1import{x as es,y as ts,d as On,J as ha,f as pi,af as ow,K as hl,L as Dr,a as Ii,e as me,t as Ct,p as Yt,s as Xt,h as vn,b as Gr,B as wi,k as At,ag as aw,n as pn,o as ei,F as Ld,z as Fd,w as kd,O as ul,Q as lw,u as cw,R as kv,N as U_,M as Bv,c as Of,l as Bf,a3 as uw,a2 as hw,a1 as dw,a5 as eo,m as $u,A as pw}from"./index-DcXg9ROm.js";import{g as Od}from"./vue3-datatable-DL8ZP2Ec.js";import{_ as Tc}from"./CustomInputSearch.vue_vue_type_script_setup_true_lang-D3PW7l-N.js";import{_ as Lr}from"./CustomButton.vue_vue_type_script_setup_true_lang-Alx29FSC.js";import{_ as qu}from"./Modal.vue_vue_type_script_setup_true_lang-CC6w2kW9.js";import{_ as bc}from"./CustomSelect.vue_vue_type_script_setup_true_lang-D-DNtqPf.js";import{_ as ua}from"./CustomInput.vue_vue_type_script_setup_true_lang-Dpd4cyCN.js";import{J as Fv}from"./job-position.service-B_gMn3hh.js";import{c as Bd,a as wc,b as fw,u as Nd,d as mw}from"./index.esm-BChMnths.js";import"./iconify-BH13CGRn.js";/* empty css */import{V as Nv}from"./vacancy.service-Cn00Ti9Z.js";import{n as _w}from"./numeral-CBTStSEg.js";import{_ as Nf}from"./CustomTextArea.vue_vue_type_script_setup_true_lang-COH2mBV5.js";import{P as cl}from"./user.state-D6bnOr5E.js";import{G as gw}from"./PhWarning.vue-D_1zjXJ7.js";import{H as yw}from"./PhProhibit.vue-CqyyqfBE.js";import{G as Vv}from"./PhArrowsClockwise.vue-BRobgkVc.js";import"./PhCaretDown.vue-CheIMR5T.js";class j_{static all(Et){return es(ts.get("https://api.chambas.ai/api/employee",{params:Et}))}static stats(){return es(ts.get("https://api.chambas.ai/api/employee/stats/internal-panel"))}static retryVerification(Et){return es(ts.post(`https://api.chambas.ai/api/employee/${Et}/retry`))}}const xw={class:"mt-5 p-6"},vw={class:"flex flex-col md:flex-row items-center gap-5 mb-4"},bw={class:"flex flex-col items-center"},ww={class:"text-2xl font-semibold"},Tw={class:"flex flex-col items-center"},Sw={class:"text-2xl font-semibold"},Ew={class:"flex flex-col items-center"},Iw={class:"text-2xl font-semibold"},Aw={class:"flex flex-col items-center"},Mw={class:"text-2xl font-semibold"},Cw={class:"flex flex-col items-center"},Pw={class:"text-2xl font-semibold"},Rw={class:"flex justify-between"},zw={class:"mt-5"},Dw={class:"flex gap-4"},Lw={class:"flex gap-4"},kw={class:"capitalize"},Fw={class:"flex"},Ow={class:"flex"},Bw=On({__name:"Employees",setup(zi){ha(()=>{Zt(),li()});const Et=pi(""),Bt=pi(0),Ye=ow({page:1,items_per_page:100}),xi=pi([]),Lt=pi(!0),Tt=pi(0),o=pi(0),Nt=pi(0),lt=pi(0),yt=pi([{field:"name",title:"Nombre",minWidth:"12em"},{field:"curp",title:"CURP"},{field:"phone",title:"Teléfono"},{field:"job_position.name",title:"Puesto"},{field:"zip_code",title:"CP"},{field:"status",title:"Estatus"},{field:"enabled",title:"Activo"},{field:"created_at",title:"Fecha de creación",minWidth:"14em"},{field:"actions",title:"",sort:!1}]),Pt=hl(),Zt=async()=>{Lt.value=!0;const[xt,Ze]=await j_.all({page:Ye.page,items_per_page:Ye.items_per_page});if(Lt.value=!1,xt){Dr("Hubo un error al tratar de obtener los candidatos, Intenta más tarde",{type:"error"});return}xi.value=Ze.data.data,Bt.value=Ze.data.total_items,Tt.value=Ze.data.total_items},li=async()=>{Lt.value=!0;const[xt,Ze]=await j_.stats();if(Lt.value=!1,xt){Dr("Hubo un error al tratar de obtener las stats, Intenta más tarde",{type:"error"});return}o.value=0,Nt.value=0,lt.value=0;for(const It of Ze.data)It.status==="verified"&&(o.value+=Number(It.total)),It.total_cv_ai&&(Nt.value+=Number(It.total_cv_ai)),It.total_cv_own&&(lt.value+=Number(It.total_cv_own))},jt=async xt=>{var It,kt;Pt.loading(!0);const[Ze]=await j_.retryVerification(xt);if(Pt.loading(!1),Ze){Zt(),Dr(((kt=(It=Ze.response)==null?void 0:It.data)==null?void 0:kt.message)||"Hubo un error al tratar de reintentar, Intenta más tarde",{type:"error"});return}Dr("Operación, exitosa",{type:"success"}),Zt()},Ke=xt=>{Ye.page=xt.current_page,Ye.items_per_page=xt.pagesize,Zt()};return(xt,Ze)=>(ei(),Ii("div",xw,[me("div",vw,[me("div",bw,[me("span",ww,Ct(Tt.value),1),Ze[1]||(Ze[1]=me("span",{class:"text-sm text-slate-500"},"Total creadas",-1))]),me("div",Tw,[me("span",Sw,Ct(o.value),1),Ze[2]||(Ze[2]=me("span",{class:"text-sm text-slate-500"},"Total verificados",-1))]),me("div",Ew,[me("span",Iw,Ct(Tt.value-o.value),1),Ze[3]||(Ze[3]=me("span",{class:"text-sm text-slate-500"},"Total errores",-1))]),me("div",Aw,[me("span",Mw,Ct(lt.value),1),Ze[4]||(Ze[4]=me("span",{class:"text-sm text-slate-500"},"Total CV's subidos",-1))]),me("div",Cw,[me("span",Pw,Ct(Nt.value),1),Ze[5]||(Ze[5]=me("span",{class:"text-sm text-slate-500"},"Total CV's generados",-1))])]),me("div",Rw,[Yt(Tc,{modelValue:Et.value,"onUpdate:modelValue":Ze[0]||(Ze[0]=It=>
1Et.value=It),placeholder:"Buscar en la tabla"},null,8,["modelValue"])]),me("div",zw,[Yt(At(Od),{rows:xi.value,columns:yt.value,loading:Lt.value,search:Et.value,isServerMode:!0,totalRows:Bt.value,pageSize:Ye.items_per_page,onChange:Ke,sortable:!0,rowClass:"global-table-row",skin:"table-global",paginationInfo:"Mostrando {0} a {1} de {2} registros",noDataContent:"Sin registros"},{curp:Xt(It=>[me("div",Dw,[me("span",null,Ct(It.value.curp.toUpperCase()),1)])]),position:Xt(It=>[me("div",Lw,[me("span",kw,Ct(It.value.position),1)])]),status:Xt(It=>[me("div",Fw,[me("span",{class:pn([[It.value.status==="verified"?"bg-green-200":"bg-red-200"],"flex items-center rounded-full px-2"])},[wi(Ct(It.value.status==="verified"?"ð¤":"ð°")+" ",1),me("span",{class:pn([[It.value.status==="verified"?"text-green-800":"text-red-900"],"text-sm ml-1 font-semibold"])},Ct(It.value.status==="verified"?"Verificado":It.value.status),3)],2)])]),enabled:Xt(It=>[me("div",Ow,[me("span",{class:pn([[It.value.enabled?"bg-green-200":"bg-red-200"],"flex items-center rounded-full px-2"])},[wi(Ct(It.value.enabled?"ð¤":"ð°")+" ",1),me("span",{class:pn([[It.value.enabled?"text-green-800":"text-red-900"],"text-sm ml-1 font-semibold"])},Ct(It.value.enabled?"Si":"No"),3)],2)])]),created_at:Xt(It=>[me("p",null,Ct(At(aw)(It.value.created_at).format("DD-MM-YYYY hh:mm a")),1)]),actions:Xt(It=>[It.value.status!=="verified"?(ei(),vn(Lr,{key:0,onClick:()=>jt(It.value.id),class:"px-2 py-1"},{default:Xt(()=>Ze[6]||(Ze[6]=[wi("Reintentar")])),_:2,__:[6]},1032,["onClick"])):Gr("",!0)]),_:1},8,["rows","columns","loading","search","totalRows","pageSize"])])]))}});class Nw{static positions(){return es(ts.get("https://api.chambas.ai/api/job-position"))}}const Vw={class:"mt-5 p-6"},Uw={class:"flex justify-between"},jw={class:"mt-5"},Gw={class:"flex"},$w={class:"flex"},qw={class:"flex justify-end"},Hw={class:"mb-4 text-xl font-bold"},Zw={class:"mt-2 w-full flex flex-col md:flex-row"},Ww={class:"mt-2 w-full"},Xw=On({__name:"Positions",setup(zi){ha(()=>{o()});const Et=hl(),Bt=pi(""),Ye=pi(null),xi=lt=>{Ye.value&&(Ye.value.open=lt)},Lt=pi([]),Tt=pi({active_on_hilos:!0,name:"",id:"",enabled:!0}),o=async()=>{Et.loading(!0);const[lt,yt]=await Nw.positions();if(Et.loading(!1),lt){Dr("Hubo un error al tratar de obtener los estados, Intenta más tarde",{type:"error"});return}Lt.value=yt.data},Nt=async()=>{Et.loading(!0);const lt=typeof Tt.value.active_on_hilos=="string"?Tt.value.active_on_hilos==="true":Tt.value.active_on_hilos,yt=typeof Tt.value.enabled=="string"?Tt.value.enabled==="true":Tt.value.enabled;if(Tt.value.id){const[Pt]=await Fv.update(Tt.value.id,{name:Tt.value.name,active_on_hilos:lt,enabled:yt});if(Pt){Et.loading(!1),Dr("Hubo un error al tratar de actualizar la posición, Intenta más tarde",{type:"error"});return}}else{const[Pt]=await Fv.create({name:Tt.value.name,enabled:yt,active_on_hilos:lt});if(Pt){Et.loading(!1),Dr("Hubo un error al tratar de crear la posición, Intenta más tarde",{type:"error"});return}}o(),Dr("Operación éxitosa",{type:"success"}),xi(!1)};return(lt,yt)=>(ei(),Ii(Ld,null,[me("div",Vw,[me("div",Uw,[Yt(Tc,{modelValue:Bt.value,"onUpdate:modelValue":yt[0]||(yt[0]=Pt=>Bt.value=Pt),placeholder:"Buscar en la tabla"},null,8,["modelValue"]),Yt(Lr,{class:"px-5 py-2 mt-4 md:mt-0",onClick:yt[1]||(yt[1]=()=>{Tt.value={id:"",active_on_hilos:!0,enabled:!0,name:""},xi(!0)})},{default:Xt(()=>yt[5]||(yt[5]=[wi(" Crear posición ")])),_:1,__:[5]})]),me("div",jw,[Yt(At(Od),{rows:Lt.value,columns:[{field:"name",title:"Nombre",sort:!0},{field:"enabled",title:"Mostrar en panel",sort:!0},{field:"active_on_hilos",title:"Mostrar en hilos",sort:!0},{field:"actions",title:""}],search:Bt.value,pageSize:10,sortable:!0,rowClass:"global-table-row",skin:"table-global",paginationInfo:"Mostrando {0} a {1} de {2} registros",sortColumn:"name",sortDirection:"asc"},{active_on_hilos:Xt(Pt=>[me("div",Gw,[me("span",{class:pn([[Pt.value.active_on_hilos?"bg-green-200":"bg-red-200"],"flex items-center rounded-full px-2"])},[wi(Ct(Pt.value.active_on_hilos?"ð¤":"ð°")+" ",1),me("span",{class:pn([[Pt.value.active_on_hilos?"text-green-800":"text-red-900"],"text-sm ml-1 font-semibold"])}
1,Ct(Pt.value.active_on_hilos?"Activo":"Inactivo"),3)],2)])]),enabled:Xt(Pt=>[me("div",$w,[me("span",{class:pn([[Pt.value.enabled?"bg-green-200":"bg-red-200"],"flex items-center rounded-full px-2"])},[wi(Ct(Pt.value.enabled?"ð¤":"ð°")+" ",1),me("span",{class:pn([[Pt.value.enabled?"text-green-800":"text-red-900"],"text-sm ml-1 font-semibold"])},Ct(Pt.value.enabled?"Activo":"Inactivo"),3)],2)])]),actions:Xt(Pt=>[me("div",qw,[Yt(Lr,{variant:"outline",class:"px-2",onClick:()=>{Tt.value=Pt.value,xi(!0)}},{default:Xt(()=>yt[6]||(yt[6]=[wi("Editar")])),_:2,__:[6]},1032,["onClick"])])]),_:1},8,["rows","search"])])]),Yt(qu,{ref_key:"modalRef",ref:Ye},{default:Xt(()=>[me("div",null,[me("p",Hw,Ct(Tt.value.id?"Editar":"Crear")+" posición",1),me("div",Zw,[Yt(bc,{id:"active-on-hilos-c",class:"w-full md:w-1/2",label:"Activo en flujo hilos",modelValue:Tt.value.active_on_hilos,"onUpdate:modelValue":yt[2]||(yt[2]=Pt=>Tt.value.active_on_hilos=Pt)},{default:Xt(()=>yt[7]||(yt[7]=[me("option",{value:!0},"Activo",-1),me("option",{value:!1},"Inactivo",-1)])),_:1,__:[7]},8,["modelValue"]),Yt(bc,{id:"enabled-c",class:"w-full md:w-1/2 md:ml-4 mt-2 md:mt-0",label:"Activo en panel",modelValue:Tt.value.enabled,"onUpdate:modelValue":yt[3]||(yt[3]=Pt=>Tt.value.enabled=Pt)},{default:Xt(()=>yt[8]||(yt[8]=[me("option",{value:!0},"Activo",-1),me("option",{value:!1},"Inactivo",-1)])),_:1,__:[8]},8,["modelValue"])]),me("div",Ww,[Yt(ua,{id:"name-c",label:"Nombre",modelValue:Tt.value.name,"onUpdate:modelValue":yt[4]||(yt[4]=Pt=>Tt.value.name=Pt),type:"text",placeholder:"Nombre"},null,8,["modelValue"])]),Yt(Lr,{"on-click":()=>Nt(),class:"px-8 py-3 mb-5 md:mb-0",color:"white"},{default:Xt(()=>[wi(Ct(Tt.value.id?"Editar":"Crear")+" posición ",1)]),_:1},8,["on-click"])])]),_:1},512)],64))}});class Ov{static all(){return es(ts.get("https://api.chambas.ai/api/user/internal-panel/all"))}static actTo(Et){return es(ts.post(`https://api.chambas.ai/api/employee/${Et}/retry`))}static update(Et,Bt){return es(ts.patch(`https://api.chambas.ai/api/user/${Et}/panel-interno`,Bt))}}const Yw=Bd({password:wc().min(6,"La contraseña debe contener mÃnimo 6 caracteres").required("Contraseña es un campo requerido"),passwordConfirm:wc().oneOf([fw("password")],"Las contraseñas deben coincidir").required("Confirmar contraseña es un campo requerido")}
1),Kw={class:"bg-white rounded-lg p-6 w-full max-w-md shadow-xl"},Jw={class:"mb-4"},Qw={class:"text-sm text-gray-600 mb-2"},eT={class:"font-semibold"},tT={class:"flex justify-end gap-3 mt-6"},iT=On({__name:"ChangePasswordModal",props:{user:{}},emits:["close","success"],setup(zi,{emit:Et}){const Bt=zi,Ye=Et,xi=pi(!1),Lt=pi(!1),{errors:Tt,meta:o,defineField:Nt,resetForm:lt}=Nd({validationSchema:Yw}),[yt,Pt]=Nt("password"),[Zt,li]=Nt("passwordConfirm");Fd(()=>Bt.user,xt=>{xi.value=!!xt,xt&<()});const jt=()=>{xi.value=!1,lt(),Ye("close")},Ke=async()=>{if(!Bt.user||!o.value.valid)return;Lt.value=!0;const[xt]=await lw.changePassword({email:Bt.user.email,password:yt.value});if(Lt.value=!1,xt){Dr("Hubo un error al cambiar la contraseña. Intenta más tarde",{type:"error"});return}Dr("Contraseña cambiada con éxito",{type:"success"}),Ye("success"),jt()};return(xt,Ze)=>{var It;return xi.value?(ei(),Ii("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:kd(jt,["self"])},[me("div",Kw,[Ze[4]||(Ze[4]=me("h2",{class:"text-2xl font-bold mb-4 text-gray-800"},"Cambiar Contraseña",-1)),me("div",Jw,[me("p",Qw,[Ze[2]||(Ze[2]=wi(" Usuario: ")),me("span",eT,Ct((It=xt.user)==null?void 0:It.email),1)])]),me("form",{onSubmit:kd(Ke,["prevent"]),class:"space-y-4"},[Yt(ua,{id:"password",modelValue:At(yt),"onUpdate:modelValue":Ze[0]||(Ze[0]=kt=>ul(yt)?yt.value=kt:null),attrs:At(Pt),error:At(Tt).password,type:"password",label:"Nueva Contraseña",placeholder:"Ingresa la nueva contraseña"},null,8,["modelValue","attrs","error"]),Yt(ua,{id:"confirmPassword",modelValue:At(Zt),"onUpdate:modelValue":Ze[1]||(Ze[1]=kt=>ul(Zt)?Zt.value=kt:null),attrs:At(li),error:At(Tt).passwordConfirm,type:"password",label:"Confirmar Contraseña",placeholder:"Confirma la nueva contraseña"},null,8,["modelValue","attrs","error"]),me("div",tT,[Yt(Lr,{"on-click":jt,disabled:Lt.value,variant:"outline",class:"px-4 py-2"},{default:Xt(()=>Ze[3]||(Ze[3]=[wi(" Cancelar ")])),_:1,__:[3]},8,["disabled"]),Yt(Lr,{"on-click":Ke,disabled:!At(o).valid||Lt.value,class:"px-4 py-2"},{default:Xt(()=>[wi(Ct(Lt.value?"Cambiando...":"Cambiar Contraseña"),1)]),_:1},8,["disabled"])])],32)])])):Gr("",!0)}}}),rT={class:"mt-5 p-6"},nT={class:"flex justify-between"},sT={class:"mt-5"},oT=["href"],aT=["href"],lT=["href"],cT=["value"],uT=["value"],hT={class:"flex"},dT={class:"flex items-center gap-2 justify-end"},pT=On({__name:"Users",setup(zi){ha(()=>{Nt()});const Et=hl(),Bt=cw(),Ye=Bv(),xi=pi(""),Lt=pi([]),Tt=pi(null),o=[{field:"admin.email",title:"Dueño plantilla",sort:!0},{field:"name",title:"Nombre",sort:!0},{field:"email",title:"Email",sort:!0},{field:"phone",title:"Teléfono",sort:!0},{field:"deleted_at",title:"Estatus",sort:!0},{field:"role",title:"Rol",sort:!0,minWidth:"13.5em"},{field:"actions",title:"",minWidth:"26em",sort:!1}],Nt=async()=>{Et.loading(!0);const[li,jt]=await Ov.all();if(Et.loading(!1),li){Dr("Hubo un error al tratar de obtener los usuarios, Intenta más tarde",{type:"error"});return}Lt.value=jt.data.map(Ke=>({...Ke,phone:Ke.phone?`+${Ke.lada}${Ke.phone}`:void 0}))},lt=async li=>{Et.loading(!0);const[jt]=await Bt.actTo({id:li});if(jt){Et.loading(!1),Dr("Hubo un error al tratar de actuar como usuario, Intenta más tarde",{type:"error"});return}await Ye.push({name:"home"}),setTimeout(()=>{location.reload()},500)},yt=async li=>{Et.loading(!0);const[jt]=await Ov.update(li.id,{role:li.role});if(Et.loading(!1),jt){Dr("Hubo un error al tratar de cambiar el rol, Intenta más tarde",{type:"error"});return}Dr("Rol cambiado con éxito",{type:"success"})},Pt=li=>{Tt.value=li},Zt=()=>{Tt.value=null};return(li,jt)=>(ei(),Ii("div",rT,[me("div",nT,[Yt(Tc,{modelValue:xi.value,"onUpdate:modelValue":jt[0]||(jt[0]=Ke=>xi.value=Ke),placeholder:"Buscar en la tabla"},null,8,["modelValue"])]),me("div",sT,[Yt(At(Od),{rows:Lt.value,columns:o,search:xi.value,pageSize:50,sortable:!0,rowClass:"global-table-row",skin:"table-global",paginationInfo:"Mostrando {0} a {1} de {2} registros",sortColumn:"created_at",sortDirection:"asc"},{phone:Xt(Ke=>[Ke.value.phone?(ei(),Ii("a",{key:0,class:"flex items-center text-slate-900 font-semibold hover:underline hover:cursor-pointer gap-1",href:`https://wa.me/+${Ke.value.lada}${Ke.value.phone}`,target:"_blank"},[Yt(At(U_.Icon),{icon:"mdi:whatsapp",class:"text-green-600 w-4 h-4"}),me("span",null,Ct(Ke.value.phone),1)],8,oT)):Gr("",!0),jt[4]||(jt[4]=me("span",null,null,-1))]),email:Xt(Ke=>[me("a",{onClick:jt[1]||(jt[1]=kd(()=>{},["stop"])),class:"font-semibold hover:underline flex items-center gap-1",href:`mailto:${Ke.value.email}`},[Yt(At(U_.Icon),{icon:"lsicon:export-outline",class:"text-xs"}),wi(" "+Ct(Ke.value.email),1)],8,aT)]),"admin.email":Xt(Ke=>{var xt;return[(xt=Ke.value.admin)!=null&&xt.email&&Ke.value.admin.email!==Ke.value.email?(ei(),Ii("a",{key:0,onClick:jt[2]||(jt[2]=kd(()=>{},["stop"])),class:"font-semibold hover:underline flex items-center gap-1",href:`mailto:${Ke.value.admin.email}`},[Yt(At(U_.Icon),{icon:"lsicon:export-outline",class:"text-xs"}),wi(" "+Ct(Ke.value.admin.email),1)],8,lT)):Gr("",!0)]}),role:Xt(Ke=>[Yt(bc,{height:"20px","custom-class":"py-1",class:"w-full",id:"role-c","show-error":!1,modelValue:Ke.value.role,"onUpdate:modelValue":[xt=>Ke.value.role=xt,xt=>yt(Ke.value)]},{default:Xt(()=>[me("option",{value:At(kv).RECRUITER},"ð¥ Reclutador",8,cT),me("option",{value:At(kv).ADMIN},"ð ï¸ Administrador",8,uT)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),deleted_at:Xt(Ke=>[me("div",hT,[me("span",{class:pn([[Ke.value.deleted_at?"bg-red-200":"bg-green-200"],"flex items-center rounded-full px-2"])},[wi(Ct(Ke.value.deleted_at?"ð°":"ð¤")+" ",1),me("span",{class:pn([[Ke.value.deleted_at?"text-red-900":"text-green-800"],"text-sm ml-1 font-semibold"])},Ct(Ke.value.deleted_at?"Inactivo":"Activo"),3)],2)])]),actions:Xt(Ke=>[me("div",dT,[Yt(Lr,{class:"px-2 py-0.5 text-sm",variant:"outline",onClick:()=>Pt(Ke.value)},{default:Xt(()=>jt[5]||(jt[5]=[wi(" Cambiar contraseña ")])),_:2,__:[5]},1032,["onClick"]),Yt(Lr,{class:"px-2 py-0.5 text-sm",onClick:()=>lt(Ke.value.id)},{default:Xt(()=>jt[6]||(jt[6]=[wi(" Iniciar sesión ")])),_:2,__:[6]},1032,["onClick"])])]),_:1},8,["rows","search"])]),Yt(iT,{user:Tt.value,onSuccess:Zt,onClose:jt[3]||(jt[3]=()=>Tt.value=null)},null,8,["user"])]))}}),fT=zi=>es(ts.post("https://api.chambas.ai/api/message-outbound",zi)),mT=()=>({create:async Et=>{const[Bt,Ye]=await fT(Et);return Bt?[Bt]:[void 0,Ye]}}),_T={class:"mt-8"},gT={class:"mt-6"},yT={class:"border border-blue-gray-100 p-6 rounded-2xl"},xT={class:"flex items-center mt-4 gap-4"},vT={key:0,class:"mt-4 flex items-center justify-center py-4"},bT={key:1,class:"border border-blue-gray-100 p-2 rounded-2xl"},wT={key:2,class:"border-2 border-green-800 rounded-2xl py-3 px-5"},TT={class:"flex"},ST={class:"text-sm text-green-800 font-semibold"},ET={key:0,class:"grid grid-cols-2 gap-4"},IT={class:"border border-blue-gray-100 p-6 rounded-2xl mt-3"},AT={class:"mb-4"},MT={class:"space-y-3 max-h-96 overflow-y-auto"},CT={key:0,class:"text-sm text-slate-500 italic p-2"},PT=["id","checked","onChange"],RT=["for"],zT={class:"flex items-center justify-between"},DT={class:"flex items-center text-xs"},LT={class:"text-gray-700 ml-2 font-medium"},kT={class:"flex items-center"},FT={class:"flex items-center text-xs"},OT={class:"text-gray-700 ml-2 font-medium"},BT={class:"flex items-center text-xs"},NT={class:"text-gray-500 ml-2"},VT={class:"flex items-center text-xs"},UT={class:"text-gray-500 ml-2"},jT={class:"flex items-center text-xs"},GT={class:"text-gray-500 ml-2"},$T={class:"flex"},qT={key:0,class:"mt-4 bg-blue-gray-100 py-1 px-5 rounded-2xl text-sm"},HT={key:0,class:"border border-blue-gray-100 p-6 rounded-2xl mt-3"},ZT={key:0,class:"mt-4"},WT={key:0,class:"space-y-3 mb-4"},XT={class:"flex-1"},YT={class:"flex-1"},KT={class:"border border-dashed border-gray-300 rounded-lg p-4"},JT={class:"flex items-start gap-2"},QT={class:"flex-1"},e2={class:"flex-1"},t2={class:"mt-4 p-3 bg-blue-gray-100 rounded-lg"},i2={class:"text-xs text-blue-gray-900 bg-white p-2 rounded border overflow-x-auto"},r2=On({__name:"MessagesOutbound",setup(zi){const{create:Et}=mT(),{loading:Bt}=hl(),Ye=pi(),xi=pi(!1),Lt=pi(""),Tt=pi(""),o=pi([]),Nt=pi("068cb27d-0e8c-7159-8000-56c1cf787c57"),lt=pi(""),yt=pi([]),Pt=pi([]),Zt=pi({}),li=pi(""),jt=pi(""),Ke=Of(()=>lt.value?yt.value.filter(ci=>{var vi,Kt,ki,Ji,Xr,Bn,cn,Zi,Jr;const Vt=lt.value.toLowerCase();return((Kt=(vi=ci.job_position)==null?void 0:vi.name)==null?void 0:Kt.toLowerCase().includes(Vt))||((ki=ci.name)==null?void 0:ki.toLowerCase().includes(Vt))||((Xr=(Ji=ci.company)==null?void 0:Ji.name)==null?void 0:Xr.toLowerCase().includes(Vt))||((cn=(Bn=ci.assigned_to)==null?void 0:Bn.name)==null?void 0:cn.toLowerCase().includes(Vt))||((Jr=(Zi=ci.assigned_to)==null?void 0:Zi.email)==null?void 0:Jr.toLowerCase().includes(Vt))}):yt.value);ha(()=>{xt()});const xt=async()=>{try{const[ci,Vt]=await Nv.getAllSudo();
1if(ci){Dr("Hubo un error al tratar de obtener las vacantes, Intenta más tarde",{type:"error"});return}yt.value=Vt.data}catch(ci){console.error("Error fetching vacancies:",ci)}},Ze=ci=>{lt.value=ci},It=ci=>Pt.value.some(Vt=>Vt.id===ci.id),kt=ci=>{const Vt=Pt.value.findIndex(vi=>vi.id===ci.id);Vt>-1?Pt.value.splice(Vt,1):Pt.value.push(ci)},Rt=()=>{li.value&&jt.value&&(Zt.value[li.value]=jt.value,li.value="",jt.value="")},wt=ci=>{delete Zt.value[ci]},Or=(ci,Vt)=>{if(Vt&&Vt!==ci&&!Zt.value[Vt]){const vi=Zt.value[ci];delete Zt.value[ci],Zt.value[Vt]=vi}},ln=(ci,Vt)=>{Zt.value[ci]=Vt},bn=async ci=>{var Kt;const vi=(Kt=ci.target.files)==null?void 0:Kt[0];if(vi){Lt.value="",Tt.value="",o.value=[],xi.value=!0;try{const Ji=(await Rn(vi)).trim().split(` 2`),Xr=Ji[0].split(",").map(cn=>cn.trim().replace(/"/g,"").toLowerCase());if(Xr.includes("lead_id")){const cn=Xr.indexOf("lead_id"),Zi=[];for(let Jr=1;Jr<Ji.length;Jr++){const Ts=Ji[Jr].split(",").map(to=>to.trim().replace(/"/g,""))[cn];Ts&&Ts!==""&&Zi.push(Ts)}o.value=Zi,Tt.value=`â Archivo procesado exitosamente. Columna 'lead_id' encontrada con ${Zi.length} ids.`}else Lt.value='â No se encontró la columna "lead_id".'}catch{Lt.value="â Error al procesar el archivo CSV."}finally{xi.value=!1}}},Rn=ci=>new Promise((Vt,vi)=>{const Kt=new FileReader;Kt.onload=ki=>{var Ji;return Vt((Ji=ki.target)==null?void 0:Ji.result)},Kt.onerror=()=>vi(new Error("Error al leer el archivo")),Kt.readAsText(ci,"UTF-8")}),zs=async()=>{Bt(!0);const ci=1e3,Vt=o.value.length,vi=Pt.value.map(Kt=>Kt.id);for(let Kt=0;Kt<Vt;Kt+=ci){const ki=o.value.slice(Kt,Kt+ci),[Ji]=await Et({type:"pagination-vacancies",flow_id:Nt.value,variables:Zt.value,lead_ids:ki,vacancy_ids:vi});if(Ji){Bt(!1),Dr("Hubo un error al tratar de despachar los flujos, Intenta más tarde",{type:"error"});return}}Dr("Flujos despachados exitosamente",{type:"success"}),Bt(!1)};return(ci,Vt)=>(ei(),Ii("div",_T,[Yt(At(Lr),{onClick:Vt[0]||(Vt[0]=()=>ci.$emit("back")),class:"py-2 px-8",variant:"outline"},{default:Xt(()=>Vt[5]||(Vt[5]=[wi(" Regresar ")])),_:1,__:[5]}),me("div",gT,[Vt[21]||(Vt[21]=me("h1",{class:"font-semibold mb-6"},"Mensajes outbound -> Paginador de vacantes",-1)),me("div",yT,[Vt[7]||(Vt[7]=me("h1",{class:"font-medium text-sm"},"Paso 1. Cargar archivo CSV (debe contener la columna lead_id)",-1)),me("div",xT,[xi.value?(ei(),Ii("div",vT,Vt[6]||(Vt[6]=[me("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"},null,-1),me("span",{class:"ml-2 text-sm text-gray-600"},"Analizando archivo CSV...",-1)]))):(ei(),Ii("div",bT,[me("input",{ref_key:"fileInput",ref:Ye,type:"file",accept:".csv",onChange:bn,class:"block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-8 file:border-0 file:text-sm file:font-semibold file:bg-secondary-green file:text-white file:rounded-2xl cursor-pointer"},null,544)])),Tt.value||Lt.value?(ei(),Ii("div",wT,[me("div",TT,[me("p",ST,Ct(Tt.value||Lt.value),1)])])):Gr("",!0)])]),Tt.value?(ei(),Ii("div",ET,[me("div",IT,[Vt[14]||(Vt[14]=me("h1",{class:"font-medium text-sm mb-4"},"Paso 2. Seleccionar las vacantes de las que se enviará el mensaje",-1)),me("div",AT,[Yt(At(Tc),{"bg-color":"bg-white",placeholder:"Buscar vacantes...","model-value":lt.value,"onUpdate:modelValue":Ze},null,8,["model-value"])]),me("div",MT,[Ke.value.length===0?(ei(),Ii("div",CT," No se encontraron vacantes ")):(ei(!0),Ii(Ld,{key:1},Bf(Ke.value,vi=>{var Kt,ki,Ji,Xr;return ei(),Ii("div",{key:vi.id,class:"flex items-center p-3 border border-blue-gray-200 rounded-lg hover:border-blue-gray-300 hover:bg-blue-gray-50"},[me("input",{type:"checkbox",id:"vacancy-"+vi.id,checked:It(vi),onChange:Bn=>kt(vi),class:"h-4 w-4 accent-secondary-green rounded"},null,40,PT),me("label",{for:"vacancy-"+vi.id,class:"ml-3 text-sm flex-grow cursor-pointer space-y-1"},[me("div",zT,[me("div",DT,[Vt[8]||(Vt[8]=me("span",{class:"text-blue-gray-400"},"Id:",-1)),me("span",LT,Ct(vi.id),1)]),me("div",kT,[me("span",{class:pn(["font-semibold rounded-full text-xs px-2 py-0.5",[vi.status==="disable"?"bg-red-200 text-red-800":"bg-green-200 text-green-800"]])},Ct(vi.status==="enable"?"Activa":"Inactiva"),3)])]),me("div",FT,[Vt[9]||(Vt[9]=me("span",{class:"text-blue-gray-400"},"Nombre:",-1)),me("span",OT,Ct(vi.name),1)]),me("div",BT,[Vt[10]||(Vt[10]=me
2("span",{class:"text-blue-gray-400"},"Puesto:",-1)),me("span",NT,Ct((Kt=vi.job_position)==null?void 0:Kt.name),1)]),me("div",VT,[Vt[11]||(Vt[11]=me("span",{class:"text-blue-gray-400"},"Empresa:",-1)),me("span",UT,Ct((ki=vi.company)==null?void 0:ki.name),1)]),me("div",jT,[Vt[12]||(Vt[12]=me("span",{class:"text-blue-gray-400"},"Agente:",-1)),me("span",GT,Ct((Ji=vi.assigned_to)==null?void 0:Ji.name)+" | "+Ct((Xr=vi.assigned_to)==null?void 0:Xr.email),1)])],8,RT)])}),128))]),me("div",$T,[Pt.value.length?(ei(),Ii("div",qT,[Vt[13]||(Vt[13]=wi(" Vacantes seleccionadas: ")),me("strong",null,Ct(Pt.value.length),1)])):Gr("",!0)])]),Pt.value.length?(ei(),Ii("div",HT,[Vt[20]||(Vt[20]=me("h1",{class:"font-medium text-sm mb-4"},"Paso 3. Seleccionar el flujo",-1)),Yt(At(ua),{label:"Ingresa el Flow ID",id:"flow",modelValue:Nt.value,"onUpdate:modelValue":Vt[1]||(Vt[1]=vi=>Nt.value=vi),autofocus:!0},null,8,["modelValue"]),Nt.value?(ei(),Ii("div",ZT,[Vt[19]||(Vt[19]=me("h2",{class:"font-medium text-sm mb-3"},"Variables del flujo",-1)),Object.keys(Zt.value).length>0?(ei(),Ii("div",WT,[(ei(!0),Ii(Ld,null,Bf(Zt.value,(vi,Kt)=>(ei(),Ii("div",{key:Kt,class:"flex items-start gap-2 p-3 bg-gray-50 rounded-lg"},[me("div",XT,[Yt(At(ua),{id:"var-name-"+Kt,label:"Nombre de variable","model-value":Kt,"onUpdate:modelValue":ki=>Or(Kt,ki),placeholder:"nombre_variable"},null,8,["id","model-value","onUpdate:modelValue"])]),me("div",YT,[Yt(At(ua),{id:"var-value-"+Kt,label:"Valor","model-value":vi,"onUpdate:modelValue":ki=>ln(Kt,ki),placeholder:"valor de la variable"},null,8,["id","model-value","onUpdate:modelValue"])]),Yt(At(Lr),{variant:"outline",class:"px-3 py-2",onClick:ki=>wt(Kt)},{default:Xt(()=>Vt[15]||(Vt[15]=[wi(" Eliminar ")])),_:2,__:[15]},1032,["onClick"])]))),128))])):Gr("",!0),me("div",KT,[Vt[17]||(Vt[17]=me("h3",{class:"text-sm font-medium text-gray-700 mb-3"},"Agregar nueva variable",-1)),me("div",JT,[me("div",QT,[Yt(At(ua),{id:"new-var-name",label:"Nombre de variable",modelValue:li.value,"onUpdate:modelValue":Vt[2]||(Vt[2]=vi=>li.value=vi),placeholder:"nombre_variable"},null,8,["modelValue"])]),me("div",e2,[Yt(At(ua),{id:"new-var-value",label:"Valor",modelValue:jt.value,"onUpdate:modelValue":Vt[3]||(Vt[3]=vi=>jt.value=vi),placeholder:"valor de la variable"},null,8,["modelValue"])]),Yt(At(Lr),{class:"px-4 py-2",disabled:!li.value||!jt.value,onClick:Rt},{default:Xt(()=>Vt[16]||(Vt[16]=[wi(" Agregar ")])),_:1,__:[16]},8,["disabled"])])]),me("div",t2,[Vt[18]||(Vt[18]=me("h3",{class:"text-sm font-medium text-blue-gray-900 mb-2"},"Preview del objeto meta:",-1)),me("pre",i2,Ct(JSON.stringify(Zt.value,null,2)),1)]),Yt(At(Lr),{class:"w-full mt-8 px-8 py-3 font-semibold",onClick:Vt[4]||(Vt[4]=vi=>zs())},{default:Xt(()=>[wi(" Despachar "+Ct(o.value.length)+" flujos ",1)]),_:1})])):Gr("",!0)])):Gr("",!0)])):Gr("",!0)])]))}}),n2=()=>{const zi=pi([]),Et=pi([]),Bt=pi(!1);return{vacancies:zi,isLoading:Bt,fetchActiveVacancies:async()=>{Bt.value=!0;const[Lt,Tt]=await Nv.getAllSudo();if(Lt){Dr("Hubo un error al tratar de obtener las vacantes, Intenta más tarde",{type:"error"}),Bt.value=!1;return}const Nt=Tt.data.filter(lt=>lt.status==="enable");zi.value=Nt,Et.value=Nt,Bt.value=!1},searchVacancies:Lt=>{if(!Lt){zi.value=Et.value;return}zi.value=Et.value.filter(Tt=>{var Nt,lt,yt,Pt,Zt,li,jt,Ke,xt;const o=Lt.toLowerCase();return((lt=(Nt=Tt.job_position)==null?void 0:Nt.name)==null?void 0:lt.toLowerCase().includes(o))||((yt=Tt.name)==null?void 0:yt.toLowerCase().includes(o))||((Zt=(Pt=Tt.company)==null?void 0:Pt.name)==null?void 0:Zt.toLowerCase().includes(o))||((jt=(li=Tt.assigned_to)==null?void 0:li.name)==null?void 0:jt.toLowerCase().includes(o))||((xt=(Ke=Tt.assigned_to)==null?void 0:Ke.email)==null?void 0:xt.toLowerCase().includes(o))})}}},s2={class:"mb-8"},o2={class:"space-y-3 flex-grow overflow-y-auto mt-6 max-h-96"},a2={key:0,class:"text-sm text-slate-500 italic p-2 text-center"},l2={key:1,class:"text-sm text-slate-500 italic p-2"},c2=["id","onChange"],u2=["for"],h2={class:"flex items-center text-xs"},d2={class:"text-gray-500 ml-2"},p2={class:"flex items-center text-xs"},f2={class:"text-gray-500 ml-2"},m2={class:"flex items-center text-xs"},_2={class:"text-gray-500 ml-2"},g2={class:"flex items-center text-xs"},y2={class:"text-gray-500 ml-2"},x2={class:"flex items-center text-xs"},v2={class:"text-gray-500 ml-2"}
2,b2={class:"flex flex-col-reverse md:flex-row justify-end mt-6 gap-4"},w2=On({__name:"VacancySelectionModal",emits:["vacancy-selected"],setup(zi,{expose:Et,emit:Bt}){const Ye=pi(null),xi=pi(""),Lt=pi(null),{vacancies:Tt,isLoading:o,fetchActiveVacancies:Nt,searchVacancies:lt}=n2(),yt=Bt;ha(()=>{Nt()});const Pt=Ke=>{xi.value=Ke,lt(Ke)},Zt=()=>{Ye.value.open=!0,Lt.value=null},li=()=>{Ye.value.open=!1,Lt.value=null},jt=()=>{Lt.value&&(yt("vacancy-selected",Lt.value),li())};return Et({openModal:Zt}),(Ke,xt)=>(ei(),vn(At(qu),{ref_key:"modalRef",ref:Ye},{buttons:Xt(()=>[me("div",b2,[Yt(Lr,{variant:"outline",class:"px-14 py-3","on-click":li},{default:Xt(()=>xt[5]||(xt[5]=[wi(" Cancelar ")])),_:1,__:[5]}),Yt(Lr,{disabled:!Lt.value,"on-click":jt,class:"px-14 py-3"},{default:Xt(()=>xt[6]||(xt[6]=[wi(" Seleccionar vacante ")])),_:1,__:[6]},8,["disabled"])])]),default:Xt(()=>[xt[7]||(xt[7]=me("p",{class:"font-bold text-2xl mb-8"}," Seleccionar vacante ",-1)),me("div",s2,[Yt(Tc,{"bg-color":"bg-white",placeholder:"Buscar vacantes...","model-value":xi.value,"onUpdate:modelValue":Pt},null,8,["model-value"]),me("div",o2,[At(o)?(ei(),Ii("div",a2," Cargando vacantes... ")):At(Tt).length===0?(ei(),Ii("div",l2," No se encontraron vacantes activas ")):(ei(!0),Ii(Ld,{key:2},Bf(At(Tt),Ze=>{var It,kt,Rt,wt;return ei(),Ii("div",{key:Ze.id,class:"flex items-center p-3 border border-blue-gray-200 rounded-lg hover:border-blue-gray-300 hover:bg-blue-gray-50 cursor-pointer"},[me("input",{type:"radio",id:"vacancy-"+Ze.id,onChange:Or=>Lt.value=Ze,name:"vacancy-selection",class:"h-4 w-4 accent-slate-900 p-1 rounded-lg"},null,40,c2),me("label",{for:"vacancy-"+Ze.id,class:"ml-2 text-sm flex-grow cursor-pointer space-y-1"},[me("div",h2,[xt[0]||(xt[0]=me("span",{class:"text-blue-gray-400"},"Id:",-1)),me("span",d2,Ct(Ze.id),1)]),me("div",p2,[xt[1]||(xt[1]=me("span",{class:"text-blue-gray-400"},"Nombre:",-1)),me("span",f2,Ct(Ze.name||((It=Ze.job_position)==null?void 0:It.name)),1)]),me("div",m2,[xt[2]||(xt[2]=me("span",{class:"text-blue-gray-400"},"Empresa:",-1)),me("span",_2,Ct((kt=Ze.company)==null?void 0:kt.name),1)]),me("div",g2,[xt[3]||(xt[3]=me("span",{class:"text-blue-gray-400"},"Agente:",-1)),me("span",y2,Ct((Rt=Ze.assigned_to)==null?void 0:Rt.name)+" | "+Ct((wt=Ze.assigned_to)==null?void 0:wt.email),1)]),me("div",x2,[xt[4]||(xt[4]=me("span",{class:"text-blue-gray-400"},"Dirección:",-1)),me("span",v2,Ct(Ze.formatted_address),1)])],8,u2)])}),128))])])]),_:1,__:[7]},512))}});var Uv={exports:{}};(function(zi,Et){(function(Bt,Ye){zi.exports=Ye()})(hw,function(){var Bt,Ye,xi;function Lt(o,Nt){if(!Bt)Bt=Nt;else if(!Ye)Ye=Nt;else{var lt="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+Bt+")(sharedChunk); ("+Ye+")(sharedChunk); self.onerror = null;",yt={};Bt(yt),xi=Nt(yt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(xi.workerUrl=window.URL.createObjectURL(new Blob([lt],{type:"text/javascript"})))}}Lt(["exports"],function(o){var Nt=1e-6,lt=typeof Float32Array<"u"?Float32Array:Array;function yt(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i*u-a*s;return h?(r[0]=u*(h=1/h),r[1]=-s*h,r[2]=-a*h,r[3]=i*h,r):null}function Pt(){var r=new lt(9);return lt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Zt(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8];return r[0]=h*v-f*g,r[1]=a*g-s*v,r[2]=s*f-a*h,r[3]=f*_-u*v,r[4]=i*v-a*_,r[5]=a*u-i*f,r[6]=u*g-h*_,r[7]=s*_-i*g,r[8]=i*h-s*u,r}function li(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=i[0],E=i[1],A=i[2],P=i[3],D=i[4],F=i[5],j=i[6],G=i[7],R=i[8];return r[0]=w*s+E*h+A*g,r[1]=w*a+E*f+A*v,r[2]=w*u+E*_+A*b,r[3]=P*s+D*h+F*g,r[4]=P*a+D*f+F*v,r[5]=P*u+D*_+F*b,r[6]=j*s+G*h+R*g,r[7]=j*a+G*f+R*v,r[8]=j*u+G*_+R*b,r}function jt(){var r=new lt(16);return lt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function Ke(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function xt(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=e[9],w=e[10],E=e[11],A=e[12],P=e[13],D=e[14],F=e[15],j=i*f-s*h,G=i*_-a*h,R=i*g-u*h,N=s*_-a*f,$=s*g-u*f,Z=a*g-u*_,oe=v*P-b*A,re=v*D-w*A,ae=v*F-E*A,he=b*D-w*P,Se=b*F-E*P,Be=w*F-E*D,ze=j*Be-G*Se+R*he+N*ae-$*re+Z*oe;return ze?(r[0]=(f*Be-_*Se+g*he)*(ze=1/ze),r[1]=(a*Se-s*Be-u*he)*ze,r[2]=(P*Z-D*$+F*N)*ze,r[3]=(w*$-b*Z-E*N)*ze,r[4]=(_*ae-h*Be-g*re)*ze,r[5]=(i*Be-a*ae+u*re)*ze,r[6]=(D*R-A*Z-F*G)*ze,r[7]=(v*Z-w*R+E*G)*ze,r[8]=(h*Se-f*ae+g*oe)*ze,r[9]=(s*ae-i*Se-u*oe)*ze,r[10]=(A*$-P*R+F*j)*ze,r[11]=(b*R-v*$-E*j)*ze,r[12]=(f*re-h*he-_*oe)*ze,r[13]=(i*he-s*re+a*oe)*ze,r[14]=(P*G-A*N-D*j)*ze,r[15]=(v*N-b*G+w*j)*ze,r):null}
2function Ze(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],E=e[10],A=e[11],P=e[12],D=e[13],F=e[14],j=e[15],G=i[0],R=i[1],N=i[2],$=i[3];return r[0]=G*s+R*f+N*b+$*P,r[1]=G*a+R*_+N*w+$*D,r[2]=G*u+R*g+N*E+$*F,r[3]=G*h+R*v+N*A+$*j,r[4]=(G=i[4])*s+(R=i[5])*f+(N=i[6])*b+($=i[7])*P,r[5]=G*a+R*_+N*w+$*D,r[6]=G*u+R*g+N*E+$*F,r[7]=G*h+R*v+N*A+$*j,r[8]=(G=i[8])*s+(R=i[9])*f+(N=i[10])*b+($=i[11])*P,r[9]=G*a+R*_+N*w+$*D,r[10]=G*u+R*g+N*E+$*F,r[11]=G*h+R*v+N*A+$*j,r[12]=(G=i[12])*s+(R=i[13])*f+(N=i[14])*b+($=i[15])*P,r[13]=G*a+R*_+N*w+$*D,r[14]=G*u+R*g+N*E+$*F,r[15]=G*h+R*v+N*A+$*j,r}function It(r,e,i){var s,a,u,h,f,_,g,v,b,w,E,A,P=i[0],D=i[1],F=i[2];return e===r?(r[12]=e[0]*P+e[4]*D+e[8]*F+e[12],r[13]=e[1]*P+e[5]*D+e[9]*F+e[13],r[14]=e[2]*P+e[6]*D+e[10]*F+e[14],r[15]=e[3]*P+e[7]*D+e[11]*F+e[15]):(a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],E=e[10],A=e[11],r[0]=s=e[0],r[1]=a,r[2]=u,r[3]=h,r[4]=f,r[5]=_,r[6]=g,r[7]=v,r[8]=b,r[9]=w,r[10]=E,r[11]=A,r[12]=s*P+f*D+b*F+e[12],r[13]=a*P+_*D+w*F+e[13],r[14]=u*P+g*D+E*F+e[14],r[15]=h*P+v*D+A*F+e[15]),r}function kt(r,e,i){var s=i[0],a=i[1],u=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*u,r[9]=e[9]*u,r[10]=e[10]*u,r[11]=e[11]*u,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Rt(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[4],h=e[5],f=e[6],_=e[7],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*a+g*s,r[5]=h*a+v*s,r[6]=f*a+b*s,r[7]=_*a+w*s,r[8]=g*a-u*s,r[9]=v*a-h*s,r[10]=b*a-f*s,r[11]=w*a-_*s,r}function wt(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a-g*s,r[1]=h*a-v*s,r[2]=f*a-b*s,r[3]=_*a-w*s,r[8]=u*s+g*a,r[9]=h*s+v*a,r[10]=f*s+b*a,r[11]=_*s+w*a,r}function Or(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[4],v=e[5],b=e[6],w=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a+g*s,r[1]=h*a+v*s,r[2]=f*a+b*s,r[3]=_*a+w*s,r[4]=g*a-u*s,r[5]=v*a-h*s,r[6]=b*a-f*s,r[7]=w*a-_*s,r}function ln(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function bn(r,e,i){var s,a,u,h=i[0],f=i[1],_=i[2],g=Math.hypot(h,f,_);return g<Nt?null:(h*=g=1/g,f*=g,_*=g,s=Math.sin(e),a=Math.cos(e),r[0]=h*h*(u=1-a)+a,r[1]=f*h*u+_*s,r[2]=_*h*u-f*s,r[3]=0,r[4]=h*f*u-_*s,r[5]=f*f*u+a,r[6]=_*f*u+h*s,r[7]=0,r[8]=h*_*u+f*s,r[9]=f*_*u-h*s,r[10]=_*_*u+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Rn(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i+i,f=s+s,_=a+a,g=i*h,v=s*h,b=s*f,w=a*h,E=a*f,A=a*_,P=u*h,D=u*f,F=u*_;return r[0]=1-b-A,r[1]=v+F,r[2]=w-D,r[3]=0,r[4]=v-F,r[5]=1-g-A,r[6]=E+P,r[7]=0,r[8]=w+D,r[9]=E-P,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var zs=Ze;function ci(){var r=new lt(3);return lt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Vt(r){var e=new lt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function vi(r){return Math.hypot(r[0],r[1],r[2])}function Kt(r,e,i){var s=new lt(3);return s[0]=r,s[1]=e,s[2]=i,s}function ki(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function Ji(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function Xr(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function Bn(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r}function cn(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r}function Zi(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function Jr(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r}function is(r,e){var i=e[0]-r[0],s=e[1]-r[1],a=e[2]-r[2];return i*i+s*s+a*a}function Ts(r){var e=r[0],i=r[1],s=r[2];return e*e+i*i+s*s}function to(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Tr(r,e){var i=e[0],s=e[1],a=e[2],u=i*i+s*s+a*a;return u>0&&(u=1/Math.sqrt(u)),r[0]=e[0]*u,r[1]=e[1]*u,r[2]=e[2]*u,r}function Br(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Yr(r,e,i){var s=e[0],a=e[1],u=e[2],h=i[0],f=i[1],_=i[2];return r[0]=a*_-u*f,r[1]=u*h-s*_,r[2]=s*f-a*h,r}function rs(r,e,i,s){var a=e[0],u=e[1],h=e[2];return r[0]=a+s*(i[0]-a),r[1]=u+s*(i[1]-u),r[2]=h+s*(i[2]-h),r}function dr(r,e,i){var s=e[0],a=e[1],u=e[2],h=i[3]*s+i[7]*a+i[11]*u+i[15];return r[0]=(i[0]*s+i[4]*a+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*s+i[5]*a+i[9]*u+i[13])/h,r[2]=(i[2]*s+i[6]*a+i[10]*u+i[14])/h,r}function da(r,e,i){var s=e[0],a=e[1],u=e[2];return r[0]=s*i[0]+a*i[3]+u*i[6],r[1]=s*i[1]+a*i[4]+u*i[7],r[2]=s*i[2]+a*i[5]+u*i[8],r}function Ds(r,e,i){var s=i[0],a=i[1],u=i[2],h=e[0],f=e[1],_=e[2],g=a*_-u*f,v=u*h-s*_,b=s*f-a*h,w=a*b-u*v,E=u*g-s*b,A=s*v-a*g,P=2*i[3];return v*=P,b*=P,E*=2,A*=2,r[0]=h+(g*=P)+(w*=2),r[1]=f+v+E,r[2]=_+b+A,r}function ps(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var Nr=Ji,pa=Xr,io=vi;function wn(){var r=new lt(4);return lt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Lo(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r}function dl(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i*i+s*s+a*a+u*u;return h>0&&(h=1/Math.sqrt(h)),r[0]=i*h,r[1]=s*h,r[2]=a*h,r[3]=u*h,r}function Tn(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3];return r[0]=i[0]*s+i[4]*a+i[8]*u+i[12]*h,r[1]=i[1]*s+i[5]*a+i[9]*u+i[13]*h,r[2]=i[2]*s+i[6]*a+i[10]*u+i[14]*h,r[3]=i[3]*s+i[7]*a+i[11]*u+i[15]*h,r}function Nn(){var r=new lt(4);return lt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function ro(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function no(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_+h*f,r[1]=a*_+u*f,r[2]=u*_-a*f,r[3]=h*_-s*f,r}function so(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_-u*f,r[1]=a*_+h*f,r[2]=u*_+s*f,r[3]=h*_-a*f,r}ci(),wn();var Sn,fa,ma,Vn,pl,Ls=dl,_a=(Sn=ci(),fa=Kt(1,0,0),ma=Kt(0,1,0),function(r,e,i){var s=Br(e,i);return s<-.999999?(Yr(Sn,fa,e),io(Sn)<1e-6&&Yr(Sn,ma,e),Tr(Sn,Sn),function(a,u,h){h*=.5;var f=Math.sin(h);a[0]=f*u[0],a[1]=f*u[1],a[2]=f*u[2],a[3]=Math.cos(h)}(r,Sn,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Yr(Sn,e,i),r[0]=Sn[0],r[1]=Sn[1],r[2]=Sn[2],r[3]=1+s,Ls(r,r))});function fn(){var r=new lt(2);return lt!=Float32Array&&(r[0]=0,r[1]=0),r}function ns(r,e){var i=new lt(2);return i[0]=r,i[1]=e,i}function ko(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function oo(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function Fo(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function ao(r){return Math.hypot(r[0],r[1])}function ga(r,e){var i=e[0],s=e[1],a=i*i+s*s;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function yr(r,e){return r[0]*e[0]+r[1]*e[1]}function lo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Nn(),Nn(),Pt(),fn();var ya,Un,Hu=function(){if(pl)return Vn;function r(e,i,s,a){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=a}return pl=1,Vn=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,a=0;a<8;a++){var u=this.sampleCurveX(s)-e;if(Math.abs(u)<i)return s;var h=this.sampleCurveDerivativeX(s);
2if(Math.abs(h)<1e-6)break;s-=u/h}var f=0,_=1;for(s=e,a=0;a<20&&(u=this.sampleCurveX(s),!(Math.abs(u-e)<i));a++)e>u?f=s:_=s,s=.5*(_-f)+f;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Vn}(),Sc=lo(Hu);function Oo(){if(Un)return ya;function r(e,i){this.x=e,this.y=i}return Un=1,ya=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,s=e.y-this.y;return i*i+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var i=Math.cos(e),s=Math.sin(e),a=s*this.x+i*this.y;return this.x=i*this.x-s*this.y,this.y=a,this},_rotateAround:function(e,i){var s=Math.cos(e),a=Math.sin(e),u=i.y+a*(this.x-i.x)+s*(this.y-i.y);return this.x=i.x+s*(this.x-i.x)-a*(this.y-i.y),this.y=u,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(e){return e instanceof r?e:Array.isArray(e)?new r(e[0],e[1]):e},ya}var Xe=lo(Oo());function ks(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!ks(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!ks(r[i],e[i]))return!1;return!0}return r===e}const Zu=Math.PI/180,fl=180/Math.PI;function Mi(r){return r*Zu}function ve(r){return r*fl}const O=[[0,0],[1,0],[1,1],[0,1]];function U(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function X(r,e,i,s){const a=new Sc(r,e,i,s);return function(u){return a.solve(u)}}const se=X(.25,.1,.25,1);function Q(r,e,i){return Math.min(i,Math.max(e,r))}function ce(r,e,i){return(i=Q((i-r)/(e-r),0,1))*i*(3-2*i)}function ge(r,e,i){const s=i-e,a=((r-e)%s+s)%s+e;return a===e?i:a}function ue(r,e,i){if(!r.length)return i(null,[]);let s=r.length;const a=new Array(r.length);let u=null;r.forEach((h,f)=>{e(h,(_,g)=>{_&&(u=_),a[f]=g,--s==0&&i(u,a)})})}function ye(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let De=1;function be(){return De++}function We(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function dt(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function ft(r,e,i){const s={};for(const a in r)s[a]=e.call(this,r[a],a,r);return s}function Gt(r,e,i){const s={};for(const a in r)e.call(this,r[a],a,r)&&(s[a]=r[a]);return s}function qt(r){return Array.isArray(r)?r.map(qt):typeof r=="object"&&r?ft(r,qt):r}function Wt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const fi={};function ii(r){fi[r]||(typeof console<"u"&&console.warn(r),fi[r]=!0)}function Ki(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function pr(r){let e=0;for(let i,s,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}function fr([r,e,i]){const s=Mi(e+90),a=Mi(i);return{x:r*Math.cos(s)*Math.sin(a),y:r*Math.sin(s)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function Ui(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function Pi(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,s,a,u)=>{const h=a||u;return e[s]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Pr=null;function Sr(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function xr(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<s?e=a+1:i=a}return e}function Qr(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<=s?e=a+1:i=a}return e}function zn(r){return r>0?1/(1.001-r):1+r}function mn(r){return r>0?1-1/(1.001-r):-r}function ml(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const rn={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!rn.API_URL)return null;
2try{const r=new URL(rn.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v0.3.0.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function co(r){return rn.API_URL_REGEX.test(r)}function Ec(r){return rn.API_SPRITE_REGEX.test(r)}let _l,gl,Ic,Ac,Bo,yl;function Mc(){return _l==null&&(_l=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),_l}const fs={now:()=>Ac!==void 0?Ac:performance.now(),setNow(r){Ac=r},restoreNow(){Ac=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:s}=r;Bo||(Bo=document.createElement("canvas"));const a=Bo.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>Bo.width||s>Bo.height)&&(Bo.width=i,Bo.height=s),a.clearRect(-e,-e,i+2*e,s+2*e),a.drawImage(r,0,0,i,s),a.getImageData(-e,-e,i+2*e,s+2*e)},resolveURL:r=>(gl||(gl=document.createElement("a")),gl.href=r,gl.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Ic==null&&(Ic=window.matchMedia("(prefers-reduced-motion: reduce)")),Ic.matches)},hasCanvasFingerprintNoise(){if(yl!==void 0)return yl;if(!Mc())return yl=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const s=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<s.data.length;++a)if(a%4!=3&&i++!==s.data[a])return yl=!0,!0;return yl=!1,!1}};function Wn(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
2const s=new URLSearchParams(r.slice(i));for(const a in e)s.set(a,e[a]);return`${r.slice(0,i)}?${s.toString()}`}function ss(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const s=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const h of e.persistentParams){const f=a.get(h);f&&s.set(h,f)}const u=s.toString();return`${r.slice(0,i)}${u.length>0?`?${u}`:""}`}const Fs="mapbox-tiles";let ms=500,Os=50;const xl=["language","worldview","jobid"];let Ss,vl;function No(){try{return caches}catch{}}function xa(){const r=No();r&&Ss==null&&(Ss=r.open(Fs))}let Wu=1/0;const Xu={supported:!1,testSupport:function(r){!bl&&Vo&&(va?Ud(r):Dn=r)}};let Dn,Vo,bl=!1,va=!1;const Vd=typeof self<"u"?self:{};function Ud(r){const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,Vo),r.isContextLost())return;Xu.supported=!0}catch{}r.deleteTexture(e),bl=!0}Vd.document&&(Vo=Vd.document.createElement("img"),Vo.onload=function(){Dn&&Ud(Dn),Dn=null,va=!0},Vo.onerror=function(){bl=!0,Dn=null},Vo.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const wl={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(wl);
2class Ei extends Error{constructor(e,i,s){i===401&&co(s)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=s}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Cc=Ui()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,ba=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(Cc())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(s,a){const u=new AbortController,h=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,referrer:Cc(),referrerPolicy:s.referrerPolicy,signal:u.signal});let f=!1,_=!1;const g=(v=h.url).indexOf("sku=")>0&&co(v);var v;s.type==="json"&&h.headers.set("Accept","application/json");const b=(E,A,P)=>{if(_)return;if(E&&E.message!=="SecurityError"&&ii(E.toString()),A&&P)return w(A);const D=Date.now();fetch(h).then(F=>{if(F.ok){const j=g?F.clone():null;return w(F,j,D)}return a(new Ei(F.statusText,F.status,s.url))}).catch(F=>{F.name!=="AbortError"&&a(new Error(`${F.message} ${s.url}`))})},w=(E,A,P)=>{(s.type==="arrayBuffer"?E.arrayBuffer():s.type==="json"?E.json():E.text()).then(D=>{_||(A&&P&&function(F,j,G){if(xa(),Ss==null)return;const R=Pi(j.headers.get("Cache-Control")||"");if(R["no-store"])return;const N={status:j.status,statusText:j.statusText,headers:new Headers};j.headers.forEach((oe,re)=>N.headers.set(re,oe)),R["max-age"]&&N.headers.set("Expires",new Date(G+1e3*R["max-age"]).toUTCString());const $=N.headers.get("Expires");if(!$||new Date($).getTime()-G<42e4)return;
2let Z=ss(F.url,{persistentParams:xl});if(j.status===206){const oe=F.headers.get("Range");if(!oe)return;N.status=200,Z=Wn(Z,{range:oe})}(function(oe,re){if(vl===void 0)try{new Response(new ReadableStream),vl=!0}catch{vl=!1}vl?re(oe.body):oe.blob().then(re).catch(ae=>ii(ae.message))})(j,oe=>{const re=new Response((ae=j.status)!==200&&ae!==404&&[101,103,204,205,304].includes(ae)?null:oe,N);var ae;xa(),Ss!=null&&Ss.then(he=>he.put(Z,re)).catch(he=>ii(he.message))})}(h,A,P),f=!0,a(null,D,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(D=>{_||a(new Error(D.message))})};return g?function(E,A){if(xa(),Ss==null)return A(null);Ss.then(P=>{let D=ss(E.url,{persistentParams:xl});const F=E.headers.get("Range");F&&(D=Wn(D,{range:F})),P.match(D).then(j=>{const G=function(R){if(!R)return!1;const N=new Date(R.headers.get("Expires")||0),$=Pi(R.headers.get("Cache-Control")||"");return Number(N)>Date.now()&&!$["no-cache"]}(j);P.delete(D).catch(A),G&&P.put(D,j.clone()).catch(A),A(null,j,G)}).catch(A)}).catch(A)}(h,b):b(null,null),{cancel:()=>{_=!0,f||u.abort()}}}(r,e);if(Ui(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return function(s,a){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const h in s.headers)u.setRequestHeader(h,s.headers[h]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{a(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let h=u.response;if(s.type==="json")try{h=JSON.parse(u.response)}catch(f){return a(f)}a(null,h,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else a(new Ei(u.statusText,u.status,s.url))},u.send(s.body),{cancel:()=>u.abort()}}(r,e)},Tl=function(r,e){return ba(ye(r,{type:"arrayBuffer"}),e)};function Uf(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const Sl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Uo,uo;Uo=[],uo=0;const Yu=function(r,e){if(Xu.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),uo>=rn.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Uo.push(u),u}uo++;let i=!1;const s=()=>
2{if(!i)for(i=!0,uo--;Uo.length&&uo<rn.MAX_PARALLEL_IMAGE_REQUESTS;){const u=Uo.shift(),{requestParameters:h,callback:f,cancelled:_}=u;_||(u.cancel=Yu(h,f).cancel)}},a=Tl(r,(u,h,f,_)=>{s(),u?e(u):h&&(self.createImageBitmap?function(g,v){const b=new Blob([new Uint8Array(g)],{type:"image/png"});createImageBitmap(b).then(w=>{v(null,w)}).catch(w=>{v(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(g,v)=>e(g,v,f,_)):function(g,v){const b=new Image;b.onload=()=>{v(null,b),URL.revokeObjectURL(b.src),b.onload=null,requestAnimationFrame(()=>{b.src=Sl})},b.onerror=()=>v(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 w=new Blob([new Uint8Array(g)],{type:"image/png"});b.src=g.byteLength?URL.createObjectURL(w):Sl}(h,(g,v)=>e(g,v,f,_)))});return{cancel:()=>{a.cancel(),s()}}};var Ku,jo,jd,Bs={exports:{}},Pc={exports:{}},Rc={exports:{}},_s=function(){if(jd)return Bs.exports;jd=1;var r=(Ku||(Ku=1,Pc.exports=function(i,s){var a,u,h,f,_,g,v,b;for(u=i.length-(a=3&i.length),h=s,_=3432918353,g=461845907,b=0;b<u;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,h=27492+(65535&(f=5*(65535&(h=(h^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(b+2))<<16;case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),Pc.exports),e=(jo||(jo=1,Rc.exports=function(i,s){for(var a,u=i.length,h=s^u,f=0;u>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),u-=4,++f;switch(u){case 3:h^=(255&i.charCodeAt(f+2))<<16;case 2:h^=(255&i.charCodeAt(f+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(f)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),Rc.exports);return Bs.exports=r,Bs.exports.murmur3=r,Bs.exports.murmur2=e,Bs.exports}(),El=lo(_s);class Go{constructor(e,...i){ye(this,i[0]||{}),this.type=e}}class zc extends Go{constructor(e,i={}){super("error",ye({error:e},i))}}function Ju(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function Dc(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class $o{on(e,i){return this._listeners=this._listeners||{},Ju(e,i,this._listeners),this}off(e,i){return Dc(e,i,this._listeners),Dc(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Ju(e,i,this._oneTimeListeners),this):new Promise(s=>{this.once(e,s)})}fire(e,i){const s=typeof e=="string"?new Go(e,i):e,a=s.type;if(this.listens(a)){s.target=this;const u=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of u)_.call(this,s);const h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of h)Dc(a,_,this._oneTimeListeners),_.call(this,s);const f=this._eventedParent;f&&(ye(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),f.fire(s))}else s instanceof zc&&console.error(s.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class jn{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new jn(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,s]=e.split("�");return new jn({name:i,iconsetId:s})}
vendor: 4,645 bytes, line 2
2static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return jn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Qu,wa={},qo=function(){if(Qu)return wa;Qu=1;var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(u){return(u=Math.round(u))<0?0:u>255?255:u}function i(u){return e(u[u.length-1]==="%"?parseFloat(u)/100*255:parseInt(u))}function s(u){return(h=u[u.length-1]==="%"?parseFloat(u)/100:parseFloat(u))<0?0:h>1?1:h;var h}function a(u,h,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?u+(h-u)*f*6:2*f<1?h:3*f<2?u+(h-u)*(2/3-f)*6:u}try{wa.parseCSSColor=function(u){var h,f=u.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(h=parseInt(f.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:f.length===7&&(h=parseInt(f.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var _=f.indexOf("("),g=f.indexOf(")");
2if(_!==-1&&g+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,g-(_+1)).split(","),w=1;switch(v){case"rgba":if(b.length!==4)return null;w=s(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),w];case"hsla":if(b.length!==4)return null;w=s(b.pop());case"hsl":if(b.length!==3)return null;var E=(parseFloat(b[0])%360+360)%360/360,A=s(b[1]),P=s(b[2]),D=P<=.5?P*(A+1):P+A-P*A,F=2*P-D;return[e(255*a(F,D,E+1/3)),e(255*a(F,D,E)),e(255*a(F,D,E-1/3)),w];default:return null}}return null}}catch{}return wa}();class Fi{constructor(e,i,s,a=1){this.r=e,this.g=i,this.b=s,this.a=a}static parse(e){if(!e)return;if(e instanceof Fi)return e;if(typeof e!="string")return;const i=qo.parseCSSColor(e);return i?new Fi(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,s,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:s,b:a,a:u}=this;return new jf(e,i,s,a,u)}toPremultipliedRenderColor(e){const{r:i,g:s,b:a,a:u}=this;return new eh(e,i*u,s*u,a*u,u)}clone(){return new Fi(this.r,this.g,this.b,this.a)}}class gs{constructor(e,i,s,a,u,h=!1){if(this.premultiplied=!1,this.premultiplied=h,e){const f=e.image.height,_=f*f;this.premultiplied?(i=u===0?0:i/u*(f-1),s=u===0?0:s/u*(f-1),a=u===0?0:a/u*(f-1)):(i*=f-1,s*=f-1,a*=f-1);const g=Math.floor(i),v=Math.floor(s),b=Math.floor(a),w=Math.ceil(i),E=Math.ceil(s),A=Math.ceil(a),P=i-g,D=s-v,F=a-b,j=e.image.data,G=4*(g+v*_+b*f),R=4*(g+v*_+A*f),N=4*(g+E*_+b*f),$=4*(g+E*_+A*f),Z=4*(w+v*_+b*f),oe=4*(w+v*_+A*f),re=4*(w+E*_+b*f),ae=4*(w+E*_+A*f);if(G<0||ae>=j.length)throw new Error("out of range");this.r=Ft(Ft(Ft(j[G],j[R],F),Ft(j[N],j[$],F),D),Ft(Ft(j[Z],j[oe],F),Ft(j[re],j[ae],F),D),P)/255*(this.premultiplied?u:1),this.g=Ft(Ft(Ft(j[G+1],j[R+1],F),Ft(j[N+1],j[$+1],F),D),Ft(Ft(j[Z+1],j[oe+1],F),Ft(j[re+1],j[ae+1],F),D),P)/255*(this.premultiplied?u:1),this.b=Ft(Ft(Ft(j[G+2],j[R+2],F),Ft(j[N+2],j[$+2],F),D),Ft(Ft(j[Z+2],j[oe+2],F),Ft(j[re+2],j[ae+2],F),D),P)/255*(this.premultiplied?u:1),this.a=u}else this.r=i,this.g=s,this.b=a,this.a=u}toArray(){const{r:e,g:i,b:s,a}=this;return[255*e,255*i,255*s,a]}toHslaArray(){let{r:e,g:i,b:s,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];e/=a,i/=a,s/=a}const u=Math.min(Math.max(e,0),1),h=Math.min(Math.max(i,0),1),f=Math.min(Math.max(s,0),1),_=Math.min(u,h,f),g=Math.max(u,h,f),v=(_+g)/2;if(_===g)return[0,0,100*v,a];const b=g-_,w=v>.5?b/(2-g-_):b/(g+_);let E=0;return g===u?E=(h-f)/b+(h<f?6:0):g===h?E=(f-u)/b+2:g===f&&(E=(u-h)/b+4),E*=60,[Math.min(Math.max(E,0),360),Math.min(Math.max(100*w,0),100),Math.min(Math.max(100*v,0),100),a]}toArray01(){const{r:e,g:i,b:s,a}=this;return[e,i,s,a]}toArray01Scaled(e){const{r:i,g:s,b:a}=this;return[i*e,s*e,a*e]}toArray01Linear(){const{r:e,g:i,b:s,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(s,2.2),a]}}class jf extends gs{constructor(e,i,s,a,u){super(e,i,s,a,u,!1)}}class eh extends gs{constructor(e,i,s,a,u){super(e,i,s,a,u,!0)}}function Ft(r,e,i){return r*(1-i)+e*i}function Lc(r,e,i){return r.map((s,a)=>Ft(s,e[a],i))}Fi.black=new Fi(0,0,0,1),Fi.white=new Fi(1,1,1,1),Fi.transparent=new Fi(0,0,0,0),Fi.red=new Fi(1,0,0,1),Fi.blue=new Fi(0,0,1,1);var Il=Object.freeze({__proto__:null,array:Lc,color:function(r,e,i){return new Fi(Ft(r.r,e.r,i),Ft(r.g,e.g,i),Ft(r.b,e.b,i),Ft(r.a,e.a,i))},number:Ft});function Ho(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class Xn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class th{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,a]of i)this.bindings[s]=a}concat(e){return new th(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Ta={kind:"null"},_t={kind:"number"},$i={kind:"string"},Di={kind:"boolean"},Gn={kind:"color"},Ns={kind:"object"},Oi={kind:"value"},kc={kind:"collator"},Al={kind:"formatted"},Ml={kind:"resolvedImage"};function En(r,e){return{kind:"array",itemType:r,N:e}}
2function $r(r){if(r.kind==="array"){const e=$r(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Gf=[Ta,_t,$i,Di,Gn,Al,Ns,En(Oi),Ml];function Sa(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Sa(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Gf)if(!Sa(i,e))return null}}return`Expected ${$r(r)} but found ${$r(e)} instead.`}function ho(r,e){return e.some(i=>i.kind===r.kind)}function Cl(r,e){return e.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}function Fc(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&Fc(r.itemType,e.itemType):r.kind===e.kind}class Pl{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Oc{constructor(e,i,s,a,u){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=s,this.fontStack=a,this.textColor=u}}class In{constructor(e){this.sections=e}static fromString(e){return new In([new Oc(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof In?e:In.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const s={};i.fontStack&&(s["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(s["font-scale"]=i.scale),i.textColor&&(s["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(s)}return e}}class Vs{constructor(e,i={}){if(this.id=jn.from(e),this.options=Object.assign({},i),i.transform){const{a:s,b:a,c:u,d:h,e:f,f:_}=i.transform;this.options.transform=new DOMMatrix([s,a,u,h,f,_])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:i,c:s,d:a,e:u,f:h}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:s,d:a,e:u,f:h}})}static parse(e){let i,s,a,u;try{({name:i,iconsetId:s,params:a,transform:u}=JSON.parse(e)||{})}catch{return null}if(!i)return null;const{a:h,b:f,c:_,d:g,e:v,f:b}=u||{};return new Vs({name:i,iconsetId:s},{params:a,transform:new DOMMatrix([h,f,_,g,v,b])})}scaleSelf(e,i){return this.options.transform.scaleSelf(e,i),this}}class Ln{constructor(e,i,s,a,u=!1){this.primaryId=jn.from(e),this.primaryOptions=i,s&&(this.secondaryId=jn.from(s)),this.secondaryOptions=a,this.available=u}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Vs(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Vs(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?Ln.build({name:e}):e}static build(e,i,s,a){return!e||typeof e=="object"&&!("name"in e)?null:new Ln(e,s,i,a)}}function Zo(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ui(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Fi||r instanceof Pl||r instanceof In||r instanceof Ln)return!0;
vendor: 5,967 bytes, line 2
2if(Array.isArray(r)){for(const e of r)if(!ui(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!ui(r[e]))return!1;return!0}return!1}function nt(r){if(r===null)return Ta;if(typeof r=="string")return $i;if(typeof r=="boolean")return Di;if(typeof r=="number")return _t;if(r instanceof Fi)return Gn;if(r instanceof Pl)return kc;if(r instanceof In)return Al;if(r instanceof Ln)return Ml;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const a=nt(s);if(i){if(i===a)continue;i=Oi;break}i=a}return En(i||Oi,e)}return Ns}function os(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof In||r instanceof Ln||r instanceof Fi?r.toString():JSON.stringify(r)}class $t{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ui(e[1]))return i.error("invalid value");const s=e[1];let a=nt(s);const u=i.expectedType;return a.kind!=="array"||a.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(a=u),new $t(a,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Fi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof In?this.value.serialize():this.value}}class Vr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Rl={string:$i,number:_t,boolean:Di,object:Ns};class zt{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,a=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in Rl)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=Rl[g],a++}else f=Oi;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);_=e[2],a++}s=En(f,_)}else s=Rl[u];const h=[];for(;a<e.length;a++){const f=i.parse(e[a],a,Oi);if(!f)return null;h.push(f)}return new zt(s,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!Sa(this.type,nt(s)))return s;if(i===this.args.length-1)throw new Vr(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${$r(nt(s))} but was expected to be of type ${$r(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const s=e.itemType;if(s.kind==="string"||s.kind==="number"||s.kind==="boolean"){i.push(s.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(s=>s.serialize()))}}class Ea{constructor(e){this.type=Al,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const a=[];let u=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=i.parseObjectValue(f["font-scale"],h,"font-scale",_t),!_))return null;let g=null;if(f["text-font"]&&(g=i.parseObjectValue(f["text-font"],h,"text-font",En($i)),!g))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],h,"text-color",Gn),!v))return null;const b=a[a.length-1];b.scale=_,b.font=g,b.textColor=v}else{const _=i.parse(e[h],h,Oi);if(!_)return null;const g=_.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new Ea(a)}evaluate(e){return new In(this.sections.map(i=>{const s=i.content.evaluate(e);return Fc(nt(s),Ml)?new Oc("",s,null,null,null):new Oc(os(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const s={};i.scale&&(s["font-scale"]=i.scale.serialize()),i.font&&(s["text-font"]=i.font.serialize()),i.textColor&&(s["text-color"]=i.textColor.serialize()),e.push(s)}return e}}class Ia{constructor(e,i,s,a){this._imageWarnHistory={},this.type=Ml,this.namePrimary=e,this.nameSecondary=i,s&&(this.paramsPrimary=s.params,this.iconsetIdPrimary=s.iconset?s.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let s=1;const a=[];function u(){if(s<e.length){const f=i.parse(e[s],s++,$i);return f?(a.push({image:f,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(s<e.length){const _=e[s];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const g=_.params,v=_.iconset,b=i.concat(s);if(!g&&!v)return s++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},E=b.concat(void 0,"params");for(const A in g){if(!A)return E.error("Image parameter name should be non-empty"),!1;const P=E.concat(void 0,A).parse(g[A],void 0,Gn,void 0,{typeAnnotation:"coerce"});if(!P)return!1;w[A]=P}a[a.length-1].options.params=w}if(v){if(typeof v!="object"||v.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!v.id)return b.error('Image options "iconset" should have an "i
2d" property'),!1;a[a.length-1].options.iconset=v}return s++,!0}var f;return!0}for(let f=0;f<2;f++)if(!u()||!h())return;return new Ia(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const s={};if(i){for(const a in i)if(i[a])try{s[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(s).length!==0)return{params:s}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},s=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=Ln.build(i,s,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const u=a.getPrimary().id;if(a.available=e.availableImages.some(h=>jn.isEqual(h,u)),a.available){const h=a.getSecondary()?a.getSecondary().id:null;h&&(a.available=e.availableImages.some(f=>jn.isEqual(f,h)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const s={};if(i&&(s.iconset={id:i}),e){s.params={};for(const a in e)e[a]&&(s.params[a]=e[a].serialize())}return Object.keys(s).length>0?s:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function po(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}const Gd={"to-boolean":Di,"to-color":Gn,"to-number":_t,"to-string":$i};class as{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0],a=[];let u=Ta;if(s==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);u=En(i.expectedType.itemType,h)}else{if(!(h>0&&ui(e[1][0])))return null;u=En(nt(e[1][0]),h)}for(let f=0;f<h;f++){const _=e[1][f];let g;if(po(_)==="array")g=i.parse(_,void 0,u.itemType);else{const v=po(_);if(v!==u.itemType.kind)return i.error(`Expected ${u.itemType.kind} but found ${v}.`);g=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!g)return null;a.push(g)}}else{if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");u=Gd[s];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,Oi);if(!f)return null;a.push(f)}}return new as(u,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,s;for(const a of this.args){if(i=a.evaluate(e),s=null,i instanceof Fi)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Zo(i[0],i[1],i[2],i[3]),!s))return new Fi(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Vr(s||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new Vr(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?In.fromString(os(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Ln.build(os(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):os(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}
vendor: 6,768 bytes, line 2
2serialize(){if(this.type.kind==="formatted")return new Ea([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Ia(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const An=["Unknown","Point","LineString","Polygon"];class zl{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?An[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:s,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(s*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=Fi.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class en{constructor(e,i,s,a,u){this.name=e,this.type=i,this._evaluate=s,this.args=a,this._overloadIndex=u}evaluate(e){if(!this._evaluate){const i=en.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const s=e[0],a=en.definitions[s];if(!a)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,g=-1;for(const[v,b]of h){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),g++,_=new Xc(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let E=!1;for(let A=1;A<e.length;A++){const P=e[A],D=Array.isArray(v)?v[A-1]:v.type,F=_.parse(P,1+w.length,D);if(!F){E=!0;break}w.push(F)}if(!E)if(Array.isArray(v)&&v.length!==w.length)_.error(`Expected ${v.length} arguments, but found ${w.length} instead.`);else{for(let A=0;A<w.length;A++){const P=Array.isArray(v)?v[A]:v.type,D=w[A];_.concat(A+1).checkSubtype(P,D.type)}if(_.errors.length===0)return new en(s,u,b,w,g)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:h.map(([w])=>w)).map(ih).join(" | "),b=[];for(let w=1;w<e.length;w++){const E=i.parse(e[w],1+b.length);if(!E)return null;b.push($r(E.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){en.definitions=i;for(const s in i)e[s]=en}}function ih(r){return Array.isArray(r)?`(${r.map($r).join(", ")})`:`(${$r(r.type)}...)`}class Es{constructor(e,i,s){this.type=kc,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const a=s["case-sensitive"]===void 0?i.parse(!1,1,Di):i.parseObjectValue(s["case-sensitive"],1,"case-sensitive",Di);if(!a)return null;const u=s["diacritic-sensitive"]===void 0?i.parse(!1,1,Di):i.parseObjectValue(s["diacritic-sensitive"],1,"diacritic-sensitive",Di);if(!u)return null;let h=null;return s.locale&&(h=i.parseObjectValue(s.locale,1,"locale",$i),!h)?null:new Es(a,u,h)}evaluate(e){return new Pl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function _n(r,e,i=0,s=r.length-1,a=$f){for(;s>i;){if(s-i>600){const _=s-i+1,g=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),w=.5*Math.sqrt(v*b*(_-b)/_)*(g-_/2<0?-1:1);_n(r,e,Math.max(i,Math.floor(e-g*b/_+w)),Math.min(s,Math.floor(e+(_-g)*b/_+w)),a)}const u=r[e];let h=i,f=s;for(Dl(r,i,e),a(r[s],u)>0&&Dl(r,i,s);h<f;){for(Dl(r,h,f),h++,f--;a(r[h],u)<0;)h++;for(;a(r[f],u)>0;)f--}a(r[i],u)===0?Dl(r,i,f):(f++,Dl(r,f,s)),f<=e&&(i=f+1),e<=f&&(s=f-1)}}function Dl(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function $f(r,e){return r<e?-1:r>e?1:0}function qf(r){let e=0;for(let i,s,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}function fo(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Aa(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function Wo(r,e,i){const s=r[0]-e[0],a=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return s*h-u*a==0&&s*u<=0&&a*h<=0}function Ma(r,e,i=!1){let s=!1;for(let f=0,_=e.length;f<_;f++){const g=e[f];for(let v=0,b=g.length,w=b-1;v<b;w=v++){const E=g[w],A=g[v];if(Wo(r,E,A))return i;(u=E)[1]>(a=r)[1]!=(h=A)[1]>a[1]&&a[0]<(h[0]-u[0])*(a[1]-u[1])/(h[1]-u[1])+u[0]&&(s=!s)}}var a,u,h;return s}function $d(r,e,i,s){const a=s[0]-i[0],u=s[1]-i[1],h=(r[0]-i[0])*u-a*(r[1]-i[1]),f=(e[0]-i[0])*u-a*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function Bc(r,e,i,s){return(a=[s[0]-i[0],s[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*u[0]!=0&&!(!$d(r,e,i,s)||!$d(i,s,r,e));var a,u}function rh(r){const e=new Xe(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Xe(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const s of r[0])e.x>s.x&&(e.x=s.x),e.y>s.y&&(e.y=s.y),i.x<s.x&&(i.x=s.x),i.y<s.y&&(i.y=s.y);return{min:e,max:i}}const Us=8192;function Hf(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*Us),Math.round(s*a*Us)]}function Zf(r,e){for(let i=0;i<e.length;i++)if(Ma(r,e[i]))return!0;return!1}function qd(r,e,i){for(const s of i)for(let a=0,u=s.length,h=u-1;a<u;h=a++)if(Bc(r,e,s[h],s[a]))return!0;return!1}function Hd(r,e){for(let i=0;i<r.length;++i)if(!Ma(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(qd(r[i],r[i+1],e))return!1;return!0}function Xo(r,e){for(let i=0;i<e.length;i++)if(Hd(r,e[i]))return!0;return!1}function nh(r,e,i){const s=[];for(let a=0;a<r.length;a++){const u=[];for(let h=0;h<r[a].length;
2h++){const f=Hf(r[a][h],i);fo(e,f),u.push(f)}s.push(u)}return s}function Zd(r,e,i){const s=[];for(let a=0;a<r.length;a++){const u=nh(r[a],e,i);s.push(u)}return s}function Nc(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const a=.5*s;let u=r[0]-i[0]>a?-s:i[0]-r[0]>a?s:0;u===0&&(u=r[0]-i[2]>a?-s:i[2]-r[0]>a?s:0),r[0]+=u}fo(e,r)}function sh(r,e,i,s){const a=Math.pow(2,s.z)*Us,u=[s.x*Us,s.y*Us],h=[];if(!r)return h;for(const f of r)for(const _ of f){const g=[_.x+u[0],_.y+u[1]];Nc(g,e,i,a),h.push(g)}return h}function oh(r,e,i,s){const a=Math.pow(2,s.z)*Us,u=[s.x*Us,s.y*Us],h=[];if(!r)return h;for(const _ of r){const g=[];for(const v of _){const b=[v.x+u[0],v.y+u[1]];fo(e,b),g.push(b)}h.push(g)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of h)for(const g of _)Nc(g,e,i,a)}var f;return h}class gn{constructor(e,i){this.type=Di,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ui(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let a=0;a<s.features.length;++a){const u=s.features[a].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new gn(s,s.features[a].geometry)}else if(s.type==="Feature"){const a=s.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new gn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new gn(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,s){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const f=nh(s.coordinates,u,h),_=sh(i.geometry(),a,u,h);if(!Aa(a,u))return!1;for(const g of _)if(!Ma(g,f))return!1}if(s.type==="MultiPolygon"){const f=Zd(s.coordinates,u,h),_=sh(i.geometry(),a,u,h);if(!Aa(a,u))return!1;for(const g of _)if(!Zf(g,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,s){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const f=nh(s.coordinates,u,h),_=oh(i.geometry(),a,u,h);if(!Aa(a,u))return!1;for(const g of _)if(!Hd(g,f))return!1}if(s.type==="MultiPolygon"){const f=Zd(s.coordinates,u,h),_=oh(i.geometry(),a,u,h);if(!Aa(a,u))return!1;for(const g of _)if(!Xo(g,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Ll={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},ah=1/298.257223563,lh=ah*(2-ah),Ca=Math.PI/180;class Pa{static fromTile(e,i,s){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),u=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/Ca;return new Pa(u,s)}static get units(){return Ll}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Ll[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Ll).join(", ")}`);const s=6378.137*Ca*(i?Ll[i]:1),a=Math.cos(e*Ca),u=1/(1-lh*(1-a*a)),h=Math.sqrt(u);this.kx=s*h*a,this.ky=s*h*u*(1-lh)}distance(e,i){const s=Yn(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+a*a)}bearing(e,i){const s=Yn(i[0]-e[0])*this.kx;return Math.atan2(s,(i[1]-e[1])*this.ky)/Ca}destination(e,i,s){const a=s*Ca;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,s){return[e[0]+i/this.kx,e[1]+s/this.ky]}lineDistance(e){let i=0;for(let s=0;s<e.length-1;s++)i+=this.distance(e[s],e[s+1]);return i}area(e){let i=0;for(let s=0;s<e.length;s++){const a=e[s];for(let u=0,h=a.length,f=h-1;u<h;f=u++)i+=Yn(a[u][0]-a[f][0])*(a[u][1]+a[f][1])*(s?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let s=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const u=e[a],h=e[a+1],f=this.distance(u,h);if(s+=f,s>i)return Vc(u,h,(i-(s-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,s){let[a,u]=i,h=Yn(s[0]-a)*this.kx,f=(s[1]-u)*this.ky;if(h!==0||f!==0){const _=(Yn(e[0]-a)*this.kx*h+(e[1]-u)*this.ky*f)/(h*h+f*f);_>1?(a=s[0],u=s[1]):_>0&&(a+=h/this.kx*_,u+=f/this.ky*_)}return h=Yn(e[0]-a)*this.kx,f=(e[1]-u)*this.ky,Math.sqrt(h*h+f*f)}pointOnLine(e,i){let s=1/0,a=e[0][0],u=e[0][1],h=0,f=0;for(let _=0;_<e.length-1;_++){let g=e[_][0],v=e[_][1],b=Yn(e[_+1][0]-g)*this.kx,w=(e[_+1][1]-v)*this.ky,E=0;b===0&&w===0||(E=(Yn(i[0]-g)*this.kx*b+(i[1]-v)*this.ky*w)/(b*b+w*w),E>
21?(g=e[_+1][0],v=e[_+1][1]):E>0&&(g+=b/this.kx*E,v+=w/this.ky*E)),b=Yn(i[0]-g)*this.kx,w=(i[1]-v)*this.ky;const A=b*b+w*w;A<s&&(s=A,a=g,u=v,h=_,f=E)}return{point:[a,u],index:h,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,s){let a=this.pointOnLine(s,e),u=this.pointOnLine(s,i);if(a.index>u.index||a.index===u.index&&a.t>u.t){const g=a;a=u,u=g}const h=[a.point],f=a.index+1,_=u.index;!ch(s[f],h[0])&&f<=_&&h.push(s[f]);for(let g=f+1;g<=_;g++)h.push(s[g]);return ch(s[_],u.point)||h.push(u.point),h}lineSliceAlong(e,i,s){let a=0;const u=[];for(let h=0;h<s.length-1;h++){const f=s[h],_=s[h+1],g=this.distance(f,_);if(a+=g,a>e&&u.length===0&&u.push(Vc(f,_,(e-(a-g))/g)),a>=i)return u.push(Vc(f,_,(i-(a-g))/g)),u;a>e&&u.push(_)}return u}bufferPoint(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[0]+a,e[1]+s]}bufferBBox(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[2]+a,e[3]+s]}insideBBox(e,i){return Yn(e[0]-i[0])>=0&&Yn(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function ch(r,e){return r[0]===e[0]&&r[1]===e[1]}function Vc(r,e,i){const s=Yn(e[0]-r[0]);return[r[0]+s*i,r[1]+(e[1]-r[1])*i]}function Yn(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class Uc{constructor(e=[],i=(s,a)=>s<a?-1:s>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,a=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(s(a,h)>=0)break;i[e]=h,e=u}i[e]=a}_down(e){const{data:i,compare:s}=this,a=this.length>>1,u=i[e];for(;e<a;){let h=1+(e<<1);const f=h+1;if(f<this.length&&s(i[f],i[h])<0&&(h=f),s(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}var Je=8192;function uh(r,e){return e.dist-r.dist}const Ra=100,za=50;function kl(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function Fl(r){return r[1]-r[0]+1}function Is(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function jc(r,e){if(r[0]>r[1])return[null,null];const i=Fl(r);if(e){if(i===2)return[r,null];const s=Math.floor(i/2);return[[r[0],r[0]+s],[r[0]+s,r[1]]]}{if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}}function ls(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!Is(e,r.length))return i;for(let s=e[0];s<=e[1];++s)fo(i,r[s]);return i}function bi(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let s=0;s<r[i].length;++s)fo(e,r[i][s]);return e}function Da(r,e,i){if(kl(r)||kl(e))return NaN;let s=0,a=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[s,a])}function Wf(r){return 360*r-180}function Xf(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Gc(r,e){const i=Math.pow(2,e.z),s=(r.y/Je+e.y)/i;return[Wf((r.x/Je+e.x)/i),Xf(s)]}function Yf(r,e){const i=[];for(let s=0;s<r.length;++s)i.push(Gc(r[s],e));return i}function vr(r,e,i){const s=i.pointOnLine(e,r).point;return i.distance(r,s)}function Wd(r,e,i,s,a){const u=i.slice(s[0],s[1]+1);let h=1/0;for(let f=e[0];f<=e[1];++f)if((h=Math.min(h,vr(r[f],u,a)))===0)return 0;return h}function hh(r,e,i,s,a){const u=Math.min(a.pointToSegmentDistance(r,i,s),a.pointToSegmentDistance(e,i,s)),h=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(s,r,e));return Math.min(u,h)}function Kf(r,e,i,s,a){if(!Is(e,r.length)||!Is(s,i.length))return NaN;let u=1/0;for(let h=e[0];h<e[1];++h)for(let f=s[0];f<s[1];++f){if(Bc(r[h],r[h+1],i[f],i[f+1]))return 0;u=Math.min(u,hh(r[h],r[h+1],i[f],i[f+1],a))}return u}function Jf(r,e,i,s,a){if(!Is(e,r.length)||!Is(s,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let f=s[0];f<=s[1];++f)if((u=Math.min(u,a.distance(r[h],i[f])))===0)return u;return u}function Qf(r,e,i){if(Ma(r,e,!0))return 0;let s=1/0;for(const a of e){const u=a.length;if(u<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[u-1]&&(s=Math.min(s,i.pointToSegmentDistance(r,a[u-1],a[0])))===0||(s=Math.min(s,vr(r,a,i)))===0)return s}return s}function em(r,e,i,s){if(!Is(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(Ma(r[u],i,!0))return 0;let a=1/0;for(let u=e[0];u<e[1];++u)for(const h of i)for(let f=0,_=h.length,g=_-1;f<_;g=f++){if(Bc(r[u],r[u+1],h[g],h[f]))return 0;a=Math.min(a,hh(r[u],r[u+1],h[g],h[f],s))}return a}function Xd(r,e){for(const i of r)for(let s=0;s<=i.length-1;++s)if(Ma(i[s],e,!0))return!0;return!1}function tm(r,e,i,s=1/0){const a=bi(r),u=bi(e);if(s!==1/0&&Da(a,u,i)>=s)return s;if(Aa(a,u)){if(Xd(r,e))return 0}else if(Xd(e,r))return 0;let h=s;for(const f of r)for(let _=0,g=f.length,v=g-1;_<g;v=_++)for(const b of e)for(let w=0,E=b.length,A=E-1;w<E;A=w++){if(Bc(f[v],f[_],b[A],b[w]))return 0;h=Math.min(h,hh(f[v],f[_],b[A],b[w],i))}return h}function $c(r,e,i,s,a,u,h){if(u===null||h===null)return;const f=Da(ls(s,u),ls(a,h),i);f<e&&r.push({dist:f,range1:u,range2:h})}function im(r,e,i,s,a=1/0){let u=Math.min(s.distance(r[0],i[0][0]),a);if(u===0)return u;const h=new Uc([{dist:0,range1:[0,r.length-1],range2:[0,0]}],uh),f=e?za:Ra,_=bi(i);for(;h.length;){const g=h.pop();if(g.dist>=u)continue;const v=g.range1;if(Fl(v)<=f){if(!Is(v,r.length))return NaN;if(e){const b=em(r,v,i,s);if((u=Math.min(u,b))===0)return u}else for(let b=v[0];b<=v[1];++b){const w=Qf(r[b],i,s);if((u=Math.min(u,w))===0)return u}}else{const b=jc(v,e);if(b[0]!==null){const w=Da(ls(r,b[0]),_,s);w<u&&h.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=Da(ls(r,b[1]),_,s);w<u&&h.push({dist:w,range1:b[1],range2:[0,0]})}}}return u}function Yd(r,e,i,s,a,u=1/0){let h=Math.min(u,a.distance(r[0],i[0]));if(h===0)return h;const f=new Uc([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],uh),_=e?za:Ra,g=s?za:Ra;for(;f.length;){const v=f.pop();if(v.dist>=h)continue;const b=v.range1,w=v.range2;if(Fl(b)<=_&&Fl(w)<=g){if(!Is(b,r.length)||!Is(w,i.length))return NaN;if(e&&s?h=Math.min(h,Kf(r,b,i,w,a)):e||s?e&&!s?h=Math.min(h,Wd(i,w,r,b,a)):!e&&s&&(h=Math.min(h,Wd(r,b,i,w,a))):h=Math.min(h,Jf(r,b,i,w,a)),h===0)return h}else{const E=jc(b,e),A=jc(w,s);$c(f,h,a,r,i,E[0],A[0]),$c(f,h,a,r,i,E[0],A[1]),$c(f,h,a,r,i,E[1],A[0]),$c(f,h,a,r,i,E[1],A[1])}}return h}function dh(r,e,i,s,a=1/0){let u=a;const h=ls(r,[0,r.length-1]);for(const f of i)if(!(u!==1/0&&Da(h,ls(f,[0,f.length-1]),s)>=u)&&(u=Math.min(u,Yd(r,e,f,!0,s,u)),u===0))return u;return u}function qc(r,e,i,s,a=1/0){let u=a;const h=ls(r,[0,r.length-1]);for(const f of i){if(u!==1/0&&Da(h,bi(f),s)>=u)continue;const _=im(r,e,f,s,u);if(isNaN(_))return _;if((u=Math.min(u,_))===0)return u}return u}function ph(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class Yo{constructor(e,i){this.type=_t,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ui(e[1])){const s=e[1];if(s.type==="FeatureCollection"){for(let a=0;a<s.features.length;++a)if(ph(s.features[a].geometry.type))return new Yo(s,s.features[a].geometry)}else if(s.type==="Feature"){if(ph(s.geometry.type))return new Yo(s,s.geometry)}else if(ph(s.type))return new Yo(s,s)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),s=e.canonicalID();if(i!=null&&s!=null){if(e.geometryType()==="Point")return function(a,u,h){const f=[];for(const g of a)for(const v of g)f.push(Gc(v,u));const _=new Pa(f[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?Yd(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",_):h.type==="MultiLineString"?dh(f,!1,h.coordinates,_):h.type==="Polygon"||h.type==="MultiPolygon"?qc(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,_):null}(i,s,this.geometries);if(e.geometryType()==="LineString")return function(a,u,h){const f=[];for(const g of a){const v=[];for(const b of g)v.push(Gc(b,u));f.push(v)}const _=new Pa(f[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return dh(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=dh(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(h.type==="Polygon"||h.type==="MultiPolygon"){let g=1/0;for(let v=0;v<f.length;v++){const b=qc(f[v],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null}(i,s,this.geometries);if(e.geometryType()==="Polygon")return function(a,u,h){const f=[];for(const g of function(v,b){const w=v.length;if(w<=1)return[v];const E=[];let A,P;for(let D=0;D<w;
2D++){const F=qf(v[D]);F!==0&&(v[D].area=Math.abs(F),P===void 0&&(P=F<0),P===F<0?(A&&E.push(A),A=[v[D]]):A.push(v[D]))}return A&&E.push(A),E}(a)){const v=[];for(let b=0;b<g.length;++b)v.push(Yf(g[b],u));f.push(v)}const _=new Pa(f[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return qc(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=qc(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return h.type==="Polygon"||h.type==="MultiPolygon"?function(g,v,b){let w=1/0;for(const E of g)for(const A of v){const P=tm(E,A,b,w);if(isNaN(P))return P;if((w=Math.min(w,P))===0)return w}return w}(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,_):null}(i,s,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function La(r){if(r instanceof en&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof gn||r instanceof Yo)return!1;if(r instanceof Fa)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!La(i)&&(e=!1)}),e}function Hc(r){if(r instanceof en&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!Hc(i)&&(e=!1)}),e}function Zc(r){if(r instanceof Fa)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...Zc(i)])}),e}function ka(r,e){if(r instanceof en&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(s=>{i&&!ka(s,e)&&(i=!1)}),i}function Kd(r,e,i){return[r,e,i].filter(Boolean).join("�")}function fh(r,e){switch(r){case"string":return os(e);case"number":return+e;case"boolean":return!!e;case"color":return Fi.parse(e);case"formatted":return In.fromString(os(e));case"resolvedImage":return Ln.build(os(e))}return e}function Jd(r,e,i,s){return s!==void 0&&(r=s*Math.round(r/s)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class Fa{constructor(e,i,s,a=!1){this.type=e,this.key=i,this.scope=s,this.featureConstant=a}static parse(e,i){let s=i.expectedType;if(s==null&&(s=Oi),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof $t))return i.error("Key name of 'config' expression must be a string literal.");let u,h=!0;const f=os(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof $t))return i.error("Scope of 'config' expression must be a string literal.");u=os(_.value)}if(i.options){const _=Kd(f,u,i._scope),g=i.options.get(_);g&&(h=La(g.value||g.default))}return new Fa(s,f,u,h)}evaluate(e){const i=Kd(this.key,this.scope,e.scope),s=e.getConfig(i);if(!s)return null;const{type:a,value:u,values:h,minValue:f,maxValue:_,stepValue:g}=s,v=s.default.evaluate(e);let b=v;if(u){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=u.evaluate(e),e.scope=w}return a&&(b=fh(a,b)),b===void 0||f===void 0&&_===void 0&&g===void 0||(typeof b=="number"?b=Jd(b,f,_,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?Jd(w,f,_,g):w))),u!==void 0&&b!==void 0&&h&&!h.includes(b)&&(b=v,a&&(b=fh(a,b))),(a&&a!==this.type||b!==void 0&&!Fc(nt(b),this.type))&&(b=fh(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Wc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new Wc(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Xc{constructor(e,i=[],s,a=new th,u=[],h,f){this.registry=e,this.path=i,this.key=i.map(_=>typeof _=="string"?`['${_}']`:`[${_}]`).join(""),this.scope=a,this.errors=u,this.expectedType=s,this._scope=h,this.options=f}parse(e,i,s,a,u={}){return i||s?this.concat(i,null,s,a)._parse(e,u):this._parse(e,u)}parseObjectValue(e,i,s,a,u,h={}){return this.concat(i,s,a,u)._parse(e,h)}_parse(e,i){function s(a,u,h){return h==="assert"?new zt(u,[a]):h==="coerce"?new as(u,[a]):a}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let u=a.parse(e,this);if(!u)return null;if(this.expectedType){const h=this.expectedType,f=u.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||f.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(h,f))return null}else u=s(u,h,i.typeAnnotation||"coerce");else u=s(u,h,i.typeAnnotation||"assert")}if(!(u instanceof $t)&&u.type.kind!=="resolvedImage"&&mh(u)){const h=new zl(this._scope,this.options);try{u=new $t(u.type,u.evaluate(h))}catch(f){return this.error(f.message),null}}return u}return as.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s,a){let u=typeof e=="number"?this.path.concat(e):this.path;u=typeof i=="string"?u.concat(i):u;const h=a?this.scope.concat(a):this.scope;return new Xc(this.registry,u,s||null,h,this.errors,this._scope,this.options)}error(e,...i){const s=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new Xn(s,e))}checkSubtype(e,i){const s=Sa(e,i);return s&&this.error(s),s}}
vendor: 5,299 bytes, line 2
2function mh(r){if(r instanceof Wc)return mh(r.boundExpression);if(r instanceof en&&r.name==="error"||r instanceof Es||r instanceof gn||r instanceof Yo||r instanceof Fa)return!1;const e=r instanceof as||r instanceof zt;let i=!0;return r.eachChild(s=>{i=e?i&&mh(s):i&&s instanceof $t}),!!i&&La(r)&&ka(r,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Yc(r,e){const i=r.length-1;let s,a,u=0,h=i,f=0;for(;u<=h;)if(f=Math.floor((u+h)/2),s=r[f],a=r[f+1],s<=e){if(f===i||e<a)return f;u=f+1}else{if(!(s>e))throw new Vr("Input is not a number.");h=f-1}return 0}class Ol{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,u]of s)this.labels.push(a),this.outputs.push(u)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,_t);if(!s)return null;const a=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],_=e[h+1],g=h,v=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',g);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=i.parse(_,v,u);if(!b)return null;u=u||b.type,a.push([f,b])}return new Ol(u,s,a)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const u=i.length;return a>=i[u-1]?s[u-1].evaluate(e):s[Yc(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const Qd=.95047,ep=1.08883,tp=4/29,mo=6/29,ip=3*mo*mo,rp=mo*mo*mo,rm=Math.PI/180,nm=180/Math.PI;function _h(r){return r>rp?Math.pow(r,1/3):r/ip+tp}function Kc(r){return r>mo?r*r*r:ip*(r-tp)}function Jc(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function _o(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function gh(r){const e=_o(r.r),i=_o(r.g),s=_o(r.b),a=_h((.4124564*e+.3575761*i+.1804375*s)/Qd),u=_h((.2126729*e+.7151522*i+.072175*s)/1);return{l:116*u-16,a:500*(a-u),b:200*(u-_h((.0193339*e+.119192*i+.9503041*s)/ep)),alpha:r.a}}function yh(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,s=isNaN(r.b)?e:e-r.b/200;return e=1*Kc(e),i=Qd*Kc(i),s=ep*Kc(s),new Fi(Jc(3.2404542*i-1.5371385*e-.4985314*s),Jc(-.969266*i+1.8760108*e+.041556*s),Jc(.0556434*i-.2040259*e+1.0572252*s),r.alpha)}function sm(r,e,i){const s=e-r;return r+i*(s>180||s<-180?s-360*Math.round(s/360):s)}const Ko={forward:gh,reverse:yh,interpolate:function(r,e,i){return{l:Ft(r.l,e.l,i),a:Ft(r.a,e.a,i),b:Ft(r.b,e.b,i),alpha:Ft(r.alpha,e.alpha,i)}}},Jo={forward:function(r){const{l:e,a:i,b:s}=gh(r),a=Math.atan2(s,i)*nm;return{h:a<0?a+360:a,c:Math.sqrt(i*i+s*s),l:e,alpha:r.a}},reverse:function(r){const e=r.h*rm,i=r.c;return yh({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:sm(r.h,e.h,i),c:Ft(r.c,e.c,i),l:Ft(r.l,e.l,i),alpha:Ft(r.alpha,e.alpha,i)}}};var np=Object.freeze({__proto__:null,hcl:Jo,lab:Ko});class Kn{constructor(e,i,s,a,u){this.type=e,this.operator=i,this.interpolation=s,this.input=a,this.labels=[],this.outputs=[];for(const[h,f]of u)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,s,a){let u=0;if(e.name==="exponential")u=Qc(i,e.base,s,a);else if(e.name==="linear")u=Qc(i,1,s,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new Sc(h[0],h[1],h[2],h[3]).solve(Qc(i,1,s,a))}return u}static parse(e,i){let[s,a,u,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const g=a[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:g}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const g=a.slice(1);if(g.length!==4||g.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,_t),!u)return null;const f=[];let _=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=Gn:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let g=0;g<h.length;g+=2){const v=h[g],b=h[g+1],w=g+3,E=g+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
2omputed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const A=i.parse(b,E,_);if(!A)return null;_=_||A.type,f.push([v,A])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new Kn(_,s,a,u,f):i.error(`Type ${$r(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const u=i.length;if(a>=i[u-1])return s[u-1].evaluate(e);const h=Yc(i,a),f=Kn.interpolationFactor(this.interpolation,a,i[h],i[h+1]),_=s[h].evaluate(e),g=s[h+1].evaluate(e);return this.operator==="interpolate"?Il[this.type.kind.toLowerCase()](_,g,f):this.operator==="interpolate-hcl"?Jo.reverse(Jo.interpolate(Jo.forward(_),Jo.forward(g),f)):Ko.reverse(Ko.interpolate(Ko.forward(_),Ko.forward(g),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let s=0;s<this.labels.length;s++)i.push(this.labels[s],this.outputs[s].serialize());return i}}function Qc(r,e,i,s){const a=s-i,u=r-i;return a===0?0:e===1?u/a:(Math.pow(e,u)-1)/(Math.pow(e,a)-1)}class Bl{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let s=null;const a=i.expectedType;a&&a.kind!=="value"&&(s=a);const u=[];for(const f of e.slice(1)){const _=i.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,u.push(_)}const h=a&&u.some(f=>Sa(a,f.type));return new Bl(h?Oi:s,u)}evaluate(e){let i,s=null,a=0;for(const u of this.args){if(a++,s=u.evaluate(e),s&&s instanceof Ln&&!s.available&&(i||(i=s),s=null,a===this.args.length))return i;if(s!==null)break}return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class eu{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u<e.length-1;u+=2){const h=e[u];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,u);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=i.parse(e[u+1],u+1);if(!f)return null;s.push([h,f])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return a?new eu(s,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,s]of this.bindings)e.push(i,s.serialize());return e.push(this.result.serialize()),e}}class xh{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,_t),a=i.parse(e[2],2,En(i.expectedType||Oi));return s&&a?new xh(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new Vr(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new Vr(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new Vr(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class vh{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,_t),a=i.parse(e[2],2,En(i.expectedType||Oi));return s&&a?new vh(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new Vr(`Array index out of bounds: ${i} < 0.`);if(i>s.length-1)throw new Vr(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i===Math.floor(i))return s[i];const a=Math.floor(i),u=Math.ceil(i),h=s[a],f=s[u];if(typeof h!="number"||typeof f!="number")throw new Vr(`Cannot interpolate between non-number values at index ${i}.`);const _=i-a;return h*(1-_)+f*_}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class tu{constructor(e,i){this.type=Di,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Oi),a=i.parse(e[2],2,Oi);return s&&a?ho(s.type,[Di,$i,_t,Ta,Oi])?new tu(s,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${$r(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(s==null)return!1;if(!Cl(i,["boolean","string","number","null"]))throw new Vr(`Expected first argument to be of type boolean, string, number or null, but found ${$r(nt(i))} instead.`);if(!Cl(s,["string","array"]))throw new Vr(`Expected second argument to be of type array or string, but found ${$r(nt(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Nl{constructor(e,i,s){this.type=_t,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Oi),a=i.parse(e[2],2,Oi);if(!s||!a)return null;if(!ho(s.type,[Di,$i,_t,Ta,Oi]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${$r(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,_t);return u?new Nl(s,a,u):null}return new Nl(s,a)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!Cl(i,["boolean","string","number","null"]))throw new Vr(`Expected first argument to be of type boolean, string, number or null, but found ${$r(nt(i))} instead.`);if(!Cl(s,["string","array"]))throw new Vr(`Expected second argument to be of type array or string, but found ${$r(nt(s))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return s.indexOf(i,a)}return s.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Oa{constructor(e,i,s,a,u,h){this.inputType=e,this.type=i,this.input=s,this.cases=a,this.outputs=u,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const u={},h=[];for(let g=2;g<e.length-1;g+=2){let v=e[g];const b=e[g+1];Array.isArray(v)||(v=[v]);const w=i.concat(g);if(v.length===0)return w.error("Expected at least one branch label.");for(const A of v){if(typeof A!="number"&&typeof A!="string")return w.error("Branch labels must be numbers or strings.");if(typeof A=="number"&&Math.abs(A)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof A=="number"&&Math.floor(A)!==A)return w.error("Numeric branch labels must be integer values.");if(s){if(w.checkSubtype(s,nt(A)))return null}else s=nt(A);if(u[String(A)]!==void 0)return w.error("Branch labels must be unique.");u[String(A)]=h.length}const E=i.parse(b,g,a);if(!E)return null;a=a||E.type,h.push(E)}const f=i.parse(e[1],1,Oi);if(!f)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?f.type.kind!=="value"&&i.concat(1).checkSubtype(s,f.type)?null:new Oa(s,a,f,u,h,_):null}evaluate(e){const i=this.input.evaluate(e);return(Fc(nt(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
vendor: 18,035 bytes, line 2
2eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),s=[],a={};for(const h of i){const f=a[this.cases[h]];f===void 0?(a[this.cases[h]]=s.length,s.push([this.cases[h],[h]])):s[f][1].push(h)}const u=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of s)e.push(f.length===1?u(f[0]):f.map(u)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class bh{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,Di);if(!f)return null;const _=i.parse(e[h+1],h+1,s);if(!_)return null;a.push([f,_]),s=s||_.type}const u=i.parse(e[e.length-1],e.length-1,s);return u?new bh(s,a,u):null}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Vl{constructor(e,i,s,a){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Oi),a=i.parse(e[2],2,_t);if(!s||!a)return null;if(!ho(s.type,[En(Oi),$i,Oi]))return i.error(`Expected first argument to be of type array or string, but found ${$r(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,_t);return u?new Vl(s.type,s,a,u):null}return new Vl(s.type,s,a)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!Cl(i,["string","array"]))throw new Vr(`Expected first argument to be of type array or string, but found ${$r(nt(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(s,a)}return i.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function sp(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function op(r,e,i,s){return s.compare(e,i)===0}function Qo(r,e,i){const s=r!=="=="&&r!=="!=";return class jv{constructor(u,h,f){this.type=Di,this.lhs=u,this.rhs=h,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||h.type.kind==="value"}static parse(u,h){if(u.length!==3&&u.length!==4)return h.error("Expected two or three arguments.");const f=u[0];let _=h.parse(u[1],1,Oi);if(!_)return null;if(!sp(f,_.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${$r(_.type)}'.`);let g=h.parse(u[2],2,Oi);if(!g)return null;if(!sp(f,g.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${$r(g.type)}'.`);if(_.type.kind!==g.type.kind&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error(`Cannot compare types '${$r(_.type)}' and '${$r(g.type)}'.`);s&&(_.type.kind==="value"&&g.type.kind!=="value"?_=new zt(g.type,[_]):_.type.kind!=="value"&&g.type.kind==="value"&&(g=new zt(_.type,[g])));let v=null;if(u.length===4){if(_.type.kind!=="string"&&g.type.kind!=="string"&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(u[3],3,kc),!v)return null}return new jv(_,g,v)}evaluate(u){const h=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const _=nt(h),g=nt(f);if(_.kind!==g.kind||_.kind!=="string"&&_.kind!=="number")throw new Vr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${g.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const _=nt(h),g=nt(f);if(_.kind!=="string"||g.kind!=="string")return e(u,h,f)}return this.collator?i(u,h,f,this.collator.evaluate(u)):e(u,h,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}serialize(){const u=[r];return this.eachChild(h=>{u.push(h.serialize())}),u}}}const ap=Qo("==",function(r,e,i){return e===i},op),om=Qo("!=",function(r,e,i){return e!==i},function(r,e,i,s){return!op(0,e,i,s)}),am=Qo("<",function(r,e,i){return e<i},function(r,e,i,s){return s.compare(e,i)<0}),lm=Qo(">",function(r,e,i){return e>i},function(r,e,i,s){return s.compare(e,i)>0}),iu=Qo("<=",function(r,e,i){return e<=i},function(r,e,i,s){return s.compare(e,i)<=0}),cm=Qo(">=",function(r,e,i){return e>=i},function(r,e,i,s){return s.compare(e,i)>=0});class ru{constructor(e,i,s,a,u,h){this.type=$i,this.number=e,this.locale=i,this.currency=s,this.unit=a,this.minFractionDigits=u,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,_t);if(!s)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let u=null;if(a.locale&&(u=i.parseObjectValue(a.locale,2,"locale",$i),!u))return null;let h=null;if(a.currency&&(h=i.parseObjectValue(a.currency,2,"currency",$i),!h))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",$i),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",_t),!_))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",_t),!g)?null:new ru(s,u,h,f,_,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class wh{constructor(e){this.type=_t,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${$r(s.type)} instead.`):new wh(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Vr(`Expected value to be of type string or array, but found ${$r(nt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function lp(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const ea={"==":ap,"!=":om,">":lm,"<":am,">=":cm,"<=":iu,array:zt,at:xh,"at-interpolated":vh,boolean:zt,case:bh,coalesce:Bl,collator:Es,format:Ea,image:Ia,in:tu,"index-of":Nl,interpolate:Kn,"interpolate-hcl":Kn,"interpolate-lab":Kn,length:wh,let:eu,literal:$t,match:Oa,number:zt,"number-format":ru,object:zt,slice:Vl,step:Ol,string:zt,"to-boolean":as,"to-color":as,"to-number":as,"to-string":as,var:Wc,within:gn,distance:Yo,config:Fa};function Th(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const u=a?a.evaluate(r):1,h=Zo(e,i,s,u);if(h)throw new Vr(h);return new Fi(e/255,i/255,s/255,u)}function Sh(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const u=a?a.evaluate(r):1,h=function(g,v,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,v,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,s,u);if(h)throw new Vr(h);const f=`hsla(${e}, ${i}%, ${s}%, ${u})`,_=Fi.parse(f);if(!_)throw new Vr(`Failed to parse HSLA color: ${f}`);return _}function cp(r,e){return r in e}function go(r,e){const i=e[r];return i===void 0?null:i}function ta(r){return{type:r}}function up(r){return{result:"success",value:r}}function yo(r){return{result:"error",value:r}}function nu(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function Ul(r){return r["property-type"]==="data-driven"}function Eh(r){return nu(r.expression,"measure-light")}function Ih(r){return nu(r.expression,"zoom")}function jl(r){return!!r.expression&&r.expression.interpolated}function Gl(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function hp(r){return r}function dp(r,e){const i=e.type==="color",s=r.stops&&typeof r.stops[0][0]=="object",a=s||!(s||r.property!==void 0),u=r.type||(jl(e)?"exponential":"interval");if(i&&((r=Ho({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],Fi.parse(g[1])])),r.default=Fi.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!np[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,f,_;if(u==="exponential")h=Ah;else if(u==="interval")h=hm;else if(u==="categorical"){h=um,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];_=typeof r.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);h=dm}if(s){const g={},v=[];for(let E=0;E<r.stops.length;E++){const A=r.stops[E],P=A[0].zoom;g[P]===void 0&&(g[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),g[P].stops.push([A[0].value,A[1]])}const b=[];for(const E of v)b.push([g[E].zoom,dp(g[E],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:Kn.interpolationFactor.bind(void 0,w),zoomStops:b.map(E=>E[0]),evaluate:({zoom:E},A)=>Ah({stops:b,base:r.base},e,E).evaluate(E,A)}}if(a){const g=u==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:Kn.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(v=>v[0]),evaluate:({zoom:v})=>h(r,e,v,f,_)}}return{kind:"source",evaluate(g,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?cs(r.default,e.default):h(r,e,b,f,_)}}}function cs(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function um(r,e,i,s,a){return cs(typeof i===a?s[i]:void 0,r.default,e.default)}function hm(r,e,i){if(po(i)!=="number")return cs(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const a=Yc(r.stops.map(u=>u[0]),i);return r.stops[a][1]}function Ah(r,e,i){const s=r.base!==void 0?r.base:1;if(po(i)!=="number")return cs(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const u=Yc(r.stops.map(v=>v[0]),i),h=function(v,b,w,E){const A=E-w,P=v-w;return A===0?0:b===1?P/A:(Math.pow(b,P)-1)/(Math.pow(b,A)-1)}(i,s,r.stops[u][0],r.stops[u+1][0]),f=r.stops[u][1],_=r.stops[u+1][1];let g=Il[e.type]||hp;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=np[r.colorSpace];g=(b,w)=>v.reverse(v.interpolate(v.forward(b),v.forward(w),h))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),w=_.evaluate.apply(void 0,v);if(b!==void 0&&w!==void 0)return g(b,w,h)}}:g(f,_,h)}function dm(r,e,i){return e.type==="color"?i=Fi.parse(i):e.type==="formatted"?i=In.fromString(i.toString()):e.type==="resolvedImage"?i=Ln.build(i.toString()):po(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),cs(i,r.default,e.default)}en.register(ea,{error:[{kind:"error"},[$i],(r,[e])=>{throw new Vr(e.evaluate(r))}],typeof:[$i,[Oi],(r,[e])=>$r(nt(e.evaluate(r)))],"to-rgba":[En(_t,4),[Gn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[En(_t,4),[Gn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Gn,[_t,_t,_t],Th],rgba:[Gn,[_t,_t,_t,_t],Th],hsl:[Gn,[_t,_t,_t],Sh],hsla:[Gn,[_t,_t,_t,_t],Sh],has:{type:Di,overloads:[[[$i],(r,[e])=>cp(e.evaluate(r),r.properties())],[[$i,Ns],(r,[e,i])=>cp(e.evaluate(r),i.evaluate(r))]]},get:{type:Oi,overloads:[[[$i],(r,[e])=>go(e.evaluate(r),r.properties())],[[$i,Ns],(r,[e,i])=>go(e.evaluate(r),i.evaluate(r))]]},"feature-state":[Oi,[$i],(r,[e])=>go(e.evaluate(r),r.featureState||{})],properties:[Ns,[],r=>r.properties()],"geometry-type":[$i,[],r=>r.geometryType()],worldview:[$i,[],r=>r.globals.worldview||""],id:[Oi,[],r=>r.id()],zoom:[_t,[],r=>r.globals.zoom],pitch:[_t,[],r=>r.globals.pitch||0],"distance-from-center":[_t,[],r=>r.distanceFromCenter()],"measure-light":[_t,[$i],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[_t,[],r=>r.globals.heatmapDensity||0],"line-progress":[_t,[],r=>r.globals.lineProgress||0],"raster-value":[_t,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[_t,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[_t,[],r=>r.globals.skyRadialProgress||0],accumulated:[Oi,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[_t,ta(_t),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[_t,ta(_t),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:_t,overloads:[[[_t,_t],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[_t],(r,[e])=>-e.evaluate(r)]]},"/":[_t,[_t,_t],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[_t,[_t,_t],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[_t,[],()=>Math.LN2],pi:[_t,[],()=>Math.PI],e:[_t,[],()=>Math.E],"^":[_t,[_t,_t],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[_t,[_t],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[_t,[_t],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[_t,[_t],(r,[e])=>Math.log(e.evaluate(r))],log2:[_t,[_t],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[_t,[_t],(r,[e])=>Math.sin(e.evaluate(r))],cos:[_t,[_t],(r,[e])=>Math.cos(e.evaluate(r))],tan:[_t,[_t],(r,[e])=>Math.tan(e.evaluate(r))],asin:[_t,[_t],(r,[e])=>Math.asin(e.evaluate(r))],acos:[_t,[_t],(r,[e])=>Math.acos(e.evaluate(r))],atan:[_t,[_t],(r,[e])=>Math.atan(e.evaluate(r))],min:[_t,ta(_t),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[_t,ta(_t),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[_t,[_t],(r,[e])=>Math.abs(e.evaluate(r))],round:[_t,[_t],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[_t,[_t],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[_t,[_t],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Di,[$i,Oi],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[Di,[Oi],(r,[e])=>r.id()===e.value],"filter-type-==":[Di,[$i],(r,[e])=>r.geometryType()===e.value],"filter-<":[Di,[$i,Oi],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<a}],"filter-id-<":[Di,[Oi],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[Di,[$i,Oi],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>a}],"filter-id->":[Di,[Oi],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[Di,[$i,Oi],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<=a}],"filter-id-<=":[Di,[Oi],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[Di,[$i,Oi],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>=a}],"filter-id->=":[Di,[Oi],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[Di,[Oi],(r,[e])=>e.value in r.properties()],"filter-has-id":[Di,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Di,[En($i)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[Di,[En(Oi)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[Di,[$i,En(Oi)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[Di,[$i,En(Oi)],(r,[e,i])=>function(s,a,u,h){for(;u<=h;){const f=u+h>>1;if(a[f]===s)return!0;a[f]>s?h=f-1:u=f+1}return!1}(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Di,overloads:[[[Di,Di],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[ta(Di),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Di,overloads:[[[Di,Di],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[ta(Di),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[Di,[Di],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Di,[$i],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[$i,[$i],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[$i,[$i],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[$i,ta(Oi),(r,e)=>e.map(i=>os(i.evaluate(r))).join("")],"resolved-locale":[$i,[kc],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[_t,[_t,_t,Oi],(r,e)=>{const[i,s,a]=e.map(h=>h.evaluate(r));if(i>s||i===s)return i;let u;
2if(typeof a=="string")u=function(h){let f=0;if(h.length===0)return f;for(let _=0;_<h.length;_++)f=(f<<5)-f+h.charCodeAt(_),f|=0;return f}(a);else{if(typeof a!="number")throw new Vr(`Invalid seed input: ${a}`);u=a}return i+lp(u)()*(s-i)}]});class Ba{constructor(e,i,s,a){this.expression=e,this._warningHistory={},this._evaluator=new zl(s,a),this._defaultValue=i?function(u){return u.type==="color"&&(Gl(u.default)||Array.isArray(u.default))?new Fi(0,0,0,0):u.type==="color"?Fi.parse(u.default)||null:u.default===void 0?null:u.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Zc(e)}evaluateWithoutErrorHandling(e,i,s,a,u,h,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,a,u,h,f,_){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new Vr(`Expected value to be one of ${Object.keys(this._enumValues).map(v=>JSON.stringify(v)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${g.message}`)),this._defaultValue}}}function su(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ea}function js(r,e,i,s){const a=new Xc(ea,[],e?function(h){const f={color:Gn,string:$i,number:_t,enum:$i,boolean:Di,formatted:Al,resolvedImage:Ml};return h.type==="array"?En(f[h.value]||Oi,h.length):f[h.type]}(e):void 0,void 0,void 0,i,s),u=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?up(new Ba(u,e,i,s)):yo(a.errors)}class $l{constructor(e,i,s,a){this.kind=e,this._styleExpression=i,this.isLightConstant=s,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Hc(i.expression),this.configDependencies=Zc(i.expression)}evaluateWithoutErrorHandling(e,i,s,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,u,h)}evaluate(e,i,s,a,u,h){return this._styleExpression.evaluate(e,i,s,a,u,h)}}class ql{constructor(e,i,s,a,u,h){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Hc(i.expression),this.isLightConstant=u,this.isLineProgressConstant=h,this.configDependencies=Zc(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,s,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,u,h)}evaluate(e,i,s,a,u,h){return this._styleExpression.evaluate(e,i,s,a,u,h)}interpolationFactor(e,i,s){return this.interpolationType?Kn.interpolationFactor(this.interpolationType,e,i,s):0}}function pp(r,e,i,s){if((r=js(r,e,i,s)).result==="error")return r;const a=r.value.expression,u=La(a);if(!u&&!Ul(e))return yo([new Xn("","data expressions not supported")]);const h=ka(a,["zoom","pitch","distance-from-center"]);if(!h&&!Ih(e))return yo([new Xn("","zoom expressions not supported")]);const f=ka(a,["measure-light"]);if(!f&&!Eh(e))return yo([new Xn("","measure-light expression not supported")]);const _=ka(a,["line-progress"]);if(!_&&!function(b){return nu(b.expression,"line-progress")}(e))return yo([new Xn("","line-progress expression not supported")]);const g=e.expression&&e.expression.relaxZoomRestriction,v=Va(a);return v||h||g?v instanceof Xn?yo([v]):v instanceof Kn&&!jl(e)?yo([new Xn("",'"interpolate" expressions cannot be used with this property')]):up(v?new ql(u&&_?"camera":"composite",r.value,v.labels,v instanceof Kn?v.interpolation:void 0,f,_):new $l(u&&_?"constant":"source",r.value,f,_)):yo([new Xn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Na{constructor(e,i){this._parameters=e,this._specification=i,Ho(this,dp(this._parameters,this._specification))}static deserialize(e){return new Na(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Va(r){let e=null;if(r instanceof eu)e=Va(r.result);else if(r instanceof Bl){for(const i of r.args)if(e=Va(i),e)break}else(r instanceof Ol||r instanceof Kn)&&r.input instanceof en&&r.input.name==="zoom"&&(e=r);return e instanceof Xn||r.eachChild(i=>{const s=Va(i);s instanceof Xn?e=s:e&&s&&e!==s&&(e=new Xn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var ou,Mh,Ch=function(){if(Mh)return ou;Mh=1,ou=e;var r=3;function e(i,s,a){var u=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var h=new Int32Array(this.arrayBuffer);i=h[0],this.d=(s=h[1])+2*(a=h[2]);for(var f=0;f<this.d*this.d;f++){var _=h[r+f],g=h[r+f+1];u.push(_===g?null:h.subarray(_,g))}var v=h[r+u.length+1];this.keys=h.subarray(h[r+u.length],v),this.bboxes=h.subarray(v),this.insert=this._insertReadonly}else{this.d=s+2*a;for(var b=0;b<this.d*this.d;b++)u.push([]);this.keys=[],this.bboxes=[]}this.n=s,this.extent=i,this.padding=a,this.scale=s/i,this.uid=0;var w=a/s*i;this.min=-w,this.max=i+w}
2return e.prototype.insert=function(i,s,a,u,h){this._forEachCell(s,a,u,h,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(h)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,s,a,u,h,f){this.cells[h].push(f)},e.prototype.query=function(i,s,a,u,h){var f=this.min,_=this.max;if(i<=f&&s<=f&&_<=a&&_<=u&&!h)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(i,s,a,u,this._queryCell,g,{},h),g},e.prototype._queryCell=function(i,s,a,u,h,f,_,g){var v=this.cells[h];if(v!==null)for(var b=this.keys,w=this.bboxes,E=0;E<v.length;E++){var A=v[E];if(_[A]===void 0){var P=4*A;(g?g(w[P+0],w[P+1],w[P+2],w[P+3]):i<=w[P+2]&&s<=w[P+3]&&a>=w[P+0]&&u>=w[P+1])?(_[A]=!0,f.push(b[A])):_[A]=!1}}},e.prototype._forEachCell=function(i,s,a,u,h,f,_,g){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(s),w=this._convertToCellCoord(a),E=this._convertToCellCoord(u),A=v;A<=w;A++)for(var P=b;P<=E;P++){var D=this.d*P+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(P),this._convertFromCellCoord(A+1),this._convertFromCellCoord(P+1)))&&h.call(this,i,s,a,u,D,f,_,g))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,s=r+this.cells.length+1+1,a=0,u=0;u<this.cells.length;u++)a+=this.cells[u].length;var h=new Int32Array(s+a+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var f=s,_=0;_<i.length;_++){var g=i[_];h[r+_]=f,h.set(g,f),f+=g.length}return h[r+i.length]=f,h.set(this.keys,f),h[r+i.length+1]=f+=this.keys.length,h.set(this.bboxes,f),f+=this.bboxes.length,h.buffer},ou}(),Gs=lo(Ch);const $s={};function st(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),$s[e]={klass:r,omit:i.omit||[]}}st(Object,"Object"),Gs.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},Gs.deserialize=function(r){return new Gs(r.buffer)},Object.defineProperty(Gs,"name",{value:"Grid"}),st(Gs,"Grid"),typeof DOMMatrix<"u"&&st(DOMMatrix,"DOMMatrix"),st(Fi,"Color"),st(Error,"Error"),st(In,"Formatted"),st(Oc,"FormattedSection"),st(Ei,"AJAXError"),st(Ln,"ResolvedImage"),st(Na,"StylePropertyFunction"),st(Ba,"StyleExpression",{omit:["_evaluator"]}),st(jn,"ImageId"),st(Vs,"ImageVariant"),st(ql,"ZoomDependentExpression"),st($l,"ZoomConstantExpression"),st(en,"CompoundExpression",{omit:["_evaluate"]});for(const r in ea)$s[ea[r]._classRegistryKey]||st(ea[r],`Expression${r}`);function fp(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function mp(r){return self.ImageBitmap&&r instanceof ImageBitmap}function xo(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp)return r;if(fp(r)||mp(r))return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const s of r)i.push(xo(s,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[s,a]of r.entries())i.entries.push(xo(s),xo(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let s=0;for(const a of r.values())i[++s]=xo(a);return i}if(r instanceof DOMMatrix){const i={$name:"DOMMatrix"},s=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const a of s)i[a]=r[a];return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,s=i._classRegistryKey;if(!s)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const u in r)r.hasOwnProperty(u)&&($s[s].omit.indexOf(u)>=0||(a[u]=xo(r[u],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(a.$name=s),a}throw new Error("can't serialize object of type "+typeof r)}function vo(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||fp(r)||mp(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(vo);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],u=new Map;for(let h=0;h<a.length;h+=2)u.set(vo(a[h]),vo(a[h+1]));return u}if(e==="Set"){const a=new Set;for(const u of Object.keys(r))u!=="$name"&&a.add(vo(r[u]));return a}if(e==="DOMMatrix"){let a;return a=r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44],new DOMMatrix(a)}if(e==="BigInt")return BigInt(r.value);const{klass:i}=$s[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(s[a]=vo(r[a]));return s}throw new Error("can't deserialize object of type "+typeof r)}const St={"Latin-1 Supplement":r=>r>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>
2=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519,Osage:r=>r>=66736&&r<=66815,"CJK Unified Ideographs Extension B":r=>r>=131072&&r<=173791};function Hl(r){for(const e of r)if(Ph(e.charCodeAt(0)))return!0;return!1}function pm(r){for(const e of r)if(!fm(e.charCodeAt(0)))return!1;return!0}function fm(r){return!(St.Arabic(r)||St["Arabic Supplement"](r)||St["Arabic Extended-A"](r)||St["Arabic Presentation Forms-A"](r)||St["Arabic Presentation Forms-B"](r))}function Ph(r){return!(r!==746&&r!==747&&(r<4352||!(St["Bopomofo Extended"](r)||St.Bopomofo(r)||St["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||St["CJK Compatibility Ideographs"](r)||St["CJK Compatibility"](r)||St["CJK Radicals Supplement"](r)||St["CJK Strokes"](r)||!(!St["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||St["CJK Unified Ideographs Extension A"](r)||St["CJK Unified Ideographs"](r)||St["Enclosed CJK Letters and Months"](r)||St["Hangul Compatibility Jamo"](r)||St["Hangul Jamo Extended-A"](r)||St["Hangul Jamo Extended-B"](r)||St["Hangul Jamo"](r)||St["Hangul Syllables"](r)||St.Hiragana(r)||St["Ideographic Description Characters"](r)||St.Kanbun(r)||St["Kangxi Radicals"](r)||St["Katakana Phonetic Extensions"](r)||St.Katakana(r)&&r!==12540||!(!St["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!St["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||St["Unified Canadian Aboriginal Syllabics"](r)||St["Unified Canadian Aboriginal Syllabics Extended"](r)||St["Vertical Forms"](r)||St["Yijing Hexagram Symbols"](r)||St["Yi Syllables"](r)||St["Yi Radicals"](r))))}function _p(r){return!(Ph(r)||function(e){return!!(St["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||St["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||St["Letterlike Symbols"](e)||St["Number Forms"](e)||St["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||St["Control Pictures"](e)&&e!==9251||St["Optical Character Recognition"](e)||St["Enclosed Alphanumerics"](e)||St["Geometric Shapes"](e)||St["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||St["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||St["CJK Symbols and Punctuation"](e)||St.Katakana(e)||St["Private Use Area"](e)||St["CJK Compatibility Forms"](e)||St["Small Form Variants"](e)||St["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(r))}function mm(r){return St.Arabic(r)||St["Arabic Supplement"](r)||St["Arabic Extended-A"](r)||St["Arabic Presentation Forms-A"](r)||St["Arabic Presentation Forms-B"](r)}function gp(r){return r>=1424&&r<=2303||St["Arabic Presentation Forms-A"](r)||St["Arabic Presentation Forms-B"](r)}function _m(r,e){return!(!e&&gp(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||St.Khmer(r))}function gm(r){for(const e of r)if(gp(e.charCodeAt(0)))return!0;return!1}const $n={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Rh=null,Mn=$n.unavailable,qs=null;const ia=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(Mn=$n.error),Rh&&Rh(r)};function au(){lu.fire(new Go("pluginStateChange",{pluginStatus:Mn,pluginURL:qs}))}const lu=new $o,Ua=function(){return Mn},yp=function(){if(Mn!==$n.deferred||!qs)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Mn=$n.loading,au(),qs&&Tl({url:qs},r=>{r?ia(r):(Mn=$n.loaded,au())})},Hs={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Mn===$n.loaded||Hs.applyArabicShaping!=null,isLoading:()=>Mn===$n.loading,setState(r){Mn=r.pluginStatus,qs=r.pluginURL},isParsing:()=>Mn===$n.parsing,isParsed:()=>Mn===$n.parsed,getPluginURL:()=>qs};class Wi{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,s){for(const a of i)if(!_m(a.charCo
2deAt(0),s))return!1;return!0}(e,Hs.isLoaded())}}class Zl{constructor(e,i,s,a){this.property=e,this.value=i,this.expression=function(u,h,f,_){if(Gl(u))return new Na(u,h);if(su(u)||Array.isArray(u)&&u.length>0){const g=pp(u,h,f,_);if(g.result==="error")throw new Error(g.value.map(v=>`${v.key}: ${v.message}`).join(", "));return g.value}{let g=u;return typeof u=="string"&&h.type==="color"&&(g=Fi.parse(u)),{kind:"constant",configDependencies:new Set,evaluate:()=>g}}}(i===void 0?e.specification.default:i,e.specification,s,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class bo{constructor(e,i,s){this.property=e,this.value=new Zl(e,void 0,i,s)}transitioned(e,i){return new vp(this.property,this.value,i,ye({},e.transition,this.transition),e.now)}untransitioned(){return new vp(this.property,this.value,null,{},0)}}class xp{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return qt(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new bo(this._values[e].property,this._scope,this._options)),this._values[e].value=new Zl(this._values[e].property,i===null?void 0:qt(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const s=this._properties.properties;if(e)for(const a in e){const u=e[a];if(a.endsWith("-transition")){const h=a.slice(0,-11);s[h]&&this.setTransition(h,u)}else s.hasOwnProperty(a)&&this.setValue(a,u)}}getTransition(e){return qt(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new bo(this._values[e].property)),this._values[e].transition=qt(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const s=new bp(this._properties);for(const a of Object.keys(this._values))s._values[a]=this._values[a].transitioned(e,i._values[a]);return s}untransitioned(){const e=new bp(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class vp{constructor(e,i,s,a,u){const h=a.delay||0,f=a.duration||0;u=u||0,this.property=e,this.value=i,this.begin=u+h,this.end=this.begin+f,e.specification.transition&&(a.delay||a.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const a=e.now||0,u=this.value.possiblyEvaluate(e,i,s),h=this.prior;if(h){if(a>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(a<this.begin)return h.possiblyEvaluate(e,i,s);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,s),u,U(f))}}return u}}class bp{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const a=new ra(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,s);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ym{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return qt(this._values[e].value)}setValue(e,i){this._values[e]=new Zl(this._values[e].property,i===null?void 0:qt(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const a=new ra(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,s);return a}}class ja{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,a){return this.property.evaluate(this.value,this.parameters,e,i,s,a)}}class ra{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ve{constructor(e){this.specification=e}
vendor: 5,672 bytes, line 2
2possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,s){const a=Il[this.specification.type];return a?a(e,i,s):e}}class it{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,a){return new ja(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,a)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new ja(this,{kind:"constant",value:void 0},e.parameters);const a=Il[this.specification.type];return a?new ja(this,{kind:"constant",value:a(e.value.value,i.value.value,s)},e.parameters):e}evaluate(e,i,s,a,u,h){return e.kind==="constant"?e.value:e.evaluate(i,s,a,u,h)}}class na{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,a){return!!e.expression.evaluate(i,null,{},s,a)}interpolate(){return!1}}class Er{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Wi(0,{});for(const s in e){const a=e[s];a.specification.overridable&&this.overridableProperties.push(s);const u=this.defaultPropertyValues[s]=new Zl(a,void 0),h=this.defaultTransitionablePropertyValues[s]=new bo(a);this.defaultTransitioningPropertyValues[s]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=u.possiblyEvaluate(i)}}}st(it,"DataDrivenProperty"),st(Ve,"DataConstantProperty"),st(na,"ColorRampProperty");var pe=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
2,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
2,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"ty
2pe":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-wall-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
2,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"int
2erpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function ys(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function cu(r){if(Array.isArray(r))return r.map(cu);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=cu(r[i]);return e}return ys(r)}function uu(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!uu(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function zh(r,e="",i=null,s="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};uu(r)||(r=hu(r));const a=r;let u=!0;try{u=function(v){if(!Ga(v))return v;let b=cu(v);return Tp(b),b=wp(b),b}(a)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 3This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 4and paste the contents of this message in the report. 5Thank you! 6Filter Expression: 7${JSON.stringify(a,null,2)} 8 `)}let h=null,f=null;if(s!=="background"&&s!=="sky"&&s!=="slot"){f=pe[`filter_${s}`];const v=js(u,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));h=(b,w,E)=>v.value.evaluate(b,w,{},E)}let _=null,g=null;if(u!==a){const v=js(a,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));_=(b,w,E,A,P)=>v.value.evaluate(b,w,{},E,void 0,void 0,A,P),g=!La(v.value.expression)}return{filter:h,dynamicFilter:_||void 0,needGeometry:Sp(u),needFeature:!!g}}function wp(r){if(!Array.isArray(r))return r;const e=function(i){if(xm.has(i[0])){for(let s=1;s<i.length;s++)if(Ga(i[s]))return!0}return i}(r);return e===!0?e:e.map(i=>wp(i))}function Tp(r){let e=!1;const i=[];if(r[0]==="case"){for(let s=1;s<r.length-1;s+=2)e=e||Ga(r[s]),i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||Ga(r[1]);for(let s=2;s<r.length-1;s+=2)i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||Ga(r[1]);for(let s=1;s<r.length-1;s+=2)i.push(r[s+1])}e&&(r.length=0,r.push("any",...i));for(let s=1;s<r.length;s++)Tp(r[s])}function Ga(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
8for(let i=1;i<r.length;i++)if(Ga(r[i]))return!0;return!1}const xm=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function vm(r,e){return r<e?-1:r>e?1:0}function Sp(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Sp(r[e]))return!0;return!1}function hu(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?Dh(r[1],r[2],"=="):e==="!="?du(Dh(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Dh(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(hu))):e==="all"?["all"].concat(r.slice(1).map(hu)):e==="none"?["all"].concat(r.slice(1).map(hu).map(du)):e==="in"?Lh(r[1],r.slice(2)):e==="!in"?du(Lh(r[1],r.slice(2))):e==="has"?Ep(r[1]):e!=="!has"||du(Ep(r[1]));var i}function Dh(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function Lh(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(vm)]]:["filter-in-small",r,["literal",e]]}}function Ep(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function du(r){return["!",r]}const Wl="�";function sa(r,e){return e?`${r}${Wl}${e}`:r}const kh="-transition",wo=new Set(["fill","line","background","hillshade","raster"]);class yn extends $o{constructor(e,i,s,a,u){if(super(),this.id=e.id,this.fqid=sa(this.id,s),this.type=e.type,this.scope=s,this.lut=a,this.options=u,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const h=js(this.filter,pe[`filter_${e.type}`]);h.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...h.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new ym(i.layout,this.scope,u),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new xp(i.paint,this.scope,u);for(const h in e.paint)this.setPaintProperty(h,e.paint[h]);for(const h in e.layout)this.setLayoutProperty(h,e.layout[h]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ra(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&wo.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const s=this._unevaluatedLayout;s._properties.properties[e]&&(s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(kh)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const s=this._transitionablePaint,a=s._properties.properties;if(e.endsWith(kh)){const b=e.slice(0,-11);return a[b]&&s.setTransition(b,i||void 0),!1}if(!a[e])return!1;const u=s._values[e],h=u.value.isDataDriven(),f=u.value;s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const _=s._values[e].value,g=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return g||h||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,s){return null}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}
vendor: 16,384 bytes, line 8
8isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return Gt({id:this.id,type:this.type,slot:this.slot,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()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof ja&&Ul(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=zh(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,s,a,u,h,f,_,g){}}const bm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Xl{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class mr{constructor(){this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Ai(r,e=1){let i=0,s=0;return{members:r.map(a=>{const u=bm[a.type].BYTES_PER_ELEMENT,h=i=Fh(i,Math.max(e,u)),f=a.components||1;return s=Math.max(s,u),i+=u*f,{name:a.name,type:a.type,components:f,offset:h}}),size:Fh(i,Math.max(s,e)),alignment:e}}function Fh(r,e){return Math.ceil(r/e)*e}class Zs extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=s,e}}Zs.prototype.bytesPerElement=4,st(Zs,"StructArrayLayout2i4");class Yl extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}Yl.prototype.bytesPerElement=6,st(Yl,"StructArrayLayout3i6");class $a extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=a,this.int16[h+3]=u,e}}$a.prototype.bytesPerElement=8,st($a,"StructArrayLayout4i8");class To extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}To.prototype.bytesPerElement=4,st(To,"StructArrayLayout1f4");class Oh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e,h=2*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.float32[h+1]=a,e}}Oh.prototype.bytesPerElement=8,st(Oh,"StructArrayLayout2i1f8");class pu extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}pu.prototype.bytesPerElement=8,st(pu,"StructArrayLayout3i8");class qa extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=s,this.int16[f+2]=a,this.int16[f+3]=u,this.int16[f+4]=h,e}}qa.prototype.bytesPerElement=10,st(qa,"StructArrayLayout5i10");class Bh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=6*e,v=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[v+4]=a,this.uint8[v+5]=u,this.uint8[v+6]=h,this.uint8[v+7]=f,this.float32[b+2]=_,e}}Bh.prototype.bytesPerElement=12,st(Bh,"StructArrayLayout2i4ub1f12");class As extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=a,e}}As.prototype.bytesPerElement=12,st(As,"StructArrayLayout3f12");class So extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=s,this.uint16[f+2]=a,this.uint16[f+3]=u,this.float32[_+2]=h,e}}So.prototype.bytesPerElement=12,st(So,"StructArrayLayout4ui1f12");class Kl extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=s,this.uint16[h+2]=a,this.uint16[h+3]=u,e}}Kl.prototype.bytesPerElement=8,st(Kl,"StructArrayLayout4ui8");class fu extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=a,this.int16[_+3]=u,this.int16[_+4]=h,this.int16[_+5]=f,e}}fu.prototype.bytesPerElement=12,st(fu,"StructArrayLayout6i12");class Ha extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,s,a,u,h,f,_,g,v,b,w)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E){const A=12*e;return this.int16[A+0]=i,this.int16[A+1]=s,this.int16[A+2]=a,this.int16[A+3]=u,this.uint16[A+4]=h,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=g,this.int16[A+8]=v,this.int16[A+9]=b,this.int16[A+10]=w,this.int16[A+11]=E,e}}Ha.prototype.bytesPerElement=24,st(Ha,"StructArrayLayout4i4ui4i24");class Za extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=10*e,g=5*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}Za.prototype.bytesPerElement=20,st(Za,"StructArrayLayout3i3f20");class nn extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=a,this.float32[h+3]=u,e}}nn.prototype.bytesPerElement=16,st(nn,"StructArrayLayout4f16");class Wa extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Wa.prototype.bytesPerElement=4,st(Wa,"StructArrayLayout1ul4");class Eo extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=s,e}}Eo.prototype.bytesPerElement=4,st(Eo,"StructArrayLayout2ui4");class Nh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s,a,u,h,f,_,g,v,b,w,E)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A){const P=20*e,D=10*e;return this.int16[P+0]=i,this.int16[P+1]=s,this.int16[P+2]=a,this.int16[P+3]=u,this.int16[P+4]=h,this.float32[D+3]=f,this.float32[D+4]=_,this.float32[D+5]=g,this.float32[D+6]=v,this.int16[P+14]=b,this.uint32[D+8]=w,this.uint16[P+18]=E,this.uint16[P+19]=A,e}}Nh.prototype.bytesPerElement=40,st(Nh,"StructArrayLayout5i4f1i1ul2ui40");class mu extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+4]=u,this.int16[g+5]=h,this.int16[g+6]=f,this.int16[g+7]=_,e}}mu.prototype.bytesPerElement=16,st(mu,"StructArrayLayout3i2i2i16");class Vh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=s,this.float32[f+2]=a,this.int16[_+6]=u,this.int16[_+7]=h,e}}Vh.prototype.bytesPerElement=16,st(Vh,"StructArrayLayout2f1f2i16");class Jl extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=20*e,g=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=s,this.float32[g+1]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}Jl.prototype.bytesPerElement=20,st(Jl,"StructArrayLayout2ub4f20");class sn extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=s,this.uint16[u+2]=a,e}}sn.prototype.bytesPerElement=6,st(sn,"StructArrayLayout3ui6");class Ql extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F,j,G,R,N){const $=this.length;return this.resize($+1),this.emplace($,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F,j,G,R,N)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F,j,G,R,N,$){const Z=30*e,oe=15*e,re=60*e;return this.int16[Z+0]=i,this.int16[Z+1]=s,this.int16[Z+2]=a,this.float32[oe+2]=u,this.float32[oe+3]=h,this.uint16[Z+8]=f,this.uint16[Z+9]=_,this.uint32[oe+5]=g,this.uint32[oe+6]=v,this.uint32[oe+7]=b,this.uint16[Z+16]=w,this.uint16[Z+17]=E,this.uint16[Z+18]=A,this.float32[oe+10]=P,this.float32[oe+11]=D,this.uint8[re+48]=F,this.uint8[re+49]=j,this.uint8[re+50]=G,this.uint32[oe+13]=R,this.int16[Z+28]=N,this.uint8[re+58]=$,e}}Ql.prototype.bytesPerElement=60,st(Ql,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Uh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F,j,G,R,N,$,Z,oe,re,ae,he,Se,Be,ze,Oe,Ne,Ie){const ke=this.length;return this.resize(ke+1),this.emplace(ke,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F,j,G,R,N,$,Z,oe,re,ae,he,Se,Be,ze,Oe,Ne,Ie)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F,j,G,R,N,$,Z,oe,re,ae,he,Se,Be,ze,Oe,Ne,Ie,ke){const we=20*e,Ee=40*e,je=80*e;return this.float32[we+0]=i,this.float32[we+1]=s,this.int16[Ee+4]=a,this.int16[Ee+5]=u,this.int16[Ee+6]=h,this.int16[Ee+7]=f,this.int16[Ee+8]=_,this.int16[Ee+9]=g,this.int16[Ee+10]=v,this.int16[Ee+11]=b,this.int16[Ee+12]=w,this.uint16[Ee+13]=E,this.uint16[Ee+14]=A,this.uint16[Ee+15]=P,this.uint16[Ee+16]=D,this.uint16[Ee+17]=F,this.uint16[Ee+18]=j,this.uint16[Ee+19]=G,this.uint16[Ee+20]=R,this.uint16[Ee+21]=N,this.uint16[Ee+22]=$,this.uint16[Ee+23]=Z,this.uint16[Ee+24]=oe,this.uint16[Ee+25]=re,this.uint16[Ee+26]=ae,this.uint16[Ee+27]=he,this.uint32[we+14]=Se,this.float32[we+15]=Be,this.float32[we+16]=ze,this.float32[we+17]=Oe,this.float32[we+18]=Ne,this.uint8[je+76]=Ie,this.uint16[Ee+39]=ke,e}}Uh.prototype.bytesPerElement=80,st(Uh,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class jh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=s,this.float32[_+2]=a,this.float32[_+3]=u,this.float32[_+4]=h,this.float32[_+5]=f,e}}jh.prototype.bytesPerElement=24,st(jh,"StructArrayLayout6f24");class Io extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace
vendor: 10,636 bytes, line 8
8(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=s,this.float32[f+2]=a,this.float32[f+3]=u,this.float32[f+4]=h,e}}Io.prototype.bytesPerElement=20,st(Io,"StructArrayLayout5f20");class ec extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=s,this.float32[g+2]=a,this.float32[g+3]=u,this.float32[g+4]=h,this.float32[g+5]=f,this.float32[g+6]=_,e}}ec.prototype.bytesPerElement=28,st(ec,"StructArrayLayout7f28");class Gh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,s,a,u,h,f,_,g,v,b)}emplace(e,i,s,a,u,h,f,_,g,v,b,w){const E=11*e;return this.float32[E+0]=i,this.float32[E+1]=s,this.float32[E+2]=a,this.float32[E+3]=u,this.float32[E+4]=h,this.float32[E+5]=f,this.float32[E+6]=_,this.float32[E+7]=g,this.float32[E+8]=v,this.float32[E+9]=b,this.float32[E+10]=w,e}}Gh.prototype.bytesPerElement=44,st(Gh,"StructArrayLayout11f44");class _u extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,a,u,h,f,_,g)}emplace(e,i,s,a,u,h,f,_,g,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=s,this.float32[b+2]=a,this.float32[b+3]=u,this.float32[b+4]=h,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=g,this.float32[b+8]=v,e}}_u.prototype.bytesPerElement=36,st(_u,"StructArrayLayout9f36");class oa extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=s,e}}oa.prototype.bytesPerElement=8,st(oa,"StructArrayLayout2f8");class $h extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=s,this.uint16[h+3]=a,this.uint16[h+4]=u,e}}$h.prototype.bytesPerElement=12,st($h,"StructArrayLayout1ul3ui12");class tc extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}tc.prototype.bytesPerElement=2,st(tc,"StructArrayLayout1ui2");class Xa extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D){const F=this.length;return this.resize(F+1),this.emplace(F,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F){const j=16*e;return this.float32[j+0]=i,this.float32[j+1]=s,this.float32[j+2]=a,this.float32[j+3]=u,this.float32[j+4]=h,this.float32[j+5]=f,this.float32[j+6]=_,this.float32[j+7]=g,this.float32[j+8]=v,this.float32[j+9]=b,this.float32[j+10]=w,this.float32[j+11]=E,this.float32[j+12]=A,this.float32[j+13]=P,this.float32[j+14]=D,this.float32[j+15]=F,e}}Xa.prototype.bytesPerElement=64,st(Xa,"StructArrayLayout16f64");class ic extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=10*e,v=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=s,this.uint16[g+2]=a,this.uint16[g+3]=u,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=_,e}}ic.prototype.bytesPerElement=20,st(ic,"StructArrayLayout4ui3f20");class qh extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}qh.prototype.bytesPerElement=2,st(qh,"StructArrayLayout1i2");class gu extends mr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}gu.prototype.bytesPerElement=1,st(gu,"StructArrayLayout1ub1");class Ip extends Xl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Ip.prototype.size=40;class yu extends Nh{get(e){return new Ip(this,e)}}st(yu,"CollisionBoxArray");class Ap extends Xl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Ap.prototype.size=60;class Mp extends Ql{get(e){return new Ap(this,e)}}st(Mp,"PlacedSymbolArray");class Cp extends Xl{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Cp.prototype.size=80;class Pp extends Uh{get(e){return new Cp(this,e)}}st(Pp,"SymbolInstanceArray");class Hh extends To{getoffsetX(e){return this.float32[1*e+0]}}st(Hh,"GlyphOffsetArray");class Rp extends Zs{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}st(Rp,"SymbolLineVertexArray");class zp extends Xl{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}zp.prototype.size=12;class Dp extends $h{get(e){return new zp(this,e)}}st(Dp,"FeatureIndexArray");
8class Lp extends Eo{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}st(Lp,"FillExtrusionCentroidArray");class kp extends Xl{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}kp.prototype.size=6;class Fp extends Yl{get(e){return new kp(this,e)}}st(Fp,"FillExtrusionWallArray");const wm=Ai([{name:"a_pos",components:2,type:"Int16"}],4),Tm=Ai([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),xu=Ai([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ar{constructor(e=[]){this.segments=e}_prepareSegment(e,i,s,a){let u=this.segments[this.segments.length-1];return e>Ar.MAX_VERTEX_ARRAY_LENGTH&&ii(`Max vertices per segment is ${Ar.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Ar.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:s,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,s,a){return this._prepareSegment(e,i.length,s.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,a){return new Ar([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function Op(r,e){return 256*(r=Q(Math.floor(r),0,255))+Q(Math.floor(e),0,255)}Ar.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,st(Ar,"SegmentVector");const vu=Ai([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Zh=Ai([{name:"a_pattern_b",components:4,type:"Uint16"}]),Bp=Ai([{name:"a_dash",components:4,type:"Uint16"}]);class rc{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,s,a){this.ids.push(Wh(e)),this.positions.push(i,s,a)}eachPosition(e,i){const s=Wh(e);let a=0,u=this.ids.length-1;for(;a<u;){const h=a+u>>1;this.ids[h]>=s?u=h:a=h+1}for(;this.ids[a]===s;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const s=new Float64Array(e.ids),a=new Uint32Array(e.positions);return bu(s,a,0,s.length-1),i&&(i.add(s.buffer),i.add(a.buffer)),{ids:s,positions:a}}static deserialize(e){const i=new rc;let s;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==s&&i.uniqueIds.push(a),s=a;return i.indexed=!0,i}}function Wh(r){const e=+r;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:El(String(r))}function bu(r,e,i,s){for(;i<s;){const a=r[i+s>>1];let u=i-1,h=s+1;for(;;){do u++;while(r[u]<a);do h--;while(r[h]>a);if(u>=h)break;nc(r,u,h),nc(e,3*u,3*h),nc(e,3*u+1,3*h+1),nc(e,3*u+2,3*h+2)}h-i<s-h?(bu(r,e,i,h),i=h+1):(bu(r,e,h+1,s),s=h)}}function nc(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}st(rc,"FeaturePositionMap");class Ws{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,s){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class wu extends Ws{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1i(this.location,s))}}class kr extends Ws{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class Ms extends Ws{constructor(e){super(e),this.current=[0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]||(this.current=s,this.gl.uniform2f(this.location,s[0],s[1])))}}class sc extends Ws{constructor(e){super(e),this.current=[0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]||(this.current=s,this.gl.uniform3f(this.location,s[0],s[1],s[2])))}}class Tu extends Ws{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3])))}}class Np extends Ws{constructor(e){super(e),this.current=Fi.transparent.toPremultipliedRenderColor(null)}set(e,i,s){this.fetchUniformLocation(e,i)&&(s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a)))}}const Sm=new Float32Array(16);class Ya extends Ws{constructor(e){super(e),this.current=Sm}set(e,i,s){if(this.fetchUniformLocation(e,i)){if(s[12]!==this.current[12]||s[0]!==this.current[0])return this.current=s,void this.gl.uniformMatrix4fv(this.location,!1,s);for(let a=1;a<16;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix4fv(this.location,!1,s);break}}}}const Xh=new Float32Array(9),Cs=new Float32Array(4);class oc extends Ws{constructor(e){super(e),this.current=Cs}set(e,i,s){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix2fv(this.location,!1,s);break}}}}function Yh(r){return[Op(255*r.r,255*r.g),Op(255*r.b,255*r.a)]}class ac{constructor(e,i,s,a){this.value=e,this.uniformNames=i.map(u=>`u_${u}`),this.type=s,this.context=a}setUniform(e,i,s,a,u){const h=a.constantOr(this.value);i.set(e,u,h instanceof Fi?h.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new Np(e):new kr(e)}}class Ka{constructor(e,i){this.uniformNames=i.map(s=>`u_${s}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,s,a,u){let h=null;u!=="u_pattern"&&u!=="u_dash"||(h=this.pattern),u==="u_pattern_b"&&(h=this.patternTransition),u==="u_pixel_ratio"&&(h=this.pixelRatio),h&&i.set(e,u,h)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Tu(e):new kr(e)}}class Xs{constructor(e,i,s,a){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,s,a,u,h,f,_){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Wi(0,{brightness:h,worldview:_}),i,{},u,a,f):this.expression.kind==="constant"&&this.expression.value,b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:h,worldview:_}),i,{},u,a,f):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,b?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,f,_){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},s,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,v=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:f,worldview:_}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v?null:this.context.lut)}
vendor: 11,264 bytes, line 8
8_setPaintValue(e,i,s,a){if(this.type==="color"){const u=Yh(s.toPremultipliedRenderColor(a));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,u[0],u[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class xs{constructor(e,i,s,a,u,h){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,s,a,u,h,f,_){const g=this.expression.evaluate(new Wi(this.context.zoom,{brightness:h,worldview:_}),i,{},u,a,f),v=this.expression.evaluate(new Wi(this.context.zoom+1,{brightness:h,worldview:_}),i,{},u,a,f),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:h,worldview:_}),i,{},u,a,f):this.lutExpression.value)==="none",w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,v,b?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,f,_){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},s,a,void 0,u),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},s,a,void 0,u),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Wi(0,{brightness:f,worldview:_}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v,b?null:this.context.lut)}_setPaintValue(e,i,s,a,u){if(this.type==="color"){const h=Yh(s.toPremultipliedRenderColor(u)),f=Yh(s.toPremultipliedRenderColor(u));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,h[0],h[1],f[0],f[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,s,a,u){const h=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,f=Q(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,f)}getBinding(e,i){return new kr(e)}}class us{constructor(e,i,s,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(s==="array"?Bp:vu).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new Kl}populatePaintArray(e,i,s,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],s)}updatePaintArray(e,i,s,a,u,h,f){this._setPaintValues(e,i,s.patterns&&s.patterns[this.layerId],h)}_setPaintValues(e,i,s,a){if(!a||!s)return;const u=a[s[0]],h=a[s[1]];if(u){if(u){const{tl:f,br:_,pixelRatio:g}=u;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],g)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=h;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],_[0],_[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Zh.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Ja{constructor(e,i,s=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const u in e.paint._values){const h=e.paint.get(u);if(u.endsWith("-use-theme")||!s(u)||!(h instanceof ja&&Ul(h.property.specification)))continue;const f=n(u,e.type),_=h.value,g=h.property.specification.type,v=!!h.property.useIntegerZoom,b=u==="line-dasharray"||u.endsWith("pattern"),w=e.paint.get(`${u}-use-theme`),E=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||w&&w.value.kind!=="constant";if(_.kind!=="constant"||E)if(_.kind==="source"||E||b){const A=p(u,g,"source");this.binders[u]=b?new us(_,f,g,A,e.id):new Xs(_,f,g,A),a.push(`/a_${u}`)}else{const A=p(u,g,"composite");this.binders[u]=new xs(_,f,g,v,i,A),a.push(`/z_${u}`)}else this.binders[u]=b?new Ka(_.value,f):new ac(_.value,f,g,i),a.push(`/u_${u}`);w&&(this.binders[u].lutExpression=w.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Xs||i instanceof xs?i.maxValue:0}populatePaintArrays(e,i,s,a,u,h,f,_){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof Xs||v instanceof xs||v instanceof us)&&v.populatePaintArray(e,i,s,a,u,h,f,_)}}setConstantPatternPositions(e,i){for(const s in this.binders){const a=this.binders[s];a instanceof Ka&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof us?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,s,a,u,h,f,_,g,v){let b=!1;const w=Object.keys(e),E=w.length!==0&&!_,A=E?w:i.uniqueIds;this.context.lut=u.lut;for(const P in this.binders){const D=this.binders[P];if(D.context=this.context,(D instanceof Xs||D instanceof xs||D instanceof us)&&D.expression&&D.expression.kind&&D.expression.kind!=="constant"&&(D.expression.isStateDependent===!0||D.expression.isLightConstant===!1)){const F=u.paint.get(P);D.expression=F.value;for(const j of A){const G=e[j.toString()];i.eachPosition(j,(R,N,$)=>{const Z=a.feature(R);D.updatePaintArray(N,$,Z,G,h,f,g,v)})}if(!E)for(const j of s.uniqueIds){const G=e[j.toString()];s.eachPosition(j,(R,N,$)=>{const Z=a.feature(R);D.updatePaintArray(N,$,Z,G,h,f,g,v)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof ac||s instanceof Ka)&&e.push(...s.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Xs||s instanceof xs||s instanceof us)for(let a=0;a<s.paintVertexAttributes.length;a++)e.push(s.paintVertexAttributes[a].name);if(s instanceof us)for(let a=0;a<Zh.members.length;a++)e.push(Zh.members[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof ac||s instanceof Ka||s instanceof xs)for(const a of s.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const s in this.binders){const a=this.binders[s];if(a instanceof ac||a instanceof Ka||a instanceof xs)for(const u of a.uniformNames)i.push({name:u,property:s,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,s,a,u){for(const{name:h,property:f,binding:_}of s)this.binders[f].setUniform(e,_,u,a.get(f),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Xs||i instanceof xs||i instanceof us)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof us&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof Xs||s instanceof xs||s instanceof us)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Xs||i instanceof xs||i instanceof us)&&i.destroy()}}}class l{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Ja(a,i,s);this.needsUpload=!1,this._featureMap=new rc,this._featureMapWithoutIds=new rc,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,s,a,u,h,f,_,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,u,h,f,_,g);i.id!==void 0?this._featureMap.add(i.id,s,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,s,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,a,u,h,f,_){for(const g of s)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,u,h,f||0,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const t={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function n(r,e){return t[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const c={"line-pattern":{source:So,composite:So},"fill-pattern":{source:So,composite:So},"fill-extrusion-pattern":{source:So,composite:So},"line-dasharray":{source:Kl,composite:Kl}},d={color:{source:oa,composite:nn},number:{source:To,composite:oa}};function p(r,e,i){const s=c[r];return s&&s[i]||d[e][i]}st(ac,"ConstantBinder"),st(Ka,"PatternConstantBinder"),st(Xs,"SourceExpressionBinder"),st(us,"PatternCompositeBinder"),st(xs,"CompositeExpressionBinder"),st(Ja,"ProgramConfiguration",{omit:["_buffers"]}),st(l,"ProgramConfigurationSet");const m=Je/Math.PI/2,y=5,x=6,T=16383,S=64,M=[S,32,16],I=-m,C=m;function L(r,e,i,s=m){return i=Mi(i),[r*Math.sin(i)*s,-e*s,r*Math.cos(i)*s]}function z(r,e,i){return L(Math.cos(Mi(r)),Math.sin(Mi(r)),e,i)}const k=63710088e-1,B=2*Math.PI*k;class V{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);
8if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new V(ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,a=e.lat*i,u=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return k*Math.acos(Math.min(u,1))}toBounds(e=0){const i=360*e/40075017,s=i/Math.cos(Math.PI/180*this.lat);return new H({lng:this.lng-s,lat:this.lat-i},{lng:this.lng+s,lat:this.lat+i})}toEcef(e){return z(this.lat,this.lng,m+e*m/k)}static convert(e){if(e instanceof V)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new V(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new V(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class H{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const s=e;this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]])}else{const s=e;this.setSouthWest(s[0]).setNorthEast(s[1])}}setNorthEast(e){return this._ne=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}setSouthWest(e){return this._sw=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}extend(e){const i=this._sw,s=this._ne;let a,u;if(e instanceof V)a=e,u=e;else{if(!(e instanceof H))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(H.convert(e)):this.extend(V.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(V.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||s?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new V(a.lng,a.lat),this._ne=new V(u.lng,u.lat)),this}getCenter(){return new V((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 V(this.getWest(),this.getNorth())}getSouthEast(){return new V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=V.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&a}static convert(e){if(e)return e instanceof H?e:new H(e)}}const Y=0,te=25.5;function ee(r){return B*Math.cos(r*Math.PI/180)}function J(r){return(180+r)/360}function K(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function ie(r,e){return r/ee(e)}function ne(r){return 360*r-180}function fe(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function _e(r,e){return r*ee(fe(e))}const Me=85.051129;function Ce(r){return Math.cos(Mi(Q(r,-85.051129,Me)))}function Fe(r,e){const i=Q(e,Y,te),s=Math.pow(2,i);return Ce(r)*B/(512*s)}function de(r){return 1/Math.cos(r*Math.PI/180)}function Te(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/Je)/(1<<r.z)*2));return 80150034*i/(i*i+1)/Je/(1<<r.z)}class le{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=V.convert(e);return new le(J(s.lng),K(s.lat),ie(i,s.lat))}toLngLat(){return new V(ne(this.x),fe(this.y))}toAltitude(){return _e(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/B*de(fe(this.y))}}function Re(r,e,i,s,a,u,h,f,_){const g=(e+s)/2,v=(i+a)/2,b=new Xe(g,v);f(b),function(w,E,A,P,D,F){const j=A-D,G=P-F;return Math.abs((P-E)*j-(A-w)*G)/Math.hypot(j,G)}(b.x,b.y,u.x,u.y,h.x,h.y)>=_?(Re(r,e,i,g,v,u,b,f,_),Re(r,g,v,s,a,b,h,f,_)):r.push(h)}function xe(r,e,i){let s=r[0],a=s.x,u=s.y;e(s);const h=[s];for(let f=1;f<r.length;f++){const _=r[f],{x:g,y:v}=_;e(_),Re(h,a,u,g,v,s,_,e,i),a=g,u=v,s=_}return h}function Le(r,e,i,s){if(s(e,i)){const a=e.add(i)._mult(.5);Le(r,e,a,s),Le(r,a,i,s)}else r.push(i)}function qe(r,e){let i=r[0];const s=[i];for(let a=1;a<r.length;a++){const u=r[a];Le(s,i,u,e),i=u}return s}const Pe=Math.pow(2,14)-1,Ge=-Pe-1;function ot(r,e){const i=Math.round(r.x*e),s=Math.round(r.y*e);return r.x=Q(i,Ge,Pe),r.y=Q(s,Ge,Pe),(i<r.x||i>r.x+1||s<r.y||s>r.y+1)&&ii("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function at(r,e,i){const s=r.loadGeometry(),a=r.extent,u=Je/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:_,y:g,projection:v}=i,b=w=>{const E=ne((e.x+w.x/a)/h),A=fe((e.y+w.y/a)/h),P=v.project(E,A);w.x=(P.x*f-_)*a,w.y=(P.y*f-g)*a};for(let w=0;w<s.length;w++)if(r.type!==1)s[w]=xe(s[w],b,1);else{const E=[];for(const A of s[w])A.x<0||A.x>=a||A.y<0||A.y>=a||(b(A),E.push(A));s[w]=E}}for(const h of s)for(const f of h)ot(f,u);return s}function rt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?at(r):[]}}var mt,gt,bt,Ut,ri,Bi,ir,ji={};function qi(){if(gt)return mt;gt=1;var r=Oo();function e(a,u,h,f,_){this.properties={},this.extent=h,this.type=0,this._pbf=a,this._geometry=-1,this._keys=f,this._values=_,a.readFields(i,this,u)}function i(a,u,h){a==1?u.id=h.readVarint():a==2?function(f,_){for(var g=f.readVarint()+f.pos;f.pos<g;){var v=_._keys[f.readVarint()],b=_._values[f.readVarint()];_.properties[v]=b}}(h,u):a==3?u.type=h.readVarint():a==4&&(u._geometry=h.pos)}function s(a){for(var u,h,f=0,_=0,g=a.length,v=g-1;_<g;v=_++)f+=((h=a[v]).x-(u=a[_]).x)*(u.y+h.y);return f}return mt=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var a=this._pbf;a.pos=this._geometry;for(var u,h=a.readVarint()+a.pos,f=1,_=0,g=0,v=0,b=[];a.pos<h;){if(_<=0){var w=a.readVarint();f=7&w,_=w>>3}if(_--,f===1||f===2)g+=a.readSVarint(),v+=a.readSVarint(),f===1&&(u&&b.push(u),u=[]),u.push(new r(g,v));else{if(f!==7)throw new Error("unknown command "+f);u&&u.push(u[0].clone())}}return u&&b.push(u),b},e.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var u=a.readVarint()+a.pos,h=1,f=0,_=0,g=0,v=1/0,b=-1/0,w=1/0,E=-1/0;a.pos<u;){if(f<=0){var A=a.readVarint();h=7&A,f=A>>3}if(f--,h===1||h===2)(_+=a.readSVarint())<v&&(v=_),_>b&&(b=_),(g+=a.readSVarint())<w&&(w=g),g>E&&(E=g);else if(h!==7)throw new Error("unknown command "+h)}return[v,w,b,E]},e.prototype.toGeoJSON=function(a,u,h){var f,_,g=this.extent*Math.pow(2,h),v=this.extent*a,b=this.extent*u,w=this.loadGeometry(),E=e.types[this.type];function A(F){for(var j=0;j<F.length;j++){var G=F[j];F[j]=[360*(G.x+v)/g-180,360/Math.PI*Math.atan(Math.exp((180-360*(G.y+b)/g)*Math.PI/180)
8)-90]}}switch(this.type){case 1:var P=[];for(f=0;f<w.length;f++)P[f]=w[f][0];A(w=P);break;case 2:for(f=0;f<w.length;f++)A(w[f]);break;case 3:for(w=function(F){var j=F.length;if(j<=1)return[F];for(var G,R,N=[],$=0;$<j;$++){var Z=s(F[$]);Z!==0&&(R===void 0&&(R=Z<0),R===Z<0?(G&&N.push(G),G=[F[$]]):G.push(F[$]))}return G&&N.push(G),N}(w),f=0;f<w.length;f++)for(_=0;_<w[f].length;_++)A(w[f][_])}w.length===1?w=w[0]:E="Multi"+E;var D={type:"Feature",geometry:{type:E,coordinates:w},properties:this.properties};return"id"in this&&(D.id=this.id),D},mt}function Rr(){if(Ut)return bt;Ut=1;var r=qi();function e(s,a){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(i,this,a),this.length=this._features.length}function i(s,a,u){s===15?a.version=u.readVarint():s===1?a.name=u.readString():s===5?a.extent=u.readVarint():s===2?a._features.push(u.pos):s===3?a._keys.push(u.readString()):s===4&&a._values.push(function(h){for(var f=null,_=h.readVarint()+h.pos;h.pos<_;){var g=h.readVarint()>>3;f=g===1?h.readString():g===2?h.readFloat():g===3?h.readDouble():g===4?h.readVarint64():g===5?h.readVarint():g===6?h.readSVarint():g===7?h.readBoolean():null}return f}(u))}return bt=e,e.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var a=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,a,this.extent,this._keys,this._values)},bt}function Jt(){return ir||(ir=1,ji.VectorTile=function(){if(Bi)return ri;Bi=1;var r=Rr();function e(i,s,a){if(i===3){var u=new r(a,a.readVarint()+a.pos);u.length&&(s[u.name]=u)}}return ri=function(i,s){this.layers=i.readFields(e,{},s)},ri}(),ji.VectorTileFeature=qi(),ji.VectorTileLayer=Rr()),ji}var oi=Jt();const mi="3d_elevation_id",ar="level";
8class Ur{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,s){return this.get(e,!0,i,s)}optional(e,i,s){return this.get(e,!1,i,s)}success(){return this._valid}get(e,i,s,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?s(a?a(u):u):i&&(this._valid=!1),this}}class rr{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,s){return this.featureFunc(e,i,s)}parseVertex(e,i,s){return this.vertexFunc(e,i,s)}}const Ri=new rr((r,e,i)=>r.reset(e).require(mi,s=>{i.id=s}).optional("fixed_height_relative",s=>{i.constantHeight=s},Ti.decodeRelativeHeight).geometry(s=>{i.bounds=s},rh).success(),(r,e,i)=>r.reset(e).require(mi,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height_relative",s=>{i.height=s},Ti.decodeRelativeHeight).geometry(s=>{i.position=s},Ti.getPoint).success()),Ir=new rr((r,e,i)=>r.reset(e).require(mi,s=>{i.id=s}).optional("fixed_height",s=>{i.constantHeight=s},Ti.decodeMetricHeight).geometry(s=>{i.bounds=s},rh).success(),(r,e,i)=>r.reset(e).require(mi,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height",s=>{i.height=s},Ti.decodeMetricHeight).geometry(s=>{i.position=s},Ti.getPoint).success());class Ti{static getPoint(e){return ns(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],s=[],a=e.length,u=new Ur;for(let f=0;f<a;f++){const _=e.feature(f),g=_.properties.hasOwnProperty("version")?String(_.properties.version):void 0,v=(h=g)?h==="1.0.1"?Ir:void 0:Ri;if(v===void 0){ii(`Unknown elevation feature version number ${g||"(unknown)"}`);continue}const b=_.properties.hasOwnProperty("type")?_.properties.type:void 0;if(b){if(oi.VectorTileFeature.types[_.type]==="Point"&&b==="curve_point"){const w={};v.parseVertex(u,_,w)&&i.push(w)}else if(oi.VectorTileFeature.types[_.type]==="Polygon"&&b==="curve_meta"){const w={};v.parseFeature(u,_,w)&&s.push(w)}}}var h;return{vertices:i,features:s}}}class Fr{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=yr(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,!0}}class lr{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=Br(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,s[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,s){if(function(E,A){var P=E[0],D=E[1],F=E[2],j=A[0],G=A[1],R=A[2];return Math.abs(P-j)<=Nt*Math.max(1,Math.abs(P),Math.abs(j))&&Math.abs(D-G)<=Nt*Math.max(1,Math.abs(D),Math.abs(G))&&Math.abs(F-R)<=Nt*Math.max(1,Math.abs(F),Math.abs(R))}(this.pos,e)||i===0)return s[0]=s[1]=s[2]=0,!1;const[a,u,h]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],g=this.pos[2]-e[2],v=a*a+u*u+h*h,b=2*(f*a+_*u+g*h),w=b*b-4*v*(f*f+_*_+g*g-i*i);if(w<0){const E=Math.max(-b/2,0),A=f+a*E,P=_+u*E,D=g+h*E,F=Math.hypot(A,P,D);return s[0]=A*i/F,s[1]=P*i/F,s[2]=D*i/F,!1}{const E=(-b-Math.sqrt(w))/(2*v);if(E<0){const A=Math.hypot(f,_,g);return s[0]=f*i/A,s[1]=_*i/A,s[2]=g*i/A,!1}return s[0]=f+a*E,s[1]=_+u*E,s[2]=g+h*E,!0}}}class Qi{constructor(e,i,s,a,u){this.TL=e,this.TR=i,this.BR=s,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,s){const a=[-1,1,1],u=[1,1,1],h=[1,-1,1],f=[-1,-1,1],_=dr(a,a,e),g=dr(u,u,e),v=dr(h,h,e),b=dr(f,f,e);return new Qi(_,g,v,b,i/s)}}function cr(r,e,i){let s=1/0,a=-1/0;const u=[];for(const h of r){Nr(u,h,e);const f=Br(u,i);s=Math.min(s,f),a=Math.max(a,f)}return[s,a]}function Li(r,e){let i=!0;for(let s=0;s<r.planes.length;s++){const a=r.planes[s];let u=0;for(let h=0;h<e.length;h++)u+=Br(a,e[h])+a[3]>=0;if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function Mr(r,e){for(const i of r.projections){const s=cr(e,r.points[0],i.axis);if(i.projection[1]<s[0]||i.projection[0]>s[1])return 0}return 1}function on(r,e){let i=0;const s=[0,0,0,0];for(let h=0;h<r.length;
vendor: 16,042 bytes, line 8
8h++)s[0]=r[h][0],s[1]=r[h][1],s[2]=r[h][2],s[3]=1,(a=s)[0]*(u=e)[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3]>=0&&i++;var a,u;return i}class _r{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=Ci.fromPoints(this.points),this.projections=[],this.frustumEdges=[Nr([],this.points[2],this.points[3]),Nr([],this.points[0],this.points[3]),Nr([],this.points[4],this.points[0]),Nr([],this.points[5],this.points[1]),Nr([],this.points[6],this.points[2]),Nr([],this.points[7],this.points[3])];for(const s of this.frustumEdges){const a=[0,-s[2],s[1]],u=[s[2],0,-s[0]];this.projections.push({axis:a,projection:cr(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:cr(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,s,a){const u=Math.pow(2,s),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(g=>{const v=Tn([],g,e),b=1/v[3]/i*u;return(w=v)[0]=(E=v)[0]*(A=[b,b,a?1/v[3]:b,b])[0],w[1]=E[1]*A[1],w[2]=E[2]*A[2],w[3]=E[3]*A[3],w;var w,E,A}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const v=Tr([],Yr([],Nr([],h[g[0]],h[g[1]]),Nr([],h[g[2]],h[g[1]]))),b=-Br(v,h[g[1]]);return v.concat(b)}),_=[];for(let g=0;g<h.length;g++)_.push([h[g][0],h[g][1],h[g][2]]);return new _r(_,f)}intersectsPrecise(e,i,s){for(let a=0;a<i.length;a++)if(!on(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!on(e,this.planes[a]))return 0;for(const a of s)for(const u of this.frustumEdges){const h=Yr([],a,u),f=vi(h);if(f===0)continue;Zi(h,h,1/f);const _=cr(this.points,this.points[0],h),g=cr(e,this.points[0],h);if(_[0]>g[1]||g[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const s=i[3];if(Br([i[0],i[1],i[2]],e)+s<0)return!1}return!0}}class Ci{static fromPoints(e){const i=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(const a of e)Bn(i,i,a),cn(s,s,a);return new Ci(i,s)}static fromTileIdAndHeight(e,i,s){const a=1<<e.canonical.z,u=e.canonical.x,h=e.canonical.y;return new Ci([u/a,h/a,i],[(u+1)/a,(h+1)/a,s])}static applyTransform(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)dr(s[a],s[a],i);return Ci.fromPoints(s)}static applyTransformFast(e,i){const s=[i[12],i[13],i[14]],a=[...s];for(let u=0;u<3;u++)for(let h=0;h<3;h++){const f=i[4*h+u],_=f*e.min[h],g=f*e.max[h];s[u]+=Math.min(_,g),a[u]+=Math.max(_,g)}return new Ci(s,a)}static projectAabbCorners(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)dr(s[a],s[a],i);return s}constructor(e,i){this.min=e,this.max=i,this.center=Zi([],ki([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=Vt(this.min),a=Vt(this.max);for(let u=0;u<i.length;u++)s[u]=i[u]?this.min[u]:this.center[u],a[u]=i[u]?this.center[u]:this.max[u];return a[2]=this.max[2],new Ci(s,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Li(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Li(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?Mr(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Mr(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}st(Ci,"Aabb");class qn{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,s=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;return[new Xe(Math.trunc(e.position[0]+s*u),Math.trunc(e.position[1]+a*u)),new Xe(Math.trunc(e.position[0]-s*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class kn{constructor(e,i,s,a,u,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:s,max:s},this.safeArea=i,this.constantHeight=s,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&_[1]===g[1]);var _,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:ns(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const _=this.vertices[f.a].position,g=this.vertices[f.b].position,v=oo(fn(),g,_),b=ao(v),w=Fo(fn(),v,1/b);this.edgeProps.push({vec:v,dir:w,len:b});const E=this.vertexProps[f.a].dir,A=this.vertexProps[f.b].dir;ko(E,E,w),ko(A,A,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||ga(f.dir,f.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[s,a]=i;return Ft(this.vertices[this.edges[s].a].height,this.vertices[this.edges[s].b].height,a)}computeSlopeNormal(e,i){const s=this.getClosestEdge(e);if(!s)return Kt(0,0,1);const a=s[0],u=this.edges[a],h=this.edgeProps[a].vec,f=Kt(h[0],h[1],(this.vertices[u.b].height-this.vertices[u.a].height)*i),_=Kt(f[1],-f[0],0);Yr(_,_,f);const g=vi(_);return g>0?Zi(_,_,1/g):Kt(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,s=Number.POSITIVE_INFINITY,a=0;const u=ns(e.x,e.y);for(let h=0;h<this.edges.length;h++){const f=this.edges[h],_=this.edgeProps[h].dir,g=new Fr(u,this.edgeProps[h].dir),v=this.vertices[f.a].position,b=this.vertices[f.b].position,w=fn(),E=fn(),A=g.intersectsPlane(v,this.vertexProps[f.a].dir,w),P=g.intersectsPlane(b,this.vertexProps[f.b].dir,E);if(!A||!P)continue;const D=oo(fn(),E,w),F=oo(fn(),u,w),j=yr(D,D),G=j>0?yr(F,D)/j:0,R=Q(G,0,1),N=Math.abs((G-R)*this.edgeProps[h].len),$=oo(fn(),u,v),Z=N+Math.abs(yr($,ns(_[1],-_[0])));Z<s&&(i=h,s=Z,a=R)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const s=this.edges[i].a,a=this.edges[i].b,{position:u,height:h,extent:f}=this.vertices[s],{position:_,height:g,extent:v}=this.vertices[a],b=this.vertexProps[s].dir,w=this.vertexProps[a].dir,E=Kt(u[0]/e,u[1]/e,h),A=Kt(_[0]/e,_[1]/e,g),P=Kt(b[1],-b[0],0);Zi(P,P,f);const D=Kt(w[1],-w[0],0);if(Zi(D,D,v),this.distSqLines(Kt(E[0]+.5*P[0],E[1]+.5*P[1],E[2]+.5*P[2]),Kt(A[0]-.5*D[0],A[1]-.5*D[1],A[2]-.5*D[2]),Kt(E[0]-.5*P[0],E[1]-.5*P[1],E[2]-.5*P[2]),Kt(A[0]+.5*D[0],A[1]+.5*D[1],A[2]+.5*D[2]))<=.0025000000000000005)continue;const F=this.vertices.length,j=ko(fn(),u,_);this.vertices.push({position:Fo(j,j,.5),height:.5*(h+g),extent:.5*(f+v)});const G=ko(fn(),b,w);this.vertexProps.push({dir:ga(G,G)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:s,b:F}),this.edges.push({a:F,b:a});const R=oo(fn(),this.vertices[F].position,u),N=ao(R),$={vec:R,dir:Fo(fn(),R,1/N),len:N};this.edgeProps.push($),this.edgeProps.push($)}}distSqLines(e,i,s,a){const u=Ji(ci(),i,e),h=Ji(ci(),a,s),f=Ji(ci(),e,s),_=Br(u,u),g=Br(u,h),v=Br(u,f),b=Br(h,h),w=Br(h,f),E=_*b-g*g;if(E===0){const D=Br(f,h)/Br(h,h);return is(rs(ci(),s,a,D),e)}const A=(g*w-v*b)/E,P=(_*w-g*v)/E;return is(rs(ci(),e,i,A),rs(ci(),s,a,P))}}class Jn{static parseFrom(e,i){const s=Ti.parse(e);if(!s)return[];let{vertices:a,features:u}=s;const h=1/Te(i);u.sort((v,b)=>v.id-b.id),a.sort((v,b)=>v.id-b.id||v.idx-b.idx),a=a.filter((v,b,w)=>b===w.findIndex(E=>E.id===v.id&&E.idx===v.idx));const f=new Array;let _=0;const g=a.length;for(const v of u){if(v.constantHeight){f.push(new kn(v.id,v.bounds,v.constantHeight));continue}for(;_!==g&&a[_].id<v.id;)_++;if(_===g||a[_].id!==v.id)continue;const b=new Array,w=new Array,E=_;for(;_!==g&&a[_].id===v.id;){const A=a[_];if(b.push({position:A.position,height:A.height,extent:A.extent}),_!==E&&a[_-1].idx===A.idx-1){const P=_-E;w.push({a:P-1,b:P})}_++}f.push(new kn(v.id,v.bounds,void 0,b,w,h))}return f}static getElevationFeature(e,i){if(!i)return;const s=+e.properties[mi];return Number.isNaN(s)?void 0:i.find(a=>a.id===s)}}class vs{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*Je,this.yOffset=(e.y*this.zScale-i.y)*Je)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,s){const a=this.constantElevation(i,s);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),s))}computeBiasedHeight(e,i){return i<=0?e:e+i*ce(0,i,e>=0?e:Math.abs(.5*e))}}st(kn,"ElevationFeature");class hs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Zs,this.indexArray=new sn,this.segments=new Ar,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new To),this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){const u=this.layers[0],h=[];let f=null;u.type==="circle"&&(f=u.layout.get("circle-sort-key"));for(const{feature:g,id:v,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=rt(g,E);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom,{worldview:this.worldview}),A,s))continue;const P=f?f.evaluate(A,{},s):void 0,D={id:v,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:E?A.geometry:at(g,s,a),patterns:{},sortKey:P};h.push(D)}f&&h.sort((g,v)=>g.sortKey-v.sortKey);let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new fu,_=a.projection);for(const g of h){const{geometry:v,index:b,sourceLayerIndex:w}=g,E=e[b].feature;this.addFeature(g,v,b,i.availableImages,s,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(E,v,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,s,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wm.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,xu.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Tm.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,s,a,u,h,f,_){let g;this.elevationMode!=="none"&&(g=Jn.getElevationFeature(e,_));for(const v of i)for(const b of v){const w=b.x,E=b.y;if(w<0||w>=Je||E<0||E>=Je)continue;if(h){const D=h.projectTilePoint(w,E,u),F=h.upVector(u,w,E);this.addGlobeExtVertex(D,F),this.addGlobeExtVertex(D,F),this.addGlobeExtVertex(D,F),this.addGlobeExtVertex(D,F)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=A.vertexLength;if(this.addCircleVertex(w,E,-1,-1),this.addCircleVertex(w,E,1,-1),this.addCircleVertex(w,E,1,1),this.addCircleVertex(w,E,-1,1),this.elevationMode!=="none"){const D=g?g.pointElevation(new Xe(w,E)):0;this.hasElevation=this.hasElevation||D!==0;for(let F=0;F<4;F++)this.elevatedLayoutVertexArray.emplaceBack(D)}this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+2,P+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},a,u,f,void 0,this.worldview)}addCircleVertex(e,i,s,a){this.layoutVertexArray.emplaceBack(2*e+(s+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function Fn(r,e){for(let i=0;i<r.length;i++)if(Ps(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Ps(r,e[i]))return!0;return!!lc(r,e)}function Ao(r,e,i){return!!Ps(r,e)||!!cc(e,r,i)}function bs(r,e){if(r.length===1)return Eu(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let a=0;a<s.length;a++)if(Ps(r,s[a]))return!0}for(let i=0;i<r.length;i++)if(Eu(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(lc(r,e[i]))return!0;return!1}function Mo(r,e,i){if(r.length>1){if(lc(r,e))return!0;for(let s=0;s<e.length;s++)if(cc(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(cc(r[s],e,i))return!0;return!1}function lc(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let u=0;u<e.length-1;u++)if(Kh(s,a,e[u],e[u+1]))return!0}return!1}function Kh(r,e,i,s){return Ki(r,i,s)!==Ki(e,i,s)&&Ki(r,e,i)!==Ki(r,e,s)}function Qa(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function Jh(r,e,i,s){const a=Qa(r,e,s),u=Qa(r,e,i);if(Math.sign(a)===Math.sign(u))return;const h=Qa(i,s,r),f=h+u-a;return Math.sign(h)!==Math.sign(f)?[h/(h-f),u/(u-a)]:void 0}function cc(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let a=1;a<e.length;a++)if(Su(r,e[a-1],e[a])<s)return!0;return!1}function Su(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function Eu(r,e){let i,s,a,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let f=0,_=i.length-1;f<i.length;_=f++)s=i[f],a=i[_],s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(u=!u)}return u}function Ps(r,e){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const u=r[s],h=r[a];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function el(r,e,i,s,a){for(const h of r)if(e<=h.x&&i<=h.y&&s>=h.x&&a>=h.y)return!0;const u=[new Xe(e,i),new Xe(e,a),new Xe(s,a),new Xe(s,i)];if(r.length>2){for(const h of u)if(Ps(r,h))return!0}for(let h=0;h<r.length-1;h++)if(aa(r[h],r[h+1],u))return!0;return!1}function aa(r,e,i){const s=i[0],a=i[2];if(r.x<s.x&&e.x<s.x||r.x>a.x&&e.x>a.x||r.y<s.y&&e.y<s.y||r.y>a.y&&e.y>a.y)return!1;const u=Ki(r,e,i[0]);return u!==Ki(r,e,i[1])||u!==Ki(r,e,i[2])||u!==Ki(r,e,i[3])}function Co(r,e,i,s,a,u){let h=e.y-r.y,f=r.x-e.x;if(u=u||0){const _=h*h+f*f;if(_===0)return!0;const g=Math.sqrt(_);h/=g,f/=g}return!((i.x-r.x)*h+(i.y-r.y)*f-u<0||(s.x-r.x)*h+(s.y-r.y)*f-u<0||(a.x-r.x)*h+(a.y-r.y)*f-u<0)}function Em(r,e,i,s,a,u,h){return!(Co(r,e,s,a,u,h)||Co(e,i,s,a,u,h)||Co(i,r,s,a,u,h)||Co(s,a,r,e,i,h)||Co(a,u,r,e,i,h)||Co(u,s,r,e,i,h))}
8function Iu(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Vp(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function G_(r,e,i,s,a){if(!e[0]&&!e[1])return r;const u=Xe.convert(e)._mult(a);i==="viewport"&&u._rotate(-s);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(u));return h}function $_(r,e,i,s){const a=Xe.convert(r)._mult(s);return e==="viewport"&&a._rotate(-i),a}let q_,H_;function Z_(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}st(hs,"CircleBucket",{omit:["layers"]});class uc{constructor(e,i,s){this.z=e,this.x=i,this.y=s,this.key=Au(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const s=function(u,h,f){var _=Z_(256*u,256*(h=Math.pow(2,f)-h-1),f),g=Z_(256*(u+1),256*(h+1),f);return _[0]+","+_[1]+","+g[0]+","+g[1]}(this.x,this.y,this.z),a=function(u,h,f){let _,g="";for(let v=u;v>0;v--)_=1<<v-1,g+=(h&_?1:0)+(f&_?2:0);return g}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(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(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",s)}toString(){return`${this.z}/${this.x}/${this.y}`}}class W_{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Au(e,i.z,i.z,i.x,i.y)}}class Cn{constructor(e,i,s,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new uc(s,+a,+u),this.key=i===0&&e===s?this.canonical.key:Au(i,e,s,a,u)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new Cn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Cn(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return Au(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const s=this.canonical.z-e;return Au(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Cn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,a=2*this.canonical.y;return[new Cn(i,this.wrap,i,s,a),new Cn(i,this.wrap,i,s+1,a),new Cn(i,this.wrap,i,s,a+1),new Cn(i,this.wrap,i,s+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Cn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Cn(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new W_(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Au(r,e,i,s,a){const u=1<<Math.min(i,22);let h=u*(a%u)+s%u;return r&&i<22&&(h+=u*u*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const $v=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new Cn(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new Cn(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new Cn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new Cn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];st(uc,"CanonicalTileID"),st(Cn,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const qv=Ai([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Up}=qv,Hv=Ai([{name:"a_pos_3",components:3,type:"Int16"}]);var X_=Ai([{name:"a_pos",type:"Int16",components:2}]);function jp(r){return r*m/k}const Zv=[new Ci([I,I,I],[C,C,C]),new Ci([I,I,I],[0,0,C]),new Ci([0,I,I],[C,0,C]),new Ci([I,0,I],[0,C,
vendor: 5,603 bytes, line 8
8C]),new Ci([0,0,I],[C,C,C])];function Y_(r,e,i,s=!0){const a=Zi([],r._camera.position,r.worldSize),u=[e,i,1,1];Tn(u,u,r.pixelMatrixInverse),Lo(u,u,1/u[3]);const h=Tr([],Nr([],u,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],g=Nr([],_,a),v=vi(g),b=Tr([],g),w=r.worldSize/(2*Math.PI),E=Br(b,h),A=Math.asin(w/v);if(A<Math.acos(E)){if(!s)return null;const ae=[],he=[];Zi(ae,h,v/E),Tr(he,Nr(he,ae,g)),Tr(h,ki(h,g,Zi(h,he,Math.tan(A)*v)))}const P=[];new lr(a,h).closestPointOnSphere(_,w,P);const D=Tr([],Sr(f,0)),F=Tr([],Sr(f,1)),j=Tr([],Sr(f,2)),G=Br(D,P),R=Br(F,P),N=Br(j,P),$=ve(Math.asin(-R/w));let Z=ve(Math.atan2(G,N));Z=r.center.lng+function(ae,he){const Se=(he-ae+180)%360-180;return Se<-180?Se+360:Se}(r.center.lng,Z);const oe=J(Z),re=Q(K($),0,1);return new le(oe,re)}class Wv{constructor(e,i,s){this.a=Nr([],e,s),this.b=Nr([],i,s),this.center=s;const a=Tr([],this.a),u=Tr([],this.b);this.angle=Math.acos(Br(a,u))}}function Im(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:function(s,a,u,h){const f=Math.sin(u);return s*(Math.sin((1-h)*u)/f)+a*(Math.sin(h*u)/f)}(r.a[e],r.b[e],r.angle,Q(i,0,1))+r.center[e]}function Po(r){if(r.z<=1)return Zv[r.z+2*r.y+r.x];const e=Am(Gp(r));return Ci.fromPoints(e)}function la(r,e,i){return Zi(r,r,1-i),Jr(r,r,e,i)}function K_(r,e,i){for(const s of r)dr(s,s,e),Zi(s,s,i)}function J_(r,e,i,s){const a=e/r.worldSize,u=r.globeMatrix;if(i.z<=1){const re=Po(i).getCorners();return K_(re,u,a),Ci.fromPoints(re)}const h=Gp(i,s),f=Am(h,m+jp(r._tileCoverLift));K_(f,u,a);const _=Number.MAX_VALUE,g=[-_,-_,-_],v=[_,_,_];if(h.contains(r.center)){for(const he of f)Bn(v,v,he),cn(g,g,he);g[2]=0;const re=r.point,ae=[re.x*a,re.y*a,0];return Bn(v,v,ae),cn(g,g,ae),new Ci(v,g)}if(r._tileCoverLift>0){for(const re of f)Bn(v,v,re),cn(g,g,re);return new Ci(v,g)}const b=[u[12]*a,u[13]*a,u[14]*a],w=h.getCenter(),E=Q(r.center.lat,-85.051129,Me),A=Q(w.lat,-85.051129,Me),P=J(r.center.lng),D=K(E);let F=P-J(w.lng);const j=D-K(A);F>.5?F-=1:F<-.5&&(F+=1);let G=0;Math.abs(F)>Math.abs(j)?G=F>=0?1:3:(G=j>=0?0:2,Jr(b,b,[u[4]*a,u[5]*a,u[6]*a],-Math.sin(Mi(j>=0?h.getSouth():h.getNorth()))*m));const R=f[G],N=f[(G+1)%4],$=new Wv(R,N,b),Z=[Im($,0)||R[0],Im($,1)||R[1],Im($,2)||R[2]],oe=tl(r.zoom);if(oe>0){const re=function({x:he,y:Se,z:Be},ze,Oe,Ne,Ie){const ke=1/(1<<Be);let we=he*ke,Ee=we+ke,je=Se*ke,$e=je+ke,vt=0;const ht=(we+Ee)/2-Ne;return ht>.5?vt=-1:ht<-.5&&(vt=1),we=((we+vt)*ze-(Ne*=ze))*Oe+Ne,Ee=((Ee+vt)*ze-Ne)*Oe+Ne,je=(je*ze-(Ie*=ze))*Oe+Ie,$e=($e*ze-Ie)*Oe+Ie,[[we,$e,0],[Ee,$e,0],[Ee,je,0],[we,je,0]]}(i,e,r._pixelsPerMercatorPixel,P,D);for(let he=0;he<f.length;he++)la(f[he],re[he],oe);const ae=ki([],re[G],re[(G+1)%4]);Zi(ae,ae,.5),la(Z,ae,oe)}for(const re of f)Bn(v,v,re),cn(g,g,re);return v[2]=Math.min(R[2],N[2]),Bn(v,v,Z),cn(g,g,Z),new Ci(v,g)}function Gp({x:r,y:e,z:i},s=!1){const a=1/(1<<i),u=new V(ne(r*a),e===(1<<i)-1&&s?-90:fe((e+1)*a)),h=new V(ne((r+1)*a),e===0&&s?90:fe(e*a));return new H(u,h)}function Am(r,e=m){const i=Mi(r.getNorth()),s=Mi(r.getSouth()),a=Math.cos(i),u=Math.cos(s),h=Math.sin(i),f=Math.sin(s),_=r.getWest(),g=r.getEast();return[L(u,f,_,e),L(u,f,g,e),L(a,h,g,e),L(a,h,_,e)]}function Qh(r,e,i,s){const a=1<<i.z,u=(r/Je+i.x)/a;return z(fe((e/Je+i.y)/a),ne(u),s)}function $p({min:r,max:e}){return T/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const Q_=new Float64Array(16);function qp(r){const e=$p(r),i=ln(Q_,[e,e,e]);return It(i,i,to([],r.min))}function Mm(r){const e=(s=r.min,(i=Q_)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=s[0],i[13]=s[1],i[14]=s[2],i[15]=1,i);var i,s;const a=1/$p(r);return kt(e,e,[a,a,a])}function Cm(r){const e=Je/(2*Math.PI);return r/(2*Math.PI)/e}function eg(r,e){return Je/(512*Math.pow(2,r))*$p(Po(e))}function tg(r,e,i,s,a){const u=Cm(i),h=[r,e,-i/(2*Math.PI)],f=Ke(new Float64Array(16));return It(f,f,h),kt(f,f,[u,u,u]),Rt(f,f,Mi(-a)),wt(f,f,Mi(-s)),f}function tl(r){return ce(y,x,r)}function ig(r,e){const i=z(e.lat,e.lng),s=function(A){const P=z(A._center.lat,A._center.lng);let D=Yr([],Kt(0,1,0),P);const F=bn([],-A.angle,P);D=dr(D,D,F),bn(F,-A._pitch,D);const j=Tr([],P);return Zi(j,j,jp(A.cameraToCenterDistance/A.pixelsPerMeter)),dr(j,j,F),ki([],P,j)}(r);return h=(a=Ji([],s,i))[0],f=a[1],_=a[2],g=(u=i)[0],v=u[1],b=u[2],E=(w=Math.sqrt(h*h+f*f+_*_)*Math.sqrt(g*g+v*v+b*b))&&Br(a,u)/w,Math.acos(Math.min(Math.max(E,-1),1));var a,u,h,f,_,g,v,b,w,E}function Pm(r,e){return ig(r,e)>Math.PI/2*1.01}const rg=Mi(85),Xv=Math.cos(rg),Yv=Math.sin(rg),Kv=jt(),ng=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function sg(r,e,i,s,a,u,h,f,_){if(u&&r.queryGeometry.isAboveHorizon)return!1;u&&(_*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,v=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const w of b){const E=w.add(f),A=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(E.x,E.y,!0):0,P=i.projection.projectTilePoint(E.x,E.y,g);if(A>0){const G=i.projection.upVector(g,E.x,E.y);P.x+=G[0]*v*A,P.y+=G[1]*v*A,P.z+=G[2]*v*A}const D=u?E:Jv(P.x,P.y,P.z,s),F=u?r.tilespaceRays.map(G=>e0(G,A)):r.queryGeometry.screenGeometry,j=Tn([],[P.x,P.y,P.z,1],s);if(!h&&u?_*=j[3]/i.cameraToCenterDistance:h&&!u&&(_*=i.cameraToCenterDistance/j[3]),u){const G=fe((w.y/Je+g.y)/(1<<g.z));_/=i.projection.pixelsPerMeter(G,1)/ie(1,G)}if(Ao(F,D,_))return!0}return!1}function Jv(r,e,i,s){const a=Tn([],[r,e,i,1],s);
8return new Xe(a[0]/a[3],a[1]/a[3])}const og=Kt(0,0,0),Qv=Kt(0,0,1);function e0(r,e){const i=ci();return og[2]=e,r.intersectsPlane(og,Qv,i),new Xe(i[0],i[1])}class ag extends hs{}let lg,cg,ug,hg;function dg(r,{width:e,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*s)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=a,r}function pg(r,e,i){const{width:s,height:a}=e;s===r.width&&a===r.height||(Rm(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,s),height:Math.min(r.height,a)},i,null),r.width=s,r.height=a,r.data=e.data)}function Rm(r,e,i,s,a,u,h,f){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||s.x>e.width-a.width||s.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,g=e.data,v=u===4&&f;for(let b=0;b<a.height;b++){const w=((i.y+b)*r.width+i.x)*u,E=((s.y+b)*e.width+s.x)*u;if(v)for(let A=0;A<a.width;A++){const P=w+A*u+3,D=E+A*u;g[D+0]=255,g[D+1]=255,g[D+2]=255,g[D+3]=_[P]}else if(h)for(let A=0;A<a.width;A++){const P=w+A*u,D=E+A*u,F=new Fi(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(h).toArray();g[D+0]=F[0],g[D+1]=F[1],g[D+2]=F[2],g[D+3]=F[3]}else for(let A=0;A<a.width*u;A++)g[E+A]=_[w+A]}return e}st(ag,"HeatmapBucket",{omit:["layers"]});class il{constructor(e,i){dg(this,e,1,i)}resize(e){pg(this,new il(e),1)}clone(){return new il({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u){Rm(e,i,s,a,u,1,null)}}class un{constructor(e,i){dg(this,e,4,i)}resize(e){pg(this,new un(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new un({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u,h,f){Rm(e,i,s,a,u,4,h,f)}}class fg{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function ed(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new un({width:i,height:s}),u=(h,f,_)=>{e[r.evaluationKey]=_;const g=r.expression.evaluate(e),v=g?g.toNonPremultipliedRenderColor(null):null;v&&(a.data[h+f+0]=Math.floor(255*v.r),a.data[h+f+1]=Math.floor(255*v.g),a.data[h+f+2]=Math.floor(255*v.b),a.data[h+f+3]=Math.floor(255*v.a))};if(r.clips)for(let h=0,f=0;h<s;++h,f+=4*i)for(let _=0,g=0;_<i;_++,g+=4){const v=_/(i-1),{start:b,end:w}=r.clips[h];u(f,g,b*(1-v)+w*v)}else for(let h=0,f=0;h<i;h++,f+=4)u(0,f,h/(i-1));return a}st(il,"AlphaImage"),st(un,"RGBAImage");const t0=Ai([{name:"a_pos",components:2,type:"Int16"}],4),i0=Ai([{name:"a_road_z_offset",components:1,type:"Float32"}],4),r0=Ai([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),n0=Ai([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function td(r,e,i=2){const s=e&&e.length,a=s?e[0]*i:r.length;let u=mg(r,0,a,i,!0);const h=[];if(!u||u.next===u.prev)return h;let f,_,g;if(s&&(u=function(v,b,w,E){const A=[];for(let P=0,D=b.length;P<D;P++){const F=mg(v,b[P]*E,P<D-1?b[P+1]*E:v.length,E,!1);F===F.next&&(F.steiner=!0),A.push(d0(F))}A.sort(c0);for(let P=0;P<A.length;P++)w=u0(A[P],w);return w}(r,e,u,i)),r.length>80*i){f=1/0,_=1/0;let v=-1/0,b=-1/0;for(let w=i;w<a;w+=i){const E=r[w],A=r[w+1];E<f&&(f=E),A<_&&(_=A),E>v&&(v=E),A>b&&(b=A)}g=Math.max(v-f,b-_),g=g!==0?32767/g:0}return id(u,h,i,f,_,g,0),h}function mg(r,e,i,s,a){let u;if(a===function(h,f,_,g){let v=0;for(let b=f,w=_-g;b<_;b+=g)v+=(h[w]-h[b])*(h[b+1]+h[w+1]),w=b;return v}(r,e,i,s)>0)for(let h=e;h<i;h+=s)u=xg(h/s|0,r[h],r[h+1],u);else for(let h=i-s;h>=e;h-=s)u=xg(h/s|0,r[h],r[h+1],u);return u&&Mu(u,u.next)&&(sd(u),u=u.next),u}function hc(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!Mu(s,s.next)&&Kr(s.prev,s,s.next)!==0)s=s.next;else{if(sd(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function id(r,e,i,s,a,u,h){if(!r)return;!h&&u&&function(_,g,v,b){let w=_;do w.z===0&&(w.z=zm(w.x,w.y,g,v,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==_);w.prevZ.nextZ=null,w.prevZ=null,function(E){let A,P=1;do{let D,F=E;E=null;let j=null;for(A=0;F;){A++;let G=F,R=0;for(let $=0;$<P&&(R++,G=G.nextZ,G);$++);let N=P;
vendor: 1,916 bytes, line 8
8for(;R>0||N>0&&G;)R!==0&&(N===0||!G||F.z<=G.z)?(D=F,F=F.nextZ,R--):(D=G,G=G.nextZ,N--),j?j.nextZ=D:E=D,D.prevZ=j,j=D;F=G}j.nextZ=null,P*=2}while(A>1)}(w)}(r,s,a,u);let f=r;for(;r.prev!==r.next;){const _=r.prev,g=r.next;if(u?o0(r,s,a,u):s0(r))e.push(_.i,r.i,g.i),sd(r),r=g.next,f=g.next;else if((r=g)===f){h?h===1?id(r=a0(hc(r),e),e,i,s,a,u,2):h===2&&l0(r,e,i,s,a,u):id(hc(r),e,i,s,a,u,1);break}}}function s0(r){const e=r.prev,i=r,s=r.next;if(Kr(e,i,s)>=0)return!1;const a=e.x,u=i.x,h=s.x,f=e.y,_=i.y,g=s.y,v=Math.min(a,u,h),b=Math.min(f,_,g),w=Math.max(a,u,h),E=Math.max(f,_,g);let A=s.next;for(;A!==e;){if(A.x>=v&&A.x<=w&&A.y>=b&&A.y<=E&&rd(a,f,u,_,h,g,A.x,A.y)&&Kr(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function o0(r,e,i,s){const a=r.prev,u=r,h=r.next;if(Kr(a,u,h)>=0)return!1;const f=a.x,_=u.x,g=h.x,v=a.y,b=u.y,w=h.y,E=Math.min(f,_,g),A=Math.min(v,b,w),P=Math.max(f,_,g),D=Math.max(v,b,w),F=zm(E,A,e,i,s),j=zm(P,D,e,i,s);let G=r.prevZ,R=r.nextZ;for(;G&&G.z>=F&&R&&R.z<=j;){if(G.x>=E&&G.x<=P&&G.y>=A&&G.y<=D&&G!==a&&G!==h&&rd(f,v,_,b,g,w,G.x,G.y)&&Kr(G.prev,G,G.next)>=0||(G=G.prevZ,R.x>=E&&R.x<=P&&R.y>=A&&R.y<=D&&R!==a&&R!==h&&rd(f,v,_,b,g,w,R.x,R.y)&&Kr(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;G&&G.z>=F;){if(G.x>=E&&G.x<=P&&G.y>=A&&G.y<=D&&G!==a&&G!==h&&rd(f,v,_,b,g,w,G.x,G.y)&&Kr(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;R&&R.z<=j;){if(R.x>=E&&R.x<=P&&R.y>=A&&R.y<=D&&R!==a&&R!==h&&rd(f,v,_,b,g,w,R.x,R.y)&&Kr(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function a0(r,e){let i=r;do{const s=i.prev,a=i.next.next;!Mu(s,a)&&gg(s,i,i.next,a)&&nd(s,a)&&nd(a,s)&&(e.push(s.i,i.i,a.i),sd(i),sd(i.next),i=r=a),i=i.next}while(i!==r);return hc(i)}function l0(r,e,i,s,a,u){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&p0(h,f)){let _=yg(h,f);return h=hc(h,h.next),_=hc(_,_.next),id(h,e,i,s,a,u,0),void id(_,e,i,s,a,u,0)}f=f.next}h=h.next}while(h!==r)}function c0(r,e){let i=r.x-e.x;
8return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function u0(r,e){const i=function(a,u){let h=u;const f=a.x,_=a.y;let g,v=-1/0;if(Mu(a,h))return h;do{if(Mu(a,h.next))return h.next;if(_<=h.y&&_>=h.next.y&&h.next.y!==h.y){const P=h.x+(_-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(P<=f&&P>v&&(v=P,g=h.x<h.next.x?h:h.next,P===f))return g}h=h.next}while(h!==u);if(!g)return null;const b=g,w=g.x,E=g.y;let A=1/0;h=g;do{if(f>=h.x&&h.x>=w&&f!==h.x&&_g(_<E?f:v,_,w,E,_<E?v:f,_,h.x,h.y)){const P=Math.abs(_-h.y)/(f-h.x);nd(h,a)&&(P<A||P===A&&(h.x>g.x||h.x===g.x&&h0(g,h)))&&(g=h,A=P)}h=h.next}while(h!==b);return g}(r,e);if(!i)return e;const s=yg(i,r);return hc(s,s.next),hc(i,i.next)}function h0(r,e){return Kr(r.prev,r,e.prev)<0&&Kr(e.next,r,r.next)<0}function zm(r,e,i,s,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d0(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function _g(r,e,i,s,a,u,h,f){return(a-h)*(e-f)>=(r-h)*(u-f)&&(r-h)*(s-f)>=(i-h)*(e-f)&&(i-h)*(u-f)>=(a-h)*(s-f)}function rd(r,e,i,s,a,u,h,f){return!(r===h&&e===f)&&_g(r,e,i,s,a,u,h,f)}function p0(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&gg(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1}(r,e)&&(nd(r,e)&&nd(e,r)&&function(i,s){let a=i,u=!1;const h=(i.x+s.x)/2,f=(i.y+s.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&h<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(u=!u),a=a.next;while(a!==i);return u}(r,e)&&(Kr(r.prev,r,e.prev)||Kr(r,e.prev,e))||Mu(r,e)&&Kr(r.prev,r,r.next)>0&&Kr(e.prev,e,e.next)>0)}function Kr(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Mu(r,e){return r.x===e.x&&r.y===e.y}function gg(r,e,i,s){const a=Zp(Kr(r,e,i)),u=Zp(Kr(r,e,s)),h=Zp(Kr(i,s,r)),f=Zp(Kr(i,s,e));return a!==u&&h!==f||!(a!==0||!Hp(r,i,e))||!(u!==0||!Hp(r,s,e))||!(h!==0||!Hp(i,r,s))||!(f!==0||!Hp(i,e,s))}function Hp(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function Zp(r){return r>0?1:r<0?-1:0}function nd(r,e){return Kr(r.prev,r,r.next)<0?Kr(r,e,r.next)>=0&&Kr(r,r.prev,e)>=0:Kr(r,e,r.prev)<0||Kr(r,r.next,e)<0}function yg(r,e){const i=Dm(r.i,r.x,r.y),s=Dm(e.i,e.x,e.y),a=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,s.next=i,i.prev=s,u.next=s,s.prev=u,s}function xg(r,e,i,s){const a=Dm(r,e,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function sd(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Dm(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Wp(r,e){const i=r.length;if(i<=1)return[r];const s=[];let a,u;for(let h=0;h<i;h++){const f=pr(r[h]);f!==0&&(r[h].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(a&&s.push(a),a=[r[h]]):a.push(r[h]))}if(a&&s.push(a),e>1)for(let h=0;h<s.length;h++)s[h].length<=e||(_n(s[h],e,1,s[h].length-1,f0),s[h]=s[h].slice(0,e));return s}function f0(r,e){return e.area-r.area}function vg(r,e,i=1){if(!r)return null;const s=typeof r=="string"?Ln.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const u of[s,a]){if(!u)continue;const h=u.id.toString();e.has(h)||e.set(h,[]),u.scaleSelf(i),e.get(h).push(u)}return{primary:s.toString(),secondary:a?a.toString():null}}function Lm(r,e,i,s){const a=s.patternDependencies;let u=!1;for(const h of e){const f=h.paint.get(`${r}-pattern`);f.isConstant()||(u=!0),vg(f.constantOr(null),a,i)&&(u=!0)}return u}function km(r,e,i,s,a,u){const h=u.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let g=_.evaluate({zoom:s},i,{},u.availableImages);g=g&&g.name?g.name:g;const v=vg(g,h,a);if(!v)continue;const{primary:b,secondary:w}=v;b&&(i.patterns[f.id]=[b,w].filter(Boolean))}}return i}class bg{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,s]of e.polygons)this.add(i,...s)}}class dc{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new dc;let i=[];for(const g of e)i.push(...g.portals);if(i.length===0)return new dc;const s=(g,v)=>g<=0&&v<=0||g>=Je&&v>=Je;for(const g of i){const v=g.va,b=g.vb;(s(v.x,b.x)||s(v.y,b.y))&&(g.type="border")}const a=i.filter(g=>g.type!=="unevaluated"),u=i.filter(g=>g.type==="unevaluated");if(u.length===0)return new dc;u.sort((g,v)=>g.hash===v.hash?g.isTunnel===v.isTunnel?0:g.isTunnel?-1:1:g.hash<v.hash?1:-1),i=a.concat(u);let h=a.length,f=h,_=h;
8do if(f++,f===i.length||i[h].hash!==i[f].hash){if(f-h==2){_<h&&(i[_]=i[h],i[h]=null);const g=i[_],v=i[f-1];g.type=g.isTunnel!==v.isTunnel?"tunnel":"polygon",g.connection={a:g.connection.a,b:v.connection.a},_++}h=f}while(h!==i.length);return i.splice(_),i.sort((g,v)=>g.hash<v.hash?1:-1),{portals:i}}}st(dc,"ElevationPortalGraph"),st(bg,"ElevationPolygons");class m0{constructor(e,i,s){this.outPositions=e,this.outNormals=i,this.outIndices=s,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,s){let a=e[2];s!=null&&(a*=s);const u=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),h=this.vertexLookup.get(u);if(h!=null)return h;const f=this.outPositions.length;this.vertexLookup.set(u,f);const _=Math.trunc(16384*i[0]),g=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,g,v),f}addVertices(e,i,...s){const a=[];for(const u of s){const h=this.addVertex(u,e,i);a.push(h)}return a}addTriangles(e,i,s){if(i&&s){const a=s.length===1,u=Kt(0,0,0);for(let h=0;h<e.length;h+=3){const f=i[e[h+0]],_=i[e[h+1]],g=i[e[h+2]],v=a?s[0]:s[e[h+1]],b=a?s[0]:s[e[h+2]],w=this.addVertex(Kt(f.x,f.y,a?s[0]:s[e[h+0]]),u),E=this.addVertex(Kt(_.x,_.y,v),u),A=this.addVertex(Kt(g.x,g.y,b),u);this.outIndices.emplaceBack(w,E,A)}}else for(let a=0;a<e.length;a+=3)this.outIndices.emplaceBack(e[a+0],e[a+1],e[a+2])}addQuad(e,i){const s=this.addVertices(i,void 0,...e.map(_=>Kt(_.coord.x,_.coord.y,_.height))),[a,u,h,f]=s;this.addTriangles([a,u,h,h,f,a])}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class ds{constructor(e,i,s,a){this.unevaluatedPortals=new dc,this.portalPolygons=new bg,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Oh,this.vertexNormals=new pu,this.indexArray=new sn,this.tileToMeters=Te(e),this.bridgeProgramConfigurations=new l(i,{zoom:s,lut:a},u=>u!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new l(i,{zoom:s,lut:a},u=>u!=="fill-bridge-guard-rail-color")}addVertices(e,i){const s=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return s}addTriangles(e,i,s){const a=s?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,s,a,u,h){const f=[new Xe(u.min.x,u.min.y),new Xe(u.max.x,u.min.y),new Xe(u.max.x,u.max.y),new Xe(u.min.x,u.max.y)];for(let _=0;_<s-1;_++){const g=i+_,v=g+1,b=this.unevalVertices[g],w=this.unevalVertices[v];if(!(b.x>=u.min.x&&b.x<=u.max.x&&b.y>=u.min.y&&b.y<=u.max.y||w.x>=u.min.x&&w.x<=u.max.x&&w.y>=u.min.y&&w.y<=u.max.y||aa(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const E=ds.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let A,P=this.vertexHashLookup.get(ds.computePosHash(b));P!=null?A=P.next:(P=this.vertexHashLookup.get(ds.computePosHash(w)),A=P!=null?P.prev:E),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:E,portalHash:A,isTunnel:a,type:"unevaluated",featureInfo:h})}}addPortalCandidates(e,i,s,a,u){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:u});const h=i[0];this.vertexHashLookup.clear();let f=ds.computeEdgeHash(h[h.length-2],h[h.length-1]);for(let _=0;_<h.length-1;_++){const g=h[_+0],v=h[_+1],b=ns(v.x-g.x,v.y-g.y),w=ao(b);if(w===0)continue;let E="unevaluated";const A=a.pointElevation(g),P=a.pointElevation(v);Math.abs(A)<.01&&Math.abs(P)<.01?E="entrance":(this.isOnBorder(g.x,v.x)||this.isOnBorder(g.y,v.y))&&(E="border");const D=ds.computeEdgeHash(g,v);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:g,vb:v,vab:b,length:w,hash:D,isTunnel:s,type:E});const F=ds.computePosHash(g);this.vertexHashLookup.set(F,{prev:f,next:D}),f=D}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),s=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},a=new m0(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),h=i(),f=i(),_=(w,E)=>{w.sort((P,D)=>P.type===E&&D.type!==E?-1:P.type!==E&&D.type===E?1:0);const A=w.findIndex(P=>P.type!==E);return A>=0?A:w.length};let g=0;this.unevalEdges.length>0&&(g=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),s(f);const v=i(),b=i();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),E=_(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:E})}s(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),s(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),s(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),s(u),this.maskSegments=Ar.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=Ar.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableBridgeSegments=Ar.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=Ar.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=Ar.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}update(e,i,s,a,u,h,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_)}
8upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,r0.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,n0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,i,s,a,u){const h=(f,_)=>{for(let g=0;g<_.length-1;g++){const v=_[g].featureIndex,b=_[g+1].vertexStart,w=e.feature(v);f.populatePaintArrays(b,w,v,{},s,i,a,void 0,u)}};h(this.bridgeProgramConfigurations,this.bridgeFeatureSections),h(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,s,a,u){const h=new Map;for(let f=a;f<u;f++){const _=s[f],g=_.a,v=_.b,b=ds.computePosHash(e[g]),w=ds.computePosHash(e[v]);h.has(b)||h.set(b,{}),h.has(w)||h.set(w,{});const E=h.get(b),A=h.get(w);i[g]<=0&&i[v]<=0||(E.to=v,A.from=g)}return h}constructBridgeStructures(e,i,s,a,u,h){e.clearVertexLookup();const f=this.computeVertexConnections(i,s,a,u.min,u.max),_=1/h,g=.5*_,v=E=>Kt(i[E].x,i[E].y,s[E]*_),b=E=>{const A=f.get(ds.computePosHash(i[E])),P=A.from,D=A.to;if(!P||!D)return;const F=v(P),j=v(E),G=v(D),R=Kt(0,0,0);if(!ps(F,j)){const $=Nr(ci(),j,F);ki(R,R,Tr($,$))}if(!ps(G,j)){const $=Nr(ci(),G,j);ki(R,R,Tr($,$))}const N=io(R);return N>0?Zi(R,R,1/N):void 0};let w=Number.POSITIVE_INFINITY;this.sortSubarray(a,u.min,u.max,(E,A)=>E.featureInfo.featureIndex-A.featureInfo.featureIndex);for(let E=u.min;E<u.max;E++){const A=a[E];if(!A.featureInfo.guardRailEnabled)continue;const P=this.prepareEdgePoints(i,s,A,(Ht,ut)=>Ht>ut);if(P==null)continue;const D=P[0],F=P[1],j=Kt(D.coord.x,D.coord.y,_*D.height),G=Kt(F.coord.x,F.coord.y,_*F.height);if(ps(j,G))continue;const R=Nr(ci(),G,j);Tr(R,R);const N=Ht=>Tr(Ht,Ht),$=b(A.a)||R,Z=b(A.b)||R,oe=N(Kt($[1],-$[0],0)),re=N(Kt(Z[1],-Z[0],0)),ae=N(Yr(ci(),oe,$)),he=N(Yr(ci(),re,Z)),Se=ci(),Be=[ki(ci(),j,Zi(Se,Nr(Se,oe,ae),g)),ki(ci(),j,Zi(Se,ki(Se,oe,ae),g)),ki(ci(),j,Zi(Se,ae,g)),j],ze=[ki(ci(),G,Zi(Se,Nr(Se,re,he),g)),ki(ci(),G,Zi(Se,ki(Se,re,he),g)),ki(ci(),G,Zi(Se,he,g)),G];w=this.addFeatureSection(A.featureInfo.featureIndex,w,this.bridgeFeatureSections,e);const[Oe,Ne]=e.addVertices(oe,h,Be[0],Be[1]),[Ie,ke]=e.addVertices(re,h,ze[0],ze[1]);e.addTriangles([Oe,Ne,Ie,Ne,ke,Ie]);const[we,Ee]=e.addVertices(ae,h,Be[1],Be[2]),[je,$e]=e.addVertices(he,h,ze[1],ze[2]);e.addTriangles([we,Ee,je,Ee,$e,je]);const[vt,ht]=e.addVertices(to(oe,oe),h,Be[2],Be[3]),[et,Ue]=e.addVertices(to(re,re),h,ze[2],ze[3]);e.addTriangles([vt,ht,et,ht,Ue,et])}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,s,a,u,h){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(v,b)=>v.featureInfo.featureIndex-b.featureInfo.featureIndex;this.sortSubarray(a,u.min,u.max,_),this.sortSubarray(a,h.min,h.max,_);const g=v=>Tr(v,v);for(let v=u.min;v<u.max;v++){const b=this.prepareEdgePoints(i,s,a[v],(P,D)=>P<D);if(b==null)continue;const[w,E]=b,A=g(Kt(-(E.coord.y-w.coord.y),E.coord.x-w.coord.x,0));f=this.addFeatureSection(a[v].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad([w,E,{coord:E.coord,height:a[v].isTunnel?-.1:0},{coord:w.coord,height:a[v].isTunnel?-.1:0}],A)}for(let v=h.min;v<h.max;v++){const b=a[v];b.isTunnel&&([b.a,b.b]=[b.b,b.a]);const w=i[b.a],E=i[b.b],A=g(Kt(-(E.y-w.y),E.x-w.x,0));f=this.addFeatureSection(b.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad([{coord:E,height:0},{coord:w,height:0},{coord:w,height:s[b.a]+4},{coord:E,height:s[b.b]+4}],A),e.addQuad([{coord:w,height:0},{coord:E,height:0},{coord:E,height:s[b.b]+4},{coord:w,height:s[b.a]+4}],A)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}prepareEdgePoints(e,i,s,a){let u=i[s.a],h=i[s.b];const f=a(u,0),_=a(h,0);if(f&&_)return[{coord:e[s.a],height:u},{coord:e[s.b],height:h}];if(!f&&!_)return;const g=e[s.a].clone(),v=e[s.b].clone();if(f){if(!_){const b=h/(h-u);v.x=Ft(v.x,g.x,b),v.y=Ft(v.y,g.y,b),h=Ft(h,u,b)}}else{const b=u/(u-h);
8g.x=Ft(g.x,v.x,b),g.y=Ft(g.y,v.y,b),u=Ft(u,h,b)}return[{coord:g,height:u},{coord:v,height:h}]}prepareEdges(e,i){if(i.length===0)return;i.sort((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1);let s=0,a=0,u=0,h=i[s].polygonIdx;do a++,(a===i.length||i[s].hash!==i[a].hash)&&((a-s==1||i[a-1].polygonIdx!==h)&&(u<s&&(i[u]=i[s],i[s]=null),i[u].type="none",u++),s=a,s!==i.length&&(h=i[s].polygonIdx));while(s!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort((g,v)=>g.portalHash<v.portalHash?1:-1);let f=0,_=0;for(;f!==i.length&&_!==e.length;){const g=i[f],v=e[_];g.portalHash>v.hash?f++:v.hash>g.portalHash?_++:(g.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=Je&&i>=Je}addFeatureSection(e,i,s,a){return e!==i&&(i=e,s.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,s,a){const u=e.slice(i,s);u.sort(a),e.splice(i,u.length,...u)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(ds.computePosHash(e))<<32n|BigInt(ds.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var wg,Tg={exports:{}},Sg=(wg||(wg=1,function(r,e){(function(i){function s(q,W){return q>W?1:q<W?-1:0}var a=function(q,W){q===void 0&&(q=s),W===void 0&&(W=!1),this._compare=q,this._root=null,this._size=0,this._noDuplicates=!!W},u={size:{configurable:!0}};function h(q,W,Ae,He,tt){var Qe=tt-He;if(Qe>0){var ct=He+Math.floor(Qe/2),Dt={key:W[ct],data:Ae[ct],parent:q};return Dt.left=h(Dt,W,Ae,He,ct),Dt.right=h(Dt,W,Ae,ct+1,tt),Dt}return null}function f(q,W,Ae,He,tt){if(!(Ae>=He)){for(var Qe=q[Ae+He>>1],ct=Ae-1,Dt=He+1;;){do ct++;while(tt(q[ct],Qe)<0);do Dt--;while(tt(q[Dt],Qe)>0);if(ct>=Dt)break;var _i=q[ct];q[ct]=q[Dt],q[Dt]=_i,_i=W[ct],W[ct]=W[Dt],W[Dt]=_i}f(q,W,Ae,Dt,tt),f(q,W,Dt+1,He,tt)}}a.prototype.rotateLeft=function(q){var W=q.right;W&&(q.right=W.left,W.left&&(W.left.parent=q),W.parent=q.parent),q.parent?q===q.parent.left?q.parent.left=W:q.parent.right=W:this._root=W,W&&(W.left=q),q.parent=W},a.prototype.rotateRight=function(q){var W=q.left;W&&(q.left=W.right,W.right&&(W.right.parent=q),W.parent=q.parent),q.parent?q===q.parent.left?q.parent.left=W:q.parent.right=W:this._root=W,W&&(W.right=q),q.parent=W},a.prototype._splay=function(q){for(;q.parent;){var W=q.parent;W.parent?W.left===q&&W.parent.left===W?(this.rotateRight(W.parent),this.rotateRight(W)):W.right===q&&W.parent.right===W?(this.rotateLeft(W.parent),this.rotateLeft(W)):W.left===q&&W.parent.right===W?(this.rotateRight(W),this.rotateLeft(W)):(this.rotateLeft(W),this.rotateRight(W)):W.left===q?this.rotateRight(W):this.rotateLeft(W)}},a.prototype.splay=function(q){for(var W,Ae,He,tt,Qe;q.parent;)(Ae=(W=q.parent).parent)&&Ae.parent?((He=Ae.parent).left===Ae?He.left=q:He.right=q,q.parent=He):(q.parent=null,this._root=q),tt=q.left,Qe=q.right,q===W.left?(Ae&&(Ae.left===W?(W.right?(Ae.left=W.right,Ae.left.parent=Ae):Ae.left=null,W.right=Ae,Ae.parent=W):(tt?(Ae.right=tt,tt.parent=Ae):Ae.right=null,q.left=Ae,Ae.parent=q)),Qe?(W.left=Qe,Qe.parent=W):W.left=null,q.right=W,W.parent=q):(Ae&&(Ae.right===W?(W.left?(Ae.right=W.left,Ae.right.parent=Ae):Ae.right=null,W.left=Ae,Ae.parent=W):(Qe?(Ae.left=Qe,Qe.parent=Ae):Ae.left=null,q.right=Ae,Ae.parent=q)),tt?(W.right=tt,tt.parent=W):W.right=null,q.left=W,W.parent=q)},a.prototype.replace=function(q,W){q.parent?q===q.parent.left?q.parent.left=W:q.parent.right=W:this._root=W,W&&(W.parent=q.parent)},a.prototype.minNode=function(q){if(q===void 0&&(q=this._root),q)for(;q.left;)q=q.left;return q},a.prototype.maxNode=function(q){if(q===void 0&&(q=this._root),q)for(;q.right;)q=q.right;return q},a.prototype.insert=function(q,W){var Ae=this._root,He=null,tt=this._compare;if(this._noDuplicates)for(;Ae;){if(He=Ae,tt(Ae.key,q)===0)return;Ae=tt(Ae.key,q)<0?Ae.right:Ae.left}else for(;Ae;)He=Ae,Ae=tt(Ae.key,q)<0?Ae.right:Ae.left;return Ae={key:q,data:W,left:null,right:null,parent:He},He?tt(He.key,Ae.key)<0?He.right=Ae:He.left=Ae:this._root=Ae,this.splay(Ae),this._size++,Ae},a.prototype.find=function(q){for(var W=this._root,Ae=this._compare;W;){var He=Ae(W.key,q);if(He<0)W=W.right;else{if(!(He>0))return W;W=W.left}}return null},a.prototype.contains=function(q){for(var W=this._root,Ae=this._compare;W;){var He=Ae(q,W.key);if(He===0)return!0;W=He<0?W.left:W.right}return!1},a.prototype.remove=function(q){var W=this.find(q);if(!W)return!1;if(this.splay(W),W.left)if(W.right){var Ae=this.minNode(W.right);Ae.parent!==W&&(this.replace(Ae,Ae.right),Ae.right=W.right,Ae.right.parent=Ae),this.replace(W,Ae),Ae.left=W.left,Ae.left.parent=Ae}else this.replace(W,W.left);else this.replace(W,W.right);return this._size--,!0},a.prototype.removeNode=function(q){if(!q)return!1;if(this.splay(q),q.left)if(q.right){var W=this.minNode(q.right);W.parent!==q&&(this.replace(W,W.right),W.right=q.right,W.right.parent=W),this.replace(q,W),W.left=q.left,W.left.parent=W}else this.replace(q,q.left);else this.replace(q,q.right);return this._size--,!0}
8,a.prototype.erase=function(q){var W=this.find(q);if(W){this.splay(W);var Ae=W.left,He=W.right,tt=null;Ae&&(Ae.parent=null,tt=this.maxNode(Ae),this.splay(tt),this._root=tt),He&&(Ae?tt.right=He:this._root=He,He.parent=tt),this._size--}},a.prototype.pop=function(){var q=this._root,W=null;if(q){for(;q.left;)q=q.left;W={key:q.key,data:q.data},this.remove(q.key)}return W},a.prototype.next=function(q){var W=q;if(W)if(W.right)for(W=W.right;W&&W.left;)W=W.left;else for(W=q.parent;W&&W.right===q;)q=W,W=W.parent;return W},a.prototype.prev=function(q){var W=q;if(W)if(W.left)for(W=W.left;W&&W.right;)W=W.right;else for(W=q.parent;W&&W.left===q;)q=W,W=W.parent;return W},a.prototype.forEach=function(q){for(var W=this._root,Ae=[],He=!1,tt=0;!He;)W?(Ae.push(W),W=W.left):Ae.length>0?(q(W=Ae.pop(),tt++),W=W.right):He=!0;return this},a.prototype.range=function(q,W,Ae,He){for(var tt=[],Qe=this._compare,ct=this._root;tt.length!==0||ct;)if(ct)tt.push(ct),ct=ct.left;else{if(Qe((ct=tt.pop()).key,W)>0)break;if(Qe(ct.key,q)>=0&&Ae.call(He,ct))return this;ct=ct.right}return this},a.prototype.keys=function(){for(var q=this._root,W=[],Ae=[],He=!1;!He;)q?(W.push(q),q=q.left):W.length>0?(q=W.pop(),Ae.push(q.key),q=q.right):He=!0;return Ae},a.prototype.values=function(){for(var q=this._root,W=[],Ae=[],He=!1;!He;)q?(W.push(q),q=q.left):W.length>0?(q=W.pop(),Ae.push(q.data),q=q.right):He=!0;return Ae},a.prototype.at=function(q){for(var W=this._root,Ae=[],He=!1,tt=0;!He;)if(W)Ae.push(W),W=W.left;else if(Ae.length>0){if(W=Ae.pop(),tt===q)return W;tt++,W=W.right}else He=!0;return null},a.prototype.load=function(q,W,Ae){if(q===void 0&&(q=[]),W===void 0&&(W=[]),Ae===void 0&&(Ae=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var He=q.length;return Ae&&f(q,W,0,He-1,this._compare),this._root=h(null,q,W,0,He),this._size=He,this},a.prototype.min=function(){var q=this.minNode(this._root);return q?q.key:null},a.prototype.max=function(){var q=this.maxNode(this._root);return q?q.key:null},a.prototype.isEmpty=function(){return this._root===null},u.size.get=function(){return this._size},a.createTree=function(q,W,Ae,He,tt){return new a(Ae,tt).load(q,W,He)},Object.defineProperties(a.prototype,u);var _=0,g=1,v=2,b=3,w=0,E=1,A=2,P=3;function D(q,W,Ae){W===null?(q.inOut=!1,q.otherInOut=!0):(q.isSubject===W.isSubject?(q.inOut=!W.inOut,q.otherInOut=W.otherInOut):(q.inOut=!W.otherInOut,q.otherInOut=W.isVertical()?!W.inOut:W.inOut),W&&(q.prevInResult=!F(W,Ae)||W.isVertical()?W.prevInResult:W));var He=F(q,Ae);q.resultTransition=He?function(tt,Qe){var ct,Dt=!tt.inOut,_i=!tt.otherInOut;switch(Qe){case w:ct=Dt&&_i;break;case E:ct=Dt||_i;break;case P:ct=Dt^_i;break;case A:ct=tt.isSubject?Dt&&!_i:_i&&!Dt}return ct?1:-1}(q,Ae):0}function F(q,W){switch(q.type){case _:switch(W){case w:return!q.otherInOut;case E:return q.otherInOut;case A:return q.isSubject&&q.otherInOut||!q.isSubject&&!q.otherInOut;case P:return!0}break;case v:return W===w||W===E;case b:return W===A;case g:return!1}return!1}var j=function(q,W,Ae,He,tt){this.left=W,this.point=q,this.otherEvent=Ae,this.isSubject=He,this.type=tt||_,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},G={inResult:{configurable:!0}};function R(q,W){return q[0]===W[0]&&q[1]===W[1]}j.prototype.isBelow=function(q){var W=this.point,Ae=this.otherEvent.point;return this.left?(W[0]-q[0])*(Ae[1]-q[1])-(Ae[0]-q[0])*(W[1]-q[1])>0:(Ae[0]-q[0])*(W[1]-q[1])-(W[0]-q[0])*(Ae[1]-q[1])>0},j.prototype.isAbove=function(q){return!this.isBelow(q)},j.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},G.inResult.get=function(){return this.resultTransition!==0},j.prototype.clone=function(){var q=new j(this.point,this.left,this.otherEvent,this.isSubject,this.type);return q.contourId=this.contourId,q.resultTransition=this.resultTransition,q.prevInResult=this.prevInResult,q.isExteriorRing=this.isExteriorRing,q.inOut=this.inOut,q.otherInOut=this.otherInOut,q},Object.defineProperties(j.prototype,G);var N=11102230246251565e-32,$=134217729,Z=(3+8*N)*N;function oe(q,W,Ae,He,tt){var Qe,ct,Dt,_i,gi=W[0],si=He[0],Gi=0,er=0;si>gi==si>-gi?(Qe=gi,gi=W[++Gi]):(Qe=si,si=He[++er]);var yi=0;if(Gi<q&&er<Ae)for(si>gi==si>-gi?(Dt=Qe-((ct=gi+Qe)-gi),gi=W[++Gi]):(Dt=Qe-((ct=si+Qe)-si),si=He[++er]),Qe=ct,Dt!==0&&(tt[yi++]=Dt);Gi<q&&er<Ae;)si>gi==si>-gi?(Dt=Qe-((ct=Qe+gi)-(_i=ct-Qe))+(gi-_i),gi=W[++Gi]):(Dt=Qe-((ct=Qe+si)-(_i=ct-Qe))+(si-_i),si=He[++er]),Qe=ct,Dt!==0&&(tt[yi++]=Dt);for(;Gi<q;)Dt=Qe-((ct=Qe+gi)-(_i=ct-Qe))+(gi-_i),gi=W[++Gi],Qe=ct,Dt!==0&&(tt[yi++]=Dt);for(;er<Ae;)Dt=Qe-((ct=Qe+si)-(_i=ct-Qe))+(si-_i),si=He[++er],Qe=ct,Dt!==0&&(tt[yi++]=Dt);return Qe===0&&yi!==0||(tt[yi++]=Qe),yi}function re(q){return new Float64Array(q)}var ae=33306690738754716e-32,he=22204460492503146e-32,Se=11093356479670487e-47,Be=re(4),ze=re(8),Oe=re(12),Ne=re(16),Ie=re(4);function ke(q,W,Ae){var He=function(tt,Qe,ct,Dt,_i,gi){var si=(Qe-gi)*(ct-_i),Gi=(tt-_i)*(Dt-gi),er=si-Gi;if(si===0||Gi===0||si>0!=Gi>0)return er;var yi=Math.abs(si+Gi);return Math.abs(er)>=ae*yi?er:-function(br,sr,Vi,zr,ur,tr,or){var Hi,ai,Xi,wr,Mt,Si,hr,Cr,gr,qr,Yi,jr,Hn,hn,an,Zn,Do,Hr,Wr=br-ur,dn=Vi-ur,Pn=sr-tr,xn=zr-tr;Be[0]=(an=(Cr=Wr-(hr=(Si=$*Wr)-(Si-Wr)))*(qr=xn-(gr=(Si=$*xn)-(Si-xn)))-((hn=Wr*xn)-hr*gr-Cr*gr-hr*qr))-((Yi=an-(Do=(Cr=Pn-(hr=(Si=$*Pn)-(Si-Pn)))*(qr=dn-(gr=(Si=$*dn)-(Si-dn)))-((Zn=Pn*dn)-hr*gr-Cr*gr-hr*qr)))+(Mt=an-Yi))+(Mt-Do),Be[1]=(Hn=hn-((jr=hn+Yi
8)-(Mt=jr-hn))+(Yi-Mt))-((Yi=Hn-Zn)+(Mt=Hn-Yi))+(Mt-Zn),Be[2]=jr-((Hr=jr+Yi)-(Mt=Hr-jr))+(Yi-Mt),Be[3]=Hr;var ll=function(nE,Dv){for(var Lv=Dv[0],V_=1;V_<4;V_++)Lv+=Dv[V_];return Lv}(0,Be),Dd=he*or;if(ll>=Dd||-ll>=Dd||(Hi=br-(Wr+(Mt=br-Wr))+(Mt-ur),Xi=Vi-(dn+(Mt=Vi-dn))+(Mt-ur),ai=sr-(Pn+(Mt=sr-Pn))+(Mt-tr),wr=zr-(xn+(Mt=zr-xn))+(Mt-tr),Hi===0&&ai===0&&Xi===0&&wr===0)||(Dd=Se*or+Z*Math.abs(ll),(ll+=Wr*wr+xn*Hi-(Pn*Xi+dn*ai))>=Dd||-ll>=Dd))return ll;Ie[0]=(an=(Cr=Hi-(hr=(Si=$*Hi)-(Si-Hi)))*(qr=xn-(gr=(Si=$*xn)-(Si-xn)))-((hn=Hi*xn)-hr*gr-Cr*gr-hr*qr))-((Yi=an-(Do=(Cr=ai-(hr=(Si=$*ai)-(Si-ai)))*(qr=dn-(gr=(Si=$*dn)-(Si-dn)))-((Zn=ai*dn)-hr*gr-Cr*gr-hr*qr)))+(Mt=an-Yi))+(Mt-Do),Ie[1]=(Hn=hn-((jr=hn+Yi)-(Mt=jr-hn))+(Yi-Mt))-((Yi=Hn-Zn)+(Mt=Hn-Yi))+(Mt-Zn),Ie[2]=jr-((Hr=jr+Yi)-(Mt=Hr-jr))+(Yi-Mt),Ie[3]=Hr;var rw=oe(4,Be,4,Ie,ze);Ie[0]=(an=(Cr=Wr-(hr=(Si=$*Wr)-(Si-Wr)))*(qr=wr-(gr=(Si=$*wr)-(Si-wr)))-((hn=Wr*wr)-hr*gr-Cr*gr-hr*qr))-((Yi=an-(Do=(Cr=Pn-(hr=(Si=$*Pn)-(Si-Pn)))*(qr=Xi-(gr=(Si=$*Xi)-(Si-Xi)))-((Zn=Pn*Xi)-hr*gr-Cr*gr-hr*qr)))+(Mt=an-Yi))+(Mt-Do),Ie[1]=(Hn=hn-((jr=hn+Yi)-(Mt=jr-hn))+(Yi-Mt))-((Yi=Hn-Zn)+(Mt=Hn-Yi))+(Mt-Zn),Ie[2]=jr-((Hr=jr+Yi)-(Mt=Hr-jr))+(Yi-Mt),Ie[3]=Hr;var nw=oe(rw,ze,4,Ie,Oe);Ie[0]=(an=(Cr=Hi-(hr=(Si=$*Hi)-(Si-Hi)))*(qr=wr-(gr=(Si=$*wr)-(Si-wr)))-((hn=Hi*wr)-hr*gr-Cr*gr-hr*qr))-((Yi=an-(Do=(Cr=ai-(hr=(Si=$*ai)-(Si-ai)))*(qr=Xi-(gr=(Si=$*Xi)-(Si-Xi)))-((Zn=ai*Xi)-hr*gr-Cr*gr-hr*qr)))+(Mt=an-Yi))+(Mt-Do),Ie[1]=(Hn=hn-((jr=hn+Yi)-(Mt=jr-hn))+(Yi-Mt))-((Yi=Hn-Zn)+(Mt=Hn-Yi))+(Mt-Zn),Ie[2]=jr-((Hr=jr+Yi)-(Mt=Hr-jr))+(Yi-Mt),Ie[3]=Hr;var sw=oe(nw,Oe,4,Ie,Ne);return Ne[sw-1]}(tt,Qe,ct,Dt,_i,gi,yi)}(q[0],q[1],W[0],W[1],Ae[0],Ae[1]);return He>0?-1:He<0?1:0}function we(q,W){var Ae=q.point,He=W.point;return Ae[0]>He[0]?1:Ae[0]<He[0]?-1:Ae[1]!==He[1]?Ae[1]>He[1]?1:-1:function(tt,Qe,ct,Dt){return tt.left!==Qe.left?tt.left?1:-1:ke(ct,tt.otherEvent.point,Qe.otherEvent.point)!==0?tt.isBelow(Qe.otherEvent.point)?-1:1:!tt.isSubject&&Qe.isSubject?1:-1}(q,W,Ae)}function Ee(q,W,Ae){var He=new j(W,!1,q,q.isSubject),tt=new j(W,!0,q.otherEvent,q.isSubject);return R(q.point,q.otherEvent.point)&&console.warn("what is that, a collapsed segment?",q),He.contourId=tt.contourId=q.contourId,we(tt,q.otherEvent)>0&&(q.otherEvent.left=!0,tt.left=!1),q.otherEvent.otherEvent=tt,q.otherEvent=He,Ae.push(tt),Ae.push(He),Ae}function je(q,W){return q[0]*W[1]-q[1]*W[0]}function $e(q,W){return q[0]*W[0]+q[1]*W[1]}function vt(q,W,Ae){var He=function(_i,gi,si,Gi,er){var yi=[gi[0]-_i[0],gi[1]-_i[1]],br=[Gi[0]-si[0],Gi[1]-si[1]];function sr(Si,hr,Cr){return[Si[0]+hr*Cr[0],Si[1]+hr*Cr[1]]}var Vi=[si[0]-_i[0],si[1]-_i[1]],zr=je(yi,br),ur=zr*zr,tr=$e(yi,yi);if(ur>0){var or=je(Vi,br)/zr;if(or<0||or>1)return null;var Hi=je(Vi,yi)/zr;return Hi<0||Hi>1?null:or===0||or===1?[sr(_i,or,yi)]:Hi===0||Hi===1?[sr(si,Hi,br)]:[sr(_i,or,yi)]}if((ur=(zr=je(Vi,yi))*zr)>0)return null;var ai=$e(yi,Vi)/tr,Xi=ai+$e(yi,br)/tr,wr=Math.min(ai,Xi),Mt=Math.max(ai,Xi);return wr<=1&&Mt>=0?wr===1?[sr(_i,wr>0?wr:0,yi)]:Mt===0?[sr(_i,Mt<1?Mt:1,yi)]:[sr(_i,wr>0?wr:0,yi),sr(_i,Mt<1?Mt:1,yi)]:null}(q.point,q.otherEvent.point,W.point,W.otherEvent.point),tt=He?He.length:0;if(tt===0||tt===1&&(R(q.point,W.point)||R(q.otherEvent.point,W.otherEvent.point))||tt===2&&q.isSubject===W.isSubject)return 0;if(tt===1)return R(q.point,He[0])||R(q.otherEvent.point,He[0])||Ee(q,He[0],Ae),R(W.point,He[0])||R(W.otherEvent.point,He[0])||Ee(W,He[0],Ae),1;var Qe=[],ct=!1,Dt=!1;return R(q.point,W.point)?ct=!0:we(q,W)===1?Qe.push(W,q):Qe.push(q,W),R(q.otherEvent.point,W.otherEvent.point)?Dt=!0:we(q.otherEvent,W.otherEvent)===1?Qe.push(W.otherEvent,q.otherEvent):Qe.push(q.otherEvent,W.otherEvent),ct&&Dt||ct?(W.type=g,q.type=W.inOut===q.inOut?v:b,ct&&!Dt&&Ee(Qe[1].otherEvent,Qe[0].point,Ae),2):Dt?(Ee(Qe[0],Qe[1].point,Ae),3):Qe[0]!==Qe[3].otherEvent?(Ee(Qe[0],Qe[1].point,Ae),Ee(Qe[1],Qe[2].point,Ae),3):(Ee(Qe[0],Qe[1].point,Ae),Ee(Qe[3].otherEvent,Qe[2].point,Ae),3)}function ht(q,W){if(q===W)return 0;if(ke(q.point,q.otherEvent.point,W.point)!==0||ke(q.point,q.otherEvent.point,W.otherEvent.point)!==0)return R(q.point,W.point)?q.isBelow(W.otherEvent.point)?-1:1:q.point[0]===W.point[0]?q.point[1]<W.point[1]?-1:1:we(q,W)===1?W.isAbove(q.point)?-1:1:q.isBelow(W.point)?-1:1;if(q.isSubject!==W.isSubject)return q.isSubject?-1:1;var Ae=q.point,He=W.point;return Ae[0]===He[0]&&Ae[1]===He[1]?(Ae=q.otherEvent.point)[0]===(He=W.otherEvent.point)[0]&&Ae[1]===He[1]?0:q.contourId>W.contourId?1:-1:we(q,W)===1?1:-1}var et=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ue(q,W,Ae,He){var tt,Qe=q+1,ct=W[q].point,Dt=W.length;for(Qe<Dt&&(tt=W[Qe].point);Qe<Dt&&tt[0]===ct[0]&&tt[1]===ct[1];){if(!Ae[Qe])return Qe;++Qe<Dt&&(tt=W[Qe].point)}for(Qe=q-1;Ae[Qe]&&Qe>He;)Qe--;return Qe}et.prototype.isExterior=function(){return this.holeOf==null};var Ht=pt,ut=pt;function pt(q,W){if(!(this instanceof pt))return new pt(q,W);if(this.data=q||[],this.length=this.data.length,this.compare=W||Ot,this.length>0)for(var Ae=(this.length>>1)-1;Ae>=0;Ae--)this._down(Ae)}function Ot(q,W){return q<W?-1:q>W?1:0}pt.prototype={push:function(q){this.data.push(q),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var q=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),q}},peek:function(){return this.data[0]},_up:function(q){for(var W=this.data,Ae=this.compare,He=W[q];q>0;){var tt=q-1>>1,Qe=W[tt];if(Ae(He,Qe)>=0)break;W[q]=Qe,q=tt}W[q]=He},_down:function(q){for(var W=this.data,Ae=this.compare,He=this.length>>1,tt=W[q];q<He;){var Qe=1+(q<<1),ct=Qe+1,Dt=W[Qe];if(ct<this.length&&Ae(W[ct],Dt)<0&&(Qe=ct,Dt=W[ct]),Ae(Dt,tt)>=0)break;W[q]=Dt,q=Qe}W[q]=tt}},Ht.default=ut;var ti=Math.max,Qt=Math.min,hi=0;function ni(q,W,Ae,He,tt,Qe){var ct,Dt,_i,gi,si,Gi;for(ct=0,Dt=q.length-1;ct<Dt;ct++)if(gi=q[ct+1],si=new j(_i=q[ct],!1,void 0,W),Gi=new j(gi,!1,si,W),si.otherEvent=Gi,_i[0]!==gi[0]||_i[1]!==gi[1]){si.contourId=Gi.contourId=Ae,Qe||(si.isExteriorRing=!1,Gi.isExteriorRing=!1),we(si,Gi)>0?Gi.left=!0:si.left=!0;var er=_i[0],yi=_i[1];tt[0]=Qt(tt[0],er),tt[1]=Qt(tt[1],yi),tt[2]=ti(tt[2],er),tt[3]=ti(tt[3],yi),He.push(si),He.push(Gi)}}var di=[];function Ni(q,W,Ae){typeof q[0][0][0]=="number"&&(q=[q]),typeof W[0][0][0]=="number"&&(W=[W]);var He=function(yi,br,sr){var Vi=null;return yi.length*br.length==0&&(sr===w?Vi=di:sr===A?Vi=yi:sr!==E&&sr!==P||(Vi=yi.length===0?br:yi)),Vi}(q,W,Ae);if(He)return He===di?null:He;var tt=[1/0,1/0,-1/0,-1/0],Qe=[1/0,1/0,-1/0,-1/0],ct=function(yi,br,sr,Vi,zr){var ur,tr,or,Hi,ai,Xi,wr=new Ht(null,we);for(or=0,Hi=yi.length;or<Hi;or++)for(ai=0,Xi=(ur=yi[or]).length;ai<Xi;ai++)(tr=ai===0)&&hi++,ni(ur[ai],!0,hi,wr,sr,tr);for(or=0,Hi=br.length;or<Hi;or++)for(ai=0,Xi=(ur=br[or]).length;ai<Xi;ai++)tr=ai===0,zr===A&&(tr=!1),tr&&hi++,ni(ur[ai],!1,hi,wr,Vi,tr);return wr}(q,W,tt,Qe,Ae);if(He=function(yi,br,sr,Vi,zr){var ur=null;return(sr[0]>Vi[2]||Vi[0]>sr[2]||sr[1]>Vi[3]||Vi[1]>
8sr[3])&&(zr===w?ur=di:zr===A?ur=yi:zr!==E&&zr!==P||(ur=yi.concat(br))),ur}(q,W,tt,Qe,Ae))return He===di?null:He;for(var Dt=function(yi){var br,sr,Vi=function(or){var Hi,ai,Xi,wr,Mt=[];for(ai=0,Xi=or.length;ai<Xi;ai++)((Hi=or[ai]).left&&Hi.inResult||!Hi.left&&Hi.otherEvent.inResult)&&Mt.push(Hi);for(var Si=!1;!Si;)for(Si=!0,ai=0,Xi=Mt.length;ai<Xi;ai++)ai+1<Xi&&we(Mt[ai],Mt[ai+1])===1&&(wr=Mt[ai],Mt[ai]=Mt[ai+1],Mt[ai+1]=wr,Si=!1);for(ai=0,Xi=Mt.length;ai<Xi;ai++)(Hi=Mt[ai]).otherPos=ai;for(ai=0,Xi=Mt.length;ai<Xi;ai++)(Hi=Mt[ai]).left||(wr=Hi.otherPos,Hi.otherPos=Hi.otherEvent.otherPos,Hi.otherEvent.otherPos=wr);return Mt}(yi),zr={},ur=[],tr=function(){if(!zr[br]){var or=ur.length,Hi=function(Mt,Si,hr){var Cr=new et;if(Mt.prevInResult!=null){var gr=Mt.prevInResult,qr=gr.outputContourId;if(gr.resultTransition>0){var Yi=Si[qr];if(Yi.holeOf!=null){var jr=Yi.holeOf;Si[jr].holeIds.push(hr),Cr.holeOf=jr,Cr.depth=Si[qr].depth}else Si[qr].holeIds.push(hr),Cr.holeOf=qr,Cr.depth=Si[qr].depth+1}else Cr.holeOf=null,Cr.depth=Si[qr].depth}else Cr.holeOf=null,Cr.depth=0;return Cr}(Vi[br],ur,or),ai=function(Mt){zr[Mt]=!0,Mt<Vi.length&&Vi[Mt]&&(Vi[Mt].outputContourId=or)},Xi=br,wr=br;for(Hi.points.push(Vi[br].point);ai(Xi),ai(Xi=Vi[Xi].otherPos),Hi.points.push(Vi[Xi].point),!((Xi=Ue(Xi,Vi,zr,wr))==wr||Xi>=Vi.length)&&Vi[Xi];);ur.push(Hi)}};for(br=0,sr=Vi.length;br<sr;br++)tr();return ur}(function(yi,br,sr,Vi,zr,ur){for(var tr,or,Hi,ai=new a(ht),Xi=[],wr=Math.min(Vi[2],zr[2]);yi.length!==0;){var Mt=yi.pop();if(Xi.push(Mt),ur===w&&Mt.point[0]>wr||ur===A&&Mt.point[0]>Vi[2])break;if(Mt.left){or=tr=ai.insert(Mt),tr=tr!==(Hi=ai.minNode())?ai.prev(tr):null,or=ai.next(or);var Si=tr?tr.key:null;if(D(Mt,Si,ur),or&&vt(Mt,or.key,yi)===2&&(D(Mt,Si,ur),D(or.key,Mt,ur)),tr&&vt(tr.key,Mt,yi)===2){var hr=tr;D(Si,(hr=hr!==Hi?ai.prev(hr):null)?hr.key:null,ur),D(Mt,Si,ur)}}else or=tr=ai.find(Mt=Mt.otherEvent),tr&&or&&(tr=tr!==Hi?ai.prev(tr):null,or=ai.next(or),ai.remove(Mt),or&&tr&&vt(tr.key,or.key,yi))}return Xi}(ct,0,0,tt,Qe,Ae)),_i=[],gi=0;gi<Dt.length;gi++){var si=Dt[gi];if(si.isExterior()){for(var Gi=[si.points],er=0;er<si.holeIds.length;er++)Gi.push(Dt[si.holeIds[er]].points);_i.push(Gi)}}return _i}var nr={UNION:E,DIFFERENCE:A,INTERSECTION:w,XOR:P};i.diff=function(q,W){return Ni(q,W,A)},i.intersection=function(q,W){return Ni(q,W,w)},i.operations=nr,i.union=function(q,W){return Ni(q,W,E)},i.xor=function(q,W){return Ni(q,W,P)},Object.defineProperty(i,"__esModule",{value:!0})})(e)}(0,Tg.exports)),Tg.exports);/** 9 * martinez v0.7.4 10 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor 11 * 12 * @author Alex Milevski <[email protected]> 13 * @license MIT 14 * @preserve 15 */function Xp(r,e,i,s){const a=[],u=s===0?(h,f,_,g,v,b)=>{h.push(new Xe(b,_+(b-f)/(g-f)*(v-_)))}:(h,f,_,g,v,b)=>{h.push(new Xe(f+(b-_)/(v-_)*(g-f),b))};for(const h of r){const f=[];for(const _ of h){if(_.length<=2)continue;const g=[];for(let w=0;w<_.length-1;w++){const E=_[w].x,A=_[w].y,P=_[w+1].x,D=_[w+1].y,F=s===0?E:A,j=s===0?P:D;F<e?j>e&&u(g,E,A,P,D,e):F>i?j<i&&u(g,E,A,P,D,i):g.push(_[w]),j<e&&F>=e&&u(g,E,A,P,D,e),j>i&&F<=i&&u(g,E,A,P,D,i)}let v=_[_.length-1];const b=s===0?v.x:v.y;b>=e&&b<=i&&g.push(v),g.length&&(v=g[g.length-1],g[0].x===v.x&&g[0].y===v.y||g.push(g[0]),f.push(g))}f.length&&a.push(f)}return a}function _0(r,e){const i=Fm(r),s=Fm([e]),a=Sg.intersection(i,s);return a==null?[]:Eg(a)}function g0(r,e){let s=Fm(r,65536);for(;e.valid();e.next()){const[a,u]=e.get(),h=a.x*65536,f=a.y*65536,_=u.x*65536,g=u.y*65536,v=_-h,b=g-f,w=Math.hypot(v,b),E=Math.trunc(b/w*3),A=-Math.trunc(v/w*3);s=Sg.diff(s,[[[h,f],[_,g],[_+E,g+A],[h+E,f+A],[h,f]]])}return Eg(s,1/65536)}function Fm(r,e=1){return[r.map(i=>i.map(s=>[s.x*e,s.y*e]))]}function Eg(r,e=1){return r.map(i=>i.map((s,a)=>{const u=s.map(h=>new Xe(h[0]*e,h[1]*e).round());return a>0&&u.reverse(),u}))}class Om{constructor(e,i){this.layoutVertexArray=new Zs,this.indexArray=new sn,this.lineIndexArray=new Eo,this.triangleSegments=new Ar,this.lineSegments=new Ar,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new To)}update(e,i,s,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_)}
15isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,t0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,i0.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,s,a,u,h,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,s,a,u,h,void 0,f)}}class Bm{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new Om(e,!1),this.elevationBufferData=new Om(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=Lm("fill",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:f,id:_,index:g,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,w=rt(f,b);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom,{worldview:this.worldview}),w,s))continue;const E=u?u.evaluate(w,{},s,i.availableImages):void 0,A={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:g,geometry:b?w.geometry:at(f,s,a),patterns:{},sortKey:E};h.push(A)}u&&h.sort((f,_)=>f.sortKey-_.sortKey);for(const f of h){const{geometry:_,index:g,sourceLayerIndex:v}=f;if(this.hasPattern){const b=km("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,g,s,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,_,g,v,this.index)}}update(e,i,s,a,u,h,f){this.bufferData.update(e,i,s,a,u,h,f,this.worldview),this.elevationBufferData.update(e,i,s,a,u,h,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,s,a,u,h,f,this.worldview)}addFeatures(e,i,s,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,s,a,h,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,s,a,u,h=[],f,_){const g=Wp(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,a,s,_):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,s,u,h,a,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,s,u,h,a,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,i,s,a,u){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,s,a,u,this.worldview))}addElevatedRoadFeature(e,i,s,a,u){const h=new Array,f=Jn.getElevationFeature(e,u);if(!f)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&h.push({polygons:g,elevationFeature:f,elevationTileID:s})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},s),featureIndex:a};for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new ds(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(ar)&&(w=+e.properties[ar]);for(const E of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.i
vendor: 34,486 bytes, line 15
15d,E,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new vs(s,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,s,a,u,h){const f={elevation:s,elevationSampler:i,bias:a,index:u,featureInfo:h},[_,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,s){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,h=null;s&&(h=s.elevationSampler.constantElevation(s.elevation,s.bias),h!=null&&(a=h,u=h));const f=(_,g,v)=>{if(s!=null)if(g.push(_),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),v.push(h);else{const b=s.elevationSampler.pointElevation(_,s.elevation,s.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),u=Math.max(u,b)}};for(const _ of e){let g=0;for(const G of _)g+=G.length;const v=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=v.vertexLength,w=[],E=[],A=[],P=[],D=[],F=i.layoutVertexArray.length;for(const G of _){if(G.length===0)continue;G!==_[0]&&E.push(w.length/2);const R=i.lineSegments.prepareSegment(G.length,i.layoutVertexArray,i.lineIndexArray),N=R.vertexLength;s&&D.push(i.layoutVertexArray.length-F),f(G[0],A,P),i.layoutVertexArray.emplaceBack(G[0].x,G[0].y),i.lineIndexArray.emplaceBack(N+G.length-1,N),w.push(G[0].x),w.push(G[0].y);for(let $=1;$<G.length;$++)f(G[$],A,P),i.layoutVertexArray.emplaceBack(G[$].x,G[$].y),i.lineIndexArray.emplaceBack(N+$-1,N+$),w.push(G[$].x),w.push(G[$].y);R.vertexLength+=G.length,R.primitiveLength+=G.length}const j=td(w,E);for(let G=0;G<j.length;G+=3)i.indexArray.emplaceBack(b+j[G],b+j[G+1],b+j[G+2]);if(j.length>0&&s&&this.elevationMode==="hd-road-base"){const G=s.elevation.isTunnel(),R=s.elevation.safeArea,N=this.elevatedStructures.addVertices(A,P);this.elevatedStructures.addTriangles(j,N,G);const $=D.length;if($>0){for(let Z=0;Z<$-1;Z++)this.elevatedStructures.addRenderableRing(s.index,D[Z]+N,D[Z+1]-D[Z],G,R,s.featureInfo);this.elevatedStructures.addRenderableRing(s.index,D[$-1]+N,A.length-D[$-1],G,R,s.featureInfo)}}v.vertexLength+=g,v.primitiveLength+=j.length/3}return[a,u]}prepareElevatedPolygons(e,i,s){const a=1/Te(s),u=[];for(const h of e){const f=g0(h,new qn(i,a));u.push(...f)}return u}clipPolygonsToTile(e,i){const s=-i,a=-i,u=Je+i,h=Je+i;let f=0;const _=[],g=[];for(;f<e.length;f++){const w=e[f],E=rh(w);(E.min.x>=s&&E.max.x<=u&&E.min.y>=a&&E.max.y<=h?_:g).push(w)}if(_.length===e.length)return e;const v=[new Xe(s,a),new Xe(u,a),new Xe(u,h),new Xe(s,h),new Xe(s,a)],b=_;for(const w of g)b.push(..._0(w,v));return b}}let Ig,Ag,Mg,Cg;st(Bm,"FillBucket",{omit:["layers","patternFeatures"]}),st(Om,"FillBufferData"),st(ds,"ElevatedStructures");class Nm{constructor(e,i,s,a){if(this.triangleCount=i.length/3,this.min=new Xe(0,0),this.max=new Xe(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,h]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];u.x=Math.min(u.x,w.x),u.y=Math.min(u.y,w.y),h.x=Math.max(h.x,w.x),h.y=Math.max(h.y,w.y)}if(a){const b=Math.ceil(Math.max(h.x-u.x,h.y-u.y)/a);s=Math.max(s,b)}if(s===0)return;this.min=u,this.max=h;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const _=Math.max(f.x,f.y)/s;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[i[3*b+0]].sub(this.min),E=e[i[3*b+1]].sub(this.min),A=e[i[3*b+2]].sub(this.min),P=Ro(Math.floor(Math.min(w.x,E.x,A.x)),this.xScale,this.cellsX),D=Ro(Math.floor(Math.max(w.x,E.x,A.x)),this.xScale,this.cellsX),F=Ro(Math.floor(Math.min(w.y,E.y,A.y)),this.yScale,this.cellsY),j=Ro(Math.floor(Math.max(w.y,E.y,A.y)),this.yScale,this.cellsY),G=new Xe(0,0),R=new Xe(0,0),N=new Xe(0,0),$=new Xe(0,0);for(let Z=F;Z<=j;++Z){G.y=R.y=Z*_,N.y=$.y=(Z+1)*_;for(let oe=P;oe<=D;++oe)G.x=N.x=oe*_,R.x=$.x=(oe+1)*_,(Em(w,E,A,G,R,$)||Em(w,E,A,G,$,N))&&g.push({cellIdx:Z*this.cellsX+oe,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let v=0;for(;v<g.length;){const b=g[v].cellIdx,w={start:this.payload.length,len:0};for(;v<g.length&&g[v].cellIdx===b;)++w.len,this.payload.push(g[v++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const s=Ro(e.x-this.min.x,this.xScale,this.cellsX),a=Ro(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+s];if(u){this._lazyInitLookup();for(let h=0;h<u.len;h++){const f=this.payload[u.start+h],_=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[_]&g)&&(this.lookup[_]|=g,i.push(f),i.length===this.triangleCount))return}}}query(e,i,s){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=Ro(e.x-this.min.x,this.xScale,this.cellsX),u=Ro(i.x-this.min.x,this.xScale,this.cellsX),h=Ro(e.y-this.min.y,this.yScale,this.cellsY),f=Ro(i.y-this.min.y,this.yScale,this.cellsY);for(let _=h;_<=f;_++)for(let g=a;g<=u;g++){const v=this.cells[_*this.cellsX+g];if(v)for(let b=0;b<v.len;b++){const w=this.payload[v.start+b],E=Math.floor(w/8),A=1<<w%8;if(!(this.lookup[E]&A)&&(this.lookup[E]|=A,s.push(w),s.length===this.triangleCount))return}}}}function Ro(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}st(Nm,"TriangleGridIndex");class Pg{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview}updateFootprints(e,i){for(const s of this.footprints)i.push({footprint:s,id:e})}populate(e,i,s,a){const u=[];for(const{feature:h,id:f,index:_,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,b=rt(h,v);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom,{worldview:this.worldview}),b,s))continue;const w={id:f,properties:h.properties,type:h.type,sourceLayerIndex:g,index:_,geometry:v?b.geometry:at(h,s,a),patterns:{}};u.push(w)}for(const h of u){const{geometry:f,index:_,sourceLayerIndex:g}=h;this.addFeature(h,f,_,s,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,s,a,u,h,f){}destroy(){}addFeature(e,i,s,a,u,h=[],f){for(const _ of Wp(i,2)){const g=[],v=[],b=[],w=new Xe(1/0,1/0),E=new Xe(-1/0,-1/0);for(const D of _)if(D.length!==0){D!==_[0]&&b.push(v.length/2);for(let F=0;F<D.length;F++)v.push(D[F].x),v.push(D[F].y),g.push(D[F]),w.x=Math.min(w.x,D[F].x),w.y=Math.min(w.y,D[F].y),E.x=Math.max(E.x,D[F].x),E.y=Math.max(E.y,D[F].y)}const A=td(v,b),P=new Nm(g,A,8,256);this.footprints.push({vertices:g,indices:A,grid:P,min:w,max:E})}}}st(Pg,"ClipBucket",{omit:["layers"]});const y0=Ai([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),x0=Ai([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),v0=Ai([{name:"a_centroid_pos",components:2,type:"Uint16"}]),b0=Ai([{name:"a_join_normal_inside",components:3,type:"Int16"}]),w0=Ai([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),T0=Ai([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:S0}=y0,Yp=Number.MAX_SAFE_INTEGER;function Rg(r,e,i,s){return r.order<e||r.order===Yp||!(r.clipMask&i)||function(a,u){return u.length!==0&&u.find(h=>h===a)===void 0}(s,r.clipScope)}function Kp(r,e){return r.x-e.x||r.y-e.y}function zg(r,e){return Kp(r.min,e.min)===0&&Kp(r.max,e.max)===0}function Vm(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function Um(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!zg(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!ks(r[i].clipScope,e[i].clipScope))return!1;return!0}function Dg(r,e,i){const s=1/Je,a=1/(1<<i.canonical.z),u=(e.x*s+i.canonical.x)*a+i.wrap,h=(e.y*s+i.canonical.y)*a;return{min:new Xe((r.x*s+i.canonical.x)*a+i.wrap,(r.y*s+i.canonical.y)*a),max:new Xe(u,h)}}function E0(r,e,i){const s=1<<i.canonical.z,a=((e.x-i.wrap)*s-i.canonical.x)*Je,u=(e.y*s-i.canonical.y)*Je;return{min:new Xe(((r.x-i.wrap)*s-i.canonical.x)*Je,(r.y*s-i.canonical.y)*Je),max:new Xe(a,u)}}function Lg(r,e,i,s,a,u,h){const f=r.indices,_=r.vertices,g=[];for(let v=s;v<s+a;v+=3){const b=e[i[v+0]+u],w=e[i[v+1]+u],E=e[i[v+2]+u],A=Math.min(b.x,w.x,E.x),P=Math.max(b.x,w.x,E.x),D=Math.min(b.y,w.y,E.y),F=Math.max(b.y,w.y,E.y);g.length=0,r.grid.query(new Xe(A,D),new Xe(P,F),g);for(let j=0;j<g.length;j++){const G=g[j];if(Em(_[f[3*G+0]],_[f[3*G+1]],_[f[3*G+2]],b,w,E,h))return!0}}return!1}function kg(r,e,i,s){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(s.canonical)||e.wrap!==s.wrap){if(i.vertices.length<r.vertices.length)return kg(i,s,r,e);const u=e.canonical,h=s.canonical,f=Math.pow(2,h.z-u.z);a=r.vertices.map(_=>new Xe((_.x+u.x*Je)*f-h.x*Je,(_.y+u.y*Je)*f-h.y*Je))}return Lg(i,a,r.indices,0,r.indices.length,0,0)}function Fg(r,e,i,s){const a=Math.pow(2,s.z-i.z);return new Xe((r+i.x*Je)*a-s.x*Je,(e+i.y*Je)*a-s.y*Je)}function Og(r,e){const i=[];e.grid.queryPoint(r,i);const s=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const h=i[u];if(Ps([a[s[3*h+0]],a[s[3*h+1]],a[s[3*h+2]]],r))return!0}return!1}const jm=[new Xe(0,0),new Xe(Je,0),new Xe(Je,Je),new Xe(0,Je)];function Bg(r,e){const i=[];let s=[];if(!e||r.length<2)return[r];if(r.length===2)return aa(r[0],r[1],jm)?[r]:[];for(let a=0;a<r.length+2;a++){const u=r[a%r.length],h=r[(a+1)%r.length],f=aa(a===0?r[r.length-1]:r[(a-1)%r.length],u,jm),_=aa(u,h,jm),g=f||_;g&&s.push(u),g&&_||s.length>0&&(s.length>1&&i.push(s),s=[])}return s.length>1&&i.push(s),i}const Gm=oi.VectorTileFeature.types,I0=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],A0=["fill-extrusion-flood-light-ground-radius"],M0=Math.pow(2,13),C0=Math.pow(2,15)-1,Ng=new Xe(0,1),rl=2147483648;function od(r,e,i,s,a,u,h,f){r.emplaceBack((e<<1)+h,(i<<1)+u,(Math.floor(s*M0)<<1)+a,Math.round(f))}function ad(r,e,i){r.emplaceBack(e.x*Je,e.y*Je,i?1:0)}function Jp(r,e,i,s,a,u){r.emplaceBack(e.x,e.y,(i.x<<1)+s,(i.y<<1)+a,u)}function ld(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Vg{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Ug{constructor(){this.centroidXY=new Xe(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Xe(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Xe(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new Xe(this.max.x-this.min.x,this.max.y-this.min.y)}}class jg{constructor(){this.acc=new Xe(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,s){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===Je)&&i.x===s.x)!=((i.y===0||i.y===Je)&&i.y===s.y)&&this.processBorderOverlap(i,s),a&&this.checkBorderIntersection(i,s)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Ft(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Je!=e.x>Je&&this.addBorderIntersection(1,Ft(i.y,e.y,(Je-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Ft(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Je!=e.y>Je&&this.addBorderIntersection(3,Ft(i.x,e.x,(Je-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const s=this.borders[e];i<s[0]&&(s[0]=i),i>s[1]&&(s[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const s=e.x===0?0:1;this.addBorderIntersection(s,i.y),this.addBorderIntersection(s,e.y)}else{const s=e.y===0?2:3;this.addBorderIntersection(s,i.x),this.addBorderIntersection(s,e.x)}}centroid(){return this.accCount===0?new Xe(0,0):new Xe(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function Gg(r,e){const i=r.add(e)._unit(),s=Q(r.x*i.x+r.y*i.y,-1,1);var a,u,h;return a=Math.acos(s),Math.min(4,Math.max(-4,Math.tan(a)))/4*C0*((u=r).x*(h=e).y-u.y*h.x<0?-1:1)}const P0=[r=>r.x<0,r=>r.x>Je,r=>r.y<0,r=>r.y>Je];function R0(r,e,i,s){const a=[4];if(s===0)return a;i._mult(s);const u=r.sub(i),h=e.sub(i),f=[r,e,u,h];for(let _=0;_<4;_++)for(const g of f)if(P0[_](g)){a.push(_);break}return a}class $g{constructor(e){this.vertexArray=new qa,this.indexArray=new sn,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut},i=>A0.includes(i)),this._segments=new Ar,this.hiddenByLandmarkVertexArray=new gu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Ar}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,s,a=!1){const u=e.length;if(u>2){let h=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let _;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const g=e[0],v=e[1];_=Gg(g.sub(e[u-1])._perp()._unit(),v.sub(g)._perp()._unit())}for(let g=0;g<u;g++){const v=g===u-1?0:g+1,b=e[g],w=e[v],E=e[v===u-1?0:v+1],A=w.sub(b)._perp()._unit(),P=Gg(A,E.sub(w)._perp()._unit()),D=_,F=P;if($m(b,w,i)||a&&Zg(b,i)&&Zg(w,i)){_=P;continue}const j=f.vertexLength;Jp(this.vertexArray,b,w,1,1,D),Jp(this.vertexArray,b,w,1,0,D),Jp(this.vertexArray,b,w,0,1,F),Jp(this.vertexArray,b,w,0,0,F),f.vertexLength+=4;const G=R0(b,w,A,s);for(const R of G)this._segmentToGroundQuads[h].push({id:j,region:R}),this._segmentToRegionTriCounts[h][R]+=2,f.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let s=0;s<i;s++)this._segmentToGroundQuads[s].sort((a,u)=>a.region-u.region);for(let s=0;s<i;s++){const a=this._segmentToGroundQuads[s],u=e[s],h=this._segmentToRegionTriCounts[s];h.reduce((_,g)=>_+g,0);let f=0;for(let _=0;_<=4;_++){const g=h[_];if(g!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new Ar);const b={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+f,vertexLength:u.vertexLength,primitiveLength:g};v.get().push(b)}f+=g}for(let _=0;_<a.length;_++){const g=a[_].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,s,a,u,h,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,s,a,u,h,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,x0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,s,a,u,h,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,s,a,u,h,f,_)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const s=e.flags&rl?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,s);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,w0.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Qp{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new sn,this.footprintVertices=new Zs,this.footprintSegments=[],this.layoutVertexArray=new $a,this.centroidVertexArray=new Lp,this.wallVertexArray=new Fp,this.indexArray=new sn,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut},i=>I0.includes(i)),this.segments=new Ar,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new $g(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.features=[],this.hasPattern=Lm("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Te(s),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:h,index:f,sourceLayerIndex:_}of e){const g=this.layers[0]._featureFilter.needGeometry,v=rt(u,g);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom,{worldview:this.worldview}),v,s))continue;const b={id:h,sourceLayerIndex:_,index:f,geometry:g?v.geometry:at(u,s,a),properties:u.properties,type:u.type,patterns:{}},w=this.layoutVertexArray.length,E=Gm[b.type]==="Polygon";if(this.hasPattern)this.features.push(km("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i));else if(this.wallMode)for(const A of b.geometry)for(const P of Bg(A,E))this.addFeature(b,[P],f,s,{},i.availableImages,a,i.brightness);else this.addFeature(b,b.geometry,f,s,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,b.geometry,f,_,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,s,a,u,h){for(const f of this.features){const _=Gm[f.type]==="Polygon",{geometry:g}=f;if(this.wallMode)for(const v of g)for(const b of Bg(v,_))this.addFeature(f,[b],f.index,i,s,a,u,h);else this.addFeature(f,g,f.index,i,s,a,u,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,s,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,this.worldview),this.groundEffect.update(e,i,u,s,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,S0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,b0.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,T0.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,v0.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,s,a,u,h,f,_){const g=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,v=[new Xe(0,0),new Xe(Je,Je)],b=f.projection,w=b.name==="globe",E=this.wallMode||Gm[e.type]==="Polygon",A=new jg;A.centroidDataIndex=this.centroidData.length;const P=new Ug,D=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a)<=0,F=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);let j;if(P.height=F,P.vertexArrayOffset=this.layoutVertexArray.length,P.groundVertexArrayOffset=this.groundEffect.vertexArray.length,w&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new fu),this.wallMode){if(w)return void ii("Non zero fill-extrusion-line-width is not yet supported on globe.");if(i.length!==1)return;j=function(ae){const he=ae[0].x===ae[ae.length-1].x&&ae[0].y===ae[ae.length-1].y;(function(et){let Ue=0;const Ht=et.length;for(let ut=0;ut<Ht;ut++)Ue+=(et[(ut+1)%Ht].x-et[ut].x)*(et[(ut+1)%Ht].y+et[ut].y);return Ue>=0})(ae)||(ae=ae.reverse());const Be={geometry:[],joinNormals:[],indices:[]},ze=[],Oe=[],Ne=[];let Ie=ae.length;for(;Ie>=2&&ae[Ie-1].equals(ae[Ie-2]);)Ie--;if(Ie<(he?3:2))return Be;let ke,we,Ee,je,$e,vt=0;for(;vt<Ie-1&&ae[vt].equals(ae[vt+1]);)vt++;he&&(ke=ae[Ie-2],$e=ae[vt].sub(ke)._unit()._perp());for(let et=vt;et<Ie;et++){if(Ee=et===Ie-1?he?ae[vt+1]:void 0:ae[et+1],Ee&&ae[et].equals(Ee))continue;$e&&(je=$e),ke&&(we=ke),ke=ae[et],$e=Ee?Ee.sub(ke)._unit()._perp():je,je=je||$e;let Ue=je.add($e);Ue.x===0&&Ue.y===0||Ue._unit();const Ht=Ue.x*$e.x+Ue.y*$e.y,ut=Ht!==0?1/Ht:1/0,pt=je.x*$e.y-je.y*$e.x>0;let Ot="miter";const ti=2;Ot==="miter"&&ut>ti&&(Ot="bevel"),Ot==="bevel"&&(ut>100&&(Ot="flipbevel"),ut<ti&&(Ot="miter"));const Qt=(hi,ni,di,Ni)=>{const nr=new Xe(hi.x,hi.y),q=new Xe(hi.x,hi.y);nr.x+=ni.x*Ni,nr.y+=ni.y*Ni,q.x-=ni.x*Math.max(di,1),q.y-=ni.y*Math.max(di,1),Ne.push(ni),ze.push(nr),Oe.push(q)};if(Ot==="miter")Ue._mult(ut),Qt(ke,Ue,0,0);else if(Ot==="flipbevel")Ue=$e.mult(-1),Qt(ke,Ue,0,0),Qt(ke,Ue.mult(-1),0,0);else{const hi=-Math.sqrt(ut*ut-1),ni=pt?hi:0,di=pt?0:hi;we&&Qt(ke,je,ni,di),Ee&&Qt(ke,$e,ni,di)}}Be.geometry=[...ze,...Oe.reverse(),ze[0]],Be.joinNormals=[...Ne,...Ne.reverse(),Ne[Ne.length-1]];const ht=Be.geometry.length-1;for(let et=0;et<ht/2;et++)if(et+1<ht/2){let Ue=et,Ht=et+1,ut=ht-1-et,pt=ht-2-et;Ue=Ue===0?ht-1:Ue-1,Ht=Ht===0?ht-1:Ht-1,ut=ut===0?ht-1:ut-1,pt=pt===0?ht-1:pt-1,Be.indices.push(ut),Be.indices.push(Ht),Be.indices.push(Ue),Be.indices.push(ut),Be.indices.push(pt),Be.indices.push(Ht)}return Be}(i[0]),i=[j.geometry]}const G=(ae,he)=>ae<(he.length-1)/2||ae===he.length-1,R=this.wallMode?[i]:Wp(i,500);for(let ae=R.length-1;ae>=0;ae--){const he=R[ae];(he.length===0||(N=he[0]).every(Se=>Se.x<=0)||N.every(Se=>Se.x>=Je)||N.every(Se=>Se.y<=0)||N.every(Se=>Se.y>=Je))&&R.splice(ae,1)}var N;let $;if(w)$=Kg(R,v,a);else{$=[];for(const ae of R)$.push({polygon:ae,bounds:v})}const Z=E?this.edgeRadius:0,oe=Z>0&&this.zoom<17,re=(ae,he)=>{if(ae.length===0)return!1;const Se=ae[ae.length-1];return he.x===Se.x&&he.y===Se.y};for(const{polygon:ae,bounds:he}of $){let Se=0,Be=0;for(const Ie of ae)E&&!Ie[0].equals(Ie[Ie.length-1])&&Ie.push(Ie[0]),Be+=E?Ie.length-1:Ie.length;const ze=this.segments.prepareSegment((E?5:4)*Be,this.layoutVertexArray,this.indexArray);P.footprintSegIdx<0&&(P.footprintSegIdx=this.footprintSegments.length),P.polygonSegIdx<0&&(P.polygonSegIdx=this.polygonSegments.length);const Oe={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Ne=new Vg;if(Ne.vertexOffset=this.footprintVertices.length,Ne.indexOffset=3*this.footprintIndices.length,Ne.ringIndices=[],E){const Ie=[],ke=[];Se=ze.vertexLength;for(let Ee=0;Ee<ae.length;Ee++){const je=ae[Ee];je.length&&Ee!==0&&ke.push(Ie.length/2);const $e=[];let vt,ht;vt=je[1].sub(je[0])._perp()._unit(),Ne.ringIndices.push(je.length-1);for(let et=1;et<je.length;et++){const Ue=je[et],Ht=je[et===je.length-1?1:et+1],ut=Ue.clone();if(Z){ht=Ht.sub(Ue)._perp()._unit();const pt=vt.add(ht)._unit(),Ot=Z*Math.min(4,1/(vt.x*pt.x+vt.y*pt.y));ut.x+=Ot*pt.x,ut.y+=Ot*pt.y,ut.x=Math.round(ut.x),ut.y=Math.round(ut.y),vt=ht}if(!D||Z!==0&&!oe||re($e,ut)||$e.push(ut),od(this.layoutVertexArray,ut.x,ut.y,0,0,1,1,0),this.wallMode){const pt=G(et,je);ad(this.wallVertexArray,j.joinNormals[et],!pt)}ze.vertexLength++,this.footprintVertices.emplaceBack(Ue.x,Ue.y),Ie.push(Ue.x,Ue.y),w&&ld(this.layoutVertexExtArray,b.projectTilePoint(ut.x,ut.y,a),b.upVector(a,ut.x,ut.y))}D&&(Z===0||oe)&&($e.length!==0&&re($e,$e[0])&&$e.pop(),this.groundEffect.addData($e,he,g))}const we=this.wallMode?j.indices:td(Ie,ke);for(let Ee=0;Ee<we.length;Ee+=3)this.footprintIndices.emplaceBack(Ne.vertexOffset+we[Ee+0],Ne.vertexOffset+we[Ee+1],Ne.vertexOffset+we[Ee+2]),this.indexArray.emplaceBack(Se+we[Ee],Se+we[Ee+2],Se+we[Ee+1]),ze.primitiveLength++;Ne.indexCount+=we.length,Ne.vertexCount+=this.footprintVertices.length-Ne.vertexOffset}for(let Ie=0;Ie<ae.length;Ie++){const ke=ae[Ie];A.startRing(P,ke[0]);let we=ke.length>4&&Wg(ke[ke.length-2],ke[0],ke[1]),Ee=Z?z0(ke[ke.length-2],ke[0],ke[1],Z):0;const je=[];let $e,vt,ht;vt=ke[1].sub(ke[0])._perp()._unit();let et=!0;for(let Ue=1,Ht=0;Ue<ke.length;Ue++){let ut=ke[Ue-1],pt=ke[Ue];const Ot=ke[Ue===ke.length-1?1:Ue+1];if(A.appendEdge(P,pt,ut),$m(pt,ut,he)){Z&&(vt=Ot.sub(pt)._perp()._unit(),et=!et);continue}const ti=pt.sub(ut)._perp(),Qt=ti.x/(Math.abs(ti.x)+Math.abs(ti.y)),hi=ti.y>0?1:0,ni=ut.dist(pt);if(Ht+ni>32768&&(Ht=0),Z){ht=Ot.sub(pt)._perp()._unit();let q=Hg(ut,pt,Ot,qg(vt,ht),Z);isNaN(q)&&(q=0);const W=pt.sub(ut)._unit();ut=ut.add(W.mult(Ee))._round(),pt=pt.add(W.mult(-q))._round(),Ee=q,vt=ht,D&&this.zoom>=17&&(re(je,ut)||je.push(ut),re(je,pt)||je.push(pt))}const di=ze.vertexLength,Ni=ke.length>4&&Wg(ut,pt,Ot);let nr=Xg(Ht,we,et);if(od(this.layoutVertexArray,ut.x,ut.y,Qt,hi,0,0,nr),od(this.layoutVertexArray,ut.x,ut.y,Qt,hi,0,1,nr),this.wallMode){const q=G(Ue-1,ke),W=j.joinNormals[Ue-1];ad(this.wallVertexArray,W,q),ad(this.wallVertexArray,W,q)}if(Ht+=ni,nr=Xg(Ht,Ni,!et),we=Ni,od(this.layoutVertexArray,pt.x,pt.y,Qt,hi,0,0,nr),od(this.layoutVertexArray,pt.x,pt.y,Qt,hi,0,1,nr),this.wallMode){const q=G(Ue,ke),W=j.joinNormals[Ue];ad(this.wallVertexArray,W,q),ad(this.wallVertexArray,W,q)}if(ze.vertexLength+=4,this.indexArray.emplaceBack(di+0,di+1,di+2),this.indexArray.emplaceBack(di+1,di+3,di+2),ze.primitiveLength+=2,Z){const q=Se+(Ue===1?ke.length-2:Ue-2),W=Ue===1?Se:q+1;if(this.indexArray.emplaceBack(di+1,q,di+3),this.indexArray.emplaceBack(q,W,di+3),ze.primitiveLength+=2,$e===void 0&&($e=di),!$m(Ot,ke[Ue],he)){const Ae=Ue===ke.length-1?$e:ze.vertexLength;this.indexArray.emplaceBack(di+2,di+3,Ae),this.indexArray.emplaceBack(di+3,Ae+1,Ae),this.indexArray.emplaceBack(di+3,W,Ae+1),ze.primitiveLength+=3}et=!et}if(w){const q=this.layoutVertexExtArray,W=b.projectTilePoint(ut.x,ut.y,a),Ae=b.projectTilePoint(pt.x,pt.y,a),He=b.upVector(a,ut.x,ut.y),tt=b.upVector(a,pt.x,pt.y);ld(q,W,He),ld(q,W,He),ld(q,Ae,tt),ld(q,Ae,tt)}}E&&(Se+=ke.length-1),D&&Z&&this.zoom>=17&&(je.length!==0&&re(je,je[0])&&je.pop(),this.groundEffect.addData(je,he,g,Z>0))}this.footprintSegments.push(Ne),Oe.triangleCount=this.indexArray.length-Oe.triangleArrayOffset,this.polygonSegments.push(Oe),++P.footprintSegLen,++P.polygonSegLen}if(P.vertexCount=this.layoutVertexArray.length-P.vertexArrayOffset,P.groundVertexCount=this.groundEffect.vertexArray.length-P.groundVertexArrayOffset,P.vertexCount!==0){if(P.centroidXY=A.borders?Ng:this.encodeCentroid(A,P),this.centroidData.push(P),A.borders){this.featuresOnBorder.push(A);const ae=this.featuresOnBorder.length-1;for(let he=0;he<A.borders.length;he++)A.borders[he][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[he].push(ae)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,h,a,_,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(e,s,u,h,a,_,this.worldview),this.maxHeight=Math.max(this.maxHeight,F)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,s)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[s].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData[f],g=+(_.min.y+_.max.y>Je),v=2*g+(+(_.min.x+_.max.x>Je)^g);for(let b=0;b<_.polygonSegLen;b++){const w=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new sn;e.sort((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx);let s=0,a=0,u=0;for(const f of e){if(f.triangleSegmentIdx!==s)break;u++}const h=e.length;for(;a!==e.length;){s=e[a].triangleSegmentIdx;let f=0,_=a,g=a;for(let v=_;v<u&&e[v].subtile===f;v++)g++;for(;_!==u;){const v=e[_];f=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),w=this.centroidData[v.centroidIdx].max.clone(),E={vertexOffset:this.segments.segments[s].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[s].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let A=_;A<g;A++){const P=e[A],D=this.polygonSegments[P.polygonSegmentIdx],F=this.centroidData[P.centroidIdx].min,j=this.centroidData[P.centroidIdx].max,G=this.indexArray.uint16;for(let R=D.triangleArrayOffset;R<D.triangleArrayOffset+D.triangleCount;R++)i.emplaceBack(G[3*R],G[3*R+1],G[3*R+2]);E.primitiveLength+=D.triangleCount,b.x=Math.min(b.x,F.x),b.y=Math.min(b.y,F.y),w.x=Math.max(w.x,j.x),w.y=Math.max(w.y,j.y)}E.primitiveLength>0&&this.triangleSubSegments.push({segment:E,min:b,max:w}),_=g;for(let A=_;A<u&&e[A].subtile===e[_].subtile;A++)g++}a=u;for(let v=a;v<h&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,s){const a=new Ar;if(this.wallMode){for(const P of this.triangleSubSegments)a.segments.push(P.segment);return a}let u=0,h=0;const f=1<<e.canonical.z;if(i){const P=i.getMinMaxForTile(e);P&&(u=P.min,h=P.max)}h+=this.maxHeight;const _=e.toUnwrapped();let g;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],w=(P,D,F)=>[P[0]*(1-F[0])+D[0]*F[0],P[1]*(1-F[1])+D[1]*F[1]],E=[],A=[];for(const P of this.triangleSubSegments){E[0]=P.min.x/Je,E[1]=P.min.y/Je,A[0]=P.max.x/Je,A[1]=P.max.y/Je;const D=w(v,b,E),F=w(v,b,A);if(new Ci([D[0],D[1],u],[F[0],F[1],h]).intersectsPrecise(s)===0){g&&(a.segments.push(g),g=void 0);continue}const j=P.segment;g&&g.vertexOffset!==j.vertexOffset&&(a.segments.push(g),g=void 0),g?(g.vertexLength+=j.vertexLength,g.primitiveLength+=j.primitiveLength):g={vertexOffset:j.vertexOffset,primitiveLength:j.primitiveLength,vertexLength:j.vertexLength,primitiveOffset:j.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&a.segments.push(g),a}encodeCentroid(e,i){const s=e.centroid(),a=i.span(),u=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new Xe(Q(s.x,1,Je-1)<<3|u,Q(s.y,1,Je-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Xe(0,0);const i=e.borders,s=Number.MAX_VALUE;if(i[0][0]!==s||i[1][0]!==s){const a=i[0][0]!==s?0:1;return new Xe(6|(i[0][0]!==s?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==s?2:3;return new Xe((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==s?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=rl,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,s=e.vertexCount+e.vertexArrayOffset,a=e.flags&rl?Ng:e.centroidXY,u=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||u!==a.x){for(let h=i;h<s;++h)this.centroidVertexArray.emplace(h,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,s){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Um(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=2147483647;const u=[];for(const h of this.activeReplacements){if(h.order<s)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.centroidData)if(!(_.flags&rl||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y))for(let g=0;g<_.footprintSegLen;g++){const v=this.footprintSegments[_.footprintSegIdx+g];if(u.length=0,D0(this.footprintVertices,v.vertexOffset,v.vertexCount,h.footprintTileId.canonical,e.canonical,u),Lg(h.footprint,u,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,
15-f)){_.flags|=rl;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,s){let a=!1;for(let u=0;u<s.footprintSegLen;u++){const h=this.footprintSegments[s.footprintSegIdx+u];let f=0;for(const _ of h.ringIndices){for(let g=f,v=_+f-1;g<_+f;v=g++){const b=this.footprintVertices.int16[2*(g+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+h.vertexOffset)+1],E=this.footprintVertices.int16[2*(v+h.vertexOffset)+1];w>i!=E>i&&e<(this.footprintVertices.int16[2*(v+h.vertexOffset)+0]-b)*(i-w)/(E-w)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let s=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+Je)*Je+(i+Je);if(this.partLookup.hasOwnProperty(u)){const h=this.partLookup[u];return h?{height:h.height,hidden:!!(h.flags&rl)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||this.footprintContainsPoint(e,i,h)&&h&&h.height>s&&(s=h.height,this.partLookup[u]=h,a=!!(h.flags&rl));if(s!==Number.NEGATIVE_INFINITY)return{height:s,hidden:a};this.partLookup[u]=void 0}}function qg(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function z0(r,e,i,s){const a=e.sub(r)._perp()._unit(),u=i.sub(e)._perp()._unit();return Hg(r,e,i,qg(a,u),s)}function Hg(r,e,i,s,a){const u=Math.sqrt(1-s*s);return Math.min(r.dist(e)/3,e.dist(i)/3,a*u/s)}function $m(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function Zg(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function Wg(r,e,i){if(r.x<0||r.x>=Je||e.x<0||e.x>=Je||i.x<0||i.x>=Je)return!1;const s=i.sub(e),a=s.perp(),u=r.sub(e);return(s.x*u.x+s.y*u.y)/Math.sqrt((s.x*s.x+s.y*s.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function Xg(r,e,i){const s=e?2|r:-3&r;return i?1|s:-2&s}function Yg(){const r=Math.PI/32,e=Math.tan(r),i=k;return i*Math.sqrt(1+2*e*e)-i}function Kg(r,e,i){const s=1<<i.z,a=ne(i.x/s),u=ne((i.x+1)/s),h=fe(i.y/s),f=fe((i.y+1)/s);return function(_,g,v,b,w=0,E){const A=[];if(!_.length||!v||!b)return A;const P=($,Z)=>{for(const oe of $)A.push({polygon:oe,bounds:Z})},D=Math.ceil(Math.log2(v)),F=Math.ceil(Math.log2(b)),j=D-F,G=[];for(let $=0;$<Math.abs(j);$++)G.push(j>0?0:1);for(let $=0;$<Math.min(D,F);$++)G.push(0),G.push(1);let R=_;if(R=Xp(R,g[0].y-w,g[1].y+w,1),R=Xp(R,g[0].x-w,g[1].x+w,0),!R.length)return A;const N=[];for(G.length?N.push({polygons:R,bounds:g,depth:0}):P(R,g);N.length;){const $=N.pop(),Z=$.depth,oe=G[Z],re=$.bounds[0],ae=$.bounds[1],he=oe===0?re.x:re.y,Se=oe===0?ae.x:ae.y,Be=E?E(oe,he,Se):.5*(he+Se),ze=Xp($.polygons,he-w,Be+w,oe),Oe=Xp($.polygons,Be-w,Se+w,oe);if(ze.length){const Ne=[re,new Xe(oe===0?Be:ae.x,oe===1?Be:ae.y)];G.length>Z+1?N.push({polygons:ze,bounds:Ne,depth:Z+1}):P(ze,Ne)}if(Oe.length){const Ne=[new Xe(oe===0?Be:re.x,oe===1?Be:re.y),ae];G.length>Z+1?N.push({polygons:Oe,bounds:Ne,depth:Z+1}):P(Oe,Ne)}}return A}(r,e,Math.ceil((u-a)/11.25),Math.ceil((h-f)/11.25),1,(_,g,v)=>{if(_===0)return .5*(g+v);{const b=fe((i.y+g/Je)/s);return(K(.5*(fe((i.y+v/Je)/s)+b))*s-i.y)*Je}})}function D0(r,e,i,s,a,u){const h=Math.pow(2,s.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];_=(_+a.x*Je)*h-s.x*Je,g=(g+a.y*Je)*h-s.y*Je,u.push(new Xe(_,g))}}let Jg,Qg;st(Qp,"FillExtrusionBucket",{omit:["layers","features"]}),st(Ug,"PartData"),st(Vg,"FootprintSegment"),st(jg,"BorderCentroidData"),st($g,"GroundEffect");class pc extends Xe{constructor(e,i,s){super(e,i),this.z=s}}class ey extends pc{constructor(e,i,s,a){super(e,i,s),this.w=a}}function ty(r,e,i,s){const a=i==="x"?"y":"x",u=(s-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*u),r[i]=s,r.hasOwnProperty("z")&&(r.z=Ft(r.z,e.z,u)),r.hasOwnProperty("w")&&(r.w=Ft(r.w,e.w,u))}function iy(r,e,i,s){const a=i,u=s;for(const h of["x","y"]){let f=r,_=e;f[h]>=_[h]&&(f=e,_=r),f[h]<a&&_[h]>a&&ty(f,_,h,a),f[h]<u&&_[h]>u&&ty(_,f,h,u)}}function ef(r,e,i,s,a,u){const h=[];for(let f=0;f<r.length;f++){const _=r[f];let g;const v=h.length;let b=0;for(let w=0;w<_.length-1;w++){let E=_[w],A=_[w+1],P=0;const D=b;let F,j;u&&(P=Math.hypot(A.x-E.x,A.y-E.y),b+=P,F=E,j=A),E.x<e&&A.x<e||(E.x<e?E=new Xe(e,E.y+(e-E.x)/(A.x-E.x)*(A.y-E.y))._round():A.x<e&&(A=new Xe(e,E.y+(e-E.x)/(A.x-E.x)*(A.y-E.y))._round()),E.y<i&&A.y<i||(E.y<i?E=new Xe(E.x+(i-E.y)/(A.y-E.y)*(A.x-E.x),i)._round():A.y<i&&(A=new Xe(E.x+(i-E.y)/(A.y-E.y)*(A.x-E.x),i)._round()),E.x>=s&&A.x>=s||(E.x>=s?E=new Xe(s,E.y+(s-E.x)/(A.x-E.x)*(A.y-E.y))._round():A.x>=s&&(A=new Xe(s,E.y+(s-E.x)/(A.x-E.x)*(A.y-E.y))._round()),E.y>=a&&A.y>=a||(E.y>=a?E=new Xe(E.x+(a-E.y)/(A.y-E.y)*(A.x-E.x),a)._round():A.y>=a&&(A=new Xe(E.x+(a-E.y)/(A.y-E.y)*(A.x-E.x),a)._round()),g&&E.equals(g[g.length-1])||(g=[E],h.push(g),u&&u.push({progress:{min:D+ry(F,j,E)*P,max:1},parentIndex:f,prevPoint:F,nextPoint:j})),g.push(A),u&&(u[u.length-1].progress.max=D+ry(F,j,A)*P,u[u.length-1].nextPoint=j)))))}if(u&&b>0)for(let w=v;w<h.length;w++)u[w].progress.min/=b,u[w].progress.max/=b}return h}function L0(r,e,i,s,a){if(r.length<2)return void s.push(r);const u=[];for(;e.valid();){const[g,v]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],E=r[b+1],A=Jh(w,E,g,v);if(A){const[P]=A,D=new Xe(Ft(w.x,E.x,P),Ft(w.y,E.y,P));u.push({t:b+P,distance:0,point:D})}}e.next()}if(u.length===0)return void s.push(r);u.sort((g,v)=>g.t-v.t);let h=0,f=0,_=[];for(s.push(_);h!==r.length;){if(f===u.length){for(;h!==r.length;)_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++;break}u[f].t<=h?(_.length!==0&&_[_.length-1].equals(u[f].point)||_.push(u[f].point),Math.trunc(u[f].t),f++):(_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++)}}function ry(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function cd(r,e){return r.x*e.x+r.y*e.y}function ny(r,e){if(r.length===1){let i=0;const s=e[i++];let a;for(;!a||s.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],f=a.sub(s),_=u.sub(s),g=h.sub(s),v=cd(f,f),b=cd(f,_),w=cd(_,_),E=cd(g,f),A=cd(g,_),P=v*w-b*b,D=(w*E-b*A)/P,F=(v*A-b*E)/P,j=s.z*(1-D-F)+a.z*D+u.z*F;if(isFinite(j))return j}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}function sy(r,e,i,s,a,u,h,f){const _=h*a.getElevationAt(r,e,!0,!0),g=u[0]!==0,v=g?u[1]===0?h*(u[0]/7-450):h*function(b,w,E){const A=Math.floor(w[0]/8),P=Math.floor(w[1]/8),D=10*(w[0]-8*A),F=10*(w[1]-8*P),j=b.getElevationAt(A,P,!0,!0),G=b.getMeterToDEM(E),R=Math.floor(.5*(D*G-1)),N=Math.floor(.5*(F*G-1)),$=b.tileCoordToPixel(A,P),Z=2*R+1,oe=2*N+1,re=function(Oe,Ne,Ie,ke,we){return[Oe.getElevationAtPixel(Ne,Ie,!0),Oe.getElevationAtPixel(Ne+we,Ie,!0),Oe.getElevationAtPixel(Ne,Ie+we,!0),Oe.getElevationAtPixel(Ne+ke,Ie+we,!0)]}(b,$.x-R,$.y-N,Z,oe),ae=Math.abs(re[0]-re[1]),he=Math.abs(re[2]-re[3]),Se=Math.abs(re[0]-re[2])+Math.abs(re[1]-re[3]),Be=Math.min(.25,.5*G*(ae+he)/Z),ze=Math.min(.25,.5*G*Se/oe);return j+Math.max(Be*D,ze*F)}(a,u,f):_;return{base:_+(i===0?-1:i),top:g?Math.max(v+s,_+i+2):_+s}}class k0{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class F0{constructor(){this.tasks={},this.taskQueue=[],dt(["process"],this),this.invoker=new k0(this.process),this.nextId=0}add(e,i){const s=this.nextId++,a=function({type:u,isSymbolTile:h,zoom:f}){return f=f||0,u==="message"?0:u!=="maybePrepare"||h?u!=="parseTile"||h?u==="parseTile"&&h?300-f:u==="maybePrepare"&&h?400-f:500:200-f:100-f}(i);if(a===0){try{e()}finally{}return null}return this.tasks[s]={fn:e,metadata:i,priority:a,id:s},this.taskQueue.push(s),this.invoker.trigger(),{cancel:()=>{delete this.tasks[s]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(s=>!!this.tasks[s]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const s=this.taskQueue[e];return this.taskQueue.splice(e,1),s}remove(){this.invoker.remove()}}class oy{constructor(e,i,s){this.target=e,this.parent=i,this.mapId=s,this.callbacks={},this.cancelCallbacks={},dt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
15=new F0}send(e,i,s,a,u=!1,h){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(s.metadata=h,this.callbacks[f]=s);const _=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!s,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:xo(i,_)},_),{cancel:()=>{s&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const s=i.id;if(s&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[s];delete this.cancelCallbacks[s],a&&a.cancel()}else if(i.mustQueue||Ui(self)){const a=this.callbacks[s],u=this.scheduler.add(()=>this.processTask(s,i),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[s]=u)}else this.processTask(s,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const s=this.callbacks[e];delete this.callbacks[e],s&&(i.error?s(vo(i.error)):s(null,vo(i.data)))}else{const s=new Set,a=i.hasCallback?(h,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?xo(h):null,data:xo(f,s)},s)}:()=>{},u=vo(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,u,a);else if(this.parent.getWorkerSource){const h=i.type.split("."),{source:f,scope:_}=u;this.parent.getWorkerSource(i.sourceMapId,h[0],f,_)[h[1]](u,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var ud={workerUrl:"",workerClass:null,workerParams:void 0};const qm="mapboxgl_preloaded_worker_pool";class fc{constructor(){this.active={}}acquire(e,i=fc.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(ud.workerClass!=null?new ud.workerClass:new self.Worker(ud.workerUrl,ud.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[qm]}numActive(){return Object.keys(this.active).length}}fc.workerCount=2;class Cu{constructor(e,i,s="Worker",a=fc.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=be();const u=this.workerPool.acquire(this.id,a);for(let h=0;h<u.length;h++){const f=new Cu.Actor(u[h],i,this.id);f.name=`${s} ${h}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,s){ue(this.actors,(a,u)=>{a.send(e,i,u)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let hd,Hm;function tf(){return hd||(hd=new fc),hd}Cu.Actor=oy;class O0{constructor(e){this.module=e}createIntArray(e){const i=new Int32Array(e),s=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heap32.set(i,s/i.BYTES_PER_ELEMENT),s}createFloatArray(e){const i=new Float32Array(e),s=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heapF32.set(i,s/i.BYTES_PER_ELEMENT),s}createStringBuffer(e){const i=this.module.malloc(e.length+1);for(let s=0;s<e.length;++s)this.module.heapU8[i+s]=e.charCodeAt(s);return this.module.heapU8[i+e.length]=0,i}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.entranceColorRgb,s=e.facadeGlazingColorRgb,a=e.roofColorRgb,u=e.wallColorRgb,h=e.normalScale;this.module.setStyle(i[0],i[1],i[2],s[0],s[1],s[2],a[0],a[1],a[2],u[0],u[1],u[2],h[0],h[1],h[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setFacadeOptions(e,i,s){this.module.setFacadeOptions(e,i,s)}generateMesh(e,i){for(const f of e){const _=this.createStringBuffer(f.roofType),g=[0],v=[];for(const E of f.coordinates)if(Array.isArray(E)){for(const A of E)v.push(A.x),v.push(A.y);g.push(v.length)}const b=this.createIntArray(g),w=this.createFloatArray(v);this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,_,f.roofType.length,w,b,g.length-1),this.module.free(_),this.module.free(b),this.module.free(w)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(_),v=[];for(const w of f.coordinates)v.push(w.x),v.push(w.y);const b=this.createFloatArray(v);this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,_.length,b,v.length),this.module.free(g),this.module.free(b)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}
15const s=this.module.getMeshCount(),a=new Array(s);for(let f=0;f<s;f++){const _=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),E=new Float32Array(this.module.heapF32.buffer,b,w),A=this.module.getColorsPtr(f),P=this.module.getColorsLength(f),D=new Uint8Array(this.module.heapU8.buffer,A,P),F=this.module.getAOPtr(f),j=this.module.getAOLength(f),G=new Float32Array(this.module.heapF32.buffer,F,j),R=this.module.getIndicesPtr(f),N=this.module.getIndicesLength(f),$=new Int32Array(this.module.heap32.buffer,R,N),Z=this.module.getBuildingPart(f),oe=this.readStringBuffer(Z);a[f]={positions:v,normals:E,colors:D,ao:G,indices:$,buildingPart:oe}}const u=this.module.getRingCount(),h=[];for(let f=0;f<u;f++){const _=this.module.getRingPtr(f),g=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g);h.push(v)}return{meshes:a,modifiedPolygonRings:h}}}let dd,Zm,Ys,Pu,Wm,Ru=null,zu=null,ay=null,Xm=null;function ly(){return Ui(self)&&self.worker.dracoUrl?self.worker.dracoUrl:Zm||rn.DRACO_URL}function cy(){if(Ui(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Pu)return Pu;const r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Pu=WebAssembly.validate(r)?rn.MESHOPT_SIMD_URL:rn.MESHOPT_URL,Pu}const rf={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},B0={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},pd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function uy(r,e,i){const s=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=s,i.json.bufferViews[s]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const Ym="KHR_draco_mesh_compression";function N0(r,e){const i=r.extensions&&r.extensions[Ym];if(!i)return;const s=new Ys.Decoder,a=fy(e,i.bufferView),u=new Ys.Mesh;if(!s.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],f=rf[h.componentType],_=h.count*f.BYTES_PER_ELEMENT,g=Ys._malloc(_);f===Uint16Array?s.GetTrianglesUInt16Array(u,_,g):s.GetTrianglesUInt32Array(u,_,g),uy(Ys.memory.buffer.slice(g,g+_),h,e),Ys._free(g);for(const v of Object.keys(i.attributes)){const b=s.GetAttributeByUniqueId(u,i.attributes[v]),w=e.json.accessors[r.attributes[v]],E=B0[w.componentType],A=w.count*pd[w.type]*rf[w.componentType].BYTES_PER_ELEMENT,P=Ys._malloc(A);s.GetAttributeDataArrayForAllPoints(u,b,Ys[E],A,P),uy(Ys.memory.buffer.slice(P,P+A),w,e),Ys._free(P)}s.destroy(),u.destroy(),delete r.extensions[Ym]}const nf="EXT_meshopt_compression";function V0(r,e){if(!r.extensions||!r.extensions[nf])return;const i=r.extensions[nf],s=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);Wm.decodeGltfBuffer(a,i.count,i.byteStride,s,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[nf]}const hy=1179937895,dy=new TextDecoder("utf8");function py(r,e){return new URL(r,e).href}function U0(r,e,i,s){return fetch(py(r.uri,s)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function fy(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function j0(r,e,i,s){if(r.uri){const a=py(r.uri,s);return fetch(a).then(u=>u.blob()).then(u=>createImageBitmap(u)).then(u=>{e.images[i]=u})}if(r.bufferView!==void 0){const a=fy(e,r.bufferView),u=new Blob([a],{type:r.mimeType});return createImageBitmap(u).then(h=>{e.images[i]=h})}}function my(r,e=0,i){const s={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===hy){const v=new Uint32Array(r,e);let b=2;const w=(v[b++]>>2)-3,E=v[b++]>>2;if(b++,s.json=JSON.parse(dy.decode(v.subarray(b,b+E))),b+=E,b<w){const A=v[b++];b++;const P=e+(b<<2);s.buffers[0]=r.slice(P,P+A)}}else s.json=JSON.parse(dy.decode(new Uint8Array(r,e)));const{buffers:a,images:u,meshes:h,extensionsUsed:f,bufferViews:_}=s.json;let g=Promise.resolve();if(a){const v=[];for(let b=0;b<a.length;b++){const w=a[b];
15w.uri?v.push(U0(w,s,b,i)):s.buffers[b]||(s.buffers[b]=null)}g=Promise.all(v)}return g.then(()=>{const v=[],b=f&&f.includes(Ym),w=f&&f.includes(nf);if(b&&v.push(function(){if(!Ys)return dd??(dd=function(E){let A,P=null;function D(){A=new Uint8Array(P.buffer)}function F(){throw new Error("Unexpected Draco error.")}const j={a:{a:F,d:function(G,R,N){return A.copyWithin(G,R,R+N)},c:function(G){const R=A.length,N=Math.max(G>>>0,Math.ceil(1.2*R)),$=Math.ceil((N-R)/65536);try{return P.grow($),D(),!0}catch{return!1}},b:F}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,j):E.then(G=>G.arrayBuffer()).then(G=>WebAssembly.instantiate(G,j))).then(G=>{const{Rb:R,Qb:N,P:$,T:Z,X:oe,Ja:re,La:ae,Qa:he,Va:Se,Wa:Be,eb:ze,jb:Oe,f:Ne,e:Ie,yb:ke,zb:we,Ab:Ee,Bb:je,Db:$e,Gb:vt}=G.instance.exports;P=Ie;const ht=(()=>{let et=0,Ue=0,Ht=0,ut=0;return pt=>{Ht&&(R(ut),R(et),Ue+=Ht,Ht=et=0),et||(Ue+=128,et=N(Ue));const Ot=pt.length+7&-8;let ti=et;Ot>=Ue&&(Ht=Ot,ti=ut=N(Ot));for(let Qt=0;Qt<pt.length;Qt++)A[ti+Qt]=pt[Qt];return ti}})();return D(),Ne(),{memory:Ie,_free:R,_malloc:N,Mesh:class{constructor(){this.ptr=$()}destroy(){Z(this.ptr)}},Decoder:class{constructor(){this.ptr=re()}destroy(){Oe(this.ptr)}DecodeArrayToMesh(et,Ue,Ht){const ut=ht(et),pt=ae(this.ptr,ut,Ue,Ht.ptr);return!!oe(pt)}GetAttributeByUniqueId(et,Ue){return{ptr:he(this.ptr,et.ptr,Ue)}}GetTrianglesUInt16Array(et,Ue,Ht){Se(this.ptr,et.ptr,Ue,Ht)}GetTrianglesUInt32Array(et,Ue,Ht){Be(this.ptr,et.ptr,Ue,Ht)}GetAttributeDataArrayForAllPoints(et,Ue,Ht,ut,pt){ze(this.ptr,et.ptr,Ue.ptr,Ht,ut,pt)}},DT_INT8:ke(),DT_UINT8:we(),DT_INT16:Ee(),DT_UINT16:je(),DT_UINT32:$e(),DT_FLOAT32:vt()}})}(fetch(ly())),dd.then(E=>{Ys=E,dd=void 0}))}()),w&&v.push(function(){if(Wm)return;const E=function(A){let P;const D=WebAssembly.instantiateStreaming(A,{}).then(G=>{P=G.instance,P.exports.__wasm_call_ctors()}),F={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},j={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:D,supported:!0,decodeGltfBuffer(G,R,N,$,Z,oe){(function(re,ae,he,Se,Be,ze,Oe){const Ne=re.exports.sbrk,Ie=Se+3&-4,ke=Ne(Ie*Be),we=Ne(ze.length),Ee=new Uint8Array(re.exports.memory.buffer);Ee.set(ze,we);const je=ae(ke,Se,Be,we,ze.length);if(je===0&&Oe&&Oe(ke,Ie,Be),he.set(Ee.subarray(ke,ke+Se*Be)),Ne(ke-Ne(0)),je!==0)throw new Error(`Malformed buffer data: ${je}`)})(P,P.exports[j[Z]],G,R,N,$,P.exports[F[oe]])}}}(fetch(cy()));return E.ready.then(()=>{Wm=E})}()),u)for(let E=0;E<u.length;E++)v.push(j0(u[E],s,E,i));return(v.length?Promise.all(v):Promise.resolve()).then(()=>{if(b&&h)for(const{primitives:E}of h)for(const A of E)N0(A,s);if(w&&h&&_)for(const E of _)V0(E,s);return s})})}class _y{constructor(e){this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.hasPattern=!1,this.worldview=e.worldview}updateFootprints(e,i){}prepare(){return function(){if(Xm!=null||ay!=null)return null;if(zu!=null)return zu;const e=fetch(rn.BUILDING_GEN_URL);return zu=function(i){let s,a,u,h;function f(){s=new Uint8Array(h.buffer),a=new Int32Array(h.buffer),u=new Float32Array(h.buffer)}function _(){throw new Error("Unexpected BuildingGen error.")}const g=()=>{},v={a:{a:_,f:function(b){const w=s.length,E=Math.max(b>>>0,Math.ceil(1.2*w)),A=Math.ceil((E-w)/65536);try{return h.grow(A),f(),!0}catch{return!1}},g:_,b:g,c:g,d:g,e:g}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,v):i.then(b=>b.arrayBuffer()).then(b=>WebAssembly.instantiate(b,v))).then(b=>{const w=b.instance.exports;return(0,w.g)(),h=w.f,f(),new O0({setStyle:w.h,setAOOptions:w.i,setMetricOptions:w.j,setFacadeOptions:w.k,addFeature:w.l,addFacade:w.m,generateMesh:w.n,getLastError:w.o,getMeshCount:w.p,getPositionsPtr:w.q,getPositionsLength:w.r,getNormalsPtr:w.s,getNormalsLength:w.t,getColorsPtr:w.u,getColorsLength:w.v,getAOPtr:w.w,getAOLength:w.x,getIndicesPtr:w.y,getIndicesLength:w.z,getBuildingPart:w.A,getRingCount:w.B,getRingPtr:w.C,getRingLength:w.D,free:w.E,malloc:w.F,heapU8:s,heap32:a,heapF32:u})})}(e).then(i=>(zu=null,Xm=i,Xm)).catch(i=>{ii("Could not load building-gen"),zu=null,ay=i}),zu}()}populate(e,i,s,a){}update(e,i,s,a,u,h,f){}isEmpty(){return!1}uploadPending(){return!1}upload(e){}destroy(){}getHeightAtTileCoord(e,i){return{height:Number.NEGATIVE_INFINITY,hidden:!0}}}let gy,yy;st(_y,"BuildingBucket",{omit:["layers"]});const G0=Ai([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),$0=Ai([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:q0}=G0,H0=Ai([{name:"a_packed",components:3,type:"Float32"}]),{members:Z0}=H0,W0=Ai([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:X0}=W0;class xy{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new il({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const s=this.getKey(e,i);return this.positions[s]}trim(){const e=this.width,i=this.height=We(this.nextRow);this.image.resize({width:e,height:i})}
vendor: 5,096 bytes, line 15
15getKey(e,i){return e.join(",")+i}getDashRanges(e,i,s){const a=[];let u=e.length%2==1?-e[e.length-1]*s:0,h=e[0]*s,f=!0;a.push({left:u,right:h,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let g=1;g<e.length;g++){f=!f;const v=e[g];u=_*s,_+=v,h=_*s,a.push({left:u,right:h,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,s){const a=i/2;for(let u=-s;u<=s;u++){const h=this.width*(this.nextRow+s+u);let f=0,_=e[f];for(let g=0;g<this.width;g++){g/_.right>1&&(_=e[++f]);const v=Math.abs(g-_.left),b=Math.abs(g-_.right),w=Math.min(v,b);let E;const A=u/s*(a+1);if(_.isDash){const P=a-Math.abs(A);E=Math.sqrt(w*w+P*P)}else E=a-Math.sqrt(w*w+A*A);this.image.data[h+g]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const g=e[_],v=e[_+1];g.zeroLength?e.splice(_,1):v&&v.isDash===g.isDash&&(v.left=g.left,e.splice(_,1))}const s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const u=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const g=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(g,v);this.image.data[u+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const s=this.getKey(e,i);if(this.positions[s])return this.positions[s];const a=i==="round",u=a?7:0,h=2*u+1;if(this.nextRow+h>this.height)return ii("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let v=0;v<e.length;v++)e[v]<0&&(ii("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),f+=e[v];if(f!==0){const v=this.width/f,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,u):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+u;this.nextRow+=h;const g={tl:[_,u],br:[f,0]};return this.positions[s]=g,g}}st(xy,"LineAtlas");const Y0=oi.VectorTileFeature.types,K0=Math.cos(Math.PI/180*37.5),J0=Math.cos(Math.PI/180*5);class Km{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Bh,this.layoutVertexArray2=new As,this.patternVertexArray=new As,this.indexArray=new sn,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Ar,this.maxLineLength=0,this.zOffsetVertexArray=new As,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:Je/64,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=Lm("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Te(s);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),E=w.isConstant()&&!w.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&E?"none":"offset",this.elevationType==="offset"&&h==="none"&&ii(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:w,id:E,index:A,sourceLayerIndex:P}of e){const D=this.layers[0]._featureFilter.needGeometry,F=rt(w,D);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom,{worldview:this.worldview}),F,s))continue;const j=u?u.evaluate(F,{},s):void 0,G={id:E,properties:w.properties,type:w.type,sourceLayerIndex:P,index:A,geometry:D?F.geometry:at(w,s,a),patterns:{},sortKey:j};_.push(G)}u&&_.sort((w,E)=>w.sortKey-E.sortKey);const{lineAtlas:g,featureIndex:v}=i,b=this.addConstantDashes(g);for(const w of _){const{geometry:E,index:A,sourceLayerIndex:P}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const D=km("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(D)}else this.addFeature(w,E,A,s,g.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[A].feature,E,A,P,this.index)}}addConstantDashes(e){let i=!1;for(const s of this.layers){const a=s.paint.get("line-dasharray").value,u=s.layout.get("line-cap").value;if(a.kind!=="constant"||u.kind!=="constant")i=!0;else{const h=u.value,f=a.value;if(!f)continue;e.addDash(f,h)}}return i}addFeatureDashes(e,i){const s=this.zoom;for(const a of this.layers){const u=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(u.kind==="constant"&&h.kind==="constant")continue;let f,_;if(u.kind==="constant"){if(f=u.value,!f)continue}else f=u.evaluate({zoom:s},e);_=h.kind==="constant"?h.value:h.evaluate({zoom:s},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,s,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_)}
15addFeatures(e,i,s,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,s,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Z0)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,X0)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,$0.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,q0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,a,u,h,f,_){const g=this.layers[0].layout,v=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),E=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=g.get("line-z-offset").value;const A=this.layers[0].paint.get("line-width").value;if(A.kind!=="constant"&&A.isLineProgressConstant===!1&&(this.variableWidthValue=A),this.elevationType==="road"){const P=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,w,E)){const[D,F]=this.clipRuntimeLinesToTile(i,1);for(let j=0;j<D.length;j++){const G=D[j],R=F[j],N={progress:{min:R.progress.min,max:R.progress.max},nextDir:this.computeSegNextDir(R,G),prevDir:this.computeSegPrevDir(R,G)};this.addLine(G,e,a,v,b,w,E,N)}this.fillNonElevatedRoadSegment(P)}}else for(const P of i)this.addLine(P,e,a,v,b,w,E);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,h,a,f,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return ef(e,-i,-i,Je+i,Je+i)}clipRuntimeLinesToTile(e,i){const s=[];return[ef(e,-i,-i,Je+i,Je+i,s),s]}addElevatedRoadFeature(e,i,s,a,u,h,f,_){const g=[],v=Jn.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,v,s);for(const E of w)g.push({geometry:E,elevation:v,elevationTileID:s,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,s,u,h,f,_);const E=new vs(s,b.elevationTileID);if(b.elevation)for(let A=w;A<this.layoutVertexArray.length;A++){const P=new Xe(this.layoutVertexArray.int16[6*A]>>1,this.layoutVertexArray.int16[6*A+1]>>1),D=E.pointElevation(P,b.elevation,.05);this.updateHeightRange(D),this.zOffsetVertexArray.emplaceBack(D,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,s){if(i.constantHeight!=null)return e;const a=[],u=1/Te(s);for(const h of e)L0(h,new qn(i,u),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,s,a,u,h,f,_){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const g=a==="none";this.patternJoinNone=this.hasPattern&&g,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const v=_&&_.progress.min>0,b=_&&_.progress.max<1;if(this.lineClips){let oe={min:this.lineClips.start,max:this.lineClips.end},re=1;
vendor: 4,674 bytes, line 15
15if(_){const Se=this.lineClips.end-this.lineClips.start;oe=function(Be,ze,Oe){return{min:ml(Be.min,ze,Oe),max:ml(Be.max,ze,Oe)}}(_.progress,{min:0,max:1},oe),Se>0&&(re=(oe.max-oe.min)/Se)}const ae=+i.properties.mapbox_clip_feature_len,he=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(ae)||Number.isNaN(he)){for(let Be=0;Be<e.length-1;Be++)this.totalDistance+=e[Be].dist(e[Be+1]);const Se=this.totalDistance/(oe.max-oe.min);this.totalFeatureLength=Number.isFinite(Se)?Se:0,this.lineClips.start=oe.min,this.lineClips.end=oe.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=ae,this.distance=he*re,this.lineClips.start=oe.min,this.lineClips.end=oe.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const w=Y0[i.type]==="Polygon";let E=e.length;for(;E>=2&&e[E-1].equals(e[E-2]);)E--;let A=0;for(;A<E-1&&e[A].equals(e[A+1]);)A++;if(E<(w?3:2))return;a==="bevel"&&(h=1.05);const P=this.segments.prepareSegment(10*E,this.layoutVertexArray,this.indexArray);let D,F,j,G,R,N,$,Z;_&&_.prevDir&&(N=_.prevDir.perp()),_&&_.nextDir&&($=_.nextDir.perp()),this.e1=this.e2=-1,w&&(D=e[E-2],R=e[A].sub(D)._unit()._perp());for(let oe=A;oe<E;oe++){if(j=oe===E-1?w?e[A+1]:void 0:e[oe+1],j&&e[oe].equals(j))continue;R&&(G=R),D&&(F=D),D=e[oe],Z=this.evaluateLineProgressFeatures(F?F.dist(D):0),R=j?j.sub(D)._unit()._perp():G,G=G||R;const re=F&&j;let ae=re?a:w||g?"butt":u;const he=G.x*R.x+G.y*R.y;if(g){const we=function(Ee){if(Ee.patternJoinNone){const je=Ee.segmentPoints.length/2,$e=Ee.lineSoFar-Ee.segmentStart;for(let vt=0;vt<je;++vt){const ht=Ee.segmentPoints[2*vt+1],et=Math.round(Ee.segmentPoints[2*vt])+.5+.25*ht;Ee.patternVertexArray.emplaceBack(et,$e,Ee.segmentStart),Ee.patternVertexArray.emplaceBack(et,$e,Ee.segmentStart)}Ee.segmentPoints.length=0}Ee.e1=Ee.e2=-1};if(re&&he<J0){this.updateDistance(F,D),this.addCurrentVertex(D,G,1,1,P,Z),we(this),this.addCurrentVertex(D,R,-1,-1,P,Z);continue}if(F){if(!j){this.updateDistance(F,D),this.addCurrentVertex(D,G,1,1,P,Z),we(this);continue}ae="miter"}}let Se=G.add(R);Se.x===0&&Se.y===0||Se._unit();const Be=Se.x*R.x+Se.y*R.y,ze=Be!==0?1/Be:1/0,Oe=2*Math.sqrt(2-2*Be),Ne=Be<K0&&F&&j,Ie=G.x*R.y-G.y*R.x>0,ke=this.overscaling<=16?15*Je/(512*this.overscaling):0;if(re&&ae==="round"){if(ze<f)ae="miter";else if(ze<=2){const we=Jm(D,-10,Je+10);ae=this.elevationType==="offset"&&(we||this.hasCrossSlope)?"miter":"fakeround"}}if(ae==="miter"&&ze>h&&(ae="bevel"),ae==="bevel"&&(ze>2&&(ae="flipbevel"),ze<h&&(ae="miter")),F&&!(ae==="miter"&&Ne)&&this.updateDistance(F,D),ae==="miter")if(Ne){const we=D.dist(F);if(we>2*ke){const je=D.sub(D.sub(F)._mult(ke/we)._round());this.updateDistance(F,je),this.addCurrentVertex(je,G,0,0,P,Z),F=je}this.updateDistance(F,D),Se._mult(ze),this.addCurrentVertex(D,Se,0,0,P,Z);const Ee=D.dist(j);if(Ee>2*ke){const je=D.add(j.sub(D)._mult(ke/Ee)._round());this.updateDistance(D,je),this.addCurrentVertex(je,R,0,0,P,Z),D=je}}else Se._mult(ze),this.addCurrentVertex(D,Se,0,0,P,Z);else if(ae==="flipbevel"){if(ze>100)Se=R.mult(-1);else{const we=ze*G.add(R).mag()/G.sub(R).mag();Se._perp()._mult(we*(Ie?-1:1))}this.addCurrentVertex(D,Se,0,0,P,Z),this.addCurrentVertex(D,Se.mult(-1),0,0,P,Z)}else if(ae==="bevel"||ae==="fakeround"){Z!=null&&F&&this.addCurrentVertex(D,$||G,-1,-1,P,Z);const we=D.dist(F)<=2*ke&&ae!=="bevel",Ee=Se.mult(Ie?1:-1);Ee._mult(ze);const je=R.mult(Ie?-1:1),$e=G.mult(Ie?-1:1),vt=this.evaluateLineProgressFeatures(this.distance);if(Z==null&&(this.addHalfVertex(D,Ee.x,Ee.y,!1,!Ie,0,P,vt),we||this.addHalfVertex(D,Ee.x+2*$e.x,Ee.y+2*$e.y,!1,Ie,0,P,vt)),ae==="fakeround"){const ht=Math.round(180*Oe/Math.PI/20);this.addHalfVertex(D,$e.x,$e.y,!1,Ie,0,P,vt);for(let et=0;et<ht;et++){let Ue=et/ht;if(Ue!==.5){const ut=Ue-.5;Ue+=Ue*ut*(Ue-1)*((1.0904+he*(he*(3.55645-1.43519*he)-3.2452))*ut*ut+(.848013+he*(.215638*he-1.06021)))}const Ht=je.sub($e)._mult(Ue)._add($e)._unit();this.addHalfVertex(D,Ht.x,Ht.y,!1,Ie,0,P,vt)}this.addHalfVertex(D,je.x,je.y,!1,Ie,0,P,vt)}we||Z!=null||this.addHalfVertex(D,Ee.x+2*je.x,Ee.y+2*je.y,!1,Ie,0,P,vt),Z!=null&&j&&this.addCurrentVertex(D,N||R,1,1,P,Z)}else if(ae==="butt")this.addCurrentVertex(D,Se,0,0,P,Z);else if(ae==="square"){if(!F){const we=v?0:-1;this.addCurrentVertex(D,Se,we,we,P,Z)}if(this.addCurrentVertex(D,Se,0,0,P,Z),F){const we=b?0:1;this.addCurrentVertex(D,Se,we,we,P,Z)}}else if(ae==="round"){if(F){const we=!re&&$?$:G;this.addCurrentVertex(D,we,0,0,P,Z),!re&&b||this.addCurrentVertex(D,we,1,1,P,Z,!0)}if(j){const we=!re&&N?N:R;!re&&v||this.addCurrentVertex(D,we,-1,-1,P,Z,!0),this.addCurrentVertex(D,we,0,0,P,Z)}}}}
15addVerticesTo(e,i,s,a,u,h,f,_,g,v){const b=(i.w-e.w)/this.tessellationStep|0;let w=0;const E=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const P=(i.x-e.x)/b,D=(i.y-e.y)/b,F=(i.z-e.z)/b,j=(i.w-e.w)/b;for(let G=1;G<b;++G){e.x+=P,e.y+=D,e.z+=F,this.lineSoFar+=j,w+=j;const R=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,s,a,v,!1,f,g,R),this.addHalfVertex(e,u,h,v,!0,-_,g,R)}}this.lineSoFar=i.w,this.scaledDistance=E;const A=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,s,a,v,!1,f,g,A),this.addHalfVertex(i,u,h,v,!0,-_,g,A)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):ii(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,s,a,u,h,f=!1){const _=i.x+i.y*s,g=i.y-i.x*s,v=i.y*a-i.x,b=-i.y-i.x*a;if(h!=null){const w=this.elevationType==="offset",E=-10,A=Je+10,P=h.zOffset,D=new ey(e.x,e.y,P,this.lineSoFar),F=!!w&&Jm(e,E,A),j=this.lineS
15oFar,G=this.distance;if(this.currentVertex)if(F){const R=this.currentVertexIsOutside,N=this.currentVertex,$=new ey(e.x,e.y,P,this.lineSoFar);if(iy(N,$,E,A),!Jm($,E,A)){if(R){this.e1=this.e2=-1,this.distance-=N.dist(D),this.lineSoFar=N.w;const Z=this.evaluateLineProgressFeatures(N.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(N,_,g,f,!1,s,u,Z),this.addHalfVertex(N,v,b,f,!0,-a,u,Z),this.prevDistance=this.distance}this.distance=this.prevDistance+N.dist($),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(N,$,_,g,v,b,s,a,u,f),this.distance=G,this.scaledDistance=this.distance/this.totalDistance}}else{const R=this.currentVertex;if(this.currentVertexIsOutside){iy(R,D,E,A),this.e1=this.e2=-1,this.distance-=R.dist(D),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=R.w;const N=this.evaluateLineProgressFeatures(R.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(R,_,g,f,!1,s,u,N),this.addHalfVertex(R,v,b,f,!0,-a,u,N),this.prevDistance=this.distance,this.distance=G,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(R,D,_,g,v,b,s,a,u,f)}else F||(this.addHalfVertex(e,_,g,f,!1,s,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h));this.currentVertex=D,this.currentVertexIsOutside=F,this.lineSoFar=j}else this.addHalfVertex(e,_,g,f,!1,s,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h)}addHalfVertex({x:e,y:i},s,a,u,h,f,_,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=Ft(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),h?this.e2=v:this.e1=v,g!=null&&this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function Jm(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let vy,by;function wy(r,e,i){return e*(Je/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}st(Km,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Ty=(r,e,i)=>(1-i)*r+i*e;function Sy(r,e){return 1/wy(r,1,e.tileZoom)}function Ey(r,e,i,s){return r.translatePosMatrix(s||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Iy=r=>{const e=[];Ay(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const s=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return s&&a&&e.push("LINE_JOIN_NONE"),e};function Ay(r){const e=r.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let Qm;const My=()=>Qm||(Qm={layout:vy||(vy=new Er({"line-cap":new it(pe.layout_line["line-cap"]),"line-join":new it(pe.layout_line["line-join"]),"line-miter-limit":new Ve(pe.layout_line["line-miter-limit"]),"line-round-limit":new Ve(pe.layout_line["line-round-limit"]),"line-sort-key":new it(pe.layout_line["line-sort-key"]),"line-z-offset":new it(pe.layout_line["line-z-offset"]),"line-elevation-reference":new Ve(pe.layout_line["line-elevation-reference"]),"line-cross-slope":new Ve(pe.layout_line["line-cross-slope"]),visibility:new Ve(pe.layout_line.visibility),"line-width-unit":new Ve(pe.layout_line["line-width-unit"])})),paint:by||(by=new Er({"line-opacity":new it(pe.paint_line["line-opacity"]),"line-color":new it(pe.paint_line["line-color"]),"line-translate":new Ve(pe.paint_line["line-translate"]),"line-translate-anchor":new Ve(pe.paint_line["line-translate-anchor"]),"line-width":new it(pe.paint_line["line-width"]),"line-gap-width":new it(pe.paint_line["line-gap-width"]),"line-offset":new it(pe.paint_line["line-offset"]),"line-blur"
vendor: 5,335 bytes, line 15
15:new it(pe.paint_line["line-blur"]),"line-dasharray":new it(pe.paint_line["line-dasharray"]),"line-pattern":new it(pe.paint_line["line-pattern"]),"line-pattern-cross-fade":new Ve(pe.paint_line["line-pattern-cross-fade"]),"line-gradient":new na(pe.paint_line["line-gradient"]),"line-trim-offset":new Ve(pe.paint_line["line-trim-offset"]),"line-trim-fade-range":new Ve(pe.paint_line["line-trim-fade-range"]),"line-trim-color":new Ve(pe.paint_line["line-trim-color"]),"line-emissive-strength":new Ve(pe.paint_line["line-emissive-strength"]),"line-border-width":new it(pe.paint_line["line-border-width"]),"line-border-color":new it(pe.paint_line["line-border-color"]),"line-occlusion-opacity":new Ve(pe.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},Qm);class Q0 extends it{possiblyEvaluate(e,i){return i=new Wi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,a){return i=ye({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,a)}}let fd;function Cy(r,e){return e>0?e+2*r:r}const e1=Ai([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),t1=Ai([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),i1=Ai([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ai([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const r1=Ai([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),n1=Ai([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),s1=Ai([{name:"a_texb",components:2,type:"Uint16"}]),o1=Ai([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),a1=Ai([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Ai([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Py=Ai([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),l1=Ai([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ai([{name:"triangle",components:3,type:"Uint16"}]),Ai([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),Ai([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
15]),Ai([{type:"Float32",name:"offsetX"}]),Ai([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var tn=24;function c1(r,e,i){return r.sections.forEach(s=>{s.text=function(a,u,h){const f=u.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),Hs.applyArabicShaping&&(a=Hs.applyArabicShaping(a)),a}(s.text,e,i)}),r}const md={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function u1(r){return r==="︶"||r==="ï¹"||r==="︸"||r==="ï¹"||r==="ï¹"||r==="︾"||r==="︼"||r==="︺"||r==="ï¸"||r==="ï¹"||r==="ï¸"||r==="ï¸"||r==="ï¸"||r==="ï½"||r==="ï¿£"||r==="ï¸"||r==="ï¸"}function h1(r){return r==="︵"||r==="ï¹"||r==="︷"||r==="ï¹"||r==="ï¹"||r==="︽"||r==="︻"||r==="︹"||r==="ï¸"||r==="︿"}var Ry,e_,zy,t_={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function d1(){return Ry||(Ry=1,t_.read=function(r,e,i,s,a){var u,h,f=8*a-s-1,_=(1<<f)-1,g=_>>1,v=-7,b=i?a-1:0,w=i?-1:1,E=r[e+b];for(b+=w,u=E&(1<<-v)-1,E>>=-v,v+=f;v>0;u=256*u+r[e+b],b+=w,v-=8);for(h=u&(1<<-v)-1,u>>=-v,v+=s;v>0;h=256*h+r[e+b],b+=w,v-=8);if(u===0)u=1-g;else{if(u===_)return h?NaN:1/0*(E?-1:1);h+=Math.pow(2,s),u-=g}return(E?-1:1)*h*Math.pow(2,u-s)},t_.write=function(r,e,i,s,a,u){var h,f,_,g=8*u-a-1,v=(1<<g)-1,b=v>>1,w=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=s?0:u-1,A=s?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,h=v):(h=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-h))<1&&(h--,_*=2),(e+=h+b>=1?w/_:w*Math.pow(2,1-b))*_>=2&&(h++,_/=2),h+b>=v?(f=0,h=v):h+b>=1?(f=(e*_-1)*Math.pow(2,a),h+=b):(f=e*Math.pow(2,b-1)*Math.pow(2,a),h=0));a>=8;r[i+E]=255&f,E+=A,f/=256,a-=8);for(h=h<<a|f,g+=a;g>0;r[i+E]=255&h,E+=A,h/=256,g-=8);r[i+E-A]|=128*P}),t_}function Dy(){if(zy)return e_;zy=1,e_=e;var r=d1();function e(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var i=4294967296,s=1/i,a=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function u(R){return R.type===e.Bytes?R.readVarint()+R.pos:R.pos+1}function h(R,N,$){return $?4294967296*N+(R>>>0):4294967296*(N>>>0)+(R>>>0)}function f(R,N,$){var Z=N<=16383?1:N<=2097151?2:N<=268435455?3:Math.floor(Math.log(N)/(7*Math.LN2));$.realloc(Z);for(var oe=$.pos-1;oe>=R;oe--)$.buf[oe+Z]=$.buf[oe]}function _(R,N){for(var $=0;$<R.length;$++)N.writeVarint(R[$])}function g(R,N){for(var $=0;$<R.length;$++)N.writeSVarint(R[$])}function v(R,N){for(var $=0;$<R.length;$++)N.writeFloat(R[$])}function b(R,N){for(var $=0;$<R.length;$++)N.writeDouble(R[$])}function w(R,N){for(var $=0;$<R.length;$++)N.writeBoolean(R[$])}function E(R,N){for(var $=0;$<R.length;$++)N.writeFixed32(R[$])}function A(R,N){for(var $=0;$<R.length;$++)N.writeSFixed32(R[$])}function P(R,N){for(var $=0;$<R.length;$++)N.writeFixed64(R[$])}function D(R,N){for(var $=0;$<R.length;$++)N.writeSFixed64(R[$])}function F(R,N){return(R[N]|R[N+1]<<8|R[N+2]<<16)+16777216*R[N+3]}function j(R,N,$){R[$]=N,R[$+1]=N>>>8,R[$+2]=N>>>16,R[$+3]=N>>>24}function G(R,N){return(R[N]|R[N+1]<<8|R[N+2]<<16)+(R[N+3]<<24)}
vendor: 8,253 bytes, line 15
15return e.prototype={destroy:function(){this.buf=null},readFields:function(R,N,$){for($=$||this.length;this.pos<$;){var Z=this.readVarint(),oe=Z>>3,re=this.pos;this.type=7&Z,R(oe,N,this),this.pos===re&&this.skip(Z)}return N},readMessage:function(R,N){return this.readFields(R,N,this.readVarint()+this.pos)},readFixed32:function(){var R=F(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=G(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=F(this.buf,this.pos)+F(this.buf,this.pos+4)*i;return this.pos+=8,R},readSFixed64:function(){var R=F(this.buf,this.pos)+G(this.buf,this.pos+4)*i;return this.pos+=8,R},readFloat:function(){var R=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var N,$,Z=this.buf;return N=127&($=Z[this.pos++]),$<128?N:(N|=(127&($=Z[this.pos++]))<<7,$<128?N:(N|=(127&($=Z[this.pos++]))<<14,$<128?N:(N|=(127&($=Z[this.pos++]))<<21,$<128?N:function(oe,re,ae){var he,Se,Be=ae.buf;if(he=(112&(Se=Be[ae.pos++]))>>4,Se<128||(he|=(127&(Se=Be[ae.pos++]))<<3,Se<128)||(he|=(127&(Se=Be[ae.pos++]))<<10,Se<128)||(he|=(127&(Se=Be[ae.pos++]))<<17,Se<128)||(he|=(127&(Se=Be[ae.pos++]))<<24,Se<128)||(he|=(1&(Se=Be[ae.pos++]))<<31,Se<128))return h(oe,he,re);throw new Error("Expected varint not more than 10 bytes")}(N|=(15&($=Z[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,N=this.pos;return this.pos=R,R-N>=12&&a?function($,Z,oe){return a.decode($.subarray(Z,oe))}(this.buf,N,R):function($,Z,oe){for(var re="",ae=Z;ae<oe;){var he,Se,Be,ze=$[ae],Oe=null,Ne=ze>239?4:ze>223?3:ze>191?2:1;if(ae+Ne>oe)break;Ne===1?ze<128&&(Oe=ze):Ne===2?(192&(he=$[ae+1]))==128&&(Oe=(31&ze)<<6|63&he)<=127&&(Oe=null):Ne===3?(Se=$[ae+2],(192&(he=$[ae+1]))==128&&(192&Se)==128&&((Oe=(15&ze)<<12|(63&he)<<6|63&Se)<=2047||Oe>=55296&&Oe<=57343)&&(Oe=null)):Ne===4&&(Se=$[ae+2],Be=$[ae+3],(192&(he=$[ae+1]))==128&&(192&Se)==128&&(192&Be)==128&&((Oe=(15&ze)<<18|(63&he)<<12|(63&Se)<<6|63&Be)<=65535||Oe>=1114112)&&(Oe=null)),Oe===null?(Oe=65533,Ne=1):Oe>65535&&(Oe-=65536,re+=String.fromCharCode(Oe>>>10&1023|55296),Oe=56320|1023&Oe),re+=String.fromCharCode(Oe),ae+=Ne}return re}(this.buf,N,R)},readBytes:function(){var R=this.readVarint()+this.pos,N=this.buf.subarray(this.pos,R);return this.pos=R,N},readPackedVarint:function(R,N){if(this.type!==e.Bytes)return R.push(this.readVarint(N));var $=u(this);for(R=R||[];this.pos<$;)R.push(this.readVarint(N));return R},readPackedSVarint:function(R){if(this.type!==e.Bytes)return R.push(this.readSVarint());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==e.Bytes)return R.push(this.readBoolean());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==e.Bytes)return R.push(this.readFloat());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==e.Bytes)return R.push(this.readDouble());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==e.Bytes)return R.push(this.readFixed32());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==e.Bytes)return R.push(this.readSFixed32());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==e.Bytes)return R.push(this.readFixed64());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==e.Bytes)return R.push(this.readSFixed64());var N=u(this);for(R=R||[];this.pos<N;)R.push(this.readSFixed64());return R},skip:function(R){var N=7&R;if(N===e.Varint)for(;this.buf[this.pos++]>127;);else if(N===e.Bytes)this.pos=this.readVarint()+this.pos;else if(N===e.Fixed32)this.pos+=4;else{if(N!==e.Fixed64)throw new Error("Unimplemented type: "+N);this.pos+=8}},writeTag:function(R,N){this.writeVarint(R<<3|N)},realloc:function(R){for(var N=this.length||16;N<this.pos+R;)N*=2;if(N!==this.length){var $=new Uint8Array(N);$.set(this.buf),this.buf=$,this.length=N}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),j(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),j(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),j(this.buf,-1&R,this.pos),j(this.buf,Math.floor(R*s),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),j(this.buf,-1&R,this.pos),j(this.buf,Math.floor(R*s),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(N,$){var Z,oe;if(N>=0?(Z=N%4294967296|0,oe=N/4294967296|0):(oe=~(-N/4294967296),4294967295^(Z=~(-N%4294967296))?Z=Z+1|0:(Z=0,oe=oe+1|0)),N>=18446744073709552e3||N<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");$.realloc(10),function(re,ae,he){he.buf[he.pos++]=127&re|128,re>>>=7,he.buf[he.pos++]=127&re|128,re>>>=7,he.buf[he.pos++]=127&re|128,re>>>=7,he.buf[he.pos++]=127&re|128,he.buf[he.pos]=127&(re>>>=7)}(Z,0,$),function(re,ae){var he=(7&re)<<4;ae.buf[ae.pos++]|=he|((re>>>=3)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re)))))}(oe,$)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var N=this.pos;this.pos=function(Z,oe,re){for(var ae,he,Se=0;Se<oe.length;Se++){if((ae=oe.charCodeAt(Se))>55295&&ae<57344){if(!he){ae>56319||Se+1===oe.length?(Z[re++]=239,Z[re++]=191,Z[re++]=189):he=ae;continue}if(ae<56320){Z[re++]=239,Z[re++]=191,Z[re++]=189,he=ae;continue}ae=he-55296<<10|ae-56320|65536,he=null}else he&&(Z[re++]=239,Z[re++]=191,Z[re++]=189,he=null);ae<128?Z[re++]=ae:(ae<2048?Z[re++]=ae>>6|192:(ae<65536?Z[re++]=ae>>12|224:(Z[re++]=ae>>18|240,Z[re++]=ae>>12&63|128),Z[re++]=ae>>6&63|128),Z[re++]=63&ae|128)}return re}(this.buf,R,this.pos);var $=this.pos-N;$>=128&&f(N,$,this),this.pos=N-1,this.writeVarint($),this.pos+=$},writeFloat:function(R){this.realloc(4),r.write(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),r.write(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var N=R.length;this.writeVarint(N),this.realloc(N);for(var $=0;$<N;$++)this.buf[this.pos++]=R[$]},writeRawMessage:function(R,N){this.pos++;var $=this.pos;R(N,this);var Z=this.pos-$;Z>=128&&f($,Z,this),this.pos=$-1,this.writeVarint(Z),this.pos+=Z},writeMessage:function(R,N,$){this.writeTag(R,e.Bytes),this.writeRawMessage(N,$)},writePackedVarint:function(R,N){N.length&&this.writeMessage(R,_,N)},writePackedSVarint:function(R,N){N.length&&this.writeMessage(R,g,N)},writePackedBoolean:function(R,N){N.length&&this.writeMessage(R,w,N)},writePackedFloat:function(R,N){N.length&&this.writeMessage(R,v,N)},writePackedDouble:function(R,N){N.length&&this.writeMessage(R,b,N)},writePackedFixed32:function(R,N){N.length&&this.writeMessage(R,E,N)},writePackedSFixed32:function(R,N){N.length&&this.writeMessage(R,A,N)},writePackedFixed64:function(R,N){N.length&&this.writeMessage(R,P,N)},writePackedSFixed64:function(R,N){N.length&&this.writeMessage(R,D,N)},writeBytesField:function(R,N){this.writeTag(R,e.Bytes),this.writeBytes(N)},writeFixed32Field:function(R,N){this.writeTag(R,e.Fixed32),this.writeFixed32(N)},writeSFixed32Field:function(R,N){this.writeTag(R,e.Fixed32),this.writeSFixed32(N)},writeFixed64Field:function(R,N){this.writeTag(R,e.Fixed64),this.writeFixed64
15(N)},writeSFixed64Field:function(R,N){this.writeTag(R,e.Fixed64),this.writeSFixed64(N)},writeVarintField:function(R,N){this.writeTag(R,e.Varint),this.writeVarint(N)},writeSVarintField:function(R,N){this.writeTag(R,e.Varint),this.writeSVarint(N)},writeStringField:function(R,N){this.writeTag(R,e.Bytes),this.writeString(N)},writeFloatField:function(R,N){this.writeTag(R,e.Fixed32),this.writeFloat(N)},writeDoubleField:function(R,N){this.writeTag(R,e.Fixed64),this.writeDouble(N)},writeBooleanField:function(R,N){this.writeVarintField(R,!!N)}},e_}var sf=lo(Dy());const i_=3;function p1(r,e,i){e.glyphs=[],r===1&&i.readMessage(f1,e)}function f1(r,e,i){if(r===3){const{id:s,bitmap:a,width:u,height:h,left:f,top:_,advance:g}=i.readMessage(m1,{});e.glyphs.push({id:s,bitmap:new il({width:u+2*i_,height:h+2*i_},a),metrics:{width:u,height:h,left:f,top:_,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function m1(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const _1=i_,Qn={horizontal:1,vertical:2,horizontalOnly:3};class _d{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const s=new _d;return s.scale=e||1,s.fontStack=i,s}static forImage(e){const i=new _d;return i.image=e,i}}class Du{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,s){const a=new Du;for(let u=0;u<e.sections.length;u++){const h=e.sections[u];h.image?a.addImageSection(h,s):a.addTextSection(h,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,s){let a="";for(let u=0;u<i.length;u++){const h=i.charCodeAt(u+1)||null,f=i.charCodeAt(u-1)||null;a+=!s&&(h&&_p(h)&&!md[i[u+1]]||f&&_p(f)&&!md[i[u-1]])||!md[i[u]]?i[u]:md[i[u]]}return a}(this.text,e)}trim(){let e=0;for(let s=0;s<this.text.length&&of[this.text.charCodeAt(s)];s++)e++;let i=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&of[this.text.charCodeAt(s)];s--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const s=new Du;return s.text=this.text.substring(e,i),s.sectionIndex=this.sectionIndex.slice(e,i),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(_d.forText(e.scale,e.fontStack||i));const s=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(s)}addImageSection(e,i){const s=e.image?e.image.getPrimary():null;if(!s)return void ii("Can't add FormattedSection with an empty image.");s.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(_d.forImage(s)),this.sectionIndex.push(this.sections.length-1)):ii("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function r_(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P=1){const D=Du.fromFeature(r,a,P);
15b===Qn.vertical&&D.verticalizePunctuation(w);let F=[];const j=function(Z,oe,re,ae,he,Se){if(!Z)return[];const Be=[],ze=function(ke,we,Ee,je,$e,vt){let ht=0;for(let et=0;et<ke.length();et++){const Ue=ke.getSection(et);ht+=Ly(ke.getCodePoint(et),Ue,je,$e,we,vt)}return ht/Math.max(1,Math.ceil(ht/Ee))}(Z,oe,re,ae,he,Se),Oe=Z.text.indexOf("â")>=0;let Ne=0;for(let ke=0;ke<Z.length();ke++){const we=Z.getSection(ke),Ee=Z.getCodePoint(ke);if(of[Ee]||(Ne+=Ly(Ee,we,ae,he,oe,Se)),ke<Z.length()-1){const je=!((Ie=Ee)<11904||!(St["Bopomofo Extended"](Ie)||St.Bopomofo(Ie)||St["CJK Compatibility Forms"](Ie)||St["CJK Compatibility Ideographs"](Ie)||St["CJK Compatibility"](Ie)||St["CJK Radicals Supplement"](Ie)||St["CJK Strokes"](Ie)||St["CJK Symbols and Punctuation"](Ie)||St["CJK Unified Ideographs Extension A"](Ie)||St["CJK Unified Ideographs"](Ie)||St["Enclosed CJK Letters and Months"](Ie)||St["Halfwidth and Fullwidth Forms"](Ie)||St.Hiragana(Ie)||St["Ideographic Description Characters"](Ie)||St["Kangxi Radicals"](Ie)||St["Katakana Phonetic Extensions"](Ie)||St.Katakana(Ie)||St["Vertical Forms"](Ie)||St["Yi Radicals"](Ie)||St["Yi Syllables"](Ie)));
15(g1[Ee]||je||we.image)&&Be.push(Fy(ke+1,Ne,ze,Be,y1(Ee,Z.getCodePoint(ke+1),je&&Oe),!1))}}var Ie;return Oy(Fy(Z.length(),Ne,ze,Be,0,!0))}(D,g,u,e,s,E),{processBidirectionalText:G,processStyledBidirectionalText:R}=Hs;if(G&&D.sections.length===1){const Z=G(D.toString(),j);for(const oe of Z){const re=new Du;re.text=oe,re.sections=D.sections;for(let ae=0;ae<oe.length;ae++)re.sectionIndex.push(0);F.push(re)}}else if(R){const Z=R(D.text,D.sectionIndex,j);for(const oe of Z){const re=new Du;re.text=oe[0],re.sectionIndex=oe[1],re.sections=D.sections,F.push(re)}}else F=function(Z,oe){const re=[],ae=Z.text;let he=0;for(const Se of oe)re.push(Z.substring(he,Se)),he=Se;return he<ae.length&&re.push(Z.substring(he,ae.length)),re}(D,j);const N=[],$={positionedLines:N,text:D.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(Z,oe,re,ae,he,Se,Be,ze,Oe,Ne,Ie,ke){let we=0,Ee=0,je=0;const $e=ze==="right"?1:ze==="left"?0:.5;let vt=!1;for(const pt of he){const Ot=pt.getSections();for(const ti of Ot){if(ti.image)continue;const Qt=oe[ti.fontStack];if(Qt&&(vt=Qt.ascender!==void 0&&Qt.descender!==void 0,!vt))break}if(!vt)break}let ht=0;for(const pt of he){pt.trim();const Ot=pt.getMaxScale(),ti=(Ot-1)*tn,Qt={positionedGlyphs:[],lineOffset:0};Z.positionedLines[ht]=Qt;const hi=Qt.positionedGlyphs;let ni=0;if(!pt.length()){Ee+=Se,++ht;continue}let di=0,Ni=0;for(let q=0;q<pt.length();q++){const W=pt.getSection(q),Ae=pt.getSectionIndex(q),He=pt.getCodePoint(q);let tt=W.scale,Qe=null,ct=null,Dt=null,_i=tn,gi=0;Oe===Qn.vertical&&((et=He)===12312||et===12313||et===12316||et===12540||et===12448)&&(Oe=Qn.horizontal);const si=!(Oe===Qn.horizontal||!Ie&&!Ph(He)||Ie&&(of[He]||mm(He)));if(W.image){const Gi=ae.get(W.image.toString());if(!Gi)continue;Dt=W.image,Z.iconsInText=Z.iconsInText||!0,ct=Gi.paddedRect;const er=Gi.displaySize;tt=tt*tn/ke,Qe={width:er[0],height:er[1],left:0,top:-3,advance:si?er[1]:er[0],localGlyph:!1},gi=vt?-Qe.height*tt:Ot*tn-17-er[1]*tt,_i=Qe.advance;const yi=(si?er[0]:er[1])*tt-tn*Ot;yi>0&&yi>ni&&(ni=yi)}else{const Gi=re[W.fontStack];if(!Gi)continue;Gi[He]&&(ct=Gi[He]);const er=oe[W.fontStack];if(!er)continue;const yi=er.glyphs[He];if(!yi)continue;if(Qe=yi.metrics,_i=He!==8203?tn:0,vt){const br=er.ascender!==void 0?Math.abs(er.ascender):0,sr=er.descender!==void 0?Math.abs(er.descender):0,Vi=(br+sr)*tt;di<Vi&&(di=Vi,Ni=(br-sr)/2*tt),gi=-br*tt}else gi=(Ot-tt)*tn-17}si?(Z.verticalizable=!0,hi.push({glyph:He,image:Dt,x:we,y:Ee+gi,vertical:si,scale:tt,localGlyph:Qe.localGlyph,fontStack:W.fontStack,sectionIndex:Ae,metrics:Qe,rect:ct}),we+=_i*tt+Ne):(hi.push({glyph:He,image:Dt,x:we,y:Ee+gi,vertical:si,scale:tt,localGlyph:Qe.localGlyph,fontStack:W.fontStack,sectionIndex:Ae,metrics:Qe,rect:ct}),we+=Qe.advance*tt+Ne)}hi.length!==0&&(je=Math.max(we-Ne,je),vt?By(hi,$e,ni,Ni,Se*Ot/2):By(hi,$e,ni,0,Se/2)),we=0;const nr=Se*Ot+ni;
vendor: 5,235 bytes, line 15
15Qt.lineOffset=Math.max(ni,ti),Ee+=nr,++ht}var et;const Ue=Ee,{horizontalAlign:Ht,verticalAlign:ut}=n_(Be);(function(pt,Ot,ti,Qt,hi,ni){const di=(Ot-ti)*hi,Ni=-ni*Qt;for(const nr of pt)for(const q of nr.positionedGlyphs)q.x+=di,q.y+=Ni})(Z.positionedLines,$e,Ht,ut,je,Ue),Z.top+=-ut*Ue,Z.bottom=Z.top+Ue,Z.left+=-Ht*je,Z.right=Z.left+je,Z.hasBaseline=vt}($,e,i,s,F,h,f,_,b,g,w,A),!function(Z){for(const oe of Z)if(oe.positionedGlyphs.length!==0)return!1;return!0}(N))return $}const of={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},g1={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Ly(r,e,i,s,a,u){if(e.image){const h=s.get(e.image.toString());return h?h.displaySize[0]*e.scale*tn/u+a:0}{const h=i[e.fontStack],f=h&&h.glyphs[r];return f?f.metrics.advance*e.scale+a:0}}function ky(r,e,i,s){const a=Math.pow(r-e,2);return s?r<e?a/2:2*a:a+Math.abs(i)*i}function y1(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function Fy(r,e,i,s,a,u){let h=null,f=ky(e,i,a,u);for(const _ of s){const g=ky(e-_.x,i,a,u)+_.badness;g<=f&&(h=_,f=g)}return{index:r,x:e,priorBreak:h,badness:f}}function Oy(r){return r?Oy(r.priorBreak).concat(r.index):[]}function n_(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function By(r,e,i,s,a){if(!(e||i||s||a))return;const u=r.length-1,h=r[u],f=(h.x+h.metrics.advance*h.scale)*e;for(let _=0;_<=u;_++)r[_].x-=f,r[_].y+=i+s+a}function Ny(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function x1(r,e,i,s){const{horizontalAlign:a,verticalAlign:u}=n_(s),h=i[0]-r.displaySize[0]*a,f=i[1]-r.displaySize[1]*u;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:h,right:h+r.displaySize[0]}}function Vy(r,e,i,s,a,u){const h=r.imagePrimary;let f;if(h.content){const D=h.content,F=h.pixelRatio||1;f=[D[0]/F,D[1]/F,h.displaySize[0]-D[2]/F,h.displaySize[1]-D[3]/F]}const _=e.left*u,g=e.right*u;let v,b,w,E;i==="width"||i==="both"?(E=a[0]+_-s[3],b=a[0]+g+s[1]):(E=a[0]+(_+g-h.displaySize[0])/2,b=E+h.displaySize[0]);const A=e.top*u,P=e.bottom*u;return i==="height"||i==="both"?(v=a[1]+A-s[0],w=a[1]+P+s[2]):(v=a[1]+(A+P-h.displaySize[1])/2,w=v+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:v,right:b,bottom:w,left:E,collisionPadding:f}}function Uy(r){return!r.imagePrimary.stretchX}function jy(r){return!r.imagePrimary.stretchY}function Gy(r){return{width:r.right-r.left,height:r.bottom-r.top}}const zo=128;function $y(r,e,i){const{expression:s}=e;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new Wi(r+1,{worldview:i}))};if(s.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:u}=s;let h=0;for(;h<a.length&&a[h]<=r;)h++;h=Math.max(0,h-1);let f=h;for(;f<a.length&&a[f]<r+1;)f++;f=Math.min(a.length-1,f);const _=a[h],g=a[f];return s.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:g,interpolationType:u}:{kind:"camera",minZoom:_,maxZoom:g,minSize:s.evaluate(new Wi(_,{worldview:i})),maxSize:s.evaluate(new Wi(g,{worldview:i})),interpolationType:u}}}function s_(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/zo:r.kind==="composite"?Ft(s/zo,a/zo,i):e}function gd(r,e,i=1){let s=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:u,minZoom:h,maxZoom:f}=r,_=u?Q(Kn.interpolationFactor(u,e,h,f),0,1):0;r.kind==="camera"?a=Ft(r.minSize,r.maxSize,_)*i:s=_*i}return{uSizeT:s,uSize:a}}class ca extends Xe{constructor(e,i,s,a,u){super(e,i),this.angle=a,this.z=s,u!==void 0&&(this.segment=u)}clone(){return new ca(this.x,this.y,this.z,this.angle,this.segment)}}function qy(r,e,i,s,a){if(e.segment===void 0)return!0;let u=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(u),u=r[h]}f+=r[h].dist(r[h+1]),h++;const _=[];let g=0;for(;f<i/2;){const v=r[h],b=r[h+1];if(!b)return!1;let w=r[h-1].angleTo(v)-v.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:w}),g+=w;f-_[0].distance>s;)g-=_.shift().angleDelta;if(g>a)return!1;h++,f+=v.dist(b)}return!0}function Hy(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Zy(r,e,i){return r?.6*e*i:0}function Wy(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function v1(r,e,i,s,a,u){const h=Zy(i,a,u),f=Wy(i,s)*u;let _=0;const g=Hy(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],w=r[v+1],E=b.dist(w);if(_+E>g){const A=(g-_)/E,P=Ft(b.x,w.x,A),D=Ft(b.y,w.y,A),F=new ca(P,D,0,w.angleTo(b),v);return!h||qy(r,F,f,h,e)?F:void 0}_+=E}}function b1(r,e,i,s,a,u,h,f,_){const g=Zy(s,u,h),v=Wy(s,a),b=v*h,w=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),Xy(r,w?e/2*f%e:(v/2+2*u)*h*f%e,e,g,i,b,w,!1,_)}function Xy(r,e,i,s,a,u,h,f,_){const g=u/2,v=Hy(r);let b=0,w=e-i,E=[];for(let A=0;A<r.length-1;A++){const P=r[A],D=r[A+1],F=P.dist(D),j=D.angleTo(P);for(;w+i<b+F;){w+=i;const G=(w-b)/F,R=Ft(P.x,D.x,G),N=Ft(P.y,D.y,G);
15if(R>=0&&R<_&&N>=0&&N<_&&w-g>=0&&w+g<=v){const $=new ca(R,N,0,j,A);s&&!qy(r,$,u,s,a)||E.push($)}}b+=F}return f||E.length||h||(E=Xy(r,b/2,i,s,a,u,h,!0,_)),E}function Yy(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort((h,f)=>f.h-h.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,u=0;for(const h of r)for(let f=s.length-1;f>=0;f--){const _=s[f];if(!(h.w>_.w||h.h>_.h)){if(h.x=_.x,h.y=_.y,u=Math.max(u,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===_.w&&h.h===_.h){const g=s.pop();f<s.length&&(s[f]=g)}else h.h===_.h?(_.x+=h.w,_.w-=h.w):h.w===_.w?(_.y+=h.h,_.h-=h.h):(s.push({x:_.x+h.w,y:_.y,w:_.w-h.w,h:h.h}),_.y+=h.h,_.h-=h.h);break}}return{w:a,h:u,fill:e/(a*u)||0}}st(ca,"Anchor");const mc=1;class yd{static getImagePositionScale(e,i,s){if(i&&e&&e.options&&e.options.transform){const a=e.options.transform;return{x:a.a,y:a.d}}return{x:s,y:s}}constructor(e,i,s,a){this.paddedRect=e;const{pixelRatio:u,version:h,stretchX:f,stretchY:_,content:g,sdf:v,usvg:b}=i;this.pixelRatio=u,this.stretchX=f,this.stretchY=_,this.content=g,this.version=h,this.padding=s,this.sdf=v,this.usvg=b,this.scale=yd.getImagePositionScale(a,b,u)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function o_(r,e,i){const s=Vs.parse(r),a=function(u,h,f=[1,1]){return{x:0,y:0,w:(u.data?u.data.width:u.width*f[0])+2*h,h:(u.data?u.data.height:u.height*f[1])+2*h}}(e,i,[s.options.transform.a,s.options.transform.d]);return{bin:a,imagePosition:new yd(a,e,i,s),imageVariant:s}}class Ky{constructor(e,i,s){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,a,mc,h),this.addImages(i,u,2,h);const{w:f,h:_}=Yy(h),g=new un({width:f||1,height:_||1});for(const[v,b]of e.entries()){const w=a.get(v).paddedRect;un.copy(b.data,g,{x:0,y:0},{x:w.x+mc,y:w.y+mc},b.data,s,b.sdf)}for(const[v,b]of i.entries()){const w=u.get(v),E=w.paddedRect;let A=w.padding;const P=E.x+A,D=E.y+A,F=b.data.width,j=b.data.height;A=A>1?A-1:A,un.copy(b.data,g,{x:0,y:0},{x:P,y:D},b.data,s),un.copy(b.data,g,{x:0,y:j-A},{x:P,y:D-A},{width:F,height:A},s),un.copy(b.data,g,{x:0,y:0},{x:P,y:D+j},{width:F,height:A},s),un.copy(b.data,g,{x:F-A,y:0},{x:P-A,y:D},{width:A,height:j},s),un.copy(b.data,g,{x:0,y:0},{x:P+F,y:D},{width:A,height:j},s),un.copy(b.data,g,{x:F-A,y:j-A},{x:P-A,y:D-A},{width:A,height:A},s),un.copy(b.data,g,{x:0,y:j-A},{x:P+F,y:D-A},{width:A,height:A},s),un.copy(b.data,g,{x:0,y:0},{x:P+F,y:D+j},{width:A,height:A},s),un.copy(b.data,g,{x:F-A,y:0},{x:P-A,y:D+j},{width:A,height:A},s)}this.lut=s,this.image=g,this.iconPositions=a,this.patternPositions=u}addImages(e,i,s,a){for(const[u,h]of e.entries()){const{bin:f,imagePosition:_,imageVariant:g}=o_(u,h,s);i.set(u,_),a.push(f),h.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,s)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,s);for(const a of e.getUpdatedImages(s)){for(const u of this.iconPositions.keys()){const h=Vs.parse(u);if(jn.isEqual(h.id,a)){const f=e.getImage(a,s);this.patchUpdatedImage(this.iconPositions.get(u),f,i)}}for(const u of this.patternPositions.keys()){const h=Vs.parse(u);if(jn.isEqual(h.id,a)){const f=e.getImage(a,s);this.patchUpdatedImage(this.patternPositions.get(u),f,i)}}}}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,u]=e.tl,h=e.sdf;if(this.lut||h){const f={width:i.data.width,height:i.data.height},_=new un(f);un.copy(i.data,_,{x:0,y:0},{x:0,y:0},f,this.lut,h),s.update(_,{position:{x:a,y:u}})}else s.update(i.data,{position:{x:a,y:u}})}}st(yd,"ImagePosition"),st(Ky,"ImageAtlas");const af=1e20;function Jy(r,e,i,s,a,u,h,f,_){for(let g=e;g<e+s;g++)Qy(r,i*u+g,u,a,h,f,_);for(let g=i;g<i+a;g++)Qy(r,g*u+e,1,s,h,f,_)}function Qy(r,e,i,s,a,u,h){u[0]=0,h[0]=-1e20,h[1]=af,a[0]=r[e];for(let f=1,_=0,g=0;f<s;f++){a[f]=r[e+f*i];const v=f*f;do{const b=u[_];g=(a[f]-a[b]+v-b*b)/(f-b)/2}while(g<=h[_]&&--_>-1);_++,u[_]=f,h[_]=g,h[_+1]=af}for(let f=0,_=0;f<s;f++){for(;h[_+1]<f;)_++;const g=u[_],v=f-g;r[e+f*i]=a[g]+v*v}}const Ks=2,a_={none:0,ideographs:1,all:2};class Lu{constructor(e,i,s){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=s,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,s){const a=[],u=this.urls[i]||rn.GLYPHS_URL;for(const h in e)for(const f of e[h])a.push({stack:h,id:f});ue(a,({stack:h,id:f},_)=>{let g=this.entries[h];g||(g=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let v=g.glyphs[f];if(v!==void 0)return void _(null,{stack:h,id:f,glyph:v});if(v=this._tinySDF(g,h,f),v)return g.glyphs[f]=v,void _(null,{stack:h,id:f,glyph:v});const b=Math.floor(f/256);if(256*b>65535)return ii("glyphs > 65535 not supported"),void _(null,{stack:h,id:f,glyph:v});if(g.ranges[b])return void _(null,{stack:h,id:f,glyph:v});let w=g.requests[b];w||(w=g.requests[b]=[],Lu.loadGlyphRange(h,b,u,this.requestManager,(E,A)=>
15{if(A){g.ascender=A.ascender,g.descender=A.descender;for(const P in A.glyphs)this._doesCharSupportLocalGlyph(+P)||(g.glyphs[+P]=A.glyphs[+P]);g.ranges[b]=!0}for(const P of w)P(E,A);delete g.requests[b]})),w.push((E,A)=>{E?_(E):A&&_(null,{stack:h,id:f,glyph:A.glyphs[f]||null})})},(h,f)=>{if(h)s(h);else if(f){const _={};for(const{stack:g,id:v,glyph:b}of f)_[g]===void 0&&(_[g]={}),_[g].glyphs===void 0&&(_[g].glyphs={}),_[g].glyphs[v]=b&&{id:b.id,bitmap:b.bitmap.clone(),metrics:b.metrics},_[g].ascender=this.entries[g].ascender,_[g].descender=this.entries[g].descender;s(null,_)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==a_.none&&(this.localGlyphMode===a_.all?!!this.localFontFamily:!!this.localFontFamily&&(St["CJK Unified Ideographs"](e)||St["Hangul Syllables"](e)||St.Hiragana(e)||St.Katakana(e)||St["CJK Symbols and Punctuation"](e)||St["CJK Unified Ideographs Extension A"](e)||St["CJK Unified Ideographs Extension B"](e)||St.Osage(e)))}_tinySDF(e,i,s){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(s))return;let u=e.tinySDF;if(!u){let P="400";/bold/i.test(i)?P="900":/medium/i.test(i)?P="500":/light/i.test(i)&&(P="200"),u=e.tinySDF=new Lu.TinySDF({fontFamily:a,fontWeight:P,fontSize:24*Ks,buffer:3*Ks,radius:8*Ks}),u.fontWeight=P}if(this.localGlyphs[u.fontWeight][s])return this.localGlyphs[u.fontWeight][s];const h=String.fromCodePoint(s),{data:f,width:_,height:g,glyphWidth:v,glyphHeight:b,glyphLeft:w,glyphTop:E,glyphAdvance:A}=u.draw(h);return this.localGlyphs[u.fontWeight][s]={id:s,bitmap:new il({width:_,height:g},f),metrics:{width:v/Ks,height:b/Ks,left:w/Ks,top:E/Ks-27,advance:A/Ks,localGlyph:!0}}}}Lu.loadGlyphRange=function(r,e,i,s,a){const u=256*e,h=u+255,f=s.transformRequest(s.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${u}-${h}`),wl.Glyphs);Tl(f,(_,g)=>{if(_)a(_);else if(g){const v={},b=function(w){return new sf(w).readFields(p1,{})}(g);for(const w of b.glyphs)v[w.id]=w;a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}})},Lu.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const f=this.size=r+4*e,_=this._createCanvas(f),g=this.ctx=_.getContext("2d",{willReadFrequently:!0});g.font=`${h} ${u} ${r}px ${a}`,g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:a,actualBoundingBoxRight:u}=this.ctx.measureText(r),h=Math.ceil(i),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-a))),_=Math.min(this.size-this.buffer,h+Math.ceil(s)),g=f+2*this.buffer,v=_+2*this.buffer,b=Math.max(g*v,0),w=new Uint8ClampedArray(b),E={data:w,width:g,height:v,glyphWidth:f,glyphHeight:_,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(f===0||_===0)return E;const{ctx:A,buffer:P,gridInner:D,gridOuter:F}=this;A.clearRect(P,P,f,_),A.fillText(r,P,P+h);const j=A.getImageData(P,P,f,_);F.fill(af,0,b),D.fill(0,0,b);for(let G=0;G<_;G++)for(let R=0;R<f;R++){const N=j.data[4*(G*f+R)+3]/255;if(N===0)continue;const $=(G+P)*g+R+P;if(N===1)F[$]=0,D[$]=af;else{const Z=.5-N;F[$]=Z>0?Z*Z:0,D[$]=Z<0?Z*Z:0}}Jy(F,0,0,g,v,g,this.f,this.v,this.z),Jy(D,P,P,f,_,g,this.f,this.v,this.z);for(let G=0;G<b;G++){const R=Math.sqrt(F[G])-Math.sqrt(D[G]);w[G]=Math.round(255-255*(R/this.radius+this.cutoff))}return E}};const _c=mc;function ex(r,e){return r+e[1]-e[0]}function tx(r,e,i,s,a=1){const u=[],h=r.imagePrimary,f=h.pixelRatio,_=h.paddedRect.w-2*_c,g=h.paddedRect.h-2*_c,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,w=h.stretchX||[[0,_]],E=h.stretchY||[[0,g]],A=w.reduce(ex,0),P=E.reduce(ex,0),D=_-A,F=g-P;let j=0,G=A,R=0,N=P,$=0,Z=D,oe=0,re=F;if(h.content&&s){const he=h.content;j=lf(w,0,he[0]),R=lf(E,0,he[1]),G=lf(w,he[0],he[2]),N=lf(E,he[1],he[3]),$=he[0]-j,oe=he[1]-R,Z=he[2]-he[0]-G,re=he[3]-he[1]-N}
15const ae=(he,Se,Be,ze)=>{const Oe=cf(he.stretch-j,G,v,r.left*a),Ne=uf(he.fixed-$,Z,he.stretch,A),Ie=cf(Se.stretch-R,N,b,r.top*a),ke=uf(Se.fixed-oe,re,Se.stretch,P),we=cf(Be.stretch-j,G,v,r.left*a),Ee=uf(Be.fixed-$,Z,Be.stretch,A),je=cf(ze.stretch-R,N,b,r.top*a),$e=uf(ze.fixed-oe,re,ze.stretch,P),vt=new Xe(Oe,Ie),ht=new Xe(we,Ie),et=new Xe(we,je),Ue=new Xe(Oe,je),Ht=new Xe(Ne/f,ke/f),ut=new Xe(Ee/f,$e/f),pt=e*Math.PI/180;if(pt){const di=Math.sin(pt),Ni=Math.cos(pt),nr=[Ni,-di,di,Ni];vt._matMult(nr),ht._matMult(nr),Ue._matMult(nr),et._matMult(nr)}const Ot=he.stretch+he.fixed,ti=Be.stretch+Be.fixed,Qt=Se.stretch+Se.fixed,hi=ze.stretch+ze.fixed,ni=r.imageSecondary;return{tl:vt,tr:ht,bl:Ue,br:et,texPrimary:{x:h.paddedRect.x+_c+Ot,y:h.paddedRect.y+_c+Qt,w:ti-Ot,h:hi-Qt},texSecondary:ni?{x:ni.paddedRect.x+_c+Ot,y:ni.paddedRect.y+_c+Qt,w:ti-Ot,h:hi-Qt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ht,pixelOffsetBR:ut,minFontScaleX:Z/f/v,minFontScaleY:re/f/b,isSDF:i}};if(s&&(h.stretchX||h.stretchY)){const he=ix(w,D,A),Se=ix(E,F,P);for(let Be=0;Be<he.length-1;Be++){const ze=he[Be],Oe=he[Be+1];for(let Ne=0;Ne<Se.length-1;Ne++)u.push(ae(ze,Se[Ne],Oe,Se[Ne+1]))}}else u.push(ae({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:g+1}));return u}function lf(r,e,i){let s=0;for(const a of r)s+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return s}function ix(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[a,u]of r){const h=s[s.length-1];s.push({fixed:a-h.stretch,stretch:h.stretch}),s.push({fixed:a-h.stretch,stretch:h.stretch+(u-a)})}return s.push({fixed:e+_c,stretch:i}),s}function cf(r,e,i,s){return r/e*i+s}function uf(r,e,i,s){return r-e*i/s}function w1(r,e,i,s){const a=e+r.positionedLines[s].lineOffset;return s===0?i+a/2:i+(a+(e+r.positionedLines[s-1].lineOffset))/2}function T1(r,e=1,i=!1){let s=1/0,a=1/0,u=-1/0,h=-1/0;const f=r[0];for(let E=0;E<f.length;E++){const A=f[E];(!E||A.x<s)&&(s=A.x),(!E||A.y<a)&&(a=A.y),(!E||A.x>u)&&(u=A.x),(!E||A.y>h)&&(h=A.y)}const _=Math.min(u-s,h-a);let g=_/2;const v=new Uc([],S1);if(_===0)return new Xe(s,a);for(let E=s;E<u;E+=_)for(let A=a;A<h;A+=_)v.push(new ku(E+g,A+g,g,r));let b=function(E){let A=0,P=0,D=0;const F=E[0];for(let j=0,G=F.length,R=G-1;j<G;R=j++){const N=F[j],$=F[R],Z=N.x*$.y-$.x*N.y;P+=(N.x+$.x)*Z,D+=(N.y+$.y)*Z,A+=3*Z}return new ku(P/A,D/A,0,E)}(r),w=v.length;for(;v.length;){const E=v.pop();(E.d>b.d||!b.d)&&(b=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-b.d<=e||(g=E.h/2,v.push(new ku(E.p.x-g,E.p.y-g,g,r)),v.push(new ku(E.p.x+g,E.p.y-g,g,r)),v.push(new ku(E.p.x-g,E.p.y+g,g,r)),v.push(new ku(E.p.x+g,E.p.y+g,g,r)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function S1(r,e){return e.max-r.max}class ku{constructor(e,i,s,a){this.p=new Xe(e,i),this.h=s,this.d=function(u,h){let f=!1,_=1/0;for(let g=0;g<h.length;g++){const v=h[g];for(let b=0,w=v.length,E=w-1;b<w;E=b++){const A=v[b],P=v[E];A.y>u.y!=P.y>u.y&&u.x<(P.x-A.x)*(u.y-A.y)/(P.y-A.y)+A.x&&(f=!f),_=Math.min(_,Su(u,A,P))}}return(f?1:-1)*Math.sqrt(_)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const E1=Object.keys,l_=Number.POSITIVE_INFINITY,I1=Math.sqrt(2);function rx(r,[e,i]){let s=0,a=0;if(i===l_){e<0&&(e=0);const u=e/I1;switch(r){case"top-right":case"top-left":a=u-7;break;case"bottom-right":case"bottom-left":a=7-u;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":s=-u;break;case"top-left":case"bottom-left":s=u;break;case"left":s=e;break;case"right":s=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":s=-e;break;case"top-left":case"bottom-left":case"left":s=e}}return[s,a]}function hf(r,e,i,s,a,u,h,f,_){if(!e||!e.usvg)return;const g=Gy(s),v=Gy(a),b=u!=="both"&&u!=="width"||!Uy(s)?1:v.width/g.width,w=u!=="both"&&u!=="height"||!jy(s)?1:v.height/g.height;i.scaleSelf(b,w);const E=i.toString();h.set(E,i),f.set(E,e);const{imagePosition:A}=o_(E,e,mc);_.set(E,A)}function nx(r,e,i,s,a,u,h,f,_){if(!r)return;const g=function(v,b,w,E,A,P){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const D=b.possiblyEvaluate(new Wi(v.maxZoom,{worldview:P}),w).evaluate(A,{},w),F=b.possiblyEvaluate(new Wi(v.minZoom,{worldview:P}),w).evaluate(A,{},w);return Math.max(D,F)}return b.possiblyEvaluate(new Wi(E,{worldview:P})).evaluate(A,{},w)}(e,i,s,a,u,_);return r.scaleSelf(g*f*h)}function sx(r,e,i,s,a,u,h,f,_){return{iconPrimary:nx(r.getPrimary(),e,i,s,a,u,h,f,_),iconSecondary:nx(r.getSecondary(),e,i,s,a,u,h,f,_)}}function A1(r,e,i){if(!e)return;const s=i.get(r.toString()),a=i.get(e.toString());a&&(s.paddedRect.w===a.paddedRect.w&&s.paddedRect.h===a.paddedRect.h||ii(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),s.usvg!==a.usvg&&ii(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function ox(r,e,i,s){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,s){const u=e.get(s.toString());r.imageSecondary=u}}function M1(r,e){for(const i in r.horizontal)ax(r.horizontal[i],e);ax(r.vertical,e)}function ax(r,e){if(r){for(const i of r.positionedLines)for(const s of i.positionedGlyphs)if(s.image!==null){const a=s.image.toString();s.rect=e.get(a).paddedRect}}}function c_(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function C1(r,e,i,s,a,u,h,f,_){const g=u_(u.horizontal)||u.vertical,v=i.get("icon-text-fit-padding").evaluate(s,{},a);let b,w=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&u.vertical&&(b=Vy(e,u.vertical,_,v,f,h)),g&&(w=Vy(e,g,_,v,f,h))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function P1(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F,j,G){let R=h.textMaxSize.evaluate(e,{},w);R===void 0?R=f*h.textScaleFactor:R*=h.textScaleFactor;const N=r.layers[0].layout,$=u_(i.horizontal)||i.vertical,Z=E.name==="globe",oe=tn,re=r.tilePixelRatio*R/oe,ae=(Ne=r.overscaling,r.zoom>18&&Ne>2&&(Ne>>=1),Math.max(Je/(512*Ne),1)*N.get("symbol-spacing")),he=N.get("text-padding")*r.tilePixelRatio,Se=N.get("icon-padding")*r.tilePixelRatio,Be=Mi(N.get("text-max-angle")),ze=N.get("icon-rotation-alignment")==="map"&&G!=="point",Oe=ae/2;var Ne;r.hasAnyIconTextFit===!1&&D!=="none"&&(r.hasAnyIconTextFit=!0);const Ie=e.properties?+e.properties[mi]:null,ke=Ie&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(Ie):65535,we=(Ee,je,$e)=>{if(je.x<0||je.x>=Je||je.y<0||je.y>=Je)return;let vt=null;if(Z){const{x:ht,y:et,z:Ue}=E.projectTilePoint(je.x,je.y,$e);vt={anchor:new ca(ht,et,Ue,0,void 0),up:E.upVector($e,je.x,je.y)}}(function(ht,et,Ue,Ht,ut,pt,Ot,ti,Qt,hi,ni,di,Ni,nr,q,W,Ae,He,tt,Qe,ct,Dt,_i,gi,si,Gi,er,yi,br){const sr=ht.addToLineVertexArray(et,Ht);let Vi,zr,ur,tr,or,Hi,ai,Xi=0,wr=0,Mt=0,Si=0,hr=-1,Cr=-1;const gr={};let qr=El("");const Yi=Ue?Ue.anchor:et,jr=yi!=="none";let Hn=0,hn=0;if(Qt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Hr=Qt.layout.get("text-offset").evaluate(ct,{},si);Hn=Hr[0]*tn,hn=Hr[1]*tn}else Hn=Qt.layout.get("text-radial-offset").evaluate(ct,{},si)*tn,hn=l_;if(ht.allowVerticalPlacement&&ut.vertical){const Hr=ut.vertical;if(q)Hi=h_(Hr),ti&&(ai=h_(ti));else{const Wr=Qt.layout.get("text-rotate").evaluate(ct,{},si)+90;ur=df(hi,Yi,et,ni,di,Ni,Hr,nr,Wr,W),ti&&(tr=df(hi,Yi,et,ni,di,Ni,ti,He,Wr))}}if(pt){const Hr=ht.iconSizeData,Wr=Qt.layout.get("icon-rotate").evaluate(ct,{},si),dn=tx(pt,Wr,_i,jr,Dt.iconScaleFactor),Pn=ti?tx(ti,Wr,_i,jr,Dt.iconScaleFactor):void 0;zr=df(hi,Yi,et,ni,di,Ni,pt,He,Wr,null),Xi=4*dn.length;let xn=null;Hr.kind==="source"?(xn=[zo*Qt.layout.get("icon-size").evaluate(ct,{},si)*Dt.iconScaleFactor],xn[0]>nl&&ii(`${ht.layerIds[0]}: Value for "icon-size" is >= ${xd}. Reduce your "icon-size".`)):Hr.kind==="composite"&&(xn=[zo*Dt.compositeIconSizes[0].evaluate(ct,{},si)*Dt.iconScaleFactor,zo*Dt.compositeIconSizes[1].evaluate(ct,{}
15,si)*Dt.iconScaleFactor],(xn[0]>nl||xn[1]>nl)&&ii(`${ht.layerIds[0]}: Value for "icon-size" is >= ${xd}. Reduce your "icon-size".`)),ht.addSymbols(ht.icon,dn,xn,Qe,tt,ct,void 0,Ue,et,sr.lineStartIndex,sr.lineLength,-1,gi,si,Gi,er),hr=ht.icon.placedSymbolArray.length-1,Pn&&(wr=4*Pn.length,ht.addSymbols(ht.icon,Pn,xn,Qe,tt,ct,Qn.vertical,Ue,et,sr.lineStartIndex,sr.lineLength,-1,gi,si,Gi,er),Cr=ht.icon.placedSymbolArray.length-1)}for(const Hr in ut.horizontal){const Wr=Hr,dn=ut.horizontal[Wr];Vi||(qr=El(dn.text),q?or=h_(dn):Vi=df(hi,Yi,et,ni,di,Ni,dn,nr,Qt.layout.get("text-rotate").evaluate(ct,{},si),W));const Pn=dn.positionedLines.length===1;if(Mt+=lx(ht,Ue,et,dn,Ot,Qt,q,ct,W,sr,ut.vertical?Qn.horizontal:Qn.horizontalOnly,Pn?E1(ut.horizontal):[Wr],gr,hr,Dt,gi,si,Gi),Pn)break}ut.vertical&&(Si+=lx(ht,Ue,et,ut.vertical,Ot,Qt,q,ct,W,sr,Qn.vertical,["vertical"],gr,Cr,Dt,gi,si,Gi));let an=-1;const Zn=(Hr,Wr)=>Hr?Math.max(Hr,Wr):Wr;an=Zn(or,an),an=Zn(Hi,an),an=Zn(ai,an);const Do=an>-1?1:0;ht.glyphOffsetArray.length>=65535&&ii("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ct.sortKey!==void 0&&ht.addToSortKeyRanges(ht.symbolInstances.length,ct.sortKey),ht.symbolInstances.emplaceBack(et.x,et.y,Yi.x,Yi.y,Yi.z,gr.right>=0?gr.right:-1,gr.center>=0?gr.center:-1,gr.left>=0?gr.left:-1,gr.vertical>=0?gr.vertical:-1,hr,Cr,qr,Vi!==void 0?Vi:ht.collisionBoxArray.length,Vi!==void 0?Vi+1:ht.collisionBoxArray.length,ur!==void 0?ur:ht.collisionBoxArray.length,ur!==void 0?ur+1:ht.collisionBoxArray.length,zr!==void 0?zr:ht.collisionBoxArray.length,zr!==void 0?zr+1:ht.collisionBoxArray.length,tr||ht.collisionBoxArray.length,tr?tr+1:ht.collisionBoxArray.length,ni,Mt,Si,Xi,wr,Do,0,Hn,hn,an,0,jr?1:0,br)})(r,je,vt,Ee,i,s,u,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,he,j,g,0,Se,ze,F,e,h,v,b,w,A,P,D,ke)};if(G==="line")for(const Ee of ef(e.geometry,0,0,Je,Je)){const je=b1(Ee,ae,Be,i.vertical||$,s,oe,re,r.overscaling,Je);for(const $e of je)$&&R1(r,$.text,Oe,$e)||we(Ee,$e,w)}else if(G==="line-center"){for(const Ee of e.geometry)if(Ee.length>1){const je=v1(Ee,Be,i.vertical||$,s,oe,re);je&&we(Ee,je,w)}}else if(e.type==="Polygon")for(const Ee of Wp(e.geometry,0)){const je=T1(Ee,16);we(Ee[0],new ca(je.x,je.y,0,0,void 0),w)}else if(e.type==="LineString")for(const Ee of e.geometry)we(Ee,new ca(Ee[0].x,Ee[0].y,0,0,void 0),w);else if(e.type==="Point")for(const Ee of e.geometry)for(const je of Ee)we([je],new ca(je.x,je.y,0,0,void 0),w)}const xd=255,nl=xd*zo;function lx(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,F){const j=function(N,$,Z,oe,re,ae,he,Se){const Be=[];if($.positionedLines.length===0)return Be;const ze=oe.layout.get("text-rotate").evaluate(ae,{})*Math.PI/180,Oe=function(Ee){const je=Ee[0],$e=Ee[1],vt=je*$e;return vt>0?[je,-$e]:vt<0?[-je,$e]:je===0?[$e,je]:[$e,-je]}(Z);let Ne=Math.abs($.top-$.bottom);for(const Ee of $.positionedLines)Ne-=Ee.lineOffset;const Ie=$.positionedLines.length,ke=Ne/Ie;let we=$.top-Z[1];for(let Ee=0;Ee<Ie;++Ee){const je=$.positionedLines[Ee];we=w1($,ke,we,Ee);for(const $e of je.positionedGlyphs){if(!$e.rect)continue;const vt=$e.rect||{};let ht=_1+1,et=!0,Ue=1,Ht=0;if($e.image){const ct=he.get($e.image.toString());if(!ct)continue;if(ct.sdf){ii("SDF images are not supported in formatted text and will be ignored.");continue}et=!1,Ue=ct.pixelRatio,ht=mc/Ue}const ut=(re||Se)&&$e.vertical,pt=$e.metrics.advance*$e.scale/2,Ot=$e.metrics,ti=$e.rect;if(ti===null)continue;Se&&$.verticalizable&&(Ht=$e.image?pt-$e.metrics.width*$e.scale/2:0);const Qt=re?[$e.x+pt,$e.y]:[0,0];let hi=[0,0],ni=[0,0],di=!1;
vendor: 6,966 bytes, line 15
15re||(ut?(ni=[$e.x+pt+Oe[0],$e.y+Oe[1]-Ht],di=!0):hi=[$e.x+pt+Z[0],$e.y+Z[1]-Ht]);const Ni=ti.w*$e.scale/(Ue*($e.localGlyph?Ks:1)),nr=ti.h*$e.scale/(Ue*($e.localGlyph?Ks:1));let q,W,Ae,He;if(ut){const ct=$e.y-we,Dt=new Xe(-pt,pt-ct),_i=-Math.PI/2,gi=new Xe(...ni);q=new Xe(-pt+hi[0],hi[1]),q._rotateAround(_i,Dt)._add(gi),q.x+=-ct+pt,q.y-=(Ot.left-ht)*$e.scale;const si=$e.image?Ot.advance*$e.scale:tn*$e.scale,Gi=String.fromCodePoint($e.glyph);u1(Gi)?q.x+=(1-ht)*$e.scale:h1(Gi)?q.x+=si-Ot.height*$e.scale+(-ht-1)*$e.scale:q.x+=$e.image||Ot.width+2*ht===ti.w&&Ot.height+2*ht===ti.h?(si-nr)/2:(si-(Ot.height+2*ht)*$e.scale)/2,W=new Xe(q.x,q.y-Ni),Ae=new Xe(q.x+nr,q.y),He=new Xe(q.x+nr,q.y-Ni)}else{const ct=(Ot.left-ht)*$e.scale-pt+hi[0],Dt=(-Ot.top-ht)*$e.scale+hi[1],_i=ct+Ni,gi=Dt+nr;q=new Xe(ct,Dt),W=new Xe(_i,Dt),Ae=new Xe(ct,gi),He=new Xe(_i,gi)}if(ze){let ct;ct=re?new Xe(0,0):di?new Xe(Oe[0],Oe[1]):new Xe(Z[0],Z[1]),q._rotateAround(ze,ct),W._rotateAround(ze,ct),Ae._rotateAround(ze,ct),He._rotateAround(ze,ct)}const tt=new Xe(0,0),Qe=new Xe(0,0);Be.push({tl:q,tr:W,bl:Ae,br:He,texPrimary:vt,texSecondary:void 0,writingMode:$.writingMode,glyphOffset:Qt,sectionIndex:$e.sectionIndex,isSDF:et,pixelOffsetTL:tt,pixelOffsetBR:Qe,minFontScaleX:0,minFontScaleY:0})}}return Be}(0,s,_,u,h,f,a,r.allowVerticalPlacement),G=r.textSizeData;let R=null;G.kind==="source"?(R=[zo*u.layout.get("text-size").evaluate(f,{},D)*A.textScaleFactor],R[0]>nl&&ii(`${r.layerIds[0]}: Value for "text-size" is >= ${xd}. Reduce your "text-size".`)):G.kind==="composite"&&(R=[zo*A.compositeTextSizes[0].evaluate(f,{},D)*A.textScaleFactor,zo*A.compositeTextSizes[1].evaluate(f,{},D)*A.textScaleFactor],(R[0]>nl||R[1]>nl)&&ii(`${r.layerIds[0]}: Value for "text-size" is >= ${xd}. Reduce your "text-size".`)),r.addSymbols(r.text,j,R,_,h,f,v,e,i,g.lineStartIndex,g.lineLength,E,P,D,F,!1);for(const N of b)w[N]=r.text.placedSymbolArray.length-1;return 4*j.length}function u_(r){for(const e in r)return r[e];return null}function df(r,e,i,s,a,u,h,f,_,g){let v=h.top,b=h.bottom,w=h.left,E=h.right;if(Ny(h)&&h.collisionPadding){const A=h.collisionPadding;w-=A[0],v-=A[1],E+=A[2],b+=A[3]}if(_){const A=new Xe(w,v),P=new Xe(E,v),D=new Xe(w,b),F=new Xe(E,b),j=Mi(_);let G=new Xe(0,0);g&&(G=new Xe(g[0],g[1])),A._rotateAround(j,G),P._rotateAround(j,G),D._rotateAround(j,G),F._rotateAround(j,G),w=Math.min(A.x,P.x,D.x,F.x),E=Math.max(A.x,P.x,D.x,F.x),v=Math.min(A.y,P.y,D.y,F.y),b=Math.max(A.y,P.y,D.y,F.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,v,E,b,f,s,a,u),r.length-1}function h_(r){Ny(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function R1(r,e,i,s){const a=r.compareText;if(e in a){const u=a[e];for(let h=u.length-1;h>=0;h--)if(s.dist(u[h])<i)return!0}else a[e]=[];return a[e].push(s),!1}function cx(r,e){const i=r.fovAboveCenter,s=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-s)/Math.cos(r._pitch),u=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let h=Math.sin(r._pitch)*u+a;const f=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let _=Math.max(r.zoom-17,0);r.isOrthographic&&(_/=10),h*=1+_}return Math.min(1.01*h,f)}function vd(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),s=r.x*i,a=(r.x+1)*i,u=r.y*i,h=(r.y+1)*i,f=ne(s),_=ne(a),g=fe(u),v=fe(h),b=e.project(f,g),w=e.project(_,g),E=e.project(_,v),A=e.project(f,v);let P=Math.min(b.x,w.x,E.x,A.x),D=Math.min(b.y,w.y,E.y,A.y),F=Math.max(b.x,w.x,E.x,A.x),j=Math.max(b.y,w.y,E.y,A.y);const G=i/16;function R($,Z,oe,re,ae,he){const Se=(oe+ae)/2,Be=(re+he)/2,ze=e.project(ne(Se),fe(Be)),Oe=Math.max(0,P-ze.x,D-ze.y,ze.x-F,ze.y-j);P=Math.min(P,ze.x),F=Math.max(F,ze.x),D=Math.min(D,ze.y),j=Math.max(j,ze.y),Oe>G&&(R($,ze,oe,re,Se,Be),R(ze,Z,Se,Be,ae,he))}R(b,w,s,u,a,u),R(w,E,a,u,a,h),R(E,A,a,h,s,h),R(A,b,s,h,s,u),P-=G,D-=G,F+=G,j+=G;const N=1/Math.max(F-P,j-D);return{scale:N,x:P*N,y:D*N,x2:F*N,y2:j*N,projection:e}}function ux(r,{x:e,y:i},s=0){return new Xe(((e-s)*r.scale-r.x)*Je,(i*r.scale-r.y)*Je)}const z1=Ke(new Float32Array(16));class sl{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new V(0,0)}projectTilePoint(e,i,s){return{x:e,y:i,z:0}}locationPoint(e,i,s,a=!0){return e._coordinatePoint(e.locationCoordinate(i,s),a)}pixelsPerMeter(e,i){return ie(1,e)*i}pixelSpaceConversion(e,i,s){return 1}farthestPixelDistance(e){return cx(e,e.pixelsPerMeter)}pointCoordinate(e,i,s,a){const u=e.horizonLineFromTop(!1),h=new Xe(i,Math.max(u,s));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,s){const a=new Xe(i,s);if(e.elevation)return e.elevation.pointCoordinate(a);{const u=this.pointCoordinate(e,a.x,a.y,0);return[u.x,u.y,u.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const s=e.horizonLineFromTop();return i.y<s}createInversionMatrix(e,i){return z1}createTileMatrix(e,i,s){let a,u,h;const f=s.canonical,_=Ke(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=vd(f,this);a=1,u=g.x+s.wrap*g.scale,h=g.y,kt(_,_,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),u=(f.x+Math.pow(2,f.z)*s.wrap)*a,h=f.y*a;return It(_,_,[u,h,0]),kt(_,_,[a/Je,a/Je,1]),_}upVector(e,i,s){return[0,0,1]}upVectorScale(e,i,s){return{metersToTile:1}}}class D1 extends sl{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,s]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(Mi(i));this.n=(a+Math.sin(Mi(s)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:s,c:a,r0:u}=this,h=Mi(e-this.center[0]),f=Mi(i),_=Math.sqrt(a-2*s*Math.sin(f))/s;return{x:_*Math.sin(h*s),y:_*Math.cos(h*s)-u,z:0}}unproject(e,i){const{n:s,c:a,r0:u}=this,h=u+i;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*s<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const _=Mi(this.center[0])*s;f=ge(f,-Math.PI-_,Math.PI-_);const g=Q(ve(f/s)+this.center[0],-180,180),v=Math.asin(Q((a-(e*e+h*h)*s*s)/(2*s),-1,1)),b=Q(ve(v),-85.051129,Me);return new V(g,b)}}const bd=1.340264,wd=-.081106,Td=893e-6,Sd=.003796,pf=Math.sqrt(3)/2;class L1 extends sl{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const s=Math.asin(pf*Math.sin(i)),a=s*s,u=a*a*a;return{x:.5*(e*Math.cos(s)/(pf*(bd+3*wd*a+u*(7*Td+9*Sd*a)))/Math.PI+.5),y:1-.5*(s*(bd+wd*a+u*(Td+Sd*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=s*s,u=a*a*a;for(let v,b,w,E=0;E<12&&(b=s*(bd+wd*a+u*(Td+Sd*a))-i,w=bd+3*wd*a+u*(7*Td+9*Sd*a),v=b/w,s=Q(s-v,
vendor: 5,980 bytes, line 15
15-Math.PI/3,Math.PI/3),a=s*s,u=a*a*a,!(Math.abs(v)<1e-12));++E);const h=pf*e*(bd+3*wd*a+u*(7*Td+9*Sd*a))/Math.cos(s),f=Math.asin(Math.sin(s)/pf),_=Q(180*h/Math.PI,-180,180),g=Q(180*f/Math.PI,-85.051129,Me);return new V(_,g)}}class k1 extends sl{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const s=360*(e-.5),a=Q(360*(.5-i),-85.051129,Me);return new V(s,a)}}const Fu=Math.PI/2;function ff(r){return Math.tan((Fu+r)/2)}class F1 extends sl{constructor(e){super(e),this.center=e.center||[0,30];const[i,s]=this.parallels=e.parallels||[30,30];let a=Mi(i),u=Mi(s);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const h=Math.cos(a),f=ff(a);this.n=a===u?Math.sin(a):Math.log(h/Math.cos(u))/Math.log(ff(u)/f),this.f=h*Math.pow(ff(a),this.n)/this.n}project(e,i){i=Mi(i),this.southernCenter&&(i=-i),e=Mi(e-this.center[0]);const s=1e-6,{n:a,f:u}=this;u>0?i<-Fu+s&&(i=-Fu+s):i>Fu-s&&(i=Fu-s);const h=u/Math.pow(ff(i),a);let f=h*Math.sin(a*e),_=u-h*Math.cos(a*e);return f=.5*(f/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:f,y:this.southernCenter?_:1-_,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:s,f:a}=this,u=a-i,h=Math.sign(u),f=Math.sign(s)*Math.sqrt(e*e+u*u);let _=Math.atan2(e,Math.abs(u))*h;u*s<0&&(_-=Math.PI*Math.sign(e)*h);const g=Q(ve(_/s)+this.center[0],-180,180),v=Q(ve(2*Math.atan(Math.pow(a/f,1/s))-Fu),-85.051129,Me);return new V(g,this.southernCenter?-v:v)}}class hx extends sl{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:J(e),y:K(i),z:0}}unproject(e,i){const s=ne(e),a=fe(i);return new V(s,a)}}const dx=Mi(Me);class O1 extends sl{project(e,i){const s=(i=Mi(i))*i,a=s*s;return{x:.5*((e=Mi(e))*(.8707-.131979*s+a*(a*(.003971*s-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+s*(.015085+a*(.028874*s-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=25,u=0,h=s*s;do{h=s*s;const g=h*h;u=(s*(1.007226+h*(.015085+g*(.028874*h-.044475-.005916*g)))-i)/(1.007226+h*(.045255+g*(.259866*h-.311325-.005916*11*g))),s=Q(s-u,-dx,dx)}while(Math.abs(u)>1e-6&&--a>0);h=s*s;const f=Q(ve(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),_=ve(s);return new V(f,_)}}const px=Mi(Me);class B1 extends sl{project(e,i){i=Mi(i),e=Mi(e);const s=Math.cos(i),a=2/Math.PI,u=Math.acos(s*Math.cos(e/2)),h=Math.sin(u)/u,f=.5*(e*a+2*s*Math.sin(e/2)/h)||0,_=.5*(i+Math.sin(i)/h)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let s=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const h=1e-6;let f=0,_=0;do{const g=Math.cos(a),v=Math.sin(a),b=2*v*g,w=v*v,E=g*g,A=Math.cos(s/2),P=Math.sin(s/2),D=2*A*P,F=P*P,j=1-E*A*A,G=j?1/j:0,R=j?Math.acos(g*A)*Math.sqrt(1/j):0,N=.5*(2*R*g*P+2*s/Math.PI)-e,$=.5*(R*v+a)-i,Z=.5*G*(E*F+R*g*A*w)+1/Math.PI,oe=G*(D*b/4-R*v*P),re=.125*G*(b*P-R*v*E*D),ae=.5*G*(w*A+R*F*g)+.5,he=oe*re-ae*Z;f=($*oe-N*ae)/he,_=(N*re-$*Z)/he,s=Q(s-f,-Math.PI,Math.PI),a=Q(a-_,-px,px)}while((Math.abs(f)>h||Math.abs(_)>h)&&--u>0);return new V(ve(s),ve(a))}}class fx extends sl{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Mi(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:s,cosPhi:a}=this;return{x:Mi(e)*a*s+.5,y:-Math.sin(Mi(i))/a*s+.5,z:0}}unproject(e,i){const{scale:s,cosPhi:a}=this,u=-(i-.5)/s,h=Q(ve((e-.5)/s)/a,-180,180),f=Math.asin(Q(u*a,-1,1)),_=Q(ve(f),-85.051129,Me);return new V(h,_)}}class N1 extends hx{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,s){const a=Qh(e,i,s);return dr(a,a,qp(Po(s))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,s){const a=z(i.lat,i.lng),u=Tr([],a),h=s?e._centerAltitude+s:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;Jr(a,a,u,ie(1,0)*Je*h);const f=Ke(new Float64Array(16));return Ze(f,e.pixelMatrix,e.globeMatrix),dr(a,a,f),new Xe(a[0],a[1])}pixelsPerMeter(e,i){return ie(1,0)*i}pixelSpaceConversion(e,i,s){const a=ie(1,e)*i,u=Ft(ie(1,45)*i,a,s);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,s){const a=Mm(Po(s.canonical));return Ze(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:s}=e,a=qp(Po(i));return wt(a,a,Mi(s.lng)),Rt(a,a,Mi(s.lat)),kt(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,s,a){return Y_(e,i,s,!0)||new le(0,0)}pointCoordinate3D(e,i,s){const a=this.pointCoordinate(e,i,s,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!Y_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,u){const h=a.cameraToCenterDistance,f=a._centerAltitude*u,_=a._camera,g=a._camera.forward(),v=ki([],Zi([],g,-h),[0,0,f]),b=a.worldSize/(2*Math.PI),w=[0,0,-b],E=a.width/a.height,A=Math.tan(a.fovAboveCenter),P=Zi([],_.up(),A),D=Zi([],_.right(),A*E),F=Tr([],ki([],ki([],g,P),D)),j=[];let G;if(new lr(v,F).closestPointOnSphere(w,b,j)){const R=ki([],j,w),N=Nr([],R,v);G=Math.cos(a.fovAboveCenter)*vi(N)}else{const R=Nr([],v,w),N=Nr([],w,v);Tr(N,N);const $=vi(R)-b;G=Math.sqrt($*($+2*b));const Z=Math.acos(G/(b+$))-Math.acos(Br(g,N));G*=Math.cos(Z)}return 1.01*G}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),s=tl(e.zoom);if(s>0){const a=cx(e,ie(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ft(i,a+u*(1-Math.cos(h)),Math.pow(s,10))}return i}upVector(e,i,s){return Qh(i,s,e,1)}upVectorScale(e){return{metersToTile:jp($p(Po(e)))}}}function mx(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;
vendor: 3,929 bytes, line 15
15switch(r.name){case"mercator":return new hx(r);case"equirectangular":return new k1(r);case"naturalEarth":return new O1(r);case"equalEarth":return new L1(r);case"winkelTripel":return new B1(r);case"albers":return i?new fx(r):new D1(r);case"lambertConformalConic":return i?new fx(r):new F1(r);case"globe":return new N1(r)}throw new Error(`Invalid projection name: ${r.name}`)}const V1=oi.VectorTileFeature.types,U1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function mf(r,e,i,s,a,u,h,f,_,g,v,b,w){const E=f?Math.min(nl,Math.round(f[0])):0,A=f?Math.min(nl,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*a),u,h,(E<<1)+(_?1:0),A,16*g,16*v,256*b,256*w)}function _f(r,e,i){r.emplaceBack(e,i)}function gf(r,e,i,s,a,u,h){r.emplaceBack(e,i,s,a,u,h)}const yf=(r,e,i,s)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],s[0],s[1],s[2])};function xf(r,e,i,s,a){r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a)}function j1(r){for(const e of r.sections)if(gm(e.text))return!0;return!1}class d_{constructor(e){this.layoutVertexArray=new Ha,this.indexArray=new sn,this.programConfigurations=e,this.segments=new Ar,this.dynamicLayoutVertexArray=new nn,this.opacityVertexArray=new Wa,this.placedSymbolArray=new Mp,this.iconTransitioningVertexArray=new Eo,this.globeExtVertexArray=new Za,this.zOffsetVertexArray=new To,this.orientationVertexArray=new jh}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,s,a,u){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,e1.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,i1.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,U1,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,s1.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,t1.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,r1.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,n1.members,!0)),this.opacityVertexBuffer.itemSize=1),(s||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}st(d_,"SymbolBuffers");class p_{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Ar,this.collisionVertexArray=new Jl,this.collisionVertexArrayExt=new nn}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,o1.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,a1.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
15stroy())}}st(p_,"CollisionBuffers");class vf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ke([]),this.placementViewportMatrix=Ke([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.textSizeData=$y(this.zoom,i["text-size"],this.worldview),this.iconSizeData=$y(this.zoom,i["icon-size"],this.worldview);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=s.get("text-allow-overlap")||s.get("icon-allow-overlap")||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=s.get("text-writing-mode").map(h=>Qn[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new d_(new l(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new d_(new l(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new Hh,this.lineVertexArray=new Rp,this.symbolInstances=new Pp}calculateGlyphDependencies(e,i,s,a,u){for(const h of e){const f=h.codePointAt(0);if(f===void 0)break;if(i[f]=!0,a&&u&&f<=65535){const _=md[h];_&&(i[_.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Um(this.activeReplacements,s)&&(this.activeReplacements=s,!0)}populate(e,i,s,a){const u=this.layers[0],h=u.layout,f=this.projection.name==="globe",_=h.get("text-font"),g=h.get("text-field"),v=h.get("icon-image"),[b,w]=h.get("icon-size-scale-range"),E=Q(i.scaleFactor||1,b,w),A=(g.value.kind!=="constant"||g.value.value instanceof In&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),P=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,D=h.get("symbol-sort-key");if(this.features=[],!A&&!P)return;const F=i.iconDependencies,j=i.glyphDependencies,G=i.availableImages,R=new Wi(this.zoom,{worldview:this.worldview});for(const{feature:N,id:$,index:Z,sourceLayerIndex:oe}of e){const re=u._featureFilter.needGeometry,ae=rt(N,re);if(!u._featureFilter.filter(R,ae,s))continue;if(re||(ae.geometry=at(N,s,a)),f&&N.type!==1&&s.z<=5){const Oe=ae.geometry,Ne=.98078528056,Ie=(ke,we)=>Br(Qh(ke.x,ke.y,s,1),Qh(we.x,we.y,s,1))<Ne;for(let ke=0;ke<Oe.length;ke++)Oe[ke]=qe(Oe[ke],Ie)}let he,Se;if(A){const Oe=u.getValueAndResolveTokens("text-field",ae,s,G),Ne=In.factory(Oe);j1(Ne)&&(this.hasRTLText=!0),(!this.hasRTLText||Ua()==="unavailable"||this.hasRTLText&&Hs.isParsed())&&(he=c1(Ne,u,ae))}if(P){const Oe=u.getValueAndResolveTokens("icon-image",ae,s,G);Se=typeof Oe=="string"?Ln.build(Oe):Oe}if(!he&&!Se)continue;const Be=this.sortFeaturesByKey?D.evaluate(ae,{},s):void 0,ze={id:$,text:he,icon:Se,index:Z,sourceLayerIndex:oe,geometry:ae.geometry,properties:N.properties,type:V1[N.type],sortKey:Be};if(this.features.push(ze),Se){const Oe=this.layers[0]._unevaluatedLayout._values,{iconPrimary:Ne,iconSecondary:Ie}=sx(Se,this.iconSizeData,Oe["icon-size"],s,this.zoom,ze,this.pixelRatio,E,this.worldview),ke=Ne.id.toString();if(F.has(ke)?F.get(ke).push(Ne):F.set(ke,[Ne]),Ie){const we=Ie.id.toString();F.has(we)?F.get(we).push(Ie):F.set(we,[Ie])}}if(he){const Oe=_.evaluate(ae,{},s).join(","),Ne=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Qn.vertical)>=0;for(const Ie of he.sections)if(Ie.image){const ke=Ie.image.getPrimary().scaleSelf(this.pixelRatio),we=ke.id.toString(),Ee=F.get(we)||[];Ee.push(ke),F.set(we,Ee)}
vendor: 29,742 bytes, line 15
15else{const ke=Hl(he.toString()),we=Ie.fontStack||Oe,Ee=j[we]=j[we]||{};this.calculateGlyphDependencies(Ie.text,Ee,Ne,this.allowVerticalPlacement,ke)}}}if(h.get("symbol-placement")==="line"&&(this.features=function(N){const $={},Z={},oe=[];let re=0;function ae(ze){oe.push(N[ze]),re++}function he(ze,Oe,Ne){const Ie=Z[ze];return delete Z[ze],Z[Oe]=Ie,oe[Ie].geometry[0].pop(),oe[Ie].geometry[0]=oe[Ie].geometry[0].concat(Ne[0]),Ie}function Se(ze,Oe,Ne){const Ie=$[Oe];return delete $[Oe],$[ze]=Ie,oe[Ie].geometry[0].shift(),oe[Ie].geometry[0]=Ne[0].concat(oe[Ie].geometry[0]),Ie}function Be(ze,Oe,Ne){const Ie=Ne?Oe[0][Oe[0].length-1]:Oe[0][0];return`${ze}:${Ie.x}:${Ie.y}`}for(let ze=0;ze<N.length;ze++){const Oe=N[ze],Ne=Oe.geometry,Ie=Oe.text?Oe.text.toString():null;if(!Ie){ae(ze);continue}const ke=Be(Ie,Ne),we=Be(Ie,Ne,!0);if(ke in Z&&we in $&&Z[ke]!==$[we]){const Ee=Se(ke,we,Ne),je=he(ke,we,oe[Ee].geometry);delete $[ke],delete Z[we],Z[Be(Ie,oe[je].geometry,!0)]=je,oe[Ee].geometry=null}else ke in Z?he(ke,we,Ne):we in $?Se(ke,we,Ne):(ae(ze),$[ke]=re-1,Z[we]=re-1)}return oe.filter(ze=>ze.geometry)}(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const N of i.elevationFeatures)this.elevationFeatureIdToIndex.set(N.id,this.elevationFeatures.length),this.elevationFeatures.push(N)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((N,$)=>N.sortKey-$.sortKey)}update(e,i,s,a,u,h,f){this.text.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const s=Te(e),a=1/s;let u=!1,h=!1;for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f),g=Kt(1,0,0),v=Kt(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:E,numVerticalIconVertices:A}=_,P=b>0||w>0,D=E>0,F=this.elevationFeatures[_.elevationFeatureIndex];if(F){const j=new Xe(_.tileAnchorX,_.tileAnchorY),G=.075+F.pointElevation(j);_.zOffset!==G&&(i=!0,_.zOffset=G);const R=F.computeSlopeNormal(j,a),N=_a(Nn(),Kt(0,0,1),R);Ds(g,g,N),Ds(v,v,N),g[2]*=s,v[2]*=s,g[0]===1&&g[1]===0&&g[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(u=u||P,h=h||D)}if(P&&(yf(this.text.orientationVertexArray,b,g,v),yf(this.text.orientationVertexArray,w,g,v)),D){const{placedIconSymbolIndex:j,verticalPlacedIconSymbolIndex:G}=_;j>=0&&yf(this.icon.orientationVertexArray,E,g,v),G>=0&&yf(this.icon.orientationVertexArray,A,g,v)}}u||(this.text.orientationVertexArray=void 0),h||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,h,f)=>{s+=h,s>u.length&&u.resize(s);for(let _=-h;_<0;_++)u.emplace(_+s,f)},i=(u,h,f)=>{a+=h,a>u.length&&u.resize(a);for(let _=-h;_<0;_++)u.emplace(_+a,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let s=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const h=this.symbolInstances.get(u),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:g}=h,v=h.zOffset,b=g>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:E}=h;w>=0&&i(this.icon.zOffsetVertexArray,g,v),E>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,v)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=mx(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D){const F=e.indexArray,j=e.layoutVertexArray,G=e.globeExtVertexArray,R=e.segments.prepareSegment(4*i.length,j,F,this.canOverlap?h.sortKey:void 0),N=this.glyphOffsetArray.length,$=R.vertexLength,Z=this.allowVerticalPlacement&&f===Qn.vertical?Math.PI/2:0,oe=h.text&&h.text.sections;for(let ae=0;ae<i.length;ae++){const{tl:he,tr:Se,bl:Be,br:ze,texPrimary:Oe,texSecondary:Ne,pixelOffsetTL:Ie,pixelOffsetBR:ke,minFontScaleX:we,minFontScaleY:Ee,glyphOffset:je,isSDF:$e,sectionIndex:vt}=i[ae],ht=R.vertexLength,et=je[1];if(mf(j,g.x,g.y,he.x,et+he.y,Oe.x,Oe.y,s,$e,Ie.x,Ie.y,we,Ee),mf(j,g.x,g.y,Se.x,et+Se.y,Oe.x+Oe.w,Oe.y,s,$e,ke.x,Ie.y,we,Ee),mf(j,g.x,g.y,Be.x,et+Be.y,Oe.x,Oe.y+Oe.h,s,$e,Ie.x,ke.y,we,Ee),mf(j,g.x,g.y,ze.x,et+ze.y,Oe.x+Oe.w,Oe.y+Oe.h,s,$e,ke.x,ke.y,we,Ee),_){const{x:Ue,y:Ht,z:ut}=_.anchor,[pt,Ot,ti]=_.up;gf(G,Ue,Ht,ut,pt,Ot,ti),gf(G,Ue,Ht,ut,pt,Ot,ti),gf(G,Ue,Ht,ut,pt,Ot,ti),gf(G,Ue,Ht,ut,pt,Ot,ti),xf(e.dynamicLayoutVertexArray,Ue,Ht,ut,Z)}else xf(e.dynamicLayoutVertexArray,g.x,g.y,g.z,Z);if(D){const Ue=Ne||Oe;_f(e.iconTransitioningVertexArray,Ue.x,Ue.y),_f(e.iconTransitioningVertexArray,Ue.x+Ue.w,Ue.y),_f(e.iconTransitioningVertexArray,Ue.x,Ue.y+Ue.h),_f(e.iconTransitioningVertexArray,Ue.x+Ue.w,Ue.y+Ue.h)}F.emplaceBack(ht,ht+1,ht+2),F.emplaceBack(ht+1,ht+2,ht+3),R.vertexLength+=4,R.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(je[0]),ae!==i.length-1&&vt===i[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(j.length,h,h.index,{},E,A,P,oe&&oe[vt],this.worldview)}const re=_?_.anchor:g;e.placedSymbolArray.emplaceBack(re.x,re.y,re.z,g.x,g.y,N,this.glyphOffsetArray.length-N,$,v,b,g.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],f,0,0,0,w,0)}_commitLayoutVertex(e,i,s,a,u,h,f){e.emplaceBack(i,s,a,u,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,s,a,u,h,f){const _=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),g=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let E=0;E<4;E++)s.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(s.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new Xe(e.x1,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new Xe(e.x2,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new Xe(e.x2,e.y2)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new Xe(e.x1,e.y2)),_.vertexLength+=4;const w=s.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,s,a,u,h){for(let f=a;f<u;f++){const _=s.get(f),g=this.getSymbolInstanceTextSize(e,h,i,f);this._addCollisionDebugVertices(_,g,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,s,a,u,h){for(let f=a;f<u;f++){const _=s.get(f),g=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(_,g,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,s){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new p_(mu,Py.members,Eo),this.iconCollisionBox=new p_(mu,Py.members,Eo);const a=gd(this.iconSizeData,e),u=gd(this.textSizeData,e,s);for(let h=0;h<this.symbolInstances.length;h++){const f=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(u,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(u,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,s,a){const u=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),h=s_(this.textSizeData,e,u)/tn;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,s){const a=this.icon.placedSymbolArray.get(s),u=s_(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,s,a){e.emplaceBack(i,-s,-s,a),e.emplaceBack(i,s,-s,a),e.emplaceBack(i,s,s,a),e.emplaceBack(i,-s,s,a)}_updateTextDebugCollisionBoxes(e,i,s,a,u,h,f){for(let _=a;_<u;_++){const g=s.get(_),v=this.getSymbolInstanceTextSize(e,h,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,s,a,u,h,f){for(let _=a;_<u;_++){const g=s.get(_),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,s,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=gd(this.iconSizeData,e,a),h=gd(this.textSizeData,e,s);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(h,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,s),this._updateTextDebugCollisionBoxes(h,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,s),this._updateIconDebugCollisionBoxes(u,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(u,e,i,_.verticalIconBoxStartIndex,_.verticalIconBoxEndIndex,_,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,s,a,u,h,f,_,g){const v={};if(i<s){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R,featureIndex:N}=e.get(i);v.textBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R},v.textFeatureIndex=N}if(a<u){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R,featureIndex:N}=e.get(a);v.verticalTextBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R},v.verticalTextFeatureIndex=N}if(h<f){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R,featureIndex:N}=e.get(h);v.iconBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R},v.iconFeatureIndex=N}if(_<g){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R,featureIndex:N}=e.get(_);v.verticalIconBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:F,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:R},v.verticalIconFeatureIndex=N}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const s=e.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<a;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),a=[],u=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const _=this.symbolInstances.get(f);a.push(0|Math.round(i*_.tileAnchorX+s*_.tileAnchorY)),u.push(_.featureIndex)}return h.sort((f,_)=>a[f]-a[_]||u[_]-u[f]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:g}=s;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),h>=0&&h!==u&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let _x,gx,f_;st(vf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),vf.addDynamicAttributes=xf;class yx{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Ta,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}st(yx,"FormatSectionOverride",{omit:["defaultValue"]});const m_=()=>f_||(f_={layout:_x||(_x=new Er({"symbol-placement":new Ve(pe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ve(pe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ve(pe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new it(pe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ve(pe.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Ve(pe.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Ve(pe.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Ve(pe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ve(pe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ve(pe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ve(pe.layout_symbol["icon-rotation-alignment"]),"icon-size":new it(pe.layout_symbol["icon-size"]),"icon-size-scale-range":new Ve(pe.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new it(pe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new it(pe.layout_symbol["icon-text-fit-padding"]),"icon-image":new it(pe.layout_symbol["icon-image"]),"icon-rotate":new it(pe.layout_symbol["icon-rotate"]),"icon-padding":new Ve(pe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ve(pe.layout_symbol["icon-keep-upright"]),"icon-offset":new it(pe.layout_symbol["icon-offset"]),"icon-anchor":new it(pe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ve(pe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ve(pe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ve(pe.layout_symbol["text-rotation-alignment"]),"text-field":new it(pe.layout_symbol["text-field"]),"text-font":new it(pe.layout_symbol["text-font"]),"text-size":new it(pe.layout_symbol["text-size"]),"text-size-scale-range":new Ve(pe.layout_symbol["text-size-scale-range"]),"text-max-width":new it(pe.layout_symbol["text-max-width"]),"text-line-height":new it(pe.layout_symbol["text-line-height"]),"text-letter-spacing":new it(pe.layout_symbol["text-letter-spacing"]),"text-justify":new it(pe.layout_symbol["text-justify"]),"text-radial-offset":new it(pe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ve(pe.layout_symbol["text-variable-anchor"]),"text-anchor":new it(pe.layout_symbol["text-anchor"]),"text-max-angle":new Ve(pe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ve(pe.layout_symbol["text-writing-mode"]),"text-rotate":new it(pe.layout_symbol["text-rotate"]),"text-padding":new Ve(pe.layout_symbol["text-padding"]),"text-keep-upright":new Ve(pe.layout_symbol["text-keep-upright"]),"text-transform":new it(pe.layout_symbol["text-transform"]),"text-offset":new it(pe.layout_symbol["text-offset"]),"text-allow-overlap":new Ve(pe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ve(pe.layout_symbol["text-ignore-placement"]),"text-optional":new Ve(pe.layout_symbol["text-optional"]),visibility:new Ve(pe.layout_symbol.visibility)})),paint:gx||(gx=new Er({"icon-opacity":new it(pe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new it(pe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new it(pe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new it(pe.paint_symbol["text-emissive-strength"]),"icon-color":new it(pe.paint_symbol["icon-color"]),"icon-halo-color":new it(pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new it(pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new it(pe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ve(pe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ve(pe.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Ve(pe.paint_symbol["icon-image-cross-fade"]),"text-opacity":new it(pe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new it(pe.paint_symbol["text-occlusion-opacity"]),"text-color":new it(pe.paint_symbol["text-color"],{runtimeType:Gn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new it(pe.paint_symbol["text-halo-color"]),"text-halo-width":new it(pe.paint_symbol["text-halo-width"]),"text-halo-blur":new it(pe.paint_symbol["text-halo-blur"]),"text-translate":new Ve(pe.paint_symbol["text-translate"]),"text-translate-anchor":new Ve(pe.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Ve(pe.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Ve(pe.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Ve(pe.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Ve(pe.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new it(pe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},f_);class bf extends yn{constructor(e,i,s,a){super(e,m_(),i,s,a),this._colorAdjustmentMatrix=Ke([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const s=this.layout.get("text-writing-mode");if(s){const a=[];for(const u of s)a.indexOf(u)<0&&a.push(u);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,s,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===s&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(u,h,f,_){u=mn(u),h=zn(h);const g=jt(),v=u/3,b=1-2*v,w=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],E=.5-.5*h,A=_-f;return Ze(g,[A,0,0,0,0,A,0,0,0,0,A,0,f,f,f,1],[h,0,0,0,0,h,0,0,0,0,h,0,E,E,E,1]),Ze(g,g,w),g}(e,i,s,a),this._saturation=e,this._contrast=i,this._brightnessMin=s,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,s,a){const u=this.layout.get(e).evaluate(i,{},s,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||su(h.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(g,v)=>v in f?String(f[v]):"")}(i.properties,u)}createBucket(e){return new vf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of m_().paint.overridableProperties){if(!bf.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new yx(i),a=new Ba(s,i.property.specification,this.scope,this.options);let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new $l("source",a):new ql("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new ja(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&bf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),a=m_().paint.properties[i];let u=!1;const h=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof In)h(s.value.value.sections);else if(s.value.kind==="source"){const f=g=>{u||(g instanceof $t&&nt(g.value)===Al?h(g.value.sections):g instanceof Ea?h(g.sections):g.eachChild(f))},_=s.value;_._styleExpression&&f(_._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,s){return{config:new Ja(this,{zoom:i,lut:s}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let xx,vx,bx,wx;var __=Ai([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function g_(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function y_(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class x_{constructor(e,i,s,a){this.context=e,this.format=s,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const s=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:h}=u,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},g=f+s,v=_+a;!this.size||this.size[0]===g&&this.size[1]===v||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&v>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,v)))+1:1;h.texStorage2D(h.TEXTURE_2D,w,this.format,g,v),this.size=[g,v]}if(this.size)if(b)h.texSubImage2D(h.TEXTURE_2D,0,f,_,g_(this.format),y_(this.format),e);else{const w=e.data;w&&h.texSubImage2D(h.TEXTURE_2D,0,f,_,s,a,g_(this.format),y_(this.format),w)}this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,s=!1){const{context:a}=this,{gl:u}=a;u.bindTexture(u.TEXTURE_2D,this.texture),e!==this.minFilter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,this.useMipmap&&!s?e===u.NEAREST?u.NEAREST_MIPMAP_NEAREST:u.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,s,a,u){const{context:h}=this,{gl:f}=h;f.bindTexture(f.TEXTURE_2D,this.texture),i!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),s!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,s),this.wrapS=s),a!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,a),this.wrapT=a),u!==this.compareMode&&(u?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,u)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=u)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class wf{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function Tf(r,e,i,s,a,u,h,f){const _=[r,e,1,i,s,1,a,u,1],g=[h,f,1],v=Zt([],_),[b,w,E]=da(g,g,v);return li(_,_,[b,0,0,0,w,0,0,0,E])}function Tx(r,e,i,s,a,u,h,f){const _=function(g,v,b,w,E,A,P,D){const F=Tf(0,0,1,0,1,1,0,1),j=Tf(g,v,b,w,E,A,P,D);return li(j,j,Zt([],F))}(r,e,i,s,a,u,h,f);return[_[2]/_[8]/Je,_[5]/_[8]/Je]}function Sf(r){return[r[0],Math.min(Math.max(r[1],-85.051129),Me)]}class Sx extends $o{constructor(e,i,s,a){super(),this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Go("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Yu(this.map._requestManager.transformRequest(this.url,wl.Image),(s,a)=>{this._imageRequest=null,this._loaded=!0,s?this.fire(new zc(s)):a&&(this.image=a instanceof HTMLImageElement?fs.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}lo
vendor: 7,438 bytes, line 15
15aded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new wf(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Go("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof wf||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],s=e[0][1];for(const u of e)u[1]>s&&(s=u[1]),u[1]<i&&(i=u[1]);const a=(s+i)/2;if(a>Me?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(le.fromLngLat);this.tileID=function(h){let f=1/0,_=1/0,g=-1/0,v=-1/0;for(const P of h)f=Math.min(f,P.x),_=Math.min(_,P.y),g=Math.max(g,P.x),v=Math.max(v,P.y);const b=Math.max(g-f,v-_),w=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),E=Math.pow(2,w);let A=Math.floor((f+g)/2*E);return A>1&&(A-=1),new uc(w,A,Math.floor((_+v)/2*E))}(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Go("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const F in this.tiles){const j=this.tiles[F];j.state!=="loaded"&&(j.state="loaded",j.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=vd(new uc(0,0,0),this.map.transform.projection),s=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(F){const j=F[1].x-F[0].x,G=F[1].y-F[0].y,R=F[2].x-F[1].x,N=F[2].y-F[1].y,$=F[3].x-F[2].x,Z=F[3].y-F[2].y,oe=F[0].x-F[3].x,re=F[0].y-F[3].y,ae=j*N-R*G,he=R*Z-$*N,Se=$*re-oe*Z,Be=oe*G-j*re;return ae>0&&he>0&&Se>0&&Be>0||ae<0&&he<0&&Se<0&&Be<0}(s))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=vd(this.tileID,this.map.transform.projection),[u,h,f,_]=this.coordinates.map(F=>{const j=a.projection.project(F[0],F[1]);return ux(a,j)._round()});this.perspectiveTransform=Tx(u.x,u.y,h.x,h.y,f.x,f.y,_.x,_.y);const g=this._boundsArray=new $a;g.emplaceBack(u.x,u.y,0,0),g.emplaceBack(h.x,h.y,Je,0),g.emplaceBack(_.x,_.y,0,Je),g.emplaceBack(f.x,f.y,Je,Je),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,__.members),this.boundsSegments=Ar.simpleSegment(0,0,4,2);const v=[],b=[Sf((w=this.coordinates)[0]),Sf(w[1]),Sf(w[2]),Sf(w[3])];var w;const[E,A,P,D]=function(F){let j=F[0][0],G=j,R=F[0][1],N=R;for(let $=1;$<F.length;$++)F[$][0]<j?j=F[$][0]:F[$][0]>G&&(G=F[$][0]),F[$][1]<R?R=F[$][1]:F[$][1]>N&&(N=F[$][1]);return[j,R,G-j,N-R]}(b);{const F=new $a,[j,G,R,N]=function(Ie){let ke=Ie[0].x,we=ke,Ee=Ie[0].y,je=Ee;for(let $e=1;$e<Ie.length;$e++)Ie[$e].x<ke?ke=Ie[$e].x:Ie[$e].x>we&&(we=Ie[$e].x),Ie[$e].y<Ee?Ee=Ie[$e].y:Ie[$e].y>je&&(je=Ie[$e].y);return[ke,Ee,we-ke,je-Ee]}(s),$=Ie=>[(Ie.x-j)/R,(Ie.y-G)/N],[Z,oe,re,ae]=s.map($),he=function(Ie,ke,we,Ee,je,$e,vt,ht){const et=Tf(0,0,1,0,1,1,0,1);return li(et,et,Zt([],Tf(Ie,ke,we,Ee,je,$e,vt,ht)))}(Z[0],Z[1],oe[0],oe[1],re[0],re[1],ae[0],ae[1]);this.elevatedGlobePerspectiveTransform=Tx(Z[0],Z[1],oe[0],oe[1],re[0],re[1],ae[0],ae[1]);const Se=(Ie,ke)=>{v.push(Ie.lng);const we=Math.round((Ie.lng-E)/P*Je),Ee=Math.round((Ie.lat-A)/D*Je),je=$(ke),$e=da([],[je[0],je[1],1],he),vt=Math.round($e[0]/$e[2]*Je),ht=Math.round($e[1]/$e[2]*Je);F.emplaceBack(we,Ee,vt,ht)},Be=s[3].x-s[0].x,ze=s[3].y-s[0].y,Oe=s[2].x-s[1].x,Ne=s[2].y-s[1].y;for(let Ie=0;Ie<65;Ie++){const ke=Ie/64,we=[s[0].x+ke*Be,s[0].y+ke*ze],Ee=[s[1].x+ke*Oe,s[1].y+ke*Ne],je=Ee[0]-we[0],$e=Ee[1]-we[1];for(let vt=0;vt<65;vt++){const ht=vt/64,et={x:we[0]+je*ht,y:we[1]+$e*ht};Se(i.projection.unproject(et.x,et.y),et)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(F,__.members)}{this.maxLongitudeTriangleSize=0;let F=[],j=new sn;const G=(R,N,$)=>{j.emplaceBack(R,N,$);const Z=v[R],oe=v[N],re=v[$],ae=Math.min(Math.min(Z,oe),re),he=Math.max(Math.max(Z,oe),re)-ae;he>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=he),F.push(ae+he/2)};for(let R=0;R<64;R++)for(let N=0;N<64;N++){const $=65*R+N,Z=$+1,oe=$+65,re=oe+1;G($,oe,Z),G(Z,oe,re)}[F,j]=function(R,N){const $=Array.from({length:R.length},(re,ae)=>ae);$.sort((re,ae)=>R[re]-R[ae]);const Z=[],oe=new sn;for(let re=0;re<$.length;re++){const ae=$[re];Z.push(R[ae]);const he=3*ae,Se=he+1;oe.emplaceBack(N.uint16[he],N.uint16[Se],N.uint16[Se+1])}return[Z,oe]}(F,j),this.elevatedGlobeTrianglesCenterLongitudes=F,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(j)}this.elevatedGlobeSegments=Ar.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,P/Je,0,D/Je,0,0,A,E,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,s=i.gl;!this._dirty||this.texture instanceof wf||(this.texture?this.texture.update(this.image):(this.texture=new x_(i,this.image,s.RGBA8),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const s=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((s[0]-u)/360);var u;const h=new Ar,f=(b,w)=>{h.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(s[0]-a)<=_){const b=Qr(s,0,s.length,a+_);return b===s.length||f(b,xr(s,b+1,s.length,a+360-_)-b),h}a<s[0]&&(a+=360);const g=xr(s,0,s.length,a-_);if(g===s.length)return f(0,s.length),h;f(0,g-0);const v=Qr(s,g+1,s.length,a+_);return v!==s.length&&f(v,s.length-v),h}}const G1=(Math.pow(256,2)-1)/16907520;class Ex extends yn{constructor(e,i,s,a){super(e,{layout:bx||(bx=new Er({visibility:new Ve(pe.layout_raster.visibility)})),paint:wx||(wx=new Er({"raster-opacity":new Ve(pe.paint_raster["raster-opacity"]),"raster-color":new na(pe.paint_raster["raster-color"]),"raster-color-mix":ne
vendor: 5,351 bytes, line 15
15w Ve(pe.paint_raster["raster-color-mix"]),"raster-color-range":new Ve(pe.paint_raster["raster-color-range"]),"raster-hue-rotate":new Ve(pe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ve(pe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ve(pe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ve(pe.paint_raster["raster-saturation"]),"raster-contrast":new Ve(pe.paint_raster["raster-contrast"]),"raster-resampling":new Ve(pe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ve(pe.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Ve(pe.paint_raster["raster-emissive-strength"]),"raster-array-band":new Ve(pe.paint_raster["raster-array-band"]),"raster-elevation":new Ve(pe.paint_raster["raster-elevation"]),"raster-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof Sx&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[s,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(s)&&isNaN(a)||s===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=ed({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:s,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[s,a])}}let Ix,Ax,Mx,Cx,Px;class Rx extends yn{constructor(e,i,s,a){super(e,{layout:Ix||(Ix=new Er({visibility:new Ve(pe["layout_raster-particle"].visibility)})),paint:Ax||(Ax=new Er({"raster-particle-array-band":new Ve(pe["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Ve(pe["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new na(pe["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Ve(pe["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Ve(pe["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Ve(pe["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Ve(pe["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Ve(pe["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this._updateColorRamp(),this.lastInvalidatedAt=fs.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=ed({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=fs.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class $1 extends yn{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function v_(r,e,i){const s=[0,0,1],a=ro([]);return so(a,a,i?-Mi(r)+Math.PI:Mi(r)),no(a,a,-Mi(e)),Ds(s,s,a),Tr(s,s)}function zx(r,e){const i=Ef(r.projection,r.zoom,r.width,r.height),s=function(u,h,f,_,g){const v=new V(f.lng-180*ol,f.lat),b=new V(f.lng+180*ol,f.lat),w=u.project(v.lng,v.lat),E=u.project(b.lng,b.lat),A=-Math.atan2(E.y-w.y,E.x-w.x),P=le.fromLngLat(f);P.y=Q(P.y,-1+ol,1-ol);const D=P.toLngLat(),F=u.project(D.lng,D.lat),j=le.fromLngLat(D);j.x+=ol;const G=j.toLngLat(),R=u.project(G.lng,G.lat),N=Lx(R.x-F.x,R.y-F.y,A),$=le.fromLngLat(D);
15$.y+=ol;const Z=$.toLngLat(),oe=u.project(Z.lng,Z.lat),re=Lx(oe.x-F.x,oe.y-F.y,A),ae=Math.abs(N.x)/Math.abs(re.y),he=Ke([]);Or(he,he,-A*(1-(g?0:_)));const Se=Ke([]);return kt(Se,Se,[1,1-(1-ae)*_,1]),Se[4]=-re.x/re.y*_,Or(Se,Se,A),Ze(Se,he,Se),Se}(r.projection,0,r.center,i,e),a=Dx(r);return kt(s,s,[a,a,1]),s}function Dx(r){const e=r.projection,i=Ef(r.projection,r.zoom,r.width,r.height),s=b_(e,r.center),a=b_(e,V.convert(e.center));return Math.pow(2,s*i+(1-i)*a)}function Ef(r,e,i,s,a=1/0){const u=r.range;if(!u)return 0;const h=Math.min(a,Math.max(i,s)),f=Math.log(h/1024)/Math.LN2;return ce(u[0]+f,u[1]+f,e)}const ol=1/4e4;function b_(r,e){const i=Q(e.lat,-85.051129,Me),s=new V(e.lng-180*ol,i),a=new V(e.lng+180*ol,i),u=r.project(s.lng,i),h=r.project(a.lng,i),f=le.fromLngLat(s),_=le.fromLngLat(a),g=h.x-u.x,v=h.y-u.y,b=_.x-f.x,w=_.y-f.y,E=Math.sqrt((b*b+w*w)/(g*g+v*v));return Math.log(E)/Math.LN2}function Lx(r,e,i){const s=Math.cos(i),a=Math.sin(i);return{x:r*s-e*a,y:r*a+e*s}}function kx(r,e,i){Ke(r),Or(r,r,Mi(e[2])),Rt(r,r,Mi(e[0])),wt(r,r,Mi(e[1])),kt(r,r,i),Ze(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function If(r,e,i,s,a,u,h,f){const _=[i[0]-e[0],i[1]-e[1],0],g=[s[0]-e[0],s[1]-e[1],0];if(vi(_)<1e-12||vi(g)<1e-12)return ro(r);const v=Yr([],_,g);Tr(v,v),Ji(g,s,e),_[2]=(u-a)*f,g[2]=(h-a)*f;const b=_;return Yr(b,_,g),Tr(b,b),_a(r,v,b)}function w_(r,e,i=!1){const s=tl(e.zoom),a=function(u,h,f){const _=h.worldSize,g=[u[12],u[13],u[14]],v=fe(g[1]/_),b=ne(g[0]/_),w=Ke([]),E=ie(1,v)*_,A=ie(1,0)*_*Fe(v,h.zoom),P=1/Cm(_);let D=A*P;if(f){const R=Ef(h.projection,h.zoom,h.width,h.height,1024);D=P*h.projection.pixelSpaceConversion(h.center.lat,_,R)}const F=z(v,b);ki(F,F,Zi([],Tr([],F),E*D*g[2]));const j=function(R){const N=[R[0],R[1],R[2]];let $=[0,1,0];const Z=Yr([],$,N);return Yr($,N,Z),Ts($)===0&&($=[0,1,0],Yr(Z,N,$)),Tr(Z,Z),Tr($,$),Tr(N,N),[Z[0],Z[1],Z[2],0,$[0],$[1],$[2],0,N[0],N[1],N[2],0,R[0],R[1],R[2],1]}(F);kt(w,w,[D,D,D*E]),It(w,w,[-g[0],-g[1],-g[2]]);const G=Ze([],h.globeMatrix,j);return Ze(G,G,w),Ze(G,G,u),G}(r,e,i);if(s>0){const u=function(h,f){const _=f.worldSize,g=ie(1,0)*_*Fe(f.center.lat,f.zoom)/Cm(_),v=ie(1,f.center.lat)*_,b=Ke([]);return wt(b,b,Mi(f.center.lng)),Rt(b,b,Mi(f.center.lat)),It(b,b,[0,0,m]),kt(b,b,[g,g,g*v]),It(b,b,[f.point.x-.5*_,f.point.y-.5*_,0]),Ze(b,b,h),Ze(b,f.globeMatrix,b)}(r,e);return function(h,f,_){const g=(A,P,D)=>{const F=vi(A),j=vi(P),G=la(A,P,D);return Zi(G,G,1/vi(G)*Ft(F,j,D))},v=g([h[0],h[1],h[2]],[f[0],f[1],f[2]],_),b=g([h[4],h[5],h[6]],[f[4],f[5],f[6]],_),w=g([h[8],h[9],h[10]],[f[8],f[9],f[10]],_),E=la([h[12],h[13],h[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,E[0],E[1],E[2],1]}(a,u,s)}return a}function Fx(r,e,i,s){const a=Ci.projectAabbCorners(s,i);let u=Number.MAX_VALUE,h=-1;for(let g=0;g<a.length;++g){const v=a[g];v[0]=(.5*v[0]+.5)*e.width,v[1]=(.5-.5*v[1])*e.height,v[2]<u&&(h=g,u=v[2])}const f=g=>new Xe(a[g][0],a[g][1]);let _;switch(h){case 0:case 6:_=[f(1),f(5),f(4),f(7),f(3),f(2),f(1)];break;case 1:case 7:_=[f(0),f(4),f(5),f(6),f(2),f(3),f(0)];break;case 3:case 5:_=[f(1),f(0),f(4),f(7),f(6),f(2),f(1)];break;default:_=[f(1),f(5),f(6),f(7),f(3),f(0),f(1)]}if(Fn(r,_))return u}const q1=Ai([{name:"a_pos_3f",components:3,type:"Float32"}]),H1=Ai([{name:"a_color_3f",components:3,type:"Float32"}]),Z1=Ai([{name:"a_color_4f",components:4,type:"Float32"}]),W1=Ai([{name:"a_uv_2f",components:2,type:"Float32"}]),X1=Ai([{name:"a_normal_3f",components:3,type:"Float32"}]),Y1=Ai([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),K1=Ai([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),Ox={None:0,Model:1,Symbol:2,FillExtrusion:4};class Af{constructor(e,i,s,a){this.message=(e?`${e}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function T_(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Bx{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Nx{constructor(){this.instancedDataArray=new Xa,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class S_{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs}updateFootprints(e,i){}populate(e,i,s,a){this.tileToMeter=Te(s);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:f,index:_,sourceLayerIndex:g}of e){const v=f??(h.properties&&h.properties.hasOwnProperty("id")?h.properties.id:void 0),b=rt(h,u);if(!this.layers[0]._featureFilter.filter(new Wi(this.zoom,{worldview:this.worldview}),b,s))continue;const w={id:v,sourceLayerIndex:g,index:_,geometry:u?b.geometry:at(h,s,a),properties:h.properties,type:h.type,patterns:{}},E=this.addFeature(w,w.geometry,b);E&&i.featureIndex.insert(h,w.geometry,_,g,this.index,this.instancesPerModel[E].instancedDataArray.length,Je/32)}this.lookup=null}update(e,i,s,a){for(const u in this.instancesPerModel){const h=this.instancesPerModel[u];for(const f in e)h.idToFeaturesIndex.hasOwnProperty(f)&&(this.evaluate(h.features[h.idToFeaturesIndex[f]],e[f],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];for(const a of s.features){const u=this.layers[0],h=a.feature,f=this.canonical,_=u.paint.get("model-rotation").evaluate(h,{},f),g=u.paint.get("model-scale").evaluate(h,{},f),v=u.paint.get("model-translation").evaluate(h,{},f);ps(a.rotation,_)&&ps(a.scale,g)&&ps(a.translation,v)||(this.evaluate(a,a.featureStates,s,!0),e=!0)}}return e}updateReplacement(e,i,s,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Um(this.activeReplacements,u))return!1;this.activeReplacements=u;let h=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],g=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,w=v.instancedDataCount;for(let E=0;E<w;E++){const A=16*(E+b);let P=g.float32[A+0];const D=P>Je;P=D?P-Je:P;const F=Math.floor(P),j=g.float32[A+1];let G=!1;for(const R of this.activeReplacements)if(!Rg(R,s,Ox.Model,a)&&!(R.min.x>F||F>R.max.x||R.min.y>j||j>R.max.y)&&(G=Og(Fg(F,j,e.canonical,R.footprintTileId.canonical),R.footprint),G))break;g.float32[A]=G?P+Je:P,h=h||G!==D}}}return h}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length<0||s.instancedDataArray.length===0||(s.instancedDataBuffer?s.instancedDataBuffer.updateData(s.instancedDataArray):s.instancedDataBuffer=e.createVertexBuffer(s.instancedDataArray,Y1.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)e.removeModel(i,"",!0)}addFeature(e,i,s){const a=this.layers[0],u=a.layout.get("model-id").evaluate(s,{},this.canonical);if(!u)return ii(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),u;(T_(u,!1)||this.styleDefinedModelURLs[u]!==void 0)&&(this.modelUris.includes(u)||this.modelUris.push(u)),this.instancesPerModel[u]||(this.instancesPerModel[u]=new Nx);const h=this.instancesPerModel[u],f=h.instancedDataArray,_=new Bx(s,f.length);for(const g of i)for(const v of g){if(v.x<0||v.x>=Je||v.y<0||v.y>=Je)continue;const b=(this.lookupDim-1)/Je,w=this.lookupDim*(v.y*b|0)+v.x*b|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const E=f.length;f.resize(E+1),h.instancesEvaluatedElevation.push(0),f.float32[16*E]=v.x,f.float32[16*E+1]=v.y}return _.instancedDataCount=h.instancedDataArray.length-_.instancedDataOffset,_.instancedDataCount>0&&(e.id&&(h.idToFeaturesIndex[e.id]=h.features.length),h.features.push(_),this.evaluate(_,{},h,!1)),u}getModelUris(){return this.modelUris}evaluate(e,i,s,a){const u=this.layers[0],h=e.feature,f=this.canonical,_=e.rotation=u.paint.get("model-rotation").evaluate(h,i,f),g=e.scale=u.paint.get("model-scale").evaluate(h,i,f),v=e.translation=u.paint.get("model-translation").evaluate(h,i,f),b=u.paint.get("model-color").evaluate(h,i,f);b.a=u.paint.get("model-color-mix-intensity").evaluate(h,i,f);const w=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),kx(w,_,g);const E=Math.round(100*b.a)+b.b/1.05;for(let A=0;A<e.instancedDataCount;++A){const P=e.instancedDataOffset+A,D=16*P,F=s.instancedDataArray.float32;let j=0;a&&(j=F[D+6]-s.instancesEvaluatedElevation[P]);const G=0|F[D+1];F[D]=(0|F[D])+b.r/1.05,F[D+1]=G+b.g/1.05,F[D+2]=E,F[D+3]=1/(f.z>10?this.tileToMeter:Te(f,G)),F[D+4]=v[0],F[D+5]=v[1],F[D+6]=v[2]+j,F[D+7]=w[0],F[D+8]=w[1],F[D+9]=w[2],F[D+10]=w[4],F[D+11]=w[5],F[D+12]=w[6],F[D+13]=w[8],F[D+14]=w[9],F[D+15]=w[10],s.instancesEvaluatedElevation[P]=v[2]}}}let Vx,Ux;st(S_,"ModelBucket",{omit:["layers"]}),st(Nx,"PerModelAttributes"),st(Bx,"ModelFeature");
vendor: 7,261 bytes, line 15
15const gc=64,Ou={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function jx(r,e,i,s,a,u,h,f,_,g=!1){const v=i.zoom,b=i.project(s),w=Fe(s.lat,v),E=1/w;Ke(r),It(r,r,[b.x+h[0]*E,b.y+h[1]*E,h[2]]);let A=1,P=1;const D=i.worldSize;if(g){if(i.projection.name==="mercator"){let R=0;i.elevation&&(R=i.elevation.getAtPointOrZero(new le(b.x/D,b.y/D),0));const N=Tn([],[b.x,b.y,R,1],i.projMatrix)[3]/i.cameraToCenterDistance;A=N,P=N*Fe(i.center.lat,v)}else if(i.projection.name==="globe"){const R=w_(r,i),N=[0,0,0,1];Tn(N,N,Ze([],i.projMatrix,R));const $=N[3]/i.cameraToCenterDistance,Z=tl(v),oe=i.projection.pixelsPerMeter(s.lat,D)*Fe(s.lat,v),re=i.projection.pixelsPerMeter(i.center.lat,D)*Fe(i.center.lat,v);A=$/Ft(oe,Ce(i.center.lat),Z),P=$*w/oe,A*=re,P*=re}}else A=E;kt(r,r,[A,A,P]);const F=[...r],j=e.orientation,G=[];if(kx(G,[j[0]+a[0],j[1]+a[1],j[2]+a[2]],u),Ze(r,F,G),f&&i.elevation){let R=0;const N=[];if(_&&i.elevation){R=function(Z,oe,re,ae,he){const Se=oe.elevation;if(!Se)return 0;const Be=Ci.projectAabbCorners(re,ae),ze=ie(1,he.lat)*oe.worldSize,Oe=function(Ue,Ht){const ut=[0,0,1],pt=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Ot of pt){const ti=Ue[Ot.corners[0]],Qt=Ue[Ot.corners[1]],hi=Ue[Ot.corners[2]],ni=[Qt[0]-ti[0],Qt[1]-ti[1],Ht*(Qt[2]-ti[2])],di=Yr(ni,ni,[hi[0]-ti[0],hi[1]-ti[1],Ht*(hi[2]-ti[2])]);Tr(di,di),Ot.dotProductWithUp=Br(di,ut)}return pt.sort((Ot,ti)=>Ot.dotProductWithUp-ti.dotProductWithUp),pt[0].corners}(Be,ze),Ne=Be[Oe[0]],Ie=Be[Oe[1]],ke=Be[Oe[2]],we=Be[Oe[3]],Ee=Se.getAtPointOrZero(new le(Ne[0]/oe.worldSize,Ne[1]/oe.worldSize),0),je=Se.getAtPointOrZero(new le(Ie[0]/oe.worldSize,Ie[1]/oe.worldSize),0),$e=Se.getAtPointOrZero(new le(ke[0]/oe.worldSize,ke[1]/oe.worldSize),0),vt=Se.getAtPointOrZero(new le(we[0]/oe.worldSize,we[1]/oe.worldSize),0),ht=(Ee+vt)/2,et=(je+$e)/2;return ht>et?je<$e?If(Z,Ie,we,Ne,je,vt,Ee,ze):If(Z,ke,Ne,we,$e,Ee,vt,ze):Ee<vt?If(Z,Ne,Ie,ke,Ee,je,$e,ze):If(Z,we,ke,Ie,vt,$e,je,ze),Math.max(ht,et)}(N,i,e.aabb,r,s);const $=Ze([],Rn([],N),G);Ze(r,F,$)}else R=i.elevation.getAtPointOrZero(new le(b.x/D,b.y/D),0);R!==0&&(r[14]+=R)}}function Ed(r,e,i=!1){r.uploaded||(r.gfxTexture=new x_(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}function J1(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,q1.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,X1.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,W1.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?H1:Z1).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,K1.members,!0)),r.segments=Ar.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const s=r.material;s.pbrMetallicRoughness.baseColorTexture&&Ed(s.pbrMetallicRoughness.baseColorTexture,e),s.pbrMetallicRoughness.metallicRoughnessTexture&&Ed(s.pbrMetallicRoughness.metallicRoughnessTexture,e),s.normalTexture&&Ed(s.normalTexture,e),s.occlusionTexture&&Ed(s.occlusionTexture,e,i),s.emissionTexture&&Ed(s.emissionTexture,e)}function E_(r,e,i){if(r.meshes)for(const s of r.meshes)J1(s,e,i);if(r.children)for(const s of r.children)E_(s,e,i)}function Mf(r){if(r.meshes)for(const e of r.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(r.children)for(const e of r.children)Mf(e)}function I_(r){if(r.meshes)for(const i of r.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(r.children)for(const i of r.children)I_(i)}class Bu{constructor(e,i,s){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=s}static create(e,i,s){const a=s||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,h=a.tileID,f=1<<i.canonical.z-h.canonical.z;return new Bu(a,u.dim/Je/f,[(i.canonical.x/f-h.canonical.x)*u.dim,(i.canonical.y/f-h.canonical.y)*u.dim])}tileCoordToPixel(e,i){const s=i*this._scale+this._offset[1],a=Math.floor(e*this._scale+this._offset[0]),u=Math.floor(s);return new Xe(a,u)}getElevationAt(e,i,s,a){const u=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],f=Math.floor(u),_=Math.floor(h),g=this._dem;return a=!!a,s?Ft(Ft(g.get(f,_,a),g.get(f,_+1,a),h-_),Ft(g.get(f+1,_,a),g.get(f+1,_+1,a),h-_),u-f):g.get(f,_,a)}getElevationAtPixel(e,i,s){return this._dem.get(e,i,!!s)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*ie(1,e)*this._dem.stride}}const A_=new Float32Array(262144),yc=new Uint8Array(262144);function Gx(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,Gx(i));return e}function $x(r,e,i){if(r.meshes)for(const s of r.meshes){if(s.aabb.min[0]===1/0)continue;const a=Ci.applyTransform(s.aabb,r.matrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const s of r.children)$x(s,e,i)}const qx=["","wall","door","roof","window","lamp","logo"];class Hx{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Gx(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new Ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const s of this.node.meshes)this.node.lightMeshIndex!==e&&(s.transformedAabb=Ci.applyTransformFast(s.aabb,this.node.matrix),i.encapsulate(s.transformedAabb)),e++;this.aabb=i}return this.aabb}}class Cf{constructor(e,i,s,a,u,h,f,_){this.id=s,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=Ou.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=Ou.HasMapbox
15MeshFeatures),u&&(this.modelTraits|=Ou.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new Hx(g)),$x(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const s of this.getNodesInfo()){const a=s.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const s=i?this.stateDependentLayers:this.layers;if(!ks(e,this.states))for(const a of s)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const s of i){const a=s.node;this.uploaded?this.updatePbrBuffer(a):E_(a,e,!0)}for(const s of i)Mf(s.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const s of e.meshes)s.pbrBuffer&&(s.pbrBuffer.updateData(s.featureArray),i=!0);return i}needsReEvaluation(e,i,s){const a=e.transform.projectionOptions,u=e.style.getBrightness(),h=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||Id(s.paint.get("model-color").value,h)||Id(s.paint.get("model-color-mix-intensity").value,h)||Id(s.paint.get("model-roughness").value,h)||Id(s.paint.get("model-emissive-strength").value,h)||Id(s.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=a,this.brightness=u;const f=this.getNodesInfo();for(const _ of f)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const s=this.getNodesInfo(),a=this.id.canonical;for(const u of s){const h=u.feature;u.evaluatedTranslation=i.paint.get("model-translation").evaluate(h,{},a),u.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e,i){const s=this.getNodesInfo();for(const a of s){if(!a.node.meshes)continue;const u=a.feature,h=i&&i[u.id];if(ks(h,a.state))continue;a.state=structuredClone(h);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],g=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<qx.length;b++){const w=qx[b];w.length&&(u.properties.part=w);const E=e.paint.get("model-color").evaluate(u,h,v).toPremultipliedRenderColor(null),A=e.paint.get("model-color-mix-intensity").evaluate(u,h,v);a.evaluatedColor[b]=[E.r,E.g,E.b,A],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(u,h,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v),a.evaluatedRMEA[b][3]=E.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(u,h,v),!a.hasTranslucentParts&&E.a<1&&(a.hasTranslucentParts=!0)}delete u.properties.part,eb(a,_!==a.evaluatedColor[2]||g!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(u,h,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(u,h,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,s,a){const u=e.findDEMTileFor(s);if(u&&(u.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(u.dem&&u.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=u.tileID.overscaledZ;const h=Bu.create(e,s,u);if(!h)return;
15this.modelTraits&Ou.HasMapboxMeshFeatures&&this.updateDEM(e,h,s,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const g=_.footprint.vertices;let v=h.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)v=Math.min(v,h.getElevationAt(g[b].x,g[b].y,!0,!0));_.elevation=v}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,s,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(s.canonical))return;const h=i._dem.dim;u.push(s.canonical);let f=!1;for(const _ of this.getNodesInfo()){const g=_.node;if(!g.footprint||!g.footprint.grid)continue;const v=g.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),w=i.tileCoordToPixel(v.max.x,v.max.y),E=Math.min(Math.min(h-w.y,b.x),Math.min(b.y,h-w.x));if(E<0)continue;const A=Q(E,2,5);let P=Math.max(0,b.x-A),D=Math.max(0,b.y-A),F=Math.min(w.x+A,h-1),j=Math.min(w.y+A,h-1);for(let $=D;$<=j;++$)for(let Z=P;Z<=F;++Z)yc[$*h+Z]=255;let G=0,R=0;for(let $=0;$<v.cellsY;++$)for(let Z=0;Z<v.cellsX;++Z){if(!v.cells[$*v.cellsX+Z])continue;const oe=i.tileCoordToPixel(v.min.x+Z/v.xScale,v.min.y+$/v.yScale),re=i.tileCoordToPixel(v.min.x+(Z+1)/v.xScale,v.min.y+($+1)/v.yScale);for(let ae=oe.y;ae<=Math.min(re.y+1,h-1);++ae)for(let he=oe.x;he<=Math.min(re.x+1,h-1);++he)yc[ae*h+he]===255&&(yc[ae*h+he]=0,G+=i.getElevationAtPixel(he,ae),R++)}const N=G/R;P=Math.max(1,b.x-A),D=Math.max(1,b.y-A),F=Math.min(w.x+A,h-2),j=Math.min(w.y+A,h-2),f=!0;for(let $=D;$<=j;++$)for(let Z=P;Z<=F;++Z)yc[$*h+Z]===0&&(A_[$*h+Z]=i._dem.set(Z,$,N));for(let $=1;$<A;++$){P=Math.max(1,b.x-$),D=Math.max(1,b.y-$),F=Math.min(w.x+$,h-2),j=Math.min(w.y+$,h-2);for(let Z=D;Z<=j;++Z)for(let oe=P;oe<=F;++oe){const re=Z*h+oe;if(yc[re]===255){let ae=0,he=0,Se=-1,Be=-1;for(let ze=-1;ze<=1;++ze)for(let Oe=-1;Oe<=1;++Oe){const Ne=(Z+ze)*h+oe+Oe;if(yc[Ne]>=$)continue;const Ie=A_[Ne],ke=Math.abs(Ie);ke>he&&(ae=Ie,he=ke,Se=Oe,Be=ze)}if(he>.1){const ze=1-($+.5*Math.abs(Se*Be))/A;let Oe=i._dem.get(oe,Z)+ae*ze;const Ne=i._dem.get(oe+Se,Z+Be),Ie=i._dem.get(oe-Se,Z-Be,!0);(Oe-Ne)*(Oe-Ie)>0&&(Oe=(Ne+Ie)/2),A_[re]=i._dem.set(oe,Z,Oe),yc[re]=$}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=fs.now())}setFilter(e){this.filter=e?zh(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Wi(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Mf(i.node),I_(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const u=a.node.footprint;a.hiddenByReplacement=!!u&&!s.find(h=>h.footprint===u)}}getHeightAtTileCoord(e,i){const s=[],a=[0,0,0],u=Ke([]);for(const h of this.getNodesInfo()){const f=h.node.meshes[0],_=f.transformedAabb;if(e<_.min[0]||i<_.min[1]||e>_.max[0]||i>_.max[1])continue;if(h.node.hidden===!0)return{height:1/0,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};xt(u,h.node.matrix),a[0]=e,a[1]=i,dr(a,a,u);const g=(a[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*gc|0,v=Math.min(63,(a[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*gc|0)*gc+Math.min(63,g),b=f.heightmap[v];if(!(b<0&&h.node.footprint))return h.hiddenByReplacement?void 0:{height:b,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};if(h.node.footprint.grid.query(new Xe(e,i),new Xe(e,i),s),s.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}function Id(r,e){return r instanceof $l&&!r.isLightConstant&&e}function Q1(r,e,i,s,a,u,h,f){let _=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=Ft(_,255*i[0],i[3]),g=Ft(g,255*i[1],i[3]),v=Ft(v,255*i[2],i[3]));const b=_<<8|g,w=v<<8|Math.floor(255*s[3]),E=function($){const Z=Q($,0,2);return Math.min(Math.round(.5*Z*255),255)}(s[2])<<8|15*s[0]<<4|15*s[1],A=Q(a[0],0,1),P=Q(a[1],0,1),D=Q(a[2],0,1),F=Q(a[3],0,1);let j,G,R,N;if(A!==P&&h!==u&&P!==A){const $=h-u;G=1/($*(P-A)),R=-(u+$*A)/($*(P-A));const Z=Q(a[4],-1,1);N=Math.pow(10,Z),j=255*D<<8|255*F}else j=65535,G=0,R=1,N=1;if(r.emplaceBack(b,w,E,j,G,R,N),f){const $=f.length;f.clear();for(let Z=0;Z<$;Z++)f.emplaceBack(b,w,E,j,G,R,N)}}function eb(r,e,i){const s=r.node;let a=0;const u=i&Ou.HasMeshoptCompression;for(const h of s.meshes){if(s.lights&&s.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new ic,h.featureArray.reserve(h.featureData.length);let f=e;for(const _ of h.featureData){const g=u?65535&_:_>>16&65535,v=u?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,w=r.evaluatedRMEA[b],E=r.evaluatedColor[b],A=r.emissionHeightBasedParams[b];let P;if(f&&b===2&&s.lights&&(P=new ic,P.resize(10*s.lights.length)),Q1(h.featureArray,g,E,w,A,h.aabb.min[2],h.aabb.max[2],P),P&&f){f=!1;const D=s.meshes[s.lightMeshIndex];D.featureArray=P,D.featureArray._trim()}}h.featureArray._trim(),a++}}function Zx(r,e,i,s){const a=1<<r.z;e.lat=fe((s/Je+r.y)/a),e.lng=ne((i/Je+r.x)/a)}function tb(r,e,i,s){const a=r.getNodesInfo()[e];
vendor: 17,846 bytes, line 15
15if(!a||a.hiddenByReplacement||!a.node.meshes)return;let u=Number.MAX_VALUE;const h=a.node,f=i.tile,_=s.calculatePosMatrix(f.tileID.toUnwrapped(),s.worldSize),g=a.evaluatedScale;let v=0;s.elevation&&h.elevation&&(v=h.elevation*s.elevation.exaggeration()),It(_,_,[(h.anchor?h.anchor[0]:0)*(g[0]-1),(h.anchor?h.anchor[1]:0)*(g[1]-1),v]),kt(_,_,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,E=function(P){const D=Ze([],_,P.matrix);Ze(D,s.expandedFarZProjMatrix,D);for(let F=0;F<P.meshes.length;++F){const j=P.meshes[F];if(F===P.lightMeshIndex)continue;const G=Fx(w,s,D,j.aabb);G!=null&&(u=Math.min(G,u))}if(P.children)for(const F of P.children)E(F)};if(E(h),u===Number.MAX_VALUE)return;const A=new V(0,0);return Zx(f.tileID.canonical,A,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:u,position:A,feature:a.feature}}st(Cf,"Tiled3dModelBucket",{omit:["layers"]}),st(Hx,"Tiled3dModelFeature");const ib={circle:class extends yn{constructor(r,e,i,s){super(r,{layout:q_||(q_=new Er({"circle-sort-key":new it(pe.layout_circle["circle-sort-key"]),"circle-elevation-reference":new Ve(pe.layout_circle["circle-elevation-reference"]),visibility:new Ve(pe.layout_circle.visibility)})),paint:H_||(H_=new Er({"circle-radius":new it(pe.paint_circle["circle-radius"]),"circle-color":new it(pe.paint_circle["circle-color"]),"circle-blur":new it(pe.paint_circle["circle-blur"]),"circle-opacity":new it(pe.paint_circle["circle-opacity"]),"circle-translate":new Ve(pe.paint_circle["circle-translate"]),"circle-translate-anchor":new Ve(pe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ve(pe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ve(pe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new it(pe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new it(pe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new it(pe.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Ve(pe.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}createBucket(r){return new hs(r)}queryRadius(r){const e=r;return Iu("circle-radius",this,e)+Iu("circle-stroke-width",this,e)+Vp(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,s,a,u,h,f){const _=$_(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return sg(r,s,u,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const s=ng(this);return{config:new Ja(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends yn{createBucket(r){return new ag(r)}constructor(r,e,i,s){super(r,{layout:lg||(lg=new Er({visibility:new Ve(pe.layout_heatmap.visibility)})),paint:cg||(cg=new Er({"heatmap-radius":new it(pe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new it(pe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ve(pe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new na(pe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ve(pe.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ed({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(r){return Iu("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,s,a,u,h,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return sg(r,s,u,h,f,!0,!0,new Xe(0,0),_)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new Ja(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends yn{constructor(r,e,i,s){super(r,{layout:ug||(ug=new Er({visibility:new Ve(pe.layout_hillshade.visibility)})),paint:hg||(hg=new Er({"hillshade-illumination-direction":new Ve(pe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ve(pe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ve(pe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ve(pe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ve(pe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ve(pe.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Ve(pe.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends yn{constructor(r,e,i,s){super(r,{layout:Ig||(Ig=new Er({"fill-sort-key":new it(pe.layout_fill["fill-sort-key"]),visibility:new Ve(pe.layout_fill.visibility),"fill-elevation-reference":new Ve(pe.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new it(pe.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Ag||(Ag=new Er({"fill-antialias":new Ve(pe.paint_fill["fill-antialias"]),"fill-opacity":new it(pe.paint_fill["fill-opacity"]),"fill-color":new it(pe.paint_fill["fill-color"]),"fill-outline-color":new it(pe.paint_fill["fill-outline-color"]),"fill-translate":new Ve(pe.paint_fill["fill-translate"]),"fill-translate-anchor":new Ve(pe.paint_fill["fill-translate-anchor"]),"fill-pattern":new it(pe.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new Ve(pe.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new Ve(pe.paint_fill["fill-emissive-strength"]),"fill-z-offset":new it(pe.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new it(pe.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new it(pe.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new Ja(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new Bm(r)}queryRadius(){return Vp(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,s,a,u){return!r.queryGeometry.isAboveHorizon&&bs(G_(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),s)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends yn{constructor(r,e,i,s){super(r,{layout:Jg||(Jg=new Er({visibility:new Ve(pe["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Ve(pe["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Qg||(Qg=new Er({"fill-extrusion-opacity":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new it(pe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new it(pe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new it(pe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new it(pe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new it(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new it(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new it(pe["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new it(pe["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Qp(r)}queryRadius(){return Vp(this.paint.get("fill-extrusion-translate"))}is3D(r){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(r,e,i,s,a,u,h,f,_){const g=$_(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],E=f&&u.elevation,A=u.elevation?u.elevation.exaggeration():1,P=r.tile.getBucket(this);if(E&&P instanceof Qp){const R=P.centroidVertexArray,N=_+1;N<R.length&&(w[0]=R.geta_centroid_pos0(N),w[1]=R.geta_centroid_pos1(N))}if(w[0]===0&&w[1]===1)return!1;u.projection.name==="globe"&&(s=Kg([s],[new Xe(0,0),new Xe(Je,Je)],r.tileID.canonical).map(R=>R.polygon).flat());const D=E?f:null,[F,j]=function(R,N,$,Z,oe,re,ae,he,Se,Be,ze){return R.projection.name==="globe"?function(Oe,Ne,Ie,ke,we,Ee,je,$e,vt,ht,et){const Ue=[],Ht=[],ut=Oe.projection.upVectorScale(et,Oe.center.lat,Oe.worldSize).metersToTile,pt=[0,0,0,1],Ot=[0,0,0,1],ti=(hi,ni,di,Ni)=>{hi[0]=ni,hi[1]=di,hi[2]=Ni,hi[3]=1},Qt=Yg();Ie>0&&(Ie+=Qt),ke+=Qt;for(const hi of Ne){const ni=[],di=[];for(const Ni of hi){const nr=Ni.x+we.x,q=Ni.y+we.y,W=Oe.projection.projectTilePoint(nr,q,et),Ae=Oe.projection.upVector(et,Ni.x,Ni.y);let He=Ie,tt=ke;if(je){const Qe=sy(nr,q,Ie,ke,je,$e,vt,ht);He+=Qe.base,tt+=Qe.top}Ie!==0?ti(pt,W.x+Ae[0]*ut*He,W.y+Ae[1]*ut*He,W.z+Ae[2]*ut*He):ti(pt,W.x,W.y,W.z),ti(Ot,W.x+Ae[0]*ut*tt,W.y+Ae[1]*ut*tt,W.z+Ae[2]*ut*tt),dr(pt,pt,Ee),dr(Ot,Ot,Ee),ni.push(new pc(pt[0],pt[1],pt[2])),di.push(new pc(Ot[0],Ot[1],Ot[2]))}Ue.push(ni),Ht.push(di)}return[Ue,Ht]}(R,N,$,Z,oe,re,ae,he,Se,Be,ze):ae?function(Oe,Ne,Ie,ke,we,Ee,je,$e,vt){const ht=[],et=[],Ue=[0,0,0,1];for(const Ht of Oe){const ut=[],pt=[];for(const Ot of Ht){const ti=Ot.x+ke.x,Qt=Ot.y+ke.y,hi=sy(ti,Qt,Ne,Ie,Ee,je,$e,vt);Ue[0]=ti,Ue[1]=Qt,Ue[2]=hi.base,Ue[3]=1,Tn(Ue,Ue,we),Ue[3]=Math.max(Ue[3],1e-5);const ni=new pc(Ue[0]/Ue[3],Ue[1]/Ue[3],Ue[2]/Ue[3]);Ue[0]=ti,Ue[1]=Qt,Ue[2]=hi.top,Ue[3]=1,Tn(Ue,Ue,we),Ue[3]=Math.max(Ue[3],1e-5);const di=new pc(Ue[0]/Ue[3],Ue[1]/Ue[3],Ue[2]/Ue[3]);ut.push(ni),pt.push(di)}ht.push(ut),et.push(pt)}return[ht,et]}(N,$,Z,oe,re,ae,he,Se,Be):function(Oe,Ne,Ie,ke,we){const Ee=[],je=[],$e=we[8]*Ne,vt=we[9]*Ne,ht=we[10]*Ne,et=we[11]*Ne,Ue=we[8]*Ie,Ht=we[9]*Ie,ut=we[10]*Ie,pt=we[11]*Ie;for(const Ot of Oe){const ti=[],Qt=[];for(const hi of Ot){const ni=hi.x+ke.x,di=hi.y+ke.y,Ni=we[0]*ni+we[4]*di+we[12],nr=we[1]*ni+we[5]*di+we[13],q=we[2]*ni+we[6]*di+we[14],W=we[3]*ni+we[7]*di+we[15],Ae=Ni+$e,He=nr+vt,tt=q+ht,Qe=Math.max(W+et,1e-5),ct=Ni+Ue,Dt=nr+Ht,_i=q+ut,gi=Math.max(W+pt,1e-5);ti.push(new pc(Ae/Qe,He/Qe,tt/Qe)),Qt.push(new pc(ct/gi,Dt/gi,_i/gi))}Ee.push(ti),je.push(Qt)}return[Ee,je]}(N,$,Z,oe,re)}(u,s,b,v,g,h,D,w,A,u.center.lat,r.tileID.canonical),G=r.queryGeometry;return function(R,N,$){let Z=1/0;bs($,N)&&(Z=ny($,N[0]));for(let oe=0;oe<N.length;oe++){const re=N[oe],ae=R[oe];for(let he=0;he<re.length-1;he++){const Se=re[he],Be=[Se,re[he+1],ae[he+1],ae[he],Se];Fn($,Be)&&(Z=Math.min(Z,ny($,Be)))}}return Z!==1/0&&Z}(F,j,G.isPointQuery()?G.screenBounds:G.screenGeometry)}},building:class extends yn{constructor(r,e,i,s){super(r,{layout:gy||(gy=new Er({visibility:new Ve(pe.layout_building.visibility),"building-roof-shape":new it(pe.layout_building["building-roof-shape"]),"building-height":new it(pe.layout_building["building-height"]),"building-base":new it(pe.layout_building["building-base"])})),paint:yy||(yy=new Er({"building-opacity":new Ve(pe.paint_building["building-opacity"]),"building-ambient-occlusion-wall-intensity":new Ve(pe.paint_building["building-ambient-occlusion-wall-intensity"]),"building-ambient-occlusion-ground-intensity":new Ve(pe.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Ve(pe.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Ve(pe.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Ve(pe.paint_building["building-vertical-scale"]),"building-cast-shadows":new Ve(pe.paint_building["building-cast-shadows"]),"building-color":new it(pe.paint_building["building-color"]),"building-emissive-strength":new it(pe.paint_building["building-emissive-strength"]),"building-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new _y(r)}},line:class extends yn{constructor(r,e,i,s){const a=My();super(r,a,e,i,s),a.layout&&(this.layout=new ra(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Ol,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>
15{if(fd)return fd;const i=My();return fd=new Q0(i.paint.properties["line-width"].specification),fd.useIntegerZoom=!0,fd})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Km(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const s=Iy(this);return{config:new Ja(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}queryRadius(r){const e=r,i=Cy(Iu("line-width",this,e),Iu("line-gap-width",this,e)),s=Iu("line-offset",this,e);return i/2+Math.abs(s)+Vp(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,s,a,u){if(r.queryGeometry.isAboveHorizon)return!1;const h=G_(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*Cy(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),_=this.paint.get("line-offset").evaluate(e,i);return _&&(s=function(g,v){const b=[],w=new Xe(0,0);for(let E=0;E<g.length;E++){const A=g[E],P=[];for(let D=0;D<A.length;D++){const F=A[D],j=A[D+1],G=D===0?w:F.sub(A[D-1])._unit()._perp(),R=D===A.length-1?w:j.sub(F)._unit()._perp(),N=G._add(R)._unit();N._mult(1/(N.x*R.x+N.y*R.y)),P.push(N._mult(v)._add(F))}b.push(P)}return b}(s,_*r.pixelToTileUnitsFactor)),function(g,v,b){for(let w=0;w<v.length;w++){const E=v[w];if(g.length>=3){for(let A=0;A<E.length;A++)if(Ps(g,E[A]))return!0}if(Mo(g,E,b))return!0}return!1}(h,s,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:bf,background:class extends yn{constructor(r,e,i,s){super(r,{layout:xx||(xx=new Er({visibility:new Ve(pe.layout_background.visibility)})),paint:vx||(vx=new Er({"background-pitch-alignment":new Ve(pe.paint_background["background-pitch-alignment"]),"background-color":new Ve(pe.paint_background["background-color"]),"background-pattern":new Ve(pe.paint_background["background-pattern"]),"background-opacity":new Ve(pe.paint_background["background-opacity"]),"background-emissive-strength":new Ve(pe.paint_background["background-emissive-strength"]),"background-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:Ex,"raster-particle":Rx,sky:class extends yn{constructor(r,e,i,s){super(r,{layout:Mx||(Mx=new Er({visibility:new Ve(pe.layout_sky.visibility)})),paint:Cx||(Cx=new Er({"sky-type":new Ve(pe.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ve(pe.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ve(pe.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ve(pe.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ve(pe.paint_sky["sky-gradient-radius"]),"sky-gradient":new na(pe.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ve(pe.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ve(pe.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ve(pe.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=ed({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}
15needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const s=this.paint.get("sky-atmosphere-sun"),a=!s,u=r.style.light,h=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&ii("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?v_(h.azimuthal,90-h.polar,e):v_(s[0],90-s[1],e)}const i=this.paint.get("sky-gradient-center");return v_(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends yn{constructor(r,e,i,s){super(r,{paint:Px||(Px=new Er({}))},e,null)}},model:class extends yn{constructor(r,e,i,s){super(r,{layout:Vx||(Vx=new Er({visibility:new Ve(pe.layout_model.visibility),"model-id":new it(pe.layout_model["model-id"])})),paint:Ux||(Ux=new Er({"model-opacity":new it(pe.paint_model["model-opacity"]),"model-rotation":new it(pe.paint_model["model-rotation"]),"model-scale":new it(pe.paint_model["model-scale"]),"model-translation":new it(pe.paint_model["model-translation"]),"model-color":new it(pe.paint_model["model-color"]),"model-color-mix-intensity":new it(pe.paint_model["model-color-mix-intensity"]),"model-type":new Ve(pe.paint_model["model-type"]),"model-cast-shadows":new Ve(pe.paint_model["model-cast-shadows"]),"model-receive-shadows":new Ve(pe.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Ve(pe.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new it(pe.paint_model["model-emissive-strength"]),"model-roughness":new it(pe.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new it(pe.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Ve(pe.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Ve(pe.paint_model["model-front-cutoff"]),"model-color-use-theme":new it({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new S_(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof Cf?Je-1:0}queryIntersectsFeature(r,e,i,s,a,u){if(!this.modelManager)return!1;const h=this.modelManager,f=r.tile.getBucket(this);if(!(f&&f instanceof S_))return!1;for(const _ in f.instancesPerModel){const g=f.instancesPerModel[_],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(g.idToFeaturesIndex.hasOwnProperty(v)){const b=g.features[g.idToFeaturesIndex[v]],w=h.getModel(_,this.scope);if(!w)return!1;let E=jt();const A=new V(0,0),P=f.canonical;let D=Number.MAX_VALUE;for(let F=0;F<b.instancedDataCount;++F){const j=16*(b.instancedDataOffset+F),G=g.instancedDataArray.float32,R=[G[j+4],G[j+5],G[j+6]];Zx(P,A,G[j],0|G[j+1]),jx(E,w,u,A,b.rotation,b.scale,R,!1,!1,!1),u.projection.name==="globe"&&(E=w_(E,u));const N=Ze([],u.projMatrix,E),$=r.queryGeometry,Z=Fx($.isPointQuery()?$.screenBounds:$.screenGeometry,u,N,w.aabb);Z!=null&&(D=Math.min(Z,D))}return D!==Number.MAX_VALUE&&D}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof ql}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends yn{constructor(r,e,i,s){super(r,{layout:Mg||(Mg=ne
15w Er({"clip-layer-types":new Ve(pe.layout_clip["clip-layer-types"]),"clip-layer-scope":new Ve(pe.layout_clip["clip-layer-scope"])})),paint:Cg||(Cg=new Er({}))},e,i,s)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new Pg(r)}is3D(r){return!0}}},M_=new Fi(0,0,0),C_={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},P_={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},Pf={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},rb={PAINT_ORDER_FILL_AND_STROKE:1},Ad={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},Wx={MASK_TYPE_LUMINANCE:1};function nb(r,e,i){r===1&&e.icons.push(function(s,a){return function(u){if(u.usvg_tree.height||(u.usvg_tree.height=u.usvg_tree.width),!u.metadata)return u;const{metadata:h}=u;if(h.content_area){const{content_area:f}=h;f.top==null&&(f.top=f.left),f.width==null&&(f.width=u.usvg_tree.width),f.height==null&&(f.height=f.width)}return h.stretch_x&&h.stretch_x.length&&Xx(h,"x"),h.stretch_y&&h.stretch_y.length&&Xx(h,"y"),u}(s.readFields(sb,{name:void 0},a))}(i,i.readVarint()+i.pos))}function Xx(r,e){const i=[],s=r[`stretch_${e}`];let a=null;for(let u=0;u<s.length;u++)a===null?a=i.length===0?s[0]:i[i.length-1][1]+s[u]:(i.push([a,a+s[u]]),a=null);r[`stretch_${e}_areas`]=i}function sb(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=function(s,a){return s.readFields(ob,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)}(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=function(s,a){return s.readFields(cb,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function ob(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=function(s,a){return s.readFields(ab,{left:0},a)}(i,i.readVarint()+i.pos):r===4&&e.variables.push(function(s,a){return s.readFields(lb,{name:void 0},a)}(i,i.readVarint()+i.pos))}function ab(r,e,i){r===1?e.left=i.readVarint():r===2?e.width=i.readVarint():r===3?e.top=i.readVarint():r===4&&(e.height=i.readVarint())}function lb(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=Df(i.readVarint()),e.value="rgb_color")}function cb(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(Rf(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push(function(s,a){return s.readFields(_b,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)}(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push(function(s,a){return s.readFields(yb,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)}(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push(function(s,a){return s.readFields(xb,{children:[]},a)}(i,i.readVarint()+i.pos)):r===8&&e.masks.push(function(s,a){const u=s.readFields(vb,{left:0,width:20,mask_type:Wx.MASK_TYPE_LUMINANCE,children:[]},a);return u.height==null&&(u.height=u.width),u.top==null&&(u.top=u.left),u}(i,i.readVarint()+i.pos))}function Rf(r,e){return r.readFields(ub,{},e)}function ub(r,e,i){r===1?(e.group=function(s,a){return s.readFields(hb,{opacity:255,children:[]},a)}(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=function(s,a){return s.readFields(pb,{paint_order:1,commands:[],step:1,diffs:[],rule:C_.PATH_RULE_NON_ZERO},a)}(i,i.readVarint()+i.pos),e.node="path")}function hb(r,e,i){r===1?e.transform=zf(i,i.readVarint()+i.pos):r===2?e.opacity=i.readVarint():r===5?e.clip_path_idx=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(Rf(i,i.readVarint()+i.pos))}function zf(r,e){return r.readFields(db,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function db(r,e,i){r===1?e.sx=i.readFloat():r===2?e.ky=i.readFloat():r===3?e.kx=i.readFloat():r===4?e.sy=i.readFloat():r===5?e.tx=i.readFloat():r===6&&(e.ty=i.readFloat())}function pb(r,e,i){r===1?e.fill=function(s,a){return s.readFields(fb,{rgb_color:M_,paint:"rgb_color",opacity:255},a)}(i,i.readVarint()+i.pos):r===2?e.stroke=function(s,a){return s.readFields(mb,{rgb_color:M_,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)}(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.
15step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function fb(r,e,i){r===1?(e.rgb_color=Df(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=i.readVarint())}function Df(r){return new Fi((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function mb(r,e,i){r===1?(e.rgb_color=Df(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5?i.readPackedFloat(e.dasharray):r===6?e.dashoffset=i.readFloat():r===7?e.miterlimit=i.readFloat():r===8?e.opacity=i.readVarint():r===9?e.width=i.readFloat():r===10?e.linecap=i.readVarint():r===11&&(e.linejoin=i.readVarint())}function _b(r,e,i){r===1?e.transform=zf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Yx(i,i.readVarint()+i.pos)):r===4?e.x1=i.readFloat():r===5?e.y1=i.readFloat():r===6?e.x2=i.readFloat():r===7&&(e.y2=i.readFloat())}function Yx(r,e){return r.readFields(gb,{offset:0,opacity:255,rgb_color:M_},e)}function gb(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=Df(i.readVarint()))}function yb(r,e,i){r===1?e.transform=zf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Yx(i,i.readVarint()+i.pos)):r===4?e.cx=i.readFloat():r===5?e.cy=i.readFloat():r===6?e.r=i.readFloat():r===7?e.fx=i.readFloat():r===8?e.fy=i.readFloat():r===9&&(e.fr=i.readFloat())}function xb(r,e,i){r===1?e.transform=zf(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(Rf(i,i.readVarint()+i.pos))}function vb(r,e,i){r===1?e.left=e.top=i.readFloat():r===2?e.width=e.height=i.readFloat():r===3?e.top=i.readFloat():r===4?e.height=i.readFloat():r===5?e.mask_type=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(Rf(i,i.readVarint()+i.pos))}class bb{static calculate(e={},i=[]){const s=new Map,a=new Map;if(Object.keys(e).length===0)return s;i.forEach(u=>{a.set(u.name,u.rgb_color||new Fi(0,0,0))});for(const[u,h]of Object.entries(e))a.has(u)?s.set(a.get(u).toString(),h):console.warn(`Ignoring unknown image variable "${u}"`);return s}}function Nu(r,e=255,i){const s=e/255,a=r.toString(),u=i.has(a)?i.get(a).clone():r.clone();return u.a*=s,u.toString()}function Md(r,e){if(!Mc()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}function wb(r,e){const i=bb.calculate(e.params,r.metadata?r.metadata.variables:[]),s=r.usvg_tree,a=s.width,u=s.height,h=e.transform?e.transform:new DOMMatrix,f=Math.max(1,Math.round(a*h.a)),_=Math.max(1,Math.round(u*h.d)),g=new DOMMatrix([f/a,0,0,_/u,0,0]),v=Md(f,_).getContext("2d");return R_(v,g,s,s,i),v.getImageData(0,0,f,_)}function R_(r,e,i,s,a){for(const u of s.children)Kx(r,e,i,u,a)}function Kx(r,e,i,s,a){s.group?(r.save(),function(u,h,f,_,g){const v=_.mask_idx!=null?f.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?f.clip_paths[_.clip_path_idx]:null;if(_.transform&&(h=Vu(_.transform).preMultiplySelf(h)),!function(A,P,D){return A.opacity!==255||P||D}(_,b!=null,v!=null))return void R_(u,h,f,_,g);const w=Md(u.canvas.width,u.canvas.height),E=w.getContext("2d");R_(E,h,f,_,g),b&&nv(E,h,f,b),v&&sv(E,h,f,v,g),u.globalAlpha=_.opacity/255,u.drawImage(w,0,0)}(r,e,i,s.group,a),r.restore()):s.path&&(r.save(),function(u,h,f,_,g){u.setTransform(h),_.paint_order===rb.PAINT_ORDER_FILL_AND_STROKE?(Jx(u,f,_,g),ev(u,f,_,g)):(ev(u,f,_,g),Jx(u,f,_,g))}(r,e,i,s.path,a),r.restore())}function Jx(r,e,i,s){const a=i.fill;if(!a)return;const u=a.opacity/255;switch(r.save(),r.beginPath(),ov(i,r),a.paint){case"rgb_color":r.fillStyle=Nu(a.rgb_color,a.opacity,s);break;case"linear_gradient_idx":{const h=e.linear_gradients[a.linear_gradient_idx];h.transform&&r.setTransform(Vu(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=tv(r,h,u,s);break}case"radial_gradient_idx":{const h=e.radial_gradients[a.radial_gradient_idx];h.transform&&r.setTransform(Vu(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=iv(r,h,u,s)}}
15r.fill(Qx(i)),r.restore()}function Qx(r){return r.rule===C_.PATH_RULE_NON_ZERO?"nonzero":r.rule===C_.PATH_RULE_EVEN_ODD?"evenodd":void 0}function ev(r,e,i,s){const a=i.stroke;if(!a)return;const u=av(i);r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const h=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=Nu(a.rgb_color,a.opacity,s);break;case"linear_gradient_idx":r.strokeStyle=tv(r,e.linear_gradients[a.linear_gradient_idx],h,s,!0);break;case"radial_gradient_idx":r.strokeStyle=iv(r,e.radial_gradients[a.radial_gradient_idx],h,s,!0)}switch(a.linejoin){case Pf.LINE_JOIN_MITER_CLIP:case Pf.LINE_JOIN_MITER:r.lineJoin="miter";break;case Pf.LINE_JOIN_ROUND:r.lineJoin="round";break;case Pf.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(a.linecap){case P_.LINE_CAP_BUTT:r.lineCap="butt";break;case P_.LINE_CAP_ROUND:r.lineCap="round";break;case P_.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(u)}function tv(r,e,i,s,a=!1){if(e.stops.length===1){const w=e.stops[0];return Nu(w.rgb_color,w.opacity*i,s)}const{x1:u,y1:h,x2:f,y2:_}=e;let g=new DOMPoint(u,h),v=new DOMPoint(f,_);if(a){const w=Vu(e.transform);g=w.transformPoint(g),v=w.transformPoint(v)}const b=r.createLinearGradient(g.x,g.y,v.x,v.y);for(const w of e.stops)b.addColorStop(w.offset,Nu(w.rgb_color,w.opacity*i,s));return b}function iv(r,e,i,s,a=!1){if(e.stops.length===1){const F=e.stops[0];return Nu(F.rgb_color,F.opacity*i,s)}const u=Vu(e.transform),{fx:h,fy:f,fr:_,cx:g,cy:v,r:b}=e;let w=new DOMPoint(h,f),E=new DOMPoint(g,v),A=_,P=b;if(a){w=u.transformPoint(w),E=u.transformPoint(E);const F=(u.a+u.d)/2;A=_*F,P=e.r*F}const D=r.createRadialGradient(w.x,w.y,A,E.x,E.y,P);for(const F of e.stops)D.addColorStop(F.offset,Nu(F.rgb_color,F.opacity*i,s));return D}function rv(r,e,i,s){const a=s.transform?Vu(s.transform).preMultiplySelf(e):e,u=Md(r.canvas.width,r.canvas.height),h=u.getContext("2d");for(const _ of s.children)if(_.group)rv(h,a,i,_.group);else if(_.path){const g=_.path,v=new Path2D;v.addPath(av(g),a),h.fill(v,Qx(g))}const f=s.clip_path_idx!=null?i.clip_paths[s.clip_path_idx]:null;f&&nv(h,a,i,f),r.globalCompositeOperation="source-over",r.drawImage(u,0,0)}function nv(r,e,i,s){const a=Md(r.canvas.width,r.canvas.height);rv(a.getContext("2d"),e,i,s),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function sv(r,e,i,s,a){if(s.children.length===0)return;const u=s.mask_idx!=null?i.masks[s.mask_idx]:null;u&&sv(r,e,i,u,a);const h=r.canvas.width,f=r.canvas.height,_=Md(h,f),g=_.getContext("2d"),v=s.width,b=s.height,w=s.left,E=s.top,A=new Path2D,P=new Path2D;P.rect(w,E,v,b),A.addPath(P,e),g.clip(A);for(const j of s.children)Kx(g,e,i,j,a);const D=g.getImageData(0,0,h,f),F=D.data;if(s.mask_type===Wx.MASK_TYPE_LUMINANCE)for(let j=0;j<F.length;j+=4)F[j+3]=F[j+3]/255*(.2126*F[j]+.7152*F[j+1]+.0722*F[j+2]);g.putImageData(D,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function Vu(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function ov(r,e){const i=r.step;let s=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(s,a);for(let u=0,h=2;u<r.commands.length;u++)switch(r.commands[u]){case Ad.PATH_COMMAND_MOVE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.moveTo(s,a);break;case Ad.PATH_COMMAND_LINE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.lineTo(s,a);break;case Ad.PATH_COMMAND_QUAD:{const f=s+r.diffs[h++]*i,_=a+r.diffs[h++]*i;s=f+r.diffs[h++]*i,a=_+r.diffs[h++]*i,e.quadraticCurveTo(f,_,s,a);break}case Ad.PATH_COMMAND_CUBIC:{const f=s+r.diffs[h++]*i,_=a+r.diffs[h++]*i,g=f+r.diffs[h++]*i,v=_+r.diffs[h++]*i;s=g+r.diffs[h++]*i,a=v+r.diffs[h++]*i,e.bezierCurveTo(f,_,g,v,s,a);break}case Ad.PATH_COMMAND_CLOSE:e.closePath()}return e}function av(r){return ov(r,new Path2D)}class Lf{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}st(Lf,"LRUCache");class z_{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new un(e,e.data)}getFromCache(e,i,s){return this.cacheMap.has(s)||this.cacheMap.set(s,new Lf(150)),this.cacheMap.get(s).get(sa(e.toString(),i))}setInCache(e,i,s,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new Lf(150));const u=this.cacheDependenciesMap.get(a),h=sa(e.id.toString(),s);u.get(h)||u.set(h,new Set);const f=this.cacheMap.get(a),_=e.toString();u.get(h).add(_),f.put(sa(e.toString(),s),i)}removeImagesFromCacheByIds(e,i,s=0){if(!this.cacheMap.has(s)||!this.cacheDependenciesMap.has(s))return;const a=this.cacheMap.get(s),u=this.cacheDependenciesMap.get(s);for(const h of e){const f=sa(h.toString(),i);if(u.has(f)){for(const _ of u.get(f))a.delete(_);u.delete(f)}}}rasterize(e,i,s,a,u=wb){const h=this.getFromCache(e,s,a);if(h)return h.clone();const f=u(i.icon,e.options),_=z_._getImage(f);return this.setInCache(e,_,s,a),_.clone()}}class lv{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const s=this.toIdx(e,i);return{min:this.minimums[s],max:this.maximums[s]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function cv(r,e,i,s){let a=0,u=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(s[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const f=1/s[h];let _=(r[h]-i[h])*f,g=(e[h]-i[h])*f;if(_>g){const v=_;_=g,g=v}if(_>a&&(a=_),g<u&&(u=g),a>u)return null}return a}function uv(r,e,i,s,a,u,h,f,_,g,v){const b=s-r,w=a-e,E=u-i,A=h-r,P=f-e,D=_-i,F=v[1]*D-v[2]*P,j=v[2]*A-v[0]*D,G=v[0]*P-v[1]*A,R=b*F+w*j+E*G;if(Math.abs(R)<1e-15)return null;const N=1/R,$=g[0]-r,Z=g[1]-e,oe=g[2]-i,re=($*F+Z*j+oe*G)*N;if(re<0||re>1)return null;const ae=Z*E-oe*w,he=oe*b-$*E,Se=$*w-Z*b,Be=(v[0]*ae+v[1]*he+v[2]*Se)*N;return Be<0||re+Be>1?null:(A*ae+P*he+D*Se)*N}
15function hv(r,e,i){return(r-e)/(i-e)}function dv(r,e,i,s,a,u,h,f,_){const g=1<<i,v=u-s,b=h-a,w=(r+1)/g*v+s,E=(e+0)/g*b+a,A=(e+1)/g*b+a;f[0]=(r+0)/g*v+s,f[1]=E,_[0]=w,_[1]=A}class pv{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(u){const h=Math.ceil(Math.log2(u.dim/8)),f=[];let _=Math.ceil(Math.pow(2,h));const g=1/_,v=(E,A,P,D,F)=>{const j=D?1:0,G=(E+1)*P-j,R=A*P,N=(A+1)*P-j;F[0]=E*P,F[1]=R,F[2]=G,F[3]=N};let b=new lv(_);const w=[];for(let E=0;E<_*_;E++){v(E%_,Math.floor(E/_),g,!1,w);const A=al(w[0],w[1],u),P=al(w[2],w[1],u),D=al(w[2],w[3],u),F=al(w[0],w[3],u);b.minimums.push(Math.min(A,P,D,F)),b.maximums.push(Math.max(A,P,D,F)),b.leaves.push(1)}for(f.push(b),_/=2;_>=1;_/=2){const E=f[f.length-1];b=new lv(_);for(let A=0;A<_*_;A++){v(A%_,Math.floor(A/_),2,!0,w);const P=E.getElevation(w[0],w[1]),D=E.getElevation(w[2],w[1]),F=E.getElevation(w[2],w[3]),j=E.getElevation(w[0],w[3]),G=E.isLeaf(w[0],w[1]),R=E.isLeaf(w[2],w[1]),N=E.isLeaf(w[2],w[3]),$=E.isLeaf(w[0],w[3]),Z=Math.min(P.min,D.min,F.min,j.min),oe=Math.max(P.max,D.max,F.max,j.max),re=G&&R&&N&&$;b.maximums.push(oe),b.minimums.push(Z),b.leaves.push(oe-Z<=5&&re?1:0)}f.push(b)}return f}(this.dem),s=i.length-1,a=i[s];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,s,0)}raycastRoot(e,i,s,a,u,h,f=1){return cv([e,i,-100],[s,a,this.maximums[0]*f],u,h)}raycast(e,i,s,a,u,h,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,s,a,u,h,f);if(_==null)return null;const g=[],v=[],b=[],w=[],E=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;E.length>0;){const{idx:A,t:P,nodex:D,nodey:F,depth:j}=E.pop();if(this.leaves[A]){dv(D,F,j,e,i,s,a,b,w);const R=1<<j,N=(D+0)/R,$=(D+1)/R,Z=(F+0)/R,oe=(F+1)/R,re=al(N,Z,this.dem)*f,ae=al($,Z,this.dem)*f,he=al($,oe,this.dem)*f,Se=al(N,oe,this.dem)*f,Be=uv(b[0],b[1],re,w[0],b[1],ae,w[0],w[1],he,u,h),ze=uv(w[0],w[1],he,b[0],w[1],Se,b[0],b[1],re,u,h),Oe=Math.min(Be!==null?Be:Number.MAX_VALUE,ze!==null?ze:Number.MAX_VALUE);if(Oe!==Number.MAX_VALUE)return Oe;{const Ne=Jr([],u,h,P);if(fv(re,ae,Se,he,hv(Ne[0],b[0],w[0]),hv(Ne[1],b[1],w[1]))>=Ne[2])return P}continue}let G=0;for(let R=0;R<this._siblingOffset.length;R++){dv((D<<1)+this._siblingOffset[R][0],(F<<1)+this._siblingOffset[R][1],j+1,e,i,s,a,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[A]+R]*f;const N=cv(b,w,u,h);if(N!=null){const $=N;g[R]=$;let Z=!1;for(let oe=0;oe<G&&!Z;oe++)$>=g[v[oe]]&&(v.splice(oe,0,R),Z=!0);Z||(v[G]=R),G++}}for(let R=0;R<G;R++){const N=v[R];E.push({idx:this.childOffsets[A]+N,t:g[N],nodex:(D<<1)+this._siblingOffset[N][0],nodey:(F<<1)+this._siblingOffset[N][1],depth:j+1})}}return null}_addNode(e,i,s){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(s),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,s,a,u){if(e[a].isLeaf(i,s)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const h=a-1,f=e[h];let _=0,g=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],w=2*s+this._siblingOffset[v][1],E=f.getElevation(b,w),A=f.isLeaf(b,w),P=this._addNode(E.min,E.max,A);A&&(_|=1<<v),g||(g=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*s+this._siblingOffset[v][1],h,g+v)}}function fv(r,e,i,s,a,u){return Ft(Ft(r,i,u),Ft(e,s,u),a)}function al(r,e,i){const s=i.dim,a=Q(r*s-.5,0,s-1),u=Q(e*s-.5,0,s-1),h=Math.floor(a),f=Math.floor(u),_=Math.min(h+1,s-1),g=Math.min(f+1,s-1);return fv(i.get(h,f),i.get(_,f),i.get(h,g),i.get(_,g),a-h,u-f)}const Tb={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Sb(r,e,i){return(256*r*256+256*e+i)/10-1e4}function Eb(r,e,i){return 256*r+e+i/256-32768}class kf{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,s,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void ii(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const u=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let _=0;_<u;_++)h[this._idx(-1,_)]=h[this._idx(0,_)],h[this._idx(u,_)]=h[this._idx(u-1,_)],h[this._idx(_,-1)]=h[this._idx(_,0)],h[this._idx(_,u)]=h[this._idx(_,u-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(u,-1)]=h[this._idx(u-1,0)],h[this._idx(-1,u)]=h[this._idx(0,u-1)],h[this._idx(u,u)]=h[this._idx(u-1,u-1)]}const f=s==="terrarium"?Eb:Sb;for(let _=0;_<h.length;++_){const g=4*_;this.floatView[_]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=fs.now()}_buildQuadTree(){this._tree=new pv(this)}get(e,i,s=!1){s&&(e=Q(e,-1,this.dim),i=Q(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,s){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=s,s-u}static getUnpackVector(e){return Tb[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const s=[0,0,0,0],a=kf.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return s[2]=u%256,u=Math.floor(u/256),s[1]=u%256,u=Math.floor(u/256),s[0]=u,s}getPixels(){return new fg({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,h=s*this.dim,f=s*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(s){case-1:h=f-1;break;case 1:f=h+1}const _=-i*this.dim,g=-s*this.dim;for(let v=h;v<f;v++)for(let b=a;b<u;b++){const w=4*this._idx(b,v),E=4*this._idx(b+_,v+g);this.pixels[w+0]=e.pixels[E+0],this.pixels[w+1]=e.pixels[E+1],this.pixels[w+2]=e.pixels[E+2],this.pixels[w+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function Ib(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push(function(s,a){return s.readFields(Rb,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)}(i,i.readVarint()+i.pos))}function Ab(r,e,i){r===1?(e.delta_filter=function(s,a){return s.readFields(Mb,{blockSize:0},a)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function Mb(r,e,i){r===1&&(e.blockSize=i.readVarint())}function Cb(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function Pb(r,e,i){let s=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push(function(u,h){return u.readFields(Ab,{},h)}(i,i.readVarint()+i.pos)):r===4?e.codec=function(u,h){return u.readFields(Cb,{},h)}(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?s=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=s)}function Rb(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push(function(s,a){return s.readFields(Pb,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)}(i,i.readVarint()+i.pos))}function zb(r,e,i){if(r===2)(function(s,a,u){s.readFields(Db,u,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function Db(r,e,i){if(r===1){let s=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[s++]=i.readVarint()}}
vendor: 7,191 bytes, line 15
15function Lb(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let s=2;s>=1;s--){const a=s===1?1:0,u=s===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let _=a;_<e[1];_++){const g=e[2]*(_+f);for(let v=u;v<e[2];v++){const b=e[3]*(v+g);for(let w=0;w<e[3];w++){const E=b+w;r[E]+=r[E-i]}}}}i*=e[s]}return r}function kb(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function Fb(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const s=r[i],a=r[i+1];r[i]=(240&s)>>4|(61440&s)>>8|(240&a)<<4|61440&a,r[i+1]=15&s|(3840&s)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const s=r[i],a=r[i+1],u=r[i+2],h=r[i+3];r[i+0]=(192&s)>>6|(192&a)>>4|(192&u)>>2|192&h,r[i+1]=(48&s)>>4|(48&a)>>2|48&u|(48&h)<<2,r[i+2]=(12&s)>>2|12&a|(12&u)<<2|(12&h)<<4,r[i+3]=3&s|(3&a)<<2|(3&u)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}st(kf,"DEMData"),st(pv,"DemMinMaxQuadTree",{omit:["dem"]});var ws=Uint8Array,Cd=Uint16Array,Ob=Int32Array,mv=new ws([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),_v=new ws([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Bb=new ws([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gv=function(r,e){for(var i=new Cd(31),s=0;s<31;++s)i[s]=e+=1<<r[s-1];var a=new Ob(i[30]);for(s=1;s<30;++s)for(var u=i[s];u<i[s+1];++u)a[u]=u-i[s]<<5|s;return{b:i,r:a}},yv=gv(mv,2),xv=yv.b,Nb=yv.r;xv[28]=258,Nb[258]=28;for(var Vb=gv(_v,0).b,vv=new Cd(32768),Zr=0;Zr<32768;++Zr){var Uu=(43690&Zr)>>1|(21845&Zr)<<1;vv[Zr]=((65280&(Uu=(61680&(Uu=(52428&Uu)>>2|(13107&Uu)<<2))>>4|(3855&Uu)<<4))>>8|(255&Uu)<<8)>>1}var Pd=function(r,e,i){for(var s=r.length,a=0,u=new Cd(e);a<s;++a)r[a]&&++u[r[a]-1];var h,f=new Cd(e);for(a=1;a<e;++a)f[a]=f[a-1]+u[a-1]<<1;h=new Cd(1<<e);var _=15-e;for(a=0;a<s;++a)if(r[a])for(var g=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,w=b|(1<<v)-1;b<=w;++b)h[vv[b]>>_]=g;return h},Rd=new ws(288);for(Zr=0;Zr<144;++Zr)Rd[Zr]=8;for(Zr=144;Zr<256;++Zr)Rd[Zr]=9;for(Zr=256;Zr<280;++Zr)Rd[Zr]=7;for(Zr=280;Zr<288;++Zr)Rd[Zr]=8;var bv=new ws(32);for(Zr=0;Zr<32;++Zr)bv[Zr]=5;var Ub=Pd(Rd,9),jb=Pd(bv,5),D_=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Js=function(r,e,i){var s=e/8|0;return(r[s]|r[s+1]<<8)>>(7&e)&i},L_=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},Gb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Qs=function(r,e,i){var s=new Error(e||Gb[r]);if(s.code=r,Error.captureStackTrace&&Error.captureStackTrace(s,Qs),!i)throw s;return s},$b=new ws(0),qb=typeof TextDecoder<"u"&&new TextDecoder;try{qb.decode($b,{stream:!0})}catch{}const Hb={gzip_data:"gzip"};class Rs extends Error{constructor(e){super(e),this.name="MRTError"}}const Zb={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},wv={uint32:1,uint16:2,uint8:4},Wb={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let k_;class Ff{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new Rs(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),s=new DataView(e);if(i[0]!==13)throw new Rs("File is not a valid MRT.");return s.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),s=this.getHeaderLength(e);if(i.length<s)throw new Rs(`Expected header with length >= ${s} but got buffer of length ${i.length}`);const a=function(u,h){return u.readFields(Ib,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new k_(i.subarray(0,s)));if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new Rs(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const u of a.layers)this.layers[u.name]=new Tv(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],s=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=s.dataIndex[a],h=u.firstByte-e.firstByte,f=u.lastByte-e.firstByte;if(s._blocksInProgress.has(a))continue;const _={layerName:s.name,firstByte:h,lastByte:f,pixelFormat:s.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(s.bandShape),buffer:s.buffer,codec:u.codec.codec,filters:u.filters.map(g=>g.filter)};s._blocksInProgress.add(a),i.push(_)}return new Sv(i,()=>{i.forEach(a=>s._blocksInProgress.delete(a.blockIndex))},(a,u)=>{if(i.forEach(h=>s._blocksInProgress.delete(h.blockIndex)),a)throw a;u.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class Tv{constructor({version:e,name:i,units:s,tileSize:a,pixelFormat:u,buffer:h,dataIndex:f},_){if(this.version=e,this.version!==1)throw new Rs(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=s,this.tileSize=a,this.buffer=h,this.pixelFormat=Zb[u],this.dataIndex=f,this.bandShape=[a+2*h,a+2*h,wv[this.pixelFormat]],this._decodedBlocks=new Lf(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return wv[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[s,a]of this.dataIndex.entries()){for(const[u,h]of a.bands.entries())if(h===e)return{bandIndex:i+u,blockIndex:s,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[s,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:s,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new Rs(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,s=-1/0;const a=[],u=new Set;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new Rs(`Invalid band: ${JSON.stringify(h)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),u.add(f),i=Math.min(i,_.firstByte),s=Math.max(s,_.lastByte)}if(u.size>this.cacheSize)throw new Rs(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:s,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:s}=this.getBlockForBand(e);if(i<0)throw new Rs(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new Rs(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],h=this.bandShape.reduce((g,v)=>g*v,1),f=s*h,_=a.subarray(f,f+h);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:u.offset,scale:u.scale}}}
15Ff.setPbf=function(r){k_=r};class Sv{constructor(e,i,s){this.tasks=e,this._onCancel=i,this._onComplete=s,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}function xc(r,e){const i=r.json.bufferViews[e.bufferView],s=rf[e.componentType];return new s(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==pd[e.type]*s.BYTES_PER_ELEMENT?i.byteStride/s.BYTES_PER_ELEMENT:pd[e.type]))}function F_(r,e,i,s){const a=rf[e.componentType],u=function(v){switch(v){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(a),h=r.json.bufferViews[e.bufferView],f=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:pd[e.type],_=i.float32,g=_.length/i.capacity;for(let v=0,b=0;v<e.count*f;v+=f,b+=g)for(let w=0;w<g;w++)_[b+w]=s[v+w]*u;i._trim()}function Xb(r,e,i){const s=r.indices,a=r.attributes,u={};u.indexArray=new sn;const h=e.json.accessors[s],f=h.count/3;u.indexArray.reserve(f);const _=xc(e,h);for(let w=0;w<f;w++)u.indexArray.emplaceBack(_[3*w],_[3*w+1],_[3*w+2]);u.indexArray._trim(),u.vertexArray=new As;const g=e.json.accessors[a.POSITION];u.vertexArray.reserve(g.count);const v=xc(e,g);for(let w=0;w<g.count;w++)u.vertexArray.emplaceBack(v[3*w],v[3*w+1],v[3*w+2]);if(u.vertexArray._trim(),u.aabb=new Ci(g.min,g.max),u.centroid=function(w,E){const A=[0,0,0],P=w.length;if(P>0){for(let D=0;D<P;D++){const F=3*w[D];A[0]+=E[F],A[1]+=E[F+1],A[2]+=E[F+2]}A[0]/=P,A[1]/=P,A[2]/=P}return A}(_,v),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],E=pd[w.type],A=xc(e,w);u.colorArray=E===3?new As:new nn,u.colorArray.resize(w.count),F_(e,w,u.colorArray,A)}if(a.NORMAL!==void 0){u.normalArray=new As;const w=e.json.accessors[a.NORMAL];u.normalArray.resize(w.count);const E=xc(e,w);F_(e,w,u.normalArray,E)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new oa;const w=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(w.count);const E=xc(e,w);F_(e,w,u.texcoordArray,E)}if(a._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=xc(e,w))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(xc(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return u.material=function(w,E){const{emissiveFactor:A=[0,0,0],alphaMode:P="OPAQUE",alphaCutoff:D=.5,normalTexture:F,occlusionTexture:j,emissiveTexture:G,doubleSided:R}=w,{baseColorFactor:N=[1,1,1,1],metallicFactor:$=1,roughnessFactor:Z=1,baseColorTexture:oe,metallicRoughnessTexture:re}=w.pbrMetallicRoughness||{},ae=j?E[j.index]:void 0;if(j&&j.extensions&&j.extensions.KHR_texture_transform&&ae){const he=j.extensions.KHR_texture_transform;ae.offsetScale=[he.offset[0],he.offset[1],he.scale[0],he.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Fi(...N),metallicFactor:$,roughnessFactor:Z,baseColorTexture:oe?E[oe.index]:void 0,metallicRoughnessTexture:re?E[re.index]:void 0},doubleSided:R,emissiveFactor:new Fi(...A),alphaMode:P,alphaCutoff:D,normalTexture:F?E[F.index]:void 0,occlusionTexture:ae,emissionTexture:G?E[G.index]:void 0,defined:w.defined===void 0}}(b!==void 0?e.json.materials[b]:{defined:!1},i),u}function Ev(r,e,i){const{matrix:s,rotation:a,translation:u,scale:h,mesh:f,extras:_,children:g}=r,v={};if(v.matrix=s||function(b,w,E,A){var P=w[0],D=w[1],F=w[2],j=w[3],G=P+P,R=D+D,N=F+F,$=P*G,Z=P*R,oe=P*N,re=D*R,ae=D*N,he=F*N,Se=j*G,Be=j*R,ze=j*N,Oe=A[0],Ne=A[1],Ie=A[2];return b[0]=(1-(re+he))*Oe,b[1]=(Z+ze)*Oe,b[2]=(oe-Be)*Oe,b[3]=0,b[4]=(Z-ze)*Ne,b[5]=(1-($+he))*Ne,b[6]=(ae+Se)*Ne,b[7]=0,b[8]=(oe+Be)*Ie,b[9]=(ae-Se)*Ie,b[10]=(1-($+re))*Ie,b[11]=0,b[12]=E[0],b[13]=E[1],b[14]=E[2],b[15]=1,b}([],a||[0,0,0,1],u||[0,0,0],h||[1,1,1]),f!==void 0){v.meshes=i[f];const b=v.anchor=[0,0];for(const w of v.meshes){const{min:E,max:A}=w.aabb;b[0]+=E[0]+A[0],b[1]+=E[1]+A[1]}b[0]=Math.floor(b[0]/v.meshes.length/2),b[1]=Math.floor(b[1]/v.meshes.length/2)}if(_&&(_.id&&(v.id=_.id),_.lights&&(v.lights=function(b){if(!b.length)return[];const w=function(F){const j=atob(F),G=new Uint8Array(j.length);for(let R=0;R<j.length;R++)G[R]=j.codePointAt(R);return G}
15(b),E=[],A=w.length/24,P=new Uint16Array(w.buffer),D=new Float32Array(w.buffer);for(let F=0;F<A;F++){const j=P[2*F*6]/30,G=P[2*F*6+1]/30,R=P[2*F*6+10]/100,N=D[6*F+1],$=D[6*F+2],Z=D[6*F+3],oe=D[6*F+4],re=Z-N,ae=oe-$,he=Math.hypot(re,ae);E.push({pos:[N+.5*re,$+.5*ae,G],normal:[ae/he,-re/he,0],width:he,height:j,depth:R,points:[N,$,Z,oe]})}return E}(_.lights))),g){const b=[];for(const w of g)b.push(Ev(e.json.nodes[w],e,i));v.children=b}return v}function Yb(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new Nm(r.vertices,r.indices,8,256),[i,s]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:s}}function Kb(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const s=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],_=h[1];typeof f=="number"&&typeof _=="number"&&s.push(new Xe(f,_))}if(s.length<3)return null;s.length>1&&s[s.length-1].equals(s[0])&&s.pop();let a=0;for(let h=0;h<s.length;h++){const f=s[h],_=s[(h+1)%s.length],g=s[(h+2)%s.length];a+=(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)}a>0&&s.reverse();const u=td(s.flatMap(h=>[h.x,h.y]),[]);return u.length===0?null:{vertices:s,indices:u}}function Jb(r,e){const i=[],s=[];let a=0;const u=[];for(const h of r){a=i.length;const f=h.vertexArray.float32,_=h.indexArray.uint16;for(let g=0;g<h.vertexArray.length;g++)u[0]=f[3*g+0],u[1]=f[3*g+1],u[2]=f[3*g+2],dr(u,u,e),i.push(new Xe(u[0],u[1]));for(let g=0;g<3*h.indexArray.length;g++)s.push(_[g]+a)}if(s.length%3!=0)return null;for(let h=0;h<s.length;h+=3){const f=i[s[h+0]],_=i[s[h+1]],g=i[s[h+2]];(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)>0&&([s[h+1],s[h+2]]=[s[h+2],s[h+1]])}return{vertices:i,indices:s}}function Iv(r){const e=function(_,g){const v=[],b=WebGL2RenderingContext;if(_.json.textures)for(const w of _.json.textures){const E={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};w.sampler!==void 0&&Object.assign(E,_.json.samplers[w.sampler]),v.push({image:g[w.source],sampler:E,uploaded:!1})}return v}(r,r.images),i=function(_,g){const v=[];for(const b of _.json.meshes){const w=[];for(const E of b.primitives)w.push(Xb(E,_,g));v.push(w)}return v}(r,e),{scenes:s,scene:a,nodes:u}=r.json,h=s?s[a||0].nodes:u,f=[];for(const _ of h)f.push(Ev(u[_],r,i));return function(_,g,v){const b={},w=new Set;for(let E=0;E<_.length;E++){const A=v[g[E]];if(!A.extras)continue;const P=A.extras["mapbox:footprint:version"],D=A.extras["mapbox:footprint:id"];(P||D)&&w.add(E),P==="1.0.0"&&D&&(b[D]=E)}for(let E=0;E<_.length;E++){if(w.has(E))continue;const A=_[E],P=v[g[E]];if(!P.extras)continue;let D=null;A.id in b&&(D=Jb(_[b[A.id]].meshes,A.matrix)),D||(D=Kb(P)),D&&(A.footprint=Yb(D))}if(w.size>0){const E=Array.from(w.values()).sort((A,P)=>A-P);for(let A=E.length-1;A>=0;A--)_.splice(E[A],1)}}(f,h,r.json.nodes),f}function Qb(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,s=r.aabb.min[1]-1,a=gc/(r.aabb.max[0]-i+2),u=gc/(r.aabb.max[1]-s+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],_=(e[h+0]-i)*a|0,g=(e[h+1]-s)*u|0;f>r.heightmap[g*gc+_]&&(r.heightmap[g*gc+_]=f)}}function ew(r,e){const i={};i.indexArray=new sn,i.indexArray.reserve(4*r.length),i.vertexArray=new As,i.vertexArray.reserve(10*r.length),i.colorArray=new nn,i.vertexArray.reserve(10*r.length);let s=0;for(const h of r){const f=Math.min(10,Math.max(4,1.3*h.height))*e,_=[-h.normal[1],h.normal[0],0],g=Math.min(.29,.1*h.width/h.depth),v=h.width-2*h.depth*e*(g+.01),b=Jr([],h.pos,_,v/2),w=Jr([],h.pos,_,-v/2),E=[b[0],b[1],b[2]+h.height],A=[w[0],w[1],w[2]+h.height],P=Jr([],h.normal,_,g);Zi(P,P,f);const D=Jr([],h.normal,_,-g);Zi(D,D,f),ki(P,b,P),ki(D,w,D),b[2]+=.1,w[2]+=.1,i.vertexArray.emplaceBack(P[0],P[1],P[2]),i.vertexArray.emplaceBack(D[0],D[1],D[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(E[0],E[1],E[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(P[0],P[1],P[2]),i.vertexArray.emplaceBack(D[0],D[1],D[2]);const F=v/f/2;i.colorArray.emplaceBack(-F-g,-1,F,.8),i.colorArray.emplaceBack(F+g,-1,F,.8),i.colorArray.emplaceBack(-F,0,F,1.3),i.colorArray.emplaceBack(F,0,F,1.3),i.colorArray.emplaceBack(F+g,-.8,F,.7),i.colorArray.emplaceBack(F+g,-.8,F,.7),i.colorArray.emplaceBack(0,0,F,1.3),i.colorArray.emplaceBack(0,0,F,1.3),i.colorArray.emplaceBack(F+g,-1.2,F,.8),i.colorArray.emplaceBack(F+g,-1.2,F,.8),i.indexArray.emplaceBack(6+s,4+s,8+s),i.indexArray.emplaceBack(7+s,9+s,5+s),i.indexArray.emplaceBack(0+s,1+s,2+s),i.indexArray.emplaceBack(1+s,3+s,2+s),s+=10}const a={defined:!0};a.emissiveFactor=Fi.black;const u={};return u.baseColorFactor=Fi.white,a.pbrMetallicRoughness=u,i.material=a,i.aabb=new Ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}Ff.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(s=>{const{layerName:a,firstByte:u,lastByte:h,pixelFormat:f,blockShape:_,blockIndex:g,filters:v,codec:b}=s,w=i.subarray(u,h+1),E=new Uint32Array(_[0]*_[1]*_[2]);let A;if(b!=="gzip_data")throw new Rs(`Unhandled codec: ${b}`);return A=function(P,D){if(!globalThis.DecompressionStream&&D==="gzip_data")return Promise.resolve(((R=function(Z){Z[0]==31&&Z[1]==139&&Z[2]==8||Qs(6,"invalid gzip data");var oe=Z[3],re=10;4&oe&&(re+=2+(Z[10]|Z[11]<<8));for(var ae=(oe>>3&1)+(oe>>4&1);ae>0;ae-=!Z[re++]);return re+(2&oe)}(G=P))+8>G.length&&Qs(6,"invalid gzip data"),function(Z,oe,re,ae){var he=Z.length;
15if(!he||oe.f&&!oe.l)return re||new ws(0);var Se=!re,Be=Se||oe.i!=2,ze=oe.i;Se&&(re=new ws(3*he));var Oe,Ne,Ie=function(zr){var ur=re.length;if(zr>ur){var tr=new ws(Math.max(2*ur,zr));tr.set(re),re=tr}},ke=oe.f||0,we=oe.p||0,Ee=oe.b||0,je=oe.l,$e=oe.d,vt=oe.m,ht=oe.n,et=8*he;do{if(!je){ke=Js(Z,we,1);var Ue=Js(Z,we+1,3);if(we+=3,!Ue){var Ht=Z[(q=4+((we+7)/8|0))-4]|Z[q-3]<<8,ut=q+Ht;if(ut>he){ze&&Qs(0);break}Be&&Ie(Ee+Ht),re.set(Z.subarray(q,ut),Ee),oe.b=Ee+=Ht,oe.p=we=8*ut,oe.f=ke;continue}if(Ue==1)je=Ub,$e=jb,vt=9,ht=5;else if(Ue==2){var pt=Js(Z,we,31)+257,Ot=Js(Z,we+10,15)+4,ti=pt+Js(Z,we+5,31)+1;we+=14;for(var Qt=new ws(ti),hi=new ws(19),ni=0;ni<Ot;++ni)hi[Bb[ni]]=Js(Z,we+3*ni,7);we+=3*Ot;var di=D_(hi),Ni=(1<<di)-1,nr=Pd(hi,di);for(ni=0;ni<ti;){var q,W=nr[Js(Z,we,Ni)];if(we+=15&W,(q=W>>4)<16)Qt[ni++]=q;else{var Ae=0,He=0;for(q==16?(He=3+Js(Z,we,3),we+=2,Ae=Qt[ni-1]):q==17?(He=3+Js(Z,we,7),we+=3):q==18&&(He=11+Js(Z,we,127),we+=7);He--;)Qt[ni++]=Ae}}var tt=Qt.subarray(0,pt),Qe=Qt.subarray(pt);vt=D_(tt),ht=D_(Qe),je=Pd(tt,vt),$e=Pd(Qe,ht)}else Qs(1);if(we>et){ze&&Qs(0);break}}Be&&Ie(Ee+131072);for(var ct=(1<<vt)-1,Dt=(1<<ht)-1,_i=we;;_i=we){var gi=(Ae=je[L_(Z,we)&ct])>>4;if((we+=15&Ae)>et){ze&&Qs(0);break}if(Ae||Qs(2),gi<256)re[Ee++]=gi;else{if(gi==256){_i=we,je=null;break}var si=gi-254;gi>264&&(si=Js(Z,we,(1<<(yi=mv[ni=gi-257]))-1)+xv[ni],we+=yi);var Gi=$e[L_(Z,we)&Dt],er=Gi>>4;if(Gi||Qs(3),we+=15&Gi,Qe=Vb[er],er>3){var yi=_v[er];Qe+=L_(Z,we)&(1<<yi)-1,we+=yi}if(we>et){ze&&Qs(0);break}Be&&Ie(Ee+131072);var br=Ee+si;if(Ee<Qe){var sr=0-Qe,Vi=Math.min(Qe,br);for(sr+Ee<0&&Qs(3);Ee<Vi;++Ee)re[Ee]=(void 0)[sr+Ee]}for(;Ee<br;++Ee)re[Ee]=re[Ee-Qe]}}oe.l=je,oe.p=_i,oe.b=Ee,oe.f=ke,je&&(ke=1,oe.m=vt,oe.d=$e,oe.n=ht)}while(!ke);return Ee!=re.length&&Se?(Oe=re,((Ne=Ee)==null||Ne>Oe.length)&&(Ne=Oe.length),new ws(Oe.subarray(0,Ne))):re.subarray(0,Ee)}(G.subarray(R,-8),{i:2},new ws(((F=G)[(j=F.length)-4]|F[j-3]<<8|F[j-2]<<16|F[j-1]<<24)>>>0))));var F,j,G,R;const N=Hb[D];if(!N)throw new Error(`Unhandled codec: ${D}`);const $=new globalThis.DecompressionStream(N);return new Response(new Blob([P]).stream().pipeThrough($)).arrayBuffer().then(Z=>new Uint8Array(Z))}(w,b).then(P=>(function(D,F){D.readFields(zb,F)}(new k_(P),E),new Wb[f](E.buffer))),A.then(P=>{for(let D=v.length-1;D>=0;D--)switch(v[D]){case"delta_filter":Lb(P,_);break;case"zigzag_filter":kb(P);break;case"bitshuffle_filter":Fb(P,f);break;default:throw new Rs(`Unhandled filter "${v[D]}"`)}return{layerName:a,blockIndex:g,data:P}}).catch(P=>{throw P})}))},st(Sv,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),st(Ff,"MapboxRasterTile"),st(Tv,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class Av{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const tw=["id","tile","layer","source","sourceLayer","state"];class ju{constructor(e,i,s,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=s,this._y=a,this.properties=e.properties,this.id=u}clone(){const e=new ju(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of tw)this[i]!==void 0&&(e[i]=this[i]);return e}}class Mv{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Gs(Je,16,0),this.featureIndexArray=new Dp,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,s,a,u,h=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,u,h);const g=this.grid;for(let v=0;v<i.length;v++){const b=i[v],w=[1/0,1/0,-1/0,-1/0];for(let E=0;E<b.length;E++){const A=b[E];w[0]=Math.min(w[0],A.x),w[1]=Math.min(w[1],A.y),w[2]=Math.max(w[2],A.x),w[3]=Math.max(w[3],A.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<Je&&w[1]<Je&&w[2]>=0&&w[3]>=0&&g.insert(_,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new oi.VectorTile(new sf(this.rawTileData)).layers,this.sourceLayerCoder=new Av(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:s,transform:a,tileTransform:u,pixelPosMatrix:h,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=s.bufferedTilespaceBounds,v=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(A,P,D,F)=>el(s.bufferedTilespaceGeometry,A,P,D,F));v.sort(iw);let b=null;a.elevation&&v.length>0&&(b=Bu.create(a.elevation,this.tileID));const w={};let E;for(let A=0;A<v.length;A++){const P=v[A];if(P===E)continue;E=P;const D=this.featureIndexArray.get(P);let F=null;
vendor: 4,734 bytes, line 15
15this.is3DTile?this.loadMatchingModelFeature(w,D,e,s,a,_):this.loadMatchingFeature(w,D,e,f,_,(j,G,R,N=0)=>(F||(F=at(j,this.tileID.canonical,u)),G.queryIntersectsFeature(s,j,R,F,this.z,a,h,b,N)))}return w}loadMatchingFeature(e,i,s,a,u,h){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],w=s.layers,E=Object.keys(w);if(E.length&&!Wt(E,b))return;const A=s.sourceCache,P=this.sourceLayerCoder.decode(g),D=this.vtLayers[P].feature(f),F=this.getId(D,P);for(let j=0;j<b.length;j++){const G=b[j];if(!w[G])continue;const{styleLayer:R,targets:N}=w[G];let $={};F!==void 0&&($=A.getFeatureState(R.sourceLayer,F));const Z=!h||h(D,R,$,v);if(!Z)continue;const oe=new ju(D,this.z,this.x,this.y,F);oe.tile=this.tileID.canonical,oe.state=$;let re=this.serializedLayersCache.get(G);re||(re=R.serialize(),re.id=G,this.serializedLayersCache.set(G,re)),oe.source=re.source,oe.sourceLayer=re["source-layer"],oe.layer=ye({},re),oe.layer.paint=Cv(re.paint,R.paint,D,$,a),oe.layer.layout=Cv(re.layout,R.layout,D,$,a);let ae=!1;for(const he of N){this.updateFeatureProperties(oe,he);const{filter:Se}=he;if(Se){if(D.properties=oe.properties,Se.needGeometry){const Be=rt(D,!0);if(!Se.filter(new Wi(this.tileID.overscaledZ,{worldview:u}),Be,this.tileID.canonical))continue}else if(!Se.filter(new Wi(this.tileID.overscaledZ,{worldview:u}),D))continue}ae=!0,he.targetId&&this.addFeatureVariant(oe,he)}ae&&this.appendToResult(e,G,f,oe,Z)}}loadMatchingModelFeature(e,i,s,a,u,h){const{featureIndex:f,bucketIndex:_}=i,g=this.bucketLayerIDs[_],v=s.layers,b=Object.keys(v);if(!b.length||Wt(b,g))for(let w=0;w<g.length;w++){const E=g[w],{styleLayer:A,targets:P}=v[E];if(A.type!=="model")continue;const D=a.tile,F=D.getBucket(A);if(!(F&&F instanceof Cf))continue;const j=tb(F,f,a,u);if(!j)continue;const{z:G,x:R,y:N}=D.tileID.canonical,{feature:$,intersectionZ:Z,position:oe}=j;let re={};$.id!==void 0&&(re=s.sourceCache.getFeatureState(A.sourceLayer,$.id));const ae=new ju({},G,R,N,$.id);ae.tile=this.tileID.canonical,ae.state=re,ae.properties=$.properties,ae.geometry={type:"Point",coordinates:[oe.lng,oe.lat]};let he=this.serializedLayersCache.get(E);he||(he=A.serialize(),he.id=E,this.serializedLayersCache.set(E,he)),ae.source=he.source,ae.sourceLayer=he["source-layer"],ae.layer=ye({},he);let Se=!1;for(const Be of P){this.updateFeatureProperties(ae,Be);const{filter:ze}=Be;if(ze){if($.properties=ae.properties,ze.needGeometry){if(!ze.filter(new Wi(this.tileID.overscaledZ,{worldview:h}),$,this.tileID.canonical))continue}else if(!ze.filter(new Wi(this.tileID.overscaledZ,{worldview:h}),$))continue}Se=!0,Be.targetId&&this.addFeatureVariant(ae,Be)}Se&&this.appendToResult(e,E,f,ae,Z)}}updateFeatureProperties(e,i,s){if(i.properties){const a={};for(const u in i.properties){const h=i.properties[u].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,s);h!=null&&(a[u]=h)}e.properties=a}}addFeatureVariant(e,i,s){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,s,a,u){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:s,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,s,a,u,h){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:s,featureIndex:_,layoutVertexArrayOffset:0},a,u,h);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:s}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(s),u=this.vtFeatures[a];if(u[i])return u[i];const h=this.vtLayers[a].feature(i);return u[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){let s=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=js(a);if(u.result!=="success"){const h=u.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void ii(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=u.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new zl),s=this.promoteIdExpression.evaluate({zoom:0},e)}else s=e.properties[a];typeof s=="boolean"&&(s=Number(s))}return s}}function Cv(r,e,i,s,a){return ft(r,(u,h)=>{const f=e instanceof ra?e.get(h):null;return f&&f.evaluate?f.evaluate(i,s,void 0,a):f})}function iw(r,e){return e-r}st(Mv,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Pv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,391 bytes, line 15
15];class O_{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=Pv[15&s];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new O_(f,h,u,e)}constructor(e,i=64,s=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Pv.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return B_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:f}=this,_=[0,u.length-1,0],g=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,w=_.pop()||0;if(b-w<=f){for(let D=w;D<=b;D++){const F=h[2*D],j=h[2*D+1];F>=e&&F<=s&&j>=i&&j<=a&&g.push(u[D])}continue}const E=w+b>>1,A=h[2*E],P=h[2*E+1];A>=e&&A<=s&&P>=i&&P<=a&&g.push(u[E]),(v===0?e<=A:i<=P)&&(_.push(w),_.push(E-1),_.push(1-v)),(v===0?s>=A:a>=P)&&(_.push(E+1),_.push(b),_.push(1-v))}return g}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:h}=this,f=[0,a.length-1,0],_=[],g=s*s;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=h){for(let D=w;D<=b;D++)zv(u[2*D],u[2*D+1],e,i)<=g&&_.push(a[D]);continue}const E=w+b>>1,A=u[2*E],P=u[2*E+1];zv(A,P,e,i)<=g&&_.push(a[E]),(v===0?e-s<=A:i-s<=P)&&(f.push(w),f.push(E-1),f.push(1-v)),(v===0?e+s>=A:i+s>=P)&&(f.push(E+1),f.push(b),f.push(1-v))}return _}}function B_(r,e,i,s,a,u){if(a-s<=i)return;const h=s+a>>1;Rv(r,e,h,s,a,u),B_(r,e,i,s,h-1,1-u),B_(r,e,i,h+1,a,1-u)}function Rv(r,e,i,s,a,u){for(;a>s;){if(a-s>600){const g=a-s+1,v=i-s+1,b=Math.log(g),w=.5*Math.exp(2*b/3),E=.5*Math.sqrt(b*w*(g-w)/g)*(v-g/2<0?-1:1);Rv(r,e,i,Math.max(s,Math.floor(i-v*w/g+E)),Math.min(a,Math.floor(i+(g-v)*w/g+E)),u)}const h=e[2*i+u];let f=s,_=a;for(zd(r,e,s,i),e[2*a+u]>h&&zd(r,e,s,a);f<_;){for(zd(r,e,f,_),f++,_--;e[2*f+u]<h;)f++;for(;e[2*_+u]>h;)_--}e[2*s+u]===h?zd(r,e,s,_):(_++,zd(r,e,_,a)),_<=i&&(s=_+1),i<=_&&(a=_-1)}}function zd(r,e,i,s){N_(r,i,s),N_(e,2*i,2*s),N_(e,2*i+1,2*s+1)}function N_(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function zv(r,e,i,s){const a=r-i,u=e-s;return a*a+u*u}o.$=en,o.A=Go,o.B=Vs,o.C=sa,o.D=Cu,o.E=$o,o.F=2,o.G=yd,o.H=Yy,o.I=jn,o.J=po,o.K=class extends Af{},o.L=Ho,o.M=ys,o.N=jl,o.O=Ul,o.P=Xe,o.Q=Ih,o.R=wl,o.S=su,o.T=x_,o.U=cu,o.V=Af,o.W=pp,o.X=js,o.Y=Hc,o.Z=ka,o._=La,o.a=function(r){return rn.API_CDN_URL_REGEX.test(r)},o.a$=be,o.a0=qo,o.a1=uu,o.a2=Gl,o.a3=Eh,o.a4=function(r){const e=r.value;let i=[];if(!e)return i;const s=po(e);return s!=="string"?(i=i.concat([new Af(r.key,e,`string expected, "${s}" found`)]),i):(T_(e,!0)||(i=i.concat([new Af(r.key,e,`invalid url "${e}"`)])),i)},o.a5=pe,o.a6=xp,o.a7=Er,o.a8=Ve,o.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return fr(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Ft(r.x,e.x,i),y:Ft(r.y,e.y,i),z:Ft(r.z,e.z,i),azimuthal:Ft(r.azimuthal,e.azimuthal,i),polar:Ft(r.polar,e.polar,i)}}},o.aA=Tn,o.aB=m,o.aC=Ps,o.aD=J,o.aE=xe,o.aF=function(r,e){const i={};for(let s=0;s<e.length;s++){const a=e[s];a in r&&(i[a]=r[a])}return i},o.aG=H,o.aH=K,o.aI=class{constructor(r){this.entries={}
15,this.scheduler=r}request(r,e,i,s){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[u,h]=a.result;return this.scheduler?this.scheduler.add(()=>{s(u,h)},e):s(u,h),()=>{}}return a.callbacks.push(s),a.cancel||(a.cancel=i((u,h)=>{a.result=[u,h];for(const f of a.callbacks)this.scheduler?this.scheduler.add(()=>{f(u,h)},e):f(u,h);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(u=>u!==s),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},o.aJ=function(r,e,i){const s=JSON.stringify(r.request);return r.data&&(this.deduped.entries[s]={result:[null,r.data]}),this.deduped.request(s,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const u=Tl(r.request,(h,f,_,g)=>{h?a(h):f&&a(null,{vectorTile:i?void 0:new oi.VectorTile(new sf(f)),rawData:f,cacheControl:_,expires:g})});return()=>{u.cancel(),a()}},e)},o.aK=function(r){Wu++,Wu>Os&&(r.getActor().send("enforceCacheSizeLimit",ms),Wu=0)},o.aL=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log(r)/Math.LN2))},o.aM=Cn,o.aN=Ex,o.aO=Rx,o.aP=Sx,o.aQ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let s=0;s<r.length;s++){const a=document.createElement("source");Uf(r[s])||(i.crossOrigin="Anonymous"),a.src=r[s],i.appendChild(a)}return{cancel:()=>{}}},o.aR=wf,o.aS=function(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>my(e,0,r))},o.aT=Iv,o.aU=class{constructor(r,e,i,s){this.id=r,this.position=e!=null?new V(e[0],e[1]):new V(0,0),this.orientation=i??[0,0,0],this.nodes=s,this.uploaded=!1,this.aabb=new Ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,e){if(Ze(r.matrix,e,r.matrix),r.meshes)for(const i of r.meshes){const s=Ci.applyTransformFast(i.aabb,r.matrix);this.aabb.encapsulate(s)}if(r.children)for(const i of r.children)this._applyTransformations(i,r.matrix)}computeBoundsAndApplyParent(){const r=Ke([]);for(const e of this.nodes)this._applyTransformations(e,r)}computeModelMatrix(r,e,i,s,a,u,h=!1){jx(this.matrix,this,r.transform,this.position,e,i,s,a,u,h)}upload(r){if(!this.uploaded){for(const e of this.nodes)E_(e,r);for(const e of this.nodes)Mf(e);this.uploaded=!0}}destroy(){for(const r of this.nodes)I_(r)}},o.aV=dt,o.aW=vd,o.aX=ne,o.aY=fe,o.aZ=$a,o.a_=sn,o.aa=Wi,o.ab=ql,o.ac=le,o.ad=dr,o.ae=vi,o.af=ce,o.ag=ra,o.ah=tl,o.ai=Ft,o.aj=Je,o.ak=Lc,o.al=Mi,o.am=Fi,o.an=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return function([i,s]){const a=fr([1,i,s]);return{x:a.x,y:a.y,z:a.z}}(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Ft(r.x,e.x,i),y:Ft(r.y,e.y,i),z:Ft(r.z,e.z,i)}}},o.ao=function(r,e,i=0,s=!0){const a=new Xe(i,i),u=r.sub(a),h=e.add(a),f=[u,new Xe(h.x,u.y),h,new Xe(u.x,h.y)];return s&&f.push(u.clone()),f},o.ap=function(r,e){const i=[];for(let s=0;s<r.length;s++){const a=ge(s-1,-1,r.length-1),u=ge(s+1,-1,r.length-1),h=r[s],f=r[u],_=r[a].sub(h).unit(),g=f.sub(h).unit(),v=g.angleWithSep(_.x,_.y),b=_.add(g).unit().mult(-1*e/Math.sin(v/2));i.push(h.add(b))}return i},o.aq=ux,o.ar=el,o.as=function(r,e,i=0){return Kt(((e.x-i)*r.scale-r.x)*Je,(e.y*r.scale-r.y)*Je,_e(e.z,e.y))},o.at=Nr,o.au=Tr,o.av=lr,o.aw=wy,o.ax=function(r){let e=1/0,i=1/0,s=-1/0,a=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),s=Math.max(s,u.x),a=Math.max(a,u.y);return{min:new Xe(e,i),max:new Xe(s,a)}},o.ay=Q,o.az=Ze,o.b=function(r){return rn.API_FONTS_REGEX.test(r)},o.b$=function(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_+a*f,r[1]=a*_-s*f,r[2]=u*_+h*f,r[3]=h*_-u*f,r},o.b0=yu,o.b1=vf,o.b2=function(){Hs.isLoading()||Hs.isLoaded()||Ua()!=="deferred"||yp()},o.b3=zh,o.b4=rt,o.b5=ju,o.b6=Pi,o.b7=Km,o.b8=Bm,o.b9=at,o.bA=function(r,e){const{x:i,y:s}=r.point,a=tg(i,s,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Ze(a,a,Mm(Po(e)))},o.bB=yt,o.bC=function(r){return r[0]=0,r[1]=0,r[2]=0,r},o.bD=function(r,e){return Math.hypot(e[0]-r[0],e[1]-r[1],e[2]-r[2])},o.bE=Jr,o.bF=Yr,o.bG=Br,o.bH=gd,o.bI=Qn,o.bJ=s_,o.bK=function(r,e,i,s,a){const u=5*e+2;r.float32[u+0]=i,r.float32[u+1]=s,r.float32[u+2]=a},o.bL=xf,o.bM=ef,o.bN=Fn,o.bO=tn,o.bP=Rg,o.bQ=Ox,o.bR=Fg,o.bS=Og,o.bT=n_,o.bU=rx,o.bV=c_,o.bW=O_,o.bX=ge,o.bY=Zi,o.bZ=io,o.b_=ro,o.ba=Zs,o.bb=tc,o.bc=X_,o.bd=Ar,o.be=td,o.bf=__,o.bg=function(r,e){const i=tl(e.zoom);if(i===0)return Po(r);const s=Gp(r),a=Am(s),u=J(s.getWest())*e.worldSize,h=J(s.getEast())*e.worldSize,f=K(s.getNorth())*e.worldSize,_=K(s.getSouth())*e.worldSize,g=[u,f,0],v=[h,f,0],b=[u,_,0],w=[h,_,0],E=xt([],e.globeMatrix);return dr(g,g,E),dr(v,v,E),dr(b,b,E),dr(w,w,E),a[0]=la(a[0],b,i),a[1]=la(a[1],w,i),a[2]=la(a[2],v,i),a[3]=la(a[3],g,i),Ci.fromPoints(a)},o.bh=qp,o.bi=xt,o.bj=Qh,o.bk=la,o.bl=Yl,o.bm=Hv,o.bn=ln,o.bo=It,o.bp=Ff,o.bq=sf,o.br=Tl,o.bs=function(r,e){const i=[];for(const s in r)s in e||i.push(s);return i},o.bt=ue,o.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.bv=ks,o.bw=function(r){var e=new lt(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},o.bx=Ke,o.by=Or,o.bz=jt,o.c=Ec,o.c$=tf,o.c0=no,o.c1=Sr,o.c2=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},o.c3=Rn,o.c4=function(r,e,i,s,a){var u,h=1/Math.tan(e/2);return r[0]=h/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0?(r[10]=(a+s)*(u=1/(s-a)),r[14]=2*a*s*u):(r[10]=-1,r[14]=-2*s),r},o.c5=function(r,e,i,s,a,u,h){var f=1/(e-i),_=1/(s-a),g=1/(u-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+i)*f,r[13]=(a+s)*_,r[14]=(h+u)*g,r[15]=1,r},o.c6=ie,o.c7=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},o.c8=wu,o.c9=sc,o.cA=Ef,o.cB=zs,o.cC=zx,o.cD=function(r){const e=zx(r,!0);return yt([],[e[0],e[1],e[4],e[5]])},o.cE=kt,o.cF=Qi,o.cG=Rt,o.cH=function(r){const{x:e,y:i}=r.point,{lng:s,lat:a}=r._center;return tg(e,i,r.worldSize,s,a)},o.cI=Xr,o.cJ=ve,o.cK=Au,o.cL=y,o.cM=function(r,e,i){let s=0;for(let a=0;a<2;++a)r[a]>0&&(s+=(r[a]-0)*(r[a]-0)),e[a]<0&&(s+=(0-e[a])*(0-e[a]));return s},o.cN=function(r){return r*r*r*r*r},o.cO=ee,o.cP=45,o.cQ=Tu,o.cR=function(r,e,i){const s=Math.sqrt(r*r+e*e+i*i),a=s>0?Math.acos(i/s)*fl:0;let u=r!==0||e!==0?Math.atan2(-e,-r)*fl+90:0;return u<0&&(u+=360),[s,u,a]},o.cS=Kt,o.cT=fr,o.cU=Te,o.cV=ki,o.cW=Ci,o.cX=Ji,o.cY=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},o.cZ=T_,o.c_=function(r,e){return r.readFields(nb,{icons:[]},e)},o.ca=kr,o.cb=Ms,o.cc=Ya,o.cd=V,o.ce=mx,o.cf=function(){var r=new lt(4);return lt!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},o.cg=function(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_+u*f,r[1]=a*_+h*f,r[2]=s*-f+u*_,r[3]=a*-f+h*_,r},o.ch=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},o.ci=ps,o.cj=function(r){return Math.hypot(r[0],r[1],r[2],r[3])},o.ck=Ls,o.cl=Ds,o.cm=W_,o.cn=_r,o.co=Dx,o.cp=uc,o.cq=J_,o.cr=function(r,e,i,s,a,u,h,f,_){if(_.name==="globe")return J_(r,e,new uc(i,s,a),!1);const g=vd({z:i,x:s,y:a},_);
15return new Ci([(u+g.x/g.scale)*e,e*(g.y/g.scale),h],[(u+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},o.cs=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},o.ct=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},o.cu=function(r){const e=Math.round((r+45+360)%360/90)%4;return O[e]},o.cv=Me,o.cw=Lo,o.cx=x,o.cy=function(r){const e=Ke(new Float64Array(16));Ze(e,r.pixelMatrix,r.globeMatrix);const i=[0,I,0],s=[0,C,0];return dr(i,i,e),dr(s,s,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!Pm(r,new V(r.center.lat,90)),s[0]>0&&s[0]<=r.width&&s[1]>0&&s[1]<=r.height&&!Pm(r,new V(r.center.lat,-90))]},o.cz=function(r,e){const{scale:i}=r.tileTransform,s=i*Je/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return function(a,u,h){var f=u[1],_=u[2],g=u[3],v=h[0],b=h[1];return a[0]=u[0]*v,a[1]=f*v,a[2]=_*b,a[3]=g*b,a}(new Float32Array(4),e.inverseAdjustmentMatrix,[s,s])},o.d=function(r){return rn.API_TILEJSON_REGEX.test(r)},o.d$=qh,o.d0=Lu,o.d1=a_,o.d2=Cc,o.d3=ia,o.d4=ss,o.d5=El,o.d6=qt,o.d7=function(r){const e=r.indexOf(Wl);return e>=0?r.slice(0,e):r},o.d8=function(r){return r.indexOf(Wl)>=0},o.d9=function(r){const e=r.lastIndexOf(Wl);return e>=0?r.slice(e+1):""},o.dA=eg,o.dB=zn,o.dC=mn,o.dD=256,o.dE=function(r,e){const i=[0,0,0];return dr(i,i,qp(Po(e.canonical))),dr(i,i,r),i},o.dF=r=>({u_matrix:new Ya(r),u_texsize:new Ms(r),u_pixels_to_tile_units:new oc(r),u_device_pixel_ratio:new kr(r),u_width_scale:new kr(r),u_floor_width_scale:new kr(r),u_image:new wu(r),u_units_to_pixels:new Ms(r),u_tile_units_to_pixels:new kr(r),u_alpha_discard_threshold:new kr(r),u_trim_offset:new Ms(r),u_trim_fade_range:new Ms(r),u_trim_color:new Tu(r),u_emissive_strength:new kr(r),u_zbias_factor:new kr(r),u_tile_to_meter:new kr(r),u_ground_shadow_factor:new sc(r),u_pattern_transition:new kr(r)}),o.dG=r=>({u_matrix:new Ya(r),u_pixels_to_tile_units:new oc(r),u_device_pixel_ratio:new kr(r),u_width_scale:new kr(r),u_floor_width_scale:new kr(r),u_units_to_pixels:new Ms(r),u_dash_image:new wu(r),u_gradient_image:new wu(r),u_image_height:new kr(r),u_texsize:new Ms(r),u_tile_units_to_pixels:new kr(r),u_alpha_discard_threshold:new kr(r),u_trim_offset:new Ms(r),u_trim_fade_range:new Ms(r),u_trim_color:new Tu(r),u_emissive_strength:new kr(r),u_zbias_factor:new kr(r),u_tile_to_meter:new kr(r),u_ground_shadow_factor:new sc(r)}),o.dH=r=>({u_camera_to_center_distance:new kr(r),u_extrude_scale:new oc(r),u_device_pixel_ratio:new kr(r),u_matrix:new Ya(r),u_inv_rot_matrix:new Ya(r),u_merc_center:new Ms(r),u_tile_id:new sc(r),u_zoom_transition:new kr(r),u_up_dir:new sc(r),u_emissive_strength:new kr(r)}),o.dI=Vh,o.dJ=l1,o.dK=ng,o.dL=(r,e,i,s,a,u)=>{const h=r.transform,f=h.projection.name==="globe";let _;if(u.paint.get("circle-pitch-alignment")==="map")if(f){const v=eg(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=h.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:fs.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:Kv,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(f){g.u_inv_rot_matrix=s,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=tl(h.zoom);const v=a[0]*Je,b=a[1]*Je;g.u_up_dir=h.projection.upVector(new uc(0,0,0),v,b)}return g},o.dM=Iy,o.dN=Ln,o.dO=(r,e,i,s,a,u,h,f,_,g)=>{const v=r.transform,b=v.pitch<15?Ty(.07,.7,Q((14-v.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Ey(r,e,i,s),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:Sy(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alph
15a_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:b,u_tile_to_meter:Te(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:g}},o.dP=(r,e,i,s,a,u,h,f,_,g)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",E=v.pitch<15?Ty(.07,.7,Q((14-v.zoom)/5,0,1)):.07;return{u_matrix:Ey(r,e,i,s),u_pixels_to_tile_units:b,u_device_pixel_ratio:u,u_width_scale:h,u_floor_width_scale:f,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:Ay(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Sy(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:E,u_tile_to_meter:Te(e.tileID.canonical,0),u_ground_shadow_factor:g}},o.dQ=We,o.dR=ed,o.dS=_e,o.dT=$v,o.dU=Qp,o.dV=Yg,o.dW=rl,o.dX=450,o.dY=7,o.dZ=G1,o.d_=Ai,o.da=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},o.db=function(r,e,i,s){return r.type==="custom"?new $1(r,e):new ib[r.type](r,e,i,s)},o.dc=Gt,o.dd=function(r){const e=r.indexOf(Wl);return e>=0?r.slice(e+1):""},o.de=class extends ju{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},o.df=lu,o.dg=ba,o.dh=function(r){return r({pluginStatus:Mn,pluginURL:qs}),lu.on("pluginStateChange",r),r},o.di=Np,o.dj=class extends Ws{constructor(r){super(r),this.current=Xh}
15set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let s=0;s<9;s++)if(i[s]!==this.current[s]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.dk=U,o.dl=function(r,e,i){const s=tl(i.zoom),a=r.style.map._antialias,u=r.terrain&&r.terrain.exaggeration()>0;return s===0&&!a&&!u},o.dm=function(r){const e=r.pixelsPerMeter,i=e/ie(1,r.center.lat),s=Ke(new Float64Array(16));return It(s,s,[r.point.x,r.point.y,0]),kt(s,s,[i,i,e]),Float32Array.from(s)},o.dn=Gp,o.dp=function(r){const e=Me-5;r=Q(r,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(Mi(r))),3);return Math.round(i*(M.length-1))},o.dq=function(r,e,i,s){const a=e.getNorth(),u=e.getSouth(),h=e.getWest(),f=e.getEast(),_=1<<r.z,g=f-h,v=a-u,b=g/S,w=-v/M[i],E=[0,b,0,w,0,0,a,h,0];if(r.z>0){const A=180/s;li(E,E,[A/g+1,0,0,0,A/v+1,0,-.5*A/b,.5*A/w,1])}return E[2]=_,E[5]=r.x,E[8]=r.y,E},o.dr=Po,o.ds=function(r,e,i){const s=Ke(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return wt(s,i.globeMatrix,a),Float32Array.from(s)},o.dt=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,s=1<<i,a=Math.floor(r.x),u=Math.floor((r.x-a)*s),h=Math.floor(r.y*s),f=this.findDEMTileFor(new Cn(i,a,i,u,h));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const s=this._source();if(!s||r.y<0||r.y>1)return e;const a=s.getSource().maxzoom,u=1<<a,h=Math.floor(r.x),f=r.x-h,_=new Cn(a,h,a,Math.floor(f*u),Math.floor(r.y*u)),g=this.findDEMTileFor(_);if(!g||!g.dem)return e;const v=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*v.dim,E=(r.y*b-g.tileID.canonical.y)*v.dim,A=Math.floor(w),P=Math.floor(E);return(i?this.exaggeration():1)*Ft(Ft(v.get(A,P),v.get(A,P+1),E-P),Ft(v.get(A+1,P),v.get(A+1,P+1),E-P),w-A)}getAtTileOffset(r,e,i){const s=1<<r.canonical.z;return this.getAtPointOrZero(new le(r.wrap+(r.canonical.x+e/Je)/s,(r.canonical.y+i/Je)/s))}getAtTileOffsetFunc(r,e,i,s){return a=>{const u=this.getAtTileOffset(r,a.x,a.y),h=s.upVector(r.canonical,a.x,a.y);return Zi(h,h,u*s.upVectorScale(r.canonical,e,i).metersToTile),h}}getForTilePoints(r,e,i,s){if(this.isUsingMockSource())return!1;const a=Bu.create(this,r,s);return!!a&&(e.forEach(u=>{u[2]=this.exaggeration()*a.getElevationAt(u[0],u[1],i)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,s=e.tileID,a=1<<r.canonical.z-s.canonical.z;let u=r.canonical.x/a-s.canonical.x,h=r.canonical.y/a-s.canonical.y,f=0;for(let _=0;_<r.canonical.z-s.canonical.z&&!i.leaves[f];_++){u*=2,h*=2;const g=2*Math.floor(h)+Math.floor(u);f=i.childOffsets[f]+g,u%=1,h%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,s=Number.MIN_VALUE;for(const a of r){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),s=Math.max(s,u.max),e=!0)}return e?{min:i,max:s}:null}},o.du=fg,o.dv=jp,o.dw=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},o.dx=Pt,o.dy=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},o.dz=da,o.e=rn,o.e$=Av,o.e0=256,o.e1=Mm,o.e2=As,o.e3=wt,o.e4=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},o.e5=Io,o.e6=ec,o.e7=lp,o.e8=function(r,e,i,s,a){return Q((r-e)/(i-e)*(a-s)+s,s,a)},o.e9=so,o.eA=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},o.eB=pa,o.eC=z,o.eD=Ts,o.eE=function(r,e,i,s){return r[0]=e,r[1]=i,r[2]=s,r},o.eF=function([r,e,i]){const s=Math.hypot(r,e,i),a=Math.atan2(r,i),u=.5*Math.PI-Math.acos(-e/s);return new V(ve(a),ve(u))},o.eG=dl,o.eH=b_,o.eI=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!function(i){if(Pr==null){const s=i.navigator?i.navigator.userAgent:null;Pr=!!i.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Pr}(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},o.eJ=function(r,e){ms=r,Os=e},o.eK=Pm,o.eL=ig,o.eM=function(r){const e=[0,0,0],i=Ke(new Float64Array(16));return Ze(i,r.pixelMatrix,r.globeMatrix),dr(e,e,i),new Xe(e[0],e[1])},o.eN=function(){const r=hd;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(qm),hd=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},o.eO=function(){tf().acquire(qm)},o.eP=Ua,o.eQ=function(r,e,i=!1){if(Mn===$n.deferred||Mn===$n.loading||Mn===$n.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");qs=fs.resolveURL(r),Mn=$n.deferred,Rh=e,au(),i||yp()},o.eR=function(r){Pu=fs.resolveURL(r),Ru||(Ru=new Cu(tf(),new $o)),Ru.broadcast("setMeshoptUrl",Pu)},o.eS=cy,o.eT=function(r){Zm=fs.resolveURL(r),Ru||(Ru=new Cu(tf(),new $o)),Ru.broadcast("setDracoUrl",Zm)},o.eU=ly,o.eV=ud,o.eW=function(r){const e=No();if(!e)return;const i=e.delete(Fs);r&&i.then(()=>r()).catch(r)},o.eX=fc,o.eY=st,o.eZ=il,o.e_=Ks,o.ea=function(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=v*h-f*g,w=-v*u+f*_,E=g*u-h*_,A=i*b+s*w+a*E;return A?(r[0]=b*(A=1/A),r[1]=(-v*s+a*g)*A,r[2]=(f*s-a*h)*A,r[3]=w*A,r[4]=(v*i-a*_)*A,r[5]=(-f*i+a*u)*A,r[6]=E*A,r[7]=(-g*i+s*_)*A,r[8]=(h*i-s*u)*A,r):null},o.eb=to,o.ec=Fe,o.ed=w_,o.ee=function(r,e){if(r===e){var i=e[1],s=e[2],a=e[3],u=e[6],h=e[7],f=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=s,r[9]=u,r[11]=e[14],r[12]=a,r[13]=h,r[14]=f}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},o.ef=ci,o.eg=[1,1,1],o.eh=class{constructor(r,e,i,s){this.context=r,this.format=s,this.size=i,this.texture=r.gl.createTexture();const[a,u,h]=this.size,{gl:f}=r;f.bindTexture(f.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),f.texImage3D(f.TEXTURE_3D,0,this.format,a,u,h,0,g_(this.format),y_(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:s}=i;s.bindTexture(s.TEXTURE_3D,this.texture),r!==this.minFilter&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MAG_FILTER,r),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},o.ei=Bu,o.ej=function(r,e,i,s){var a=new lt(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=s,a},o.ek=wn,o.el=function(r,e,i,s){var a=e[0],u=e[1],h=e[2],f=e[3];return r[0]=a+s*(i[0]-a),r[1]=u+s*(i[1]-u),r[2]=h+s*(i[2]-h),r[3]=f+s*(i[3]-f),r},o.em=Ou,o.en=Eo,o.eo=oa,o.ep=function(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P){var D=new lt(16);return D[0]=r,D[1]=e,D[2]=i,D[3]=s,D[4]=a,D[5]=u,D[6]=h,D[7]=f,D[8]=_,D[9]=g,D[10]=v,D[11]=b,D[12]=w,D[13]=E,D[14]=A,D[15]=P,D},o.eq=k,o.er=_u,o.es=Gh,o.et=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Xe(1/0,1/0),max:new Xe(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=Dg(new Xe(0,0),new Xe(Je,Je),r),s=[];if(e&&!Vm(i,this._globalClipBounds))return s;for(const a of this._activeRegions){if(a.hiddenByOverlap||!Vm(i,a))continue;const u=E0(a.min,a.max,r);s.push({min:u.min,max:u.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return s}
vendor: 6,943 bytes, line 15
15setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const s of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(s).buckets[e.layer];a&&a.updateFootprints(s.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),s=r.getClipMask(),a=r.getClipScope();for(const u of e){if(!u.footprint)continue;const h=Dg(u.footprint.min,u.footprint.max,u.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:u.id,footprint:u.footprint,order:i,clipMask:s,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Kp(e.min,i.min)||Kp(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(s,a){const u=(h,f)=>h+f;return s.length-a.length||s.reduce(u,"").localeCompare(a.reduce(u,""))}(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],s=this._prevRegions[e];r=i.priority!==s.priority||!zg(i,s)||i.order!==s.order||i.clipMask!==s.clipMask||!ks(i.clipScope,s.clipScope),++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==Yp&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const s=this._activeRegions;if(i>=s.length)return i;const a=s[i].priority;for(;i<s.length&&s[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,s=e(i);for(;i!==s;){let a=i;const u=i;for(;a!==s;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let f=0;f<u;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&h.order===Yp&&Vm(h,_)&&(h.hiddenByOverlap=kg(h.footprint,h.tileId,_.footprint,_.tileId),h.hiddenByOverlap))break}++a}i=s,s=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},o.eu=Yp,o.ev=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new Zs,s=new sn,a=[],u=r+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),_=(g,v,b)=>{let w=g===u-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,v]};for(let g=0;g<u;++g)i.emplaceBack(..._(g,0,!0));for(let g=0;g<h;++g)for(let v=0;v<u;++v)i.emplaceBack(..._(v,g,(v===0||v===u-1)&&!0));for(let g=0;g<e.length;++g){const v=e[g];for(let b=0;b<u;++b)i.emplaceBack(..._(b,v,!0))}for(let g=0;g<e.length;++g){const v=s.length,b=e[g]+1+2,w=new sn;for(let P=0;P<b-1;P++){const D=P===b-2,F=D?u*(f-e.length+g-P):u;for(let j=0;j<u-1;j++){const G=P*u+j;P===0||D||j===0||j===u-2?(w.emplaceBack(G+1,G,G+F),w.emplaceBack(G+F,G+F+1,G+1)):(s.emplaceBack(G+1,G,G+F),s.emplaceBack(G+F,G+F+1,G+1))}}const E=Ar.simpleSegment(0,v,i.length,s.length-v);for(let P=0;P<w.uint16.length;P+=3)s.emplaceBack(w.uint16[P],w.uint16[P+1],w.uint16[P+2]);const A=Ar.simpleSegment(0,v,i.length,s.length-v);a.push({withoutSkirts:E,withSkirts:A})}return{vertices:i,indices:s,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(S,M);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,X_.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new sn;for(let h=0;h<=S;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new Io,s=new Io,a=new Io,u=new Io;this._poleSegments=[];for(let h=0,f=0;h<y;h++){const _=360/(1<<h);i.emplaceBack(0,-m,0,.5,0),s.emplaceBack(0,-m,0,.5,1),a.emplaceBack(0,-m,0,.5,.5),u.emplaceBack(0,-m,0,.5,.5);for(let g=0;g<=S;g++){let v=g/S,b=0;const w=Ft(0,_,v),[E,A,P]=L(Xv,Yv,w,m);i.emplaceBack(E,A,P,v,b),s.emplaceBack(E,A,P,v,1-b);const D=Mi(w);v=.5+.5*Math.sin(D),b=.5+.5*Math.cos(D),a.emplaceBack(E,A,P,v,b),u.emplaceBack(E,A,P,v,1-b)}this._poleSegments.push(Ar.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,Up,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(s,Up,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,Up,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(u,Up,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},o.ew=X,o.ex=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.ey=se,o.ez=de,o.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},o.f0=Mv,o.f1=xy,o.f2=mi,o.f3="hd_road_elevation",o.f4=Jn,o.f5=ft,o.f6=dc,o.f7=o_,o.f8=mc,o.f9=function(r,e,i,s,a,u,h,f=1,_,g,v){r.createArrays(),r.tilePixelRatio=Je/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const b=r.layers[0].layout,w=r.layers[0]._unevaluatedLayout._values,E={};E.scaleFactor=f,E.textSizeScaleRange=b.get("text-size-scale-range"),E.iconSizeScaleRange=b.get("icon-size-scale-range");const[A,P]=E.textSizeScaleRange,[D,F]=E.iconSizeScaleRange;E.textScaleFactor=Q(E.scaleFactor,A,P),E.iconScaleFactor=Q(E.scaleFactor,D,F);const j=w["text-size"],G=w["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:re,maxZoom:ae}=r.textSizeData;E.compositeTextSizes=[j.possiblyEvaluate(new Wi(re,{worldview:v}),u),j.possiblyEvaluate(new Wi(ae,{worldview:v}),u)]}if(r.iconSizeData.kind==="composite"){const{minZoom:re,maxZoom:ae}=r.iconSizeData;E.compositeIconSizes=[G.possiblyEvaluate(new Wi(re,{worldview:v}),u),G.possiblyEvaluate(new Wi(ae,{worldview:v}),u)]}E.layoutTextSize=j.possiblyEvaluate(new Wi(h+1,{worldview:v}),u),E.layoutIconSize=G.possiblyEvaluate(new Wi(h+1,{worldview:v}),u),E.textMaxSize=j.possiblyEvaluate(new Wi(18,{worldview:v}),u);const R=b.get("symbol-placement"),N=b.get("text-rotation-alignment")==="map"&&R!=="point",$=b.get("text-size");let Z=!1;const oe=[];for(const re of r.features){const ae=b.get("text-font").evaluate(re,{},u).join(","),he=$.evaluate(re,{},u)*E.textScaleFactor,Se=E.layoutTextSize.evaluate(re,{},u)*E.textScaleFactor,Be=E.layoutIconSize.evaluate(re,{},u)*E.iconScaleFactor,ze={horizontal:{},vertical:void 0},Oe=re.text;
15let Ne,Ie=[0,0];if(Oe){const Ot=Oe.toString(),ti=b.get("text-letter-spacing").evaluate(re,{},u)*tn,Qt=b.get("text-line-height").evaluate(re,{},u)*tn,hi=pm(Ot)?ti:0,ni=b.get("text-anchor").evaluate(re,{},u),di=b.get("text-variable-anchor");if(!di){const Ae=b.get("text-radial-offset").evaluate(re,{},u);if(Ae)Ie=rx(ni,[Ae*tn,l_]);else{const He=b.get("text-offset").evaluate(re,{},u);Ie=[He[0]*tn,He[1]*tn]}}let Ni=N?"center":b.get("text-justify").evaluate(re,{},u);const nr=R==="point",q=nr?b.get("text-max-width").evaluate(re,{},u)*tn:1/0,W=Ae=>{r.allowVerticalPlacement&&Hl(Ot)&&(ze.vertical=r_(Oe,e,i,a,ae,q,Qt,ni,Ae,hi,Ie,Qn.vertical,!0,Se,he,_))};if(!N&&di){const Ae=Ni==="auto"?di.map(tt=>c_(tt)):[Ni];let He=!1;for(let tt=0;tt<Ae.length;tt++){const Qe=Ae[tt];if(!ze.horizontal[Qe])if(He)ze.horizontal[Qe]=ze.horizontal[0];else{const ct=r_(Oe,e,i,a,ae,q,Qt,"center",Qe,hi,Ie,Qn.horizontal,!1,Se,he,_);ct&&(ze.horizontal[Qe]=ct,He=ct.positionedLines.length===1)}}W("left")}else{if(Ni==="auto"&&(Ni=c_(ni)),nr||b.get("text-writing-mode").indexOf("horizontal")>=0||!Hl(Ot)){const Ae=r_(Oe,e,i,a,ae,q,Qt,ni,Ni,hi,Ie,Qn.horizontal,!1,Se,he,_);Ae&&(ze.horizontal[Ni]=Ae)}W(nr?"left":Ni)}}let ke,we,Ee,je,$e,vt,ht=!1;const et=b.get("icon-text-fit").evaluate(re,{},u);if(re.icon&&re.icon.hasPrimary()){const Ot=sx(re.icon,r.iconSizeData,w["icon-size"],u,r.zoom,re,_,E.iconScaleFactor,v);ke=Ot.iconPrimary,Ee=Ot.iconSecondary;const ti=ke.toString();if(we=s.get(ti),we&&($e=b.get("icon-offset").evaluate(re,{},u),vt=b.get("icon-anchor").evaluate(re,{},u),Ne=x1(a.get(ti),Ee?a.get(Ee.toString()):void 0,$e,vt),ht=we.sdf,r.sdfIcons===void 0?r.sdfIcons=we.sdf:r.sdfIcons!==we.sdf&&ii("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(we.pixelRatio!==r.pixelRatio||b.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Ee){const Qt=Ee.toString();je=s.get(Qt)}}Z=Z||!(!re.icon||!re.icon.hasSecondary());const Ue=u_(ze.horizontal)||ze.vertical;r.iconsInText||(r.iconsInText=!!Ue&&Ue.iconsInText);const Ht=Se*E.textScaleFactor/tn,{defaultShapedIcon:ut,verticallyShapedIcon:pt}=C1(r,Ne,b,re,u,ze,Ht,$e,et);et!=="none"&&Ne&&(Uy(Ne)||jy(Ne))&&(hf(0,we,ke,Ne,ut,et,g,s,a),hf(0,je,Ee,Ne,ut,et,g,s,a),pt&&(hf(0,we,ke,Ne,pt,et,g,s,a),hf(0,je,Ee,Ne,pt,et,g,s,a))),Ne=ut,oe.push({feature:re,shapedTextOrientations:ze,shapedText:Ue,shapedIcon:Ne,iconPrimary:ke,iconSecondary:Ee,iconOffset:$e,iconAnchor:vt,verticallyShapedIcon:pt,layoutTextSize:Se,layoutIconSize:Be,textOffset:Ie,isSDFIcon:ht,iconTextFit:et})}return{featureData:oe,sizes:E,hasAnySecondaryIcon:Z,textAlongLine:N,symbolPlacement:R}},o.fa=Ky,o.fb=function(r,e,i,s,a,u,h,f,_,g){const{featureData:v,hasAnySecondaryIcon:b,sizes:w,textAlongLine:E,symbolPlacement:A}=e;for(const P of v){const{shapedIcon:D,verticallyShapedIcon:F,feature:j,shapedTextOrientations:G,shapedText:R,layoutTextSize:N,textOffset:$,isSDFIcon:Z,iconPrimary:oe,iconSecondary:re,iconTextFit:ae,iconOffset:he}=P;ox(D,g.iconPositions,oe,re),ox(F,g.iconPositions,oe,re),M1(G,g.iconPositions),A1(oe,re,g.iconPositions),(R||D)&&P1(r,j,G,D,F,_,w,N,0,$,Z,s,a,h,f,b,ae,he,E,A)}i&&r.generateCollisionDebugBuffers(u,r.collisionBoxArray,w.textScaleFactor)},o.fc=oi,o.fd=kf,o.fe=Oo,o.ff=Jt,o.fg=Dy,o.fh=lo,o.fi=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==hy){const i=new Uint32Array(r,0,7),[,,s,a,u,h]=i;e=i.byteLength+a+u+h+u,(s!==r.byteLength||e>=r.byteLength)&&ii("Invalid b3dm header information.")}return my(r,e)},o.fj=function(r,e){const i=Iv(r);for(const s of i){for(const a of s.meshes)Qb(a);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(ew(s.lights,e)))}return i},o.fk=Cf,o.fl=Ui,o.fm=oy,o.fn=Hs,o.fo=$n,o.fp=function(r){xa(),Ss!=null&&Ss.then(e=>{e.keys().then(i=>{for(let s=0;s<i.length-r;s++)e.delete(i[s]).catch(a=>ii(a.message))}).catch(i=>ii(i.message))}).catch(e=>ii(e.message))},o.g=function(r,e){return ba(ye(r,{method:"GET"}),e)},o.h=ye,o.i=function(r){return rn.API_STYLE_REGEX.test(r)&&!Ec(r)},o.j=function(r){return r.indexOf("mapbox:")===0},o.k=co,o.l=Xu,o.m=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},o.n=function(r,e){return ba(ye(r,{type:"json"}),e)},o.o=Yu,o.p=function(r,e){return ba(ye(r,{method:"POST"}),e)},o.q=fs,o.r=un,o.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},o.t=Mc,o.u=function(){return function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)}()},o.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},o.w=ii,o.x=function(){return Hm||(Hm=new fc),Hm},o.y=z_,o.z=zc}),Lt(["./shared"],function(o){function Nt(ve){const O=ve?ve.url.toString():void 0;return O?performance.getEntriesByName(O):[]}function lt(ve){if(typeof ve=="number"||typeof ve=="boolean"||typeof ve=="string"||ve==null)return JSON.stringify(ve);if(Array.isArray(ve)){let U="[";for(const X of ve)U+=`${lt(X)},`;return`${U}]`}let O="{";for(const U of Object.keys(ve).sort())O+=`${U}:${lt(ve[U])},`;return`${O}}`}function yt(ve){let O="";for(const U of o.bu)O+=`/${lt(ve[U])}`;return O}class Pt{constructor(O){this.keyCache={},this._layers={},this._layerConfigs={},O&&this.replace(O)}replace(O,U){this._layerConfigs={},this._layers={},this.update(O,[],U)}update(O,U,X){this._options=X;for(const Q of O)this._layerConfigs[Q.id]=Q,(this._layers[Q.id]=o.db(Q,this.scope,null,this._options)).compileFilter(X),this.keyCache[Q.id]&&delete this.keyCache[Q.id];for(const Q of U)delete this.keyCache[Q],delete this._layerConfigs[Q],delete this._layers[Q];this.familiesBySource={};const se=function(Q,ce){const ge={};for(let ye=0;ye<Q.length;ye++){const De=Q[ye];let be=ce&&ce[De.id];be||(De.type==="symbol"?be=De.id:(be=yt(De),De.type==="line"&&De.paint&&function dt(ft){return typeof ft=="string"&&ft==="line-progress"||(Array.isArray(ft)?ft.some(dt):!(!ft||typeof ft!="object")&&Object.values(ft).some(dt))}(De.paint["line-width"])&&(be+=`/${lt(De.paint["line-width"])}`))),ce&&(ce[De.id]=be);let We=ge[be];We||(We=ge[be]=[]),We.push(De)}const ue=[];for(const ye in ge)ue.push(ge[ye]);return ue}(Object.values(this._layerConfigs),this.keyCache);for(const Q of se){const ce=Q.map(We=>this._layers[We.id]),ge=ce[0];if(ge.visibility==="none")continue;const ue=ge.source||"";let ye=this.familiesBySource[ue];ye||(ye=this.familiesBySource[ue]={});const De=ge.sourceLayer||"_geojsonTileLayer";let be=ye[De];be||(be=ye[De]=[]),be.push(ce)}}}const Zt=1*o.e_;class li{constructor(O){const U={},X=[];for(const ge in O){const ue=O[ge],ye=U[ge]={};for(const De in ue.glyphs){const be=ue.glyphs[+De];if(!be||be.bitmap.width===0||be.bitmap.height===0)continue;const We=be.metrics.localGlyph?Zt:1,dt={x:0,y:0,w:be.bitmap.width+2*We,h:be.bitmap.height+2*We};X.push(dt),ye[De]=dt}}const{w:se,h:Q}=o.H(X),ce=new o.eZ({width:se||1,height:Q||1});for(const ge in O){const ue=O[ge];for(const ye in ue.glyphs){const De=ue.glyphs[+ye];if(!De||De.bitmap.width===0||De.bitmap.height===0)continue;const be=U[ge][ye],We=De.metrics.localGlyph?Zt:1;o.eZ.copy(De.bitmap,ce,{x:0,y:0},{x:be.x+We,y:be.y+We},De.bitmap)}}this.image=ce,this.positions=U}}o.eY(li,"GlyphAtlas");class jt{constructor(O){this.tileID=new o.aM(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.tileZoom=O.tileZoom,this.uid=O.uid,this.zoom=O.zoom,this.lut=O.lut,this.canonical=O.tileID.canonical,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.scope=O.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=O.showCollisionBoxes,this.collectResourceTiming=!!O.request&&O.request.collectResourceTiming,this.promoteId=O.promoteId,this.isSymbolTile=O.isSymbolTile,this.tileTransform=o.aW(O.tileID.canonical,O.projection),this.projection=O.projection,this.worldview=O.worldview,this.localizableLayerIds=O.localizableLayerIds,this.brightness=O.brightness,this.extraShadowCaster=!!O.extraShadowCaster,this.tessellationStep=O.tessellationStep,this.scaleFactor=O.scaleFactor,this.worldview=O.worldview}parse(O,U,X,se,Q,ce){this.status="parsing",this.data=O,this.collisionBoxArray=new o.b0;const ge=new o.e$(Object.keys(O.layers).sort()),ue=new o.f0(this.tileID,this.promoteId);ue.bucketLayerIDs=[];const ye={},De=new o.f1(256,256),be={featureIndex:ue,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:De,availableImages:X,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},We=[],dt=U.familiesBySource[this.source];for(const Gt in dt){const qt=O.layers[Gt];if(!qt)continue;let Wt=!1,fi=!1,ii=!1;for(const Ui of dt[Gt])Ui[0].type==="symbol"?Wt=!0:fi=!0,Ui[0].is3D()&&Ui[0].type!=="model"&&(ii=!0);if(this.extraShadowCaster&&!ii||this.isSymbolTile===!0&&!Wt||this.isSymbolTile===!1&&!fi)continue;qt.version===1&&o.w(`Vector tile source "${this.source}" layer "${Gt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ki=ge.encode(Gt),pr=[];let fr=!1;for(let Ui=0,Pi=0;Ui<qt.length;Ui++){const Pr=qt.feature(Ui),Sr=ue.getId(Pr,Gt);if(this.localizableLayerIds&&this.localizableLayerIds.has(Gt)){const xr=Pr.properties?Pr.properties.worldview:null;if(this.worldview&&typeof xr=="string")if(xr==="all")Pr.properties.$localized=!0;else{if(!xr.split(",").includes(this.worldview))continue;Pr.properties.$localized=!0,Pr.properties.worldview=this.worldview}}!fr&&Pr.properties&&Pr.properties.hasOwnProperty(o.f2)&&(fr=!0),pr.push({feature:Pr,id:Sr,index:Pi,sourceLayerIndex:Ki}),Pi++}fr&&!be.elevationFeatures&&O.layers.hasOwnProperty(o.f3)&&(be.elevationFeatures=o.f4.parseFrom(O.layers[o.f3],this.canonical));for(const Ui of dt[Gt]){const Pi=Ui[0];if(this.extraShadowCaster&&(!Pi.is3D()||Pi.type==="model")||this.isSymbolTile!==void 0&&Pi.type==="symbol"!==this.isSymbolTile||Pi.minzoom&&this.zoom<Math.floor(Pi.minzoom)||Pi.maxzoom&&this.zoom>=Pi.maxzoom||Pi.visibility==="none")continue;Ke(Ui,this.zoom,be.brightness,X,this.worldview);const Pr=ye[Pi.id]=Pi.createBucket({index:ue.bucketLayerIDs.length,layers:Ui,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ki,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:se,worldview:this.worldview});ue.bucketLayerIDs.push(Ui.map(xr=>o.C(xr.id,xr.scope)));let Sr=Pr.prepare?Pr.prepare():null;Sr!=null?(Sr=Sr.then(()=>Pr.populate(pr,be,this.tileID.canonical,this.tileTransform)),We.push(Sr)):Pr.populate(pr,be,this.tileID.canonical,this.tileTransform)}}const ft=()=>{let Gt,qt,Wt,fi,ii,Ki;De.trim();const pr={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},fr=()=>{if(Gt)return this.status="done",ce(Gt);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(ye).filter(Pi=>!Pi.isEmpty()),featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:be.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(qt&&Wt&&fi){const Pi=new li(qt),Pr=new Map;for(const[Qr,zn]of Wt.entries()){const{imagePosition:mn}=o.f7(Qr,zn,o.f8);Pr.set(Qr,mn)}const Sr={};for(const Qr in ye){const zn=ye[Qr];zn instanceof o.b1&&(Ke(zn.layers,this.zoom,be.brightness,X,this.worldview),Sr[Qr]=o.f9(zn,qt,Pi.positions,Wt,Pr,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,ii,this.worldview))}const xr={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(Q,Wt,ii,()=>{xr.iconsPending=!1,Ui(Sr,Pi,xr)}),this.rasterizeIfNeeded(Q,fi,Ki,()=>{xr.patternsPending=!1,Ui(Sr,Pi,xr)})}},Ui=(Pi,Pr,Sr,xr)=>{if(Sr.iconsPending||Sr.patternsPending)return;const Qr=new o.fa(Wt,fi,this.lut);for(const zn in ye){const mn=ye[zn];if(zn in Pi)o.fb(mn,Pi[zn],this.showCollisionBoxes,X,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Wt,Qr);else if(mn.hasPattern&&(mn instanceof o.b7||mn instanceof o.b8||mn instanceof o.dU)){Ke(mn.layers,this.zoom,be.brightness,X,this.worldview);const ml=Object.fromEntries(Qr.patternPositions);mn.addFeatures(be,this.tileID.canonical,ml,X,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(ye).filter(zn=>!zn.isEmpty()),featureIndex:ue,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Pr.image,lineAtlas:De,imageAtlas:Qr,brightness:be.brightness})};if(!this.extraShadowCaster){const Pi=o.f5(be.glyphDependencies,xr=>Object.keys(xr).map(Number));Object.keys(Pi).length?Q.send("getGlyphs",{uid:this.uid,stacks:Pi,scope:this.scope},(xr,Qr)=>{Gt||(Gt=xr,qt=Qr,fr())},void 0,!1,pr):qt={};const Pr=Array.from(be.iconDependencies.keys()).map(xr=>o.I.parse(xr));Pr.length?Q.send("getImages",{images:Pr,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(xr,Qr)=>{Gt||(Gt=xr,Wt=new Map,ii=this.updateImageMapAndGetImageTaskQueue(Wt,Qr,be.iconDependencies),fr())},void 0,!1,pr):(Wt=new Map,ii=new Map);const Sr=Array.from(be.patternDependencies.keys()).map(xr=>o.I.parse(xr));Sr.length?Q.send("getImages",{images:Sr,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(xr,Qr)=>{Gt||(Gt=xr,fi=new Map,Ki=this.updateImageMapAndGetImageTaskQueue(fi,Qr,be.patternDependencies),fr())},void 0,!1,pr):(fi=new Map,Ki=new Map)}if(be.elevationFeatures&&be.elevationFeatures.length>0){const Pi=[];for(const Sr of Object.values(ye))if(Sr instanceof o.b8){const xr=Sr.getUnevaluatedPortalGraph();xr&&Pi.push(xr)}const Pr=o.f6.evaluate(Pi);for(const Sr of Object.values(ye))if(Sr instanceof o.b8){const xr=O.layers[ge.decode(Sr.sourceLayerIndex)];Sr.setEvaluatedPortalGraph(Pr,xr,this.tileID.canonical,be.availableImages,be.brightness)}}fr()};We.length>0?Promise.allSettled(We).then(ft).catch(ce):ft()}rasterizeIfNeeded(O,U,X,se){Array.from(U.values()).some(Q=>Q.usvg)?this.rasterize(O,U,X,se):se()}updateImageMapAndGetImageTaskQueue(O,U,X){const se=new Map;for(const Q of U.keys()){const ce=X.get(Q)||[];for(const ge of ce){const ue=ge.toString(),ye=U.get(ge.id.toString());ye.usvg?se.has(ue)||(se.set(ue,ge),O.set(ue,Object.assign({},ye))):O.set(ue,ye)}}return se}rasterize(O,U,X,se){this.rasterizeTask=O.send("rasterizeImages",{scope:this.scope,tasks:X},(Q,ce)=>{if(!Q)for(const[ge,ue]of ce.entries()){const ye=Object.assign(U.get(ge),{data:ue});U.set(ge,ye)}se()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Ke(ve,O,U,X,se){const Q=new o.aa(O,{brightness:U,worldview:se});
15for(const ce of ve)ce.recalculate(Q,X)}class xt extends o.E{constructor(O,U,X,se,Q,ce,ge){super(),this.actor=O,this.layerIndex=U,this.availableImages=X,this.availableModels=se,this.loadVectorData=ce||o.aJ,this.loading={},this.loaded={},this.deduped=new o.aI(O.scheduler),this.isSpriteLoaded=Q,this.scheduler=O.scheduler,this.brightness=ge}loadTile(O,U){const X=O.uid,se=O&&O.request,Q=se&&se.collectResourceTiming,ce=this.loading[X]=new jt(O);ce.abort=this.loadVectorData(O,(ge,ue)=>{const ye=!this.loading[X];if(delete this.loading[X],ce.cancelRasterize(),ye||ge||!ue)return ce.status="done",ye||(this.loaded[X]=ce),U(ge);const De=ue.rawData,be={};ue.expires&&(be.expires=ue.expires),ue.cacheControl&&(be.cacheControl=ue.cacheControl),ce.vectorTile=ue.vectorTile||new o.fc.VectorTile(new o.bq(De));const We=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(dt,ft)=>{if(dt||!ft)return U(dt);const Gt={};if(Q){const qt=Nt(se);qt.length>0&&(Gt.resourceTiming=JSON.parse(JSON.stringify(qt)))}U(null,o.h({rawTileData:De.slice(0)},ft,be,Gt))})};this.isSpriteLoaded?We():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(We,{type:"parseTile",isSymbolTile:O.isSymbolTile,zoom:O.tileZoom}):We()}),this.loaded=this.loaded||{},this.loaded[X]=ce})}reloadTile(O,U){const X=this.loaded,se=O.uid;if(X&&X[se]){const Q=X[se];Q.scaleFactor=O.scaleFactor,Q.showCollisionBoxes=O.showCollisionBoxes,Q.projection=O.projection,Q.brightness=O.brightness,Q.tileTransform=o.aW(O.tileID.canonical,O.projection),Q.extraShadowCaster=O.extraShadowCaster,Q.lut=O.lut,Q.worldview=O.worldview;const ce=(ge,ue)=>{const ye=Q.reloadCallback;ye&&(delete Q.reloadCallback,Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ye)),U(ge,ue)};Q.status==="parsing"?Q.reloadCallback=ce:Q.status==="done"&&(Q.vectorTile?Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ce):ce())}else U(null,void 0)}abortTile(O,U){const X=O.uid,se=this.loading[X];se&&(se.abort&&se.abort(),delete this.loading[X]),U()}removeTile(O,U){const X=this.loaded,se=O.uid;X&&X[se]&&delete X[se],U()}}class Ze{loadTile(O,U){const{uid:X,encoding:se,rawImageData:Q,padding:ce}=O,ge=ImageBitmap&&Q instanceof ImageBitmap?this.getImageData(Q,ce):Q;U(null,new o.fd(X,ge,se,ce<1))}reloadTile(O,U){U(null,null)}abortTile(O,U){U()}removeTile(O,U){U()}getImageData(O,U){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(O.width,O.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=O.width,this.offscreenCanvas.height=O.height,this.offscreenCanvasContext.drawImage(O,0,0,O.width,O.height);const X=this.offscreenCanvasContext.getImageData(-U,-U,O.width+2*U,O.height+2*U);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),X}}o.bp.setPbf(o.bq);class It{constructor(O){this._mrt=new o.bp(O.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=O.uid,this.tileID=O.tileID,this.source=O.source}parse(O,U){const X=this._mrt;this.status="parsing",this._entireBuffer=O;try{X.parseHeader(O),this._isHeaderLoaded=!0;const se=[];for(const Q in X.layers){const ce=X.getLayer(Q),ge=ce.getDataRange(ce.getBandList()),ue=X.createDecodingTask(ge),ye=O.slice(ge.firstByte,ge.lastByte+1),De=o.bp.performDecoding(ye,ue).then(be=>ue.complete(null,be)).catch(be=>ue.complete(be,null));se.push(De)}Promise.allSettled(se).then(()=>U(null,X)).catch(Q=>U(Q))}catch(se){U(se)}}}class kt{constructor(O){this.actor=O,this.loading={},this.loaded={}}loadTile(O,U){const X=O.uid,se=O.request,Q=this.loading[X]=new It(O),{cancel:ce}=o.br(se,(ge,ue,ye,De)=>{const be=!this.loading[X];if(delete this.loading[X],be||ge||!ue)return Q.status="done",be||(this.loaded[X]=Q),U(ge);Q.parse(ue,(We,dt)=>{if(We||!dt)return U(We);U(null,dt,ye,De)}),this.loaded[X]=Q});Q.abort=ce}reloadTile(O,U){U(null,void 0)}abortTile(O,U){const X=O.uid,se=this.loading[X];se&&(se.abort&&se.abort(),delete this.loading[X]),U()}removeTile(O,U){const X=O.uid;this.loaded[X]&&delete this.loaded[X],U()}decodeRasterArray(O,U){o.bp.performDecoding(O.buffer,O.task).then(X=>U(null,X)).catch(X=>U(X))}}const Rt=o.fc.VectorTileFeature.prototype.toGeoJSON;class wt{constructor(O){this._feature=O,this.extent=o.aj,this.type=O.type,this.properties=O.tags,"id"in O&&!isNaN(O.id)&&
15(this.id=parseInt(O.id,10))}loadGeometry(){if(this._feature.type===1){const O=[];for(const U of this._feature.geometry)O.push([new o.P(U[0],U[1])]);return O}{const O=[];for(const U of this._feature.geometry){const X=[];for(const se of U)X.push(new o.P(se[0],se[1]));O.push(X)}return O}}toGeoJSON(O,U,X){return Rt.call(this,O,U,X)}}class Or{constructor(O){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.aj,this.length=O.length,this._features=O}feature(O){return new wt(this._features[O])}}class ln{constructor(O,U){this.name=O,this.extent=o.aj,this.length=U.length,this._features=U}feature(O){return new wt(this._features[O])}}class bn extends Or{constructor(O){super([]),this.layers={};for(const U in O)this.layers[U]=new ln(U,O[U])}}const Rn=64/4096,zs=128;class ci{constructor(){this.features=new Map}clear(){this.features.clear()}load(O=[],U){for(const X of O){const se=X.id;if(se==null)continue;let Q=this.features.get(se);Q&&this.updateCache(Q,U),X.geometry?(Q=vi(X),this.updateCache(Q,U),this.features.set(se,Q)):this.features.delete(se),this.updateCache(Q,U)}}updateCache(O,U){for(const{canonical:X,uid:se}of Object.values(U)){const{z:Q,x:ce,y:ge}=X;Vt(O,Math.pow(2,Q),ce,ge)&&delete U[se]}}getTile(O,U,X){const se=Math.pow(2,O),Q=[];for(const ce of this.features.values())Vt(ce,se,U,X)&&Q.push(Xr(ce,se,U,X));return{features:Q}}getFeatures(){return[...this.features.values()]}}function Vt({minX:ve,minY:O,maxX:U,maxY:X},se,Q,ce){return ve<(Q+1+Rn)/se&&O<(ce+1+Rn)/se&&U>(Q-Rn)/se&&X>(ce-Rn)/se}function vi(ve){const{id:O,geometry:U,properties:X}=ve;if(!U)return;if(U.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:se,coordinates:Q}=U,ce={id:O,type:1,geometry:[],tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},ge=ce.geometry;if(se==="Point")Kt(Q,ge,ce);else if(se==="MultiPoint")for(const ue of Q)Kt(ue,ge,ce);else if(se==="LineString")ce.type=2,ki(Q,ge,ce);else if(se==="MultiLineString")ce.type=2,Ji(Q,ge,ce);else if(se==="Polygon")ce.type=3,Ji(Q,ge,ce,!0);else{if(se!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const ue of Q)Ji(ue,ge,ce,!0)}return ce}function Kt([ve,O],U,X){const se=o.aD(ve);let Q=o.aH(O);Q=Q<0?0:Q>1?1:Q,U.push(se,Q),X.minX=Math.min(X.minX,se),X.minY=Math.min(X.minY,Q),X.maxX=Math.max(X.maxX,se),X.maxY=Math.max(X.maxY,Q)}function ki(ve,O,U,X=!1,se=!1){const Q=[];for(const ce of ve)Kt(ce,Q,U);O.push(Q),X&&function(ce,ge){let ue=0;
15for(let ye=0,De=ce.length,be=De-2;ye<De;be=ye,ye+=2)ue+=(ce[ye]-ce[be])*(ce[ye+1]+ce[be+1]);if(ue>0===ge)for(let ye=0,De=ce.length;ye<De/2;ye+=2){const be=ce[ye],We=ce[ye+1];ce[ye]=ce[De-2-ye],ce[ye+1]=ce[De-1-ye],ce[De-2-ye]=be,ce[De-1-ye]=We}}(Q,se)}function Ji(ve,O,U,X=!1){for(let se=0;se<ve.length;se++)ki(ve[se],O,U,X,se===0)}function Xr(ve,O,U,X){const{id:se,type:Q,geometry:ce,tags:ge}=ve,ue=[];if(Q===1)(function(ye,De,be,We,dt){for(let ft=0;ft<ye.length;ft+=2){const Gt=Math.round(o.aj*(ye[ft+0]*De-be)),qt=Math.round(o.aj*(ye[ft+1]*De-We));dt.push([Gt,qt])}})(ce,O,U,X,ue);else for(const ye of ce)Bn(ye,O,U,X,ue);return{id:se,type:Q,geometry:ue,tags:ge}}function Bn(ve,O,U,X,se){const ce=o.aj+zs;let ge;for(let ue=0;ue<ve.length-2;ue+=2){let ye=Math.round(o.aj*(ve[ue+0]*O-U)),De=Math.round(o.aj*(ve[ue+1]*O-X)),be=Math.round(o.aj*(ve[ue+2]*O-U)),We=Math.round(o.aj*(ve[ue+3]*O-X));const dt=be-ye,ft=We-De;ye<-128&&be<-128||(ye<-128?(De+=Math.round(ft*((-128-ye)/dt)),ye=-128):be<-128&&(We=De+Math.round(ft*((-128-ye)/dt)),be=-128),De<-128&&We<-128||(De<-128?(ye+=Math.round(dt*((-128-De)/ft)),De=-128):We<-128&&(be=ye+Math.round(dt*((-128-De)/ft)),We=-128),ye>=ce&&be>=ce||(ye>=ce?(De+=Math.round(ft*((ce-ye)/dt)),ye=ce):be>=ce&&(We=De+Math.round(ft*((ce-ye)/dt)),be=ce),De>=ce&&We>=ce||(De>=ce?(ye+=Math.round(dt*((ce-De)/ft)),De=ce):We>=ce&&(be=ye+Math.round(dt*((ce-De)/ft)),We=ce),ge&&ye===ge[ge.length-1][0]&&De===ge[ge.length-1][1]||(ge=[[ye,De]],se.push(ge)),ge.push([be,We])))))}}var cn,Zi,Jr,is={exports:{}},Ts=function(){if(Jr)return is.exports;Jr=1;var ve=o.fg(),O=function(){if(Zi)return cn;Zi=1;var De=o.fe(),be=o.ff().VectorTileFeature;function We(ft,Gt){this.options=Gt||{},this.features=ft,this.length=ft.length}function dt(ft,Gt){this.id=typeof ft.id=="number"?ft.id:void 0,this.type=ft.type,this.rawGeometry=ft.type===1?[ft.geometry]:ft.geometry,this.properties=ft.tags,this.extent=Gt||4096}return cn=We,We.prototype.feature=function(ft){return new dt(this.features[ft],this.options.extent)},dt.prototype.loadGeometry=function(){var ft=this.rawGeometry;this.geometry=[];for(var Gt=0;Gt<ft.length;Gt++){for(var qt=ft[Gt],Wt=[],fi=0;fi<qt.length;fi++)Wt.push(new De(qt[fi][0],qt[fi][1]));this.geometry.push(Wt)}return this.geometry},dt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ft=this.geometry,Gt=1/0,qt=-1/0,Wt=1/0,fi=-1/0,ii=0;ii<ft.length;ii++)for(var Ki=ft[ii],pr=0;pr<Ki.length;pr++){var fr=Ki[pr];Gt=Math.min(Gt,fr.x),qt=Math.max(qt,fr.x),Wt=Math.min(Wt,fr.y),fi=Math.max(fi,fr.y)}return[Gt,Wt,qt,fi]},dt.prototype.toGeoJSON=be.prototype.toGeoJSON,cn}();function U(De){var be=new ve;return function(We,dt){for(var ft in We.layers)dt.writeMessage(3,X,We.layers[ft])}(De,be),be.finish()}function X(De,be){var We;be.writeVarintField(15,De.version||1),be.writeStringField(1,De.name||""),be.writeVarintField(5,De.extent||4096);var dt={keys:[],values:[],keycache:{},valuecache:{}};for(We=0;We<De.length;We++)dt.feature=De.feature(We),be.writeMessage(2,se,dt);var ft=dt.keys;for(We=0;We<ft.length;We++)be.writeStringField(3,ft[We]);var Gt=dt.values;for(We=0;We<Gt.length;We++)be.writeMessage(4,ye,Gt[We])}function se(De,be){var We=De.feature;We.id!==void 0&&be.writeVarintField(1,We.id),be.writeMessage(2,Q,De),be.writeVarintField(3,We.type),be.writeMessage(4,ue,We)}function Q(De,be){var We=De.feature,dt=De.keys,ft=De.values,Gt=De.keycache,qt=De.valuecache;for(var Wt in We.properties){var fi=We.properties[Wt],ii=Gt[Wt];if(fi!==null){ii===void 0&&(dt.push(Wt),Gt[Wt]=ii=dt.length-1),be.writeVarint(ii);var Ki=typeof fi;Ki!=="string"&&Ki!=="boolean"&&Ki!=="number"&&(fi=JSON.stringify(fi));var pr=Ki+":"+fi,fr=qt[pr];fr===void 0&&(ft.push(fi),qt[pr]=fr=ft.length-1),be.writeVarint(fr)}}}function ce(De,be){return(be<<3)+(7&De)}function ge(De){return De<<1^De>>31}function ue(De,be){for(var We=De.loadGeometry(),dt=De.type,ft=0,Gt=0,qt=We.length,Wt=0;Wt<qt;Wt++){var fi=We[Wt],ii=1;dt===1&&(ii=fi.length),be.writeVarint(ce(1,ii));for(var Ki=dt===3?fi.length-1:fi.length,pr=0;pr<Ki;pr++){pr===1&&dt!==1&&be.writeVarint(ce(2,Ki-1));var fr=fi[pr].x-ft,Ui=fi[pr].y-Gt;be.writeVarint(ge(fr)),be.writeVarint(ge(Ui)),ft+=fr,Gt+=Ui}dt===3&&be.writeVarint(ce(7,1))}}function ye(De,be){var We=typeof De;We==="string"?be.writeStringField(1,De):We==="boolean"?be.writeBooleanField(7,De):We==="number"&&(De%1!=0?be.writeDoubleField(3,De):De<0?be.writeSVarintField(6,De):be.writeVarintField(5,De))}return is.exports=U,is.exports.fromVectorTileJs=U,is.exports.fromGeojsonVt=function(De,be){be=be||{};var We={};for(var dt in De)We[dt]=new O(De[dt].features,be),We[dt].name=dt,We[dt].version=be.ver
vendor: 5,359 bytes, line 15
15sion,We[dt].extent=be.extent;return U({layers:We})},is.exports.GeoJSONWrapper=O,is.exports}(),to=o.fh(Ts);const Tr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ve=>ve},Br=Math.fround||(Yr=new Float32Array(1),ve=>(Yr[0]=+ve,Yr[0]));var Yr;const rs=3,dr=5,da=6;class Ds{constructor(O){this.options=Object.assign(Object.create(Tr),O),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(O){const{log:U,minZoom:X,maxZoom:se}=this.options;U&&console.time("total time");const Q=`prepare ${O.length} points`;U&&console.time(Q),this.points=O;const ce=[];for(let ue=0;ue<O.length;ue++){const ye=O[ue];if(!ye.geometry)continue;const[De,be]=ye.geometry.coordinates,We=Br(pa(De)),dt=Br(io(be));ce.push(We,dt,1/0,ue,-1,1),this.options.reduce&&ce.push(0)}let ge=this.trees[se+1]=this._createTree(ce);U&&console.timeEnd(Q);for(let ue=se;ue>=X;ue--){const ye=+Date.now();ge=this.trees[ue]=this._createTree(this._cluster(ge,ue)),U&&console.log("z%d: %d clusters in %dms",ue,ge.numItems,+Date.now()-ye)}return U&&console.timeEnd("total time"),this}getClusters(O,U){let X=((O[0]+180)%360+360)%360-180;const se=Math.max(-90,Math.min(90,O[1]));let Q=O[2]===180?180:((O[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,O[3]));if(O[2]-O[0]>=360)X=-180,Q=180;else if(X>Q){const be=this.getClusters([X,se,180,ce],U),We=this.getClusters([-180,se,Q,ce],U);return be.concat(We)}const ge=this.trees[this._limitZoom(U)],ue=ge.range(pa(X),io(ce),pa(Q),io(se)),ye=ge.data,De=[];for(const be of ue){const We=this.stride*be;De.push(ye[We+dr]>1?ps(ye,We,this.clusterProps):this.points[ye[We+rs]])}return De}getChildren(O){const U=this._getOriginId(O),X=this._getOriginZoom(O),se="No cluster with the specified id.",Q=this.trees[X];if(!Q)throw new Error(se);const ce=Q.data;if(U*this.stride>=ce.length)throw new Error(se);const ge=this.options.radius/(this.options.extent*Math.pow(2,X-1)),ue=Q.within(ce[U*this.stride],ce[U*this.stride+1],ge),ye=[];for(const De of ue){const be=De*this.stride;ce[be+4]===O&&ye.push(ce[be+dr]>1?ps(ce,be,this.clusterProps):this.points[ce[be+rs]])}if(ye.length===0)throw new Error(se);return ye}getLeaves(O,U,X){const se=[];return this._appendLeaves(se,O,U=U||10,X=X||0,0),se}getTile(O,U,X){const se=this.trees[this._limitZoom(O)],Q=Math.pow(2,O),{extent:ce,radius:ge}=this.options,ue=ge/ce,ye=(X-ue)/Q,De=(X+1+ue)/Q,be={features:[]};return this._addTileFeatures(se.range((U-ue)/Q,ye,(U+1+ue)/Q,De),se.data,U,X,Q,be),U===0&&this._addTileFeatures(se.range(1-ue/Q,ye,1,De),se.data,Q,X,Q,be),U===Q-1&&this._addTileFeatures(se.range(0,ye,ue/Q,De),se.data,-1,X,Q,be),be.features.length?be:null}getClusterExpansionZoom(O){let U=this._getOriginZoom(O)-1;for(;U<=this.options.maxZoom;){const X=this.getChildren(O);if(U++,X.length!==1)break;O=X[0].properties.cluster_id}return U}_appendLeaves(O,U,X,se,Q){const ce=this.getChildren(U);for(const ge of ce){const ue=ge.properties;if(ue&&ue.cluster?Q+ue.point_count<=se?Q+=ue.point_count:Q=this._appendLeaves(O,ue.cluster_id,X,se,Q):Q<se?Q++:O.push(ge),O.length===X)break}return Q}_createTree(O){const U=new o.bW(O.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<O.length;X+=this.stride)U.add(O[X],O[X+1]);return U.finish(),U.data=O,U}_addTileFeatures(O,U,X,se,Q,ce){for(const ge of O){const ue=ge*this.stride,ye=U[ue+dr]>1;let De,be,We;if(ye)De=Nr(U,ue,this.clusterProps),be=U[ue],We=U[ue+1];else{const Gt=this.points[U[ue+rs]];De=Gt.properties;const[qt,Wt]=Gt.geometry.coordinates;be=pa(qt),We=io(Wt)}const dt={type:1,geometry:[[Math.round(this.options.extent*(be*Q-X)),Math.round(this.options.extent*(We*Q-se))]],tags:De};let ft;ft=ye||this.options.generateId?U[ue+rs]:this.points[U[ue+rs]].id,ft!==void 0&&(dt.id=ft),ce.features.push(dt)}}_limitZoom(O){return Math.max(this.options.minZoom,Math.min(Math.floor(+O),this.options.maxZoom+1))}_cluster(O,U){const{radius:X,extent:se,reduce:Q,minPoints:ce}=this.options,ge=X/(se*Math.pow(2,U)),ue=O.data,ye=[],De=this.stride;for(let be=0;be<ue.length;be+=De){if(ue[be+2]<=U)continue;ue[be+2]=U;const We=ue[be],dt=ue[be+1],ft=O.within(ue[be],ue[be+1],ge),Gt=ue[be+dr];let qt=Gt;for(const Wt of ft){const fi=Wt*De;ue[fi+2]>U&&(qt+=ue[fi+dr])}if(qt>Gt&&qt>=ce){let Wt,fi=We*Gt,ii=dt*Gt,Ki=-1;const pr=(be/De<<5)+(U+1)+this.points.length;for(const fr of ft){const Ui=fr*De;if(ue[Ui+2]<=U)continue;ue[Ui+2]=U;const Pi=ue[Ui+dr];fi+=ue[Ui]*Pi,ii+=ue[Ui+1]*Pi,ue[Ui+4]=pr,Q&&(Wt||(Wt=this._map(ue,be,!0),Ki=this.clusterProps.length,this.clusterProps.push(Wt)),Q(Wt,this._map(ue,Ui)))}ue[be+4]=pr,ye.push(fi/qt,ii/qt,1/0,pr,-1,qt),Q&&ye.push(Ki)}else{for(let Wt=0;Wt<De;Wt++)ye.push(ue[be+Wt]);if(qt>1)for(const Wt of ft){const fi=Wt*De;if(!(ue[fi+2]<=U)){ue[fi+2]=U;for(let ii=0;ii<De;ii++)ye.push(ue[fi+ii])}}}}return ye}_getOriginId(O){return O-this.points.length>>5}_getOriginZoom(O){return(O-this.points.length)%32}_map(O,U,X){if(O[U+dr]>1){const ce=this.clusterProps[O[U+da]];return X?Object.assign({},ce):ce}const se=this.points[O[U+rs]].properties,Q=this.options.map(se);return X&&Q===se?Object.assign({},Q):Q}}function ps(ve,O,U){return{type:"Feature",id:ve[O+rs],properties:Nr(ve,O,U),geometry:{type:"Point",coordinates:[(X=ve[O],360*(X-.5)),wn(ve[O+1])]}};var X}function Nr(ve,O,U){const X=ve[O+dr],se=X>=1e4?`${Math.round(X/1e3)}
15k`:X>=1e3?Math.round(X/100)/10+"k":X,Q=ve[O+da],ce=Q===-1?{}:Object.assign({},U[Q]);return Object.assign(ce,{cluster:!0,cluster_id:ve[O+rs],point_count:X,point_count_abbreviated:se})}function pa(ve){return ve/360+.5}function io(ve){const O=Math.sin(ve*Math.PI/180),U=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return U<0?0:U>1?1:U}function wn(ve){const O=(180-360*ve)*Math.PI/180;return 360*Math.atan(Math.exp(O))/Math.PI-90}function Lo(ve,O,U,X){let se=X;const Q=O+(U-O>>1);let ce,ge=U-O;const ue=ve[O],ye=ve[O+1],De=ve[U],be=ve[U+1];for(let We=O+3;We<U;We+=3){const dt=dl(ve[We],ve[We+1],ue,ye,De,be);if(dt>se)ce=We,se=dt;else if(dt===se){const ft=Math.abs(We-Q);ft<ge&&(ce=We,ge=ft)}}se>X&&(ce-O>3&&Lo(ve,O,ce,X),ve[ce+2]=se,U-ce>3&&Lo(ve,ce,U,X))}function dl(ve,O,U,X,se,Q){let ce=se-U,ge=Q-X;if(ce!==0||ge!==0){const ue=((ve-U)*ce+(O-X)*ge)/(ce*ce+ge*ge);ue>1?(U=se,X=Q):ue>0&&(U+=ce*ue,X+=ge*ue)}return ce=ve-U,ge=O-X,ce*ce+ge*ge}function Tn(ve,O,U,X){const se={id:ve??null,type:O,geometry:U,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(O==="Point"||O==="MultiPoint"||O==="LineString")Nn(se,U);else if(O==="Polygon")Nn(se,U[0]);else if(O==="MultiLineString")for(const Q of U)Nn(se,Q);else if(O==="MultiPolygon")for(const Q of U)Nn(se,Q[0]);return se}function Nn(ve,O){for(let U=0;U<O.length;U+=3)ve.minX=Math.min(ve.minX,O[U]),ve.minY=Math.min(ve.minY,O[U+1]),ve.maxX=Math.max(ve.maxX,O[U]),ve.maxY=Math.max(ve.maxY,O[U+1])}function ro(ve,O,U,X){if(!O.geometry)return;const se=O.geometry.coordinates;if(se&&se.length===0)return;const Q=O.geometry.type,ce=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let ge=[],ue=O.id;if(U.promoteId?ue=O.properties[U.promoteId]:U.generateId&&(ue=X||0),Q==="Point")no(se,ge);else if(Q==="MultiPoint")for(const ye of se)no(ye,ge);else if(Q==="LineString")so(se,ge,ce,!1);else if(Q==="MultiLineString"){if(U.lineMetrics){for(const ye of se)ge=[],so(ye,ge,ce,!1),ve.push(Tn(ue,"LineString",ge,O.properties));return}Sn(se,ge,ce,!1)}else if(Q==="Polygon")Sn(se,ge,ce,!0);else{if(Q!=="MultiPolygon"){if(Q==="GeometryCollection"){for(const ye of O.geometry.geometries)ro(ve,{id:ue,geometry:ye,properties:O.properties},U,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ye of se){const De=[];Sn(ye,De,ce,!0),ge.push(De)}}ve.push(Tn(ue,Q,ge,O.properties))}function no(ve,O){O.push(fa(ve[0]),ma(ve[1]),0)}function so(ve,O,U,X){let se,Q,ce=0;for(let ue=0;ue<ve.length;ue++){const ye=fa(ve[ue][0]),De=ma(ve[ue][1]);O.push(ye,De,0),ue>0&&(ce+=X?(se*De-ye*Q)/2:Math.sqrt(Math.pow(ye-se,2)+Math.pow(De-Q,2))),se=ye,Q=De}const ge=O.length-3;O[2]=1,Lo(O,0,ge,U),O[ge+2]=1,O.size=Math.abs(ce),O.start=0,O.end=O.size}function Sn(ve,O,U,X){for(let se=0;se<ve.length;se++){const Q=[];so(ve[se],Q,U,X),O.push(Q)}}function fa(ve){return ve/360+.5}function ma(ve){const O=Math.sin(ve*Math.PI/180),U=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return U<0?0:U>1?1:U}function Vn(ve,O,U,X,se,Q,ce,ge){if(X/=O,Q>=(U/=O)&&ce<X)return ve;if(ce<U||Q>=X)return null;const ue=[];for(const ye of ve){const De=ye.geometry;let be=ye.type;const We=se===0?ye.minX:ye.minY,dt=se===0?ye.maxX:ye.maxY;if(We>=U&&dt<X){ue.push(ye);continue}if(dt<U||We>=X)continue;let ft=[];if(be==="Point"||be==="MultiPoint")pl(De,ft,U,X,se);else if(be==="LineString")Ls(De,ft,U,X,se,!1,ge.lineMetrics);else if(be==="MultiLineString")fn(De,ft,U,X,se,!1);else if(be==="Polygon")fn(De,ft,U,X,se,!0);else if(be==="MultiPolygon")for(const Gt of De){const qt=[];fn(Gt,qt,U,X,se,!0),qt.length&&ft.push(qt)}if(ft.length){if(ge.lineMetrics&&be==="LineString"){for(const Gt of ft)ue.push(Tn(ye.id,be,Gt,ye.tags));continue}be!=="LineString"&&be!=="MultiLineString"||(ft.length===1?(be="LineString",ft=ft[0]):be="MultiLineString"),be!=="Point"&&be!=="MultiPoint"||(be=ft.length===3?"Point":"MultiPoint"),ue.push(Tn(ye.id,be,ft,ye.tags))}}return ue.length?ue:null}function pl(ve,O,U,X,se){for(let Q=0;Q<ve.length;Q+=3){const ce=ve[Q+se];ce>=U&&ce<=X&&ns(O,ve[Q],ve[Q+1],ve[Q+2])}}function Ls(ve,O,U,X,se,Q,ce){let ge=_a(ve);const ue=se===0?ko:oo;let ye,De,be=ve.start;for(let qt=0;qt<ve.length-3;qt+=3){const Wt=ve[qt],fi=ve[qt+1],ii=ve[qt+2],Ki=ve[qt+3],pr=ve[qt+4],fr=se===0?Wt:fi,Ui=se===0?Ki:pr;let Pi=!1;ce&&(ye=Math.sqrt(Math.pow(Wt-Ki,2)+Math.pow(fi-pr,2))),fr<U?Ui>U&&(De=ue(ge,Wt,fi,Ki,pr,U),ce&&(ge.start=be+ye*De)):fr>X?Ui<X&&(De=ue(ge,Wt,fi,Ki,pr,X),ce&&(ge.start=be+ye*De)):ns(ge,Wt,fi,ii),Ui<U&&fr>=U&&(De=ue(ge,Wt,fi,Ki,pr,U),Pi=!0),Ui>X&&fr<=X&&(De=ue(ge,Wt,fi,Ki,pr,X),Pi=!0),!Q&&Pi&&(ce&&(ge.end=be+ye*De),O.push(ge),ge=_a(ve)),ce&&(be+=ye)}let We=ve.length-3;const dt=ve[We],ft=ve[We+1],Gt=se===0?dt:ft;Gt>=U&&Gt<=X&&ns(ge,dt,ft,ve[We+2]),We=ge.length-3,Q&&We>=3&&(ge[We]!==ge[0]||ge[We+1]!==ge[1])&&ns(ge,ge[0],ge[1],ge[2]),ge.length&&O.push(ge)}function _a(ve){const O=[];return O.size=ve.size,O.start=ve.start,O.end=ve.end,O}function fn(ve,O,U,X,se,Q){for(const ce of ve)Ls(ce,O,U,X,se,Q,!1)}function ns(ve,O,U,X){ve.push(O,U,X)}function ko(ve,O,U,X,se,Q){const ce=(Q-O)/(X-O);return ns(ve,Q,U+(se-U)*ce,1),ce}function oo(ve,O,U,X,se,Q){const ce=(Q-U)/(se-U);return ns(ve,O+(X-O)*ce,Q,1),ce}function Fo(ve,O){const U=[];for(let X=0;X<ve.length;X++){const se=ve[X],Q=se.type;let ce;if(Q==="Point"||Q==="MultiPoint"||Q==="LineString")ce=ao(se.geometry,O);else if(Q==="MultiLineString"||Q==="Polygon"){ce=[];for(const ge of se.geometry)ce.push(ao(ge,O))}else if(Q==="MultiPolygon"){ce=[];for(const ge of se.geometry){const ue=[];for(const ye of ge)ue.push(ao(ye,O));
vendor: 4,643 bytes, line 15
15ce.push(ue)}}U.push(Tn(se.id,Q,ce,se.tags))}return U}function ao(ve,O){const U=[];U.size=ve.size,ve.start!==void 0&&(U.start=ve.start,U.end=ve.end);for(let X=0;X<ve.length;X+=3)U.push(ve[X]+O,ve[X+1],ve[X+2]);return U}function ga(ve,O){if(ve.transformed)return ve;const U=1<<ve.z,X=ve.x,se=ve.y;for(const Q of ve.features){const ce=Q.geometry,ge=Q.type;if(Q.geometry=[],ge===1)for(let ue=0;ue<ce.length;ue+=2)Q.geometry.push(yr(ce[ue],ce[ue+1],O,U,X,se));else for(let ue=0;ue<ce.length;ue++){const ye=[];for(let De=0;De<ce[ue].length;De+=2)ye.push(yr(ce[ue][De],ce[ue][De+1],O,U,X,se));Q.geometry.push(ye)}}return ve.transformed=!0,ve}function yr(ve,O,U,X,se,Q){return[Math.round(U*(ve*X-se)),Math.round(U*(O*X-Q))]}function lo(ve,O,U,X,se){const Q=O===se.maxZoom?0:se.tolerance/((1<<O)*se.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:ve.length,source:null,x:U,y:X,z:O,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of ve)ya(ce,ge,Q,se);return ce}function ya(ve,O,U,X){const se=O.geometry,Q=O.type,ce=[];if(ve.minX=Math.min(ve.minX,O.minX),ve.minY=Math.min(ve.minY,O.minY),ve.maxX=Math.max(ve.maxX,O.maxX),ve.maxY=Math.max(ve.maxY,O.maxY),Q==="Point"||Q==="MultiPoint")for(let ge=0;ge<se.length;ge+=3)ce.push(se[ge],se[ge+1]),ve.numPoints++,ve.numSimplified++;else if(Q==="LineString")Un(ce,se,ve,U,!1,!1);else if(Q==="MultiLineString"||Q==="Polygon")for(let ge=0;ge<se.length;ge++)Un(ce,se[ge],ve,U,Q==="Polygon",ge===0);else if(Q==="MultiPolygon")for(let ge=0;ge<se.length;ge++){const ue=se[ge];for(let ye=0;ye<ue.length;ye++)Un(ce,ue[ye],ve,U,!0,ye===0)}if(ce.length){let ge=O.tags||null;if(Q==="LineString"&&X.lineMetrics){ge={};for(const ye in O.tags)ge[ye]=O.tags[ye];ge.mapbox_clip_start=se.start/se.size,ge.mapbox_clip_end=se.end/se.size}const ue={geometry:ce,type:Q==="Polygon"||Q==="MultiPolygon"?3:Q==="LineString"||Q==="MultiLineString"?2:1,tags:ge};O.id!==null&&(ue.id=O.id),ve.features.push(ue)}}function Un(ve,O,U,X,se,Q){const ce=X*X;if(X>0&&O.size<(se?ce:X))return void(U.numPoints+=O.length/3);const ge=[];for(let ue=0;ue<O.length;ue+=3)(X===0||O[ue+2]>ce)&&(U.numSimplified++,ge.push(O[ue],O[ue+1])),U.numPoints++;se&&function(ue,ye){let De=0;for(let be=0,We=ue.length,dt=We-2;be<We;dt=be,be+=2)De+=(ue[be]-ue[dt])*(ue[be+1]+ue[dt+1]);if(De>0===ye)for(let be=0,We=ue.length;be<We/2;be+=2){const dt=ue[be],ft=ue[be+1];ue[be]=ue[We-2-be],ue[be+1]=ue[We-1-be],ue[We-2-be]=dt,ue[We-1-be]=ft}}(ge,Q),ve.push(ge)}const Hu={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Sc{constructor(O,U){const X=(U=this.options=function(Q,ce){for(const ge in ce)Q[ge]=ce[ge];return Q}(Object.create(Hu),U)).debug;if(X&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let se=function(Q,ce){const ge=[];if(Q.type==="FeatureCollection")for(let ue=0;ue<Q.features.length;ue++)ro(ge,Q.features[ue],ce,ue);else ro(ge,Q.type==="Feature"?Q:{geometry:Q},ce);return ge}(O,U);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),se=function(Q,ce){const ge=ce.buffer/ce.extent;let ue=Q;const ye=Vn(Q,1,-1-ge,ge,0,-1,2,ce),De=Vn(Q,1,1-ge,2+ge,0,-1,2,ce);return(ye||De)&&(ue=Vn(Q,1,-ge,1+ge,0,-1,2,ce)||[],ye&&(ue=Fo(ye,1).concat(ue)),De&&(ue=ue.concat(Fo(De,-1)))),ue}(se,U),se.length&&this.splitTile(se,0,0,0),X&&(se.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(O,U,X,se,Q,ce,ge){const ue=[O,U,X,se],ye=this.options,De=ye.debug;for(;ue.length;){se=ue.pop(),X=ue.pop(),U=ue.pop(),O=ue.pop();const be=1<<U,We=Oo(U,X,se);let dt=this.tiles[We];if(!dt&&(De>1&&console.time("creation"),dt=this.tiles[We]=lo(O,U,X,se,ye),this.tileCoords.push({z:U,x:X,y:se}),De)){De>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,X,se,dt.numFeatures,dt.numPoints,dt.numSimplified),console.timeEnd("creation"));const Pi=`z${U}`;this.stats[Pi]=(this.stats[Pi]||0)+1,this.total++}if(dt.source=O,Q==null){if(U===ye.indexMaxZoom||dt.numPoints<=ye.indexMaxPoints)continue}else{if(U===ye.maxZoom||U===Q)continue;if(Q!=null){const Pi=Q-U;if(X!==ce>>Pi||se!==ge>>Pi)continue}}if(dt.source=null,O.length===0)continue;De>1&&console.time("clipping");
15const ft=.5*ye.buffer/ye.extent,Gt=.5-ft,qt=.5+ft,Wt=1+ft;let fi=null,ii=null,Ki=null,pr=null,fr=Vn(O,be,X-ft,X+qt,0,dt.minX,dt.maxX,ye),Ui=Vn(O,be,X+Gt,X+Wt,0,dt.minX,dt.maxX,ye);O=null,fr&&(fi=Vn(fr,be,se-ft,se+qt,1,dt.minY,dt.maxY,ye),ii=Vn(fr,be,se+Gt,se+Wt,1,dt.minY,dt.maxY,ye),fr=null),Ui&&(Ki=Vn(Ui,be,se-ft,se+qt,1,dt.minY,dt.maxY,ye),pr=Vn(Ui,be,se+Gt,se+Wt,1,dt.minY,dt.maxY,ye),Ui=null),De>1&&console.timeEnd("clipping"),ue.push(fi||[],U+1,2*X,2*se),ue.push(ii||[],U+1,2*X,2*se+1),ue.push(Ki||[],U+1,2*X+1,2*se),ue.push(pr||[],U+1,2*X+1,2*se+1)}}getTile(O,U,X){O=+O,U=+U,X=+X;const se=this.options,{extent:Q,debug:ce}=se;if(O<0||O>24)return null;const ge=1<<O,ue=Oo(O,U=U+ge&ge-1,X);if(this.tiles[ue])return ga(this.tiles[ue],Q);ce>1&&console.log("drilling down to z%d-%d-%d",O,U,X);let ye,De=O,be=U,We=X;for(;!ye&&De>0;)De--,be>>=1,We>>=1,ye=this.tiles[Oo(De,be,We)];return ye&&ye.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",De,be,We),console.time("drilling down")),this.splitTile(ye.source,De,be,We,O,U,X),ce>1&&console.timeEnd("drilling down"),this.tiles[ue]?ga(this.tiles[ue],Q):null):null}}function Oo(ve,O,U){return 32*((1<<ve)*U+O)+ve}function Xe(ve,O){const U=ve.tileID.canonical;if(!this._geoJSONIndex)return void O(null,null);const X=this._geoJSONIndex.getTile(U.z,U.x,U.y);if(!X)return void O(null,null);const se=ue=>ue.tags&&"3d_elevation_id"in ue.tags&&"source"in ue.tags&&ue.tags.source==="elevation",Q=X.features.filter(ue=>se(ue));let ce;if(Q.length>0){const ue=X.features.filter(ye=>!se(ye));ce=new bn({_geojsonTileLayer:ue,hd_road_elevation:Q})}else ce=new Or(X.features);let ge=to(ce);ge.byteOffset===0&&ge.byteLength===ge.buffer.byteLength||(ge=new Uint8Array(ge)),O(null,{vectorTile:ce,rawData:ge.buffer})}class ks extends xt{constructor(O,U,X,se,Q,ce,ge){super(O,U,X,se,Q,Xe,ge),ce&&(this.loadGeoJSON=ce),this._dynamicIndex=new ci}loadData(O,U){const X=O&&O.request,se=X&&X.collectResourceTiming;this.loadGeoJSON(O,(Q,ce)=>{if(Q||!ce)return U(Q);if(typeof ce!="object")return U(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));{try{if(O.filter){const ue=o.X(O.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));ce.features=ce.features.filter(ye=>ue.value.evaluate({zoom:0},ye))}O.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),O.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),O.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=O.cluster?new Ds(function({superclusterOptions:ue,clusterProperties:ye}){if(!ye||!ue)return ue;const De={},be={},We={accumulated:null,zoom:0},dt={properties:null},ft=Object.keys(ye);for(const Gt of ft){const[qt,Wt]=ye[Gt],fi=o.X(Wt),ii=o.X(typeof qt=="string"?[qt,["accumulated"],["get",Gt]]:qt);De[Gt]=fi.value,be[Gt]=ii.value}return ue.map=Gt=>{dt.properties=Gt;const qt={};for(const Wt of ft)qt[Wt]=De[Wt].evaluate(We,dt);return qt},ue.reduce=(Gt,qt)=>{dt.properties=qt;for(const Wt of ft)We.accumulated=Gt[Wt],Gt[Wt]=be[Wt].evaluate(We,dt)},ue}(O)).load(ce.features):O.dynamic?this._dynamicIndex:function(ue,ye){return new Sc(ue,ye)}(ce,O.geojsonVtOptions)}catch(ue){return U(ue)}const ge={};if(se){const ue=Nt(X);ue&&(ge.resourceTiming={},ge.resourceTiming[O.source]=JSON.parse(JSON.stringify(ue)))}U(null,ge)}})}reloadTile(O,U){const X=this.loaded;return X&&X[O.uid]?O.partial?U(null,void 0):super.reloadTile(O,U):this.loadTile(O,U)}loadGeoJSON(O,U){if(O.request)o.n(O.request,U);else{if(typeof O.data!="string")return U(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));try{return U(null,JSON.parse(O.data))}catch{return U(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(O,U){try{U(null,this._geoJSONIndex.getClusterExpansionZoom(O.clusterId))}catch(X){U(X)}}getClusterChildren(O,U){try{U(null,this._geoJSONIndex.getChildren(O.clusterId))}catch(X){U(X)}}getClusterLeaves(O,U){try{U(null,this._geoJSONIndex.getLeaves(O.clusterId,O.limit,O.offset))}catch(X){U(X)}}}class Zu{constructor(O,U,X){this.tileID=new o.aM(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.tileZoom=O.tileZoom,this.uid=O.uid,this.zoom=O.zoom,this.canonical=O.tileID.canonical,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=O.projection,this.brightness=U,this.worldview=X}parse(O,U,X,se){this.status="parsing";const Q=new o.aM(X.tileID.overscaledZ,X.tileID.wrap,X.tileID.canonical.z,X.tileID.canonical.x,X.tileID.canonical.y),ce=[],ge=U.familiesBySource[X.source],ue=new o.f0(Q,X.promoteId);ue.bucketLayerIDs=[],ue.is3DTile=!0,o.fi(O).then(ye=>{if(!ye)return se(new Error("Could not parse tile"));const De=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("MAPBOX_mesh_features")||ye.json.asset.extras&&ye.json.asset.extras.MAPBOX_mesh_features,be=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("EXT_meshopt_compression"),We=new o.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const dt in ge)for(const ft of ge[dt]){const Gt=ft[0];ue.bucketLayerIDs.push(ft.map(fi=>o.C(fi.id,fi.scope))),Gt.recalculate(We,[]);
15const qt=o.fj(ye,1/o.cU(X.tileID.canonical)),Wt=new o.fk(ft,qt,Q,De,be,this.brightness,ue,this.worldview);De||(Wt.needsUpload=!0),ce.push(Wt),Wt.evaluate(Gt)}this.status="done",se(null,{buckets:ce,featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(ye=>se(new Error(ye.message)))}}class fl{constructor(O,U,X,se,Q,ce,ge,ue){this.actor=O,this.layerIndex=U,this.availableImages=X,this.availableModels=se,this.brightness=ge,this.loading={},this.loaded={},this.worldview=ue}loadTile(O,U){const X=O.uid,se=this.loading[X]=new Zu(O,this.brightness,this.worldview);o.br(O.request,(Q,ce)=>{const ge=!this.loading[X];return delete this.loading[X],ge||Q?(se.status="done",ge||(this.loaded[X]=se),U(Q)):ce&&ce.byteLength!==0?void se.parse(ce,this.layerIndex,O,(ue,ye)=>{se.status="done",this.loaded=this.loaded||{},this.loaded[X]=se,ue||!ye?U(ue):U(null,ye)}):(se.status="done",this.loaded[X]=se,U())})}reloadTile(O,U){const X=this.loaded,se=O.uid;if(X&&X[se]){const Q=X[se];Q.projection=O.projection,Q.brightness=O.brightness;const ce=(ge,ue)=>{Q.reloadCallback&&(delete Q.reloadCallback,this.loadTile(O,U)),U(ge,ue)};Q.status==="parsing"?Q.reloadCallback=ce:Q.status==="done"&&this.loadTile(O,U)}}abortTile(O,U){const X=O.uid;this.loading[X]&&delete this.loading[X],U()}removeTile(O,U){const X=this.loaded,se=O.uid;X&&X[se]&&delete X[se],U()}}class Mi{constructor(O){this.self=O,this.actor=new o.fm(O,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new o.y,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=o.ce({name:"mercator"}),this.workerSourceTypes={vector:xt,geojson:ks,"raster-dem":Ze,"raster-array":kt,"batched-model":fl},this.workerSources={},this.self.registerWorkerSource=(U,X)=>{if(this.workerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.workerSourceTypes[U]=X},this.self.registerRTLTextPlugin=U=>{if(o.fn.isParsed())throw new Error("RTL text plugin already registered.");o.fn.setState({pluginStatus:o.fo.parsed,pluginURL:o.fn.getPluginURL()}),o.fn.applyArabicShaping=U.applyArabicShaping,o.fn.processBidirectionalText=U.processBidirectionalText,o.fn.processStyledBidirectionalText=U.processStyledBidirectionalText;for(const X of this.rtlPluginParsingListeners)X(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(O,U,X){delete this.layerIndexes[O],delete this.availableImages[O],delete this.availableModels[O],delete this.workerSources[O],X()}checkIfReady(O,U,X){X()}setReferrer(O,U){this.referrer=U}spriteLoaded(O,U){this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={});const{scope:X,isLoaded:se}=U;if(this.isSpriteLoaded[O][X]=se,this.workerSources[O]&&this.workerSources[O][X])for(const Q in this.workerSources[O][X]){const ce=this.workerSources[O][X][Q];for(const ge in ce){const ue=ce[ge];ue instanceof xt&&(ue.isSpriteLoaded=se,ue.fire(new o.A("isSpriteLoaded")))}}}setImages(O,U,X){this.availableImages[O]||(this.availableImages[O]={});const{scope:se,images:Q}=U;if(this.availableImages[O][se]=Q,this.workerSources[O]&&this.workerSources[O][se]){for(const ce in this.workerSources[O][se]){const ge=this.workerSources[O][se][ce];for(const ue in ge)ge[ue].availableImages=Q}X()}else X()}setModels(O,{scope:U,models:X},se){if(this.availableModels[O]||(this.availableModels[O]={}),this.availableModels[O][U]=X,this.workerSources[O]&&this.workerSources[O][U]){for(const Q in this.workerSources[O][U]){const ce=this.workerSources[O][U][Q];for(const ge in ce)ce[ge].availableModels=X}se()}else se()}setProjection(O,U){this.projections[O]=o.ce(U)}setBrightness(O,U,X){this.brightness=U,X()}setWorldview(O,U,X){this.worldview=U,X()}setLayers(O,U,X){this.getLayerIndex(O,U.scope).replace(U.layers,U.options),X()}updateLayers(O,U,X){this.getLayerIndex(O,U.scope).update(U.layers,U.removedIds,U.options),X()}loadTile(O,U,X){U.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,U.type,U.source,U.scope).loadTile(U,X)}decodeRasterArray(O,U,X){this.getWorkerSource(O,U.type,U.source,U.scope).decodeRasterArray(U,X)}reloadTile(O,U,X){U.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,U.type,U.source,U.scope).reloadTile(U,X)}abortTile(O,U,X){this.getWorkerSource(O,U.type,U.source,U.scope).abortTile(U,X)}removeTile(O,U,X){this.getWorkerSource(O,U.type,U.source,U.scope).removeTile(U,X)}removeSource(O,U,X){if(!(this.workerSources[O]&&this.workerSources[O][U.scope]&&this.workerSources[O][U.scope][U.type]&&this.workerSources[O][U.scope][U.type][U.source]))return;const se=this.workerSources[O][U.scope][U.type][U.source];delete this.workerSources[O][U.scope][U.type][U.source],se.removeSource!==void 0?se.removeSource(U,X):X()}loadWorkerSource(O,U,X){try{this.self.importScripts(U.url),X()}catch(se){X(se.toString())}}syncRTLPluginState(O,U,X){if(o.fn.isParsed())X(null,!0);else if(o.fn.isParsing())this.rtlPluginParsingListeners.push(X);else try{o.fn.setState(U);const se=o.fn.getPluginURL();!o.fn.isLoaded()||o.fn.isParsed()||o.fn.isParsing()||se==null||(o.fn.setState({pluginStatus:o.fo.parsing,pluginURL:o.fn.getPluginURL()}),this.self.importScripts(se),o.fn.isParsed()?X(null,!0):this.rtlPluginParsingListeners.push(X))}catch(se){X(se.toString())}}setDracoUrl(O,U){this.dracoUrl=U}getAvailableImages(O,U){this.availableImages[O]||(this.availableImages[O]={});let X=this.availableImages[O][U];return X||(X=[]),X}getAvailableModels(O,U){this.availableModels[O]||(this.availableModels[O]={});let X=this.availableModels[O][U];return X||(X={}),X}getLayerIndex(O,U){this.layerIndexes[O]||(this.layerIndexes[O]={});let X=this.layerIndexes[O][U];return X||(X=this.layerIndexes[O][U]=new Pt,X.scope=U),X}getWorkerSource(O,U,X,se){const Q=this.workerSources;return Q[O]||(Q[O]={}),Q[O][se]||(Q[O][se]={}),Q[O][se][U]||(Q[O][se][U]={}),this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={}),Q[O][se][U][X]||(Q[O][se][U][X]=new this.workerSourceTypes[U]({send:(ce,ge,ue,ye,De,be)=>this.actor.send(ce,ge,ue,O,De,be),scheduler:this.actor.scheduler},this.getLayerIndex(O,se),this.getAvailableImages(O,se),this.getAvailableModels(O,se),this.isSpriteLoaded[O][se],void 0,this.brightness,this.worldview)),Q[O][se][U][X]}rasterizeImagesWorker(O,U,X){const se=new Map;for(const[Q,{image:ce,imageVariant:ge}]of U.tasks.entries()){const ue=this.imageRasterizer.rasterize(ge,ce,U.scope,O);se.set(Q,ue)}X(void 0,se)}removeRasterizedImages(O,U,X){this.imageRasterizer.removeImagesFromCacheByIds(U.imageIds,U.scope,O),X()}enforceCacheSizeLimit(O,U){o.fp(U)}getWorkerPerformanceMetrics(O,U,X){X(void 0,void 0)}}return o.fl(self)&&(self.worker=new Mi(self)),Mi}),Lt(["./shared"],function(o){var Nt="3.13.0";const lt={create:"create",load:"load",fullLoad:"fullLoad"},yt={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function Pt(l){const t=l.name.split("?")[0];return o.a(t)&&t.includes("mapbox-gl.js")?"javascript":o.a(t)&&t.includes("mapbox-gl.css")?"css":o.b(t)?"fontRange":o.c(t)?"sprite":o.i(t)?"style":o.d(t)?"tilejson":"other"}var Zt,li={},jt=function(){if(Zt)return li;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,m,y=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(y);try{m=new Worker(x),p=!0}catch{p=!1}return m&&m.terminate(),URL.revokeObjectURL(x),p}()?function(){var p=document.createElement("canvas");p.width=p.height=1;var m=p.getContext("2d");if(!m)return!1;var y=m.getImageData(0,0,1,1);return y&&y.width===p.width}()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=function(p){var m,y=function(x){var T=document.createElement("canvas"),S=Object.create(l.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=x,T.getContext("webgl2",S)}(p);if(!y)return!1;try{m=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!m||y.isContextLost())&&(y.shaderSource(m,"void main() {}"),y.compileShader(m),y.getShaderParameter(m,y.COMPILE_STATUS)===!0)}(d)),n[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}Zt=1,li.supported=l,li.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},li}();function Ke(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function xt(l,t,n){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return n&&n.appendChild(c),c}const Ze=typeof document<"u"?document.documentElement&&document.documentElement.style:null,It=Ze&&Ze.userSelect!==void 0?"userSelect":"WebkitUserSelect";let kt;function Rt(){Ze&&It&&(kt=Ze[It],Ze[It]="none")}function wt(){Ze&&It&&(Ze[It]=kt)}function Or(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",Or,!0)}function ln(){window.addEventListener("click",Or,!0),window.setTimeout(()=>{window.removeEventListener("click",Or,!0)},0)}function bn(l,t){const n=l.getBoundingClientRect();return ci(l,n,t)}function Rn(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(ci(l,n,t[d]));return c}function zs(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function ci(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new o.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const Vt="01",vi="NO_ACCESS_TOKEN";class Kt{constructor(t,n,c){this._transformRequestFn=t,this._customAccessToken=n,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=function(){let n="";for(let c=0;c<10;c++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Vt,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeStyleURL(t,n){if(!o.j(t))return t;const c=Ji(t);return c.params.push(`sdk=js-${Nt}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!o.j(t))return t;const c=Ji(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!o.j(t))return t;const c=Ji(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!o.j(t))return t;const p=Ji(t);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),c&&p.params.push(`language=${c}`),d&&p.params.push(`worldview=${d}`),this._makeAPIURL(p,this._customAccessToken||n)}normalizeIconsetURL(t,n){const c=Ji(t);return o.j(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):Xr(c)}normalizeSpriteURL(t,n,c,d){const p=Ji(t);return o.j(t)?(p.path=`/styles/v1${p.path}/sprite${n}${c}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${n}${c}`,Xr(p))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!o.j(t))return t;const d=Ji(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${o.l.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${o.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${o.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${o.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${o.e.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null}(d.params)||o.e.ACCESS_TOKEN;return o.e.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,n){const c=Ji(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${o.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${o.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${o.e.TILE_URL_VERSION}/`,"")}`;let p=c.params;return n&&(p=p.filter(m=>!m.match(/^access_token=/))),p.length&&(d+=`?${p.join("&")}`),d}canonicalizeTileset(t,n){const c=!!n&&o.j(n),d=[];
15for(const p of t.tiles||[])o.k(p)?d.push(this.canonicalizeTileURL(p,c)):d.push(p);return d}_makeAPIURL(t,n){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=Ji(o.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const p=t.params.indexOf("secure");p>=0&&t.params.splice(p,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!o.e.REQUIRE_ACCESS_TOKEN)return Xr(t);if(n=n||o.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(p=>p.indexOf("access_token")===-1),t.params.push(`access_token=${n||""}`),Xr(t)}}const ki=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Ji(l){const t=l.match(ki);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Xr(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const Bn="mapbox.eventData";function cn(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(o.m(t[1]))}catch{return null}}class Zi{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=cn(o.e.ACCESS_TOKEN);let c="";return c=n&&n.u?o.f(n.u):o.e.ACCESS_TOKEN||"",t?`${Bn}.${t}:${c}`:`${Bn}:${c}`}fetchEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(n);d&&(this.eventData=JSON.parse(d));const p=localStorage.getItem(c);p&&(this.anonId=p)}catch{o.w("Unable to read from LocalStorage")}}saveEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData))}catch{o.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!o.e.EVENTS_URL)return;const p=Ji(o.e.EVENTS_URL);p.params.push(`access_token=${d||o.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},y=n?o.h(m,n):m,x={url:Xr(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=o.p(x,T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)})}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}const Jr=new class extends Zi{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){o.e.EVENTS_URL&&o.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(n=>o.j(n)||o.k(n))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=cn(o.e.ACCESS_TOKEN),n=t?t.u:o.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;o.v(this.anonId)||(this.anonId=o.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const p=new Date(this.eventData.lastSuccess),m=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||p.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Nt,skuId:Vt,"enabled.telemetry":!1,userId:this.anonId},p=>{p||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)},l):this.processRequests()}},is=Jr.postTurnstileEvent.bind(Jr),Ts=new class extends Zi{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.EVENTS_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(vi)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),o.v(this.anonId)||(this.anonId=o.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Nt,skuId:Vt,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},to=Ts.postMapLoadEvent.bind(Ts),Tr=new class extends Zi{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=o.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:n,style:c,importedStyles:d}=t;if(!o.e.EVENTS_URL||!l&&!o.e.ACCESS_TOKEN)return;const p=this.getMapInstanceId(n),m={mapInstanceId:p,eventId:this.getEventId(p),style:c};d.length&&(m.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:m},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:n}=this.queue.shift();this.postEvent(t,n,()=>{},l)}},Br=Tr.postStyleLoadEvent.bind(Tr),Yr=new class extends Zi{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){o.e.EVENTS_URL&&(l||o.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),c=function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),y=function(C){const L={};if(C){for(const z in C)if(z!=="other")for(const k of C[z]){const B=`${z}ResolveRangeMin`,V=`${z}ResolveRangeMax`,H=`${z}RequestCount`,Y=`${z}RequestCachedCount`;L[B]=Math.min(L[B]||1/0,k.startTime),L[V]=Math.max(L[V]||-1/0,k.responseEnd);const te=ee=>{L[ee]===void 0&&(L[ee]=0),++L[ee]};k.transferSize!==void 0&&k.transferSize===0&&te(Y),te(H)}}return L}(function(C,L){const z={};if(C)for(const k of C){const B=L(k);z[B]===void 0&&(z[B]=[]),z[B].push(k)}return z}(p,Pt)),x=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,S=T?T.effectiveType:void 0,M={counters:[],metadata:[],attributes:[]},I=(C,L,z)=>
15{z!=null&&C.push({name:L,value:z.toString()})};for(const C in y)I(M.counters,C,y[C]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(I(M.counters,"interactionRangeMin",d.interactionRange[0]),I(M.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const C of Object.keys(lt)){const L=lt[C],z=m.find(k=>k.name===L);z&&I(M.counters,L,z.startTime)}return I(M.counters,"visibilityHidden",d.visibilityHidden),I(M.attributes,"style",function(C){if(C)for(const L of C){const z=L.name.split("?")[0];if(o.i(z)){const k=z.split("/").slice(-2);if(k.length===2)return`mapbox://styles/${k[0]}/${k[1]}`}}}(p)),I(M.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),I(M.attributes,"fogEnabled",d.fogEnabled?"true":"false"),I(M.attributes,"projection",d.projection),I(M.attributes,"zoom",d.zoom),I(M.metadata,"devicePixelRatio",x),I(M.metadata,"connectionEffectiveType",S),I(M.metadata,"navigatorUserAgent",navigator.userAgent),I(M.metadata,"screenWidth",window.screen.width),I(M.metadata,"screenHeight",window.screen.height),I(M.metadata,"windowWidth",window.innerWidth),I(M.metadata,"windowHeight",window.innerHeight),I(M.metadata,"mapWidth",d.width/x),I(M.metadata,"mapHeight",d.height/x),I(M.metadata,"webglRenderer",d.renderer),I(M.metadata,"webglVendor",d.vendor),I(M.metadata,"sdkVersion",Nt),I(M.metadata,"sdkIdentifier","mapbox-gl-js"),M}(n);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},l)}},rs=Yr.postPerformanceEvent.bind(Yr),dr=new class extends Zi{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!o.e.API_URL||!o.e.SESSION_PATH)return;const d=Ji(o.e.API_URL+o.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||o.e.ACCESS_TOKEN||""}`);const p={url:Xr(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=o.g(p,m=>{this.pendingRequest=null,n(m),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.SESSION_PATH&&o.e.API_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(vi)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},da=dr.getSessionAPI.bind(dr),Ds=new Set;function ps(l,t){t?Ds.add(l):Ds.delete(l)}class Nr{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(o.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function pa(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class io extends o.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&o.t()&&(this.imageRasterizerDispatcher=new o.D(o.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new o.r({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const c of n.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new o.y),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}
15addImage(t,n,c){this._validate(t,c)&&this.images.get(n).set(t.toString(),c)}_validate(t,n){let c=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,n){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,c){const d=this.images.get(n).get(t.toString());c.version=d.version+1,this.images.get(n).set(t.toString(),c),this.updatedImages.get(n).add(t),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&(o.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:n}):this.imageRasterizer.removeImagesFromCacheByIds([t],n))}removeImage(t,n){const c=this.images.get(n),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(n=>o.I.from(n))}getImages(t,n,c){const d=[],p=[],m=this.imageProviders.get(n);for(const S of t){if(!S.iconsetId){d.push(S);continue}const M=m.get(S.iconsetId);M&&(this.getImage(S,n)?p.push(S):M.addPendingRequest(S))}if(d.length===0)return void this._notify(p,n,c);let y=!0;const x=!!this.loaded.get(n),T=this.images.get(n);if(!x)for(const S of d)T.has(S.toString())||(y=!1);x||y?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:p}=t;for(const[m,y]of d.entries()){const x=this.getImage(y.id,p);x&&c.set(m,{image:x,imageVariant:y})}this._rasterizeImages(p,c,n)}_rasterizeImages(t,n,c){if(o.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[p,{image:m,imageVariant:y}]of n.entries())d.set(p,this.imageRasterizer.rasterize(y,m,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,n,c){const d=this.images.get(n),p=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new o.A("styleimagemissing",{id:m.name}))}const y=d.get(m.toString());if(!y){o.w(`Image "${m.name}" 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.`);continue}const x={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(x,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),p.set(o.I.toString(m),x)}c(null,p)}getPixelSize(t){const{width:n,height:c}=this.atlasImage.get(t);return{width:n,height:c}}getPattern(t,n,c){const d=t.toString(),p=this.patterns.get(n),m=p.get(d),y=this.getImage(t,n);if(!y)return null;if(m){if(m.position.version===y.version)return m.position;m.position.version=y.version}else{if(y.usvg&&!y.data){const x=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const T=new o.B(t).scaleSelf(o.q.devicePixelRatio),S=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(n,S,(M,I)=>this.storePatternImage(T,n,y,c,I)),null}this.storePattern(t,n,y)}return this._updatePatternAtlas(n,c),p.get(d).position}getPatternInFlightId(t,n){return o.C(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,p){const m=t.toString(),y=p?p.get(m):void 0;y&&(c.data=y,this.storePattern(t.id,n,c),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,c){const d={w:c.data.width+2*o.F,h:c.data.height+2*o.F,x:0,y:0},p=new o.G(d,c,o.F);this.patterns.get(n).set(t.toString(),{bin:d,position:p})}bind(t,n){const c=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new o.T(t,this.atlasImage.get(n),c.RGBA8),this.atlasTexture.set(n,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:T})=>T),{w:p,h:m}=o.H(d),y=this.atlasImage.get(t);y.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[T,{bin:S,position:M}]of c.entries()){let I=M.padding;const C=S.x+I,L=S.y+I,z=x.get(T).data,k=z.width,B=z.height;I=I>1?I-1:I,o.r.copy(z,y,{x:0,y:0},{x:C,y:L},{width:k,height:B},n),o.r.copy(z,y,{x:0,y:B-I},{x:C,y:L-I},{width:k,height:I},n),o.r.copy(z,y,{x:0,y:0},{x:C,y:L+B},{width:k,height:I},n),o.r.copy(z,y,{x:k-I,y:0},{x:C-I,y:L},{width:I,height:B},n),o.r.copy(z,y,{x:0,y:0},{x:C+k,y:L},{width:I,height:B},n),o.r.copy(z,y,{x:k-I,y:B-I},{x:C-I,y:L-I},{width:I,height:I},n),o.r.copy(z,y,{x:0,y:B-I},{x:C+k,y:L-I},{width:I,height:I},n),o.r.copy(z,y,{x:0,y:0},{x:C+k,y:L+B},{width:I,height:I},n),o.r.copy(z,y,{x:k-I,y:0},{x:C-I,y:L+B},{width:I,height:I},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
15dispatchRenderCallbacks(t,n){const c=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const p=c.get(d.toString());pa(p)&&this.updateImage(d,n,p)}}}function wn(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},p=l.style,m=l.styleSpec;let y=[];const x=o.J(n);if(x!=="object")return[new o.V(t,n,`object expected, ${x} found`)];for(const T in n){const S=T.split(".")[0];let M;d[S]?M=d[S]:c[S]?M=yr:d["*"]?M=d["*"]:c["*"]&&(M=yr),M?y=y.concat(M({key:(t&&`${t}.`)+T,value:n[T],valueSpec:c[S]||c["*"],style:p,styleSpec:m,object:n,objectKey:T},n)):y.push(new o.K(t,n[T],`unknown property "${T}"`))}for(const T in c)d[T]||c[T].required&&c[T].default===void 0&&n[T]===void 0&&y.push(new o.V(t,n,`missing required property "${T}"`));return y}function Lo(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,p=l.key,m=l.arrayElementValidator||yr;if(o.J(t)!=="array")return[new o.V(p,t,`array expected, ${o.J(t)} found`)];if(n.length&&t.length!==n.length)return[new o.V(p,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new o.V(p,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let y={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(y.function=n.function),o.J(n.value)==="object"&&(y=n.value);let x=[];for(let T=0;T<t.length;T++)x=x.concat(m({array:t,arrayIndex:T,value:t[T],valueSpec:y,style:c,styleSpec:d,key:`${p}[${T}]`},!0));return x}function dl(l){const t=l.key,n=l.value,c=l.valueSpec;let d=o.J(n);if(d==="number"&&n!=n&&(d="NaN"),d!=="number")return[new o.V(t,n,`number expected, ${d} found`)];if("minimum"in c){let p=c.minimum;if(o.J(c.minimum)==="array"&&(p=c.minimum[l.arrayIndex]),n<p)return[new o.V(t,n,`${n} is less than the minimum value ${p}`)]}if("maximum"in c){let p=c.maximum;if(o.J(c.maximum)==="array"&&(p=c.maximum[l.arrayIndex]),n>p)return[new o.V(t,n,`${n} is greater than the maximum value ${p}`)]}return[]}function Tn(l){const t=l.valueSpec,n=o.M(l.value.type);let c,d,p,m={};const y=n!=="categorical"&&l.value.property===void 0,x=!y,T=o.J(l.value.stops)==="array"&&o.J(l.value.stops[0])==="array"&&o.J(l.value.stops[0][0])==="object",S=wn({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(C){if(n==="identity")return[new o.V(C.key,C.value,'identity function may not have a "stops" property')];let L=[];const z=C.value;return L=L.concat(Lo({key:C.key,value:z,valueSpec:C.valueSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:M})),o.J(z)==="array"&&z.length===0&&L.push(new o.V(C.key,z,"array must have at least one stop")),L},default:function(C){return yr({key:C.key,value:C.value,valueSpec:t,style:C.style,styleSpec:C.styleSpec})}}});return n==="identity"&&y&&S.push(new o.V(l.key,l.value,'missing required property "property"')),n==="identity"||l.value.stops||S.push(new o.V(l.key,l.value,'missing required property "stops"')),n==="exponential"&&l.valueSpec.expression&&!o.N(l.valueSpec)&&S.push(new o.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(x&&!o.O(l.valueSpec)?S.push(new o.V(l.key,l.value,"property functions not supported")):y&&!o.Q(l.valueSpec)&&S.push(new o.V(l.key,l.value,"zoom functions not supported"))),n!=="categorical"&&!T||l.value.property!==void 0||S.push(new o.V(l.key,l.value,'"property" property is required')),S;function M(C){let L=[];const z=C.value,k=C.key;if(o.J(z)!=="array")return[new o.V(k,z,`array expected, ${o.J(z)} found`)];if(z.length!==2)return[new o.V(k,z,`array length 2 expected, length ${z.length} found`)];if(T){if(o.J(z[0])!=="object")return[new o.V(k,z,`object expected, ${o.J(z[0])} found`)];if(z[0].zoom===void 0)return[new o.V(k,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new o.V(k,z,"object stop key must have value")];const B=o.M(z[0].zoom);if(typeof B!="number")return[new o.V(k,z[0].zoom,"stop zoom values must be numbers")];if(p&&p>B)return[new o.V(k,z[0].zoom,"stop zoom values must appear in ascending order")];B!==p&&(p=B,d=void 0,m={}),L=L.concat(wn({key:`${k}[0]`,value:z[0],valueSpec:{zoom:{}},style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:dl,value:I}}))}else L=L.concat(I({key:`${k}[0]`,value:z[0],style:C.style,styleSpec:C.styleSpec},z));return o.S(o.U(z[1]))?L.concat([new o.V(`${k}[1]`,z[1],"expressions are not allowed in function stops.")]):L.concat(yr({key:`${k}[1]`,value:z[1],valueSpec:t,style:C.style,styleSpec:C.styleSpec}))}function I(C,L){const z=o.J(C.value),k=o.M(C.value),B=C.value!==null?C.value:L;if(c){if(z!==c)return[new o.V(C.key,B,`${z} stop domain type must match previous stop domain type ${c}`)]}else c=z;if(z!=="number"&&z!=="string"&&z!=="boolean"&&typeof k!="number"&&typeof k!="string"&&typeof k!="boolean")return[new o.V(C.key,B,"stop domain value must be a number, string, or boolean")];
15if(z!=="number"&&n!=="categorical"){let V=`number expected, ${z} found`;return o.O(t)&&n===void 0&&(V+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(C.key,B,V)]}return n!=="categorical"||z!=="number"||typeof k=="number"&&isFinite(k)&&Math.floor(k)===k?n!=="categorical"&&z==="number"&&typeof k=="number"&&typeof d=="number"&&d!==void 0&&k<d?[new o.V(C.key,B,"stop domain values must appear in ascending order")]:(d=k,n==="categorical"&&k in m?[new o.V(C.key,B,"stop domain values must be unique")]:(m[k]=!0,[])):[new o.V(C.key,B,`integer expected, found ${String(k)}`)]}}function Nn(l){const t=(l.expressionContext==="property"?o.W:o.X)(o.U(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new o.V(`${l.key}${c.key}`,l.value,c.message));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new o.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!o.Y(n))return[new o.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return ro(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!o.Z(n,["zoom","feature-state"]))return[new o.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!o._(n))return[new o.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ro(l,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(
15d);if(n.size===0)return[];const c=[];return l instanceof o.$&&n.has(l.name)?[new o.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...ro(d,t))}),c)}function no(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function so(l){return o.a1(o.U(l.value))?Nn(o.L({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):Sn(l)}function Sn(l){const t=l.value,n=l.key;if(o.J(t)!=="array")return[new o.V(n,t,`array expected, ${o.J(t)} found`)];const c=l.styleSpec;let d,p=[];if(t.length<1)return[new o.V(n,t,"filter array must have at least 1 element")];switch(p=p.concat(no({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator,style:l.style,styleSpec:l.styleSpec})),o.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&o.M(t[1])==="$type"&&p.push(new o.V(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&p.push(new o.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=o.J(t[1]),d!=="string"&&p.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`)));for(let m=2;m<t.length;m++)d=o.J(t[m]),o.M(t[1])==="$type"?p=p.concat(no({key:`${n}[${m}]`,value:t[m],valueSpec:c.geometry_type,style:l.style,styleSpec:l.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&p.push(new o.V(`${n}[${m}]`,t[m],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)p=p.concat(Sn({key:`${n}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":d=o.J(t[1]),t.length!==2?p.push(new o.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&p.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`))}return p}function fa(l,t){const n=l.key,c=l.style,d=l.layer,p=l.styleSpec,m=l.value,y=l.objectKey,x=p[`${t}_${l.layerType}`];if(!x)return[];const T=y.match(/^(.*)-use-theme$/);if(t==="paint"&&T&&x[T[1]])return o.S(m)?[].concat(yr({key:l.key,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y})):yr({key:n,value:m,valueSpec:{type:"string"},style:c,styleSpec:p});const S=y.match(/^(.*)-transition$/);if(t==="paint"&&S&&x[S[1]]&&x[S[1]].transition)return yr({key:n,value:m,valueSpec:p.transition,style:c,styleSpec:p});const M=l.valueSpec||x[y];if(!M)return[new o.K(n,m,`unknown property "${y}"`)];let I;if(o.J(m)==="string"&&o.O(M)&&!M.tokens&&(I=/^{([^}]+)}$/.exec(m))){const L=`\`{ "type": "identity", "property": ${I?JSON.stringify(I[1]):'"_"'} }\``;return[new o.V(n,m,`"${y}" does not support interpolation syntax 16Use an identity property function instead: ${L}.`)]}const C=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||C.push(new o.V(n,m,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&o.a2(o.U(m))&&o.M(m.type)==="identity"&&C.push(new o.V(n,m,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&o.O(M)&&(o.a3(M)||o.Q(M))){const L=o.W(o.U(m),M),z=L.value.expression||L.value._styleExpression.expression;z&&!o.Z(z,["measure-light"])&&(y==="model-emissive-strength"&&o._(z)&&o.Y(z)||C.push(new o.V(n,m,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(yr({key:l.key,value:m,valueSpec:M,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y}))}function ma(l){return fa(l,"paint")}function Vn(l){return fa(l,"layout")}function pl(l){let t=[];const n=l.value,c=l.key,d=l.style,p=l.styleSpec;n.type||n.ref||t.push(new o.V(c,n,'either "type" or "ref" is required'));let m=o.M(n.type);const y=o.M(n.ref);
16if(n.id){const x=o.M(n.id);for(let T=0;T<l.arrayIndex;T++){const S=d.layers[T];o.M(S.id)===x&&t.push(new o.V(c,n.id,`duplicate layer id "${n.id}", previously used at line ${S.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(T=>{T in n&&t.push(new o.V(c,n[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{o.M(T.id)===y&&(x=T)}),x?x.ref?t.push(new o.V(c,n.ref,"ref cannot reference another ref layer")):m=o.M(x.type):typeof y=="string"&&t.push(new o.V(c,n.ref,`ref layer "${y}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(n.source){const x=d.sources&&d.sources[n.source],T=x&&o.M(x.type);x?T==="vector"&&m==="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a raster source`)):T==="raster"&&m!=="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a vector source`)):T!=="vector"||n["source-layer"]?T==="raster-dem"&&m!=="hillshade"?t.push(new o.V(c,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&T==="geojson"&&!x.lineMetrics?t.push(new o.V(c,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&T!=="raster-array"&&t.push(new o.V(c,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new o.V(c,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new o.V(c,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new o.V(c,n.source,`source "${n.source}" not found`))}else t.push(new o.V(c,n,'missing required property "source"'));return t=t.concat(wn({key:c,value:n,valueSpec:p.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>yr({key:`${c}.type`,value:n.type,valueSpec:p.layer.type,style:l.style,styleSpec:l.styleSpec,object:n,objectKey:"type"}),filter:x=>so(o.L({layerType:m},x)),layout:x=>wn({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>Vn(o.L({layerType:m},T))}}),paint:x=>wn({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>ma(o.L({layerType:m,layer:n},T))}})}})),t}function Ls(l){const t=l.value,n=l.key,c=o.J(t);return c!=="string"?[new o.V(n,t,`string expected, ${c} found`)]:[]}const _a={promoteId:function l({key:t,value:n}){if(o.J(n)==="string")return Ls({key:t,value:n});if(Array.isArray(n)){const c=[],d=o.U(n),p=o.X(d);return p.result==="error"&&p.value.forEach(m=>{c.push(new o.V(`${t}${m.key}`,null,`${m.message}`))}),o.Z(p.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||c.push(new o.V(`${t}`,null,"promoteId expression should be only feature dependent")),c}{const c=[];for(const d in n)c.push(...l({key:`${t}.${d}`,value:n[d]}));return c}}};function fn(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const p=o.M(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&(t.url||t.tiles||m.push(new o.K(n,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(wn({key:n,value:t,valueSpec:c[`source_${p.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:_a})),m;case"geojson":if(m=wn({key:n,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:_a}),t.cluster)for(const y in t.clusterProperties){const[x,T]=t.clusterProperties[y],S=typeof x=="string"?[x,["accumulated"],["get",y]]:x;m.push(...Nn({key:`${n}.${y}.map`,value:T,expressionContext:"cluster-map"})),m.push(...Nn({key:`${n}.${y}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return m;case"video":return wn({key:n,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return wn({key:n,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new o.V(n,null,"Please use runtime APIs to add canvas sources, rather than
16including them in stylesheets.","source.canvas")];default:return no({key:`${n}.type`,value:t.type,valueSpec:{values:ns(c)}})}}function ns(l){return l.source.reduce((t,n)=>{const c=l[n];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values))),t},[])}function ko(l){const t=l.value,n=l.styleSpec,c=n.light,d=l.style;let p=[];const m=o.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new o.V("light",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&c[T[1]]?yr({key:y,value:t[y],valueSpec:{type:"string"},style:d,styleSpec:n}):x&&c[x[1]]&&c[x[1]].transition?yr({key:y,value:t[y],valueSpec:n.transition,style:d,styleSpec:n}):c[y]?yr({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}):[new o.V(y,t[y],`unknown property "${y}"`)])}return p}function oo(l){const t=l.value;let n=[];if(!t)return n;const c=o.J(t);if(c!=="object")return n=n.concat([new o.V("light-3d",t,`object expected, ${c} found`)]),n;const d=l.styleSpec,p=d["light-3d"],m=l.key,y=l.style,x=l.style.lights;for(const M of["type","id"])if(!(M in t))return n=n.concat([new o.V("light-3d",t,`missing property ${M} on light`)]),n;if(t.type&&x)for(let M=0;M<l.arrayIndex;M++){const I=o.M(t.type),C=x[M];o.M(C.type)===I&&n.push(new o.V(m,t.id,`duplicate light type "${t.type}", previously defined at line ${C.id.__line__}`))}const T=`properties_light_${t.type}`;if(!(T in d))return n=n.concat([new o.V("light-3d",t,`Invalid light type ${t.type}`)]),n;const S=d[T];for(const M in t)if(M==="properties"){const I=t[M],C=o.J(I);if(C!=="object")return n=n.concat([new o.V("properties",I,`object expected, ${C} found`)]),n;for(const L in I){const z=L.match(/^(.*)-transition$/),k=L.match(/^(.*)-use-theme$/);n=n.concat(k&&S[k[1]]?yr({key:M,value:I[L],valueSpec:{type:"string"},style:y,styleSpec:d}):z&&S[z[1]]&&S[z[1]].transition?yr({key:M,value:t[M],valueSpec:d.transition,style:y,styleSpec:d}):S[L]?yr({key:L,value:I[L],valueSpec:S[L],style:y,styleSpec:d}):[new o.K(l.key,I[L],`unknown property "${L}"`)])}}else n=n.concat(p[M]?yr({key:M,value:t[M],valueSpec:p[M],style:y,styleSpec:d}):[new o.K(M,t[M],`unknown property "${M}"`)]);return n}function Fo(l){const t=l.value,n=l.key,c=l.style,d=l.styleSpec,p=d.terrain;let m=[];const y=o.J(t);if(t===void 0||y==="null")return m;if(y!=="object")return m=m.concat([new o.V("terrain",t,`object expected, ${y} found`)]),m;for(const x in t){const T=x.match(/^(.*)-transition$/),S=x.match(/^(.*)-use-theme$/);m=m.concat(S&&p[S[1]]?yr({key:x,value:t[x],valueSpec:{type:"string"},style:c,styleSpec:d}):T&&p[T[1]]&&p[T[1]].transition?yr({key:x,value:t[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?yr({key:x,value:t[x],valueSpec:p[x],style:c,styleSpec:d}):[new o.K(x,t[x],`unknown property "${x}"`)])}if(t.source){const x=c.sources&&c.sources[t.source],T=x&&o.M(x.type);x?T!=="raster-dem"&&m.push(new o.V(n,t.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):m.push(new o.V(n,t.source,`source "${t.source}" not found`))}else m.push(new o.V(n,t,'terrain is missing required property "source"'));return m}function ao(l){const t=l.value,n=l.style,c=l.styleSpec,d=c.fog;let p=[];const m=o.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new o.V("fog",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&d[T[1]]?yr({key:y,value:t[y],valueSpec:{type:"string"},style:n,styleSpec:c}):x&&d[x[1]]&&d[x[1]].transition?yr({key:y,value:t[y],valueSpec:c.transition,style:n,styleSpec:c}):d[y]?yr({key:y,value:t[y],valueSpec:d[y],style:n,styleSpec:c}):[new o.K(y,t[y],`unknown property "${y}"`)])}return p}const ga={"*":()=>[],array:Lo,boolean:function(l){const t=l.value,n=l.key,c=o.J(t);return c!=="boolean"?[new o.V(n,t,`boolean expected, ${c} found`)]:[]},number:dl,color:function(l){const t=l.key,n=l.value,c=o.J(n);return c!=="string"?[new o.V(t,n,`color expected, ${c} found`)]:o.a0.parseCSSColor(n)===null?[new o.V(t,n,`color expected, "${n}" found`)]:[]},enum:no,filter:so,function:Tn,layer:pl,object:wn,source:fn,model:o.a4,light:ko,"light-3d":oo,terrain:Fo,fog:ao,string:Ls,formatted:function(l){return Ls(l).length===0?[]:Nn(l)},resolvedImage:function(l){return Ls(l).length===0?[]:Nn(l)},projection:function(l){const t=l.value,n=l.styleSpec,c=n.projection,d=l.style;let p=[];const m=o.J(t);if(m==="object")for(const y in t)p=p.concat(yr({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}));else m!=="string"&&(p=p.concat([new o.V("projection",t,`object or string expected, ${m}
16 found`)]));return p},import:function(l){const{value:t,styleSpec:n}=l,{data:c,...d}=t;Object.defineProperty(d,"__line__",{value:t.__line__,enumerable:!1});let p=wn(o.L({},l,{value:d,valueSpec:n.import}));return o.M(d.id)===""&&p.push(new o.V(`${l.key}.id`,d,"import id can't be an empty string")),c&&(p=p.concat(ya(c,n,{key:`${l.key}.data`}))),p},iconset:function(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const p=o.M(t.type);let m=[];if(m=m.concat(wn({key:n,value:t,valueSpec:c[`iconset_${p}`],style:d,styleSpec:c})),p==="source"&&t.source){const y=d.sources&&d.sources[t.source],x=y&&o.M(y.type);y?x!=="raster-array"&&m.push(new o.V(n,t.source,`iconset cannot be used with a source of type ${String(x)}, it only be used with a "raster-array" source type`)):m.push(new o.V(n,t.source,`source "${t.source}" not found`))}return m}};function yr(l,t=!1){const n=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression&&o.a2(o.M(n)))return Tn(l);if(c.expression&&o.S(o.U(n)))return Nn(l);if(c.type&&ga[c.type]){const p=ga[c.type](l);return t===!0&&p.length>0&&o.J(l.value)==="array"?Nn(l):p}return wn(o.L({},l,{valueSpec:c.type?d[c.type]:c}))}function lo(l){const t=l.value,n=l.key,c=Ls(l);return c.length||(t.indexOf("{fontstack}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{range}" token'))),c}function ya(l,t=o.a5,n={}){return yr({key:n.key||"",value:l,valueSpec:t.$root,styleSpec:t,style:l,objectElementValidators:{glyphs:lo,"*":()=>[]}})}function Un(l,t=o.a5){return se(ya(l,t))}const Hu=l=>se(fn(l)),Sc=l=>se(ko(l)),Oo=l=>se(oo(l)),Xe=l=>se(Fo(l)),ks=l=>se(ao(l)),Zu=l=>se(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.snow;let m=[];const y=o.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new o.V("snow",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?yr({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?yr({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new o.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),fl=l=>se(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.rain;let m=[];const y=o.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new o.V("rain",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?yr({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?yr({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new o.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),Mi=l=>se(pl(l)),ve=l=>se(so(l)),O=l=>se(ma(l)),U=l=>se(Vn(l)),X=l=>se(o.a4(l));function se(l){return l.slice().sort((t,n)=>t.line&&n.line?t.line-n.line:0)}function Q(l,t){let n=!1;if(t&&t.length)for(const c of t)c instanceof o.K?o.w(c.message):(l.fire(new o.z(new Error(c.message))),n=!0);return n}let ce;class ge extends o.E{constructor(t,n="flat"){super(),this._transitionable=new o.a6(ce||(ce=new o.a7({anchor:new o.a8(o.a5.light.anchor),position:new o.a9(o.a5.light.position),color:new o.a8(o.a5.light.color),intensity:new o.a8(o.a5.light.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,c={}){this._validate(Sc,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=n)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&Q(this,t.call(Un,o.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let ue=class extends o.E{constructor(l,t,n,c,d){super(),this.scope=n,this._transitionable=new o.a6(new o.a7({source:new o.a8(o.a5.terrain.source),exaggeration:new o.a8(o.a5.terrain.exaggeration)}),n,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new o.aa(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let n=-1,c=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new o.aa(p,{worldview:this.worldview})),d>.01?(n=p,c=-1):c=p;return d<.01&&n>0&&c>n?[n,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof o.ab}};const ye=45,De=65,be=.05;function We(l,t,n,c){const d=o.af(ye,De,n),[p,m]=dt(l,c);let y=1-Math.min(1,Math.exp((t-p)/(m-p)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function dt(l,t){const n=.5/Math.tan(.5*t);return[l.range[0]+n,l.range[1]+n]}function ft(l,t,n,c,d){const p=o.ad([],[t,n,c],d.mercatorFogMatrix);return We(l,o.ae(p),d.pitch,d._fov)}function Gt(l,t,n,c,d,p,m){const y=[[n,c,0],[d,c,0],[d,p,0],[n,p,0]];let x=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of y){const M=o.ad([],S,t),I=o.ae(M);x=Math.min(x,I),T=Math.max(T,I)}return[We(l,x,m.pitch,m._fov),We(l,T,m.pitch,m._fov)]}class qt extends o.E{constructor(t,n,c,d){super();const p=new o.a7({range:new o.a8(o.a5.fog.range),color:new o.a8(o.a5.fog.color),"color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new o.a8(o.a5.fog["high-color"]),"high-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new o.a8(o.a5.fog["space-color"]),"space-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}
16),"horizon-blend":new o.a8(o.a5.fog["horizon-blend"]),"star-intensity":new o.a8(o.a5.fog["star-intensity"]),"vertical-range":new o.a8(o.a5.fog["vertical-range"])});this._transitionable=new o.a6(p,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new o.ag(p),this.scope=c}get state(){const t=this._transform,n=t.projection.name==="globe",c=o.ah(t.zoom),d=this.properties.get("range"),p=[.5,3];return{range:n?[o.ai(p[0],d[0],c),o.ai(p[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,n,c={}){if(this._validate(ks,t,c))return;const d=o.h({},t);for(const p of Object.keys(o.a5.fog))d[p]===void 0&&(d[p]=o.a5.fog[p].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,n)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const n=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:o.af(ye,De,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?function(c,d,p){const m=o.ac.fromLngLat(d),y=p.elevation?p.elevation.getAtPointOrZero(m):0;return ft(c,m.x,m.y,y,p)}(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Gt(this.state,n,0,0,o.aj,o.aj,this._transform)}getOpacityForBounds(t,n,c,d,p){return this._transform.projection.supportsFog?Gt(this.state,t,n,c,d,p,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?dt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const n=[4,5,6,7];for(const c of n){const d=t.points[c];let p;if(d[2]>=0)p=d;else{const m=t.points[c-4];p=o.ak(m,d,m[2]/(m[2]-d[2]))}if(ft(this.state,p[0],p[1],0,this._transform)>=be)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&Q(this,t.call(Un,o.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let Wt,fi,ii,Ki,pr=class extends o.E{constructor(l,t,n,c){super();const d=Wt||(Wt=new o.a7({density:new o.a8(o.a5.snow.density),intensity:new o.a8(o.a5.snow.intensity),color:new o.a8(o.a5.snow.color),opacity:new o.a8(o.a5.snow.opacity),vignette:new o.a8(o.a5.snow.vignette),"vignette-color":new o.a8(o.a5.snow["vignette-color"]),"center-thinning":new o.a8(o.a5.snow["center-thinning"]),direction:new o.a8(o.a5.snow.direction),"flake-size":new o.a8(o.a5.snow["flake-size"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=m,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(Zu,l,n))return;const c=o.h({},l);for(const d of Object.keys(o.a5.snow))c[d]===void 0&&(c[d]=o.a5.snow[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&Q(this,l.call(Un,o.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}},fr=class extends o.E{constructor(l,t,n,c){super();const d=fi||(fi=new o.a7({density:new o.a8(o.a5.rain.density),intensity:new o.a8(o.a5.rain.intensity),color:new o.a8(o.a5.rain.color),opacity:new o.a8(o.a5.rain.opacity),vignette:new o.a8(o.a5.rain.vignette),"vignette-color":new o.a8(o.a5.rain["vignette-color"]),"center-thinning":new o.a8(o.a5.rain["center-thinning"]),direction:new o.a8(o.a5.rain.direction),"droplet-size":new o.a8(o.a5.rain["droplet-size"]),"distortion-strength":new o.a8(o.a5.rain["distortion-strength"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette-color");return m.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),droplet
16Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:m}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(fl,l,n))return;const c=o.h({},l);for(const d of Object.keys(o.a5.rain))c[d]===void 0&&(c[d]=o.a5.rain[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&Q(this,l.call(Un,o.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}};class Ui extends o.E{constructor(t,n,c,d){super(),this.scope=c,this._options=t,this.properties=new o.ag(n),this._transitionable=new o.a6(n,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,n){this._options=t,this._transitionable.setTransitionOrValue(t.properties,n)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class Pi{constructor(t,n,c,d){this.screenBounds=t,this.cameraPoint=n,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=c,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,d)}static createFromScreenPoints(t,n){let c,d;if(t instanceof o.P||typeof t[0]=="number"){const p=o.P.convert(t);c=[p],d=n.isPointAboveHorizon(p)}else{const p=o.P.convert(t[0]),m=o.P.convert(t[1]),y=p.add(m)._div(2);c=[p,m],d=o.ao(p,m).every(x=>n.isPointAboveHorizon(x))&&n.isPointAboveHorizon(y)}return new Pi(c,n.getCameraPoint(),d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return o.ao(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(d[3]=this.cameraPoint)),o.ap(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,t),p=this.cameraPoint.clone();switch(3*((p.y>n.y)+(p.y>c.y))+((p.x>n.x)+(p.x>c.x))){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(t,n,c,d=0){const p=t.queryPadding/n._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(p,n):this._bufferedScreenMercator(p,n);let y=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map(k=>o.aq(t.tileTransform,k,y));if(!o.ar(x,0,0,o.aj,o.aj))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(k=>o.as(t.tileTransform,k,y)),S=T.map(k=>new o.P(k[0],k[1])),M=n.getFreeCameraOptions().position||new o.ac(0,0,0),I=o.as(t.tileTransform,M,y),C=T.map(k=>{const B=o.at(k,k,I);return o.au(B,B),new o.av(I,B)}),L=o.aw(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:C,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(z=o.ax(x),z.min.x=o.ay(z.min.x,0,o.aj),z.min.y=o.ay(z.min.y,0,o.aj),z.max.x=o.ay(z.max.x,0,o.aj),z.max.y=o.ay(z.max.y,0,o.aj),z),tile:t,t
16ileID:t.tileID,pixelToTileUnitsFactor:L};var z}_bufferedScreenMercator(t,n){const c=xr(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),n):{polygon:this.bufferedScreenGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,n){const c=xr(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),n):{polygon:this.bufferedCameraGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,n){const c=function(p,m){const y=o.az([],m.pixelMatrix,m.globeMatrix),x=[0,-o.aB,0,1],T=[0,o.aB,0,1],S=[0,0,0,1];o.aA(x,x,y),o.aA(T,T,y),o.aA(S,S,y);const M=new o.P(x[0]/x[3],x[1]/x[3]),I=new o.P(T[0]/T[3],T[1]/T[3]),C=o.aC(p,M)&&x[3]<S[3],L=o.aC(p,I)&&T[3]<S[3];if(!C&&!L)return null;const z=function(J,K,ie){for(let ne=1;ne<J.length;ne++){const fe=Sr(K.pointCoordinate3D(J[ne-1]).x),_e=Sr(K.pointCoordinate3D(J[ne]).x);if(ie<0){if(fe<_e)return{idx:ne,t:-fe/(_e-1-fe)}}else if(_e<fe)return{idx:ne,t:(1-fe)/(_e+1-fe)}}return null}(p,m,C?-1:1);if(!z)return null;const{idx:k,t:B}=z;let V=k>1?Pr(p.slice(0,k),m):[],H=k<p.length?Pr(p.slice(k),m):[];V=V.map(J=>new o.P(Sr(J.x),J.y)),H=H.map(J=>new o.P(Sr(J.x),J.y));const Y=[...V];Y.length===0&&Y.push(H[H.length-1]);const te=o.ai(Y[Y.length-1].y,(H.length===0?V[0]:H[0]).y,B);let ee;return ee=C?[new o.P(0,te),new o.P(0,0),new o.P(1,0),new o.P(1,te)]:[new o.P(1,te),new o.P(1,1),new o.P(0,1),new o.P(0,te)],Y.push(...ee),H.length===0?Y.push(V[0]):Y.push(...H),{polygon:Y.map(J=>new o.ac(J.x,J.y)),unwrapped:!1}}(t,n);if(c)return c;const d=function(p,m){let y=!1,x=-1/0,T=0;for(let M=0;M<p.length-1;M++)p[M].x>x&&(x=p[M].x,T=M);for(let M=0;M<p.length-1;M++){const I=(T+M)%(p.length-1),C=p[I],L=p[I+1];Math.abs(C.x-L.x)>.5&&(C.x<L.x?(C.x+=1,I===0&&(p[p.length-1].x+=1)):(L.x+=1,I+1===p.length-1&&(p[0].x+=1)),y=!0)}const S=o.aD(m.center.lng);return y&&S<Math.abs(S-1)&&p.forEach(M=>{M.x-=1}),{polygon:p,unwrapped:y}}(Pr(t,n).map(p=>new o.P(Sr(p.x),p.y)),n);return{polygon:d.polygon.map(p=>new o.ac(p.x,p.y)),unwrapped:d.unwrapped}}}function Pr(l,t){return o.aE(l,n=>{const c=t.pointCoordinate3D(n);n.x=c.x,n.y=c.y},1/256)}function Sr(l){return l<0?1+l%1:l%1}function xr(l){return 100*l|0}function Qr(l,t,n,c,d){const p=function(y,x){if(y)return d(y);if(x){if(l.url&&x.tiles&&l.tiles&&delete l.tiles,x.variants){if(!Array.isArray(x.variants))return d(new Error("variants must be an array"));for(const S of x.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return d(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){x=o.h(x,S);break}}}const T=o.aF(o.h({},x,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);T.tiles=t.canonicalizeTileset(T,l.url),d(null,T)}},m=function(y,x,T){if(!y)return null;if(!x&&!T)return y;T=T||y.worldview_default;const S=Object.values(y.language||{});if(S.length===0)return null;const M=Object.values(y.worldview||{});if(M.length===0)return null;const I=S.every(L=>L===x),C=M.every(L=>L===T);return I&&C?y:x in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null}(l.data,n,c);return m?o.q.frame(()=>p(null,m)):l.url?o.n(t.transformRequest(t.normalizeSourceURL(l.url,null,n,c),o.R.Source),p):o.q.frame(()=>{const{data:y,...x}=l;p(null,x)})}function zn(l,t){const n=Math.pow(2,t.z),c=Math.floor(o.aD(l.getWest())*n),d=Math.floor(o.aH(l.getNorth())*n),p=Math.ceil(o.aD(l.getEast())*n),m=Math.ceil(o.aH(l.getSouth())*n);return t.x>=c&&t.x<p&&t.y>=d&&t.y<m}class mn{constructor(t,n,c){this.bounds=t?o.aG.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=c||24}
16validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const n of t)this.extraBounds.push(o.aG.convert(this.validateBounds(n)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!zn(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const n of this.extraBounds)if(zn(n,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const n=new mn(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class ml extends o.E{constructor(t,n,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.h(this,o.aF(n,["url","scheme","tileSize","promoteId"])),this._options=o.h({type:"vector"},n),this._collectResourceTiming=!!n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new o.aI}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=Qr(this._options,this.map._requestManager,n,c,(d,p)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new o.z(d));else if(p){if(o.h(this,p),this.hasWorldviews=!!p.worldview_options,p.worldview_default&&(this.worldviewDefault=p.worldview_default),p.vector_layers){this.vectorLayers=p.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const m of p.vector_layers)this.vectorLayerIds.push(m.id),p.worldview&&p.worldview[m.source]&&this.localizableLayerIds.add(m.id)}this.tileBounds=mn.fromTileJSON(p),is(p.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.h({},this._options)}loadTile(t,n){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),p=this.map._requestManager.transformRequest(d,o.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,y=m?{image:m.image.clone()}:null,x={request:p,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
16ype,source:this.id,scope:this.scope,pixelRatio:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault};if(this.hasWorldviews&&o.j(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",x,T.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",x,T.bind(this),void 0,!0);else{const S=o.aJ.call({deduped:this._deduped},x,(M,I)=>{M||!I?T.call(this,M):(x.data={cacheControl:I.cacheControl,expires:I.expires,rawData:I.rawData.slice(0)},t.actor&&t.actor.send("loadTile",x,T.bind(this),void 0,!0))},!0);t.request={cancel:S}}function T(S,M){return delete t.request,t.aborted?n(null):S&&S.status!==404?n(S):(M&&M.resourceTiming&&(t.resourceTiming=M.resourceTiming),this.map._refreshExpiredTiles&&M&&t.setExpiryData(M),t.loadVectorData(M,this.map.painter),o.aK(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
16ype,source:this.id,scope:this.scope})}unloadTile(t,n){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class rn extends o.E{constructor(t,n,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.h({type:"raster"},n),o.h(this,o.aF(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const n=this.map.getWorldview();this._tileJSONRequest=Qr(this._options,this.map._requestManager,null,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new o.z(c)):d&&(o.h(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map(p=>p.id)),this.tileBounds=mn.fromTileJSON(d),is(d.tiles),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.h({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const c=o.q.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=o.o(this.map._requestManager.transformRequest(d,o.R.Tile),(p,m,y,x)=>(delete t.request,t.aborted?(t.state="unloaded",n(null)):p?(t.state="errored",n(p)):m?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:y,expires:x}),t.setTexture(m,this.map.painter),t.state="loaded",o.aK(this.dispatcher),void n(null)):n(null)))}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof o.T?(t.destroy(!0),t.texture&&t.texture instanceof o.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class co extends rn{constructor(t,n,c,d){super(t,n,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=o.h({type:"raster-array"},n)}triggerRepaint(t){const n=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);n&&n.enabled&&c&&n._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,n){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,o.R.Tile),p={request:d,uid:t.uid,tileID:t.tileID,type:this.t
16ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const m=(y,x,T,S)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",n(y));if(this.map._refreshExpiredTiles&&x&&t.setExpiryData({cacheControl:T,expires:S}),this.partial)t.state="empty";else{if(!x)return n(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=x}n(null)};t.request=this.partial?t.fetchHeader(void 0,m.bind(this)):t.actor.send("loadTile",p,m.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,n){const c=t.texture;c&&c instanceof o.T?(t.destroy(!0),this.map.painter.saveTileTexture(c)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,n,c){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBand(n,c,(d,p)=>{if(d)return t.state="errored",this.fire(new o.z(d)),void this.triggerRepaint(t);p&&(t._isHeaderLoaded=!0,t.setTexture(p,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const n=this.rasterLayers.find(({id:p})=>p===t),c=n&&n.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,n,c){if(!t)return;const d=n.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let p=null;n instanceof o.aN?p=n.paint.get("raster-array-band"):n instanceof o.aO&&(p=n.paint.get("raster-particle-array-band"));const m=p||this.getInitialBand(d);if(m!=null)if(t.textureDescriptor){if(!t.updateNeeded(d,m)||c)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,d,m)}getImages(t,n){const c=new Map;for(const d of t)for(const p of n){const[m,y]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(y)||!x.hasDataForBand(y))continue;const{bytes:T,tileSize:S,buffer:M}=x.getBandView(y),I=S+2*M,C={data:new o.r({width:I,height:I},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(p,C)}return c}}const Ec={vector:ml,raster:rn,"raster-dem":class extends rn{constructor(l,t,n,c){super(l,t,n,c),this.type="raster-dem",this.maxzoom=22,this._options=o.h({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,p){d&&(l.state="errored",t(d)),p&&(l.dem=p,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=o.o(this.map._requestManager.transformRequest(n,o.R.Tile),(function(d,p,m,y){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(p){this.map._refreshExpiredTiles&&l.setExpiryData({cacheControl:m,expires:y});const x=ImageBitmap&&p instanceof ImageBitmap&&o.t(),T=1-(p.width-o.aL(p.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=x?p:o.q.getImageData(p,T),M={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
16ype,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",M,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,n=Math.pow(2,t.z),c=(t.x-1+n)%n,d=t.x===0?l.wrap-1:l.wrap,p=(t.x+1+n)%n,m=t.x+1===n?l.wrap+1:l.wrap,y={};return y[new o.aM(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<n&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),y}},"raster-array":co,geojson:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(c),this._data=t.data,this._options=o.h({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=o.aj/this.tileSize;this.workerOptions=o.h({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:o.aj,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:o.aj,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new o.z(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new o.z(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const n of this._data.features)t.set(n.id,n);for(const n of l.features)t.set(n.id,n);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,n,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:n},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new o.A("dataloading",{dataType:"source"})),this._loaded=!1;const t=o.h({append:l},this.workerOptions);t.scope=this.scope;const n=this._data;typeof n=="string"?(t.request=this.map._requestManager.transformRequest(o.q.resolveURL(n),o.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new o.z(c));else{const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(p.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new o.A("data",p)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const n=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}
16:null,p=this._partialReload,m={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview()};l.request=this.actor.send(n,m,(y,x)=>p&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(),l.aborted?t(null):y?t(y):(l.loadVectorData(x,this.map.painter,n==="reloadTile"),t(null))),void 0,n==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return o.h({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends o.aP{constructor(l,t,n,c){super(l,t,n,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,o.R.Source).url);o.aQ(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new o.z(t)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new o.z(new o.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,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 l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new o.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:o.aP,model:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const l=[];for(const t in this._options.models){const n=this._options.models[t],c=o.aS(this.map._requestManager.transformRequest(n.uri,o.R.Model).url).then(d=>{if(!d)return;const p=o.aT(d),m=new o.aU(t,n.position,n.orientation,p);m.computeBoundsAndApplyParent(),this.models.push(m)}).catch(d=>{this.fire(new o.z(new Error(`Could not load model ${t} from ${n.uri}: ${d.message}`)))});l.push(c)}Promise.allSettled(l).then(()=>{this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=>{this._loaded=!0,this.fire(new o.z(new Error(`Could not load models: ${t.message}`)))})}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,t){}serialize(){return this._options}},"batched-model":class extends o.E{constructor(l,t,n,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=n,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=Qr(this._options,this.map._requestManager,t,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),n&&n.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new o.z(c))):d&&(o.h(this,d),d.bounds&&(this.tileBounds=new mn(d.bounds,this.minzoom,this.maxzoom)),is(d.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(n,o.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
16ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:o.q.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const p=Object.values(l.buckets);for(const m of p)m.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(p,m){return l.aborted?t(null):p&&p.status!==404?t(p):(this.map._refreshExpiredTiles&&m&&l.setExpiryData(m),l.loadModelData(m,this.map.painter),l.state="loaded",void t(null))}}serialize(){return o.h({},this._options)}},canvas:class extends o.aP{constructor(l,t,n,c){super(l,t,n,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new o.z(new o.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.z(new o.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new o.z(new o.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new o.z(new o.V(`sources.${l}`,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 o.z(new o.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.z(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(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof o.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new o.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new o.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new mn(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),o.h(this,o.aF(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return o.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:n,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:n,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:n,y:c,z:d}=l.tileID.canonical,p=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:n,y:c,z:d},{signal:p.signal})).then((function(m){return delete l.request,l.aborted?(l.state="unloaded",t(null)):m===void 0?(l.state="errored",t(null)):m===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):function(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement}(m)?(this.loadTileData(l,m),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(m=>{m.name!=="AbortError"&&(l.state="errored",t(m))}),l.request.cancel=()=>p.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof o.T?(l.destroy(!0),l.texture&&l.texture instanceof o.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:n,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:n,y:c,z:d})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}
16).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}}},_l=function(l,t,n,c){const d=new Ec[t.type](l,t,n,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return o.aV(["load","abort","unload","serialize","prepare"],d),d};function gl(l,t,n=""){return`${n}:${t.id||""}:${t.layer.id}:${function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:p}=c;return`featureset:${d}${p?`:import:${p}`:""}`}}(l.target)}`}function Ic(l,t,n,c=""){if(l.uniqueFeatureID){const d=gl(l,t,c);if(n.has(d))return!0;n.add(d)}return!1}function Ac(l,t,n,c,d=!1){const p=t.sourceCache.transform,m=t.sourceCache.tilesIn(l,t.has3DLayers,d);m.sort(Mc);const y=[];for(const x of m){const T=x.tile.queryRenderedFeatures(t,x,n,c,p,d);Object.keys(T).length&&y.push({wrappedTileID:x.tile.tileID.wrapped().key,queryResults:T})}return y.length===0?{}:function(x){const T={},S={};for(const M of x){const I=M.queryResults,C=M.wrappedTileID,L=S[C]=S[C]||{};for(const z in I){const k=I[z],B=L[z]=L[z]||{},V=T[z]=T[z]||[];for(const H of k)B[H.featureIndex]||(B[H.featureIndex]=!0,V.push(H))}}return T}(y)}function Bo(l,t,n,c,d,p){const m={},y=c.queryRenderedSymbols(l),x=[];for(const T of Object.keys(y).map(Number))x.push(d[T]);x.sort(Mc);for(const T of x){const S=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,n,p);for(const M in S){const I=m[M]=m[M]||[],C=S[M];C.sort((L,z)=>{const k=T.featureSortOrder;if(k){const B=k.indexOf(L.featureIndex);return k.indexOf(z.featureIndex)-B}return z.featureIndex-L.featureIndex});for(const L of C)I.push(L)}}return m}function yl(l,t){const n=l.getRenderableIds().map(p=>l.getTileByID(p)),c=[],d={};for(let p=0;p<n.length;p++){const m=n[p],y=m.tileID.canonical.key;d[y]||(d[y]=!0,m.querySourceFeatures(c,t))}return c}function Mc(l,t){const n=l.tileID,c=t.tileID;return n.overscaledZ-c.overscaledZ||n.canonical.y-c.canonical.y||n.wrap-c.wrap||n.canonical.x-c.canonical.x}function fs(l,t){const n={};if(!t)return n;for(const c of l){const d=c.layerIds.map(p=>t.getLayer(p)).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(p=>d.filter(m=>m.id===p)[0]));for(const p of d)n[p.fqid]=c}}return n}const Wn=32,ss=33,Fs=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,n=0,c=0,d=0,p=0,m=0,y=0;for(1&t?d=p=m=Wn:n=c=y=Wn;(t>>=1)>1;){const T=n+d>>1,S=c+p>>1;1&t?(d=n,p=c,n=m,c=y):(n=d,c=p,d=m,p=y),m=T,y=S}const x=4*l;Fs[x+0]=n,Fs[x+1]=c,Fs[x+2]=d,Fs[x+3]=p}const ms=new Uint16Array(2178),Os=new Uint8Array(1089),xl=new Uint16Array(1089);function Ss(l){return l===0?-.03125:l===32?.03125:0}const vl={type:2,extent:o.aj,loadGeometry:()=>[[new o.P(0,0),new o.P(o.aj+1,0),new o.P(o.aj+1,o.aj+1),new o.P(0,o.aj+1),new o.P(0,0)]]};class No{constructor(t,n,c,d,p,m){this.tileID=t,this.uid=o.a$(),this.uses=0,this.tileSize=n,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection),this.worldview=m}registerFadeDuration(t){const n=t+this.timeAdded;n<o.q.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=o.aW(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,n,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=fs(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];
16if(p instanceof o.b1){if(this.hasSymbolBuckets=!0,!c)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof o.b1&&p.hasRTLText){this.hasRTLText=!0,o.b2();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=n.style.getOwnLayer(d);if(!m)continue;const y=m.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,y)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new o.b0}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,n,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,fs(t.buckets,n.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const d in this.buckets){const p=this.buckets[d];p.uploadPending()&&p.upload(t)}const n=t.gl,c=this.imageAtlas;c&&!c.uploaded&&(this.imageAtlasTexture=new o.T(t,c.image,n.RGBA8,{useMipmap:!!c.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(t,this.glyphAtlasImage,n.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new o.T(t,this.lineAtlas.image,n.R8),this.lineAtlas.uploaded=!0)}prepare(t,n,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!n||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=n.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}queryRenderedFeatures(t,n,c,d,p,m){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const y=function(x,T){const S=o.bn([],[.5*x.width,.5*-x.height,1]);return o.bo(S,S,[1,-1,0]),o.az(S,S,x.calculateProjMatrix(T.toUnwrapped())),Float32Array.from(S)}(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:y,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview})}querySourceFeatures(t,n){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),p=n?n.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const y=o.b3(n&&n.filter),{z:x,x:T,y:S}=this.tileID.canonical,M={z:x,x:T,y:S};for(let I=0;I<m.length;I++){const C=m.feature(I);if(y.needGeometry){const k=o.b4(C,!0);if(!y.filter(new o.aa(this.tileID.overscaledZ,{worldview:this.worldview}),k,this.tileID.canonical))continue}else if(!y.filter(new o.aa(this.tileID.overscaledZ,{worldview:this.worldview}),C))continue;const L=c.getId(C,p),z=new o.b5(C,x,T,S,L);z.tile=M,t.push(z)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const c=o.b6(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const p=this.expirationTime-n;p?this.expirationTime=c+Math.max(p,3e4):d=!0}else d=!0;d?(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)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}updateBuckets(t,n){if(!this.latestFeatureIndex||!t.style)return;const c=this.latestFeatureIndex.loadVTLayers(),d=t.style.listImages(),p=t.style.getBrightness();for(const m in this.buckets){if(!t.style.hasLayer(m))continue;const y=this.buckets[m],x=y.layers[0],T=x.sourceLayer||"_geojsonTileLayer",S=c[T],M=t.style.getLayerSourceCache(x);let I={};M&&(I=M._state.getState(T,void 0));const C=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},L=Object.keys(I).length>0&&!n;L&&!y.stateDependentLayers.length&&!n||y.update(I,S,d,C,L?y.stateDependentLayers:y.layers,n,p),(y instanceof o.b7||y instanceof o.b8)&&t._terrain&&t._terrain.enabled&&M&&y.uploadPending()&&t._terrain._clearRenderCacheForTile(M.id,this.tileID);const z=t&&t.style&&t.style.getOwnLayer(m);z&&(this.queryPadding=Math.max(this.queryPadding,z.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=o.q.now()+t}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t):(this.texture=new o.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}
vendor: 6,115 bytes, line 16
16setDependencies(t,n){const c={};for(const d of n)c[d]=!0;this.dependencies[t]=c}hasDependency(t,n){for(const c of t){const d=this.dependencies[c];if(d){for(const p of n)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,n){if(!n||n.name==="mercator"||this._tileDebugBuffer)return;const c=o.b9(vl,this.tileID.canonical,this.tileTransform)[0],d=new o.ba,p=new o.bb;for(let m=0;m<c.length;m++){const{x:y,y:x}=c[m];d.emplaceBack(y,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,o.bc.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const c=o.b9(vl,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=function(y,x){const T=o.aW(y,x),S=Math.pow(2,y.z);for(let k=0;k<ss;k++)for(let B=0;B<ss;B++){const V=o.aX((y.x+(B+Ss(B))/Wn)/S),H=o.aY((y.y+(k+Ss(k))/Wn)/S),Y=x.project(V,H),te=k*ss+B;ms[2*te+0]=Math.round((Y.x*T.scale-T.x)*o.aj),ms[2*te+1]=Math.round((Y.y*T.scale-T.y)*o.aj)}Os.fill(0),xl.fill(0);for(let k=2045;k>=0;k--){const B=4*k,V=Fs[B+0],H=Fs[B+1],Y=Fs[B+2],te=Fs[B+3],ee=V+Y>>1,J=H+te>>1,K=ee+J-H,ie=J+V-ee,ne=H*ss+V,fe=te*ss+Y,_e=J*ss+ee,Me=Math.hypot((ms[2*ne+0]+ms[2*fe+0])/2-ms[2*_e+0],(ms[2*ne+1]+ms[2*fe+1])/2-ms[2*_e+1])>=16;Os[_e]=Os[_e]||(Me?1:0),k<1022&&(Os[_e]=Os[_e]||Os[(H+ie>>1)*ss+(V+K>>1)]||Os[(te+ie>>1)*ss+(Y+K>>1)])}const M=new o.aZ,I=new o.a_;let C=0;function L(k,B){const V=B*ss+k;return xl[V]===0&&(M.emplaceBack(ms[2*V+0],ms[2*V+1],k*o.aj/Wn,B*o.aj/Wn),xl[V]=++C),xl[V]-1}function z(k,B,V,H,Y,te){const ee=k+V>>1,J=B+H>>1;if(Math.abs(k-Y)+Math.abs(B-te)>1&&Os[J*ss+ee])z(Y,te,k,B,ee,J),z(V,H,Y,te,ee,J);else{const K=L(k,B),ie=L(V,H),ne=L(Y,te);I.emplaceBack(K,ie,ne)}}return z(0,0,Wn,Wn,Wn,0),z(Wn,Wn,0,0,0,Wn),{vertices:M,indices:I}}(this.tileID.canonical,n);d=m.vertices,p=m.indices}else{d=new o.aZ,p=new o.a_;for(const{x:y,y:x}of c)d.emplaceBack(y,x,0,0);const m=o.be(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<m.length;y+=3)p.emplaceBack(m[y],m[y+1],m[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,o.bf.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=o.bd.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(t,n){const c=n.projection;if(!c||c.name!=="globe"||n.freezeTileCoverage)return;const d=this.tileID.canonical,p=o.bg(d,n),m=o.bh(p),y=o.ah(n.zoom);let x;y>0&&(x=o.bi(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,m,x,y),this._makeGlobeTileDebugTextBuffer(t,d,n,m,x,y)}_globePoint(t,n,c,d,p,m,y){let x=o.bj(t,n,c);if(m){const T=1<<c.z,S=o.aD(d.center.lng),M=o.aH(d.center.lat),I=(c.x+.5)/T-S;let C=0;I>.5?C=-1:I<-.5&&(C=1);let L=(t/o.aj+c.x)/T+C,z=(n/o.aj+c.y)/T;L=(L-S)*d._pixelsPerMercatorPixel+S,z=(z-M)*d._pixelsPerMercatorPixel+M;const k=[L*d.worldSize,z*d.worldSize,0];o.ad(k,k,m),x=o.bk(x,k,y)}return o.ad(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,n,c,d,p,m){const y=new o.ba,x=new o.bb,T=new o.bl,S=(I,C,L,z,k)=>{const B=(L-I)/(k-1),V=(z-C)/(k-1),H=y.length;for(let Y=0;Y<k;Y++){const te=I+Y*B,ee=C+Y*V;y.emplaceBack(te,ee);const J=this._globePoint(te,ee,n,c,d,p,m);T.emplaceBack(J[0],J[1],J[2]),x.emplaceBack(H+Y)}},M=o.aj;S(0,0,M,0,16),S(M,0,M,M,16),S(M,M,0,M,16),S(0,M,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(y,o.bc.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(T,o.bm.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugTextBuffer(t,n,c,d,p,m){const y=o.aj/4,x=new o.ba,T=new o.a_,S=new o.bl,M=25;T.reserve(32),x.reserve(M),S.reserve(M);const I=(C,L)=>M*C+L;for(let C=0;C<M;C++){const L=C*y;for(let z=0;z<M;z++){const k=z*y;x.emplaceBack(k,L);const B=this._globePoint(k,L,n,c,d,p,m);S.emplaceBack(B[0],B[1],B[2])}}for(let C=0;C<4;C++)for(let L=0;L<4;L++){const z=I(C,L),k=I(C,L+1),B=I(C+1,L),V=I(C+1,L+1);T.emplaceBack(z,k,B),T.emplaceBack(B,k,V)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(T),this._tileDebugTextBuffer=t.createVertexBuffer(x,o.bc.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(S,o.bm.members),this._tileDebugTextSegments=o.bd.simpleSegment(0,0,M,32)}destroy(t=!1){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof o.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}o.bp.setPbf(o.bq);class xa extends No{constructor(t,n,c,d,p){super(t,n,c,d,p),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}
16getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t,{premultiply:!1}):this.texture=new o.T(c,t,d.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(t=16384,n){const c=this._mrt=new o.bp(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=o.br(d,(p,m,y,x)=>{if(p)n(p);else try{const T=c.getHeaderLength(m);if(T>t)return void(this.request=this.fetchHeader(T,n));c.parseHeader(m),this._isHeaderLoaded=!0;let S=0;for(const M of Object.values(c.layers))S=Math.max(S,M.dataIndex[M.dataIndex.length-1].lastByte);m.byteLength>=S&&(this.entireBuffer=m),n(null,this.entireBuffer||m,y,x)}catch(T){n(T)}}),this.request}fetchBand(t,n,c){const d=this._mrt;if(!this._isHeaderLoaded||!d)return void c(new Error("Tile header is not ready"));const p=this.actor;if(!p)return void c(new Error("Can't fetch tile band without an actor"));let m;const y=(M,I)=>{m.complete(M,I),M?c(M):(this.updateTextureDescriptor(t,n),c(null,this.textureDescriptor&&this.textureDescriptor.img))},x=(M,I)=>{if(M)return c(M);const C=p.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:I,task:m},y,void 0,!0);this._workQueue.push(()=>{C&&C.cancel(),m.cancel()})},T=d.getLayer(t);if(!T)return void c(new Error(`Unknown sourceLayer "${t}"`));if(T.hasDataForBand(n))return this.updateTextureDescriptor(t,n),void c(null,this.textureDescriptor?this.textureDescriptor.img:null);const S=T.getDataRange([n]);if(m=d.createDecodingTask(S),!m||m.tasks.length)if(this.flushQueues(),this.entireBuffer)x(null,this.entireBuffer.slice(S.firstByte,S.lastByte+1));else{const M=Object.assign({},this.requestParams,{headers:{Range:`bytes=${S.firstByte}-${S.lastByte}`}}),I=o.br(M,x);this._fetchQueue.push(()=>{I.cancel(),m.cancel()})}else c(null)}updateNeeded(t,n){return(!this.textureDescriptor||this.textureDescriptor.band!==n||this.textureDescriptor.layer!==t)&&this.state!=="errored"}updateTextureDescriptor(t,n){if(!this._mrt)return;const c=this._mrt.getLayer(t);if(!c||!c.hasBand(n)||!c.hasDataForBand(n))return;const{bytes:d,tileSize:p,buffer:m,offset:y,scale:x}=c.getBandView(n),T=p+2*m,S=new o.r({width:T,height:T},d),M=this.texture;M&&M instanceof o.T&&M.update(S,{premultiply:!1}),this.textureDescriptor={layer:t,band:n,img:S,buffer:m,offset:y,tileSize:p,format:c.pixelFormat,mix:[x,256*x,65536*x,16777216*x]}}}class Wu{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const p={value:n,timeout:void 0};if(c!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},c)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const c=t.wrapped().key,d=n===void 0?0:this.data[c].indexOf(n),p=this.data[c][d];return this.data[c].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(p.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||n.push(d);for(const c of n)this.remove(c.value.tileID,c)}}class Xu{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,c){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},o.h(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==d&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const p in this.state[t][d])c[p]||(this.deletedStates[t][d][p]=null)}else for(const p in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][p]===null&&delete this.deletedStates[t][d][p]}removeFeatureState(t,n,c){if(this.deletedStates[t]===null)return;const d=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&n!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,n){const c=this.state[t]||{},d=this.stateChanges[t]||{},p=this.deletedStates[t];if(p===null)return{};if(n!==void 0){const y=String(n),x=o.h({},c[y],d[y]);if(p){const T=p[n];if(T===null)return{};for(const S in T)delete x[S]}return x}const m=o.h({},c,d);if(p)for(const y in p)delete m[y];return m}initializeTileState(t,n){t.refreshFeatureState(n)}coalesceChanges(t,n){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const p={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),o.h(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];c[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]={},this.state[d][m]={};else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]={};else if(this.state[d][m])for(const y of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][y];p[m]=this.state[d][m]}c[d]=c[d]||{},o.h(c[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(n)}}class Dn extends o.E{constructor(t,n,c){super(),this.id=t,this._onlySymbols=c,n.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),n.on("error",()=>{this._sourceErrored=!0}),this._source=n,this._tiles={},this._cache=new Wu(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
vendor: 5,309 bytes, line 16
16,this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Xu,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,n){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const c=this._tiles[n];c.upload(t),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Vo).map(t=>t.key)}getRenderableIds(t,n){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,n)&&c.push(this._tiles[d]);return t?c.sort((d,p)=>{const m=d.tileID,y=p.tileID,x=new o.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new o.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||T.y-x.y||T.x-x.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(Vo).map(d=>d.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,n){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=n),this._loadTile(c,this._tileLoaded.bind(this,c,t,n)))}_tileLoaded(t,n,c,d){if(d)if(t.state="errored",d.status!==404)this._source.fire(new o.z(d,{tile:t}));else{if(this._source.fire(new o.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const p=this.map.painter.terrain;this.update(this.transform,p.getScaledDemTileSize(),!0),p.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=o.q.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new o.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const p=n[d];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);c(t,m),c(m,t)}}function c(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=p.tileID.canonical.x-d.tileID.canonical.x;const y=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),T=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,c,d){for(const p in this._tiles){let m=this._tiles[p];if(d[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>c)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const T=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[T.key],m&&m.hasData()&&(y=T)}let x=y;for(;x.overscaledZ>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=n?c:null}for(let c=t.overscaledZ-1;c>=n;c--){const d=t.scaledTo(c),p=this._getLoadedTile(d);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,n){n=n||this._source.tileSize;const c=Math.ceil(t.width/n)+1,d=Math.ceil(t.height/n)+1,p=Math.floor(c*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,y=typeof this._maxTileC
16acheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(y)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const c={};for(const d in this._tiles){const p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),c[p.tileID.key]=p}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,n,c,d,p){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,n),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const m=this._source.type==="batched-model";let y,x=this._source.maxzoom;const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const I=T.attenuationRange()[0],C=Math.floor(I)-Math.log2(T.getDemUpscale());x>C&&(x=C)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(I=>new o.aM(I.canonical.z,I.wrap,I.canonical.z,I.canonical.x,I.canonical.y));else if(this.tileCoverLift!==0){const I=t.clone();I.tileCoverLift=this.tileCoverLift,y=I.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new o.aM(1,0,1,0,0)),y.push(new o.aM(1,0,1,1,0)),y.push(new o.aM(1,0,1,0,1)),y.push(new o.aM(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.hasTile){const I=this._source.hasTile.bind(this._source);y=y.filter(C=>I(C))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!bl(this._source.type)){const I=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),C=Math.min(I,this._source.maxzoom);if(m){const L=t.extendTileCover(y,C);for(const z of L)y.push(z)}else if(p){const L=t.extendTileCover(y,C,this.transform._camera.forward());for(const z of L)y.push(z)}else if(this.castsShadows&&d){const L=t.extendTileCover(y,C,d);for(const z of L)this._shadowCasterTiles[z.key]=!0,y.push(z)}}const S=this._updateRetainedTiles(y);if(bl(this._source.type)&&y.length!==0){const I={},C={},L=Object.keys(S);for(const k of L){const B=S[k],V=this._tiles[k];if(!V||V.fadeEndTime&&V.fadeEndTime<=o.q.now())continue;const H=this.findLoadedParent(B,Math.max(B.overscaledZ-Dn.maxOverzooming,this._source.minzoom));H&&(this._addTile(H.tileID),I[H.tileID.key]=H.tileID),C[k]=B}const z=y[y.length-1].overscaledZ;for(const k in this._tiles){const B=this._tiles[k];if(S[k]||!B.hasData())continue;let V=B.tileID;for(;V.overscaledZ>z;){V=V.scaledTo(V.overscaledZ-1);const H=this._tiles[V.key];if(H&&H.hasData()&&C[V.key]){S[k]=B.tileID;break}}}for(const k in I)S[k]||(this._coveredTiles[k]=!0,S[k]=I[k])}for(const I in S)this._tiles[I].clearFadeHold();const M=o.bs(this._tiles,S);for(const I of M){const C=this._tiles[I];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(+I)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const n={};if(t.length===0)return n;const c={},d=t.reduce((T,S)=>Math.min(T,S.overscaledZ),1/0),p=t[0].overscaledZ,m=Math.max(p-Dn.maxOverzooming,this._source.minzoom),y=Math.max(p+Dn.maxUnderzooming,this._source.minzoom),x={};for(const T of t){const S=this._addTile(T);n[T.key]=T,S.hasData()||d<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,d,y,n);for(const T of t){let S=this._tiles[T.key];if(S.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const I=T.children(this._source.maxzoom)[0],C=this.getTile(I);if(C&&C.hasData()){n[I.key]=I;continue}}else{const I=T.children(this._source.maxzoom);
vendor: 4,163 bytes, line 16
16if(n[I[0].key]&&n[I[1].key]&&n[I[2].key]&&n[I[3].key])continue}let M=S.wasRequested();for(let I=T.overscaledZ-1;I>=m;--I){const C=T.scaledTo(I);if(c[C.key]||(c[C.key]=!0,S=this.getTile(C),!S&&M&&(S=this._addTile(C)),S&&(n[C.key]=C,M=S.wasRequested(),S.hasData())))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}n.push(d.key);const p=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(p),c)break;d=p}for(const p of n)this._loadedParentTiles[p]=c}}_addTile(t){let n=this._tiles[t.key];if(n)return n.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const c=!!n;if(!c){const d=this.map?this.map.painter:null,p=this._source.tileSize*t.overscaleFactor();n=this._source.type==="raster-array"?new xa(t,p,this.transform.tileZoom,d,this._isRaster):new No(t,p,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))}return n.uses++,this._tiles[t.key]=n,c||this._source.fire(new o.A("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=n.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"||n.state==="empty"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,n,c){const d=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",y=o.aD(p.center.lng);for(const x in this._tiles){const T=this._tiles[x];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let S;if(m){const M=T.tileID.canonical;if(M.z===0){const I=[Math.abs(o.ay(y,...va(M,-1))-y),Math.abs(o.ay(y,...va(M,1))-y)];S=[0,2*I.indexOf(Math.min(...I))-1]}else{const I=[Math.abs(o.ay(y,...va(M,-1))-y),Math.abs(o.ay(y,...va(M,0))-y),Math.abs(o.ay(y,...va(M,1))-y)];S=[I.indexOf(Math.min(...I))-1]}}else S=[0];for(const M of S){const I=t.containsTile(T,p,n,M);I&&d.push(I)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,n){const c=this.getRenderableIds(t,n).map(p=>this._tiles[p].tileID),d=this.transform.projection.name==="globe";for(const p of c)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return c}sortCoordinatesByDistance(t){const n=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const m of n){const y=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*y+m.wrap-c[0])*d[0]+((m.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return n.sort((m,y)=>p[m.key]-p[y.key]),n}hasTransition(){if(this._source.hasTransition())return!0;if(bl(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=o.q.now())return!0}return!1}setFeatureState(t,n,c){this._state.updateState(t=t||"_geojsonTileLayer",n,c)}removeFeatureState(t,n,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,c)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}
16setDependencies(t,n,c){const d=this._tiles[t];d&&d.setDependencies(n,c)}reloadTilesForDependencies(t,n){for(const c in this._tiles)this._tiles[c].hasDependency(t,n)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,n))}_preloadTiles(t,n){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(t,n))};return void this._source.on("data",x)}const c=new Map,d=Array.isArray(t)?t:[t],p=this.map.painter.terrain,m=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const x of d){const T=x.coveringTiles({tileSize:m,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of T)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}const y=Array.from(c.values());o.bt(y,(x,T)=>{const S=new No(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(S,M=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),T(M,S)})},n)}}function Vo(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function bl(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function va(l,t){const n=1<<l.z;return[l.x/n+t,(l.x+1)/n+t]}Dn.maxOverzooming=10,Dn.maxUnderzooming=3;class Vd{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,n=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:t,visibilityChanged:n});else if(d.type==="model"){const p=this.style.getLayerSource(d);p&&p.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:n})}}}onNewFrame(t){this.layersGotHidden=!1;for(const n of this.layers){const c=n.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="building"?d=!c.isHidden(t)&&c.paint.get("building-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&n.visible,n.visible=d}}updateZOffset(t,n){this.currentBuildingBuckets=[];for(const d of this.layers){const p=d.layer,m=this.style.getLayerSourceCache(p);let y=1;p.type==="fill-extrusion"?y=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(y=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(n):null;if(!x&&m&&n.canonical.z>m.getSource().minzoom){let T=n.scaledTo(Math.min(m.getSource().maxzoom,n.overscaledZ-1));for(;T.overscaledZ>=m.getSource().minzoom&&(x=m.getTile(T),!x&&T.overscaledZ!==0);)T=T.scaledTo(T.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:n,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,y=this._getHeightAtTileOffset(n,p.tileAnchorX,p.tileAnchorY);p.zOffset=y!==Number.NEGATIVE_INFINITY?y:m,c||m===p.zOffset||(c=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,c,d){let p=n,m=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,x=1/(1<<t.canonical.z-y.z);p=(n+t.canonical.x*o.aj)*x-y.x*o.aj|0,m=(c+t.canonical.y*o.aj)*x-y.y*o.aj|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,n,c){let d,p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:x,tileID:T,verticalScale:S}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:M,tileY:I}=this._mapCoordToOverlappingTile(t,n,c,T),C=x.getHeightAtTileCoord(M,I);C&&C.height!==void 0&&(C.hidden?d=C.height:p=Math.max(C.height*S,p||0))}if(p!==void 0)return p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:x,tileID:T}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:S,tileY:M}=this._mapCoordToOverlappingTile(t,n,c,T),I=x.getHeightAtTileCoord(S,M);if(I&&!I.hidden)return I.height===void 0&&d!==void 0?Math.min(I.maxHeight,d)*I.verticalScale:I.height?I.height*I.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Ud(l,t){const n={};for(const c in l)c!=="ref"&&(n[c]=l[c]);return o.bu.forEach(c=>{c in t&&(n[c]=t[c])}),n}function wl(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=Ud(l[n],t[l[n].ref]));return l}const Ei={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function Cc(l,t,n){n.push({command:Ei.addSource,args:[l,t[l]]})}function ba(l,t,n){t.push({command:Ei.removeSource,args:[l]}),n[l]=!0}function Tl(l,t,n,c){ba(l,n,c),Cc(l,t,n)}function Uf(l,t,n){let c;for(c in l[n])if(l[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;for(c in t[n])if(t[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;return!0}function Sl(l,t,n,c,d,p){let m;
vendor: 4,627 bytes, line 16
16for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(o.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(o.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}))}function Uo(l){return l.id}function uo(l,t){return l[t.id]=t,l}class Yu{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=o.ay(t,0,1);let n=1,c=this._distances[n];const d=t*this.paddedLength+this.padding;for(;c<d&&n<this._distances.length;)c=this._distances[++n];const p=n-1,m=this._distances[p],y=c-m,x=y>0?(d-m)/y:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}class Ku{constructor(t,n,c){const d=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(n/c);for(let m=0;m<this.xCellCount*this.yCellCount;m++)d.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,c,d,p){this._forEachCell(n,c,d,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(p)}insertCircle(t,n,c,d){this._forEachCell(n-d,c-d,n+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,n,c,d,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,c,d,p,m){this.circleCells[p].push(m)}_query(t,n,c,d,p,m){if(c<0||t>this.width||d<0||n>this.height)return!p&&[];const y=[];if(t<=0&&n<=0&&this.width<=c&&this.height<=d){if(p)return!0;for(let x=0;x<this.boxKeys.length;x++)y.push({key:this.boxKeys[x],x1:this.bboxes[4*x],y1:this.bboxes[4*x+1],x2:this.bboxes[4*x+2],y2:this.bboxes[4*x+3]});for(let x=0;x<this.circleKeys.length;x++){const T=this.circles[3*x],S=this.circles[3*x+1],M=this.circles[3*x+2];y.push({key:this.circleKeys[x],x1:T-M,y1:S-M,x2:T+M,y2:S+M})}return m?y.filter(m):y}return this._forEachCell(t,n,c,d,this._queryCell,y,{hitTest:p,seenUids:{box:{},circle:{}}},m),p?y.length>0:y}_queryCircle(t,n,c,d,p){const m=t-c,y=t+c,x=n-c,T=n+c;if(y<0||m>this.width||T<0||x>this.height)return!d&&[];const S=[];return this._forEachCell(m,x,y,T,this._queryCellCircle,S,{hitTest:d,circle:{x:t,y:n,radius:c},seenUids:{box:{},circle:{}}},p),d?S.length>0:S}query(t,n,c,d,p){return this._query(t,n,c,d,!1,p)}hitTest(t,n,c,d,p){return this._query(t,n,c,d,!0,p)}hitTestCircle(t,n,c,d){return this._queryCircle(t,n,c,!0,d)}_queryCell(t,n,c,d,p,m,y,x){const T=y.seenUids,S=this.boxCells[p];if(S!==null){const I=this.bboxes;for(const C of S)if(!T.box[C]){T.box[C]=!0;const L=4*C;if(t<=I[L+2]&&n<=I[L+3]&&c>=I[L+0]&&d>=I[L+1]&&(!x||x(this.boxKeys[C]))){if(y.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[C],x1:I[L],y1:I[L+1],x2:I[L+2],y2:I[L+3]})}}}const M=this.circleCells[p];if(M!==null){const I=this.circles;for(const C of M)if(!T.circle[C]){T.circle[C]=!0;const L=3*C;if(this._circleAndRectCollide(I[L],I[L+1],I[L+2],t,n,c,d)&&(!x||x(this.circleKeys[C]))){if(y.hitTest)return m.push(!0),!0;{const z=I[L],k=I[L+1],B=I[L+2];m.push({key:this.circleKeys[C],x1:z-B,y1:k-B,x2:z+B,y2:k+B})}}}}}_queryCellCircle(t,n,c,d,p,m,y,x){const T=y.circle,S=y.seenUids,M=this.boxCells[p];if(M!==null){const C=this.bboxes;for(const L of M)if(!S.box[L]){S.box[L]=!0;const z=4*L;if(this._circleAndRectCollide(T.x,T.y,T.radius,C[z+0],C[z+1],C[z+2],C[z+3])&&(!x||x(this.boxKeys[L])))return m.push(!0),!0}}const I=this.circleCells[p];if(I!==null){const C=this.circles;for(const L of I)if(!S.circle[L]){S.circle[L]=!0;const z=3*L;if(this._circlesCollide(C[z],C[z+1],C[z+2],T.x,T.y,T.radius)&&(!x||x(this.circleKeys[L])))return m.push(!0),!0}}}_forEachCell(t,n,c,d,p,m,y,x){const T=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),M=this._convertToXCellCoord(c),I=this._convertToYCellCoord(d);for(let C=T;C<=M;C++)for(let L=S;L<=I;L++)if(p.call(this,t,n,c,d,this.xCellCount*L+C,m,y,x))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,c,d,p,m){const y=d-t,x=p-n,T=c+m;return T*T>y*y+x*x}
16_circleAndRectCollide(t,n,c,d,p,m,y){const x=(m-d)/2,T=Math.abs(t-(d+x));if(T>x+c)return!1;const S=(y-p)/2,M=Math.abs(n-(p+S));if(M>S+c)return!1;if(T<=x||M<=S)return!0;const I=T-x,C=M-S;return I*I+C*C<=c*c}}const jo={unknown:0,flipRequired:1,flipNotRequired:2},jd=Math.tan(85*Math.PI/180);function Bs(l,t,n,c,d,p,m){const y=o.bz();if(n)if(p.name==="globe"){const x=o.bA(d,t);o.az(y,y,x)}else{const x=o.bB([],m);y[0]=x[0],y[1]=x[1],y[4]=x[2],y[5]=x[3],c||o.by(y,y,d.angle)}else o.az(y,d.labelPlaneMatrix,l);return y}function Pc(l,t,n,c,d,p,m){const y=Bs(l,t,n,c,d,p,m);return p.name==="globe"&&n||(y[2]=y[6]=y[10]=y[14]=0),y}function Rc(l,t,n,c,d,p,m){if(n){if(p.name==="globe"){const y=Bs(l,t,n,c,d,p,m);return o.bi(y,y),o.az(y,l,y),y}{const y=o.bw(l),x=o.bx([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],o.az(y,y,x),c||o.by(y,y,-d.angle),y}}return d.glCoordMatrix}function _s(l,t,n,c){const d=[l,t,n,1];n?o.aA(d,d,c):Fi(d,d,c);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function El(l,t){return Math.min(.5+l/t*.5,1.5)}function Go(l,t){const n=l[0]/l[3],c=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&c>=-t[1]&&c<=t[1]}function zc(l,t,n,c,d,p,m,y,x,T){const S=n.transform,M=c?l.textSizeData:l.iconSizeData,I=o.bH(M,n.transform.zoom),C=S.projection.name==="globe",L=[256/n.width*2+1,256/n.height*2+1],z=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;z.clear();let k=null;C&&(k=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const B=l.lineVertexArray,V=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Y,te=!1;for(let ee=0;ee<V.length;ee++){const J=V.get(ee),{numGlyphs:K,writingMode:ie}=J;if(ie!==o.bI.vertical||te||Y===o.bI.horizontal||(te=!0),Y=ie,(J.hidden||ie===o.bI.vertical)&&!te){qo(K,z);continue}te=!1;const ne=new o.P(J.tileAnchorX,J.tileAnchorY);let{x:fe,y:_e,z:Me}=S.projection.projectTilePoint(ne.x,ne.y,T.canonical);if(x){const[ot,at,rt]=x(ne);fe+=ot,_e+=at,Me+=rt}const Ce=[fe,_e,Me,1];if(o.aA(Ce,Ce,t),!Go(Ce,L)){qo(K,z);continue}const Fe=Ce[3],de=El(n.transform.getCameraToCenterDistance(S.projection),Fe),Te=o.bJ(M,I,J),le=m?Te/de:Te*de,Re=_s(fe,_e,Me,d);if(Re[3]<=0){qo(K,z);continue}let xe={};const Le=o.al(l.layers[0].layout.get("text-max-angle")),qe=Math.cos(Le),Pe=m?null:x,Ge=$o(J,le,!1,y,t,d,p,l.glyphOffsetArray,B,z,k,Re,ne,xe,H,Pe,S.projection,T,m,qe);te=Ge.useVertical,Pe&&Ge.needsFlipping&&(xe={}),(Ge.notEnoughRoom||te||Ge.needsFlipping&&$o(J,le,!0,y,t,d,p,l.glyphOffsetArray,B,z,k,Re,ne,xe,H,Pe,S.projection,T,m,qe).notEnoughRoom)&&qo(K,z)}c?(l.text.dynamicLayoutVertexBuffer.updateData(z),k&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(k)):(l.icon.dynamicLayoutVertexBuffer.updateData(z),k&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(k))}function Ju(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k){const{lineStartIndex:B,glyphStartIndex:V,segment:H}=y,Y=V+y.numGlyphs,te=B+y.lineLength,ee=t.getoffsetX(V),J=t.getoffsetX(Y-1),K=wa(l*ee,n,c,d,p,m,H,B,te,x,T,S,M,I,!0,C,L,z,k);if(!K)return null;const ie=wa(l*J,n,c,d,p,m,H,B,te,x,T,S,M,I,!0,C,L,z,k);return ie?{first:K,last:ie}:null}function Dc(l,t,n,c){return l===o.bI.horizontal&&Math.abs(c)>Math.abs(n)?{useVertical:!0}:l===o.bI.vertical?c>0?{needsFlipping:!0}:null:t!==jo.unknown&&function(d,p){return d===0||Math.abs(p/d)>jd}(n,c)?t===jo.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function $o(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B,V,H){const Y=t/24,te=l.lineOffsetX*Y,ee=l.lineOffsetY*Y,{lineStartIndex:J,glyphStartIndex:K,numGlyphs:ie,segment:ne,writingMode:fe,flipState:_e}=l,Me=J+l.lineLength,Ce=Fe=>{if(S){const[Re,xe,Le]=Fe.up,qe=T.length;o.bK(S,qe+0,Re,xe,Le),o.bK(S,qe+1,Re,xe,Le),o.bK(S,qe+2,Re,xe,Le),o.bK(S,qe+3,Re,xe,Le)}const[de,Te,le]=Fe.point;o.bL(T,de,Te,le,Fe.angle)};if(ie>1){const Fe=Ju(Y,y,te,ee,n,M,I,l,x,p,C,z,!1,k,B,V,H);if(!Fe)return{notEnoughRoom:!0};if(c&&!n){let[de,Te,le]=Fe.first.point,[Re,xe,Le]=Fe.last.point;[de,Te]=_s(de,Te,le,m),[Re,xe]=_s(Re,xe,Le,m);const qe=Dc(fe,_e,(Re-de)*L,xe-Te);if(l.flipState=qe&&qe.needsFlipping?jo.flipRequired:jo.flipNotRequired,qe)return qe}Ce(Fe.first);for(let de=K+1;de<K+ie-1;de++){const Te=wa(Y*y.getoffsetX(de),te,ee,n,M,I,ne,J,Me,x,p,C,z,!1,!1,k,B,V,H);if(!Te)return T.length-=4*(de-K),{notEnoughRoom:!0};Ce(Te)}Ce(Fe.last)}else{if(c&&!n){const de=_s(I.x,I.y,0,d),Te=J+ne+1,le=new o.P(x.getx(Te),x.gety(Te)),Re=_s(le.x,le.y,0,d),xe=Re[3]>
160?Re:Qu(I,le,de,1,d,void 0,k,B.canonical),Le=Dc(fe,_e,(xe[0]-de[0])*L,xe[1]-de[1]);if(l.flipState=Le&&Le.needsFlipping?jo.flipRequired:jo.flipNotRequired,Le)return Le}const Fe=wa(Y*y.getoffsetX(K),te,ee,n,M,I,ne,J,Me,x,p,C,z,!1,!1,k,B,V,H);if(!Fe)return{notEnoughRoom:!0};Ce(Fe)}return{}}function jn(l,t,n,c,d){const{x:p,y:m,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return _s(p,m,y,n);const[x,T,S]=d(l);return _s(p+x,m+T,y+S,n)}function Qu(l,t,n,c,d,p,m,y){const x=jn(l.sub(t)._unit()._add(l),y,d,m,p);return o.at(x,n,x),o.au(x,x),o.bE(x,n,x,c)}function wa(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B,V){const H=c?l-t:l+t;let Y=H>0?1:-1,te=0;c&&(Y*=-1,te=Math.PI),Y<0&&(te+=Math.PI);let ee=y+m+(Y>0?0:1)|0,J=d,K=d,ie=0,ne=0;const fe=Math.abs(H),_e=[],Me=[];let Ce=p,Fe=Ce,de=o.bC([]);const Te=()=>Qu(Fe,Ce,K,fe-ie+1,S,I,z,k.canonical);for(;ie+ne<=fe;){if(ee+=Y,ee<y||ee>=x)return null;if(K=J,Fe=Ce,_e.push(K),C&&Me.push(Fe),Ce=new o.P(T.getx(ee),T.gety(ee)),J=M[ee],!J){const rt=jn(Ce,k.canonical,S,z,I);J=rt[3]>0?M[ee]=rt:Te()}ie+=ne;const ot=o.at([],J,K),at=o.bD(K,J);if(n&&at>0&&ne>0&&o.bG(de,ot)/(ne*at)<V)return null;ne=at,de=ot}L&&I&&(M[ee]&&(J=Te(),ne=o.bD(K,J),de=o.at([],J,K)),M[ee]=J);const le=(fe-ie)/ne,Re=Ce.sub(Fe)._mult(le)._add(Fe),xe=o.bE([],K,de,le);let Le=[0,0,1],qe=de[0],Pe=de[1];if(B&&(Le=z.upVector(k.canonical,Re.x,Re.y),Le[0]!==0||Le[1]!==0||Le[2]!==1)){const ot=[Le[2],0,-Le[0]],at=o.bF([],Le,ot);o.au(ot,ot),o.au(at,at),qe=o.bG(de,ot),Pe=o.bG(de,at)}if(n){const ot=o.bF([],Le,de);o.au(ot,ot),o.bE(xe,xe,ot,n*Y)}const Ge=te+Math.atan2(Pe,qe);return _e.push(xe),C&&Me.push(Re),{point:xe,angle:Ge,path:_e,tilePath:Me,up:Le}}function qo(l,t){const n=t.length,c=n+4*l;t.resize(c),t.float32.fill(-1/0,4*n,4*c)}function Fi(l,t,n){const c=t[0],d=t[1];return l[0]=n[0]*c+n[4]*d+n[12],l[1]=n[1]*c+n[5]*d+n[13],l[3]=n[3]*c+n[7]*d+n[15],l}const gs=100;class jf{constructor(t,n,c=new Ku(t.width+200,t.height+200,25),d=new Ku(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+gs,this.screenBottomBoundary=t.height+gs,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=n}placeCollisionBox(t,n,c,d,p,m,y,x){let T=c.projectedAnchorX,S=c.projectedAnchorY,M=c.projectedAnchorZ;const I=c.elevation,C=c.tileID,L=t.getProjection();if(I&&C){const[ee,J,K]=L.upVector(C.canonical,c.tileAnchorX,c.tileAnchorY),ie=L.upVectorScale(C.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=ee*I*ie,S+=J*I*ie,M+=K*I*ie}const z=this.projectAndGetPerspectiveRatio(y,T,S,M,c.tileID,L.name==="globe"||!!I||this.transform.pitch>0,L),k=m*z.perspectiveRatio,B=(c.x1*n+d.x-c.padding)*k+z.point.x,V=(c.y1*n+d.y-c.padding)*k+z.point.y,H=(c.x2*n+d.x+c.padding)*k+z.point.x,Y=(c.y2*n+d.y+c.padding)*k+z.point.y,te=z.perspectiveRatio<=.55||z.occluded;return!this.isInsideGrid(B,V,H,Y)||!p&&this.grid.hitTest(B,V,H,Y,x)||te?{box:[],offscreen:!1,occluded:z.occluded}:{box:[B,V,H,Y],offscreen:this.isOffscreen(B,V,H,Y),occluded:!1}}placeCollisionCircles(t,n,c,d,p,m,y,x,T,S,M,I,C,L,z){const k=[],B=this.transform.elevation,V=t.getProjection(),H=B?B.getAtTileOffsetFunc(z,this.transform.center.lat,this.transform.worldSize,V):null,Y=new o.P(c.tileAnchorX,c.tileAnchorY);let{x:te,y:ee,z:J}=V.projectTilePoint(Y.x,Y.y,z.canonical);if(H){const[Le,qe,Pe]=H(Y);te+=Le,ee+=qe,J+=Pe}const K=V.name==="globe",ie=this.projectAndGetPerspectiveRatio(y,te,ee,J,z,K||!!B||this.transform.pitch>0,V),{perspectiveRatio:ne}=ie,fe=(M?m/ne:m*ne)/o.bO,_e=_s(te,ee,J,x),Me=c.lineOffsetX*fe,Ce=c.lineOffsetY*fe,Fe=o.al(t.layers[0].layout.get("text-max-angle")),de=Math.cos(Fe),Te=ie.signedDistanceFromCamera>0?Ju(fe,p,Me,Ce,!1,_e,Y,c,d,x,{},B&&!M?H:null,M&&!!B,V,z,M,de):null;let le=!1,Re=!1,xe=!0;if(Te&&!ie.occluded){const Le=.5*C*ne+L,qe=new o.P(-100,-100),Pe=new o.P(this.screenRightBoundary,this.screenBottomBoundary),Ge=new Yu,{first:ot,last:at}=Te,rt=ot.path.length;let mt=[];for(let Ut=rt-1;Ut>=1;Ut--)mt.push(ot.path[Ut]);for(let Ut=1;Ut<at.path.length;Ut++)mt.push(at.path[Ut]);const gt=2.5*Le;T&&(mt=mt.map(([Ut,ri,Bi],ir)=>(H&&!K&&(Bi=H(ir<rt-1?ot.tilePath[rt-1-ir]:at.tilePath[ir-rt+2])[2]),_s(Ut,ri,Bi,T))),mt.some(Ut=>Ut[3]<=0)&&(mt=[]));let bt=[];if(mt.length>0){let Ut=1/0,ri=-1/0,Bi=1/0,ir=-1/0;for(const ji of mt)Ut=Math.min(Ut,ji[0]),Bi=Math.min(Bi,ji[1]),ri=Math.max(ri,ji[0]),ir=Math.max(ir,ji[1]);ri>=qe.x&&Ut<=Pe.x&&ir>=qe.y&&Bi<=Pe.y&&(bt=[mt.map(ji=>new o.P(ji[0],ji[1]))],(Ut<qe.x||ri>Pe.x||Bi<qe.y||ir>Pe.y)&&(bt=o.bM(bt,qe.x,qe.y,Pe.x,Pe.y)))}for(const Ut of bt){Ge.reset(Ut,.25*Le);let ri=0;ri=Ge.length<=.5*Le?1:Math.ceil(Ge.paddedLength/gt)+1;for(let Bi=0;Bi<ri;Bi++){const ir=Bi/Math.max(ri-1,1),ji=Ge.lerp(ir),qi=ji.x+gs,Rr=ji.y+gs;k.push(qi,Rr,Le,0);const Jt=qi-Le,oi=Rr-Le,mi=qi+Le,ar=Rr+Le;if(xe=xe&&this.isOffscreen(Jt,oi,mi,ar),Re=Re||this.isInsideGrid(Jt,oi,mi,ar),!n&&this.grid.hitTestCircle(qi,Rr,Le,I)&&(le=!0,!S))return{circles:[],offscreen:!1,collisionDetected:le,occluded:!1}}}}return{circles:!S&&le||!Re?[]:k,offscreen:xe,collisionDetected:le,occluded:ie.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let c=1/0,d=1/0,p=-1/0,m=-1/0;for(const S of t){const M=new o.P(S.x+gs,S.y+gs);c=Math.min(c,M.x),d=Math.min(d,M.y),p=Math.max(p,M.x),m=Math.max(m,M.y),n.push(M)}const y=this.grid.query(c,d,p,m).concat(this.ignoredGrid.query(c,d,p,m)),x={},T={};for(const S of y){const M=S.key;if(x[M.bucketInstanceId]===void 0&&(x[M.bucketInstanceId]={}),x[M.bucketInstanceId][M.featureIndex])continue;const I=[new o.P(S.x1,S.y1),new o.P(S.x2,S.y1),new o.P(S.x2,S.y2),new o.P(S.x1,S.y2)];o.bN(n,I)&&(x[M.bucketInstanceId][M.featureIndex]=!0,T[M.bucketInstanceId]===void 0&&(T[M.bucketInstanceId]=[]),T[M.bucketInstanceId].push(M.featureIndex))}return T}insertCollisionBox(t,n,c,d,p){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:p},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,c,d,p){const m=n?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;
16x+=4)m.insertCircle(y,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,n,c,d,p,m,y){const x=[n,c,d,1];let T=!1;d||this.transform.pitch>0?(o.aA(x,x,t),this.fogState&&p&&y.name!=="globe"&&(T=function(I,C,L,z,k,B){const V=B.calculateFogTileMatrix(k),H=[C,L,z];return o.ad(H,H,V),We(I,o.ae(H),B.pitch,B._fov)}(this.fogState,n,c,d,p.toUnwrapped(),this.transform)>.9)):Fi(x,x,t);const S=x[3];return{point:new o.P((x[0]/S+1)/2*this.transform.width+gs,(-x[1]/S+1)/2*this.transform.height+gs),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/S*.5,1.5),signedDistanceFromCamera:S,occluded:m&&x[2]>S||T}}isOffscreen(t,n,c,d){return c<gs||t>=this.screenRightBoundary||d<gs||n>this.screenBottomBoundary}isInsideGrid(t,n,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=o.bx([]);return o.bo(t,t,[-100,-100,0]),t}}function eh(l,t,n){const c=t.createTileMatrix(l,l.worldSize,n.toUnwrapped());return o.az(new Float32Array(16),l.projMatrix,c)}function Ft(l,t,n){if(t.projection.name===n.projection.name)return l.projMatrix;const c=n.clone();return c.setProjection(t.projection),eh(c,t.getProjection(),l)}function Lc(l,t,n){return t.name===n.projection.name?l.projMatrix:eh(n,t,l)}class Il{constructor(t,n,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class Ho{constructor(t,n,c,d,p,m=!1){this.text=new Il(t?t.text:null,n,c,p),this.icon=new Il(t?t.icon:null,n,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Xn{constructor(t,n,c,d=!1){this.text=t,this.icon=n,this.skipFade=c,this.clipped=d}}class th{constructor(){this.invProjMatrix=o.bz(),this.viewportMatrix=o.bz(),this.circles=[]}}class Ta{constructor(t,n,c,d,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=p}}class _t{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:c=>c.collisionGroupID===n}}return this.collisionGroups[t]}}function $i(l,t,n,c,d){const{horizontalAlign:p,verticalAlign:m}=o.bT(l),y=-(p-.5)*t,x=-(m-.5)*n,T=o.bU(l,c);return new o.P(y+T[0]*d,x+T[1]*d)}function Di(l,t,n,c,d){const p=new o.P(l,t);return n&&p._rotate(c?d:-d),p}class Gn{constructor(t,n,c,d,p,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new jf(this.transform,p),this.buildingIndex=m,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new _t(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,c,d,p=1){const m=c.getBucket(n),y=c.latestFeatureIndex;if(!m||!y||n.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,T=m.layers[0].paint,S=c.collisionBoxArray,M=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),I=c.tileSize/o.aj,C=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const L=(z=c.tileID,k=m.getProjection(),B=this.transform,k.name===this.projection?B.calculateProjMatrix(z.toUnwrapped()):eh(B,k,z));var z,k,B;const V=x.get("text-pitch-alignment")==="map",H=x.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const Y=n.dynamicFilter(),te=n.dynamicFilterNeedsFeature(),ee=this.transform.calculatePixelsToTileUnitsMatrix(c),J=Pc(L,c.tileID.canonical,V,H,this.transform,m.getProjection(),ee);let K=null;if(V){const Te=Rc(L,c.tileID.canonical,V,H,this.transform,m.getProjection(),ee);K=o.az([],this.transform.labelPlaneMatrix,Te)}let ie=null;Y&&c.latestFeatureIndex&&(ie={unwrappedTileID:C,dynamicFilter:Y,dynamicFilterNeedsFeature:te}),this.retainedQueryData[m.bucketInstanceId]=new Ta(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,c.tileID);const[ne,fe]=m.layers[0].layout.get("text-size-scale-range"),_e=o.ay(p,ne,fe),[Me,Ce]=x.get("icon-size-scale-range"),Fe=o.ay(p,Me,Ce),de={bucket:m,layout:x,paint:T,posMatrix:L,textLabelPlaneMatr
16ix:J,labelToScreenMatrix:K,clippingData:ie,scale:M,textPixelRatio:I,holdingForFade:c.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:o.bH(m.textSizeData,this.transform.zoom,_e),partiallyEvaluatedIconSize:o.bH(m.iconSizeData,this.transform.zoom,Fe),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const Te of m.sortKeyRanges){const{sortKey:le,symbolInstanceStart:Re,symbolInstanceEnd:xe}=Te;t.push({sortKey:le,symbolInstanceStart:Re,symbolInstanceEnd:xe,parameters:de})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:de})}attemptAnchorPlacement(t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B,V){const{textOffset0:H,textOffset1:Y,crossTileID:te}=I,ee=[H,Y],J=$i(t,c,d,ee,p),K=this.collisionIndex.placeCollisionBox(L,p,n,Di(J.x,J.y,m,y,this.transform.angle),M,x,T,S.predicate);if(k){const ie=L.getSymbolInstanceIconSize(V,this.transform.zoom,I.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,ie,k,Di(J.x,J.y,m,y,this.transform.angle),M,x,T,S.predicate).box.length===0)return}if(K.box.length>0){let ie;return this.prevPlacement&&this.prevPlacement.variableOffsets[te]&&this.prevPlacement.placements[te]&&this.prevPlacement.placements[te].text&&(ie=this.prevPlacement.variableOffsets[te].anchor),this.variableOffsets[te]={textOffset:ee,width:c,height:d,anchor:t,textScale:p,prevAnchor:ie},this.markUsedJustification(L,t,I,z),L.allowVerticalPlacement&&(this.markUsedOrientation(L,z,I),this.placedOrientations[te]=z),{shift:J,placedGlyphBoxes:K}}}placeLayerBucketPart(t,n,c,d,p=1){const{bucket:m,layout:y,paint:x,posMatrix:T,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:I,textPixelRatio:C,holdingForFade:L,collisionBoxArray:z,partiallyEvaluatedTextSize:k,partiallyEvaluatedIconSize:B,collisionGroup:V,latestFeatureIndex:H}=t.parameters,Y=y.get("text-optional"),te=y.get("icon-optional"),ee=y.get("text-allow-overlap"),J=y.get("icon-allow-overlap"),K=y.get("text-rotation-alignment")==="map",ie=y.get("text-pitch-alignment")==="map",ne=x.get("symbol-z-offset"),fe=y.get("symbol-elevation-reference")==="sea",[_e,Me]=y.get("text-size-scale-range"),[Ce,Fe]=y.get("icon-size-scale-range"),de=o.ay(p,_e,Me),Te=o.ay(p,Ce,Fe);this.transform.setProjection(m.projection);let le=ee&&(J||!m.hasIconData()||te),Re=J&&(ee||!m.hasTextData()||Y);const xe=!ne.isConstant();!m.collisionArrays&&z&&m.deserializeCollisionBoxes(z),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,z,de,Te);const Le=(Pe,Ge,ot)=>{const{crossTileID:at,numVerticalGlyphVertices:rt}=Pe;let mt=null;if(I&&I.dynamicFilterNeedsFeature||xe){const Qi=this.retainedQueryData[m.bucketInstanceId];mt=H.loadFeature({featureIndex:Pe.featureIndex,bucketIndex:Qi.bucketIndex,sourceLayerIndex:Qi.sourceLayerIndex,layoutVertexArrayOffset:0})}if(I&&!(0,I.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},mt,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new o.P(Pe.tileAnchorX,Pe.tileAnchorY),this.transform.calculateDistanceTileData(I.unwrappedTileID)))return this.placements[at]=new Xn(!1,!1,!1,!0),void n.add(at);const gt=ne.evaluate(mt,{});if(n.has(at))return;if(L)return void(this.placements[at]=new Xn(!1,!1,!1));let bt=!1,Ut=!1,ri=!0,Bi=!1,ir=!1,ji=null,qi={box:null,offscreen:null,occluded:null},Rr={box:null},Jt=null,oi=null,mi=null,ar=0,Ur=0,rr=0;ot.textFeatureIndex?ar=ot.textFeatureIndex:Pe.useRuntimeCollisionCircles&&(ar=Pe.featureIndex),ot.verticalTextFeatureIndex&&(Ur=ot.verticalTextFeatureIndex);const Ri=Qi=>{Qi.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const cr=this.transform.elevation;Qi.elevation=fe?gt:gt+(cr?cr.getAtTileOffset(Qi.tileID,Qi.tileAnchorX,Qi.tileAnchorY):0),Qi.elevation+=Pe.zOffset},Ir=ot.textBox;if(Ir){Ri(Ir);const Qi=Li=>{let Mr=o.bI.horizontal;if(m.allowVerticalPlacement&&!Li&&this.prevPlacement){const on=this.prevPlacement.placedOrientations[at];on&&(this.placedOrientations[at]=on,Mr=on,this.markUsedOrientation(m,Mr,Pe))}return Mr},cr=(Li,Mr)=>{if(m.allowVerticalPlacement&&rt>0&&ot.verticalTextBox){for(const on of m.writingModes)if(on===o.bI.vertical?(qi=Mr(),Rr=qi):qi=Li(),qi&&qi.box&&qi.box.length)break}else qi=Li()};if(y.get("text-variable-anchor")){let Li=y.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[at]){const _r=this.prevPlacement.variableOffsets[at];
vendor: 18,622 bytes, line 16
16Li.indexOf(_r.anchor)>0&&(Li=Li.filter(Ci=>Ci!==_r.anchor),Li.unshift(_r.anchor))}const Mr=(_r,Ci,qn)=>{const kn=m.getSymbolInstanceTextSize(k,Pe,this.transform.zoom,Ge),Jn=(_r.x2-_r.x1)*kn+2*_r.padding,vs=(_r.y2-_r.y1)*kn+2*_r.padding,hs=Pe.hasIconTextFit&&!J?Ci:null;hs&&Ri(hs);let Fn={box:[],offscreen:!1,occluded:!1};const Ao=ee?2*Li.length:Li.length;for(let bs=0;bs<Ao;++bs){const Mo=this.attemptAnchorPlacement(Li[bs%Li.length],_r,Jn,vs,kn,K,ie,C,T,V,bs>=Li.length,Pe,Ge,m,qn,hs,k,B);if(Mo&&(Fn=Mo.placedGlyphBoxes,Fn&&Fn.box&&Fn.box.length)){bt=!0,ji=Mo.shift;break}}return Fn};cr(()=>Mr(Ir,ot.iconBox,o.bI.horizontal),()=>{const _r=ot.verticalTextBox;return _r&&Ri(_r),m.allowVerticalPlacement&&!(qi&&qi.box&&qi.box.length)&&rt>0&&_r?Mr(_r,ot.verticalIconBox,o.bI.vertical):{box:null,offscreen:null,occluded:null}}),qi&&(bt=qi.box,ri=qi.offscreen,Bi=qi.occluded);const on=Qi(!(!qi||!qi.box));if(!bt&&this.prevPlacement){const _r=this.prevPlacement.variableOffsets[at];_r&&(this.variableOffsets[at]=_r,this.markUsedJustification(m,_r.anchor,Pe,on))}}else{const Li=(Mr,on)=>{const _r=m.getSymbolInstanceTextSize(k,Pe,this.transform.zoom,Ge,p),Ci=this.collisionIndex.placeCollisionBox(m,_r,Mr,new o.P(0,0),ee,C,T,V.predicate);return Ci&&Ci.box&&Ci.box.length&&(this.markUsedOrientation(m,on,Pe),this.placedOrientations[at]=on),Ci};cr(()=>Li(Ir,o.bI.horizontal),()=>{const Mr=ot.verticalTextBox;return m.allowVerticalPlacement&&rt>0&&Mr?(Ri(Mr),Li(Mr,o.bI.vertical)):{box:null,offscreen:null,occluded:null}}),Qi(!!(qi&&qi.box&&qi.box.length))}}if(Jt=qi,bt=Jt&&Jt.box&&Jt.box.length>0,ri=Jt&&Jt.offscreen,Bi=Jt&&Jt.occluded,Pe.useRuntimeCollisionCircles){const Qi=m.text.placedSymbolArray.get(Pe.centerJustifiedTextSymbolIndex>=0?Pe.centerJustifiedTextSymbolIndex:Pe.verticalPlacedTextSymbolIndex),cr=o.bJ(m.textSizeData,k,Qi),Li=y.get("text-padding");oi=this.collisionIndex.placeCollisionCircles(m,ee,Qi,m.lineVertexArray,m.glyphOffsetArray,cr,T,S,M,c,ie,V.predicate,Pe.collisionCircleDiameter*cr/o.bO,Li,this.retainedQueryData[m.bucketInstanceId].tileID),bt=ee||oi.circles.length>0&&!oi.collisionDetected,ri=ri&&oi.offscreen,Bi=oi.occluded}if(ot.iconFeatureIndex&&(rr=ot.iconFeatureIndex),ot.iconBox){const Qi=cr=>{Ri(cr);const Li=Pe.hasIconTextFit&&ji?Di(ji.x,ji.y,K,ie,this.transform.angle):new o.P(0,0),Mr=m.getSymbolInstanceIconSize(B,this.transform.zoom,Pe.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,Mr,cr,Li,J,C,T,V.predicate)};Rr&&Rr.box&&Rr.box.length&&ot.verticalIconBox?(mi=Qi(ot.verticalIconBox),Ut=mi.box.length>0):(mi=Qi(ot.iconBox),Ut=mi.box.length>0),ri=ri&&mi.offscreen,ir=mi.occluded}const Ti=Y||Pe.numHorizontalGlyphVertices===0&&rt===0,Fr=te||Pe.numIconVertices===0;if(Ti||Fr?Fr?Ti||(Ut=Ut&&bt):bt=Ut&&bt:Ut=bt=Ut&&bt,bt&&Jt&&Jt.box&&this.collisionIndex.insertCollisionBox(Jt.box,y.get("text-ignore-placement"),m.bucketInstanceId,Rr&&Rr.box&&Ur?Ur:ar,V.ID),Ut&&mi&&this.collisionIndex.insertCollisionBox(mi.box,y.get("icon-ignore-placement"),m.bucketInstanceId,rr,V.ID),oi&&(bt&&this.collisionIndex.insertCollisionCircles(oi.circles,y.get("text-ignore-placement"),m.bucketInstanceId,ar,V.ID),c)){const Qi=m.bucketInstanceId;let cr=this.collisionCircleArrays[Qi];cr===void 0&&(cr=this.collisionCircleArrays[Qi]=new th);for(let Li=0;Li<oi.circles.length;Li+=4)cr.circles.push(oi.circles[Li+0]),cr.circles.push(oi.circles[Li+1]),cr.circles.push(oi.circles[Li+2]),cr.circles.push(oi.collisionDetected?1:0)}const lr=m.projection.name!=="globe";le=le&&(lr||!Bi),Re=Re&&(lr||!ir),this.placements[at]=new Xn(bt||le,Ut||Re,ri||m.justReloaded),n.add(at)},qe=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,qe),m.elevationType==="road"&&m.updateRoadElevation(qe.canonical),m.updateZOffset(),m.sortFeaturesByY){const Pe=m.getSortedSymbolIndexes(this.transform.angle);for(let Ge=Pe.length-1;Ge>=0;--Ge){const ot=Pe[Ge];Le(m.symbolInstances.get(ot),ot,m.collisionArrays[ot])}m.hasAnyZOffset&&o.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const Pe=m.getSortedIndexesByZOffset();for(let Ge=0;Ge<Pe.length;++Ge){const ot=Pe[Ge];Le(m.symbolInstances.get(ot),ot,m.collisionArrays[ot])}}else for(let Pe=t.symbolInstanceStart;Pe<t.symbolInstanceEnd;Pe++)Le(m.symbolInstances.get(Pe),Pe,m.collisionArrays[Pe]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const Pe=this.collisionCircleArrays[m.bucketInstanceId];o.bi(Pe.invProjMatrix,T),Pe.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,n,c,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,crossTileID:T}=c,S=o.bV(n),M=d===o.bI.vertical?x:S==="left"?p:S==="center"?m:S==="right"?y:-1;p>=0&&(t.text.placedSymbolArray.get(p).crossTileID=M>=0&&p!==M?0:T),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=M>=0&&m!==M?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=M>=0&&y!==M?0:T),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=M>=0&&x!==M?0:T)}markUsedOrientation(t,n,c){const d=n===o.bI.horizontal||n===o.bI.horizontalOnly?n:0,p=n===o.bI.vertical?n:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:T}=c,S=t.text.placedSymbolArray;m>=0&&(S.get(m).placedOrientation=d),y>=0&&(S.get(y).placedOrientation=d),x>=0&&(S.get(x).placedOrientation=d),T>=0&&(S.get(T).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let c=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const d=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],S=p[x];S?(this.opacities[x]=new Ho(S,d,T.text,T.icon,null,T.clipped),c=c||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[x]=new Ho(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const x in p){const T=p[x];if(!this.opacities[x]){const S=new Ho(T,d,!1,!1);S.isHidden()||(this.opacities[x]=S,c=c||T.text.placed||T.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in y)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=y[x]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,c,d){const p=new Set;for(const m of n){const y=m.getBucket(t);y&&m.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,p,m,m.collisionBoxArray,c,d,m.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,m.tileID),y.elevationType==="road"&&y.updateRoadElevation(m.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(t,n,c,d,p,m,y,x){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const T=t.layers[0].layout,S=t.layers[0].paint,M=!!t.layers[0].dynamicFilter(),I=new Ho(null,0,!1,!1,!0),C=T.get("text-allow-overlap"),L=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),k=T.get("text-rotation-alignment")==="map",B=T.get("text-pitch-alignment")==="map",V=S.get("symbol-z-offset"),H=T.get("symbol-elevation-reference")==="sea",Y=!V.isConstant(),te=new Ho(null,0,C&&(L||!t.hasIconData()||T.get("icon-optional")),L&&(C||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const ee=(K,ie,ne)=>{for(let fe=0;fe<ie/4;fe++)K.opacityVertexArray.emplaceBack(ne)};let J=0;m&&t.updateReplacement(y,m);for(let K=0;K<t.symbolInstances.length;K++){const ie=t.symbolInstances.get(K),{numHorizontalGlyphVertices:ne,numVerticalGlyphVertices:fe,crossTileID:_e,numIconVertices:Me,tileAnchorX:Ce,tileAnchorY:Fe}=ie;let de=null;const Te=this.retainedQueryData[t.bucketInstanceId];Y&&ie&&Te&&(de=c.latestFeatureIndex.loadFeature({featureIndex:ie.featureIndex,bucketIndex:Te.bucketIndex,sourceLayerIndex:Te.sourceLayerIndex,layoutVertexArrayOffset:0}));const le=V.evaluate(de,{}),Re=n.has(_e);let xe=this.opacities[_e];Re?xe=I:xe||(xe=te,this.opacities[_e]=xe),n.add(_e);const Le=ne>0||fe>0,qe=Me>0,Pe=this.placedOrientations[_e],Ge=Pe===o.bI.vertical,ot=Pe===o.bI.horizontal||Pe===o.bI.horizontalOnly;!Le&&!qe||xe.isHidden()||J++;let at=!1;if((Le||qe)&&m)for(const rt of t.activeReplacements){if(o.bP(rt,p,o.bQ.Symbol,x)||rt.min.x>Ce||Ce>rt.max.x||rt.min.y>Fe||Fe>rt.max.y)continue;const mt=o.bR(Ce,Fe,y.canonical,rt.footprintTileId.canonical);if(at=o.bS(mt,rt.footprint),at)break}if(Le){const rt=at?ho:Sa(xe.text);ee(t.text,ne,Ge?ho:rt),ee(t.text,fe,ot?ho:rt);const mt=xe.text.isHidden(),{leftJustifiedTextSymbolIndex:gt,centerJustifiedTextSymbolIndex:bt,rightJustifiedTextSymbolIndex:Ut,verticalPlacedTextSymbolIndex:ri}=ie,Bi=t.text.placedSymbolArray,ir=mt||Ge?1:0;gt>=0&&(Bi.get(gt).hidden=ir),bt>=0&&(Bi.get(bt).hidden=ir),Ut>=0&&(Bi.get(Ut).hidden=ir),ri>=0&&(Bi.get(ri).hidden=mt||ot?1:0);const ji=this.variableOffsets[_e];ji&&this.markUsedJustification(t,ji.anchor,ie,Pe);const qi=this.placedOrientations[_e];qi&&(this.markUsedJustification(t,"left",ie,qi),this.markUsedOrientation(t,qi,ie))}if(qe){const rt=at?ho:Sa(xe.icon),{placedIconSymbolIndex:mt,verticalPlacedIconSymbolIndex:gt}=ie,bt=t.icon.placedSymbolArray,Ut=xe.icon.isHidden()?1:0;mt>=0&&(ee(t.icon,Me,Ge?ho:rt),bt.get(mt).hidden=Ut),gt>=0&&(ee(t.icon,ie.numVerticalIconVertices,ot?ho:rt),bt.get(gt).hidden=Ut)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const rt=t.collisionArrays[K];if(rt){let mt=new o.P(0,0),gt=!0;if(rt.textBox||rt.verticalTextBox){if(z){const Ut=this.variableOffsets[_e];Ut?(mt=$i(Ut.anchor,Ut.width,Ut.height,Ut.textOffset,Ut.textScale),k&&mt._rotate(B?this.transform.angle:-this.transform.angle)):gt=!1}M&&(gt=!xe.clipped),rt.textBox&&Ns(t.textCollisionBox.collisionVertexArray,xe.text.placed,!gt||Ge,le,H,mt.x,mt.y),rt.verticalTextBox&&Ns(t.textCollisionBox.collisionVertexArray,xe.text.placed,!gt||ot,le,H,mt.x,mt.y)}const bt=gt&&!!(!ot&&rt.verticalIconBox);rt.iconBox&&Ns(t.iconCollisionBox.collisionVertexArray,xe.icon.placed,bt,le,H,ie.hasIconTextFit?mt.x:0,ie.hasIconTextFit?mt.y:0),rt.verticalIconBox&&Ns(t.iconCollisionBox.collisionVertexArray,xe.icon.placed,!bt,le,H,ie.hasIconTextFit?mt.x:0,ie.hasIconTextFit?mt.y:0)}}}if(t.fullyClipped=J===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const K=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=K.invProjMatrix,t.placementViewportMatrix=K.viewportMatrix,t.collisionCircleArray=K.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const c=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function Ns(l,t,n,c,d,p,m){l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0)}const Oi=Math.pow(2,25),kc=Math.pow(2,24),Al=Math.pow(2,17),Ml=Math.pow(2,16),En=Math.pow(2,9),$r=Math.pow(2,8),Gf=Math.pow(2,1);function Sa(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*Oi+t*kc+n*Al+t*Ml+n*En+t*$r+n*Gf+t}const ho=0;class Cl{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,n,c,d,p,m){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((x,T)=>x.sortKey-T.sortKey));this._currentPartIndex<y.length;){const x=y[this._currentPartIndex];if(n.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class Fc{constructor(t,n,c,d,p,m,y,x,T){this.placement=new Gn(t,p,m,y,x,T),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,c,d,p){const m=o.q.now(),y=()=>{const x=o.q.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=n[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=T)&&(!x.maxzoom||x.maxzoom>T)){const S=x,M=S.layout.get("symbol-z-elevate"),I=S.layout.get("symbol-sort-key").constantOr(1)!==void 0,C=S.layout.get("symbol-z-order"),L=C==="viewport-y"||C==="auto"&&!(C!=="viewport-y"&&I),z=S.layout.get("text-allow-overlap")||S.layout.get("icon-allow-overlap")||S.layout.get("text-ignore-placement")||S.layout.get("icon-ignore-placement"),k=L&&z,B=this._inProgressLayer=this._inProgressLayer||new Cl(S),V=o.C(x.source,x.scope);if(B.continuePlacement(M||k?d[V]:c[V],this.placement,this._showCollisionBoxes,x,y,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Pl=512/o.aj/2;class Oc{constructor(t,n,c){this.tileID=t,this.bucketInstanceId=c,this.index=new o.bW(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*o.aj,p=t.canonical.y*o.aj;for(let m=0;m<n.length;m++){const{key:y,crossTileID:x,tileAnchorX:T,tileAnchorY:S}=n.get(m),M=Math.floor((d+T)*Pl),I=Math.floor((p+S)*Pl);this.index.add(M,I),this.keys.push(y),this.crossTileIDs.push(x)}this.index.finish()}findMatches(t,n,c){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z),p=Pl/Math.pow(2,n.canonical.z-this.tileID.canonical.z),m=n.canonical.x*o.aj,y=n.canonical.y*o.aj;for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const{key:S,tileAnchorX:M,tileAnchorY:I}=T,C=Math.floor((m+M)*p),L=Math.floor((y+I)*p),z=this.index.range(C-d,L-d,C+d,L+d).sort((k,B)=>k-B);for(const k of z){const B=this.crossTileIDs[k];if(this.keys[k]===S&&!c.has(B)){c.add(B),T.crossTileID=B;break}}}}}class In{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Vs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const c in this.indexes){const d=this.indexes[c],p={};for(const m in d){const y=d[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[c]=p}this.lng=t}addBucket(t,n,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in m){const x=m[y];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,d)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,d)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=c.generate(),d.add(m.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Oc(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const c of n.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let n=!1;for(const c in this.indexes){const d=this.indexes[c];for(const p in d)t[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[p]),delete d[p],n=!0)}return n}}class Ln{constructor(){this.layerIndexes={},this.crossTileIDs=new In,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,c,d){let p=this.layerIndexes[t.fqid];p===void 0&&(p=this.layerIndexes[t.fqid]=new Vs);let m=!1;const y={};d.name!=="globe"&&p.handleWrapJump(c);for(const x of n){const T=x.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,T,this.crossTileIDs)&&(m=!0),y[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(t){const n={};t.forEach(c=>{n[c]=!0});for(const c in this.layerIndexes)n[c]||delete this.layerIndexes[c]}}const Zo=771;class ui{constructor(t,n,c,d){this.blendFunction=t,this.blendColor=n.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}ui.Replace=[1,0,1,0],ui.disabled=new ui(ui.Replace,o.am.transparent,[!1,!1,!1,!1]),ui.unblended=new ui(ui.Replace,o.am.transparent,[!0,!0,!0,!0]),ui.alphaBlended=new ui([1,Zo,1,Zo],o.am.transparent,[!0,!0,!0,!0]),ui.alphaBlendedNonPremultiplied=new ui([770,Zo,770,Zo],o.am.transparent,[!0,!0,!0,!0]),ui.multiply=new ui([774,0,774,0],o.am.transparent,[!0,!0,!0,!0]);
16class nt{constructor(t,n,c){this.func=t,this.mask=n,this.range=c}}nt.ReadOnly=!1,nt.ReadWrite=!0,nt.disabled=new nt(519,nt.ReadOnly,[0,1]);const os=7680;class $t{constructor(t,n,c,d,p,m){this.test=t,this.ref=n,this.mask=c,this.fail=d,this.depthFail=p,this.pass=m}}$t.disabled=new $t({func:519,mask:0},0,0,os,os,os);const Vr=1029,Rl=2305;class zt{constructor(t,n,c){this.enable=t,this.mode=n,this.frontFace=c}}function Ea(l,t){const n=o.c1(l,3);o.c3(l,t),o.c7(l,3,n)}function Ia(l,t){const n=o.b_([]);return o.b$(n,n,-t),o.c0(n,n,-l),n}function po(l,t){const n=[l[0],l[1],0],c=[t[0],t[1],0];if(o.ae(n)>=1e-15){const m=o.au([],n);o.bY(c,m,o.bG(c,m)),t[0]=c[0],t[1]=c[1]}const d=o.bF([],t,l);if(o.bZ(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return Ia(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),p)}zt.disabled=new zt(!1,Vr,Rl),zt.backCCW=new zt(!0,Vr,Rl),zt.backCW=new zt(!0,Vr,2304),zt.frontCW=new zt(!0,1028,2304),zt.frontCCW=new zt(!0,1028,Rl);class Gd{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof o.ac?t:new o.ac(t[0],t[1],t[2]);
16this._renderWorldCopies&&(n.x=o.bX(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n){if(this.orientation=null,!this.position)return;const c=this.position,d=this._elevation?this._elevation.getAtPointOrZero(o.ac.fromLngLat(t)):0,p=o.ac.fromLngLat(t,d),m=[p.x-c.x,p.y-c.y,p.z-c.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=po(m,n)}setPitchBearing(t,n){this.orientation=Ia(o.al(t),o.al(-n))}}class as{constructor(t,n){this._transform=o.bx([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new o.ac(t[0],t[1],t[2])}get position(){const t=o.c1(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&o.c7(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||o.b_([]),t&&Ea(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),n=this.right();return{bearing:Math.atan2(-n[1],n[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,n){this._orientation=Ia(t,n),Ea(this._transform,this._orientation)}forward(){const t=o.c1(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=o.c1(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=o.c1(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const c=new Float64Array(16);return o.bi(c,this.getWorldToCamera(t,n)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,c){const d=this.position;o.bY(d,d,-t);const p=new Float64Array(16);return o.bn(p,[c,c,c]),o.bo(p,p,d),p[10]*=n,p}getWorldToCamera(t,n){const c=new Float64Array(16),d=new Float64Array(4),p=this.position;return o.c2(d,this._orientation),o.bY(p,p,-t),o.c3(c,d),o.bo(c,c,p),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=n,c[9]*=n,c[10]*=n,c[11]*=n,c}getCameraToClipPerspective(t,n,c,d){const p=new Float64Array(16);return o.c4(p,t,n,c,d),p}getCameraToClipOrthographic(t,n,c,d,p,m){const y=new Float64Array(16);return o.c5(y,t,n,c,d,p,m),y}getDistanceToElevation(t,n=!1){const c=t===0?0:o.c6(t,n?o.aY(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new as([...this.position],[...this.orientation])}}const An={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class zl{constructor(t=0,n=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=c,this.right=d}interpolate(t,n,c){return n.top!=null&&t.top!=null&&(this.top=o.ai(t.top,n.top,c)),n.bottom!=null&&t.bottom!=null&&(this.bottom=o.ai(t.bottom,n.bottom,c)),n.left!=null&&t.left!=null&&(this.left=o.ai(t.left,n.left,c)),n.right!=null&&t.right!=null&&(this.right=o.ai(t.right,n.right,c)),this}getCenter(t,n){const c=o.ay((this.left+t-this.right)/2,0,t),d=o.ay((this.top+n-this.bottom)/2,0,n);return new o.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new zl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const en=15;class ih{constructor(t,n,c,d,p,m,y){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new o.cd(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new zl,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new as,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new ih(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 1,249 bytes, line 16
16xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<en}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,n=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
16xaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return o.aF(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=o.ce(this.projectionOptions);const c=this.getProjection(),d=!o.bv(n,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=o.ce({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return o.c6(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return o.bX(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=o.cf(),o.cg(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=o.ay(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=o.al(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._setZoom(n),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,n=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
160&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!n||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;n||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,p=0;for(let m=0;m<n.length;m++){const y=new o.P(n[m][0]*this.width,c+n[m][1]*(this.height-c)),x=t.pointCoordinate(y);if(!x)continue;const T=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*T,p+=T}return p===0?NaN:d/p}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,n=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*n,d=this._mercatorZfromZoom(t),p=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-c,p);this._setZoom(this._zoomFromMercatorZ(m))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(t){const n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[n.x,n.y,n.z]:[t.x,t.y,t.z];const d=o.ae(o.at([],this._camera.position,c));return o.ay(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!o.ch(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];o.ci(c,this._camera.position)||(this._setCameraPosition(c),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new Gd;return n.position=new o.ac(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!o.cj(t))return!1;o.ck(t,t);const n=o.cl([],[0,0,-1],t),c=o.cl([],[0,-1,0],t);if(c[2]<0)return!1;const d=po(n,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const n=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=o.ay(t[2],d/c,d/n),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,c){this._unmodified=!1,this._edgeInsets.interpolate(t,n,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new o.cm(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new o.P(0,0)),d=this.pointCoordinate(new o.P(this.width,0)),p=this.pointCoordinate(new o.P(this.width,this.height)),m=this.pointCoordinate(new o.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,p.x,m.x)),x=Math.floor(Math.max(c.x,d.x,p.x,m.x)),T=1;for(let S=y-T;S<=x+T;S++)S!==0&&n.push(new o.cm(S,t))}return n}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,n,c){let d=[];const p=c!=null,m=!p;if(m&&this.zoom<n||p&&c[0]===0&&c[1]===0)return d;const y=new Set,x=(S,M,I,C,L)=>{const z=o.cK(M,S,I,C,L);y.has(z)||(d.push(new o.aM(S,M,I,C,L)),y.add(z))};for(let S=0;S<t.length;S++){const M=t[S];if(m&&M.canonical.z!==n)continue;const I=M.canonical,C=M.overscaledZ,L=M.wrap,z=1<<I.z,k=I.x+1<z,B=I.x>0,V=I.y+1<z,H=I.y>0,Y=M.wrap-(B?0:1),te=M.wrap+(k?0:1),ee=B?I.x-1:z-1,J=k?I.x+1:0;if(p)c[0]<0?(x(C,te,I.z,J,I.y),c[1]<0&&V&&(x(C,L,I.z,I.x,I.y+1),x(C,te,I.z,J,I.y+1)),c[1]>0&&H&&(x(C,L,I.z,I.x,I.y-1),x(C,te,I.z,J,I.y-1))):c[0]>0?(x(C,Y,I.z,ee,I.y),c[1]<0&&V&&(x(C,L,I.z,I.x,I.y+1),x(C,Y,I.z,ee,I.y+1)),c[1]>0&&H&&(x(C,L,I.z,I.x,I.y-1),x(C,Y,I.z,ee,I.y-1))):c[1]<0&&V?x(C,L,I.z,I.x,I.y+1):H&&x(C,L,I.z,I.x,I.y-1);else{const K=M.visibleQuadrants;
161&K&&(x(C,Y,I.z,ee,I.y),H&&(x(C,L,I.z,I.x,I.y-1),x(C,Y,I.z,ee,I.y-1))),2&K&&(x(C,te,I.z,J,I.y),H&&(x(C,L,I.z,I.x,I.y-1),x(C,te,I.z,J,I.y-1))),4&K&&(x(C,Y,I.z,ee,I.y),V&&(x(C,L,I.z,I.x,I.y+1),x(C,Y,I.z,ee,I.y+1))),8&K&&(x(C,te,I.z,J,I.y),V&&(x(C,L,I.z,I.x,I.y+1),x(C,te,I.z,J,I.y+1)))}}const T=[];for(const S of d)d.some(M=>S.isChildOf(M))||T.push(S);if(d=T.filter(S=>!t.some(M=>!!(S.overscaledZ<n&&M.isChildOf(S))||S.equals(M)||S.isChildOf(M))),m){const S=1<<n,M=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),I=[S*M.x,S*M.y],C=4,L=C*C;d=d.filter(z=>{const k=z.canonical.x+.5-I[0],B=z.canonical.y+.5-I[1];return k*k+B*B<L})}return d}coveringTiles(t){let n=this.coveringZoomLevel(t);const c=n,d=this.elevation&&this.elevation.exaggeration(),p=d&&!t.isTerrainDEM,m=this.projection.name==="mercator";if(t.minzoom!==void 0&&n<t.minzoom)return[];t.maxzoom!==void 0&&n>t.maxzoom&&(n=t.maxzoom);const y=this.locationCoordinate(this.center),x=this.center.lat,T=1<<n,S=[T*y.x,T*y.y,0],M=this.projection.name==="globe",I=!M,C=o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,I),L=M?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=T*o.c6(1,this.center.lat),k=this._camera.position[2]/o.c6(1,this.center.lat),B=[T*L.x,T*L.y,k*(I?1:z)],V=M||d,H=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),Y=this.isLODDisabled(!0)?n:0;let te;if(this._elevation&&t.isTerrainDEM)te=1e4*this._elevation.exaggeration();else if(this._elevation){const le=this._elevation.getMinMaxForVisibleTiles();te=le?le.max:this._centerAltitude}else te=this._centerAltitude;const ee=t.isTerrainDEM?-te:this._elevation?this._elevation.getMinElevationBelowMSL():0,J=this.projection.isReprojectedInTileSpace?o.co(this):1,K=le=>{const xe=new o.ac(le.x+25e-6,le.y,le.z),Le=new o.ac(le.x,le.y+25e-6,le.z),qe=le.toLngLat(),Pe=xe.toLngLat(),Ge=Le.toLngLat(),ot=this.locationCoordinate(qe),at=this.locationCoordinate(Pe),rt=this.locationCoordinate(Ge),mt=Math.hypot(at.x-ot.x,at.y-ot.y),gt=Math.hypot(rt.x-ot.x,rt.y-ot.y);return Math.sqrt(mt*gt)*J/25e-6},ie=le=>{const Re=te,xe=ee;return{aabb:o.cr(this,T,0,0,0,le,xe,Re,this.projection),zoom:0,x:0,y:0,minZ:xe,maxZ:Re,wrap:le,fullyVisible:!1}},ne=[];let fe=[];const _e=n,Me=t.reparseOverscaled?c:n,Ce=(k-this._centerAltitude)*z,Fe=le=>{if(!this._elevation||!le.tileID||!m)return;const Re=this._elevation.getMinMaxForTile(le.tileID),xe=le.aabb;Re?(xe.min[2]=Re.min,xe.max[2]=Re.max,xe.center[2]=(xe.min[2]+xe.max[2])/2):(le.shouldSplit=Te(le),le.shouldSplit||(xe.min[2]=xe.max[2]=xe.center[2]=this._centerAltitude))},de=(le,Re)=>{if(.707*Re<le)return 1;const xe=Re/le;return xe/(1.4144271570014144+(Math.pow(1.1,xe-1.4144271570014144+1)-1)/(1.1-1)-1)},Te=le=>{if(le.zoom<Y)return!0;if(le.zoom===_e)return!1;if(le.shouldSplit!=null)return le.shouldSplit;const Re=le.aabb.distanceX(B),xe=le.aabb.distanceY(B);let Le=Ce,qe=1;if(M){Le=le.aabb.distanceZ(B);const gt=Math.pow(2,le.zoom),bt=o.aY((le.y+1)/gt),Ut=o.aY(le.y/gt),ri=Math.min(Math.max(x,bt),Ut),Bi=o.cO(ri)/o.cO(x);if(qe=ri===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Bi/this._mercatorScaleRatio),this.zoom<=o.cL&&le.zoom===_e-1&&Bi>=.9)return!0}else if(p&&(Le=le.aabb.distanceZ(B)*z),this.projection.isReprojectedInTileSpace&&c<=5){const gt=Math.pow(2,le.zoom),bt=K(new o.ac((le.x+.5)/gt,(le.y+.5)/gt));qe=bt>.85?1:bt}if(!m){const gt=Math.sqrt(Re*Re+xe*xe+Le*Le);let bt=(1<<_e-le.zoom)*H*qe;return bt*=de(Math.max(Le,Ce),gt),gt<bt}let Pe=Number.MAX_VALUE,Ge=0;const ot=le.aabb.getCorners(),at=[];for(const gt of ot){o.at(at,gt,B),M||(p?at[2]*=z:at[2]=Ce);const bt=o.bG(at,this._camera.forward());bt<Pe&&(Pe=bt,Ge=Math.abs(at[2]))}let rt=(1<<_e-le.zoom)*H*qe;if(rt*=de(Math.max(Ge,Ce),Pe),Pe<rt)return!0;const mt=le.aabb.closestPoint(S);return mt[0]===S[0]&&mt[1]===S[1]};if(this.renderWorldCopies)for(let le=1;le<=3;le++)ne.push(ie(-le)),ne.push(ie(le));for(ne.push(ie(0));ne.length>0;){const le=ne.pop(),Re=le.x,xe=le.y;let Le=le.fullyVisible;const qe=()=>this.projection.name==="globe"&&(le.y===0||le.y===(1<<le.zoom)-1);if(!Le){let Pe=V?le.aabb.intersects(C):le.aabb.intersectsFlat(C);if(Pe===0&&qe()){const Ge=new o.cp(le.zoom,Re,xe);Pe=o.cq(this,T,Ge,!0).intersects(C)}if(Pe===0)continue;Le=Pe===2}if(le.zoom!==_e&&Te(le))for(let Pe=0;Pe<4;Pe++){const Ge=(Re<<1)+Pe%2,ot=(xe<<1)+(Pe>>1),at={aabb:m?le.aabb.quadrant(Pe):o.cr(this,T,le.zoom+1,Ge,ot,le.wrap,le.minZ,le.maxZ,this.projection),zoom:le.zoom+1,x:Ge,y:ot,wrap:le.wrap,fullyVisible:Le,tileID:void 0,shouldSplit:void 0,minZ:le.minZ,maxZ:le.maxZ};p&&!M&&(at.tileID=new o.aM(le.zoom+1===_e?Me:le.zoom+1,le.wrap,le.zoom+1,Ge,ot),Fe(at)),ne.push(at)}else{const Pe=le.zoom===_e?Me:le.zoom;if(t.minzoom&&t.minzoom>Pe)continue;let Ge=0;
16if(!Le){let mt=V?le.aabb.intersectsPrecise(C):le.aabb.intersectsPreciseFlat(C);if(mt===0&&qe()){const gt=new o.cp(le.zoom,Re,xe);mt=o.cq(this,T,gt,!0).intersectsPrecise(C)}if(mt===0)continue;if(t.calculateQuadrantVisibility)if(C.containsPoint(le.aabb.center))Ge=15;else for(let gt=0;gt<4;gt++)le.aabb.quadrant(gt).intersects(C)!==0&&(Ge|=1<<gt)}const ot=S[0]-(.5+Re+(le.wrap<<le.zoom))*(1<<n-le.zoom),at=S[1]-.5-xe,rt=le.tileID?le.tileID:new o.aM(Pe,le.wrap,le.zoom,Re,xe);t.calculateQuadrantVisibility&&(rt.visibleQuadrants=Ge),fe.push({tileID:rt,distanceSq:ot*ot+at*at})}}if(this.fogCullDistSq){const le=this.fogCullDistSq,Re=this.horizonLineFromTop();fe=fe.filter(xe=>{const Le=[0,0,0,1],qe=[o.aj,o.aj,0,1],Pe=this.calculateFogTileMatrix(xe.tileID.toUnwrapped());o.aA(Le,Le,Pe),o.aA(qe,qe,Pe);const Ge=o.cs([],Le,qe),ot=o.ct([],Le,qe),at=o.cM(Ge,ot);if(at===0)return!0;let rt=!1;const mt=this._elevation;if(mt&&at>le&&Re!==0){const gt=this.calculateProjMatrix(xe.tileID.toUnwrapped());let bt;t.isTerrainDEM||(bt=mt.getMinMaxForTile(xe.tileID)),bt||(bt={min:ee,max:te});const Ut=o.cu(this.rotation),ri=[Ut[0]*o.aj,Ut[1]*o.aj,bt.max];o.ad(ri,ri,gt),rt=(1-ri[1])*this.height*.5<Re}return at<le||rt})}return fe.sort((le,Re)=>le.distanceSq-Re.distanceSq).map(le=>le.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=o.ay(t.lat,-85.051129,o.cv),c=this.projection.project(t.lng,n);return new o.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/o.c6(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let c,d;const p=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(n.x-p.x)/y,d=(n.y-p.y)/y}else{const y=this.pointCoordinate(n),x=this.pointCoordinate(p);c=y.x-x.x,d=y.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new o.ac(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,n){return this.projection.locationPoint(this,t,n)}locationPoint3D(t,n){return this.projection.locationPoint(this,t,n,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,n){return this.coordinateLocation(this.pointCoordinate3D(t,n))}locationCoordinate(t,n){const c=n?o.c6(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new o.ac(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const c=n??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];o.aA(d,d,this.pixelMatrixInverse),o.aA(p,p,this.pixelMatrixInverse);const m=p[3];o.cw(d,d,1/d[3]),o.cw(p,p,1/m);const y=d[2],x=p[2];return{p0:d,p1:p,t:y===x?0:(c-y)/(x-y)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return o.aA(n,n,this.pixelMatrixInverse),o.aA(c,c,this.pixelMatrixInverse),o.cw(n,n,1/n[3]),o.cw(c,c,1/c[3]),n[2]=o.c6(n[2],this._center.lat)*this.worldSize,c[2]=o.c6(c[2],this._center.lat)*this.worldSize,o.cw(n,n,1/this.worldSize),o.cw(c,c,1/this.worldSize),new o.av([n[0],n[1],n[2]],o.au([],o.at([],c,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:c,t:d}=t,p=o.c6(n[2],this._center.lat),m=o.c6(c[2],this._center.lat);return new o.ac(o.ai(n[0],c[0],d)/this.worldSize,o.ai(n[1],c[1],d)/this.worldSize,o.ai(p,m,d))}pointCoordinate(t,n=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,n)}pointCoordinate3D(t,n){if(!this.elevation)return this.pointCoordinate(t,n);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new o.ac(c[0],c[1],c[2]);let d=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t,n);const m=.02*p,y=t.clone();for(let x=0;x<10&&p-d>m;x++){y.y=o.ai(d,p,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(p=y.y,c=T):d=y.y}return c?new o.ac(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=o.cx)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const c=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return o.aA(d,d,this.pixelMatrix),d[3]>0?new o.P(d[0]/d[3],d[1]/d[3]):new o.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new o.P(n,t)),m=this.pointLocation3D(new o.P(d,t)),y=this.pointLocation3D(new o.P(d,c)),x=this.pointLocation3D(new o.P(n,c));let T=Math.min(p.lng,m.lng,y.lng,x.lng),S=Math.max(p.lng,m.lng,y.lng,x.lng),M=Math.min(p.lat,m.lat,y.lat,x.lat),I=Math.max(p.lat,m.lat,y.lat,x.lat);const C=Math.pow(2,-this.zoom)/16*270,L=this.projection.name==="globe"?1:4,z=(k,B,V,H,Y)=>{const te=(k+V)/2,ee=(B+H)/2,J=new o.P(te,ee),{lng:K,lat:ie}=this.pointLocation3D(J),ne=Math.max(0,T-K,M-ie,K-S,ie-I);T=Math.min(T,K),S=Math.max(S,K),M=Math.min(M,ie),I=Math.max(I,ie),(Y<L||ne>C)&&(z(k,B,te,ee,Y+1),z(te,ee,V,H,Y+1))};if(z(n,t,d,t,1),z(d,t,d,c,1),z(d,c,n,c,1),z(n,c,n,t,1),this.projection.name==="globe"){const[k,B]=o.cy(this);k?(I=90,S=180,T=-180):B&&(M=-90,S=180,T=-180)}return new o.aG(new o.cd(T,M),new o.cd(S,I))}_getBoundsRectangular(t,n){const{top:c,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,y=new o.P(d,c),x=new o.P(m,c),T=new o.P(m,p),S=new o.P(d,p);let M=this.pointCoordinate(y,t),I=this.pointCoordinate(x,t);const C=this.pointCoordinate(T,n),L=this.pointCoordinate(S,n),z=(k,B)=>(B.y-k.y)/(B.x-k.x);return M.y>1&&I.y>=0?M=new o.ac((1-L.y)/z(L,M)+L.x,1):M.y<0&&I.y<=1&&(M=new o.ac(-L.y/z(L,M)+L.x,0)),I.y>1&&M.y>
16=0?I=new o.ac((1-C.y)/z(C,I)+C.x,1):I.y<0&&M.y<=1&&(I=new o.ac(-C.y/z(C,I)+C.x,0)),new o.aG().extend(this.coordinateLocation(M)).extend(this.coordinateLocation(I)).extend(this.coordinateLocation(L)).extend(this.coordinateLocation(C))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const n=t.visibleDemTiles.reduce((c,d)=>{if(d.dem){const p=d.dem.tree;c.min=Math.min(c.min,p.minimums[0]),c.max=Math.max(c.max,p.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(n.min*t.exaggeration(),n.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const n=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-n*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-85.051129,this.maxLat=o.cv,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=o.aD(this.minLng)*this.tileSize,this.worldMaxX=o.aD(this.maxLng)*this.tileSize,this.worldMinY=o.aH(this.maxLat)*this.tileSize,this.worldMaxY=o.aH(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,n){return this.projection.createTileMatrix(this,n,t)}calculateDistanceTileData(t){const n=t.key,c=this._distanceTileDataCache;if(c[n])return c[n];const d=t.canonical,p=1/this.height,m=this.cameraWorldSize,y=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*y,T=d.y*y,S=this.point;S.x*=m/this.worldSize,S.y*=m/this.worldSize;const M=this.angle,I=Math.sin(-M),C=-Math.cos(-M);return c[n]={bearing:[I,C],center:[(S.x-x)*p,(S.y-T)*p],scale:y/o.aj*p},c[n]}calculateFogTileMatrix(t){const n=t.key,c=this._fogTileMatrixCache;if(c[n])return c[n];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return o.az(d,this.worldToFogMatrix,d),c[n]=new Float32Array(d),c[n]}calculateProjMatrix(t,n=!1,c=!1){const d=t.key;let p;if(p=c?this._expandedProjMatrixCache:n?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const m=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,o.az(m,y,m),p[d]=new Float32Array(m),p[d]}calculatePixelsToTileUnitsMatrix(t){const n=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[n])return c[n];const d=o.cz(t,this);return c[n]=d,c[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,n=o.bn([],[t,t,t]);return o.az(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=o.c6(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(n),d=this._camera.forward(),p=o.c6(1,this._center.lat);c[2]/=p,d[2]/=p,o.au(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const y=o.bE([],c,d,m),x=new o.ac(y[0],y[1],o.c6(y[2],o.aY(y[1]))),T=(x.z+o.ae([x.x-c[0],x.y-c[1],x.z-c[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=x.toAltitude(),this._center=this.coordinateLocation(x),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const n=this._elevation,c=o.c6(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),p=n.getAtPointOrZero(new o.ac(...d)),m=this.pixelsPerMeter/this.worldSize*p,y=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=y)if(x<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],T.z-d[2]],M=o.ae(S);S[2]-=(y-x)/this._pixelsPerMercatorPixel;const I=o.ae(S);if(I===0)return;o.bY(S,S,M/I*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-S[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const I=this.center;return I.lat=o.ay(I.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(I.lng=o.ay(I.lng,this.minLng,this.maxLng)),this.center=I,void(this._constraining=!1)}const n=this._unmodified,{x:c,y:d}=this.point;let p=0,m=c,y=d;const x=this.width/2,T=this.height/2,S=this.worldMinY*this.scale,M=this.worldMaxY*this.scale;if(d-T<S&&(y=S+T),d+T>M&&(y=M-T),M-S<this.height&&(p=Math.max(p,this.height/(M-S)),y=(M+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const I=this.worldMinX*this.scale,C=this.worldMaxX*this.scale,L=this.worldSize/2-(I+C)/2;m=(c+L+this.worldSize)%this.worldSize-L,m-x<I&&(m=I+x),m+x>C&&(m=C-x),C-I<this.width&&(p=Math.max(p,this.width/(C-I)),m=(C+I)/2)}m===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new o.P(m,y))),p&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(p)),this._constrainCamera(),this._unmodified=n,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
16_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o.c6(1,this.center.lat)/o.c6(1,o.cP));const d=o.cA(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,p);let y;const x=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(x[8]=2*-t.x/this.width,x[9]=2*t.y/this.height,this.isOrthographic){let ie=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ne=ie*this.aspect,fe=-ne,_e=-ie;ne-=t.x,fe-=t.x,ie+=t.y,_e+=t.y,y=this._camera.getCameraToClipOrthographic(fe,ne,_e,ie,this._nearZ,this._farZ),((Me,Ce,Fe,de)=>{for(let Te=0;Te<16;Te++)Me[Te]=o.ai(Ce[Te],Fe[Te],de)})(y,y,x,o.cN(this.pitch>=en?1:this.pitch/en))}else y=x;const T=o.cB([],x,m);let S=o.cB([],y,m);if(this.projection.isReprojectedInTileSpace){const ie=this.locationCoordinate(this.center),ne=o.bx([]);o.bo(ne,ne,[ie.x*this.worldSize,ie.y*this.worldSize,0]),o.az(ne,ne,o.cC(this)),o.bo(ne,ne,[-ie.x*this.worldSize,-ie.y*this.worldSize,0]),o.az(S,S,ne),o.az(T,T,ne),this.inverseAdjustmentMatrix=o.cD(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=o.cE([],S,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=S,this.invProjMatrix=o.bi(new Float64Array(16),this.projMatrix),n){const ie=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ie[8]=2*-t.x/this.width,ie[9]=2*t.y/this.height,this.expandedFarZProjMatrix=o.cB([],ie,m)}else this.expandedFarZProjMatrix=this.projMatrix;const M=o.bi([],y);this.frustumCorners=o.cF.fromInvProjectionMatrix(M,this.horizonLineFromTop(),this.height),this.cameraFrustum=o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);const I=new Float32Array(16);o.bx(I),o.cE(I,I,[1,-1,1]),o.cG(I,I,this._pitch),o.by(I,I,this.angle);const C=o.c4(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=o.bw(C);const L=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;C[8]=2*-t.x/this.width,C[9]=2*(t.y+L)/this.height,this.skyboxMatrix=o.az(I,C,I);const z=this.point,k=z.x,B=z.y,V=this.width%2/2,H=this.height%2/2,Y=Math.cos(this.angle),te=Math.sin(this.angle),ee=k-Math.round(k)+Y*V+te*H,J=B-Math.round(B)+Y*H+te*V,K=new Float64Array(S);if(o.bo(K,K,[ee>.5?ee-1:ee,J>.5?J-1:J,0]),this.alignedProjMatrix=K,S=o.bz(),o.cE(S,S,[this.width/2,-this.height/2,1]),o.bo(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=o.bz(),o.cE(S,S,[1,-1,1]),o.bo(S,S,[-1,-1,0]),o.cE(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=o.az(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=o.bi(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=o.cH(this);const ie=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=o.ad(ie,ie,m),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,n=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,p=[t,t,n];o.bY(p,p,d),o.bY(c,c,-1),o.cI(c,c,p);const m=o.bz();o.bo(m,m,c),o.cE(m,m,p),this.mercatorFogMatrix=m,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,d)}_computeCameraPosition(t){const n=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*n-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*p,d.y/this.worldSize-c[1]*p,t/this.worldSize*this._centerAltitude-c[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((n-c)/d,1)),this._camera.position=o.bE([],this._camera.position,t,p),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),p=o.c6(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(o.al(this._maxPitch)),y=Math.max((t[2]-p)/Math.cos(c),m),x=this._zoomFromMercatorZ(y);o.bE(t,t,n,y),this._pitch=o.ay(c,o.al(this.minPitch),o.al(this.maxPitch)),this.angle=o.bX(d,-Math.PI,Math.PI),this._setZoom(o.ay(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new o.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let n=0,c=o.cx,d=0,p=1/0;for(;c-n>1e-6&&c>n;){const m=n+.5*(c-n),y=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,y),T=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),S=Math.abs(m-T);S<p&&(p=S,d=m),m<T?n=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(o.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const c=Math.min(t.x,n.x),d=Math.max(t.x,n.x),p=Math.min(t.y,n.y),m=Math.max(t.y,n.y);if(p<this.horizonLineFromTop(!1))return!0;
16if(this.projection.name!=="mercator")return!1;const y=[new o.P(c,p),new o.P(d,m),new o.P(c,m),new o.P(d,p)],x=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const M=this.pointRayIntersection(S);if(M.t<0)return!0;const I=this.rayIntersectionCoordinate(M);if(I.x<x||I.y<0||I.x>T||I.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+o.cJ(this.fovAboveCenter)>88||this.anyCornerOffEdge(new o.P(0,0),new o.P(this.width,this.height))}zoomDeltaToMovement(t,n){const c=o.ae(o.at([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+n;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([n,c,d],p){const m=[n,c,d,1];o.aA(m,m,p);const y=m[3]=Math.max(m[3],1e-6);return m[0]/=y,m[1]/=y,m[2]/=y,m}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new o.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,c=this.worldSize){const d=o.cA(t,n,this.width,this.height,1024),p=t.pixelSpaceConversion(this.center.lat,c,d);let m=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(m=o.ai(1,m,o.cN(this.pitch>=en?1:this.pitch/en))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&o.az(t,t,this.globeMatrix),t}getFrustum(t){return o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const Es=(l,t)=>{if(t>0&&l.terrain&&o.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=l.transform,c=Math.max(Math.abs(n._zoom-(l.minCutoffZoom-1)),1),d=n.isLODDisabled(!1)?o.af(60,45,n.pitch):o.af(30,15,n.pitch),p=n._farZ-n._nearZ,m=t*n.height,y=((1-(x=d))*n.cameraToCenterDistance+x*(n._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(y-n._nearZ)/p,(y-m-n._nearZ)/p]}}},_n={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class Dl{constructor(t,n){this.aabb=t,this.lastCascade=n}}class $f{add(t,n){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],n.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],n.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],n.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],n.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],n.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],n.max[2])):this.receivers[t.key]=new Dl(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,c){const d=o.cW.fromPoints(t.points);let p=0;for(const m in this.receivers){const y=this.receivers[m];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const x=y.aabb.getCorners();for(let T=0;T<c.length;T++){let S=!0;for(const M of x){const I=[M[0]*n,M[1]*n,M[2]];if(o.ad(I,I,c[T].matrix),I[0]<-1||I[0]>1||I[1]<-1||I[1]>1){S=!1;break}}if(y.lastCascade=T,p=Math.max(p,T),S)break}}return p+1}}class qf{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new $f,this._depthMode=new nt(t.context.gl.LEQUAL,nt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),t.tp.registerParameter(_n,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(_n,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(_n,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,n){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!n||!n.properties)return;const d=n.properties.get("shadow-intensity");if(!n.shadowsEnabled()||d<=0||(this._shadowLayerCount=c.style.order.reduce((L,z)=>{const k=c.style._mergedLayers[z];return L+(k.hasShadowPass()&&!k.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const p=c.context,m=_n.shadowMapResolution,y=_n.shadowMapResolution;if(this._cascades.length===0||_n.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let L=0;L<_n.cascadeCount;++L){const z=c._shadowMapDebug,k=p.gl,B=p.createFramebuffer(m,y,z,"texture"),V=new o.T(p,{width:m,height:y,data:null},k.DEPTH_COMPONENT16);if(B.depthAttachment.set(V.texture),z){const H=new o.T(p,{width:m,height:y,data:null},k.RGBA8);B.colorAttachment.set(H.texture)}this._cascades.push({framebuffer:B,texture:V,matrix:[],far:0,boundingSphereRadius:0,frustum:new o.cn,scale:0})}}this.shadowDirection=Aa(n);let x=0;if(t.elevation){const L=t.elevation,z=[1e4,-1e4];L.visibleDemTiles.filter(k=>k.dem).forEach(k=>{const B=k.dem.tree;z[0]=Math.min(z[0],B.minimums[0]),z[1]=Math.max(z[1],B.maximums[0])}),z[0]!==1e4&&(x=(z[1]-z[0])*L.exaggeration())}const T=1.5*t.cameraToCenterDistance,S=3*T,M=new Float64Array(16);for(let L=0;L<this._cascades.length;++L){const z=this._cascades[L];let k=t.height/50,B=1;_n.cascadeCount===1?B=S:L===0?B=T:(k=T,B=S);const[V,H]=Ma(t,this.shadowDirection,k,B,_n.shadowMapResolution,x);z.scale=t.scale,z.matrix=V,z.boundingSphereRadius=H,o.bi(M,z.matrix),z.frustum=o.cn.fromInvProjectionMatrix(M,1,0,!0),z.far=B}const I=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[I].far,this._cascades[I].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/_n.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=_n.shadowMapResolution,this._uniformValues.u_shadowmap_0=An.ShadowMap0,this._uniformValues.u_shadowmap_1=An.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const C=c.transform.elevation;for(const L of this._groundShadowTiles){let z={min:0,max:0};if(C){const k=C.getMinMaxForTile(L);k&&(z=k)}this.addShadowReceiver(L.toUnwrapped(),z.min,z.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,n){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,_n.shadowMapResolution,_n.shadowMapResolution]);for(let p=0;p<this._numCascadesToRender;++p){c.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:o.am.white,depth:1});for(const m of t.order){const y=t._mergedLayers[m];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const x=t.getLayerSourceCache(y),T=x?n[x.id]:void 0;(y.type==="model"||T&&T.length)&&c.renderLayer(c,x,y,T)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,n=t.style,c=t.context,d=c.gl,p=n.directionalLight,m=n.ambientLight;if(!p||!m)return;const y=[],x=Es(t,t.longestCutoffRange);x.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=Wo(n,p,m),S=new nt(d.LEQUAL,nt.ReadOnly,t.depthRangeFor3D),M=new $t({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const I of this._groundShadowTiles){const C=I.toUnwrapped(),L=t.isTileAffectedByFog(I),z=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:L});this.setupShadows(C,z),t.uploadCommonUniforms(c,z,C,null,x);const k={u_matrix:t.transform.calculateProjMatrix(C),u_ground_shadow_factor:T};z.draw(t,d.TRIANGLES,S,M,ui.multiply,zt.disabled,k,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?ui.unblended:ui.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const n=this.painter.transform,c=n.calculatePosMatrix(t,n.worldSize);return o.az(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}
16calculateShadowPassMatrixFromMatrix(t){return o.az(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,n,c,d=0){if(!this.enabled)return;const p=this.painter.transform,m=this.painter.context,y=m.gl,x=this._uniformValues,T=new Float64Array(16),S=p.calculatePosMatrix(t,p.worldSize);for(let M=0;M<this._cascades.length;M++)o.az(T,this._cascades[M].matrix,S),x[M===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),m.activeTexture.set(y.TEXTURE0+An.ShadowMap0+M),this._cascades[M].texture.bindExtraParam(y.LINEAR,y.LINEAR,y.CLAMP_TO_EDGE,y.CLAMP_TO_EDGE,y.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const M=o.cU(t.canonical),I=2/p.tileSize*o.aj/_n.shadowMapResolution,C=I*this._cascades[0].boundingSphereRadius,L=I*this._cascades[this._cascades.length-1].boundingSphereRadius,z=(c==="vector-tile"?1:3)/Math.pow(2,d-t.canonical.z-(1-p.zoom+Math.floor(p.zoom)));x.u_shadow_normal_offset=[M,C*z,L*z],x.u_shadow_bias=[6e-5,.0012,.012]}else x.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(m,x)}setupShadowsFromMatrix(t,n,c=!1){if(!this.enabled)return;const d=this.painter.context,p=d.gl,m=this._uniformValues,y=new Float64Array(16);for(let x=0;x<_n.cascadeCount;x++)o.az(y,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(p.TEXTURE0+An.ShadowMap0+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER);if(this.useNormalOffset=c,c){const x=_n.normalOffset;m.u_shadow_normal_offset=[1,x,x],m.u_shadow_bias=[6e-5,.0012,.012]}else m.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(d,m)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,n,c,d){if(d[2]>=0)return{};const p=function(x,T,S){const M=S/(1<<x.canonical.z);return new o.cW([x.canonical.x*M+x.wrap*S,x.canonical.y*M+x.wrap*S,0],[(x.canonical.x+1)*M+x.wrap*S,(x.canonical.y+1)*M+x.wrap*S,T])}(t,n,c).getCorners(),m=n/-d[2];d[0]<0?(o.cV(p[0],p[0],[d[0]*m,0,0]),o.cV(p[3],p[3],[d[0]*m,0,0])):d[0]>0&&(o.cV(p[1],p[1],[d[0]*m,0,0]),o.cV(p[2],p[2],[d[0]*m,0,0])),d[1]<0?(o.cV(p[0],p[0],[0,d[1]*m,0]),o.cV(p[1],p[1],[0,d[1]*m,0])):d[1]>0&&(o.cV(p[2],p[2],[0,d[1]*m,0]),o.cV(p[3],p[3],[0,d[1]*m,0]));const y={};return y.vertices=p,y.planes=[fo(p[1],p[0],p[4]),fo(p[2],p[1],p[5]),fo(p[3],p[2],p[6]),fo(p[0],p[3],p[7])],y}addShadowReceiver(t,n,c){this._receivers.add(t,o.cW.fromTileIdAndHeight(t,n,c))}getMaxCascadeForTile(t){const n=this._receivers.get(t);return n&&n.lastCascade?n.lastCascade:0}}function fo(l,t,n){const c=o.at([],n,t),d=o.at([],l,t),p=o.bF([],c,d),m=o.ae(p);return m===0?[0,0,1,0]:(o.bY(p,p,1/m),[p[0],p[1],p[2],-o.bG(p,t)])}function Aa(l){const t=l.properties.get("direction"),n=o.cR(t.x,t.y,t.z);n[2]=o.ay(n[2],0,75);const c=o.cT([n[0],n[1],n[2]]);return o.cS(c.x,c.y,c.z)}function Wo(l,t,n){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=[m.x,m.y,m.z],x=n.properties.get("color-use-theme")==="none",T=n.properties.get("color"),S=n.properties.get("intensity"),M=Math.max(o.bG([0,0,1],y),0),I=[0,0,0];o.bY(I,T.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),S);const C=[0,0,0];return o.bY(C,d.toPremultipliedRenderColor(c?null:l.getLut(n.scope)).toArray01Linear().slice(0,3),M*p),o.cY([I[0]>0?I[0]/(I[0]+C[0]):0,I[1]>0?I[1]/(I[1]+C[1]):0,I[2]>0?I[2]/(I[2]+C[2]):0])}function Ma(l,t,n,c,d,p){const m=l.zoom,y=l.scale,x=l.worldSize,T=1/x,S=l.aspect,M=Math.sqrt(1+S*S)*Math.tan(.5*l.fovX),I=M*M,C=c-n,L=c+n;let z,k;I>C/L?(z=c,k=c*M):(z=.5*L*(1+I),k=.5*Math.sqrt(C*C+2*(c*c+n*n)*I+L*L*I*I));const B=l.projection.pixelsPerMeter(l.center.lat,x),V=l._camera.getCameraToWorldMercator(),H=[0,0,-z*T];o.ad(H,H,V);let Y=k*T;const te=l._edgeInsets;if(!(te.left===0&&te.top===0&&te.right===0&&te.bottom===0||te.left===te.right&&te.top===te.bottom)){const Le=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?B:1),qe=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,n,c);qe[8]=2*-l.centerOffset.x/l.width,qe[9]=2*l.centerOffset.y/l.height;const Pe=new Float64Array(16);o.cB(Pe,qe,Le);const Ge=new Float64Array(16);o.bi(Ge,Pe);const ot=o.cn.fromInvProjectionMatrix(Ge,x,m,!0);for(const at of ot.points){const rt=((ee=at)[0]/=y,ee[1]/=y,ee[2]=o.c6(ee[2],l._center.lat),ee);Y=Math.max(Y,o.bZ(o.cX([],H,rt)))}}var ee;Y*=d/(d-1);const J=Math.acos(t[2]),K=Math.atan2(-t[0],-t[1]),ie=new as;ie.position=H,ie.setPitchBearing(J,K);const ne=ie.getWorldToCamera(x,B),fe=Y*x,_e=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*fe),Me=ie.getCameraToClipOrthographic(-fe,fe,-fe,fe,_e,(fe+p*B)/t[2]),Ce=new Float64Array(16);o.az(Ce,Me,ne);const Fe=o.cS(Math.floor(1e6*H[0])/1e6*x,Math.floor(1e6*H[1])/1e6*x,0),de=.5*d,Te=[0,0,0];o.ad(Te,Fe,Ce),o.bY(Te,Te,de);const le=[Math.floor(Te[0]),Math.floor(Te[1]),Math.floor(Te[2])],Re=[0,0,0];o.at(Re,Te,le),o.bY(Re,Re,-1/de);const xe=new Float64Array(16);return o.bx(xe),o.bo(xe,xe,Re),o.az(Ce,xe,Ce),[Ce,fe]}class $d extends o.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,n){return o.aS(this.requestManager.transformRequest(n,o.R.Model).url).then(c=>{if(!c)return;const d=o.aT(c),p=new o.aU(t,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p}).catch(c=>{if(c&&c.status===404)return null;
16this.fire(new o.z(new Error(`Could not load model ${t} from ${n}: ${c.message}`)))})}load(t,n,c={forceReload:!1}){this.models[n]||(this.models[n]={});const d=Object.keys(t),p=[],m=[];for(const y of d){const x=t[y];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:y,scope:n},p.push(this.loadModel(y,x)),m.push(y)),this.models[n][y]||(this.models[n][y]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+m.length,Promise.allSettled(p).then(y=>{for(let x=0;x<y.length;x++){const{status:T}=y[x];if(T==="rejected")continue;const{value:S}=y[x];this.models[n][m[x]]||(this.models[n][m[x]]={model:null,numReferences:1}),this.models[n][m[x]].model=S}this.numModelsLoading[n]-=m.length,this.fire(new o.A("data",{dataType:"style"}))}).catch(y=>{this.fire(new o.z(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,n,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,n):this.getModelByURL(this.modelUris[n][t]))}getModel(t,n){return this.models[n]||(this.models[n]={}),this.models[n][t]?this.models[n][t].model:void 0}getModelByURL(t){if(!t)return null;const n=this.modelByURL[t];return n?this.models[n.scope][n.modelId].model:null}hasModelBeenAdded(t,n){return this.models[n]&&this.models[n][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,n,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(n);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:p,modelId:m}=this.modelByURL[d];this.models[p][m].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c=this.modelUris[n];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c={};for(const d of t)this.hasModel(d,n,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[n][d].numReferences++:this.modelUris[n][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[n][d]:!this.hasURLBeenRequested(d)&&o.cZ(d,!1)&&(this.modelUris[n][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[n][d]);this.load(c,n)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,n,c=!1){if(this.models[n]&&this.models[n][t]&&(this.models[n][t].numReferences--,this.models[n][t].numReferences===0)){const d=this.modelUris[n][t];c||delete this.modelUris[n][t],delete this.modelByURL[d];const p=this.models[n][t].model;if(!p)return;delete this.models[n][t],p.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const n of Object.keys(this.models[t])){const c=this.models[t][n].model;delete this.models[t][n],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,n){this.models[n]||(this.models[n]={});for(const c in this.models[n])this.models[n][c].model&&this.models[n][c].model.upload(t.context)}}const Bc=new o.a7({data:new o.a8(o.a5.colorTheme.data)}),rh={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function Us(l){return l=l||{},Object.assign(l,rh)}class Hf extends o.E{constructor(t){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indo
16orData=void 0,this._floorplanStates={},o.aV(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=t,this._checkFloorplanVisible(),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle(t=>{t.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new o.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=t.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=t.stylesheet.indoor.buildingFeaturesetId,this._scope=t.scope))}),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:t=>(t.feature&&t.feature.properties.floorplan&&this.selectFloorplan(t.feature.properties.floorplan),!0)}),this._checkFloorplanVisible()}_onMove(){this._checkFloorplanVisible()}_checkFloorplanVisible(){if(!this._queryFeatureSetId||!this._map.isStyleLoaded())return;const t=()=>{this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new o.A("floorplangone"))};if(this._map.transform.zoom<13)return void t();const n={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=this._map.transform.width,d=this._map.transform.height,p=c*(2/3),m=d*(2/3),y=.5*(c-p),x=.5*(d-m),T=[new o.P(y,x),new o.P(y+p,x+m)],S=this._map.queryRenderedFeatures(T,n);S.length>0?this._selectedFloorplan&&S[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=S[0],this._floorplanSelected()):t()}_floorplanSelected(){this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._floorplanStates[this._indoorData.id]=this._floorplanStates[this._indoorData.id]||{},this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[this._indoorData.id]]);const t=this._floorplanStates[this._indoorData.id].selectedBuilding,n=t?this._indoorData.buildings.find(y=>y.id===t):this._indoorData.buildings.length>0?this._indoorData.buildings[0]:null,c=this._floorplanStates[this._indoorData.id].selectedLevel,d=this._indoorData.levels.find(y=>y.id===c),p=this._indoorData.levels.find(y=>!(!n||!n.levels)&&Number(y.levelOrder)===0&&n.levels.includes(y.id)),m=d?d.id:p?p.id:void 0;this.fire(new o.A("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:m})),n&&this._buildingSelected(n,!1),m&&this._levelSelected(m)}_buildingSelected(t,n){if(!t||!t.id)return void console.warn("IndoorManager: Building or building id is undefined");n&&t.extent&&this._map.fitBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=t?t.id:void 0;const c=this._indoorData.levels.filter(d=>t.levels.includes(d.id));this.fire(new o.A("buildingselected",{buildingId:t.id,levels:c}))}_levelSelected(t){const n=this._indoorData.levels.find(c=>c.id===t);n?(this._updateLevels(n,!0),this.fire(new o.A("levelselected",{levelId:n.id}))):console.warn(`IndoorManager: Level with ID ${t} not found in the current floorplan.`)}_updateLevels(t,n){if(!t||!t.id)throw new Error("IndoorManager: Selected level or level ID is undefined");function c(T){const S=T.indexOf("/floor/");if(S===-1)return T;const M=S+7,I=T.indexOf("/",M);return I===-1?T.slice(M):T.slice(M,I)}this._floorplanStates[this._indoorData.id].selectedLevel=t.id;const d=[],p={},m={},y={},x={};for(const T of this._indoorData.levels){if(d.push(T.id),p[T.id]=T.levelOrder>=0?3*Math.abs(T.levelOrder+1):3*Math.abs(T.levelOrder),m[T.id]=T.levelOrder>=0?3*T.levelOrder:0,this.mergeFloors){const S=c(t.id),M=c(T.id);y[T.id]=M===S?"true":"false"}else y[T.id]=T.id===t.id?"true":"false";x[T.id]=T.levelOrder<t.levelOrder?"true":"false"}this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",d]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-height",["literal",p]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-base",["literal",m]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",y]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-overlapped",["literal",x]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",t.levelOrder<0)}selectFloorplan(t){const n={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=[new o.P(0,0),new o.P(this._map.transform.width,this._map.transform.height)],d=this._map.queryRenderedFeatures(c,n);if(d.length>0){for(const p of d)if(JSON.parse(p.properties["indoor-data"]).id===t){this._selectedFloorplan=p,this._floorplanSelected();break}}}
16selectBuilding(t){const n=this._indoorData.buildings.find(c=>c.id===t);this._buildingSelected(n,!0)}selectLevel(t){this._levelSelected(t)}}function Zf(l){if(!l.metadata||!l.metadata.content_area)return;const t=o.q.devicePixelRatio,{left:n,top:c,width:d,height:p}=l.metadata.content_area,m=n*t,y=c*t;return[m,y,m+d*t,y+p*t]}function qd(l){if(l)return l.map(([t,n])=>[t*o.q.devicePixelRatio,n*o.q.devicePixelRatio])}class Hd{constructor(t,n,c){this.id=t,this.scope=n,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const n=this.sourceCache.getVisibleCoordinates();if(n.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof co))return t;const d=n.map(m=>this.sourceCache.getTile(m)),p=c.getImages(d,Array.from(this.pendingRequests));for(const[m,y]of p)t.set(o.I.from({name:m,iconsetId:this.id}),y),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}const Xo=(l,t)=>Q(l,t&&t.filter(n=>n.identifier!=="source.canvas")),nh=o.aF(Ei,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Zd=o.aF(Ei,["setCenter","setZoom","setBearing","setPitch"]),Nc=new Set(["background","sky","slot","custom"]),sh={version:8,layers:[],sources:{}},oh={duration:300,delay:0};class gn extends o.E{constructor(t,n={}){super(),this.map=t,this.scope=n.scope||"",this.globalId=null,this.fragments=[],this.importDepth=n.importDepth||0,this.importsCache=n.importsCache||new Map,this.resolvedImports=n.resolvedImports||new Set,this.transition=o.h({},oh),this._buildingIndex=new Vd(this),this.crossTileSymbolIndex=new Ln,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=n.styleChanges||new Nr,this.dispatcher=n.dispatcher?n.dispatcher:new o.D(o.c$(),this),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new io(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new o.d0(t._requestManager,n.localFontFamily?o.d1.all:n.localIdeographFontFamily?o.d1.ideographs:o.d1.none,n.localFontFamily||n.localIdeographFontFamily),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new $d(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._configDependentLayers=n.configDependentLayers?n.configDependentLayers:new Set,this._config=n.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:n.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=n.initialConfig,this.dispatcher.broadcast("setReferrer",o.d2());const c=this;this._rtlTextPluginCallback=gn.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(p,m)=>{if(o.d3(p),m&&m.every(y=>y))for(const y in c._sourceCaches){const x=c._sourceCaches[y],T=x.getSource().type;T!=="vector"&&T!=="geojson"||x.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const m in this._layers){const y=this._layers[m];
16y.source===p.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(o.j(t))return t;const n=o.d4(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${o.d5(JSON.stringify(t))}`}_diffStyle(t,n,c){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,c))}catch(y){m(y,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(p,o.R.Style);o.n(m,(y,x)=>{y?this.fire(new o.z(y)):x&&d(x,n)})}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"}));const c=typeof n.validate=="boolean"?n.validate:!o.j(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,n.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const p=this.map._requestManager.transformRequest(t,o.R.Style);this._request=o.n(p,(m,y)=>{if(this._request=null,m)this.fire(new o.z(m));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=o.q.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new o.A("dataloading",{dataType:"style"})),this._load(sh,!1)}_loadImports(t,n,c){if(this.importDepth>=4)return o.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),y=new Promise(S=>{m.once("style.import.load",S),m.once("error",S)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(m.loadJSON(x,{validate:n}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:n}):m.loadEmpty();const T={style:m,id:p.id,config:p.config};if(c){const S=this.fragments.findIndex(({id:M})=>M===c);this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,n=new Set){for(const c of t.fragments)c.style.globalId&&n.add(c.style.globalId),this.getImportGlobalIds(c.style,n);return[...n.values()]}_createFragmentStyle(t){const n=this.scope?o.C(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(c=o.h({},t.config,d));const p=new gn(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,n){const c=t.indoor?Us(t.schema):t.schema;if(this._isInternalStyle(t)){const m=o.h({},sh,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(m,n)}if(this.updateConfig(this._config,c),n&&Xo(this,Un(t)))return;this._loaded=!0,this.stylesheet=o.d6(t);const d=()=>{for(const T in t.sources)this.addSource(T,t.sources[T],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const T in t.iconsets)this.addIconset(T,t.iconsets[T]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.setGlyphsUrl(t.glyphs);const m=wl(this.stylesheet.layers);if(this._order=m.map(T=>T.id),this.stylesheet.light&&o.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const T=this.stylesheet.lights[0];this.light=new ge(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ge(this.stylesheet.light)),this._layers={};for(const T of m){const S=o.db(T,this.scope,this._styleColorTheme.lut,this.options);S.configDependencies.size!==0&&this._configDependentLayers.add(S.fqid),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S;const M=this.getOwnLayerSourceCache(S),I=!!this.directionalLight&&this.directionalLight.shadowsEnabled();M&&S.canCastShadows()&&I&&(M.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const y=this.stylesheet.terrain;y&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(y,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new o.A("data",{dataType:"style"}));const x=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then(()=>{this._reloadImports(),this.fire(new o.A(x?"style.load":"style.import.load"))}).catch(T=>
16{this.fire(new o.z(new Error("Failed to load imports",T))),this.fire(new o.A(x?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new o.A(x?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(p){const m=this._evaluateColorThemeData(p);this._loadColorTheme(m).then(()=>{d()}).catch(y=>{o.w(`Couldn't load color theme from the stylesheet: ${y}`),d()})}else this._styleColorTheme.lut=null,d()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,n,c,d,p,m,y,x,T,S;const M={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(I=>{if(I.stylesheet){if(I.light!=null&&(t=I.light),I.stylesheet.lights)for(const C of I.stylesheet.lights)C.type==="ambient"&&I.ambientLight!=null&&(n=I.ambientLight),C.type==="directional"&&I.directionalLight!=null&&(c=I.directionalLight);d=this._prioritizeTerrain(d,I.terrain,I.stylesheet.terrain),I.stylesheet.fog&&I.fog!=null&&(p=I.fog),I.stylesheet.snow&&I.snow!=null&&(m=I.snow),I.stylesheet.rain&&I.rain!=null&&(y=I.rain),I.stylesheet.camera!=null&&(S=I.stylesheet.camera),I.stylesheet.projection!=null&&(x=I.stylesheet.projection),I.stylesheet.transition!=null&&(T=I.stylesheet.transition),M[I.scope]=I._styleColorTheme}}),this.light=t,this.ambientLight=n,this.directionalLight=c,this.fog=p,this.snow=m,this.rain=y,this._styleColorThemeForScope=M,d===null?delete this.terrain:this.terrain=d,this.camera=S||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=o.h({},oh,T),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const n=c=>{for(const d of c.fragments)n(d.style);t(c)};n(this)}_prioritizeTerrain(t,n,c){const d=t&&t.drapeRenderMode===0;return c===null?n&&n.drapeRenderMode===0?n:d?t:null:n!=null&&(!t||d||n&&n.drapeRenderMode===1)?n:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(n=>{t=this._prioritizeTerrain(t,n.terrain,n.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(n=>{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},n={},c={};this.forEachFragmentStyle(d=>{for(const p in d._sourceCaches){const m=o.C(p,d.scope);t[m]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const m=o.C(p,d.scope);n[m]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const m=o.C(p,d.scope);c[m]=d._symbolSourceCaches[p]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=c}mergeLayers(){const t={},n=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(p=>{for(const m of p._order){const y=p._layers[m];if(y.type==="slot"){const x=o.d7(m);if(t[x])continue;t[x]=[]}y.slot&&t[y.slot]?t[y.slot].push(y):n.push(y)}}),this._mergedOrder=[];const d=(p=[])=>{for(const m of p)if(m.type==="slot"){const y=o.d7(m.id);t[y]&&d(t[y]),this._mergedSlots.push(y)}else{const y=o.C(m.id,m.scope);this._mergedOrder.push(y),c[y]=m,m.is3D(!!this.terrain)&&(this._has3DLayers=!0),m.type==="circle"&&(this._hasCircleLayers=!0),m.type==="symbol"&&(this._hasSymbolLayers=!0),m.type==="clip"&&(this._clipLayerPresent=!0)}};d(n),this._mergedOrder.sort((p,m)=>{const y=c[p],x=c[m];return y.hasInitialOcclusionOpacityProperties?x.is3D(!!this.terrain)?1:0:y.is3D(!!this.terrain)&&x.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=o.h({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(n,c,d,p){const m=o.h({},c);for(const x of Object.keys(o.a5.colorTheme))m[x]===void 0&&(m[x]=o.a5.colorTheme[x].default);const y=new o.a6(Bc,n,new Map(d));return y.setTransitionOrValue(m,d),y.untransitioned().possiblyEvaluate(new o.aa(0,{worldview:void 0}))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let m=t;m.startsWith(p)||(m=p+m);const y=o.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>
16{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:M}=o.q.getImageData(x);if(S>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new o.r({width:T,height:S},M),pixelRatio:1,sdf:!1,usvg:!1,version:0});const I=this.imageManager.getImage(y,this.scope);I?(this._styleColorTheme.lut={image:I.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const n=this._styleColorThemeForScope[t];return n?n.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(n,c,d){let p,m,y;const x=o.q.devicePixelRatio>1?"@2x":"";let T=o.n(c.transformRequest(c.normalizeSpriteURL(n,x,".json"),o.R.SpriteJSON),(I,C)=>{T=null,y||(y=I,p=C,M())}),S=o.o(c.transformRequest(c.normalizeSpriteURL(n,x,".png"),o.R.SpriteImage),(I,C)=>{S=null,y||(y=I,m=C,M())});function M(){if(y)d(y);else if(p&&m){const I=o.q.getImageData(m),C={};for(const L in p){const{width:z,height:k,x:B,y:V,sdf:H,pixelRatio:Y,stretchX:te,stretchY:ee,content:J}=p[L],K=new o.r({width:z,height:k});o.r.copy(I,K,{x:B,y:V},{x:0,y:0},{width:z,height:k},null),C[L]={data:K,pixelRatio:Y,sdf:H,stretchX:te,stretchY:ee,content:J,usvg:!1}}d(null,C)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(t,this.map._requestManager,(n,c)=>{if(this._spriteRequest=null,n)this.fire(new o.z(n));else if(c){const d=new Map;for(const p in c)d.set(o.I.from(p),c[p]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))})}addIconset(t,n){if(n.type==="sprite")return void this._loadSprite(n.url);const c=this.getOwnSourceCache(n.source);if(!c)return void this.fire(new o.z(new Error(`Source "${n.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new o.z(new Error(`Source "${n.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const p=new Hd(t,this.scope,c);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!o.j(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(p,m)=>{if(this._spriteRequest=null,p)n?this._loadSprite(t):this.fire(new o.z(p));else if(m){const y=new Map;for(const x in m)y.set(o.I.from(x),m[x]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))},o.br((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),o.R.Iconset),(p,m)=>{if(p)return void d(p);const y={},x=o.c_(new o.bq(m));for(const T of x.icons){const S={version:1,pixelRatio:o.q.devicePixelRatio,content:Zf(T),stretchX:T.metadata?qd(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?qd(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=S}d(null,y)}))}_validateLayer(t){const n=this.getOwnSource(t.source);if(!n)return;const c=t.sourceLayer;c&&(n.type==="geojson"||n.vectorLayerIds&&n.vectorLayerIds.indexOf(c)===-1)&&this.fire(new o.z(ne
16w Error(`Source layer "${c}" does not exist on source "${n.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,n)=>{const c=this.fragments[n];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const n in this._sourceCaches){const c=this._sourceCaches[n].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const n=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&n.push(d.serialize())}return n}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const n=this.getOwnLayer(t);if(n)return n;this.fire(new o.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const n=this.getOwnSource(t);if(n)return n;this.fire(new o.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,n){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const p=t.getProgramIds();if(p)for(const m of p){const y=t.getDefaultProgramParams(m,n.zoom,this._styleColorTheme.lut);y&&(c.style=this,this.fog&&(c._fogVisible=!0,y.overrideFog=!0,c.getOrCreateProgram(m,y)),c._fogVisible=!1,y.overrideFog=!1,c.getOrCreateProgram(m,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,c.getOrCreateProgram(m,y)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const n=this.calculateLightsBrightness();t.brightness=n||0,n!==this._brightness&&(this._brightness=n,this.dispatcher.broadcast("setBrightness",n)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const y=this._changes.getLayerUpdatesByScope();for(const x in y){const{updatedIds:T,removedIds:S}=y[x];(T||S)&&(this._updateWorkerLayers(x,T,S),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const p={};for(const y in this._mergedSourceCaches){const x=this._mergedSourceCaches[y];p[y]=x.used,x.used=!1,x.tileCoverLift=0}for(const y of this._mergedOrder){const x=this._mergedLayers[y];if(x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const T=this.getLayerSourceCache(x);T&&(T.used=!0,T.tileCoverLift=Math.max(T.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
16{this.precompilePrograms(x,t)}):this.precompilePrograms(x,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();const m=this.imageManager.getPendingImageProviders();for(const y of m)y.sourceCache.used=!0;for(const y in p){const x=this._mergedSourceCaches[y];p[y]!==x.used&&x.getSource().fire(new o.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new o.A("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const n of t){const c=n.resolvePendingRequests(),d=this.getFragmentStyle(n.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const n in this._mergedSourceCaches){const c=this._mergedSourceCaches[n].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const n in t)this._changes.resetUpdatedImages(n)}_updateWorkerLayers(t,n,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:n?d._serializeLayers(n):[],scope:t,removedIds:c||[],options:d.options})}setState(t,n){if(this._checkLoaded(),Xo(this,Un(t)))return!1;(t=o.d6(t)).layers=wl(t.layers);const c=function(m,y){if(!m)return[{command:Ei.setStyle,args:[y]}];let x=[];try{if(!o.bv(m.version,y.version))return[{command:Ei.setStyle,args:[y]}];if(o.bv(m.center,y.center)||x.push({command:Ei.setCenter,args:[y.center]}),o.bv(m.zoom,y.zoom)||x.push({command:Ei.setZoom,args:[y.zoom]}),o.bv(m.bearing,y.bearing)||x.push({command:Ei.setBearing,args:[y.bearing]}),o.bv(m.pitch,y.pitch)||x.push({command:Ei.setPitch,args:[y.pitch]}),o.bv(m.sprite,y.sprite)||x.push({command:Ei.setSprite,args:[y.sprite]}),o.bv(m.glyphs,y.glyphs)||x.push({command:Ei.setGlyphs,args:[y.glyphs]}),o.bv(m.imports,y.imports)||function(C=[],L=[],z){L=L||[];const k=(C=C||[]).map(Uo),B=L.map(Uo),V=C.reduce(uo,{}),H=L.reduce(uo,{}),Y=k.slice();let te,ee,J,K;for(te=0,ee=0;te<k.length;te++)J=k[te],H.hasOwnProperty(J)?ee++:(z.push({command:Ei.removeImport,args:[J]}),Y.splice(Y.indexOf(J,ee),1));for(te=0,ee=0;te<B.length;te++)J=B[B.length-1-te],Y[Y.length-1-te]!==J&&(V.hasOwnProperty(J)?(z.push({command:Ei.removeImport,args:[J]}),Y.splice(Y.lastIndexOf(J,Y.length-ee),1)):ee++,K=Y[Y.length-te],z.push({command:Ei.addImport,args:[H[J],K]}),Y.splice(Y.length-te,0,J));for(const ie of L){const ne=V[ie.id];ne&&(delete ne.data,o.bv(ne,ie)||z.push({command:Ei.updateImport,args:[ie.id,ie]}))}}(m.imports,y.imports,x),o.bv(m.transition,y.transition)||x.push({command:Ei.setTransition,args:[y.transition]}),o.bv(m.light,y.light)||x.push({command:Ei.setLight,args:[y.light]}),o.bv(m.fog,y.fog)||x.push({command:Ei.setFog,args:[y.fog]}),o.bv(m.snow,y.snow)||x.push({command:Ei.setSnow,args:[y.snow]}),o.bv(m.rain,y.rain)||x.push({command:Ei.setRain,args:[y.rain]}),o.bv(m.projection,y.projection)||x.push({command:Ei.setProjection,args:[y.projection]}),o.bv(m.lights,y.lights)||x.push({command:Ei.setLights,args:[y.lights]}),o.bv(m.camera,y.camera)||x.push({command:Ei.setCamera,args:[y.camera]}),o.bv(m.iconsets,y.iconsets)||function(C,L,z){let k;for(k in L=L||{},C=C||{})C.hasOwnProperty(k)&&(L.hasOwnProperty(k)||z.push({command:Ei.removeIconset,args:[k]}));for(k in L){if(!L.hasOwnProperty(k))continue;const B=L[k];C.hasOwnProperty(k)?o.bv(C[k],B)||(z.push({command:Ei.removeIconset,args:[k]}),z.push({command:Ei.addIconset,args:[k,B]})):z.push({command:Ei.addIconset,args:[k,B]})}}(m.iconsets,y.iconsets,x),!o.bv(m["color-theme"],y["color-theme"]))return[{command:Ei.setStyle,args:[y]}];const T={},S=[];(function(C,L,z,k){let B;for(B in L=L||{},C=C||{})C.hasOwnProperty(B)&&(L.hasOwnProperty(B)||ba(B,z,k));for(B in L){if(!L.hasOwnProperty(B))continue;const V=L[B];C.hasOwnProperty(B)?o.bv(C[B],V)||(C[B].type==="geojson"&&V.type==="geojson"&&Uf(C,L,B)?z.push({command:Ei.setGeoJSONSourceData,args:[B,V.data]}):Tl(B,L,z,k)):Cc(B,L,z)}})(m.sources,y.sources,S,T);const M=[];
16m.layers&&m.layers.forEach(C=>{C.source&&T[C.source]?x.push({command:Ei.removeLayer,args:[C.id]}):M.push(C)});let I=m.terrain;I&&T[I.source]&&(x.push({command:Ei.setTerrain,args:[void 0]}),I=void 0),x=x.concat(S),o.bv(I,y.terrain)||x.push({command:Ei.setTerrain,args:[y.terrain]}),function(C,L,z){L=L||[];const k=(C=C||[]).map(Uo),B=L.map(Uo),V=C.reduce(uo,{}),H=L.reduce(uo,{}),Y=k.slice(),te=Object.create(null);let ee,J,K,ie,ne,fe,_e;for(ee=0,J=0;ee<k.length;ee++)K=k[ee],H.hasOwnProperty(K)?J++:(z.push({command:Ei.removeLayer,args:[K]}),Y.splice(Y.indexOf(K,J),1));for(ee=0,J=0;ee<B.length;ee++)K=B[B.length-1-ee],Y[Y.length-1-ee]!==K&&(V.hasOwnProperty(K)?(z.push({command:Ei.removeLayer,args:[K]}),Y.splice(Y.lastIndexOf(K,Y.length-J),1)):J++,fe=Y[Y.length-ee],z.push({command:Ei.addLayer,args:[H[K],fe]}),Y.splice(Y.length-ee,0,K),te[K]=!0);for(ee=0;ee<B.length;ee++)if(K=B[ee],ie=V[K],ne=H[K],!te[K]&&!o.bv(ie,ne))if(o.bv(ie.source,ne.source)&&o.bv(ie["source-layer"],ne["source-layer"])&&o.bv(ie.type,ne.type)){for(_e in Sl(ie.layout,ne.layout,z,K,null,Ei.setLayoutProperty),Sl(ie.paint,ne.paint,z,K,null,Ei.setPaintProperty),o.bv(ie.slot,ne.slot)||z.push({command:Ei.setSlot,args:[K,ne.slot]}),o.bv(ie.filter,ne.filter)||z.push({command:Ei.setFilter,args:[K,ne.filter]}),o.bv(ie.minzoom,ne.minzoom)&&o.bv(ie.maxzoom,ne.maxzoom)||z.push({command:Ei.setLayerZoomRange,args:[K,ne.minzoom,ne.maxzoom]}),ie)ie.hasOwnProperty(_e)&&_e!=="layout"&&_e!=="paint"&&_e!=="filter"&&_e!=="metadata"&&_e!=="minzoom"&&_e!=="maxzoom"&&_e!=="slot"&&(_e.indexOf("paint.")===0?Sl(ie[_e],ne[_e],z,K,_e.slice(6),Ei.setPaintProperty):o.bv(ie[_e],ne[_e])||z.push({command:Ei.setLayerProperty,args:[K,_e,ne[_e]]}));for(_e in ne)ne.hasOwnProperty(_e)&&!ie.hasOwnProperty(_e)&&_e!=="layout"&&_e!=="paint"&&_e!=="filter"&&_e!=="metadata"&&_e!=="minzoom"&&_e!=="maxzoom"&&_e!=="slot"&&(_e.indexOf("paint.")===0?Sl(ie[_e],ne[_e],z,K,_e.slice(6),Ei.setPaintProperty):o.bv(ie[_e],ne[_e])||z.push({command:Ei.setLayerProperty,args:[K,_e,ne[_e]]}))}else z.push({command:Ei.removeLayer,args:[K]}),fe=Y[Y.lastIndexOf(K)+1],z.push({command:Ei.addLayer,args:[ne,fe]})}(M,y.layers,x)}catch(T){console.warn("Unable to compute style diff:",T),x=[{command:Ei.setStyle,args:[y]}]}return x}(this.serialize(),t).filter(m=>!(m.command in Zd));if(c.length===0)return!1;const d=c.filter(m=>!(m.command in nh));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);const p=[];return c.forEach(m=>{p.push(this[m.command](...m.args))}),n&&Promise.all(p).then(n).catch(n),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){for(const[n,c]of t.entries()){if(this.getImage(n))return this.fire(new o.z(new Error(`An image with the name "${n.name}" already exists.`)));this.imageManager.addImage(n,this.scope,c),this._changes.updateImage(n,this.scope)}return this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new o.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this)}updateImage(t,n,c=!1){this.imageManager.updateImage(t,this.scope,n),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"}
vendor: 6,406 bytes, line 16
16)),this):this.fire(new o.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(t){return this.modelManager.addModelURLs(t,this.scope),this._updateWorkerModels(),this.fire(new o.A("data",{dataType:"style"})),this}addModel(t,n,c={}){return this._checkLoaded(),this._validate(X,`models.${t}`,n,null,c)||(this.modelManager.addModel(t,n,this.scope),this.fire(new o.A("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this.fire(new o.A("data",{dataType:"style"})),this):this.fire(new o.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,n,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(Hu,`sources.${t}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=_l(t,n,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const p=m=>{const y=(m?"symbol:":"other:")+d.id,x=o.C(y,this.scope),T=this._sourceCaches[y]=new Dn(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};p(!1),n.type!=="vector"&&n.type!=="geojson"||p(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const n=this.getOwnSource(t);if(!n)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([p,m])=>m.type==="source"&&m.source===t);if(d)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const p=o.d7(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new o.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,n){this._checkLoaded(),this.getOwnSource(t).setData(n),this._changes.setDirty()}getOwnSource(t){const n=this.getOwnSourceCache(t);return n&&n.getSource()}getOwnSources(){const t=[];for(const n in this._otherSourceCaches){const c=this.getOwnSourceCache(n);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const n in t){const c=t[n]._tiles;for(const d in c){const p=c[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const n=this._getTransitionParameters();for(const p of t){if(this._validate(Oo,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(n)}else this.ambientLight=new Ui(p,ii||(ii=new o.a7({color:new o.a8(o.a5.properties_light_ambient.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(n)}else this.directionalLight=new Ui(p,Ki||(Ki=new o.a7({direction:new o.an(o.a5.properties_light_directional.direction),color:new o.a8(o.a5.properties_light_directional.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_directional.intensity),"cast-shadows":new o.a8(o.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new o.a8(o.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new o.a8(o.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=Object.assign(n,{worldview:this.map.getWorldview()}),d=new o.aa(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,n=this.ambientLight;if(!t||!n)return;const c=I=>.2126*(I[0]<=.03928?I[0]/12.92:Math.pow((I[0]+.055)/1.055,2.4))+.7152*(I[1]<=.03928?I[1]/12.92:Math.pow((I[1]+.055)/1.055,2.4))+.0722*(I[2]<=.03928?I[2]/12.92:Math.pow((I[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=1-o.cR(m.x,m.y,m.z)[2]/90,x=c(d)*p*y,T=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),S=n.properties.get("intensity"),M=c(T)*S;return Number(((x+M)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(o.d8(t)){const n=o.d9(t),c=this.fragments.find(({id:p})=>p===n);if(!c)return;const d=o.d7(t);return c.style.getFragmentStyle(d)}{const n=this.fragments.find(({id:c})=>c===t);return n?n.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const n={},c=(d,p="")=>`${d}::${p}`;this._featuresetSelectors={};for(const d in t){const p=this._featuresetSelectors[d]=[];
16for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){o.w(`Layer is undefined for selector: ${m.layer}`);continue}const T=c(x.source,x.sourceLayer);if(T in n&&n[T]!==m.featureNamespace){o.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}n[T]=m.featureNamespace}let y;if(m.properties)for(const x in m.properties){const T=o.X(m.properties[x]);T.result==="success"&&(y=y||{},y[x]=T.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:y,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const n=this.getFragmentStyle(t);if(!n||!n.stylesheet.featuresets)return[];const c=[];for(const d in n.stylesheet.featuresets)c.push({featuresetId:d,importId:n.scope?n.scope:void 0});return c}getFeaturesetLayers(t,n){const c=this.getFragmentStyle(n),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new o.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const y=c.getOwnLayer(m.layer);y&&p.push(y)}return p}getConfigProperty(t,n){const c=this.getFragmentStyle(t);if(!c)return null;const d=o.C(n,c.scope),p=c.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}setConfigProperty(t,n,c){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.indoor?Us(d.stylesheet.schema):d.stylesheet.schema;if(!p||!p[n])return;const m=o.X(c);if(m.result!=="success")return void Xo(this,m.value);const y=m.value.expression,x=o.C(n,d.scope),T=d.options.get(x);if(!T)return;let S;const{minValue:M,maxValue:I,stepValue:C,type:L,values:z}=p[n],k=o.X(p[n].default);k.result==="success"&&(S=k.value.expression),S?(this.options.set(x,Object.assign({},T,{value:y,default:S,minValue:M,maxValue:I,stepValue:C,type:L,values:z})),this.updateConfigDependencies(n)):this.fire(new o.z(new Error(`No schema defined for the config option "${n}" in the "${t}" fragment.`)))}getConfig(t){const n=this.getFragmentStyle(t);if(!n)return null;const c=n.stylesheet.schema;if(!c)return null;const d={};for(const p in c){const m=o.C(p,n.scope),y=n.options.get(m),x=y?y.value||y.default:null;d[p]=x?x.serialize():null}return d}setConfig(t,n){const c=this.getFragmentStyle(t);c&&(c.updateConfig(n,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const n=this.getFragmentStyle(t);return n?n.stylesheet.schema:null}setSchema(t,n){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=n,c.updateConfig(c._config,n),this.updateConfigDependencies())}updateConfig(t,n){if(this._config=t,t||n)if(n)for(const c in n){let d,p;const m=o.X(n[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const I=o.X(t[c]);I.result==="success"&&(p=I.value.expression)}const{minValue:y,maxValue:x,stepValue:T,type:S,values:M}=n[c];if(d){const I=o.C(c,this.scope);this.options.set(I,{default:d,value:p,minValue:y,maxValue:x,stepValue:T,type:S,values:M})}else this.fire(new o.z(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new o.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(t){for(const n of this._configDependentLayers){const c=this.getLayer(n);if(c){if(t&&!c.configDependencies.has(t))continue;c.possiblyEvaluateVisibility(),this._updateLayer(c)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(n=>{const c=n._styleColorTheme.colorThemeOverride?n._styleColorTheme.colorThemeOverride:n._styleColorTheme.colorTheme;if(c){const d=n._evaluateColorThemeData(c);(!n._styleColorTheme.lut&&d!==""||n._styleColorTheme.lut&&d!==n._styleColorTheme.lut.data)&&n.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,n,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new o.z(new Error(`Layer with i
16d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(Xo(this,o.da(t)))return;p=o.db(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=o.d6(t),t=o.h(t,{source:d})),this._validate(Mi,`layers.${d}`,t,{arrayIndex:-1},c))return;p=o.db(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid);let m=this._order.length;if(n){const S=this._order.indexOf(n);if(S===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));p.slot===this._layers[n].slot?m=S:o.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,d),this._layerOrderChanged=!0,this._layers[d]=p;const y=this.getOwnLayerSourceCache(p),x=!!this.directionalLight&&this.directionalLight.shadowsEnabled();y&&p.canCastShadows()&&x&&(y.castsShadows=!0);const T=this._changes.getRemovedLayer(p);if(T&&p.source&&y&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const S=o.C(p.source,p.scope);T.type!==p.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),y.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.scope=this.scope,this.mergeLayers()}moveLayer(t,n){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===n)return;const d=this._order.indexOf(t);this._order.splice(d,1);let p=this._order.length;if(n){const m=this._order.indexOf(n);
16if(m===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));c.slot===this._layers[n].slot?p=m:o.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(p,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const n=this._checkLayer(t);if(!n)return;n.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(n.fqid),this._changes.removeLayer(n);const d=this.getOwnLayerSourceCache(n);if(d&&d.castsShadows){let p=!1;for(const m in this._layers)if(this._layers[m].source===n.source&&this._layers[m].canCastShadows()){p=!0;break}d.castsShadows=p}n.onRemove&&n.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const n in this._layers)if(this._layers[n].type===t)return!0;return!1}setLayerZoomRange(t,n,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===n&&d.maxzoom===c||(n!=null&&(d.minzoom=n),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,n){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==n&&(c.slot=n,this._updateLayer(c))}setFilter(t,n,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!o.bv(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(ve,`layers.${d.id}.filter`,n,{layerType:d.type},c)||(d.filter=o.d6(n),this._updateLayer(d)))}getFilter(t){const n=this._checkLayer(t);if(n)return o.d6(n.filter)}setLayoutProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!o.bv(p.getLayoutProperty(n),c)){if(c!=null&&(!d||d.validate!==!1)&&Xo(p,U.call(Un,{key:`layers.${t}.layout.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:o.a5,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(n,c),p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),this._updateLayer(p)}}getLayoutProperty(t,n){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(n)}setPaintProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(!p||o.bv(p.getPaintProperty(n),c)||c!=null&&(!d||d.validate!==!1)&&Xo(p,O.call(Un,{key:`layers.${t}.paint.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:o.a5})))return;const m=p.setPaintProperty(n,c);p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),m&&this._updateLayer(p),this._changes.updatePaintProperties(p)}getPaintProperty(t,n){const c=this._checkLayer(t);if(c)return c.getPaintProperty(n)}setFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:I,sourceLayer:C}of M)S.setFeatureState({id:t.id,source:I,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.setFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=t.sourceLayer,p=this._checkSource(c);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new o.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:I,sourceLayer:C}of M)S.removeFeatureState({id:t.id,source:I,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.removeFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;
vendor: 4,419 bytes, line 16
16if(p==="vector"&&!m)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new o.z(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.removeFeatureState(m,t.id,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:y}=t.target,x=this.getFragmentStyle(y),T=x.getFeaturesetLayers(m);for(const{source:S,sourceLayer:M}of T){const I=x.getFeatureState({id:t.id,source:S,sourceLayer:M});if(I&&!p)p=I;else if(!o.bv(p,I))return void this.fire(new o.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:m}=t.target,y=this.getLayer(m);p=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return p}const n=t.source,c=t.sourceLayer,d=this._checkSource(n);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(c,t.id);this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=o.h({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return o.h({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return o.dc({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:n,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const n of Object.values(this._mergedLayers))t(n)&&this._updateLayer(n)}_updateLayer(t){this._changes.updateLayer(t);const n=this.getLayerSourceCache(t),c=o.C(t.source,t.scope),d=this._changes.getUpdatedSourceCaches();t.source&&!d[c]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},p=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x)){d[x]=y;for(const T of t){const S=T[x];if(S)for(const M of S)p.push(M)}}}p.sort((y,x)=>x.intersectionZ-y.intersectionZ);const m=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x))for(let T=p.length-1;T>=0;T--){const S=p[T].feature;if(S.layer&&d[S.layer.id]<y)break;m.push(S),p.pop()}else for(const T of t){const S=T[x];if(S)for(const M of S)m.push(M.feature)}}return m}queryRenderedFeatures(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ve,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(n.filter));const p={},m=S=>{if(Nc.has(S.type))return;const M=this.getOwnLayerSourceCache(S),I=p[M.id]=p[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};S.is3D(!!this.terrain)&&(I.has3DLayers=!0),I.layers[S.fqid]=I.layers[S.fqid]||{styleLayer:S,targets:[]},I.layers[S.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new o.z(new Error("parameters.layers must be an Array."))),[];for(const S of n.layers){const M=this._layers[S];if(!M)return this.fire(new o.z(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];m(M)}}else for(const S in this._layers)m(this._layers[S]);const y=this._queryRenderedFeatures(t,p,c),x=this._flattenAndSortRenderedFeatures(y),T=[];for(const S of x)o.dd(S.layer.id)===this.scope&&T.push(S);return T}queryRenderedFeatureset(t,n,c){let d;
16n&&!Array.isArray(n)&&n.filter&&(this._validate(ve,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(n.filter));const p="mock",m=[];if(n&&n.target)m.push(Object.assign({},n,{targetId:p,filter:d}));else{const S=this.getFeaturesetDescriptors();for(const M of S)m.push({targetId:p,filter:d,target:M});for(const{style:M}of this.fragments){const I=M.getFeaturesetDescriptors();for(const C of I)m.push({targetId:p,filter:d,target:C})}}const y=this.queryRenderedTargets(t,m,c),x=[],T=new Set;for(const S of y)for(const M of S.variants[p])Ic(M,S,T)||x.push(new o.de(S,M));return x}queryRenderedTargets(t,n,c){const d={},p=(y,x,T,S)=>{const M=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(M.layers[y.fqid]=M.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(M.has3DLayers=!0),!S)return T.uniqueFeatureID=!1,void M.layers[y.fqid].targets.push(T);M.layers[y.fqid].targets.push(Object.assign({},T,{namespace:S.namespace,properties:S.properties,uniqueFeatureID:S.uniqueFeatureID}))};for(const y of n)if("featuresetId"in y.target){const{featuresetId:x,importId:T}=y.target,S=this.getFragmentStyle(T);if(!S||!S._featuresetSelectors)continue;const M=S._featuresetSelectors[x];if(!M){this.fire(new o.z(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const I of M){const C=S.getOwnLayer(I.layerId);C&&!Nc.has(C.type)&&p(C,S.getOwnLayerSourceCache(C),y,I)}}else if("layerId"in y.target){const{layerId:x}=y.target,T=this.getLayer(x);if(!T||Nc.has(T.type))continue;p(T,this.getLayerSourceCache(T),y)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,n,c){const d=[],p=!!this.map._showQueryGeometry,m=Pi.createFromScreenPoints(t,c);for(const y in n){const x=Ac(m,n[y],this._availableImages,c,p);Object.keys(x).length&&d.push(x)}if(this.placement)for(const y in n){if(!n[y].sourceCache._onlySymbols)continue;const x=Bo(m.screenGeometry,n[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,n){const c=n&&n.filter;c&&this._validate(ve,"querySourceFeatures.filter",c,null,n);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(yl(m,n));return d}addSourceType(t,n,c){return gn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(gn.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,n,c={}){this._checkLoaded();const d=this.light.getLight();let p=!1;for(const y in t)if(!o.bv(t[y],d[y])){p=!0;break}if(!p)return;const m=this._getTransitionParameters();this.light.setLight(t,n,c),this.light.updateTransitions(m)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=o.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&o.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,n=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),n===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if(typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=o.d6(c),c=o.h(c,{source:y})}const p=o.h({},c),m={};if(this.terrain&&d){p.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(m.style=y.serialize())}if(this._validate(Xe,"terrain",p,m))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&n!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,n),this.fire(new o.A("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const y of Object.keys(o.a5.terrain))!c.hasOwnProperty(y)&&o.a5.terrain[y].default&&(c[y]=o.a5.terrain[y].default);for(const y in t)if(!o.bv(t[y],m[y])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new o.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedU
16pdate=!0}_createFog(t){const n=this.fog=new qt(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createSnow(t){const n=this.snow=new pr(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createRain(t){const n=this.rain=new fr(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const n=this.snow;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const n=this.rain;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!n)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(n);this._loadColorTheme(c).then(()=>{this.fire(new o.A("colorthemeset")),t()}).catch(d=>{o.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&o.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,n){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=n,c._reloadColorTheme())}_getTransitionParameters(t){return{now:o.q.now(),transition:o.h(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],n=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):n.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...n)}_createTerrain(t,n){const c=this.terrain=new ue(t,n,this.scope,this.options,this.map.getWorldview());n===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="fill-extrusion"&&this._updateLayer(n)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="symbol"&&this._updateLayer(n)}}_validate(t,n,c,d,p={}){if(p&&p.validate===!1)return!1;const m=o.h({},this.serialize());return Xo(this,t.call(Un,o.h({key:n,style:m,value:c,styleSpec:o.a5},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.df.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const n=this.getSourceCaches(t);for(const c of n)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}reloadSource(t){const n=this.getSourceCaches(t);for(const c of n)c.resume(),c.reload()}
16reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let n;this.directionalLight&&(n=Aa(this.directionalLight));const c=new Set;for(const d in this._mergedLayers){const p=this._mergedLayers[d];p.hasElevation()&&!c.has(p.source)&&c.add(p.source)}for(const d in this._mergedSourceCaches){const p=this._mergedSourceCaches[d],m=c.has(p._source.id);p.update(t,void 0,void 0,n,m)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}_updatePlacement(t,n,c,d,p,m,y=!1){let x=!1,T=!1;const S={},M={};for(const I of this._mergedOrder){const C=this._mergedLayers[I];if(C.type!=="symbol")continue;const L=o.C(C.source,C.scope);let z=S[L];if(!z){const B=this.getLayerSourceCache(C);if(!B)continue;const V=B.getRenderableIds(!0).map(H=>B.getTileByID(H));M[L]=V.slice(),z=S[L]=V.sort((H,Y)=>Y.tileID.overscaledZ-H.tileID.overscaledZ||(H.tileID.isLessThan(Y.tileID)?-1:1))}const k=this.crossTileSymbolIndex.addLayer(C,z,n.center.lng,n.projection);x=x||k}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),y=y||this._layerOrderChanged||d===0,this._layerOrderChanged&&this.fire(new o.A("neworder")),(y||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.q.now(),n.zoom))&&(this.pauseablePlacement=new Fc(n,this._mergedOrder,y,c,d,p,this.placement,this.fog&&n.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,S,M,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.q.now()),T=!0),x&&this.pauseablePlacement.placement.setStale()),T||x){this._buildingIndex.onNewFrame(n.zoom);for(let I=0;I<this._mergedOrder.length;I++){const C=this._mergedLayers[this._mergedOrder[I]];if(C.type!=="symbol")continue;const L=this.isLayerClipped(C);this.placement.updateLayerOpacities(C,S[o.C(C.source,C.scope)],I,L?m:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.q.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,n){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:p})=>p===t.id)!==-1)return void this.fire(new o.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:p})=>p===n);return d===-1&&this.fire(new o.z(new Error(`Import with id "${n}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,n)}updateImport(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof n=="string"?(this.setImportUrl(t,n),this):(n.url&&n.url!==c[d].url&&this.setImportUrl(t,n.url),o.bv(n.config,c[d].config)||this.setImportConfig(t,n.config,n.data.schema),o.bv(n.data,c[d].data)||this.setImportData(t,n.data),this)}moveImport(t,n){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const p=this.getImportIndex(n);if(p===-1)return this;const m=c[d],y=this.fragments[d];return c=c.filter(({id:x})=>x!==t),this.fragments=this.fragments.filter(({id:x})=>x!==t),this.stylesheet.imports=c.slice(0,p).concat(m).concat(c.slice(p)),this.fragments=this.fragments.slice(0,p).concat(y).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=n;const p=this.fragments[d];return p.style=this._createFragmentStyle(c[d]),p.style.on("style.import.load",()=>this.mergeAll()),p.style.loadURL(n),this}setImportData(t,n){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:n?(this.fragments[c].style.setState(n),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,n,c){this._checkLoaded();const d=this.getImportIndex(t),p=this.stylesheet.imports||[];if(d===-1)return this;n?p[d].config=n:delete p[d].config;const m=this.fragments[d];c&&m.style.stylesheet&&(m.style.stylesheet.schema=c);const y=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=n,m.style.updateConfig(n,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const n=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(n.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const n=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);
16return n===-1&&this.fire(new o.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),n}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const n in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[n];c&&t.push(c.getSource())}return t}getSource(t,n){const c=this.getSourceCache(t,n);return c&&c.getSource()}getLayerSource(t){const n=this.getLayerSourceCache(t);return n&&n.getSource()}getSourceCache(t,n){const c=o.C(t,n);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const n=o.C(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[n]:this._mergedOtherSourceCaches[n]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const n=[];return this._mergedOtherSourceCaches[t]&&n.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&n.push(this._mergedSymbolSourceCaches[t]),n}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const n in t){const c=t[n];c==="reload"?this.reloadSource(n):c==="clear"&&this.clearSource(n)}}updateLayers(t){const n=this._changes.getUpdatedPaintProperties();for(const c of n){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t,this.scope)}getImages(t,n,c){this.imageManager.getImages(n.images,n.scope,c),this._updateTilesForChangedImages();const d=m=>{if(m){const y=n.images.map(x=>o.I.toString(x));m.setDependencies(n.tileID.key,n.type,y)}},p=o.C(n.source,n.scope);d(this._mergedOtherSourceCaches[p]),d(this._mergedSymbolSourceCaches[p])}rasterizeImages(t,n,c){this.imageManager.rasterizeImages(n,c)}getGlyphs(t,n,c){this.glyphManager.getGlyphs(n.stacks,n.scope,c)}getResource(t,n,c){return o.dg(n,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const n=[];return this._otherSourceCaches[t]&&n.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&n.push(this._symbolSourceCaches[t]),n}_isSourceCacheLoaded(t){const n=this.getOwnSourceCaches(t);return n.length===0?(this.fire(new o.z(new Error(`There is no source with ID '${t}'`))),!1):n.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,n){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&t.sourceLayer==="building",d=t.type==="building";if(t.is3D(!!this.terrain)){if(c||d||n&&n.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}gn.getSourceType=function(l){return Ec[l]},gn.setSourceType=function(l,t){Ec[l]=t},gn.registerForPluginStateChange=o.dh;var Ll=` 17#define EPSILON 0.0000001 18#define PI 3.141592653589793 19#ifdef RENDER_CUTOFF 20float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} 21#endif`,ah=` 22out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) 23{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 24#ifdef INDICATOR_CUTOUT 25uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 26#endif 27vec4 applyCutout(vec4 color,float height) { 28#ifdef INDICATOR_CUTOUT 29float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
29float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); 30#else 31return color; 32#endif 33} 34#ifdef DEBUG_WIREFRAME 35#define HANDLE_WIREFRAME_DEBUG \\ 36glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 37gl_FragDepth=gl_FragCoord.z-0.0001; 38#else 39#define HANDLE_WIREFRAME_DEBUG 40#endif 41#ifdef RENDER_CUTOFF 42uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 43#endif 44vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,lh=` 45#define EXTENT 8192.0 46#define RAD_TO_DEG 180.0/PI 47#define DEG_TO_RAD PI/180.0 48#define GLOBE_RADIUS EXTENT/PI/2.0 49float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 50#ifdef PROJECTION_GLOBE_VIEW 51vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 52#ifndef PROJECTED_POS_ON_VIEWPORT 53float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; 54#else 55return vec3(0.0); 56#endif 57}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} 58#endif 59vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( 60unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 61);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} 62#ifdef RENDER_CUTOFF 63uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 64#endif 65const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 66{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Ca="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
66void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Pa=` 67#define ELEVATION_SCALE 7.0 68#define ELEVATION_OFFSET 450.0 69#ifdef PROJECTION_GLOBE_VIEW 70uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 71mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} 72#else 73vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 74#endif 75#ifdef TERRAIN 76uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { 77#ifdef TERRAIN_DEM_FLOAT_FORMAT 78vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; 79#else 80float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 81#endif 82}float prevElevation(vec2 apos) { 83#ifdef TERRAIN_DEM_FLOAT_FORMAT 84vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; 85#else 86float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 87#endif 88} 89#ifdef TERRAIN_VERTEX_MORPHING 90float elevation(vec2 apos) { 91#ifdef ZERO_EXAGGERATION 92return 0.0; 93#endif 94float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 95#else 96float elevation(vec2 apos) { 97#ifdef ZERO_EXAGGERATION 98return 0.0; 99#endif 100return currentElevation(apos);} 101#endif 102vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} 103#else 104float elevation(vec2 pos) { return 0.0; } 105#endif 106#ifdef DEPTH_OCCLUSION 107uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; 108#ifdef DEPTH_D24 109float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} 110#else 111highp float unpack_depth_rgba(vec4 rgba_depth) 112{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 113#endif 114bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 115#ifdef DEPTH_D24 116float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 117#else 118float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 119#endif 120return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
120size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 121#ifdef DEPTH_D24 122highp vec4 depth=vec4( 123texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r 124);depth=unpack_depth4(depth); 125#else 126highp vec4 depth=vec4( 127unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) 128); 129#endif 130return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { 131#ifdef DEPTH_D24 132highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 133#else 134highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 135#endif 136res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} 137#else 138bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 139#endif//DEPTH_OCCLUSION`,ch=`#ifdef FOG 140uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} 141#endif`,Vc=`#ifdef FOG 142uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 143mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
143vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} 144#endif`,Yn=`#ifdef RASTER_ARRAY 145uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) 146);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) 147);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} 148#endif`,Uc=`#ifdef RASTER_ARRAY 149uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} 150#endif 151uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Je=`#ifdef RENDER_SHADOWS 152uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} 153#endif//RENDER_SHADOWS`,uh=`#ifdef RENDER_SHADOWS 154precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
154p float bias) {highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w; 155#ifdef SHADOWS_SINGLE_CASCADE 156vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias); 157#else 158light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); 159#endif 160}highp float calculate_shadow_bias(float NDotL) { 161#ifdef NORMAL_OFFSET 162return 0.5*u_shadow_bias.x; 163#else 164return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 165#endif 166}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) 167{highp vec2 biasUV=vec2( 168pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} 169#endif`;const Ra=[];ls(Ll,Ra),ls(lh,Ra),ls(ah,Ra);const za={"_prelude_fog.vertex.glsl":ch,"_prelude_terrain.vertex.glsl":Pa,"_prelude_shadow.vertex.glsl":Je,"_prelude_fog.fragment.glsl":Vc,"_prelude_shadow.fragment.glsl":uh,"_prelude_lighting.glsl":` 170#ifdef LIGHTING_3D_MODE 171uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
171));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} 172#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":Yn,"_prelude_raster_particle.glsl":Uc},kl={};bi("",Pa),bi(Vc,ch),bi(uh,Je),bi(Yn,""),bi(Uc,"");const Fl=bi(ah,lh),Is=Ll;var jc={background:bi(`#include "_prelude_fog.fragment.glsl" 173#include "_prelude_lighting.glsl" 174uniform vec4 u_color;uniform float u_opacity; 175#ifdef LIGHTING_3D_MODE 176in vec4 v_color; 177#endif 178void main() {vec4 out_color; 179#ifdef LIGHTING_3D_MODE 180out_color=v_color; 181#else 182out_color=u_color; 183#endif 184#ifdef FOG 185out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 186#endif 187glFragColor=out_color*u_opacity; 188#ifdef OVERDRAW_INSPECTOR 189glFragColor=vec4(1.0); 190#endif 191HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 192#include "_prelude_lighting.glsl" 193in vec2 a_pos;uniform mat4 u_matrix; 194#ifdef LIGHTING_3D_MODE 195uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; 196#endif 197void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 198#ifdef LIGHTING_3D_MODE 199v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 200#endif 201#ifdef FOG 202v_fog_pos=fog_position(a_pos); 203#endif 204}`),backgroundPattern:bi(`#include "_prelude_fog.fragment.glsl" 205#include "_prelude_lighting.glsl" 206uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); 207#ifdef LIGHTING_3D_MODE 208out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 209#endif 210#ifdef FOG 211out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 212#endif 213glFragColor=out_color*u_opacity; 214#ifdef OVERDRAW_INSPECTOR 215glFragColor=vec4(1.0); 216#endif 217HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 218uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos); 219#ifdef FOG 220v_fog_pos=fog_position(a_pos); 221#endif 222}`),building:bi(`#include "_prelude_fog.fragment.glsl" 223#include "_prelude_shadow.fragment.glsl" 224#include "_prelude_lighting.glsl" 225in vec4 v_color;in highp vec3 v_normal;in highp float v_height; 226#ifdef RENDER_SHADOWS 227in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 228#endif 229uniform lowp float u_opacity;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}
229vec3 apply_lighting_linear(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec4 color=vec4(v_color.rgb,1.0);vec3 normal=normalize(v_normal);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 230#ifdef RENDER_SHADOWS 231shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 232#else 233shadowed_lighting_factor=dot(normal,u_lighting_directional_dir); 234#endif 235color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,v_color.rgb,v_color.a); 236#ifdef FOG 237color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_height)); 238#endif 239color.rgb=linearTosRGB(color.rgb);color*=u_opacity; 240#ifdef RENDER_CUTOFF 241color*=v_cutoff_opacity; 242#endif 243#ifdef INDICATOR_CUTOUT 244color=applyCutout(color,v_height); 245#endif 246glFragColor=color; 247#ifdef DEBUG_SHOW_NORMALS 248color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 249#endif 250#ifdef OVERDRAW_INSPECTOR 251glFragColor=vec4(1.0); 252#endif 253HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 254#include "_prelude_shadow.vertex.glsl" 255in vec3 a_pos_3f;in vec3 a_normal_3f;out vec4 v_color;out highp vec3 v_normal;out highp float v_height;uniform mat4 u_matrix;uniform mat4 u_normal_matrix; 256#ifdef RENDER_SHADOWS 257uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; 258#endif 259vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 260#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 261void main() { 262#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 263vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));vec3 pos=a_pos_3f;v_height=pos.z;gl_Position=u_matrix*vec4(pos,1.0); 264#ifdef RENDER_SHADOWS 265vec3 shadow_pos=pos; 266#ifdef NORMAL_OFFSET 267vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 268#endif 269v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);v_depth_shadows=gl_Position.w; 270#endif 271#ifdef FOG 272v_fog_pos=fog_position(pos); 273#endif 274#ifdef RENDER_CUTOFF 275v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 276#endif 277}`),buildingDepth:bi(`in highp float v_depth;void main() { 278#ifndef DEPTH_TEXTURE 279glFragColor=pack_depth(v_depth); 280#endif 281}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:bi(`#include "_prelude_fog.fragment.glsl" 282#include "_prelude_lighting.glsl" 283in vec3 v_data;in float v_visibility; 284#pragma mapbox: define highp vec4 color 285#pragma mapbox: define mediump float radius 286#pragma mapbox: define lowp float blur 287#pragma mapbox: define lowp float opacity 288#pragma mapbox: define highp vec4 stroke_color 289#pragma mapbox: define mediump float stroke_width 290#pragma mapbox: define lowp float stroke_opacity 291uniform float u_emissive_strength;void main() { 292#pragma mapbox: initialize highp vec4 color 293#pragma mapbox: initialize mediump float radius 294#pragma mapbox: initialize lowp float blur 295#pragma mapbox: initialize lowp float opacity 296#pragma mapbox: initialize highp vec4 stroke_color 297#pragma mapbox: initialize mediump float stroke_width 298#pragma mapbox: initialize lowp float stroke_opacity 299vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 300smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 301smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_op
301acity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 302antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 303);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 304#ifdef LIGHTING_3D_MODE 305out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 306#endif 307#ifdef FOG 308out_color=fog_apply_premultiplied(out_color,v_fog_pos); 309#endif 310glFragColor=out_color*(v_visibility*opacity_t); 311#ifdef OVERDRAW_INSPECTOR 312glFragColor=vec4(1.0); 313#endif 314}`,`#include "_prelude_fog.vertex.glsl" 315#include "_prelude_terrain.vertex.glsl" 316#define NUM_VISIBILITY_RINGS 2 317#define INV_SQRT2 0.70710678 318#define ELEVATION_BIAS 0.0001 319#define NUM_SAMPLES_PER_RING 16 320uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; 321#ifdef PROJECTION_GLOBE_VIEW 322in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 323#endif 324#ifdef ELEVATED_ROADS 325in float a_circle_z_offset; 326#endif 327out vec3 v_data;out float v_visibility; 328#pragma mapbox: define highp vec4 color 329#pragma mapbox: define mediump float radius 330#pragma mapbox: define lowp float blur 331#pragma mapbox: define lowp float opacity 332#pragma mapbox: define highp vec4 stroke_color 333#pragma mapbox: define mediump float stroke_width 334#pragma mapbox: define lowp float stroke_opacity 335vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 336#if defined(TERRAIN) 337return elevation(pos)+ELEVATION_BIAS; 338#else 339return 0.0; 340#endif 341}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); 342#ifdef PITCH_WITH_MAP 343#ifdef PROJECTION_GLOBE_VIEW 344return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 345#else 346return u_matrix*( world_center+vec4(sample_offset,0,0) ); 347#endif 348#else 349return projected_center+vec4(sample_offset,0,0); 350#endif 351}float get_sample_step() { 352#ifdef PITCH_WITH_MAP 353return 2.0*PI/float(NUM_SAMPLES_PER_RING); 354#else 355return PI/float(NUM_SAMPLES_PER_RING); 356#endif 357}void main(void) { 358#pragma mapbox: initialize highp vec4 color 359#pragma mapbox: initialize mediump float radius 360#pragma mapbox: initialize lowp float blur 361#pragma mapbox: initialize lowp float opacity 362#pragma mapbox: initialize highp vec4 stroke_color 363#pragma mapbox: initialize mediump float stroke_width 364#pragma mapbox: initialize lowp float stroke_opacity 365vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; 366#ifdef PROJECTION_GLOBE_VIEW 367vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); 368#else
369surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 370#endif 371#ifdef ELEVATED_ROADS 372world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 373#endif 374vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 375#ifdef PITCH_WITH_MAP 376#ifdef SCALE_WITH_MAP 377view_scale=1.0; 378#else 379view_scale=projected_center.w/u_camera_to_center_distance; 380#endif 381#else 382#ifdef SCALE_WITH_MAP 383view_scale=u_camera_to_center_distance; 384#else 385view_scale=projected_center.w; 386#endif 387#endif 388gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 389#ifdef TERRAIN 390float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 391#ifdef PITCH_WITH_MAP 392float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; 393#else 394occlusion_world_center=world_center;occlusion_projected_center=projected_center; 395#endif 396for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); 397#else 398visibility=1.0; 399#endif 400#ifdef PROJECTION_GLOBE_VIEW 401visibility=1.0; 402#endif 403v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 404#ifdef FOG 405v_fog_pos=fog_position(world_center.xyz); 406#endif 407}`),clippingMask:bi("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:bi(`#include "_prelude_fog.fragment.glsl" 408uniform highp float u_intensity;in vec2 v_extrude; 409#pragma mapbox: define highp float weight 410#define GAUSS_COEF 0.3989422804014327 411void main() { 412#pragma mapbox: initialize highp float weight 413float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); 414#ifdef FOG 415if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 416#endif 417#ifdef OVERDRAW_INSPECTOR 418glFragColor=vec4(1.0); 419#endif 420HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 421#include "_prelude_fog.vertex.glsl" 422uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 423#ifdef PROJECTION_GLOBE_VIEW 424in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 425#endif 426out vec2 v_extrude; 427#pragma mapbox: define highp float weight 428#pragma mapbox: define mediump float radius 429const highp float ZERO=1.0/255.0/16.0; 430#define GAUSS_COEF 0.3989422804014327 431void main(void) { 432#pragma mapbox: initialize highp float weight 433#pragma mapbox: initialize mediump float radius 434vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; 435#ifdef PROJECTION_GLOBE_VIEW 436vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 437#else 438pos=vec3(tilePos+extrude,elevation(tilePos)); 439#endif 440gl_Position=u_matrix*vec4(pos,1); 441#ifdef FOG 442v_fog_pos=fog_position(pos); 443#endif 444}`),heatmapTexture:bi(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; 445#ifdef OVERDRAW_INSPECTOR 446glFragColor=vec4(0.0); 447#endif 448HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:bi("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" 449in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 4500.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:bi("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( 451mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 4520.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:bi("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" 453in vec2 a_pos; 454#ifdef PROJECTION_GLOBE_VIEW 455in vec3 a_pos_3; 456#endif 457out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; 458#ifdef PROJECTION_GLOBE_VIEW
459gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 460#else 461gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 462#endif 463}`),elevatedStructuresDepth:bi(`void main() { 464#ifndef DEPTH_TEXTURE 465glFragColor=vec4(0.); 466#endif 467}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:bi(`#ifdef DEPTH_RECONSTRUCTION 468in float v_height; 469#endif 470void main() { 471#ifdef DEPTH_RECONSTRUCTION 472if (v_height >=0.0) 473discard; 474#endif 475glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; 476#ifdef DEPTH_RECONSTRUCTION 477out float v_height; 478#endif 479void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 480#ifdef DEPTH_RECONSTRUCTION 481if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 482#endif 483gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:bi(`#include "_prelude_fog.fragment.glsl" 484#include "_prelude_lighting.glsl" 485#include "_prelude_shadow.fragment.glsl" 486in vec3 v_normal;in float v_height; 487#ifdef RENDER_SHADOWS 488in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 489#endif 490vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
490vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 491{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; 492#pragma mapbox: define highp vec4 structure_color 493void main() { 494#pragma mapbox: initialize highp vec4 structure_color 495vec3 color=structure_color.xyz; 496#ifdef LIGHTING_3D_MODE 497vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); 498#ifdef RENDER_SHADOWS 499float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor); 500#else 501color=apply_lighting(color,transformed_normal); 502#endif 503color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} 504#endif 505#ifdef FOG 506color=fog_apply(color,v_fog_pos); 507#endif 508vec4 out_color=vec4(color,1.0); 509#ifdef INDICATOR_CUTOUT 510out_color=applyCutout(out_color,v_height); 511#endif 512glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 513#include "_prelude_shadow.vertex.glsl" 514in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; 515#ifdef RENDER_SHADOWS 516uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; 517#endif 518#pragma mapbox: define highp vec4 structure_color 519void main() { 520#pragma mapbox: initialize highp vec4 structure_color 521v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); 522#ifdef RENDER_SHADOWS 523vec3 shd_pos0=pos;vec3 shd_pos1=pos; 524#ifdef NORMAL_OFFSET 525vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 526#endif 527v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 528#endif 529#ifdef FOG 530v_fog_pos=fog_position(a_pos); 531#endif 532}`),fill:bi(`#include "_prelude_fog.fragment.glsl" 533#include "_prelude_lighting.glsl" 534#include "_prelude_shadow.fragment.glsl" 535#pragma mapbox: define highp vec4 color 536#pragma mapbox: define lowp float opacity 537uniform float u_emissive_strength; 538#ifdef RENDER_SHADOWS 539uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 540#endif 541#ifdef ELEVATED_ROADS 542in highp float v_road_z_offset; 543#endif 544#ifdef INDICATOR_CUTOUT 545in highp float v_z_offset; 546#endif 547void main() { 548#pragma mapbox: initialize highp vec4 color 549#pragma mapbox: initialize lowp float opacity 550vec4 out_color=color; 551#ifdef LIGHTING_3D_MODE 552out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 553#ifdef RENDER_SHADOWS 554float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 555#ifdef ELEVATED_ROADS 556out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 557#else 558out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 559#endif 560#endif 561#endif 562#ifdef FOG 563out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 564#endif 565out_color*=opacity; 566#ifdef INDICATOR_CUTOUT 567if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 568#endif 569glFragColor=out_color; 570#ifdef OVERDRAW_INSPECTOR 571glFragColor=vec4(1.0); 572#endif 573HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 574#include "_prelude_shadow.vertex.glsl" 575in vec2 a_pos; 576#ifdef ELEVATED_ROADS 577in float a_road_z_offset;out highp float v_road_z_offset; 578#endif 579#ifdef RENDER_SHADOWS 580uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 581#endif 582#ifdef INDICATOR_CUTOUT 583out highp float v_z_offset; 584#endif 585uniform mat4 u_matrix; 586#pragma mapbox: define highp vec4 color 587#pragma mapbox: define lowp float opacity 588#pragma mapbox: define highp float z_offset 589void main() { 590#pragma mapbox: initialize highp vec4 color 591#pragma mapbox: initialize lowp float opacity 592#pragma mapbox: initialize highp float z_offset 593#ifdef ELEVATED_ROADS 594z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 595#endif 596float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 597#ifdef RENDER_SHADOWS 598vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 599#ifdef NORMAL_OFFSET 600vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 601#endif 602v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 603#endif 604#ifdef FOG 605v_fog_pos=fog_position(a_pos); 606#endif 607#ifdef INDICATOR_CUTOUT 608v_z_offset=z_offset; 609#endif 610}`),fillOutline:bi(`#include "_prelude_fog.fragment.glsl" 611#include "_prelude_lighting.glsl" 612#include "_prelude_shadow.fragment.glsl" 613in highp vec2 v_pos;uniform float u_emissive_strength; 614#ifdef RENDER_SHADOWS 615uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 616#endif 617#pragma mapbox: define highp vec4 outline_color 618#pragma mapbox: define lowp float opacity 619void main() { 620#pragma mapbox: initialize highp vec4 outline_color 621#pragma mapbox: initialize lowp float opacity 622float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 623#ifdef LIGHTING_3D_MODE 624out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 625#ifdef RENDER_SHADOWS 626float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 627#endif 628#endif 629#ifdef FOG 630out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 631#endif 632glFragColor=out_color*(alpha*opacity); 633#ifdef OVERDRAW_INSPECTOR 634glFragColor=vec4(1.0); 635#endif 636HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 637#include "_prelude_shadow.vertex.glsl" 638in vec2 a_pos; 639#ifdef ELEVATED_ROADS 640in float a_road_z_offset; 641#endif 642#ifdef RENDER_SHADOWS 643uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 644#endif 645uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 646#pragma mapbox: define highp vec4 outline_color 647#pragma mapbox: define lowp float opacity 648#pragma mapbox: define highp float z_offset 649void main() { 650#pragma mapbox: initialize highp vec4 outline_color 651#pragma mapbox: initialize lowp float opacity 652#pragma mapbox: initialize highp float z_offset 653#ifdef ELEVATED_ROADS 654z_offset+=a_road_z_offset; 655#endif 656float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 657#ifdef RENDER_SHADOWS 658vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 659#ifdef NORMAL_OFFSET 660vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 661#endif 662v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 663#endif 664#ifdef FOG 665v_fog_pos=fog_position(a_pos); 666#endif 667}`),fillOutlinePattern:bi(`#include "_prelude_fog.fragment.glsl" 668#include "_prelude_lighting.glsl" 669#include "_prelude_shadow.fragment.glsl" 670uniform vec2 u_texsize;uniform sampler2D u_image; 671#ifdef FILL_PATTERN_TRANSITION 672uniform float u_pattern_transition; 673#endif 674uniform float u_emissive_strength; 675#ifdef RENDER_SHADOWS 676uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 677#endif 678in highp vec2 v_pos;in highp vec2 v_pos_world; 679#pragma mapbox: define lowp float opacity 680#pragma mapbox: define lowp vec4 pattern 681#ifdef FILL_PATTERN_TRANSITION 682#pragma mapbox: define mediump vec4 pattern_b 683#endif 684void main() { 685#pragma mapbox: initialize lowp float opacity 686#pragma mapbox: initialize mediump vec4 pattern 687#ifdef FILL_PATTERN_TRANSITION 688#pragma mapbox: initialize mediump vec4 pattern_b 689#endif 690vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 691#ifdef FILL_PATTERN_TRANSITION 692vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 693#endif 694#ifdef LIGHTING_3D_MODE 695out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 696#ifdef RENDER_SHADOWS 697float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 698#endif 699#endif 700#ifdef FOG 701out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 702#endif 703glFragColor=out_color*(alpha*opacity); 704#ifdef OVERDRAW_INSPECTOR 705glFragColor=vec4(1.0); 706#endif 707HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 708#include "_prelude_shadow.vertex.glsl" 709uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; 710#ifdef ELEVATED_ROADS 711in float a_road_z_offset; 712#endif 713#ifdef RENDER_SHADOWS 714uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 715#endif 716out highp vec2 v_pos;out highp vec2 v_pos_world; 717#pragma mapbox: define lowp float opacity 718#pragma mapbox: define lowp vec4 pattern 719#ifdef FILL_PATTERN_TRANSITION 720#pragma mapbox: define mediump vec4 pattern_b 721#endif 722#pragma mapbox: define lowp float pixel_ratio 723#pragma mapbox: define highp float z_offset 724void main() { 725#pragma mapbox: initialize lowp float opacity 726#pragma mapbox: initialize mediump vec4 pattern 727#ifdef FILL_PATTERN_TRANSITION 728#pragma mapbox: initialize mediump vec4 pattern_b 729#endif 730#pragma mapbox: initialize lowp float pixel_ratio 731#pragma mapbox: initialize highp float z_offset 732vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; 733#ifdef ELEVATED_ROADS 734z_offset+=a_road_z_offset; 735#endif 736float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 737#ifdef RENDER_SHADOWS 738vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 739#ifdef NORMAL_OFFSET 740vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 741#endif 742v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 743#endif 744#ifdef FOG 745v_fog_pos=fog_position(a_pos); 746#endif 747}`),fillPattern:bi(`#include "_prelude_fog.fragment.glsl" 748#include "_prelude_lighting.glsl" 749#include "_prelude_shadow.fragment.glsl" 750uniform vec2 u_texsize;uniform sampler2D u_image; 751#ifdef FILL_PATTERN_TRANSITION 752uniform float u_pattern_transition; 753#endif 754in highp vec2 v_pos;uniform float u_emissive_strength; 755#ifdef RENDER_SHADOWS 756uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 757#endif 758#ifdef ELEVATED_ROADS 759in highp float v_road_z_offset; 760#endif 761#pragma mapbox: define lowp float opacity 762#pragma mapbox: define lowp vec4 pattern 763#ifdef FILL_PATTERN_TRANSITION 764#pragma mapbox: define mediump vec4 pattern_b 765#endif 766void main() { 767#pragma mapbox: initialize lowp float opacity 768#pragma mapbox: initialize mediump vec4 pattern 769#ifdef FILL_PATTERN_TRANSITION 770#pragma mapbox: initialize mediump vec4 pattern_b 771#endif 772vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 773#ifdef FILL_PATTERN_TRANSITION 774vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 775#endif 776#ifdef LIGHTING_3D_MODE 777out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 778#ifdef RENDER_SHADOWS 779float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 780#ifdef ELEVATED_ROADS 781out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 782#else 783out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 784#endif 785#endif 786#endif 787#ifdef FOG 788out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 789#endif 790glFragColor=out_color*opacity; 791#ifdef OVERDRAW_INSPECTOR 792glFragColor=vec4(1.0); 793#endif 794HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 795#include "_prelude_shadow.vertex.glsl" 796uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; 797#ifdef ELEVATED_ROADS 798in float a_road_z_offset;out highp float v_road_z_offset; 799#endif 800#ifdef RENDER_SHADOWS 801uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 802#endif 803out highp vec2 v_pos; 804#pragma mapbox: define lowp float opacity 805#pragma mapbox: define lowp vec4 pattern 806#ifdef FILL_PATTERN_TRANSITION 807#pragma mapbox: define mediump vec4 pattern_b 808#endif 809#pragma mapbox: define lowp float pixel_ratio 810#pragma mapbox: define highp float z_offset 811void main() { 812#pragma mapbox: initialize lowp float opacity 813#pragma mapbox: initialize mediump vec4 pattern 814#pragma mapbox: initialize lowp float pixel_ratio 815#pragma mapbox: initialize highp float z_offset 816#ifdef FILL_PATTERN_TRANSITION 817#pragma mapbox: initialize mediump vec4 pattern_b 818#endif 819vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 820#ifdef ELEVATED_ROADS 821z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 822#endif 823float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 824#ifdef RENDER_SHADOWS 825vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 826#ifdef NORMAL_OFFSET 827vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 828#endif 829v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 830#endif 831#ifdef FOG 832v_fog_pos=fog_position(a_pos); 833#endif 834}`),fillExtrusion:bi(`#include "_prelude_fog.fragment.glsl" 835#include "_prelude_shadow.fragment.glsl" 836#include "_prelude_lighting.glsl" 837in vec4 v_color;in vec4 v_flat; 838#ifdef RENDER_SHADOWS 839in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 840#endif 841uniform lowp float u_opacity; 842#ifdef FAUX_AO 843uniform lowp vec2 u_ao;in vec2 v_ao; 844#endif 845#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 846in vec4 v_roof_color; 847#endif 848#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 849in highp vec3 v_normal; 850#endif 851uniform vec3 u_flood_light_color;uniform highp float u_vertical_scal
851e;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 852#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 853in float v_flood_radius;in float v_has_floodlight; 854#endif 855in float v_height; 856#pragma mapbox: define highp float emissive_strength 857void main() { 858#pragma mapbox: initialize highp float emissive_strength 859#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 860vec3 normal=normalize(v_normal); 861#endif 862float z;vec4 color=v_color; 863#ifdef ZERO_ROOF_RADIUS 864z=float(normal.z > 0.00001); 865#ifdef LIGHTING_3D_MODE 866normal=mix(normal,vec3(0.0,0.0,1.0),z); 867#else 868color=mix(v_color,v_roof_color,z); 869#endif 870#endif 871float h=max(0.0,v_height);float ao_shade=1.0; 872#ifdef FAUX_AO 873float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; 874#ifdef ZERO_ROOF_RADIUS 875concave*=(1.0-z); 876#endif 877float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); 878#ifdef LIGHTING_3D_MODE 879#ifdef FLOOD_LIGHT 880color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 881#else 882color.rgb*=ao_shade; 883#endif 884#else 885color.rgb*=ao_shade; 886#endif 887#endif 888#ifdef LIGHTING_3D_MODE 889float flood_radiance=0.0; 890#ifdef FLOOD_LIGHT 891flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 892#endif 893#ifdef RENDER_SHADOWS 894#ifdef FLOOD_LIGHT 895float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); 896#else 897float shadowed_lighting_factor; 898#ifdef RENDER_CUTOFF 899shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} 900#else 901shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 902#endif 903color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 904#endif 905#else 906color.rgb=apply_lighting(color.rgb,normal); 907#ifdef FLOOD_LIGHT 908color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 909#endif 910#endif 911color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 912#endif 913#ifdef FOG 914color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 915#endif 916#ifdef INDICATOR_CUTOUT 917color=applyCutout(color,h); 918#endif 919glFragColor=color; 920#ifdef OVERDRAW_INSPECTOR 921glFragColor=vec4(1.0); 922#endif 923HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 924#include "_prelude_terrain.vertex.glsl" 925#include "_prelude_shadow.vertex.glsl" 926#include "_prelude_lighting.glsl" 927uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 928#ifdef RENDER_WALL_MODE 929in vec3 a_join_normal_inside; 930#endif 931#ifdef PROJECTION_GLOBE_VIEW 932in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 933#endif 934#ifdef TERRAIN 935uniform int u_height_type;uniform int u_base_type; 936#endif 937uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 938#ifdef RENDER_SHADOWS 939uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; 940#endif 941#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 942out vec4 v_roof_color; 943#endif 944#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 945out highp vec3 v_normal; 946#endif 947#ifdef FAUX_AO 948uniform lowp vec2 u_ao;out vec2 v_ao; 949#endif 950#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
951out float v_flood_radius;out float v_has_floodlight; 952#endif 953out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 954#pragma mapbox: define highp float base 955#pragma mapbox: define highp float height 956#pragma mapbox: define highp vec4 color 957#pragma mapbox: define highp float flood_light_wall_radius 958#pragma mapbox: define highp float line_width 959#pragma mapbox: define highp float emissive_strength 960void main() { 961#pragma mapbox: initialize highp float base 962#pragma mapbox: initialize highp float height 963#pragma mapbox: initialize highp vec4 color 964#pragma mapbox: initialize highp float flood_light_wall_radius 965#pragma mapbox: initialize highp float line_width 966#pragma mapbox: initialize highp float emissive_strength 967base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); 968#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 969v_normal=normal; 970#endif 971base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 972#if defined(HAS_CENTROID) || defined(TERRAIN) 973centroid_pos=a_centroid_pos; 974#endif 975float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 976#ifdef TERRAIN 977bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 978#else 979h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 980#endif 981#ifdef PROJECTION_GLOBE_VIEW 982float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 983#endif 984float cutoff=1.0;vec3 scaled_pos=pos; 985#ifdef RENDER_CUTOFF 986vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); 987#endif 988float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 989#ifdef RENDER_WALL_MODE 990vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5; 991#endif 992gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 993#ifdef RENDER_SHADOWS 994vec3 shd_pos0=pos;vec3 shd_pos1=pos; 995#ifdef NORMAL_OFFSET 996vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 997#endif 998v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); 999#endif 1000float NdotL=0.0;float colorvalue=0.0; 1001#ifndef LIGHTING_3D_MODE 1002colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( 1003(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1004#endif 1005#ifdef FAUX_AO
1006float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 1007#ifdef TERRAIN 1008top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1009#endif 1010v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1011#ifdef PROJECTION_GLOBE_VIEW 1012top_height+=u_height_lift; 1013#endif 1014gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1015#endif 1016#ifdef LIGHTING_3D_MODE 1017#ifdef FLOOD_LIGHT 1018float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; 1019#endif 1020v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); 1021#else 1022v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; 1023#endif 1024#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1025float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; 1026#endif 1027#ifdef FOG 1028v_fog_pos=fog_position(pos); 1029#endif 1030}`),fillExtrusionDepth:bi(`in highp float v_depth;void main() { 1031#ifndef DEPTH_TEXTURE 1032glFragColor=pack_depth(v_depth); 1033#endif 1034}`,`#include "_prelude_terrain.vertex.glsl" 1035uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 1036#ifdef TERRAIN 1037uniform int u_height_type;uniform int u_base_type; 1038#endif 1039in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1040#ifdef RENDER_WALL_MODE 1041in vec3 a_join_normal_inside; 1042#endif 1043#pragma mapbox: define highp float base 1044#pragma mapbox: define highp float height 1045#pragma mapbox: define highp float line_width 1046#pragma mapbox: define highp vec4 color 1047out highp float v_depth;void main() { 1048#pragma mapbox: initialize highp float base 1049#pragma mapbox: initialize highp float height 1050#pragma mapbox: initialize highp float line_width 1051#pragma mapbox: initialize highp vec4 color 1052base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 1053#if defined(HAS_CENTROID) || defined(TERRAIN) 1054centroid_pos=a_centroid_pos; 1055#endif 1056vec3 pos; 1057#ifdef TERRAIN 1058bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 1059#else 1060pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 1061#endif 1062#ifdef RENDER_WALL_MODE 1063vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5; 1064#endif 1065float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:bi(`#include "_prelude_fog.fragment.glsl" 1066#include "_prelude_lighting.glsl" 1067uniform vec2 u_texsize;uniform sampler2D u_image; 1068#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1069uniform float u_pattern_transition; 1070#endif 1071#ifdef FAUX_AO 1072uniform lowp vec2 u_ao;in vec3 v_ao; 1073#endif 1074#ifdef LIGHTING_3D_MODE 1075in vec3 v_normal; 1076#endif 1077in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 1078#pragma mapbox: define highp float base 1079#pragma mapbox: define highp float height 1080#pragma mapbox: define mediump vec4 pattern 1081#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1082#pragma mapbox: define mediump vec4 pattern_b 1083#endif 1084#pragma mapbox: define highp float pixel_ratio 1085void main() { 1086#pragma mapbox: initialize highp float base 1087#pragma mapbox: initialize highp float height 1088#pragma mapbox: initialize mediump vec4 pattern 1089#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1090#pragma mapbox: initialize mediump vec4 pattern_b 1091#endif 1092#pragma mapbox: initialize highp float pixel_ratio 1093vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 1094#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1095vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 1096#endif 1097#ifdef LIGHTING_3D_MODE 1098out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 1099#else 1100out_color=out_color*v_lighting; 1101#endif 1102#ifdef FAUX_AO 1103float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1103),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; 1104#endif 1105#ifdef FOG 1106out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1107#endif 1108#ifdef INDICATOR_CUTOUT 1109out_color=applyCutout(out_color,height); 1110#endif 1111glFragColor=out_color; 1112#ifdef OVERDRAW_INSPECTOR 1113glFragColor=vec4(1.0); 1114#endif 1115HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1116#include "_prelude_terrain.vertex.glsl" 1117#include "_prelude_lighting.glsl" 1118uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1119#ifdef RENDER_WALL_MODE 1120in vec3 a_join_normal_inside; 1121#endif 1122#ifdef PROJECTION_GLOBE_VIEW 1123in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 1124#endif 1125#ifdef TERRAIN 1126uniform int u_height_type;uniform int u_base_type; 1127#endif 1128out highp vec2 v_pos;out vec4 v_lighting; 1129#ifdef FAUX_AO 1130uniform lowp vec2 u_ao;out vec3 v_ao; 1131#endif 1132#ifdef LIGHTING_3D_MODE 1133out vec3 v_normal; 1134#endif 1135#pragma mapbox: define highp float base 1136#pragma mapbox: define highp float height 1137#pragma mapbox: define highp vec4 color 1138#pragma mapbox: define mediump vec4 pattern 1139#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1140#pragma mapbox: define mediump vec4 pattern_b 1141#endif 1142#pragma mapbox: define highp float pixel_ratio 1143#pragma mapbox: define highp float line_width 1144void main() { 1145#pragma mapbox: initialize highp float base 1146#pragma mapbox: initialize highp float height 1147#pragma mapbox: initialize highp vec4 color 1148#pragma mapbox: initialize mediump vec4 pattern 1149#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1150#pragma mapbox: initialize mediump vec4 pattern_b 1151#endif 1152#pragma mapbox: initialize highp float pixel_ratio 1153#pragma mapbox: initialize highp float line_width 1154vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); 1155#if defined(HAS_CENTROID) || defined(TERRAIN) 1156centroid_pos=a_centroid_pos; 1157#endif 1158float ele=0.0;float h=z;vec3 p;float c_ele; 1159#ifdef TERRAIN 1160bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); 1161#else 1162p=vec3(pos_nx.xy,z); 1163#endif 1164#ifdef PROJECTION_GLOBE_VIEW 1165float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 1166#endif 1167#ifdef RENDER_WALL_MODE 1168vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5; 1169#endif 1170float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 1171? pos_nx.xy 1172: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; 1173#ifdef LIGHTING_3D_MODE 1174NdotL=calculate_NdotL(normal); 1175#else 1176NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1177#endif 1178if (normal.y !=0.0) {float r=0.84; 1179#ifndef LIGHTING_3D_MODE 1180r=mix(0.7,0.98,1.0-u_lightintensity); 1181#endif 1182NdotL*=( 1183(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1184#ifdef FAUX_AO
1185float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 1186#ifdef TERRAIN 1187top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1188#endif 1189v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1190#ifdef PROJECTION_GLOBE_VIEW 1191top_height+=u_height_lift; 1192#endif 1193gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1194#endif 1195#ifdef LIGHTING_3D_MODE 1196v_normal=normal; 1197#else 1198v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1199#endif 1200#ifdef FOG 1201v_fog_pos=fog_position(p); 1202#endif 1203}`),groundShadow:bi(`#include "_prelude_shadow.fragment.glsl" 1204precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1205#ifdef FOG 1206in float v_fog_opacity; 1207#endif 1208void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); 1209#ifdef RENDER_CUTOFF 1210shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 1211#endif 1212#ifdef FOG 1213shadow=mix(shadow,vec3(1.0),v_fog_opacity); 1214#endif 1215#ifdef INDICATOR_CUTOUT 1216shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 1217#endif 1218glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 1219uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; 1220#ifdef FOG 1221out float v_fog_opacity; 1222#endif 1223void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); 1224#ifdef FOG 1225v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 1226#endif 1227}`),fillExtrusionGroundEffect:bi(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; 1228#ifdef SDF_SUBPASS 1229in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} 1230#ifdef FOG 1231in highp float v_fog; 1232#endif 1233#endif 1234void main() { 1235#ifdef CLEAR_SUBPASS 1236vec4 color=vec4(1.0); 1237#ifdef CLEAR_FROM_TEXTURE 1238color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 1239#endif 1240glFragColor=color; 1241#else 1242#ifdef SDF_SUBPASS 1243highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; 1244#ifdef FOG 1245fog=v_fog; 1246#endif 1247#ifdef RENDER_CUTOFF 1248fog*=v_cutoff_opacity; 1249#endif 1250glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 1251#else 1252vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 1253#ifdef OVERDRAW_INSPECTOR 1254color=vec4(1.0); 1255#endif 1256glFragColor=color; 1257#endif 1258HANDLE_WIREFRAME_DEBUG; 1259#endif 1260}`,`#include "_prelude_fog.vertex.glsl" 1261in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 1262#ifdef SDF_SUBPASS 1263out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 1264#ifdef FOG 1265out highp float v_fog; 1266#endif 1267#endif 1268uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao; 1269#pragma mapbox: define highp float flood_light_ground_radius 1270const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1271#pragma mapbox: initialize highp float flood_light_ground_radius 1272vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; 1273#ifdef SDF_SUBPASS 1274v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); 1275#ifdef FOG 1276v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 1277#endif 1278#endif 1279float hidden_by_landmark=0.0; 1280#ifdef HAS_CENTROID 1281hidden_by_landmark=a_hidden_by_landmark; 1282#endif 1283float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); 1284#ifdef RENDER_CUTOFF 1285v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1286#endif 1287}`),hillshadePrepare:bi(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 1288(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1289)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1290deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:bi(`#include "_prelude_fog.fragment.glsl" 1291#include "_prelude_lighting.glsl" 1292uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; 1293#ifdef LIGHTING_3D_MODE 1294glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1295#endif 1296#ifdef FOG 1297glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1298#endif 1299#ifdef OVERDRAW_INSPECTOR 1300glFragColor=vec4(1.0); 1301#endif 1302HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1303uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; 1304#ifdef FOG 1305v_fog_pos=fog_position(a_pos); 1306#endif 1307}`),line:bi(`#include "_prelude_fog.fragment.glsl" 1308#include "_prelude_lighting.glsl" 1309#include "_prelude_shadow.fragment.glsl" 1310uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1310uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; 1311#ifdef ELEVATED_ROADS 1312in highp float v_road_z_offset; 1313#endif 1314#ifdef RENDER_LINE_DASH 1315uniform sampler2D u_dash_image;in vec2 v_tex; 1316#endif 1317#ifdef RENDER_LINE_GRADIENT 1318uniform sampler2D u_gradient_image; 1319#endif 1320#ifdef INDICATOR_CUTOUT 1321in highp float v_z_offset; 1322#endif 1323#ifdef RENDER_SHADOWS 1324uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1325#endif 1326float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; 1327#pragma mapbox: define highp vec4 color 1328#pragma mapbox: define lowp float floorwidth 1329#pragma mapbox: define lowp vec4 dash 1330#pragma mapbox: define lowp float blur 1331#pragma mapbox: define lowp float opacity 1332#pragma mapbox: define lowp float border_width 1333#pragma mapbox: define lowp vec4 border_color 1334float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1335#pragma mapbox: initialize highp vec4 color 1336#pragma mapbox: initialize lowp float floorwidth 1337#pragma mapbox: initialize lowp vec4 dash 1338#pragma mapbox: initialize lowp float blur 1339#pragma mapbox: initialize lowp float opacity 1340#pragma mapbox: initialize lowp float border_width 1341#pragma mapbox: initialize lowp vec4 border_color 1342float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0); 1343#ifdef RENDER_LINE_DASH 1344float sdfdist=texture(u_dash_image,v_tex).r;
1344float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); 1345#endif 1346highp vec4 out_color; 1347#ifdef RENDER_LINE_GRADIENT 1348out_color=texture(u_gradient_image,v_uv.xy); 1349#else 1350out_color=color; 1351#endif 1352float trim_alpha=1.0; 1353#ifdef RENDER_LINE_TRIM_OFFSET 1354highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;} 1355#endif 1356if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1357#ifdef RENDER_LINE_BORDER 1358float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}} 1359#endif 1360#ifdef LIGHTING_3D_MODE 1361out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1362#ifdef RENDER_SHADOWS 1363float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1364#ifdef ELEVATED_ROADS 1365out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1366#else 1367out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1368#endif 1369#endif 1370#endif 1371#ifdef FOG 1372out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1373#endif 1374out_color*=(alpha*opacity); 1375#ifdef INDICATOR_CUTOUT 1376out_color=applyCutout(out_color,v_z_offset); 1377#endif 1378glFragColor=out_color; 1379#ifdef OVERDRAW_INSPECTOR 1380glFragColor=vec4(1.0); 1381#endif 1382HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1383#include "_prelude_shadow.vertex.glsl" 1384#include "_prelude_terrain.vertex.glsl" 1385#define EXTRUDE_SCALE 0.015873016 1386in vec2 a_pos_normal;in vec4 a_data; 1387#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 1388in vec3 a_z_offset_width; 1389#endif 1390#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1391in highp vec3 a_packed; 1392#endif 1393#ifdef RENDER_LINE_DASH 1394in float a_linesofar; 1395#endif 1396uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale; 1397#ifdef ELEVATED 1398uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1399#ifdef ELEVATION_REFERENCE_SEA 1400return 0.0; 1401#else 1402return elevation(apos); 1403#endif 1404} 1405#endif 1406out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; 1407#ifdef ELEVATED_ROADS 1408out highp float v_road_z_offset; 1409#endif 1410#ifdef RENDER_LINE_DASH 1411uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1412#endif 1413#ifdef RENDER_LINE_GRADIENT 1414uniform float u_image_height; 1415#endif 1416#ifdef INDICATOR_CUTOUT 1417out highp float v_z_offset; 1418#endif 1419#ifdef RENDER_SHADOWS 1420uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1421#endif 1422#pragma mapbox: define highp vec4 color 1423#pragma mapbox: define lowp float floorwidth 1424#pragma mapbox: define lowp vec4 dash 1425#pragma mapbox: define lowp float blur 1426#pragma mapbox: define lowp float opacity 1427#pragma mapbox: define mediump float gapwidth 1428#pragma mapbox: define lowp float offset 1429#pragma mapbox: define mediump float width 1430#pragma mapbox: define lowp float border_width 1431#pragma mapbox: define lowp vec4 border_color 1432void main() { 1433#pragma mapbox: initialize highp vec4 color 1434#pragma mapbox: initialize lowp float floorwidth 1435#pragma mapbox: initialize lowp vec4 dash 1436#pragma mapbox: initialize lowp float blur 1437#pragma mapbox: initialize lowp float opacity 1438#pragma mapbox: initialize mediump float gapwidth 1439#pragma mapbox: initialize lowp float offset 1440#pragma mapbox: initialize mediump float width 1441#pragma mapbox: initialize lowp float border_width 1442#pragma mapbox: initialize lowp vec4 border_color 1443float a_z_offset; 1444#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1445a_z_offset=a_z_offset_width.x; 1446#endif 1447float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth; 1448#ifdef VARIABLE_LINE_WIDTH 1449float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0; 1450#else 1451halfwidth=(u_width_scale*width)/2.0; 1452#endif 1453offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1453vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1454#ifdef ELEVATED_ROADS 1455v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; 1456#else 1457#ifdef ELEVATED 1458vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1459#ifdef CROSS_SLOPE_VERTICAL 1460float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1461#else 1462#ifdef CROSS_SLOPE_HORIZONTAL 1463float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; 1464#else 1465float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; 1466#endif 1467#endif 1468gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1469#else 1470gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1471#endif 1472#endif 1473#ifdef ELEVATED_ROADS 1474#ifdef RENDER_SHADOWS 1475vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1476#ifdef NORMAL_OFFSET 1477vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1478#endif 1479v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1480#endif 1481#endif 1482#ifndef RENDER_TO_TEXTURE 1483float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1484#else 1485v_gamma_scale=1.0; 1486#endif 1487#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1488highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; 1489#ifdef RENDER_LINE_GRADIENT 1490highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); 1491#else 1492v_uv=vec3(a_uv_x,0.0,line_progress); 1493#endif 1494#endif 1495#ifdef RENDER_LINE_DASH 1496float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y); 1497#endif 1498v_width2=vec2(outset,inset); 1499#ifdef FOG 1500v_fog_pos=fog_position(pos); 1501#endif 1502#ifdef INDICATOR_CUTOUT 1503v_z_offset=a_z_offset; 1504#endif 1505}`),linePattern:bi(`#include "_prelude_fog.fragment.glsl" 1506#include "_prelude_lighting.glsl" 1507#include "_prelude_shadow.fragment.glsl" 1508uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; 1509#ifdef LINE_PATTERN_TRANSITION 1510uniform float u_pattern_transition; 1511#endif 1512in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1513#ifdef RENDER_LINE_TRIM_OFFSET 1514in highp vec3 v_uv; 1515#endif 1516#ifdef ELEVATED_ROADS 1517in highp float v_road_z_offset; 1518#endif 1519#ifdef LINE_JOIN_NONE 1520in vec2 v_pattern_data; 1521#endif 1522#ifdef INDICATOR_CUTOUT 1523in highp float v_z_offset; 1524#endif 1525#ifdef RENDER_SHADOWS 1526uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1527#endif 1528uniform float u_emissive_strength; 1529#pragma mapbox: define mediump vec4 pattern 1530#ifdef LINE_PATTERN_TRANSITION 1531#pragma mapbox: define mediump vec4 pattern_b 1532#endif 1533#pragma mapbox: define mediump float pixel_ratio 1534#pragma mapbox: define mediump float blur 1535#pragma mapbox: define mediump float opacity 1536void main() { 1537#pragma mapbox: initialize mediump vec4 pattern 1538#ifdef LINE_PATTERN_TRANSITION 1539#pragma mapbox: initialize mediump vec4 pattern_b 1540#endif 1541#pragma mapbox: initialize mediump float pixel_ratio 1542#pragma mapbox: initialize mediump float blur 1543#pragma mapbox: initialize mediump float opacity 1544vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); 1545#ifdef LINE_PATTERN_TRANSITION 1546vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 1547#endif 1548#ifdef RENDER_LINE_TRIM_OFFSET 1549highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} 1550#endif 1551#ifdef LINE_JOIN_NONE 1552highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} 1553#endif 1554#ifdef LIGHTING_3D_MODE 1555color=apply_lighting_with_emission_ground(color,u_emissive_strength); 1556#ifdef RENDER_SHADOWS 1557float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1558#ifdef ELEVATED_ROADS 1559color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1560#else 1561color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1562#endif 1563#endif 1564#endif 1565#ifdef FOG 1566color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1567#endif 1568color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1569#ifdef INDICATOR_CUTOUT 1570color=applyCutout(color,v_z_offset); 1571#endif 1572glFragColor=color; 1573#ifdef OVERDRAW_INSPECTOR 1574glFragColor=vec4(1.0); 1575#endif 1576HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1577#include "_prelude_shadow.vertex.glsl" 1578#include "_prelude_terrain.vertex.glsl" 1579#define scale 0.015873016 1580in vec2 a_pos_normal;in vec4 a_data; 1581#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1582in vec3 a_z_offset_width; 1583#endif 1584#ifdef RENDER_LINE_TRIM_OFFSET 1585in highp vec3 a_packed; 1586#endif 1587in highp float a_linesofar; 1588#ifdef LINE_JOIN_NONE 1589in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1590#endif 1591#ifdef INDICATOR_CUTOUT 1592out highp float v_z_offset; 1593#endif 1594uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; 1595#ifdef ELEVATED 1596uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1597#ifdef ELEVATION_REFERENCE_SEA 1598return 0.0; 1599#else 1600return elevation(apos); 1601#endif 1602} 1603#endif 1604out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1605#ifdef RENDER_LINE_TRIM_OFFSET 1606out highp vec3 v_uv; 1607#endif 1608#ifdef ELEVATED_ROADS 1609out highp float v_road_z_offset; 1610#endif 1611#ifdef RENDER_SHADOWS 1612uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1613#endif 1614#pragma mapbox: define mediump float blur 1615#pragma mapbox: define mediump float opacity 1616#pragma mapbox: define mediump float offset 1617#pragma mapbox: define mediump float gapwidth 1618#pragma mapbox: define mediump float width 1619#pragma mapbox: define mediump float floorwidth 1620#pragma mapbox: define mediump vec4 pattern 1621#ifdef LINE_PATTERN_TRANSITION 1622#pragma mapbox: define mediump vec4 pattern_b 1623#endif 1624#pragma mapbox: define mediump float pixel_ratio 1625void main() { 1626#pragma mapbox: initialize mediump float blur 1627#pragma mapbox: initialize mediump float opacity 1628#pragma mapbox: initialize mediump float offset 1629#pragma mapbox: initialize mediump float gapwidth 1630#pragma mapbox: initialize mediump float width 1631#pragma mapbox: initialize mediump float floorwidth 1632#pragma mapbox: initialize mediump vec4 pattern 1633#ifdef LINE_PATTERN_TRANSITION 1634#pragma mapbox: initialize mediump vec4 pattern_b 1635#endif 1636#pragma mapbox: initialize mediump float pixel_ratio 1637float a_z_offset; 1638#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1639a_z_offset=a_z_offset_width.x; 1640#endif 1641float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1641vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1642#ifdef ELEVATED_ROADS 1643v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; 1644#else 1645#ifdef ELEVATED 1646vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1647#ifdef CROSS_SLOPE_VERTICAL 1648float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1649#else 1650#ifdef CROSS_SLOPE_HORIZONTAL 1651float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; 1652#else 1653float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; 1654#endif 1655#endif 1656gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1657#else 1658gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1659#endif 1660#endif 1661#ifdef ELEVATED_ROADS 1662#ifdef RENDER_SHADOWS 1663vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1664#ifdef NORMAL_OFFSET 1665vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1666#endif 1667v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1668#endif 1669#endif 1670#ifndef RENDER_TO_TEXTURE 1671float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1672#else 1673v_gamma_scale=1.0; 1674#endif 1675#ifdef RENDER_LINE_TRIM_OFFSET 1676highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1677#endif 1678v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1679#ifdef LINE_JOIN_NONE 1680v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); 1681#endif 1682#ifdef FOG 1683v_fog_pos=fog_position(pos); 1684#endif 1685#ifdef INDICATOR_CUTOUT 1686v_z_offset=a_z_offset; 1687#endif 1688}`),raster:bi(`#include "_prelude_fog.fragment.glsl" 1689#include "_prelude_lighting.glsl" 1690#include "_prelude_raster_array.glsl" 1691uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; 1692#ifdef PROJECTION_GLOBE_VIEW 1693in float v_split_fade; 1694#endif 1695uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; 1696#ifndef RASTER_ARRAY 1697uniform highp sampler2D u_image0;uniform sampler2D u_image1; 1698#endif 1699#ifdef RASTER_COLOR 1700uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1701#endif 1702void main() {vec4 color0,color1,color;vec2 value; 1703#ifdef RASTER_COLOR 1704#ifdef RASTER_ARRAY 1705#ifdef RASTER_ARRAY_LINEAR 1706value=mix( 1707raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 1708); 1709#else 1710value=mix( 1711raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 1712); 1713#endif 1714if (value.y > 0.0) value.x/=value.y; 1715#else 1716color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); 1717#endif 1718color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 1719#else 1720color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); 1721#endif 1722color.a*=u_opacity; 1723#ifdef GLOBE_POLES 1724color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 1725#endif 1726vec3 rgb=color.rgb;rgb=vec3( 1727dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); 1728#ifdef LIGHTING_3D_MODE 1729out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 1730#endif 1731#ifdef FOG 1732highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 1733#endif 1734glFragColor=vec4(out_color*color.a,color.a); 1735#ifdef PROJECTION_GLOBE_VIEW 1736glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 1737#endif 1738#ifdef RENDER_CUTOFF 1739glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 1740#endif 1741#ifdef OVERDRAW_INSPECTOR 1742glFragColor=vec4(1.0); 1743#endif 1744HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1745uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 1746#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1747#ifdef GLOBE_POLES 1748in vec3 a_globe_pos;in vec2 a_uv; 1749#else 1750in vec2 a_pos;in vec2 a_texture_pos; 1751#endif 1752out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 1753#ifdef PROJECTION_GLOBE_VIEW 1754out float v_split_fade; 1755#endif 1756void main() {vec2 uv; 1757#ifdef GLOBE_POLES 1758vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; 1759#ifdef FOG 1760v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 1761#endif 1762#else 1763float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 1764#ifdef PROJECTION_GLOBE_VIEW 1765vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); 1766v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1766if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; 1767#ifdef FOG 1768v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1769#endif 1770#else 1771gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1772#ifdef FOG 1773v_fog_pos=fog_position(a_pos); 1774#endif 1775#endif 1776#endif 1777v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; 1778#ifdef RENDER_CUTOFF 1779v_depth=gl_Position.z; 1780#endif 1781}`),rasterParticle:bi(`#include "_prelude_fog.fragment.glsl" 1782#include "_prelude_lighting.glsl" 1783uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; 1784#ifdef LIGHTING_3D_MODE 1785out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb; 1786#endif 1787#ifdef FOG 1788highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 1789#endif 1790glFragColor=vec4(out_color*color.a,color.a); 1791#ifdef OVERDRAW_INSPECTOR 1792glFragColor=vec4(1.0); 1793#endif 1794HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1795uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 1796#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1797in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 1798#ifdef PROJECTION_GLOBE_VIEW 1799vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; 1800#ifdef FOG 1801v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1802#endif 1803#else 1804uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1805#ifdef FOG 1806v_fog_pos=fog_position(a_pos); 1807#endif 1808#endif 1809v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:bi("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" 1810in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( 1811mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:bi("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:bi(`#include "_prelude_raster_particle.glsl" 1812uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
1812vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( 1813linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 1814);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:bi(`#include "_prelude_lighting.glsl" 1815#include "_prelude_shadow.fragment.glsl" 1816#define SDF_PX 8.0 1817#define SDF 1.0 1818#define ICON 0.0 1819uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; 1820#ifdef ICON_TRANSITION 1821uniform float u_icon_transition; 1822#endif 1823#ifdef COLOR_ADJUSTMENT 1824uniform mat4 u_color_adj_mat; 1825#endif 1826#ifdef INDICATOR_CUTOUT 1827in highp float v_z_offset; 1828#else 1829#ifdef Z_OFFSET 1830#ifdef RENDER_SHADOWS 1831in highp float v_z_offset; 1832#endif 1833#endif 1834#endif 1835in vec2 v_tex_a; 1836#ifdef ICON_TRANSITION 1837in vec2 v_tex_b; 1838#endif 1839in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 1840#ifdef RENDER_TEXT_AND_SYMBOL 1841in float is_sdf;in vec2 v_tex_a_icon; 1842#endif 1843#ifdef Z_OFFSET 1844#ifdef RENDER_SHADOWS 1845uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1846#endif 1847#endif 1848#pragma mapbox: define highp vec4 fill_color 1849#pragma mapbox: define highp vec4 halo_color 1850#pragma mapbox: define lowp float opacity 1851#pragma mapbox: define lowp float halo_width 1852#pragma mapbox: define lowp float halo_blur 1853#pragma mapbox: define lowp float emissive_strength 1854void main() { 1855#pragma mapbox: initialize highp vec4 fill_color 1856#pragma mapbox: initialize highp vec4 halo_color 1857#pragma mapbox: initialize lowp float opacity 1858#pragma mapbox: initialize lowp float halo_width 1859#pragma mapbox: initialize lowp float halo_blur 1860#pragma mapbox: initialize lowp float emissive_strength 1861vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 1862#ifdef RENDER_TEXT_AND_SYMBOL 1863if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; 1864#ifdef OVERDRAW_INSPECTOR 1865glFragColor=vec4(1.0); 1866#endif 1867return;} 1868#endif 1869#ifdef RENDER_SDF 1870float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; 1871#else 1872#ifdef ICON_TRANSITION 1873vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); 1874#else 1875out_color=texture(u_texture,v_tex_a); 1876#endif 1877#ifdef COLOR_ADJUSTMENT 1878out_color=u_color_adj_mat*out_color; 1879#endif 1880#endif 1881out_color*=opacity*fade_opacity; 1882#ifdef LIGHTING_3D_MODE 1883out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1884#ifdef Z_OFFSET 1885#ifdef RENDER_SHADOWS 1886float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1887#endif 1888#endif 1889#endif 1890#ifdef INDICATOR_CUTOUT 1891out_color=applyCutout(out_color,v_z_offset); 1892#endif 1893glFragColor=out_color; 1894#ifdef OVERDRAW_INSPECTOR 1895glFragColor=vec4(1.0); 1896#endif 1897HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1898#include "_prelude_shadow.vertex.glsl" 1899in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 1900#ifdef Z_OFFSET 1901in float a_auto_z_offset; 1902#endif 1903#ifdef PROJECTION_GLOBE_VIEW 1904in vec3 a_globe_anchor;in vec3 a_globe_normal; 1905#endif 1906#ifdef ICON_TRANSITION 1907in vec2 a_texb; 1908#endif 1909#ifdef OCCLUSION_QUERIES 1910in float a_occlusion_query_opacity; 1911#endif 1912#ifdef ELEVATED_ROADS 1913in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 1914#endif 1915#ifdef INDICATOR_CUTOUT 1916out highp float v_z_offset; 1917#else 1918#ifdef Z_OFFSET 1919#ifdef RENDER_SHADOWS 1920out highp float v_z_offset; 1921#endif 1922#endif 1923#endif 1924uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; 1925#ifdef PROJECTION_GLOBE_VIEW 1926uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 1927#endif 1928out vec2 v_tex_a; 1929#ifdef ICON_TRANSITION 1930out vec2 v_tex_b; 1931#endif 1932out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 1933#ifdef RENDER_TEXT_AND_SYMBOL 1934out float is_sdf;out vec2 v_tex_a_icon; 1935#endif 1936#ifdef Z_OFFSET 1937#ifdef RENDER_SHADOWS 1938uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1939#endif 1940#endif 1941#pragma mapbox: define highp vec4 fill_color 1942#pragma mapbox: define highp vec4 halo_color 1943#pragma mapbox: define lowp float opacity 1944#pragma mapbox: define lowp float halo_width 1945#pragma mapbox: define lowp float halo_blur 1946#pragma mapbox: define lowp float emissive_strength 1947#pragma mapbox: define lowp float occlusion_opacity 1948#pragma mapbox: define lowp float z_offset 1949void main() { 1950#pragma mapbox: initialize highp vec4 fill_color 1951#pragma mapbox: initialize highp vec4 halo_color 1952#pragma mapbox: initialize lowp float opacity 1953#pragma mapbox: initialize lowp float halo_width 1954#pragma mapbox: initialize lowp float halo_blur 1955#pragma mapbox: initialize lowp float emissive_strength 1956#pragma mapbox: initialize lowp float occlusion_opacity 1957#pragma mapbox: initialize lowp float z_offset 1958vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); 1959#ifdef Z_OFFSET 1960e+=a_auto_z_offset; 1961#endif 1962vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 1963#ifdef PROJECTION_GLOBE_VIEW 1964mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 1965#else 1966world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 1967#endif 1968vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 1969camera_to_anchor_distance/u_camera_to_center_distance : 1970u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 19710.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; 1972#ifdef PROJECTION_GLOBE_VIEW 1973vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; 1974#else 1975offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 1976#endif 1977vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 1978#ifdef PROJECTION_GLOBE_VIEW 1979#ifdef PROJECTED_POS_ON_VIEWPORT 1980projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 1981#else 1982vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 1983#endif 1984#else 1985projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 1986#endif 1987highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); 1988#ifdef TERRAIN 1989#ifdef PITCH_WITH_MAP_TERRAIN 1990vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 1991#endif 1992#endif 1993#ifdef Z_OFFSET 1994z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 1995#else 1996z+=u_pitch_with_map ? z_offset : 0.0; 1997#endif 1998float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); 1999#ifdef DEPTH_OCCLUSION 2000float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 2001#endif 2002#ifdef OCCLUSION_QUERIES 2003float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 2004#endif 2005float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 2006#ifdef PROJECTION_GLOBE_VIEW 2007vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; 2008#else 2009#ifdef ELEVATED_ROADS 2010vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; 2011#else 2012pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 2013#endif 2014#endif 2015gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; 2016#ifdef RENDER_TEXT_AND_SYMBOL 2017is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 2018#endif 2019#ifdef ICON_TRANSITION 2020v_tex_b=a_texb/u_texsize; 2021#endif 2022#ifdef Z_OFFSET 2023#ifdef RENDER_SHADOWS 2024vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 2025#ifdef NORMAL_OFFSET 2026vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 2027#endif 2028v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 2029#endif 2030#endif 2031#ifdef INDICATOR_CUTOUT 2032v_z_offset=e; 2033#else 2034#ifdef Z_OFFSET 2035#ifdef RENDER_SHADOWS 2036v_z_offset=e; 2037#endif 2038#endif 2039#endif 2040}`),terrainRaster:bi(`#include "_prelude_fog.fragment.glsl" 2041#include "_prelude_shadow.fragment.glsl" 2042#include "_prelude_lighting.glsl" 2043uniform sampler2D u_image0;in vec2 v_pos0; 2044#ifdef FOG 2045in float v_fog_opacity; 2046#endif 2047#ifdef RENDER_SHADOWS 2048in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2049#endif 2050uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 2051#ifdef LIGHTING_3D_MODE 2052const vec3 normal=vec3(0.0,0.0,1.0); 2053#ifdef RENDER_SHADOWS 2054float cutoffOpacity=1.0; 2055#ifdef RENDER_CUTOFF 2056cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 2057#endif 2058#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2059vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 2060#else 2061float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); 2062#endif 2063#else 2064float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 2065#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2066color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; 2067#endif 2068#endif 2069#else 2070color=image_color; 2071#endif 2072#ifdef FOG 2073#ifdef ZERO_EXAGGERATION 2074color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2075#else 2076color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 2077#endif 2078#endif 2079glFragColor=color; 2080#ifdef OVERDRAW_INSPECTOR 2081glFragColor=vec4(1.0); 2082#endif 2083HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2084#include "_prelude_terrain.vertex.glsl" 2085uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 2086#ifdef FOG 2087out float v_fog_opacity; 2088#endif 2089#ifdef RENDER_SHADOWS 2090uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth; 2091#endif 2092void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); 2093#ifdef FOG 2094#ifdef ZERO_EXAGGERATION 2095v_fog_pos=fog_position(decodedPos); 2096#else 2097v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 2098#endif 2099#endif 2100#ifdef RENDER_SHADOWS 2101vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); 2102#endif 2103}`),terrainDepth:bi("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 2104uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:bi(`#include "_prelude_fog.fragment.glsl" 2105in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3
2105 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( 2106cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; 2107#ifdef FOG 2108sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 2109#endif 2110sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 2111#ifdef OVERDRAW_INSPECTOR 2112glFragColor=vec4(1.0); 2113#endif 2114}`,Ca),skyboxGradient:bi(`#include "_prelude_fog.fragment.glsl" 2115in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); 2116#ifdef FOG 2117color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 2118#endif 2119color*=u_opacity;glFragColor=color; 2120#ifdef OVERDRAW_INSPECTOR 2121glFragColor=vec4(1.0); 2122#endif 2123}`,Ca),skyboxCapture:bi
vendor: 3,792 bytes, lines 2123-2134
2123(` 2124in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; 2125#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 2126#define BETA_M vec3(21e-6,21e-6,21e-6) 2127#define MIE_G 0.76 2128#define DENSITY_HEIGHT_SCALE_R 8000.0 2129#define DENSITY_HEIGHT_SCALE_M 1200.0 2130#define PLANET_RADIUS 6360e3 2131#define ATMOSPHERE_RADIUS 6420e3 2132#define SAMPLE_STEPS 10 2133#define DENSITY_STEPS 4 2134float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2134Raster:bi(`#include "_prelude_fog.fragment.glsl" 2135#include "_prelude_lighting.glsl" 2136uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; 2137#ifndef FOG 2138uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; 2139#endif 2140void main() {vec4 color; 2141#ifdef CUSTOM_ANTIALIASING 2142highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 2143mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); 2144#ifdef LIGHTING_3D_MODE 2145#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2146raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 2147#else 2148raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 2149#endif 2150#else 2151color=vec4(raster.rgb*antialias,raster.a*antialias); 2152#endif 2153#else 2154color=texture(u_image0,v_pos0); 2155#ifdef LIGHTING_3D_MODE 2156#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2157color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; 2158#else 2159color=apply_lighting_ground(color); 2160#endif 2161#endif 2162#endif 2163#ifdef FOG 2164color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2165#endif 2166color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 2167#ifdef OVERDRAW_INSPECTOR 2168glFragColor=vec4(1.0); 2169#endif 2170HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2171#include "_prelude_terrain.vertex.glsl" 2172uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; 2173#ifdef GLOBE_POLES 2174in vec3 a_globe_pos;in vec2 a_uv; 2175#else 2176in vec2 a_pos; 2177#endif 2178out vec2 v_pos0;void main() { 2179#ifdef GLOBE_POLES 2180vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2181#else 2182float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); 2183#endif 2184v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2185#ifdef GLOBE_POLES 2186vec3 up_vector=globe_derived_up_vector; 2187#else 2188vec3 up_vector=elevationVector(tile_pos); 2189#endif 2190float height=elevation(tile_pos);globe_pos+=up_vector*height; 2191#ifndef GLOBE_POLES 2192globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2193#endif 2194#ifdef GLOBE_POLES 2195vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2196#else 2197vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); 2198#endif 2199gl_Position=u_proj_matrix*interpolated_pos; 2200#ifdef FOG 2201v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2202#endif 2203}`),globeAtmosphere:bi(`#include "_prelude_fog.fragment.glsl" 2204uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 2205#ifdef PROJECTION_GLOBE_VIEW 2206globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { 2207#ifdef ALPHA_PASS 2208glFragColor=vec4(0,0,0,0);return; 2209#else 2210#ifdef NATIVE 2211glFragColor=vec4(1,1,1,1); 2212#else 2213glFragColor=vec4(0,0,0,1); 2214#endif 2215return; 2216#endif 2217} 2218#endif 2219highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 22200.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2221#ifdef PROJECTION_GLOBE_VIEW 2222highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? 2223PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); 2224#else 2225horizon_angle=horizon_angle_mercator; 2226#endif 2227horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2227vec3 color_stop_2=u_space_color.rgb; 2228#ifdef ALPHA_PASS 2229float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); 2230#else 2231vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); 2232#endif 2233}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( 2234mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( 2235mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:bi(`#include "_prelude_fog.fragment.glsl" 2236#include "_prelude_shadow.fragment.glsl" 2237#include "_prelude_lighting.glsl" 2238uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; 2239#ifdef RENDER_SHADOWS 2240in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2241#endif 2242#ifdef OCCLUSION_TEXTURE_TRANSFORM 2243uniform vec4 u_occlusionTextureTransform; 2244#endif 2245#pragma mapbox: define-attribute highp vec3 normal_3f 2246#pragma mapbox: define-attribute highp vec3 color_3f 2247#pragma mapbox: define-attribute highp vec4 color_4f 2248#pragma mapbox: define-attribute highp vec2 uv_2f 2249#pragma mapbox: initialize-attribute highp vec3 normal_3f 2250#pragma mapbox: initialize-attribute highp vec3 color_3f 2251#pragma mapbox: initialize-attribute highp vec4 color_4f 2252#pragma mapbox: initialize-attribute highp vec2 uv_2f 2253#ifdef HAS_ATTRIBUTE_a_pbr 2254in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2255#endif 2256#ifdef HAS_TEXTURE_u_baseColorTexture 2257uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 2258#endif 2259#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2260uniform sampler2D u_metallicRoughnessTexture; 2261#endif 2262#ifdef HAS_TEXTURE_u_occlusionTexture 2263uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2264#endif 2265#ifdef HAS_TEXTURE_u_normalTexture 2266uniform sampler2D u_normalTexture; 2267#endif 2268#ifdef HAS_TEXTURE_u_emissionTexture 2269uniform sampler2D u_emissionTexture; 2270#endif 2271#ifdef APPLY_LUT_ON_GPU 2272uniform highp sampler3D u_lutTexture; 2273#endif 2274#ifdef TERRAIN_FRAGMENT_OCCLUSION 2275in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2276#ifdef DEPTH_D24 2277highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2278#else 2279highp float unpack_depth_rgba(highp vec4 rgba_depth) 2280{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 2281#endif 2282bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2283#ifdef DEPTH_D24 2284highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2285#else 2286highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2287#endif 2288return v_depth > depth+0.0005;} 2289#endif 2290#define saturate(_x) clamp(_x,0.,1.) 2291vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) 2292{ 2293#ifdef LIGHTING_3D_MODE 2294vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2295#ifdef RENDER_SHADOWS 2296lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2297#else 2298lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2299#endif 2300return apply_lighting(albedo,transformed_normal,lighting_factor); 2301#else 2302vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2302Color),vec3(1.0));return c3; 2303#endif 2304}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2305#ifdef HAS_ATTRIBUTE_a_color_3f 2306albedo*=vec4(color_3f,1.0); 2307#endif 2308#ifdef HAS_ATTRIBUTE_a_pbr 2309#else 2310#ifdef HAS_ATTRIBUTE_a_color_4f 2311albedo*=color_4f; 2312#endif 2313#endif 2314#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2315vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2316#ifdef UNPREMULT_TEXTURE_IN_SHADER 2317if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 2318#endif 2319if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2320#endif 2321vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2322#ifdef APPLY_LUT_ON_GPU 2323color=applyLUT(u_lutTexture,color); 2324#endif 2325return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2326#ifdef HAS_TEXTURE_u_normalTexture 2327highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; 2328#else 2329return mat3(1.0); 2330#endif 2331}highp vec3 getNormal(){highp vec3 n; 2332#ifdef HAS_ATTRIBUTE_a_normal_3f 2333n=normalize(normal_3f); 2334#else 2335highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0; 2336#endif 2337#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2338vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); 2339#endif 2340return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; 2341#ifdef HAS_ATTRIBUTE_a_pbr 2342mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2343#endif 2344#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2345vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2346#endif 2347const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) 2348{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) 2349{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2350{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) 2351{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) 2352{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) 2353{ 2354#ifdef LIGHTING_3D_MODE 2355return mat.diffuseColor; 2356#else 2357return mat.diffuseColor/PI; 2358#endif 2359}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2360{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) 2361{vec3 env_light=vec3(0.65,0.65,0.65); 2362#ifdef LIGHTING_3D_MODE 2363float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2364#endif 2365vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) 2366{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; 2367#ifdef RENDER_SHADOWS 2368lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2369#else 2370lighting_factor=NdotL; 2371#endif 2372vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2372Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2373#if !defined(LIGHTING_3D_MODE) 2374const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); 2375#endif 2376color*=intensityFactor;return color;}void main() { 2377#ifdef TERRAIN_FRAGMENT_OCCLUSION 2378if (isOccluded()) {discard;} 2379#endif 2380vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 2381#ifdef LIGHTING_3D_MODE 2382lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2383#endif 2384vec4 finalColor; 2385#ifdef DIFFUSE_SHADED 2386vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2387#ifdef HAS_TEXTURE_u_occlusionTexture 2388float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2389#endif 2390finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2391#else 2392Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2393#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2394#ifdef OCCLUSION_TEXTURE_TRANSFORM 2395vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2396#else 2397vec2 uv=uv_2f; 2398#endif 2399ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2400#endif 2401vec4 emissive=u_emissiveFactor; 2402#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2403emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2404#endif 2405#ifdef APPLY_LUT_ON_GPU 2406float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2407#endif 2408color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2409#ifdef HAS_ATTRIBUTE_a_pbr 2410float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; 2411#ifdef APPLY_LUT_ON_GPU 2412color_mix=applyLUT(u_lutTexture,color_mix); 2413#endif 2414color=mix(color,color_mix,min(1.0,resEmission)); 2415#ifdef HAS_ATTRIBUTE_a_color_4f 2416float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2416y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); 2417#endif 2418#endif 2419vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2420#endif 2421#ifdef FOG 2422finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2423#endif 2424#ifdef RENDER_CUTOFF 2425finalColor*=v_cutoff_opacity; 2426#endif 2427#ifdef INDICATOR_CUTOUT 2428finalColor=applyCutout(finalColor,v_position_height.w); 2429#endif 2430glFragColor=finalColor; 2431#ifdef OVERDRAW_INSPECTOR 2432glFragColor=vec4(1.0); 2433#endif 2434HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2435#include "_prelude_shadow.vertex.glsl" 2436in vec3 a_pos_3f; 2437#pragma mapbox: define-attribute highp vec3 normal_3f 2438#pragma mapbox: define-attribute highp vec2 uv_2f 2439#pragma mapbox: define-attribute highp vec3 color_3f 2440#pragma mapbox: define-attribute highp vec4 color_4f 2441#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 2442#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2443uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2444#ifdef INSTANCED_ARRAYS 2445in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2446#else 2447uniform highp mat4 u_normal_matrix; 2448#endif 2449#ifdef RENDER_SHADOWS 2450uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; 2451#endif 2452out vec4 v_position_height;out lowp vec4 v_color_mix; 2453#ifdef TERRAIN_FRAGMENT_OCCLUSION 2454out highp float v_depth; 2455#endif 2456#ifdef HAS_ATTRIBUTE_a_pbr 2457out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2458#endif 2459vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2460#pragma mapbox: initialize-attribute highp vec3 normal_3f 2461#pragma mapbox: initialize-attribute highp vec2 uv_2f 2462#pragma mapbox: initialize-attribute highp vec3 color_3f 2463#pragma mapbox: initialize-attribute highp vec4 color_4f 2464#pragma mapbox: initialize-attribute-custom highp vec4 pbr 2465#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2466highp mat4 normal_matrix; 2467#ifdef INSTANCED_ARRAYS 2468normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2469#else 2470normal_matrix=u_normal_matrix; 2471#endif 2472vec3 local_pos;mat3 rs; 2473#ifdef MODEL_POSITION_ON_GPU 2474vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; 2475#else 2476local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); 2477#endif 2478v_position_height.w=a_pos_3f.z; 2479#ifdef HAS_ATTRIBUTE_a_pbr 2480vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; 2481#endif 2482#ifdef FOG 2483v_fog_pos=fog_position(local_pos); 2484#endif 2485#ifdef RENDER_CUTOFF 2486v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2487#endif 2488#ifdef TERRAIN_FRAGMENT_OCCLUSION 2489v_depth=gl_Position.z/gl_Position.w; 2490#endif 2491#ifdef HAS_ATTRIBUTE_a_normal_3f 2492#ifdef MODEL_POSITION_ON_GPU 2493float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); 2494#else
2495normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2496#endif 2497#endif 2498#ifdef HAS_ATTRIBUTE_a_pbr 2499#ifdef HAS_ATTRIBUTE_a_color_4f 2500v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); 2501#endif 2502#endif 2503#ifdef RENDER_SHADOWS 2504vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2505#ifdef NORMAL_OFFSET 2506#ifdef HAS_ATTRIBUTE_a_normal_3f 2507#ifdef MODEL_POSITION_ON_GPU 2508vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2509#else 2510vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2511#endif 2512#endif 2513#endif 2514v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; 2515#endif 2516}`),modelDepth:bi(`in highp float v_depth;void main() { 2517#ifndef DEPTH_TEXTURE 2518glFragColor=pack_depth(v_depth); 2519#endif 2520}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 2521#ifdef MODEL_POSITION_ON_GPU 2522#ifdef INSTANCED_ARRAYS 2523in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2524#else 2525uniform highp mat4 u_instance; 2526#endif 2527uniform highp mat4 u_node_matrix; 2528#endif 2529void main() { 2530#ifdef MODEL_POSITION_ON_GPU 2531highp mat4 instance; 2532#ifdef INSTANCED_ARRAYS 2533instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2534#else 2535instance=u_instance; 2536#endif 2537vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2537rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); 2538#else 2539gl_Position=u_matrix*vec4(a_pos_3f,1); 2540#endif 2541v_depth=gl_Position.z/gl_Position.w;}`),stars:bi(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2542{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` 2543in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:bi("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` 2544in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 2545uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 2546uniform float u_horizontalOscillationRate; 2547uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ 2548localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:bi("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` 2549in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 2550uniform float u_velocity; 2551uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
2551pos*=halfBoxSize; 2552pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ 2553localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:bi("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:bi("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 2554in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; 2555#ifdef TERRAIN 2556float e=elevation(world_pos.xy);world_pos.z+=e; 2557#endif 2558vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function ls(l,t){const n=l.replace(/\s*\/\/[^\n]*\n/g,` 2559`).split(` 2560`);for(let c of n)if(c=c.trim(),c[0]==="#"&&c.includes("if")&&!c.includes("endif")){c=c.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=c.split(" ");for(const p of d)t.includes(p)||t.push(p)}}function bi(l,t){const n=/#include\s+"([^"]+)"/g,c=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map(T=>{const S=T.split(" ");return S[S.length-1]}),d=[...new Set(d)]);const p={},m=[],y=[];if(l=l.replace(n,(T,S)=>(y.push(S),"")),(t=t.replace(n,(T,S)=>(m.push(S),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let x=[...Ra];ls(l,x),ls(t,x);for(const T of[...m,...y])za[T]||console.error(`Undefined include: ${T}`),kl[T]||(kl[T]=[],ls(za[T],kl[T])),x=[...x,...kl[T]];return{fragmentSource:l=l.replace(c,(T,S,M,I,C)=>(p[C]=!0,S==="define"?` 2561#ifndef HAS_UNIFORM_u_${C} 2562in ${M} ${I} ${C}; 2563#else 2564uniform ${M} ${I} u_${C}; 2565#endif 2566`:S==="initialize"?` 2567#ifdef HAS_UNIFORM_u_${C} 2568 ${M} ${I} ${C} = u_${C}; 2569#endif 2570`:S==="define-attribute"?` 2571#ifdef HAS_ATTRIBUTE_a_${C} 2572 in ${M} ${I} ${C}; 2573#endif 2574`:S==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(c,(T,S,M,I,C)=>{const L=I==="float"?"vec2":I,z=C.match(/color/)?"color":L;return S==="define-attribute-vertex-shader-only"?` 2575#ifdef HAS_ATTRIBUTE_a_${C} 2576in ${M} ${I} a_${C}; 2577#endif 2578`:p[C]?S==="define"?` 2579#ifndef HAS_UNIFORM_u_${C} 2580uniform lowp float u_${C}_t; 2581in ${M} ${L} a_${C}; 2582out ${M} ${I} ${C}; 2583#else 2584uniform ${M} ${I} u_${C}; 2585#endif 2586`:S==="initialize"?z==="vec4"?` 2587#ifndef HAS_UNIFORM_u_${C} 2588 ${C} = a_${C}; 2589#else 2590 ${M} ${I} ${C} = u_${C}; 2591#endif 2592`:` 2593#ifndef HAS_UNIFORM_u_${C} 2594 ${C} = unpack_mix_${z}(a_${C}, u_${C}_t); 2595#else 2596 ${M} ${I} ${C} = u_${C}; 2597#endif 2598`:S==="define-attribute"?` 2599#ifdef HAS_ATTRIBUTE_a_${C} 2600 in ${M} ${I} a_${C}; 2601 out ${M} ${I} ${C}; 2602#endif 2603`:S==="initialize-attribute"?` 2604#ifdef HAS_ATTRIBUTE_a_${C} 2605 ${C} = a_${C}; 2606#endif 2607`:void 0:S==="define"?` 2608#ifndef HAS_UNIFORM_u_${C} 2609uniform lowp float u_${C}_t; 2610in ${M} ${L} a_${C}; 2611#else 2612uniform ${M} ${I} u_${C}; 2613#endif 2614`:S==="define-instanced"?z==="mat4"?` 2615#ifdef INSTANCED_ARRAYS 2616in vec4 a_${C}0; 2617in vec4 a_${C}1; 2618in vec4 a_${C}2; 2619in vec4 a_${C}3; 2620#else 2621uniform ${M} ${I} u_${C}; 2622#endif 2623`:` 2624#ifdef INSTANCED_ARRAYS 2625in ${M} ${L} a_${C}; 2626#else 2627uniform ${M} ${I} u_${C}; 2628#endif 2629`:S==="initialize-attribute-custom"?` 2630#ifdef HAS_ATTRIBUTE_a_${C} 2631 ${M} ${I} ${C} = a_${C}; 2632#endif 2633`:z==="vec4"?` 2634#ifndef HAS_UNIFORM_u_${C} 2635 ${M} ${I} ${C} = a_${C}; 2636#else 2637 ${M} ${I} ${C} = u_${C}; 2638#endif 2639`:` 2640#ifndef HAS_UNIFORM_u_${C} 2641 ${M} ${I} ${C} = unpack_mix_${z}(a_${C}, u_${C}_t); 2642#else 2643 ${M} ${I} ${C} = u_${C}; 2644#endif 2645`}),staticAttributes:d,usedDefines:x,vertexIncludes:m,fragmentIncludes:y}}class Da{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,n,c,d,p,m,y,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let M=0;!T&&M<d.length;M++)this.boundPaintVertexBuffers[M]!==d[M]&&(T=!0);let S=this.boundDynamicVertexBuffers.length!==y.length;for(let M=0;!S&&M<y.length;M++)this.boundDynamicVertexBuffers[M]!==y[M]&&(S=!0);if(!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==c||T||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(n,c,d,p,m,y,x);else{t.bindVertexArrayOES.set(this.vao);for(const M of y)M&&(M.bind(),x&&M.instanceCount&&M.setVertexAttribDivisor(t.gl,n,x));p&&p.dynamicDraw&&p.bind()}}
vendor: 11,080 bytes, line 2645
2645freshBind(t,n,c,d,p,m,y){const x=t.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,n.enableAttributes(S,t),n.bind(),n.setVertexAttribPointers(S,t,p);for(const M of c)M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,p);for(const M of m)M&&(M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,p),y&&M.instanceCount&&M.setVertexAttribDivisor(S,t,y));d&&d.bind(),T.currentNumAttributes=x}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Wf(l,t){const n=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new o.ac(0,c/n).toLngLat().lat,new o.ac(0,(c+1)/n).toLngLat().lat]}function Xf(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=n.hillshadeFBO;if(!T)return;l.prepareDrawTile();const S=l.isTileAffectedByFog(t),M=l.getOrCreateProgram("hillshade",{overrideFog:S});y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,T.colorAttachment.get());const I=((k,B,V,H)=>{const Y=V.paint.get("hillshade-shadow-color"),te=V.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ee=V.paint.get("hillshade-highlight-color"),J=V.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",K=V.paint.get("hillshade-accent-color"),ie=V.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ne=V.paint.get("hillshade-emissive-strength");let fe=o.al(V.paint.get("hillshade-illumination-direction"));if(V.paint.get("hillshade-illumination-anchor")==="viewport")fe-=k.transform.angle;else if(k.style&&k.style.enable3dLights()&&k.style.directionalLight){const Me=k.style.directionalLight.properties.get("direction"),Ce=o.cR(Me.x,Me.y,Me.z);fe=o.al(Ce[1])}const _e=!k.options.moving;return{u_matrix:H||k.transform.calculateProjMatrix(B.tileID.toUnwrapped(),_e),u_image:0,u_latrange:Wf(0,B.tileID),u_light:[V.paint.get("hillshade-exaggeration"),fe],u_shadow:Y.toPremultipliedRenderColor(te?null:V.lut),u_highlight:ee.toPremultipliedRenderColor(J?null:V.lut),u_emissive_strength:ne,u_accent:K.toPremultipliedRenderColor(ie?null:V.lut)}})(l,n,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(y,M,t.toUnwrapped());const{tileBoundsBuffer:C,tileBoundsIndexBuffer:L,tileBoundsSegments:z}=l.getTileBoundsBuffers(n);M.draw(l,x.TRIANGLES,d,p,m,zt.disabled,I,c.id,C,L,z)}function Gc(l,t,n){if(!t.needsDEMTextureUpload)return;const c=l.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(n.stride);const p=n.getPixels();t.demTexture?t.demTexture.update(p,{premultiply:!1}):t.demTexture=new o.T(c,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function Yf(l,t,n){const c=l.context,d=c.gl;if(!t.dem)return;const p=t.dem;if(c.activeTexture.set(d.TEXTURE1),Gc(l,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const I=new o.T(c,{width:m,height:m,data:null},d.RGBA8);I.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(m,m,!0,"renderbuffer"),y.colorAttachment.set(I.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=l.getMercatorTileBoundsBuffers(),M=[];l.linearFloatFilteringSupported()&&M.push("TERRAIN_DEM_FLOAT_FORMAT"),l.getOrCreateProgram("hillshadePrepare",{defines:M}).draw(l,d.TRIANGLES,nt.disabled,$t.disabled,ui.unblended,zt.disabled,((I,C)=>{const L=C.stride,z=o.bz();return o.c5(z,0,o.aj,-8192,0,0,1),o.bo(z,z,[0,-8192,0]),{u_matrix:z,u_image:1,u_dimension:[L,L],u_zoom:I.overscaledZ}})(t.tileID,p),n.id,x,T,S),t.needsHillshadePrepare=!1}class vr{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Wd extends vr{getDefault(){return o.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class hh extends vr{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Kf extends vr{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Jf extends vr{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Qf extends vr{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class em extends vr{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Xd extends vr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class tm extends vr{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class $c extends vr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class im extends vr{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Yd extends vr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class dh extends vr{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class qc extends vr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class ph extends vr{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Yo extends vr{getDefault(){return o.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class La extends vr{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class Hc extends vr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Zc extends vr{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class ka extends vr{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Kd=class extends vr{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class fh extends vr{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Jd extends vr{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Fa extends vr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Wc extends vr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Xc extends vr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class mh extends vr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Yc extends vr{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ol extends vr{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Qd extends vr{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class ep extends vr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class tp extends vr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class mo extends vr{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ip extends mo{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class rp extends mo{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,this.attachment(),n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class rm extends mo{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,this.attachment(),n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class nm extends rp{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const _h=(l,t,n)=>({u_matrix:l,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:n}),Kc=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:n,u_zoom_transition:d,u_merc_center:p,u_image0:0,u_frustum_tl:m,u_frustum_tr:y,u_frustum_br:x,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:M,u_viewport:I,u_grid_matrix:z?Float32Array.from(z):new Float32Array(9),u_skirt_height:C,u_far_z_cutoff:L});
2645function Jc(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const _o=new class{constructor(){this.operations={}}newMorphing(l,t,n,c,d){if(l in this.operations){const p=this.operations[l];p.to.tileID.key!==n.tileID.key&&(p.queued=n)}else this.operations[l]={startTime:c,phase:0,duration:d,from:t,to:n,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const t=this.operations[l];return{from:t.from,to:t.to,phase:t.phase}}update(l){for(const t in this.operations){const n=this.operations[t];for(n.phase=(l-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,l)){delete this.operations[t];break}}}_nextOp(l,t){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=t,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},gh={0:null,1:"TERRAIN_VERTEX_MORPHING"};function yh(l,t,n){if(t===0)return 0;const c=t<1&&n===514?.25/t:1;return 6*Math.pow(1.5,22-l)*Math.max(t,1)*c}function sm(l,t){const n=1<<l.z;return!t&&(l.x===0||l.x===n-1)||l.y===0||l.y===n-1}const Ko=l=>({u_matrix:l});function Jo(l,t,n,c,d){if(d>0){const p=o.q.now(),m=(p-l.timeAdded)/d,y=t?(p-t.timeAdded)/d:-1,x=n.getSource(),T=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),M=S&&l.refreshedUponExpiration?1:o.ay(S?m:1-y,0,1);return l.refreshedUponExpiration&&m>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-M}:{opacity:M,mix:0}}return{opacity:1,mix:0}}class np extends Dn{constructor(t){const n={type:"raster-dem",maxzoom:t.transform.maxZoom},c=new o.D(o.c$(),null),d=_l("mock-dem",n,c,t.style);super("mock-dem",d,!1),d.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,n){t.state="loaded",n(null)}}class Kn extends Dn{constructor(t){const n=_l("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new o.D(o.c$(),null),t.style);super("proxy",n,!1),n.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,n,c){if(t.freezeTileCoverage)return;this.transform=t;const d=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((p,m)=>{if(p[m.key]="",!this._tiles[m.key]){const y=new No(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[m.key]=y}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const n=this.proxyCachedFBO[t];if(n!==void 0){const c=Object.values(n);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Qc extends o.aM{constructor(t,n,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=n,this.projMatrix=c}}class Bl extends o.dt{constructor(t,n){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,p]=function(x){const T=new o.ba,S=new o.a_,M=131;T.reserve(17161),S.reserve(33800);const I=o.aj/128,C=o.aj+I/2,L=C+I;for(let k=-64;k<L;k+=I)for(let B=-64;B<L;B+=I){const V=B<0||B>C||k<0||k>C?24575:0,H=o.ay(Math.round(B),0,o.aj),Y=o.ay(Math.round(k),0,o.aj);T.emplaceBack(H+V,Y)}const z=(k,B)=>{const V=B*M+k;S.emplaceBack(V+1,V,V+M),S.emplaceBack(V+M,V+M+1,V+1)};for(let k=1;k<129;k++)for(let B=1;B<129;B++)z(B,k);return[0,129].forEach(k=>{for(let B=0;B<130;B++)z(B,k),z(k,B)}),[T,S,32768]}(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,o.bc.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=o.bd.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=o.bd.simpleSegment(0,0,c.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Kn(n.map),this.orthoMatrix=o.bz(),o.c5(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,o.aj,0,o.aj,0,1);const y=m.gl;this._overlapStencilMode=new $t({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new np(n.map),this._pendingGroundEffectLayers=[]}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,n,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=o.q.now();const y=t.terrain&&t.terrain.scope,x=d.get("source"),T=p?this._mockSourceCache:t.getSourceCache(x,y);if(!T)return void o.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(n):d.get("exaggeration"),!n.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&o.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 2646This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const M=this.getScaledDemTileSize();this.sourceCache.update(n,M,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),n.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0,this._previousZoom=n.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const n=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=n!=null?c-n:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const p=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(p);let y=p-this._previousZoom;const x=this._previousUpdateTimestamp;let T=p;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(p-T)>.5&&(y=.5*(p-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const S=m.getExaggeration(T),M=S===m.getExaggeration(Math.max(0,T-.1));if(M&&Math.abs(S-this._exaggeration)<.01)return S;let I=Math.min(.1,.00375*(this._updateTimestamp-x));return(M||S<.1||Math.abs(y)<1e-4)&&(I=Math.min(.2,4*I)),o.ai(this._exaggeration,S,I)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.coord&&t.dataType==="source"?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(o.ac.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=n.getIds().map(x=>{const T=n.getTileByID(x).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T});(function(x,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),M=new o.P(S.x,S.y);x.sort((I,C)=>
vendor: 4,617 bytes, line 2646
2646{if(C.overscaledZ-I.overscaledZ)return C.overscaledZ-I.overscaledZ;const L=new o.P(I.canonical.x+(1<<I.canonical.z)*I.wrap,I.canonical.y),z=new o.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),k=M.mult(1<<I.canonical.z);return k.x-=.5,k.y-=.5,k.distSqr(L)-k.distSqr(z)})})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach(x=>{this.proxyToSource[x.key]={}}),this.terrainTileForTile={};const m=this._style._mergedSourceCaches;for(const x in m){const T=m[x];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[x],p),T.usedForTerrain))continue;const S=t[x];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[n.id]=d.map(x=>new Qc(x,x.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const T=this.terrainTileForTile[x.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(t){this._initializing||t.forEach(n=>{if(this.terrainTileForTile[n.key])return;const c=this._findTileCoveringTileID(n,this.sourceCache);c&&(this.terrainTileForTile[n.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,n=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(n.TEXTURE1),Gc(this.painter,d,p))}}_prepareDemTileUniforms(t,n,c,d){if(!n||n.demTexture==null)return!1;const p=t.tileID.canonical,m=Math.pow(2,n.tileID.canonical.z-p.z),y=d||"";return c[`u_dem_tl${y}`]=[p.x*m%1,p.y*m%1],c[`u_dem_scale${y}`]=m,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const n=this._visibleDemTiles.reduce((c,d)=>{if(!d.dem)return c;const p=d.dem.tree.minimums[0];return p>0&&t++,c+p},0);return t?n/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,n=t.gl;t.activeTexture.set(n.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new o.du({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let p=this._emptyDEMTexture;return p?p.update(d,{premultiply:!1}):p=this._emptyDEMTexture=new o.T(t,d,n.R32F,{premultiply:!1}),p}setupElevationDraw(t,n,c){const d=this.painter.context,p=d.gl,m={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};m.u_exaggeration=this.exaggeration();let y=null,x=null,T=1;if(c&&c.morphing&&this._useVertexMorphing){const C=c.morphing.srcDemTile,L=c.morphing.dstDemTile;T=c.morphing.phase,C&&L&&(this._prepareDemTileUniforms(t,C,m,"_prev")&&(x=C),this._prepareDemTileUniforms(t,L,m)&&(y=L))}const S=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let M=null;var I;if(this.enabled?x&&y?(M=y.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(S(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],M=this._prepareDemTileUniforms(t,y,m)?y.demTexture:this.emptyDEMTexture):M=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),M&&(m.u_dem_size=(I=M).size[0]===1?1:I.size[0]-2,M.bind(S(y),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,n,m),c&&c.useMeterToDem&&y){const C=(1<<y.tileID.canonical.z)*o.c6(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=C}if(c&&c.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),n.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const C=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);n.setGlobeUniformValues(d,C)}}globeUniformValues(t,n,c){const d=t.projection;return{u_tile_tl_up:d.upVector(n,0,0),u_tile_tr_up:d.upVector(n,o.aj,0),u_tile_br_up:d.upVector(n,o.aj,o.aj),u_tile_bl_up:d.upVector(n,0,o.aj),u_tile_up_scale:c?o.dv(1):d.upVectorScale(n,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const n=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),n.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(d,p,m,y,x){if(d.transform.projection.name==="globe")(function(T,S,M,I,C){const L=T.context,z
2646=L.gl;let k,B;const V=T.transform,H=o.dl(T,L,V),Y=(Me,Ce)=>{if(B===Ce)return;const Fe=[gh[Ce],"PROJECTION_GLOBE_VIEW"];H&&Fe.push("CUSTOM_ANTIALIASING");const de=T.isTileAffectedByFog(Me);k=T.getOrCreateProgram("globeRaster",{defines:Fe,overrideFog:de}),B=Ce},te=T.colorModeForRenderPass(),ee=new nt(z.LEQUAL,nt.ReadWrite,T.depthRangeFor3D);_o.update(C);const J=o.dm(V),K=[o.aD(V.center.lng),o.aH(V.center.lat)],ie=T.globeSharedBuffers,ne=[V.width*o.q.devicePixelRatio,V.height*o.q.devicePixelRatio],fe=Float32Array.from(V.globeMatrix),_e={useDenormalizedUpVectorScale:!0};{const Me=T.transform,Ce=yh(Me.zoom,S.exaggeration(),S.sourceCache._source.tileSize);B=-1;const Fe=z.TRIANGLES;for(const de of I){const Te=M.getTile(de),le=$t.disabled,Re=S.prevTerrainTileForTile[de.key],xe=S.terrainTileForTile[de.key];Jc(Re,xe)&&_o.newMorphing(de.key,Re,xe,C,250),L.activeTexture.set(z.TEXTURE0),Te.texture&&Te.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const Le=_o.getMorphValuesForProxy(de.key),qe=Le?1:0;Le&&o.L(_e,{morphing:{srcDemTile:Le.from,dstDemTile:Le.to,phase:o.dk(Le.phase)}});const Pe=o.dn(de.canonical),Ge=o.dp(Pe.getCenter().lat),ot=o.dq(de.canonical,Pe,Ge,Me.worldSize/Me._pixelsPerMercatorPixel),at=o.bh(o.dr(de.canonical)),rt=Kc(Me.expandedFarZProjMatrix,fe,J,at,o.ah(Me.zoom),K,Me.frustumCorners.TL,Me.frustumCorners.TR,Me.frustumCorners.BR,Me.frustumCorners.BL,Me.globeCenterInViewSpace,Me.globeRadius,ne,Ce,Me._farZ,ot);if(Y(de,qe),k&&(S.setupElevationDraw(Te,k,_e),T.uploadCommonUniforms(L,k,de.toUnwrapped()),ie)){const[mt,gt,bt]=ie.getGridBuffers(Ge,Ce!==0);k.draw(T,Fe,ee,le,te,zt.backCCW,rt,"globe_raster",mt,gt,bt)}}}if(ie&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const Me=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];H&&Me.push("CUSTOM_ANTIALIASING"),k=T.getOrCreateProgram("globeRaster",{defines:Me});for(const Ce of I){const{x:Fe,y:de,z:Te}=Ce.canonical,le=de===0,Re=de===(1<<Te)-1,[xe,Le,qe,Pe]=ie.getPoleBuffers(Te,!1);if(Pe&&(le||Re)){const Ge=M.getTile(Ce);L.activeTexture.set(z.TEXTURE0),Ge.texture&&Ge.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let ot=o.ds(Te,Fe,V);const at=o.bh(o.dr(Ce.canonical)),rt=(mt,gt)=>mt.draw(T,z.TRIANGLES,ee,$t.disabled,te,zt.disabled,Kc(V.expandedFarZProjMatrix,ot,ot,at,0,K,V.frustumCorners.TL,V.frustumCorners.TR,V.frustumCorners.BR,V.frustumCorners.BL,V.globeCenterInViewSpace,V.globeRadius,ne,0,V._farZ),"globe_pole_raster",gt,qe,Pe);S.setupElevationDraw(Ge,k,_e),T.uploadCommonUniforms(L,k,Ce.toUnwrapped()),le&&T.renderDefaultNorthPole&&rt(k,xe),Re&&T.renderDefaultSouthPole&&(ot=o.cE(o.bz(),ot,[1,-1,1]),rt(k,Le))}}}})(d,p,m,y,x);else{const T=d.context,S=T.gl;let M,I;const C=d.shadowRenderer,L=Es(d,d.longestCutoffRange),z=te=>{if(I===te)return;const ee=[];ee.push(gh[te]),L.shouldRenderCutoff&&ee.push("RENDER_CUTOFF"),C&&(ee.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&ee.push("NORMAL_OFFSET")),M=d.getOrCreateProgram("terrainRaster",{defines:ee}),I=te},k=d.colorModeForRenderPass(),B=new nt(S.LEQUAL,nt.ReadWrite,d.depthRangeFor3D);_o.update(x);const V=d.transform,H=yh(V.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let Y=[0,0,0];if(C){const te=d.style.directionalLight,ee=d.style.ambientLight;te&&ee&&(Y=Wo(d.style,te,ee))}{I=-1;const te=S.TRIANGLES,[ee,J]=[p.gridIndexBuffer,p.gridSegments];for(const K of y){const ie=m.getTile(K),ne=$t.disabled,fe=p.prevTerrainTileForTile[K.key],_e=p.terrainTileForTile[K.key];Jc(fe,_e)&&_o.newMorphing(K.key,fe,_e,x,250),T.activeTexture.set(S.TEXTURE0),ie.texture&&ie.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const Me=_o.getMorphValuesForProxy(K.key),Ce=Me?1:0;let Fe;Me&&(Fe={morphing:{srcDemTile:Me.from,dstDemTile:Me.to,phase:o.dk(Me.phase)}});const de=_h(K.projMatrix,sm(K.canonical,V.renderWorldCopies)?H/10:H,Y);if(z(Ce),!M)continue;p.setupElevationDraw(ie,M,Fe);const Te=K.toUnwrapped();C&&C.setupShadows(Te,M),d.uploadCommonUniforms(T,M,Te,null,L),M.draw(d,te,B,ne,k,zt.backCCW,de,"terrain_raster",p.gridBuffer,ee,J)}}}}(n,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const n=this.painter,c=this.painter.context,d=this.proxySourceCache,p=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),y=n.style.order,x=[];let T=0;for(const S of p){const M=d.getTileByID(S.proxyTileKey),I=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][t]:void 0,C=I!==void 0?d.renderCache[I]:this.pool[T++],L=I!==void 0;if(M.texture=C.tex,L&&!C.dirty){x.push(M.tileID);continue}let z;c.bindFramebuffer.set(C.fb.framebuffer),this.renderedToTile=!1,C.dirty&&(c.clear({color:o.am.transparent,stencil:0}),C.dirty=!1);for(let k=m.start;k<=m.end;++k){const B=n.style._mergedLayers[y[k]];if(B.isHidden(n.transform.zoom))continue;const V=n.style.getLayerSourceCache(B),H=V?this.proxyToSource[S.key][V.id]:[S];if(!H)continue;const Y=H;
vendor: 11,041 bytes, line 2646
2646c.viewport.set([0,0,C.fb.width,C.fb.height]),z!==(V?V.id:null)&&(this._setupStencil(C,H,B,V),z=V?V.id:null),n.renderLayer(n,V,B,Y)}if(this._drapedRenderBatches.length===0)for(const k of this._pendingGroundEffectLayers){const B=n.style._mergedLayers[y[k]];if(B.isHidden(n.transform.zoom))continue;const V=n.style.getLayerSourceCache(B),H=V?this.proxyToSource[S.key][V.id]:[S];if(!H)continue;const Y=H;c.viewport.set([0,0,C.fb.width,C.fb.height]),z!==(V?V.id:null)&&(this._setupStencil(C,H,B,V),z=V?V.id:null),n.renderLayer(n,V,B,Y)}this.renderedToTile?(C.dirty=!0,x.push(M.tileID)):L||--T,T===5&&(T=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const n=t.order.length;let c=-1,d=n;for(let p=0;p<n;++p)this._style.isLayerDraped(t._mergedLayers[t.order[p]])?c=Math.max(c,p):d=Math.min(d,p);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(n=>n.dem).forEach(n=>{t=Math.min(t,n.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,n,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(p=>p.dem).map(p=>{const m=p.tileID,y=1<<m.overscaledZ,{x,y:T}=m.canonical,S=x/y,M=(x+1)/y,I=T/y,C=(T+1)/y;return{minx:S,miny:I,maxx:M,maxy:C,t:p.dem.tree.raycastRoot(S,I,M,C,t,n,c),tile:p}});d.sort((p,m)=>(p.t!==null?p.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE));for(const p of d){if(p.t==null)return null;const m=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,t,n,c);if(m!=null)return m}return null}_createFBO(){const t=this.painter.context,n=t.gl,c=this.drapeBufferSize;t.activeTexture.set(n.TEXTURE0);const d=new o.T(t,{width:c[0],height:c[1],data:null},n.RGBA8);d.bind(n.LINEAR,n.CLAMP_TO_EDGE);const p=t.createFramebuffer(c[0],c[1],!0,null);return p.colorAttachment.set(d.texture),p.depthAttachment=new nm(t,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:p,tex:d,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const n=this._style._mergedLayers[t],c=n.isHidden(this.painter.transform.zoom);return n.type==="hillshade"||n.type==="custom"?!c&&n.shouldRedrape():!c&&n.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof ml){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(p&&!n[p.id]&&!d.isHidden(this.painter.transform.zoom)&&d.type==="line"&&d.widthExpression()instanceof o.ab){n[p.id]=!0;for(const m of this.proxyCoords){const y=this.proxyToSource[m.key][p.id];if(y)for(const x of y)this._clearRenderCacheForTile(p.id,x)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof rn){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(!p||n[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const m=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const x=this.proxyToSource[y.key][p.id];if(x)for(const T of x){const S=Jo(p.getTile(T),p.findLoadedParent(T,0),p,this.painter.transform,m);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(p.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,n=t.length;if(n===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,p=0,m=this._style._mergedLayers[t[p]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++p<n;)m=this._style._mergedLayers[t[p]];for(;p<n;++p){const y=this._style._mergedLayers[t[p]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=p):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(c.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:p-1}),c.length!==0){const y=c[c.length-1];this._pendingGroundEffectLayers.every(x=>x>y.end)||o.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const n=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,n.renderCache.length>n.renderCachePool.length){const m=Object.values(n.proxyCachedFBO);n.proxyCachedFBO={};for(let y=0;y<m.length;++y){const x=Object.values(m[y]);n.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let m=c.length-1;m>=0;m--){const y=c[m];if(n.getTileByID(y.key),n.proxyCachedFBO[y.key]!==void 0){const x=t[y.key],T=this.proxyToSource[y.key];let S=0;for(const M in T){const I=T[M],C=x[M];if(!C||C.length!==I.length||I.some((L,z)=>L!==C[z]||d[M]&&d[M].hasOwnProperty(L.key))){S=-1;break}++S}for(const M in n.proxyCachedFBO[y.key])n.renderCache[n.proxyCachedFBO[y.key][M]].dirty=S<0||S!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort((m,y)=>y.end-y.start-(m.end-m.start));for(const m of p)for(const y of c){if(n.proxyCachedFBO[y.key])continue;let x=n.renderCachePool.pop();x===void 0&&n.renderCache.length<50&&(x=n.renderCache.length,n.renderCache.push(this._createFBO())),x!==void 0&&(n.proxyCachedFBO[y.key]={},n.proxyCachedFBO[y.key][m.start]=x,n.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,n,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,m=p.gl;if(n.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=n.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(n[0].overscaledZ>n[n.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(n,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):$t.disabled}_renderTileClippingMasks(t,n){const c=this.painter,d=this.painter.context,p=d.gl;c._tileClippingMaskIDs={},d.setColorMode(ui.disabled),d.setDepthMode(nt.disabled);const m=c.getOrCreateProgram("clippingMask");for(const y of t){const x=c._tileClippingMaskIDs[y.key]=--n;m.draw(c,p.TRIANGLES,nt.disabled,new $t({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),ui.disabled,zt.disabled,Ko(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const n=this.painter.transform;if(t.x<0||t.x>n.width||t.y<0||t.y>n.height)return null;const c=[t.x,t.y,1,1];o.aA(c,c,n.pixelMatrixInverse),o.cw(c,c,1/c[3]),c[0]/=n.worldSize,c[1]/=n.worldSize;const d=n._camera.position,p=o.c6(1,n.center.lat),m=[d[0],d[1],d[2]/p,0],y=o.cX([],c.slice(0,3),m);o.au(y,y);const x=this.raycast(m,y,this._exaggeration);return x!==null&&x?(o.bE(m,m,y,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,n,c){if(t.getSource()instanceof o.aP)return this._setupProxiedCoordsForImageSource(t,n,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const T=p[x],S=this._findTileCoveringTileID(T,t);if(S){const M=this._createProxiedId(T,S,c[T.key]&&c[T.key][t.id]);d.push(M),this.proxyToSource[T.key][t.id]=[M]}}let m=!1;const y=new Set;for(let x=0;x<n.length;x++){const T=t.getTile(n[x]);if(!T||!T.hasData())continue;const S=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==T.tileID.canonical.z){const M=this.proxyToSource[S.tileID.key][t.id],I=this._createProxiedId(S.tileID,T,c[S.tileID.key]&&c[S.tileID.key][t.id]);M?M.splice(M.length-1,0,I):this.proxyToSource[S.tileID.key][t.id]=[I];const C=this.proxyToSource[S.tileID.key][t.id];y.has(C)||y.add(C),d.push(I),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of y)x.sort((T,S)=>S.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(t,n,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),y=m.tileID;if(!y)return;const x=new o.P(y.x,y.y)._div(1<<y.z),T=m.coordinates.map(o.ac.fromLngLat).reduce((M,I)=>(M.min.x=Math.min(M.min.x,I.x-x.x),M.min.y=Math.min(M.min.y,I.y-x.y),M.max.x=Math.max(M.max.x,I.x-x.x),M.max.y=Math.max(M.max.y,I.y-x.y),M),{min:new o.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new o.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(M,I)=>{const C=M.wrap+M.canonical.x/(1<<M.canonical.z),L=M.canonical.y/(1<<M.canonical.z),z=o.aj/(1<<M.canonical.z),k=I.wrap+I.canonical.x/(1<<I.canonical.z),B=I.canonical.y/(1<<I.canonical.z);return C+z<k+T.min.x||C>k+T.max.x||L+z<B+T.min.y||L>B+T.max.y};for(let M=0;M<p.length;M++){const I=p[M];for(let C=0;C<n.length;C++){const L=t.getTile(n[C]);if(!L||!L.hasData()||S(I,L.tileID))continue;const z=this._createProxiedId(I,L,c[I.key]&&c[I.key][t.id]),k=this.proxyToSource[I.key][t.id];k?k.push(z):this.proxyToSource[I.key][t.id]=[z],d.push(z)}}}_createProxiedId(t,n,c){let d=this.orthoMatrix;if(c){const p=c.find(m=>m.key===n.tileID.key);if(p)return p}if(n.tileID.key!==t.key){const p=t.canonical.z-n.tileID.canonical.z;let m,y,x;d=o.bz();const T=n.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=o.aj>>p,y=m*((n.tileID.canonical.x<<p)-t.canonical.x+T),x=m*((n.tileID.canonical.y<<p)-t.canonical.y)):(m=o.aj<<-p,y=o.aj*(n.tileID.canonical.x-(t.canonical.x+T<<-p)),x=o.aj*(n.tileID.canonical.y-(t.canonical.y<<-p))),o.c5(d,0,m,0,m,0,1),o.bo(d,d,[y,x,0])}return new Qc(n.tileID,t.key,d)}_findTileCoveringTileID(t,n){let c=n.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[n.id],p=d[t.key];
2646if(c=p?n.getTileByID(p):null,c&&c.hasData()||p===null)return c;let m=c?c.tileID:t,y=m.overscaledZ;const x=n.getSource().minzoom,T=[];if(!p){const M=n.getSource().maxzoom;if(t.canonical.z>=M){const I=t.canonical.z-M;n.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,n.transform.tileZoom),m=new o.aM(y,t.wrap,M,t.canonical.x>>I,t.canonical.y>>I)):I!==0&&(y=M,m=new o.aM(y,t.wrap,M,t.canonical.x>>I,t.canonical.y>>I))}m.key!==t.key&&(T.push(m.key),c=n.getTile(m))}const S=M=>{T.forEach(I=>{d[I]=M}),T.length=0};for(y-=1;y>=x&&(!c||!c.hasData());y--){c&&S(c.tileID.key);const M=m.calculateScaledKey(y);if(c=n.getTileByID(M),c&&c.hasData())break;const I=d[M];if(I===null)break;I===void 0?T.push(M):c=n.getTileByID(I)}return S(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,n){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[n.key]=!0}}function eu(l,t,n){const c=function(y,x,T){const S=o.bG(x,y),M=o.bG(T,[.2126,.7152,.0722]),I=(L,z,k)=>(1-k)*L+k*z,C=I(1-.3*Math.min(M,1),1,Math.min(S+1,1));return I(.92,1,Math.asin(o.ay(x[2],-1,1))/Math.PI+.5)*C}(l,[0,0,1],t),d=[0,0,0];o.bY(d,n.slice(0,3),c);const p=[0,0,0];o.bY(p,t.slice(0,3),l[2]);const m=[0,0,0];return o.cV(m,d,p),o.cY(m)}const xh=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],vh=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class tu{static cacheKey(t,n,c,d){let p=`${n}${d?d.cacheKey:""}`;for(const m of c)t.usedDefines.includes(m)&&(p+=`/${m}`);return p}constructor(t,n,c,d,p,m){const y=t.gl;this.program=y.createProgram(),this.configuration=d,this.name=n,this.fixedDefines=[...m];const x=d?d.getBinderAttributes():[],T=(c.staticAttributes||[]).concat(x);let S=d?d.defines():[];S=S.concat(m.map(k=>`#define ${k}`));const M=`#version 300 es 2647`;let I=M+S.concat("precision mediump float;",Is,Fl.fragmentSource).join(` 2648`);for(const k of c.fragmentIncludes)I+=` 2649${za[k]}`;I+=` 2650${c.fragmentSource}`;let C=M+S.concat("precision highp float;",Is,Fl.vertexSource).join(` 2651`);for(const k of c.vertexIncludes)C+=` 2652${za[k]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(C+=` 2653uniform int u_instanceID; 2654`),C+=` 2655${c.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(C=C.replaceAll("gl_InstanceID","u_instanceID"));const L=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(L,I),y.compileShader(L),y.attachShader(this.program,L);const z=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())this.failedToCreate=!0;else{y.shaderSource(z,C),y.compileShader(z),y.attachShader(this.program,z),this.attributes={},this.numAttributes=T.length;for(let k=0;k<this.numAttributes;k++)if(T[k]){const B=T[k].startsWith("a_")?T[k]:`a_${T[k]}`;y.bindAttribLocation(this.program,k,B),this.attributes[B]=k}y.linkProgram(this.program),y.deleteShader(z),y.deleteShader(L),this.fixedUniforms=p(t),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(k=>({u_instanceID:new o.c8(k)}))(t)),(m.includes("TERRAIN")||n.indexOf("symbol")!==-1||n.indexOf("circle")!==-1)&&(this.terrainUniforms=(k=>({u_dem:new o.c8(k),u_dem_prev:new o.c8(k),u_dem_tl:new o.cb(k),u_dem_scale:new o.ca(k),u_dem_tl_prev:new o.cb(k),u_dem_scale_prev:new o.ca(k),u_dem_size:new o.ca(k),u_dem_lerp:new o.ca(k),u_exaggeration:new o.ca(k),u_depth:new o.c8(k),u_depth_size_inv:new o.cb(k),u_depth_range_unpack:new o.cb(k),u_occluder_half_size:new o.ca(k),u_occlusion_depth_offset:new o.ca(k),u_meter_to_dem:new o.ca(k),u_label_plane_matrix_inv:new o.cc(k)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(k=>({u_tile_tl_up:new o.c9(k),u_tile_tr_up:new o.c9(k),u_tile_br_up:new o.c9(k),u_tile_bl_up:new o.c9(k),u_tile_up_scale:new o.ca(k)}))(t)),m.includes("FOG")&&(this.fogUniforms=(k=>({u_fog_matrix:new o.cc(k),u_fog_range:new o.cb(k),u_fog_color:new o.cQ(k),u_fog_horizon_blend:new o.ca(k),u_fog_vertical_limit:new o.cb(k),u_fog_temporal_offset:new o.ca(k),u_frustum_tl:new o.c9(k),u_frustum_tr:new o.c9(k),u_frustum_br:new o.c9(k),u_frustum_bl:new o.c9(k),u_globe_pos:new o.c9(k),u_globe_radius:new o.ca(k),u_globe_transition:new o.ca(k),u_is_globe:new o.c8(k),u_viewport:new o.cb(k)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(k=>({u_cutoff_params:new o.cQ(k)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(k=>({u_lighting_ambient_color:new o.c9(k),u_lighting_directional_dir:new o.c9(k),u_lighting_directional_color:new o.c9(k),u_ground_radiance:new o.c9(k)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(k=>({u_light_matrix_0:new o.cc(k),u_light_matrix_1:new o.cc(k),u_fade_range:new o.cb(k),u_shadow_normal_offset:new o.c9(k),u_shadow_intensity:new o.ca(k),u_shadow_texel_size:new o.ca(k),u_shadow_map_resolution:new o.ca(k),u_shadow_direction:new o.c9(k),u_shadow_bias:new o.c9(k),u_shadowmap_0:new o.c8(k),u_shadowmap_1:new o.c8(k)}))(t))}}setTerrainUniformValues(t,n){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setGlobeUniformValues(t,n){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setFogUniformValues(t,n){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setCutoffUniformValues(t,n){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setLightsUniformValues(t,n){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setShadowUniformValues(t,n){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}_drawDebugWireframe(t,n,c,d,p,m,y,x,T,S){const M=t.options.wireframe;if(M.terrain===!1&&M.layers2D===!1&&M.layers3D===!1)return;const I=t.context;if(!(!(!M.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!M.layers2D||t._terrain&&t._terrain.renderingToTexture||!xh.includes(this.name))||!(!M.layers3D||!vh.includes(this.name))))return;const C=I.gl,L=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,I);if(!L)return;const z=[...this.fixedDefines];
2655z.push("DEBUG_WIREFRAME");const k=t.getOrCreateProgram(this.name,{config:this.configuration,defines:z});I.program.set(k.program);const B=(Y,te,ee)=>{if(te[Y]&&ee[Y])for(const J in te[Y])ee[Y][J]&&ee[Y][J].set(ee.program,J,te[Y][J].current)};T&&T.setUniforms(k.program,I,k.binderUniforms,y,{zoom:x}),B("fixedUniforms",this,k),B("terrainUniforms",this,k),B("globeUniforms",this,k),B("fogUniforms",this,k),B("lightsUniforms",this,k),B("shadowUniforms",this,k),L.bind(),I.setColorMode(new ui([C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ZERO,C.ONE],o.am.transparent,[!0,!0,!0,!1])),I.setDepthMode(new nt(n.func===C.LESS?C.LEQUAL:n.func,nt.ReadOnly,n.range)),I.setStencilMode($t.disabled);const V=3*m.primitiveLength*2,H=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Y=S||1;for(let te=0;te<Y;++te)k.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",te),C.drawElements(C.LINES,V,C.UNSIGNED_SHORT,H)}else S&&S>1?C.drawElementsInstanced(C.LINES,V,C.UNSIGNED_SHORT,H,S):C.drawElements(C.LINES,V,C.UNSIGNED_SHORT,H);p.bind(),I.program.set(this.program),I.setDepthMode(n),I.setStencilMode(c),I.setColorMode(d)}checkUniforms(t,n,c){if(this.fixedDefines.includes(n)){for(const d of Object.keys(c))if(!c[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${n} being defined`)}}draw(t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k){const B=t.context,V=B.gl;if(this.failedToCreate)return;B.program.set(this.program),B.setDepthMode(c),B.setStencilMode(d),B.setColorMode(p),B.setCullFace(m);for(const te of Object.keys(this.fixedUniforms))this.fixedUniforms[te].set(this.program,te,y[te]);L&&L.setUniforms(this.program,B,this.binderUniforms,I,{zoom:C});const H={[V.POINTS]:1,[V.LINES]:2,[V.TRIANGLES]:3,[V.LINE_STRIP]:1}[n];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const Y=k&&k>0?1:void 0;for(const te of M.get()){const ee=te.vaos||(te.vaos={});if((ee[x]||(ee[x]=new Da)).bind(B,this,T,L?L.getPaintVertexBuffers():[],S,te.vertexOffset,z||[],Y),this.forceManualRenderingForInstanceIDShaders){const J=k||1;for(let K=0;K<J;++K)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",K),S?V.drawElements(n,te.primitiveLength*H,V.UNSIGNED_SHORT,te.primitiveOffset*H*2):V.drawArrays(n,te.vertexOffset,te.vertexLength)}else k&&k>1?V.drawElementsInstanced(n,te.primitiveLength*H,V.UNSIGNED_SHORT,te.primitiveOffset*H*2,k):S?V.drawElements(n,te.primitiveLength*H,V.UNSIGNED_SHORT,te.primitiveOffset*H*2):V.drawArrays(n,te.vertexOffset,te.vertexLength);n===V.TRIANGLES&&S&&this._drawDebugWireframe(t,c,d,p,S,te,I,C,L,k)}}}function Nl(l,t,n=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,p=d*(t.tileID.canonical.x+t.tileID.wrap*c),m=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/o.aw(t,1,l.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m],u_pattern_transition:n}}const Oa={terrain:0,flat:1},bh=o.bz(),Vl=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B)=>{const V=t.style.light,H=V.properties.get("position"),Y=[H.x,H.y,H.z],te=o.dx();V.properties.get("anchor")==="viewport"&&(o.dy(te,-t.transform.angle),o.dz(Y,Y,te));const ee=V.properties.get("color").toPremultipliedRenderColor(null),J=t.transform,K={u_matrix:l,u_lightpos:Y,u_lightintensity:V.properties.get("intensity"),u_lightcolor:[ee.r,ee.g,ee.b],u_vertical_gradient:+n,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:bh,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Oa[T],u_base_type:Oa[S],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:L,u_vertical_scale:z,u_flood_light_intensity:k,u_ground_shadow_factor:B};return J.projection.name==="globe"&&(K.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],K.u_zoom_transition=M,K.u_inv_rot_matrix=C,K.u_merc_center=I,K.u_up_dir=J.projection.upVector(new o.cp(0,0,0),I[0]*o.aj,I[1]*o.aj),K.u_height_lift=x),K},sp=(l,t,n,c,d,p)=>({u_matrix:l,u_edge_radius:t,u_width_scale:n,u_vertical_scale:c,u_height_type:Oa[d],u_base_type:Oa[p]}),op=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B)=>{const V=Vl(l,t,n,c,d,p,m,y,T,S,M,I,C,L,z,k,1,[0,0,0]),H={u_height_factor:-Math.pow(2,y.overscaledZ
2655)/x.tileSize/8};return o.h(V,Nl(t,x,B),H)},Qo=(l,t,n)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:n}),ap=(l,t,n,c,d,p=0)=>o.h(Qo(l,t,d),Nl(n,c,p)),om=(l,t,n,c)=>({u_matrix:l,u_world:n,u_emissive_strength:t,u_ground_shadow_factor:c}),am=(l,t,n,c,d,p,m=0)=>o.h(ap(l,t,n,c,p,m),{u_world:d}),lm=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),iu=(l,t,n,c,d)=>({u_matrix:l,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:n,u_height_scale:c,u_reset_depth:d}),cm=(l,t,n,c)=>{const d=o.aj/n.tileSize;return{u_matrix:l,u_camera_to_center_distance:t.getCameraToCenterDistance(c),u_extrude_scale:[t.pixelsToGLUnits[0]/d,t.pixelsToGLUnits[1]/d]}},ru=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),wh=o.bz(),lp=(l,t,n,c,d,p,m)=>{const y=l.transform,x=y.projection.name==="globe",T=x?o.dA(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:o.aw(n,1,p),S={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:m,u_inv_rot_matrix:wh,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){S.u_inv_rot_matrix=c,S.u_merc_center=d,S.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],S.u_zoom_transition=o.ah(y.zoom);const M=d[0]*o.aj,I=d[1]*o.aj;S.u_up_dir=y.projection.upVector(new o.cp(0,0,0),M,I)}return S};function ea(l,[t,n,c,d],[p,m]){if(p===m)return[0,0,0,0];const y=255*(l-1)/(l*(m-p));return[t*y,n*y,c*y,d*y]}function Th(l,t,[n,c]){return n===c?0:.5/l+(t-n)*(l-1)/(l*(c-n))}const Sh=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B,V,H,Y)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*M.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:M.paint.get("raster-brightness-min"),u_brightness_high:M.paint.get("raster-brightness-max"),u_saturation_factor:o.dC(M.paint.get("raster-saturation")),u_contrast_factor:o.dB(M.paint.get("raster-contrast")),u_spin_weights:cp(M.paint.get("raster-hue-rotate")),u_perspective_transform:I,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x,u_colorization_mix:ea(o.dD,z,B),u_colorization_offset:Th(o.dD,k,B),u_color_ramp:L,u_texture_offset:[H/(V+2*H),V/(V+2*H)],u_texture_res:[V+2*H,V+2*H],u_emissive_strength:Y});function cp(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const go=.05,ta=(l,t,n,c,d,p,m,y,x,T,S,M)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:M,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x}),up=(l,t,n,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:n,u_velocity:c,u_color_ramp:p,u_velocity_res:d,u_max_speed:m,u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[go,go]}),yo=(l,t,n,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:n,u_velocity_res:c,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[go,go]}),nu=o.bz(),Ul=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B,V,H,Y,te,ee,J)=>{const K=d.transform,ie={u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:K.getCameraToCenterDistance(V),u_rotate_symbol:+n,u_aspect_ratio:K.width/K.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:x?1:0,u_pitch_with_map:+c,u_texsize:S,u_texsize_icon:M,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:nu,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:nu,u_up_vector:[0,-1,0],u_color_adj_mat:te,u_icon_transition:ee||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(V)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:o.q.devicePixelRatio,u_is_halo:1,u_scale_factor:J||1,u_ground_shadow_factor:H,u_inv_matrix:o.bi(o.bz(),m),u_normal_scale:Y};
2655return V.name==="globe"&&(ie.u_tile_id=[C.canonical.x,C.canonical.y,1<<C.canonical.z],ie.u_zoom_transition=L,ie.u_inv_rot_matrix=k,ie.u_merc_center=z,ie.u_camera_forward=K._camera.forward(),ie.u_ecef_origin=o.dE(K.globeMatrix,C.toUnwrapped()),ie.u_tile_matrix=Float32Array.from(K.globeMatrix),ie.u_up_vector=B),ie},Eh=(l,t,n,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:n,u_color:c}),Ih=(l,t,n,c,d,p,m,y,x)=>o.h(function(T,S,M,I,C,L){const{width:z,height:k}=I.imageManager.getPixelSize(S),B=Math.pow(2,L.tileID.overscaledZ),V=L.tileSize*Math.pow(2,I.transform.tileZoom)/B,H=V*(L.tileID.canonical.x+L.tileID.wrap*B),Y=V*L.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[z,k],u_pattern_size:M.displaySize,u_pattern_units_to_pixels:C?[I.transform.width,-1*I.transform.height]:[1/o.aw(L,1,I.transform.tileZoom),1/o.aw(L,1,I.transform.tileZoom)],u_pixel_coord_upper:[H>>16,Y>>16],u_pixel_coord_lower:[65535&H,65535&Y]}}(0,p,m,c,y,x),{u_matrix:l,u_emissive_strength:t,u_opacity:n}),jl=new Float32Array(o.bx([])),Gl=(l,t,n,c,d,p,m,y,x,T,S,M,I,C=[0,0,0],L)=>{const z=d.style.light,k=z.properties.get("position"),B=[-k.x,-k.y,k.z],V=o.dx();z.properties.get("anchor")==="viewport"&&(o.dy(V,-d.transform.angle),o.dz(B,B,V));const H=S.alphaMode==="MASK",Y=z.properties.get("color").toNonPremultipliedRenderColor(null),te=I.paint.get("model-ambient-occlusion-intensity"),ee=I.paint.get("model-color").constantOr(o.am.white).toNonPremultipliedRenderColor(null);return ee.a=I.paint.get("model-color-mix-intensity").constantOr(0),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:n,u_node_matrix:c||jl,u_lightpos:B,u_lightintensity:z.properties.get("intensity"),u_lightcolor:[Y.r,Y.g,Y.b],u_camera_pos:C,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+H,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:T,u_baseColorTexture:An.BaseColor,u_metallicRoughnessTexture:An.MetallicRoughness,u_normalTexture:An.Normal,u_occlusionTexture:An.Occlusion,u_emissionTexture:An.Emission,u_lutTexture:An.LUT,u_color_mix:ee.toArray01(),u_aoIntensity:te,u_emissive_strength:M,u_occlusionTextureTransform:L||[0,0,0,0]}},hp=(l,t=jl,n=jl)=>({u_matrix:l,u_instance:t,u_node_matrix:n}),dp={fillExtrusion:l=>({u_matrix:new o.cc(l),u_lightpos:new o.c9(l),u_lightintensity:new o.ca(l),u_lightcolor:new o.c9(l),u_vertical_gradient:new o.ca(l),u_opacity:new o.ca(l),u_edge_radius:new o.ca(l),u_width_scale:new o.ca(l),u_ao:new o.cb(l),u_height_type:new o.c8(l),u_base_type:new o.c8(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_up_dir:new o.c9(l),u_height_lift:new o.ca(l),u_flood_light_color:new o.c9(l),u_vertical_scale:new o.ca(l),u_flood_light_intensity:new o.ca(l),u_ground_shadow_factor:new o.c9(l)}),fillExtrusionDepth:l=>({u_matrix:new o.cc(l),u_edge_radius:new o.ca(l),u_width_scale:new o.ca(l),u_vertical_scale:new o.ca(l),u_height_type:new o.c8(l),u_base_type:new o.c8(l)}),fillExtrusionPattern:l=>({u_matrix:new o.cc(l),u_lightpos:new o.c9(l),u_lightintensity:new o.ca(l),u_lightcolor:new o.c9(l),u_vertical_gradient:new o.ca(l),u_height_factor:new o.ca(l),u_edge_radius:new o.ca(l),u_width_scale:new o.ca(l),u_ao:new o.cb(l),u_height_type:new o.c8(l),u_base_type:new o.c8(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_up_dir:new o.c9(l),u_height_lift:new o.ca(l),u_image:new o.c8(l),u_texsize:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_tile_units_to_pixels:new o.ca(l),u_opacity:new o.ca(l),u_pattern_transition:new o.ca(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new o.cc(l),u_opacity:new o.ca(l),u_ao_pass:new o.ca(l),u_meter_to_tile:new o.ca(l),u_ao:new o.cb(l),u_flood_light_intensity:new o.ca(l),u_flood_light_color:new o.c9(l),u_attenuation:new o.ca(l),u_edge_radius:new o.ca(l),u_fb:new o.c8(l),u_fb_size:new o.ca(l),u_dynamic_offset:new o.ca(l)}),fill:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_ground_shadow_factor:new o.c9(l)}),fillPattern:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_image:new o.c8(l),u_texsize:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_tile_units_to_pixels:new o.ca(l),u_ground_shadow_factor:new o.c9(l),u_pattern_transition:new o.ca(l)}),fillOutline:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_world:new o.cb(l),u_ground_shadow_factor:new o.c9(l)}),fillOutlinePattern:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_world:new o.cb(l),u_image:new o.c8(l),u_texsize:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_tile_units_to_pixels:new o.ca(l),u_ground_shadow_factor:new o.c9(l),u_pattern_transition:new o.ca(l)}),building:l=>({u_matrix:new o.cc(l),u_normal_matrix:new o.cc(l),u_opacity:new o.ca(l)}),buildingDepth:l=>({u_matrix:new o.cc(l)}),elevatedStructuresDepth:l=>({u_matrix:new o.cc(l),u_depth_bias:new o.ca(l)}),elevatedStructures:l=>({u_matrix:new o.cc(l),u_ground_shadow_factor:new o.c9(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new o.cc(l),u_camera_pos:new o.c9(l),u_depth_bias:new o.ca(l),u_height_scale:new o.ca(l),u_reset_depth:new o.ca(l)}),circle:o.dH,collisionBox:l=>({u_matrix:new o.cc(l),u_camera_to_center_distance:new o.ca(l),u_extrude_scale:new o.cb(l)}),collisionCircle:l=>({u_matrix:new o.cc(l),u_inv_matrix:new o.cc(l),u_camera_to_center_distance:new o.ca(l),u_viewport_size:new o.cb(l)}),debug:l=>({u_color:new o.di(l),u_matrix:new o.cc(l),u_overlay:new o.c8(l),u_overlay_scale:new o.ca(l)}),clippingMask:l=>({u_matrix:new o.cc(l)}),heatmap:l=>({u_extrude_scale:new o.ca(l),u_intensity:new o.ca(l),u_matrix:new o.cc(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_up_dir:new o.c9(l)}),heatmapTexture:l=>({u_image:new o.c8(l),u_color_ramp:new o.c8(l),u_opacity:new o.ca(l)}),hillshade:l=>({u_matrix:new o.cc(l),u_image:new o.c8(l),u_latrange:new o.cb(l),u_light:new o.cb(l),u_shadow:new o.di(l),u_highlight:new o.di(l),u_emissive_strength:new o.ca(l),u_accent:new o.di(l)}),hillshadePrepare:l=>({u_matrix:new o.cc(l),u_image:new o.c8(l),u_dimension:new o.cb(l),u_zoom:new o.ca(l)}),line:o.dG,linePattern:o.dF,raster:l=>({u_matrix:new o.cc(l),u_normalize_matrix:new o.cc(l),u_globe_matrix:new o.cc(l),u_merc_matrix:new o.cc(l),u_grid_matrix:new o.dj(l),u_tl_parent:new o.cb(l),u_scale_parent:new o.ca(l),u_fade_t:new o.ca(l),u_opacity:new o.ca(l),u_image0:new o.c8(l),u_image1:new o.c8(l),u_brightness_low:new o.ca(l),u_brightness_high:new o.ca(l),u_saturation_factor:new o.ca(l),u_contrast_factor:new o.ca(l),u_spin_weights:new o.c9(l),u_perspective_transform:new o.cb(l),u_raster_elevation:new o.ca(l),u_zoom_transition:new o.ca(l),u_merc_center:new o.cb(l),u_cutoff_params:new o.cQ(l),u_colorization_mix:new o.cQ(l),u_colorization_offset:new o.ca(l),u_color_ramp:new o.c8(l),u_texture_offset:new o.cb(l),u_texture_res:new o.cb(l),u_emissive_strength:new o.ca(l)}),rasterParticle:l=>({u_matrix:new o.cc(l),u_normalize_matrix:new o.cc(l),u_globe_matrix:new o.cc(l),u_merc_matrix:new o.cc(l),u_grid_matrix:new o.dj(l),u_tl_parent:new o.cb(l),u_scale_parent:new o.ca(l),u_fade_t:new o.ca(l),u_opacity:new o.ca(l),u_image0:new o.c8(l),u_image1:new o.c8(l),u_raster_elevation:new o.ca(l),u_zoom_transition:new o.ca(l),u_merc_center:new o.cb(l),u_cutoff_params:new o.cQ(l)}),rasterParticleTexture:l=>({u_texture:new o.c8(l),u_opacity:new o.ca(l)}),rasterParticleDraw:l=>({u_particle_texture:new o.c8(l),u_particle_texture_side_len:new o.ca(l),u_tile_offset:new o.cb(l),u_velocity:new o.c8(l),u_color_ramp:new o.c8(l),u_velocity_res:new o.cb(l),u_max_speed:new o.ca(l),u_uv_offset:new o.cb(l),u_data_scale:new o.cb(l),u_data_offset:new o.ca(l),u_particle_pos_scale:new o.ca(l),u_particle_pos_offset:new o.cb(l)}),rasterParticleUpdate:l=>({u_particle_texture:new o.c8(l),u_particle_texture_side_len:new o.ca(l),u_velocity:new o.c8(l),u_velocity_res:new o.cb(l),u_max_speed:new o.ca(l),u_speed_factor:new o.ca(l),u_reset_rate:new o.ca(l),u_rand_seed:new o.ca(l),u_uv_offset:new o.cb(l),u_data_scale:new o.cb(l),u_data_offset:new o.ca(l),u_particle_pos_scale:new o.ca(l),u_particle_pos_offset:new o.cb(l)}),symbol:l=>({u_is_size_zoom_constant:new o.c8(l),u_is_size_feature_constant:new o.c8(l),u_size_t:new o.ca(l),u_size:new o.ca(l),u_camera_to_center_distance:new o.ca(l),u_rotate_symbol:new o.c8(l),u_aspect_ratio:new o.ca(l),u_fade_change:new o.ca(l),u_matrix:new o.cc(l),u_label_plane_matrix:new o.cc(l),u_coord_matrix:new o.cc(l),u_is_text:new o.c8(l),u_elevation_from_sea:new o.c8(l),u_pitch_with_map:new o.c8(l),u_texsize:new o.cb(l),u_texsize_icon:new o.cb(l),u_texture:new o.c8(l),u_texture_icon:new o.c8(l),u_gamma_scale:new o.ca(l),u_device_pixel_ratio:new o.ca(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_camera_forward:new o.c9(l),u_tile_matrix:new o.cc(l),u_up_vector:new o.c9(l),u_ecef_origin:new o.c9(l),u_is_halo:new o.c8(l),u_icon_transition:new o.ca(l),u_color_adj_mat:new o.cc(l),u_scale_factor:new o.ca(l),u_ground_shadow_factor:new o.c9(l),u_inv_matrix:new o.cc(l),u_normal_scale:new o.ca(l)}),background:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_opacity:new o.ca(l),u_color:new o.di(l)}),backgroundPattern:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_opacity:new o.ca(l),u_image:new o.c8(l),u_pattern_tl:new o.cb(l),u_pattern_br:new o.cb(l),u_texsize:new o.cb(l),u_pattern_size:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_pattern_units_to_pixels:new o.cb(l)}),terrainRaster:l=>({u_matrix:new o.cc(l),u_image0:new o.c8(l),u_skirt_height:new o.ca(l),u_ground_shadow_factor:new o.c9(l)}),skybox:l=>({u_matrix:new o.cc(l),u_sun_direction:new o.c9(l),u_cubemap:new o.c8(l),u_opacity:new o.ca(l),u_temporal_offset:new o.ca(l)}),skyboxGradient:l=>({u_matrix:new o.cc(l),u_color_ramp:new o.c8(l),u_center_direction:new o.c9(l),u_radius:new o.ca(l),u_opacity:new o.ca(l),u_temporal_offset:new o.ca(l)}),skyboxCapture:l=>({u_matrix_3f:new o.dj(l),u_sun_direction:new o.c9(l),u_sun_intensity:new o.ca(l),u_color_tint_r:new o.cQ(l),u_color_tint_m:new o.cQ(l),u_luminance:new o.ca(l)}),globeRaster:l=>({u_proj_matrix:new o.cc(l),u_globe_matrix:new o.cc(l),u_normalize_matrix:new o.cc(l),u_merc_matrix:new o.cc(l),u_zoom_transition:new o.ca(l),u_merc_center:new o.cb(l),u_image0:new o.c8(l),u_grid_matrix:new o.dj(l),u_skirt_height:new o.ca(l),u_far_z_cutoff:new o.ca(l),u_frustum_tl:new o.c9(l),u_frustum_tr:new o.c9(l),u_frustum_br:new o.c9(l),u_frustum_bl:new o.c9(l),u_globe_pos:new o.c9(l),u_globe_radius:new o.ca(l),u_viewport:new o.cb(l)}),globeAtmosphere:l=>({u_frustum_tl:new o.c9(l),u_frustum_tr:new o.c9(l),u_frustum_br:new o.c9(l),u_frustum_bl:new o.c9(l),u_horizon:new o.ca(l),u_transition:new o.ca(l),u_fadeout_range:new o.ca(l),u_color:new o.cQ(l),u_high_color:new o.cQ(l),u_space_color:new o.cQ(l),u_temporal_offset:new o.ca(l),u_horizon_angle:new o.ca(l)}),model:l=>({u_matrix:new o.cc(l),u_lighting_matrix:new o.cc(l),u_normal_matrix:new o.cc(l),u_node_matrix:new o.cc(l),u_lightpos:new o.c9(l),u_lightintensity:new o.ca(l),u_lightcolor:new o.c9(l),u_camera_pos:new o.c9(l),u_opacity:new o.ca(l),u_baseColorFactor:new o.cQ(l),u_emissiveFactor:new o.cQ(l),u_metallicFactor:new o.ca(l),u_roughnessFactor:new o.ca(l),u_baseTextureIsAlpha:new o.c8(l),u_alphaMask:new o.c8(l),u_alphaCutoff:new o.ca(l),u_baseColorTexture:new o.c8(l),u_metallicRoughnessTexture:new o.c8(l),u_normalTexture:new o.c8(l),u_occlusionTexture:new o.c8(l),u_emissionTexture:new o.c8(l),u_lutTexture:new o.c8(l),u_color_mix:new o.cQ(l),u_aoIntensity:new o.ca(l),u_emissive_strength:new o.ca(l),u_occlusionTextureTransform:new o.cQ(l)}),modelDepth:l=>({u_matrix:new o.cc(l),u_instance:new o.cc(l),u_node_matrix:new o.cc(l)}),groundShadow:l=>({u_matrix:new o.cc(l),u_ground_shadow_factor:new o.c9(l)}),stars:l=>({u_matrix:new o.cc(l),u_up:new o.c9(l),u_right:new o.c9(l),u_intensity_multiplier:new o.ca(l)}),snowParticle:l=>({u_modelview:new o.cc(l),u_projection:new o.cc(l),u_time:new o.ca(l),u_cam_pos:new o.c9(l),u_velocityConeAperture:new o.ca(l),u_velocity:new o.ca(l),u_horizontalOscillationRadius:new o.ca(l),u_horizontalOscillationRate:new o.ca(l),u_boxSize:new o.ca(l),u_billboardSize:new o.ca(l),u_simpleShapeParameters:new o.cb(l),u_screenSize:new o.cb(l),u_thinningCenterPos:new o.cb(l),u_thinningShape:new o.c9(l),u_thinningAffectedRatio:new o.ca(l),u_thinningParticleOffset:new o.ca(l),u_particleColor:new o.cQ(l),u_direction:new o.c9(l)}),rainParticle:l=>({u_modelview:new o.cc(l),u_projection:new o.cc(l),u_time:new o.ca(l),u_cam_pos:new o.c9(l),u_texScreen:new o.c8(l),u_velocityConeAperture:new o.ca(l),u_velocity:new o.ca(l),u_boxSize:new o.ca(l),u_rainDropletSize:new o.cb(l),u_distortionStrength:new o.ca(l),u_rainDirection:new o.c9(l),u_color:new o.cQ(l),u_screenSize:new o.cb(l),u_thinningCenterPos:new o.cb(l),u_thinningShape:new o.c9(l),u_thinningAffectedRatio:new o.ca(l),u_thinningParticleOffset:new o.ca(l),u_shapeDirectionalPower:new o.ca(l),u_shapeNormalPower:new o.ca(l),u_mode:new o.ca(l)}),vignette:l=>({u_vignetteShape:new o.c9(l),u_vignetteColor:new o.cQ(l)}),occlusion:l=>({u_matrix:new o.cc(l),u_anchorPos:new o.c9(l),u_screenSizePx:new o.cb(l),u_occluderSizePx:new o.cb(l),u_color:new o.cQ(l)})};class cs{constructor(t,n,c,d){this.id=cs.uniqueIdxCounter,cs.uniqueIdxCounter++,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||n.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=cs.uniqueIdxCounter,cs.uniqueIdxCounter++;const n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}cs.uniqueIdxCounter=0;const um={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class hm{constructor(t,n,c,d,p,m){this.length=n.length,this.attributes=c,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.instanceCount=m,this.context=t;const y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||p||n.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}
2655enableAttributes(t,n){for(let c=0;c<this.attributes.length;c++){const d=n.attributes[this.attributes[c].name];d!==void 0&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[um[p.type]],!1,this.itemSize,p.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=n.attributes[this.attributes[d].name];p!==void 0&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ah{constructor(t,n,c,d,p){this.context=t,this.width=n,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d&&(this.colorAttachment=new ip(t,m)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new rp(t,m):new rm(t,m))}destroy(){const t=this.context.gl;if(this.colorAttachment){const n=this.colorAttachment.get();n&&t.deleteTexture(n)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}else{const n=this.depthAttachment.get();n&&t.deleteTexture(n)}t.deleteFramebuffer(this.framebuffer)}}class dm{constructor(t,n){this.gl=t,this.clearColor=new Wd(this),this.clearDepth=new hh(this),this.clearStencil=new Kf(this),this.colorMask=new Jf(this),this.depthMask=new Qf(this),this.stencilMask=new em(this),this.stencilFunc=new Xd(this),this.stencilOp=new tm(this),this.stencilTest=new $c(this),this.depthRange=new im(this),this.depthTest=new Yd(this),this.depthFunc=new dh(this),this.blend=new qc(this),this.blendFunc=new ph(this),this.blendColor=new Yo(this),this.blendEquation=new La(this),this.cullFace=new Hc(this),this.cullFaceSide=new Zc(this),this.frontFace=new ka(this),this.program=new Kd(this),this.activeTexture=new fh(this),this.viewport=new Jd(this),this.bindFramebuffer=new Fa(this),this.bindRenderbuffer=new Wc(this),this.bindTexture=new Xc(this),this.bindVertexBuffer=new mh(this),this.bindElementBuffer=new Yc(this),this.bindVertexArrayOES=new Ol(this),this.pixelStoreUnpack=new Qd(this),this.pixelStoreUnpackPremultiplyAlpha=new ep(this),this.pixelStoreUnpackFlipY=new tp(this),this.options=n?Object.assign({},n):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=n&&!!n.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxPointSize=t.getParameter(t.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n,c){return new cs(this,t,n,c)}createVertexBuffer(t,n,c,d,p){return new hm(this,t,n,c,d,p)}createRenderbuffer(t,n,c){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,t,n,c),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,c,d){return new Ah(this,t,n,c,d)}clear({color:t,depth:n,stencil:c,colorMask:d}){const p=this.gl;let m=0;t&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),n!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),c!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),p.clear(m)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){o.bv(t.blendFunction,ui.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Ba;function su(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=l.transform,S=l.getOrCreateProgram("collisionBox"),M=[];let I=0,C=0;for(let Y=0;Y<c.length;Y++){const te=c[Y],ee=t.getTile(te),J=ee.getBucket(n);if(!J)continue;const K=Ft(te,J,T);let ie=K;d[0]===0&&d[1]===0||(ie=l.translatePosMatrix(K,ee,d,p));const ne=m?J.textCollisionBox:J.iconCollisionBox,fe=J.collisionCircleArray;
2655if(fe.length>0){const _e=o.bz(),Me=ie;o.cB(_e,J.placementInvProjMatrix,T.glCoordMatrix),o.cB(_e,_e,J.placementViewportMatrix),M.push({circleArray:fe,circleOffset:C,transform:Me,invTransform:_e,projection:J.getProjection()}),I+=fe.length/4,C=I}ne&&(l.terrain&&l.terrain.setupElevationDraw(ee,S),S.draw(l,x.LINES,nt.disabled,$t.disabled,l.colorModeForRenderPass(),zt.disabled,cm(ie,T,ee,J.getProjection()),n.id,ne.layoutVertexBuffer,ne.indexBuffer,ne.segments,null,T.zoom,null,[ne.collisionVertexBuffer,ne.collisionVertexBufferExt]))}if(!m||!M.length)return;const L=l.getOrCreateProgram("collisionCircle"),z=new o.dI;z.resize(4*I),z._trim();let k=0;for(const Y of M)for(let te=0;te<Y.circleArray.length/4;te++){const ee=4*te,J=Y.circleArray[ee+0],K=Y.circleArray[ee+1],ie=Y.circleArray[ee+2],ne=Y.circleArray[ee+3];z.emplace(k++,J,K,ie,ne,0),z.emplace(k++,J,K,ie,ne,1),z.emplace(k++,J,K,ie,ne,2),z.emplace(k++,J,K,ie,ne,3)}(!Ba||Ba.length<2*I)&&(Ba=function(Y){const te=2*Y,ee=new o.a_;ee.resize(te),ee._trim();for(let J=0;J<te;J++){const K=6*J;ee.uint16[K+0]=4*J+0,ee.uint16[K+1]=4*J+1,ee.uint16[K+2]=4*J+2,ee.uint16[K+3]=4*J+2,ee.uint16[K+4]=4*J+3,ee.uint16[K+5]=4*J+0}return ee}(I));const B=y.createIndexBuffer(Ba,!0),V=y.createVertexBuffer(z,o.dJ.members,!0);for(const Y of M){const te={u_matrix:Y.transform,u_inv_matrix:Y.invTransform,u_camera_to_center_distance:(H=T).getCameraToCenterDistance(Y.projection),u_viewport_size:[H.width,H.height]};L.draw(l,x.TRIANGLES,nt.disabled,$t.disabled,l.colorModeForRenderPass(),zt.disabled,te,n.id,V,B,o.bd.simpleSegment(0,2*Y.circleOffset,Y.circleArray.length,Y.circleArray.length/2),null,T.zoom)}var H;V.destroy(),B.destroy()}const js=o.bz();function $l(l){const t=l._camera.getWorldToCamera(l.worldSize,1),n=o.az([],t,l.globeMatrix);o.bi(n,n);const c=[0,0,0],d=[0,1,0,0];return o.aA(d,d,n),c[0]=d[0],c[1]=d[1],c[2]=d[2],o.au(c,c),c}function ql({width:l,height:t,anchor:n,textOffset:c,textScale:d},p){const{horizontalAlign:m,verticalAlign:y}=o.bT(n),x=-(m-.5)*l,T=-(y-.5)*t,S=o.bU(n,c);return new o.P((x/d+S[0])*p,(T/d+S[1])*p)}function pp(l,t,n,c,d,p,m,y,x,T){const S=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,I=l.icon.dynamicLayoutVertexArray,C={},L=l.getProjection(),z=Lc(m,L,d),k=d.elevation,B=L.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;M.clear();for(let V=0;V<S.length;V++){const H=S.get(V),{tileAnchorX:Y,tileAnchorY:te,numGlyphs:ee}=H,J=H.hidden||!H.crossTileID||l.allowVerticalPlacement&&!H.placedOrientation?null:c[H.crossTileID];if(J){let K=0,ie=0,ne=0;if(k){const Re=k?k.getAtTileOffset(m,Y,te):0,[xe,Le,qe]=L.upVector(m.canonical,Y,te);K=Re*xe*B,ie=Re*Le*B,ne=Re*qe*B}let[fe,_e,Me,Ce]=_s(H.projectedAnchorX+K,H.projectedAnchorY+ie,H.projectedAnchorZ+ne,n?z:p);const Fe=El(d.getCameraToCenterDistance(L),Ce);let de=o.bJ(l.textSizeData,x,H)*Fe/o.bO;n&&(de*=l.tilePixelRatio/y);const Te=ql(J,de);n?({x:fe,y:_e,z:Me}=L.projectTilePoint(Y+Te.x,te+Te.y,m.canonical),[fe,_e,Me]=_s(fe+K,_e+ie,Me+ne,p)):(t&&Te._rotate(-d.angle),fe+=Te.x,_e+=Te.y,Me=0);const le=l.allowVerticalPlacement&&H.placedOrientation===o.bI.vertical?Math.PI/2:0;for(let Re=0;Re<ee;Re++)o.bL(M,fe,_e,Me,le);T&&H.associatedIconIndex>=0&&(C[H.associatedIconIndex]={x:fe,y:_e,z:Me,angle:le})}else qo(ee,M)}if(T){I.clear();const V=l.icon.placedSymbolArray;for(let H=0;H<V.length;H++){const Y=V.get(H),{numGlyphs:te}=Y,ee=C[H];if(Y.hidden||!ee)qo(te,I);else{const{x:J,y:K,z:ie,angle:ne}=ee;for(let fe=0;fe<te;fe++)o.bL(I,J,K,ie,ne)}}l.icon.dynamicLayoutVertexBuffer.updateData(I)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function Na(l,t,n,c,d,p,m={}){const y=n.paint.get("icon-translate"),x=n.paint.get("text-translate"),T=n.paint.get("icon-translate-anchor"),S=n.paint.get("text-translate-anchor"),M=n.layout.get("icon-rotation-alignment"),I=n.layout.get("text-rotation-alignment"),C=n.layout.get("icon-pitch-alignment"),L=n.layout.get("text-pitch-alignment"),z=n.layout.get("icon-keep-upright"),k=n.layout.get("text-keep-upright"),B=n.paint.get("icon-color-saturation"),V=n.paint.get("icon-color-contrast"),H=n.paint.get("icon-color-brightness-min"),Y=n.paint.get("icon-color-brightness-max"),te=n.layout.get("symbol-elevation-reference")==="sea",ee=l.context,J=ee.gl,K=l.transform,ie=M==="map",ne=I==="map",fe=C==="map",_e=L==="map",Me=n.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Ce=!1;const Fe=l.depthModeForSublayer(0,nt.ReadOnly),de=new nt(l.context.gl.LEQUAL,nt.ReadOnly,l.depthRangeFor3D),Te=[o.aD(K.
2655center.lng),o.aH(K.center.lat)],le=n.layout.get("text-variable-anchor"),Re=K.projection.name==="globe",xe=[],Le=[0,-1,0];for(const qe of c){const Pe=t.getTile(qe),Ge=Pe.getBucket(n);if(!Ge||Ge.projection.name==="mercator"&&Re||Ge.fullyClipped)continue;const ot=Ge.projection.name==="globe",at=ot?o.ah(K.zoom):0,rt=Lc(qe,Ge.getProjection(),K),mt=K.calculatePixelsToTileUnitsMatrix(Pe),gt=le&&Ge.hasTextData(),bt=Ge.hasIconTextFit()&>&&Ge.hasIconData(),Ut=Ge.getProjection().createInversionMatrix(K,qe.canonical),ri=(1<<Pe.tileID.canonical.z)*o.aj/l.transform.worldSize,Bi=rr=>{let Ri=[0,0,0];if(rr){const Ir=l.style.directionalLight,Ti=l.style.ambientLight;Ir&&Ti&&(Ri=Wo(l.style,Ir,Ti))}return Ri},ir=rr=>{K.depthOcclusionForSymbolsAndCircles&&(n.hasInitialOcclusionOpacityProperties||l.terrain)&&(rr.push("DEPTH_D24"),rr.push("DEPTH_OCCLUSION"))},ji=()=>{const rr=ie&&n.layout.get("symbol-placement")!=="point",Ri=[];ir(Ri);const Ir=rr||bt,Ti=Ge.elevationType==="road"&&fe,Fr=l.shadowRenderer,lr=Ti&&!!Fr&&Fr.enabled,Qi=Bi(lr),cr=Ti?de:Fe,Li=n.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&fe&&Ri.push("PITCH_WITH_MAP_TERRAIN"),ot&&(Ri.push("PROJECTION_GLOBE_VIEW"),Ir&&Ri.push("PROJECTED_POS_ON_VIEWPORT")),Li>0&&Ri.push("ICON_TRANSITION"),Ge.icon.zOffsetVertexBuffer&&Ri.push("Z_OFFSET"),B===0&&V===0&&H===0&&Y===1||Ri.push("COLOR_ADJUSTMENT"),Ge.sdfIcons&&Ri.push("RENDER_SDF"),lr&&Ri.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Ti&&Ge.icon.orientationVertexBuffer&&Ri.push("ELEVATED_ROADS");const Mr=Ge.icon.programConfigurations.get(n.id),on=l.getOrCreateProgram("symbol",{config:Mr,defines:Ri}),_r=Pe.imageAtlasTexture?Pe.imageAtlasTexture.size:[0,0],Ci=Ge.iconSizeData,qn=o.bH(Ci,K.zoom),kn=fe||!K.isOrthographic,Jn=Bs(rt,Pe.tileID.canonical,fe,ie,K,Ge.getProjection(),mt),vs=Rc(rt,Pe.tileID.canonical,fe,ie,K,Ge.getProjection(),mt),hs=l.translatePosMatrix(vs,Pe,y,T,!0),Fn=l.translatePosMatrix(rt,Pe,y,T),Ao=Ir?js:Jn,bs=ie&&!fe&&!rr;let Mo=Le;!Re&&!K.mercatorFromTransition||ie||(Mo=$l(K));const lc=ot?Mo:Le,Kh=n.getColorAdjustmentMatrix(B,V,H,Y),Qa=Ul(Ci.kind,qn,bs,fe,l,Fn,Ao,hs,te,!1,_r,[0,0],0,qe,at,Te,Ut,lc,Ge.getProjection(),Qi,ri,Kh,Li,null),Jh=Pe.imageAtlasTexture?Pe.imageAtlasTexture:null,cc=n.layout.get("icon-size").constantOr(0)!==1||Ge.iconsNeedLinear,Su=Ge.sdfIcons||l.options.rotating||l.options.zooming||cc||kn?J.LINEAR:J.NEAREST,Eu=Ge.sdfIcons&&n.paint.get("icon-halo-width").constantOr(1)!==0,Ps=l.terrain&&fe&&rr?o.bi(o.bz(),Jn):js;if(rr&&Ge.icon){const el=K.elevation,aa=el?el.getAtTileOffsetFunc(qe,K.center.lat,K.worldSize,Ge.getProjection()):null,Co=Pc(rt,Pe.tileID.canonical,fe,ie,K,Ge.getProjection(),mt);zc(Ge,rt,l,!1,Co,vs,fe,z,aa,qe)}return{program:on,buffers:Ge.icon,uniformValues:Qa,atlasTexture:Jh,atlasTextureIcon:null,atlasInterpolation:Su,atlasInterpolationIcon:null,isSDF:Ge.sdfIcons,hasHalo:Eu,depthMode:cr,tile:Pe,renderWithShadows:lr,labelPlaneMatrixInv:Ps}},qi=()=>{const rr=ne&&n.layout.get("symbol-placement")!=="point",Ri=[],Ir=rr||le||bt,Ti=Ge.elevationType==="road"&&_e,Fr=l.shadowRenderer,lr=Ti&&!!Fr&&Fr.enabled,Qi=Bi(lr),cr=Ti?de:Fe;l.terrainRenderModeElevated()&&_e&&Ri.push("PITCH_WITH_MAP_TERRAIN"),ot&&(Ri.push("PROJECTION_GLOBE_VIEW"),Ir&&Ri.push("PROJECTED_POS_ON_VIEWPORT")),Ge.text.zOffsetVertexBuffer&&Ri.push("Z_OFFSET"),Ge.iconsInText&&Ri.push("RENDER_TEXT_AND_SYMBOL"),Ri.push("RENDER_SDF"),lr&&Ri.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Ti&&Ge.text.orientationVertexBuffer&&Ri.push("ELEVATED_ROADS"),ir(Ri);const Li=Ge.text.programConfigurations.get(n.id),Mr=l.getOrCreateProgram("symbol",{config:Li,defines:Ri});let on,_r=[0,0],Ci=null;const qn=Ge.textSizeData;Ge.iconsInText&&(_r=Pe.imageAtlasTexture?Pe.imageAtlasTexture.size:[0,0],Ci=Pe.imageAtlasTexture?Pe.imageAtlasTexture:null,on=_e||!K.isOrthographic||l.options.rotating||l.options.zooming||qn.kind==="composite"||qn.kind==="camera"?J.LINEAR:J.NEAREST);const kn=Pe.glyphAtlasTexture?Pe.glyphAtlasTexture.size:[0,0],Jn=n.layout.get("text-size-scale-range"),vs=o.ay(l.scaleFactor,Jn[0],Jn[1]),hs=o.bH(qn,K.zoom,vs),Fn=Bs(rt,Pe.tileID.canonical,_e,
2655ne,K,Ge.getProjection(),mt),Ao=Rc(rt,Pe.tileID.canonical,_e,ne,K,Ge.getProjection(),mt),bs=l.translatePosMatrix(Ao,Pe,x,S,!0),Mo=l.translatePosMatrix(rt,Pe,x,S),lc=Ir?js:Fn,Kh=ne&&!_e&&!rr;let Qa=Le;!Re&&!K.mercatorFromTransition||ne||(Qa=$l(K));const Jh=Ul(qn.kind,hs,Kh,_e,l,Mo,lc,bs,te,!0,kn,_r,0,qe,at,Te,Ut,ot?Qa:Le,Ge.getProjection(),Qi,ri,null,null,vs),cc=Pe.glyphAtlasTexture?Pe.glyphAtlasTexture:null,Su=J.LINEAR,Eu=n.paint.get("text-halo-width").constantOr(1)!==0,Ps=l.terrain&&_e&&rr?o.bi(o.bz(),Fn):js;if(rr&&Ge.text){const el=K.elevation,aa=el?el.getAtTileOffsetFunc(qe,K.center.lat,K.worldSize,Ge.getProjection()):null,Co=Pc(rt,Pe.tileID.canonical,_e,ne,K,Ge.getProjection(),mt);zc(Ge,rt,l,!0,Co,Ao,_e,k,aa,qe)}return{program:Mr,buffers:Ge.text,uniformValues:Jh,atlasTexture:cc,atlasTextureIcon:Ci,atlasInterpolation:Su,atlasInterpolationIcon:on,isSDF:!0,hasHalo:Eu,depthMode:cr,tile:Pe,renderWithShadows:lr,labelPlaneMatrixInv:Ps}},Rr=Ge.icon.segments.get().length,Jt=Ge.text.segments.get().length,oi=Rr&&!m.onlyText?ji():null,mi=Jt&&!m.onlyIcons?qi():null,ar=n.paint.get("icon-opacity").constantOr(1),Ur=n.paint.get("text-opacity").constantOr(1);if(Me&&Ge.canOverlap){Ce=!0;const rr=ar&&!m.onlyText?Ge.icon.segments.get():[],Ri=Ur&&!m.onlyIcons?Ge.text.segments.get():[];for(const Ir of rr)xe.push({segments:new o.bd([Ir]),sortKey:Ir.sortKey,state:oi});for(const Ir of Ri)xe.push({segments:new o.bd([Ir]),sortKey:Ir.sortKey,state:mi})}else m.onlyText||xe.push({segments:ar?Ge.icon.segments:new o.bd([]),sortKey:0,state:oi}),m.onlyIcons||xe.push({segments:Ur?Ge.text.segments:new o.bd([]),sortKey:0,state:mi})}Ce&&xe.sort((qe,Pe)=>qe.sortKey-Pe.sortKey);for(const qe of xe){const Pe=qe.state;if(Pe)if(l.terrain?l.terrain.setupElevationDraw(Pe.tile,Pe.program,{useDepthForOcclusion:K.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Pe.labelPlaneMatrixInv}):l.setupDepthForOcclusion(K.depthOcclusionForSymbolsAndCircles,Pe.program),ee.activeTexture.set(J.TEXTURE0),Pe.atlasTexture&&Pe.atlasTexture.bind(Pe.atlasInterpolation,J.CLAMP_TO_EDGE,!0),Pe.atlasTextureIcon&&(ee.activeTexture.set(J.TEXTURE1),Pe.atlasTextureIcon&&Pe.atlasTextureIcon.bind(Pe.atlasInterpolationIcon,J.CLAMP_TO_EDGE,!0)),Pe.renderWithShadows&&l.shadowRenderer.setupShadows(Pe.tile.tileID.toUnwrapped(),Pe.program,"vector-tile",Pe.tile.tileID.overscaledZ),l.uploadCommonLightUniforms(l.context,Pe.program),Pe.hasHalo){const Ge=Pe.uniformValues;Ge.u_is_halo=1,Va(Pe.buffers,qe.segments,n,l,Pe.program,Pe.depthMode,d,p,Ge,2),Ge.u_is_halo=0}else{if(Pe.isSDF){const Ge=Pe.uniformValues;Pe.hasHalo&&(Ge.u_is_halo=1,Va(Pe.buffers,qe.segments,n,l,Pe.program,Pe.depthMode,d,p,Ge,1)),Ge.u_is_halo=0}Va(Pe.buffers,qe.segments,n,l,Pe.program,Pe.depthMode,d,p,Pe.uniformValues,1)}}}function Va(l,t,n,c,d,p,m,y,x,T){const S=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,p,m,y,zt.disabled,x,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,c.transform.zoom,l.programConfigurations.get(n.id),S,T)}function ou(l,t){const n=1<<l.canonical.z,c=(t.x*n-l.canonical.x-l.wrap*n)*o.aj,d=(t.y*n-l.canonical.y)*o.aj,p=o.dS(t.z,t.y);return o.cS(c,d,p)}function Mh(l,t,n,c,d){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const p=l.context.gl,m=new nt(l.context.gl.LEQUAL,nt.ReadWrite,l.depthRangeFor3D),y=new nt(l.context.gl.GREATER,nt.ReadWrite,l.depthRangeFor3D),x=function(C){const L=o.cJ(C.pitch);let z=.01;return C.isOrthographic&&(z=o.ai(1e-4,z,o.cN(L>=en?1:L/en))),2*z}(l.transform),T=l.transform.getFreeCameraOptions().position,S="elevatedStructuresDepthReconstruct",M=l.getOrCreateProgram(S,{defines:["DEPTH_RECONSTRUCTION"]}),I=l.getOrCreateProgram(S);for(const C of c){const L=t.getTile(C),z=L.getBucket(n);if(!z)continue;const k=z.elevatedStructures;if(!k)continue;const B=z.elevationBufferData.heightRange,V=ou(C.toUnwrapped(),T),H=l.translatePosMatrix(C.projMatrix,L,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let Y,te,ee,J;if(d==="initialize"){if(!B||B.min>=1||k.depthSegments.segments[0].primitiveLength===0)continue;Y=iu(H,V,x,1,0),te=m,ee=k.depthSegments,J=M}else if(d==="reset"){if(!B||B.min>=0||k.maskSegments.segments[0].primitiveLength===0)continue;Y=iu(H,V,0,0,1),te=y,ee=k.maskSegments,J=M}else if(d==="geometry"){if(k.depthSegments.segments[0].primitiveLength===0)continue;Y=iu(H,V,x,1,0),te=m,ee=k.depthSegments,J=I}J.draw(l,p.TRIANGLES,te,$t.disabled,ui.disabled,zt.disabled,Y,n.id,k.vertexBuffer,k.indexBuffer,ee,n.paint,l.transform.zoom)}}
2655function Ch(l,t,n){const{painter:c,sourceCache:d,layer:p,coords:m,colorMode:y,elevationType:x,terrainEnabled:T,pass:S}=l,M=c.context.gl,I=p.paint.get("fill-pattern"),C=p.paint.get("fill-pattern-cross-fade"),L=I.constantOr(null);let z=x;x!=="road"||t&&!T||(z="none");const k=z==="road",B=l.painter.shadowRenderer,V=k&&!!B&&B.enabled,H=new nt(c.context.gl.LEQUAL,nt.ReadOnly,c.depthRangeFor3D);let Y=[0,0,0];if(V){const J=c.style.directionalLight,K=c.style.ambientLight;J&&K&&(Y=Wo(c.style,J,K))}const te=I&&I.constantOr(1),ee=(J,K)=>{let ie,ne,fe,_e,Me;K?(ie=te&&!p.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",fe=M.LINES):(ie=te?"fillPattern":"fill",fe=M.TRIANGLES);for(const Ce of m){const Fe=d.getTile(Ce);if(te&&!Fe.patternsLoaded())continue;const de=Fe.getBucket(p);if(!de)continue;const Te=t?de.elevationBufferData:de.bufferData;if(Te.isEmpty())continue;c.prepareDrawTile();const le=Te.programConfigurations.get(p.id),Re=c.isTileAffectedByFog(Ce),xe=[],Le=[];k&&(xe.push("ELEVATED_ROADS"),Le.push(Te.elevatedLayoutVertexBuffer)),V&&xe.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),te&&(c.context.activeTexture.set(M.TEXTURE0),Fe.imageAtlasTexture&&Fe.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),le.updatePaintBuffers());let qe=!1;if(L&&Fe.imageAtlas){const rt=Fe.imageAtlas,mt=o.dN.from(L),gt=mt.getPrimary().scaleSelf(o.q.devicePixelRatio).toString(),bt=mt.getSecondary(),Ut=rt.patternPositions.get(gt),ri=bt?rt.patternPositions.get(bt.scaleSelf(o.q.devicePixelRatio).toString()):null;qe=!!Ut&&!!ri,Ut&&le.setConstantPatternPositions(Ut,ri)}C>0&&(qe||le.getPatternTransitionVertexBuffer("fill-pattern"))&&xe.push("FILL_PATTERN_TRANSITION");const Pe=c.getOrCreateProgram(ie,{config:le,overrideFog:Re,defines:xe}),Ge=c.translatePosMatrix(Ce.projMatrix,Fe,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));V&&B.setupShadows(Fe.tileID.toUnwrapped(),Pe,"vector-tile",Fe.tileID.overscaledZ);const ot=p.paint.get("fill-emissive-strength");if(K){_e=Te.lineIndexBuffer,Me=Te.lineSegments;const rt=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[M.drawingBufferWidth,M.drawingBufferHeight];ne=ie==="fillOutlinePattern"&&te?am(Ge,ot,c,Fe,rt,Y,C):om(Ge,ot,rt,Y)}else _e=Te.indexBuffer,Me=Te.triangleSegments,ne=te?ap(Ge,ot,c,Fe,Y,C):Qo(Ge,ot,Y);c.uploadCommonUniforms(c.context,Pe,Ce.toUnwrapped());let at=J;(x==="road"&&!T||x==="offset")&&(at=H),Pe.draw(c,fe,at,n||c.stencilModeForClipping(Ce),y,zt.disabled,ne,p.id,Te.layoutVertexBuffer,_e,Me,p.paint,c.transform.zoom,le,Le)}};c.renderPass===S&&ee(c.depthModeForSublayer(1,c.renderPass==="opaque"?nt.ReadWrite:nt.ReadOnly),!1),z==="none"&&c.renderPass==="translucent"&&p.paint.get("fill-antialias")&&ee(c.depthModeForSublayer(p.getPaintProperty("fill-outline-color")?2:0,nt.ReadOnly),!0)}function Gs(l,t,n,c,d,p,m,y){n.resetLayerRenderingStats(l);const x=l.context,T=x.gl,S=l.transform,M=n.paint.get("fill-extrusion-pattern"),I=n.paint.get("fill-extrusion-pattern-cross-fade"),C=M.constantOr(null),L=M.constantOr(1),z=n.paint.get("fill-extrusion-opacity"),k=l.style.enable3dLights(),B=n.paint.get(k&&!L?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),V=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),B],H=n.layout.get("fill-extrusion-edge-radius"),Y=H>0&&!n.paint.get("fill-extrusion-rounded-roof"),te=Y?0:H,ee=S.projection.name==="globe"?o.dV():0,J=S.projection.name==="globe",K=J?o.ah(S.zoom):0,ie=[o.aD(S.center.lng),o.aH(S.center.lat)],ne=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",fe=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ne?null:n.lut).toArray01().slice(0,3),_e=n.paint.get("fill-extrusion-flood-light-intensity"),Me=n.paint.get("fill-extrusion-vertical-scale"),Ce=n.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Fe=n.paint.get("fill-extrusion-height-alignment"),de=n.paint.get("fill-extrusion-base-alignment"),Te=Es(l,n.paint.get("fill-extrusion-cutoff-fade-range")),le=[];let Re;J&&le.push("PROJECTION_GLOBE_VIEW"),V[0]>0&&le.push("FAUX_AO"),Y&&le.push("ZERO_ROOF_RADIUS"),y&&le.push("HAS_CENTROID"),_e>0&&le.push("FLOOD_LIGHT"),Te.shouldRenderCutoff&&le.push("RENDER_CUTOFF"),Ce&&le.push("RENDER_WALL_MODE");const xe=l.renderPass==="shadow",Le=l.shadowRenderer,qe=xe&&!!Le,Pe=xe?zt.disabled:zt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let Ge=[0,0,0];if(Le){const rt=l.style.directionalLight,mt=l.style.ambientLight;rt&&mt&&(Ge=Wo(l.style,rt,mt)),xe||(le.push("RENDER_SHADOWS","DEPTH_TEXTURE"),Le.useNormalOffset&&le.push("NORMAL_OFFSET")),Re=le.concat(["SHADOWS_SINGLE_CASCADE"])}const ot=qe?"fillExtrusionDepth":L?"fillExtrusionPattern":"fillExtrusion",at=n.getLayerRenderingStats();for(const rt of c){const mt=t.getTile(rt),gt=mt.getBucket(n);if(!gt||gt.projection.name!==S.projection.name)continue;let bt=!1;Le&&(bt=Le.getMaxCascadeForTile(rt.toUnwrapped())===0);const Ut=l.isTileAffectedByFog(rt),ri=gt.programConfigurations.get(n.id);let Bi=!1;if(C&&mt.imageAtlas){const mi=mt.imageAtlas,ar=o.dN.from(C),Ur=ar.getPrimary().scaleSelf(o.q.devicePixelRatio).toString(),rr=ar.getSecondary(),Ri=mi.patternPositions.get(Ur),Ir=rr?mi.patternPositions.get(rr.scaleSelf(o.q.devicePixelRatio).toString()):null;Bi=!!Ri&&!!Ir,Ri&&ri.setConstantPatternPositions(Ri,Ir)}I>0&&(Bi||ri.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&le.push("FILL_EXTRUSION_PATTERN_TRANSITION");const ir=l.getOrCreateProgram(ot,{config:ri,defines:bt?Re:le,overrideFog:Ut});if(l.terrain&&l.terrain.setupElevationDraw(mt,ir,{useMeterToDem:!0}),!gt.centroidVertexBuffer){const mi=ir.attributes.a_centroid_pos;mi!==void 0&&T.vertexAttrib2f(mi,0,0)}!xe&&Le&&Le.setupShadows(mt.tileID.toUnwrapped(),ir,"vector-tile",mt.tileID.overscaledZ
2655),L&&(l.context.activeTexture.set(T.TEXTURE0),mt.imageAtlasTexture&&mt.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ri.updatePaintBuffers());const ji=n.paint.get("fill-extrusion-vertical-gradient"),qi=1/gt.tileToMeter;let Rr;if(xe&&Le){if(vo(mt.tileID,gt,l))continue;const mi=Le.calculateShadowPassMatrixFromTile(mt.tileID.toUnwrapped());Rr=sp(mi,te,qi,Me,Fe,de)}else{const mi=l.translatePosMatrix(rt.expandedProjMatrix,mt,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ar=S.projection.createInversionMatrix(S,rt.canonical);Rr=L?op(mi,l,ji,z,V,te,qi,rt,mt,ee,Fe,de,K,ie,ar,fe,Me,I):Vl(mi,l,ji,z,V,te,qi,rt,ee,Fe,de,K,ie,ar,fe,Me,_e,Ge)}l.uploadCommonUniforms(x,ir,rt.toUnwrapped(),null,Te);let Jt=gt.segments;if(S.projection.name==="mercator"&&!xe&&(Jt=gt.getVisibleSegments(mt.tileID,l.terrain,l.transform.getFrustum(0)),!Jt.get().length))continue;if(at)if(xe)for(const mi of Jt.get())at.numRenderedVerticesInShadowPass+=mi.primitiveLength;else for(const mi of Jt.get())at.numRenderedVerticesInTransparentPass+=mi.primitiveLength;const oi=[];(l.terrain||y)&&oi.push(gt.centroidVertexBuffer),J&&oi.push(gt.layoutVertexExtBuffer),Ce&&oi.push(gt.wallVertexBuffer),ir.draw(l,x.gl.TRIANGLES,d,p,m,Pe,Rr,n.id,gt.layoutVertexBuffer,gt.indexBuffer,Jt,n.paint,l.transform.zoom,ri,oi)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}function $s(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,z,k,B,V){const H=l.context,Y=H.gl,te=l.transform,ee=l.transform.zoom,J=[],K=Es(l,n.paint.get("fill-extrusion-cutoff-fade-range"));T==="clear"?(J.push("CLEAR_SUBPASS"),V&&(J.push("CLEAR_FROM_TEXTURE"),H.activeTexture.set(Y.TEXTURE0),V.bind(Y.LINEAR,Y.CLAMP_TO_EDGE))):T==="sdf"&&J.push("SDF_SUBPASS"),k&&J.push("HAS_CENTROID"),K.shouldRenderCutoff&&J.push("RENDER_CUTOFF");const ie=n.layout.get("fill-extrusion-edge-radius"),ne=(fe,_e,Me,Ce,Fe)=>{const de=_e.programConfigurations.get(n.id),Te=l.isTileAffectedByFog(fe),le=l.getOrCreateProgram("fillExtrusionGroundEffect",{config:de,defines:J,overrideFog:Te}),Re=((Le,qe,Pe,Ge,ot,at,rt,mt,gt,bt,Ut)=>({u_matrix:qe,u_opacity:Pe,u_ao_pass:Ge?1:0,u_meter_to_tile:ot,u_ao:at,u_flood_light_intensity:rt,u_flood_light_color:mt,u_attenuation:gt,u_edge_radius:bt,u_fb:0,u_fb_size:Ut,u_dynamic_offset:1}))(0,Ce,S,x,Fe,[M,I*Fe],C,L,z,ee>=17?0:ie*Fe,V?V.size[0]:0),xe=[];k&&xe.push(_e.hiddenByLandmarkVertexBuffer),l.uploadCommonUniforms(H,le,fe.toUnwrapped(),null,K),le.draw(l,H.gl.TRIANGLES,d,p,m,y,Re,n.id,_e.vertexBuffer,_e.indexBuffer,Me,n.paint,ee,de,xe)};for(const fe of c){const _e=t.getTile(fe),Me=_e.getBucket(n);if(!Me||Me.projection.name!==te.projection.name||!Me.groundEffect||Me.groundEffect&&!Me.groundEffect.hasData())continue;const Ce=Me.groundEffect,Fe=1/Me.tileToMeter;{const de=l.translatePosMatrix(fe.projMatrix,_e,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Te=Ce.getDefaultSegment();ne(fe,Ce,Te,de,Fe)}if(B)for(let de=0;de<4;de++){const Te=o.dT[de](fe),le=t.getTile(Te);if(!le)continue;const Re=le.getBucket(n);if(!Re||Re.projection.name!==te.projection.name||!Re.groundEffect||Re.groundEffect&&!Re.groundEffect.hasData())continue;const xe=Re.groundEffect;let Le,qe;de===0?(Le=[-8192,0,0],qe=1):de===1?(Le=[o.aj,0,0],qe=0):de===2?(Le=[0,-8192,0],qe=3):(Le=[0,o.aj,0],qe=2);const Pe=xe.regionSegments[qe];if(!Pe)continue;const Ge=new Float32Array(16);o.bo(Ge,fe.projMatrix,Le),ne(fe,xe,Pe,l.translatePosMatrix(Ge,_e,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Fe)}}}function st(l,t,n,c,d,p,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=p?p.findDEMTileFor(n):null;if(!(y&&y.dem||m))return;p&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const x=B=>new o.P(Math.ceil((B+o.dX)*o.dY),0),T=B=>{const V=t.getSource().minzoom,H=te=>{const ee=t.getTileByID(te);if(ee&&ee.hasData())return ee.getBucket(d)},Y=[0,-1,1];for(const te of Y){if(B.overscaledZ+te<V)continue;const ee=H(B.calculateScaledKey(B.overscaledZ+te));if(ee)return ee}},S=[0,0,0],M=(B,V)=>(S[0]=Math.min(B.min.y,V.min.y),S[1]=Math.max(B.max.y,V.max.y),S[2]=o.aj-V.min.x>B.max.x?V.min.x-o.aj:B.max.x,S),I=(B,V)=>(S[0]=Math.min(B.min.x,V.min.x),S[1]=Math.max(B.max.x,V.max.x),S[2]=o.aj-V.min.y>B.max.y?V.min.y-o.aj:B.max.y,S),C=[(B,V)=>M(B,V),(B,V)=>M(V,B),(B,V)=>I(B,V),(B,V)=>I(V,B)],L=(B,V,H,Y,te,ee,J)=>{if(!p)return 0;const K=[[ee?H:B,ee?B:H,0],[ee?H:V,ee?V:H,0]],ie=J<0?o.aj+J:J,ne=[ee?ie:(B+V)/2,ee?(B+V)/2:ie,0];return H===0&&J<0||H!==0&&J>0?p.getForTilePoints(te,[ne],!0,Y):K.push(ne),p.getForTilePoints(n,K,!0,y),Math.max(K[0][2],K[1][2],ne[2])/p.exaggeration()};for(let B=0;B<4;B++){const V=c.borderFeatureIndices[B];if(V.length===0)continue;const H=o.dT[B](n),Y=T(H);if(!(Y&&Y instanceof o.dU))continue;const te=p?p.findDEMTileFor(H):null;if(!(te&&te.dem||m)||(p&&te&&te.dem&&c.borderDEMTileTimestamp[B]!==te.dem._timestamp&&(c.borderDoneWithNeighborZ[B]=-1,c.borderDEMTileTimestamp[B]=te.dem._timestamp),c.borderDoneWithNeighborZ[B]===Y.canonical.z))continue;Y.centroidVertexArray.length===0&&Y.createCentroidsBuffer();const ee=(B<2?1:5)-B,J=Y.borderDoneWithNeighborZ[ee]!==c.canonical.z,K=Y.borderFeatureIndices[ee];let ie=0;if(c.canonical.z!==Y.canonical.z){for(const ne of V)c.showCentroid(c.featuresOnBorder[ne]);if(J)for(const ne of K)Y.showCentroid(Y.featuresOnBorder[ne]);c.borderDoneWithNeighborZ[B]=Y.canonical.z,Y.borderDoneWithNeighborZ[ee]=c.canonical.z}for(const ne of V){const fe=c.featuresOnBorder[ne],_e=c.centroidData[fe.centroidDataIndex],Me=fe.borders[B];let Ce;for(;ie<K.length;){Ce=Y.featuresOnBorder[K[ie]];const Fe=Ce.borders[ee];if(Fe[1]>Me[0]+3||Fe[0]>Me[0]-3)break;Y.showCentroid(Ce),ie++}if(Ce&&ie<K.length){const Fe=ie;let de=0;for(;!(Ce.borders[ee][0]>Me[1]-3)&&(de++,++ie!==K.length);)Ce=Y.featuresOnBorder[K[ie]];Ce=Y.featuresOnBorder[K[Fe]];let Te=!1;if(de>=1){const xe=Ce.borders[ee];Math.abs(Me[0]-xe[0])<3&&Math.abs(Me[1]-xe[1])<3&&(de=1,Te=!0,ie=Fe+1)}else if(de===0){c.showCentroid(fe);continue}const le=Y.centroidData[Ce.centroidDataIndex];m&&Te&&(((z=_e).flags|(k=le).flags)&o.dW?(z.flags|=o.dW,k.flags|=o.dW):(z.flags&=2147483647,k.flags&=2147483647));const Re=fe.intersectsCount()>1||Ce.intersectsCount()>1;
2655if(de>1)ie=Fe,_e.centroidXY=le.centroidXY=new o.P(0,0);else if(te&&te.dem&&!Re){const xe=C[B](_e,le),Le=B%2?o.aj-1:0,qe=L(xe[0],Math.min(o.aj-1,xe[1]),Le,te,H,B<2,xe[2]);_e.centroidXY=le.centroidXY=x(qe)}else Re?_e.centroidXY=le.centroidXY=new o.P(0,0):(_e.centroidXY=c.encodeBorderCentroid(fe),le.centroidXY=Y.encodeBorderCentroid(Ce));c.writeCentroidToBuffer(_e),Y.writeCentroidToBuffer(le)}else c.showCentroid(fe)}c.borderDoneWithNeighborZ[B]=Y.canonical.z,Y.borderDoneWithNeighborZ[ee]=c.canonical.z}var z,k;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const fp=[1,0,0],mp=[0,1,0],xo=[0,0,1];function vo(l,t,n){const c=n.transform,d=n.shadowRenderer;if(!d)return!0;const p=l.toUnwrapped(),m=c.tileSize*d._cascades[n.currentShadowCascade].scale;let y=t.maxHeight;if(c.elevation){const z=c.elevation.getMinMaxForTile(l);z&&(y+=z.max)}const x=[...d.shadowDirection];x[2]=-x[2];const T=d.computeSimplifiedTileShadowVolume(p,y,m,x);if(!T)return!1;const S=[fp,mp,xo,x,[x[0],0,x[2]],[0,x[1],x[2]]],M=c.projection.name==="globe",I=c.scaleZoom(m),C=o.cn.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,I,!M),L=d.getCurrentCascadeFrustum();return C.intersectsPrecise(T.vertices,T.planes,S)===0||L.intersectsPrecise(T.vertices,T.planes,S)===0}function St(l){return[l[0]*o.dZ,l[1]*o.dZ,l[2]*o.dZ,0]}function Hl(l,t,n,c,d,p,m,y,x){const T=c.getSource(),S=n.globeSharedBuffers;if(!S)return;let M,I,C;if(t&&(M=c.getTile(t)),T instanceof o.aP?(I=T.texture,C=o.ds(0,0,n.transform)):M&&t&&(I=M.texture,C=o.ds(t.canonical.z,t.canonical.x,n.transform)),!I||!C)return;l||(C=o.cE(o.bz(),C,[1,-1,1]));const L=n.context,z=L.gl,k=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,B=n.colorModeForDrapableLayerRenderPass(p),V=m.defines;V.push("GLOBE_POLES");const H=new nt(z.LEQUAL,nt.ReadWrite,n.depthRangeFor3D),Y=Float32Array.from(n.transform.expandedFarZProjMatrix),te=Float32Array.from(o.bh(o.dr(new o.cp(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),L.activeTexture.set(z.TEXTURE0),I.bind(k,z.CLAMP_TO_EDGE),L.activeTexture.set(z.TEXTURE1),I.bind(k,z.CLAMP_TO_EDGE),"useMipmap"in I&&L.extTextureFilterAnisotropic&&n.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const[ee,J,K,ie]=t?S.getPoleBuffers(t.canonical.z,!1):S.getPoleBuffers(0,!0),ne=d.paint.get("raster-elevation");let fe;l?(fe=ee,n.renderDefaultNorthPole=ne!==0):(fe=J,n.renderDefaultSouthPole=ne!==0);const _e=St(m.mix),Me=((Fe,de,Te,le,Re,xe,Le,qe,Pe,Ge,ot,at,rt)=>Sh(Fe,de,Te,new Float32Array(16),new Float32Array(9),[0,0],le,[0,0],[0,0,0,0],1,{opacity:1,mix:0},xe,[0,0],qe,2,Ge,ot,at,1,0,rt))(Y,te,C,o.ah(n.transform.zoom),0,d,0,ne,0,_e,m.offset,m.range,p),Ce=n.getOrCreateProgram("raster",{defines:V});n.uploadCommonUniforms(L,Ce,null),Ce.draw(n,z.TRIANGLES,H,x,B,y,Me,d.id,fe,K,ie)}function pm(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}function fm(l,t,n,c){if(l)return t instanceof co&&l instanceof xa?t.getTextureDescriptor(l,n,!0):{texture:l.texture,mix:St(c.mix),offset:c.offset,buffer:0,tileSize:1}}var Ph=o.d_([{name:"a_index",type:"Int16",components:1}]);class _p{constructor(t,n,c,d){const p={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new o.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new o.T(t,p,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(n,d),this.lastInvalidatedAt=0}updateParticleTexture(t,n){if(this.particleTextureDimension===n.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,d=n.width*n.height;this.particleTexture0=new o.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new o.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1});const p=new o.d$;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,Ph.members,!0),this.particleSegment=o.bd.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=n.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=o.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function mm(l,t,n){if(!l)return null;const c=t.getTextureDescriptor(l,n,!0);if(!c)return null;let{texture:d,mix:p,offset:m,tileSize:y,buffer:x,format:T}=c;if(!d||!T)return null;let S=!1;return T==="uint32"&&(S=!0,p[3]=0,p=ea(o.e0,p,[0,n.paint.get("raster-particle-max-speed")]),m=Th(o.e0,m,[0,n.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(y+2*x),y/(y+2*x)],tileSize:y,scalarData:S,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function gp(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}
vendor: 11,442 bytes, line 2655
2655const _m=new o.am(1,0,0,1),gm=new o.am(0,1,0,1),$n=new o.am(0,0,1,1),Rh=new o.am(1,0,1,1),Mn=new o.am(0,1,1,1);function qs(l,t,n,c,d,p){for(let m=0;m<n.length;m++)if(d){const T=new o.am(c.r*.8,c.g*.8,c.b*.8,1);ia(l,t,n[m],c,-1,-1,p),ia(l,t,n[m],c,-1,1,p),ia(l,t,n[m],c,1,1,p),ia(l,t,n[m],c,1,-1,p),ia(l,t,n[m],T,0,0,p)}else ia(l,t,n[m],c,0,0,p)}function ia(l,t,n,c,d,p,m){const y=l.context,x=l.transform,T=y.gl,S=x.projection.name==="globe",M=S?["PROJECTION_GLOBE_VIEW"]:[];let I=o.bw(n.projMatrix);if(S&&o.ah(x.zoom)>0){const _e=o.bg(n.canonical,x),Me=o.e1(_e);I=o.az(new Float32Array(16),x.globeMatrix,Me),o.az(I,x.projMatrix,I)}const C=o.bz();C[12]+=2*d/(o.q.devicePixelRatio*x.width),C[13]+=2*p/(o.q.devicePixelRatio*x.height),o.az(I,C,I);const L=l.getOrCreateProgram("debug",{defines:M}),z=t.getTileByID(n.key);l.terrain&&l.terrain.setupElevationDraw(z,L);const k=nt.disabled,B=$t.disabled,V=l.colorModeForRenderPass(),H="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?z._makeGlobeTileDebugBuffers(l.context,x):z._makeDebugTileBoundsBuffers(l.context,x.projection);const Y=z._tileDebugBuffer||l.debugBuffer,te=z._tileDebugIndexBuffer||l.debugIndexBuffer,ee=z._tileDebugSegments||l.debugSegments;if(L.draw(l,T.LINE_STRIP,k,B,V,zt.disabled,ru(I,c.toPremultipliedRenderColor(null)),H,Y,te,ee,null,null,null,[z._globeTileDebugBorderBuffer]),m){const _e=z.latestRawTileData,Me=Math.floor((_e&&_e.byteLength||0)/1024);let Ce=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(Ce+=` => ${n.overscaledZ}`),Ce+=` ${z.state}`,Ce+=` ${Me}kb`,function(Fe,de){Fe.initDebugOverlayCanvas();const Te=Fe.debugOverlayCanvas,le=Fe.context.gl,Re=Fe.debugOverlayCanvas.getContext("2d");Re.clearRect(0,0,Te.width,Te.height),Re.shadowColor="white",Re.shadowBlur=2,Re.lineWidth=1.5,Re.strokeStyle="white",Re.textBaseline="top",Re.font="bold 36px Open Sans, sans-serif",Re.fillText(de,5,5),Re.strokeText(de,5,5),Fe.debugOverlayTexture.update(Te),Fe.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,Ce)}const J=t.getTile(n).tileSize,K=512/Math.min(J,512)*(n.overscaledZ/x.zoom)*.5,ie=z._tileDebugTextBuffer||l.debugBuffer,ne=z._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,fe=z._tileDebugTextSegments||l.debugSegments;L.draw(l,T.TRIANGLES,k,B,ui.alphaBlended,zt.disabled,ru(I,o.am.transparent.toPremultipliedRenderColor(null),K),H,ie,ne,fe,null,null,null,[z._globeTileDebugTextBuffer])}function au(l,t,n,c){Ua(l,0,t+n/2,l.transform.width,n,c)}function lu(l,t,n,c){Ua(l,t-n/2,0,n,l.transform.height,c)}function Ua(l,t,n,c,d,p){const m=l.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*o.q.devicePixelRatio,n*o.q.devicePixelRatio,c*o.q.devicePixelRatio,d*o.q.devicePixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}const yp=o.d_([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Hs}=yp;function Wi(l,t,n,c){l.emplaceBack(t,n,c)}class Zl{constructor(t){this.vertexArray=new o.e2,this.indices=new o.a_,Wi(this.vertexArray,-1,-1,1),Wi(this.vertexArray,1,-1,1),Wi(this.vertexArray,-1,1,1),Wi(this.vertexArray,1,1,1),Wi(this.vertexArray,-1,-1,-1),Wi(this.vertexArray,1,-1,-1),Wi(this.vertexArray,-1,1,-1),Wi(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Hs),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=o.bd.simpleSegment(0,0,36,12)}}function bo(l,t,n,c,d,p){const m=l.context.gl,y=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),S=((M,I,C,L,z)=>({u_matrix_3f:M,u_sun_direction:I,u_sun_intensity:C,u_color_tint_r:[L.r,L.g,L.b,L.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(o.e4(o.dx(),c),d,T,y.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),n.draw(l,m.TRIANGLES,nt.disabled,$t.disabled,ui.unblended,zt.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const xp=o.d_([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class vp{constructor(t){const n=new o.e5;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);const c=new o.a_;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,xp.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=o.bd.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const bp=o.d_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class ym{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ja{constructor(t){this.colorModeAlphaBlendedWriteRGB=new ui([1,Zo,1,Zo],o.am.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ui([1,0,1,0],o.am.transparent,[!1,!1,!1,!0]),this.params=new ym,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(t){const n=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new vp(n);const c=this.params.sizeRange,d=this.params.intensityRange,p=function(S){const M=o.e7(30),I=[];for(let C=0;C<S;++C){const L=2*Math.PI*M(),z=Math.acos(1-2*M())-.5*Math.PI;I.push(o.cS(Math.cos(z)*Math.cos(L),Math.cos(z)*Math.sin(L),Math.sin(z)))}return I}(this.params.starsCount),m=o.e7(300),y=new o.e6,x=new o.a_;let T=0;for(let S=0;S<p.length;++S){const M=o.bY([],p[S],200),I=Math.max(0,1+.01*c*(1*m()-.5)),C=Math.max(0,1+.01*d*(1*m()-.5));y.emplaceBack(M[0],M[1],M[2],-1,-1,I,C),y.emplaceBack(M[0],M[1],M[2],1,-1,I,C),y.emplaceBack(M[0],M[1],M[2],1,1,I,C),y.emplaceBack(M[0],M[1],M[2],-1,1,I,C),x.emplaceBack(T+0,T+1,T+2),x.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=n.createVertexBuffer(y,bp.members),this.starsIdx=n.createIndexBuffer(x),this.starsSegments=o.bd.simpleSegment(0,0,y.length,x.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,n){const c=t.context,d=c.gl,p=t.transform,m=new nt(d.LEQUAL,nt.ReadOnly,[0,1]),y=o.ah(p.zoom),x=t.style.getLut(n.scope),T=n.properties.get("color-use-theme")==="none",S=n.properties.get("color").toNonPremultipliedRenderColor(T?null:x).toArray01(),M=n.properties.get("high-color-use-theme")==="none",I=n.properties.get("high-color").toNonPremultipliedRenderColor(M?null:x).toArray01(),C=n.properties.get("space-color-use-theme")==="none",L=n.properties.get("space-color").toNonPremultipliedRenderColor(C?null:x).toArray01(),z=5e-4,k=o.e8(n.properties.get("horizon-blend"),0,1,z,.25),B=o.dl(t,c,p)&&k===z?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,V=t.frameCounter/1e3%1,H=o.ae(p.globeCenterInViewSpace),Y=Math.sqrt(Math.pow(H,2)-Math.pow(B,2)),te=Math.acos(Y/H),ee=J=>{const K=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];J&&K.push("ALPHA_PASS");const ie=t.getOrCreateProgram("globeAtmosphere",{defines:K}),ne=((_e,Me,Ce,Fe,de,Te,le,Re,xe,Le,qe,Pe)=>({u_frustum_tl:_e,u_frustum_tr:Me,u_frustum_br:Ce,u_frustum_bl:Fe,u_horizon:de,u_transition:Te,u_fadeout_range:le,u_color:Re,u_high_color:xe,u_space_color:Le,u_temporal_offset:qe,u_horizon_angle:Pe}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,y,k,S,I,L,V,te);t.uploadCommonUniforms(c,ie);const fe=this.atmosphereBuffer;fe&&ie.draw(t,d.TRIANGLES,m,$t.disabled,J?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,zt.backCW,ne,J?"atmosphere_glow_alpha":"atmosphere_glow",fe.vertexBuffer,fe.indexBuffer,fe.segments)};ee(!1),ee(!0)}drawStars(t,n){const c=o.ay(n.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,p=d.gl,m=t.transform,y=t.getOrCreateProgram("stars"),x=o.b_([]);o.c0(x,x,-m._pitch),o.b$(x,x,-m.angle),o.c0(x,x,o.al(m._center.lat)),o.e9(x,x,-o.al(m._center.lng));const T=o.c3(new Float32Array(16),x),S=o.az([],m.starsProjMatrix,T),M=o.e4([],T),I=o.ea([],M),C=[0,1,0];o.dz(C,C,I),o.bY(C,C,this.params.sizeMultiplier);const L=[1,0,0];o.dz(L,L,I),o.bY(L,L,this.params.sizeMultiplier);const z=(k=C,B=L,V=c,{u_matrix:Float32Array.from(S),u_up:k,u_right:B,u_intensity_multiplier:V});var k,B,V;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,p.TRIANGLES,nt.disabled,$t.disabled,this.colorModeAlphaBlendedWriteRGB,zt.disabled,z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function ra(l,t){const n=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=o.bx([]);return o.cE(d,d,[c,c,1]),o.az(n,d,n),o.az(n,t.worldToFogMatrix,n),n}function Ve(l,t,n,c,d){const p=n.material,m=c.context,{baseColorTexture:y,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:M}=p;function I(L,z,k){if(L&&(l.push(z),m.activeTexture.set(m.gl.TEXTURE0+k),L.gfxTexture)){const{minFilter:B,magFilter:V,wrapS:H,wrapT:Y}=L.sampler;L.gfxTexture.bindExtraParam(B,V,H,Y)}}I(y,"HAS_TEXTURE_u_baseColorTexture",An.BaseColor),I(x,"HAS_TEXTURE_u_metallicRoughnessTexture",An.MetallicRoughness),I(T,"HAS_TEXTURE_u_normalTexture",An.Normal),I(S,"HAS_TEXTURE_u_occlusionTexture",An.Occlusion),I(M,"HAS_TEXTURE_u_emissionTexture",An.Emission),d&&(d.texture||(d.texture=new o.eh(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+An.LUT),d.texture&&d.texture.bind(m.gl.LINEAR,m.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(n.texcoordBuffer)),n.colorBuffer&&(l.push(n.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(n.colorBuffer)),n.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(n.normalBuffer)),n.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(n.pbrBuffer)),p.alphaMode!=="OPAQUE"&&p.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),p.defined||l.push("DIFFUSE_SHADED");const C=c.shadowRenderer;C&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&l.push("NORMAL_OFFSET"))}function it(l,t,n,c,d,p){const m=n.paint.get("model-opacity").constantOr(1),y=t.context,x=new nt(t.context.gl.LEQUAL,nt.ReadWrite,t.depthRangeFor3D),T=t.transform,S=l.mesh,M=S.material,I=M.pbrMetallicRoughness,C=t.style.fog;let L;L=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:o.az([],c.zScaleMatrix,l.nodeModelMatrix),o.az(L,c.negCameraPosMatrix,L);const z=o.bi([],L);o.ee(z,z);
2655const k=n.paint.get("model-color-use-theme").constantOr("default")==="none",B=n.paint.get("model-emissive-strength").constantOr(0),V=Gl(new Float32Array(l.worldViewProjection),new Float32Array(L),new Float32Array(z),null,t,m,I.baseColorFactor,M.emissiveFactor,I.metallicFactor,I.roughnessFactor,M,B,n),H={defines:[]},Y=[],te=t.shadowRenderer;te&&(te.useNormalOffset=!1),Ve(H.defines,Y,S,t,k?null:n.lut);let ee=null;if(C){const ie=ra(l.nodeModelMatrix,t.transform);if(ee=new Float32Array(ie),T.projection.name!=="globe"){const ne=S.aabb.min,fe=S.aabb.max,[_e,Me]=C.getOpacityForBounds(ie,ne[0],ne[1],fe[0],fe[1]);H.overrideFog=_e>=be||Me>=be}}const J=Es(t,n.paint.get("model-cutoff-fade-range"));J.shouldRenderCutoff&&H.defines.push("RENDER_CUTOFF");const K=t.getOrCreateProgram("model",H);t.uploadCommonUniforms(y,K,null,ee,J),t.renderPass!=="shadow"&&te&&te.setupShadowsFromMatrix(l.nodeModelMatrix,K),K.draw(t,y.gl.TRIANGLES,x,d,p,S.material.doubleSided?zt.disabled:zt.backCCW,V,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,t.transform.zoom,void 0,Y)}function na(l,t,n,c,d,p,m){let y;y=l.projection.name==="globe"?o.ed(n,l):[...n],o.az(y,y,t.matrix);const x=o.az([],c,y);if(t.meshes)for(const T of t.meshes){if(T.material.alphaMode!=="BLEND"){m.push({mesh:T,depth:0,modelIndex:d,worldViewProjection:x,nodeModelMatrix:y});continue}const S=o.ad([],T.centroid,x);!l.isOrthographic&&S[2]<=0||p.push({mesh:T,depth:S[2],modelIndex:d,worldViewProjection:x,nodeModelMatrix:y})}if(t.children)for(const T of t.children)na(l,T,n,c,d,p,m)}function Er(l,t,n,c){const d=n.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(t),x=hp(y);n.getOrCreateProgram("modelDepth",{defines:n._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(n,n.context.gl.TRIANGLES,p,$t.disabled,m,zt.backCCW,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,n.transform.zoom,void 0,void 0)}function pe(l,t,n){const c=t.updateZoomBasedPaintProperties(),d=function(p,m,y){let x,T,S,M=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&M>0){const I=p.terrain,C=I.findDEMTileFor(y);C&&C.dem?x=o.ei.create(I,y,C):M=0}if(M===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),M===m.validForExaggeration&&(M===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const I in m.instancesPerModel){const C=m.instancesPerModel[I];for(let L=0;L<C.instancedDataArray.length;++L){const z=(x?M*x.getElevationAt(0|C.instancedDataArray.float32[16*L],0|C.instancedDataArray.float32[16*L+1],!0,!0):0)+C.instancesEvaluatedElevation[L];C.instancedDataArray.float32[16*L+6]=z,T=T?Math.min(m.terrainElevationMin,z):z,S=S?Math.max(m.terrainElevationMax,z):z}}return m.terrainElevationMin=T||0,m.terrainElevationMax=S||0,m.validForExaggeration=M,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0}(l,t,n);(c||d)&&(t.uploaded=!1,t.upload(l.context))}const ys={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new o.cW([0,0,0],[o.aj,o.aj,0])};function cu(l,t){const n=1<<l.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,p=l.canonical.x/n,m=(l.canonical.x+1)/n,y=l.canonical.y/n,x=(l.canonical.y+1)/n;let T=t._centerAltitude;if(d){const C=d.getMinMaxForTile(l);C&&C.max>T&&(T=C.max)}const S=o.ay(c.x,p,m)-c.x,M=o.ay(c.y,y,x)-c.y,I=o.c6(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(S*S+M*M+I*I))}function uu(l,t,n,c,d,p,m){const y=l.context,x=l.renderPass==="shadow",T=l.shadowRenderer,S=x&&T?T.getShadowPassDepthMode():new nt(y.gl.LEQUAL,nt.ReadWrite,l.depthRangeFor3D),M=l.isTileAffectedByFog(p);if(n.meshes)for(const I of n.meshes){const C=["MODEL_POSITION_ON_GPU"],L=[];let z,k,B;c.instancedDataArray.length>20&&C.push("INSTANCED_ARRAYS");const V=Es(l,t.paint.get("model-cutoff-fade-range"));if(V.shouldRenderCutoff&&C.push("RENDER_CUTOFF"),x&&T)z=l.getOrCreateProgram("modelDepth",{defines:C}),k=hp(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(n.matrix
2655)),B=T.getShadowPassColorMode();else{Ve(C,L,I,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),z=l.getOrCreateProgram("model",{defines:C,overrideFog:M});const Y=I.material,te=Y.pbrMetallicRoughness,ee=t.paint.get("model-opacity").constantOr(1),J=t.paint.get("model-emissive-strength").constantOr(0);k=Gl(p.expandedProjMatrix,Float32Array.from(n.matrix),new Float32Array(16),null,l,ee,te.baseColorFactor,Y.emissiveFactor,te.metallicFactor,te.roughnessFactor,Y,J,t,d),T&&(m.shadowUniformsInitialized?z.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(p.toUnwrapped(),z,"model-tile",p.overscaledZ),m.shadowUniformsInitialized=!0)),B=V.shouldRenderCutoff||ee<1||Y.alphaMode!=="OPAQUE"?ui.alphaBlended:ui.unblended}l.uploadCommonUniforms(y,z,p.toUnwrapped(),null,V);const H=I.material.doubleSided?zt.disabled:zt.backCCW;if(c.instancedDataArray.length>20)L.push(c.instancedDataBuffer),z.draw(l,y.gl.TRIANGLES,S,$t.disabled,B,H,k,t.id,I.vertexBuffer,I.indexBuffer,I.segments,t.paint,l.transform.zoom,void 0,L,c.instancedDataArray.length);else{const Y=x?"u_instance":"u_normal_matrix";for(let te=0;te<c.instancedDataArray.length;++te)k[Y]=new Float32Array(c.instancedDataArray.arrayBuffer,64*te,16),z.draw(l,y.gl.TRIANGLES,S,$t.disabled,B,H,k,t.id,I.vertexBuffer,I.indexBuffer,I.segments,t.paint,l.transform.zoom,void 0,L)}}if(n.children)for(const I of n.children)uu(l,t,I,c,d,p,m)}const zh=[1,-1,1];function wp(l,t,n,c){if(!n.modelManager)return!0;const d=n.modelManager;if(!n.shadowRenderer)return!0;const p=n.shadowRenderer,m=t.aabb;let y=!0,x=l.maxHeight;if(x===0){let S=0;for(const M in l.instancesPerModel){const I=d.getModel(M,c);I?S=Math.max(S,Math.max(Math.max(I.aabb.max[0],I.aabb.max[1]),I.aabb.max[2])):y=!1}x=l.maxScale*S*1.41+l.maxVerticalOffset,y&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,o.ad(m.min,m.min,t.tileMatrix),o.ad(m.max,m.max,t.tileMatrix);const T=m.intersects(p.getCurrentCascadeFrustum());return n.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function Tp(l,t){const n=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],p=l.uniformValues.u_cutoff_params[3];return c===n||p===d?1:o.ay(((t-n)/(c-n)-d)/(p-d),0,1)}function Ga(l,t,n,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();o.az(d,d,l);const p=o.ej(n.min[0],n.min[1],n.min[2],1);let m=o.aA(o.ek(),p,d),y=m,x=m;p[1]=n.max[1],m=o.aA(o.ek(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[0]=n.max[0],m=o.aA(o.ek(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[1]=n.min[1],m=o.aA(o.ek(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x;const T=o.ay(c[0],0,1),S=100*t.pixelsPerMeter*o.ay(c[1],0,1),M=o.ay(c[2],0,1),I=o.el(o.ek(),y,x,T),C=Math.tan(.5*t.fovX),L=-I[2]*C;if(S===0)return I[1]<-Math.abs(L)?M:1;const z=(-Math.abs(L)-I[1])/S,k=(V,H,Y)=>(1-Y)*V+Y*H,B=o.ay(k(1,M,z),M,1);return k(1,B,o.ay((t.pitch-20)/20,0,1))}class xm{}class vm{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,n,c){{const M=this._storage.get(n.id);if(M)return M.lastUsedFrameIdx=t,M.buf}const d=c.gl,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(p),y=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new o.en;for(let M=0;M<p/2;M+=3){const I=y[M],C=y[M+1],L=y[M+2];x.emplaceBack(I,C),x.emplaceBack(C,L),x.emplaceBack(L,I)}const T=c.bindVertexArrayOES.current,S=new xm;return S.buf=new cs(c,x),S.lastUsedFrameIdx=t,this._storage.set(n.id,S),c.bindVertexArrayOES.set(T),S.buf}update(t){for(const[n,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(n))}destroy(){for(const[t,n]of this._storage)n.buf.destroy(),this._storage.delete(t)}}class Sp{constructor(t){this.occluderSize=30,this.depthOffset=-1e-4,t.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),t.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const hu=o.d_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Dh{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class Lh{constructor(t,n){this.revealStart=11,this.revealRange=2,t.registerParameter(this,[...n,"Reveal"],"revealStart",{min:0,max:17,step:.05}
2655),t.registerParameter(this,[...n,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const Ep=o.d_([{type:"Float32",name:"a_pos_2f",components:2}]);class du{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,n){const c=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const m=new o.eo,y=new o.a_;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,Ep.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=o.bd.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(p={vignetteShape:[n.start,n.range,Math.pow(10,n.fadePower)],vignetteColor:[n.color.r,n.color.g,n.color.b,n.color.a*n.strength]}).vignetteShape,u_vignetteColor:p.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,nt.disabled,$t.disabled,ui.alphaBlended,zt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class Wl{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,n){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),p=c.toLngLat(),m=o.al(p.lng),y=o.al(p.lat),x=t.pixelsPerMeter/n,T=m*o.eq,S=o.eq*Math.log(Math.tan(Math.PI/4+y/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const M=-this._offsetYPrev+S,I=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*x,this._accumulatedOffsetY+=M*x,this._accumulatedElevation+=I*x,this._offsetXPrev=T,this._offsetYPrev=S,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function sa(l,t){return[-(l[0]-Math.floor(l[0]/t)*t),-(l[1]-Math.floor(l[1]/t)*t),-(l[2]-Math.floor(l[2]/t)*t)]}function kh(l){const t=o.e7(1323123451230),n=[];for(let c=0;c<l;++c){const d=2*t()-1,p=2*t()-1,m=2*t()-1;n.push(o.cS(d,p,m))}return n}function wo(l,t,n,c,d){const p=o.ay((d-n)/(c-n),0,1);return(1-p)*l+p*t}class yn{constructor(t){this._movement=new Wl,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new du,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,n){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,p=o.b_([]);o.c0(p,p,o.al(90)-c._pitch),o.b$(p,p,-c.angle);const m=o.c3(new Float32Array(16),p),y=o.ep(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=o.ee([],y),T=o.az([],x,m),S=Date.now()/1e3;return this._accumulatedTimeFromStart+=(S-this._prevTime)*n,this._prevTime=S,{projectionMatrix:d,modelviewMatrix:T}}}class bm extends yn{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new Lh(t.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=kh(this.particlesCount),d=new o.er,p=new o.a_;let m=0;const y=o.e7(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,1,...S),d.emplaceBack(T[0],T[1],T[2],-1,1,...S),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=n.createVertexBuffer(d,hu.members),this.particlesIdx=n.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const n=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(n.revealStart>c)return;const d=wo(0,1,n.revealStart,n.revealStart+n.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const p=structuredClone(this._params);let m=[-p.direction.x,p.direction.y,-100];o.au(m,m);
2655const y=structuredClone(this._vignetteParams);y.strength*=d,p.overrideStyleParameters||(p.intensity=t.style.rain.state.density,p.timeFactor=t.style.rain.state.intensity,p.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),p.screenThinning.intensity=t.style.rain.state.centerThinning,p.dropletSizeX=t.style.rain.state.dropletSize[0],p.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],p.distortionStrength=100*t.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,p.timeFactor),T=t.context,S=T.gl,M=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new o.T(T,{width:t.width,height:t.height,data:null},S.RGBA8)),p.distortionStrength>0&&(T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),S.copyTexSubImage2D(S.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const I=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(T,I),T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const C=[p.color.r,p.color.g,p.color.b,p.color.a],L=(z,k)=>{const B=sa(this._movement.getPosition(),z),V=p.dropletSizeX,H=p.dropletSizeX*p.dropletSizeYScale,Y=t.width/2,te=t.height/2,ee=wo(0,p.screenThinning.start,0,1,p.screenThinning.intensity),J=wo(.001,p.screenThinning.range,0,1,p.screenThinning.intensity),K=wo(0,p.screenThinning.particleOffset,0,1,p.screenThinning.intensity),ie=(ne={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:B,velocityConeAperture:p.velocityConeAperture,velocity:p.velocity,boxSize:z,rainDropletSize:[V,H],distortionStrength:p.distortionStrength,rainDirection:m,color:C,screenSize:[M.width,M.height],thinningCenterPos:[Y,te],thinningShape:[ee,J,Math.pow(10,p.screenThinning.fadePower)],thinningAffectedRatio:p.screenThinning.affectedRatio,thinningParticleOffset:K,shapeDirectionalPower:p.shapeDirPower,shapeNormalPower:p.shapeNormalPower,mode:k?0:1},{u_modelview:Float32Array.from(ne.modelview),u_projection:Float32Array.from(ne.projection),u_time:ne.time,u_cam_pos:ne.camPos,u_texScreen:0,u_velocityConeAperture:ne.velocityConeAperture,u_velocity:ne.velocity,u_boxSize:ne.boxSize,u_rainDropletSize:ne.rainDropletSize,u_distortionStrength:ne.distortionStrength,u_rainDirection:ne.rainDirection,u_color:ne.color,u_screenSize:ne.screenSize,u_thinningCenterPos:ne.thinningCenterPos,u_thinningShape:ne.thinningShape,u_thinningAffectedRatio:ne.thinningAffectedRatio,u_thinningParticleOffset:ne.thinningParticleOffset,u_shapeDirectionalPower:ne.shapeDirectionalPower,u_shapeNormalPower:ne.shapeNormalPower,u_mode:ne.mode});var ne;const fe=Math.round(p.intensity*this.particlesCount),_e=o.bd.simpleSegment(0,0,4*fe,2*fe);I.draw(t,S.TRIANGLES,nt.disabled,$t.disabled,ui.alphaBlended,zt.disabled,ie,"rain_particles",this.particlesVx,this.particlesIdx,_e)};p.distortionStrength>0&&L(p.boxSize,!0),L(p.boxSize,!1),this._vignette.draw(t,y)}}const Xl=o.d_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class mr extends yn{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Lh(t.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=kh(this.particlesCount),d=new o.es,p=new o.a_;let m=0;const y=o.e7(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=y(),M=y(),I=y(),C=[x/c.length,S,M,I],L=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...C,...L),d.emplaceBack(T[0],T[1],T[2],1,-1,...C,...L),d.emplaceBack(T[0],T[1],T[2],1,1,...C,...L),d.emplaceBack(T[0],T[1],T[2],-1,1,...C,...L),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m
2655+=4}this.particlesVx=n.createVertexBuffer(d,Xl.members),this.particlesIdx=n.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const n=structuredClone(this._params);let c=[-n.direction.x,n.direction.y,-100];o.au(c,c);const d=structuredClone(this._vignetteParams),p=n.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},m=t.transform.zoom;if(p.revealStart>m)return;const y=wo(0,1,p.revealStart,p.revealStart+p.revealRange,m);d.strength*=y,n.overrideStyleParameters||(n.intensity=t.style.snow.state.density,n.timeFactor=t.style.snow.state.intensity,n.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),n.screenThinning.intensity=t.style.snow.state.centerThinning,n.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const x=this.updateOnRender(t,n.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=t.context,S=T.gl,M=t.transform,I=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(T,I),((C,L,z)=>{const k=sa(this._movement.getPosition(),C),B=M.width/2,V=M.height/2,H=wo(0,z.screenThinning.start,0,1,z.screenThinning.intensity),Y=wo(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),te=wo(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),ee=(J={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:k,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:C,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[M.width,M.height],thinningCenterPos:[B,V],thinningShape:[H,Y,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:te,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:c},{u_modelview:Float32Array.from(J.modelview),u_projection:Float32Array.from(J.projection),u_time:J.time,u_cam_pos:J.camPos,u_velocityConeAperture:J.velocityConeAperture,u_velocity:J.velocity,u_horizontalOscillationRadius:J.horizontalOscillationRadius,u_horizontalOscillationRate:J.horizontalOscillationRate,u_boxSize:J.boxSize,u_billboardSize:J.billboardSize,u_simpleShapeParameters:J.simpleShapeParameters,u_screenSize:J.screenSize,u_thinningCenterPos:J.thinningCenterPos,u_thinningShape:J.thinningShape,u_thinningAffectedRatio:J.thinningAffectedRatio,u_thinningParticleOffset:J.thinningParticleOffset,u_particleColor:J.color,u_direction:J.direction});var J;const K=Math.round(z.intensity*this.particlesCount),ie=o.bd.simpleSegment(0,0,4*K,2*K);this.particlesVx&&this.particlesIdx&&I.draw(t,S.TRIANGLES,nt.disabled,$t.disabled,ui.alphaBlended,zt.disabled,ee,"snow_particles",this.particlesVx,this.particlesIdx,ie)})(n.boxSize,0,n),this._vignette.draw(t,d)}}const Ai={symbol:function(l,t,n,c,d){if(l.renderPass!=="translucent")return;const p=$t.disabled,m=l.colorModeForRenderPass(),y=n.layout.get("text-variable-anchor"),x=n.layout.get("text-size-scale-range"),T=o.ay(l.scaleFactor,x[0],x[1]);y&&function(I,C,L,z,k,B,V,H){const Y=C.transform,te=k==="map",ee=B==="map";for(const J of I){const K=z.getTile(J),ie=K.getBucket(L);if(!ie||!ie.text||!ie.text.segments.get().length)continue;const ne=o.bH(ie.textSizeData,Y.zoom,H),fe=Lc(J,ie.getProjection(),Y),_e=Y.calculatePixelsToTileUnitsMatrix(K),Me=Bs(fe,K.tileID.canonical,ee,te,Y,ie.getProjection(),_e),Ce=ie.hasIconTextFit()&&ie.hasIconData();ne&&pp(ie,te,ee,V,Y,Me,J,Math.pow(2,Y.zoom-K.tileID.overscaledZ),ne,Ce)}}(c,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d,T);const S=n.paint.get("icon-opacity").constantOr(1)!==0,M=n.paint.get("text-opacity").constantOr(1)!==0;n.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(S||M)?Na(l,t,n,c,p,m):(S&&Na(l,t,n,c,p,m,{onlyIcons:!0}),M&&Na(l,t,n,c,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&(su(l,t,n,c,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),su(l,t,n,c,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=n.layout.get("
vendor: 7,351 bytes, line 2655
2655circle-sort-key").constantOr(1)!==void 0,x=n.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const T=l.context,S=T.gl,M=l.transform,I=!(!l.terrain||!l.terrain.enabled),C=n.layout.get("circle-elevation-reference"),L=l.depthModeForSublayer(0,nt.ReadOnly),z=new nt(l.context.gl.LEQUAL,nt.ReadOnly,l.depthRangeFor3D),k=C==="none"||I?L:z,B=$t.disabled,V=l.colorModeForDrapableLayerRenderPass(x),H=M.projection.name==="globe",Y=[o.aD(M.center.lng),o.aH(M.center.lat)],te=[];for(let J=0;J<c.length;J++){const K=c[J],ie=t.getTile(K),ne=ie.getBucket(n);if(!ne||ne.projection.name!==M.projection.name)continue;const fe=ne.programConfigurations.get(n.id),_e=ne.layoutVertexBuffer,Me=ne.globeExtVertexBuffer,Ce=ne.indexBuffer,Fe=o.dK(n),de=[Me],Te=l.isTileAffectedByFog(K);H&&Fe.push("PROJECTION_GLOBE_VIEW"),Fe.push("DEPTH_D24"),l.terrain&&M.depthOcclusionForSymbolsAndCircles&&Fe.push("DEPTH_OCCLUSION"),ne.hasElevation&&(Fe.push("ELEVATED_ROADS"),de.push(ne.elevatedLayoutVertexBuffer));const le=l.getOrCreateProgram("circle",{config:fe,defines:Fe,overrideFog:Te}),Re=M.projection.createInversionMatrix(M,K.canonical),xe={programConfiguration:fe,program:le,layoutVertexBuffer:_e,dynamicBuffers:de,indexBuffer:Ce,uniformValues:o.dL(l,K,ie,Re,Y,n),tile:ie};if(y){const Le=ne.segments.get();for(const qe of Le)te.push({segments:new o.bd([qe]),sortKey:qe.sortKey,state:xe})}else te.push({segments:ne.segments,sortKey:0,state:xe})}y&&te.sort((J,K)=>J.sortKey-K.sortKey);const ee={useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles};for(const J of te){const{programConfiguration:K,program:ie,layoutVertexBuffer:ne,dynamicBuffers:fe,indexBuffer:_e,uniformValues:Me,tile:Ce}=J.state,Fe=J.segments;l.terrain&&l.terrain.setupElevationDraw(Ce,ie,ee),l.uploadCommonUniforms(T,ie,Ce.tileID.toUnwrapped()),ie.draw(l,S.TRIANGLES,k,B,V,zt.disabled,Me,n.id,ne,_e,Fe,n.paint,M.zoom,K,fe)}},heatmap:function(l,t,n,c){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,p=d.gl,m=$t.disabled,y=new ui([p.ONE,p.ONE,p.ONE,p.ONE],o.am.transparent,[!0,!0,!0,!0]);(function(C,L,z,k){const B=C.gl,V=L.width*k,H=L.height*k;C.activeTexture.set(B.TEXTURE1),C.viewport.set([0,0,V,H]);let Y=z.heatmapFbo;if(!Y||Y&&(Y.width!==V||Y.height!==H)){Y&&Y.destroy();const te=B.createTexture();B.bindTexture(B.TEXTURE_2D,te),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.LINEAR),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.LINEAR),Y=z.heatmapFbo=C.createFramebuffer(V,H,!0,null),function(ee,J,K,ie,ne,fe){const _e=ee.gl;_e.texImage2D(_e.TEXTURE_2D,0,ee.extRenderToTextureHalfFloat?_e.RGBA16F:_e.RGBA,ne,fe,0,_e.RGBA,ee.extRenderToTextureHalfFloat?_e.HALF_FLOAT:_e.UNSIGNED_BYTE,null),ie.colorAttachment.set(K)}(C,0,te,Y,V,H)}else B.bindTexture(B.TEXTURE_2D,Y.colorAttachment.get()),C.bindFramebuffer.set(Y.framebuffer)})(d,l,n,l.transform.projection.name==="globe"?.5:.25),d.clear({color:o.am.transparent});const x=l.transform,T=x.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],M=T?zt.frontCCW:zt.disabled,I=[o.aD(x.center.lng),o.aH(x.center.lat)];for(let C=0;C<c.length;C++){const L=c[C];if(t.hasRenderableParent(L))continue;const z=t.getTile(L),k=z.getBucket(n);if(!k||k.projection.name!==x.projection.name)continue;const B=l.isTileAffectedByFog(L),V=k.programConfigurations.get(n.id),H=l.getOrCreateProgram("heatmap",{config:V,defines:S,overrideFog:B}),{zoom:Y}=l.transform;l.terrain&&l.terrain.setupElevationDraw(z,H),l.uploadCommonUniforms(d,H,L.toUnwrapped());const te=x.projection.createInversionMatrix(x,L.canonical);H.draw(l,p.TRIANGLES,nt.disabled,m,y,M,lp(l,L,z,te,I,Y,n.paint.get("heatmap-intensity")),n.id,k.layoutVertexBuffer,k.indexBuffer,k.segments,n.paint,l.transform.zoom,V,T?[k.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(d,p){const m=d.context,y=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,x.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1);let T=p.colorRampTexture;T||(T=p.colorRampTexture=new o.T(m,p.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,nt.disabled,$t.disabled,d.colorModeForRenderPass(),zt.disabled,((S,M,I,C)=>({u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)}(l,n))},line:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const m=n.paint.get("line-emissive-strength"),y=n.paint.get("line-occlusion-opacity"),x=n.layout.get("line-elevation-reference"),T=n.layout.get("line-width-unit")==="meters",S=x==="sea",M=!(!l.terrain||!l.terrain.enabled),I=l.context,C=I.gl;if(n.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const L=n.layout.get("line-cross-slope"),z=L!==void 0,k=L<1,B=l.colorModeForDrapableLayerRenderPass(m),V=l.terrain&&l.terrain.renderingToTexture,H=V?1:o.q.devicePixelRatio,Y=n.paint.get("line-dasharray"),te=Y.constantOr(1),ee=n.layout.get("line-cap"),J=Y.constantOr(null),K=ee.constantOr(null),ie=n.paint.get("line-pattern"),ne=ie.constantOr(1),fe=n.paint.get("line-pattern-cross-fade"),_e=ie.constantOr(null),Me=n.paint.get("line-opacity").constantOr(1);let Ce=!ne&&Me!==1||l.depthOcclusion&&y>0&&y<1;const Fe=n.paint.get("line-gradient"),de=ne?"linePattern":"line",Te=o.dM(n);let le;if(V&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(Ce=!1),y!==0&&l.depthOcclusion){const qe=n.paint._values["line-opacity"];qe&&qe.value&&qe.value.kind==="constant"?le=qe.value:o.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}p.value.kind!=="constant"&&p.value.isLineProgressConstant===!1&&Te.push("VARIABLE_LINE_WIDTH");const Re=(qe,Pe,Ge,ot,at,rt)=>{for(const mt of qe){const gt=t.getTile(mt);if(ne&&!gt.patternsLoaded())continue;const bt=gt.getBucket(n);if(!bt||bt.elevationType!=="none"&&!at||bt.elevationType==="none"&&at)continue;l.prepareDrawTile();const Ut=[...Pe],ri=l.shadowRenderer,Bi=bt.elevationType==="road"&&!!ri&&ri.enabled;let ir=[0,0,0];if(Bi){const Ti=l.style.directionalLight,Fr=l.style.ambientLight;Ti&&Fr&&(ir=Wo(l.style,Ti,Fr)),Ut.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const ji=bt.programConfigurations.get(n.id);let qi=!1;if(_e&>.imageAtlas){const Ti=o.dN.from(_e),Fr=Ti.getPrimary().scaleSelf(H).toString(),lr=gt.imageAtlas.patternPositions.get(Fr),Qi=Ti.getSecondary(),cr=Qi?gt.imageAtlas.patternPositions.get(Qi.scaleSelf(H).toString()):null;qi=!!lr&&!!cr,lr&&ji.setConstantPatternPositions(lr,cr)}fe>0&&(qi||ji.getPatternTransitionVertexBuffer("line-pattern"))&&Ut.push("LINE_PATTERN_TRANSITION");const Rr=l.isTileAffectedByFog(mt),Jt=l.getOrCreateProgram(de,{config:ji,defines:Ut,overrideFog:Rr,overrideRtt:!at&&void 0});if(!ne&&J&&K&>.lineAtlas){const Ti=gt.lineAtlas.getDash(J,K);Ti&&ji.setConstantPatternPositions(Ti)}Bi&&ri.setupShadows(gt.tileID.toUnwrapped(),Jt,"vector-tile",gt.tileID.overscaledZ
2655);let[oi,mi]=n.paint.get("line-trim-offset");(K==="round"||K==="square")&&oi!==mi&&(oi===0&&(oi-=1),mi===1&&(mi+=1));const ar=V?mt.projMatrix:null,Ur=T?1/bt.tileToMeter/o.aw(gt,1,l.transform.zoom):1,rr=T?1/bt.tileToMeter/o.aw(gt,1,Math.floor(l.transform.zoom)):1,Ri=ne?o.dO(l,gt,n,ar,H,Ur,rr,[oi,mi],ir,fe):o.dP(l,gt,n,ar,bt.lineClipsArray.length,H,Ur,rr,[oi,mi],ir);if(Fe){const Ti=bt.gradients[n.id];let Fr=Ti.texture;if(n.gradientVersion!==Ti.version){let lr=256;if(n.stepInterpolant){const Qi=t.getSource().maxzoom,cr=mt.canonical.z===Qi?Math.ceil(1<<l.transform.maxZoom-mt.canonical.z):1;lr=o.ay(o.dQ(bt.maxLineLength/o.aj*1024*cr),256,I.maxTextureSize)}Ti.gradient=o.dR({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:lr,image:Ti.gradient||void 0,clips:bt.lineClipsArray}),Ti.texture?Ti.texture.update(Ti.gradient):Ti.texture=new o.T(I,Ti.gradient,C.RGBA8),Ti.version=n.gradientVersion,Fr=Ti.texture}I.activeTexture.set(C.TEXTURE1),Fr.bind(n.stepInterpolant?C.NEAREST:C.LINEAR,C.CLAMP_TO_EDGE)}te&&(I.activeTexture.set(C.TEXTURE0),gt.lineAtlasTexture&>.lineAtlasTexture.bind(C.LINEAR,C.REPEAT),ji.updatePaintBuffers()),ne&&(I.activeTexture.set(C.TEXTURE0),gt.imageAtlasTexture&>.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),ji.updatePaintBuffers()),at&&!S&&l.terrain.setupElevationDraw(gt,Jt),l.uploadCommonUniforms(I,Jt,mt.toUnwrapped());const Ir=Ti=>{le!=null&&(le.value=Me*y),Jt.draw(l,C.TRIANGLES,Ge,Ti,B,zt.disabled,Ri,n.id,bt.layoutVertexBuffer,bt.indexBuffer,bt.segments,n.paint,l.transform.zoom,ji,[bt.layoutVertexBuffer2,bt.patternVertexBuffer,bt.zOffsetVertexBuffer]),le!=null&&(le.value=Me)};if(Ce&&!at){const Ti=l.stencilModeForClipping(mt).ref;Ti===0&&V&&I.clear({stencil:0});const Fr={func:C.EQUAL,mask:255};Ri.u_alpha_discard_threshold=.8,Ir(new $t(Fr,Ti,255,C.KEEP,C.KEEP,C.INVERT)),Ri.u_alpha_discard_threshold=0,Ir(new $t(Fr,Ti,255,C.KEEP,C.KEEP,C.KEEP))}else Ri.u_alpha_discard_threshold=Ce&&at&&rt?.8:0,Ir(at?ot:l.stencilModeForClipping(mt))}};let xe=l.depthModeForSublayer(0,nt.ReadOnly);const Le=new nt(l.depthOcclusion?C.GREATER:C.LEQUAL,nt.ReadOnly,l.depthRangeFor3D);if(n.hasNonElevatedBuckets){const qe=!V&&l.terrain;y!==0&&qe?o.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):qe?o.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):Re(c,Te,xe,$t.disabled,!1,!0)}if(n.hasElevatedBuckets){x==="hd-road-markup"?M||(xe=Le,Te.push("ELEVATED_ROADS")):(Te.push("ELEVATED"),xe=Le,z&&Te.push(k?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),S&&Te.push("ELEVATION_REFERENCE_SEA"));const qe=Ce?l.stencilModeFor3D():$t.disabled;l.forceTerrainMode=!0,Re(c,Te,xe,qe,!0,!0),Ce&&Re(c,Te,xe,qe,!0,!1),l.forceTerrainMode=!1}Ce&&(l.resetStencilClippingMasks(),V&&I.clear({stencil:0})),y===0||l.depthOcclusion||V||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,n,c){const d=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=n.paint.get("fill-emissive-strength"),y=l.colorModeForDrapableLayerRenderPass(m),x=n.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(o.am.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";let S="none";n.layout.get("fill-elevation-reference")!=="none"?S="road":n.paint.get("fill-z-offset").constantOr(1)!==0&&(S="offset");const M=!(!l.terrain||!l.terrain.enabled),I={painter:l,sourceCache:t,layer:n,coords:c,colorMode:y,elevationType:S,terrainEnabled:M,pass:T};if(l.renderPass!=="shadow")if(S!=="offset"){if(Ch(I,!1),S==="road"){const C=!M&&l.renderPass==="translucent";C&&Mh(l,t,n,c,"geometry"),Ch(I,!0,$t.disabled),C&&function(L){const{painter:z,sourceCache:k,layer:B,coords:V,colorMode:H}=L,Y=z.context.gl,te=L.painter.shadowRenderer,ee=!!te&&te.enabled,J=new nt(z.context.gl.LEQUAL,nt.ReadOnly,z.depthRangeFor3D);let K=[0,0,0];if(ee){const ne=z.style.directionalLight,fe=z.style.ambientLight;ne&&fe&&(K=Wo(z.style,ne,fe))}const ie=ne=>{for(const fe of V){const _e=k.getTile(fe),Me=_e.getBucket(B);if(!Me)continue;const Ce=Me.elevatedStructures;if(!Ce)continue;let Fe,de;if(ne?(Fe=Ce.renderableBridgeSegments,de=Ce.bridgeProgramConfigurations.get(B.id)):(Fe=Ce.renderableTunnelSegments,de=Ce.tunnelProgramConfigurations.get(B.id)),!Fe||Fe.segments[0].primitiveLength===0)continue;de.updatePaintBuffers(),z.prepareDrawTile();const Te=z.isTileAffectedByFog(fe),le=[];ee&&le.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Re=z.getOrCreateProgram("elevatedStructures",{config:de,overrideFog:Te,defines:le}),xe=z.translatePosMatrix(fe.projMatrix,_e,B.paint.get("fill-translate"),B.paint.get("fill-translate-anchor"));ee&&te.setupShadows(_e.tileID.toUnwrapped(),Re,"vector-tile",_e.tileID.overscaledZ
2655);const Le=lm(xe,K);z.uploadCommonUniforms(z.context,Re,fe.toUnwrapped()),Re.draw(z,Y.TRIANGLES,J,$t.disabled,H,zt.backCCW,Le,B.id,Ce.vertexBuffer,Ce.indexBuffer,Fe,B.paint,z.transform.zoom,de,[Ce.vertexBufferNormal])}};ie(!0),ie(!1)}(I)}}else Ch(I,!1,l.stencilModeFor3D());else l.shadowRenderer&&S==="road"&&!M&&function(C){const{painter:L,sourceCache:z,layer:k,coords:B}=C,V=L.context.gl,H=C.painter.shadowRenderer;for(const Y of B){const te=z.getTile(Y),ee=te.getBucket(k);if(!ee)continue;const J=ee.elevatedStructures;if(!J||!J.shadowCasterSegments||J.shadowCasterSegments.segments[0].primitiveLength===0)continue;L.prepareDrawTile();const K=ee.bufferData.programConfigurations.get(k.id),ie=L.isTileAffectedByFog(Y),ne=L.getOrCreateProgram("elevatedStructuresDepth",{config:K,overrideFog:ie}),fe=H.calculateShadowPassMatrixFromTile(te.tileID.toUnwrapped());L.uploadCommonUniforms(L.context,ne,Y.toUnwrapped());const _e={u_matrix:fe,u_depth_bias:.001};ne.draw(L,V.TRIANGLES,H.getShadowPassDepthMode(),$t.disabled,H.getShadowPassColorMode(),zt.disabled,_e,k.id,J.vertexBuffer,J.indexBuffer,J.shadowCasterSegments,k.paint,L.transform.zoom,K)}}(I)},"fill-extrusion":function(l,t,n,c){const d=n.paint.get("fill-extrusion-opacity"),p=l.context,m=p.gl,y=l.terrain,x=y&&y.renderingToTexture;if(d===0)return;const T=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),S=l.style.order.indexOf(n.fqid);if(T&&function(M,I,C,L,z){for(const k of L){const B=I.getTile(k).getBucket(C);B&&(B.updateReplacement(k,M.replacementSource,z),B.uploadCentroid(M.context))}}(l,t,n,c,S),y||T)for(const M of c){const I=t.getTile(M).getBucket(n);I&&st(l.context,t,M,I,n,y,T)}if(l.renderPass==="shadow"&&l.shadowRenderer){const M=l.shadowRenderer;if(y&&d<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof o.ab)return;const I=M.getShadowPassDepthMode(),C=M.getShadowPassColorMode();Gs(l,t,n,c,I,$t.disabled,C,T)}else if(l.renderPass==="translucent"){const M=!n.paint.get("fill-extrusion-pattern").constantOr(1),I=n.paint.get("fill-extrusion-color").constantOr(o.am.white);if(!x&&I.a!==0){const C=new nt(l.context.gl.LEQUAL,nt.ReadWrite,l.depthRangeFor3D);d===1&&M?Gs(l,t,n,c,C,$t.disabled,ui.unblended,T):(Gs(l,t,n,c,C,$t.disabled,ui.disabled,T),Gs(l,t,n,c,C,l.stencilModeFor3D(),l.colorModeForRenderPass(),T),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&M&&(!y&&l.transform.projection.name!=="globe"||x)){const C=n.paint.get("fill-extrusion-opacity"),L=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),z=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),k=n.paint.get("fill-extrusion-flood-light-intensity"),B=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",V=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(B?null:n.lut).toArray01().slice(0,3),H=L>0&&z>0,Y=k>0,te=(J,K,ie)=>(1-ie)*J+ie*K,ee=J=>{const K=l.depthModeForSublayer(1,nt.ReadOnly,m.LEQUAL,!0),ie=n.paint.get(J?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ne=te(.1,3,ie),fe=l._showOverdrawInspector;if(!fe){const _e=new $t({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Me=new ui([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0],m.MIN);$s(l,t,n,c,K,_e,Me,zt.disabled,J,"sdf",C,L,z,k,V,ne,T,!1)}{const _e=fe?$t.disabled:new $t({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Me=fe?l.colorModeForRenderPass():new ui([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],o.am.transparent,[!0,!0,!0,!0]);$s(l,t,n,c,K,_e,Me,zt.disabled,J,"color",C,L,z,k,V,ne,T,!1)}};if(x){const J=(K,ie,ne)=>{const fe=l.depthModeForSublayer(1,nt.ReadOnly,m.LEQUAL,!1),_e=n.paint.get(K?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Me=te(.1,3,_e);{const Ce=new ui([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0]);$s(l,t,n,c,fe,$t.disabled,Ce,zt.disabled,K,"clear",C,L,z,k,V,Me,T,ie)}{const Ce=new $t({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Fe=new ui([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0],m.MIN);$s(l,t,n,c,fe,Ce,Fe,zt.disabled,K,"sdf",C,L,z,k,V,Me,T,ie)}{const Ce=K?m.ZERO:m.ONE_MINUS_DST_ALPHA,Fe=new $t({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),de=new ui([Ce,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],o.am.transparent,[!0,!0,!0,!0]);$s(l,t,n,c,fe,Fe,de,zt.disabled,K,"color",C,L,z,k,V,Me,T,ie)}{const Ce=new ui([m.ONE,m.ONE,m.ONE,K?m.ZERO:m.ONE],o.am.transparent,[!1,!1,!1,!0],K?m.FUNC_ADD:m.MAX);$s(l,t,n,c,fe,$t.disabled,Ce,zt.disabled,K,"clear",C,L,z,k,V,Me,T,ie,ne)}};if(H||Y){let K;if(l.prepareDrawTile(),y){const ie=y.drapeBufferSize[0],ne=y.drapeBufferSize[1];K=y.framebufferCopyTexture,K&&(!K||K.size[0]===ie&&K.size[1]===ne)||(K&&K.destroy(),K=y.framebufferCopyTexture=new o.T(p,new o.r({width:ie,height:ne}),m.RGBA8)),K.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,ie,ne)}H&&J(!0,!1,K),Y&&J(!1,!0,K)}}else H&&ee(!0),Y&&ee(!1),(H||Y)&&l.resetStencilClippingMasks()}}},building:function(l,t,n,c){},hillshade:function(l,t,n,c){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;const d=l.context,p=l.terrain&&l.terrain.renderingToTexture,[m,y]=l.renderPass!=="translucent"||p?[{},c]:l.stencilConfigForOverlap(c);for(const x of y){const T=t.getTile(x);
2655if(T.needsHillshadePrepare&&l.renderPass==="offscreen")Yf(l,T,n);else if(l.renderPass==="translucent"){const S=l.depthModeForSublayer(0,nt.ReadOnly),M=n.paint.get("hillshade-emissive-strength"),I=l.colorModeForDrapableLayerRenderPass(M),C=p&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];Xf(l,x,T,n,S,C,I)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,n,c,d,p){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0)return;const m=l.transform.projection.name==="globe",y=n.paint.get("raster-elevation")!==0,x=y&&m;if(l.renderElevatedRasterBackface&&!x)return;const T=l.context,S=T.gl,M=t.getSource(),I=function(ee,J,K,ie){const ne=J.paint.get("raster-color"),fe=ee.type==="raster-array",_e=[],Me=J.paint.get("raster-resampling"),Ce=J.paint.get("raster-color-mix");let Fe=J.paint.get("raster-color-range");const de=[Ce[0],Ce[1],Ce[2],0],Te=Ce[3];let le=Me==="nearest"?ie.NEAREST:ie.LINEAR;if(fe&&(_e.push("RASTER_ARRAY"),ne||_e.push("RASTER_COLOR"),Me==="linear"&&_e.push("RASTER_ARRAY_LINEAR"),le=ie.NEAREST,!Fe&&ee.rasterLayers)){const Re=ee.rasterLayers.find(({id:xe})=>xe===J.sourceLayer);Re&&Re.fields&&Re.fields.range&&(Fe=Re.fields.range)}if(Fe=Fe||[0,1],ne){_e.push("RASTER_COLOR"),K.activeTexture.set(ie.TEXTURE2),J.updateColorRamp(Fe);let Re=J.colorRampTexture;Re||(Re=J.colorRampTexture=new o.T(K,J.colorRamp,ie.RGBA8)),Re.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}return{mix:de,range:Fe,offset:Te,defines:_e,resampling:le}}(M,n,T,S);if(M instanceof o.aP&&!c.length&&!m)return;const C=n.paint.get("raster-emissive-strength"),L=l.colorModeForDrapableLayerRenderPass(C),z=l.terrain&&l.terrain.renderingToTexture,k=!l.options.moving,B=n.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(M instanceof o.aP&&!c.length&&(M.onNorthPole||M.onSouthPole)){const ee=y?l.stencilModeFor3D():$t.disabled;return void Hl(!!M.onNorthPole,null,l,t,n,C,I,zt.disabled,ee)}if(!c.length)return;const[V,H]=M instanceof o.aP||z?[{},c]:l.stencilConfigForOverlap(c),Y=H[H.length-1].overscaledZ;x&&I.defines.push("PROJECTION_GLOBE_VIEW"),y&&I.defines.push("RENDER_CUTOFF");const te=(ee,J,K)=>{for(const ie of ee){const ne=ie.toUnwrapped(),fe=t.getTile(ie);if(z&&(!fe||!fe.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const _e=fm(fe,M,n,I);if(!_e||!_e.texture)continue;const{texture:Me,mix:Ce,offset:Fe,tileSize:de,buffer:Te}=_e;let le,Re;z?(le=nt.disabled,Re=ie.projMatrix):y?(le=new nt(S.LEQUAL,nt.ReadWrite,l.depthRangeFor3D),Re=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(ne,k)):(le=l.depthModeForSublayer(ie.overscaledZ-Y,n.paint.get("raster-opacity")===1?nt.ReadWrite:nt.ReadOnly,S.LESS),Re=l.transform.calculateProjMatrix(ne,k));const xe=l.terrain&&z?l.terrain.stencilModeForRTTOverlap(ie):V[ie.overscaledZ],Le=p?0:n.paint.get("raster-fade-duration");fe.registerFadeDuration(Le);const qe=t.findLoadedParent(ie,0),Pe=Jo(fe,qe,t,l.transform,Le);let Ge,ot;l.terrain&&l.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),Me.bind(B,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),qe?(qe.texture&&qe.texture.bind(B,S.CLAMP_TO_EDGE),Ge=Math.pow(2,qe.tileID.overscaledZ-fe.tileID.overscaledZ),ot=[fe.tileID.canonical.x*Ge%1,fe.tileID.canonical.y*Ge%1]):Me.bind(B,S.CLAMP_TO_EDGE),"useMipmap"in Me&&T.extTextureFilterAnisotropic&&l.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const at=l.transform;let rt;const mt=y?pm(at):[0,0,0,0];let gt,bt,Ut,ri,Bi,ir=0;if(x&&M instanceof o.aP&&M.coordinates.length>3)gt=Float32Array.from(o.bh(o.dr(new o.cp(0,0,0)))),bt=Float32Array.from(at.globeMatrix),Ut=Float32Array.from(o.dm(at)),ri=[o.aD(at.center.lng),o.aH(at.center.lat)],rt=M.elevatedGlobePerspectiveTransform,Bi=M.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const Jt=o.dn(ie.canonical);ir=o.dp(Jt.getCenter().lat),gt=Float32Array.from(o.bh(o.dr(ie.canonical))),bt=Float32Array.from(at.globeMatrix),Ut=Float32Array.from(o.dm(at)),ri=[o.aD(at.center.lng),o.aH(at.center.lat)],rt=[0,0],Bi=Float32Array.from(o.dq(ie.canonical,Jt,ir,at.worldSize/at._pixelsPerMercatorPixel))}else rt=M instanceof o.aP?M.perspectiveTransform:[0,0],gt=new Float32Array(16),bt=new Float32Array(9),Ut=new Float32Array(16),ri=[0,0],Bi=new Float32Array(9);const ji=Sh(Re,gt,bt,Ut,Bi,ot||[0,0],o.ah(l.transform.zoom),ri,mt,Ge||1,Pe,n,rt,y?n.paint.get("raster-elevation"):0,2,Ce,Fe,I.range,de,Te,C),qi=l.isTileAffectedByFog(ie),Rr=l.getOrCreateProgram("raster",{defines:I.defines,overrideFog:qi});if(l.uploadCommonUniforms(T,Rr,ne),M instanceof o.aP){const Jt=M.elevatedGlobeVertexBuffer,oi=M.elevatedGlobeIndexBuffer;if(z||!m)M.boundsBuffer&&M.boundsSegments&&Rr.draw(l,S.TRIANGLES,le,$t.disabled,L,zt.disabled,ji,n.id,M.boundsBuffer,l.quadTriangleIndexBuffer,M.boundsSegments);else if(Jt&&oi){const mi=at.zoom<=o.cL?M.elevatedGlobeSegments:M.getSegmentsForLongitude(at.center.lng);mi&&Rr.draw(l,S.TRIANGLES,le,$t.disabled,L,J,ji,n.id,Jt,oi,mi)}}else if(x){le=new nt(S.LEQUAL,nt.ReadOnly,l.depthRangeFor3D);const Jt=l.globeSharedBuffers;if(Jt){const[oi,mi,ar]=Jt.getGridBuffers(ir,!1);Rr.draw(l,S.TRIANGLES,le,K||xe,l.colorModeForRenderPass(),J,ji,n.id,oi,mi,ar)}}else{const{tileBoundsBuffer:Jt,tileBoundsIndexBuffer:oi,tileBoundsSegments:mi}=l.getTileBoundsBuffers(fe);Rr.draw(l,S.TRIANGLES,le,xe,L,zt.disabled,ji,n.id,Jt,oi,mi)}}if(!(M instanceof o.aP)&&x)for(const ie of ee){const ne=ie.canonical.y===(1<<ie.canonical.z)-1;ie.canonical.y===0&&Hl(!0,ie,l,t,n,C,I,J,K||$t.disabled),ne&&Hl(!1,ie,l,t,n,C,I,J===zt.frontCW?zt.backCW:zt.frontCW,K||$t.disabled)}};x?te(H,l.renderElevatedRasterBackface?zt.backCW:zt.frontCW,l.stencilModeFor3D()):te(H,zt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,n,c,d,p){l.renderPass==="offscreen"&&function(m,y,x,T){if(!T.length)return;const S=m.context,M=S.gl,I=y.getSource();if(!(I instanceof co))return;const C=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let L=x.particlePositionRGBAImage;if(!L||L.width!==C){const H=function(Y){const te=Y*Y,ee=new Uint8Array(4*te),J=function(ie){return ie|=0,ie=Math.imul(2747636419^ie,2654435769),ie=Math.imul(ie^ie>>>16,2654435769),((ie=Math.imul(ie^ie>>>16,2654435769))>>>0)/4294967296},K=1/1.1;for(let ie=0;ie<te;ie++){const ne=K*(J(2*ie+0)+go),fe=K*(J(2*ie+1)+go),_e=255*ne%1,Me=255*fe%1,Ce=_e,Fe=fe-Me/255,de=Me;ee[4*ie+0]=255*(ne-_e/255),ee[4*ie+1]=255*Ce,ee[4*ie+2]=255*Fe,ee[4*ie+3]=255*de}return ee}(C);L=x.particlePositionRGBAImage=new o.r({width:C,height:C},H)}let z=x.particleFramebuffer;z?z.width!==C&&(z.destroy(),z=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null)):z=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null);const k=[];for(const H of T){const Y=y.getTile(H);if(!(Y instanceof xa))continue;const te=mm(Y,I,x);if(!te)continue;const ee=[Y.tileSize,Y.tileSize];let J=x.tileFramebuffer;J||(J=x.tileFramebuffer=S.createFramebuffer(ee[0],ee[1],!0,null));let K=Y.rasterParticleState;K||(K=Y.rasterParticleState=new _p(S,H,ee,L));const ie=K.update(x.lastInvalidatedAt);K.particleTextureDimension!==C&&K.updateParticleTexture(H,L);const ne=K.targetColorTexture;K.targetColorTexture=K.backgroundColorTexture,K.backgroundColorTexture=ne;const fe=K.particleTexture0;K.particleTexture0=K.particleTexture1,K.particleTexture1=fe,k.push([H,te,K,ie])}if(k.length===0)return;const B=o.q.now(),V=x.previousDrawTimestamp?.001*(B-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=B,x.hasColorMap()){S.activeTexture.set(M.TEXTURE0+2);let H=x.colorRampTexture;H||(H=x.colorRampTexture=new o.T(S,x.colorRamp,M.RGBA8)),H.bind(M.LINEAR,M.CLAMP_TO_EDGE)}S.bindFramebuffer.set(x.tileFramebuffer.framebuffer),function(H,Y,te){const ee=H.context,J=ee.gl,K=Y.tileFramebuffer;ee.activeTexture.set(J.TEXTURE0);const ie={u_texture:0,u_opacity:1.05*(fe=Y.paint.get("raster-particle-fade-opacity-factor"))/(fe+.05)},ne=H.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var fe;for(const _e of te){const[,,Me,Ce]=_e;K.colorAttachment.set(Me.targetColorTexture.texture),ee.viewport.set([0,0,K.width,K.height]),ee.clear({color:o.am.transparent}),Ce&&(Me.backgroundColorTexture.bind(J.NEAREST,J.CLAMP_TO_EDGE),ne.draw(H,J.TRIANGLES,nt.disabled,$t.disabled,ui.alphaBlended,zt.disabled,ie,Y.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments))}}(m,x,k),function(H,Y,te,ee){const J=H.context,K=J.gl,ie=te.tileFramebuffer,ne=H.transform.projection.name==="globe",fe=te.paint.get("raster-particle-max-speed");for(const _e of ee){const[Me,Ce,Fe]=_e;J.activeTexture.set(K.TEXTURE0+0),Ce.texture.bind(K.LINEAR,K.CLAMP_TO_EDGE),ie.colorAttachment.set(Fe.targetColorTexture.texture);const de=H.getOrCreateProgram("rasterParticleDraw",{defines:Ce.defines,overrideFog:!1});J.activeTexture.set(K.TEXTURE0+1);const Te=Ce.scalarData?[]:[0,1,2,3].map(xe=>o.dT[xe](Me));Te.push(Me);const le=Me.canonical.x,Re=Me.canonical.y;for(const xe of Te){const Le=Y.getTile(ne?xe.wrapped():xe);if(!Le)continue;const qe=Le.rasterParticleState;if(!qe)continue;const Pe=xe.canonical.x+(1<<xe.canonical.z)*(xe.wrap-Me.wrap),Ge=xe.canonical.y;qe.particleTexture0.bind(K.NEAREST,K.CLAMP_TO_EDGE);const ot=up(1,qe.particleTexture0.size[0],[Pe-le,Ge-Re],0,Ce.texture.size,2,fe,Ce.textureOffset,Ce.scale,Ce.offset);de.draw(H,K.POINTS,nt.disabled,$t.disabled,ui.alphaBlended,zt.disabled,ot,te.id,qe.particleIndexBuffer,void 0,qe.particleSegment)}}}(m,y,x,k),S.bindFramebuffer.set(x.particleFramebuffer.framebuffer),function(H,Y,te,ee){const J=H.context,K=J.gl,ie=Y.paint.get("raster-particle-max-speed"),ne=ee*Y.paint.get("raster-particle-speed-factor")*.15,fe=function(Me){return Math.pow(Me,6)}(.01+1*Y.paint.get("raster-particle-reset-rate-factor")),_e=Y.particleFramebuffer;J.viewport.set([0,0,_e.width,_e.height]);for(const Me of te){const[,Ce,Fe]=Me;J.activeTexture.set(K.TEXTURE0+0),Ce.texture.bind(K.LINEAR,K.CLAMP_TO_EDGE),J.activeTexture.set(K.TEXTURE0+1);const de=Fe.particleTexture0;de.bind(K.NEAREST,K.CLAMP_TO_EDGE);const Te=yo(1,de.size[0],0,Ce.texture.size,ie,ne,fe,Ce.textureOffset,Ce.scale,Ce.offset);_e.colorAttachment.set(Fe.particleTexture1.texture),J.clear({color:o.am.transparent}),H.getOrCreateProgram("rasterParticleUpdate",{defines:Ce.defines}).draw(H,K.TRIANGLES,nt.disabled,$t.disabled,ui.unblended,zt.disabled,Te,Y.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments)}}(m,x,k,V)}(l,t,n,c),l.renderPass==="translucent"&&(function(m,y,x,T,S){const M=m.context,I=M.gl,C=y.getSource().tileSize,L=5*(1-o.af(o.cx,o.cx+1,m.transform.zoom))*C+x.paint.get("raster-particle-elevation"),z=!m.options.moving,k=m.transform.projection.name==="globe";if(!T.length)return;const[B,V]=m.stencilConfigForOverlap(T),H=[];k&&H.push("PROJECTION_GLOBE_VIEW");const Y=m.stencilModeFor3D();for(const te of V){const ee=te.toUnwrapped(),J=y.getTile(te);if(!J.rasterParticleState)continue;const K=J.rasterParticleState,ie=100;J.registerFadeDuration(ie);const ne=y.findLoadedParent(te,0),fe=Jo(J,ne,y,m.transform,ie);let _e,Me;m.terrain&&m.terrain.prepareDrawTile(),M.activeTexture.set(I.TEXTURE0),K.targetColorTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),M.activeTexture.set(I.TEXTURE1),ne&&ne.rasterParticleState?(ne.rasterParticleState.targetColorTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),_e=Math.pow(2,ne.tileID.overscaledZ-J.tileID.overscaledZ
2655),Me=[J.tileID.canonical.x*_e%1,J.tileID.canonical.y*_e%1]):K.targetColorTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const Ce=k?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(ee,z),Fe=m.transform,de=gp(Fe),Te=o.dn(te.canonical),le=o.dp(Te.getCenter().lat);let Re,xe,Le,qe,Pe;k?(Re=Float32Array.from(o.bh(o.dr(te.canonical))),xe=Float32Array.from(Fe.globeMatrix),Le=Float32Array.from(o.dm(Fe)),qe=[o.aD(Fe.center.lng),o.aH(Fe.center.lat)],Pe=Float32Array.from(o.dq(te.canonical,Te,le,Fe.worldSize/Fe._pixelsPerMercatorPixel))):(Re=new Float32Array(16),xe=new Float32Array(9),Le=new Float32Array(16),qe=[0,0],Pe=new Float32Array(9));const Ge=ta(Ce,Re,xe,Le,Pe,Me||[0,0],o.ah(m.transform.zoom),qe,de,_e||1,fe,L),ot=m.isTileAffectedByFog(te),at=m.getOrCreateProgram("rasterParticle",{defines:H,overrideFog:ot});if(m.uploadCommonUniforms(M,at,ee),k){const rt=new nt(I.LEQUAL,nt.ReadOnly,m.depthRangeFor3D),mt=0,gt=m.globeSharedBuffers;if(gt){const[bt,Ut,ri]=gt.getGridBuffers(le,mt!==0);at.draw(m,I.TRIANGLES,rt,Y,ui.alphaBlended,m.renderElevatedRasterBackface?zt.frontCCW:zt.backCCW,Ge,x.id,bt,Ut,ri)}}else{const rt=m.depthModeForSublayer(0,nt.ReadOnly),mt=B[te.overscaledZ],{tileBoundsBuffer:gt,tileBoundsIndexBuffer:bt,tileBoundsSegments:Ut}=m.getTileBoundsBuffers(J);at.draw(m,I.TRIANGLES,rt,mt,ui.alphaBlended,zt.disabled,Ge,x.id,gt,bt,Ut)}}m.resetStencilClippingMasks()}(l,t,n,c),l.style.map.triggerRepaint())},background:function(l,t,n,c){const d=n.paint.get("background-color"),p=n.paint.get("background-color-use-theme").constantOr("default")==="none",m=n.paint.get("background-opacity"),y=n.paint.get("background-emissive-strength"),x=n.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const T=l.context,S=T.gl,M=l.transform,I=M.tileSize,C=n.paint.get("background-pattern");let L;if(C!==void 0&&(C===null||(L=l.imageManager.getPattern(o.I.from(C.toString()),n.scope,l.style.getLut(n.scope)),!L)))return;const z=!C&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==z)return;const k=$t.disabled,B=l.depthModeForSublayer(0,z==="opaque"?nt.ReadWrite:nt.ReadOnly),V=l.colorModeForDrapableLayerRenderPass(y),H=C?"backgroundPattern":"background";let Y,te=c;if(te||(Y=l.getBackgroundTiles(),te=Object.values(Y).map(ee=>ee.tileID)),C&&(T.activeTexture.set(S.TEXTURE0),l.imageManager.bind(l.context,n.scope)),x){const ee=l.getOrCreateProgram(H,{overrideFog:!1,overrideRtt:!0}),J=new Float32Array(o.bx([])),K=new o.aM(0,0,0,0,0),ie=C?Ih(J,y,m,l,0,n.scope,L,x,{tileID:K,tileSize:I}):Eh(J,y,m,d.toPremultipliedRenderColor(p?null:n.lut));ee.draw(l,S.TRIANGLES,B,k,V,zt.disabled,ie,n.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}else for(const ee of te){const J=l.isTileAffectedByFog(ee),K=l.getOrCreateProgram(H,{overrideFog:J}),ie=ee.toUnwrapped(),ne=c?ee.projMatrix:l.transform.calculateProjMatrix(ie);l.prepareDrawTile();const fe=t?t.getTile(ee):Y?Y[ee.key]:new No(ee,I,M.zoom,l),_e=C?Ih(ne,y,m,l,0,n.scope,L,x,{tileID:ee,tileSize:I}):Eh(ne,y,m,d.toPremultipliedRenderColor(p?null:n.lut));l.uploadCommonUniforms(T,K,ie);const{tileBoundsBuffer:Me,tileBoundsIndexBuffer:Ce,tileBoundsSegments:Fe}=l.getTileBoundsBuffers(fe);K.draw(l,S.TRIANGLES,B,k,V,zt.disabled,_e,n.id,Me,Ce,Fe)}},sky:function(l,t,n){const c=l._atmosphere?o.ah(l.transform.zoom):1,d=n.paint.get("sky-opacity")*c;if(d===0)return;const p=l.context,m=n.paint.get("sky-type"),y=new nt(p.gl.LEQUAL,nt.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?n.needsSkyboxCapture(l)&&(function(T,S,M,I){const C=T.context,L=C.gl;let z=S.skyboxFbo;if(!z){z=S.skyboxFbo=C.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new Zl(C),S.skyboxTexture=C.gl.createTexture(),L.bindTexture(L.TEXTURE_CUBE_MAP,S.skyboxTexture),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MAG_FILTER,L.LINEAR);for(let H=0;H<6;++H)L.texImage2D(L.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,L.RGBA,32,32,0,L.RGBA,L.UNSIGNED_BYTE,null)}C.bindFramebuffer.set(z.framebuffer),C.viewport.set([0,0,32,32]);const k=S.getCenter(T,!0),B=T.getOrCreateProgram("skyboxCapture"),V=new Float64Array(16);o.bx(V),o.e3(V,V,.5*-Math.PI),bo(T,S,B,V,k,0),o.bx(V),o.e3(V,V,.5*Math.PI),bo(T,S,B,V,k,1),o.bx(V),o.cG(V,V,.5*-Math.PI),bo(T,S,B,V,k,2),o.bx(V),o.cG(V,V,.5*Math.PI),bo(T,S,B,V,k,3),o.bx(V),bo(T,S,B,V,k,4),o.bx(V),o.e3(V,V,Math.PI),bo(T,S,B,V,k,5),C.viewport.set([0,0,T.width,T.height])}(l,n),n.markSkyboxValid(l)):l.renderPass==="sky"&&function(T,S,M,I,C){const L=T.context,z
2655=L.gl,k=T.transform,B=T.getOrCreateProgram("skybox");L.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,S.skyboxTexture);const V=((H,Y,te,ee,J)=>({u_matrix:H,u_sun_direction:Y,u_cubemap:0,u_opacity:ee,u_temporal_offset:J}))(k.skyboxMatrix,S.getCenter(T,!1),0,I,C);T.uploadCommonUniforms(L,B),B.draw(T,z.TRIANGLES,M,$t.disabled,T.colorModeForRenderPass(),zt.backCW,V,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x):m==="gradient"&&l.renderPass==="sky"&&function(T,S,M,I,C){const L=T.context,z=L.gl,k=T.transform,B=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new Zl(L)),L.activeTexture.set(z.TEXTURE0);let V=S.colorRampTexture;V||(V=S.colorRampTexture=new o.T(L,S.colorRamp,z.RGBA8)),V.bind(z.LINEAR,z.CLAMP_TO_EDGE);const H=((Y,te,ee,J,K)=>({u_matrix:Y,u_color_ramp:0,u_center_direction:te,u_radius:o.al(ee),u_opacity:J,u_temporal_offset:K}))(k.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),I,C);T.uploadCommonUniforms(L,B),B.draw(T,z.TRIANGLES,M,$t.disabled,T.colorModeForRenderPass(),zt.backCW,H,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x)},custom:function(l,t,n,c){const d=l.context,p=n.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&n.isDraped(t)){if(l.renderPass==="offscreen"){const m=p.prerender;if(m){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;m.call(p,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),o.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=p.renderToTile;if(y){const x=c[0].canonical,T={x:x.x+c[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(nt.disabled),d.setStencilMode($t.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(p,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode($t.disabled);const m=p.renderingMode==="3d"?new nt(l.context.gl.LEQUAL,nt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,nt.ReadOnly);if(d.setDepthMode(m),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;p.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),o.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else p.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else o.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,n,c){if(l.renderPass==="opaque")return;const d=n.paint.get("model-opacity").constantOr(1);if(d===0)return;const p=n.paint.get("model-cast-shadows");if(l.renderPass==="shadow"&&(!p||l.terrain&&d<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof o.ab))return;const m=l.shadowRenderer,y=n.paint.get("model-receive-shadows");m&&(m.useNormalOffset=!0,y||(m.enabled=!1));const x=()=>{m&&(m.useNormalOffset=!0,y||(m.enabled=!0))},T=t.getSource();if(l.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(B,V,H,Y,te){const ee=B.transform;if(ee.projection.name!=="mercator")return void o.w(`Drawing 3D models for ${ee.projection.name} projection is not yet implemented`);const J=ee.getFreeCameraOptions().position;if(!B.modelManager)return;const K=B.modelManager;H.modelManager=K;const ie=B.shadowRenderer;if(!H._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ne=H._unevaluatedLayout._values["model-id"],fe=Object.assign({},H.layout.get("model-id").parameters),_e=B.style.order.indexOf(H.fqid);for(const Me of Y){const Ce=V.getTile(Me).getBucket(H);if(!Ce||Ce.projection.name!==ee.projection.name)continue;const Fe=Ce.getModelUris();Fe&&!Ce.modelsRequested&&(K.addModelsFromBucket(Fe,te),Ce.modelsRequested=!0);const de=cu(Me,ee);fe.zoom=de;const Te=ne.possiblyEvaluate(fe);if(pe(B,Ce,Me),ys.shadowUniformsInitialized=!1,ys.useSingleShadowCascade=!!ie&&ie.getMaxCascadeForTile(Me.toUnwrapped())===0,B.renderPass==="shadow"&&ie){if(B.currentShadowCascade===1&&Ce.isInsideFirstShadowMapFrustum)continue;const xe=ee.calculatePosMatrix(Me.toUnwrapped(),ee.worldSize);
2655if(ys.tileMatrix.set(xe),ys.shadowTileMatrix=Float32Array.from(ie.calculateShadowPassMatrixFromMatrix(xe)),ys.aabb.min.fill(0),ys.aabb.max[0]=ys.aabb.max[1]=o.aj,ys.aabb.max[2]=0,wp(Ce,ys,B,H.scope))continue}const le=1<<Me.canonical.z,Re=[((J.x-Me.wrap)*le-Me.canonical.x)*o.aj,(J.y*le-Me.canonical.y)*o.aj,J.z*le*o.aj];B.conflationActive&&Object.keys(Ce.instancesPerModel).length>0&&B.style.isLayerClipped(H,V.getSource())&&Ce.updateReplacement(Me,B.replacementSource,_e,te)&&(Ce.uploaded=!1,Ce.upload(B.context));for(let xe in Ce.instancesPerModel){const Le=Ce.instancesPerModel[xe];Le.features.length>0&&(xe=Te.evaluate(Le.features[0].feature,{}));const qe=K.getModel(xe,te);if(qe||K.hasURLBeenRequested(xe)||Ce.modelUris.includes(xe)||(Ce.modelUris.push(xe),Ce.modelsRequested=!1),qe&&qe.uploaded)for(const Pe of qe.nodes)uu(B,H,Pe,Le,Re,Me,ys)}}}(l,t,n,c,T.type==="vector"?n.scope:""),void x();if(!T.loaded())return;if(T.type==="batched-model")return function(B,V,H,Y){H.resetLayerRenderingStats(B);const te=B.context,ee=B.transform,J=B.style.fog,K=B.shadowRenderer;if(ee.projection.name!=="mercator")return void o.w(`Drawing 3D landmark models for ${ee.projection.name} projection is not yet implemented`);const ie=B.transform.getFreeCameraOptions().position,ne=o.bY([],[ie.x,ie.y,ie.z],B.transform.worldSize),fe=o.eb([],ne),_e=o.bx([]),Me=o.ec(ee.center.lat,ee.zoom),Ce=o.bn([],[1,1,1/Me]);o.bo(_e,_e,fe);const Fe=H.paint.get("model-opacity").constantOr(1),de=new nt(te.gl.LEQUAL,nt.ReadWrite,B.depthRangeFor3D),Te=new nt(te.gl.LEQUAL,nt.ReadOnly,B.depthRangeFor3D),le=new o.cW([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Re=B.renderPass==="shadow",xe=Re&&K?K.getCurrentCascadeFrustum():ee.getFrustum(ee.scaleZoom(ee.worldSize)),Le=H.paint.get("model-front-cutoff"),qe=Le[2]<1,Pe=Es(B,H.paint.get("model-cutoff-fade-range")),Ge=H.getLayerRenderingStats();(function(ot,at,rt,mt){const gt=ot.terrain?ot.terrain.exaggeration():0,bt=ot.transform.zoom;for(const Ut of mt){const ri=at.getTile(Ut).getBucket(rt);ri&&(ri.setFilter(rt.filter),ot.conflationActive&&ri.updateReplacement(Ut,ot.replacementSource),ri.evaluateTransform(ot,rt),ot.terrain&>>0&&ri.elevationUpdate(ot.terrain,gt,Ut,rt.source),ri.needsReEvaluation(ot,bt,rt)&&ri.evaluate(rt))}})(B,V,H,Y),function(){let ot,at,rt;qe?(ot=Y.length-1,at=-1,rt=-1):(ot=0,at=Y.length,rt=1);const mt=new Float64Array(16),gt=o.ef(),bt=new o.P(0,0);for(let Ut=ot;Ut!==at;Ut+=rt){const ri=Y[Ut],Bi=V.getTile(ri).getBucket(H);if(!Bi||!Bi.uploaded)continue;let ir=!1;K&&(ir=K.getMaxCascadeForTile(ri.toUnwrapped())===0);const ji=ee.calculatePosMatrix(ri.toUnwrapped(),ee.worldSize),qi=Bi.modelTraits;!Re&&qe&&(o.bi(mt,ji),o.ad(gt,ne,mt),bt.x=gt[0],bt.y=gt[1]);const Rr=[];Bi.setFilter(H.filter);for(const Jt of Bi.getNodesInfo()){if(Jt.hiddenByReplacement||!Jt.node.meshes)continue;const oi=Jt.node;let mi=0;B.terrain&&oi.elevation&&(mi=oi.elevation*B.terrain.exaggeration());const ar=(()=>{const Mr=Jt.aabb;return le.min=[...Mr.min],le.max=[...Mr.max],le.min[2]+=mi,le.max[2]+=mi,o.ad(le.min,le.min,ji),o.ad(le.max,le.max,ji),le})(),Ur=Jt.evaluatedScale;if(Ur[0]<=1&&Ur[1]<=1&&Ur[2]<=1&&ar.intersects(xe)===0)continue;if(!Re&&qe){const Mr=.16666666666666666;Jt.cameraCollisionOpacity=ne[0]>ar.min[0]&&ne[0]<ar.max[0]&&ne[1]>ar.min[1]&&ne[1]<ar.max[1]&&ne[2]*Me<ar.max[2]&&oi.footprint&&o.bS(bt,oi.footprint)?Math.max(Jt.cameraCollisionOpacity-Mr,0):Math.min(1,Jt.cameraCollisionOpacity+Mr)}const rr=[...ji],Ri=1/o.cU(ri.canonical),Ir=oi.anchor?oi.anchor[0]:0,Ti=oi.anchor?oi.anchor[1]:0;o.bo(rr,rr,[Ir*(Ur[0]-1)+Jt.evaluatedTranslation[0]*Ri,Ti*(Ur[1]-1)+Jt.evaluatedTranslation[1]*Ri,mi+Jt.evaluatedTranslation[2]]),o.ci(Ur,o.eg)||o.cE(rr,rr,Ur);const Fr=o.az([],rr,oi.matrix),lr=o.az([],ee.expandedFarZProjMatrix,Fr),Qi=o.az([],ee.expandedFarZProjMatrix,rr),cr=o.aA([],[Ir,Ti,mi,1],lr)[2];oi.hidden=!1;let Li=Fe;Re||(qe&&(Li*=Jt.cameraCollisionOpacity,Li*=Ga(rr,ee,Jt.aabb,Le)),Li*=Tp(Pe,cr)),Li!==0?Rr.push({nodeInfo:Jt,depth:cr,opacity:Li,wvpForNode:lr,wvpForTile:Qi,nodeModelMatrix:Fr,tileModelMatrix:rr}):oi.hidden=!0}Re||Rr.sort((Jt,oi)=>!qe||Jt.opacity===1&&oi.opacity===1?Jt.depth<oi.depth?-1:1:Jt.opacity===1?-1:oi.opacity===1?1:Jt.depth>oi.depth?-1:1);for(const Jt of Rr){const oi=Jt.nodeInfo,mi=oi.node;let ar=o.az([],Ce,Jt.tileModelMatrix);o.az(ar,_e,ar);const Ur=o.bi([],ar);o.ee(Ur,Ur),o.cE(Ur,Ur,zh),ar=o.az(ar,ar,mi.matrix);const rr=B.renderPass==="light-beam",Ri=H.paint.get("model-color-use-theme").
2655constantOr("default")==="none",Ir=qi&o.em.HasMapboxMeshFeatures,Ti=Ir?0:oi.evaluatedRMEA[0][2];for(let Fr=0;Fr<mi.meshes.length;++Fr){const lr=mi.meshes[Fr],Qi=Fr===mi.lightMeshIndex;let cr=Jt.wvpForNode;if(Qi){if(!rr&&!B.terrain&&B.shadowRenderer){B.currentLayer<B.firstLightBeamLayer&&(B.firstLightBeamLayer=B.currentLayer);continue}cr=Jt.wvpForTile}else if(rr)continue;const Li={defines:[]},Mr=[];if(!Re&&K&&(K.useNormalOffset=!!lr.normalBuffer),Ve(Li.defines,Mr,lr,B,Ri?null:H.lut),Ir||Li.defines.push("DIFFUSE_SHADED"),ir&&Li.defines.push("SHADOWS_SINGLE_CASCADE"),Ge&&(Re?Ge.numRenderedVerticesInShadowPass+=lr.vertexArray.length:Ge.numRenderedVerticesInTransparentPass+=lr.vertexArray.length),Re){Er(lr,Jt.nodeModelMatrix,B,H);continue}let on=null;if(J){const vs=ra(Jt.nodeModelMatrix,B.transform);if(on=new Float32Array(vs),ee.projection.name!=="globe"){const hs=lr.aabb.min,Fn=lr.aabb.max,[Ao,bs]=J.getOpacityForBounds(vs,hs[0],hs[1],Fn[0],Fn[1]);Li.overrideFog=Ao>=be||bs>=be}}const _r=lr.material;let Ci;_r.occlusionTexture&&_r.occlusionTexture.offsetScale&&(Ci=_r.occlusionTexture.offsetScale,Li.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const qn=B.getOrCreateProgram("model",Li);!Re&&K&&K.setupShadowsFromMatrix(Jt.tileModelMatrix,qn,K.useNormalOffset),B.uploadCommonUniforms(te,qn,null,on);const kn=_r.pbrMetallicRoughness;kn.metallicFactor=.9,kn.roughnessFactor=.5;const Jn=Gl(new Float32Array(cr),new Float32Array(ar),new Float32Array(Ur),new Float32Array(mi.matrix),B,Jt.opacity,kn.baseColorFactor,_r.emissiveFactor,kn.metallicFactor,kn.roughnessFactor,_r,Ti,H,[0,0,0],Ci);!Qi&&(oi.hasTranslucentParts||Jt.opacity<1)&&qn.draw(B,te.gl.TRIANGLES,de,$t.disabled,ui.disabled,zt.backCCW,Jn,H.id,lr.vertexBuffer,lr.indexBuffer,lr.segments,H.paint,B.transform.zoom,void 0,Mr),qn.draw(B,te.gl.TRIANGLES,Qi?Te:de,$t.disabled,Qi||Jt.opacity<1||oi.hasTranslucentParts?ui.alphaBlended:ui.unblended,zt.backCCW,Jn,H.id,lr.vertexBuffer,lr.indexBuffer,lr.segments,H.paint,B.transform.zoom,void 0,Mr)}}}}()}(l,t,n,c),void x();if(T.type!=="model")return;const S=T.getModels(),M=[],I=l.transform.getFreeCameraOptions().position,C=o.bY([],[I.x,I.y,I.z],l.transform.worldSize);o.eb(C,C);const L=[],z=[];let k=0;for(const B of S){const V=n.paint.get("model-rotation").constantOr(null),H=n.paint.get("model-scale").constantOr(null),Y=n.paint.get("model-translation").constantOr(null);B.computeModelMatrix(l,V,H,Y,!0,!0,!1);const te=o.bx([]),ee=o.ec(B.position.lat,l.transform.zoom),J=o.bn([],[1,1,1/ee]);o.bo(te,te,C),M.push({zScaleMatrix:J,negCameraPosMatrix:te});for(const K of B.nodes)na(l.transform,K,B.matrix,l.transform.expandedFarZProjMatrix,k,L,z);k++}if(L.sort((B,V)=>V.depth-B.depth),l.renderPass!=="shadow"){if(d===1)for(const B of z)it(B,l,n,M[B.modelIndex],$t.disabled,l.colorModeForRenderPass());else{for(const B of z)it(B,l,n,M[B.modelIndex],$t.disabled,ui.disabled);for(const B of z)it(B,l,n,M[B.modelIndex],l.stencilModeFor3D(),l.colorModeForRenderPass());l.resetStencilClippingMasks()}for(const B of L)it(B,l,n,M[B.modelIndex],$t.disabled,l.colorModeForRenderPass());x()}else{for(const B of z)Er(B.mesh,B.nodeModelMatrix,l,n);for(const B of L)Er(B.mesh,B.nodeModelMatrix,l,n);x()}}},Fh={line:function(l,t,n){if(l.hasElevatedBuckets=!1,l.hasNonElevatedBuckets=!1,l._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||l._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();for(const d of c){const p=t.getTile(d).getBucket(l);if(p&&(p.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,n){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(n.modelManager&&n.modelManager.upload(n,c.type==="vector"?l.scope:""));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const p of d)p.upload(n.context)},raster:function(l,t,n){const c=t.getSource();if(!(c instanceof co&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(d,p)&&c.prepareTile(y,d,p)},"raster-particle":function(l,t,n){const c=t.getSource();if(!(c instanceof co&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(d,p)&&c.prepareTile(y,d,p)}},Zs={fill:Mh},Yl={fill:function(l,t,n,c){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const d=l.context.gl,p=new nt(d.LEQUAL,nt.ReadOnly,l.depthRangeFor3D),m=new $t({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=l.transform.getFreeCameraOptions().position,x=l.getOrCreateProgram("elevatedStructuresDepthReconstruct",{defines:["DEPTH_RECONSTRUCTION"]});for(const T of c){const S=t.getTile(T),M=S.getBucket(n);if(!M)continue;const I=M.elevatedStructures;if(!I||I.maskSegments.segments[0].primitiveLength===0)continue;const C=ou(T.toUnwrapped(),y),L=l.translatePosMatrix(T.projMatrix,S,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor")),z=iu(L,C,0,0,0);x.draw(l,d.TRIANGLES,p,m,ui.disabled,zt.disabled,z,n.id,I.vertexBuffer,I.indexBuffer,I.maskSegments,n.paint,l.transform.zoom)}}};class $a{constructor(t,n,c,d,p,m){this.context=new dm(t,n),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=p,this._timeStamp=o.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const y=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const T of y)this._debugParams.enabledLayers[T]=!0;p.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),p.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),p.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),p.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const T of y)p.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],T);this.occlusionParams=new Sp(p),this.setup(),this.numSublayers=Dn.maxUnderzooming+Dn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new o.et,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new qf(this),this._wireframeDebugCache=new vm,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const x=new o.r({width:1,height:1},Uint8Array.of(0,0,0,0));
2655this.emptyDepthTexture=new o.T(this.context,x,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=m}updateTerrain(t,n){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Bl(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,n),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const n=t.fog;if(!n||this.transform.projection.name==="globe"||n.getOpacity(this.transform.pitch)<1||n.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=n.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const p=c+.78*(d-c);this.transform.fogCullDistSq=p*p}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new Bl(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,n){if(this.width=t*o.q.devicePixelRatio,this.height=n*o.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,n=new o.ba;n.emplaceBack(0,0),n.emplaceBack(o.aj,0),n.emplaceBack(0,o.aj),n.emplaceBack(o.aj,o.aj),this.tileExtentBuffer=t.createVertexBuffer(n,o.bc.members),this.tileExtentSegments=o.bd.simpleSegment(0,0,4,2);const c=new o.ba;c.emplaceBack(0,0),c.emplaceBack(o.aj,0),c.emplaceBack(0,o.aj),c.emplaceBack(o.aj,o.aj),this.debugBuffer=t.createVertexBuffer(c,o.bc.members),this.debugSegments=o.bd.simpleSegment(0,0,4,5);const d=new o.ba;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,o.bc.members),this.viewportSegments=o.bd.simpleSegment(0,0,4,2);const p=new o.aZ;p.emplaceBack(0,0,0,0),p.emplaceBack(o.aj,0,o.aj,0),p.emplaceBack(0,o.aj,0,o.aj),p.emplaceBack(o.aj,o.aj,o.aj,o.aj),this.mercatorBoundsBuffer=t.createVertexBuffer(p,o.bf.members),this.mercatorBoundsSegments=o.bd.simpleSegment(0,0,4,2);const m=new o.a_;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const y=new o.bb;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new o.T(t,new o.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=o.bz();const x=this.context.gl;this.stencilClearMode=new $t({func:x.ALWAYS,mask:0},0,255,x.ZERO,x.ZERO,x.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,nt.disabled,this.stencilClearMode,ui.disabled,zt.disabled,Ko(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,n,c){if(!n||this.currentStencilSource===n.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const x of c)if(this._tileClippingMaskIDs[x.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=n.id;const d=this.context,p=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(ui.disabled),d.setDepthMode(nt.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const x=n.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:M,tileBoundsSegments:I}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,nt.disabled,new $t({func:p.ALWAYS,mask:0},T,255,p.KEEP,p.KEEP,p.REPLACE),ui.disabled,zt.disabled,Ko(y.projMatrix),"$clipping",S,M,I)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new $t({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const n=this.context.gl;return new $t({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,c=t.sort((m,y)=>
2655y.overscaledZ-m.overscaledZ),d=c[c.length-1].overscaledZ,p=c[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+d]=new $t({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,c]}return[{[d]:$t.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ui([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new o.am(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ui.unblended:ui.alphaBlended}colorModeForDrapableLayerRenderPass(t){const n=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new ui([n.ONE,n.ONE_MINUS_SRC_ALPHA,n.CONSTANT_ALPHA,n.ONE_MINUS_SRC_ALPHA],new o.am(0,0,0,t===void 0?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,n,c,d=!1){if(this.depthOcclusion)return new nt(this.context.gl.GREATER,nt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return nt.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new nt(c||this.context.gl.LEQUAL,n,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,n=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),p=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===n&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),n!==0&&c!==0&&(this.depthFBO=new Ah(this.context,n,c,!1,"texture"),this.depthTexture=new o.T(this.context,{width:n,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,p),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,n,c,0,0,n,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,n)=>t+n/this._fpsHistory.length,0))}render(t,n){const c=o.q.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=n;const d=this.style._mergedLayers,p=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(p).filter(de=>{const Te=d[de];return!(Te.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Te.type]});let y=m(),x=!1,T=!1;for(const de of y){const Te=d[de];Te.type==="circle"&&(x=!0),Te.type==="symbol"&&(Te.hasInitialOcclusionOpacityProperties?T=!0:x=!0)}let S=y.map(de=>d[de]);const M=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(o.q.now()),this.imageManager.beginFrame();let I=0,C=!1;for(const de in M){const Te=M[de];Te.used&&(Te.prepare(this.context),Te.getSource().usedInConflation&&++I)}let L=!1;for(const de of S)de.isHidden(this.transform.zoom)||(de.type==="clip"&&(L=!0),this.prepareLayer(de));const z={},k={},B={},V={},H={};for(const de in M){const Te=M[de];z[de]=Te.getVisibleCoordinates(),k[de]=z[de].slice().reverse(),B[de]=Te.getVisibleCoordinates(!0).reverse(),V[de]=Te.getShadowCasterCoordinates(),H[de]=Te.sortCoordinatesByDistance(z[de])}const Y=de=>{const Te=this.style.getLayerSourceCache(de);return Te&&Te.used?Te.getSource():null};if(I||L||this._clippingActiveLastFrame){const de=[],Te=[];let le=0;for(const Re of S)this.isSourceForClippingOrConflation(Re,Y(Re))&&(de.push(Re),Te.push(le)),le++;if(de&&(L||de.length>1)||this._clippingActiveLastFrame){L=!1;const Re=[];for(let xe=0;xe<de.length;xe++){const Le=de[xe],qe=Te[xe],Pe=this.style.getLayerSourceCache(Le);if(!Pe||!Pe.used||!Pe.getSource().usedInConflation&&Le.type!=="clip")continue;let Ge=o.eu,ot=o.bQ.None;const at=[];let rt=!0;
2655if(Le.type==="clip"){Ge=qe;for(const mt of Le.layout.get("clip-layer-types"))ot|=mt==="model"?o.bQ.Model:mt==="symbol"?o.bQ.Symbol:o.bQ.FillExtrusion;for(const mt of Le.layout.get("clip-layer-scope"))at.push(mt);Le.isHidden(this.transform.zoom)?rt=!1:L=!0}rt&&Re.push({layer:Le.fqid,cache:Pe,order:Ge,clipMask:ot,clipScope:at})}this.replacementSource.setSources(Re),C=!0}}this._clippingActiveLastFrame=L,C||this.replacementSource.clear(),this.conflationActive=C,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let de=0;de<S.length;de++){const Te=S[de],le=Te.cutoffRange();if(this.longestCutoffRange=Math.max(le,this.longestCutoffRange),le>0){const Re=Y(Te);Re&&(this.minCutoffZoom=Math.max(Re.minzoom,this.minCutoffZoom)),Te.minzoom&&(this.minCutoffZoom=Math.max(Te.minzoom,this.minCutoffZoom))}Te.is3D(p)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=de),this._lastOcclusionLayer=de)}const te=this.style&&this.style.fog;te?(this._fogVisible=te.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=te.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(B),this.opaquePassCutoff=0,y=m(),S=y.map(de=>d[de]));const ee=this._shadowRenderer;if(ee){ee.updateShadowParameters(this.transform,this.style.directionalLight);for(const de in M)for(const Te of z[de]){let le={min:0,max:0};this.terrain&&(le=this.terrain.getMinMaxForTile(Te)||le),ee.addShadowReceiver(Te.toUnwrapped(),le.min,le.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new o.ev(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ja(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const J=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),K=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(J&&!this._snow&&(this._snow=new mr(this)),!J&&this._snow&&(this._snow.destroy(),delete this._snow),K&&!this._rain&&(this._rain=new bm(this)),!K&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),!Ds.has(this.context.gl))return;this.renderPass="offscreen";for(const de of S){const Te=t.getLayerSourceCache(de);if(!de.hasOffscreenPass()||de.isHidden(this.transform.zoom))continue;const le=Te?k[Te.id]:void 0;(de.type==="custom"||de.type==="raster"||de.type==="raster-particle"||de.isSky()||le&&le.length)&&this.renderLayer(this,Te,de,le)}this.depthRangeFor3D=[0,1-(S.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,V)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ie=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),ne=(()=>{if(n.showOverdrawInspector)return o.am.black;const de=this.style.fog;if(de&&this.transform.projection.supportsFog){const Te=this.style.getLut(de.scope);if(!ie){const le=de.properties.get("color-use-theme")==="none",Re=de.properties.get("color").toNonPremultipliedRenderColor(le?null:Te).toArray01();return new o.am(...Re)}if(ie){const le=de.properties.get("space-color-use-theme")==="none",Re=de.properties.get("space-color").toNonPremultipliedRenderColor(le?null:Te).toArray01();return new o.am(...Re)}}return o.am.transparent})();if(this.context.clear({color:ne,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ie&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const de=S[this.currentLayer],Te=t.getLayerSourceCache(de);if(de.isSky())continue;const le=Te?(de.is3D(p)?H:k)[Te.id]:void 0;this._renderTileClippingMasks(de,Te,le),this.renderLayer(this,Te,de,le)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ie&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||o.ah(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isH
2655orizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const de=S[this.currentLayer],Te=t.getLayerSourceCache(de);de.isSky()&&this.renderLayer(this,Te,de,Te?k[Te.id]:void 0)}function fe(de,Te){let le;return Te&&(le=(de.type==="symbol"?B:de.is3D(p)?H:k)[Te.id]),le}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const de=S[this.currentLayer];if(de.type==="raster"||de.type==="raster-particle"){const Te=t.getLayerSourceCache(de);this.renderLayer(this,Te,de,fe(de,Te))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let _e=0;ee&&(_e=ee.getShadowCastingLayerCount());let Me=!1,Ce=-1;for(let de=0;de<y.length;++de){const Te=S[de];Te.isHidden(this.transform.zoom)||Te.is3D(p)&&(Ce=de)}T&&Ce===-1&&(x=!0);let Fe=!1;for(;this.currentLayer<y.length;){const de=S[this.currentLayer],Te=t.getLayerSourceCache(de);if(de.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(de)){if(de.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Fe&&de.is3D(p)&&!p){const le=this.currentLayer,Re=xe=>{for(this.currentLayer=0;this.currentLayer<S.length;this.currentLayer++){const Le=S[this.currentLayer];if(Zs[Le.type]){const qe=this.style.getLayerSourceCache(Le);Zs[Le.type](this,qe,Le,fe(Le,qe),xe)}}};Re("initialize"),Re("reset"),this.currentLayer=le,Fe=!0}if(x&&!Me&&this.terrain&&!this.transform.isOrthographic&&(Me=!0,this.blitDepth()),T&&Ce!==-1&&this.currentLayer===Ce+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(de,Te,Te?z[Te.id]:void 0),this.renderLayer(this,Te,de,fe(de,Te)),!this.terrain&&ee&&_e>0&&de.hasShadowPass()&&--_e==0){{this.clearStencil();const le=this.currentLayer;for(this.currentLayer=0;this.currentLayer<S.length;this.currentLayer++){const Re=S[this.currentLayer];if(Yl[Re.type]){const xe=this.style.getLayerSourceCache(Re);Yl[Re.type](this,xe,Re,fe(Re,xe))}}this.currentLayer=le}if(ee.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const le=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=le;this.currentLayer++){const Re=S[this.currentLayer];if(!Re.hasLightBeamPass())continue;const xe=t.getLayerSourceCache(Re);this.renderLayer(this,xe,Re,xe?k[xe.id]:void 0)}this.currentLayer=le,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const le=this.currentLayer;this.depthOcclusion=!0;for(const Re of this.layersWithOcclusionOpacity){this.currentLayer=Re;const xe=S[this.currentLayer],Le=t.getLayerSourceCache(xe),qe=Le?k[Le.id]:void 0;this.terrain||this._renderTileClippingMasks(xe,Le,Le?z[Le.id]:void 0),this.renderLayer(this,Le,xe,qe)}this.depthOcclusion=!1,this.currentLayer=le,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let de=null;S.forEach(Te=>{const le=t.getLayerSourceCache(Te);le&&!Te.isHidden(this.transform.zoom)&&le.getVisibleCoordinates().length&&(!de||de.getSource().maxzoom<le.getSource().maxzoom)&&(de=le)}),de&&this.options.showTileBoundaries&&qs(this,de,de.getVisibleCoordinates(),o.am.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&qs(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new o.am(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(de){const Te=de.transform.padding;au(de,de.transform.height-(Te.top||0),3,_m),au(de,Te.bottom||0,3,gm),lu(de,Te.left||0,3,$n),lu(de,de.transform.width-(Te.right||0),3,Rh);const le=de.transform.centerPoint;(function(Re,xe,Le,qe){Ua(Re,xe-1,Le-10,2,20,qe),Ua(Re,xe-10,Le-1,20,2,qe)})(de,le.x,de.transform.height-le.y,Mn)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
2655anvasCopy()),C||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:n}=this.transform.projection,c=!n||!n.includes(t.type);if(Fh[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);Fh[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,n,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||d&&d.length)&&(this.id=c.id,this.gpuTimingStart(c),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(c.type)&&(!t.terrain||c.type!=="custom")||c.type==="clip"||Ai[c.type](t,n,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery,c=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),d.calls++,c.beginQuery(n.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,n=this.context.gl,c=n.createQuery();this.deferredRenderGpuTimeQueries.push(c),n.beginQuery(t.TIME_ELAPSED_EXT,c)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const n={};for(const c in t){const d=t[c],p=this.context.extTimerQuery,m=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
2655p.deleteQueryEXT(d.query),n[c]=m}return n}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const n=this.context.gl;let c=0;for(const d of t)c+=n.getQueryParameter(d,n.QUERY_RESULT)/1e6,n.deleteQuery(d);return c}translatePosMatrix(t,n,c,d,p){if(!c[0]&&!c[1])return t;const m=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const T=Math.sin(m),S=Math.cos(m);c=[c[0]*S-c[1]*T,c[0]*T+c[1]*S]}const y=[p?c[0]:o.aw(n,c[0],this.transform.zoom),p?c[1]:o.aw(n,c[1],this.transform.zoom),0],x=new Float32Array(16);return o.bo(x,t,y),x}saveTileTexture(t){const n=t.size[0],c=this._tileTextures[n];c?c.push(t):this._tileTextures[n]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,n,c){const d=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,p=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(p.push("LIGHTING_3D_MODE"),p.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||p.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||p.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(p.push("TERRAIN"),this.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&p.push("GLOBE"),!this._fogVisible||d||n!==void 0&&!n||p.push("FOG","FOG_DITHERING"),d&&p.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&p.push("OVERDRAW_INSPECTOR"),p}getOrCreateProgram(t,n){this.cache=this.cache||{};const c=n&&n.defines||[],d=n&&n.config,p=this.currentGlobalDefines(t,n&&n.overrideFog,n&&n.overrideRtt).concat(c),m=tu.cacheKey(jc[t],t,p,d);return this.cache[m]||(this.cache[m]=new tu(this.context,t,jc[t],d,dp[t],p)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new o.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,n){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const p=((m,y,x)=>{const T=m.properties.get("direction"),S=m.properties.get("color-use-theme")==="none",M=m.properties.get("color").toNonPremultipliedRenderColor(S?null:x.getLut(m.scope)).toArray01(),I=m.properties.get("intensity"),C=y.properties.get("color-use-theme")==="none",L=y.properties.get("color").toNonPremultipliedRenderColor(C?null:x.getLut(y.scope)).toArray01(),z=y.properties.get("intensity"),k=[T.x,T.y,T.z],B=o.dw(L,z),V=o.dw(M,I);return{u_lighting_ambient_color:B,u_lighting_directional_dir:k,u_lighting_directional_color:V,u_ground_radiance:eu(k,V,B)}})(c,d,this.style);n.setLightsUniformValues(t,p)}}}uploadCommonUniforms(t,n,c,d,p){if(this.uploadCommonLightUniforms(t,n),this.terrain&&this.terrain.renderingToTexture)return;const m=this.style.fog;if(m){const y=m.getOpacity(this.transform.pitch),x=((T,S,M,I,C,L,z,k,B,V,H,Y)=>{const te=T.transform,ee=S.properties.get("color-use-theme")==="none",J=S.properties.get("color").toNonPremultipliedRenderColor(ee?null:T.style.getLut(S.scope)).toArray01();J[3]=I;const K=T.frameCounter/1e3%1,[ie,ne]=S.properties.get("vertical-range");return{u_fog_matrix:M?te.calculateFogTileMatrix(M):Y||T.identityMat,u_fog_range:S.getFovAdjustedRange(te._fov),u_fog_color:J,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ie,ne),ne],u_fog_temporal_offset:K,u_frustum_tl:C,u_frustum_tr:L,u_frustum_br:z,u_frustum_bl:k,u_globe_pos:B,u_globe_radius:V,u_viewport:H,u_globe_transition:o.ah(te.zoom),u_is_globe:+(te.projection.name==="globe")}})(this,m,c,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*o.q.devicePixelRatio,this.transform.height*o.q.devicePixelRatio],d);n.setFogUniformValues(t,x)}p&&n.setCutoffUniformValues(t,p.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),n}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}
vendor: 37,246 bytes, line 2655
2655getBackgroundTiles(){const t=this._backgroundTiles,n=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)n[d.key]=t[d.key]||new No(d,512,this.transform.tileZoom,this,void 0,this.worldview);return n}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,n){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building")&&(!n||n.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let n=this._cachedTileFogOpacities[t.key];return n||(this._cachedTileFogOpacities[t.key]=n=this.style.fog.getOpacityForTile(t)),n[0]>=be||n[1]>=be}setupDepthForOcclusion(t,n,c){const d=this.context,p=d.gl,m=!!c;var y;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||n.setTerrainUniformValues(d,c)}}function To(l,t){let n=!1,c=null;const d=()=>{c=null,n&&(l(),c=setTimeout(d,t),n=!1)};return()=>(n=!0,c||d(),c)}class Oh{constructor(t){this._hashName=t&&encodeURIComponent(t),o.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=To(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const n=pu(t);if(this._hashName){const c=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(m=>{const y=m.split("=")[0];return y===c?(d=!0,`${y}=${n}`):m}).filter(m=>m);return d||p.push(`${c}=${n}`),`#${p.join("&")}`}return`#${n}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(n=c)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const n=this._getCurrentHash();if(n.length>=3&&!n.some(c=>isNaN(Number(c)))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(n[3]||0):t.getBearing();return t.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:c,pitch:+(n[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function pu(l,t){const n=l.getCenter(),c=Math.round(100*l.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,d),m=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,x=l.getBearing(),T=l.getPitch();let S=t?`/${m}/${y}/${c}`:`${c}/${y}/${m}`;return(x||T)&&(S+="/"+Math.round(10*x)/10),T&&(S+=`/${Math.round(T)}`),S}const qa={linearity:.3,easing:o.ew(0,0,.3,1)},Bh=o.h({deceleration:2500,maxSpeed:1400},qa),As=o.h({deceleration:20,maxSpeed:1400},qa),So=o.h({deceleration:1e3,maxSpeed:360},qa),Kl=o.h({deceleration:1e3,maxSpeed:90},qa);class fu{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=o.q.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const n={zoom:0,bearing:0,pitch:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){const p=Za(n.pan.mag(),c,o.h({},Bh,t||{}));d.offset=n.pan.mult(p.amount/n.pan.mag()),d.center=this._map.transform.center,Ha(d,p)}if(n.zoom){const p=Za(n.zoom,c,As);d.zoom=this._map.transform.zoom+p.amount,Ha(d,p)}if(n.bearing){const p=Za(n.bearing,c,So);d.bearing=this._map.transform.bearing+o.ay(p.amount,-179,179),Ha(d,p)}if(n.pitch){const p=Za(n.pitch,c,Kl);d.pitch=this._map.transform.pitch+p.amount,Ha(d,p)}if(d.zoom||d.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function Ha(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function Za(l,t,n){const{maxSpeed:c,linearity:d,deceleration:p}=n,m=o.ay(l*d/(t/1e3),-c,c),y=Math.abs(m)/(p*d);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class nn extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c,d={}){const p=bn(n.getCanvasContainer(),c),m=n.unproject(p);super(t,o.h({point:p,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=n}}class Wa extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c){const d=t==="touchend"?c.changedTouches:c.touches,p=Rn(n.getCanvasContainer(),d),m=p.map(x=>n.unproject(x)),y=p.reduce((x,T,S,M)=>x.add(T.div(M.length)),new o.P(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class Eo extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n){super("wheel",{originalEvent:n}),this._defaultPrevented=!1}}class Nh{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new Eo(this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new nn(t.type,this._map,t))}mouseup(t){this._map.fire(new nn(t.type,this._map,t))}preclick(t){const n=o.h({},t);n.type="preclick",this._map.fire(new nn(n.type,this._map,n))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||(this.preclick(t),this._map.fire(new nn(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new nn(t.type,this._map,t))}mouseover(t){this._map.fire(new nn(t.type,this._map,t))}mouseout(t){this._map.fire(new nn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Wa(t.type,this._map,t))}touchmove(t){this._map.fire(new Wa(t.type,this._map,t))}touchend(t){this._map.fire(new Wa(t.type,this._map,t))}touchcancel(t){this._map.fire(new Wa(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mu{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new nn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new nn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new nn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vh{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Rt(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const c=n,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=Ke("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,c.x),y=Math.max(d.x,c.x),x=Math.min(d.y,c.y),T=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=y-m+"px",this._box.style.height=T-x+"px")})}mouseupWindow(t,n){if(!this._active)return;const c=this._startPos,d=n;if(c&&t.button===0){if(this.reset(),ln(),c.x!==d.x||c.y!==d.y)return this._map.fire(new o.A("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),wt(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new o.A(t,{originalEvent:n}))}}function Jl(l,t){const n={};for(let c=0;c<l.length;c++)n[l[c].identifier]=t[c];return n}class sn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,n,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=function(d){const p=new o.P(0,0);for(const m of d)p._add(m);return p.div(d.length)}(n),this.touches=Jl(c,n)))}touchmove(t,n,c){if(this.aborted||!this.centroid)return;const d=Jl(c,n);for(const p in this.touches){const m=d[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class Ql{constructor(t){this.singleTap=new sn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,n,c){this.singleTap.touchstart(t,n,c)}touchmove(t,n,c){this.singleTap.touchmove(t,n,c)}touchend(t,n,c){const d=this.singleTap.touchend(t,n,c);if(d){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Uh{constructor(){this._zoomIn=new Ql({numTouches:1,numTaps:2}),this._zoomOut=new Ql({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,c){this._zoomIn.touchstart(t,n,c),this._zoomOut.touchstart(t,n,c)}touchmove(t,n,c){this._zoomIn.touchmove(t,n,c),this._zoomOut.touchmove(t,n,c)}touchend(t,n,c){const d=this._zoomIn.touchend(t,n,c),p=this._zoomOut.touchend(t,n,c);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(d)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const jh={0:1,2:2},Io={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class ec{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const c=zs(t);this._correctButton(t,c)&&(this._lastPoint=n,this._eventButton=c)}mousemoveWindow(t,n){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&function(d,p){const m=jh[p];return d.buttons===void 0||(d.buttons&m)!==m}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(c,n)}}mouseupWindow(t){this._lastPoint&&zs(t)===this._eventButton&&(this._moved&&ln(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gh extends ec{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class _u extends ec{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Io[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=.8*(n.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class oa extends ec{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Io[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=-.5*(n.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class $h{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),o.aV(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}touchstart(t,n,c){return this._calculateTransform(t,n,c)}touchmove(t,n,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!o.ex())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,n,c)}}touchend(t,n,c){this._calculateTransform(t,n,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,c){c.length>0&&(this._active=!0);const d=Jl(c,n),p=new o.P(0,0),m=new o.P(0,0);let y=0;for(const T in d){const S=d[T],M=this._touches[T];M&&(p._add(S),m._add(S.sub(M)),y++,d[T]=S)}if(this._touches=d,y<this._minTouches||!m.mag())return;const x=m.div(y);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:x}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ke("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class tc{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,n,c){return{}}touchstart(t,n,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[p,m]=d,y=Xa(c,n,p),x=Xa(c,n,m);if(!y||!x)return;const T=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],T,t)}touchend(t,n,c){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=Xa(c,n,d),y=Xa(c,n,p);m&&y||(this._active&&ln(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Xa(l,t,n){for(let c=0;c<l.length;c++)if(l[c].identifier===n)return t[c]}function ic(l,t){return Math.log(l/t)/Math.LN2}class qh extends tc{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ic(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ic(this._distance,c),pinchAround:n}}}function gu(l,t){return 180*l.angleWith(t)/Math.PI}class Ip extends tc{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:gu(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=gu(t,c);return Math.abs(d)<n}}function yu(l){return Math.abs(l.y)>Math.abs(l.x)}class Ap extends tc{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,yu(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,c){const d=this._lastPoints;if(!d)return;const p=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!o.ex()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(p,m,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5})}gestureBeginsVertically(t,n,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,p=n.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return yu(t)&&yu(n)&&m}}const Mp={panStep:100,bearingStep:15,pitchStep:10};class Cp{constructor(){const t=Mp;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,c=0,d=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:y=>{const x=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:Pp,zoom:n?Math.round(x)+n*(t.shiftKey?2:1):x,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:y.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Pp(l){return l*(2-l)}const Hh=4.000244140625,Rp=1/450;class zp{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Rp,o.aV(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||o.ex()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=o.q.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,n!==0&&n%Hh==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=bn(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:n,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const n=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Hh?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const M=n(),I=Math.pow(2,M),C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):I;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*S))),this._type==="wheel"&&(this._startZoom=M,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:n(),d=this._startZoom,p=this._easing;let m,y=!1;if(this._type==="wheel"&&d&&p){const T=Math.min((o.q.now()-this._lastWheelEventTime)/200,1),S=p(T);m=o.ai(d,c,S),T<1?this._frameId||(this._frameId=!0):y=!0}else m=c,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let x=m-n();return x*this._lastDelta<0&&(x=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=o.ey;if(this._prevEase){const c=this._prevEase,d=(o.q.now()-c.start)/c.duration,p=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=o.ew(m,y,.25,1)}return this._prevEase={start:o.q.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ke("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Dp{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Lp{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,n){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class kp{constructor(){this._tap=new Ql({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,n,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=n[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,n,c))}touchmove(t,n,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=n[0],p=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,c)}touchend(t,n,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,n,c)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fp{constructor(t,n,c){this._el=t,this._mousePan=n,this._touchPan=c}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class wm{constructor(t,n,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Tm{constructor(t,n,c,d){this._el=t,this._touchZoom=n,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const xu=l=>l.zoom||l.drag||l.pitch||l.rotate;class Ar extends o.A{}class Op{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const c=o.at([],n,t);this.radius=o.ae(c[2]<0?o.eA([],c,this.constants):[c[0],c[1],0])}projectRay(t){o.eA(t,t,this.constants),o.au(t,t),o.eB(t,t,this.constants);const n=o.bY([],t,this.radius);if(n[2]>0){const c=o.bY([],[0,0,1],o.bG(n,[0,0,1])),d=o.bY([],o.au([],[n[0],n[1],0]),this.radius),p=o.cV([],n,o.bY([],o.at([],o.cV([],d,c),n),2));n[0]=p[0],n[1]=p[1]}return n}}function vu(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Zh{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new fu(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Op,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),o.aV(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,y,m)}}destroy(){for(const[t,n,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(n,d,c)}}_addDefaultHandlers(t){const n=this._map,c=n.getCanvasContainer();this._add("mapEvent",new Nh(n,t));const d=n.boxZoom=new Vh(n,t);this._add("boxZoom",d);const p=new Uh,m=new Lp;n.doubleClickZoom=new Dp(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new kp;this._add("tapDragZoom",y);const x=n.touchPitch=new Ap(n);this._add("touchPitch",x);const T=new _u(t),S=new oa(t);n.dragRotate=new wm(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const M=new Gh(t),I=new $h(n,t);n.dragPan=new Fp(c,M,I),this._add("mousePan",M),this._add("touchPan",I,["touchZoom","touchRotate"]);const C=new Ip,L=new qh;n.touchZoomRotate=new Tm(c,L,C,y),this._add("touchRotate",C,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]),this._add("blockableMapEvent",new mu(n));const z=n.scrollZoom=new zp(n,this);this._add("scrollZoom",z,["mousePan"]);const k=n.keyboard=new Cp;this._add("keyboard",k);for(const B of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[B]&&n[B].enable(t[B])}_add(t,n,c){this._handlers.push({handlerName:t,handler:n,allowed:c}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!xu(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,n,c){for(const d in t)if(d!==c&&(!n||n.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const c of t)this._el.contains(c.target)&&n.push(c);return n}handleEvent(t,n){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,p={needsRenderFrame:!1},m={},y={},x=t.touches?this._getMapTouches(t.touches):void 0,T=x?Rn(this._el,x):c?void 0:bn(this._el,t);for(const{handlerName:I,handler:C,allowed:L}of this._handlers){if(!C.isEnabled())continue;let z;this._blockedByActive(y,L,I)?C.reset():C[n||t.type]&&(z=C[n||t.type](t,T,x),this.mergeHandlerResult(p,m,z,I,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||C.isActive())&&(y[I]=C)}const S={};for(const I in this._previousActiveHandlers)y[I]||(S[I]=d);this._previousActiveHandlers=y,(Object.keys(S).length||vu(p))&&(this._changes.push([p,m,S]),this._triggerRenderFrame()),(Object.keys(y).length||vu(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=p;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,c,d,p){if(!c)return;o.h(t,c);const m={handlerName:d,originalEvent:c.originalEvent||p};c.zoomDelta!==void 0&&(n.zoom=m),c.panDelta!==void 0&&(n.drag=m),c.pitchDelta!==void 0&&(n.pitch=m),c.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},c={};for(const[d,p,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new o.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),o.h(n,p),o.h(c,m);this._updateMapTransform(t,n,c),this._changes=[]}_updateMapTransform(t,n,c){const d=this._map,p=d.transform,m=V=>[V.x,V.y,V.z];if((V=>{const H=this._eventsInProgress.drag;return H&&!this._handlersById[H.handlerName].isActive()})()&&!vu(t)){const V=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),V!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!vu(t))return void this._fireEvents(n,c,!0);let{panDelta:y,zoomDelta:x,bearingDelta:T,pitchDelta:S,around:M,aroundCoord:I,pinchAround:C}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),C!==void 0&&(M=C),(x||(V=>n[V]&&!this._eventsInProgress[V])("drag"))&&M&&(this._dragOrigin=m(p.pointCoordinate3D(M)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),M=M||d.transform.centerPoint,T&&(p.bearing+=T),S&&(p.pitch+=S),p._updateCameraState();const L=[0,0,0];if(y)if(p.projection.name==="mercator"){const V=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M).dir),H=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M.sub(y)).dir);L[0]=H[0]-V[0],L[1]=H[1]-V[1]}else{const V=p.pointCoordinate(M);if(p.projection.name==="globe"){y=y.rotate(-p.angle);const H=p._pixelsPerMercatorPixel/p.worldSize;L[0]=-y.x*o.ez(o.aY(V.y))*H,L[1]=-y.y*o.ez(p.center.lat)*H}else{const H=p.pointCoordinate(M.sub(y));V&&H&&(L[0]=H.x-V.x,L[1]=H.y-V.y)}}const z=p.zoom,k=[0,0,0];if(x){const V=m(I||p.pointCoordinate3D(M)),H={dir:o.au([],o.at([],V,p._camera.position))};if(H.dir[2]<0){const Y=p.zoomDeltaToMovement(V,x);o.bY(k,H.dir,Y)}}const B=o.cV(L,L,k);p._translateCameraConstrained(B),x&&Math.abs(p.zoom-z)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,c,!0)}_fireEvents(t,n,c){const d=xu(this._eventsInProgress),p=xu(t),m={};for(const S in t){const{originalEvent:M}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=M),this._eventsInProgress[S]=t[S]}!d&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:M}=t[S];this._fireEvent(S,M)}const y={};let x;for(const S in this._eventsInProgress){const{handlerName:M,originalEvent:I}=this._eventsInProgress[S];this._handlersById[M].isActive()||(delete this._eventsInProgress[S],x=n[M]||I,y[`${S}end`]=x)}for(const S in y)this._fireEvent(S,y[S]);const T=xu(this._eventsInProgress);if(c&&(d||p)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=I=>I!==0&&-this._bearingSnap<I&&I<this._bearingSnap;S?(M(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:x})):(this._map.fire(new o.A("moveend",{originalEvent:x})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new o.A(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new Ar("renderFrame",{timeStamp:t})),this._applyChanges()})}
2655_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Bp="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class rc extends o.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=n.respectPrefersReducedMotion!==!1,o.aV(["_renderFrameCallback"],this)}getCenter(){return new o.cd(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,c){return t=o.P.convert(t).mult(-1),this.panTo(this.transform.center,o.h({offset:t},n),c)}panTo(t,n,c){return this.easeTo(o.h({center:t},n),c)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,c){return this.easeTo(o.h({zoom:t},n),c)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,c){return this.easeTo(o.h({bearing:t},n),c)}resetNorth(t,n){return this.rotateTo(0,o.h({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(o.h({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=o.aG.convert(t);const c=n&&n.bearing||0,d=n&&n.pitch||0,p=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,p,m,c,d,n)}_extendPadding(t){const n={top:0,right:0,bottom:0,left:0};return t==null?o.h({},n,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:o.h({},n,t)}_extendCameraOptions(t){return(t=o.h({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,n){const c=n.max[0]-n.min[0],d=n.max[1]-n.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,n,c,d,p,m){const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=o.cd.convert(n),S=o.cd.convert(c),M=.5*(T.lat+S.lat),I=.5*(T.lng+S.lng),C=o.eC(M,I),L=o.au([],C),z=o.au([],o.bF([],L,[0,1,0])),k=o.bF([],z,L),B=[z[0],z[1],z[2],0,k[0],k[1],k[2],0,L[0],L[1],L[2],0,0,0,0,1],V=[C,o.eC(T.lat,T.lng),o.eC(S.lat,T.lng),o.eC(S.lat,S.lng),o.eC(T.lat,S.lng),o.eC(M,T.lng),o.eC(M,S.lng),o.eC(T.lat,I),o.eC(S.lat,I)];let H=o.cW.fromPoints(V.map(xe=>[o.bG(z,xe),o.bG(k,xe),o.bG(L,xe)]));const Y=o.ad([],H.center,B);o.eD(Y)===0&&o.eE(Y,0,0,1),o.au(Y,Y),o.bY(Y,Y,o.aB),y.center=o.eF(Y);const te=y.getWorldToCameraMatrix(),ee=o.bi(new Float64Array(16),te);H=o.cW.applyTransform(H,o.az([],te,B));const J=this._extendAABB(H,y,x,d);if(!J)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");H=J,o.ad(Y,Y,te);const K=.5*(H.max[2]-H.min[2]),ie=this._minimumAABBFrustumDistance(y,H),ne=o.bY([],[0,0,1],K),fe=o.cV(ne,Y,ne),_e=ie+(y.pitch===0?0:o.bD(Y,fe)),Me=y.globeCenterInViewSpace,Ce=o.at([],Y,[Me[0],Me[1],Me[2]]);o.au(Ce,Ce),o.bY(Ce,Ce,_e);const Fe=o.cV([],Y,Ce);o.ad(Fe,Fe,ee);const de=o.eq/o.aB,Te=o.ae(Fe),le=o.c6(Math.max(Te*de-o.eq,Number.EPSILON),0),Re=Math.min(y.zoomFromMercatorZAdjusted(le),x.maxZoom);return Re>.5*(o.cL+o.cx)?(y.setProjection({name:"mercator"}),y.zoom=Re,this._cameraForBounds(y,n,c,d,p,m)):{center:y.center,zoom:Re,bearing:d,pitch:p}}_extendAABB(t,n,c,d){const p=.5*((c.padding.left||0)+(c.padding.right||0)),m=.5*((c.padding.top||0)+(c.padding.bottom||0)),y=m,x=p,T=p,S=m,M=n.width-(x+T),I=n.height-(y+S),C=o.at([],t.max,t.min),L=Math.min(M/C[0],I/C[1]),z=Math.min(n.scaleZoom(n.scale*L),c.maxZoom);if(isNaN(z))return null;const k=n.scale/n.zoomScale(z),B=new o.cW([t.min[0]-x*k,t.min[1]-S*k,t.min[2]],[t.max[0]+T*k,t.max[1]+y*k,t.max[2]]),V=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new o.P(c.offset.x,c.offset.y):o.P.convert(c.offset)).rotate(-o.al(d));return B.center[0]-=V.x*k,B.center[1]+=V.y*k,B}queryTerrainElevation(t,n){const c=this.transform.elevation;return c?(n=o.h({},{exaggerated:!0}
vendor: 12,347 bytes, line 2655
2655,n),c.getAtPoint(o.ac.fromLngLat(t),null,n.exaggerated)):null}_cameraForBounds(t,n,c,d,p,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,n,c,d,p,m);const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=o.cd.convert(n),S=o.cd.convert(c),M=new o.cd(T.lng,S.lat),I=new o.cd(S.lng,T.lat),C=y.project(T),L=y.project(S),z=this.queryTerrainElevation(T),k=this.queryTerrainElevation(S),B=this.queryTerrainElevation(M),V=this.queryTerrainElevation(I),H=[[C.x,C.y,Math.min(z||0,k||0,B||0,V||0)],[L.x,L.y,Math.max(z||0,k||0,B||0,V||0)]];let Y=o.cW.fromPoints(H);const te=y.getWorldToCameraMatrix(),ee=o.bi(new Float64Array(16),te);Y=o.cW.applyTransform(Y,te);const J=this._extendAABB(Y,y,x,d);if(!J)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Y=J;const K=.5*o.at([],Y.max,Y.min)[2],ie=this._minimumAABBFrustumDistance(y,Y),ne=[0,0,1,0];o.aA(ne,ne,te),o.eG(ne,ne);const fe=o.bY([],ne,ie+K),_e=o.cV([],Y.center,fe);o.ad(Y.center,Y.center,ee),o.ad(_e,_e,ee);const Me=y.unproject(new o.P(Y.center[0],Y.center[1])),Ce=o.eH(y.projection,Me),Fe=Math.pow(2,Ce),de=Math.min(y._zoomFromMercatorZ(_e[2]*y.pixelsPerMeter*Fe/y.worldSize),x.maxZoom);return y.mercatorFromTransition&&de<.5*(o.cL+o.cx)?(y.setProjection({name:"globe"}),y.zoom=de,this._cameraForBounds(y,n,c,d,p,m)):{center:Me,zoom:de,bearing:d,pitch:p}}fitBounds(t,n,c){const d=this.cameraForBounds(t,n);return this._fitInternal(d,n,c)}fitScreenCoordinates(t,n,c,d,p){const m=o.P.convert(t),y=o.P.convert(n),x=new o.P(Math.min(m.x,y.x),Math.min(m.y,y.y)),T=new o.P(Math.max(m.x,y.x),Math.max(m.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,y))return this;const S=this.transform.pointLocation3D(x),M=this.transform.pointLocation3D(T),I=this.transform.pointLocation3D(new o.P(x.x,T.y)),C=this.transform.pointLocation3D(new o.P(T.x,x.y)),L=[Math.min(S.lng,M.lng,I.lng,C.lng),Math.min(S.lat,M.lat,I.lat,C.lat)],z=[Math.max(S.lng,M.lng,I.lng,C.lng),Math.max(S.lat,M.lat,I.lat,C.lat)],k=d&&d.pitch?d.pitch:this.getPitch(),B=this._cameraForBounds(this.transform,L,z,c,k,d);return this._fitInternal(B,d,p)}_fitInternal(t,n,c){return t?(n=o.h(t,n)).linear?this.easeTo(n,c):this.flyTo(n,c):this}jumpTo(t,n){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=o.cd.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(m=!0,c.pitch=+t.pitch);const y=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(y))if(t.retainPadding===!1){const x=c.clone();x.padding=y,c.setLocationAtPoint(c.center,x.centerPoint)}else c.padding=y;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new o.A("movestart",n)).fire(new o.A("move",n)),d&&this.fire(new o.A("zoomstart",n)).fire(new o.A("zoom",n)).fire(new o.A("zoomend",n)),p&&this.fire(new o.A("rotatestart",n)).fire(new o.A("rotate",n)).fire(new o.A("rotateend",n)),m&&this.fire(new o.A("pitchstart",n)).fire(new o.A("pitch",n)).fire(new o.A("pitchend",n)),this.fire(new o.A("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||o.w(Bp),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const c=this.transform;if(!c.projection.supportsFreeCamera)return o.w(Bp),this;this.stop();const d=c.zoom,p=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,x=p!==c.pitch,T=m!==c.bearing;return this.fire(new o.A("movestart",n)).fire(new o.A("move",n)),y&&this.fire(new o.A("zoomstart",n)).fire(new o.A("zoom",n)).fire(new o.A("zoomend",n)),T&&this.fire(new o.A("rotatestart",n)).fire(new o.A("rotate",n)).fire(new o.A("rotateend",n)),x&&this.fire(new o.A("pitchstart",n)).fire(new o.A("pitch",n)).fire(new o.A("pitchend",n)),this.fire(new o.A("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),((t=o.h({offset:[0,0],duration:500,easing:o.ey},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),I=o.P.convert(t.offset);let C,L,z;if(c.projection.name==="globe"){const ne=o.ac.fromLngLat(c.center),fe=I.rotate(-c.angle);ne.x+=fe.x/c.worldSize,ne.y+=fe.y/c.worldSize;const _e=ne.toLngLat(),Me=o.cd.convert(t.center||_e);this._normalizeCenter(Me),C=c.centerPoint.add(fe),L=new o.P(ne.x,ne.y).mult(c.worldSize),z=new o.P(o.aD(Me.lng),o.aH(Me.lat)).mult(c.worldSize).sub(L)}else{C=c.centerPoint.add(I);const ne=c.pointLocation(C),fe=o.cd.convert(t.center||ne);this._normalizeCenter(fe),L=c.project(ne),z=c.project(fe).sub(L)}const k=c.zoomScale(x-d);let B,V;t.around&&(B=o.cd.convert(t.around),V=c.locationPoint(B));const H=this._zooming||x!==d,Y=this._rotating||p!==T,te=this._pitching||S!==m,ee=!c.isPaddingEqual(M),J=t.retainPadding===!1?c.clone():c,K=ne=>fe=>{if(H&&(ne.zoom=o.ai(d,x,fe)),Y&&(ne.bearing=o.ai(p,T,fe)),te&&(ne.pitch=o.ai(m,S,fe)),ee&&(J.interpolatePadding(y,M,fe),C=J.centerPoint.add(I)),B)ne.setLocationAtPoint(B,V);else{const _e=ne.zoomScale(ne.zoom-d),Me=x>d?Math.min(2,k):Math.max(.5,k),Ce=Math.pow(Me,1-fe),Fe=ne.unproject(L.add(z.mult(fe*Ce)).mult(_e));ne.setLocationAtPoint(ne.renderWorldCopies?Fe.wrap():Fe,C)}return t.preloadOnly||this._fireMoveEvents(n),ne};if(t.preloadOnly){const ne=this._emulate(K,t.duration,c);return this._preloadTiles(ne),this}const ie={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=H,this._rotating=Y,this._pitching=te,this._padding=ee,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ie),this._ease(K(c),ne=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(n,ne)},t),this}_prepareEase(t,n,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),n||c.moving||this.fire(new o.A("movestart",t)),this._zooming&&!c.zooming&&this.fire(new o.A("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new o.A("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new o.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new o.A("move",t)),this._zooming&&this.fire(new o.A("zoom",t)),this._rotating&&this.fire(new o.A("rotate",t)),this._pitching&&this.fire(new o.A("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new o.A("zoomend",t)),d&&this.fire(new o.A("rotateend",t)),p&&this.fire(new o.A("pitchend",t)),this.fire(new o.A("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const xe=o.aF(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(xe,n)}this.stop(),t=o.h({offset:[0,0],speed:1.2,curve:1.42,easing:o.ey},t);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?o.ay(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),I=c.zoomScale(x-d),C=o.P.convert(t.offset);let L=c.centerPoint.add(C);const z=c.pointLocation(L),k=o.cd.convert(t.center||z);this._normalizeCenter(k);const B=c.project(z),V=c.project(k).sub(B);let H=t.curve;const Y=Math.max(c.width,c.height),te=Y/I,ee=V.mag();if("minZoom"in t){const xe=o.ay(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),Le=Y/c.zoomScale(xe-d);H=Math.sqrt(Le/ee*2)}const J=H*H;function K(xe){const Le=(te*te-Y*Y+(xe?-1:1)*J*J*ee*ee)/(2*(xe?te:Y)*J*ee);return Math.log(Math.sqrt(Le*Le+1)-Le)}function ie(xe){return(Math.exp(xe)-Math.exp(-xe))/2}function ne(xe){return(Math.exp(xe)+Math.exp(-xe))/2}const fe=K(0);let _e=function(xe){return ne(fe)/ne(fe+H*xe)},Me=function(xe){return Y*((ne(fe)*(ie(Le=fe+H*xe)/ne(Le))-ie(fe))/J)/ee;var Le},Ce=(K(1)-fe)/H;if(Math.abs(ee)<1e-6||!isFinite(Ce)){if(Math.abs(Y-te)<1e-6)return this.easeTo(t,n);const xe=te<Y?-1:1;Ce=Math.abs(Math.log(te/Y))/H,Me=function(){return 0},_e=function(Le){return Math.exp(xe*H*Le)}}t.duration="duration"in t?+t.duration:1e3*Ce/("screenSpeed"in t?+t.screenSpeed/H:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Fe=p!==T,de=S!==m,Te=!c.isPaddingEqual(M),le=t.retainPadding===!1?c.clone():c,Re=xe=>Le=>{const qe=Le*Ce,Pe=1/_e(qe);xe.zoom=Le===1?x:d+xe.scaleZoom(Pe),Fe&&(xe.bearing=o.ai(p,T,Le)),de&&(xe.pitch=o.ai(m,S,Le)),Te&&(le.interpolatePadding(y,M,Le),L=le.centerPoint.add(C));const Ge=Le===1?k:xe.unproject(B.add(V.mult(Me(qe))).mult(Pe));return xe.setLocationAtPoint(xe.renderWorldCopies?Ge.wrap():Ge,L),xe._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),xe};if(t.preloadOnly){const xe=this._emulate(Re,t.duration,c);return this._preloadTiles(xe),this}return this._zooming=!0,this._rotating=Fe,this._pitching=de,this._padding=Te,this._prepareEase(n,!1),this._ease(Re(c),()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,n)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,n,c){c.animate===!1||c.duration===0?(t(1),n()):(this._easeStart=o.q.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((o.q.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=o.bX(t,-180,180);const c=Math.abs(t-n);return Math.abs(t-360-n)<c&&(t-=360),Math.abs(t+360-n)<c&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(n.maxBounds||n.projection.name!=="globe"&&!n.renderWorldCopies)return;const c=t.lng-n.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&o.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,n,c){const d=Math.ceil(15*n/1e3),p=[],m=t(c.clone());for(let y=0;y<=d;y++){const x=m(y/d);p.push(x.clone())}return p}_preloadTiles(t,n){}}class Wh{constructor(t={}){this.options=t,o.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const n=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=Ke("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Ke("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const d=Ke("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=Ke("div","mapboxgl-ctrl-attrib-inner",this._container),n&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),n===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
2655se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||o.e.ACCESS_TOKEN}];if(t){const c=n.reduce((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<n.length-1?"&":""}`),d),"?");t.href=`${o.e.FEEDBACK_URL}/${c}#${pu(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const n=this._map.style._mergedSourceCaches;for(const d in n){const p=n[d];if(p.used){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t.sort((d,p)=>d.length-p.length),t=t.filter((d,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class bu{constructor(){o.aV(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Ke("div","mapboxgl-ctrl");const n=Ke("a","mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://www.mapbox.com/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const n in t){const c=t[n].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<250?n.classList.add("mapboxgl-compact"):n.classList.remove("mapboxgl-compact")}}}class nc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,c=n?this._queue.concat(n):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const n=this._currentlyRunning=this._queue;this._queue=[];for(const c of n)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Ws{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const n=o.dk((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,n,c){this._start=this.getValue(n),this._end=t,this._startTime=n,this._endTime=n+c}}const wu={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class kr extends o.A{constructor(t,n,c,d){const{point:p,lngLat:m,originalEvent:y,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:y,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=n,this.interaction=c,this.feature=d}}class Ms{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}
vendor: 6,584 bytes, line 2655
2655add(t,n){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=n.filter;let d=n.type;c&&this.filters.set(t,o.b3(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const p=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,n)):p.size===0&&this.map.on(d,this.handleType),p.size===0&&this.interactionsByType.set(d,p),p.set(t,n),this.typeById.set(t,d)}get(t){const n=this.typeById.get(t);if(!n)return;const c=this.interactionsByType.get(n);return c?c.get(t):void 0}remove(t){const n=this.typeById.get(t);if(!n)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(n);c&&(c.delete(t),n==="mouseenter"||n==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(n,this.handleType))}queryTargets(t,n){const c=[];for(const[d,p]of n)p.target&&c.push({targetId:d,target:p.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const n=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());n.length&&(t.type="mouseenter",this.handleType(t,n));const c=new Map;for(const[d,{feature:p}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(p.id,p);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const n=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);n.length&&(t.type="mouseleave",this.handleType(t,n)),this.hoveredFeatures.clear()}handleType(t,n){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void o.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!n;n=n||this.queryTargets(t.point,d);let m=!1;const y=new Set;for(const x of n){for(const[T,S]of d){if(!S.target)continue;const M=x.variants?x.variants[T]:null;if(M){for(const I of M){if(Ic(I,x,y,T))continue;const C=new o.de(x,I),L=gl(I,x,T);p&&(C.state=this.map.getFeatureState(C));const z=c?this.prevHoveredFeatures.get(L):null,k=new kr(t,T,S,C),B=z?z.stop:S.handler(k);if(c&&this.hoveredFeatures.set(L,{feature:x,stop:B}),B!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,T]of d){const{handler:S,target:M}=T;if(!M&&S(new kr(t,x,T,null))!==!1)break}}}function sc(l,t){if(Array.isArray(l)&&Array.isArray(t)){const n=new Set(l),c=new Set(t);return n.size===c.size&&l.every(d=>c.has(d))}return o.bv(l,t)}const Tu={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},Np={showCompass:!0,showZoom:!0,visualizePitch:!1};class Sm{constructor(t,n,c=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new _u({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new oa({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),o.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),Rt()}move(t,n){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,n),p=d&&d.bearingDelta;if(p&&c.setBearing(c.getBearing()+p),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,n),y=m&&m.pitchDelta;y&&c.setPitch(c.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){wt(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(o.h({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),bn(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,bn(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Rn(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Rn(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Ya(l,t,n){if(l=new o.cd(l.lng,l.lat),t){const c=new o.cd(l.lng-360,l.lat),d=new o.cd(l.lng+360,l.lat),p=360*Math.ceil(Math.abs(l.lng-n.center.lng)/360),m=n.locationPoint3D(l).distSqr(t),y=t.x<0||t.y<0||t.x>n.width||t.y>n.height;n.locationPoint3D(c).distSqr(t)<m&&(y||Math.abs(c.lng-n.center.lng)<p)?l=c:n.locationPoint3D(d).distSqr(t)<m&&(y||Math.abs(d.lng-n.center.lng)<p)&&(l=d)}for(;Math.abs(l.lng-n.center.lng)>180;){const c=n.locationPoint3D(l);if(c.x>=0&&c.y>=0&&c.x<=n.width&&c.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}
2655const Xh={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},Cs={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class oc extends o.E{constructor(t,n){super(),(t instanceof HTMLElement||n)&&(t=o.h({element:t},n)),o.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:y=0,rotation:x=Cs.rotation,rotationAlignment:T=Cs.rotationAlignment,pitchAlignment:S=Cs.pitchAlignment,occludedOpacity:M=Cs.occludedOpacity,altitude:I=Cs.altitude}=t||{};this._anchor=c,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=y,this._rotation=x,this._rotationAlignment=T,this._pitchAlignment=S,this._occludedOpacity=M,this._altitude=I,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=o.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=o.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",z=>{z.preventDefault()}),this._element.addEventListener("mousedown",z=>{z.preventDefault()});const C=this._element.classList;for(const z in Xh)C.remove(`mapboxgl-marker-anchor-${z}`);C.add(`mapboxgl-marker-anchor-${this._anchor}`);const L=t&&t.className?t.className.trim().split(/\s+/):[];C.add(...L),this._popup=null}_createDefaultMarker(){const t=Ke("div"),n=xt("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=xt("radialGradient",{id:"shadowGradient"},xt("defs",{},n));xt("stop",{offset:"10%","stop-opacity":.4},c),xt("stop",{offset:"100%","stop-opacity":.05},c),xt("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n)}return xt("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},n),xt("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},n),xt("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=o.cd.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||Cs.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 7,438 bytes, lines 2655-2660
26550,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const n=t.code,c=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,c=this._element;this._popup&&(n===c||c.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,n=this._pos;if(!t||!n)return!1;const c=t.unproject(n,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const p=d.position.toLngLat();return p.distanceTo(c)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const n=this._pos;if(!n||n.x<0||n.x>t.transform.width||n.y<0||n.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(n,this._altitude);let d;t._showingGlobe()&&o.eK(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const n=this._offset.mult(this._scale);this._element.style.transform=` 2656 translate(${t.x}px,${t.y}px) 2657 ${Xh[this._anchor]} 2658 ${this._calculateXYTransform()} ${this._calculateZTransform()} 2659 translate(${n.x}px,${n.y}px) 2660 `}_calculateXYTransform(){const t=this._pos,n=this._map,c=this.getPitchAlignment();if(!n||!t||c!=="map")return"";if(!n._showingGlobe()){const x=n.getPitch();return x?`rotateX(${x}deg)`:""}const d=o.cJ(o.eL(n.transform,this._lngLat)),p=t.sub(o.eM(n.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const y=d/m;return`rotateX(${-p.y*y}deg) rotateY(${p.x*y}deg)`}_calculateZTransform(){const t=this._pos,n=this._map;if(!n||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(n._showingGlobe()){const p=n.project(new o.cd(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=n.project(new o.cd(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);c=o.cJ(Math.atan2(m.y,m.x))-90}else c=-n.getBearing();else if(d==="horizon"){const p=o.af(4,6,n.getZoom()),m=o.eM(n.transform);m.y+=p*n.transform.height;const y=t.sub(m),x=o.cJ(Math.atan2(y.y,y.x));c=(x>90?x-270:x+90)*(1-p)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const n=this._map;n&&(n.transform.renderWorldCopies&&(this._lngLat=Ya(this._lngLat,this._pos,n.transform)),this._pos=n.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),n._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=o.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const n=this._map;if(!n)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const p=this._clickTolerance||n._clickTolerance;if(t.point.dist(c)<p)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=n.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.A("dragstart"))),this.fire(new o.A("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new o.A("dragend")),this._state="inactive"}_addDragHandler(t){const n=this._map,c=this._pos;n&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",n.on("mousemove",this._onMove),n.on("touchmove",this._onMove),n.once("mouseup",this._onUp),n.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const n=this._map;return n&&(t?(n.on("mousedown",this._addDragHandler),n.on("touchstart",this._addDragHandler)):(n.off("mousedown",this._addDragHandler),n.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||Cs.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||Cs.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||Cs.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||Cs.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Yh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},ac={maxWidth:100,unit:"metric"},Ka={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},Xs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},xs=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function us(l=new o.P(0,0),t="bottom"){if(typeof l=="number"){const n=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new o.P(0,l);case"top-left":return new o.P(n,n);case"top-right":return new o.P(-n,n);case"bottom":return new o.P(0,-l);case"bottom-left":return new o.P(n,-n);case"bottom-right":return new o.P(-n,-n);case"left":return new o.P(l,0);case"right":return new o.P(-l,0)}return new o.P(0,0)}return l instanceof o.P||Array.isArray(l)?o.P.convert(l):o.P.convert(l[t]||[0,0])}return{version:Nt,supported:jt.supported,setRTLTextPlugin:o.eQ,getRTLTextPluginStatus:o.eP,Map:class extends rc{constructor(l){yt.mark(lt.create);const t=l;if((l=o.h({}
2660,Tu,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&o.eI(window)&&(l.antialias=!1,o.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new ih(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies,null,null),l),this._repaint=!!l.repaint,this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._collectResourceTiming=l.collectResourceTiming,this._language=this._parseLanguage(l.language),this._worldview=l.worldview,this._renderTaskQueue=new nc,this._domRenderTaskQueue=new nc,this._controls=[],this._markers=[],this._popups=[],this._mapId=o.a$(),this._locale=o.h({},wu,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._performanceMetricsCollection=l.performanceMetricsCollection,this._tessellationStep=l.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=l.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Ws(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new Kt(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const n=document.getElementById(l.container);if(!n)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=n}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&o.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,o.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Dh),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Zh(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||o.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),this.indoor=new Hf(this),l.hash&&(this._hash=new Oh(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const n=l.bounds;n&&(this.resize(),this.fitBounds(n,o.h({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new Wh({customAttribution:l.customAttribution}
vendor: 27,467 bytes, lines 2660-2662
2660)),this._logoControl=new bu,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new o.A(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new o.A(`${n.dataType}dataloading`,n))}),this._interactions=new Ms(this)}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new o.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(n,c.firstChild):c.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new o.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new o.A("movestart",l)).fire(new o.A("move",l)),this.fire(new o.A("resize",l)),t&&this.fire(new o.A("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(o.aG.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(t=>t==="auto"?navigator.language:t):l}setLanguage(l){const t=this._parseLanguage(l);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const n of this._controls)n._setLanguage&&n._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,t=l.projection.name;let n;t==="globe"&&l.zoom>=o.cx?(l.setMercatorFromTransition(),n=!0):t==="mercator"&&l.zoom<o.cx&&(l.setProjection({name:"globe"}),n=!0),n&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;return t=l.name==="globe"&&this.transform.zoom>=o.cx?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate(),t&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(o.cd.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(o.P.convert(l),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(l,t,n){const c=d=>{let p=[];if(Array.isArray(t)){const m=t.filter(y=>this.getLayer(y));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:m=>{const y=c(m.point);y.length?d||(d=!0,n.call(this,new nn(l,this,m.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,n.call(this,new nn(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,n.call(this,new nn(l,this,y.originalEvent)))}}}}{const d=p=>{const m=c(p.point);m.length&&(p.features=m,n.call(this,p),delete p.features)};return{listener:n,targets:t,delegates:{[l]:d}}}}on(l,t,n){if(typeof t=="function"||n===void 0)return super.on(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(l,t,n){if(typeof t=="function"||n===void 0)return super.once(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(l,t,n){if(typeof t=="function"||n===void 0)return super.off(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[l]:void 0;return c&&(d=>{for(let p=0;p<d.length;p++){const m=d[p];if(m.listener===n&&sc(m.targets,t)){for(const y in m.delegates)this.off(y,m.delegates[y]);return d.splice(p,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof o.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const p=this.style.queryRenderedFeatures(l,void 0,this.transform),m=this.style.queryRenderedFeatureset(l,void 0,this.transform);return p.concat(m)}let n=!0;if(t.target&&(n=this._isTargetValid(t.target),n&&!t.layers))return this.style.queryRenderedFeatureset(l,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const p of t.layers)if(!this._isValidId(p)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(l,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(l,t,this.transform))),n&&(d=d.concat(this.style.queryRenderedFeatureset(l,t,this.transform))),d}querySourceFeatures(l,t){return!l||typeof l=="string"&&!this._isValidId(l)?[]:this.style.querySourceFeatures(l,t)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&o.w(`${t} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(o.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=o.h({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,(n,c)=>{if(n){const d=typeof n=="string"?n:n instanceof Error?n.message:n.error;o.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const n=o.h({},t);t&&t.config&&(n.initialConfig=t.config,delete n.config),this.style=new gn(this,n).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new gn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(o.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new o.z(new Error("IDs can't be empty."))),!1):!o.d8(l)||(this.fire(new o.z(new Error(`IDs can't contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,n){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,t,{pixelRatio:n=1,sdf:c=!1,stretchX:d,stretchY:p,content:m}={}){this._lazyInitEmptyStyle();const y=o.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:T,data:S}=o.q.getImageData(t);this.style.addImage(y,{data:new o.r({width:x,height:T},S),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new o.z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:x,height:T}=t,S=t;this.style.addImage(y,{data:new o.r({width:x,height:T},new Uint8Array(S.data)),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,usvg:!1,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const n=o.I.from(l),c=this.style.getImage(n);if(!c)return void this.fire(new o.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?o.q.getImageData(t):t,{width:p,height:m,data:y}=d;if(p===void 0||m===void 0)return void this.fire(new o.z(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||m!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new o.z(new Error(`The width and height of the updated image (${p}, ${m}) 2661 must be that same as the previous version of the image 2662 (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new o.r({width:p,height:m},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,x),this.style.updateImage(n,c,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(o.I.from(l)):(this.fire(new o.z(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(o.I.from(l))}loadImage(l,t){o.o(this._requestManager.transformRequest(l,o.R.Image),(n,c)=>{t(n,c instanceof HTMLImageElement?o.q.getImageData(c):c)})}listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,t){this._lazyInitEmptyStyle(),this.style.addModel(l,t)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new o.z(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}addImport(l,t){return this.style.addImport(l,t).catch(n=>this.fire(new o.z(new Error("Failed to add import",n)))),this}updateImport(l,t){return typeof t!="string"&&t.id!==l?(this.removeImport(l),this.addImport(t)):(this.style.updateImport(l,t),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,t){return this.style.moveImport(l,t),this._update(!0)}moveLayer(l,t){return this._isValidId(l)?(this.style.moveLayer(l,t),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const t=this.style.getOwnLayer(l);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,t,n){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,n),this._update(!0)):this}setFilter(l,t,n={}){return this._isValidId(l)?(this.style.setFilter(l,t,n),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,n,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,n,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,n){return this.style.setConfigProperty(l,t,n),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const t=l[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,t),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthographicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(o.cd.convert(l),this.transform):0}setFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,t),this._update())}removeFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,t),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let n,c,d,p=this._container;for(;p&&(!c||!d);){const m=window.getComputedStyle(p).transform;m&&m!=="none"&&(n=m.match(/matrix.*\((.+)\)/)[1].split(", "),n[0]&&n[0]!=="0"&&n[0]!=="1"&&(c=n[0]),n[3]&&n[3]!=="0"&&n[3]!=="1"&&(d=n[3])),p=p.parentElement}this._containerWidth=c?Math.abs(l/c):l,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&o.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=Ke("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Ke("div","mapboxgl-canvas-container",l);this._canvas=Ke("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const n=this._controlContainer=Ke("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=Ke("div",`mapboxgl-ctrl-${d}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const n=o.q.devicePixelRatio||1;this._canvas.width=n*Math.ceil(l),this._canvas.height=n*Math.ceil(t),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const t=this._markers.indexOf(l);t!==-1&&this._markers.splice(t,1)}_addPopup(l){this._popups.push(l)}_removePopup(l){const t=this._popups.indexOf(l);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const l=o.h({},jt.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(ps(t,!0),this.painter=new $a(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",n=>{n.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),o.l.testSupport(t)):this.fire(new o.z(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.A("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new o.A("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new o.A("renderstart")),++this._frameId;const n=this.painter.context.extTimerQuery,c=o.q.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(n.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,S=this.transform.pitch,M=o.q.now(),I=new o.aa(T,{now:M,fadeDuration:p,pitch:S,transition:this.style.transition,worldview:this._worldview});this.style.update(I)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),m=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):m=this._updateAverageElevation(c);const y=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),y&&(this._placementDirty=y.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:p,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new o.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,yt.mark(lt.load),this.fire(new o.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const T=o.q.now()-c;d.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{const S=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new o.A("gpu-timing-frame",{cpuTime:T,gpuTime:S}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const S=this.painter.queryGpuTimers(T);this.fire(new o.A("gpu-timing-layer",{layerTimes:S}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const S=this.painter.queryGpuTimeDeferredRender(T);this.fire(new o.A("gpu-timing-deferred-render",{gpuTime:S}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(x||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new o.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new o.A("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,yt.mark(lt.fullLoad),this._performanceMetricsCollection&&rs(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}
2662_forceMarkerAndPopupUpdate(l){for(const t of this._markers)l&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!l||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(l,t=!1){const n=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&n(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const d=this.transform.averageElevation;let p=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=l;const m=Math.abs(d-p);if(m>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(p),n(p);this._averageElevation.easeTo(p,l,300)}else if(m>1e-4)return this._averageElevation.jumpTo(p),n(p)}return!!this._averageElevation.isEasing(l)&&n(this._averageElevation.getValue(l))}_authenticate(){da(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===vi||l.status===401)){const t=this.painter.context.gl;ps(t,!1),this._logoControl instanceof bu&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new o.z(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),to(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Br(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const n=this.painter.context.gl,c=n.createFramebuffer();function d(p){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,p,0);const m=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,m),m}return n.bindFramebuffer(n.FRAMEBUFFER,c),this._canvasPixelComparison(d(l),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(l,t,n){let c=n[1]-n[0];const d=l.length/4;for(let p=0;p<t.length;p++){const m=t[p];let y=0;for(let x=0;x<m.length;x+=4)m[x]===l[x]&&m[x+1]===l[x+1]&&m[x+2]===l[x+2]&&m[x+3]===l[x+3]&&(y+=1);c+=(n[p+2]-n[p+1])*(1-y/d)}return c}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),Ds.delete(this.painter.context.gl),dr.remove(),Ts.remove(),this._removed=!0,this.fire(new o.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=o.q.frame(t=>{const n=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,n&&this._render(t)}))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return o.bt(t,(n,c)=>n._preloadTiles(l,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this._tp.refreshUI(),l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,this._tp.refreshUI(),l&&this._update())}_setCacheLimits(l,t){o.eJ(l,t)}get version(){return Nt}},NavigationControl:class{constructor(l={}){this.options=o.h({},Np,l),this._container=Ke("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(o.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),Ke("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),Ke("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(o.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const n=this._map;n&&(this.options.visualizePitch?n.resetNorthPitch({},{originalEvent:t}):n.resetNorth({},{originalEvent:t}))}),this._compassIcon=Ke("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;
vendor: 4,341 bytes, line 2662
2662const t=l.getZoom(),n=t===l.getMaxZoom(),c=t===l.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Sm(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,t){const n=Ke("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){if(!this._map)return;const n=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",n),l.firstElementChild&&l.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends o.E{constructor(l={}){super();const t=navigator.geolocation;this.options=o.h({geolocation:t},Yh,l),o.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=To(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=Ke("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(l){const t=(n=!!this.options.geolocation)=>{this._supportsGeolocation=n,l(n)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(n=>t(n.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.coords;return!!t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new o.A("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2662RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.A("geolocate",l)),this._finish()}}_updateCamera(l){const t=new o.cd(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,c=this._map.getBearing(),d=o.h({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new o.cd(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=o.c6(1,l._center.lat)*l.worldSize,n=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.A("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Ke("button","mapboxgl-ctrl-geolocate",this._container),Ke("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2662se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Ke("div","mapboxgl-user-location"),this._dotElement.appendChild(Ke("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Ke("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new oc({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Ke("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new oc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new o.A("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new o.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const l=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2662se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Wh,ScaleControl:class{constructor(l={}){this.options=o.h({},ac,l),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),o.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,n=t._containerHeight/2,c=t._containerWidth/2-l/2,d=t.unproject([c,n]),p=t.unproject([c+l,n]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const y=3.2808*m;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,m/1852,"nautical-mile"):m>=1e3?this._setScale(l,m/1e3,"kilometer"):this._setScale(l,m,"meter")}_setScale(l,t,n){this._map._requestDomTask(()=>{const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(y),m*y}(t),d=c/t;this._container.innerHTML=this._isNumberFormatSupported&&n!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(c):`${c} ${Ka[n]}`,this._container.style.width=l*d+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=Ke("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:o.w("Full screen control 'container' must be a DOM element.")),o.aV(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=Ke("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=Ke("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Ke("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends o.E{constructor(l){super(),this.options=o.h(Object.create(Xs),l),this._altitude=this.options.altitude,o.aV(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new o.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new o.A("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=o.cd.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let c;for(n.innerHTML=l;c=n.firstChild,c;
vendor: 4,313 bytes, line 2662
2662)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=Ke("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const n=this._closeButton=Ke("button","mapboxgl-popup-close-button",t);n.type="button",n.setAttribute("aria-label","Close popup"),n.innerHTML='<span aria-hidden="true">×</span>',n.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let t;return this._classList.delete(l)?t=!1:(this._classList.add(l),t=!0),this._updateClassList(),t}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const t=this._map,n=this._container,c=this._pos;if(!t||!n||!c)return"bottom";const d=n.offsetWidth,p=n.offsetHeight,m=c.x<d/2,y=c.x>t.transform.width-d/2;if(c.y+l<p)return m?"top-left":y?"top-right":"top";if(c.y>t.transform.height-p){if(m)return"bottom-left";if(y)return"bottom-right"}return m?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,n=this._content;if(!t||!this._lngLat&&!this._trackPointer||!n)return;let c=this._container;if(c||(c=this._container=Ke("div","mapboxgl-popup",t.getContainer()),this._tip=Ke("div","mapboxgl-popup-tip",c),c.appendChild(n)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ya(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof o.P?l:t.project(this._lngLat,this._altitude),p=us(this.options.offset),m=this._anchor=this._getAnchor(p.y),y=us(this.options.offset,m),x=d.add(y).round();t._requestDomTask(()=>{this._container&&m&&(this._container.style.transform=`${Xh[m]} translate(${x.x}px,${x.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=o.eK(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(xs);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:oc,Style:gn,LngLat:o.cd,LngLatBounds:o.aG,Point:o.P,MercatorCoordinate:o.ac,FreeCameraOptions:Gd,Evented:o.E,config:o.e,prewarm:o.eO,clearPrewarmedResources:o.eN,get accessToken(){return o.e.ACCESS_TOKEN},set accessToken(l){o.e.ACCESS_TOKEN=l},get baseApiUrl(){return o.e.API_URL},set baseApiUrl(l){o.e.API_URL=l},get workerCount(){return o.eX.workerCount},set workerCount(l){o.eX.workerCount=l},get maxParallelImageRequests(){return o.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){o.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){o.eW(l)},get workerUrl(){return o.eV.workerUrl},set workerUrl(l){o.eV.workerUrl=l},get workerClass(){return o.eV.workerClass},set workerClass(l){o.eV.workerClass=l},get workerParams(){return o.eV.workerParams},set workerParams(l){o.eV.workerParams=l},get dracoUrl(){return o.eU()},set dracoUrl(l){o.eT(l)},get meshoptUrl(){return o.eS()},set meshoptUrl(l){o.eR(l)},setNow:o.q.setNow,restoreNow:o.q.restoreNow}});var Tt=xi;return Tt})})(Uv);var T2=Uv.exports;const vc=uw(T2),S2=zi=>es(ts.get(`https://api.chambas.ai/api/vacancy/density-map/${zi}`)),E2={class:"p-4 rounded-2xl flex flex-col border bg-white border-blue-gray-100 shadow-md hover:border-blue-gray-300 hover:shadow-lg cursor-pointer transition duration-200 mb-4"},I2={class:"text-blue-gray-500 text-xs mb-4"},A2=On({__name:"DensityMap",props:{vacancy:{}}
2662,setup(zi){const Et=pi(null),Bt="pk.eyJ1IjoiYW9nYXJjaWFnIiwiYSI6ImNtOGtmaXM5dDBxaGoycnB4ZGRuMTZybHEifQ.VUz3ZCyfDGUHMsbnRvFV0Q";let Ye=null;const xi=pi(!1),Lt=zi,Tt=async()=>{var Pt;if(!((Pt=Lt.vacancy)!=null&&Pt.id)){console.error("No hay ID de vacante disponible");return}const[lt,yt]=await S2(Lt.vacancy.id);if(lt){console.error("Error al obtener el mapa",lt);return}Et.value=yt.data,xi.value&&Et.value&&Nt(Et.value)},o=()=>{var yt;if(!Ye||!Lt.vacancy||!Lt.vacancy.latitude||!Lt.vacancy.longitude)return;const lt=document.createElement("div");lt.className="vacancy-marker",lt.style.width="20px",lt.style.height="20px",lt.style.borderRadius="50%",lt.style.backgroundColor="#8b5cf6",lt.style.border="3px solid #FFFFFF",lt.style.boxShadow="0 0 10px rgba(0, 0, 0, 0.3)",new vc.Marker(lt).setLngLat([Lt.vacancy.longitude,Lt.vacancy.latitude]).setPopup(new vc.Popup({offset:25}).setHTML(` 2663 <div class="font-medium p-2"> 2664 <div class="text-gray-900 text-base font-bold">${Lt.vacancy.name||((yt=Lt.vacancy.job_position)==null?void 0:yt.name)||"Vacante"}</div> 2665 <div class="text-gray-700 text-sm">${Lt.vacancy.formatted_address||""}</div> 2666 </div> 2667 `)).addTo(Ye)};dw(()=>{Ye&&(Ye.remove(),Ye=null)}),ha(async()=>{try{await Tt(),vc.accessToken=Bt,Ye=new vc.Map({container:"map",style:"mapbox://styles/mapbox/streets-v12",center:[-99.1332,19.4326],zoom:5,preserveDrawingBuffer:!0}),Ye.addControl(new vc.NavigationControl,"top-right"),Ye.on("load",()=>{xi.value=!0,Ye&&(Ye.getLayer("road-primary")&&Ye.setPaintProperty("road-primary","line-color","#cccccc"),Ye.getLayer("road-secondary")&&Ye.setPaintProperty("road-secondary","line-color","#dddddd"),Ye.getLayer("road-street")&&Ye.setPaintProperty("road-street","line-color","#e0e0e0"),Ye.getLayer("place-label")&&(Ye.setPaintProperty("place-label","text-color","#888888"),Ye.setPaintProperty("place-label","text-halo-color","#ffffff")),o()),Et.value&&Nt(Et.value)}),Ye.on("error",()=>{console.error("Error al cargar el mapa")})}catch{console.error("Error al inicializar el mapa")}});const Nt=lt=>{if(!(!Ye||!xi.value))try{if(!lt.features||lt.features.length===0)return;Ye.getLayer("customer-polygons")&&Ye.removeLayer("customer-polygons"),Ye.getLayer("customer-polygon-outline")&&Ye.removeLayer("customer-polygon-outline"),Ye.getLayer("customer-labels")&&Ye.removeLayer("customer-labels"),Ye.getSource("customers")&&Ye.removeSource("customers"),Ye.addSource("customers",{type:"geojson",data:lt}),Ye.addLayer({id:"customer-polygons",type:"fill",source:"customers",paint:{"fill-color":["get","color"],"fill-opacity":.7}}),Ye.addLayer({id:"customer-polygon-outline",type:"line",source:"customers",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#ffffff","line-width":1.5}}),Ye.addLayer({id:"customer-labels",type:"symbol",source:"customers",layout:{"text-field":["format",["concat",["to-string",["get","count"]]]],"text-size":12,"text-font":["Open Sans Bold","Arial Unicode MS Bold"],"text-offset":[0,0],"text-anchor":"center","text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#FFF","text-halo-color":"#000","text-halo-width":1}}),Ye.on("mouseenter","customer-polygons",()=>{Ye&&(Ye.getCanvas().style.cursor="pointer")}),Ye.on("mouseleave","customer-polygons",()=>{Ye&&(Ye.getCanvas().style.cursor="")}),Ye.on("click","customer-polygons",jt=>{if(!Ye)return;const Ke=jt.features;if(!(Ke!=null&&Ke.length))return;const xt=Ke[0],Ze=jt.lngLat,{municipality:It,count:kt}=xt.properties||{};!It||kt===void 0||new vc.Popup().setLngLat(Ze).setHTML(` 2668 <div class="font-medium p-1"> 2669 <div class="text-gray-900 text-base">${It}: ${kt}</div> 2670 </div> 2671 `).addTo(Ye)});const yt=new vc.LngLatBounds;let Pt=!1;const Zt=[[-99.35,19.15],[-98.95,19.6]];if(lt.features.filter(jt=>{var Ze,It;if(!((It=(Ze=jt.geometry.coordinates)==null?void 0:Ze[0])!=null&&It[0]))return!1;const[Ke,xt]=jt.geometry.coordinates[0][0];return Ke>=Zt[0][0]&&Ke<=Zt[1][0]&&xt>=Zt[0][1]&&xt<=Zt[1][1]}).length>5){Ye.flyTo({center:[-99.1332,19.4326],zoom:10,essential:!0});return}
2671lt.features.forEach(jt=>{jt.geometry.coordinates&&jt.geometry.coordinates.length>0&&jt.geometry.coordinates[0].forEach(Ke=>{Array.isArray(Ke)&&Ke.length>=2&&(yt.extend([Ke[0],Ke[1]]),Pt=!0)})}),Pt&&!yt.isEmpty()?Ye.fitBounds(yt,{padding:30,maxZoom:10,minZoom:5,essential:!0}):Ye.flyTo({center:[-99.1332,19.4326],zoom:10,essential:!0})}catch{console.error("Error al mostrar los datos en el mapa")}};return(lt,yt)=>(ei(),Ii("div",E2,[yt[0]||(yt[0]=me("h3",{class:"text-xl font-bold"}," Mapa de densidad ",-1)),me("p",I2,Ct(lt.vacancy.name)+" - "+Ct(lt.vacancy.formatted_address),1),yt[1]||(yt[1]=me("div",{class:"w-full h-[450px] rounded-lg overflow-hidden border border-gray-200"},[me("div",{id:"map",class:"w-full h-full"})],-1))]))}}),M2={class:"mt-8"},C2={class:"mt-6"},P2={key:1,class:"mb-4"},R2={class:"flex items-center justify-between p-4 rounded-lg border border-blue-gray-200"},z2={class:"flex flex-col gap-1"},D2={class:"text-xs text-blue-gray-500"},L2={class:"text-xs text-blue-gray-500"},k2={class:"text-xs text-blue-gray-500"},F2={class:"text-xs text-blue-gray-500"},O2={class:"text-xs text-blue-gray-500"},B2={class:"text-xs text-blue-gray-500"},N2=On({__name:"DensityMap",setup(zi){const Et=pi(null),Bt=pi(null),Ye=()=>{var Lt;(Lt=Et.value)==null||Lt.openModal()},xi=Lt=>{Bt.value=Lt};return(Lt,Tt)=>{var o,Nt,lt,yt,Pt;return ei(),Ii("div",M2,[Yt(At(Lr),{onClick:Tt[0]||(Tt[0]=()=>Lt.$emit("back")),class:"py-2 px-8",variant:"outline"},{default:Xt(()=>Tt[1]||(Tt[1]=[wi(" Regresar ")])),_:1,__:[1]}),me("div",C2,[Bt.value?Gr("",!0):(ei(),vn(At(Lr),{key:0,onClick:Ye,class:"py-2 px-8 mb-4"},{default:Xt(()=>Tt[2]||(Tt[2]=[wi(" Seleccionar vacante ")])),_:1,__:[2]})),Bt.value?(ei(),Ii("div",P2,[me("div",R2,[me("div",z2,[me("p",D2,[Tt[3]||(Tt[3]=me("strong",null,"Nombre:",-1)),wi(" "+Ct(Bt.value.name||((o=Bt.value.job_position)==null?void 0:o.name)),1)]),me("p",L2,[Tt[4]||(Tt[4]=me("strong",null,"Id:",-1)),wi(" "+Ct(Bt.value.id),1)]),me("p",k2,[Tt[5]||(Tt[5]=me("strong",null,"Puesto y empresa:",-1)),wi(" "+Ct((Nt=Bt.value.job_position)==null?void 0:Nt.name)+" - "+Ct((lt=Bt.value.company)==null?void 0:lt.name),1)]),me("p",F2,[Tt[6]||(Tt[6]=me("strong",null,"Ubicación:",-1)),wi(" "+Ct(Bt.value.formatted_address),1)]),me("p",O2,[Tt[7]||(Tt[7]=me("strong",null,"Agente:",-1)),wi(" "+Ct((yt=Bt.value.assigned_to)==null?void 0:yt.name)+" - "+Ct((Pt=Bt.value.assigned_to)==null?void 0:Pt.email),1)]),me("p",B2,[Tt[8]||(Tt[8]=me("strong",null,"Estatus:",-1)),wi(" "+Ct(Bt.value.status),1)])]),Yt(At(Lr),{onClick:Ye,variant:"outline",class:"py-1 px-4 text-sm"},{default:Xt(()=>Tt[9]||(Tt[9]=[wi(" Cambiar vacante ")])),_:1,__:[9]})])])):Gr("",!0),Bt.value?(ei(),vn(A2,{vacancy:Bt.value,key:Bt.value.id},null,8,["vacancy"])):Gr("",!0)]),Yt(w2,{ref_key:"vacancyModalRef",ref:Et,onVacancySelected:xi},null,512)])}}}),V2={class:"p-6"},U2={key:2,class:"grid grid-cols-4 gap-4 mt-8"},j2={class:"bg-white p-4 border border-blue-gray-100 rounded-2xl"},G2={class:"bg-white p-4 border border-blue-gray-100 rounded-2xl"},$2={class:"bg-white p-4 border border-blue-gray-100 rounded-2xl"},q2=On({__name:"Preview",setup(zi){const Et=pi();return(Bt,Ye)=>(ei(),Ii("div",V2,[Et.value==="outbound"?(ei(),vn(r2,{key:0,onBack:Ye[0]||(Ye[0]=()=>Et.value=void 0)})):Gr("",!0),Et.value==="density-map"?(ei(),vn(N2,{key:1,onBack:Ye[1]||(Ye[1]=()=>Et.value=void 0)})):(ei(),Ii("div",U2,[me("div",j2,[Ye[6]||(Ye[6]=me("h1",{class:"font-semibold"},"Nuevos modelos",-1)),Yt(At(Lr),{class:"mt-4 py-2 w-full",onClick:Ye[2]||(Ye[2]=()=>Bt.$router.push({name:"chat-new-model"}))},{default:Xt(()=>Ye[5]||(Ye[5]=[wi(" Ir a la sección ")])),_:1,__:[5]})]),me("div",G2,[Ye[8]||(Ye[8]=me("h1",{class:"font-semibold"},"Mensaje outbound",-1)),Yt(At(Lr),{class:"mt-4 py-2 w-full",onClick:Ye[3]||(Ye[3]=()=>Et.value="outbound")},{default:Xt(()=>Ye[7]||(Ye[7]=[wi(" Ir a la sección ")])),_:1,__:[7]})]),me("div",$2,[Ye[10]||(Ye[10]=me("h1",{class:"font-semibold"},"Mapa de densidad",-1)),Yt(At(Lr),{class:"mt-4 py-2 w-full",onClick:Ye[4]||(Ye[4]=()=>Et.value="density-map")},{default:Xt(()=>Ye[9]||(Ye[9]=[wi(" Ir a la sección ")])),_:1,__:[9]})])]))]))}});class Gu{static allOperations(){return es(ts.get("https://api.chambas.ai/api/vacancy-payment/all-operations"))}static extendDays(Et,Bt){return es(ts.put(`https://api.chambas.ai/api/vacancy-payment/${Et}/extend`,Bt))}static changePlanType(Et,Bt){return es(ts.put(`https://api.chambas.ai/api/vacancy-payment/${Et}/change-plan-operations`,Bt))}static expirePlan(Et,Bt){return es(ts.put(`https://api.chambas.ai/api/vacancy-payment/${Et}/expire`,{notes:Bt}))}static getVacanciesWithoutPayment(){return es(ts.get("https://api.chambas.ai/api/vacancy-payment/vacancies-without-payment"))}static migrateVacancy(Et){return es(ts.post("https://api.chambas.ai/api/vacancy-payment/migrate-vacancy",Et))}}const Vf=()=>{const zi=pi([]),Et=pi(!1),Bt=pi(null);return{operations:zi,loading:Et,error:Bt,fetchAllOperations:async()=>{Et.value=!0,Bt.value=null;const[o,Nt]=await Gu.allOperations();return o?(Bt.value=o.message||"Error al cargar las operaciones",Et.value=!1,[o]):(zi.value=(Nt==null?void 0:Nt.data)||[],Et.value=!1,[void 0,Nt==null?void 0:Nt.data])},extendDays:async(o,Nt)=>{const[lt,yt]=await Gu.extendDays(o,Nt);return lt?[lt]:[void 0,yt==null?void 0:yt.data]},changePlanType:async(o,Nt)=>{const[lt,yt]=await Gu.changePlanType(o,Nt);return lt?[lt]:[void 0,yt==null?void 0:yt.data]},expirePlan:async(o,Nt)=>{const[lt,yt]=await Gu.expirePlan(o,Nt);return lt?[lt]:[void 0,yt==null?void 0:yt.data]}}}
2671,H2=Bd({extension_days:mw().min(1,"El número de dÃas debe ser mayor a 0").required("El número de dÃas es requerido").typeError("Ingresa un número válido"),operations_notes:wc()}),Z2={key:0,class:"mb-4 p-3 bg-gray-50 rounded-lg"},W2={class:"text-sm text-gray-600"},X2={class:"text-sm text-gray-600"},Y2={key:0,class:"text-sm text-gray-600"},K2={class:"mt-4 w-full"},J2={class:"mt-4 w-full"},Q2={class:"flex gap-3 mt-6"},eS=On({__name:"ExtendVacancyPaymentModal",props:{operation:{}},emits:["success","close"],setup(zi,{expose:Et,emit:Bt}){const Ye=zi,xi=Bt,Lt=hl(),{extendDays:Tt}=Vf(),{values:o,errors:Nt,meta:lt,resetForm:yt,defineField:Pt}=Nd({validationSchema:H2,initialValues:{extension_days:void 0,operations_notes:""}}),[Zt,li]=Pt("extension_days"),[jt,Ke]=Pt("operations_notes"),xt=pi(null),Ze=kt=>{xt.value&&(xt.value.open=kt),kt||xi("close")};Fd(()=>Ye.operation,kt=>{kt&&(yt(),Ze(!0))});const It=async()=>{if(!Ye.operation)return;if(!lt.value.valid){Dr("Por favor corrige los errores en el formulario",{type:"error"});return}Lt.loading(!0);const[kt]=await Tt(Ye.operation.id,{extension_days:Number(o.extension_days),operations_notes:o.operations_notes||""});if(Lt.loading(!1),kt){Dr("Hubo un error al extender el plan, intenta más tarde",{type:"error"});return}Dr("Plan extendido exitosamente",{type:"success"}),Ze(!1),xi("success")};return Et({toggleModal:Ze}),(kt,Rt)=>(ei(),vn(qu,{ref_key:"modalRef",ref:xt},{default:Xt(()=>[me("div",null,[Rt[7]||(Rt[7]=me("p",{class:"mb-4 text-xl font-bold"},"Extender dÃas del plan",-1)),kt.operation?(ei(),Ii("div",Z2,[me("p",W2,[Rt[2]||(Rt[2]=me("strong",null,"Usuario:",-1)),wi(" "+Ct(kt.operation.user.name)+" ("+Ct(kt.operation.user.email)+") ",1)]),me("p",X2,[Rt[3]||(Rt[3]=me("strong",null,"Plan:",-1)),wi(" "+Ct(kt.operation.plan_type===At(cl).BASIC_VACANCY?"Básico":"Con búsqueda"),1)]),kt.operation.expires_at?(ei(),Ii("p",Y2,[Rt[4]||(Rt[4]=me("strong",null,"Expira:",-1)),wi(" "+Ct(At(eo)(kt.operation.expires_at).format("DD-MM-YYYY HH:mm a")),1)])):Gr("",!0)])):Gr("",!0),me("div",K2,[Yt(ua,$u({id:"extension-days",label:"DÃas de extensión",modelValue:At(Zt),"onUpdate:modelValue":Rt[0]||(Rt[0]=wt=>ul(Zt)?Zt.value=wt:null)},At(li),{type:"number",placeholder:"Número de dÃas",min:"1",error:At(Nt).extension_days}),null,16,["modelValue","error"])]),me("div",J2,[Yt(Nf,$u({id:"operations-notes",label:"Notas de operación (opcional)",modelValue:At(jt),"onUpdate:modelValue":Rt[1]||(Rt[1]=wt=>ul(jt)?jt.value=wt:null)},At(Ke),{rows:4,placeholder:"Ej: Extensión acordada con el cliente debido a...",error:At(Nt).operations_notes}),null,16,["modelValue","error"])]),me("div",Q2,[Yt(Lr,{"on-click":It,disabled:!At(lt).valid,class:"px-8 py-3"},{default:Xt(()=>Rt[5]||(Rt[5]=[wi(" Extender plan ")])),_:1,__:[5]},8,["disabled"]),Yt(Lr,{"on-click":()=>Ze(!1),class:"px-8 py-3",variant:"outline"},{default:Xt(()=>Rt[6]||(Rt[6]=[wi(" Cancelar ")])),_:1,__:[6]},8,["on-click"])])])]),_:1},512))}}),tS=Bd({plan_type:wc().required("El tipo de plan es requerido"),operations_notes:wc()}),iS={key:0,class:"mb-4 p-3 bg-gray-50 rounded-lg"},rS={class:"text-sm text-gray-600"},nS={class:"text-sm text-gray-600"},sS={class:"mt-4 w-full"},oS=["value"],aS=["value"],lS={class:"mt-4 w-full"},cS={class:"flex gap-3 mt-6"},uS=On({__name:"ChangePlanTypeModal",props:{operation:{}},emits:["success","close"],setup(zi,{expose:Et,emit:Bt}){const Ye=zi,xi=Bt,Lt=hl(),{changePlanType:Tt}=Vf(),{values:o,errors:Nt,meta:lt,resetForm:yt,defineField:Pt}=Nd({validationSchema:tS,initialValues:{plan_type:"",operations_notes:""}}),[Zt,li]=Pt("plan_type"),[jt,Ke]=Pt("operations_notes"),xt=pi(null),Ze=kt=>{xt.value&&(xt.value.open=kt),kt||xi("close")};Fd(()=>Ye.operation,kt=>{kt&&(yt({values:{plan_type:kt.plan_type,operations_notes:""}}),Ze(!0))});const It=async()=>{if(!Ye.operation)return;if(!lt.value.valid){Dr("Por favor corrige los errores en el formulario",{type:"error"});return}Lt.loading(!0);const[kt]=await Tt(Ye.operation.id,{new_plan_type:o.plan_type,operations_notes:o.operations_notes||""});if(Lt.loading(!1),kt){Dr("Hubo un error al cambiar el tipo de plan, intenta más tarde",{type:"error"});return}Dr("Tipo de plan actualizado exitosamente",{type:"success"}),Ze(!1),xi("success")};return Et({toggleModal:Ze}),(kt,Rt)=>(ei(),vn(qu,{ref_key:"modalRef",ref:xt},{default:Xt(()=>[me("div",null,[Rt[7]||(Rt[7]=me("p",{class:"mb-4 text-xl font-bold"},"Cambiar tipo de plan",-1)),kt.operation?(ei(),Ii("div",iS,[me("p",rS,[Rt[2]||(Rt[2]=me("strong",null,"Usuario:",-1)),wi(" "+Ct(kt.operation.user.n
2671ame)+" ("+Ct(kt.operation.user.email)+") ",1)]),me("p",nS,[Rt[3]||(Rt[3]=me("strong",null,"Plan actual:",-1)),wi(" "+Ct(kt.operation.plan_type===At(cl).BASIC_VACANCY?"Básico":"Con búsqueda"),1)])])):Gr("",!0),me("div",sS,[Yt(bc,$u({id:"plan-type",label:"Tipo de plan",modelValue:At(Zt),"onUpdate:modelValue":Rt[0]||(Rt[0]=wt=>ul(Zt)?Zt.value=wt:null)},At(li),{error:At(Nt).plan_type}),{default:Xt(()=>[Rt[4]||(Rt[4]=me("option",{value:"",disabled:""},"Selecciona un tipo de plan",-1)),me("option",{value:At(cl).BASIC_VACANCY},"Básico",8,oS),me("option",{value:At(cl).VACANCY_WITH_SEARCH},"Con búsqueda",8,aS)]),_:1,__:[4]},16,["modelValue","error"])]),me("div",lS,[Yt(Nf,$u({id:"operations-notes",label:"Notas de operación (opcional)",modelValue:At(jt),"onUpdate:modelValue":Rt[1]||(Rt[1]=wt=>ul(jt)?jt.value=wt:null)},At(Ke),{rows:4,placeholder:"Ej: Cambio de plan solicitado por el cliente...",error:At(Nt).operations_notes}),null,16,["modelValue","error"])]),me("div",cS,[Yt(Lr,{"on-click":It,disabled:!At(lt).valid,class:"px-8 py-3"},{default:Xt(()=>Rt[5]||(Rt[5]=[wi(" Cambiar plan ")])),_:1,__:[5]},8,["disabled"]),Yt(Lr,{"on-click":()=>Ze(!1),class:"px-8 py-3",variant:"outline"},{default:Xt(()=>Rt[6]||(Rt[6]=[wi(" Cancelar ")])),_:1,__:[6]},8,["on-click"])])])]),_:1},512))}}),hS=Bd({notes:wc().required("Las notas son requeridas").min(10,"Las notas deben tener al menos 10 caracteres")}),dS={class:"flex items-center gap-2 mb-4"},pS={key:0,class:"mb-4 p-4 bg-red-50 border border-red-200 rounded-lg"},fS={key:1,class:"mb-4 p-3 bg-gray-50 rounded-lg"},mS={class:"text-sm text-gray-600"},_S={key:0,class:"text-sm text-gray-600"},gS={class:"text-sm text-gray-600"},yS={class:"mt-4 w-full"},xS={key:0,class:"text-xs text-gray-500 -mt-3 ml-4"},vS={class:"flex gap-3 mt-6"},bS=On({__name:"ExpirePlanModal",props:{operation:{}},emits:["success","close"],setup(zi,{expose:Et,emit:Bt}){const Ye=zi,xi=Bt,Lt=hl(),{expirePlan:Tt}=Vf(),{values:o,errors:Nt,meta:lt,resetForm:yt,defineField:Pt}=Nd({validationSchema:hS,initialValues:{notes:""}}),[Zt,li]=Pt("notes"),jt=pi(null),Ke=Ze=>{jt.value&&(jt.value.open=Ze),Ze||xi("close")};Fd(()=>Ye.operation,Ze=>{Ze&&(yt({values:{notes:""}}),Ke(!0))});const xt=async()=>{if(!Ye.operation)return;if(!lt.value.valid){Dr("Por favor corrige los errores en el formulario",{type:"error"});return}Lt.loading(!0);const[Ze]=await Tt(Ye.operation.id,o.notes||"");if(Lt.loading(!1),Ze){Dr("Hubo un error al expirar el plan, intenta más tarde",{type:"error"});return}Dr("Plan expirado exitosamente",{type:"success"}),Ke(!1),xi("success")};return Et({toggleModal:Ke}),(Ze,It)=>(ei(),vn(qu,{ref_key:"modalRef",ref:jt},{default:Xt(()=>[me("div",null,[me("div",dS,[Yt(At(gw),{size:24,class:"text-red-600",weight:"fill"}),It[1]||(It[1]=me("p",{class:"text-xl font-bold text-red-600"},"Expirar plan",-1))]),Ze.operation?(ei(),Ii("div",pS,It[2]||(It[2]=[me("p",{class:"text-sm text-red-800 font-semibold mb-2"}," â ï¸ Esta acción expirará el plan inmediatamente ",-1),me("p",{class:"text-sm text-red-700 mb-2"}," ⢠La vacante será cerrada y el usuario no podrá editarla ",-1),me("p",{class:"text-sm text-red-700 mb-2"}," ⢠El usuario no podrá hacer uso de la vacante ",-1)]))):Gr("",!0),Ze.operation?(ei(),Ii("div",fS,[me("p",mS,[It[3]||(It[3]=me("strong",null,"Usuario:",-1)),wi(" "+Ct(Ze.operation.user.name)+" ("+Ct(Ze.operation.user.email)+") ",1)]),Ze.operation.vacancy?(ei(),Ii("p",_S,[It[4]||(It[4]=me("strong",null,"Vacante:",-1)),wi(" "+Ct(Ze.operation.vacancy.name)+" - "+Ct(Ze.operation.vacancy.job_position.name),1)])):Gr("",!0),me("p",gS,[It[5]||(It[5]=me("strong",null,"Estado actual:",-1)),me("span",{class:pn({"text-green-600":Ze.operation.status==="active","text-blue-600":Ze.operation.status==="paid","text-amber-600":Ze.operation.status==="pending","text-red-600":Ze.operation.status==="expired"})},Ct(Ze.operation.status==="active"?"Activo":Ze.operation.status==="paid"?"Pagado":Ze.operation.status==="pending"?"Pendiente":"Expirado"),3)])])):Gr("",!0),me("div",yS,[Yt(Nf,$u({id:"expire-notes",label:"Notas de operación *",modelValue:At(Zt),"onUpdate:modelValue":It[0]||(It[0]=kt=>ul(Zt)?Zt.value=kt:null)},At(li),{rows:4,placeholder:"Ej: Plan expirado por solicitud del cliente, falta de pago, etc...",error:At(Nt).notes}),null,16,["modelValue","error"]),At(Nt).notes?Gr("",!0):(ei(),Ii("p",xS," Es obligatorio agregar una nota explicando el motivo de la expiración "))]),me("div",vS,[Yt(Lr,{"on-click":xt,disabled:!At(lt).valid,class:"px-8 py-3 bg-red-600 hover:bg-red-700"},{default:Xt(()=>It[6]||(It[6]=[wi(" Expirar plan ")])),_:1,__:[6]},8,["disabled"]),Yt(Lr,{"on-click":()=>Ke(!1),class:"px-8 py-3",variant:"outline"},{default:Xt(()=>It[7]||(It[7]=[wi(" Cancelar ")])),_:1,__:[7]},8,["on-click"])])])]),_:1},512))}}),wS={class:"px-6 mb-4 flex items-center justify-between"},TS={class:"flex flex-col md:flex-row gap-4 mb-4"},SS={class:"flex-1 flex items-center justify-end gap-3"},ES=["value"],IS=["value"],AS=["onClick"],MS={key:1,class:"text-gray-600"},CS=["onClick"],PS={key:1,class:"text-gray-600"}
2671,RS={key:2,class:"font-semibold"},zS={key:0},DS={key:1,class:"text-gray-400 italic"},LS={class:"text-sm"},kS={key:1,class:"text-gray-400 text-sm"},FS=On({__name:"PaymentOperationsTab",setup(zi){const{operations:Et,loading:Bt,fetchAllOperations:Ye}=Vf(),xi=pi(null),Lt=pi(null),Tt=pi(null),o=pi(""),Nt=pi(""),lt=pi(""),yt=pi(""),Pt=Of(()=>o.value!==""||Nt.value!==""||lt.value!==""||yt.value!==""),Zt=()=>{o.value="",Nt.value="",lt.value="",yt.value=""},li=Of(()=>{let kt=[...Et.value];if(o.value){const Rt=o.value.toLowerCase();kt=kt.filter(wt=>{var Or,ln,bn,Rn,zs,ci,Vt,vi,Kt,ki,Ji,Xr;return((ln=(Or=wt.user)==null?void 0:Or.email)==null?void 0:ln.toLowerCase().includes(Rt))||((Rn=(bn=wt.user)==null?void 0:bn.name)==null?void 0:Rn.toLowerCase().includes(Rt))||((ci=(zs=wt.vacancy)==null?void 0:zs.name)==null?void 0:ci.toLowerCase().includes(Rt))||((Kt=(vi=(Vt=wt.vacancy)==null?void 0:Vt.company)==null?void 0:vi.name)==null?void 0:Kt.toLowerCase().includes(Rt))||((Xr=(Ji=(ki=wt.vacancy)==null?void 0:ki.job_position)==null?void 0:Ji.name)==null?void 0:Xr.toLowerCase().includes(Rt))})}if(Nt.value&&(kt=kt.filter(Rt=>Rt.plan_type===Nt.value)),lt.value){const Rt=parseInt(lt.value),wt=eo(),Or=eo().add(Rt,"days");kt=kt.filter(ln=>{if(!ln.expires_at)return!1;const bn=eo(ln.expires_at);return bn.isAfter(wt)&&bn.isBefore(Or)})}if(yt.value){const Rt=parseInt(yt.value),wt=eo().subtract(Rt,"days");kt=kt.filter(Or=>Or.paid_at?eo(Or.paid_at).isAfter(wt):!1)}return kt}),jt=kt=>{kt.payment_method!=="manual"&&kt.payment_method!=="stripe_legacy"||(xi.value=kt)},Ke=kt=>{kt.payment_method!=="manual"&&kt.payment_method!=="stripe_legacy"||(Lt.value=kt)},xt=kt=>{Tt.value=kt},Ze=async()=>{xi.value=null,Lt.value=null,Tt.value=null,await Ye()},It=pi([{field:"user.email",title:"Email"},{field:"plan_type",title:"Tipo de plan",minWidth:"11em"},{field:"status",title:"Estado",minWidth:"15em"},{field:"payment_method",title:"Método de pago",minWidth:"11em"},{field:"vacancy.name",title:"Vacante",minWidth:"20em"},{field:"vacancy.status",title:"Estado de vacante"},{field:"paid_at",title:"Fecha de pago",minWidth:"15em"},{field:"activated_at",title:"Fecha de activación",minWidth:"15em"},{field:"expires_at",title:"Fecha de expiración",minWidth:"15em"},{field:"operations_notes",title:"Notas"},{field:"actions",title:"Acciones",minWidth:"10em"}]);return ha(()=>{Ye()}),(kt,Rt)=>(ei(),Ii("div",null,[me("div",wS,[me("div",TS,[Yt(At(Tc),{modelValue:o.value,"onUpdate:modelValue":Rt[0]||(Rt[0]=wt=>o.value=wt),placeholder:"Buscar por email, vacante, empresa...",class:"flex-1 min-w-[380px]"},null,8,["modelValue"])]),me("div",SS,[Yt(At(bc),{id:"plan-type-filter",modelValue:Nt.value,"onUpdate:modelValue":Rt[1]||(Rt[1]=wt=>Nt.value=wt),"show-error":!1,class:"w-full md:w-auto min-w-[220px]"},{default:Xt(()=>[Rt[7]||(Rt[7]=me("option",{value:""},"Todos los planes",-1)),me("option",{value:At(cl).BASIC_VACANCY},"Básico",8,ES),me("option",{value:At(cl).VACANCY_WITH_SEARCH},"Con búsqueda",8,IS)]),_:1,__:[7]},8,["modelValue"]),Yt(At(bc),{id:"expires-filter",modelValue:lt.value,"onUpdate:modelValue":Rt[2]||(Rt[2]=wt=>lt.value=wt),"show-error":!1,class:"w-full md:w-auto min-w-[220px]"},{default:Xt(()=>Rt[8]||(Rt[8]=[me("option",{value:""},"Próximos a expirar",-1),me("option",{value:"3"},"Próximos 3 dÃas",-1),me("option",{value:"7"},"Próximos 7 dÃas",-1),me("option",{value:"15"},"Próximos 15 dÃas",-1)])),_:1,__:[8]},8,["modelValue"]),Yt(At(bc),{id:"paid-filter",modelValue:yt.value,"onUpdate:modelValue":Rt[3]||(Rt[3]=wt=>yt.value=wt),"show-error":!1,class:"w-full md:w-auto min-w-[220px]"},{default:Xt(()=>Rt[9]||(Rt[9]=[me("option",{value:""},"Ãltimos pagados",-1),me("option",{value:"7"},"Ãltimos 7 dÃas",-1),me("option",{value:"15"},"Ãltimos 15 dÃas",-1),me("option",{value:"30"},"Ãltimos 30 dÃas",-1)])),_:1,__:[9]},8,["modelValue"]),Pt.value?(ei(),vn(At(Lr),{key:0,onClick:Zt,variant:"outline",class:"px-4 py-2"},{default:Xt(()=>Rt[10]||(Rt[10]=[wi(" Limpiar filtros ")])),_:1,__:[10]})):Gr("",!0)])]),Yt(At(Od),{rowClass:"global-table-row",skin:"table-global-gray",rows:li.value,columns:It.value,loading:At(Bt),pageSize:100,sortable:!0,paginationInfo:"Mostrando {0} a {1} de {2} registros"},{amount:Xt(wt=>[me("span",null,"$"+Ct(At(_w)(wt.value.amount).format("0,0.00"))+" "+Ct(wt.value.currency),1)]),plan_type:Xt(wt=>[wt.value.payment_method==="manual"||wt.value.payment_method==="str
2671ipe_legacy"?(ei(),Ii("button",{key:0,onClick:()=>Ke(wt.value),class:"text-secondary-green underline cursor-pointer font-medium"},Ct(wt.value.plan_type===At(cl).BASIC_VACANCY?"Básico":"Con búsqueda"),9,AS)):(ei(),Ii("span",MS,Ct(wt.value.plan_type===At(cl).BASIC_VACANCY?"Básico":"Con búsqueda"),1))]),status:Xt(wt=>[me("span",{class:pn(["rounded-full px-2 py-0.5 text-xs font-medium",[wt.value.status==="active"?"bg-green-100 border border-green-300 text-green-800":wt.value.status==="paid"?"bg-blue-100 border border-blue-300 text-blue-800":wt.value.status==="pending"?"bg-amber-100 border border-amber-300 text-amber-800":"bg-red-100 border border-red-300 text-red-800"]])},Ct(wt.value.status==="paid"?"Pagado sin vacante":wt.value.status==="active"?"Activo con vacante":wt.value.status==="pending"?"Esperando pago":"Expirado"),3)]),"vacancy.status":Xt(wt=>{var Or,ln;return[me("span",{class:pn(["rounded-full px-2 py-0.5 text-xs font-medium",((Or=wt.value.vacancy)==null?void 0:Or.status)==="enable"?"bg-green-100 border border-green-300 text-green-800":"bg-red-100 border border-red-300 text-red-800"])},Ct(((ln=wt.value.vacancy)==null?void 0:ln.status)==="enable"?"Activa":"Inactiva"),3)]}),paid_at:Xt(wt=>[me("span",null,Ct(wt.value.paid_at?At(eo)(wt.value.paid_at).format("DD-MM-YYYY HH:mm a"):"-"),1)]),activated_at:Xt(wt=>[me("p",{class:pn({"font-semibold":!wt.value.activated_at})},Ct(wt.value.activated_at?At(eo)(wt.value.activated_at).format("DD-MM-YYYY HH:mm a"):"-"),3)]),expires_at:Xt(wt=>[wt.value.expires_at&&(wt.value.payment_method==="manual"||wt.value.payment_method==="str
2671ipe_legacy")?(ei(),Ii("button",{key:0,onClick:()=>jt(wt.value),class:"text-secondary-green underline cursor-pointer font-medium"},Ct(At(eo)(wt.value.expires_at).format("DD-MM-YYYY HH:mm a")),9,CS)):wt.value.expires_at?(ei(),Ii("span",PS,Ct(At(eo)(wt.value.expires_at).format("DD-MM-YYYY HH:mm a")),1)):(ei(),Ii("span",RS,"-"))]),"vacancy.name":Xt(wt=>{var Or;return[wt.value.vacancy?(ei(),Ii("span",zS,Ct(wt.value.vacancy.name)+" - "+Ct(wt.value.vacancy.job_position.name)+" - "+Ct((Or=wt.value.vacancy.company)==null?void 0:Or.name),1)):(ei(),Ii("span",DS,"-"))]}),operations_notes:Xt(wt=>[me("span",LS,Ct(wt.value.operations_notes||"-"),1)]),payment_method:Xt(wt=>[me("span",{class:pn(["rounded-full px-2 py-0.5 text-sm font-medium",[wt.value.payment_method==="manual"?"bg-purple-100 border border-purple-300 text-purple-800":wt.value.payment_method==="stripe_legacy"?"bg-orange-100 border border-orange-300 text-orange-800":"bg-blue-100 border border-blue-300 text-blue-800"]])},Ct(wt.value.payment_method==="manual"?"Manual":wt.value.payment_method==="str
2671ipe_legacy"?"Stripe Legacy":"Stripe"),3)]),actions:Xt(wt=>[["manual","stripe_legacy"].includes(wt.value.payment_method)?(ei(),vn(At(Lr),{key:0,variant:"outline",onClick:()=>xt(wt.value),class:"px-3 flex items-center gap-2"},{default:Xt(()=>[Yt(At(yw),{size:16,weight:"bold"}),Rt[11]||(Rt[11]=wi(" Expirar "))]),_:2,__:[11]},1032,["onClick"])):(ei(),Ii("span",kS,"-"))]),_:1},8,["rows","columns","loading"]),Yt(eS,{operation:xi.value,onSuccess:Ze,onClose:Rt[4]||(Rt[4]=()=>xi.value=null)},null,8,["operation"]),Yt(uS,{operation:Lt.value,onSuccess:Ze,onClose:Rt[5]||(Rt[5]=()=>Lt.value=null)},null,8,["operation"]),Yt(bS,{operation:Tt.value,onSuccess:Ze,onClose:Rt[6]||(Rt[6]=()=>Tt.value=null)},null,8,["operation"])]))}}),OS=Bd({notes:wc().required("Las notas son requeridas").min(10,"Las notas deben tener al menos 10 caracteres")}),BS={class:"flex items-center gap-2 mb-4"},NS={key:0,class:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg"},VS={key:1,class:"mb-4 p-3 bg-gray-50 rounded-lg"},US={class:"text-sm text-gray-600"},jS={class:"text-sm text-gray-600"},GS={class:"text-sm text-gray-600"},$S={class:"mt-4 w-full"},qS={key:0,class:"text-xs text-gray-500 -mt-3 ml-4"},HS={class:"flex gap-3 mt-6"},ZS=On({__name:"MigrateVacancyModal",props:{vacancy:{}},emits:["success","close"],setup(zi,{expose:Et,emit:Bt}){const Ye=zi,xi=Bt,Lt=hl(),{values:Tt,errors:o,meta:Nt,resetForm:lt,defineField:yt}=Nd({validationSchema:OS,initialValues:{notes:""}}),[Pt,Zt]=yt("notes"),li=pi(null),jt=xt=>{li.value&&(li.value.open=xt),xt||xi("close")};Fd(()=>Ye.vacancy,xt=>{xt&&(lt({values:{notes:""}}),jt(!0))});const Ke=async()=>{if(!Ye.vacancy)return;if(!Nt.value.valid){Dr("Por favor corrige los errores en el formulario",{type:"error"});return}Lt.loading(!0);const[xt]=await Gu.migrateVacancy({vacancy_id:Ye.vacancy.id,notes:Tt.notes||""});if(Lt.loading(!1),xt){Dr("Hubo un error al migrar la vacante, intenta más tarde",{type:"error"});return}Dr("Vacante migrada exitosamente",{type:"success"}),jt(!1),xi("success")};return Et({toggleModal:jt}),(xt,Ze)=>(ei(),vn(qu,{ref_key:"modalRef",ref:li},{default:Xt(()=>[me("div",null,[me("div",BS,[Yt(At(Vv),{size:24,weight:"bold"}),Ze[1]||(Ze[1]=me("p",{class:"text-xl font-bold"},"Migrar vacante",-1))]),xt.vacancy?(ei(),Ii("div",NS,Ze[2]||(Ze[2]=[me("p",{class:"text-sm text-blue-700 font-semibold mb-2"}," â¹ï¸ Esta acción creará una operación de pago activa para esta vacante ",-1),me("p",{class:"text-sm text-blue-700 mb-2"}," ⢠Se creará un VacancyPayment con estado ACTIVE ",-1),me("p",{class:"text-sm text-blue-700 mb-2"}," ⢠La vacante quedará asociada a esta operación ",-1)]))):Gr("",!0),xt.vacancy?(ei(),Ii("div",VS,[me("p",US,[Ze[3]||(Ze[3]=me("strong",null,"Usuario:",-1)),wi(" "+Ct(xt.vacancy.user.name)+" ("+Ct(xt.vacancy.user.email)+") ",1)]),me("p",jS,[Ze[4]||(Ze[4]=me("strong",null,"Vacante:",-1)),wi(" "+Ct(xt.vacancy.name)+" - "+Ct(xt.vacancy.job_position.name),1)]),me("p",GS,[Ze[5]||(Ze[5]=me("strong",null,"Empresa:",-1)),wi(" "+Ct(xt.vacancy.company.name),1)])])):Gr("",!0),me("div",$S,[Yt(Nf,$u({id:"migrate-notes",label:"Notas de operación *",modelValue:At(Pt),"onUpdate:modelValue":Ze[0]||(Ze[0]=It=>ul(Pt)?Pt.value=It:null)},At(Zt),{rows:4,placeholder:"Ej: Vacante del evento - Usuario no pagó, Migración por cortesÃa, etc...",error:At(o).notes}),null,16,["modelValue","error"]),At(o).notes?Gr("",!0):(ei(),Ii("p",qS," Es obligatorio agregar una nota explicando el motivo de la migración "))]),me("div",HS,[Yt(Lr,{"on-click":Ke,disabled:!At(Nt).valid,class:"px-8 py-3"},{default:Xt(()=>Ze[6]||(Ze[6]=[wi(" Migrar vacante ")])),_:1,__:[6]},8,["disabled"]),Yt(Lr,{"on-click":()=>jt(!1),class:"px-8 py-3",variant:"outline"},{default:Xt(()=>Ze[7]||(Ze[7]=[wi(" Cancelar ")])),_:1,__:[7]},8,["on-click"])])])]),_:1},512))}}),WS={class:"ml-6 flex mb-4"},XS=On({__name:"VacanciesWithoutPaymentTab",setup(zi){const Et=pi([]),Bt=pi(!1),Ye=pi(null),xi=pi(""),Lt=pi(null),Tt=Of(()=>{if(!xi.value)return Et.value;const Pt=xi.value.toLowerCase();return Et.value.filter(Zt=>{var li,jt,Ke,xt,Ze;return Zt.user.email.toLowerCase().includes(Pt)||Zt.user.name.toLowerCase().includes(Pt)||((li=Zt.name)==null?void 0:li.toLowerCase().includes(Pt))||((Ke=(jt=Zt.company)==null?void 0:jt.name)==null?void 0:Ke.toLowerCase().includes(Pt))||((Ze=(xt=Zt.
2671job_position)==null?void 0:xt.name)==null?void 0:Ze.toLowerCase().includes(Pt))})}),o=async()=>{Bt.value=!0,Ye.value=null;const[Pt,Zt]=await Gu.getVacanciesWithoutPayment();if(Pt){Ye.value=Pt.message||"Error al cargar las vacantes",Dr("Error al cargar las vacantes sin pago",{type:"error"}),Bt.value=!1;return}Et.value=(Zt==null?void 0:Zt.data)||[],Bt.value=!1},Nt=Pt=>{Lt.value=Pt},lt=async()=>{Lt.value=null,await o()},yt=pi([{field:"user.email",title:"Email"},{field:"user.name",title:"Usuario"},{field:"name",title:"Vacante"},{field:"job_position.name",title:"Puesto"},{field:"company.name",title:"Empresa"},{field:"status",title:"Estado"},{field:"created_at",title:"Fecha de creación"},{field:"actions",title:"Acciones",minWidth:"18em"}]);return ha(()=>{o()}),(Pt,Zt)=>(ei(),Ii("div",null,[me("div",WS,[Yt(At(Tc),{modelValue:xi.value,"onUpdate:modelValue":Zt[0]||(Zt[0]=li=>xi.value=li),placeholder:"Buscar por email, vacante, empresa...",class:"w-[380px]"},null,8,["modelValue"])]),Yt(At(Od),{rowClass:"global-table-row",skin:"table-global-gray",rows:Tt.value,columns:yt.value,loading:Bt.value,pageSize:100,sortable:!0,sortColumn:"created_at",sortDirection:"desc",paginationInfo:"Mostrando {0} a {1} de {2} registros"},{status:Xt(li=>[me("span",{class:pn(["rounded-full px-2 py-0.5 text-xs",[li.value.status==="enable"?"bg-green-100 border border-green-300 text-green-800":"bg-red-100 border border-red-300 text-red-800"]])},Ct(li.value.status==="enable"?"Activa":"Inactiva"),3)]),created_at:Xt(li=>[me("span",null,Ct(At(eo)(li.value.created_at).format("DD-MM-YYYY HH:mm a")),1)]),actions:Xt(li=>[Yt(Lr,{variant:"outline",onClick:()=>Nt(li.value),class:"px-2 py-0.5 flex items-center gap-2"},{default:Xt(()=>[Yt(At(Vv),{size:16,weight:"bold"}),Zt[2]||(Zt[2]=wi(" Migrar vacante "))]),_:2,__:[2]},1032,["onClick"])]),_:1},8,["rows","columns","loading"]),Yt(ZS,{vacancy:Lt.value,onSuccess:lt,onClose:Zt[1]||(Zt[1]=()=>Lt.value=null)},null,8,["vacancy"])]))}}),YS={class:"px-6 my-6"},KS={class:"border-b border-gray-200"},JS={class:"-mb-px flex space-x-8"},QS=On({__name:"Billing",setup(zi){const Et=pi("operations");return(Bt,Ye)=>(ei(),Ii("div",null,[me("div",YS,[me("div",KS,[me("nav",JS,[me("button",{onClick:Ye[0]||(Ye[0]=xi=>Et.value="operations"),class:pn([Et.value==="operations"?"border-secondary-green text-secondary-green":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300","whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"])}," Operaciones de pago ",2),me("button",{onClick:Ye[1]||(Ye[1]=xi=>Et.value="without-payment"),class:pn([Et.value==="without-payment"?"border-secondary-green text-secondary-green":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300","whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"])}," Vacantes sin operación de pago ",2)])])]),Et.value==="operations"?(ei(),vn(FS,{key:0})):Et.value==="without-payment"?(ei(),vn(XS,{key:1})):Gr("",!0)]))}}),eE={class:"rounded-2xl border bg-white border-blue-gray-100 shadow-md"},tE={class:"text-sm font-medium text-center text-slate-500 border-b border-slate-200 dark:text-slate-400 dark:border-slate-700 px-6 pt-3"},iE={class:"flex flex-wrap -mb-px"},rE=["onClick"];var Gv=(zi=>(zi.PREVIEW="Herramientas",zi.BILLING="Gestión de Pagos",zi.CANDIDATES="Candidatos",zi.POSITIONS="Puestos",zi.USERS="Usuarios",zi))(Gv||{});const SE=On({__name:"Main",setup(zi){const Et=pw(),Bt=Bv(),Ye=pi();ha(()=>{Ye.value=Et.query.tab||"Herramientas"});const xi=Lt=>{Ye.value=Lt,Bt.replace({query:{tab:Lt}})};return(Lt,Tt)=>(ei(),Ii("div",eE,[me("div",tE,[me("ul",iE,[(ei(),Ii(Ld,null,Bf(Gv,o=>me("li",{class:"me-2",key:o},[me("a",{href:"#",class:pn(["inline-block p-4 border-b-2 rounded-t-lg",[Ye.value===o?"text-slate-900 border-slate-900 dark:text-slate-900 dark:border-slate-900 active":"border-transparent hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300 "]]),onClick:kd(Nt=>xi(o),["prevent"])},Ct(o),11,rE)])),64))])]),Ye.value==="Herramientas"?(ei(),vn(q2,{key:0,class:"p-6"})):Ye.value==="Gestión de Pagos"?(ei(),vn(QS,{key:1})):Ye.value==="Candidatos"?(ei(),vn(Bw,{key:2})):Ye.value==="Puestos"?(ei(),vn(Xw,{key:3})):Ye.value==="Usuarios"?(ei(),vn(pT,{key:4})):Gr("",!0)]))}});
2671export{SE as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.