import{a6 as Ht,aa as mo,p as PR,d as LR,Y as wR,t as FR,Q as BR,o as DR,b as UR}from"./index-bVOhw2NF.js";import{e as Bn,E as lp}from"./index-Cy9UOSCT.js";import{f as E,_ as kR,d as ly,e as cy,c as $R,b as zR,a as VR,g as bl}from"./defineProperty-DTM21if9.js";import{c as HR}from"./cloneDeep-C6NKQlMO.js";import"./typeof-QjJsDpFa.js";import"./_initCloneObject-K-Y0ueWp.js";import"./_getTag-BJ2nhJXz.js";var fy={},hy={},Jv=e=>hy[e],Tn=(e,t)=>{hy[e]=t},jR=e=>fy[e],ja=(e,t)=>{fy[e]=t},e0={},yh={},Th=34,Ss=10,Ah=13;function dy(e){return new Function("d","return {"+e.map(function(t,r){return JSON.stringify(t)+": d["+r+'] || ""'}).join(",")+"}")}function XR(e,t){var r=dy(e);return function(n,i){return t(r(n),i,e)}}function t0(e){var t=Object.create(null),r=[];return e.forEach(function(n){for(var i in n)i in t||r.push(t[i]=i)}),r}function un(e,t){var r=e+"",n=r.length;return n9999?"+"+un(e,6):un(e,4)}function GR(e){var t=e.getUTCHours(),r=e.getUTCMinutes(),n=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":WR(e.getUTCFullYear())+"-"+un(e.getUTCMonth()+1,2)+"-"+un(e.getUTCDate(),2)+(i?"T"+un(t,2)+":"+un(r,2)+":"+un(n,2)+"."+un(i,3)+"Z":n?"T"+un(t,2)+":"+un(r,2)+":"+un(n,2)+"Z":r||t?"T"+un(t,2)+":"+un(r,2)+"Z":"")}function YR(e){var t=new RegExp('["'+e+` \r]`),r=e.charCodeAt(0);function n(c,h){var d,p,v=i(c,function(g,y){if(d)return d(g,y-1);p=g,d=h?XR(g,h):dy(g)});return v.columns=p||[],v}function i(c,h){var d=[],p=c.length,v=0,g=0,y,S=p<=0,R=!1;c.charCodeAt(p-1)===Ss&&--p,c.charCodeAt(p-1)===Ah&&--p;function x(){if(S)return yh;if(R)return R=!1,e0;var $,F=v,Y;if(c.charCodeAt(F)===Th){for(;v++=p?S=!0:(Y=c.charCodeAt(v++))===Ss?R=!0:Y===Ah&&(R=!0,c.charCodeAt(v)===Ss&&++v),c.slice(F+1,$-1).replace(/""/g,'"')}for(;vt in e?t2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fp=(e,t)=>{for(var r in t||(t={}))i2.call(t,r)&&i0(e,r,t[r]);if(n0)for(var r of n0(t))o2.call(t,r)&&i0(e,r,t[r]);return e},hp=(e,t)=>r2(e,n2(t)),dp=e=>Gl.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))],a2=class extends Error{constructor(e,t,r,n){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=n}};function gy(e,t){const r=new XMLHttpRequest,n=Array.isArray(e.url)?e.url[0]:e.url;r.open(e.method||"GET",n,!0),e.type==="arrayBuffer"&&(r.responseType="arraybuffer");for(const i in e.headers)e.headers.hasOwnProperty(i)&&r.setRequestHeader(i,e.headers[i]);return e.type==="json"&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials=e.credentials==="include",r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||r.status===0)&&r.response!==null){let i=r.response;if(e.type==="json")try{i=JSON.parse(r.response)}catch(o){return t(o)}t(null,i,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"),r)}else{const i=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});t(new a2(r.status,r.statusText,n.toString(),i))}},r.cancel=r.abort,r.send(e.body),r}function s2(e){return new Promise((t,r)=>{gy(e,(n,i,o,a,s)=>{n?r({err:n,data:null,xhr:s}):t({err:null,data:i,cacheControl:o,expires:a,xhr:s})})})}function pp(e,t){return gy(e,t)}var u2=(e,t)=>(dp(e.url)||pp)(hp(fp({},e),{type:"json"}),t),_p=(e,t)=>(dp(e.url)||pp)(hp(fp({},e),{type:"arrayBuffer"}),t),l2=(e,t)=>pp(hp(fp({},e),{method:"GET"}),t),o0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Ey(e,t){const r=new window.Image,n=window.URL||window.webkitURL;r.crossOrigin="anonymous",r.onload=()=>{t(null,r),n.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=o0})},r.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const i=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?n.createObjectURL(i):o0}function yy(e,t){const r=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(r).then(n=>{t(null,n)}).catch(n=>{t(new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}var sd=(e,t,r)=>{const n=(i,o)=>{if(i)t(i);else if(o){const a=typeof createImageBitmap=="function",s=r?r(o):o;a?yy(s,t):Ey(s,t)}};return e.type==="json"?u2(e,n):_p(e,n)},c2=(e,t)=>{typeof createImageBitmap=="function"?yy(e,t):Ey(e,t)};function vp(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Ty(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Iu(){}var fu=.7,ac=1/fu,Sa="\\s*([+-]?\\d+)\\s*",hu="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",oi="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",f2=/^#([0-9a-f]{3,8})$/,h2=new RegExp("^rgb\\("+[Sa,Sa,Sa]+"\\)$"),d2=new RegExp("^rgb\\("+[oi,oi,oi]+"\\)$"),p2=new RegExp("^rgba\\("+[Sa,Sa,Sa,hu]+"\\)$"),_2=new RegExp("^rgba\\("+[oi,oi,oi,hu]+"\\)$"),v2=new RegExp("^hsl\\("+[hu,oi,oi]+"\\)$"),m2=new RegExp("^hsla\\("+[hu,oi,oi,hu]+"\\)$"),a0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vp(Iu,Pa,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:s0,formatHex:s0,formatHsl:g2,formatRgb:u0,toString:u0});function s0(){return this.rgb().formatHex()}function g2(){return Ay(this).formatHsl()}function u0(){return this.rgb().formatRgb()}function Pa(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=f2.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?l0(t):r===3?new En(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Rl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Rl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=h2.exec(e))?new En(t[1],t[2],t[3],1):(t=d2.exec(e))?new En(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=p2.exec(e))?Rl(t[1],t[2],t[3],t[4]):(t=_2.exec(e))?Rl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=v2.exec(e))?h0(t[1],t[2]/100,t[3]/100,1):(t=m2.exec(e))?h0(t[1],t[2]/100,t[3]/100,t[4]):a0.hasOwnProperty(e)?l0(a0[e]):e==="transparent"?new En(NaN,NaN,NaN,0):null}function l0(e){return new En(e>>16&255,e>>8&255,e&255,1)}function Rl(e,t,r,n){return n<=0&&(e=t=r=NaN),new En(e,t,r,n)}function E2(e){return e instanceof Iu||(e=Pa(e)),e?(e=e.rgb(),new En(e.r,e.g,e.b,e.opacity)):new En}function sc(e,t,r,n){return arguments.length===1?E2(e):new En(e,t,r,n??1)}function En(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}vp(En,sc,Ty(Iu,{brighter:function(e){return e=e==null?ac:Math.pow(ac,e),new En(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=e==null?fu:Math.pow(fu,e),new En(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:c0,formatHex:c0,formatRgb:f0,toString:f0}));function c0(){return"#"+Sh(this.r)+Sh(this.g)+Sh(this.b)}function f0(){var e=this.opacity;return e=isNaN(e)?1:Math.max(0,Math.min(1,e)),(e===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(e===1?")":", "+e+")")}function Sh(e){return e=Math.max(0,Math.min(255,Math.round(e)||0)),(e<16?"0":"")+e.toString(16)}function h0(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new ii(e,t,r,n)}function Ay(e){if(e instanceof ii)return new ii(e.h,e.s,e.l,e.opacity);if(e instanceof Iu||(e=Pa(e)),!e)return new ii;if(e instanceof ii)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,u=(o+i)/2;return s?(t===o?a=(r-n)/s+(r0&&u<1?0:a,new ii(a,s,u,e.opacity)}function y2(e,t,r,n){return arguments.length===1?Ay(e):new ii(e,t,r,n??1)}function ii(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}vp(ii,y2,Ty(Iu,{brighter:function(e){return e=e==null?ac:Math.pow(ac,e),new ii(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=e==null?fu:Math.pow(fu,e),new ii(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new En(xh(e>=240?e-240:e+120,i,n),xh(e,i,n),xh(e<120?e+240:e-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return e=isNaN(e)?1:Math.max(0,Math.min(1,e)),(e===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(e===1?")":", "+e+")")}}));function xh(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}function Zt(e){const t=Pa(e),r=[0,0,0,0];return t!=null&&(r[0]=t.r/255,r[1]=t.g/255,r[2]=t.b/255,r[3]=t.opacity),r}function yo(e){const t=e&&e[0],r=e&&e[1],n=e&&e[2];return t+r*256+n*65536-1}function La(e){return[e+1&255,e+1>>8&255,e+1>>8>>8&255]}function T2(e){let t=window.document.createElement("canvas"),r=t.getContext("2d");t.width=256,t.height=1;let n=null;const i=r.createLinearGradient(0,0,256,1),o=e.positions[0],a=e.positions[e.positions.length-1];for(let s=0;s{const a=Zt(e.colors[o]);n.data[i*4+0]=a[0]*255,n.data[i*4+1]=a[1]*255,n.data[i*4+2]=a[2]*255,n.data[i*4+3]=a[3]*255}),t=null,r=null,n}function x2(e){let t=window.document.createElement("canvas"),r=t.getContext("2d");r.globalAlpha=1,t.width=256,t.height=1;const n=256/e.colors.length;for(let a=0;a=t?e:t)),e}var C2=R2,O2=/\s/;function I2(e){for(var t=e.length;t--&&O2.test(e.charAt(t)););return t}var M2=I2,N2=M2,P2=/^\s+/;function L2(e){return e&&e.slice(0,N2(e)+1).replace(P2,"")}var w2=L2;function F2(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Dn=F2;const B2=Ht(Dn);var D2=typeof mo=="object"&&mo&&mo.Object===Object&&mo,Sy=D2,U2=Sy,k2=typeof self=="object"&&self&&self.Object===Object&&self,$2=U2||k2||Function("return this")(),Kn=$2,z2=Kn,V2=z2.Symbol,Mu=V2,d0=Mu,xy=Object.prototype,H2=xy.hasOwnProperty,j2=xy.toString,xs=d0?d0.toStringTag:void 0;function X2(e){var t=H2.call(e,xs),r=e[xs];try{e[xs]=void 0;var n=!0}catch{}var i=j2.call(e);return n&&(t?e[xs]=r:delete e[xs]),i}var W2=X2,G2=Object.prototype,Y2=G2.toString;function Z2(e){return Y2.call(e)}var q2=Z2,p0=Mu,K2=W2,Q2=q2,J2="[object Null]",e3="[object Undefined]",_0=p0?p0.toStringTag:void 0;function t3(e){return e==null?e===void 0?e3:J2:_0&&_0 in Object(e)?K2(e):Q2(e)}var yi=t3;function r3(e){return e!=null&&typeof e=="object"}var Un=r3,n3=yi,i3=Un,o3="[object Symbol]";function a3(e){return typeof e=="symbol"||i3(e)&&n3(e)==o3}var Yc=a3,s3=w2,v0=Dn,u3=Yc,m0=NaN,l3=/^[-+]0x[0-9a-f]+$/i,c3=/^0b[01]+$/i,f3=/^0o[0-7]+$/i,h3=parseInt;function d3(e){if(typeof e=="number")return e;if(u3(e))return m0;if(v0(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=v0(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=s3(e);var r=c3.test(e);return r||f3.test(e)?h3(e.slice(2),r?2:8):l3.test(e)?m0:+e}var by=d3,p3=C2,bh=by;function _3(e,t,r){return r===void 0&&(r=t,t=void 0),r!==void 0&&(r=bh(r),r=r===r?r:0),t!==void 0&&(t=bh(t),t=t===t?t:0),p3(bh(e),t,r)}var v3=_3;const m3=Ht(v3);function g3(){this.__data__=[],this.size=0}var E3=g3;function y3(e,t){return e===t||e!==e&&t!==t}var Nu=y3,T3=Nu;function A3(e,t){for(var r=e.length;r--;)if(T3(e[r][0],t))return r;return-1}var Zc=A3,S3=Zc,x3=Array.prototype,b3=x3.splice;function R3(e){var t=this.__data__,r=S3(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():b3.call(t,r,1),--this.size,!0}var C3=R3,O3=Zc;function I3(e){var t=this.__data__,r=O3(t,e);return r<0?void 0:t[r][1]}var M3=I3,N3=Zc;function P3(e){return N3(this.__data__,e)>-1}var L3=P3,w3=Zc;function F3(e,t){var r=this.__data__,n=w3(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var B3=F3,D3=E3,U3=C3,k3=M3,$3=L3,z3=B3;function Xa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=yI}var Py=TI,AI=yi,SI=Py,xI=Un,bI="[object Arguments]",RI="[object Array]",CI="[object Boolean]",OI="[object Date]",II="[object Error]",MI="[object Function]",NI="[object Map]",PI="[object Number]",LI="[object Object]",wI="[object RegExp]",FI="[object Set]",BI="[object String]",DI="[object WeakMap]",UI="[object ArrayBuffer]",kI="[object DataView]",$I="[object Float32Array]",zI="[object Float64Array]",VI="[object Int8Array]",HI="[object Int16Array]",jI="[object Int32Array]",XI="[object Uint8Array]",WI="[object Uint8ClampedArray]",GI="[object Uint16Array]",YI="[object Uint32Array]",rr={};rr[$I]=rr[zI]=rr[VI]=rr[HI]=rr[jI]=rr[XI]=rr[WI]=rr[GI]=rr[YI]=!0;rr[bI]=rr[RI]=rr[UI]=rr[CI]=rr[kI]=rr[OI]=rr[II]=rr[MI]=rr[NI]=rr[PI]=rr[LI]=rr[wI]=rr[FI]=rr[BI]=rr[DI]=!1;function ZI(e){return xI(e)&&SI(e.length)&&!!rr[AI(e)]}var qI=ZI;function KI(e){return function(t){return e(t)}}var tf=KI,lc={exports:{}};lc.exports;(function(e,t){var r=Sy,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===n,a=o&&r.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}}();e.exports=s})(lc,lc.exports);var Sp=lc.exports,QI=qI,JI=tf,S0=Sp,x0=S0&&S0.isTypedArray,eM=x0?JI(x0):QI,rf=eM;const tM=Ht(rf);var rM=iI,nM=My,iM=Ti,oM=ef,aM=Ny,sM=rf,uM=Object.prototype,lM=uM.hasOwnProperty;function cM(e,t){var r=iM(e),n=!r&&nM(e),i=!r&&!n&&oM(e),o=!r&&!n&&!i&&sM(e),a=r||n||i||o,s=a?rM(e.length,String):[],u=s.length;for(var l in e)(t||lM.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||aM(l,u)))&&s.push(l);return s}var Ly=cM,fM=Object.prototype;function hM(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||fM;return e===r}var xp=hM;function dM(e,t){return function(r){return e(t(r))}}var wy=dM,pM=wy,_M=pM(Object.keys,Object),vM=_M,mM=xp,gM=vM,EM=Object.prototype,yM=EM.hasOwnProperty;function TM(e){if(!mM(e))return gM(e);var t=[];for(var r in Object(e))yM.call(e,r)&&r!="constructor"&&t.push(r);return t}var AM=TM,SM=Kc,xM=Py;function bM(e){return e!=null&&xM(e.length)&&!SM(e)}var nf=bM,RM=Ly,CM=AM,OM=nf;function IM(e){return OM(e)?RM(e):CM(e)}var bp=IM,MM=Pu,NM=bp;function PM(e,t){return e&&MM(t,NM(t),e)}var LM=PM;function wM(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var FM=wM,BM=Dn,DM=xp,UM=FM,kM=Object.prototype,$M=kM.hasOwnProperty;function zM(e){if(!BM(e))return UM(e);var t=DM(e),r=[];for(var n in e)n=="constructor"&&(t||!$M.call(e,n))||r.push(n);return r}var VM=zM,HM=Ly,jM=VM,XM=nf;function WM(e){return XM(e)?HM(e,!0):jM(e)}var Lu=WM,GM=Pu,YM=Lu;function ZM(e,t){return e&&GM(t,YM(t),e)}var qM=ZM,cc={exports:{}};cc.exports;(function(e,t){var r=Kn,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===n,a=o?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;function u(l,f){if(f)return l.slice();var c=l.length,h=s?s(c):new l.constructor(c);return l.copy(h),h}e.exports=u})(cc,cc.exports);var Fy=cc.exports;function KM(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r=t||F<0||c&&Y>=o}function y(){var $=Ch();if(g($))return S($);s=setTimeout(y,v($))}function S($){return s=void 0,h&&n?d($):(n=i=void 0,a)}function R(){s!==void 0&&clearTimeout(s),l=0,n=u=i=s=void 0}function x(){return s===void 0?a:S(Ch())}function M(){var $=Ch(),F=g($);if(n=arguments,i=this,u=$,F){if(s===void 0)return p(u);if(c)return clearTimeout(s),s=setTimeout(y,t),d(u)}return s===void 0&&(s=setTimeout(y,t)),a}return M.cancel=R,M.flush=x,M}var Zy=xL;const bL=Ht(Zy);var RL=Ti,CL=Yc,OL=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,IL=/^\w*$/;function ML(e,t){if(RL(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||CL(e)?!0:IL.test(e)||!OL.test(e)||t!=null&&e in Object(t)}var NL=ML,qy=yp,PL="Expected a function";function Mp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(PL);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Mp.Cache||qy),r}Mp.Cache=qy;var LL=Mp,wL=LL,FL=500;function BL(e){var t=wL(e,function(n){return r.size===FL&&r.clear(),n}),r=t.cache;return t}var DL=BL,UL=DL,kL=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$L=/\\(\\)?/g,zL=UL(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(kL,function(r,n,i,o){t.push(i?o.replace($L,"$1"):n||r)}),t}),VL=zL;function HL(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++rs))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var c=-1,h=!0,d=r&Bw?new Pw:void 0;for(o.set(e,t),o.set(t,e);++c0){if(++t>=WB)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var qB=ZB,KB=XB,QB=qB,JB=QB(KB),eD=JB,tD=lT,rD=kB,nD=eD;function iD(e,t){return nD(rD(e,t,tD),e+"")}var cT=iD,oD=Nu,aD=nf,sD=Ny,uD=Dn;function lD(e,t,r){if(!uD(r))return!1;var n=typeof t;return(n=="number"?aD(r)&&sD(t,r.length):n=="string"&&t in r)?oD(r[t],e):!1}var cD=lD,fD=cT,hD=cD;function dD(e){return fD(function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&hD(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n-1;)s!==e&&sm.call(s,u,1),sm.call(e,u,1);return e}var HD=VD,jD=HD;function XD(e,t){return e&&e.length&&t&&t.length?jD(e,t):e}var WD=XD,GD=cT,YD=WD,ZD=GD(YD),qD=ZD;const KD=Ht(qD);var QD=Zy,JD=Dn,e6="Expected a function";function t6(e,t,r){var n=!0,i=!0;if(typeof e!="function")throw new TypeError(e6);return JD(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),QD(e,t,{leading:n,maxWait:t,trailing:i})}var r6=t6;const n6=Ht(r6);var i6=hT;function o6(e,t){var r=e==null?0:e.length;return!!r&&i6(e,t,0)>-1}var a6=o6;function s6(e,t,r){for(var n=-1,i=e==null?0:e.length;++n=A6){var l=t?null:y6(e);if(l)return T6(l);a=!1,i=E6,u=new v6}else u=t?[]:s;e:for(;++ni?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n=n?e:N6(e,t,r)}var L6=P6,w6="\\ud800-\\udfff",F6="\\u0300-\\u036f",B6="\\ufe20-\\ufe2f",D6="\\u20d0-\\u20ff",U6=F6+B6+D6,k6="\\ufe0e\\ufe0f",$6="\\u200d",z6=RegExp("["+$6+w6+U6+k6+"]");function V6(e){return z6.test(e)}var dT=V6;function H6(e){return e.split("")}var j6=H6,pT="\\ud800-\\udfff",X6="\\u0300-\\u036f",W6="\\ufe20-\\ufe2f",G6="\\u20d0-\\u20ff",Y6=X6+W6+G6,Z6="\\ufe0e\\ufe0f",q6="["+pT+"]",dd="["+Y6+"]",pd="\\ud83c[\\udffb-\\udfff]",K6="(?:"+dd+"|"+pd+")",_T="[^"+pT+"]",vT="(?:\\ud83c[\\udde6-\\uddff]){2}",mT="[\\ud800-\\udbff][\\udc00-\\udfff]",Q6="\\u200d",gT=K6+"?",ET="["+Z6+"]?",J6="(?:"+Q6+"(?:"+[_T,vT,mT].join("|")+")"+ET+gT+")*",e5=ET+gT+J6,t5="(?:"+[_T+dd+"?",dd,vT,mT,q6].join("|")+")",r5=RegExp(pd+"(?="+pd+")|"+t5+e5,"g");function n5(e){return e.match(r5)||[]}var i5=n5,o5=j6,a5=dT,s5=i5;function u5(e){return a5(e)?s5(e):o5(e)}var l5=u5,c5=L6,f5=dT,h5=l5,d5=qa;function p5(e){return function(t){t=d5(t);var r=f5(t)?h5(t):void 0,n=r?r[0]:t.charAt(0),i=r?c5(r,1).join(""):t.slice(1);return n[e]()+i}}var _5=p5,v5=_5,m5=v5("toUpperCase"),yT=m5;const g5=Ht(yT);function E5(e){return e===void 0}var y5=E5;const T5=Ht(y5);var A5=qa,S5=yT;function x5(e){return S5(A5(e).toLowerCase())}var b5=x5;function R5(e,t,r,n){var i=-1,o=e==null?0:e.length;for(n&&o&&(r=e[++i]);++i{e.classList.remove(n)}):BT(e,wT((" "+Pp(e)+" ").replace(" "+t+" "," ")))}function W7(e,t){if(e.classList!==void 0)return e.classList.contains(t);const r=Pp(e);return r.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(r)}function BT(e,t){e instanceof HTMLElement?e.className=t:e.className.baseVal=t}function Pp(e){return e instanceof SVGElement&&(e=e.correspondingElement),e.className.baseVal===void 0?e.className:e.className.baseVal}X7(["transform","WebkitTransform"]);function G7(){var e;const t=window.document.querySelector('meta[name="viewport"]');if(!t)return 1;const n=((e=t.content)==null?void 0:e.split(",")).find(i=>{const[o]=i.split("=");return o==="initial-scale"});return n?n.split("=")[1]*1:1}var ln=G7()<1?1:window.devicePixelRatio;function Y7(e,t){e.setAttribute("style",`${e.style.cssText}${t}`)}function Z7(e){return Object.entries(e).map(([t,r])=>`${t}: ${r}`).join(";")}function q7(e,t){return{left:e.left-t.left,top:e.top-t.top,right:t.left+t.width-e.left-e.width,bottom:t.top+t.height-e.top-e.height}}function DT(e){e.innerHTML=""}function K7(e){e.setAttribute("draggable","false")}function Q7(e,t){var r;const n=Array.isArray(t)?t:[t];let i=e;for(;i instanceof Element&&i!==window.document.body;){if(n.find(o=>i==null?void 0:i.matches(o)))return i;i=(r=i==null?void 0:i.parentElement)!=null?r:null}}function J7(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var vd=navigator==null?void 0:navigator.userAgent;vd.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);vd.indexOf("Android")>-1||vd.indexOf("Adr")>-1;function md(e){var t=[1/0,1/0,-1/0,-1/0];return _y(e,function(r){t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]r&&e.lng<=i&&e.lat>n&&e.lat<=o}function tU(e){const t=[1/0,1/0,-1/0,-1/0];return e.forEach(r=>{const{coordinates:n}=r;UT(t,n)}),t}function UT(e,t){return Array.isArray(t[0])?t.forEach(r=>{UT(e,r)}):(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]180||e<-180)&&(e=e%360,e>180&&(e=-360+e),e<-180&&(e=360+e),e===0&&(e=0)),e}function nU(e){if(e==null)throw new Error("lat is required");return(e>90||e<-90)&&(e=e%180,e>90&&(e=-180+e),e<-90&&(e=180+e),e===0&&(e=0)),e}function iU(e,t){if(t===!1)return e;const r=rU(e[0]);let n=nU(e[1]);return n>85&&(n=85),n<-85&&(n=-85),e.length===3?[r,n,e[2]]:[r,n]}function Pn(e){const t=85.0511287798,r=Math.max(Math.min(t,e[1]),-t),n=256<<20;let i=Math.PI/180,o=e[0]*i,a=r*i;a=Math.log(Math.tan(Math.PI/4+a/2));const s=.5/Math.PI,u=.5,l=-.5/Math.PI;return i=.5,o=n*(s*o+u),a=n*(l*a+i),[Math.floor(o),Math.floor(a)]}function Ph(e,t){const r=85.0511287798,n=Math.PI/180,i=6378137;return t=Math.max(Math.min(r,t),-r),e*=n,t*=n,t=Math.log(Math.tan(Math.PI/4+t/2)),[e*i,t*i]}function Lp(e,t){const r=Math.abs(e[1][1]-e[0][1])*t,n=Math.abs(e[1][0]-e[0][0])*t;return[[e[0][0]-n,e[0][1]-r],[e[1][0]+n,e[1][1]+r]]}function kT(e,t){return e[0][0]<=t[0][0]&&e[0][1]<=t[0][1]&&e[1][0]>=t[1][0]&&e[1][1]>=t[1][1]}function dc(e){return[[e[0],e[1]],[e[2],e[3]]]}function oU(e){const t=aU(e,[0,0]);return[e[0]/t,e[1]/t]}function aU(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Ao(e){if(Nh(e[0]))return e;if(Nh(e[0][0]))throw new Error("当前数据不支持标注");if(Nh(e[0][0][0])){const t=e;let r=0,n=0,i=0;return t.forEach(o=>{o.forEach(a=>{r+=a[0],n+=a[1],i++})}),[r/i,n/i,0]}else throw new Error("当前数据不支持标注")}function sU(e){let t=e[0],r=e[1],n=e[0],i=e[1],o=0,a=0,s=0;for(let u=0;u{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var cU=class{constructor(e=50,t){this.limit=e,this.destroy=t||this.defaultDestroy,this.order=[],this.clear()}clear(){this.order.forEach(e=>{this.delete(e)}),this.cache={},this.order=[]}get(e){const t=this.cache[e];return t&&(this.deleteOrder(e),this.appendOrder(e)),t}set(e,t){this.cache[e]?(this.delete(e),this.cache[e]=t,this.appendOrder(e)):(Object.keys(this.cache).length===this.limit&&this.delete(this.order[0]),this.cache[e]=t,this.appendOrder(e))}delete(e){const t=this.cache[e];t&&(this.deleteCache(e),this.deleteOrder(e),this.destroy(t,e))}deleteCache(e){delete this.cache[e]}deleteOrder(e){const t=this.order.findIndex(r=>r===e);t>=0&&this.order.splice(t,1)}appendOrder(e){this.order.push(e)}defaultDestroy(e,t){return null}};function fU(e){if(e.length===0)throw new Error("max requires at least one data point");let t=e[0];for(let r=1;rt&&(t=e[r]);return t*1}function hU(e){if(e.length===0)throw new Error("min requires at least one data point");let t=e[0];for(let r=1;rn&&(n=i,r=t),i=1,t=e[o]):i++;return r*1}var zT={min:hU,max:fU,mean:dU,sum:$T,mode:pU};function VT(e,t){return e.map(r=>r[t])}function _U(e,t){t===void 0&&(t={});var r=Number(e[0]),n=Number(e[1]),i=Number(e[2]),o=Number(e[3]);if(e.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var a=[r,n],s=[r,o],u=[i,o],l=[i,n];return cp([[a,l,u,s,a]],t.properties,{bbox:e,id:t.id})}var ou=(e=>(e.Realtime="realtime",e.Overlap="overlap",e.Replace="replace",e))(ou||{}),On=(e=>(e.Loading="Loading",e.Loaded="Loaded",e.Failure="Failure",e.Cancelled="Cancelled",e))(On||{}),HT=0,dm=1,af=2;function vU(e){e.forEach(t=>{t.isCurrent&&(t.isVisible=t.isLoaded)})}function mU(e){e.forEach(t=>{t.properties.state=HT}),e.forEach(t=>{t.isCurrent&&!jT(t)&&wp(t)}),e.forEach(t=>{t.isVisible=!!(t.properties.state&af)})}function gU(e){e.forEach(r=>{r.properties.state=HT}),e.forEach(r=>{r.isCurrent&&jT(r)}),e.slice().sort((r,n)=>r.z-n.z).forEach(r=>{r.isVisible=!!(r.properties.state&af),r.children.length&&(r.isVisible||r.properties.state&dm)?r.children.forEach(n=>{n.properties.state=dm}):r.isCurrent&&wp(r)})}function jT(e){for(;e;){if(e.isLoaded)return e.properties.state|=af,!0;e=e.parent}return!1}function wp(e){e.children.forEach(t=>{t.isLoaded?t.properties.state|=af:wp(t)})}var XT=[-1/0,-1/0,1/0,1/0],EU=.2,yU=5,TU={[ou.Realtime]:vU,[ou.Overlap]:mU,[ou.Replace]:gU},AU=()=>{};function gd(e,t,r){const n=Math.floor((e+180)/360*Math.pow(2,r)),i=Math.floor((1-Math.log(Math.tan(t*Math.PI/180)+1/Math.cos(t*Math.PI/180))/Math.PI)/2*Math.pow(2,r));return[n,i]}function pm(e,t,r){const n=e/Math.pow(2,r)*360-180,i=Math.PI-2*Math.PI*t/Math.pow(2,r),o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[n,o]}var WT=(e,t,r)=>{const[n,i]=pm(e,t,r),[o,a]=pm(e+1,t+1,r);return[n,a,o,i]};function SU({zoom:e,latLonBounds:t,maxZoom:r=1/0,minZoom:n=0,zoomOffset:i=0,extent:o=XT}){let a=Math.ceil(e)+i;if(Number.isFinite(n)&&ar&&(a=r);const[s,u,l,f]=t,c=[Math.max(s,o[0]),Math.max(u,o[1]),Math.min(l,o[2]),Math.min(f,o[3])],h=[],[d,p]=gd(c[0],c[1],a),[v,g]=gd(c[2],c[3],a);for(let x=d;x<=v;x++)for(let M=g;M<=p;M++)h.push({x,y:M,z:a});const y=(v+d)/2,S=(p+g)/2,R=(x,M)=>Math.abs(x-y)+Math.abs(M-S);return h.sort((x,M)=>R(x.x,x.y)-R(M.x,M.y)),h}var xU=(e,t,r,n=!0)=>{const i=Math.pow(2,r),o=i-1,a=i;let s=e;const u=t;return n&&(s<0?s=s+a:s>o&&(s=s%a)),{warpX:s,warpY:u}},bU=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),RU=class extends Bn.EventEmitter{constructor(e){super(),this.tileSize=256,this.isVisible=!1,this.isCurrent=!1,this.isVisibleChange=!1,this.loadedLayers=0,this.isLayerLoaded=!1,this.isLoad=!1,this.isChildLoad=!1,this.parent=null,this.children=[],this.data=null,this.properties={},this.loadDataId=0;const{x:t,y:r,z:n,tileSize:i,warp:o=!0}=e;this.x=t,this.y=r,this.z=n,this.warp=o||!0,this.tileSize=i}get isLoading(){return this.loadStatus===On.Loading}get isLoaded(){return this.loadStatus===On.Loaded}get isFailure(){return this.loadStatus===On.Failure}setTileLayerLoaded(){this.isLayerLoaded=!0}get isCancelled(){return this.loadStatus===On.Cancelled}get isDone(){return[On.Loaded,On.Cancelled,On.Failure].includes(this.loadStatus)}get bounds(){return WT(this.x,this.y,this.z)}get bboxPolygon(){const[e,t,r,n]=this.bounds,i=[(r-e)/2,(n-t)/2];return _U(this.bounds,{properties:{key:this.key,id:this.key,bbox:this.bounds,center:i,meta:` ${this.key} `}})}get key(){return`${this.x}_${this.y}_${this.z}`}layerLoad(){this.loadedLayers++,this.emit("layerLoaded")}loadData(e){return bU(this,arguments,function*({getData:t,onLoad:r,onError:n}){this.loadDataId++;const i=this.loadDataId;this.isLoading&&this.abortLoad(),this.abortController=new AbortController,this.loadStatus=On.Loading;let o=null,a;try{const{x:s,y:u,z:l,bounds:f,tileSize:c,warp:h}=this,{warpX:d,warpY:p}=xU(s,u,l,h),{signal:v}=this.abortController;o=yield t({x:d,y:p,z:l,bounds:f,tileSize:c,signal:v,warp:h},this)}catch(s){a=s}if(i===this.loadDataId&&!(this.isCancelled&&!o)){if(a||!o){this.loadStatus=On.Failure,n(a,this);return}this.loadStatus=On.Loaded,this.data=o,r(this)}})}reloadData(e){this.isLoading&&this.abortLoad(),this.loadData(e)}abortLoad(){this.isLoaded||this.isCancelled||(this.loadStatus=On.Cancelled,this.abortController.abort(),this.xhrCancel&&this.xhrCancel())}},CU=(e,t)=>{const r=dc(e),n=Lp(r,t),i=360*3-180,o=85.0511287798065;return[Math.max(n[0][0],-i),Math.max(n[0][1],-o),Math.min(n[1][0],i),Math.min(n[1][1],o)]},OU=(e,t)=>{const r=dc(e),n=dc(t);return kT(r,n)},IU=Object.defineProperty,MU=Object.defineProperties,NU=Object.getOwnPropertyDescriptors,_m=Object.getOwnPropertySymbols,PU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,vm=(e,t,r)=>t in e?IU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mm=(e,t)=>{for(var r in t||(t={}))PU.call(t,r)&&vm(e,r,t[r]);if(_m)for(var r of _m(t))LU.call(t,r)&&vm(e,r,t[r]);return e},wU=(e,t)=>MU(e,NU(t)),{throttle:FU}=Sr,BU=class extends lp{constructor(e){super(),this.currentTiles=[],this.cacheTiles=new Map,this.throttleUpdate=FU((t,r)=>{this.update(t,r)},16),this.onTileLoad=t=>{this.emit("tile-loaded",t),this.updateTileVisible(),this.loadFinished()},this.onTileError=(t,r)=>{this.emit("tile-error",{error:t,tile:r}),this.updateTileVisible(),this.loadFinished()},this.onTileUnload=t=>{this.emit("tile-unload",t),this.loadFinished()},this.options={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0,extent:XT,getTileData:AU,warp:!0,updateStrategy:ou.Replace},this.updateOptions(e)}get isLoaded(){return this.currentTiles.every(e=>e.isDone)}get tiles(){return Array.from(this.cacheTiles.values()).sort((t,r)=>t.z-r.z)}updateOptions(e){const t=e.minZoom===void 0?this.options.minZoom:Math.ceil(e.minZoom),r=e.maxZoom===void 0?this.options.maxZoom:Math.floor(e.maxZoom);this.options=wU(mm(mm({},this.options),e),{minZoom:t,maxZoom:r})}update(e,t){const r=Math.max(0,Math.ceil(e));if(this.lastViewStates&&this.lastViewStates.zoom===r&&OU(this.lastViewStates.latLonBoundsBuffer,t))return;const n=CU(t,EU);this.lastViewStates={zoom:r,latLonBounds:t,latLonBoundsBuffer:n},this.currentZoom=r;let i=!1;const o=this.getTileIndices(r,n).filter(a=>this.options.warp||a.x>=0&&a.x{let l=this.getTile(a,s,u);return l?(((l==null?void 0:l.isFailure)||(l==null?void 0:l.isCancelled))&&l.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}),l):(l=this.createTile(a,s,u),i=!0,l)}),i&&this.resizeCacheTiles(),this.updateTileVisible(),this.pruneRequests()}reloadAll(){for(const[e,t]of this.cacheTiles){if(!this.currentTiles.includes(t)){this.cacheTiles.delete(e),this.onTileUnload(t);return}this.onTileUnload(t),t.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError})}}reloadTileById(e,t,r){const n=this.cacheTiles.get(`${t},${r},${e}`);n&&(this.onTileUnload(n),n.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}))}reloadTileByLnglat(e,t,r){const n=this.getTileByLngLat(e,t,r);n&&this.reloadTileById(n.z,n.x,n.y)}reloadTileByExtent(e,t){this.getTileIndices(t,e).forEach(n=>{this.reloadTileById(n.z,n.x,n.y)})}pruneRequests(){const e=[];for(const t of this.cacheTiles.values())t.isLoading&&!t.isCurrent&&!t.isVisible&&e.push(t);for(;e.length>0;)e.shift().abortLoad()}getTileByLngLat(e,t,r){const{zoomOffset:n}=this.options,i=Math.ceil(r)+n,o=gd(e,t,i);return this.tiles.filter(s=>s.key===`${o[0]}_${o[1]}_${i}`)[0]}getTileExtent(e,t){return this.getTileIndices(t,e)}getTileByZXY(e,t,r){return this.tiles.filter(i=>i.key===`${t}_${r}_${e}`)[0]}clear(){for(const e of this.cacheTiles.values())e.isLoading?e.abortLoad():this.onTileUnload(e);this.lastViewStates=void 0,this.cacheTiles.clear(),this.currentTiles=[]}destroy(){this.clear(),this.removeAllListeners()}updateTileVisible(){const e=this.options.updateStrategy,t=new Map;for(const i of this.cacheTiles.values())t.set(i.key,i.isVisible),i.isCurrent=!1,i.isVisible=!1;for(const i of this.currentTiles)i.isCurrent=!0,i.isVisible=!0;const r=Array.from(this.cacheTiles.values());typeof e=="function"?e(r):TU[e](r);let n=!1;Array.from(this.cacheTiles.values()).forEach(i=>{i.isVisible!==t.get(i.key)?(i.isVisibleChange=!0,n=!0):i.isVisibleChange=!1}),n&&this.emit("tile-update")}getTileIndices(e,t){const{tileSize:r,extent:n,zoomOffset:i}=this.options,o=Math.floor(this.options.maxZoom),a=Math.ceil(this.options.minZoom);return SU({maxZoom:o,minZoom:a,zoomOffset:i,tileSize:r,zoom:e,latLonBounds:t,extent:n})}getTileId(e,t,r){return`${e},${t},${r}`}loadFinished(){const e=!this.currentTiles.some(t=>!t.isDone);return e&&this.emit("tiles-load-finished"),e}getTile(e,t,r){const n=this.getTileId(e,t,r);return this.cacheTiles.get(n)}createTile(e,t,r){const n=this.getTileId(e,t,r),i=new RU({x:e,y:t,z:r,tileSize:this.options.tileSize,warp:this.options.warp});return this.cacheTiles.set(n,i),i.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}),i}resizeCacheTiles(){const e=yU*this.currentTiles.length;if(this.cacheTiles.size>e){for(const[r,n]of this.cacheTiles)if(!n.isVisible&&!this.currentTiles.includes(n)&&(this.cacheTiles.delete(r),this.onTileUnload(n)),this.cacheTiles.size<=e)break}this.rebuildTileTree()}rebuildTileTree(){for(const e of this.cacheTiles.values())e.parent=null,e.children.length=0;for(const e of this.cacheTiles.values()){const t=this.getNearestAncestor(e.x,e.y,e.z);e.parent=t,t!=null&&t.children&&t.children.push(e)}}getNearestAncestor(e,t,r){for(;r>this.options.minZoom;){e=Math.floor(e/2),t=Math.floor(t/2),r=r-1;const n=this.getTile(e,t,r);if(n)return n}return null}};function GT(e){const t=[];let r=/\{([a-z])-([a-z])\}/.exec(e);if(r){const n=r[1].charCodeAt(0),i=r[2].charCodeAt(0);let o;for(o=n;o<=i;++o)t.push(e.replace(r[0],String.fromCharCode(o)));return t}if(r=/\{(\d+)-(\d+)\}/.exec(e),r){const n=parseInt(r[2],10);for(let i=parseInt(r[1],10);i<=n;i++)t.push(e.replace(r[0],i.toString()));return t}return t.push(e),t}function xa(e,t){if(!e||!e.length)throw new Error("url is not allowed to be empty");const{x:r,y:n,z:i}=t,o=GT(e),a=Math.abs(r+n)%o.length;return(dp(o[a])?`${o[a]}/{z}/{x}/{y}`:o[a]).replace(/\{x\}/g,r.toString()).replace(/\{y\}/g,n.toString()).replace(/\{z\}/g,i.toString()).replace(/\{bbox\}/g,WT(r,n,i).join(",")).replace(/\{-y\}/g,(Math.pow(2,i)-n-1).toString())}function DU(e,t){const{x:r,y:n,z:i,layer:o,version:a="1.0.0",style:s="default",format:u,service:l="WMTS",tileMatrixset:f}=t,c=GT(e),h=Math.abs(r+n)%c.length;return`${c[h]}&SERVICE=${l}&REQUEST=GetTile&VERSION=${a}&LAYER=${o}&STYLE=${s}&TILEMATRIXSET=${f}&FORMAT=${u}&TILECOL=${r}&TILEROW=${n}&TILEMATRIX=${i}`}function bs(e,t){return e??t}var UU=ql;function ql(e,t){var r=e&&e.type,n;if(r==="FeatureCollection")for(n=0;n=Math.abs(s)?r-u+s:s-u+r,r=u}r+n>=0!=!!t&&e.reverse()}const kU=Ht(UU);function $U(e,t){return e.map(r=>r[t]*1)}function YT(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number":!1}function Ed(e){const t=Object.isFrozen(e)?Sr.cloneDeep(e):e;return kU(t,!0),t}function wu(e,t){return e||[[t[0],t[3]],[t[2],t[3]],[t[2],t[1]],[t[0],t[1]]]}var zU=Object.defineProperty,VU=Object.defineProperties,HU=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,jU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,Tm=(e,t,r)=>t in e?zU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Am=(e,t)=>{for(var r in t||(t={}))jU.call(t,r)&&Tm(e,r,t[r]);if(ym)for(var r of ym(t))XU.call(t,r)&&Tm(e,r,t[r]);return e},Sm=(e,t)=>VU(e,HU(t));function ZT(e,t){const{x:r,y:n,x1:i,y1:o,coordinates:a,geometry:s}=t,u=[];if(!Array.isArray(e))return{dataArray:[]};if(s)return e.filter(l=>l[s]&&l[s].type&&l[s].coordinates&&l[s].coordinates.length>0).forEach((l,f)=>{const c=Ed(l[s]);vy(c,h=>{const d=py(h),p=Sm(Am({},l),{_id:f,coordinates:d});u.push(p)})}),{dataArray:u};for(let l=0;lt in e?GU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,QU=(e,t)=>{for(var r in t||(t={}))qU.call(t,r)&&bm(e,r,t[r]);if(xm)for(var r of xm(t))KU.call(t,r)&&bm(e,r,t[r]);return e},JU=(e,t)=>YU(e,ZU(t));function e8(e){const t=e.toString();let r=5381,n=t.length;for(;n;)r=r*33^t.charCodeAt(--n);return r>>>0}function t8(e,t){return t===void 0?null:typeof(e.properties[t]*1)=="number"?e.properties[t]*1:e.properties&&e.properties[t]?e8(e.properties[t]+"")%1000019:null}function r8(e,t){const r=[],n={};return e.features?(e.features=e.features.filter(i=>{const o=i.geometry;return i!=null&&o&&o.type&&o.coordinates&&o.coordinates.length>0}),e=Ed(e),e.features.length===0?{dataArray:[],featureKeys:n}:(vy(e,(i,o)=>{let a=t8(i,t==null?void 0:t.featureId);a===null&&(a=o);const s=a,u=py(i),l=JU(QU({},i.properties),{coordinates:u,_id:s});r.push(l)}),{dataArray:r,featureKeys:n})):(e.features=[],{dataArray:[]})}function yd(e,t,r,n){for(var i=n,o=r-t>>1,a=r-t,s,u=e[t],l=e[t+1],f=e[r],c=e[r+1],h=t+3;hi)s=h,i=d;else if(d===i){var p=Math.abs(h-o);pn&&(s-t>3&&yd(e,t,s,n),e[s+2]=i,r-s>3&&yd(e,s,r,n))}function n8(e,t,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var u=((e-r)*a+(t-n)*s)/(a*a+s*s);u>1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return a=e-r,s=t-n,a*a+s*s}function du(e,t,r,n){var i={id:typeof e>"u"?null:e,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return i8(i),i}function i8(e){var t=e.geometry,r=e.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Lh(e,t);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n0&&(n?a+=(i*l-u*o)/2:a+=Math.sqrt(Math.pow(u-i,2)+Math.pow(l-o,2))),i=u,o=l}var f=t.length-3;t[2]=1,yd(t,0,f,r),t[f+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function wh(e,t,r,n){for(var i=0;i1?1:r}function vi(e,t,r,n,i,o,a,s){if(r/=t,n/=t,o>=r&&a=n)return null;for(var u=[],l=0;l=r&&p=n)continue;var v=[];if(h==="Point"||h==="MultiPoint")a8(c,v,r,n,i);else if(h==="LineString")QT(c,v,r,n,i,!1,s.lineMetrics);else if(h==="MultiLineString")Fh(c,v,r,n,i,!1);else if(h==="Polygon")Fh(c,v,r,n,i,!0);else if(h==="MultiPolygon")for(var g=0;g=r&&a<=n&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function QT(e,t,r,n,i,o,a){for(var s=Cm(e),u=i===0?s8:u8,l=e.start,f,c,h=0;hr&&(c=u(s,d,p,g,y,r),a&&(s.start=l+f*c)):S>n?R=r&&(c=u(s,d,p,g,y,r),x=!0),R>n&&S<=n&&(c=u(s,d,p,g,y,n),x=!0),!o&&x&&(a&&(s.end=l+f*c),t.push(s),s=Cm(e)),a&&(l+=f)}var M=e.length-3;d=e[M],p=e[M+1],v=e[M+2],S=i===0?d:p,S>=r&&S<=n&&Bh(s,d,p,v),M=s.length-3,o&&M>=3&&(s[M]!==s[0]||s[M+1]!==s[1])&&Bh(s,s[0],s[1],s[2]),s.length&&t.push(s)}function Cm(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Fh(e,t,r,n,i,o){for(var a=0;aa.maxX&&(a.maxX=f),c>a.maxY&&(a.maxY=c)}return a}function f8(e,t,r,n){var i=t.geometry,o=t.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s0&&t.size<(i?a:n)){r.numPoints+=t.length/3;return}for(var s=[],u=0;ua)&&(r.numSimplified++,s.push(t[u]),s.push(t[u+1])),r.numPoints++;i&&h8(s,o),e.push(s)}function h8(e,t){for(var r=0,n=0,i=e.length,o=i-2;n0===t)for(n=0,i=e.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=o8(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=l8(n,t),n.length&&this.splitTile(n,0,0,0),r&&(n.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)))}sf.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};sf.prototype.splitTile=function(e,t,r,n,i,o,a){for(var s=[e,t,r,n],u=this.options,l=u.debug;s.length;){n=s.pop(),r=s.pop(),t=s.pop(),e=s.pop();var f=1<1&&console.time("creation"),h=this.tiles[c]=c8(e,t,r,n,u),this.tileCoords.push({z:t,x:r,y:n}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var d="z"+t;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(h.source=e,i){if(t===u.maxZoom||t===i)continue;var p=1<1&&console.time("clipping");var v=.5*u.buffer/u.extent,g=.5-v,y=.5+v,S=1+v,R,x,M,$,F,Y;R=x=M=$=null,F=vi(e,f,r-v,r+y,0,h.minX,h.maxX,u),Y=vi(e,f,r+g,r+S,0,h.minX,h.maxX,u),e=null,F&&(R=vi(F,f,n-v,n+y,1,h.minY,h.maxY,u),x=vi(F,f,n+g,n+S,1,h.minY,h.maxY,u),F=null),Y&&(M=vi(Y,f,n-v,n+y,1,h.minY,h.maxY,u),$=vi(Y,f,n+g,n+S,1,h.minY,h.maxY,u),Y=null),l>1&&console.timeEnd("clipping"),s.push(R||[],t+1,r*2,n*2),s.push(x||[],t+1,r*2,n*2+1),s.push(M||[],t+1,r*2+1,n*2),s.push($||[],t+1,r*2+1,n*2+1)}}};sf.prototype.getTile=function(e,t,r){var n=this.options,i=n.extent,o=n.debug;if(e<0||e>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var u=e,l=t,f=r,c;!c&&u>0;)u--,l=Math.floor(l/2),f=Math.floor(f/2),c=this.tiles[Ad(u,l,f)];return!c||!c.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",u,l,f),o>1&&console.time("drilling down"),this.splitTile(c.source,u,l,f,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Im(this.tiles[s],i):null)};function Ad(e,t,r){return((1<t in e?_8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pc=(e,t)=>{for(var r in t||(t={}))g8.call(t,r)&&Pm(e,r,t[r]);if(Nm)for(var r of Nm(t))E8.call(t,r)&&Pm(e,r,t[r]);return e},y8=(e,t)=>v8(e,m8(t)),T8=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),A8={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0};function S8(e){let t=0;for(let r=0,n=e.length,i=n-1,o,a;rT8(void 0,null,function*(){return new Promise(i=>{const o=t.getTile(e.z,e.x,e.y),s={layers:{defaultLayer:{features:o?o.features.map(l=>R8(n,r.x,r.y,r.z,l)):[]}}},u=new Ys(s,e.x,e.y,e.z);i(u)})});function O8(e){const t={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!0,debug:0};return e===void 0||typeof e.geojsonvtOptions>"u"?t:pc(pc({},t),e.geojsonvtOptions)}function I8(e,t){const r=O8(t),n=r.extent||4096,i=d8(e,r),o=(s,u)=>C8(u,i,s,n),a=y8(pc(pc({},A8),t),{getTileData:o});return{data:e,dataArray:[],tilesetOptions:a,isTile:!0}}var M8=Object.defineProperty,N8=Object.defineProperties,P8=Object.getOwnPropertyDescriptors,Lm=Object.getOwnPropertySymbols,L8=Object.prototype.hasOwnProperty,w8=Object.prototype.propertyIsEnumerable,wm=(e,t,r)=>t in e?M8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fm=(e,t)=>{for(var r in t||(t={}))L8.call(t,r)&&wm(e,r,t[r]);if(Lm)for(var r of Lm(t))w8.call(t,r)&&wm(e,r,t[r]);return e},Bm=(e,t)=>N8(e,P8(t));function JT(e,t){const{extent:r=[121.168,30.2828,121.384,30.4219],coordinates:n,requestParameters:i={}}=t,o=new Promise(u=>{e instanceof HTMLImageElement||J7(e)?u([e]):F8(e,i,l=>{u(l)})}),a=wu(n,r);return{originData:e,images:o,_id:1,dataArray:[{_id:0,coordinates:a}]}}function F8(e,t,r){const n=[];if(typeof e=="string")sd(Bm(Fm({},t),{url:e}),(i,o)=>{o&&(n.push(o),r(n))});else{const i=e.length;let o=0;e.forEach(a=>{sd(Bm(Fm({},t),{url:a}),(s,u)=>{o++,u&&n.push(u),o===i&&r(n)})})}return JT}var B8=Object.defineProperty,D8=Object.defineProperties,U8=Object.getOwnPropertyDescriptors,Dm=Object.getOwnPropertySymbols,k8=Object.prototype.hasOwnProperty,$8=Object.prototype.propertyIsEnumerable,Um=(e,t,r)=>t in e?B8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eA=(e,t)=>{for(var r in t||(t={}))k8.call(t,r)&&Um(e,r,t[r]);if(Dm)for(var r of Dm(t))$8.call(t,r)&&Um(e,r,t[r]);return e},tA=(e,t)=>D8(e,U8(t)),z8=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),V8=(e,t,r,n)=>z8(void 0,null,function*(){const i={x:t.x,y:t.y,z:t.z},o=xa(e,i);return new Promise(a=>{n?n(i,(s,u)=>{if(s||!u){const l={layers:{defaultLayer:{features:[]}}},f=new Ys(l,t.x,t.y,t.z);a(f)}else{const l={layers:{defaultLayer:{features:u.features}}},f=new Ys(l,t.x,t.y,t.z);a(f)}}):l2(tA(eA({},r),{url:o}),(s,u)=>{if(s||!u){const l={layers:{defaultLayer:{features:[]}}},f=new Ys(l,t.x,t.y,t.z);a(f)}else{const f={layers:{defaultLayer:{features:JSON.parse(u)}}},c=new Ys(f,t.x,t.y,t.z);a(c)}})})});function H8(e,t){const r=(i,o)=>V8(e,o,t==null?void 0:t.requestParameters,t.getCustomData),n=tA(eA({},t),{getTileData:r});return{dataArray:[],tilesetOptions:n,isTile:!0}}var j8=ba;function ba(e,t){this.x=e,this.y=t}ba.prototype={clone:function(){return new ba(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,t){return this.clone()._rotateAround(e,t)},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 t=e.x-this.x,r=e.y-this.y;return t*t+r*r},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,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,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 t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),o=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};ba.convert=function(e){return e instanceof ba?e:Array.isArray(e)?new ba(e[0],e[1]):e};var X8=j8,W8=wa;function wa(e,t,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i,e.readFields(G8,this,t)}function G8(e,t,r){e==1?t.id=r.readVarint():e==2?Y8(r,t):e==3?t.type=r.readVarint():e==4&&(t._geometry=r.pos)}function Y8(e,t){for(var r=e.readVarint()+e.pos;e.pos>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new X8(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};wa.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,l=-1/0;e.pos>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),is&&(s=i),ol&&(l=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,u,s,l]};wa.prototype.toGeoJSON=function(e,t,r){var n=this.extent*Math.pow(2,r),i=this.extent*e,o=this.extent*t,a=this.loadGeometry(),s=wa.types[this.type],u,l;function f(d){for(var p=0;p>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}rA.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new K8(this._pbf,t,this.extent,this._keys,this._values)};var tk=Q8,rk=nk;function nk(e,t){this.layers=e.readFields(ik,{},t)}function ik(e,t,r){if(e===3){var n=new tk(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}var ok=rk,Fp={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */Fp.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,u=(1<>1,f=-7,c=r?i-1:0,h=r?-1:1,d=e[t+c];for(c+=h,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=o*256+e[t+c],c+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+e[t+c],c+=h,f-=8);if(o===0)o=1-l;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(d?-1:1)*a*Math.pow(2,o-n)};Fp.write=function(e,t,r,n,i,o){var a,s,u,l=o*8-i-1,f=(1<>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+c>=1?t+=h/u:t+=h*Math.pow(2,1-c),t*u>=2&&(a++,u/=2),a+c>=f?(s=0,a=f):a+c>=1?(s=(t*u-1)*Math.pow(2,i),a=a+c):(s=t*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=s&255,d+=p,s/=256,i-=8);for(a=a<0;e[r+d]=a&255,d+=p,a/=256,l-=8);e[r+d-p]|=v*128};var ak=jt,Ol=Fp;function jt(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}jt.Varint=0;jt.Fixed64=1;jt.Bytes=2;jt.Fixed32=5;var Sd=65536*65536,km=1/Sd,sk=12,nA=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");jt.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Il(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=zm(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Il(this.buf,this.pos)+Il(this.buf,this.pos+4)*Sd;return this.pos+=8,e},readSFixed64:function(){var e=Il(this.buf,this.pos)+zm(this.buf,this.pos+4)*Sd;return this.pos+=8,e},readFloat:function(){var e=Ol.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Ol.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,uk(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=sk&&nA?Ak(this.buf,t,e):Tk(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==jt.Bytes)return e.push(this.readVarint(t));var r=pi(this);for(e=e||[];this.pos127;);else if(t===jt.Bytes)this.pos=this.readVarint()+this.pos;else if(t===jt.Fixed32)this.pos+=4;else if(t===jt.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0){lk(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=Sk(this.buf,e,this.pos);var r=this.pos-t;r>=128&&$m(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Ol.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Ol.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r=128&&$m(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,jt.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,hk,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,dk,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,vk,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,pk,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,_k,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,mk,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,gk,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Ek,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,yk,t)},writeBytesField:function(e,t){this.writeTag(e,jt.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,jt.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,jt.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,jt.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,jt.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,jt.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,jt.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,jt.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,jt.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,jt.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};function uk(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return aa(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function pi(e){return e.type===jt.Bytes?e.readVarint()+e.pos:e.pos+1}function aa(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function lk(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),ck(r,n,t),fk(n,t)}function ck(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function fk(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function $m(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function hk(e,t){for(var r=0;r>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function zm(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Tk(e,t,r){for(var n="",i=t;i239?4:o>223?3:o>191?2:1;if(i+s>r)break;var u,l,f;s===1?o<128&&(a=o):s===2?(u=e[i+1],(u&192)===128&&(a=(o&31)<<6|u&63,a<=127&&(a=null))):s===3?(u=e[i+1],l=e[i+2],(u&192)===128&&(l&192)===128&&(a=(o&15)<<12|(u&63)<<6|l&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(u=e[i+1],l=e[i+2],f=e[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(a=(o&15)<<18|(u&63)<<12|(l&63)<<6|f&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function Ak(e,t,r){return nA.decode(e.subarray(t,r))}function Sk(e,t,r){for(var n=0,i,o;n55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}const xk=Ht(ak);var bk=Object.defineProperty,Rk=Object.defineProperties,Ck=Object.getOwnPropertyDescriptors,Vm=Object.getOwnPropertySymbols,Ok=Object.prototype.hasOwnProperty,Ik=Object.prototype.propertyIsEnumerable,Hm=(e,t,r)=>t in e?bk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jm=(e,t)=>{for(var r in t||(t={}))Ok.call(t,r)&&Hm(e,r,t[r]);if(Vm)for(var r of Vm(t))Ik.call(t,r)&&Hm(e,r,t[r]);return e},Mk=(e,t)=>Rk(e,Ck(t)),Xm=class{constructor(e,t,r,n){this.vectorLayerCache={},this.x=t,this.y=r,this.z=n,this.vectorTile=new ok(new xk(e))}getTileData(e){if(!e||!this.vectorTile.layers[e])return[];if(this.vectorLayerCache[e])return this.vectorLayerCache[e];const t=this.vectorTile.layers[e];if(Array.isArray(t.features))return this.vectorLayerCache[e]=t.features,t.features;const r=[];for(let n=0;nt in e?Nk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xd=(e,t)=>{for(var r in t||(t={}))wk.call(t,r)&&Gm(e,r,t[r]);if(Wm)for(var r of Wm(t))Fk.call(t,r)&&Gm(e,r,t[r]);return e},iA=(e,t)=>Pk(e,Lk(t)),Bk=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),Dk={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0,warp:!0},Uk=(e,t,r,n,i)=>Bk(void 0,null,function*(){const o=xa(e,t);return new Promise(a=>{if(i)i({x:r.x,y:r.y,z:r.z},(s,u)=>{if(s||!u)a(void 0);else{const l=new Xm(u,r.x,r.y,r.z);a(l)}});else{const s=_p(iA(xd({},n),{url:o}),(u,l)=>{if(u||!l)a(void 0);else{const f=new Xm(l,r.x,r.y,r.z);a(f)}});r.xhrCancel=()=>s.cancel()}})});function kk(e,t){const r=Array.isArray(e)?e[0]:e,n=(o,a)=>Uk(r,o,a,t==null?void 0:t.requestParameters,t==null?void 0:t.getCustomData),i=iA(xd(xd({},Dk),t),{getTileData:n});return{data:r,dataArray:[],tilesetOptions:i,isTile:!0}}function $k(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"^":return Math.pow(t,r);case"abs":return Math.abs(t);case"floor":return Math.floor(t);case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"sin":return Math.sin(t);case"cos":return Math.cos(t);case"atan":return r===-1?Math.atan(t):Math.atan2(t,r);case"min":return Math.min(t,r);case"max":return Math.max(t,r);case"log10":return Math.log(t);case"log2":return Math.log2(t);default:return console.warn("Calculate symbol err! Return default 0"),0}}function au(e,t){const{width:r,height:n}=t[0],i=t.map(u=>u.rasterData),o=r*n,a=[],s=JSON.stringify(e);for(let u=0;u{if(Array.isArray(n)&&n.length>0)switch(n[0]){case"band":try{e[i]=t[n[1]][r]}catch{console.warn("Raster Data err!"),e[i]=0}break;default:oA(n,t,r)}})}function zk(e){const[t,r=-1,n=-1]=e;return t===void 0?(console.warn("Express err!"),["+",0,0]):[t.replace(/\s+/g,""),r,n]}function bd(e){const t=zk(e),r=t[0];let n=t[1],i=t[2];return Array.isArray(n)&&(n=bd(e[1])),Array.isArray(i)&&(i=bd(e[2])),$k(r,n,i)}var Vk={nd:{type:"operation",expression:["/",["-",["band",1],["band",0]],["+",["band",1],["band",0]]]},rgb:{type:"function",method:Hk}};function Hk(e,t){const r=e[0].rasterData,n=e[1].rasterData,i=e[2].rasterData,o=[],[a,s]=(t==null?void 0:t.countCut)||[2,98],u=(t==null?void 0:t.RMinMax)||Ra(r,a,s),l=(t==null?void 0:t.GMinMax)||Ra(n,a,s),f=(t==null?void 0:t.BMinMax)||Ra(i,a,s);for(let c=0;cs-u),i=n.length,o=n[Math.ceil(i*t/100)],a=n[Math.ceil(i*r/100)];return[o,a]}var jk=Object.defineProperty,Xk=Object.defineProperties,Wk=Object.getOwnPropertyDescriptors,Ym=Object.getOwnPropertySymbols,Gk=Object.prototype.hasOwnProperty,Yk=Object.prototype.propertyIsEnumerable,Zm=(e,t,r)=>t in e?jk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zk=(e,t)=>{for(var r in t||(t={}))Gk.call(t,r)&&Zm(e,r,t[r]);if(Ym)for(var r of Ym(t))Yk.call(t,r)&&Zm(e,r,t[r]);return e},qk=(e,t)=>Xk(e,Wk(t)),aA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())});function Bp(e,t,r){return aA(this,null,function*(){if(e.length===0)return{rasterData:[0],width:1,heigh:1};const n=yield Promise.all(e.map(({data:u,bands:l=[0]})=>t(u,l))),i=[];n.forEach(u=>{Array.isArray(u)?i.push(...u):i.push(u)});const{width:o,height:a}=i[0];let s;switch(typeof r){case"function":s=r(i);break;case"object":Array.isArray(r)?s={rasterData:au(r,i)}:s=Kk(r,i);break;default:s={rasterData:i[0].rasterData}}return qk(Zk({},s),{width:o,height:a})})}function Kk(e,t){const r=Vk[e.type];if(r.type==="function")return r.method(t,e==null?void 0:e.options);if(r.type==="operation")return e.type==="rgb"?Qk(r.expression,t):{rasterData:au(r.expression,t)}}function Qk(e,t){e.r===void 0&&console.warn("Channel R lost in Operation! Use band[0] to fill!"),e.g===void 0&&console.warn("Channel G lost in Operation! Use band[0] to fill!"),e.b===void 0&&console.warn("Channel B lost in Operation! Use band[0] to fill!");const r=au(e.r||["band",0],t),n=au(e.g||["band",0],t),i=au(e.b||["band",0],t);return[r,n,i]}function Rd(e,t,r,n){return aA(this,null,function*(){const i=yield Bp(e,t,r);n(null,{data:i})})}function Jk(e,t){const{extent:r=[121.168,30.2828,121.384,30.4219],coordinates:n,width:i,height:o,min:a,max:s,format:u,operation:l}=t;let f,c,h;if(u===void 0||YT(e))f=Array.from(e),c=i,h=o;else{const v=Array.isArray(e)?e:[e];f=Bp(v,u,l)}const d=wu(n,r);return{_id:1,dataArray:[{_id:1,data:f,width:c,height:h,min:a,max:s,coordinates:d}]}}function qm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function he(e){for(var t=1;t{a({framebuffer:n.getWriteFBO(),color:[0,0,0,0],depth:1,stencil:0});const l=he({u_BloomFinal:0,u_Texture:n.getReadFBO(),u_ViewportSize:[s,u]},this.convertOptionsToUniforms(this.optionsToUpdate));r&&(l.u_BloomFinal=1,l.u_Texture2=r),this.model.draw({uniforms:l})})}isEnabled(){return this.enabled}setEnabled(t){this.enabled=t}setRenderToScreen(t){this.renderToScreen=t}updateOptions(t){this.optionsToUpdate=he(he({},this.optionsToUpdate),t)}setupShaders(){throw new Error("Method not implemented.")}convertOptionsToUniforms(t){const r={};return Object.keys(t).forEach(n=>{r9(t[n])||(r[`u_${n9(t9(n))}`]=t[n])}),r}}function i9(e){let t=0;switch(e){case"vec2":case"ivec2":t=2;break;case"vec3":case"ivec3":t=3;break;case"vec4":case"ivec4":case"mat2":t=4;break;case"mat3":t=9;break;case"mat4":t=16;break}return t}const sA=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function Km(e,t=!1){const r={};return e=e.replace(sA,(n,i,o)=>{const a=o.split(":"),s=a[0].trim();let u="";switch(a.length>1&&(u=a[1].trim()),i){case"bool":u=u==="true";break;case"float":case"int":u=Number(u);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":u?u=u.replace("[","").replace("]","").split(",").reduce((l,f)=>(l.push(Number(f.trim())),l),[]):u=new Array(i9(i)).fill(0);break}return r[s]=u,`${t?"uniform ":""}${i} ${s}; `}),{content:e,uniforms:r}}function kh(e){let{content:t,uniforms:r}=Km(e,!0);return t=t.replace(/(\s*uniform\s*.*\s*){((?:\s*.*\s*)*?)};/g,(n,i,o)=>{o=o.trim().replace(/^.*$/gm,u=>`uniform ${u}`);const{content:a,uniforms:s}=Km(o);return Object.assign(r,s),`${i}{ ${a} };`}),{content:t,uniforms:r}}function Qm(e){const t={};return e.replace(sA,(r,n,i)=>{const o=i.trim();return t[o]?"":(t[o]=!0,`uniform ${n} ${o}; `)})}const fo={ProjectionMatrix:"u_ProjectionMatrix",ViewMatrix:"u_ViewMatrix",ViewProjectionMatrix:"u_ViewProjectionMatrix",Zoom:"u_Zoom",ZoomScale:"u_ZoomScale",FocalDistance:"u_FocalDistance",CameraPosition:"u_CameraPosition"};let _c=function(e){return e.TOPRIGHT="topright",e.TOPLEFT="topleft",e.BOTTOMRIGHT="bottomright",e.BOTTOMLEFT="bottomleft",e.TOPCENTER="topcenter",e.BOTTOMCENTER="bottomcenter",e.LEFTCENTER="leftcenter",e.RIGHTCENTER="rightcenter",e.LEFTTOP="lefttop",e.RIGHTTOP="righttop",e.LEFTBOTTOM="leftbottom",e.RIGHTBOTTOM="rightbottom",e}({}),vc=function(e){return e[e.LNGLAT=1]="LNGLAT",e[e.LNGLAT_OFFSET=2]="LNGLAT_OFFSET",e[e.VECTOR_TILE=3]="VECTOR_TILE",e[e.IDENTITY=4]="IDENTITY",e[e.METER_OFFSET=5]="METER_OFFSET",e}({});const ua={CoordinateSystem:"u_CoordinateSystem",ViewportCenter:"u_ViewportCenter",ViewportCenterProjection:"u_ViewportCenterProjection",PixelsPerDegree:"u_PixelsPerDegree",PixelsPerDegree2:"u_PixelsPerDegree2",PixelsPerMeter:"u_PixelsPerMeter"};var Fr={MapInitStart:"mapInitStart",LayerInitStart:"layerInitStart",LayerInitEnd:"layerInitEnd",SourceInitStart:"sourceInitStart",SourceInitEnd:"sourceInitEnd",ScaleInitStart:"scaleInitStart",ScaleInitEnd:"scaleInitEnd",MappingStart:"mappingStart",MappingEnd:"mappingEnd",BuildModelStart:"buildModelStart",BuildModelEnd:"buildModelEnd"};let cn=function(e){return e.Hover="hover",e.Click="click",e.Select="select",e.Active="active",e.Drag="drag",e}({}),Ui=function(e){return e.normal="normal",e.additive="additive",e.subtractive="subtractive",e.min="min",e.max="max",e.none="none",e}({}),go=function(e){return e.MULTIPLE="MULTIPLE",e.SINGLE="SINGLE",e}({}),uf=function(e){return e.AND="and",e.OR="or",e}({}),jr=function(e){return e.INIT="init",e.UPDATE="update",e}({}),Xt=function(e){return e.LINEAR="linear",e.SEQUENTIAL="sequential",e.POWER="power",e.LOG="log",e.IDENTITY="identity",e.TIME="time",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.CAT="cat",e.DIVERGING="diverging",e.CUSTOM="threshold",e}({}),la=function(e){return e.CONSTANT="constant",e.VARIABLE="variable",e}({}),qe=function(e){return e[e.Attribute=0]="Attribute",e[e.InstancedAttribute=1]="InstancedAttribute",e[e.Uniform=2]="Uniform",e}({});const Jm=["mapload","mapchange","mapAfterFrameChange"];var Dp={exports:{}};Dp.exports=Bu;Dp.exports.default=Bu;var Ca=1e20;function Bu(e,t,r,n,i,o){this.fontSize=e||24,this.buffer=t===void 0?3:t,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var a=this.size=this.fontSize+this.buffer*2,s=a+this.buffer*2;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.useMetrics=this.ctx.measureText("A").actualBoundingBoxLeft!==void 0,this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function o9(e,t,r,n,i,o,a){o.fill(Ca,0,t*r),a.fill(0,0,t*r);for(var s=(t-n)/2,u=0;u-1);u++,o[u]=s,a[u]=l,a[u+1]=Ca}for(s=0,u=0;s{if(!o[c]){const d=t(c,h);l+Rs>i&&(l=0,u++),o[c]={x:l,y:s+u*Rs,width:Rs,height:Rs,advance:d},l+=Rs}});const f=r+n*2;return{mapping:o,xOffset:l,yOffset:s+u*f,canvasHeight:uA(s+(u+1)*f)}}function c9(e,t,r){let n=0,i=0,o=0,a=[];const s={};for(const l of e)if(!s[l.id]){const{size:f}=l;n+f+t>r&&(rg(s,a,i),n=0,i=o+i+t,o=0,a=[]),a.push({icon:l,xOffset:n}),n=n+f+t,o=Math.max(o,f)}a.length>0&&rg(s,a,i);const u=uA(o+i+t);return{mapping:s,canvasHeight:u}}function rg(e,t,r){for(const n of t){const{icon:i,xOffset:o}=n;e[i.id]=he(he({},i),{},{x:o,y:r,image:i.image,width:i.width,height:i.height})}}function uA(e){return Math.pow(2,Math.ceil(Math.log2(e)))}const f9=y9(),h9="sans-serif",d9="normal",p9=24,_9=3,v9=.25,m9=8,ng=1024,g9=1,ig=1,E9=3;function y9(){const e=[];for(let t=32;t<128;t++)e.push(String.fromCharCode(t));return e}function og(e,t,r,n){e.font=`${n} ${r}px ${t}`,e.fillStyle="black",e.textBaseline="middle"}function ag(e,t){for(let r=0;r{this.iconFontGlyphs[r.name]=r.unicode})}addIconFont(t,r){this.iconFontMap.set(t,r)}getIconFontKey(t){return this.iconFontMap.get(t)||t}getGlyph(t){return this.iconFontGlyphs[t]?String.fromCharCode(parseInt(this.iconFontGlyphs[t],16)):""}setFontOptions(t){this.fontOptions=he(he({},this.fontOptions),t),this.key=this.getKey();const r=this.getNewChars(this.key,this.fontOptions.characterSet),n=this.cache.get(this.key);if(n&&r.length===0)return;const i=this.generateFontAtlas(this.key,r,n);this.fontAtlas=i,this.cache.set(this.key,i)}addFontFace(t,r){const n=document.createElement("style");n.type="text/css",n.innerText=` @font-face{ font-family: '${t}'; src: url('${r}') format('woff2'), url('${r}') format('woff'), url('${r}') format('truetype'); }`,n.onload=()=>{if(document.fonts)try{document.fonts.load(`24px ${t}`,"L7text"),document.fonts.ready.then(()=>{this.emit("fontloaded",{fontFamily:t})})}catch(i){console.warn("当前环境不支持 document.fonts !"),console.warn("当前环境不支持 iconfont !"),console.warn(i)}},document.getElementsByTagName("head")[0].appendChild(n)}destroy(){this.cache.clear(),this.iconFontMap.clear()}generateFontAtlas(t,r,n){const{fontFamily:i,fontWeight:o,fontSize:a,buffer:s,sdf:u,radius:l,cutoff:f,iconfont:c}=this.fontOptions;let h=n&&n.data;h||(h=window.document.createElement("canvas"),h.width=ng);const d=h.getContext("2d",{willReadFrequently:!0});og(d,i,a,o);const{mapping:p,canvasHeight:v,xOffset:g,yOffset:y}=l9(he({getFontWidth:R=>d.measureText(R).width,fontHeight:a*ig,buffer:s,characterSet:r,maxCanvasWidth:ng},n&&{mapping:n.mapping,xOffset:n.xOffset,yOffset:n.yOffset})),S=d.getImageData(0,0,h.width,h.height);if(h.height=v,d.putImageData(S,0,0),og(d,i,a,o),u){const R=new u9(a,s,l,f,i,o),x=d.getImageData(0,0,R.size,R.size);for(const M of r){if(c){const $=String.fromCharCode(parseInt(M.replace("&#x","").replace(";",""),16)),F=R.draw($);ag(F,x)}else ag(R.draw(M),x);d.putImageData(x,p[M].x,p[M].y)}}else for(const R of r)d.fillText(R,p[R].x,p[R].y+a*g9);return{xOffset:g,yOffset:y,mapping:p,data:h,width:h.width,height:h.height}}getKey(){const{fontFamily:t,fontWeight:r}=this.fontOptions;return`${t}_${r}`}getNewChars(t,r){const n=this.cache.get(t);if(!n)return r;const i=[],o=n.mapping,a=new Set(Object.keys(o));return new Set(r).forEach(u=>{a.has(u)||i.push(u)}),i}}function sg(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(l){return void r(l)}s.done?t(u):Promise.resolve(u).then(n,i)}function ve(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(u){sg(o,n,i,a,s,"next",u)}function s(u){sg(o,n,i,a,s,"throw",u)}a(void 0)})}}const A9=3,ug=1024,Cs=64;class S9 extends Bn.EventEmitter{constructor(...t){super(...t),E(this,"canvasHeight",128),E(this,"texture",void 0),E(this,"canvas",void 0),E(this,"iconData",void 0),E(this,"iconMap",void 0),E(this,"ctx",void 0),E(this,"loadingImageCount",0)}isLoading(){return this.loadingImageCount===0}init(){this.iconData=[],this.iconMap={},this.canvas=window.document.createElement("canvas"),this.canvas.width=128,this.canvas.height=128,this.ctx=this.canvas.getContext("2d")}addImage(t,r){var n=this;return ve(function*(){let i=new Image;n.loadingImageCount++,n.hasImage(t)?console.warn("Image Id already exists"):n.iconData.push({id:t,size:Cs}),n.updateIconMap(),i=yield n.loadImage(r);const o=n.iconData.find(a=>a.id===t);o&&(o.image=i,o.width=i.width,o.height=i.height),n.update()})()}addImageMini(t,r,n){const i=n.getSceneConfig().canvas;let o=i.createImage();if(this.loadingImageCount++,this.hasImage(t))throw new Error("Image Id already exists");this.iconData.push({id:t,size:Cs}),this.updateIconMap(),this.loadImageMini(r,i).then(a=>{o=a;const s=this.iconData.find(u=>u.id===t);s&&(s.image=o,s.width=o.width,s.height=o.height),this.update()})}getTexture(){return this.texture}getIconMap(){return this.iconMap}getCanvas(){return this.canvas}hasImage(t){return this.iconMap.hasOwnProperty(t)}removeImage(t){this.hasImage(t)&&(this.iconData=this.iconData.filter(r=>r.id!==t),delete this.iconMap[t],this.update())}destroy(){this.removeAllListeners("imageUpdate"),this.iconData=[],this.iconMap={}}loadImage(t){return new Promise((r,n)=>{if(t instanceof HTMLImageElement){r(t);return}const i=new Image;i.crossOrigin="anonymous",i.onload=()=>{r(i)},i.onerror=()=>{n(new Error("Could not load image at "+t))},i.src=t instanceof File?URL.createObjectURL(t):t})}update(){this.updateIconMap(),this.updateIconAtlas(),this.loadingImageCount--,this.loadingImageCount===0&&this.emit("imageUpdate")}updateIconAtlas(){this.canvas.width=ug,this.canvas.height=this.canvasHeight,Object.keys(this.iconMap).forEach(t=>{const{x:r,y:n,image:i,width:o=64,height:a=64}=this.iconMap[t],u=Math.max(o,a)/Cs,l=a/u,f=o/u;i&&this.ctx.drawImage(i,r+(Cs-f)/2,n+(Cs-l)/2,f,l)})}updateIconMap(){const{mapping:t,canvasHeight:r}=c9(this.iconData,A9,ug);this.iconMap=t,this.canvasHeight=r}loadImageMini(t,r){return new Promise((n,i)=>{const o=r.createImage();o.crossOrigin="anonymous",o.onload=()=>{n(o)},o.onerror=()=>{i(new Error("Could not load image at "+t))},o.src=t})}}var Wr=1e-6,Fn=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Up(){var e=new Fn(16);return Fn!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function x9(e,t,r,n,i,o,a,s,u,l,f,c,h,d,p,v){var g=new Fn(16);return g[0]=e,g[1]=t,g[2]=r,g[3]=n,g[4]=i,g[5]=o,g[6]=a,g[7]=s,g[8]=u,g[9]=l,g[10]=f,g[11]=c,g[12]=h,g[13]=d,g[14]=p,g[15]=v,g}function lA(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],f=t[8],c=t[9],h=t[10],d=t[11],p=t[12],v=t[13],g=t[14],y=t[15],S=r*s-n*a,R=r*u-i*a,x=r*l-o*a,M=n*u-i*s,$=n*l-o*s,F=i*l-o*u,Y=f*v-c*p,ge=f*g-h*p,q=f*y-d*p,k=c*g-h*v,G=c*y-d*v,K=h*y-d*g,ce=S*K-R*G+x*k+M*q-$*ge+F*Y;return ce?(ce=1/ce,e[0]=(s*K-u*G+l*k)*ce,e[1]=(i*G-n*K-o*k)*ce,e[2]=(v*F-g*$+y*M)*ce,e[3]=(h*$-c*F-d*M)*ce,e[4]=(u*q-a*K-l*ge)*ce,e[5]=(r*K-i*q+o*ge)*ce,e[6]=(g*x-p*F-y*R)*ce,e[7]=(f*F-h*x+d*R)*ce,e[8]=(a*G-s*q+l*Y)*ce,e[9]=(n*q-r*G-o*Y)*ce,e[10]=(p*$-v*x+y*S)*ce,e[11]=(c*x-f*$-d*S)*ce,e[12]=(s*ge-a*k-u*Y)*ce,e[13]=(r*k-n*ge+i*Y)*ce,e[14]=(v*R-p*M-g*S)*ce,e[15]=(f*M-c*R+h*S)*ce,e):null}function Oa(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],f=t[7],c=t[8],h=t[9],d=t[10],p=t[11],v=t[12],g=t[13],y=t[14],S=t[15],R=r[0],x=r[1],M=r[2],$=r[3];return e[0]=R*n+x*s+M*c+$*v,e[1]=R*i+x*u+M*h+$*g,e[2]=R*o+x*l+M*d+$*y,e[3]=R*a+x*f+M*p+$*S,R=r[4],x=r[5],M=r[6],$=r[7],e[4]=R*n+x*s+M*c+$*v,e[5]=R*i+x*u+M*h+$*g,e[6]=R*o+x*l+M*d+$*y,e[7]=R*a+x*f+M*p+$*S,R=r[8],x=r[9],M=r[10],$=r[11],e[8]=R*n+x*s+M*c+$*v,e[9]=R*i+x*u+M*h+$*g,e[10]=R*o+x*l+M*d+$*y,e[11]=R*a+x*f+M*p+$*S,R=r[12],x=r[13],M=r[14],$=r[15],e[12]=R*n+x*s+M*c+$*v,e[13]=R*i+x*u+M*h+$*g,e[14]=R*o+x*l+M*d+$*y,e[15]=R*a+x*f+M*p+$*S,e}function mc(e,t,r){var n=r[0],i=r[1],o=r[2],a,s,u,l,f,c,h,d,p,v,g,y;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(a=t[0],s=t[1],u=t[2],l=t[3],f=t[4],c=t[5],h=t[6],d=t[7],p=t[8],v=t[9],g=t[10],y=t[11],e[0]=a,e[1]=s,e[2]=u,e[3]=l,e[4]=f,e[5]=c,e[6]=h,e[7]=d,e[8]=p,e[9]=v,e[10]=g,e[11]=y,e[12]=a*n+f*i+p*o+t[12],e[13]=s*n+c*i+v*o+t[13],e[14]=u*n+h*i+g*o+t[14],e[15]=l*n+d*i+y*o+t[15]),e}function gc(e,t,r){var n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function kp(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[4],a=t[5],s=t[6],u=t[7],l=t[8],f=t[9],c=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+l*n,e[5]=a*i+f*n,e[6]=s*i+c*n,e[7]=u*i+h*n,e[8]=l*i-o*n,e[9]=f*i-a*n,e[10]=c*i-s*n,e[11]=h*i-u*n,e}function cA(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],u=t[3],l=t[8],f=t[9],c=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-l*n,e[1]=a*i-f*n,e[2]=s*i-c*n,e[3]=u*i-h*n,e[8]=o*n+l*i,e[9]=a*n+f*i,e[10]=s*n+c*i,e[11]=u*n+h*i,e}function fA(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],u=t[3],l=t[4],f=t[5],c=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+l*n,e[1]=a*i+f*n,e[2]=s*i+c*n,e[3]=u*i+h*n,e[4]=l*i-o*n,e[5]=f*i-a*n,e[6]=c*i-s*n,e[7]=h*i-u*n,e}function b9(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n),e}var R9=b9;function lg(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],l=e[7],f=e[8],c=e[9],h=e[10],d=e[11],p=e[12],v=e[13],g=e[14],y=e[15],S=t[0],R=t[1],x=t[2],M=t[3],$=t[4],F=t[5],Y=t[6],ge=t[7],q=t[8],k=t[9],G=t[10],K=t[11],ce=t[12],Pe=t[13],Xe=t[14],Je=t[15];return Math.abs(r-S)<=Wr*Math.max(1,Math.abs(r),Math.abs(S))&&Math.abs(n-R)<=Wr*Math.max(1,Math.abs(n),Math.abs(R))&&Math.abs(i-x)<=Wr*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-M)<=Wr*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(a-$)<=Wr*Math.max(1,Math.abs(a),Math.abs($))&&Math.abs(s-F)<=Wr*Math.max(1,Math.abs(s),Math.abs(F))&&Math.abs(u-Y)<=Wr*Math.max(1,Math.abs(u),Math.abs(Y))&&Math.abs(l-ge)<=Wr*Math.max(1,Math.abs(l),Math.abs(ge))&&Math.abs(f-q)<=Wr*Math.max(1,Math.abs(f),Math.abs(q))&&Math.abs(c-k)<=Wr*Math.max(1,Math.abs(c),Math.abs(k))&&Math.abs(h-G)<=Wr*Math.max(1,Math.abs(h),Math.abs(G))&&Math.abs(d-K)<=Wr*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(p-ce)<=Wr*Math.max(1,Math.abs(p),Math.abs(ce))&&Math.abs(v-Pe)<=Wr*Math.max(1,Math.abs(v),Math.abs(Pe))&&Math.abs(g-Xe)<=Wr*Math.max(1,Math.abs(g),Math.abs(Xe))&&Math.abs(y-Je)<=Wr*Math.max(1,Math.abs(y),Math.abs(Je))}function Zs(){var e=new Fn(3);return Fn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Wn(e,t,r){var n=new Fn(3);return n[0]=e,n[1]=t,n[2]=r,n}function C9(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function O9(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function qs(e,t){var r=t[0],n=t[1],i=t[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function I9(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function M9(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[0],s=r[1],u=r[2];return e[0]=i*u-o*s,e[1]=o*a-n*u,e[2]=n*s-i*a,e}function Ml(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,e}function cg(e,t){var r=e[0],n=e[1],i=e[2],o=t[0],a=t[1],s=t[2],u=Math.sqrt(r*r+n*n+i*i),l=Math.sqrt(o*o+a*a+s*s),f=u*l,c=f&&I9(e,t)/f;return Math.acos(Math.min(Math.max(c,-1),1))}var fg=C9;(function(){var e=Zs();return function(t,r,n,i,o,a){var s,u;for(r||(r=3),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e}function Id(e,t){return e[0]*t[0]+e[1]*t[1]}function F9(e,t,r,n){var i=t[0],o=t[1];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e}var dA=Od;(function(){var e=hn();return function(t,r,n,i,o,a){var s,u;for(r||(r=2),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;sr.controlOption.name===t)}removeControl(t){const r=this.controls.indexOf(t);return r>-1&&this.controls.splice(r,1),t.remove(),this}addControls(){this.unAddControls.forEach(t=>{t.addTo(this.scene),this.controls.push(t)}),this.unAddControls=[]}destroy(){for(const t of this.controls)t.remove();this.controls=[],this.clearControlPos()}initControlPos(){const t=this.controlCorners={},r="l7-",n=this.controlContainer=yn("div",r+"control-container",this.container);function i(a=[]){const s=a.map(u=>r+u).join(" ");t[a.filter(u=>!["row","column"].includes(u)).join("")]=yn("div",s,n)}function o(a){return[...a.replace(/^(top|bottom|left|right|center)/,"$1-").split("-"),D9[a]]}Object.values(_c).forEach(a=>{i(o(a))}),this.checkCornerOverlap()}clearControlPos(){for(const t in this.controlCorners)this.controlCorners[t]&&hc(this.controlCorners[t]);this.controlContainer&&hc(this.controlContainer)}checkCornerOverlap(){const t=window.MutationObserver;if(t)for(const r of Object.keys(this.controlCorners)){const n=r.match(/^(top|bottom)(left|right)$/);if(n){const[,i,o]=n,a=this.controlCorners[`${i}${o}`];new t(([{target:u}])=>{a&&(a.style[i]=u.clientHeight+"px")}).observe(this.controlCorners[`${o}${i}`],{childList:!0,attributes:!0})}}}}class k9{constructor(){E(this,"container",void 0),E(this,"scene",void 0),E(this,"mapsService",void 0),E(this,"markers",[]),E(this,"markerLayers",[]),E(this,"unAddMarkers",[]),E(this,"unAddMarkerLayers",[])}addMarkerLayer(t){this.mapsService.map&&this.mapsService.getMarkerContainer()?(this.markerLayers.push(t),t.addTo(this.scene)):this.unAddMarkerLayers.push(t)}removeMarkerLayer(t){t.destroy(),this.markerLayers.indexOf(t);const r=this.markerLayers.indexOf(t);r>-1&&this.markerLayers.splice(r,1)}addMarker(t){this.mapsService.map&&this.mapsService.getMarkerContainer()?(this.markers.push(t),t.addTo(this.scene)):this.unAddMarkers.push(t)}addMarkers(){this.unAddMarkers.forEach(t=>{t.addTo(this.scene),this.markers.push(t)}),this.unAddMarkers=[]}addMarkerLayers(){this.unAddMarkerLayers.forEach(t=>{this.markerLayers.push(t),t.addTo(this.scene)}),this.unAddMarkers=[]}removeMarker(t){t.remove(),this.markers.indexOf(t);const r=this.markers.indexOf(t);r>-1&&this.markers.splice(r,1)}removeAllMarkers(){this.destroy()}init(t){this.scene=t,this.mapsService=t.mapService}destroy(){this.markers.forEach(t=>{t.remove()}),this.markers=[],this.markerLayers.forEach(t=>{t.destroy()}),this.markerLayers=[]}removeMakerLayerMarker(t){t.destroy()}}class $9{constructor(){E(this,"scene",void 0),E(this,"mapsService",void 0),E(this,"popups",[]),E(this,"unAddPopups",[])}get isMarkerReady(){return this.mapsService.map&&this.mapsService.getMarkerContainer()}removePopup(t){t!=null&&t.isOpen()&&t.remove();const r=this.popups.indexOf(t);r>-1&&this.popups.splice(r,1);const n=this.unAddPopups.indexOf(t);n>-1&&this.unAddPopups.splice(n,1)}destroy(){this.popups.forEach(t=>t.remove())}addPopup(t){t&&t.getOptions().autoClose&&[...this.popups,...this.unAddPopups].forEach(r=>{r.getOptions().autoClose&&this.removePopup(r)}),this.isMarkerReady?(t.addTo(this.scene),this.popups.push(t)):this.unAddPopups.push(t),t.on("close",()=>{this.removePopup(t)})}initPopup(){this.unAddPopups.length&&this.unAddPopups.forEach(t=>{this.addPopup(t),this.unAddPopups=[]})}init(t){this.scene=t,this.mapsService=t.mapService}}const z9={MapToken:"您正在使用 Demo 测试 Token, 生产环境务必自行注册 Token 确保服务稳定 高德地图申请地址 https://lbs.amap.com/api/javascript-api/guide/abc/prepare Mapbox地图申请地址 https://docs.mapbox.com/help/glossary/access-token/",SDK:"请确认引入了mapbox-gl api且在L7之前引入"},{merge:V9}=Sr,H9={id:"map",logoPosition:"bottomleft",logoVisible:!0,antialias:!0,stencil:!0,preserveDrawingBuffer:!1,pickBufferScale:1,fitBoundsOptions:{animate:!1}},j9={colors:["rgb(103,0,31)","rgb(178,24,43)","rgb(214,96,77)","rgb(244,165,130)","rgb(253,219,199)","rgb(247,247,247)","rgb(209,229,240)","rgb(146,197,222)","rgb(67,147,195)","rgb(33,102,172)","rgb(5,48,97)"],size:10,shape:"circle",scales:{},shape2d:["circle","triangle","square","pentagon","hexagon","octogon","hexagram","rhombus","vesica"],shape3d:["cylinder","triangleColumn","hexagonColumn","squareColumn"],minZoom:-1,maxZoom:24,visible:!0,autoFit:!1,pickingBuffer:0,enablePropagation:!1,zIndex:0,blend:"normal",maskLayers:[],enableMask:!0,maskOperation:uf.AND,pickedFeatureID:-1,enableMultiPassRenderer:!1,enablePicking:!0,active:!1,activeColor:"#2f54eb",enableHighlight:!1,enableSelect:!1,highlightColor:"#2f54eb",activeMix:0,selectColor:"blue",selectMix:0,enableLighting:!1,animateOption:{enable:!1,interval:.2,duration:4,trailLength:.15},forward:!0};class X9{constructor(){E(this,"sceneConfigCache",{}),E(this,"layerConfigCache",{}),E(this,"layerAttributeConfigCache",{})}getSceneConfig(t){return this.sceneConfigCache[t]}getSceneWarninfo(t){return z9[t]}setSceneConfig(t,r){this.sceneConfigCache[t]=he(he({},H9),r)}getLayerConfig(t){return this.layerConfigCache[t]}setLayerConfig(t,r,n){this.layerConfigCache[r]=he({},V9({},this.sceneConfigCache[t],j9,n))}getAttributeConfig(t){return this.layerAttributeConfigCache[t]}setAttributeConfig(t,r){this.layerAttributeConfigCache[t]=he(he({},this.layerAttributeConfigCache[t]),r)}clean(){this.sceneConfigCache={},this.layerConfigCache={}}}const zh=Math.PI/180,W9=512,hg=4003e4;function dg({latitude:e=0,zoom:t=0,scale:r,highPrecision:n=!1,flipY:i=!1}){r=r!==void 0?r:Math.pow(2,t);const o={},a=W9*r,s=Math.cos(e*zh),u=a/360,l=u/s,f=a/hg/s;if(o.pixelsPerMeter=[f,-f,f],o.metersPerPixel=[1/f,-1/f,1/f],o.pixelsPerDegree=[u,-l,f],o.degreesPerPixel=[1/u,-1/l,1/f],n){const c=zh*Math.tan(e*zh)/s,h=u*c/2,d=a/hg*c,p=d/l*f;o.pixelsPerDegree2=[0,-h,d],o.pixelsPerMeter2=[p,0,p],i&&(o.pixelsPerDegree2[1]=-o.pixelsPerDegree2[1],o.pixelsPerMeter2[1]=-o.pixelsPerMeter2[1])}return i&&(o.pixelsPerMeter[1]=-o.pixelsPerMeter[1],o.metersPerPixel[1]=-o.metersPerPixel[1],o.pixelsPerDegree[1]=-o.pixelsPerDegree[1],o.degreesPerPixel[1]=-o.degreesPerPixel[1]),o}const G9=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];class Y9{constructor(t){E(this,"needRefresh",!0),E(this,"coordinateSystem",void 0),E(this,"viewportCenter",void 0),E(this,"viewportCenterProjection",void 0),E(this,"pixelsPerDegree",void 0),E(this,"pixelsPerDegree2",void 0),E(this,"pixelsPerMeter",void 0),this.cameraService=t}refresh(t){const r=this.cameraService.getZoom(),n=t||this.cameraService.getCenter(),{pixelsPerMeter:i,pixelsPerDegree:o}=dg({latitude:n[1],zoom:r});this.viewportCenter=n,this.viewportCenterProjection=[0,0,0,0],this.pixelsPerMeter=i,this.pixelsPerDegree=o,this.pixelsPerDegree2=[0,0,0],this.coordinateSystem===vc.LNGLAT?this.cameraService.setViewProjectionMatrix(void 0):this.coordinateSystem===vc.LNGLAT_OFFSET&&this.calculateLnglatOffset(n,r),this.needRefresh=!1}getCoordinateSystem(){return this.coordinateSystem}setCoordinateSystem(t){this.coordinateSystem=t}getViewportCenter(){return this.viewportCenter}getViewportCenterProjection(){return this.viewportCenterProjection}getPixelsPerDegree(){return this.pixelsPerDegree}getPixelsPerDegree2(){return this.pixelsPerDegree2}getPixelsPerMeter(){return this.pixelsPerMeter}calculateLnglatOffset(t,r,n,i){const{pixelsPerMeter:o,pixelsPerDegree:a,pixelsPerDegree2:s}=dg({latitude:t[1],zoom:r,scale:n,flipY:i,highPrecision:!0});let u=this.cameraService.getViewMatrix();const l=this.cameraService.getProjectionMatrix();let f=Oa([],l,u);const c=this.cameraService.projectFlat([Math.fround(t[0]),Math.fround(t[1])],Math.pow(2,r));this.viewportCenterProjection=$p([],[c[0],c[1],0,1],f),u=this.cameraService.getViewMatrixUncentered()||u,f=Oa([],l,u),f=Oa([],f,G9),this.cameraService.setViewProjectionMatrix(f),this.pixelsPerMeter=o,this.pixelsPerDegree=a,this.pixelsPerDegree2=s}}class Z9 extends Bn.EventEmitter{constructor(...t){super(...t),E(this,"renderMap",new Map),E(this,"enable",!1),E(this,"renderEnable",!1),E(this,"cacheLogs",{})}setEnable(t){this.enable=!!t}log(t,r){if(!this.enable)return;const n=t.split(".");let i=null;n.forEach((o,a)=>{i!==null?(i[o]||(i[o]={}),a!==n.length-1&&(i=i[o])):(this.cacheLogs[o]||(this.cacheLogs[o]={}),a!==n.length-1&&(i=this.cacheLogs[o])),a===n.length-1&&(i[o]=he(he({time:Date.now()},i[o]),r))})}getLog(t){switch(typeof t){case"string":return this.cacheLogs[t];case"object":return t.map(r=>this.cacheLogs[r]).filter(r=>r!==void 0);case"undefined":return this.cacheLogs}}removeLog(t){delete this.cacheLogs[t]}generateRenderUid(){return this.renderEnable?lU():""}renderDebug(t){this.renderEnable=t}renderStart(t){if(!this.renderEnable||!this.enable)return;const r=this.renderMap.get(t)||{};this.renderMap.set(t,he(he({},r),{},{renderUid:t,renderStart:Date.now()}))}renderEnd(t){if(!this.renderEnable||!this.enable)return;const r=this.renderMap.get(t);if(r){const n=r.renderStart,i=Date.now();this.emit("renderEnd",he(he({},r),{},{renderEnd:i,renderDuration:i-n})),this.renderMap.delete(t)}}destroy(){this.cacheLogs=null,this.renderMap.clear()}}var pA={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; * Licensed under the MIT license */(function(e){(function(t,r,n,i){var o=["","webkit","Moz","MS","ms","o"],a=r.createElement("div"),s="function",u=Math.round,l=Math.abs,f=Date.now;function c(A,O,H){return setTimeout(R(A,H),O)}function h(A,O,H){return Array.isArray(A)?(d(A,H[O],H),!0):!1}function d(A,O,H){var ue;if(A)if(A.forEach)A.forEach(O,H);else if(A.length!==i)for(ue=0;ue\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Mt=t.console&&(t.console.warn||t.console.log);return Mt&&Mt.call(t.console,ue,Qe),A.apply(this,arguments)}}var v;typeof Object.assign!="function"?v=function(O){if(O===i||O===null)throw new TypeError("Cannot convert undefined or null to object");for(var H=Object(O),ue=1;ue-1}function q(A){return A.trim().split(/\s+/g)}function k(A,O,H){if(A.indexOf&&!H)return A.indexOf(O);for(var ue=0;ueNr[O]}),ue}function ce(A,O){for(var H,ue,Le=O[0].toUpperCase()+O.slice(1),Qe=0;Qe1&&!H.firstMultiple?H.firstMultiple=xi(O):Le===1&&(H.firstMultiple=!1);var Qe=H.firstInput,Mt=H.firstMultiple,br=Mt?Mt.center:Qe.center,Mr=O.center=Kt(ue);O.timeStamp=f(),O.deltaTime=O.timeStamp-Qe.timeStamp,O.angle=qi(br,Mr),O.distance=on(br,Mr),wo(H,O),O.offsetDirection=$n(O.deltaX,O.deltaY);var Nr=Kr(O.deltaTime,O.deltaX,O.deltaY);O.overallVelocityX=Nr.x,O.overallVelocityY=Nr.y,O.overallVelocity=l(Nr.x)>l(Nr.y)?Nr.x:Nr.y,O.scale=Mt?Ki(Mt.pointers,ue):1,O.rotation=Mt?Br(Mt.pointers,ue):0,O.maxPointers=H.prevInput?O.pointers.length>H.prevInput.maxPointers?O.pointers.length:H.prevInput.maxPointers:O.pointers.length,ui(H,O);var xn=A.element;Y(O.srcEvent.target,xn)&&(xn=O.srcEvent.target),O.target=xn}function wo(A,O){var H=O.center,ue=A.offsetDelta||{},Le=A.prevDelta||{},Qe=A.prevInput||{};(O.eventType===Gt||Qe.eventType===le)&&(Le=A.prevDelta={x:Qe.deltaX||0,y:Qe.deltaY||0},ue=A.offsetDelta={x:H.x,y:H.y}),O.deltaX=Le.x+(H.x-ue.x),O.deltaY=Le.y+(H.y-ue.y)}function ui(A,O){var H=A.lastInterval||O,ue=O.timeStamp-H.timeStamp,Le,Qe,Mt,br;if(O.eventType!=ze&&(ue>xr||H.velocity===i)){var Mr=O.deltaX-H.deltaX,Nr=O.deltaY-H.deltaY,xn=Kr(ue,Mr,Nr);Qe=xn.x,Mt=xn.y,Le=l(xn.x)>l(xn.y)?xn.x:xn.y,br=$n(Mr,Nr),A.lastInterval=O}else Le=H.velocity,Qe=H.velocityX,Mt=H.velocityY,br=H.direction;O.velocity=Le,O.velocityX=Qe,O.velocityY=Mt,O.direction=br}function xi(A){for(var O=[],H=0;H=l(O)?A<0?Ae:Dt:O<0?Et:zt}function on(A,O,H){H||(H=$r);var ue=O[H[0]]-A[H[0]],Le=O[H[1]]-A[H[1]];return Math.sqrt(ue*ue+Le*Le)}function qi(A,O,H){H||(H=$r);var ue=O[H[0]]-A[H[0]],Le=O[H[1]]-A[H[1]];return Math.atan2(Le,ue)*180/Math.PI}function Br(A,O){return qi(O[1],O[0],dr)+qi(A[1],A[0],dr)}function Ki(A,O){return on(O[0],O[1],dr)/on(A[0],A[1],dr)}var bi={mousedown:Gt,mousemove:Xr,mouseup:le},Qa="mousedown",mf="mousemove mouseup";function Fo(){this.evEl=Qa,this.evWin=mf,this.pressed=!1,Jt.apply(this,arguments)}S(Fo,Jt,{handler:function(O){var H=bi[O.type];H&Gt&&O.button===0&&(this.pressed=!0),H&Xr&&O.which!==1&&(H=le),this.pressed&&(H&le&&(this.pressed=!1),this.callback(this.manager,H,{pointers:[O],changedPointers:[O],pointerType:wt,srcEvent:O}))}});var gf={pointerdown:Gt,pointermove:Xr,pointerup:le,pointercancel:ze,pointerout:ze},Ef={2:mt,3:It,4:wt,5:gt},Ja="pointerdown",es="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Ja="MSPointerDown",es="MSPointerMove MSPointerUp MSPointerCancel");function ts(){this.evEl=Ja,this.evWin=es,Jt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}S(ts,Jt,{handler:function(O){var H=this.store,ue=!1,Le=O.type.toLowerCase().replace("ms",""),Qe=gf[Le],Mt=Ef[O.pointerType]||O.pointerType,br=Mt==mt,Mr=k(H,O.pointerId,"pointerId");Qe&Gt&&(O.button===0||br)?Mr<0&&(H.push(O),Mr=H.length-1):Qe&(le|ze)&&(ue=!0),!(Mr<0)&&(H[Mr]=O,this.callback(this.manager,Qe,{pointers:H,changedPointers:[O],pointerType:Mt,srcEvent:O}),ue&&H.splice(Mr,1))}});var yf={touchstart:Gt,touchmove:Xr,touchend:le,touchcancel:ze},Qr="touchstart",Tf="touchstart touchmove touchend touchcancel";function Vu(){this.evTarget=Qr,this.evWin=Tf,this.started=!1,Jt.apply(this,arguments)}S(Vu,Jt,{handler:function(O){var H=yf[O.type];if(H===Gt&&(this.started=!0),!!this.started){var ue=Af.call(this,O,H);H&(le|ze)&&ue[0].length-ue[1].length===0&&(this.started=!1),this.callback(this.manager,H,{pointers:ue[0],changedPointers:ue[1],pointerType:mt,srcEvent:O})}}});function Af(A,O){var H=G(A.touches),ue=G(A.changedTouches);return O&(le|ze)&&(H=K(H.concat(ue),"identifier")),[H,ue]}var Sf={touchstart:Gt,touchmove:Xr,touchend:le,touchcancel:ze},xf="touchstart touchmove touchend touchcancel";function Bo(){this.evTarget=xf,this.targetIds={},Jt.apply(this,arguments)}S(Bo,Jt,{handler:function(O){var H=Sf[O.type],ue=bf.call(this,O,H);ue&&this.callback(this.manager,H,{pointers:ue[0],changedPointers:ue[1],pointerType:mt,srcEvent:O})}});function bf(A,O){var H=G(A.touches),ue=this.targetIds;if(O&(Gt|Xr)&&H.length===1)return ue[H[0].identifier]=!0,[H,H];var Le,Qe,Mt=G(A.changedTouches),br=[],Mr=this.target;if(Qe=H.filter(function(Nr){return Y(Nr.target,Mr)}),O===Gt)for(Le=0;Le-1&&ue.splice(Qe,1)};setTimeout(Le,Rf)}}function Cf(A){for(var O=A.srcEvent.clientX,H=A.srcEvent.clientY,ue=0;ue-1&&this.requireFail.splice(O,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(A){return!!this.simultaneous[A.id]},emit:function(A){var O=this,H=this.state;function ue(Le){O.manager.emit(Le,A)}H=Jn&&ue(O.options.event+Yu(H))},tryEmit:function(A){if(this.canEmit())return this.emit(A);this.state=An},canEmit:function(){for(var A=0;AO.threshold&&Le&O.direction},attrTest:function(A){return vn.prototype.attrTest.call(this,A)&&(this.state&an||!(this.state&an)&&this.directionTest(A))},emit:function(A){this.pX=A.deltaX,this.pY=A.deltaY;var O=Zu(A.direction);O&&(A.additionalEvent=this.options.event+O),this._super.emit.call(this,A)}});function Ci(){vn.apply(this,arguments)}S(Ci,vn,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[li]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.scale-1)>this.options.threshold||this.state&an)},emit:function(A){if(A.scale!==1){var O=A.scale<1?"in":"out";A.additionalEvent=this.options.event+O}this._super.emit.call(this,A)}});function Vo(){Vn.apply(this,arguments),this._timer=null,this._input=null}S(Vo,Vn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Gu]},process:function(A){var O=this.options,H=A.pointers.length===O.pointers,ue=A.distanceO.time;if(this._input=A,!ue||!H||A.eventType&(le|ze)&&!Le)this.reset();else if(A.eventType&Gt)this.reset(),this._timer=c(function(){this.state=zn,this.tryEmit()},O.time,this);else if(A.eventType&le)return zn;return An},reset:function(){clearTimeout(this._timer)},emit:function(A){this.state===zn&&(A&&A.eventType&le?this.manager.emit(this.options.event+"up",A):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function os(){vn.apply(this,arguments)}S(os,vn,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[li]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.rotation)>this.options.threshold||this.state&an)}});function as(){vn.apply(this,arguments)}S(as,vn,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Rt|ut,pointers:1},getTouchAction:function(){return zo.prototype.getTouchAction.call(this)},attrTest:function(A){var O=this.options.direction,H;return O&(Rt|ut)?H=A.overallVelocity:O&Rt?H=A.overallVelocityX:O&ut&&(H=A.overallVelocityY),this._super.attrTest.call(this,A)&&O&A.offsetDirection&&A.distance>this.options.threshold&&A.maxPointers==this.options.pointers&&l(H)>this.options.velocity&&A.eventType&le},emit:function(A){var O=Zu(A.offsetDirection);O&&this.manager.emit(this.options.event+O,A),this.manager.emit(this.options.event,A)}});function ei(){Vn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}S(ei,Vn,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ns]},process:function(A){var O=this.options,H=A.pointers.length===O.pointers,ue=A.distance{const n=this.interactionEvent(r);n.type=K9[n.type],n.type==="dragging"?this.indragging=!0:this.indragging=!1,this.emit(cn.Drag,n)}),E(this,"onHammer",r=>{r.srcEvent.stopPropagation();const n=this.interactionEvent(r);this.emit(cn.Hover,n)}),E(this,"onTouch",r=>{const n=r.touches[0];this.onHover({clientX:n.clientX,clientY:n.clientY,type:"touchstart"})}),E(this,"onTouchEnd",r=>{if(r.changedTouches.length>0){const n=r.changedTouches[0];this.onHover({clientX:n.clientX,clientY:n.clientY,type:"touchend"})}}),E(this,"onTouchMove",r=>{const n=r.changedTouches[0];this.onHover({clientX:n.clientX,clientY:n.clientY,type:"touchmove"})}),E(this,"onHover",r=>{const{clientX:n,clientY:i}=r;let o=n,a=i;const s=r.type,u=this.mapService.getMapContainer();if(u){const{top:f,left:c}=u.getBoundingClientRect();o=o-c-u.clientLeft,a=a-f-u.clientTop}const l=this.mapService.containerToLngLat([o,a]);if(s==="click"){this.isDoubleTap(o,a,l);return}if(s==="touch"){this.isDoubleTap(o,a,l);return}s!=="click"&&s!=="dblclick"&&this.emit(cn.Hover,{x:o,y:a,lngLat:l,type:s,target:r})}),this.container=t}init(){this.addEventListenerOnMap(),this.$containter=this.mapService.getMapContainer()}destroy(){this.hammertime&&this.hammertime.destroy(),this.removeEventListenerOnMap(),this.off(cn.Hover)}triggerHover({x:t,y:r}){this.emit(cn.Hover,{x:t,y:r})}triggerSelect(t){this.emit(cn.Select,{featureId:t})}triggerActive(t){this.emit(cn.Active,{featureId:t})}addEventListenerOnMap(){const t=this.mapService.getMapContainer();if(t){const r=new Os.Manager(t);r.add(new Os.Tap({event:"dblclick",taps:2})),r.add(new Os.Tap({event:"click"})),r.add(new Os.Pan({threshold:0,pointers:0})),r.add(new Os.Press({})),r.on("dblclick click",this.onHammer),r.on("panstart panmove panend pancancel",this.onDrag),t.addEventListener("touchstart",this.onTouch),t.addEventListener("touchend",this.onTouchEnd),t.addEventListener("mousemove",this.onHover),t.addEventListener("touchmove",this.onTouchMove),t.addEventListener("mousedown",this.onHover,!0),t.addEventListener("mouseup",this.onHover),t.addEventListener("contextmenu",this.onHover),this.hammertime=r}}removeEventListenerOnMap(){const t=this.mapService.getMapContainer();t&&(t.removeEventListener("mousemove",this.onHover),this.hammertime.off("dblclick click",this.onHammer),this.hammertime.off("panstart panmove panend pancancel",this.onDrag),t.removeEventListener("touchstart",this.onTouch),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("mousedown",this.onHover),t.removeEventListener("mouseup",this.onHover),t.removeEventListener("contextmenu",this.onHover))}interactionEvent(t){const{type:r,pointerType:n}=t;let i,o;n==="touch"?(o=Math.floor(t.pointers[0].clientY),i=Math.floor(t.pointers[0].clientX)):(o=Math.floor(t.srcEvent.y),i=Math.floor(t.srcEvent.x));const a=this.mapService.getMapContainer();if(a){const{top:u,left:l}=a.getBoundingClientRect();i-=l,o-=u}const s=this.mapService.containerToLngLat([i,o]);return{x:i,y:o,lngLat:s,type:r,target:t.srcEvent}}isDoubleTap(t,r,n){const i=new Date().getTime();let o="click";i-this.lastClickTime<400&&Math.abs(this.lastClickXY[0]-t)<10&&Math.abs(this.lastClickXY[1]-r)<10?(this.lastClickTime=0,this.lastClickXY=[-1,-1],this.clickTimer&&clearTimeout(this.clickTimer),o="dblclick",this.emit(cn.Hover,{x:t,y:r,lngLat:n,type:o})):(this.lastClickTime=i,this.lastClickXY=[t,r],this.clickTimer=setTimeout(()=>{o="click",this.emit(cn.Hover,{x:t,y:r,lngLat:n,type:o})},400))}}let J9=0;function e$(e){let t=e;if(typeof e=="string"&&(t=document.getElementById(e)),t){const r=document.createElement("div");return r.style.cssText+=` position: absolute; z-index:2; height: 100%; width: 100%; pointer-events: none; `,r.id=`l7-scene-${J9++}`,r.classList.add("l7-scene"),t.appendChild(r),r}return null}function t$(e){var t;let r=!0;if((e==null||(t=e.target)===null||t===void 0?void 0:t.target)instanceof HTMLElement){var n;let o=e==null||(n=e.target)===null||n===void 0?void 0:n.target;for(;o;){var i;const a=Array.from(o.classList);if(a.includes("l7-marker")||a.includes("l7-popup")){r=!1;break}o=(i=o)===null||i===void 0?void 0:i.parentElement}}return r}let pu=function(e){return e[e.SAMPLED=0]="SAMPLED",e[e.RENDER_TARGET=1]="RENDER_TARGET",e}({});class r${constructor(t){var r=this;E(this,"pickedColors",void 0),E(this,"pickedTileLayers",[]),E(this,"pickingFBO",void 0),E(this,"width",0),E(this,"height",0),E(this,"alreadyInPicking",!1),E(this,"pickBufferScale",1),E(this,"pickFromPickingFBO",function(){var n=ve(function*(i,{x:o,y:a,lngLat:s,type:u,target:l}){var f;let c=!1;const{readPixels:h,readPixelsAsync:d,getViewportSize:p,queryVerdorInfo:v}=r.rendererService,{width:g,height:y}=p(),{enableHighlight:S,enableSelect:R}=i.getLayerConfig(),x=o*ln,M=a*ln;if(x>g-1*ln||x<0||M>y-1*ln||M<0)return!1;let $;if(v()==="WebGPU"?$=yield d({x:Math.floor(x/r.pickBufferScale),y:Math.floor((y-(a+1)*ln)/r.pickBufferScale),width:1,height:1,data:new Uint8Array(4),framebuffer:r.pickingFBO}):$=h({x:Math.floor(x/r.pickBufferScale),y:Math.floor((y-(a+1)*ln)/r.pickBufferScale),width:1,height:1,data:new Uint8Array(4),framebuffer:r.pickingFBO}),r.pickedColors=$,$[0]!==0||$[1]!==0||$[2]!==0){const Y=yo($),ge=i.layerPickService.getFeatureById(Y);Y!==i.getCurrentPickId()&&u==="mousemove"&&(u="mouseenter");const q={x:o,y:a,type:u,lngLat:s,featureId:Y,feature:ge,target:l};ge&&(c=!0,i.setCurrentPickId(Y),r.triggerHoverOnLayer(i,q))}else{const Y={x:o,y:a,lngLat:s,type:i.getCurrentPickId()!==null&&u==="mousemove"?"mouseout":"un"+u,featureId:null,target:l,feature:null};r.triggerHoverOnLayer(i,he(he({},Y),{},{type:"unpick"})),r.triggerHoverOnLayer(i,Y),i.setCurrentPickId(null)}if(S&&i.layerPickService.highlightPickedFeature($),R&&u==="click"&&((f=$)===null||f===void 0?void 0:f.toString())!==[0,0,0,0].toString()){const Y=yo($);i.getCurrentSelectedId()===null||Y!==i.getCurrentSelectedId()?(i.layerPickService.selectFeature($),i.setCurrentSelectedId(Y)):(i.layerPickService.selectFeature(new Uint8Array([0,0,0,0])),i.setCurrentSelectedId(null))}return c});return function(i,o){return n.apply(this,arguments)}}()),this.container=t}get mapService(){return this.container.mapService}get rendererService(){return this.container.rendererService}get configService(){return this.container.globalConfigService}get interactionService(){return this.container.interactionService}get layerService(){return this.container.layerService}init(t){const{createTexture2D:r,createFramebuffer:n,getViewportSize:i}=this.rendererService;let{width:o,height:a}=i();this.pickBufferScale=this.configService.getSceneConfig(t).pickBufferScale||1,o=Math.round(o/this.pickBufferScale),a=Math.round(a/this.pickBufferScale);const s=r({width:o,height:a,usage:pu.RENDER_TARGET,label:"Picking Texture"});this.pickingFBO=n({color:s,depth:!0,width:o,height:a}),this.interactionService.on(cn.Hover,this.pickingAllLayer.bind(this))}boxPickLayer(t,r,n){var i=this;return ve(function*(){const{useFramebufferAsync:o,clear:a}=i.rendererService;i.resizePickingFBO(),t.hooks.beforePickingEncode.call(),yield o(i.pickingFBO,ve(function*(){a({framebuffer:i.pickingFBO,color:[0,0,0,0],stencil:0,depth:1}),t.renderModels({ispick:!0})})),t.hooks.afterPickingEncode.call();const s=yield i.pickBox(t,r);n(s)})()}pickBox(t,r){var n=this;return ve(function*(){const[i,o,a,s]=r.map(y=>{const S=y<0?0:y;return Math.floor(S*ln/n.pickBufferScale)}),{readPixelsAsync:u,getViewportSize:l}=n.rendererService,{width:f,height:c}=l();if(i>(f-1)*ln/n.pickBufferScale||a<0||o>(c-1)*ln/n.pickBufferScale||s<0)return[];const h=Math.min(f/n.pickBufferScale,a)-i,d=Math.min(c/n.pickBufferScale,s)-o,p=yield u({x:i,y:Math.floor(c/n.pickBufferScale-(s+1)),width:h,height:d,data:new Uint8Array(h*d*4),framebuffer:n.pickingFBO}),v=[],g={};for(let y=0;ys.needPick(t.type)).reverse()){yield i(r.pickingFBO,ve(function*(){n({framebuffer:r.pickingFBO,color:[0,0,0,0],stencil:0,depth:1}),a.layerPickService.pickRender(t)}));const s=yield r.pickFromPickingFBO(a,t);if(r.layerService.pickedLayerId=s?+a.id:-1,s&&!a.getLayerConfig().enablePropagation)break}})()}triggerHoverOnLayer(t,r){t$(r)&&(this.handleCursor(t,r.type),t.emit(r.type,r))}}class n${constructor(t=!0){E(this,"autoStart",void 0),E(this,"startTime",0),E(this,"oldTime",0),E(this,"running",!1),E(this,"elapsedTime",0),this.autoStart=t}start(){this.startTime=(typeof performance>"u"?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const r=(typeof performance>"u"?Date:performance).now();t=(r-this.oldTime)/1e3,this.oldTime=r,this.elapsedTime+=t}return t}}const{throttle:pg}=Sr;class i$ extends Bn.EventEmitter{get renderService(){return this.container.rendererService}get mapService(){return this.container.mapService}get debugService(){return this.container.debugService}constructor(t){super(),E(this,"pickedLayerId",-1),E(this,"clock",new n$),E(this,"alreadyInRendering",!1),E(this,"layers",[]),E(this,"layerList",[]),E(this,"layerRenderID",void 0),E(this,"sceneInited",!1),E(this,"animateInstanceCount",0),E(this,"shaderPicking",!0),E(this,"enableRender",!0),E(this,"reRender",pg(()=>{this.renderLayers()},32)),E(this,"throttleRenderLayers",pg(()=>{this.renderLayers()},16)),this.container=t}needPick(t){return this.updateLayerRenderList(),this.layerList.some(r=>r.needPick(t))}add(t){this.layers.push(t),this.sceneInited&&t.init().then(()=>{this.renderLayers()})}addMask(t){this.sceneInited&&t.init().then(()=>{this.renderLayers()})}initLayers(){var t=this;return ve(function*(){t.sceneInited=!0,t.layers.forEach(function(){var r=ve(function*(n){n.startInit||(yield n.init(),t.updateLayerRenderList())});return function(n){return r.apply(this,arguments)}}())})()}getSceneInited(){return this.sceneInited}getRenderList(){return this.layerList}getLayers(){return this.layers}getLayer(t){return this.layers.find(r=>r.id===t)}getLayerByName(t){return this.layers.find(r=>r.name===t)}remove(t,r){var n=this;return ve(function*(){r?r.layerChildren=r.layerChildren.filter(i=>i!==t):n.layers=n.layers.filter(i=>i!==t),t.destroy(),n.reRender(),n.emit("layerChange",n.layers)})()}removeAllLayers(){var t=this;return ve(function*(){t.destroy(),t.reRender()})()}setEnableRender(t){this.enableRender=t}renderLayers(){var t=this;return ve(function*(){if(t.alreadyInRendering||!t.enableRender)return;t.updateLayerRenderList();const r=t.debugService.generateRenderUid();t.debugService.renderStart(r),t.alreadyInRendering=!0,t.clear();for(const n of t.layerList)n.prerender();t.renderService.beginFrame();for(const n of t.layerList){const{enableMask:i}=n.getLayerConfig();n.masks.filter(o=>o.inited).length>0&&i&&t.renderMask(n.masks),n.getLayerConfig().enableMultiPassRenderer?yield n.renderMultiPass():n.render()}t.renderService.endFrame(),t.debugService.renderEnd(r),t.alreadyInRendering=!1})()}renderMask(t){let r=0;this.renderService.clear({stencil:0,depth:1,framebuffer:null});const n=t.length>1?go.MULTIPLE:go.SINGLE;for(const i of t)i.render({isStencil:!0,stencilType:n,stencilIndex:r++})}beforeRenderData(t){var r=this;return ve(function*(){(yield t.hooks.beforeRenderData.promise())&&r.renderLayers()})()}renderTileLayerMask(t){let r=0;const{enableMask:n=!0}=t.getLayerConfig();let i=t.tileMask?1:0;const o=t.masks.filter(s=>s.inited);i=i+(n?o.length:1);const a=i>1?go.MULTIPLE:go.SINGLE;if((t.tileMask||o.length&&n)&&this.renderService.clear({stencil:0,depth:1,framebuffer:null}),o.length&&n)for(const s of o)s.render({isStencil:!0,stencilType:a,stencilIndex:r++});t.tileMask&&t.tileMask.render({isStencil:!0,stencilType:a,stencilIndex:r++,stencilOperation:uf.OR})}renderTileLayer(t){var r=this;return ve(function*(){r.renderTileLayerMask(t),t.getLayerConfig().enableMultiPassRenderer?yield t.renderMultiPass():yield t.render()})()}updateLayerRenderList(){this.layerList=[],this.layers.filter(t=>t.inited).filter(t=>t.isVisible()).sort((t,r)=>t.zIndex-r.zIndex).forEach(t=>{this.layerList.push(t)})}destroy(){this.layers.forEach(t=>{t.destroy()}),this.layers=[],this.layerList=[],this.emit("layerChange",this.layers)}startAnimate(){this.animateInstanceCount++===0&&(this.clock.start(),this.runRender())}stopAnimate(){--this.animateInstanceCount===0&&(this.stopRender(),this.clock.stop())}getOESTextureFloat(){return this.renderService.extensionObject.OES_texture_float}enableShaderPick(){this.shaderPicking=!0}disableShaderPick(){this.shaderPicking=!1}getShaderPickStat(){return this.shaderPicking}clear(){const t=Zt(this.mapService.bgColor);this.renderService.clear({color:t,depth:1,stencil:0,framebuffer:null})}runRender(){this.renderLayers(),this.layerRenderID=window.requestAnimationFrame(this.runRender.bind(this))}stopRender(){window.cancelAnimationFrame(this.layerRenderID)}}function o$(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}function ai(e,t){if(e==null)return{};var r,n,i=o$(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n{if(r.length===0){var n;return((n=this.scale)===null||n===void 0?void 0:n.defaultValues)||[]}return r.map((i,o)=>{var a;return((a=this.scale)===null||a===void 0?void 0:a.scalers[o].func)(i)})}),this.setProps(t)}setProps(t){Object.assign(this,t)}mapping(t){var r;if((r=this.scale)!==null&&r!==void 0&&r.callback){var n;const i=(n=this.scale)===null||n===void 0?void 0:n.callback(...t);if(!a$(i))return[i]}return this.defaultCallback(t)}resetDescriptor(){this.descriptor&&(this.descriptor.buffer.data=[])}}const u$=["buffer","update","name"],l$=["buffer","update","name"],c$={[m.FLOAT]:4,[m.UNSIGNED_BYTE]:1,[m.UNSIGNED_SHORT]:2};class f${constructor(t){E(this,"attributesAndIndices",void 0),E(this,"attributes",[]),E(this,"triangulation",void 0),E(this,"featureLayout",{sizePerElement:0,elements:[]}),this.rendererService=t}registerStyleAttribute(t){let r=this.getLayerStyleAttribute(t.name||"");return r?r.setProps(t):(r=new s$(t),this.attributes.push(r)),r}unRegisterStyleAttribute(t){const r=this.attributes.findIndex(n=>n.name===t);r>-1&&this.attributes.splice(r,1)}updateScaleAttribute(t){this.attributes.forEach(r=>{var n;const i=r.name,o=(n=r.scale)===null||n===void 0?void 0:n.field;(t[i]||o&&t[o])&&(r.needRescale=!0,r.needRemapping=!0,r.needRegenerateVertices=!0)})}updateStyleAttribute(t,r,n){let i=this.getLayerStyleAttribute(t);i||(i=this.registerStyleAttribute(he(he({},r),{},{name:t})));const{scale:o}=r;o&&i&&(i.scale=o,i.needRescale=!0,i.needRemapping=!0,i.needRegenerateVertices=!0,n&&n.featureRange&&(i.featureRange=n.featureRange))}getLayerStyleAttributes(){return this.attributes}getLayerStyleAttribute(t){return this.attributes.find(r=>r.name===t)}getLayerAttributeScale(t){var r;const n=this.getLayerStyleAttribute(t),i=n==null||(r=n.scale)===null||r===void 0?void 0:r.scalers;return i&&i[0]?i[0].func:null}updateAttributeByFeatureRange(t,r,n=0,i,o){const a=this.attributes.find(s=>s.name===t);if(a&&a.descriptor){const{descriptor:s}=a,{update:u,buffer:l,size:f=0}=s,c=c$[l.type||m.FLOAT];if(u){const{elements:h,sizePerElement:d}=this.featureLayout,p=h.slice(n,i);if(!p.length)return;const{offset:v}=p[0],g=v*f*c,y=p.map(({featureIdx:S,vertices:R,normals:x},M)=>{const $=R.length/d,F=[];for(let Y=0;Y<$;Y++){const ge=x?x.slice(Y*3,Y*3+3):[];F.push(...u(r[S],S,R.slice(Y*d,Y*d+d),M,ge))}return F}).flat();a.vertexAttribute.updateBuffer({data:y,offset:g}),o==null||o.emit(`legend:${t}`,o.getLegend(t))}}}createAttributesAndIndices(t,r,n,i){this.featureLayout={sizePerElement:0,elements:[]},r&&(this.triangulation=r);const o=this.attributes.map(v=>(v.resetDescriptor(),v.descriptor));let a=0,s=0;const u=[];let l=3;t.forEach((v,g)=>{const{indices:y,vertices:S,normals:R,size:x,indexes:M,count:$}=this.triangulation(v,n);typeof $=="number"&&(s+=$),y.forEach(Y=>{u.push(Y+a)}),l=x;const F=S.length/x;this.featureLayout.sizePerElement=l,this.featureLayout.elements.push({featureIdx:g,vertices:S,normals:R,offset:a}),a+=F;for(let Y=0;Y{G&&G.update&&G.buffer.data.push(...G.update(v,g,q,Y,ge,k))})}});const{createAttribute:f,createBuffer:c,createElements:h}=this.rendererService,d={};o.forEach((v,g)=>{if(v){const{buffer:y,update:S,name:R}=v,x=ai(v,u$),M=f(he({buffer:c(y)},x));d[v.name||""]=M,this.attributes[g].vertexAttribute=M}});const p=h({data:u,type:m.UNSIGNED_INT,count:u.length});return this.attributesAndIndices={attributes:d,elements:p,count:s},Object.values(this.attributes).filter(v=>v.scale).forEach(v=>{const g=v.name;i==null||i.emit(`legend:${g}`,i.getLegend(g))}),this.attributesAndIndices}createAttributes(t,r){this.featureLayout={sizePerElement:0,elements:[]},r&&(this.triangulation=r);const n=this.attributes.map(l=>(l.resetDescriptor(),l.descriptor));let i=0,o=3;t.forEach((l,f)=>{const{indices:c,vertices:h,normals:d,size:p,indexes:v}=this.triangulation(l);c.forEach(y=>{}),o=p;const g=h.length/p;this.featureLayout.sizePerElement=o,this.featureLayout.elements.push({featureIdx:f,vertices:h,normals:d,offset:i}),i+=g;for(let y=0;y{M&&M.update&&M.buffer.data.push(...M.update(l,f,R,y,S,x))})}});const{createAttribute:a,createBuffer:s}=this.rendererService,u={};return n.forEach((l,f)=>{if(l){const{buffer:c,update:h,name:d}=l,p=ai(l,l$),v=a(he({buffer:s(c)},p));u[l.name||""]=v,this.attributes[f].vertexAttribute=v}}),{attributes:u}}clearAllAttributes(){var t;this.attributes.forEach(r=>{r.vertexAttribute&&r.vertexAttribute.destroy()}),(t=this.attributesAndIndices)===null||t===void 0||t.elements.destroy(),this.attributes=[]}}function _A(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(f){try{l(n.next(f))}catch(c){a(c)}}function u(f){try{l(n.throw(f))}catch(c){a(c)}}function l(f){f.done?o(f.value):i(f.value).then(s,u)}l((n=n.apply(e,[])).next())})}function vA(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Vp(e,t,r){if(arguments.length===2)for(var n=0,i=t.length,o;n=0&&n.length%1===0}e.exports=t.default})(_u,_u.exports);var _n={},Nd={exports:{}},Pd={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r){return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];var o=n.pop();return r.call(this,n,o)}},e.exports=t.default})(Pd,Pd.exports);var Yi={};Object.defineProperty(Yi,"__esModule",{value:!0});Yi.fallback=gA;Yi.wrap=EA;var h$=Yi.hasQueueMicrotask=typeof queueMicrotask=="function"&&queueMicrotask,d$=Yi.hasSetImmediate=typeof setImmediate=="function"&&setImmediate,p$=Yi.hasNextTick=typeof process=="object"&&typeof process.nextTick=="function";function gA(e){setTimeout(e,0)}function EA(e){return function(t){for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];return e(function(){return t.apply(void 0,r)})}}var Ks;h$?Ks=queueMicrotask:d$?Ks=setImmediate:p$?Ks=process.nextTick:Ks=gA;Yi.default=EA(Ks);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=Pd.exports,n=s(r),i=Yi,o=s(i),a=_n;function s(c){return c&&c.__esModule?c:{default:c}}function u(c){return(0,a.isAsync)(c)?function(){for(var h=[],d=arguments.length;d--;)h[d]=arguments[d];var p=h.pop(),v=c.apply(this,h);return l(v,p)}:(0,n.default)(function(h,d){var p;try{p=c.apply(this,h)}catch(v){return d(v)}if(p&&typeof p.then=="function")return l(p,d);d(null,p)})}function l(c,h){return c.then(function(d){f(h,null,d)},function(d){f(h,d&&d.message?d:new Error(d))})}function f(c,h,d){try{c(h,d)}catch(p){(0,o.default)(function(v){throw v},p)}}e.exports=t.default})(Nd,Nd.exports);Object.defineProperty(_n,"__esModule",{value:!0});_n.isAsyncIterable=_n.isAsyncGenerator=_n.isAsync=void 0;var _$=Nd.exports,v$=m$(_$);function m$(e){return e&&e.__esModule?e:{default:e}}function yA(e){return e[Symbol.toStringTag]==="AsyncFunction"}function g$(e){return e[Symbol.toStringTag]==="AsyncGenerator"}function E$(e){return typeof e[Symbol.asyncIterator]=="function"}function y$(e){if(typeof e!="function")throw new Error("expected a function");return yA(e)?(0,v$.default)(e):e}_n.default=y$;_n.isAsync=yA;_n.isAsyncGenerator=g$;_n.isAsyncIterable=E$;var So={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n,i){if(i===void 0&&(i=n.length),!i)throw new Error("arity is undefined");function o(){for(var a=this,s=[],u=arguments.length;u--;)s[u]=arguments[u];return typeof s[i-1]=="function"?n.apply(this,s):new Promise(function(l,f){s[i-1]=function(c){for(var h=[],d=arguments.length-1;d-- >0;)h[d]=arguments[d+1];if(c)return f(c);l(h.length>1?h:h[0])},n.apply(a,s)})}return o}e.exports=t.default})(So,So.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=_u.exports,n=u(r),i=_n,o=u(i),a=So.exports,s=u(a);function u(l){return l&&l.__esModule?l:{default:l}}t.default=(0,s.default)(function(l,f,c){var h=(0,n.default)(f)?[]:{};l(f,function(d,p,v){(0,o.default)(d)(function(g){for(var y,S=[],R=arguments.length-1;R-- >0;)S[R]=arguments[R+1];S.length<2&&(y=S,S=y[0]),h[p]=S,v(g)})},function(d){return c(d,h)})},3),e.exports=t.default})(yc,yc.exports);var Ld={exports:{}},Tc={exports:{}},wd={exports:{}},vu={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){function i(){for(var o=[],a=arguments.length;a--;)o[a]=arguments[a];if(n!==null){var s=n;n=null,s.apply(this,o)}}return Object.assign(i,n),i}e.exports=t.default})(vu,vu.exports);var Fd={exports:{}},Bd={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r){return r[Symbol.iterator]&&r[Symbol.iterator]()},e.exports=t.default})(Bd,Bd.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=_u.exports,n=a(r),i=Bd.exports,o=a(i);function a(c){return c&&c.__esModule?c:{default:c}}function s(c){var h=-1,d=c.length;return function(){return++h=s||h||f||(h=!0,a.next().then(function(S){var R=S.value,x=S.done;if(!(c||f)){if(h=!1,x){f=!0,d<=0&&l(null);return}d++,u(R,p,g),p++,v()}}).catch(y))}function g(S,R){if(d-=1,!c){if(S)return y(S);if(S===!1){f=!0,c=!0;return}if(R===n.default||f&&d<=0)return f=!0,l(null);v()}}function y(S){c||(h=!1,f=!0,l(S))}v()}e.exports=t.default})(Dd,Dd.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=vu.exports,n=d(r),i=Fd.exports,o=d(i),a=mu.exports,s=d(a),u=_n,l=Dd.exports,f=d(l),c=gu.exports,h=d(c);function d(p){return p&&p.__esModule?p:{default:p}}t.default=function(p){return function(v,g,y){if(y=(0,n.default)(y),p<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!v)return y(null);if((0,u.isAsyncGenerator)(v))return(0,f.default)(v,p,g,y);if((0,u.isAsyncIterable)(v))return(0,f.default)(v[Symbol.asyncIterator](),p,g,y);var S=(0,o.default)(v),R=!1,x=!1,M=0,$=!1;function F(ge,q){if(!x)if(M-=1,ge)R=!0,y(ge);else if(ge===!1)R=!0,x=!0;else{if(q===h.default||R&&M<=0)return R=!0,y(null);$||Y()}}function Y(){for($=!0;M0;)S[R]=arguments[R+1];if(y!==!1){if(y||p===h.length)return d.apply(void 0,[y].concat(S));v(S)}}v([])}t.default=(0,l.default)(c),e.exports=t.default})(kd,kd.exports);var T$=mA(kd.exports),vg=function(){function e(){this.tasks=[]}return e.prototype.call=function(){return lf(this.tasks)},e.prototype.tap=function(t,r){this.tasks.push(function(n){var i=r();n(i,t)})},e}(),A$=function(){function e(){this.args=[],this.tasks=[]}return e.prototype.promise=function(){for(var t=arguments,r=[],n=0;n";while(a[0]);return i>4?i:n}();return e===r};xA.isLegacyOpera=function(){return!!window.opera};var bA=SA.exports,RA={exports:{}},N$=RA.exports={};N$.getOption=P$;function P$(e,t,r){var n=e[t];return n==null&&r!==void 0?r:n}var L$=RA.exports,mg=L$,w$=function(t){t=t||{};var r=t.reporter,n=mg.getOption(t,"async",!0),i=mg.getOption(t,"auto",!0);i&&!n&&(r&&r.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),n=!0);var o=gg(),a,s=!1;function u(p,v){!s&&i&&n&&o.size()===0&&c(),o.add(p,v)}function l(){for(s=!0;o.size();){var p=o;o=gg(),p.process()}s=!1}function f(p){s||(p===void 0&&(p=n),a&&(h(a),a=null),p?c():l())}function c(){a=d(l)}function h(p){var v=clearTimeout;return v(p)}function d(p){var v=function(g){return setTimeout(g,0)};return v(p)}return{add:u,force:f}};function gg(){var e={},t=0,r=0,n=0;function i(s,u){u||(u=s,s=0),s>r?r=s:s div::-webkit-scrollbar { "+l(["display: none"])+` } `,q+="."+ge+" { "+l(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+Y,"animation-name: "+Y])+` } `,q+="@-webkit-keyframes "+Y+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } } `,q+="@keyframes "+Y+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",F(q)}}function h(x){x.className+=" "+s+"_animation_active"}function d(x,M,$){if(x.addEventListener)x.addEventListener(M,$);else if(x.attachEvent)x.attachEvent("on"+M,$);else return t.error("[scroll] Don't know how to add event listeners.")}function p(x,M,$){if(x.removeEventListener)x.removeEventListener(M,$);else if(x.detachEvent)x.detachEvent("on"+M,$);else return t.error("[scroll] Don't know how to remove event listeners.")}function v(x){return n(x).container.childNodes[0].childNodes[0].childNodes[0]}function g(x){return n(x).container.childNodes[0].childNodes[0].childNodes[1]}function y(x,M){var $=n(x).listeners;if(!$.push)throw new Error("Cannot add listener to an element that is not detectable.");n(x).listeners.push(M)}function S(x,M,$){$||($=M,M=x,x=null),x=x||{};function F(){if(x.debug){var le=Array.prototype.slice.call(arguments);if(le.unshift(i.get(M),"Scroll: "),t.log.apply)t.log.apply(null,le);else for(var ze=0;ze{this.emit("resize"),this.$container&&(this.initContainer(),this.coordinateSystemService.needRefresh=!0,this.render())}),E(this,"handleMapCameraChanged",r=>{this.cameraService.update(r),this.render()}),this.container=t,this.hooks={init:new A$},this.id=t.id}init(t){var r=this;this.configService.setSceneConfig(this.id,t),this.shaderModuleService.registerBuiltinModules(),this.iconService.init(),this.iconService.on("imageUpdate",()=>this.render()),this.fontService.init(),this.hooks.init.tapPromise("initMap",ve(function*(){r.debugService.log("map.mapInitStart",{type:r.map.version}),yield new Promise(n=>{r.map.onCameraChanged(i=>{r.cameraService.init(),r.cameraService.update(i),n()}),r.map.init()}),r.map.onCameraChanged(r.handleMapCameraChanged),r.map.addMarkerContainer(),r.markerService.addMarkers(),r.markerService.addMarkerLayers(),r.popupService.initPopup(),r.interactionService.init(),r.interactionService.on(cn.Drag,r.addSceneEvent.bind(r))})),this.hooks.init.tapPromise("initRenderer",ve(function*(){var n;const i=((n=r.map)===null||n===void 0?void 0:n.getOverlayContainer())||void 0;if(i?r.$container=i:r.$container=e$(r.configService.getSceneConfig(r.id).id||""),r.$container){const{canvas:a}=t;if(r.canvas=a||yn("canvas","",r.$container),r.setCanvas(),yield r.rendererService.init(r.canvas,r.configService.getSceneConfig(r.id),t.gl),r.registerContextLost(),r.initContainer(),r.resizeDetector=q$({strategy:"scroll"}),r.resizeDetector.listenTo(r.$container,r.handleWindowResized),window.matchMedia){var o;(o=window.matchMedia("screen and (-webkit-min-device-pixel-ratio: 1.5)"))===null||o===void 0||o.addListener(r.handleWindowResized.bind("screen"))}}else console.error("容器 id 不存在");r.pickingService.init(r.id)})),this.render()}registerContextLost(){const t=this.rendererService.getCanvas();t&&t.addEventListener("webglcontextlost",()=>this.emit("webglcontextlost"))}addLayer(t){this.layerService.sceneService=this,this.layerService.add(t)}addMask(t){this.layerService.sceneService=this,this.layerService.addMask(t)}render(){var t=this;return ve(function*(){t.rendering||t.destroyed||(t.rendering=!0,t.inited?(yield t.layerService.initLayers(),yield t.layerService.renderLayers()):(yield t.hooks.init.promise(),t.destroyed&&t.destroy(),yield t.layerService.initLayers(),t.layerService.renderLayers(),t.controlService.addControls(),t.loaded=!0,t.emit("loaded"),t.inited=!0),t.rendering=!1)})()}addFontFace(t,r){this.fontService.addFontFace(t,r)}getSceneContainer(){return this.$container}exportPng(t){var r=this;return ve(function*(){var n;const i=(n=r.$container)===null||n===void 0?void 0:n.getElementsByTagName("canvas")[0];return yield r.render(),t==="jpg"?i==null?void 0:i.toDataURL("image/jpeg"):i==null?void 0:i.toDataURL("image/png")})()}getSceneConfig(){return this.configService.getSceneConfig(this.id)}getPointSizeRange(){return this.rendererService.getPointSizeRange()}addMarkerContainer(){const t=this.$container.parentElement;t!==null&&(this.markerContainer=yn("div","l7-marker-container",t))}getMarkerContainer(){return this.markerContainer}destroy(){var t;if(!this.inited){this.destroyed=!0;return}this.resizeDetector.removeListener(this.$container,this.handleWindowResized),this.pickingService.destroy(),this.layerService.destroy(),this.interactionService.destroy(),this.controlService.destroy(),this.markerService.destroy(),this.fontService.destroy(),this.iconService.destroy(),this.removeAllListeners(),this.inited=!1,this.map.destroy(),setTimeout(()=>{var r;(r=this.$container)===null||r===void 0||r.removeChild(this.canvas),this.canvas=null,this.rendererService.destroy()}),(t=this.$container)===null||t===void 0||(t=t.parentNode)===null||t===void 0||t.removeChild(this.$container),this.emit("destroy")}initContainer(){var t,r;const n=ln,i=((t=this.$container)===null||t===void 0?void 0:t.clientWidth)||400,o=((r=this.$container)===null||r===void 0?void 0:r.clientHeight)||300,a=this.canvas;a&&(a.width=i*n,a.height=o*n),this.rendererService.viewport({x:0,y:0,width:n*i,height:n*o})}setCanvas(){var t,r;const n=ln,i=((t=this.$container)===null||t===void 0?void 0:t.clientWidth)||400,o=((r=this.$container)===null||r===void 0?void 0:r.clientHeight)||300,a=this.canvas;a.width=i*n,a.height=o*n,a.style.width="100%",a.style.height="100%"}addSceneEvent(t){this.emit(t.type,t)}};const{uniq:Q$}=Sr,Sg="#define PI 3.14159265359",J$=`#define ambientRatio 0.5 #define diffuseRatio 0.3 #define specularRatio 0.2 float calc_lighting(vec4 pos) { vec3 worldPos = vec3(pos * u_ModelMatrix); vec3 worldNormal = a_Normal; // //cal light weight vec3 viewDir = normalize(u_CameraPosition - worldPos); vec3 lightDir = normalize(vec3(1, -10.5, 12)); vec3 halfDir = normalize(viewDir+lightDir); // //lambert float lambert = dot(worldNormal, lightDir); //specular float specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0); //sum to light weight float lightWeight = ambientRatio + diffuseRatio * lambert + specularRatio * specular; return lightWeight; } `,ez=`#define SHIFT_RIGHT17 1.0 / 131072.0 #define SHIFT_RIGHT18 1.0 / 262144.0 #define SHIFT_RIGHT19 1.0 / 524288.0 #define SHIFT_RIGHT20 1.0 / 1048576.0 #define SHIFT_RIGHT21 1.0 / 2097152.0 #define SHIFT_RIGHT22 1.0 / 4194304.0 #define SHIFT_RIGHT23 1.0 / 8388608.0 #define SHIFT_RIGHT24 1.0 / 16777216.0 #define SHIFT_LEFT17 131072.0 #define SHIFT_LEFT18 262144.0 #define SHIFT_LEFT19 524288.0 #define SHIFT_LEFT20 1048576.0 #define SHIFT_LEFT21 2097152.0 #define SHIFT_LEFT22 4194304.0 #define SHIFT_LEFT23 8388608.0 #define SHIFT_LEFT24 16777216.0 vec2 unpack_float(float packedValue) { int packedIntValue = int(packedValue); int v0 = packedIntValue / 256; return vec2(v0, packedIntValue - v0 * 256); } vec4 decode_color(vec2 encodedColor) { return vec4( unpack_float(encodedColor[0]) / 255.0, unpack_float(encodedColor[1]) / 255.0 ); } `,tz=`// Blinn-Phong model // apply lighting in vertex shader instead of fragment shader // @see https://learnopengl.com/Advanced-Lighting/Advanced-Lighting uniform float u_Ambient : 1.0; uniform float u_Diffuse : 1.0; uniform float u_Specular : 1.0; uniform int u_NumOfDirectionalLights : 1; uniform int u_NumOfSpotLights : 0; #define SHININESS 32.0 #define MAX_NUM_OF_DIRECTIONAL_LIGHTS 3 #define MAX_NUM_OF_SPOT_LIGHTS 3 struct DirectionalLight { vec3 direction; vec3 ambient; vec3 diffuse; vec3 specular; }; struct SpotLight { vec3 position; vec3 direction; vec3 ambient; vec3 diffuse; vec3 specular; float constant; float linear; float quadratic; float angle; float blur; float exponent; }; uniform DirectionalLight u_DirectionalLights[MAX_NUM_OF_DIRECTIONAL_LIGHTS]; uniform SpotLight u_SpotLights[MAX_NUM_OF_SPOT_LIGHTS]; vec3 calc_directional_light(DirectionalLight light, vec3 normal, vec3 viewDir) { vec3 lightDir = normalize(light.direction); // diffuse shading float diff = max(dot(normal, lightDir), 0.0); // Blinn-Phong specular shading vec3 halfwayDir = normalize(lightDir + viewDir); float spec = pow(max(dot(normal, halfwayDir), 0.0), SHININESS); vec3 ambient = light.ambient * u_Ambient; vec3 diffuse = light.diffuse * diff * u_Diffuse; vec3 specular = light.specular * spec * u_Specular; return ambient + diffuse + specular; } vec3 calc_lighting(vec3 position, vec3 normal, vec3 viewDir) { vec3 weight = vec3(0.0); for (int i = 0; i < MAX_NUM_OF_DIRECTIONAL_LIGHTS; i++) { if (i >= u_NumOfDirectionalLights) { break; } weight += calc_directional_light(u_DirectionalLights[i], normal, viewDir); } return weight; } `,rz=` in vec4 v_PickingResult; #pragma include "picking_uniforms" #define PICKING_NONE 0.0 #define PICKING_ENCODE 1.0 #define PICKING_HIGHLIGHT 2.0 #define COLOR_SCALE 1. / 255. #define HIGHLIGHT 1.0 #define SELECT 2.0 /* * Returns highlight color if this item is selected. */ vec4 filterHighlightColor(vec4 color, float weight) { float activeType = v_PickingResult.a; if(activeType > 0.0) { vec4 highLightColor = activeType > 1.5 ? u_SelectColor : u_HighlightColor; highLightColor = highLightColor * COLOR_SCALE; float highLightAlpha = highLightColor.a; float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha)); vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio); return vec4(mix(resultRGB * weight, color.rgb, u_activeMix), color.a); } else { return color; } } /* * Returns picking color if picking enabled else unmodified argument. */ vec4 filterPickingColor(vec4 color) { vec3 pickingColor = v_PickingResult.rgb; if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) { discard; } return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color; } /* * Returns picking color if picking is enabled if not * highlight color if this item is selected, otherwise unmodified argument. */ vec4 filterColor(vec4 color) { // 过滤多余的 shader 计算 // return color; if(u_shaderPick < 0.5) { return color; // 暂时去除 直接取消计算在选中时拖拽地图会有问题 } else { return filterPickingColor(filterHighlightColor(color, 1.0)); } } vec4 filterColorAlpha(vec4 color, float alpha) { // 过滤多余的 shader 计算 // return color; if(u_shaderPick < 0.5) { return color; // 暂时去除 直接取消计算在选中时拖拽地图会有问题 } else { return filterPickingColor(filterHighlightColor(color, alpha)); } } `,nz=`layout(location = ATTRIBUTE_LOCATION_PICKING_COLOR) in vec3 a_PickingColor; out vec4 v_PickingResult; #pragma include "picking_uniforms" #define PICKING_NONE 0.0 #define PICKING_ENCODE 1.0 #define PICKING_HIGHLIGHT 2.0 #define COLOR_SCALE 1. / 255. #define NORMAL 0.0 #define HIGHLIGHT 1.0 #define SELECT 2.0 bool isVertexPicked(vec3 vertexColor) { return distance(vertexColor,u_PickingColor.rgb) < 0.01; } // 判断当前点是否已经被 select 选中 bool isVertexSelected(vec3 vertexColor) { return distance(vertexColor,u_CurrentSelectedId.rgb) < 0.01; } void setPickingColor(vec3 pickingColor) { if(u_shaderPick < 0.5) { return; } // compares only in highlight stage if(u_PickingStage == PICKING_HIGHLIGHT) { if(isVertexPicked(pickingColor)) { v_PickingResult = vec4(pickingColor.rgb * COLOR_SCALE,HIGHLIGHT); return; } if(isVertexSelected(pickingColor)) { v_PickingResult = vec4(u_CurrentSelectedId.rgb * COLOR_SCALE,SELECT); return; } } else { v_PickingResult= vec4(pickingColor.rgb * COLOR_SCALE,NORMAL); return; } // // v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && (isVertexPicked(pickingColor) || isVertexPicked(u_CurrentSelectedId))); // // Stores the picking color so that the fragment shader can render it during picking // v_PickingResult.rgb = pickingColor * COLOR_SCALE; } float setPickingSize(float x) { return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x; } float setPickingOrder(float z) { bool selected = bool(v_PickingResult.a); return selected ? z + 1. : 0.; } `,xg=`layout(std140) uniform PickingUniforms { vec4 u_HighlightColor; vec4 u_SelectColor; vec3 u_PickingColor; float u_PickingStage; vec3 u_CurrentSelectedId; float u_PickingThreshold; float u_PickingBuffer; float u_shaderPick; float u_activeMix; };`,iz=` #define E 2.718281828459045 vec2 ProjectFlat(vec2 lnglat){ float maxs=85.0511287798; float lat=max(min(maxs,lnglat.y),-maxs); float scale= 268435456.; float d=PI/180.; float x=lnglat.x*d; float y=lat*d; y=log(tan((PI/4.)+(y/2.))); float a=.5/PI, b=.5, c=-.5/PI; d=.5; x=scale*(a*x+b); y=scale*(c*y+d); return vec2(x,y); } vec2 unProjectFlat(vec2 px){ float a=.5/PI; float b=.5; float c=-.5/PI; float d=.5; float scale = 268435456.; float x=(px.x/scale-b)/a; float y=(px.y/scale-d)/c; y=(atan(pow(E,y))-(PI/4.))*2.; d=PI/180.; float lat=y/d; float lng=x/d; return vec2(lng,lat); } float pixelDistance(vec2 from, vec2 to) { vec2 a1 = ProjectFlat(from); vec2 b1 = ProjectFlat(to); return distance(a1, b1); } // gaode2.0 vec2 customProject(vec2 lnglat) { // 经纬度 => 平面坐标 float t = lnglat.x; float e = lnglat.y; float Sm = 180.0 / PI; float Tm = 6378137.0; float Rm = PI / 180.0; float r = 85.0511287798; e = max(min(r, e), -r); t *= Rm; e *= Rm; e = log(tan(PI / 4.0 + e / 2.0)); return vec2(t * Tm, e * Tm); } vec2 unProjCustomCoord(vec2 point) { // 平面坐标 => 经纬度 float Sm = 57.29577951308232; //180 / Math.PI float Tm = 6378137.0; float t = point.x; float e = point.y; return vec2(t / Tm * Sm, (2.0 * atan(exp(e / Tm)) - PI / 2.0) * Sm); } float customPixelDistance(vec2 from, vec2 to) { vec2 a1 = ProjectFlat(from); vec2 b1 = ProjectFlat(to); return distance(a1, b1); }`,bg=`#define TILE_SIZE (512.0) #define PI (3.1415926536) #define WORLD_SCALE (TILE_SIZE / (PI * 2.0)) #define EARTH_CIRCUMFERENCE (40.03e6) #define COORDINATE_SYSTEM_LNGLAT (1.0) // mapbox #define COORDINATE_SYSTEM_LNGLAT_OFFSET (2.0) // mapbox offset #define COORDINATE_SYSTEM_VECTOR_TILE (3.0) #define COORDINATE_SYSTEM_IDENTITY (4.0) #define COORDINATE_SYSTEM_METER_OFFSET (5.0) #pragma include "scene_uniforms" const vec2 ZERO_64_XY_LOW = vec2(0.0, 0.0); // web mercator coords -> world coords vec2 project_mercator(vec2 lnglat) { float x = lnglat.x; return vec2(radians(x) + PI, PI - log(tan(PI * 0.25 + radians(lnglat.y) * 0.5))); } float project_scale(float meters) { return meters * u_PixelsPerMeter.z; } // offset coords -> world coords vec4 project_offset(vec4 offset) { float dy = offset.y; dy = clamp(dy, -1.0, 1.0); vec3 pixels_per_unit = u_PixelsPerDegree + u_PixelsPerDegree2 * dy; return vec4(offset.xyz * pixels_per_unit, offset.w); } vec3 project_normal(vec3 normal) { vec4 normal_modelspace = u_ModelMatrix * vec4(normal, 0.0); return normalize(normal_modelspace.xyz * u_PixelsPerMeter); } vec3 project_offset_normal(vec3 vector) { if ( u_CoordinateSystem < COORDINATE_SYSTEM_LNGLAT + 0.01 && u_CoordinateSystem > COORDINATE_SYSTEM_LNGLAT - 0.01 || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // normals generated by the polygon tesselator are in lnglat offsets instead of meters return normalize(vector * u_PixelsPerDegree); } return project_normal(vector); } vec4 project_position(vec4 position, vec2 position64xyLow) { if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { float X = position.x - u_ViewportCenter.x; float Y = position.y - u_ViewportCenter.y; return project_offset( vec4(X + position64xyLow.x, Y + position64xyLow.y, position.z, position.w) ); } if ( u_CoordinateSystem < COORDINATE_SYSTEM_LNGLAT + 0.01 && u_CoordinateSystem > COORDINATE_SYSTEM_LNGLAT - 0.01 ) { return vec4( project_mercator(position.xy) * WORLD_SCALE * u_ZoomScale, project_scale(position.z), position.w ); } return position; } vec4 project_position(vec4 position) { return project_position(position, ZERO_64_XY_LOW); } vec2 project_pixel_size_to_clipspace(vec2 pixels) { vec2 offset = pixels / u_ViewportSize * u_DevicePixelRatio * 2.0; return offset * u_FocalDistance; } // 适配纹理贴图的等像素大小 float project_pixel_texture(float pixel) { // mapbox zoom > 12 if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { return pixel * pow(0.5, u_Zoom) * u_FocalDistance; } return pixel * 2.0 * u_FocalDistance; } // 在不论什么底图下需要统一处理的时候使用 float project_float_pixel(float pixel) { if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // mapbox 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减1 return pixel * pow(2.0, 19.0 - u_Zoom) * u_FocalDistance; } return pixel * u_FocalDistance; } // Project meter into the unit of pixel which used in the camera world space float project_float_meter(float meter) { if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // Since the zoom level uniform is updated by mapservice and it's alread been subtracted by 1 // Not sure if we are supposed to do that again return meter; } else { return project_float_pixel(meter); } // TODO: change the following code to make adaptations for amap // return u_FocalDistance * TILE_SIZE * pow(2.0, u_Zoom) * meter / EARTH_CIRCUMFERENCE; } float project_pixel(float pixel) { return pixel * u_FocalDistance; } vec2 project_pixel(vec2 pixel) { return pixel * -1.0 * u_FocalDistance; } vec3 project_pixel(vec3 pixel) { return pixel * -1.0 * u_FocalDistance; } vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) { if ( u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // Needs to be divided with project_uCommonUnitsPerMeter position.w *= u_PixelsPerMeter.z; } return viewProjectionMatrix * position + center; } // Projects from common space coordinates to clip space vec4 project_common_position_to_clipspace(vec4 position) { return project_common_position_to_clipspace( position, u_ViewProjectionMatrix, u_ViewportCenterProjection ); } vec4 unproject_clipspace_to_position(vec4 clipspacePos, mat4 u_InverseViewProjectionMatrix) { vec4 pos = u_InverseViewProjectionMatrix * (clipspacePos - u_ViewportCenterProjection); if ( u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // Needs to be divided with project_uCommonUnitsPerMeter pos.w = pos.w / u_PixelsPerMeter.z; } return pos; } bool isEqual(float a, float b) { return a < b + 0.001 && a > b - 0.001; } `,oz=`vec2 rotate_matrix(vec2 v, float a) { float b = a / 180.0 * 3.1415926535897932384626433832795; float s = sin(b); float c = cos(b); mat2 m = mat2(c, s, -s, c); return m * v; }`,Rg=`layout(std140) uniform SceneUniforms { mat4 u_ViewMatrix; mat4 u_ProjectionMatrix; mat4 u_ViewProjectionMatrix; mat4 u_ModelMatrix; vec4 u_ViewportCenterProjection; vec3 u_PixelsPerDegree; float u_Zoom; vec3 u_PixelsPerDegree2; float u_ZoomScale; vec3 u_PixelsPerMeter; float u_CoordinateSystem; vec3 u_CameraPosition; float u_DevicePixelRatio; vec2 u_ViewportCenter; vec2 u_ViewportSize; float u_FocalDistance; }; `,az=`/** * 2D signed distance field functions * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm */ float ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; } float sdCircle(vec2 p, float r) { return length(p) - r; } float sdEquilateralTriangle(vec2 p) { float k = sqrt(3.0); p.x = abs(p.x) - 1.0; p.y = p.y + 1.0/k; if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0; p.x -= clamp( p.x, -2.0, 0.0 ); return -length(p)*sign(p.y); } float sdBox(vec2 p, vec2 b) { vec2 d = abs(p)-b; return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0); } float sdPentagon(vec2 p, float r) { vec3 k = vec3(0.809016994,0.587785252,0.726542528); p.x = abs(p.x); p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y); p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y); p -= vec2(clamp(p.x,-r*k.z,r*k.z),r); return length(p)*sign(p.y); } float sdHexagon(vec2 p, float r) { vec3 k = vec3(-0.866025404,0.5,0.577350269); p = abs(p); p -= 2.0*min(dot(k.xy,p),0.0)*k.xy; p -= vec2(clamp(p.x, -k.z*r, k.z*r), r); return length(p)*sign(p.y); } float sdOctogon(vec2 p, float r) { vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 ); p = abs(p); p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y); p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y); p -= vec2(clamp(p.x, -k.z*r, k.z*r), r); return length(p)*sign(p.y); } float sdHexagram(vec2 p, float r) { vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076); p = abs(p); p -= 2.0*min(dot(k.xy,p),0.0)*k.xy; p -= 2.0*min(dot(k.yx,p),0.0)*k.yx; p -= vec2(clamp(p.x,r*k.z,r*k.w),r); return length(p)*sign(p.y); } float sdRhombus(vec2 p, vec2 b) { vec2 q = abs(p); float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0); float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) ); return d * sign( q.x*b.y + q.y*b.x - b.x*b.y ); } float sdVesica(vec2 p, float r, float d) { p = abs(p); float b = sqrt(r*r-d*d); // can delay this sqrt return ((p.y-b)*d>p.x*b) ? length(p-vec2(0.0,b)) : length(p-vec2(-d,0.0))-r; } `,Cg=/precision\s+(high|low|medium)p\s+float/,Og=`#ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; #else precision mediump float; #endif `,sz=/#pragma include (["^+"]?["[a-zA-Z_0-9](.*)"]*?)/g,uz=/void\s+main\s*\([^)]*\)\s*\{\n?/;class lz{constructor(){E(this,"moduleCache",{}),E(this,"rawContentCache",{})}registerBuiltinModules(){this.destroy(),this.registerModule("common",{vs:Sg,fs:Sg}),this.registerModule("decode",{vs:ez,fs:""}),this.registerModule("scene_uniforms",{vs:Rg,fs:Rg}),this.registerModule("picking_uniforms",{vs:xg,fs:xg}),this.registerModule("projection",{vs:bg,fs:bg}),this.registerModule("project",{vs:iz,fs:""}),this.registerModule("sdf_2d",{vs:"",fs:az}),this.registerModule("lighting",{vs:tz,fs:""}),this.registerModule("light",{vs:J$,fs:""}),this.registerModule("picking",{vs:nz,fs:rz}),this.registerModule("rotation_2d",{vs:oz,fs:""})}registerModule(t,r){r.vs=r.vs.replace(/\r\n/g,` `),r.fs=r.fs.replace(/\r\n/g,` `);const{vs:n,fs:i,uniforms:o,defines:a,inject:s}=r,{content:u,uniforms:l}=kh(n),{content:f,uniforms:c}=kh(i);this.rawContentCache[t]={fs:f,defines:a,inject:s,uniforms:he(he(he({},l),c),o),vs:u}}getModule(t){let r=this.rawContentCache[t].vs,n=this.rawContentCache[t].fs;const{defines:i={},inject:o={}}=this.rawContentCache[t];let a={};o["vs:#decl"]&&(r=o["vs:#decl"]+r,a=kh(o["vs:#decl"]).uniforms),o["vs:#main-start"]&&(r=r.replace(uz,v=>v+o["vs:#main-start"])),o["fs:#decl"]&&(n=o["fs:#decl"]+n),r=cz(i)+r;const{content:u,includeList:l}=this.processModule(r,[],"vs"),{content:f,includeList:c}=this.processModule(n,[],"fs"),h=Q$(l.concat(c).concat(t)).reduce((v,g)=>he(he({},v),this.rawContentCache[g].uniforms),he({},a)),d=(Cg.test(f)?"":Og)+u,p=(Cg.test(f)?"":Og)+f;return this.moduleCache[t]={vs:d.trim(),fs:p.trim(),uniforms:h},this.moduleCache[t]}destroy(){this.moduleCache={},this.rawContentCache={}}processModule(t,r,n){return{content:t.replace(sz,(o,a)=>{const u=a.split(" ")[0].replace(/"/g,"");if(r.indexOf(u)>-1)return"";const l=this.rawContentCache[u][n];r.push(u);const{content:f}=this.processModule(l,r,n);return f}),includeList:r}}}function cz(e){return Object.keys(e).reduce((r,n)=>r+`#define ${n.toUpperCase()} ${e[n]} `,` `)}class jp{constructor(){E(this,"shaderModuleService",void 0),E(this,"rendererService",void 0),E(this,"cameraService",void 0),E(this,"mapService",void 0),E(this,"interactionService",void 0),E(this,"layerService",void 0),E(this,"config",void 0)}getName(){return""}getType(){return Fu.Normal}init(t,r){this.config=r,this.rendererService=t.getContainer().rendererService,this.cameraService=t.getContainer().cameraService,this.mapService=t.getContainer().mapService,this.interactionService=t.getContainer().interactionService,this.layerService=t.getContainer().layerService,this.shaderModuleService=t.getContainer().shaderModuleService}render(t){}}class fz extends jp{getName(){return"clear"}init(t,r){super.init(t,r)}render(){this.rendererService.clear({color:[0,0,0,0],depth:1,framebuffer:null})}}class hz{constructor(t){E(this,"passes",[]),E(this,"layer",void 0),E(this,"renderFlag",void 0),E(this,"width",0),E(this,"height",0),this.postProcessor=t}setLayer(t){this.layer=t}setRenderFlag(t){this.renderFlag=t}getRenderFlag(){return this.renderFlag}getPostProcessor(){return this.postProcessor}render(){var t=this;return ve(function*(){for(const r of t.passes)yield r.render(t.layer);yield t.postProcessor.render(t.layer)})()}resize(t,r){(this.width!==t||this.height!==r)&&(this.postProcessor.resize(t,r),this.width=t,this.height=r)}add(t,r){t.getType()===Fu.PostProcessing?this.postProcessor.add(t,this.layer,r):(t.init(this.layer,r),this.passes.push(t))}insert(t,r,n){t.init(this.layer,r),this.passes.splice(n,0,t)}destroy(){this.passes.length=0}}class dz extends jp{constructor(...t){var r;super(...t),r=this,E(this,"pickingFBO",void 0),E(this,"layer",void 0),E(this,"width",0),E(this,"height",0),E(this,"alreadyInRendering",!1),E(this,"pickFromPickingFBO",({x:n,y:i,lngLat:o,type:a})=>{if(!this.layer.isVisible()||!this.layer.needPick(a))return;const{getViewportSize:s,readPixelsAsync:u,useFramebuffer:l}=this.rendererService,{width:f,height:c}=s(),{enableHighlight:h,enableSelect:d}=this.layer.getLayerConfig(),p=n*ln,v=i*ln;if(p>f||p<0||v>c||v<0)return;let g;l(this.pickingFBO,ve(function*(){var y;if(g=yield u({x:Math.round(p),y:Math.round(c-(i+1)*ln),width:1,height:1,data:new Uint8Array(1*1*4),framebuffer:r.pickingFBO}),g[0]!==0||g[1]!==0||g[2]!==0){const S=yo(g),R=r.layer.getSource().getFeatureById(S),x={x:n,y:i,type:a,lngLat:o,featureId:S,feature:R};R&&(r.layer.setCurrentPickId(S),r.triggerHoverOnLayer(x))}else{const S={x:n,y:i,lngLat:o,type:r.layer.getCurrentPickId()===null?"un"+a:"mouseout",featureId:null,feature:null};r.triggerHoverOnLayer(he(he({},S),{},{type:"unpick"})),r.triggerHoverOnLayer(S),r.layer.setCurrentPickId(null)}h&&r.highlightPickedFeature(g),d&&a==="click"&&((y=g)===null||y===void 0?void 0:y.toString())!==[0,0,0,0].toString()&&r.selectFeature(g)}))})}getType(){return Fu.Normal}getName(){return"pixelPicking"}init(t,r){super.init(t,r),this.layer=t;const{createTexture2D:n,createFramebuffer:i,getViewportSize:o}=this.rendererService,{width:a,height:s}=o(),u=n({width:a,height:s,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,label:"Picking Texture"});this.pickingFBO=i({color:u}),this.interactionService.on(cn.Hover,this.pickFromPickingFBO),this.interactionService.on(cn.Select,this.selectFeatureHandle.bind(this)),this.interactionService.on(cn.Active,this.highlightFeatureHandle.bind(this))}render(t){if(this.alreadyInRendering)return;const{getViewportSize:r,useFramebuffer:n,clear:i}=this.rendererService,{width:o,height:a}=r();this.alreadyInRendering=!0,(this.width!==o||this.height!==a)&&(this.pickingFBO.resize({width:o,height:a}),this.width=o,this.height=a),n(this.pickingFBO,()=>{i({framebuffer:this.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});const s=this.layer.multiPassRenderer.getRenderFlag();this.layer.multiPassRenderer.setRenderFlag(!1),t.hooks.beforePickingEncode.call(),t.render(),t.hooks.afterPickingEncode.call(),this.layer.multiPassRenderer.setRenderFlag(s),this.alreadyInRendering=!1})}triggerHoverOnLayer(t){this.layer.emit(t.type,t)}highlightPickedFeature(t){const[r,n,i]=t;this.layer.hooks.beforeHighlight.call([r,n,i]),this.layerService.renderLayers()}selectFeature(t){const[r,n,i]=t;this.layer.hooks.beforeSelect.call([r,n,i]),this.layerService.renderLayers()}selectFeatureHandle({featureId:t}){const r=La(t);this.selectFeature(new Uint8Array(r))}highlightFeatureHandle({featureId:t}){const r=La(t);this.highlightPickedFeature(new Uint8Array(r))}}class pz{constructor(t){E(this,"passes",[]),E(this,"readFBO",void 0),E(this,"writeFBO",void 0),this.rendererService=t,this.init()}getReadFBO(){return this.readFBO}getWriteFBO(){return this.writeFBO}getCurrentFBOTex(){const{getViewportSize:t,createTexture2D:r}=this.rendererService,{width:n,height:i}=t();return r({x:0,y:0,width:n,height:i,copy:!0})}getReadFBOTex(){var t=this;const{useFramebuffer:r}=this.rendererService;return new Promise(n=>{r(this.readFBO,ve(function*(){n(t.getCurrentFBOTex())}))})}renderBloomPass(t,r){var n=this;return ve(function*(){const i=yield n.getReadFBOTex();let o=0;for(;o<4;)yield r.render(t,i),n.swap(),o++})()}render(t){var r=this;return ve(function*(){for(let n=0;nr.getName()===t)}init(){const{createFramebuffer:t,createTexture2D:r}=this.rendererService;this.readFBO=t({color:r({width:1,height:1,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,usage:pu.RENDER_TARGET})}),this.writeFBO=t({color:r({width:1,height:1,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,usage:pu.RENDER_TARGET})})}isLastEnabledPass(t){for(let r=t+1;r{n({color:[0,0,0,0],depth:1,stencil:0,framebuffer:i}),t.multiPassRenderer.setRenderFlag(!1),t.models.forEach(o=>{o.draw({uniforms:t.layerModel.getUninforms()})}),t.multiPassRenderer.setRenderFlag(!0)})}}const vz=`varying vec2 v_UV; uniform float u_BloomFinal: 0.0; uniform sampler2D u_Texture; uniform sampler2D u_Texture2; uniform vec2 u_ViewportSize: [1.0, 1.0]; uniform float u_radius: 5.0; uniform float u_intensity: 0.3; uniform float u_baseRadio: 0.5; // https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) { vec4 color = vec4(0.0); vec2 off1 = vec2(1.3846153846) * direction; vec2 off2 = vec2(3.2307692308) * direction; color += texture2D(image, uv) * 0.2270270270; color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162; color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162; color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703; color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703; return color; } float luminance(vec4 color) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b; } void main() { // vec4 baseColor = texture2D(u_Texture, v_UV); float r = sqrt(u_radius); vec4 c1 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(u_radius, 0.0)); // c1 *= luminance(c1); vec4 c2 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(0.0, u_radius)); // c2 *= luminance(c2); vec4 c3 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(r, r)); // c3 *= luminance(c3); vec4 c4 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(r, -r)); // c4 *= luminance(c4); vec4 inbloomColor = (c1 + c2 + c3 + c4) * 0.25; // float lum = luminance(inbloomColor); // inbloomColor.rgb *= lum; if(u_BloomFinal > 0.0) { vec4 baseColor = texture2D(u_Texture2, v_UV); float baselum = luminance(baseColor); gl_FragColor = mix(inbloomColor, baseColor, u_baseRadio); if(baselum <= 0.2) { gl_FragColor = inbloomColor * u_intensity; } } else { gl_FragColor = inbloomColor; } }`,mz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`,{isNil:Vh}=Sr;class gz extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:mz,fs:vz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return Vh(t.bloomRadius)||(r.u_radius=t.bloomRadius),Vh(t.bloomIntensity)||(r.u_intensity=t.bloomIntensity),Vh(t.bloomBaseRadio)||(r.u_baseRadio=t.bloomBaseRadio),r}}const Ez=`varying vec2 v_UV; uniform sampler2D u_Texture; uniform vec2 u_ViewportSize: [1.0, 1.0]; uniform vec2 u_BlurDir: [1.0, 0.0]; // https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) { vec4 color = vec4(0.0); vec2 off1 = vec2(1.3846153846) * direction; vec2 off2 = vec2(3.2307692308) * direction; color += texture2D(image, uv) * 0.2270270270; color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162; color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162; color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703; color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703; return color; } void main() { gl_FragColor = blur9(u_Texture, v_UV, u_ViewportSize, u_BlurDir); }`,yz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`,{isNil:Tz}=Sr;class Az extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:yz,fs:Ez});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return Tz(t.blurRadius)||(r.u_BlurDir=[t.blurRadius,0]),r}}const Sz=`varying vec2 v_UV; uniform sampler2D u_Texture; uniform vec2 u_ViewportSize: [1.0, 1.0]; uniform vec2 u_BlurDir: [1.0, 0.0]; // https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) { vec4 color = vec4(0.0); vec2 off1 = vec2(1.3846153846) * direction; vec2 off2 = vec2(3.2307692308) * direction; color += texture2D(image, uv) * 0.2270270270; color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162; color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162; color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703; color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703; return color; } void main() { gl_FragColor = blur9(u_Texture, v_UV, u_ViewportSize, u_BlurDir); }`,xz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`,{isNil:bz}=Sr;class Rz extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:xz,fs:Sz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return bz(t.blurRadius)||(r.u_BlurDir=[0,t.blurRadius]),r}}const Cz=`varying vec2 v_UV; uniform sampler2D u_Texture; uniform vec2 u_ViewportSize: [1.0, 1.0]; uniform vec2 u_Center : [0.5, 0.5]; uniform float u_Angle : 0; uniform float u_Size : 8; #pragma include "common" float scale = PI / u_Size; float pattern(float u_Angle, vec2 texSize, vec2 texCoord) { float s = sin(u_Angle), c = cos(u_Angle); vec2 tex = texCoord * texSize - u_Center * texSize; vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale; return (sin(point.x) * sin(point.y)) * 4.0; } // https://github.com/evanw/glfx.js/blob/master/src/filters/fun/colorhalftone.js vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) { vec3 cmy = 1.0 - color.rgb; float k = min(cmy.x, min(cmy.y, cmy.z)); cmy = (cmy - k) / (1.0 - k); cmy = clamp( cmy * 10.0 - 3.0 + vec3( pattern(u_Angle + 0.26179, texSize, texCoord), pattern(u_Angle + 1.30899, texSize, texCoord), pattern(u_Angle, texSize, texCoord) ), 0.0, 1.0 ); k = clamp(k * 10.0 - 5.0 + pattern(u_Angle + 0.78539, texSize, texCoord), 0.0, 1.0); return vec4(1.0 - cmy - k, color.a); } void main() { gl_FragColor = vec4(texture2D(u_Texture, v_UV)); gl_FragColor = colorHalftone_filterColor(gl_FragColor, u_ViewportSize, v_UV); }`,Oz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`;class Iz extends Ai{setupShaders(){this.shaderModuleService.registerModule("colorhalftone-pass",{vs:Oz,fs:Cz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("colorhalftone-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const Mz=`varying vec2 v_UV; uniform sampler2D u_Texture; void main() { gl_FragColor = vec4(texture2D(u_Texture, v_UV)); }`,Nz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`;class Pz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("copy-pass",{vs:Nz,fs:Mz}),this.shaderModuleService.getModule("copy-pass")}}const Lz=`varying vec2 v_UV; uniform sampler2D u_Texture; uniform vec2 u_ViewportSize: [1.0, 1.0]; uniform vec2 u_Center : [0.5, 0.5]; uniform float u_Scale : 10; // https://github.com/evanw/glfx.js/blob/master/src/filters/fun/hexagonalpixelate.js vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) { vec2 tex = (texCoord * texSize - u_Center * texSize) / u_Scale; tex.y /= 0.866025404; tex.x -= tex.y * 0.5; vec2 a; if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) { a = vec2(floor(tex.x), floor(tex.y)); } else a = vec2(ceil(tex.x), ceil(tex.y)); vec2 b = vec2(ceil(tex.x), floor(tex.y)); vec2 c = vec2(floor(tex.x), ceil(tex.y)); vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y); vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y); vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y); vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y); float alen = length(TEX - A); float blen = length(TEX - B); float clen = length(TEX - C); vec2 choice; if (alen < blen) { if (alen < clen) choice = a; else choice = c; } else { if (blen < clen) choice = b; else choice = c; } choice.x += choice.y * 0.5; choice.y *= 0.866025404; choice *= u_Scale / texSize; return texture2D(texture, choice + u_Center); } void main() { gl_FragColor = vec4(texture2D(u_Texture, v_UV)); gl_FragColor = hexagonalPixelate_sampleColor(u_Texture, u_ViewportSize, v_UV); }`,wz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`;class Fz extends Ai{setupShaders(){this.shaderModuleService.registerModule("hexagonalpixelate-pass",{vs:wz,fs:Lz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("hexagonalpixelate-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const Bz=`varying vec2 v_UV; uniform sampler2D u_Texture; uniform vec2 u_ViewportSize: [1.0, 1.0]; uniform float u_Strength : 0.6; vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) { vec2 dx = vec2(1.0 / texSize.x, 0.0); vec2 dy = vec2(0.0, 1.0 / texSize.y); vec4 color = texture2D(texture, texCoord); float bigTotal = 0.0; float smallTotal = 0.0; vec3 bigAverage = vec3(0.0); vec3 smallAverage = vec3(0.0); for (float x = -2.0; x <= 2.0; x += 1.0) { for (float y = -2.0; y <= 2.0; y += 1.0) { vec3 sample = texture2D(texture, texCoord + dx * x + dy * y).rgb; bigAverage += sample; bigTotal += 1.0; if (abs(x) + abs(y) < 2.0) { smallAverage += sample; smallTotal += 1.0; } } } vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal); float power = u_Strength * u_Strength * u_Strength * u_Strength * u_Strength; return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a); } void main() { gl_FragColor = vec4(texture2D(u_Texture, v_UV)); gl_FragColor = ink_sampleColor(u_Texture, u_ViewportSize, v_UV); }`,Dz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`;class Uz extends Ai{setupShaders(){this.shaderModuleService.registerModule("ink-pass",{vs:Dz,fs:Bz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("ink-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const kz=`varying vec2 v_UV; uniform sampler2D u_Texture; uniform float u_Amount : 0.5; float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js vec4 noise_filterColor(vec4 color, vec2 texCoord) { float diff = (rand(texCoord) - 0.5) * u_Amount; color.r += diff; color.g += diff; color.b += diff; return color; } void main() { gl_FragColor = vec4(texture2D(u_Texture, v_UV)); gl_FragColor = noise_filterColor(gl_FragColor, v_UV); }`,$z=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`;class zz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("noise-pass",{vs:$z,fs:kz}),this.shaderModuleService.getModule("noise-pass")}}const Vz=`attribute vec2 a_Position; varying vec2 v_UV; void main() { v_UV = 0.5 * (a_Position + 1.0); gl_Position = vec4(a_Position, 0., 1.); }`,Hz=`varying vec2 v_UV; uniform sampler2D u_Texture; uniform float u_Amount : 0.5; // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/sepia.js vec4 sepia_filterColor(vec4 color) { float r = color.r; float g = color.g; float b = color.b; color.r = min(1.0, (r * (1.0 - (0.607 * u_Amount))) + (g * (0.769 * u_Amount)) + (b * (0.189 * u_Amount))); color.g = min(1.0, (r * 0.349 * u_Amount) + (g * (1.0 - (0.314 * u_Amount))) + (b * 0.168 * u_Amount)); color.b = min(1.0, (r * 0.272 * u_Amount) + (g * 0.534 * u_Amount) + (b * (1.0 - (0.869 * u_Amount)))); return color; } void main() { gl_FragColor = vec4(texture2D(u_Texture, v_UV)); gl_FragColor = sepia_filterColor(gl_FragColor); }`;class jz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("sepia-pass",{vs:Vz,fs:Hz}),this.shaderModuleService.getModule("sepia-pass")}}const OA=new X9;let Xz=0;function Wz(){const e=new lz,t=new Z9,r=new B9,n=new Y9(r),i=new T9,o=new S9,a=new k9,s=new $9,u=new U9,l={id:`${Xz++}`,globalConfigService:OA,shaderModuleService:e,debugService:t,cameraService:r,coordinateSystemService:n,fontService:i,iconService:o,markerService:a,popupService:s,controlService:u,customRenderService:{}},f=new i$(l);l.layerService=f;const c=new K$(l);l.sceneService=c;const h=new Q9(l);l.interactionService=h;const d=new r$(l);l.pickingService=d;const p={clear:new fz,pixelPicking:new dz,render:new _z};l.normalPassFactory=g=>p[g];const v={copy:new Pz,bloom:new gz,blurH:new Az,blurV:new Rz,noise:new zz,sepia:new jz,colorHalftone:new Iz,hexagonalPixelate:new Fz,ink:new Uz};return l.postProcessingPass=v,l.postProcessingPassFactory=g=>v[g],l}function su(e){const t=he({},e);return t.postProcessor=new pz(t.rendererService),t.multiPassRenderer=new hz(t.postProcessor),t.styleAttributeService=new f$(t.rendererService),t}const Nl=["loaded","fontloaded","maploaded","resize","destroy","dragstart","dragging","dragend","dragcancel"];let Hr=function(e){return e.IMAGE="image",e.CUSTOMIMAGE="customImage",e.ARRAYBUFFER="arraybuffer",e.RGB="rgb",e.TERRAINRGB="terrainRGB",e.CUSTOMRGB="customRGB",e.CUSTOMARRAYBUFFER="customArrayBuffer",e.CUSTOMTERRAINRGB="customTerrainRGB",e}({});var IA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),Gz=(e,t,r,n)=>IA(void 0,null,function*(){return new Promise((i,o)=>{t({x:e.x,y:e.y,z:e.z},(a,s)=>{if(a||s.length===0){o(a);return}s&&Rd([{data:s,bands:[0]}],r,n,(u,l)=>{u?o(u):l&&i(l)})})})}),Yz=(e,t)=>IA(void 0,null,function*(){return new Promise((r,n)=>{t({x:e.x,y:e.y,z:e.z},(i,o)=>{if(i||!o){n(i);return}o instanceof ArrayBuffer?c2(o,(a,s)=>{a&&n(a),r(s)}):o instanceof HTMLImageElement?r(o):n(i)})})});function Zz(e,t){return Array.isArray(e)?typeof e[0]=="string"?e.map(r=>xa(r,t)):e.map(r=>({url:xa(r.url,t),bands:r.bands||[0]})):xa(e,t)}function qz(e){return typeof e=="string"?[{url:e,bands:[0]}]:typeof e[0]=="string"?e.map(t=>({url:t,bands:[0]})):e}function Ig(e,t){e.xhrCancel=()=>{t.map(r=>{r.abort()})}}var Kz=Object.defineProperty,Qz=Object.defineProperties,Jz=Object.getOwnPropertyDescriptors,Mg=Object.getOwnPropertySymbols,eV=Object.prototype.hasOwnProperty,tV=Object.prototype.propertyIsEnumerable,Ng=(e,t,r)=>t in e?Kz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pg=(e,t)=>{for(var r in t||(t={}))eV.call(t,r)&&Ng(e,r,t[r]);if(Mg)for(var r of Mg(t))tV.call(t,r)&&Ng(e,r,t[r]);return e},Lg=(e,t)=>Qz(e,Jz(t)),MA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),rV=(e,t,r,n,i)=>MA(void 0,null,function*(){const o=qz(t.url);if(o.length>1){const{rasterFiles:a,xhrList:s,errList:u}=yield nV(o,t);if(Ig(e,s),u.length>0){r(u,null);return}Rd(a,n,i,r)}else{const a=_p(t,(s,u)=>{if(s)r(s);else if(u){const l=[{data:u,bands:o[0].bands}];Rd(l,n,i,r)}});Ig(e,[a])}});function nV(e,t){return MA(this,null,function*(){const r=[],n=[],i=[];for(let o=0;ot in e?iV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ql=(e,t)=>{for(var r in t||(t={}))sV.call(t,r)&&Fg(e,r,t[r]);if(wg)for(var r of wg(t))uV.call(t,r)&&Fg(e,r,t[r]);return e},NA=(e,t)=>oV(e,aV(t)),PA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),lV=(e,t,r,n)=>PA(void 0,null,function*(){const{format:i=LA,operation:o,requestParameters:a={}}=n,s=NA(Ql({},a),{url:Zz(e,t)});return new Promise((u,l)=>{rV(r,s,(f,c)=>{f?l(f):c&&u(c)},i,o)})}),Bg=(e,t,r,n)=>PA(void 0,null,function*(){let i;const o=Array.isArray(e)?e[0]:e;return n.wmtsOptions?i=((n==null?void 0:n.getURLFromTemplate)||DU)(o,Ql(Ql({},t),n.wmtsOptions)):i=((n==null?void 0:n.getURLFromTemplate)||xa)(o,t),new Promise((a,s)=>{var u;const l=sd(NA(Ql({},n==null?void 0:n.requestParameters),{url:i,type:((u=n==null?void 0:n.requestParameters)==null?void 0:u.type)||"arrayBuffer"}),(f,c)=>{f?s(f):c&&a(c)},n.transformResponse);r.xhrCancel=()=>l.cancel()})}),LA=()=>({rasterData:new Uint8Array([0]),width:1,height:1}),cV=Object.defineProperty,fV=Object.defineProperties,hV=Object.getOwnPropertyDescriptors,Dg=Object.getOwnPropertySymbols,dV=Object.prototype.hasOwnProperty,pV=Object.prototype.propertyIsEnumerable,Ug=(e,t,r)=>t in e?cV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,kg=(e,t)=>{for(var r in t||(t={}))dV.call(t,r)&&Ug(e,r,t[r]);if(Dg)for(var r of Dg(t))pV.call(t,r)&&Ug(e,r,t[r]);return e},_V=(e,t)=>fV(e,hV(t)),vV={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0,warp:!0};Hr.ARRAYBUFFER,Hr.RGB;function mV(e){return!!(Array.isArray(e)&&e.length===0||!Array.isArray(e)&&typeof e!="string")}function gV(e,t={}){if(mV(e))throw new Error("tile server url is error");let r=(t==null?void 0:t.dataType)||Hr.IMAGE;r===Hr.RGB&&(r=Hr.ARRAYBUFFER);const n=(o,a)=>{switch(r){case Hr.IMAGE:return Bg(e,o,a,t);case Hr.CUSTOMIMAGE:case Hr.CUSTOMTERRAINRGB:return Yz(a,t==null?void 0:t.getCustomData);case Hr.ARRAYBUFFER:return lV(e,o,a,t);case Hr.CUSTOMARRAYBUFFER:case Hr.CUSTOMRGB:return Gz(a,t==null?void 0:t.getCustomData,(t==null?void 0:t.format)||LA,t==null?void 0:t.operation);default:return Bg(e,o,a,t)}},i=_V(kg(kg({},vV),t),{getTileData:n});return{data:e,dataArray:[],tilesetOptions:i,isTile:!0}}var EV=Object.defineProperty,yV=Object.defineProperties,TV=Object.getOwnPropertyDescriptors,Ac=Object.getOwnPropertySymbols,wA=Object.prototype.hasOwnProperty,FA=Object.prototype.propertyIsEnumerable,$g=(e,t,r)=>t in e?EV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,AV=(e,t)=>{for(var r in t||(t={}))wA.call(t,r)&&$g(e,r,t[r]);if(Ac)for(var r of Ac(t))FA.call(t,r)&&$g(e,r,t[r]);return e},SV=(e,t)=>yV(e,TV(t)),xV=(e,t)=>{var r={};for(var n in e)wA.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ac)for(var n of Ac(e))t.indexOf(n)<0&&FA.call(e,n)&&(r[n]=e[n]);return r};function bV(e,t){const r=t,{extent:n=[121.168,30.2828,121.384,30.4219],coordinates:i,width:o,height:a}=r,s=xV(r,["extent","coordinates","width","height"]);e.length<2&&console.warn("RGB解析需要2个波段的数据");const[u,l]=s.bands||[0,1],f=[e[u],e[l]],c=[];for(let p=0;pt in e?RV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,IV=(e,t)=>{for(var r in t||(t={}))BA.call(t,r)&&zg(e,r,t[r]);if(Sc)for(var r of Sc(t))DA.call(t,r)&&zg(e,r,t[r]);return e},MV=(e,t)=>CV(e,OV(t)),NV=(e,t)=>{var r={};for(var n in e)BA.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Sc)for(var n of Sc(e))t.indexOf(n)<0&&DA.call(e,n)&&(r[n]=e[n]);return r};function PV(e,t){const r=t,{extent:n,coordinates:i,width:o,height:a}=r,s=NV(r,["extent","coordinates","width","height"]);e.length<3&&console.warn("RGB解析需要三个波段的数据");const[u,l,f]=s.bands||[0,1,2],c=[e[u],e[l],e[f]],h=[],[d,p]=(s==null?void 0:s.countCut)||[2,98],v=(s==null?void 0:s.RMinMax)||Ra(c[0],d,p),g=(s==null?void 0:s.GMinMax)||Ra(c[1],d,p),y=(s==null?void 0:s.BMinMax)||Ra(c[2],d,p);for(let x=0;xt in e?LV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,BV=(e,t)=>{for(var r in t||(t={}))UA.call(t,r)&&Vg(e,r,t[r]);if(xc)for(var r of xc(t))kA.call(t,r)&&Vg(e,r,t[r]);return e},DV=(e,t)=>wV(e,FV(t)),UV=(e,t)=>{var r={};for(var n in e)UA.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&xc)for(var n of xc(e))t.indexOf(n)<0&&kA.call(e,n)&&(r[n]=e[n]);return r};function kV(e,t){const r=t,{extent:n,coordinates:i,min:o,max:a,width:s,height:u,format:l,operation:f}=r,c=UV(r,["extent","coordinates","min","max","width","height","format","operation"]);let h;if(l===void 0||YT(e))h=Array.from(e);else{const v=Array.isArray(e)?e:[e];h=Bp(v,l,f)}const d=wu(i,n);return{_id:1,dataArray:[DV(BV({_id:1,data:h,width:s,height:u},c),{min:o,max:a,coordinates:d})]}}var $V=Object.defineProperty,zV=Object.defineProperties,VV=Object.getOwnPropertyDescriptors,Hg=Object.getOwnPropertySymbols,HV=Object.prototype.hasOwnProperty,jV=Object.prototype.propertyIsEnumerable,jg=(e,t,r)=>t in e?$V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xg=(e,t)=>{for(var r in t||(t={}))HV.call(t,r)&&jg(e,r,t[r]);if(Hg)for(var r of Hg(t))jV.call(t,r)&&jg(e,r,t[r]);return e},XV=(e,t)=>zV(e,VV(t)),WV=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),GV={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0},YV=e=>WV(void 0,null,function*(){return new Promise(t=>{const[r,n,i,o]=e.bounds,a={layers:{testTile:{features:[{type:"Feature",properties:{key:e.x+"/"+e.y+"/"+e.z,x:(r+i)/2,y:(n+o)/2},geometry:{type:"LineString",coordinates:[[i,o],[i,n],[r,n],[r,n]]}}]}}};t(a)})});function ZV(e,t){const r=i=>YV(i),n=XV(Xg(Xg({},GV),t),{getTileData:r});return{data:e,dataArray:[],tilesetOptions:n,isTile:!0}}var $A={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(mo,function(){function r(q,k,G,K,ce,Pe){if(!(ce-K<=G)){var Xe=K+ce>>1;n(q,k,Xe,K,ce,Pe%2),r(q,k,G,K,Xe-1,Pe+1),r(q,k,G,Xe+1,ce,Pe+1)}}function n(q,k,G,K,ce,Pe){for(;ce>K;){if(ce-K>600){var Xe=ce-K+1,Je=G-K+1,ft=Math.log(Xe),Ge=.5*Math.exp(2*ft/3),et=.5*Math.sqrt(ft*Ge*(Xe-Ge)/Xe)*(Je-Xe/2<0?-1:1),vt=Math.max(K,Math.floor(G-Je*Ge/Xe+et)),mt=Math.min(ce,Math.floor(G+(Xe-Je)*Ge/Xe+et));n(q,k,G,vt,mt,Pe)}var It=k[2*G+Pe],wt=K,gt=ce;for(i(q,k,K,G),k[2*ce+Pe]>It&&i(q,k,K,ce);wtIt;)gt--}k[2*K+Pe]===It?i(q,k,K,gt):(gt++,i(q,k,gt,ce)),gt<=G&&(K=gt+1),G<=gt&&(ce=gt-1)}}function i(q,k,G,K){o(q,G,K),o(k,2*G,2*K),o(k,2*G+1,2*K+1)}function o(q,k,G){var K=q[k];q[k]=q[G],q[G]=K}function a(q,k,G,K,ce,Pe,Xe){for(var Je=[0,q.length-1,0],ft=[],Ge,et;Je.length;){var vt=Je.pop(),mt=Je.pop(),It=Je.pop();if(mt-It<=Xe){for(var wt=It;wt<=mt;wt++)Ge=k[2*wt],et=k[2*wt+1],Ge>=G&&Ge<=ce&&et>=K&&et<=Pe&&ft.push(q[wt]);continue}var gt=Math.floor((It+mt)/2);Ge=k[2*gt],et=k[2*gt+1],Ge>=G&&Ge<=ce&&et>=K&&et<=Pe&&ft.push(q[gt]);var xr=(vt+1)%2;(vt===0?G<=Ge:K<=et)&&(Je.push(It),Je.push(gt-1),Je.push(xr)),(vt===0?ce>=Ge:Pe>=et)&&(Je.push(gt+1),Je.push(mt),Je.push(xr))}return ft}function s(q,k,G,K,ce,Pe){for(var Xe=[0,q.length-1,0],Je=[],ft=ce*ce;Xe.length;){var Ge=Xe.pop(),et=Xe.pop(),vt=Xe.pop();if(et-vt<=Pe){for(var mt=vt;mt<=et;mt++)u(k[2*mt],k[2*mt+1],G,K)<=ft&&Je.push(q[mt]);continue}var It=Math.floor((vt+et)/2),wt=k[2*It],gt=k[2*It+1];u(wt,gt,G,K)<=ft&&Je.push(q[It]);var xr=(Ge+1)%2;(Ge===0?G-ce<=wt:K-ce<=gt)&&(Xe.push(vt),Xe.push(It-1),Xe.push(xr)),(Ge===0?G+ce>=wt:K+ce>=gt)&&(Xe.push(It+1),Xe.push(et),Xe.push(xr))}return Je}function u(q,k,G,K){var ce=q-G,Pe=k-K;return ce*ce+Pe*Pe}var l=function(q){return q[0]},f=function(q){return q[1]},c=function(k,G,K,ce,Pe){G===void 0&&(G=l),K===void 0&&(K=f),ce===void 0&&(ce=64),Pe===void 0&&(Pe=Float64Array),this.nodeSize=ce,this.points=k;for(var Xe=k.length<65536?Uint16Array:Uint32Array,Je=this.ids=new Xe(k.length),ft=this.coords=new Pe(k.length*2),Ge=0;Ge=ce;et--){var vt=+Date.now();ft=this._cluster(ft,et),this.trees[et]=new c(ft,Y,ge,Xe,Float32Array),K&&console.log("z%d: %d clusters in %dms",et,ft.length,+Date.now()-vt)}return K&&console.timeEnd("total time"),this},p.prototype.getClusters=function(k,G){var K=((k[0]+180)%360+360)%360-180,ce=Math.max(-90,Math.min(90,k[1])),Pe=k[2]===180?180:((k[2]+180)%360+360)%360-180,Xe=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)K=-180,Pe=180;else if(K>Pe){var Je=this.getClusters([K,ce,180,Xe],G),ft=this.getClusters([-180,ce,Pe,Xe],G);return Je.concat(ft)}for(var Ge=this.trees[this._limitZoom(G)],et=Ge.range(R(K),x(Xe),R(Pe),x(ce)),vt=[],mt=0,It=et;mtG&&(gt+=le.numPoints||1)}if(gt>wt&>>=ft){for(var ze=vt.x*wt,nt=vt.y*wt,Ae=Je&&wt>1?this._map(vt,!0):null,Dt=(et<<5)+(G+1)+this.points.length,Et=0,zt=It;Et1)for(var $r=0,dr=It;$r>5},p.prototype._getOriginZoom=function(k){return(k-this.points.length)%32},p.prototype._map=function(k,G){if(k.numPoints)return G?F({},k.properties):k.properties;var K=this.points[k.index].properties,ce=this.options.map(K);return G&&ce===K?F({},ce):ce};function v(q,k,G,K,ce){return{x:d(q),y:d(k),zoom:1/0,id:G,parentId:-1,numPoints:K,properties:ce}}function g(q,k){var G=q.geometry.coordinates,K=G[0],ce=G[1];return{x:d(R(K)),y:d(x(ce)),zoom:1/0,index:k,parentId:-1}}function y(q){return{type:"Feature",id:q.id,properties:S(q),geometry:{type:"Point",coordinates:[M(q.x),$(q.y)]}}}function S(q){var k=q.numPoints,G=k>=1e4?Math.round(k/1e3)+"k":k>=1e3?Math.round(k/100)/10+"k":k;return F(F({},q.properties),{cluster:!0,cluster_id:q.id,point_count:k,point_count_abbreviated:G})}function R(q){return q/360+.5}function x(q){var k=Math.sin(q*Math.PI/180),G=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return G<0?0:G>1?1:G}function M(q){return(q-.5)*360}function $(q){var k=(180-q*360)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function F(q,k){for(var G in k)q[G]=k[G];return q}function Y(q){return q.x}function ge(q){return q.y}return p})})($A);var qV=$A.exports;const KV=Ht(qV);var QV=Object.defineProperty,Wg=Object.getOwnPropertySymbols,JV=Object.prototype.hasOwnProperty,eH=Object.prototype.propertyIsEnumerable,Gg=(e,t,r)=>t in e?QV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zA=(e,t)=>{for(var r in t||(t={}))JV.call(t,r)&&Gg(e,r,t[r]);if(Wg)for(var r of Wg(t))eH.call(t,r)&&Gg(e,r,t[r]);return e};function VA(e,t){const{radius:r=40,maxZoom:n=18,minZoom:i=0,zoom:o=2}=t;if(e.pointIndex){const u=e.pointIndex.getClusters(e.extent,Math.floor(o));return e.dataArray=tH(u),e}const a=new KV({radius:r,minZoom:i,maxZoom:n}),s={type:"FeatureCollection",features:[]};return s.features=e.dataArray.map(u=>({type:"Feature",geometry:{type:"Point",coordinates:u.coordinates},properties:zA({},u)})),a.load(s.features),a}function tH(e){return e.map((t,r)=>zA({coordinates:t.geometry.coordinates,_id:r+1},t.properties))}function rH(e){if(e.length===0)throw new Error("max requires at least one data point");let t=e[0];for(let r=1;rt&&(t=e[r]);return t}function nH(e){if(e.length===0)throw new Error("min requires at least one data point");let t=e[0];for(let r=1;r=Math.abs(e[i])?r+=t-n+e[i]:r+=e[i]-n+t,t=n;return t+r*1}function iH(e){if(e.length===0)throw new Error("mean requires at least one data point");return HA(e)/e.length}var oH={min:nH,max:rH,mean:iH,sum:HA},aH=Object.defineProperty,Yg=Object.getOwnPropertySymbols,sH=Object.prototype.hasOwnProperty,uH=Object.prototype.propertyIsEnumerable,Zg=(e,t,r)=>t in e?aH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ms=(e,t)=>{for(var r in t||(t={}))sH.call(t,r)&&Zg(e,r,t[r]);if(Yg)for(var r of Yg(t))uH.call(t,r)&&Zg(e,r,t[r]);return e},qg=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),{cloneDeep:lH,isFunction:Kg,isString:cH,mergeWith:fH}=Sr;function hH(e,t){if(Array.isArray(t))return t}var dH=class extends Bn.EventEmitter{constructor(e,t){super(),this.type="source",this.isTile=!1,this.inited=!1,this.hooks={init:new ni},this.parser={type:"geojson"},this.transforms=[],this.cluster=!1,this.clusterOptions={enable:!1,radius:40,maxZoom:20,zoom:-99,method:"count"},this.invalidExtent=!1,this.dataArrayChanged=!1,this.cfg={autoRender:!0},this.originData=e,this.initCfg(t),this.init().then(()=>{this.inited=!0,this.emit("update",{type:"inited"})})}getSourceCfg(){return this.cfg}getClusters(e){return this.clusterIndex.getClusters(this.caculClusterExtent(2),e)}getClustersLeaves(e){return this.clusterIndex.getLeaves(e,1/0)}getParserType(){return this.parser.type}updateClusterData(e){const{method:t="sum",field:r}=this.clusterOptions;let n=this.clusterIndex.getClusters(this.caculClusterExtent(2),Math.floor(e));this.clusterOptions.zoom=e,n.forEach(i=>{i.id||(i.properties.point_count=1)}),(r||Kg(t))&&(n=n.map(i=>{const o=i.id;if(o){const s=this.clusterIndex.getLeaves(o,1/0).map(l=>l.properties);let u;if(cH(t)&&r){const l=$U(s,r);u=oH[t](l)}Kg(t)&&(u=t(s)),i.properties.stat=u}else i.properties.point_count=1;return i})),this.data=Jv("geojson")({type:"FeatureCollection",features:n}),this.executeTrans()}getFeatureById(e){const{type:t="geojson",geometry:r}=this.parser;if(t==="geojson"&&!this.cluster){const n=ea._id===e);i.properties=o}return i}else return t==="json"&&r?this.data.dataArray.find(n=>n._id===e):er._id===e?Ms(Ms({},r),t):r),this.dataArrayChanged=!0,this.emit("update",{type:"update"})}getFeatureId(e,t){const r=this.data.dataArray.find(n=>n[e]===t);return r==null?void 0:r._id}setData(e,t){this.originData=e,this.dataArrayChanged=!1,this.initCfg(t),this.init().then(()=>{this.emit("update",{type:"update"})})}reloadAllTile(){var e;(e=this.tileset)==null||e.reloadAll()}reloadTilebyId(e,t,r){var n;(n=this.tileset)==null||n.reloadTileById(e,t,r)}reloadTileByLnglat(e,t,r){var n;(n=this.tileset)==null||n.reloadTileByLnglat(e,t,r)}getTileExtent(e,t){var r;return(r=this.tileset)==null?void 0:r.getTileExtent(e,t)}getTileByZXY(e,t,r){var n;return(n=this.tileset)==null?void 0:n.getTileByZXY(e,t,r)}reloadTileByExtent(e,t){var r;(r=this.tileset)==null||r.reloadTileByExtent(e,t)}destroy(){var e;this.removeAllListeners(),this.originData=null,this.clusterIndex=null,this.data=null,(e=this.tileset)==null||e.destroy()}processData(){return qg(this,null,function*(){return new Promise((e,t)=>{try{this.excuteParser(),this.initCluster(),this.executeTrans(),e({})}catch(r){t(r)}})})}initCfg(e){this.cfg=fH(this.cfg,e,hH);const t=this.cfg;t&&(t.parser&&(this.parser=t.parser),t.transforms&&(this.transforms=t.transforms),this.cluster=t.cluster||!1,t.clusterOptions&&(this.cluster=!0,this.clusterOptions=Ms(Ms({},this.clusterOptions),t.clusterOptions)))}init(){return qg(this,null,function*(){this.inited=!1,yield this.processData(),this.inited=!0})}excuteParser(){const e=this.parser,t=e.type||"geojson",r=Jv(t);this.data=r(this.originData,e),this.tileset=this.initTileset(),!e.cancelExtent&&(this.extent=tU(this.data.dataArray),this.setCenter(this.extent),this.invalidExtent=this.extent[0]===this.extent[2]||this.extent[1]===this.extent[3])}setCenter(e){this.center=[(e[0]+e[2])/2,(e[1]+e[3])/2],(isNaN(this.center[0])||isNaN(this.center[1]))&&(this.center=[108.92361111111111,34.54083333333333])}initTileset(){const{tilesetOptions:e}=this.data;return e?(this.isTile=!0,this.tileset?(this.tileset.updateOptions(e),this.tileset):new BU(Ms({},e))):void 0}executeTrans(){this.transforms.forEach(t=>{const{type:r}=t,n=jR(r)(this.data,t);Object.assign(this.data,n)})}initCluster(){if(!this.cluster)return;const e=this.clusterOptions||{};this.clusterIndex=VA(this.data,e)}caculClusterExtent(e){let t=[[-1/0,-1/0],[1/0,1/0]];return this.invalidExtent||(t=Lp(dc(this.extent),e)),t[0].concat(t[1])}};function pH(e,t){const{callback:r}=t;return r&&(e.dataArray=e.dataArray.filter(r)),e}var Xp=6378e3;function _H(e,t){const r=e.dataArray,{size:n=10}=t,i=n/(2*Math.PI*Xp)*(256<<20)/2,{gridHash:o,gridOffset:a}=vH(r,n),s=yH(o,a,t);return{yOffset:i,xOffset:i,radius:i,type:"grid",dataArray:s}}function vH(e,t){let r=1/0,n=-1/0,i;for(const u of e)i=u.coordinates[1],Number.isFinite(i)&&(r=in?i:n);const o=(r+n)/2,a=mH(t,o);if(a.xOffset<=0||a.yOffset<=0)return{gridHash:{},gridOffset:a};const s={};for(const u of e){const l=u.coordinates[1],f=u.coordinates[0];if(Number.isFinite(l)&&Number.isFinite(f)){const c=Math.floor((l+90)/a.yOffset),h=Math.floor((f+180)/a.xOffset),d=`${c}-${h}`;s[d]=s[d]||{count:0,points:[]},s[d].count+=1,s[d].points.push(u)}}return{gridHash:s,gridOffset:a}}function mH(e,t){const r=gH(e),n=EH(t,e);return{yOffset:r,xOffset:n}}function gH(e){return e/Xp*(180/Math.PI)}function EH(e,t){return t/Xp*(180/Math.PI)/Math.cos(e*Math.PI/180)}function yH(e,t,r){return Object.keys(e).reduce((n,i,o)=>{const a=i.split("-"),s=parseInt(a[0],10),u=parseInt(a[1],10),l={};if(r.field&&r.method){const f=VT(e[i].points,r.field);l[r.method]=zT[r.method](f)}return Object.assign(l,{_id:o,coordinates:Pn([-180+t.xOffset*(u+.5),-90+t.yOffset*(s+.5)]),rawData:e[i].points,count:e[i].count}),n.push(l),n},[])}var ma=Math.PI/3,TH=[0,ma,2*ma,3*ma,4*ma,5*ma];function AH(e){return e[0]}function SH(e){return e[1]}function xH(){var e=0,t=0,r=1,n=1,i=AH,o=SH,a,s,u;function l(c){var h={},d=[],p,v=c.length;for(p=0;p1){var $=y-x,F=x+(yge*ge+q*q&&(x=F+(R&1?1:-1)/2,R=Y)}var k=x+"-"+R,G=h[k];G?G.push(g):(d.push(G=h[k]=[g]),G.x=(x+(R&1)/2)*s,G.y=R*u)}return d}function f(c){var h=0,d=0;return TH.map(function(p){var v=Math.sin(p)*c,g=-Math.cos(p)*c,y=v-h,S=g-d;return h=v,d=g,[y,S]})}return l.hexagon=function(c){return"m"+f(c==null?a:+c).join("l")+"z"},l.centers=function(){for(var c=[],h=Math.round(t/u),d=Math.round(e/s),p=h*u;pt in e?bH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,MH=(e,t)=>{for(var r in t||(t={}))OH.call(t,r)&&Jg(e,r,t[r]);if(Qg)for(var r of Qg(t))IH.call(t,r)&&Jg(e,r,t[r]);return e},NH=(e,t)=>RH(e,CH(t)),PH=6378e3;function LH(e,t){const r=e.dataArray,{size:n=10,method:i="sum"}=t,o=n/(2*Math.PI*PH)*(256<<20)/2,a=r.map(f=>{const[c,h]=Pn(f.coordinates);return NH(MH({},f),{coordinates:[c,h]})});return{dataArray:xH().radius(o).x(f=>f.coordinates[0]).y(f=>f.coordinates[1])(a).map((f,c)=>{if(t.field&&i){const h=VT(f,t.field);f[i]=zT[i](h)}return{[t.method]:f[i],count:f.length,rawData:f,coordinates:[f.x,f.y],_id:c}}),radius:o,xOffset:o,yOffset:o,type:"hexagon"}}var wH=Object.defineProperty,eE=Object.getOwnPropertySymbols,FH=Object.prototype.hasOwnProperty,BH=Object.prototype.propertyIsEnumerable,tE=(e,t,r)=>t in e?wH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rE=(e,t)=>{for(var r in t||(t={}))FH.call(t,r)&&tE(e,r,t[r]);if(eE)for(var r of eE(t))BH.call(t,r)&&tE(e,r,t[r]);return e};function DH(e,t){const{sourceField:r,targetField:n,data:i}=t,o={};return i.forEach(a=>{o[a[r]]=a}),e.dataArray=e.dataArray.map(a=>{const s=a[n];return rE(rE({},a),o[s])}),e}function UH(e,t){const{callback:r}=t;return r&&(e.dataArray=e.dataArray.map(r)),e}Tn("rasterTile",gV);Tn("mvt",kk);Tn("geojsonvt",I8);Tn("testTile",ZV);Tn("geojson",r8);Tn("jsonTile",H8);Tn("image",JT);Tn("csv",WU);Tn("json",ZT);Tn("raster",Jk);Tn("rasterRgb",kV);Tn("rgb",PV);Tn("ndi",bV);ja("cluster",VA);ja("filter",pH);ja("join",DH);ja("map",UH);ja("grid",_H);ja("hexagon",LH);var kH=dH;window._iconfont_svg_string_3580659='',function(e){try{let l=function(){s||(s=!0,o())},f=function(){try{a.documentElement.doScroll("left")}catch{return void setTimeout(f,50)}l()};var r=(r=document.getElementsByTagName("script"))[r.length-1],t=r.getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,o,a,s,u=function(c,h){h.parentNode.insertBefore(c,h)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}n=function(){var c,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_3580659,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(c=document.body).firstChild?u(h,c.firstChild):c.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(o=n,a=e.document,s=!1,f(),a.onreadystatechange=function(){a.readyState=="complete"&&(a.onreadystatechange=null,l())})}}catch{}}(window);class Eu extends lp{constructor(t){super(),E(this,"controlOption",void 0),E(this,"container",void 0),E(this,"isShow",void 0),E(this,"sceneContainer",void 0),E(this,"scene",void 0),E(this,"mapsService",void 0),E(this,"renderService",void 0),E(this,"layerService",void 0),E(this,"controlService",void 0),E(this,"configService",void 0),Eu.controlCount++,this.controlOption=he(he({},this.getDefault(t)),t||{})}getOptions(){return this.controlOption}setOptions(t){const r=this.getDefault(t);Object.entries(t).forEach(([n,i])=>{i===void 0&&(t[n]=r[n])}),"position"in t&&this.setPosition(t.position),"className"in t&&this.setClassName(t.className),"style"in t&&this.setStyle(t.style),this.controlOption=he(he({},this.controlOption),t)}addTo(t){this.mapsService=t.mapService,this.renderService=t.rendererService,this.layerService=t.layerService,this.controlService=t.controlService,this.configService=t.globalConfigService,this.scene=t.sceneService,this.sceneContainer=t,this.isShow=!0,this.container=this.onAdd(),iu(this.container,"l7-control");const{className:r,style:n}=this.controlOption;return r&&this.setClassName(r),n&&this.setStyle(n),this.insertContainer(),this.emit("add",this),this}remove(){if(!this.mapsService)return this;hc(this.container),this.onRemove(),this.emit("remove",this)}onAdd(){return yn("div")}onRemove(){}show(){const t=this.container;_d(t,"l7-control--hide"),this.isShow=!0,this.emit("show",this)}hide(){const t=this.container;iu(t,"l7-control--hide"),this.isShow=!1,this.emit("hide",this)}getDefault(t){return{position:_c.TOPRIGHT,name:`${Eu.controlCount}`}}getContainer(){return this.container}getIsShow(){return this.isShow}_refocusOnMap(t){if(this.mapsService&&t&&t.screenX>0&&t.screenY>0){const r=this.mapsService.getContainer();r!==null&&r.focus()}}setPosition(t=_c.TOPLEFT){const r=this.controlService;return r&&r.removeControl(this),this.controlOption.position=t,r&&r.addControl(this,this.sceneContainer),this}setClassName(t){const r=this.container,{className:n}=this.controlOption;n&&_d(r,n),t&&iu(r,t)}setStyle(t){const r=this.container;t?r.setAttribute("style",t):r.removeAttribute("style")}insertContainer(){const t=this.controlOption.position,r=this.container;if(t instanceof Element)t.appendChild(r);else{const n=this.controlService.controlCorners[t];["bottomleft","bottomright","righttop","rightbottom"].includes(t)?n.insertBefore(r,n.firstChild):n.appendChild(r)}}checkUpdateOption(t,r){return r.some(n=>n in t)}}E(Eu,"controlCount",0);class bc extends Bn.EventEmitter{get buttonRect(){return this.button.getBoundingClientRect()}constructor(t,r){super(),E(this,"popperDOM",void 0),E(this,"contentDOM",void 0),E(this,"button",void 0),E(this,"option",void 0),E(this,"isShow",!1),E(this,"content",void 0),E(this,"timeout",null),E(this,"show",()=>this.isShow||!this.contentDOM.innerHTML?this:(this.resetPopperPosition(),_d(this.popperDOM,"l7-popper-hide"),this.isShow=!0,this.option.unique&&bc.conflictPopperList.forEach(n=>{n!==this&&n.isShow&&n.hide()}),this.emit("show"),window.addEventListener("pointerdown",this.onPopperUnClick),this)),E(this,"hide",()=>this.isShow?(iu(this.popperDOM,"l7-popper-hide"),this.isShow=!1,this.emit("hide"),window.removeEventListener("pointerdown",this.onPopperUnClick),this):this),E(this,"setHideTimeout",()=>{this.timeout||(this.timeout=window.setTimeout(()=>{this.isShow&&(this.hide(),this.timeout=null)},300))}),E(this,"clearHideTimeout",()=>{this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null)}),E(this,"onBtnClick",()=>{this.isShow?this.hide():this.show()}),E(this,"onPopperUnClick",n=>{Q7(n.target,[".l7-button-control",".l7-popper-content"])||this.hide()}),E(this,"onBtnMouseLeave",()=>{this.setHideTimeout()}),E(this,"onBtnMouseMove",()=>{this.clearHideTimeout(),!this.isShow&&this.show()}),this.button=t,this.option=r,this.init(),r.unique&&bc.conflictPopperList.push(this)}getPopperDOM(){return this.popperDOM}getIsShow(){return this.isShow}getContent(){return this.content}setContent(t){typeof t=="string"?this.contentDOM.innerHTML=t:t instanceof HTMLElement&&(DT(this.contentDOM),this.contentDOM.appendChild(t)),this.content=t}init(){const{trigger:t}=this.option;this.popperDOM=this.createPopper(),t==="click"?this.button.addEventListener("click",this.onBtnClick):(this.button.addEventListener("mousemove",this.onBtnMouseMove),this.button.addEventListener("mouseleave",this.onBtnMouseLeave),this.popperDOM.addEventListener("mousemove",this.onBtnMouseMove),this.popperDOM.addEventListener("mouseleave",this.onBtnMouseLeave))}destroy(){this.button.removeEventListener("click",this.onBtnClick),this.button.removeEventListener("mousemove",this.onBtnMouseMove),this.button.removeEventListener("mousemove",this.onBtnMouseLeave),this.popperDOM.removeEventListener("mousemove",this.onBtnMouseMove),this.popperDOM.removeEventListener("mouseleave",this.onBtnMouseLeave),hc(this.popperDOM)}resetPopperPosition(){const t={},{container:r,offset:n=[0,0],placement:i}=this.option,[o,a]=n,s=this.button.getBoundingClientRect(),u=r.getBoundingClientRect(),{left:l,right:f,top:c,bottom:h}=q7(s,u);let d=!1,p=!1;/^(left|right)/.test(i)?(i.includes("left")?t.right=`${s.width+f}px`:i.includes("right")&&(t.left=`${s.width+l}px`),i.includes("start")?t.top=`${c}px`:i.includes("end")?t.bottom=`${h}px`:(t.top=`${c+s.height/2}px`,p=!0,t.transform=`translate(${o}px, calc(${a}px - 50%))`)):/^(top|bottom)/.test(i)&&(i.includes("top")?t.bottom=`${s.height+h}px`:i.includes("bottom")&&(t.top=`${s.height+c}px`),i.includes("start")?t.left=`${l}px`:i.includes("end")?t.right=`${f}px`:(t.left=`${l+s.width/2}px`,d=!0,t.transform=`translate(calc(${o}px - 50%), ${a}px)`)),t.transform=`translate(calc(${o}px - ${d?"50%":"0%"}), calc(${a}px - ${p?"50%":"0%"})`;const v=i.split("-");v.length&&iu(this.popperDOM,v.map(g=>`l7-popper-${g}`).join(" ")),Y7(this.popperDOM,Z7(t))}createPopper(){const{container:t,className:r="",content:n}=this.option,i=yn("div",`l7-popper l7-popper-hide ${r}`),o=yn("div","l7-popper-content"),a=yn("div","l7-popper-arrow");return i.appendChild(o),i.appendChild(a),t.appendChild(i),this.popperDOM=i,this.contentDOM=o,n&&this.setContent(n),i}}E(bc,"conflictPopperList",[]);const nE=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],gi=(()=>{if(typeof document>"u")return!1;const e=nE[0],t={};for(const r of nE)if((r==null?void 0:r[1])in document){for(const[i,o]of r.entries())t[e[i]]=o;return t}return!1})(),iE={change:gi.fullscreenchange,error:gi.fullscreenerror};let Mn={request(e=document.documentElement,t){return new Promise((r,n)=>{const i=()=>{Mn.off("change",i),r()};Mn.on("change",i);const o=e[gi.requestFullscreen](t);o instanceof Promise&&o.then(i).catch(n)})},exit(){return new Promise((e,t)=>{if(!Mn.isFullscreen){e();return}const r=()=>{Mn.off("change",r),e()};Mn.on("change",r);const n=document[gi.exitFullscreen]();n instanceof Promise&&n.then(r).catch(t)})},toggle(e,t){return Mn.isFullscreen?Mn.exit():Mn.request(e,t)},onchange(e){Mn.on("change",e)},onerror(e){Mn.on("error",e)},on(e,t){const r=iE[e];r&&document.addEventListener(r,t,!1)},off(e,t){const r=iE[e];r&&document.removeEventListener(r,t,!1)},raw:gi};Object.defineProperties(Mn,{isFullscreen:{get:()=>!!document[gi.fullscreenElement]},element:{enumerable:!0,get:()=>{var e;return(e=document[gi.fullscreenElement])!==null&&e!==void 0?e:void 0}},isEnabled:{enumerable:!0,get:()=>!!document[gi.fullscreenEnabled]}});gi||(Mn={isEnabled:!1});class $H extends Eu{getDefault(){return{position:_c.BOTTOMLEFT,name:"logo",href:"https://l7.antv.antgroup.com/",img:"https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*GRb1TKp4HcMAAAAAAAAAAAAAARQnAQ"}}onAdd(){const t=yn("div","l7-control-logo");return this.setLogoContent(t),t}onRemove(){return null}setOptions(t){super.setOptions(t),this.checkUpdateOption(t,["img","href"])&&(DT(this.container),this.setLogoContent(this.container))}setLogoContent(t){const{href:r,img:n}=this.controlOption,i=yn("img");if(i.setAttribute("src",n),i.setAttribute("aria-label","AntV logo"),K7(i),r){const o=yn("a","l7-control-logo-link");o.target="_blank",o.href=r,o.rel="noopener nofollow",o.setAttribute("rel","noopener nofollow"),o.appendChild(i),t.appendChild(o)}else t.appendChild(i)}}class zH{constructor(){E(this,"mapService",void 0),E(this,"fontService",void 0)}apply(t,{styleAttributeService:r,mapService:n,fontService:i}){var o=this;this.mapService=n,this.fontService=i,t.hooks.init.tapPromise("DataMappingPlugin",ve(function*(){t.log(Fr.MappingStart,jr.INIT),o.generateMaping(t,{styleAttributeService:r}),t.log(Fr.MappingEnd,jr.INIT)})),t.hooks.beforeRenderData.tapPromise("DataMappingPlugin",function(){var a=ve(function*(s){if(!s)return s;t.dataState.dataMappingNeedUpdate=!1,t.log(Fr.MappingStart,jr.UPDATE);const u=o.generateMaping(t,{styleAttributeService:r});return t.log(Fr.MappingEnd,jr.UPDATE),u});return function(s){return a.apply(this,arguments)}}()),t.hooks.beforeRender.tap("DataMappingPlugin",()=>{const a=t.getSource();if(t.layerModelNeedUpdate||!a||!a.inited)return;const s=r.getLayerStyleAttributes()||[],u=r.getLayerStyleAttribute("filter"),{dataArray:l}=a.data;if(Array.isArray(l)&&l.length===0)return;const f=s.filter(h=>h.needRemapping);let c=l;if(u!=null&&u.needRemapping&&u!==null&&u!==void 0&&u.scale&&(c=l.filter(h=>this.applyAttributeMapping(u,h)[0])),f.length){const h=this.mapping(t,f,c,t.getEncodedData());t.setEncodedData(h)}})}generateMaping(t,{styleAttributeService:r}){const n=r.getLayerStyleAttributes()||[],i=r.getLayerStyleAttribute("filter"),{dataArray:o}=t.getSource().data;let a=o;i!=null&&i.scale&&(a=o.filter(u=>this.applyAttributeMapping(i,u)[0])),a=t.processData(a);const s=this.mapping(t,n,a,void 0);return t.setEncodedData(s),t.emit("dataUpdate",null),!0}mapping(t,r,n,i){const o=r.filter(s=>s.scale!==void 0).filter(s=>s.name!=="filter"),a=n.map((s,u)=>{const l=i?i[u]:{},f=he({id:s._id,coordinates:s.coordinates},l);return o.forEach(c=>{let h=this.applyAttributeMapping(c,s);(c.name==="color"||c.name==="stroke")&&(h=h.map(d=>Zt(d))),f[c.name]=Array.isArray(h)&&h.length===1?h[0]:h,c.name==="shape"&&(f.shape=this.fontService.getIconFontKey(f[c.name]))}),f});return r.forEach(s=>{s.needRemapping=!1}),this.adjustData2SimpleCoordinates(a),a}adjustData2SimpleCoordinates(t){t.length>0&&this.mapService.version==="SIMPLE"&&t.map(r=>{r.simpleCoordinate||(r.coordinates=this.unProjectCoordinates(r.coordinates),r.simpleCoordinate=!0)})}unProjectCoordinates(t){if(typeof t[0]=="number")return this.mapService.simpleMapCoord.unproject(t);if(t[0]&&t[0][0]instanceof Array){const r=[];return t.map(n=>{const i=[];n.map(o=>{i.push(this.mapService.simpleMapCoord.unproject(o))}),r.push(i)}),r}else{const r=[];return t.map(n=>{r.push(this.mapService.simpleMapCoord.unproject(n))}),r}}applyAttributeMapping(t,r){var n;if(!t.scale)return[];const i=(t==null||(n=t.scale)===null||n===void 0?void 0:n.scalers)||[],o=[];return i.forEach(({field:s})=>{var u;(r.hasOwnProperty(s)||((u=t.scale)===null||u===void 0?void 0:u.type)==="variable")&&o.push(r[s])}),t.mapping?t.mapping(o):[]}getArrowPoints(t,r){const n=[r[0]-t[0],r[1]-t[1]],i=oU(n);return[t[0]+i[0]*1e-4,t[1]+i[1]*1e-4]}}class VH{constructor(){E(this,"mapService",void 0)}apply(t){var r=this;this.mapService=t.getContainer().mapService,t.hooks.init.tapPromise("DataSourcePlugin",ve(function*(){t.log(Fr.SourceInitStart,jr.INIT);let n=t.getSource();if(!n){const{data:i,options:o}=t.sourceOption||t.defaultSourceConfig;n=new kH(i,o),t.setSource(n)}n.inited?(r.updateClusterData(t),t.log(Fr.SourceInitEnd,jr.INIT)):yield new Promise(i=>{n.on("update",o=>{o.type==="inited"&&(r.updateClusterData(t),t.log(Fr.SourceInitEnd,jr.INIT)),i(null)})})})),t.hooks.beforeRenderData.tapPromise("DataSourcePlugin",ve(function*(){const n=r.updateClusterData(t),i=t.dataState.dataSourceNeedUpdate;return t.dataState.dataSourceNeedUpdate=!1,n||i}))}updateClusterData(t){if(t.isTileLayer||t.tileLayer||!t.getSource())return!1;const r=t.getSource(),n=r.cluster,{zoom:i=0}=r.clusterOptions,o=this.mapService.getZoom()-1,a=t.dataState.dataSourceNeedUpdate;return n&&a&&r.updateClusterData(Math.floor(o)),n&&Math.abs(t.clusterZoom-o)>=1?(i!==Math.floor(o)&&r.updateClusterData(Math.floor(o)),t.clusterZoom=o,!0):!1}}function oE(e,t){let r,n;for(const i of e)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],a=n>0?e[n-1]:2*i-o,s=nr&&(o=t.slice(r,o),s[a]?s[a]+=o:s[++a]=o),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:Rc(n,i)})),r=Hh.lastIndex;return rt?1:e>=t?0:NaN}function XA(e){return e.length===1&&(e=oj(e)),{left:function(t,r,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n>>1;e(t[o],r)<0?n=o+1:i=o}return n},right:function(t,r,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n>>1;e(t[o],r)>0?i=o:n=o+1}return n}}}function oj(e){return function(t,r){return Yp(e(t),r)}}var aj=XA(Yp),cf=aj.right;function sj(e){return e===null?NaN:+e}var zd=Math.sqrt(50),Vd=Math.sqrt(10),Hd=Math.sqrt(2);function WA(e,t,r){var n,i=-1,o,a,s;if(t=+t,e=+e,r=+r,e===t&&r>0)return[e];if((n=t0)for(e=Math.ceil(e/s),t=Math.floor(t/s),a=new Array(o=Math.ceil(t-e+1));++i=0?(o>=zd?10:o>=Vd?5:o>=Hd?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=zd?10:o>=Vd?5:o>=Hd?2:1)}function jd(e,t,r){var n=Math.abs(t-e)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),o=n/i;return o>=zd?i*=10:o>=Vd?i*=5:o>=Hd&&(i*=2),t=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),a=+r(e[o],o,e),s=+r(e[o+1],o+1,e);return a+(s-a)*(i-o)}}function Zi(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function GA(e,t){switch(arguments.length){case 0:break;case 1:this.interpolator(e);break;default:this.interpolator(t).domain(e);break}return this}var In="$";function Cc(){}Cc.prototype=Oc.prototype={constructor:Cc,has:function(e){return In+e in this},get:function(e){return this[In+e]},set:function(e,t){return this[In+e]=t,this},remove:function(e){var t=In+e;return t in this&&delete this[t]},clear:function(){for(var e in this)e[0]===In&&delete this[e]},keys:function(){var e=[];for(var t in this)t[0]===In&&e.push(t.slice(1));return e},values:function(){var e=[];for(var t in this)t[0]===In&&e.push(this[t]);return e},entries:function(){var e=[];for(var t in this)t[0]===In&&e.push({key:t.slice(1),value:this[t]});return e},size:function(){var e=0;for(var t in this)t[0]===In&&++e;return e},empty:function(){for(var e in this)if(e[0]===In)return!1;return!0},each:function(e){for(var t in this)t[0]===In&&e(this[t],t.slice(1),this)}};function Oc(e,t){var r=new Cc;if(e instanceof Cc)e.each(function(s,u){r.set(u,s)});else if(Array.isArray(e)){var n=-1,i=e.length,o;if(t==null)for(;++nr&&(n=t,t=r,r=n),function(i){return Math.max(t,Math.min(r,i))}}function fj(e,t,r){var n=e[0],i=e[1],o=t[0],a=t[1];return i2?hj:fj,u=l=null,c}function c(h){return isNaN(h=+h)?o:(u||(u=s(e.map(n),t,r)))(n(a(h)))}return c.invert=function(h){return a(i((l||(l=s(t,e.map(n),Rc)))(h)))},c.domain=function(h){return arguments.length?(e=ZA.call(h,cj),a===Zr||(a=cE(e)),f()):e.slice()},c.range=function(h){return arguments.length?(t=xo.call(h),f()):t.slice()},c.rangeRound=function(h){return t=xo.call(h),r=ij,f()},c.clamp=function(h){return arguments.length?(a=h?cE(e):Zr,c):a!==Zr},c.interpolate=function(h){return arguments.length?(r=h,f()):r},c.unknown=function(h){return arguments.length?(o=h,c):o},function(h,d){return n=h,i=d,f()}}function qA(e,t){return Zp()(e,t)}function dj(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Mc(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Fa(e){return e=Mc(Math.abs(e)),e?e[1]:NaN}function pj(e,t){return function(r,n){for(var i=r.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),o.push(r.substring(i-=s,i+s)),!((u+=s+1)>n));)s=e[a=(a+1)%e.length];return o.reverse().join(t)}}function _j(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var vj=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Nc(e){if(!(t=vj.exec(e)))throw new Error("invalid format: "+e);var t;return new qp({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Nc.prototype=qp.prototype;function qp(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}qp.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function mj(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var KA;function gj(e,t){var r=Mc(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(KA=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=n.length;return o===a?n:o>a?n+new Array(o-a+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Mc(e,Math.max(0,t+o-1))[0]}function fE(e,t){var r=Mc(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const hE={"%":function(e,t){return(e*100).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:dj,e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return fE(e*100,t)},r:fE,s:gj,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function dE(e){return e}var pE=Array.prototype.map,_E=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ej(e){var t=e.grouping===void 0||e.thousands===void 0?dE:pj(pE.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?dE:_j(pE.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"-":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function l(c){c=Nc(c);var h=c.fill,d=c.align,p=c.sign,v=c.symbol,g=c.zero,y=c.width,S=c.comma,R=c.precision,x=c.trim,M=c.type;M==="n"?(S=!0,M="g"):hE[M]||(R===void 0&&(R=12),x=!0,M="g"),(g||h==="0"&&d==="=")&&(g=!0,h="0",d="=");var $=v==="$"?r:v==="#"&&/[boxX]/.test(M)?"0"+M.toLowerCase():"",F=v==="$"?n:/[%p]/.test(M)?a:"",Y=hE[M],ge=/[defgprs%]/.test(M);R=R===void 0?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,R)):Math.max(0,Math.min(20,R));function q(k){var G=$,K=F,ce,Pe,Xe;if(M==="c")K=Y(k)+K,k="";else{k=+k;var Je=k<0||1/k<0;if(k=isNaN(k)?u:Y(Math.abs(k),R),x&&(k=mj(k)),Je&&+k==0&&p!=="+"&&(Je=!1),G=(Je?p==="("?p:s:p==="-"||p==="("?"":p)+G,K=(M==="s"?_E[8+KA/3]:"")+K+(Je&&p==="("?")":""),ge){for(ce=-1,Pe=k.length;++ceXe||Xe>57){K=(Xe===46?i+k.slice(ce+1):k.slice(ce))+K,k=k.slice(0,ce);break}}}S&&!g&&(k=t(k,1/0));var ft=G.length+k.length+K.length,Ge=ft>1)+G+k+K+Ge.slice(ft);break;default:k=Ge+G+k+K;break}return o(k)}return q.toString=function(){return c+""},q}function f(c,h){var d=l((c=Nc(c),c.type="f",c)),p=Math.max(-8,Math.min(8,Math.floor(Fa(h)/3)))*3,v=Math.pow(10,-p),g=_E[8+p/3];return function(y){return d(v*y)+g}}return{format:l,formatPrefix:f}}var Pl,Kp,QA;yj({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function yj(e){return Pl=Ej(e),Kp=Pl.format,QA=Pl.formatPrefix,Pl}function Tj(e){return Math.max(0,-Fa(Math.abs(e)))}function Aj(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Fa(t)/3)))*3-Fa(Math.abs(e)))}function Sj(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Fa(t)-Fa(e))+1}function xj(e,t,r,n){var i=jd(e,t,r),o;switch(n=Nc(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=Aj(i,a))&&(n.precision=o),QA(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=Sj(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=Tj(i))&&(n.precision=o-(n.type==="%")*2);break}}return Kp(n)}function Du(e){var t=e.domain;return e.ticks=function(r){var n=t();return WA(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return xj(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,a=n[i],s=n[o],u;return s0?(a=Math.floor(a/u)*u,s=Math.ceil(s/u)*u,u=Jl(a,s,r)):u<0&&(a=Math.ceil(a*u)/u,s=Math.floor(s*u)/u,u=Jl(a,s,r)),u>0?(n[i]=Math.floor(a/u)*u,n[o]=Math.ceil(s/u)*u,t(n)):u<0&&(n[i]=Math.ceil(a*u)/u,n[o]=Math.floor(s*u)/u,t(n)),e},e}function JA(){var e=qA(Zr,Zr);return e.copy=function(){return ff(e,JA())},Zi.apply(e,arguments),Du(e)}function eS(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],a;return o0){for(;hf)break;S.push(g)}}else for(;h=1;--v)if(g=p*v,!(gf)break;S.push(g)}}else S=WA(h,d,Math.min(d-h,y)).map(o);return c?S.reverse():S},t.tickFormat=function(s,u){if(u==null&&(u=n===10?".0e":","),typeof u!="function"&&(u=Kp(u)),s===1/0)return u;s==null&&(s=10);var l=Math.max(1,n*s/t.ticks().length);return function(f){var c=f/o(Math.round(i(f)));return c*n0?r[s-1]:e[0],s=r?[n[r-1],t]:[n[l-1],n[l]]},a.unknown=function(u){return arguments.length&&(o=u),a},a.thresholds=function(){return n.slice()},a.copy=function(){return iS().domain([e,t]).range(i).unknown(o)},Zi.apply(Du(a),arguments)}function oS(){var e=[.5],t=[0,1],r,n=1;function i(o){return o<=o?t[cf(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=xo.call(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=xo.call(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var a=t.indexOf(o);return[e[a-1],e[a]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return oS().domain(e).range(t).unknown(r)},Zi.apply(i,arguments)}var jh=new Date,Xh=new Date;function rn(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=function(o){return e(o=new Date(+o)),o},i.ceil=function(o){return e(o=new Date(o-1)),t(o,1),e(o),o},i.round=function(o){var a=i(o),s=i.ceil(o);return o-a0))return u;do u.push(l=new Date(+o)),t(o,s),e(o);while(l=a)for(;e(a),!o(a);)a.setTime(a-1)},function(a,s){if(a>=a)if(s<0)for(;++s<=0;)for(;t(a,-1),!o(a););else for(;--s>=0;)for(;t(a,1),!o(a););})},r&&(i.count=function(o,a){return jh.setTime(+o),Xh.setTime(+a),e(jh),e(Xh),Math.floor(r(jh,Xh))},i.every=function(o){return o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?function(a){return n(a)%o===0}:function(a){return i.count(0,a)%o===0}):i}),i}var Pc=rn(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});Pc.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?rn(function(t){t.setTime(Math.floor(t/e)*e)},function(t,r){t.setTime(+t+r*e)},function(t,r){return(r-t)/e}):Pc};Pc.range;var Lc=1e3,yu=6e4,yE=36e5,aS=864e5,sS=6048e5,uS=rn(function(e){e.setTime(e-e.getMilliseconds())},function(e,t){e.setTime(+e+t*Lc)},function(e,t){return(t-e)/Lc},function(e){return e.getUTCSeconds()});uS.range;var lS=rn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*Lc)},function(e,t){e.setTime(+e+t*yu)},function(e,t){return(t-e)/yu},function(e){return e.getMinutes()});lS.range;var cS=rn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*Lc-e.getMinutes()*yu)},function(e,t){e.setTime(+e+t*yE)},function(e,t){return(t-e)/yE},function(e){return e.getHours()});cS.range;var hf=rn(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*yu)/aS},function(e){return e.getDate()-1});hf.range;function No(e){return rn(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,r){t.setDate(t.getDate()+r*7)},function(t,r){return(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*yu)/sS})}var Qp=No(0),wc=No(1),wj=No(2),Fj=No(3),Ba=No(4),Bj=No(5),Dj=No(6);Qp.range;wc.range;wj.range;Fj.range;Ba.range;Bj.range;Dj.range;var fS=rn(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()});fS.range;var Wi=rn(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});Wi.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:rn(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,r){t.setFullYear(t.getFullYear()+r*e)})};Wi.range;var Jp=rn(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/aS},function(e){return e.getUTCDate()-1});Jp.range;function Po(e){return rn(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,r){t.setUTCDate(t.getUTCDate()+r*7)},function(t,r){return(r-t)/sS})}var hS=Po(0),Fc=Po(1),Uj=Po(2),kj=Po(3),Da=Po(4),$j=Po(5),zj=Po(6);hS.range;Fc.range;Uj.range;kj.range;Da.range;$j.range;zj.range;var bo=rn(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});bo.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:rn(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,r){t.setUTCFullYear(t.getUTCFullYear()+r*e)})};bo.range;function Wh(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Gh(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Ns(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function Vj(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,o=e.days,a=e.shortDays,s=e.months,u=e.shortMonths,l=Ps(i),f=Ls(i),c=Ps(o),h=Ls(o),d=Ps(a),p=Ls(a),v=Ps(s),g=Ls(s),y=Ps(u),S=Ls(u),R={a:Je,A:ft,b:Ge,B:et,c:null,d:RE,e:RE,f:fX,g:TX,G:SX,H:uX,I:lX,j:cX,L:dS,m:hX,M:dX,p:vt,q:mt,Q:IE,s:ME,S:pX,u:_X,U:vX,V:mX,w:gX,W:EX,x:null,X:null,y:yX,Y:AX,Z:xX,"%":OE},x={a:It,A:wt,b:gt,B:xr,c:null,d:CE,e:CE,f:OX,g:UX,G:$X,H:bX,I:RX,j:CX,L:_S,m:IX,M:MX,p:Gt,q:Xr,Q:IE,s:ME,S:NX,u:PX,U:LX,V:wX,w:FX,W:BX,x:null,X:null,y:DX,Y:kX,Z:zX,"%":OE},M={a:q,A:k,b:G,B:K,c:ce,d:xE,e:xE,f:iX,g:SE,G:AE,H:bE,I:bE,j:eX,L:nX,m:Jj,M:tX,p:ge,q:Qj,Q:aX,s:sX,S:rX,u:Gj,U:Yj,V:Zj,w:Wj,W:qj,x:Pe,X:Xe,y:SE,Y:AE,Z:Kj,"%":oX};R.x=$(r,R),R.X=$(n,R),R.c=$(t,R),x.x=$(r,x),x.X=$(n,x),x.c=$(t,x);function $(le,ze){return function(nt){var Ae=[],Dt=-1,Et=0,zt=le.length,Rt,ut,Ut;for(nt instanceof Date||(nt=new Date(+nt));++Dt53)return null;"w"in Ae||(Ae.w=1),"Z"in Ae?(Et=Gh(Ns(Ae.y,0,1)),zt=Et.getUTCDay(),Et=zt>4||zt===0?Fc.ceil(Et):Fc(Et),Et=Jp.offset(Et,(Ae.V-1)*7),Ae.y=Et.getUTCFullYear(),Ae.m=Et.getUTCMonth(),Ae.d=Et.getUTCDate()+(Ae.w+6)%7):(Et=Wh(Ns(Ae.y,0,1)),zt=Et.getDay(),Et=zt>4||zt===0?wc.ceil(Et):wc(Et),Et=hf.offset(Et,(Ae.V-1)*7),Ae.y=Et.getFullYear(),Ae.m=Et.getMonth(),Ae.d=Et.getDate()+(Ae.w+6)%7)}else("W"in Ae||"U"in Ae)&&("w"in Ae||(Ae.w="u"in Ae?Ae.u%7:"W"in Ae?1:0),zt="Z"in Ae?Gh(Ns(Ae.y,0,1)).getUTCDay():Wh(Ns(Ae.y,0,1)).getDay(),Ae.m=0,Ae.d="W"in Ae?(Ae.w+6)%7+Ae.W*7-(zt+5)%7:Ae.w+Ae.U*7-(zt+6)%7);return"Z"in Ae?(Ae.H+=Ae.Z/100|0,Ae.M+=Ae.Z%100,Gh(Ae)):Wh(Ae)}}function Y(le,ze,nt,Ae){for(var Dt=0,Et=ze.length,zt=nt.length,Rt,ut;Dt=zt)return-1;if(Rt=ze.charCodeAt(Dt++),Rt===37){if(Rt=ze.charAt(Dt++),ut=M[Rt in TE?ze.charAt(Dt++):Rt],!ut||(Ae=ut(le,nt,Ae))<0)return-1}else if(Rt!=nt.charCodeAt(Ae++))return-1}return Ae}function ge(le,ze,nt){var Ae=l.exec(ze.slice(nt));return Ae?(le.p=f[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function q(le,ze,nt){var Ae=d.exec(ze.slice(nt));return Ae?(le.w=p[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function k(le,ze,nt){var Ae=c.exec(ze.slice(nt));return Ae?(le.w=h[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function G(le,ze,nt){var Ae=y.exec(ze.slice(nt));return Ae?(le.m=S[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function K(le,ze,nt){var Ae=v.exec(ze.slice(nt));return Ae?(le.m=g[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function ce(le,ze,nt){return Y(le,t,ze,nt)}function Pe(le,ze,nt){return Y(le,r,ze,nt)}function Xe(le,ze,nt){return Y(le,n,ze,nt)}function Je(le){return a[le.getDay()]}function ft(le){return o[le.getDay()]}function Ge(le){return u[le.getMonth()]}function et(le){return s[le.getMonth()]}function vt(le){return i[+(le.getHours()>=12)]}function mt(le){return 1+~~(le.getMonth()/3)}function It(le){return a[le.getUTCDay()]}function wt(le){return o[le.getUTCDay()]}function gt(le){return u[le.getUTCMonth()]}function xr(le){return s[le.getUTCMonth()]}function Gt(le){return i[+(le.getUTCHours()>=12)]}function Xr(le){return 1+~~(le.getUTCMonth()/3)}return{format:function(le){var ze=$(le+="",R);return ze.toString=function(){return le},ze},parse:function(le){var ze=F(le+="",!1);return ze.toString=function(){return le},ze},utcFormat:function(le){var ze=$(le+="",x);return ze.toString=function(){return le},ze},utcParse:function(le){var ze=F(le+="",!0);return ze.toString=function(){return le},ze}}}var TE={"-":"",_:" ",0:"0"},kr=/^\s*\d+/,Hj=/^%/,jj=/[\\^$*+?|[\]().{}]/g;function Vt(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o68?1900:2e3),r+n[0].length):-1}function Kj(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Qj(e,t,r){var n=kr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Jj(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function xE(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function eX(e,t,r){var n=kr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function bE(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tX(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rX(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nX(e,t,r){var n=kr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function iX(e,t,r){var n=kr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function oX(e,t,r){var n=Hj.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function aX(e,t,r){var n=kr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function sX(e,t,r){var n=kr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function RE(e,t){return Vt(e.getDate(),t,2)}function uX(e,t){return Vt(e.getHours(),t,2)}function lX(e,t){return Vt(e.getHours()%12||12,t,2)}function cX(e,t){return Vt(1+hf.count(Wi(e),e),t,3)}function dS(e,t){return Vt(e.getMilliseconds(),t,3)}function fX(e,t){return dS(e,t)+"000"}function hX(e,t){return Vt(e.getMonth()+1,t,2)}function dX(e,t){return Vt(e.getMinutes(),t,2)}function pX(e,t){return Vt(e.getSeconds(),t,2)}function _X(e){var t=e.getDay();return t===0?7:t}function vX(e,t){return Vt(Qp.count(Wi(e)-1,e),t,2)}function pS(e){var t=e.getDay();return t>=4||t===0?Ba(e):Ba.ceil(e)}function mX(e,t){return e=pS(e),Vt(Ba.count(Wi(e),e)+(Wi(e).getDay()===4),t,2)}function gX(e){return e.getDay()}function EX(e,t){return Vt(wc.count(Wi(e)-1,e),t,2)}function yX(e,t){return Vt(e.getFullYear()%100,t,2)}function TX(e,t){return e=pS(e),Vt(e.getFullYear()%100,t,2)}function AX(e,t){return Vt(e.getFullYear()%1e4,t,4)}function SX(e,t){var r=e.getDay();return e=r>=4||r===0?Ba(e):Ba.ceil(e),Vt(e.getFullYear()%1e4,t,4)}function xX(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Vt(t/60|0,"0",2)+Vt(t%60,"0",2)}function CE(e,t){return Vt(e.getUTCDate(),t,2)}function bX(e,t){return Vt(e.getUTCHours(),t,2)}function RX(e,t){return Vt(e.getUTCHours()%12||12,t,2)}function CX(e,t){return Vt(1+Jp.count(bo(e),e),t,3)}function _S(e,t){return Vt(e.getUTCMilliseconds(),t,3)}function OX(e,t){return _S(e,t)+"000"}function IX(e,t){return Vt(e.getUTCMonth()+1,t,2)}function MX(e,t){return Vt(e.getUTCMinutes(),t,2)}function NX(e,t){return Vt(e.getUTCSeconds(),t,2)}function PX(e){var t=e.getUTCDay();return t===0?7:t}function LX(e,t){return Vt(hS.count(bo(e)-1,e),t,2)}function vS(e){var t=e.getUTCDay();return t>=4||t===0?Da(e):Da.ceil(e)}function wX(e,t){return e=vS(e),Vt(Da.count(bo(e),e)+(bo(e).getUTCDay()===4),t,2)}function FX(e){return e.getUTCDay()}function BX(e,t){return Vt(Fc.count(bo(e)-1,e),t,2)}function DX(e,t){return Vt(e.getUTCFullYear()%100,t,2)}function UX(e,t){return e=vS(e),Vt(e.getUTCFullYear()%100,t,2)}function kX(e,t){return Vt(e.getUTCFullYear()%1e4,t,4)}function $X(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Da(e):Da.ceil(e),Vt(e.getUTCFullYear()%1e4,t,4)}function zX(){return"+0000"}function OE(){return"%"}function IE(e){return+e}function ME(e){return Math.floor(+e/1e3)}var ca,mS;VX({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function VX(e){return ca=Vj(e),mS=ca.format,ca.parse,ca.utcFormat,ca.utcParse,ca}var Js=1e3,eu=Js*60,tu=eu*60,Tu=tu*24,HX=Tu*7,NE=Tu*30,Yh=Tu*365;function jX(e){return new Date(e)}function XX(e){return e instanceof Date?+e:+new Date(+e)}function gS(e,t,r,n,i,o,a,s,u){var l=qA(Zr,Zr),f=l.invert,c=l.domain,h=u(".%L"),d=u(":%S"),p=u("%I:%M"),v=u("%I %p"),g=u("%a %d"),y=u("%b %d"),S=u("%B"),R=u("%Y"),x=[[a,1,Js],[a,5,5*Js],[a,15,15*Js],[a,30,30*Js],[o,1,eu],[o,5,5*eu],[o,15,15*eu],[o,30,30*eu],[i,1,tu],[i,3,3*tu],[i,6,6*tu],[i,12,12*tu],[n,1,Tu],[n,2,2*Tu],[r,1,HX],[t,1,NE],[t,3,3*NE],[e,1,Yh]];function M(F){return(a(F)i?(r=i,i):r,n.unknown=i=>i?(t=i,i):t,n.copy=()=>AS().unknown(t),n}const{isNil:Zh,isString:ZX,uniq:qX}=Sr,KX=/^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/,QX={[Xt.LINEAR]:JA,[Xt.POWER]:rS,[Xt.LOG]:tS,[Xt.IDENTITY]:AS,[Xt.SEQUENTIAL]:yS,[Xt.TIME]:WX,[Xt.QUANTILE]:nS,[Xt.QUANTIZE]:iS,[Xt.THRESHOLD]:oS,[Xt.CAT]:Ic,[Xt.DIVERGING]:TS};class JX{constructor(){E(this,"scaleOptions",{})}apply(t,{styleAttributeService:r}){var n=this;t.hooks.init.tapPromise("FeatureScalePlugin",ve(function*(){var i;t.log(Fr.ScaleInitStart,jr.INIT),n.scaleOptions=t.getScaleOptions();const o=r.getLayerStyleAttributes(),a=(i=t.getSource())===null||i===void 0?void 0:i.data.dataArray;Array.isArray(a)&&a.length===0||(n.caculateScalesForAttributes(o||[],a),t.log(Fr.ScaleInitEnd,jr.INIT))})),t.hooks.beforeRenderData.tapPromise("FeatureScalePlugin",function(){var i=ve(function*(o){if(!o)return o;t.log(Fr.ScaleInitStart,jr.UPDATE),n.scaleOptions=t.getScaleOptions();const a=r.getLayerStyleAttributes(),s=t.getSource().data.dataArray;return Array.isArray(s)&&s.length===0||(n.caculateScalesForAttributes(a||[],s),t.log(Fr.ScaleInitEnd,jr.UPDATE),t.layerModelNeedUpdate=!0),!0});return function(o){return i.apply(this,arguments)}}()),t.hooks.beforeRender.tap("FeatureScalePlugin",()=>{if(t.layerModelNeedUpdate)return;this.scaleOptions=t.getScaleOptions();const i=r.getLayerStyleAttributes(),o=t.getSource().data.dataArray;if(!(Array.isArray(o)&&o.length===0)&&i){const a=i.filter(s=>s.needRescale);a.length&&this.caculateScalesForAttributes(a,o)}})}isNumber(t){return!isNaN(parseFloat(t))&&isFinite(t)}caculateScalesForAttributes(t,r){t.forEach(n=>{if(n.scale){const i=n.scale,o=n.scale.field;i.names=this.parseFields(Zh(o)?[]:o);const a=[];i.names.forEach(s=>{var u;a.push(this.createScale(s,n.name,(u=n.scale)===null||u===void 0?void 0:u.values,r))}),a.some(s=>s.type===la.VARIABLE)?(i.type=la.VARIABLE,a.forEach(s=>{if(!i.callback&&i.values!=="text"){var u;switch((u=s.option)===null||u===void 0?void 0:u.type){case Xt.LOG:case Xt.LINEAR:case Xt.POWER:if(i.values&&i.values.length>2){const f=s.scale.ticks(i.values.length);s.scale.domain(f)}i.values?s.scale.range(i.values):s.scale.range(s.option.domain);break;case Xt.QUANTILE:case Xt.QUANTIZE:case Xt.THRESHOLD:s.scale.range(i.values);break;case Xt.IDENTITY:break;case Xt.CAT:i.values?s.scale.range(i.values):s.scale.range(s.option.domain);break;case Xt.DIVERGING:case Xt.SEQUENTIAL:s.scale.interpolator(ZH(i.values));break}}if(i.values==="text"){var l;s.scale.range((l=s.option)===null||l===void 0?void 0:l.domain)}})):(i.type=la.CONSTANT,i.defaultValues=a.map((s,u)=>s.scale(i.names[u]))),i.scalers=a.map(s=>({field:s.field,func:s.scale,option:s.option})),n.needRescale=!1}})}parseFields(t){return Array.isArray(t)?t:ZX(t)?t.split("*"):[t]}createScale(t,r,n,i){var o,a;const s=this.scaleOptions[r]&&((o=this.scaleOptions[r])===null||o===void 0?void 0:o.field)===t?this.scaleOptions[r]:this.scaleOptions[t],u={field:t,scale:void 0,type:la.VARIABLE,option:s};if(!i||!i.length)return s&&s.type?u.scale=this.createDefaultScale(s):(u.scale=Ic([t]),u.type=la.CONSTANT),u;const l=(a=i.find(f=>!Zh(f[t])))===null||a===void 0?void 0:a[t];if(this.isNumber(t)||Zh(l)&&!s)u.scale=Ic([t]),u.type=la.CONSTANT;else{let f=s&&s.type||this.getDefaultType(l);n==="text"&&(f=Xt.CAT),n===void 0&&(f=Xt.IDENTITY);const c=this.createScaleConfig(f,t,s,i);u.scale=this.createDefaultScale(c),u.option=c}return u}getDefaultType(t){let r=Xt.LINEAR;return typeof t=="string"&&(r=KX.test(t)?Xt.TIME:Xt.CAT),r}createScaleConfig(t,r,n,i){const o={type:t};let a=[];if(t===Xt.QUANTILE){const s=new Map;i==null||i.forEach(u=>{s.set(u._id,u[r])}),a=Array.from(s.values())}else a=(i==null?void 0:i.map(s=>s[r]))||[];if(n!=null&&n.domain)o.domain=n==null?void 0:n.domain;else if(t===Xt.CAT||t===Xt.IDENTITY)o.domain=qX(a);else if(t===Xt.QUANTILE)o.domain=a;else if(t===Xt.DIVERGING){const s=oE(a),u=(n==null?void 0:n.neutral)!==void 0?n==null?void 0:n.neutral:(s[0]+s[1])/2;o.domain=[s[0],u,s[1]]}else o.domain=oE(a);return he(he({},o),n)}createDefaultScale({type:t,domain:r,unknown:n,clamp:i,nice:o}){const a=QX[t]();return r&&a.domain&&a.domain(r),n&&a.unknown(n),i!==void 0&&a.clamp&&a.clamp(i),o!==void 0&&a.nice&&a.nice(o),a}}class eW{apply(t){t.hooks.beforeRender.tap("LayerAnimateStylePlugin",()=>{t.animateStatus&&t.models.forEach(n=>{n.addUniforms(he({},t.layerModel.getAnimateUniforms()))})})}}let tW=class{apply(t){t.hooks.afterInit.tap("LayerMaskPlugin",()=>{const{maskLayers:r,enableMask:n}=t.getLayerConfig();!t.tileLayer&&r&&r.length>0&&t.updateLayerConfig({mask:n})})}};class rW{build(t){return ve(function*(){t.prepareBuildModel(),yield t.buildModels()})()}initLayerModel(t){var r=this;return ve(function*(){yield r.build(t),t.styleNeedUpdate=!1})()}prepareLayerModel(t){var r=this;return ve(function*(){yield r.build(t),t.styleNeedUpdate=!1})()}apply(t){var r=this;t.hooks.init.tapPromise("LayerModelPlugin",ve(function*(){if(t.getSource().isTile){t.prepareBuildModel();return}t.log(Fr.BuildModelStart,jr.INIT),yield r.initLayerModel(t),t.log(Fr.BuildModelEnd,jr.INIT)})),t.hooks.beforeRenderData.tapPromise("LayerModelPlugin",function(){var n=ve(function*(i){return!i||t.getSource().isTile?!1:(t.log(Fr.BuildModelStart,jr.UPDATE),yield r.prepareLayerModel(t),t.log(Fr.BuildModelEnd,jr.UPDATE),!0)});return function(i){return n.apply(this,arguments)}}())}}class nW{apply(t){t.hooks.afterInit.tap("LayerStylePlugin",()=>{const{autoFit:r,fitBoundsOptions:n}=t.getLayerConfig();r&&t.fitBounds(n),t.styleNeedUpdate=!1})}}const iW=["type"],PE={directional:{lights:"u_DirectionalLights",num:"u_NumOfDirectionalLights"},spot:{lights:"u_SpotLights",num:"u_NumOfSpotLights"}},oW={type:"directional",direction:[1,10.5,12],ambient:[.2,.2,.2],diffuse:[.6,.6,.6],specular:[.1,.1,.1]},aW={direction:[0,0,0],ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0]},sW={position:[0,0,0],direction:[0,0,0],ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],constant:1,linear:0,quadratic:0,angle:14,exponent:40,blur:5};function uW(e){const t={u_DirectionalLights:new Array(3).fill(he({},aW)),u_NumOfDirectionalLights:0,u_SpotLights:new Array(3).fill(he({},sW)),u_NumOfSpotLights:0};return(!e||!e.length)&&(e=[oW]),e.forEach(r=>{let{type:n="directional"}=r,i=ai(r,iW);const o=PE[n].lights,a=PE[n].num,s=t[a];t[o][s]=he(he({},t[o][s]),i),t[a]++}),t}class lW{apply(t){t.hooks.beforeRender.tap("LightingPlugin",()=>{const{enableLighting:r}=t.getLayerConfig();r&&t.models.forEach(n=>n.addUniforms(he({},uW())))})}}function SS(e){return e.map(t=>(typeof t=="string"&&(t=[t,{}]),t))}function xS(e,t,r,n){const i=e.multiPassRenderer;return i.add(n("render")),SS(t).forEach(o=>{const[a,s]=o;i.add(r(a),s)}),i.add(r("copy")),i}class cW{constructor(){E(this,"enabled",void 0)}apply(t,{rendererService:r,postProcessingPassFactory:n,normalPassFactory:i}){t.hooks.init.tapPromise("MultiPassRendererPlugin",()=>{const{enableMultiPassRenderer:o,passes:a=[]}=t.getLayerConfig();this.enabled=!!o&&t.getLayerConfig().enableMultiPassRenderer!==!1,this.enabled&&(t.multiPassRenderer=xS(t,a,n,i),t.multiPassRenderer.setRenderFlag(!0))}),t.hooks.beforeRender.tap("MultiPassRendererPlugin",()=>{if(this.enabled){const{width:o,height:a}=r.getViewportSize();t.multiPassRenderer.resize(o,a)}})}}const zi={POSITION:0,POSITION_64LOW:1,COLOR:2,PICKING_COLOR:3,STROKE:4,OPACITY:5,OFFSETS:6,ROTATION:7,MAX:8};function fW(e){switch(e){case"rotation":return{name:"Rotation",type:qe.Attribute,descriptor:{name:"a_Rotation",shaderLocation:zi.ROTATION,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{rotation:r=0}=t;return Array.isArray(r)?[r[0]]:[r]}}};case"stroke":return{name:"stroke",type:qe.Attribute,descriptor:{name:"a_Stroke",shaderLocation:zi.STROKE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:4,update:t=>{const{stroke:r=[1,1,1,1]}=t;return r}}};case"opacity":return{name:"opacity",type:qe.Attribute,descriptor:{name:"a_Opacity",shaderLocation:zi.OPACITY,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{opacity:r=1}=t;return[r]}}};case"offsets":return{name:"offsets",type:qe.Attribute,descriptor:{name:"a_Offsets",shaderLocation:zi.OFFSETS,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{offsets:r}=t;return r}}};default:return}}const{isNumber:hW}=Sr,fa={NONE:0,ENCODE:1,HIGHLIGHT:2};class dW{constructor(){E(this,"pickingUniformMap",void 0)}pickOption2Array(){const t=[];return this.pickingUniformMap.forEach(r=>{hW(r)?t.push(r):t.push(...r)}),t}updatePickOption(t,r){Object.keys(t).forEach(a=>{this.pickingUniformMap.set(a,t[a])});const n=r.getLayerConfig().pickingBuffer||0,i=Number(r.getShaderPickStat());this.pickingUniformMap.set("u_PickingBuffer",n),this.pickingUniformMap.set("u_shaderPick",i),r.getPickingUniformBuffer().subData({offset:0,data:this.pickOption2Array()})}apply(t,{styleAttributeService:r}){this.pickingUniformMap=new Map([["u_HighlightColor",[1,0,0,1]],["u_SelectColor",[1,0,0,1]],["u_PickingColor",[0,0,0]],["u_PickingStage",0],["u_CurrentSelectedId",[0,0,0]],["u_PickingThreshold",10],["u_PickingBuffer",0],["u_shaderPick",0],["u_activeMix",0]]),t.hooks.init.tapPromise("PixelPickingPlugin",()=>{const{enablePicking:n}=t.getLayerConfig();r.registerStyleAttribute({name:"pickingColor",type:qe.Attribute,descriptor:{name:"a_PickingColor",shaderLocation:zi.PICKING_COLOR,buffer:{data:[],type:m.FLOAT},size:3,update:i=>{const{id:o}=i;return n?La(o):[0,0,0]}}})}),t.hooks.beforePickingEncode.tap("PixelPickingPlugin",()=>{const{enablePicking:n}=t.getLayerConfig();n&&t.isVisible()&&(this.updatePickOption({u_PickingStage:fa.ENCODE},t),t.models.forEach(i=>i.addUniforms({u_PickingStage:fa.ENCODE})))}),t.hooks.afterPickingEncode.tap("PixelPickingPlugin",()=>{const{enablePicking:n}=t.getLayerConfig();n&&t.isVisible()&&(this.updatePickOption({u_PickingStage:fa.HIGHLIGHT},t),t.models.forEach(i=>i.addUniforms({u_PickingStage:fa.HIGHLIGHT})))}),t.hooks.beforeHighlight.tap("PixelPickingPlugin",n=>{const{highlightColor:i,activeMix:o=0}=t.getLayerConfig(),a=typeof i=="string"?Zt(i):i||[1,0,0,1];t.updateLayerConfig({pickedFeatureID:yo(new Uint8Array(n))});const s={u_PickingStage:fa.HIGHLIGHT,u_PickingColor:n,u_HighlightColor:a.map(u=>u*255),u_activeMix:o};this.updatePickOption(s,t),t.models.forEach(u=>u.addUniforms(s))}),t.hooks.beforeSelect.tap("PixelPickingPlugin",n=>{const{selectColor:i,selectMix:o=0}=t.getLayerConfig(),a=typeof i=="string"?Zt(i):i||[1,0,0,1];t.updateLayerConfig({pickedFeatureID:yo(new Uint8Array(n))});const s={u_PickingStage:fa.HIGHLIGHT,u_PickingColor:n,u_HighlightColor:a.map(u=>u*255),u_activeMix:o,u_CurrentSelectedId:n,u_SelectColor:a.map(u=>u*255)};this.updatePickOption(s,t),t.models.forEach(u=>u.addUniforms(s))})}}const pW=["mvt","geojsonvt","testTile"];function _W(e){const t=e.getSource();return pW.includes(t.parser.type)}class vW{apply(t,{styleAttributeService:r}){t.hooks.init.tapPromise("RegisterStyleAttributePlugin",()=>{_W(t)||this.registerBuiltinAttributes(r,t)})}registerBuiltinAttributes(t,r){if(r.type==="MaskLayer"){this.registerPositionAttribute(t);return}this.registerPositionAttribute(t),this.registerColorAttribute(t)}registerPositionAttribute(t){t.registerStyleAttribute({name:"position",type:qe.Attribute,descriptor:{name:"a_Position",shaderLocation:zi.POSITION,buffer:{data:[],type:m.FLOAT},size:3,update:(r,n,i)=>i.length===2?[i[0],i[1],0]:[i[0],i[1],i[2]]}})}registerColorAttribute(t){t.registerStyleAttribute({name:"color",type:qe.Attribute,descriptor:{name:"a_Color",shaderLocation:zi.COLOR,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:4,update:r=>{const{color:n}=r;return!n||!n.length?[1,1,1,1]:n}}})}}class mW{constructor(){E(this,"cameraService",void 0),E(this,"coordinateSystemService",void 0),E(this,"rendererService",void 0),E(this,"mapService",void 0),E(this,"layerService",void 0)}apply(t,{rendererService:r,mapService:n,layerService:i,coordinateSystemService:o,cameraService:a}){this.rendererService=r,this.mapService=n,this.layerService=i,this.coordinateSystemService=o,this.cameraService=a;let s;this.rendererService.uniformBuffers[0]||(s=this.rendererService.createBuffer({data:new Float32Array(16*4+4*7),isUBO:!0,label:"renderUniformBuffer"}),this.rendererService.uniformBuffers[0]=s),t.hooks.beforeRender.tap("ShaderUniformPlugin",()=>{const u=t.getLayerConfig().tileOrigin;this.coordinateSystemService.refresh(u);const{width:l,height:f}=this.rendererService.getViewportSize(),{data:c,uniforms:h}=this.generateUBO(l,f);this.layerService.alreadyInRendering&&this.rendererService.uniformBuffers[0]&&this.rendererService.uniformBuffers[0].subData({offset:0,data:c}),this.rendererService.queryVerdorInfo()==="WebGL1"&&t.models.forEach(p=>{p.addUniforms(he(he({},h),{},{u_PickingBuffer:t.getLayerConfig().pickingBuffer||0,u_shaderPick:Number(t.getShaderPickStat())}))})})}generateUBO(t,r){const n=this.cameraService.getProjectionMatrix(),i=this.cameraService.getViewMatrix(),o=this.cameraService.getViewProjectionMatrix(),a=this.cameraService.getModelMatrix(),s=this.coordinateSystemService.getViewportCenterProjection(),u=this.coordinateSystemService.getPixelsPerDegree(),l=this.cameraService.getZoom(),f=this.coordinateSystemService.getPixelsPerDegree2(),c=this.cameraService.getZoomScale(),h=this.coordinateSystemService.getPixelsPerMeter(),d=this.coordinateSystemService.getCoordinateSystem(),p=this.cameraService.getCameraPosition(),v=window.devicePixelRatio,g=this.coordinateSystemService.getViewportCenter(),y=[t,r],S=this.cameraService.getFocalDistance();return{data:[...i,...n,...o,...a,...s,...u,l,...f,c,...h,d,...p,v,...g,...y,S,0,0,0],uniforms:{[fo.ProjectionMatrix]:n,[fo.ViewMatrix]:i,[fo.ViewProjectionMatrix]:o,[fo.Zoom]:l,[fo.ZoomScale]:c,[fo.FocalDistance]:S,[fo.CameraPosition]:p,[ua.CoordinateSystem]:d,[ua.ViewportCenter]:g,[ua.ViewportCenterProjection]:s,[ua.PixelsPerDegree]:u,[ua.PixelsPerDegree2]:f,[ua.PixelsPerMeter]:h,u_ViewportSize:y,u_ModelMatrix:a,u_DevicePixelRatio:v}}}}class gW{apply(t){t.hooks.beforeRender.tap("UpdateModelPlugin",()=>{t.layerModel&&t.layerModel.needUpdate().then(r=>{r&&t.renderLayers()})}),t.hooks.afterRender.tap("UpdateModelPlugin",()=>{t.layerModelNeedUpdate=!1})}}class EW{apply(t,{styleAttributeService:r}){t.hooks.init.tapPromise("UpdateStyleAttributePlugin",()=>{this.initStyleAttribute(t,{styleAttributeService:r})}),t.hooks.beforeRender.tap("UpdateStyleAttributePlugin",()=>{t.layerModelNeedUpdate||t.inited&&this.updateStyleAttribute(t,{styleAttributeService:r})})}updateStyleAttribute(t,{styleAttributeService:r}){const n=r.getLayerStyleAttributes()||[],i=r.getLayerStyleAttribute("filter");if(i&&i.needRegenerateVertices){t.layerModelNeedUpdate=!0,n.forEach(o=>o.needRegenerateVertices=!1);return}n.filter(o=>o.needRegenerateVertices).forEach(o=>{r.updateAttributeByFeatureRange(o.name,t.getEncodedData(),o.featureRange.startIndex,o.featureRange.endIndex,t),o.needRegenerateVertices=!1})}initStyleAttribute(t,{styleAttributeService:r}){(r.getLayerStyleAttributes()||[]).filter(i=>i.needRegenerateVertices).forEach(i=>{r.updateAttributeByFeatureRange(i.name,t.getEncodedData(),i.featureRange.startIndex,i.featureRange.endIndex),i.needRegenerateVertices=!1})}}function yW(){return[new VH,new vW,new JX,new zH,new nW,new tW,new EW,new gW,new cW,new mW,new eW,new lW,new dW,new rW]}const bS={[Ui.additive]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE,srcAlpha:1,dstAlpha:1}},[Ui.none]:{enable:!1},[Ui.normal]:{enable:!0,func:{srcRGB:m.SRC_ALPHA,dstRGB:m.ONE_MINUS_SRC_ALPHA,srcAlpha:1,dstAlpha:1}},[Ui.subtractive]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE,srcAlpha:m.ZERO,dstAlpha:m.ONE_MINUS_SRC_COLOR},equation:{rgb:m.FUNC_SUBTRACT,alpha:m.FUNC_SUBTRACT}},[Ui.max]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE},equation:{rgb:m.MAX_EXT}},[Ui.min]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE},equation:{rgb:m.MIN_EXT}}};class TW{constructor(t){E(this,"layer",void 0),this.layer=t}pickRender(t){const n=this.layer.getContainer().layerService,i=this.layer;if(i.tileLayer)return i.tileLayer.pickRender(t);i.hooks.beforePickingEncode.call(),n.renderTileLayerMask(i),i.renderModels({ispick:!0}),i.hooks.afterPickingEncode.call()}pick(t,r){var n=this;return ve(function*(){const o=n.layer.getContainer().pickingService;return t.type==="RasterLayer"?n.pickRasterLayer(t,r):(n.pickRender(r),o.pickFromPickingFBO(t,r))})()}pickRasterLayer(t,r,n){const i=this.layer.getContainer(),o=i.pickingService,a=i.mapService,s=this.layer.getSource().extent,u=eU(r.lngLat,s),l={x:r.x,y:r.y,type:r.type,lngLat:r.lngLat,target:r,rasterValue:null},f=n||t;if(u){const c=this.readRasterValue(t,s,a,r.x,r.y);return l.rasterValue=c,o.triggerHoverOnLayer(f,l),!0}else return l.type=r.type==="mousemove"?"mouseout":"un"+r.type,o.triggerHoverOnLayer(f,he(he({},l),{},{type:"unpick"})),o.triggerHoverOnLayer(f,l),!1}readRasterValue(t,r,n,i,o){const a=t.getSource().data.dataArray[0],[s=0,u=0,l=10,f=-10]=r,c=n.lngLatToContainer([s,u]),h=n.lngLatToContainer([l,f]),d=h.x-c.x,p=c.y-h.y,v=[(i-c.x)/d,(o-h.y)/p],g=a.width||1,y=a.height||1,S=Math.floor(v[0]*g),R=Math.floor(v[1]*y),x=Math.max(0,R-1)*g+S;return a.data[x]}selectFeature(t){const r=this.layer,[n,i,o]=t;r.hooks.beforeSelect.call([n,i,o])}highlightPickedFeature(t){const[r,n,i]=t;this.layer.hooks.beforeHighlight.call([r,n,i])}getFeatureById(t){return this.layer.getSource().getFeatureById(t)}}class AW{constructor(t){E(this,"layer",void 0),E(this,"rendererService",void 0),E(this,"colorTexture",void 0),E(this,"key",void 0),this.layer=t;const r=this.layer.getContainer();this.rendererService=r.rendererService}getColorTexture(t,r){const n=this.getTextureKey(t,r);return this.key===n?this.colorTexture:(this.createColorTexture(t,r),this.key=n,this.colorTexture)}createColorTexture(t,r){const{createTexture2D:n}=this.rendererService,i=this.getColorRampBar(t,r),o=n({data:new Uint8Array(i.data),width:i.width,height:i.height,flipY:!1,unorm:!0});return this.colorTexture=o,o}setColorTexture(t,r,n){this.key=this.getTextureKey(r,n),this.colorTexture=t}destroy(){var t;(t=this.colorTexture)===null||t===void 0||t.destroy()}getColorRampBar(t,r){switch(t.type){case"cat":return S2(t);case"quantize":return x2(t);case"custom":return b2(t,r);case"linear":return A2(t,r);default:return T2(t)}}getTextureKey(t,r){var n;return`${t.colors.join("_")}_${t==null||(n=t.positions)===null||n===void 0?void 0:n.join("_")}_${t.type}_${r==null?void 0:r.join("_")}`}}const SW=["passes"],xW=["moduleName","vertexShader","fragmentShader","defines","inject","triangulation","styleOption","pickingEnabled"],{isEqual:qh,isFunction:LE,isNumber:wE,isObject:Vr,isPlainObject:bW,isUndefined:RW}=Sr;let FE=0;class Ka extends Bn.EventEmitter{get shaderModuleService(){return this.container.shaderModuleService}get cameraService(){return this.container.cameraService}get coordinateService(){return this.container.coordinateSystemService}get iconService(){return this.container.iconService}get fontService(){return this.container.fontService}get pickingService(){return this.container.pickingService}get rendererService(){return this.container.rendererService}get layerService(){return this.container.layerService}get debugService(){return this.container.debugService}get interactionService(){return this.container.interactionService}get mapService(){var t;return(t=this.container)===null||t===void 0?void 0:t.mapService}get normalPassFactory(){return this.container.normalPassFactory}constructor(t={}){super(),E(this,"id",`${FE++}`),E(this,"name",`${FE}`),E(this,"parent",void 0),E(this,"coordCenter",void 0),E(this,"type",void 0),E(this,"visible",!0),E(this,"zIndex",0),E(this,"minZoom",void 0),E(this,"maxZoom",void 0),E(this,"inited",!1),E(this,"layerModelNeedUpdate",!1),E(this,"pickedFeatureID",null),E(this,"selectedFeatureID",null),E(this,"styleNeedUpdate",!1),E(this,"rendering",void 0),E(this,"forceRender",!1),E(this,"clusterZoom",0),E(this,"layerType",void 0),E(this,"triangulation",void 0),E(this,"layerPickService",void 0),E(this,"textureService",void 0),E(this,"defaultSourceConfig",{data:[],options:{parser:{type:"json"}}}),E(this,"dataState",{dataSourceNeedUpdate:!1,dataMappingNeedUpdate:!1,filterNeedUpdate:!1,featureScaleNeedUpdate:!1,StyleAttrNeedUpdate:!1}),E(this,"hooks",{init:new S$,afterInit:new vg,beforeRender:new vg,beforeRenderData:new x$,afterRender:new ni,beforePickingEncode:new ni,afterPickingEncode:new ni,beforeHighlight:new ni(["pickedColor"]),afterHighlight:new ni,beforeSelect:new ni(["pickedColor"]),afterSelect:new ni,beforeDestroy:new ni,afterDestroy:new ni}),E(this,"models",[]),E(this,"multiPassRenderer",void 0),E(this,"plugins",void 0),E(this,"startInit",!1),E(this,"sourceOption",void 0),E(this,"layerModel",void 0),E(this,"shapeOption",void 0),E(this,"tileLayer",void 0),E(this,"layerChildren",[]),E(this,"masks",[]),E(this,"configService",OA),E(this,"styleAttributeService",void 0),E(this,"layerSource",void 0),E(this,"postProcessingPassFactory",void 0),E(this,"animateOptions",{enable:!1}),E(this,"container",void 0),E(this,"encodedData",void 0),E(this,"currentPickId",null),E(this,"rawConfig",void 0),E(this,"needUpdateConfig",void 0),E(this,"encodeStyleAttribute",{}),E(this,"enableShaderEncodeStyles",[]),E(this,"enableDataEncodeStyles",[]),E(this,"pendingStyleAttributes",[]),E(this,"scaleOptions",{}),E(this,"animateStartTime",void 0),E(this,"animateStatus",!1),E(this,"isDestroyed",!1),E(this,"uniformBuffers",[]),E(this,"encodeDataLength",0),E(this,"sourceEvent",()=>{this.dataState.dataSourceNeedUpdate=!0;const r=this.getLayerConfig();r&&r.autoFit&&this.fitBounds(r.fitBoundsOptions),this.layerSource.getSourceCfg().autoRender&&setTimeout(()=>{this.reRender()},10)}),this.name=t.name||this.id,this.zIndex=t.zIndex||0,this.rawConfig=t,this.masks=t.maskLayers||[]}addMask(t){this.masks.push(t),this.updateLayerConfig({maskLayers:this.masks}),this.enableMask()}removeMask(t){const r=this.masks.indexOf(t);r>-1&&this.masks.splice(r,1),this.updateLayerConfig({maskLayers:this.masks})}disableMask(){this.updateLayerConfig({enableMask:!1})}enableMask(){this.updateLayerConfig({enableMask:!0})}addMaskLayer(t){this.masks.push(t)}removeMaskLayer(t){const r=this.masks.indexOf(t);r>-1&&this.masks.splice(r,1),t.destroy()}getAttribute(t){return this.styleAttributeService.getLayerStyleAttribute(t)}getLayerConfig(){return this.configService.getLayerConfig(this.id)}updateLayerConfig(t){if(Object.keys(t).map(r=>{r in this.rawConfig&&(this.rawConfig[r]=t[r])}),!this.startInit)this.needUpdateConfig=he(he({},this.needUpdateConfig),t);else{const r=this.container.id;this.configService.setLayerConfig(r,this.id,he(he(he({},this.configService.getLayerConfig(this.id)),this.needUpdateConfig),t)),this.needUpdateConfig={}}}setContainer(t){this.container=t}getContainer(){return this.container}addPlugin(t){return this.plugins.push(t),this}init(){var t=this;return ve(function*(){const r=t.container.id;t.startInit=!0,t.configService.setLayerConfig(r,t.id,t.rawConfig),t.layerType=t.rawConfig.layerType;const{enableMultiPassRenderer:n,passes:i}=t.getLayerConfig();n&&i!==null&&i!==void 0&&i.length&&i.length>0&&t.mapService.on("mapAfterFrameChange",()=>{t.renderLayers()}),t.postProcessingPassFactory=t.container.postProcessingPassFactory,t.styleAttributeService=t.container.styleAttributeService,n&&(t.multiPassRenderer=t.container.multiPassRenderer,t.multiPassRenderer.setLayer(t)),t.pendingStyleAttributes.forEach(({attributeName:o,attributeField:a,attributeValues:s,updateOptions:u})=>{t.styleAttributeService.updateStyleAttribute(o,{scale:he({field:a},t.splitValuesAndCallbackInAttribute(s,a?void 0:t.getLayerConfig()[o]))},u)}),t.pendingStyleAttributes=[],t.plugins=yW();for(const o of t.plugins)o.apply(t,t.container);t.layerPickService=new TW(t),t.textureService=new AW(t),t.log(Fr.LayerInitStart),yield t.hooks.init.promise(),t.log(Fr.LayerInitEnd),t.inited=!0,t.emit("inited",{target:t,type:"inited"}),t.emit("add",{target:t,type:"add"}),t.hooks.afterInit.call()})()}log(t,r="init"){var n;if(this.tileLayer||this.isTileLayer)return;const i=`${this.id}.${r}.${t}`,o={id:this.id,type:this.type};(n=this.debugService)===null||n===void 0||n.log(i,o)}updateModelData(t){t.attributes&&t.elements?this.models.map(r=>{r.updateAttributesAndElements(t.attributes,t.elements)}):console.warn("data error")}setLayerPickService(t){this.layerPickService=t}prepareBuildModel(){Object.keys(this.needUpdateConfig||{}).length!==0&&this.updateLayerConfig({});const{animateOption:t}=this.getLayerConfig();t!=null&&t.enable&&(this.layerService.startAnimate(),this.animateStatus=!0)}color(t,r,n){return this.updateStyleAttribute("color",t,r,n),this}texture(t,r,n){return this.updateStyleAttribute("texture",t,r,n),this}rotate(t,r,n){return this.updateStyleAttribute("rotate",t,r,n),this}size(t,r,n){return this.updateStyleAttribute("size",t,r,n),this}filter(t,r,n){const i=this.updateStyleAttribute("filter",t,r,n);return this.dataState.dataSourceNeedUpdate=i&&this.inited,this}shape(t,r,n){this.shapeOption={field:t,values:r};const i=this.updateStyleAttribute("shape",t,r,n);return this.dataState.dataSourceNeedUpdate=i&&this.inited,this}label(t,r,n){return this.pendingStyleAttributes.push({attributeName:"label",attributeField:t,attributeValues:r,updateOptions:n}),this}animate(t){let r={};return Vr(t)?(r.enable=!0,r=he(he({},r),t)):r.enable=t,this.updateLayerConfig({animateOption:r}),this}source(t,r){return(t==null?void 0:t.type)==="source"?(this.setSource(t),this):(this.sourceOption={data:t,options:r},this.clusterZoom=0,this)}setData(t,r){return this.inited?(this.dataUpdatelog(),this.layerSource.setData(t,r)):this.on("inited",()=>{this.dataUpdatelog(),this.layerSource.setData(t,r)}),this}dataUpdatelog(){this.log(Fr.SourceInitStart,jr.UPDATE),this.layerSource.once("update",()=>{this.log(Fr.SourceInitEnd,jr.UPDATE)})}style(t){const{passes:r}=t,n=ai(t,SW);r&&SS(r).forEach(o=>{const a=this.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(o[0]);a&&a.updateOptions(o[1])}),n.borderColor&&(n.stroke=n.borderColor),n.borderWidth&&(n.strokeWidth=n.borderWidth);const i=n;return Object.keys(n).forEach(o=>{const a=n[o];Array.isArray(a)&&a.length===2&&!wE(a[0])&&!wE(a[1])&&(i[o]={field:a[0],value:a[1]})}),this.encodeStyle(i),this.updateLayerConfig(i),this}encodeStyle(t){Object.keys(t).forEach(r=>{[...this.enableShaderEncodeStyles,...this.enableDataEncodeStyles].includes(r)&&bW(t[r])&&(t[r].field||t[r].value)&&!qh(this.encodeStyleAttribute[r],t[r])?(this.encodeStyleAttribute[r]=t[r],this.updateStyleAttribute(r,t[r].field,t[r].value),this.inited&&(this.dataState.dataMappingNeedUpdate=!0)):this.encodeStyleAttribute[r]&&(delete this.encodeStyleAttribute[r],this.dataState.dataSourceNeedUpdate=!0)})}scale(t,r){const n=he({},this.scaleOptions);if(Vr(t)?this.scaleOptions=he(he({},this.scaleOptions),t):this.scaleOptions[t]=r,this.styleAttributeService&&!qh(n,this.scaleOptions)){const i=Vr(t)?t:{[t]:r};this.styleAttributeService.updateScaleAttribute(i)}return this}renderLayers(){this.rendering=!0,this.layerService.reRender(),this.rendering=!1}prerender(){}render(t={}){return this.tileLayer?(this.tileLayer.render(),this):(this.layerService.beforeRenderData(this),this.encodeDataLength<=0&&!this.forceRender?this:(this.renderModels(t),this))}renderMultiPass(){var t=this;return ve(function*(){t.encodeDataLength<=0&&!t.forceRender||(t.multiPassRenderer&&t.multiPassRenderer.getRenderFlag()?yield t.multiPassRenderer.render():t.renderModels())})()}active(t){const r={};return r.enableHighlight=Vr(t)?!0:t,Vr(t)?(r.enableHighlight=!0,t.color&&(r.highlightColor=t.color),t.mix&&(r.activeMix=t.mix)):r.enableHighlight=!!t,this.updateLayerConfig(r),this}setActive(t,r){if(Vr(t)){const{x:n=0,y:i=0}=t;this.updateLayerConfig({highlightColor:Vr(r)?r.color:this.getLayerConfig().highlightColor,activeMix:Vr(r)?r.mix:this.getLayerConfig().activeMix}),this.pick({x:n,y:i})}else this.updateLayerConfig({pickedFeatureID:t,highlightColor:Vr(r)?r.color:this.getLayerConfig().highlightColor,activeMix:Vr(r)?r.mix:this.getLayerConfig().activeMix}),this.hooks.beforeHighlight.call(La(t)).then(()=>{setTimeout(()=>{this.reRender()},1)})}select(t){const r={};return r.enableSelect=Vr(t)?!0:t,Vr(t)?(r.enableSelect=!0,t.color&&(r.selectColor=t.color),t.mix&&(r.selectMix=t.mix)):r.enableSelect=!!t,this.updateLayerConfig(r),this}setSelect(t,r){if(Vr(t)){const{x:n=0,y:i=0}=t;this.updateLayerConfig({selectColor:Vr(r)?r.color:this.getLayerConfig().selectColor,selectMix:Vr(r)?r.mix:this.getLayerConfig().selectMix}),this.pick({x:n,y:i})}else this.updateLayerConfig({pickedFeatureID:t,selectColor:Vr(r)?r.color:this.getLayerConfig().selectColor,selectMix:Vr(r)?r.mix:this.getLayerConfig().selectMix}),this.hooks.beforeSelect.call(La(t)).then(()=>{setTimeout(()=>{this.reRender()},1)})}setBlend(t){return this.updateLayerConfig({blend:t}),this.reRender(),this}show(){return this.updateLayerConfig({visible:!0}),this.reRender(),this.emit("show"),this}hide(){return this.updateLayerConfig({visible:!1}),this.reRender(),this.emit("hide"),this}setIndex(t){return this.zIndex=t,this.layerService.updateLayerRenderList(),this.layerService.renderLayers(),this}setCurrentPickId(t){this.currentPickId=t}getCurrentPickId(){return this.currentPickId}setCurrentSelectedId(t){this.selectedFeatureID=t}getCurrentSelectedId(){return this.selectedFeatureID}isVisible(){const t=this.mapService.getZoom(),{visible:r,minZoom:n=-1/0,maxZoom:i=1/0}=this.getLayerConfig();return!!r&&t>=n&&tMath.abs(o)===1/0)?this:(this.mapService.fitBounds([[n[0],n[1]],[n[2],n[3]]],t),this)}destroy(t=!0){var r,n,i,o,a;if(this.isDestroyed)return;(r=this.layerModel)===null||r===void 0||r.uniformBuffers.forEach(u=>{u.destroy()}),this.layerChildren.map(u=>u.destroy(!1)),this.layerChildren=[];const{maskfence:s}=this.getLayerConfig();s&&(this.masks.map(u=>u.destroy(!1)),this.masks=[]),this.hooks.beforeDestroy.call(),this.layerSource.off("update",this.sourceEvent),(n=this.multiPassRenderer)===null||n===void 0||n.destroy(),this.textureService.destroy(),this.styleAttributeService.clearAllAttributes(),this.hooks.afterDestroy.call(),(i=this.layerModel)===null||i===void 0||i.clearModels(t),(o=this.tileLayer)===null||o===void 0||o.destroy(),this.models=[],(a=this.debugService)===null||a===void 0||a.removeLog(this.id),this.emit("remove",{target:this,type:"remove"}),this.emit("destroy",{target:this,type:"destroy"}),this.removeAllListeners(),this.isDestroyed=!0}clear(){this.styleAttributeService.clearAllAttributes()}clearModels(){var t;this.models.forEach(r=>r.destroy()),(t=this.layerModel)===null||t===void 0||t.clearModels(),this.models=[]}isDirty(){return!!(this.styleAttributeService.getLayerStyleAttributes()||[]).filter(t=>t.needRescale||t.needRemapping||t.needRegenerateVertices).length}setSource(t){if(this.layerSource&&this.layerSource.off("update",this.sourceEvent),this.layerSource=t,this.clusterZoom=0,this.inited&&this.layerSource.cluster){const r=this.mapService.getZoom();this.layerSource.updateClusterData(r)}this.layerSource.inited&&this.sourceEvent(),this.layerSource.on("update",({type:r})=>{if(this.coordCenter===void 0){const n=this.layerSource.center;this.coordCenter=n}if(r==="update"){if(this.tileLayer){this.tileLayer.reload();return}this.sourceEvent()}})}getSource(){return this.layerSource}getScaleOptions(){return this.scaleOptions}setEncodedData(t){this.encodedData=t,this.encodeDataLength=t.length}getEncodedData(){return this.encodedData}getScale(t){return this.styleAttributeService.getLayerAttributeScale(t)}getLegend(t){var r,n,i;const o=this.styleAttributeService.getLayerStyleAttribute(t);return{type:(n=((o==null||(r=o.scale)===null||r===void 0?void 0:r.scalers)||[])[0])===null||n===void 0||(n=n.option)===null||n===void 0?void 0:n.type,field:o==null||(i=o.scale)===null||i===void 0?void 0:i.field,items:this.getLegendItems(t)}}getLegendItems(t){const r=this.styleAttributeService.getLayerAttributeScale(t);return r?r.invertExtent?r.range().map(i=>({value:r.invertExtent(i),[t]:i})):r.ticks?r.ticks().map(i=>({value:i,[t]:r(i)})):r!=null&&r.domain?r.domain().filter(i=>!RW(i)).map(i=>({value:i,[t]:r(i)})):[]:[]}pick({x:t,y:r}){this.interactionService.triggerHover({x:t,y:r})}boxSelect(t,r){this.pickingService.boxPickLayer(this,t,r)}buildLayerModel(t){var r=this;return ve(function*(){const{moduleName:n,vertexShader:i,fragmentShader:o,defines:a,inject:s,triangulation:u,styleOption:l,pickingEnabled:f=!0}=t,c=ai(t,xW);r.shaderModuleService.registerModule(n,{vs:i,fs:o,defines:a,inject:s});const{vs:h,fs:d,uniforms:p}=r.shaderModuleService.getModule(n),{createModel:v}=r.rendererService;return new Promise(g=>{const{attributes:y,elements:S,count:R}=r.styleAttributeService.createAttributesAndIndices(r.encodedData,u,l,r),x=[...r.layerModel.uniformBuffers,...r.rendererService.uniformBuffers];f&&x.push(r.getPickingUniformBuffer());const M=he({attributes:y,uniforms:p,fs:d,vs:h,elements:S,blend:bS[Ui.normal],uniformBuffers:x,textures:r.layerModel.textures},c);R&&(M.count=R);const $=v(M);g($)})})()}createAttributes(t){const{triangulation:r}=t,{attributes:n}=this.styleAttributeService.createAttributes(this.encodedData,r);return n}getTime(){return this.layerService.clock.getDelta()}setAnimateStartTime(){this.animateStartTime=this.layerService.clock.getElapsedTime()}stopAnimate(){this.animateStatus&&(this.layerService.stopAnimate(),this.animateStatus=!1,this.updateLayerConfig({animateOption:{enable:!1}}))}getLayerAnimateTime(){return this.layerService.clock.getElapsedTime()-this.animateStartTime}needPick(t){const{enableHighlight:r=!0,enableSelect:n=!0}=this.getLayerConfig();let i=this.eventNames().indexOf(t)!==-1||this.eventNames().indexOf("un"+t)!==-1;return(t==="click"||t==="dblclick")&&n&&(i=!0),t==="mousemove"&&(r||this.eventNames().indexOf("mouseenter")!==-1||this.eventNames().indexOf("unmousemove")!==-1||this.eventNames().indexOf("mouseout")!==-1)&&(i=!0),this.isVisible()&&i}buildModels(){return ve(function*(){throw new Error("Method not implemented.")})()}rebuildModels(){var t=this;return ve(function*(){yield t.buildModels()})()}renderMulPass(t){return ve(function*(){yield t.render()})()}renderModels(t={}){return this.encodeDataLength<=0&&!this.forceRender?(this.clearModels(),this):(this.hooks.beforeRender.call(),this.models.forEach(r=>{r.draw({uniforms:this.layerModel.getUninforms(),blend:this.layerModel.getBlend(),stencil:this.layerModel.getStencil(t),textures:this.layerModel.textures},(t==null?void 0:t.ispick)||!1)}),this.hooks.afterRender.call(),this)}updateStyleAttribute(t,r,n,i){const o=this.configService.getAttributeConfig(this.id)||{};return qh(o[t],{field:r,values:n})?!1:(["color","size","texture","rotate","filter","label","shape"].indexOf(t)!==-1&&this.configService.setAttributeConfig(this.id,{[t]:{field:r,values:n}}),this.startInit?this.styleAttributeService.updateStyleAttribute(t,{scale:he({field:r},this.splitValuesAndCallbackInAttribute(n,this.getLayerConfig()[r]))},i):this.pendingStyleAttributes.push({attributeName:t,attributeField:r,attributeValues:n,updateOptions:i}),!0)}getLayerAttributeConfig(){return this.configService.getAttributeConfig(this.id)}getShaderPickStat(){return this.layerService.getShaderPickStat()}setEarthTime(t){console.warn("empty fn")}processData(t){return t}getModelType(){throw new Error("Method not implemented.")}getDefaultConfig(){return{}}initLayerModels(){var t=this;return ve(function*(){t.models.forEach(n=>n.destroy()),t.models=[],t.uniformBuffers.forEach(n=>{n.destroy()}),t.uniformBuffers=[];const r=t.rendererService.createBuffer({data:new Float32Array(20).fill(0),isUBO:!0,label:"pickingUniforms"});t.uniformBuffers.push(r),t.models=yield t.layerModel.initModels()})()}getPickingUniformBuffer(){return this.uniformBuffers[0]}reRender(){this.inited&&this.layerService.reRender()}splitValuesAndCallbackInAttribute(t){return{values:LE(t)?void 0:t,callback:LE(t)?t:void 0}}}function CW(e,t){return{enable:e,mask:255,func:{cmp:m.EQUAL,ref:t?1:0,mask:1}}}function BE(e){return e.maskOperation===uf.OR?{enable:!0,mask:255,func:{cmp:m.ALWAYS,ref:1,mask:255},opFront:{fail:m.KEEP,zfail:m.REPLACE,zpass:m.REPLACE}}:{enable:!0,mask:255,func:{cmp:e.stencilType===go.SINGLE||e.stencilIndex===0?m.ALWAYS:m.LESS,ref:e.stencilType===go.SINGLE?1:e.stencilIndex===0?2:1,mask:255},opFront:{fail:m.KEEP,zfail:m.REPLACE,zpass:m.REPLACE}}}const OW={opacity:1,stroke:[1,0,0,1],offsets:[0,0],rotation:0,extrusionBase:0,strokeOpacity:1,thetaOffset:.314},Ll={opacity:"float",stroke:"vec4",offsets:"vec2",textOffset:"vec2",rotation:"float",extrusionBase:"float",strokeOpacity:"float",thetaOffset:"float"};var e_={exports:{}};e_.exports=df;e_.exports.default=df;function df(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=RS(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,u,l,f,c,h,d;if(n&&(o=LW(e,t,o,r)),e.length>80*r){s=l=e[0],u=f=e[1];for(var p=r;pl&&(l=c),h>f&&(f=h);d=Math.max(l-s,f-u),d=d!==0?32767/d:0}return Au(o,a,r,s,u,d,0),a}function RS(e,t,r,n,i){var o,a;if(i===Yd(e,t,r,n)>0)for(o=t;o=t;o-=n)a=DE(o,e[o],e[o+1],a);return a&&pf(a,a.next)&&(xu(a),a=a.next),a}function Ro(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(pf(r,r.next)||hr(r.prev,r,r.next)===0)){if(xu(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Au(e,t,r,n,i,o,a){if(e){!a&&o&&UW(e,n,i,o);for(var s=e,u,l;e.prev!==e.next;){if(u=e.prev,l=e.next,o?MW(e,n,i,o):IW(e)){t.push(u.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),xu(e),e=l.next,s=l.next;continue}if(e=l,e===s){a?a===1?(e=NW(Ro(e),t,r),Au(e,t,r,n,i,o,2)):a===2&&PW(e,t,r,n,i,o):Au(Ro(e),t,r,n,i,o,1);break}}}}function IW(e){var t=e.prev,r=e,n=e.next;if(hr(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,u=r.y,l=n.y,f=io?i>a?i:a:o>a?o:a,d=s>u?s>l?s:l:u>l?u:l,p=n.next;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=c&&p.y<=d&&Ea(i,s,o,u,a,l,p.x,p.y)&&hr(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function MW(e,t,r,n){var i=e.prev,o=e,a=e.next;if(hr(i,o,a)>=0)return!1;for(var s=i.x,u=o.x,l=a.x,f=i.y,c=o.y,h=a.y,d=su?s>l?s:l:u>l?u:l,g=f>c?f>h?f:h:c>h?c:h,y=Wd(d,p,t,r,n),S=Wd(v,g,t,r,n),R=e.prevZ,x=e.nextZ;R&&R.z>=y&&x&&x.z<=S;){if(R.x>=d&&R.x<=v&&R.y>=p&&R.y<=g&&R!==i&&R!==a&&Ea(s,f,u,c,l,h,R.x,R.y)&&hr(R.prev,R,R.next)>=0||(R=R.prevZ,x.x>=d&&x.x<=v&&x.y>=p&&x.y<=g&&x!==i&&x!==a&&Ea(s,f,u,c,l,h,x.x,x.y)&&hr(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;R&&R.z>=y;){if(R.x>=d&&R.x<=v&&R.y>=p&&R.y<=g&&R!==i&&R!==a&&Ea(s,f,u,c,l,h,R.x,R.y)&&hr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;x&&x.z<=S;){if(x.x>=d&&x.x<=v&&x.y>=p&&x.y<=g&&x!==i&&x!==a&&Ea(s,f,u,c,l,h,x.x,x.y)&&hr(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function NW(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!pf(i,o)&&CS(i,n,n.next,o)&&Su(i,o)&&Su(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),xu(n),xu(n.next),n=e=o),n=n.next}while(n!==e);return Ro(n)}function PW(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&zW(a,s)){var u=OS(a,s);a=Ro(a,a.next),u=Ro(u,u.next),Au(a,t,r,n,i,o,0),Au(u,t,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==e)}function LW(e,t,r,n){var i=[],o,a,s,u,l;for(o=0,a=t.length;o=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x=r.x&&r.x>=l&&n!==r.x&&Ea(ia.x||r.x===a.x&&DW(a,r)))&&(a=r,c=h)),r=r.next;while(r!==u);return a}function DW(e,t){return hr(e.prev,e,t.prev)<0&&hr(t.next,e,e.next)<0}function UW(e,t,r,n){var i=e;do i.z===0&&(i.z=Wd(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,kW(i)}function kW(e){var t,r,n,i,o,a,s,u,l=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t0||u>0&&n;)s!==0&&(u===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1);return e}function Wd(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function $W(e){var t=e,r=e;do(t.x=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function zW(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!VW(e,t)&&(Su(e,t)&&Su(t,e)&&HW(e,t)&&(hr(e.prev,e,t.prev)||hr(e,t.prev,t))||pf(e,t)&&hr(e.prev,e,e.next)>0&&hr(t.prev,t,t.next)>0)}function hr(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function pf(e,t){return e.x===t.x&&e.y===t.y}function CS(e,t,r,n){var i=Fl(hr(e,t,r)),o=Fl(hr(e,t,n)),a=Fl(hr(r,n,e)),s=Fl(hr(r,n,t));return!!(i!==o&&a!==s||i===0&&wl(e,r,t)||o===0&&wl(e,n,t)||a===0&&wl(r,e,n)||s===0&&wl(r,t,n))}function wl(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Fl(e){return e>0?1:e<0?-1:0}function VW(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&CS(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function Su(e,t){return hr(e.prev,e,e.next)<0?hr(e,t,e.next)>=0&&hr(e,e.prev,t)>=0:hr(e,t,e.prev)<0||hr(e,e.next,t)<0}function HW(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function OS(e,t){var r=new Gd(e.i,e.x,e.y),n=new Gd(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function DE(e,t,r,n){var i=new Gd(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function xu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Gd(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}df.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(Yd(e,0,o,r));if(i)for(var s=0,u=t.length;s0&&(n+=e[i-1].length,r.holes.push(n))}return r};var jW=e_.exports;const bu=Ht(jW);function UE(e){return Math.max(Math.ceil(e/4)*4,4)}function IS(e,t,r,n=!0){const i=r===3;if(n){e=e.slice();const a=[];for(let s=0;s{typeof n[i]=="boolean"&&(n[i]=n[i]?1:0)}),!this.rendererService.hasOwnProperty("device")&&this.textures&&this.textures.length===1&&(n.u_texture=this.textures[0]),n}getAnimateUniforms(){return{}}needUpdate(){return ve(function*(){return!1})()}buildModels(){return ve(function*(){throw new Error("Method not implemented.")})()}initModels(){return ve(function*(){throw new Error("Method not implemented.")})()}clearModels(t=!0){}getAttribute(){throw new Error("Method not implemented.")}prerender(){}render(t){throw new Error("Method not implemented.")}registerBuiltinAttributes(){throw new Error("Method not implemented.")}animateOption2Array(t){return[t.enable?0:1,t.duration||4,t.interval||.2,t.trailLength||.1]}startModelAnimate(){const{animateOption:t}=this.layer.getLayerConfig();t.enable&&this.layer.setAnimateStartTime()}getInject(){return XW(this.layer.enableShaderEncodeStyles,this.layer.encodeStyleAttribute)}getDefines(){const t=Object.keys(this.attributeLocation).reduce((r,n)=>{const i=MS+n;return r[i]=this.attributeLocation[n],r},{});return he({},t)}getStyleAttribute(){const t={};return this.layer.enableShaderEncodeStyles.forEach(r=>{if(!this.layer.encodeStyleAttribute[r]){const n=this.layer.getLayerConfig()[r];let i=typeof n>"u"?OW[r]:n;r==="stroke"&&(i=Zt(i)),t["u_"+r]=i}}),t}registerStyleAttribute(){Object.keys(this.layer.encodeStyleAttribute).forEach(t=>{const r=fW(t);r&&this.styleAttributeService.registerStyleAttribute(r)})}registerPosition64LowAttribute(t=!0){this.styleAttributeService.registerStyleAttribute({name:"position64Low",type:qe.Attribute,descriptor:{name:"a_Position64Low",shaderLocation:this.attributeLocation.POSITION_64LOW,buffer:{data:[],type:m.FLOAT},size:2,update:(r,n,i)=>t?[Ir(i[0]),Ir(i[1])]:[0,0]}})}updateEncodeAttribute(t,r){this.encodeStyleAttribute[t]=r}initUniformsBuffer(){const t=this.getUniformsBufferInfo(this.getStyleAttribute()),r=this.getCommonUniformsInfo();t.uniformsLength!==0&&(this.attributeUnifoms=this.rendererService.createBuffer({data:new Float32Array(UE(t.uniformsLength)).fill(0),isUBO:!0,label:"layerModelAttributeUnifoms"}),this.uniformBuffers.push(this.attributeUnifoms)),r.uniformsLength!==0&&(this.commonUnifoms=this.rendererService.createBuffer({data:new Float32Array(UE(r.uniformsLength)).fill(0),isUBO:!0,label:"layerModelCommonUnifoms"}),this.uniformBuffers.push(this.commonUnifoms))}getUniformsBufferInfo(t){let r=0;const n=[];return Object.values(t).forEach(i=>{Array.isArray(i)?(n.push(...i),r+=i.length):typeof i=="number"?(n.push(i),r+=1):typeof i=="boolean"&&(n.push(Number(i)),r+=1)}),{uniformsOption:t,uniformsLength:r,uniformsArray:n}}getCommonUniformsInfo(){return{uniformsLength:0,uniformsArray:[],uniformsOption:{}}}updateStyleUnifoms(){var t,r;const{uniformsArray:n}=this.getUniformsBufferInfo(this.getStyleAttribute()),{uniformsArray:i}=this.getCommonUniformsInfo();(t=this.attributeUnifoms)===null||t===void 0||t.subData({offset:0,data:new Uint8Array(new Float32Array(n).buffer)}),(r=this.commonUnifoms)===null||r===void 0||r.subData({offset:0,data:new Uint8Array(new Float32Array(i).buffer)})}}function XW(e,t){const r=[];let n="";e.forEach(a=>{const s=a.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase(),u=MS+s;t[a]?n+=`#define USE_ATTRIBUTE_${s} 0.0 `:r.push(` ${Ll[a]} u_${a};`),n+=` #ifdef USE_ATTRIBUTE_${s} layout(location = ${u}) in ${Ll[a]} a_${a.charAt(0).toUpperCase()+a.slice(1)}; #endif `});const i=r.length?` layout(std140) uniform AttributeUniforms { ${r.join(` `)} }; `:"";n+=i;let o="";return e.forEach(a=>{const s=a.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase();o+=` #ifdef USE_ATTRIBUTE_${s} ${Ll[a]} ${a} = a_${a.charAt(0).toUpperCase()+a.slice(1)}; #else ${Ll[a]} ${a} = u_${a}; #endif `}),{"vs:#decl":n,"fs:#decl":i,"vs:#main-start":o}}let kE=function(e){return e.VERTICAL="vertical",e.HORIZONTAL="horizontal",e}({}),WW=function(e){return e.NORMAL="normal",e.REPLACE="replace",e}({}),t_=function(e){return e[e.pixel=0]="pixel",e[e.meter=1]="meter",e}({});const NS=100;function $E(e){return e/180*Math.acos(-1)}function PS(e){const t=$E(e[0])+Math.PI/2,r=$E(e[1]),n=NS+Math.random()*.4,i=n*Math.cos(r)*Math.cos(t),o=n*Math.cos(r)*Math.sin(t),a=n*Math.sin(r);return[o,a,i]}const zE=hn();hn();const Cn=hn(),ws=hn(),Bl=hn();function VE(e,t,r,n,i){ki(e,r,n),Ec(e,e),t=Cd(-e[1],e[0]);const o=Cd(-r[1],r[0]);return[i/Id(t,o),t]}function Fs(e,t){return L9(e,-t[1],t[0])}function Dl(e,t,r){return dA(e,t,r),Ec(e,e),e}function HE(e,t){return e[0]===t[0]&&e[1]===t[1]}class GW{constructor(t={}){E(this,"complex",void 0),E(this,"join",void 0),E(this,"cap",void 0),E(this,"miterLimit",void 0),E(this,"thickness",void 0),E(this,"normal",void 0),E(this,"lastFlip",-1),E(this,"miter",Cd(0,0)),E(this,"started",!1),E(this,"dash",!1),E(this,"totalDistance",0),E(this,"currentIndex",0),this.join=t.join||"miter",this.cap=t.cap||"butt",this.miterLimit=t.miterLimit||10,this.thickness=t.thickness||1,this.dash=t.dash||!1,this.complex={positions:[],indices:[],normals:[],startIndex:0,indexes:[]}}simpleExtrude(t){const r=this.complex;if(t.length<=1)return r;this.lastFlip=-1,this.started=!1,this.normal=null,this.totalDistance=0;const n=t.length;let i=r.startIndex;for(let o=1;othis.miterLimit&&(R=!0),R?(l.push(this.normal[0],this.normal[1],0),l.push(y[0],y[1],0),u.push(i[0],i[1],i[2]|0,this.totalDistance,-this.thickness*S,i[2]|0),this.complex.indexes.push(this.currentIndex),u.push(i[0],i[1],i[2]|0,this.totalDistance,this.thickness*S,i[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++,s.push(...this.lastFlip!==-S?[r,r+2,r+3]:[r+2,r+1,r+3]),s.push(r+2,r+3,r+4),Fs(zE,ws),$h(this.normal,zE),l.push(this.normal[0],this.normal[1],0),u.push(i[0],i[1],i[2]|0,this.totalDistance,-this.thickness*S,i[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++,a+=3):(this.extrusions(u,l,i,y,g,this.totalDistance),s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),S=-1,$h(this.normal,y),a+=2),this.lastFlip=S}else{if(Fs(this.normal,Cn),f){const v=hn(),g=hn();dA(g,Cn,this.normal),ki(v,Cn,this.normal),l.push(g[0],g[1],0),l.push(v[0],v[1],0),u.push(i[0],i[1],i[2]|0,this.totalDistance,this.thickness,i[2]|0),this.complex.indexes.push(this.currentIndex),u.push(i[0],i[1],i[2]|0,this.totalDistance,this.thickness,i[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++}else this.extrusions(u,l,i,this.normal,this.thickness,this.totalDistance);s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),a+=2}return a}extrusions(t,r,n,i,o,a){r.push(i[0],i[1],0),r.push(i[0],i[1],0),t.push(n[0],n[1],n[2]|0,a,-o,n[2]|0),this.complex.indexes.push(this.currentIndex),t.push(n[0],n[1],n[2]|0,a,o,n[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++}lineSegmentDistance(t,r){const n=r[0]-t[0],i=r[1]-t[1];return Math.sqrt(n*n+i*i)}}let Bs=function(e){return e.CYLINDER="cylinder",e.SQUARECOLUMN="squareColumn",e.TRIANGLECOLUMN="triangleColumn",e.HEXAGONCOLUMN="hexagonColumn",e.PENTAGONCOLUMN="pentagonColumn",e}({}),Ds=function(e){return e.CIRCLE="circle",e.SQUARE="square",e.TRIANGLE="triangle",e.HEXAGON="hexagon",e.PENTAGON="pentagon",e}({});function Uu(e,t=0){const r=Math.PI*2/e,n=[];for(let o=0;o{const a=Math.sin(o+Math.PI/4),s=Math.cos(o+Math.PI/4);return[a,s,0]})}function Zd(){return Uu(30)}function jE(){return Uu(4)}function XE(){return Uu(3)}function WE(){return Uu(6,1)}function GE(){return Uu(5)}const Kh={[Ds.CIRCLE]:Zd,[Ds.HEXAGON]:WE,[Ds.TRIANGLE]:XE,[Ds.SQUARE]:jE,[Ds.PENTAGON]:GE,[Bs.CYLINDER]:Zd,[Bs.HEXAGONCOLUMN]:WE,[Bs.TRIANGLECOLUMN]:XE,[Bs.SQUARECOLUMN]:jE,[Bs.PENTAGONCOLUMN]:GE};function LS(e,t=!1){const r=e[0][0],n=e[0][e[0].length-1];r[0]===n[0]&&r[1]===n[1]&&(e[0]=e[0].slice(0,e[0].length-1));const i=e[0].length,o=bu.flatten(e),{vertices:a,dimensions:s,holes:u}=o,l=[],f=[],c=[];for(let d=0;dS+g))}return{positions:l,index:f,normals:c}}function YW(e,t,r,n=!1){const i=Zs(),o=Zs(),a=Zs();n&&(e=Zl(e),t=Zl(t),r=Zl(r));const s=Wn(...e),u=Wn(...t),l=Wn(...r);fg(i,l,u),fg(o,s,u),M9(a,i,o);const f=Zs();return qs(f,a),f}const Ul={};function To(e){const t=Ao(e.coordinates);return{vertices:[...t,...t,...t,...t],indices:[0,1,2,2,3,0],size:t.length}}function YE(e){const t=Ao(e.coordinates),r=PS(t);return{vertices:[...r,...r,...r,...r],indices:[0,1,2,2,3,0],size:r.length}}function wS(e){const{shape:t}=e,{positions:r,index:n,normals:i}=eG(t,!1);return{vertices:r,indices:n,normals:i,size:5}}function ZW(e){const t=Ao(e.coordinates);return{vertices:[...t],indices:[0],size:t.length}}function qd(e){const{coordinates:t}=e,r=new GW({dash:!0,join:"bevel"});let n=t;n[0]&&!Array.isArray(n[0][0])&&(n=[t]),n.forEach(o=>{r.extrude(o)});const i=r.complex;return{vertices:i.positions,indices:i.indices,normals:i.normals,indexes:i.indexes,size:6}}function qW(e){const{coordinates:t}=e,r=[];if(!Array.isArray(t[0]))return{vertices:[],indices:[],normals:[],size:6,count:0};const{results:n,totalDistance:i}=KW(t);return n.map(o=>{r.push(o[0],o[1],o[2],o[3],0,i)}),{vertices:r,indices:[],normals:[],size:6,count:n.length}}function ZE(e,t){const r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function Qh(e,t){return e.length<3&&e.push(0),t!==void 0&&e.push(t),e}function KW(e){let t=e;Array.isArray(t)&&Array.isArray(t[0])&&Array.isArray(t[0][0])&&(t=e.flat());let r=0;if(t.length<2)return{results:t,totalDistance:0};{const n=[],i=Qh(t[0],r);n.push(i);for(let a=1;aa*2+s));return{vertices:i,indices:o,size:7}}function eG(e,t=!1){if(Ul&&Ul[e])return Ul[e];const r=Kh[e]?Kh[e]():Kh.cylinder(),n=LS([r],t);return Ul[e]=n,n}function tG(e,t){return{type:e.type,field:"value",items:e.positions.map((r,n)=>({[t]:n>=e.colors.length?null:e.colors[n],value:r}))}}const rG=`uniform sampler2D u_texture; layout(std140) uniform commonUniforms { float u_opacity:1.0; float u_brightness:1.0; float u_contrast:1.0; float u_saturation:1.0; float u_gamma:1.0; }; in vec2 v_texCoord; out vec4 outputColor; vec3 setContrast(vec3 rgb, float contrast) { vec3 color = mix(vec3(0.5), rgb, contrast); color = clamp(color, 0.0, 1.0); return color; } vec3 setSaturation(vec3 rgb, float adjustment) { const vec3 grayVector = vec3(0.2125, 0.7154, 0.0721); vec3 intensity = vec3(dot(rgb, grayVector)); vec3 color = mix(intensity, rgb, adjustment); color = clamp(color, 0.0, 1.0); return color; } void main() { vec4 color = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y)); //brightness color.rgb = mix(vec3(0.0, 0.0, 0.0), color.rgb, u_brightness); //contrast color.rgb = setContrast(color.rgb, u_contrast); // saturation color.rgb = setSaturation(color.rgb, u_saturation); // gamma color.rgb = pow(color.rgb, vec3(u_gamma)); outputColor = color; outputColor.a *= u_opacity; if(outputColor.a < 0.01) discard; } `,nG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv; layout(std140) uniform commonUniforms { float u_opacity:1.0; float u_brightness:1.0; float u_contrast:1.0; float u_saturation:1.0; float u_gamma:1.0; }; out vec2 v_texCoord; #pragma include "projection" void main() { v_texCoord = a_Uv; vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0)); } `;let iG=class extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getCommonUniformsInfo(){const{opacity:t,brightness:r,contrast:n,saturation:i,gamma:o}=this.layer.getLayerConfig(),a={u_opacity:bs(t,1),u_brightness:bs(r,1),u_contrast:bs(n,1),u_saturation:bs(i,1),u_gamma:bs(o,1)};return this.textures=[this.texture],this.getUniformsBufferInfo(a)}initModels(){var t=this;return ve(function*(){return yield t.loadTexture(),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}loadTexture(){var t=this;return ve(function*(){const{createTexture2D:r}=t.rendererService,i=yield t.layer.getSource().data.images;t.texture=r({data:i[0],width:i[0].width,height:i[0].height,mag:m.LINEAR,min:m.LINEAR})})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"rasterImage",vertexShader:nG,fragmentShader:rG,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,blend:{enable:!0},depth:{enable:!1},pickingEnabled:!1})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}};const oG={image:iG};class aG extends Ka{constructor(...t){super(...t),E(this,"type","ImageLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new oG[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{image:{}}[t]}getModelType(){return"image"}}const sG=` #define Animate 0.0 #define LineTexture 1.0 uniform sampler2D u_texture; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float segmentNumber; float u_lineDir: 1.0; float u_icon_step: 100; float u_line_texture: 0.0; float u_textureBlend; float u_blur : 0.9; float u_line_type: 0.0; float u_time; float u_linearColor: 0.0; }; in vec4 v_color; in vec2 v_iconMapUV; in vec4 v_lineData; //dash in vec4 v_dash_array; in float v_distance_ratio; out vec4 outputColor; #pragma include "picking" void main() { if(u_dash_array!=vec4(0.0)){ float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w); if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) { discard; }; } float animateSpeed = 0.0; // 运动速度 outputColor = v_color; if(u_animate.x == Animate && u_line_texture != LineTexture) { animateSpeed = u_time / u_animate.y; float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y); alpha = (alpha + u_animate.w -1.0) / u_animate.w; // alpha = smoothstep(0., 1., alpha); alpha = clamp(alpha, 0.0, 1.0); outputColor.a *= alpha; } // 当存在贴图时在底色上贴上贴图 if(u_line_texture == LineTexture) { // while load texture float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber)); // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio); float count = v_lineData.g; // 贴图在弧线上重复的数量 float time = 0.0; if(u_animate.x == Animate) { time = u_time / u_animate.y; } float redioCount = arcRadio * count; float u = fract(redioCount - time); float v = v_lineData.a; // 横向 v vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec4 pattern = texture(SAMPLER_2D(u_texture), uv); if(u_animate.x == Animate) { float currentPlane = floor(redioCount - time); float textureStep = floor(count * u_animate.z); float a = mod(currentPlane, textureStep); if(a < textureStep - 1.0) { pattern = vec4(0.0); } } if(u_textureBlend == 0.0) { // normal pattern.a = 0.0; outputColor = filterColor(outputColor + pattern); } else { // replace pattern.a *= v_color.a; if(outputColor.a <= 0.0) { pattern.a = 0.0; } outputColor = filterColor(pattern); } } else { outputColor = filterColor(outputColor); } }`,uG=`#define Animate (0.0) #define LineTexture (1.0) layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance; layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float segmentNumber; float u_lineDir: 1.0; float u_icon_step: 100; float u_line_texture: 0.0; float u_textureBlend; float u_blur : 0.9; float u_line_type: 0.0; float u_time; float u_linearColor: 0.0; }; out vec4 v_color; out vec2 v_iconMapUV; out vec4 v_lineData; //dash out vec4 v_dash_array; out float v_distance_ratio; #pragma include "projection" #pragma include "project" #pragma include "picking" float bezier3(vec3 arr, float t) { float ut = 1.0 - t; return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t; } vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) { vec2 center = target - source; float r = length(center); float theta = atan(center.y, center.x); float thetaOffset = arcThetaOffset; float r2 = r / 2.0 / cos(thetaOffset); float theta2 = theta + thetaOffset; vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y); if (u_lineDir == 1.0) { // 正向 return mid; } else { // 逆向 // (mid + vmin)/2 = (s + t)/2 vec2 vmid = source + target - mid; return vmid; } // return mid; } float getSegmentRatio(float index) { // dash: index / (segmentNumber - 1.); // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.)); return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0)); // return index / (segmentNumber - 1.); } vec2 interpolate(vec2 source, vec2 target, float t, float arcThetaOffset) { // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation vec2 mid = midPoint(source, target, arcThetaOffset); vec3 x = vec3(source.x, mid.x, target.x); vec3 y = vec3(source.y, mid.y, target.y); return vec2(bezier3(x, t), bezier3(y, t)); } vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) { // normalized direction of the line vec2 dir_screenspace = normalize(line_clipspace); // rotate by 90 degrees dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0; return offset; } vec2 getNormal(vec2 line_clipspace, float offset_direction) { // normalized direction of the line vec2 dir_screenspace = normalize(line_clipspace); // rotate by 90 degrees dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); return dir_screenspace.xy * sign(offset_direction); } void main() { //vs中计算渐变色 if (u_linearColor == 1.0) { float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置 v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex / segmentNumber); } else { v_color = a_Color; } v_color.a = v_color.a * opacity; vec2 source_world = a_Instance.rg; // 起始点 vec2 target_world = a_Instance.ba; // 终点 float segmentIndex = a_Position.x; float segmentRatio = getSegmentRatio(segmentIndex); // 计算 dashArray 和 distanceRatio 输出到片元 float total_Distance = pixelDistance(source_world, target_world) / 2.0 * PI; v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance; v_distance_ratio = segmentIndex / segmentNumber; float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0)); float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir); float d_distance_ratio; if(u_animate.x == Animate) { d_distance_ratio = segmentIndex / segmentNumber; if(u_lineDir != 1.0) { d_distance_ratio = 1.0 - d_distance_ratio; } } v_lineData.b = d_distance_ratio; vec4 source = project_position(vec4(source_world, 0, 1.), a_Instance64Low.xy); vec4 target = project_position(vec4(target_world, 0, 1.), a_Instance64Low.zw); vec2 currPos = interpolate(source.xy, target.xy, segmentRatio, thetaOffset); vec2 nextPos = interpolate(source.xy, target.xy, nextSegmentRatio, thetaOffset); vec2 offset = project_pixel( getExtrusionOffset((nextPos.xy - currPos.xy) * indexDir, a_Position.y) ); float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置 v_lineData.r = d_segmentIndex; if(LineTexture == u_line_texture) { // 开启贴图模式 float arcDistrance = length(source - target); // 起始点和终点的距离 arcDistrance = project_pixel(arcDistrance); v_iconMapUV = a_iconMapUV; float pixelLen = project_pixel_texture(u_icon_step); // 贴图沿弧线方向的长度 - 随地图缩放改变 float texCount = floor(arcDistrance / pixelLen); // 贴图在弧线上重复的数量 v_lineData.g = texCount; float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离 float linePixelSize = project_pixel(a_Size); // 定点位置偏移 v_lineData.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值 } gl_Position = project_common_position_to_clipspace(vec4(currPos.xy + offset, 0, 1.0)); setPickingColor(a_PickingColor); } `,lG={solid:0,dash:1};class cG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12,THETA_OFFSET:13})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],forward:a=!0,lineTexture:s=!1,iconStep:u=100,segmentNumber:l=30}=this.layer.getLayerConfig(),{animateOption:f}=this.layer.getLayerConfig();let c=o;i!=="dash"&&(c=[0,0]),c.length===2&&c.push(0,0);let h=0,d=[0,0,0,0],p=[0,0,0,0];if(t&&r&&(d=Zt(t),p=Zt(r),h=1),this.rendererService.getDirty()){var v;(v=this.texture)===null||v===void 0||v.bind()}const g={u_animate:this.animateOption2Array(f),u_dash_array:c,u_sourceColor:d,u_targetColor:p,u_textSize:[1024,this.iconService.canvasHeight||128],segmentNumber:l,u_lineDir:a?1:-1,u_icon_step:u,u_line_texture:s?1:0,u_textureBlend:n==="normal"?0:1,u_blur:.9,u_line_type:lG[i||"solid"],u_time:this.layer.getLayerAnimateTime()||0,u_linearColor:h};return this.getUniformsBufferInfo(g)}initModels(){var t=this;return ve(function*(){return t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}getShaders(){return{frag:sG,vert:uG,type:""}}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const{segmentNumber:r=30}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:"lineArc2d"+o,vertexShader:i,fragmentShader:n,defines:t.getDefines(),inject:t.getInject(),triangulation:r_,depth:{enable:!1},styleOption:{segmentNumber:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"thetaOffset",type:qe.Attribute,descriptor:{name:"a_ThetaOffset",shaderLocation:this.attributeLocation.THETA_OFFSET,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{thetaOffset:r=1}=t;return[r]}}})}}const fG=`#define LineTypeSolid 0.0 #define LineTypeDash 1.0 #define Animate 0.0 #define LineTexture 1.0 uniform sampler2D u_texture; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array: [10.0, 5., 0, 0]; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float u_globel; float u_globel_radius; float u_global_height: 10; float segmentNumber; float u_line_type: 0.0; float u_icon_step: 100; float u_line_texture: 0.0; float u_textureBlend; float u_time; float u_linearColor: 0.0; }; in vec4 v_color; in vec4 v_dash_array; in float v_segmentIndex; in vec2 v_iconMapUV; in vec4 v_line_data; out vec4 outputColor; #pragma include "picking" void main() { float animateSpeed = 0.0; // 运动速度 float d_distance_ratio = v_line_data.g; // 当前点位距离占线总长的比例 outputColor = v_color; if(u_line_type == LineTypeDash) { float flag = 0.; float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w); if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) { flag = 1.; } outputColor.a *=flag; } if(u_animate.x == Animate && u_line_texture != LineTexture) { animateSpeed = u_time / u_animate.y; float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y); alpha = (alpha + u_animate.w -1.0) / u_animate.w; // alpha = smoothstep(0., 1., alpha); alpha = clamp(alpha, 0.0, 1.0); outputColor.a *= alpha; // u_animate // x enable // y duration // z interval // w trailLength } if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture // float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber)); float arcRadio = v_segmentIndex / (segmentNumber - 1.0); float count = v_line_data.b; // // 贴图在弧线上重复的数量 float time = 0.0; if(u_animate.x == Animate) { time = u_time / u_animate.y; } float redioCount = arcRadio * count; float u = fract(redioCount - time); float v = v_line_data.a; // 线图层贴图部分的 v 坐标值 vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec4 pattern = texture(SAMPLER_2D(u_texture), uv); if(u_animate.x == Animate) { float currentPlane = floor(redioCount - time); float textureStep = floor(count * u_animate.z); float a = mod(currentPlane, textureStep); if(a < textureStep - 1.0) { pattern = vec4(0.0); } } if(u_textureBlend == 0.0) { // normal pattern.a = 0.0; outputColor = filterColor(outputColor + pattern); } else { // replace pattern.a *= v_color.a; if(outputColor.a <= 0.0) { pattern.a = 0.0; discard; } else { outputColor = filterColor(pattern); } } } else { outputColor = filterColor(outputColor); } } `,hG=`#define LineTypeSolid 0.0 #define LineTypeDash 1.0 #define Animate 0.0 #define LineTexture 1.0 layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance; layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array: [10.0, 5., 0, 0]; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float u_globel; float u_globel_radius; float u_global_height: 10; float segmentNumber; float u_line_type: 0.0; float u_icon_step: 100; float u_line_texture: 0.0; float u_textureBlend; float u_time; float u_linearColor: 0.0; }; out vec4 v_color; out vec4 v_dash_array; out float v_segmentIndex; out vec2 v_iconMapUV; out vec4 v_line_data; #pragma include "projection" #pragma include "project" #pragma include "picking" float maps (float value, float start1, float stop1, float start2, float stop2) { return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1)); } float getSegmentRatio(float index) { return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0)); } float paraboloid(vec2 source, vec2 target, float ratio) { vec2 x = mix(source, target, ratio); vec2 center = mix(source, target, 0.5); float dSourceCenter = distance(source, center); float dXCenter = distance(x, center); return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter); } vec3 getPos(vec2 source, vec2 target, float segmentRatio) { float vertex_height = paraboloid(source, target, segmentRatio); return vec3( mix(source, target, segmentRatio), sqrt(max(0.0, vertex_height)) ); } vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) { // normalized direction of the line vec2 dir_screenspace = normalize(line_clipspace); // rotate by 90 degrees dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0; return offset; } vec2 getNormal(vec2 line_clipspace, float offset_direction) { // normalized direction of the line vec2 dir_screenspace = normalize(line_clipspace); // rotate by 90 degrees dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); return dir_screenspace.xy * sign(offset_direction); } float torad(float deg) { return (deg / 180.0) * acos(-1.0); } vec3 lglt2xyz(vec2 lnglat) { float pi = 3.1415926; // + Math.PI/2 是为了对齐坐标 float lng = torad(lnglat.x) + pi / 2.0; float lat = torad(lnglat.y); // 手动增加一些偏移,减轻面的冲突 float radius = u_globel_radius; float z = radius * cos(lat) * cos(lng); float x = radius * cos(lat) * sin(lng); float y = radius * sin(lat); return vec3(x, y, z); } void main() { //vs中计算渐变色 if(u_linearColor==1.0){ float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置 v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber); } else{ v_color = a_Color; } v_color.a = v_color.a * opacity; vec2 source = project_position(vec4(a_Instance.rg, 0, 0), a_Instance64Low.xy).xy; vec2 target = project_position(vec4(a_Instance.ba, 0, 0), a_Instance64Low.zw).xy; float segmentIndex = a_Position.x; float segmentRatio = getSegmentRatio(segmentIndex); float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0)); float d_distance_ratio; if(u_line_type == LineTypeDash) { d_distance_ratio = segmentIndex / segmentNumber; float total_Distance = pixelDistance(source, target) / 2.0 * PI; v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex); } if(u_animate.x == Animate) { d_distance_ratio = segmentIndex / segmentNumber; } v_line_data.g = d_distance_ratio; // 当前点位距离占线总长的比例 float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir); vec3 curr = getPos(source, target, segmentRatio); vec3 next = getPos(source, target, nextSegmentRatio); vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y); // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y); v_segmentIndex = a_Position.x; if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // 开启贴图模式 float arcDistrance = length(source - target); float pixelLen = project_pixel_texture(u_icon_step); v_line_data.b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量 vec2 projectOffset = project_pixel(offset); float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离 float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离 v_line_data.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值 v_iconMapUV = a_iconMapUV; } gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z * thetaOffset, 1.0)); // 地球模式 if(u_globel > 0.0) { vec3 startLngLat = lglt2xyz(a_Instance.rg); vec3 endLngLat = lglt2xyz(a_Instance.ba); float globalRadius = length(startLngLat); vec3 lineDir = normalize(endLngLat - startLngLat); vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0); // 线的偏移 vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y; // 计算起始点和终止点的距离 float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0; // 计算飞线各个节点相应的高度 float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength; // 地球点位 vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size; gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0); } setPickingColor(a_PickingColor); } `,dG={solid:0,dash:1};class qE extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12,THETA_OFFSET:13})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],lineTexture:a=!1,iconStep:s=100,segmentNumber:u=30,globalArcHeight:l=10}=this.layer.getLayerConfig(),{animateOption:f}=this.layer.getLayerConfig();o.length===2&&o.push(0,0);let c=0,h=[0,0,0,0],d=[0,0,0,0];if(t&&r&&(h=Zt(t),d=Zt(r),c=1),this.rendererService.getDirty()){var p;(p=this.texture)===null||p===void 0||p.bind()}const v={u_animate:this.animateOption2Array(f),u_dash_array:o,u_sourceColor:h,u_targetColor:d,u_textSize:[1024,this.iconService.canvasHeight||128],u_globel:this.mapService.version==="GLOBEL"?1:0,u_globel_radius:NS,u_global_height:l,segmentNumber:u,u_line_type:dG[i]||0,u_icon_step:s,u_line_texture:a?1:0,u_textureBlend:n==="normal"?0:1,u_time:this.layer.getLayerAnimateTime()||0,u_linearColor:c};return this.getUniformsBufferInfo(v)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}getShaders(){return{frag:fG,vert:hG,type:""}}buildModels(){var t=this;return ve(function*(){const{segmentNumber:r=30}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:"lineArc3d"+o,vertexShader:i,fragmentShader:n,defines:t.getDefines(),inject:t.getInject(),triangulation:r_,styleOption:{segmentNumber:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"thetaOffset",type:qe.Attribute,descriptor:{name:"a_ThetaOffset",shaderLocation:this.attributeLocation.THETA_OFFSET,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{thetaOffset:r=1}=t;return[r]}}})}}const KE={circle:2,triangle:2,diamond:4,rect:2,classic:3,halfTriangle:2,none:0},dn=1/2;function pG(e,t){const{width:r=2,height:n=1}=t;return{vertices:[0,dn*e,1*e*r,-(n+dn)*e,1*e*r,(n-dn)*e,0,dn*e,1*e*r,-(n+dn)*e,1*e*r,(n-dn)*e],indices:[3,4,5],outLineIndices:[0,1,2],normals:[1*e,-2*e,1,-2*e,1.5*e,1,1*e,1.5*e,1,0,0,0,0,0,0,0,0,0],dimensions:2}}function _G(e,t){const{width:r=2,height:n=3}=t;return{vertices:[0,0,1*e*r,1*n,1*e*r,-1*n,0,0,1*e*r,1*n,1*e*r,-1*n],outLineIndices:[0,1,2],indices:[3,4,5],normals:[0,-1.5*e,1,2,1*e,1,-2,1*e,1,0,0,0,0,0,0,0,0,0],dimensions:2}}function vG(e,t){const{width:r=2,height:n=2}=t;return{vertices:[0,n/2,e*r*1,n/2,e*r*1,-n/2,0,-n/2,0,n/2,e*r*1,n/2,e*r*1,-n/2,0,-n/2],dimensions:2,indices:[4,5,6,4,6,7],outLineIndices:[0,1,2,0,2,3],normals:[0,-e,1,1,0,1,0,-e,1,-1,-0,1,0,0,0,0,0,0,0,0,0,0,0,0]}}function mG(e,t){const{width:r=2,height:n=3}=t;return{vertices:[0,0,1*r*e,.5*n,2*r*e,0,1*r*e,-.5*n,0,0,1*r*e,.5*n,2*r*e,0,1*r*e,-.5*n],dimensions:2,indices:[4,5,6,4,6,7],outLineIndices:[0,1,2,0,2,3],normals:[0,-e,1,1,0,1,0,-e,1,-1,-0,1,0,0,0,0,0,0,0,0,0,0,0,0]}}function gG(e,t){const{width:r=2,height:n=3}=t;return{vertices:[0,0,2*e*r,1*n,1.5*e*r,0,2*e*r,-1*n,0,0,2*e*r,1*n,1.5*e*r,0,2*e*r,-1*n],dimensions:2,indices:[4,5,6,4,6,7],outLineIndices:[0,1,2,0,2,3],normals:[0,-e,1,1,0,1,0,-e,1,-1,-0,1,0,0,0,0,0,0,0,0,0,0,0,0]}}function EG(e,t){const{width:r=2,height:n=2}=t,i=Zd(),o=bu.flatten([i]),a=bu(o.vertices,o.holes,o.dimensions),s=i.map(u=>[u[0]*r*e,u[1]*n]).flat();return{vertices:[...s,...s],dimensions:2,indices:a.map(u=>u+i.length),outLineIndices:a,normals:[...i.map(u=>[u[1]*n,u[0]*r*e,1]).flat(),...new Array(i.length*3).fill(0)]}}function yG(e,t=0,r){const n=typeof r.source=="object"?r.source.type:r.source,i=typeof r.target=="object"?r.target.type:r.target,{width:o=n?KE[n]:0}=typeof r.source=="object"?r.source:{},{width:a=i?KE[i]:0}=typeof r.target=="object"?r.target:{};return{vertices:[0,dn,1*o,...e,1,dn,-1*a,...e,1,-dn,-1*a,...e,0,-dn,1*o,...e,0,dn,1*o,...e,1,dn,-1*a,...e,1,-dn,-1*a,...e,0,-dn,1*o,...e],outLineIndices:[0,1,2,0,2,3].map(s=>s+t),indices:[4,5,6,4,6,7].map(s=>s+t),normals:[1,-1,1,1,1,1,-1,0,1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0],dimensions:2}}function QE(e,t){const r=typeof e=="object"?e.type:e,n=t==="source"?1:-1,i=typeof e=="object"?e:{};switch(r){case"circle":return EG(n,i);case"triangle":return _G(n,i);case"diamond":return mG(n,i);case"rect":return vG(n,i);case"classic":return gG(n,i);case"halfTriangle":return pG(n,i);default:return{vertices:[],indices:[],normals:[],dimensions:2,outLineIndices:[],outLineNormals:[]}}}function TG(e){const t=e.coordinates.flat(),r=1,n=1;return{vertices:[1,0,0,...t,1,2,-3,...t,1,1,-3,...t,0,1,0,...t,0,0,0,...t,1,0,0,...t,1,2,-3,...t,1,1,-3,...t,0,1,0,...t,0,0,0,...t],normals:[-r,2*n,1,2*n,-n,1,n,-n,1,n,-n,1,-r,-n,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],indices:[0,1,2,0,2,3,0,3,4,5,6,7,5,7,8,5,8,9],size:7}}function AG(e,t){return t?SG(e,t):TG(e)}function SG(e,t){const r=e.coordinates.flat(),{target:n="classic",source:i="circle"}=t,o=JE(QE(i,"source"),r,0,0),a=yG(r,o.vertices.length/7,t),s=JE(QE(n,"target"),r,1,o.vertices.length/7+a.vertices.length/7);return{vertices:[...o.vertices,...a.vertices,...s.vertices],indices:[...o.outLineIndices,...a.outLineIndices,...s.outLineIndices,...o.indices,...a.indices,...s.indices],normals:[...o.normals,...a.normals,...s.normals],size:7}}function JE(e,t,r=1,n=0){const i=[],{vertices:o,indices:a,dimensions:s,outLineIndices:u}=e;for(let l=0;ll+n),outLineIndices:u.map(l=>l+n)})}const xG=`// #extension GL_OES_standard_derivatives : enable in vec4 v_color; out vec4 outputColor; // line texture #pragma include "picking" void main() { outputColor = v_color; outputColor = filterColor(outputColor); } `,bG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size; layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance; layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; layout(std140) uniform commonUniorm { float u_gap_width: 1.0; float u_stroke_width: 1.0; float u_stroke_opacity: 1.0; }; #pragma include "projection" #pragma include "project" #pragma include "picking" out vec4 v_color; vec2 project_pixel_offset(vec2 offsets) { vec2 data = project_pixel(offsets); return vec2(data.x, -data.y); } vec2 line_dir(vec2 target, vec2 source) { return normalize(ProjectFlat(target) - ProjectFlat(source)); } void main() { // 透明度计算 vec2 source_world = a_Instance.rg; // 起点 vec2 target_world = a_Instance.ba; // 终点 vec2 flowlineDir = line_dir(target_world, source_world); vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x); vec2 position = mix(source_world, target_world, a_Position.x); vec2 position64Low = mix(a_Instance64Low.rg, a_Instance64Low.ba, a_Position.x); float lengthCommon = length( project_position(vec4(target_world, 0, 1)) - project_position(vec4(source_world, 0, 1)) ); vec2 offsetDistances = a_Size.x * project_pixel_offset(vec2(a_Position.y, a_Position.z)); // Mapbox || 高德 vec2 limitedOffsetDistances = clamp( offsetDistances, project_pixel(-lengthCommon * 0.2), project_pixel(lengthCommon * 0.2) ); float startOffsetCommon = project_pixel(offsets[0]); float endOffsetCommon = project_pixel(offsets[1]); float endpointOffset = mix( clamp(startOffsetCommon, 0.0, lengthCommon * 0.2), -clamp(endOffsetCommon, 0.0, lengthCommon * 0.2), a_Position.x ); vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y)); float gapCommon = -1. * project_pixel(u_gap_width); vec3 offsetCommon = vec3( flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) - perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x), 0.0 ); vec4 project_pos = project_position(vec4(position.xy, 0, 1.0), position64Low); vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity); v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0)); setPickingColor(a_PickingColor); } `;class RG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,NORMAL:12})}getCommonUniformsInfo(){const{gapWidth:t=2,strokeWidth:r=1,strokeOpacity:n=1}=this.layer.getLayerConfig(),i={u_gap_width:t,u_stroke_width:r,u_stroke_opacity:n};return this.getUniformsBufferInfo(i)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return[yield t.layer.buildLayerModel({moduleName:"flow_line",vertexShader:bG,fragmentShader:xG,defines:t.getDefines(),inject:t.getInject(),triangulation:AG,styleOption:t.layer.getLayerConfig().symbol,primitive:m.TRIANGLES,depth:{enable:!1},pick:!1})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}})}}const CG=`#define LineTypeSolid 0.0 #define LineTypeDash 1.0 #define Animate 0.0 #define LineTexture 1.0 uniform sampler2D u_texture; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array: [10.0, 5., 0, 0]; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float segmentNumber; float u_line_type: 0.0; float u_icon_step: 100; float u_line_texture: 0.0; float u_textureBlend; float u_time; float u_linearColor: 0; }; in vec4 v_dash_array; in vec4 v_color; in vec2 v_iconMapUV; in vec4 v_line_data; in float v_distance_ratio; out vec4 outputColor; #pragma include "picking" #pragma include "project" #pragma include "projection" void main() { float animateSpeed = 0.0; float d_segmentIndex = v_line_data.g; // 设置弧线的底色 if(u_linearColor == 1.0) { // 使用渐变颜色 outputColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber); outputColor.a *= v_color.a; } else { // 使用 color 方法传入的颜色 outputColor = v_color; } // float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy)); // float blur = smoothstep(1.0, u_blur, length(v_normal.xy)); if(u_line_type == LineTypeDash) { float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w); if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) { // 实线部分 } else { // 虚线部分 discard; }; } // 设置弧线的动画模式 if(u_animate.x == Animate) { animateSpeed = u_time / u_animate.y; float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y); alpha = (alpha + u_animate.w -1.0) / u_animate.w; alpha = smoothstep(0., 1., alpha); outputColor.a *= alpha; } // 设置弧线的贴图 if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0))); // float arcRadio = d_segmentIndex / (segmentNumber - 1.0); float count = v_line_data.b; // 贴图在弧线上重复的数量 float u = fract(arcRadio * count - animateSpeed * count); // float u = fract(arcRadio * count - animateSpeed); if(u_animate.x == Animate) { u = outputColor.a/v_color.a; } float v = v_line_data.a; // 线图层贴图部分的 v 坐标值 vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec4 pattern = texture(SAMPLER_2D(u_texture), uv); // 设置贴图和底色的叠加模式 if(u_textureBlend == 0.0) { // normal pattern.a = 0.0; outputColor = filterColor(outputColor + pattern); } else { // replace pattern.a *= v_color.a; if(outputColor.a <= 0.0) { pattern.a = 0.0; } outputColor = filterColor(pattern); } } else { outputColor = filterColor(outputColor); } // gl_FragColor = filterColor(gl_FragColor); } `,OG=`#define LineTypeSolid (0.0) #define LineTypeDash (1.0) #define Animate (0.0) #define LineTexture (1.0) layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance; layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array: [10.0, 5., 0, 0]; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float segmentNumber; float u_line_type: 0.0; float u_icon_step: 100; float u_line_texture: 0.0; float u_textureBlend; float u_time; float u_linearColor: 0; }; out vec4 v_dash_array; out vec4 v_color; out vec2 v_iconMapUV; out vec4 v_line_data; out float v_distance_ratio; #pragma include "projection" #pragma include "project" #pragma include "picking" float maps(float value, float start1, float stop1, float start2, float stop2) { return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1)); } float getSegmentRatio(float index) { return index / (segmentNumber - 1.0); } float paraboloid(vec2 source, vec2 target, float ratio) { vec2 x = mix(source, target, ratio); vec2 center = mix(source, target, 0.5); float dSourceCenter = distance(source, center); float dXCenter = distance(x, center); return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter); } vec3 getPos(vec2 source, vec2 target, float segmentRatio) { float vertex_height = paraboloid(source, target, segmentRatio); return vec3(mix(source, target, segmentRatio), sqrt(max(0.0, vertex_height))); } vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) { // normalized direction of the line vec2 dir_screenspace = normalize(line_clipspace); // rotate by 90 degrees dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0; return offset; } vec2 getNormal(vec2 line_clipspace, float offset_direction) { // normalized direction of the line vec2 dir_screenspace = normalize(line_clipspace); // rotate by 90 degrees dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); return dir_screenspace.xy * sign(offset_direction); } float getAngularDist(vec2 source, vec2 target) { vec2 delta = source - target; vec2 sin_half_delta = sin(delta / 2.0); float a = sin_half_delta.y * sin_half_delta.y + cos(source.y) * cos(target.y) * sin_half_delta.x * sin_half_delta.x; return 2.0 * atan(sqrt(a), sqrt(1.0 - a)); } vec2 midPoint(vec2 source, vec2 target) { vec2 center = target - source; float r = length(center); float theta = atan(center.y, center.x); float thetaOffset = 0.314; float r2 = r / 2.0 / cos(thetaOffset); float theta2 = theta + thetaOffset; vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y); return mid; } float bezier3(vec3 arr, float t) { float ut = 1.0 - t; return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t; } vec2 interpolate(vec2 source, vec2 target, float angularDist, float t) { if (abs(angularDist - PI) < 0.001) { return (1.0 - t) * source + t * target; } float a = sin((1.0 - t) * angularDist) / sin(angularDist); float b = sin(t * angularDist) / sin(angularDist); vec2 sin_source = sin(source); vec2 cos_source = cos(source); vec2 sin_target = sin(target); vec2 cos_target = cos(target); float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x; float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x; float z = a * sin_source.y + b * sin_target.y; return vec2(atan(y, x), atan(z, sqrt(x * x + y * y))); } void main() { v_color = a_Color; v_color.a = v_color.a * opacity; vec2 source = radians(a_Instance.rg); vec2 target = radians(a_Instance.ba); float angularDist = getAngularDist(source, target); float segmentIndex = a_Position.x; float segmentRatio = getSegmentRatio(segmentIndex); float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0)); if (u_line_type == LineTypeDash) { v_distance_ratio = segmentIndex / segmentNumber; float total_Distance = pixelDistance(source, target) / 2.0 * PI; total_Distance = total_Distance * 16.0; // total_Distance*16.0 调整默认的效果 v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance; } if (u_animate.x == Animate) { v_distance_ratio = segmentIndex / segmentNumber; } float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir); v_distance_ratio = segmentIndex / segmentNumber; vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0), a_Instance64Low.xy); vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0), a_Instance64Low.zw); // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y); vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y)); // vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0)); // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0)); v_line_data.g = a_Position.x; // 该顶点在弧线上的分段排序 if (LineTexture == u_line_texture) { float d_arcDistrance = length(source - target); d_arcDistrance = project_pixel(d_arcDistrance); float d_pixelLen = project_pixel(u_icon_step) / 8.0; v_line_data.b = floor(d_arcDistrance / d_pixelLen); // 贴图在弧线上重复的数量 float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离 float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离 v_line_data.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值 v_iconMapUV = a_iconMapUV; } gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0)); setPickingColor(a_PickingColor); } `,IG={solid:0,dash:1};class MG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],lineTexture:a=!1,iconStep:s=100,segmentNumber:u=30}=this.layer.getLayerConfig(),{animateOption:l}=this.layer.getLayerConfig();if(o.length===2&&o.push(0,0),this.rendererService.getDirty()){var f;(f=this.texture)===null||f===void 0||f.bind()}let c=0,h=[0,0,0,0],d=[0,0,0,0];t&&r&&(h=Zt(t),d=Zt(r),c=1);let p=this.layer.getLayerAnimateTime();isNaN(p)&&(p=0);const v={u_animate:this.animateOption2Array(l),u_dash_array:o,u_sourceColor:h,u_targetColor:d,u_textSize:[1024,this.iconService.canvasHeight||128],segmentNumber:u,u_line_type:IG[i]||0,u_icon_step:s,u_line_texture:a?1:0,u_textureBlend:n==="normal"?0:1,u_time:p,u_linearColor:c};return this.getUniformsBufferInfo(v)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){const{segmentNumber:r=30}=t.layer.getLayerConfig();return[yield t.layer.buildLayerModel({moduleName:"lineGreatCircle",vertexShader:OG,fragmentShader:CG,triangulation:r_,styleOption:{segmentNumber:r},defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const NG=`// #extension GL_OES_standard_derivatives : enable #define Animate 0.0 #define LineTexture 1.0 uniform sampler2D u_texture; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array; vec4 u_blur; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float u_icon_step: 100; float u_heightfixed: 0.0; float u_vertexScale: 1.0; float u_raisingHeight: 0.0; float u_strokeWidth: 0.0; float u_textureBlend; float u_line_texture; float u_linearDir: 1.0; float u_linearColor: 0; float u_time; }; in vec4 v_color; in vec4 v_stroke; // dash in vec4 v_dash_array; in float v_d_distance_ratio; in vec2 v_iconMapUV; in vec4 v_texture_data; out vec4 outputColor; #pragma include "picking" // [animate, duration, interval, trailLength], void main() { if(u_dash_array!=vec4(0.0)){ float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w); if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) { // 虚线部分 discard; }; } float animateSpeed = 0.0; // 运动速度 float d_distance_ratio = v_texture_data.r; // 当前点位距离占线总长的比例 if(u_linearDir < 1.0) { d_distance_ratio = v_texture_data.a; } if(u_linearColor == 1.0) { // 使用渐变颜色 outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio); outputColor.a *= v_color.a; } else { // 使用 color 方法传入的颜色 outputColor = v_color; } // anti-alias // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy)); if(u_animate.x == Animate) { animateSpeed = u_time / u_animate.y; float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed); alpha = (alpha + u_animate.w -1.0) / u_animate.w; alpha = smoothstep(0., 1., alpha); outputColor.a *= alpha; } if(u_line_texture == LineTexture) { // while load texture float aDistance = v_texture_data.g; // 当前顶点的距离 float d_texPixelLen = v_texture_data.b; // 贴图的像素长度,根据地图层级缩放 float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed); float v = v_texture_data.a; // 线图层贴图部分的 v 坐标值 // v = max(smoothstep(0.95, 1.0, v), v); vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec4 pattern = texture(SAMPLER_2D(u_texture), uv); if(u_textureBlend == 0.0) { // normal pattern.a = 0.0; outputColor += pattern; } else { // replace pattern.a *= v_color.a; if(outputColor.a <= 0.0) { pattern.a = 0.0; } outputColor = pattern; } } float v = v_texture_data.a; float strokeWidth = min(0.5, u_strokeWidth); // 绘制 border if(strokeWidth > 0.01) { float borderOuterWidth = strokeWidth / 2.0; if(v >= 1.0 - strokeWidth || v <= strokeWidth) { if(v > strokeWidth) { // 外侧 float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth); // float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth); outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear); } else if(v <= strokeWidth) { float linear = smoothstep(0.0, 1.0, v/strokeWidth); outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear); } } if(v < borderOuterWidth) { outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth); } else if(v > 1.0 - borderOuterWidth) { outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth); } } // blur float blurV = v_texture_data.a; if(blurV < 0.5) { outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5); } else { outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5); } outputColor = filterColor(outputColor); } `,PG=`#define Animate (0.0) layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size; layout(location = ATTRIBUTE_LOCATION_DISTANCE_INDEX) in vec3 a_DistanceAndIndexAndMiter; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec4 a_Normal_Total_Distance; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array; vec4 u_blur; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float u_icon_step: 100; float u_heightfixed: 0.0; float u_vertexScale: 1.0; float u_raisingHeight: 0.0; float u_strokeWidth: 0.0; float u_textureBlend; float u_line_texture; float u_linearDir: 1.0; float u_linearColor: 0; float u_time; }; out vec4 v_color; out vec4 v_stroke; //dash out vec4 v_dash_array; out float v_d_distance_ratio; // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向) out vec2 v_iconMapUV; out vec4 v_texture_data; #pragma include "projection" #pragma include "picking" void main() { vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy; float a_Miter = a_DistanceAndIndexAndMiter.z; vec3 a_Normal = a_Normal_Total_Distance.xyz; float a_Total_Distance = a_Normal_Total_Distance.w; //dash输出 v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance; v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance; // cal style mapping - 数据纹理映射部分的计算 float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放 v_iconMapUV = a_iconMapUV; d_texPixelLen = project_float_pixel(u_icon_step); v_color = a_Color; v_color.a *= opacity; v_stroke = stroke; vec3 size = a_Miter * setPickingSize(a_Size.x) * a_Normal; vec2 offset = project_pixel(size.xy); float lineDistance = a_DistanceAndIndex.x; float currentLinePointRatio = lineDistance / a_Total_Distance; float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和) float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2 float texV = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值 v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV); // 设置数据集的参数 vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low); // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0)); float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 vertex height float lineHeight = a_Size.y; // size 第二个参数代表的高度 [linewidth, lineheight] // 兼容 mapbox 在线高度上的效果表现基本一致 if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // mapbox // 保持高度相对不变 float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom); h *= mapboxZoomScale; h += u_raisingHeight * mapboxZoomScale; if (u_heightfixed > 0.0) { lineHeight *= mapboxZoomScale; } } gl_Position = project_common_position_to_clipspace( vec4(project_pos.xy + offset, lineHeight + h, 1.0) ); setPickingColor(a_PickingColor); } `;class BS extends Qt{constructor(...t){super(...t),E(this,"textureEventFlag",!1),E(this,"texture",this.createTexture2D({data:new Uint8Array([0,0,0,0]),width:1,height:1})),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.textures.length===0&&(this.textures=[this.texture]),this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128})})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,DISTANCE_INDEX:10,NORMAL:11,UV:12})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5,0,0],lineTexture:a=!1,iconStep:s=100,vertexHeightScale:u=20,strokeWidth:l=0,raisingHeight:f=0,heightfixed:c=!1,linearDir:h=kE.VERTICAL,blur:d=[1,1,1,0]}=this.layer.getLayerConfig();let p=o;if(i!=="dash"&&(p=[0,0,0,0]),p.length===2&&p.push(0,0),this.rendererService.getDirty()&&this.texture){var v;(v=this.texture)===null||v===void 0||v.bind()}const{animateOption:g}=this.layer.getLayerConfig();let y=0,S=[0,0,0,0],R=[0,0,0,0];t&&r&&(S=Zt(t),R=Zt(r),y=1);const x={u_animate:this.animateOption2Array(g),u_dash_array:p,u_blur:d,u_sourceColor:S,u_targetColor:R,u_textSize:[1024,this.iconService.canvasHeight||128],u_icon_step:s,u_heightfixed:Number(c),u_vertexScale:u,u_raisingHeight:Number(f),u_strokeWidth:l,u_textureBlend:n===WW.NORMAL?0:1,u_line_texture:a?1:0,u_linearDir:h===kE.VERTICAL?1:0,u_linearColor:y,u_time:this.layer.getLayerAnimateTime()||0};return this.getUniformsBufferInfo(x)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.textureEventFlag||(t.textureEventFlag=!0,t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture)),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){const{depth:r=!1}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return t.layer.triangulation=qd,[yield t.layer.buildLayerModel({moduleName:"line"+o,vertexShader:i,fragmentShader:n,triangulation:qd,defines:t.getDefines(),inject:t.getInject(),depth:{enable:r}})]})()}getShaders(){return{frag:NG,vert:PG,type:""}}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"distanceAndIndex",type:qe.Attribute,descriptor:{name:"a_DistanceAndIndexAndMiter",shaderLocation:this.attributeLocation.DISTANCE_INDEX,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o,a)=>a===void 0?[n[3],10,n[4]]:[n[3],a,n[4]]}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal_total_distance",type:qe.Attribute,descriptor:{name:"a_Normal_Total_Distance",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n,i,o)=>[...o,n[5]]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const LG=` layout(std140) uniform commonUniorm { vec4 u_sourceColor; vec4 u_targetColor; vec4 u_dash_array; float u_vertexScale: 1.0; float u_linearColor: 0; }; in float v_distanceScale; in vec4 v_color; //dash in vec4 v_dash_array; out vec4 outputColor; void main() { if(u_dash_array!=vec4(0.0)){ float dashLength = mod(v_distanceScale, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w); if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) { // 虚线部分 discard; }; } if(u_linearColor==1.0){ outputColor = mix(u_sourceColor, u_targetColor, v_distanceScale); outputColor.a *= v_color.a; // 全局透明度 } else{ outputColor = v_color; } } `,wG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in vec4 a_SizeDistanceAndTotalDistance; layout(std140) uniform commonUniorm { vec4 u_sourceColor; vec4 u_targetColor; vec4 u_dash_array; float u_vertexScale: 1.0; float u_linearColor: 0; }; #pragma include "projection" #pragma include "picking" out vec4 v_color; out float v_distanceScale; out vec4 v_dash_array; void main() { //dash输出 v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a; v_color = a_Color; v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a; v_color.a = v_color.a * opacity; vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low); float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 float lineHeight = a_SizeDistanceAndTotalDistance.y; // 兼容 mapbox 在线高度上的效果表现基本一致 if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // 保持高度相对不变 h *= 2.0 / pow(2.0, 20.0 - u_Zoom); } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0)); gl_PointSize = 10.0; } `;class FG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,lineType:n="solid",dashArray:i=[10,5,0,0],vertexHeightScale:o=20}=this.layer.getLayerConfig();let a=i;n!=="dash"&&(a=[0,0,0,0]),a.length===2&&a.push(0,0);let s=0,u=[0,0,0,0],l=[0,0,0,0];t&&r&&(u=Zt(t),l=Zt(r),s=1);const f={u_sourceColor:u,u_targetColor:l,u_dash_array:a,u_vertexScale:o,u_linearColor:s};return this.getUniformsBufferInfo(f)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}getShaders(){return{frag:LG,vert:wG,type:"lineSimpleNormal"}}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const{frag:r,vert:n,type:i}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,triangulation:qW,defines:t.getDefines(),inject:t.getInject(),primitive:m.LINES,depth:{enable:!1},pick:!1})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"sizeDistanceAndTotalDistance",type:qe.Attribute,descriptor:{name:"a_SizeDistanceAndTotalDistance",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>{const{size:i=1}=t,o=Array.isArray(i)?[i[0],i[1]]:[i,0];return[o[0],o[1],n[3],n[5]]}}})}}const BG=`#define Animate 0.0 #define LineTexture 1.0 // line texture uniform sampler2D u_texture; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float u_icon_step: 100; float u_heightfixed; float u_linearColor: 0; float u_line_texture; float u_textureBlend; float u_iconStepCount; float u_time; }; in vec2 v_iconMapUV; in vec4 v_color; in float v_blur; in vec4 v_dataset; out vec4 outputColor; #pragma include "picking" void main() { float animateSpeed = 0.0; // 运动速度 float d_distance_ratio = v_dataset.r; // 当前点位距离占线总长的比例 float v = v_dataset.a; if(u_linearColor == 1.0) { // 使用渐变颜色 outputColor = mix(u_sourceColor, u_targetColor, v); } else { // 使用 color 方法传入的颜色 outputColor = v_color; } outputColor.a *= v_color.a; // 全局透明度 if(u_animate.x == Animate) { animateSpeed = u_time / u_animate.y; float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed); alpha = (alpha + u_animate.w -1.0) / u_animate.w; alpha = smoothstep(0., 1., alpha); outputColor.a *= alpha; } if(u_line_texture == LineTexture) { // while load texture float aDistance = v_dataset.g; // 当前顶点的距离 float d_texPixelLen = v_dataset.b; // 贴图的像素长度,根据地图层级缩放 float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed); float v = v_dataset.a; // 线图层贴图部分的 v 坐标值 // 计算纹理间隔 start float flag = 0.0; if(u > 1.0/u_iconStepCount) { flag = 1.0; } u = fract(u*u_iconStepCount); // 计算纹理间隔 end vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.; vec4 pattern = texture(SAMPLER_2D(u_texture), uv); // Tip: 判断纹理间隔 if(flag > 0.0) { pattern = vec4(0.0); } if(u_textureBlend == 0.0) { // normal pattern.a = 0.0; outputColor = filterColor(outputColor + pattern); } else { // replace pattern.a *= v_color.a; if(outputColor.a <= 0.0) { pattern.a = 0.0; } outputColor = filterColor(pattern); } } // blur - AA if(v < v_blur) { outputColor.a = mix(0.0, outputColor.a, v/v_blur); } else if(v > 1.0 - v_blur) { outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - v_blur))/v_blur); } outputColor = filterColor(outputColor); } `,DG=`#define Animate 0.0 layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV; layout(location = ATTRIBUTE_LOCATION_DISTANCE_MITER_TOTAL) in vec3 a_Distance_Total_Miter; layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float u_icon_step: 100; float u_heightfixed; float u_linearColor: 0; float u_line_texture; float u_textureBlend; float u_iconStepCount; float u_time; }; // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向) out vec2 v_iconMapUV; out vec4 v_color; out float v_blur; out vec4 v_dataset; #pragma include "projection" #pragma include "light" #pragma include "picking" void main() { float a_Distance = a_Distance_Total_Miter.x; float a_Miter = a_Distance_Total_Miter.y; float a_Total_Distance = a_Distance_Total_Miter.z; float d_distance_ratio; // 当前点位距离占线总长的比例 float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放 v_iconMapUV = a_iconMapUV; if (u_heightfixed < 1.0) { // 高度随 zoom 调整 d_texPixelLen = project_pixel(u_icon_step); } else { d_texPixelLen = u_icon_step; } if (u_animate.x == Animate || u_linearColor == 1.0) { d_distance_ratio = a_Distance / a_Total_Distance; } float miter = (a_Miter + 1.0) / 2.0; // 设置数据集的参数 v_dataset[0] = d_distance_ratio; // 当前点位距离占线总长的比例 v_dataset[1] = a_Distance; // 当前顶点的距离 v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放 v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1 vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low); float originSize = a_Size.x; // 固定高度 if (u_heightfixed < 1.0) { originSize = project_float_meter(a_Size.x); // 高度随 zoom 调整 } float wallHeight = originSize * miter; float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0)); v_blur = min(project_float_pixel(2.0) / originSize, 0.05); v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity); // 兼容 mapbox 在线高度上的效果表现基本一致 if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { // mapbox // 保持高度相对不变 float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom); if (u_heightfixed > 0.0) { wallHeight *= mapboxZoomScale; } } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0)); setPickingColor(a_PickingColor); } `;class UG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:12,UV:13,DISTANCE_MITER_TOTAL:15})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",heightfixed:i=!1,lineTexture:o=!1,iconStep:a=100,iconStepCount:s=1}=this.layer.getLayerConfig(),{animateOption:u}=this.layer.getLayerConfig();if(this.rendererService.getDirty()){var l;(l=this.texture)===null||l===void 0||l.bind()}let f=0,c=[0,0,0,0],h=[0,0,0,0];t&&r&&(c=Zt(t),h=Zt(r),f=1);const d={u_animate:this.animateOption2Array(u),u_sourceColor:c,u_targetColor:h,u_textSize:[1024,this.iconService.canvasHeight||128],u_icon_step:a,u_heightfixed:Number(i),u_linearColor:f,u_line_texture:o?1:0,u_textureBlend:n==="normal"?0:1,u_iconStepCount:s,u_time:this.layer.getLayerAnimateTime()||0};return this.getUniformsBufferInfo(d)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){return[yield t.layer.buildLayerModel({moduleName:"lineWall",vertexShader:DG,fragmentShader:BG,triangulation:qd,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},blend:t.getBlend()})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"distanceAndTotalAndMiter",type:qe.Attribute,descriptor:{name:"a_Distance_Total_Miter",shaderLocation:this.attributeLocation.DISTANCE_MITER_TOTAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n)=>[n[3],n[4],n[5]]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const kG={arc:cG,arc3d:qE,greatcircle:MG,wall:UG,line:BS,simple:FG,flowline:RG,earthArc3d:qE};class DS extends Ka{constructor(...t){super(...t),E(this,"type","LineLayer"),E(this,"enableShaderEncodeStyles",["stroke","offsets","opacity","thetaOffset"]),E(this,"arrowInsertCount",0),E(this,"defaultSourceConfig",{data:[{lng1:100,lat1:30,lng2:130,lat2:30}],options:{parser:{type:"json",x:"lng1",y:"lat1",x1:"lng2",y1:"lat2"}}})}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new kG[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{line:{},linearline:{},simple:{},wall:{},arc3d:{blend:"additive"},arc:{blend:"additive"},greatcircle:{blend:"additive"},tileLine:{},earthArc3d:{},flowline:{},arrow:{}}[t]}getModelType(){var t;if(this.layerType)return this.layerType;const r=this.styleAttributeService.getLayerStyleAttribute("shape");return(r==null||(t=r.scale)===null||t===void 0?void 0:t.field)||"line"}processData(t){if(this.getModelType()!=="simple")return t;const r=[];return t.map(n=>{if(Array.isArray(n.coordinates)&&Array.isArray(n.coordinates[0])&&Array.isArray(n.coordinates[0][0])){const i=he({},n);n.coordinates.map(o=>{r.push(he(he({},i),{},{coordinates:o}))})}else r.push(n)}),r}}const $G=` layout(std140) uniform commonUniorm { vec4 u_stroke_color; float u_additive; float u_stroke_opacity; float u_stroke_width; }; in vec4 v_color; in float v_blur; in float v_innerRadius; out vec4 outputColor; #pragma include "picking" void main() { vec2 center = vec2(0.5); // Tip: 片元到中心点的距离 0 - 1 float fragmengTocenter = distance(center, gl_PointCoord) * 2.0; // Tip: 片元的剪切成圆形 float circleClipOpacity = 1.0 - smoothstep(v_blur, 1.0, fragmengTocenter); if(v_innerRadius < 0.99) { // 当存在 stroke 且 stroke > 0.01 float blurWidth = (1.0 - v_blur)/2.0; vec4 stroke = vec4(u_stroke_color.rgb, u_stroke_opacity); if(fragmengTocenter > v_innerRadius + blurWidth) { outputColor = stroke; } else if(fragmengTocenter > v_innerRadius - blurWidth){ float mixR = (fragmengTocenter - (v_innerRadius - blurWidth)) / (blurWidth * 2.0); outputColor = mix(v_color, stroke, mixR); } else { outputColor = v_color; } } else { // 当不存在 stroke 或 stroke <= 0.01 outputColor = v_color; } outputColor = filterColor(outputColor); if(u_additive > 0.0) { outputColor *= circleClipOpacity; } else { outputColor.a *= circleClipOpacity; } } `,zG=` layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(std140) uniform commonUniorm { vec4 u_stroke_color; float u_additive; float u_stroke_opacity; float u_stroke_width; }; out vec4 v_color; out float v_blur; out float v_innerRadius; #pragma include "projection" #pragma include "picking" #pragma include "project" void main() { v_color = vec4(a_Color.xyz, a_Color.w * opacity); v_blur = 1.0 - max(2.0 / a_Size, 0.05); v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0); vec2 offset = project_pixel(u_offsets); vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w)); gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio; setPickingColor(a_PickingColor); } `;function e1(e){const t=e.coordinates;return{vertices:[...t],indices:[0],size:t.length}}class VG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getDefaultStyle(){return{blend:"additive"}}getCommonUniformsInfo(){const{blend:t,strokeOpacity:r=1,strokeWidth:n=0,stroke:i="#fff"}=this.layer.getLayerConfig(),o={u_stroke_color:Zt(i),u_additive:t==="additive"?1:0,u_stroke_opacity:r,u_stroke_width:n};return this.getUniformsBufferInfo(o)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=e1,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointSimple",vertexShader:zG,fragmentShader:$G,defines:t.getDefines(),inject:t.getInject(),triangulation:e1,depth:{enable:!1},primitive:m.POINTS})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const HG=`precision highp float; in vec4 v_color; #pragma include "picking" layout(std140) uniform commonUniform { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor: 0; float u_heightfixed: 0.0; // 默认不固定 float u_globel; float u_r; float u_pickLight: 0.0; float u_opacitylinear: 0.0; float u_opacitylinear_dir: 1.0; float u_lightEnable: 1.0; }; in float v_lightWeight; in float v_barLinearZ; out vec4 outputColor; void main() { outputColor = v_color; // 开启透明度渐变 if(u_opacitylinear > 0.0) { outputColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ; } // picking if(u_pickLight > 0.0) { outputColor = filterColorAlpha(outputColor, v_lightWeight); } else { outputColor = filterColor(outputColor); } } `,jG=`precision highp float; #define pi 3.1415926535 #define ambientRatio 0.5 #define diffuseRatio 0.3 #define specularRatio 0.2 layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in vec3 a_Size; layout(location = ATTRIBUTE_LOCATION_POS) in vec3 a_Pos; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; layout(std140) uniform commonUniform { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor: 0; float u_heightfixed: 0.0; // 默认不固定 float u_globel; float u_r; float u_pickLight: 0.0; float u_opacitylinear: 0.0; float u_opacitylinear_dir: 1.0; float u_lightEnable: 1.0; }; out vec4 v_color; out float v_lightWeight; out float v_barLinearZ; // 用于将在顶点着色器中计算好的样式值传递给片元 #pragma include "projection" #pragma include "light" #pragma include "picking" float getYRadian(float x, float z) { if(x > 0.0 && z > 0.0) { return atan(x/z); } else if(x > 0.0 && z <= 0.0){ return atan(-z/x) + pi/2.0; } else if(x <= 0.0 && z <= 0.0) { return pi + atan(x/z); //atan(x/z) + } else { return atan(z/-x) + pi*3.0/2.0; } } float getXRadian(float y, float r) { return atan(y/r); } void main() { // cal style mapping - 数据纹理映射部分的计算 vec3 size = a_Size * a_Position; // a_Position.z 是在构建网格的时候传入的标准值 0 - 1,在插值器插值可以获取 0~1 线性渐变的值 v_barLinearZ = a_Position.z; vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移 if(u_heightfixed < 1.0) { // 圆柱体不固定高度 // } else {// 圆柱体固定高度 ( 处理 mapbox ) if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { offset *= 4.0/pow(2.0, 21.0 - u_Zoom); } } vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0)); // u_r 控制圆柱的生长 vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0); // 圆柱光照效果 float lightWeight = 1.0; if(u_lightEnable > 0.0) { // 取消三元表达式,增强健壮性 lightWeight = calc_lighting(pos); } v_lightWeight = lightWeight; // 设置圆柱的底色 if(u_linearColor == 1.0) { // 使用渐变颜色 v_color = mix(u_sourceColor, u_targetColor, v_barLinearZ); v_color.rgb *= lightWeight; } else { // 使用 color 方法传入的颜色 v_color = a_Color; } v_color.a *= u_opacity; // 在地球模式下,将原本垂直于 xy 平面的圆柱调整姿态到适应圆的角度 //旋转矩阵mx,创建绕x轴旋转矩阵 float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x); float xRadian = getXRadian(a_Pos.y, r); float xcos = cos(xRadian);//求解旋转角度余弦值 float xsin = sin(xRadian);//求解旋转角度正弦值 mat4 mx = mat4( 1,0,0,0, 0,xcos,-xsin,0, 0,xsin,xcos,0, 0,0,0,1); //旋转矩阵my,创建绕y轴旋转矩阵 float yRadian = getYRadian(a_Pos.x, a_Pos.z); float ycos = cos(yRadian);//求解旋转角度余弦值 float ysin = sin(yRadian);//求解旋转角度正弦值 mat4 my = mat4( ycos,0,-ysin,0, 0,1,0,0, ysin,0,ycos,0, 0,0,0,1); gl_Position = u_ViewProjectionMatrix * vec4(( my * mx * vec4(a_Position * a_Size, 1.0)).xyz + a_Pos, 1.0); setPickingColor(a_PickingColor); } `,{isNumber:XG}=Sr;let WG=class extends Qt{constructor(...t){super(...t),E(this,"raiseCount",0),E(this,"raiseRepeat",0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,POS:10,NORMAL:11})}getCommonUniformsInfo(){const{animateOption:t={enable:!1,speed:.01,repeat:!1},opacity:r=1,sourceColor:n,targetColor:i,pickLight:o=!1,heightfixed:a=!0,opacityLinear:s={enable:!1,dir:"up"},lightEnable:u=!0}=this.layer.getLayerConfig();let l=0,f=[0,0,0,0],c=[0,0,0,0];if(n&&i&&(f=Zt(n),c=Zt(i),l=1),this.raiseCount<1&&this.raiseRepeat>0&&t.enable){const{speed:p=.01}=t;this.raiseCount+=p,this.raiseCount>=1&&(this.raiseRepeat>1?(this.raiseCount=0,this.raiseRepeat--):this.raiseCount=1)}const h={u_sourceColor:f,u_targetColor:c,u_linearColor:l,u_pickLight:Number(o),u_heightfixed:Number(a),u_r:t.enable&&this.raiseRepeat>0?this.raiseCount:1,u_opacity:XG(r)?r:1,u_opacitylinear:Number(s.enable),u_opacitylinear_dir:s.dir==="up"?1:0,u_lightEnable:Number(u)};return this.getUniformsBufferInfo(h)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{animateOption:{repeat:r=1}}=t.layer.getLayerConfig();return t.raiseRepeat=r,[yield t.layer.buildLayerModel({moduleName:"pointEarthExtrude",vertexShader:jG,fragmentShader:HG,triangulation:wS,depth:{enable:!0},defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT},blend:t.getBlend()})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const{size:r}=t;if(r){let n=[];return Array.isArray(r)&&(n=r.length===2?[r[0],r[0],r[1]]:r),Array.isArray(r)||(n=[r,r,r]),n}else return[2,2,2]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"pos",type:qe.Attribute,descriptor:{name:"a_Pos",shaderLocation:this.attributeLocation.POS,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const r=Ao(t.coordinates);return PS([r[0],r[1]])}}})}};const GG=`in vec4 v_data; in vec4 v_color; in float v_radius; layout(std140) uniform commonUniform { float u_additive; float u_stroke_opacity : 1; float u_stroke_width : 2; float u_blur : 0.0; }; #pragma include "sdf_2d" #pragma include "picking" out vec4 outputColor; void main() { int shape = int(floor(v_data.w + 0.5)); vec4 strokeColor = u_stroke == vec4(0.0) ? v_color : u_stroke; lowp float antialiasblur = v_data.z; float r = v_radius / (v_radius + u_stroke_width); float outer_df; float inner_df; // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica' if (shape == 0) { outer_df = sdCircle(v_data.xy, 1.0); inner_df = sdCircle(v_data.xy, r); } else if (shape == 1) { outer_df = sdEquilateralTriangle(1.1 * v_data.xy); inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy); } else if (shape == 2) { outer_df = sdBox(v_data.xy, vec2(1.)); inner_df = sdBox(v_data.xy, vec2(r)); } else if (shape == 3) { outer_df = sdPentagon(v_data.xy, 0.8); inner_df = sdPentagon(v_data.xy, r * 0.8); } else if (shape == 4) { outer_df = sdHexagon(v_data.xy, 0.8); inner_df = sdHexagon(v_data.xy, r * 0.8); } else if (shape == 5) { outer_df = sdOctogon(v_data.xy, 1.0); inner_df = sdOctogon(v_data.xy, r); } else if (shape == 6) { outer_df = sdHexagram(v_data.xy, 0.52); inner_df = sdHexagram(v_data.xy, r * 0.52); } else if (shape == 7) { outer_df = sdRhombus(v_data.xy, vec2(1.0)); inner_df = sdRhombus(v_data.xy, vec2(r)); } else if (shape == 8) { outer_df = sdVesica(v_data.xy, 1.1, 0.8); inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8); } if(outer_df > antialiasblur + 0.018) discard; float opacity_t = smoothstep(0.0, antialiasblur, outer_df); float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep( antialiasblur, 0.0, inner_df ); if(u_stroke_width < 0.01) { outputColor = vec4(v_color.rgb, v_color.a * u_opacity); } else { outputColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t); } if(u_additive > 0.0) { outputColor *= opacity_t; outputColor = filterColorAlpha(outputColor, outputColor.a); } else { outputColor.a *= opacity_t; outputColor = filterColor(outputColor); } } `,YG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_SHAPE) in float a_Shape; layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude; layout(std140) uniform commonUniform { float u_additive; float u_stroke_opacity : 1; float u_stroke_width : 2; float u_blur : 0.0; }; out vec4 v_data; out vec4 v_color; out float v_radius; #pragma include "projection" #pragma include "picking" void main() { vec3 extrude = a_Extrude; float shape_type = a_Shape; /* * setPickingSize 设置拾取大小 */ float newSize = setPickingSize(a_Size); // float newSize = setPickingSize(a_Size) * 0.00001038445708445579; // unpack color(vec2) v_color = a_Color; // radius(16-bit) v_radius = newSize; // anti-alias // float antialiased_blur = -max(u_blur, antialiasblur); float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur); // TODP: /abs(extrude.x) 是为了兼容地球模式 v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type); gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + vec3(u_offsets,0.0), 1.0); setPickingColor(a_PickingColor); } `;let ZG=class extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,SHAPE:10,EXTRUDE:11})}getCommonUniformsInfo(){const{strokeOpacity:t=1,strokeWidth:r=0,blend:n,blur:i=0}=this.layer.getLayerConfig();this.layer.getLayerConfig();const o={u_additive:n==="additive"?1:0,u_stroke_opacity:t,u_stroke_width:r,u_blur:i};return this.getUniformsBufferInfo(o)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=YE,[yield t.layer.buildLayerModel({moduleName:"pointEarthFill",vertexShader:YG,fragmentShader:GG,triangulation:YE,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!0},blend:t.getBlend()})]})()}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const[o,a,s]=n,u=Wn(0,0,1),l=Wn(o,0,s),f=o>=0?cg(u,l):Math.PI*2-cg(u,l),c=Math.PI*2-Math.asin(a/100),h=Up();cA(h,h,f),kp(h,h,c);const d=Wn(1,1,0);Ml(d,d,h),qs(d,d);const p=Wn(-1,1,0);Ml(p,p,h),qs(p,p);const v=Wn(-1,-1,0);Ml(v,v,h),qs(v,v);const g=Wn(1,-1,0);Ml(g,g,h),qs(g,g);const y=[...d,...p,...v,...g],S=i%4*3;return[y[S],y[S+1],y[S+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"shape",type:qe.Attribute,descriptor:{name:"a_Shape",shaderLocation:this.attributeLocation.SHAPE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{shape:r=2}=t;return[this.layer.getLayerConfig().shape2d.indexOf(r)]}}})}};const qG=` in vec4 v_color; in float v_lightWeight; out vec4 outputColor; layout(std140) uniform commonUniforms { float u_pickLight; float u_heightfixed; float u_r; float u_linearColor; vec4 u_sourceColor; vec4 u_targetColor; float u_opacitylinear; float u_opacitylinear_dir; float u_lightEnable; }; #pragma include "scene_uniforms" #pragma include "picking" void main() { outputColor = v_color; // 开启透明度渐变 // picking if(u_pickLight > 0.0) { outputColor = filterColorAlpha(outputColor, v_lightWeight); } else { outputColor = filterColor(outputColor); } } `,KG=`#define pi (3.1415926535) layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in vec3 a_Size; layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec4 a_Extrude; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; layout(std140) uniform commonUniforms { float u_pickLight; float u_heightfixed; float u_r; float u_linearColor; vec4 u_sourceColor; vec4 u_targetColor; float u_opacitylinear; float u_opacitylinear_dir; float u_lightEnable; }; out vec4 v_color; out float v_lightWeight; #pragma include "projection" #pragma include "light" #pragma include "picking" float getYRadian(float x, float z) { if (x > 0.0 && z > 0.0) { return atan(x / z); } else if (x > 0.0 && z <= 0.0) { return atan(-z / x) + pi / 2.0; } else if (x <= 0.0 && z <= 0.0) { return pi + atan(x / z); //atan(x/z) + } else { return atan(z / -x) + pi * 3.0 / 2.0; } } float getXRadian(float y, float r) { return atan(y / r); } void main() { vec3 size = a_Size * a_Position; vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移 if (u_heightfixed < 1.0) { // 圆柱体不固定高度 } else { // 圆柱体固定高度 ( 处理 mapbox ) if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { offset *= 4.0 / pow(2.0, 21.0 - u_Zoom); } } vec2 positions = a_Extrude.xy; vec2 positions64Low = a_Extrude.zw; vec4 project_pos = project_position(vec4(positions, 0.0, 1.0), positions64Low); // u_r 控制圆柱的生长 vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0); // // 圆柱光照效果 float lightWeight = 1.0; if (u_lightEnable > 0.0) { // 取消三元表达式,增强健壮性 lightWeight = calc_lighting(pos); } v_lightWeight = lightWeight; v_color = a_Color; // 设置圆柱的底色 if (u_linearColor == 1.0) { // 使用渐变颜色 v_color = mix(u_sourceColor, u_targetColor, a_Position.z); v_color.a = v_color.a * opacity; } else { v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity); } if (u_opacitylinear > 0.0) { v_color.a *= u_opacitylinear_dir > 0.0 ? 1.0 - a_Position.z : a_Position.z; } gl_Position = project_common_position_to_clipspace(pos); setPickingColor(a_PickingColor); } `;let US=class extends Qt{constructor(...t){super(...t),E(this,"raiseCount",0),E(this,"raiseRepeat",0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10,NORMAL:11})}getCommonUniformsInfo(){const{animateOption:t={enable:!1,speed:.01,repeat:!1},sourceColor:r,targetColor:n,pickLight:i=!1,heightfixed:o=!1,opacityLinear:a={enable:!1,dir:"up"},lightEnable:s=!0}=this.layer.getLayerConfig();let u=0,l=[0,0,0,0],f=[0,0,0,0];if(r&&n&&(l=Zt(r),f=Zt(n),u=1),this.raiseCount<1&&this.raiseRepeat>0&&t.enable){const{speed:d=.01}=t;this.raiseCount+=d,this.raiseCount>=1&&(this.raiseRepeat>1?(this.raiseCount=0,this.raiseRepeat--):this.raiseCount=1)}const c={u_pickLight:Number(i),u_heightfixed:Number(o),u_r:t.enable&&this.raiseRepeat>0?this.raiseCount:1,u_linearColor:u,u_sourceColor:l,u_targetColor:f,u_opacitylinear:Number(a.enable),u_opacitylinear_dir:a.dir==="up"?1:0,u_lightEnable:Number(s)};return this.getUniformsBufferInfo(c)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{depth:r=!0,animateOption:{repeat:n=1}}=t.layer.getLayerConfig();return t.raiseRepeat=n,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointExtrude",vertexShader:KG,fragmentShader:qG,triangulation:wS,defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT},depth:{enable:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const{size:r}=t;if(r){let n=[];return Array.isArray(r)&&(n=r.length===2?[r[0],r[0],r[1]]:r),Array.isArray(r)||(n=[r,r,r]),n}else return[2,2,2]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:4,update:t=>{const r=Ao(t.coordinates);return[r[0],r[1],Ir(r[0]),Ir(r[1])]}}})}};const QG=` layout(std140) uniform commonUniforms { vec3 u_blur_height_fixed; float u_stroke_width; float u_additive; float u_stroke_opacity; float u_size_unit; float u_time; vec4 u_animate; }; in vec4 v_color; in vec4 v_stroke; in vec4 v_data; in float v_radius; #pragma include "scene_uniforms" #pragma include "sdf_2d" #pragma include "picking" out vec4 outputColor; void main() { int shape = int(floor(v_data.w + 0.5)); lowp float antialiasblur = v_data.z; float r = v_radius / (v_radius + u_stroke_width); float outer_df; float inner_df; // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica' if (shape == 0) { outer_df = sdCircle(v_data.xy, 1.0); inner_df = sdCircle(v_data.xy, r); } else if (shape == 1) { outer_df = sdEquilateralTriangle(1.1 * v_data.xy); inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy); } else if (shape == 2) { outer_df = sdBox(v_data.xy, vec2(1.)); inner_df = sdBox(v_data.xy, vec2(r)); } else if (shape == 3) { outer_df = sdPentagon(v_data.xy, 0.8); inner_df = sdPentagon(v_data.xy, r * 0.8); } else if (shape == 4) { outer_df = sdHexagon(v_data.xy, 0.8); inner_df = sdHexagon(v_data.xy, r * 0.8); } else if (shape == 5) { outer_df = sdOctogon(v_data.xy, 1.0); inner_df = sdOctogon(v_data.xy, r); } else if (shape == 6) { outer_df = sdHexagram(v_data.xy, 0.52); inner_df = sdHexagram(v_data.xy, r * 0.52); } else if (shape == 7) { outer_df = sdRhombus(v_data.xy, vec2(1.0)); inner_df = sdRhombus(v_data.xy, vec2(r)); } else if (shape == 8) { outer_df = sdVesica(v_data.xy, 1.1, 0.8); inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8); } float opacity_t = smoothstep(0.0, antialiasblur, outer_df); float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep( antialiasblur, 0.0, inner_df ); float PI = 3.14159; float N_RINGS = 3.0; float FREQ = 1.0; if(u_stroke_width < 0.01) { outputColor = v_color; } else { outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t); } float intensity = 1.0; if(u_time!=-1.0){ //wave相关逻辑 float d = length(v_data.xy); if(d > 0.5) { discard; } intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0); } if(u_additive > 0.0) { outputColor *= opacity_t; outputColor *= intensity;//wave outputColor = filterColorAlpha(outputColor, outputColor.a); } else { outputColor.a *= opacity_t; outputColor.a *= intensity;//wave outputColor = filterColor(outputColor); } // 作为 mask 模板时需要丢弃透明的像素 if(outputColor.a < 0.01) { discard; } } `,JG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_SHAPE) in float a_Shape; layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude; layout(std140) uniform commonUniforms { vec3 u_blur_height_fixed; float u_stroke_width; float u_additive; float u_stroke_opacity; float u_size_unit; float u_time; vec4 u_animate; }; out vec4 v_color; out vec4 v_stroke; out vec4 v_data; out float v_radius; #pragma include "projection" #pragma include "picking" #pragma include "rotation_2d" void main() { // 透明度计算 v_stroke = stroke; vec3 extrude = a_Extrude; float shape_type = a_Shape; /* * setPickingSize 设置拾取大小 * u_meter2coord 在等面积大小的时候设置单位 */ float newSize = setPickingSize(a_Size); // float newSize = setPickingSize(a_Size) * 0.00001038445708445579; // unpack color(vec2) v_color = vec4(a_Color.xyz, a_Color.w * opacity); if(u_size_unit == 1.0) { newSize = newSize * u_PixelsPerMeter.z; } v_radius = newSize; // anti-alias // float antialiased_blur = -max(u_blur, antialiasblur); float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x); vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets); offset = project_pixel(offset); offset = rotate_matrix(offset,rotation); // TODP: /abs(extrude.x) 是为了兼容地球模式 v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type); vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low); // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0)); float raisingHeight = u_blur_height_fixed.y; if(u_blur_height_fixed.z < 1.0) { // false raisingHeight = project_pixel(u_blur_height_fixed.y); } else { if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom); raisingHeight = u_blur_height_fixed.y * mapboxZoomScale; } } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0)); setPickingColor(a_PickingColor); } `;let kS=class extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,SHAPE:10,EXTRUDE:11})}getCommonUniformsInfo(){const{strokeOpacity:t=1,strokeWidth:r=0,blend:n,blur:i=0,raisingHeight:o=0,heightfixed:a=!1,unit:s="pixel"}=this.layer.getLayerConfig();let u=this.getAnimateUniforms().u_time;isNaN(u)&&(u=-1);const l={u_blur_height_fixed:[i,Number(o),Number(a)],u_stroke_width:r,u_additive:n==="additive"?1:0,u_stroke_opacity:t,u_size_unit:t_[s],u_time:u,u_animate:this.getAnimateUniforms().u_animate};return this.getUniformsBufferInfo(l)}getAnimateUniforms(){const{animateOption:t={enable:!1}}=this.layer.getLayerConfig();return{u_animate:this.animateOption2Array(t),u_time:this.layer.getLayerAnimateTime()}}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.layer.triangulation=To,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:To,depth:{enable:!1}})]})()}getShaders(){return{frag:QG,vert:JG,type:"pointFill"}}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){const t=this.layer.getLayerConfig().shape2d;this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(r,n,i,o)=>{const a=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],s=o%4*3;return[a[s],a[s+1],a[s+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:r=>{const{size:n=5}=r;return Array.isArray(n)?[n[0]]:[n]}}}),this.styleAttributeService.registerStyleAttribute({name:"shape",type:qe.Attribute,descriptor:{name:"a_Shape",shaderLocation:this.attributeLocation.SHAPE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:r=>{const{shape:n=2}=r;return[t.indexOf(n)]}}})}};const eY=`in vec2 v_uv;// 本身的 uv 坐标 in vec2 v_Iconuv; in float v_opacity; out vec4 outputColor; uniform sampler2D u_texture; layout(std140) uniform commonUniform { vec2 u_textSize; float u_heightfixed: 0.0; float u_raisingHeight: 0.0; float u_size_unit; }; #pragma include "scene_uniforms" #pragma include "sdf_2d" #pragma include "picking" void main() { vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.; outputColor = texture(SAMPLER_2D(u_texture), pos); outputColor.a *= v_opacity; outputColor = filterColor(outputColor); } `,tY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv; layout(std140) uniform commonUniform { vec2 u_textSize; float u_heightfixed; float u_raisingHeight; float u_size_unit; }; out vec2 v_uv; out vec2 v_Iconuv; out float v_opacity; #pragma include "projection" #pragma include "picking" #pragma include "rotation_2d" void main() { vec3 extrude = a_Extrude; v_uv = (a_Extrude.xy + 1.0) / 2.0; v_uv.y = 1.0 - v_uv.y; v_Iconuv = a_Uv; v_opacity = opacity; float newSize = a_Size; if (u_size_unit == 1.0) { newSize = newSize * u_PixelsPerMeter.z; } // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets); vec2 offset = extrude.xy * newSize + offsets; offset = rotate_matrix(offset, rotation); offset = project_pixel(offset); vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0)); setPickingColor(a_PickingColor); } `;class rY extends Qt{constructor(...t){super(...t),E(this,"meter2coord",1),E(this,"texture",void 0),E(this,"isMeter",!1),E(this,"radian",0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas(),mag:"linear",min:"linear mipmap nearest",mipmap:!0}),this.layerService.throttleRenderLayers();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.LINEAR,min:m.LINEAR_MIPMAP_LINEAR,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128,mipmap:!0}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10,UV:11})}getCommonUniformsInfo(){const{raisingHeight:t=0,heightfixed:r=!1,unit:n="pixel"}=this.layer.getLayerConfig();if(this.rendererService.getDirty()){var i;(i=this.texture)===null||i===void 0||i.bind()}const o={u_textSize:[1024,this.iconService.canvasHeight||128],u_heightfixed:Number(r),u_raisingHeight:Number(t),u_size_unit:t_[n]};return this.getUniformsBufferInfo(o)}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.iconService.on("imageUpdate",t.updateTexture),t.updateTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointFillImage",vertexShader:tY,fragmentShader:eY,triangulation:To,depth:{enable:!1},defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT}})]})()}clearModels(){var t;this.iconService.off("imageUpdate",this.updateTexture),(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{shape:n}=t,{x:i,y:o}=r[n]||{x:-64,y:-64};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const o=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],a=i%4*3;return[o[a],o[a+1],o[a+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const nY=`layout(std140) uniform commonUniforms { vec2 u_textSize; float u_raisingHeight; float u_heightfixed; }; uniform sampler2D u_texture; in vec4 v_color; in vec2 v_uv; in float v_opacity; #pragma include "picking" out vec4 outputColor; void main(){ vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.; vec4 textureColor; // Y = 0.299R + 0.587G + 0.114B // 亮度提取 textureColor = texture(SAMPLER_2D(u_texture), pos); // Tip: 去除边缘部分 mipmap 导致的混合变暗 float fragmengTocenter = distance(vec2(0.5), gl_PointCoord); if(fragmengTocenter >= 0.5) { float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b; textureColor.a *= luma; } if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){ outputColor= textureColor; }else { outputColor= step(0.01, textureColor.z) * v_color; } outputColor.a *= v_opacity; if (outputColor.a < 0.01) { discard; } outputColor = filterColor(outputColor); } `,iY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv; layout(std140) uniform commonUniforms { vec2 u_textSize; float u_raisingHeight; float u_heightfixed; }; out vec4 v_color; out vec2 v_uv; out float v_opacity; #pragma include "projection" #pragma include "picking" void main() { // cal style mapping - 数据纹理映射部分的计算 v_color = a_Color; v_opacity = opacity; v_uv = a_Uv; vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); vec2 offset = project_pixel(offsets); float raisingHeight = u_raisingHeight; if (u_heightfixed < 1.0) { // false raisingHeight = project_pixel(u_raisingHeight); } else { if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom); raisingHeight = u_raisingHeight * mapboxZoomScale; } } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0)); gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio; setPickingColor(a_PickingColor); } `;class $S extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas(),mag:"linear",min:"linear mipmap nearest",mipmap:!0}),setTimeout(()=>{this.layerService.throttleRenderLayers()});return}this.texture=r({data:this.iconService.getCanvas(),mag:m.LINEAR,min:m.LINEAR_MIPMAP_LINEAR,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128,mipmap:!0})})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,UV:10})}getUninforms(){if(this.rendererService.getDirty()){var t;(t=this.texture)===null||t===void 0||t.bind()}const r=this.getCommonUniformsInfo(),n=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},r.uniformsOption),n.uniformsOption)}getCommonUniformsInfo(){const{raisingHeight:t=0,heightfixed:r=!1}=this.layer.getLayerConfig(),n={u_textSize:[1024,this.iconService.canvasHeight||128],u_raisingHeight:Number(t),u_heightfixed:Number(r),u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.iconService.on("imageUpdate",t.updateTexture),t.updateTexture(),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointImage",vertexShader:iY,fragmentShader:nY,triangulation:ZW,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},primitive:m.POINTS})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{shape:n}=t,{x:i,y:o}=r[n]||{x:-64,y:-64};return[i,o]}}})}}const oY=`in vec4 v_color; out vec4 outputColor; void main() { outputColor = v_color; }`,aY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(std140) uniform u_Common { float u_size_scale; }; out vec4 v_color; #pragma include "projection" #pragma include "project" void main() { v_color = vec4(a_Color.xyz, a_Color.w * opacity); vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); gl_Position = project_common_position_to_clipspace(project_pos); gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio; } `;function t1(e){const t=e.coordinates;return{vertices:[...t],indices:[0],size:t.length}}class zS extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getDefaultStyle(){return{blend:"additive"}}getCommonUniformsInfo(){const t={u_size_scale:.5};return this.getUniformsBufferInfo(t)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=t1,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointNormal",vertexShader:aY,fragmentShader:oY,triangulation:t1,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},primitive:m.POINTS,pick:!1})]})()}clearModels(){}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const sY=` layout(std140) uniform commonUniorm{ float u_additive; float u_size_unit; float u_speed: 1.0; float u_time; }; in vec4 v_data; in vec4 v_color; in float v_radius; in vec2 v_extrude; #pragma include "sdf_2d" #pragma include "picking" out vec4 outputColor; void main() { lowp float antialiasblur = v_data.z; float r = v_radius / (v_radius); float outer_df = sdCircle(v_data.xy, 1.0); float inner_df = sdCircle(v_data.xy, r); float opacity_t = smoothstep(0.0, antialiasblur, outer_df); outputColor = vec4(v_color.rgb, v_color.a); if(u_additive > 0.0) { outputColor *= opacity_t; } else { outputColor.a *= opacity_t; } if(outputColor.a > 0.0) { outputColor = filterColor(outputColor); } vec2 extrude = v_extrude; vec2 dir = normalize(extrude); vec2 baseDir = vec2(1.0, 0.0); float pi = 3.14159265359; float flag = sign(dir.y); float rades = dot(dir, baseDir); float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi; // simple AA if(radar_v > 0.99) { radar_v = 1.0 - (radar_v - 0.99)/0.01; } outputColor.a *= radar_v; } `,uY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude; layout(std140) uniform commonUniorm { float u_additive; float u_size_unit; float u_speed: 1.0; float u_time; }; out vec4 v_data; out vec4 v_color; out float v_radius; out vec2 v_extrude; #pragma include "projection" #pragma include "picking" void main() { float newSize = setPickingSize(a_Size); float time = u_time * u_speed; mat2 rotateMatrix = mat2( cos(time), sin(time), -sin(time), cos(time) ); v_extrude = rotateMatrix * a_Extrude.xy; v_color = a_Color; v_color.a *= opacity; float blur = 0.0; float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur); if(u_size_unit == 1.) { newSize = newSize * u_PixelsPerMeter.z; } v_radius = newSize; vec2 offset = (a_Extrude.xy * (newSize)); offset = project_pixel(offset); v_data = vec4(a_Extrude.x, a_Extrude.y, antialiasblur, -1.0); vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0)); setPickingColor(a_PickingColor); } `;class lY extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10})}getCommonUniformsInfo(){const{blend:t,speed:r=1,unit:n="pixel"}=this.layer.getLayerConfig(),i={u_additive:t==="additive"?1:0,u_size_unit:t_[n],u_speed:r,u_time:this.layer.getLayerAnimateTime()};return this.getUniformsBufferInfo(i)}getAnimateUniforms(){return{}}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointRadar",vertexShader:uY,fragmentShader:sY,triangulation:To,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}})]})()}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const o=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],a=i%4*3;return[o[a],o[a+1],o[a+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.SIZE,name:"a_Size",buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}class cY{constructor(t,r,n){E(this,"boxCells",[]),E(this,"xCellCount",void 0),E(this,"yCellCount",void 0),E(this,"boxKeys",void 0),E(this,"bboxes",void 0),E(this,"width",void 0),E(this,"height",void 0),E(this,"xScale",void 0),E(this,"yScale",void 0),E(this,"boxUid",void 0);const i=this.boxCells;this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(r/n);for(let o=0;othis.width||i<0||r>this.height)return o?!1:[];const s=[];if(t<=0&&r<=0&&this.width<=n&&this.height<=i){if(o)return!0;for(let l=0;l0:s}queryCell(t,r,n,i,o,a,s,u){const l=s.seenUids,f=this.boxCells[o];if(f!==null){const c=this.bboxes;for(const h of f)if(!l.box[h]){l.box[h]=!0;const d=h*4;if(t<=c[d+2]&&r<=c[d+3]&&n>=c[d+0]&&i>=c[d+1]&&(!u||u(this.boxKeys[h]))){if(s.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[h],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}return!1}forEachCell(t,r,n,i,o,a,s,u){const l=this.convertToXCellCoord(t),f=this.convertToYCellCoord(r),c=this.convertToXCellCoord(n),h=this.convertToYCellCoord(i);for(let d=l;d<=c;d++)for(let p=f;p<=h;p++){const v=this.xCellCount*p+d;if(o.call(this,t,r,n,i,v,a,s,u))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)))}}class fY{constructor(t,r){E(this,"width",void 0),E(this,"height",void 0),E(this,"grid",void 0),E(this,"viewportPadding",100),E(this,"screenRightBoundary",void 0),E(this,"screenBottomBoundary",void 0),E(this,"gridRightBoundary",void 0),E(this,"gridBottomBoundary",void 0),this.width=t,this.height=r,this.viewportPadding=Math.max(t,r),this.grid=new cY(t+this.viewportPadding,r+this.viewportPadding,25),this.screenRightBoundary=t+this.viewportPadding,this.screenBottomBoundary=r+this.viewportPadding,this.gridRightBoundary=t+2*this.viewportPadding,this.gridBottomBoundary=r+2*this.viewportPadding}placeCollisionBox(t){const r=t.x1+t.anchorPointX+this.viewportPadding,n=t.y1+t.anchorPointY+this.viewportPadding,i=t.x2+t.anchorPointX+this.viewportPadding,o=t.y2+t.anchorPointY+this.viewportPadding;return!this.isInsideGrid(r,n,i,o)||this.grid.hitTest(r,n,i,o)?{box:[]}:{box:[r,n,i,o]}}insertCollisionBox(t,r){const n={featureIndex:r};this.grid.insert(n,t[0],t[1],t[2],t[3])}project(t,r,n){const i=N9(r,n,0,1),o=hA(),a=x9(...t);return $p(o,i,a),{x:(o[0]/o[3]+1)/2*this.width+this.viewportPadding,y:(-o[1]/o[3]+1)/2*this.height+this.viewportPadding}}isInsideGrid(t,r,n,i){return n>=0&&t=0&&r{if(y.split("").forEach(S=>{const R=t[S];R&&(c.push({glyph:S,x:u,y:l+0,vertical:!1,scale:1,metrics:R}),u+=R.advance+a)}),c.length!==d){const S=u-a;f=Math.max(S,f),c.length-1}u=0,l-=n+5});const{horizontalAlign:p,verticalAlign:v}=VS(i);HS(c,h,p,v,f,n,r.length);const g=l- -8;e.top+=-v*g,e.bottom=e.top-g,e.left+=-p*f,e.right=e.left+f}function dY(e,t,r,n,i,o,a){let u=0,l=-8,f=0;const c=e.positionedGlyphs,h=0,d=c.length;r.forEach(y=>{const S=t[y];if(S&&(c.push({glyph:y,x:S.advance/2,y:l+0,vertical:!1,scale:1,metrics:S}),u+=S.advance+a),c.length!==d){const x=u-a;f=Math.max(x,f),c.length-1}u=0,l-=n+5});const{horizontalAlign:p,verticalAlign:v}=VS(i);HS(c,h,p,v,f,n,r.length);const g=l- -8;e.top+=-v*g,e.bottom=e.top-g,e.left+=-p*f,e.right=e.left+f}function pY(e,t,r,n,i,o,a=[0,0],s){const u=e.split(` `),l=[],f={positionedGlyphs:l,top:a[1],bottom:a[1],left:a[0],right:a[0],lineCount:u.length,text:e};return s?dY(f,t,u,r,n,i,o):hY(f,t,u,r,n,i,o),l.length?f:!1}function _Y(e,t=[0,0],r){const{positionedGlyphs:n=[]}=e,i=[];for(const o of n){const a=o.metrics,s=4,u=a.advance*o.scale/2,l=[0,0],f=[o.x+u+t[0],o.y+t[1]],c=(0-s)*o.scale-u+f[0],h=(0-s)*o.scale+f[1],d=c+a.width*o.scale,p=h+a.height*o.scale,v={x:c,y:h},g={x:d,y:h},y={x:c,y:p},S={x:d,y:p};i.push({tl:v,tr:g,bl:y,br:S,tex:a,glyphOffset:l})}return i}const r1=`#define SDF_PX 8.0 #define EDGE_GAMMA 0.105 #define FONT_SIZE 48.0 uniform sampler2D u_sdf_map; layout(std140) uniform commonUniforms { vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0]; vec2 u_sdf_map_size; float u_raisingHeight: 0.0; float u_stroke_width : 2; float u_gamma_scale : 0.5; float u_halo_blur : 0.5; }; in vec2 v_uv; in float v_gamma_scale; in vec4 v_color; in vec4 v_stroke_color; in float v_fontScale; out vec4 outputColor; #pragma include "picking" void main() { // get style data mapping // get sdf from atlas float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a; lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX; highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0; highp float gamma_scaled = gamma * v_gamma_scale; highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist); outputColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist)); outputColor.a *= alpha; // 作为 mask 模板时需要丢弃透明的像素 if (outputColor.a < 0.01) { discard; } outputColor = filterColor(outputColor); } `,n1=`#define SDF_PX 8.0 #define EDGE_GAMMA 0.105 #define FONT_SIZE 24.0 layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_TEXT_OFFSETS) in vec2 a_textOffsets; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex; layout(std140) uniform commonUniforms { vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0]; vec2 u_sdf_map_size; float u_raisingHeight: 0.0; float u_stroke_width : 2; float u_gamma_scale : 0.5; float u_halo_blur : 0.5; }; out vec2 v_uv; out float v_gamma_scale; out vec4 v_color; out vec4 v_stroke_color; out float v_fontScale; #pragma include "projection" #pragma include "picking" #pragma include "rotation_2d" void main() { // cal style mapping - 数据纹理映射部分的计算 v_uv = a_tex / u_sdf_map_size; v_color = vec4(a_Color.xyz, a_Color.w * opacity); v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity); // 文本缩放比例 float fontScale = a_Size / FONT_SIZE; v_fontScale = fontScale; vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); vec2 offset = rotate_matrix(a_textOffsets,rotation); // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0); float raiseHeight = u_raisingHeight; if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom); raiseHeight = u_raisingHeight * mapboxZoomScale; } vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0)); gl_Position = vec4( projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0); v_gamma_scale = gl_Position.w; setPickingColor(a_PickingColor); } `,{isEqual:Us}=Sr;function i1(e){const t=this,r=e.id,n=[],i=[];if(!t.glyphInfoMap||!t.glyphInfoMap[r])return{vertices:[],indices:[],size:7};const o=t.glyphInfoMap[r].centroid,a=o.length===2?[o[0],o[1],0]:o;return t.glyphInfoMap[r].glyphQuads.forEach((s,u)=>{n.push(...a,s.tex.x,s.tex.y+s.tex.height,s.tl.x,s.tl.y,...a,s.tex.x+s.tex.width,s.tex.y+s.tex.height,s.tr.x,s.tr.y,...a,s.tex.x+s.tex.width,s.tex.y,s.br.x,s.br.y,...a,s.tex.x,s.tex.y,s.bl.x,s.bl.y),i.push(0+u*4,1+u*4,2+u*4,2+u*4,3+u*4,0+u*4)}),{vertices:n,indices:i,size:7}}class jS extends Qt{constructor(...t){var r;super(...t),r=this,E(this,"glyphInfo",void 0),E(this,"glyphInfoMap",{}),E(this,"rawEncodeData",void 0),E(this,"texture",void 0),E(this,"currentZoom",-1),E(this,"extent",void 0),E(this,"textureHeight",0),E(this,"textCount",0),E(this,"preTextStyle",{}),E(this,"mapping",ve(function*(){r.initGlyph(),r.updateTexture(),yield r.reBuildModel()}))}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,TEXT_OFFSETS:10,UV:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he(he({},t.uniformsOption),r.uniformsOption),{u_sdf_map:this.textures[0]})}getCommonUniformsInfo(){const{stroke:t="#fff",strokeWidth:r=0,halo:n=.5,gamma:i=2,raisingHeight:o=0}=this.layer.getLayerConfig(),a=this.getFontServiceMapping(),s=this.getFontServiceCanvas();a&&Object.keys(a).length!==this.textCount&&s&&(this.updateTexture(),this.textCount=Object.keys(a).length),this.preTextStyle=this.getTextStyle();const u={u_stroke_color:Zt(t),u_sdf_map_size:[(s==null?void 0:s.width)||1,(s==null?void 0:s.height)||1],u_raisingHeight:Number(o),u_stroke_width:r,u_gamma_scale:i,u_halo_blur:n};return this.getUniformsBufferInfo(u)}initModels(){var t=this;return ve(function*(){return t.bindEvent(),t.extent=t.textExtent(),t.rawEncodeData=t.layer.getEncodedData(),t.preTextStyle=t.getTextStyle(),t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{textAllowOverlap:r=!1}=t.layer.getLayerConfig();return t.initGlyph(),t.updateTexture(),r||t.filterGlyphs(),[yield t.layer.buildLayerModel({moduleName:"pointText",vertexShader:n1,fragmentShader:r1,defines:t.getDefines(),inject:t.getInject(),triangulation:i1.bind(t),depth:{enable:!1}})]})()}needUpdate(){var t=this;return ve(function*(){const{textAllowOverlap:r=!1,textAnchor:n="center",textOffset:i,padding:o,fontFamily:a,fontWeight:s}=t.getTextStyle();if(!Us(o,t.preTextStyle.padding)||!Us(i,t.preTextStyle.textOffset)||!Us(n,t.preTextStyle.textAnchor)||!Us(a,t.preTextStyle.fontFamily)||!Us(s,t.preTextStyle.fontWeight))return yield t.mapping(),!0;if(r)return!1;const u=t.mapService.getZoom(),l=t.mapService.getBounds(),f=kT(t.extent,l);return Math.abs(t.currentZoom-u)>.5||!f||r!==t.preTextStyle.textAllowOverlap?(yield t.reBuildModel(),!0):!1})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.layer.off("remapping",this.mapping)}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"textOffsets",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.TEXT_OFFSETS,name:"a_textOffsets",buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"textUv",type:qe.Attribute,descriptor:{name:"a_tex",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=12}=t;return Array.isArray(r)?[r[0]]:[r]}}})}bindEvent(){this.layer.isTileLayer||this.layer.on("remapping",this.mapping)}textExtent(){const t=this.mapService.getBounds();return Lp(t,.5)}initTextFont(){const{fontWeight:t,fontFamily:r}=this.getTextStyle(),n=this.rawEncodeData,i=[];n.forEach(o=>{let{shape:a=""}=o;a=a.toString();for(const s of a)i.indexOf(s)===-1&&i.push(s)}),this.fontService.setFontOptions({characterSet:i,fontWeight:t,fontFamily:r,iconfont:!1})}initIconFontTex(){const{fontWeight:t,fontFamily:r}=this.getTextStyle(),n=this.rawEncodeData,i=[];n.forEach(o=>{let{shape:a=""}=o;a=`${a}`,i.indexOf(a)===-1&&i.push(a)}),this.fontService.setFontOptions({characterSet:i,fontWeight:t,fontFamily:r,iconfont:!0})}getTextStyle(){const{fontWeight:t="400",fontFamily:r="sans-serif",textAllowOverlap:n=!1,padding:i=[0,0],textAnchor:o="center",textOffset:a=[0,0],opacity:s=1,strokeOpacity:u=1,strokeWidth:l=0,stroke:f="#000"}=this.layer.getLayerConfig();return{fontWeight:t,fontFamily:r,textAllowOverlap:n,padding:i,textAnchor:o,textOffset:a,opacity:s,strokeOpacity:u,strokeWidth:l,stroke:f}}generateGlyphLayout(t){const r=this.getFontServiceMapping(),{spacing:n=2,textAnchor:i="center",textOffset:o}=this.layer.getLayerConfig(),a=this.rawEncodeData;this.glyphInfo=a.map(s=>{const{shape:u="",id:l,size:f=1}=s,c=s.textOffset?s.textOffset:o||[0,0],h=s.textAnchor?s.textAnchor:i||"center",d=pY(u.toString(),r,f,h,"left",n,c,t),p=_Y(d,c);return s.shaping=d,s.glyphQuads=p,s.centroid=Ao(s.coordinates),this.glyphInfoMap[l]={shaping:d,glyphQuads:p,centroid:Ao(s.coordinates)},s})}getFontServiceMapping(){const{fontWeight:t="400",fontFamily:r="sans-serif"}=this.layer.getLayerConfig();return this.fontService.getMappingByKey(`${r}_${t}`)}getFontServiceCanvas(){const{fontWeight:t="400",fontFamily:r="sans-serif"}=this.layer.getLayerConfig();return this.fontService.getCanvasByKey(`${r}_${t}`)}filterGlyphs(){const{padding:t=[0,0],textAllowOverlap:r=!1}=this.layer.getLayerConfig();if(r)return;this.glyphInfoMap={},this.currentZoom=this.mapService.getZoom(),this.extent=this.textExtent();const{width:n,height:i}=this.rendererService.getViewportSize(),o=new fY(n,i);this.glyphInfo.filter(s=>{const{shaping:u,id:l=0}=s,f=s.centroid,h=s.size/16,d=this.mapService.lngLatToContainer(f),{box:p}=o.placeCollisionBox({x1:u.left*h-t[0],x2:u.right*h+t[0],y1:u.top*h-t[1],y2:u.bottom*h+t[1],anchorPointX:d.x,anchorPointY:d.y});return p&&p.length?(o.insertCollisionBox(p,l),!0):!1}).forEach(s=>{this.glyphInfoMap[s.id]=s})}initGlyph(){const{iconfont:t=!1}=this.layer.getLayerConfig();t?this.initIconFontTex():this.initTextFont(),this.generateGlyphLayout(t)}updateTexture(){const{createTexture2D:t}=this.rendererService,r=this.getFontServiceCanvas();this.textureHeight=r.height,this.texture&&this.texture.destroy(),this.texture=t({data:r,mag:m.LINEAR,min:m.LINEAR,width:r.width,height:r.height}),this.textures=[this.texture]}reBuildModel(){var t=this;return ve(function*(){t.filterGlyphs();const r=yield t.layer.buildLayerModel({moduleName:"pointText",vertexShader:n1,fragmentShader:r1,triangulation:i1.bind(t),defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}});t.layer.models=[r]})()}}const vY={fillImage:rY,fill:kS,radar:lY,image:$S,normal:zS,simplePoint:VG,extrude:US,text:jS,earthFill:ZG,earthExtrude:WG};class Kd extends Ka{constructor(...t){super(...t),E(this,"type","PointLayer"),E(this,"enableShaderEncodeStyles",["stroke","offsets","opacity","rotation"]),E(this,"enableDataEncodeStyles",["textOffset","textAnchor"]),E(this,"defaultSourceConfig",{data:[],options:{parser:{type:"json",x:"lng",y:"lat"}}})}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel&&t.layerModel.clearModels(),t.layerModel=new vY[r](t),yield t.initLayerModels()})()}rebuildModels(){var t=this;return ve(function*(){yield t.buildModels()})()}getModelTypeWillEmptyData(){if(this.shapeOption){const{field:t,values:r}=this.shapeOption,{shape2d:n}=this.getLayerConfig(),i=this.iconService.getIconMap();if(t&&(n==null?void 0:n.indexOf(t))!==-1)return"fill";if(r==="text")return"text";if(r&&r instanceof Array){for(const o of r)if(typeof o=="string"&&i.hasOwnProperty(o))return"image"}}return"normal"}getDefaultConfig(){const t=this.getModelType();return{fillImage:{},normal:{blend:"additive"},radar:{},simplePoint:{},fill:{blend:"normal"},extrude:{},image:{},text:{blend:"normal"},tile:{},tileText:{},earthFill:{},earthExtrude:{}}[t]}getModelType(){const t=this.getEncodedData(),{shape2d:r,shape3d:n,billboard:i=!0}=this.getLayerConfig(),o=this.iconService.getIconMap(),a=t.find(s=>s.hasOwnProperty("shape"));if(a){const s=a.shape;return s==="dot"?"normal":s==="simple"?"simplePoint":s==="radar"?"radar":this.layerType==="fillImage"||i===!1?"fillImage":(r==null?void 0:r.indexOf(s))!==-1?this.mapService.version==="GLOBEL"?"earthFill":"fill":(n==null?void 0:n.indexOf(s))!==-1?this.mapService.version==="GLOBEL"?"earthExtrude":"extrude":o.hasOwnProperty(s)?"image":"text"}else return this.getModelTypeWillEmptyData()}}function mY(e){return Qd.apply(this,arguments)}function Qd(){return Qd=ve(function*(e){if(window.createImageBitmap){const t=yield fetch(e);return yield createImageBitmap(yield t.blob())}else{const t=new window.Image;return new Promise(r=>{t.onload=()=>r(t),t.src=e,t.crossOrigin="Anonymous"})}}),Qd.apply(this,arguments)}const gY=`layout(std140) uniform commonUniforms { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor; float u_topsurface; float u_sidesurface; float u_heightfixed; // 默认不固定 float u_raisingHeight; }; in vec4 v_Color; #pragma include "scene_uniforms" #pragma include "picking" out vec4 outputColor; void main() { // top face if(u_topsurface < 1.0) { discard; } outputColor = v_Color; outputColor = filterColor(outputColor); } `,EY=` layout(std140) uniform commonUniforms { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor; float u_topsurface; float u_sidesurface; float u_heightfixed; // 默认不固定 float u_raisingHeight; }; in vec4 v_Color; in vec3 v_uvs; in vec2 v_texture_data; out vec4 outputColor; #pragma include "scene_uniforms" #pragma include "picking" void main() { float isSide = v_texture_data.x; float sidey = v_uvs[2]; float lightWeight = v_texture_data.y; // Tip: 部分机型 GPU 计算精度兼容 if(isSide < 0.999) { // side face if(u_sidesurface < 1.0) { discard; } if( u_linearColor == 1.0) { // side use linear vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey); linearColor.rgb *= lightWeight; outputColor = linearColor; } else { // side notuse linear outputColor = v_Color; } } else { // top face if(u_topsurface < 1.0) { discard; } outputColor = v_Color; } outputColor = filterColorAlpha(outputColor, lightWeight); } `,yY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs; layout(std140) uniform commonUniforms { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor; float u_topsurface; float u_sidesurface; float u_heightfixed; // 默认不固定 float u_raisingHeight; }; out vec4 v_Color; out vec3 v_uvs; out vec2 v_texture_data; #pragma include "projection" #pragma include "light" #pragma include "picking" void main() { v_uvs = a_uvs; // cal style mapping - 数据纹理映射部分的计算 vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0); vec4 project_pos = project_position(pos, a_Position64Low); if (u_heightfixed > 0.0) { // 判断几何体是否固定高度 project_pos.z = a_Position.z * a_Size; project_pos.z += u_raisingHeight; if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom); project_pos.z *= mapboxZoomScale; project_pos.z += u_raisingHeight * mapboxZoomScale; } } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); float lightWeight = calc_lighting(project_pos); v_texture_data = vec2(a_Position.z, lightWeight); v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity); setPickingColor(a_PickingColor); } `,TY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs; layout(std140) uniform commonUniforms { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor; float u_topsurface; float u_sidesurface; float u_heightfixed; // 默认不固定 float u_raisingHeight; }; out vec4 v_Color; #pragma include "projection" #pragma include "light" #pragma include "picking" void main() { float isSide = a_Position.z; float topU = a_uvs[0]; float topV = 1.0 - a_uvs[1]; float sidey = a_uvs[2]; vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0); vec4 project_pos = project_position(pos, a_Position64Low); float lightWeight = calc_lighting(project_pos); if (u_heightfixed > 0.0) { // 判断几何体是否固定高度 project_pos.z = a_Position.z * a_Size; project_pos.z += u_raisingHeight; if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom); project_pos.z *= mapboxZoomScale; project_pos.z += u_raisingHeight * mapboxZoomScale; } } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); // Tip: 部分机型 GPU 计算精度兼容 if (isSide < 0.999) { // side face // if(u_sidesurface < 1.0) { // discard; // } if (u_linearColor == 1.0) { vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey); linearColor.rgb *= lightWeight; v_Color = linearColor; } else { v_Color = a_Color; } } else { v_Color = a_Color; } v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity); setPickingColor(a_PickingColor); } `,AY=`uniform sampler2D u_texture; layout(std140) uniform commonUniforms { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor; float u_topsurface; float u_sidesurface; float u_heightfixed; // 默认不固定 float u_raisingHeight; }; in vec4 v_Color; in vec3 v_uvs; in vec2 v_texture_data; #pragma include "scene_uniforms" #pragma include "picking" out vec4 outputColor; void main() { float opacity = u_opacity; float isSide = v_texture_data.x; float lightWeight = v_texture_data.y; float topU = v_uvs[0]; float topV = 1.0 - v_uvs[1]; float sidey = v_uvs[2]; outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV)); // Tip: 部分机型 GPU 计算精度兼容 if (isSide < 0.999) {// 是否是边缘 // side face if (u_sidesurface < 1.0) { discard; } if (u_linearColor == 1.0) { vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey); linearColor.rgb *= lightWeight; outputColor = linearColor; } else { outputColor = v_Color; } } else { // top face if (u_topsurface < 1.0) { discard; } } outputColor.a *= opacity; outputColor = filterColor(outputColor); } `,SY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs; layout(std140) uniform commonUniforms { vec4 u_sourceColor; vec4 u_targetColor; float u_linearColor; float u_topsurface; float u_sidesurface; float u_heightfixed; // 默认不固定 float u_raisingHeight; }; out vec4 v_Color; out vec3 v_uvs; out vec2 v_texture_data; #pragma include "projection" #pragma include "light" #pragma include "picking" void main() { vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0); vec4 project_pos = project_position(pos, a_Position64Low); float lightWeight = calc_lighting(project_pos); v_uvs = a_uvs; v_Color = a_Color; v_Color.a *= opacity; v_texture_data = vec2(a_Position.z, lightWeight); if (u_heightfixed > 0.0) { // 判断几何体是否固定高度 project_pos.z = a_Position.z * a_Size; project_pos.z += u_raisingHeight; if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom); project_pos.z *= mapboxZoomScale; project_pos.z += u_raisingHeight * mapboxZoomScale; } } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); setPickingColor(a_PickingColor); } `;class xY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:10,UV:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{mapTexture:t,heightfixed:r=!1,raisingHeight:n=0,topsurface:i=!0,sidesurface:o=!0,sourceColor:a,targetColor:s}=this.layer.getLayerConfig();let u=0,l=[1,1,1,1],f=[1,1,1,1];a&&s&&(l=Zt(a),f=Zt(s),u=1);const c={u_sourceColor:l,u_targetColor:f,u_linearColor:u,u_topsurface:Number(i),u_sidesurface:Number(o),u_heightfixed:Number(r),u_raisingHeight:Number(n)};return t&&this.texture&&(c.u_texture=this.texture,this.textures=[this.texture]),this.getUniformsBufferInfo(c)}initModels(){var t=this;return ve(function*(){return yield t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,depth:{enable:!0},defines:t.getDefines(),inject:t.getInject(),triangulation:FS})]})()}getShaders(){const{pickLight:t,mapTexture:r}=this.layer.getLayerConfig();return r?{frag:AY,vert:SY,type:"polygonExtrudeTexture"}:t?{frag:EY,vert:yY,type:"polygonExtrudePickLight"}:{frag:gY,vert:TY,type:"polygonExtrude"}}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.textures=[]}registerBuiltinAttributes(){const t=this.layer.getSource().extent,r=t[2]-t[0],n=t[3]-t[1];this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uvs",type:qe.Attribute,descriptor:{name:"a_uvs",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(i,o,a)=>{const s=a[0],u=a[1];return[(s-t[0])/r,(u-t[1])/n,a[4]]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(i,o,a,s,u)=>u}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:i=>{const{size:o=10}=i;return Array.isArray(o)?[o[0]]:[o]}}})}loadTexture(){var t=this;return ve(function*(){const{mapTexture:r}=t.layer.getLayerConfig(),{createTexture2D:n}=t.rendererService;if(t.texture=n({height:1,width:1}),r){const i=yield mY(r);t.texture=n({data:i,width:i.width,height:i.height,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,min:m.LINEAR,mag:m.LINEAR})}})()}}const bY=` in vec4 v_Color; #pragma include "scene_uniforms" #pragma include "picking" out vec4 outputColor; void main() { outputColor = v_Color; outputColor = filterColor(outputColor); } `,RY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size; layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal; out vec4 v_Color; #pragma include "projection" #pragma include "light" #pragma include "picking" void main() { vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0); vec4 project_pos = project_position(pos, a_Position64Low); float lightWeight = calc_lighting(project_pos); v_Color = a_Color; v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); setPickingColor(a_PickingColor); } `;class CY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:10,EXTRUSION_BASE:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const t={};return this.getUniformsBufferInfo(t)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:FS,depth:{enable:!0}})]})()}getShaders(){return{frag:bY,vert:RY,type:"polygonExtrude"}}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=10}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"extrusionBase",type:qe.Attribute,descriptor:{name:"a_ExtrusionBase",shaderLocation:this.attributeLocation.EXTRUSION_BASE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{extrusionBase:r=0}=t;return[r]}}})}}const OY=`in vec4 v_color; #pragma include "scene_uniforms" #pragma include "picking" out vec4 outputColor; void main() { outputColor = v_color; outputColor = filterColor(outputColor); } `,IY=` layout(std140) uniform commonUniforms { float u_raisingHeight; float u_opacitylinear; float u_dir; }; in vec4 v_color; in vec3 v_linear; in vec2 v_pos; out vec4 outputColor; #pragma include "scene_uniforms" #pragma include "picking" void main() { outputColor = v_color; if (u_opacitylinear > 0.0) { outputColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z; } outputColor = filterColor(outputColor); } `,MY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_LINEAR) in vec3 a_linear; layout(std140) uniform commonUniforms { float u_raisingHeight; float u_opacitylinear; float u_dir; }; out vec4 v_color; out vec3 v_linear; out vec2 v_pos; #pragma include "projection" #pragma include "picking" void main() { if (u_opacitylinear > 0.0) { v_linear = a_linear; v_pos = a_Position.xy; } v_color = vec4(a_Color.xyz, a_Color.w * opacity); vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); project_pos.z += u_raisingHeight; if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom); project_pos.z *= mapboxZoomScale; project_pos.z += u_raisingHeight * mapboxZoomScale; } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); setPickingColor(a_PickingColor); } `,NY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(std140) uniform commonUniforms { float u_raisingHeight; }; out vec4 v_color; #pragma include "projection" #pragma include "picking" void main() { // cal style mapping - 数据纹理映射部分的计算 v_color = vec4(a_Color.xyz, a_Color.w * opacity); vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); project_pos.z += u_raisingHeight; if ( u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET ) { float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom); project_pos.z *= mapboxZoomScale; project_pos.z += u_raisingHeight * mapboxZoomScale; } gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); setPickingColor(a_PickingColor); } `;class PY extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,LINEAR:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{raisingHeight:t=0,opacityLinear:r={enable:!1,dir:"in"}}=this.layer.getLayerConfig(),n={u_raisingHeight:Number(t),u_opacitylinear:Number(r.enable),u_dir:r.dir==="in"?1:0};return this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,triangulation:i,type:o}=t.getModelParams();return t.initUniformsBuffer(),t.layer.triangulation=i,[yield t.layer.buildLayerModel({moduleName:o,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:i,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute();const{opacityLinear:t={enable:!1,dir:"in"}}=this.layer.getLayerConfig();t.enable&&this.styleAttributeService.registerStyleAttribute({name:"linear",type:qe.Attribute,descriptor:{name:"a_linear",shaderLocation:this.attributeLocation.LINEAR,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(r,n,i)=>[i[3],i[4],i[5]]}})}getModelParams(){const{opacityLinear:t={enable:!1}}=this.layer.getLayerConfig();return t.enable?{frag:IY,vert:MY,type:"polygonLinear",triangulation:QW}:{frag:OY,vert:NY,type:"polygonFill",triangulation:ku}}}const LY=` layout(std140) uniform commonUniforms { vec4 u_watercolor; vec4 u_watercolor2; float u_time; }; in vec2 v_uv; in float v_opacity; out vec4 outputColor; float coast2water_fadedepth = 0.10; float large_waveheight = .750; // change to adjust the "heavy" waves float large_wavesize = 3.4; // factor to adjust the large wave size float small_waveheight = 0.6; // change to adjust the small random waves float small_wavesize = 0.5; // factor to ajust the small wave size float water_softlight_fact = 15.; // range [1..200] (should be << smaller than glossy-fact) float water_glossylight_fact= 120.; // range [1..200] float particle_amount = 70.; vec3 water_specularcolor = vec3(1.3, 1.3, 0.9); // specular Color (RGB) of the water-highlights #define light vec3(-0., sin(u_time*0.5)*.5 + .35, 2.8) // position of the sun uniform sampler2D u_texture1; uniform sampler2D u_texture2; uniform sampler2D u_texture3; float hash( float n ) { return fract(sin(n)*43758.5453123); } // 2d noise function float noise1( in vec2 x ) { vec2 p = floor(x); vec2 f = smoothstep(0.0, 1.0, fract(x)); float n = p.x + p.y*57.0; return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y); } float noise(vec2 p) { return texture(SAMPLER_2D(u_texture2),p*vec2(1./256.)).x; } vec4 highness(vec2 p) { vec4 t = texture(SAMPLER_2D(u_texture1),fract(p)); float clipped = -2.0-smoothstep(3.,10.,t.a)*6.9-smoothstep(10.,100.,t.a)*89.9-smoothstep(0.,10000.,t.a)*10000.0; return clamp(t, 0.0,3.0)+clamp(t/3.0-1.0, 0.0,1.0)+clamp(t/16.0-1.0, 0.0,1.0); } float height_map( vec2 p ) { vec4 height=highness(p); /* height = -0.5+ 0.5*smoothstep(-100.,0.,-height)+ 2.75*smoothstep(0.,2.,height)+ 1.75*smoothstep(2.,4.,height)+ 2.75*smoothstep(4.,16.,height)+ 1.5*smoothstep(16.,1000.,height); */ mat2 m = mat2( 0.9563*1.4, -0.2924*1.4, 0.2924*1.4, 0.9563*1.4 ); //p = p*6.; float f = 0.6000*noise1( p ); p = m*p*1.1*6.; f += 0.2500*noise( p ); p = m*p*1.32; f += 0.1666*noise( p ); p = m*p*1.11; f += 0.0834*noise( p ); p = m*p*1.12; f += 0.0634*noise( p ); p = m*p*1.13; f += 0.0444*noise( p ); p = m*p*1.14; f += 0.0274*noise( p ); p = m*p*1.15; f += 0.0134*noise( p ); p = m*p*1.16; f += 0.0104*noise( p ); p = m*p*1.17; f += 0.0084*noise( p ); f = .25*f+dot(height,vec4(-.03125,-.125,.25,.25))*.5; const float FLAT_LEVEL = 0.92525; //f = f*0.25+height*0.75; if (f level) { col = CalcTerrain(uv, height); } if (height <= level) { vec2 dif = vec2(.0, .01); vec2 pos = uv*15. + vec2(u_time*.01); float h1 = water_map(pos-dif,waveheight); float h2 = water_map(pos+dif,waveheight); float h3 = water_map(pos-dif.yx,waveheight); float h4 = water_map(pos+dif.yx,waveheight); vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane uv += normwater.xy*.002*(level-height); col = CalcTerrain(uv, height); float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.); float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.); float intensity = col.r*.2126+col.g*.7152+col.b*.0722; watercolor = mix(watercolor*intensity, watercolor2, smoothstep(0., 1., coastfade2)); vec3 r0 = vec3(uv, WATER_LEVEL); vec3 rd = normalize( light - r0 ); // ray-direction to the light from water-position float grad = dot(normwater, rd); // dot-product of norm-vector and light-direction float specular = pow(grad, water_softlight_fact); // used for soft highlights float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights float gradpos = dot(vec3(0., 0., 1.), rd); float specular1= smoothstep(0., 1., pow(gradpos, 5.)); // used for diffusity (some darker corona around light's specular reflections...) float watershade = test_shadow( uv, level ); watercolor *= 2.2+watershade; watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25; watercolor /= (1.+specular1*1.25); watercolor += watershade*specular2*water_specularcolor; watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(uv)+vec3(1., 1., 1.)*particles(uv)); col = mix(col, watercolor, coastfade); } outputColor = vec4(col, v_opacity); } `,wY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv; layout(std140) uniform commonUniforms { vec4 u_watercolor; vec4 u_watercolor2; float u_time; }; out vec2 v_uv; out float v_opacity; #pragma include "projection" void main() { v_uv = a_uv; v_opacity = opacity; vec4 project_pos = project_position(vec4(a_Position, 1.0)); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); } `;class FY extends Qt{constructor(...t){super(...t),E(this,"texture1",void 0),E(this,"texture2",void 0),E(this,"texture3",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{watercolor:t="#6D99A8",watercolor2:r="#0F121C"}=this.layer.getLayerConfig(),n={u_watercolor:Zt(t),u_watercolor2:Zt(r),u_time:this.layer.getLayerAnimateTime(),u_texture1:this.texture1,u_texture2:this.texture2,u_texture3:this.texture3};return this.textures=[this.texture1,this.texture2,this.texture3],this.getUniformsBufferInfo(n)}getAnimateUniforms(){return{u_time:this.layer.getLayerAnimateTime()}}initModels(){var t=this;return ve(function*(){return t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"polygonOcean",vertexShader:wY,fragmentShader:LY,defines:t.getDefines(),inject:t.getInject(),triangulation:ku,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}clearModels(){var t,r,n;(t=this.texture1)===null||t===void 0||t.destroy(),(r=this.texture2)===null||r===void 0||r.destroy(),(n=this.texture3)===null||n===void 0||n.destroy()}registerBuiltinAttributes(){const t=this.layer.getSource().extent,[r,n,i,o]=t,a=i-r,s=o-n;this.styleAttributeService.registerStyleAttribute({name:"oceanUv",type:qe.Attribute,descriptor:{name:"a_uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(u,l,f)=>{const[c,h]=f;return[(c-r)/a,(h-n)/s]}}})}loadTexture(){const{createTexture2D:t}=this.rendererService,r={height:0,width:0};this.texture1=t(r),this.texture2=t(r),this.texture3=t(r),n(o=>{this.texture1=i(o[0]),this.texture2=i(o[1]),this.texture3=i(o[2]),this.layerService.reRender()});function n(o){let a=0;const s=[];["https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ","https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*MJ22QbpuCzIAAAAAAAAAAAAAARQnAQ","https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*-z2HSIVDsHIAAAAAAAAAAAAAARQnAQ"].map(l=>{const f=new Image;f.crossOrigin="",f.src=l,s.push(f),f.onload=()=>{a++,a===3&&o(s)}})}function i(o){return t({data:o,width:o.width,height:o.height,wrapS:m.MIRRORED_REPEAT,wrapT:m.MIRRORED_REPEAT,min:m.LINEAR,mag:m.LINEAR})}}}const BY=`uniform sampler2D u_texture; layout(std140) uniform commonUniforms { float u_speed; float u_time; }; out vec4 outputColor; in vec4 v_Color; in vec2 v_uv; float rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); } float water(vec3 p) { float t = u_time * u_speed; p.z += t * 2.; p.x += t * 2.; vec3 c1 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz; p.z += t * 3.; p.x += t * 0.52; vec3 c2 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz; p.z += t * 4.; p.x += t * 0.8; vec3 c3 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz; c1 += c2 - c3; float z = (c1.x + c1.y + c1.z) / 3.; return p.y + z / 4.; } float map(vec3 p) { float d = 100.0; d = water(p); return d; } float intersect(vec3 ro, vec3 rd) { float d = 0.0; for (int i = 0; i <= 100; i++) { float h = map(ro + rd * d); if (h < 0.1) return d; d += h; } return 0.0; } vec3 norm(vec3 p) { float eps = .1; return normalize(vec3( map(p + vec3(eps, 0, 0)) - map(p + vec3(-eps, 0, 0)), map(p + vec3(0, eps, 0)) - map(p + vec3(0, -eps, 0)), map(p + vec3(0, 0, eps)) - map(p + vec3(0, 0, -eps)) )); } float calSpc() { vec3 l1 = normalize(vec3(1, 1, 1)); vec3 ro = vec3(-3, 20, -8); vec3 rc = vec3(0, 0, 0); vec3 ww = normalize(rc - ro); vec3 uu = normalize(cross(vec3(0,1,0), ww)); vec3 vv = normalize(cross(rc - ro, uu)); vec3 rd = normalize(uu * v_uv.x + vv * v_uv.y + ww); float d = intersect(ro, rd); vec3 p = ro + rd * d; vec3 n = norm(p); float spc = pow(max(0.0, dot(reflect(l1, n), rd)), 30.0); return spc; } void main() { outputColor = v_Color; float spc = calSpc(); outputColor += spc * 0.4; } `,DY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv; layout(std140) uniform commonUniforms { float u_speed; float u_time; }; out vec4 v_Color; out vec2 v_uv; #pragma include "projection" void main() { v_uv = a_uv; v_Color = a_Color; v_Color.a *= opacity; vec4 project_pos = project_position(vec4(a_Position, 1.0)); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); } `;class UY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{speed:t=.5}=this.layer.getLayerConfig(),r={u_speed:t,u_time:this.layer.getLayerAnimateTime(),u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(r)}getAnimateUniforms(){return{u_time:this.layer.getLayerAnimateTime()}}initModels(){var t=this;return ve(function*(){return t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"polygonWater",vertexShader:DY,fragmentShader:BY,triangulation:ku,defines:t.getDefines(),inject:t.getInject(),primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1,diagnosticDerivativeUniformityEnabled:!1})]})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){const t=this.layer.getSource().extent,[r,n,i,o]=t,a=i-r,s=o-n;this.styleAttributeService.registerStyleAttribute({name:"waterUv",type:qe.Attribute,descriptor:{name:"a_uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(u,l,f)=>{const[c,h]=f;return[(c-r)/a,(h-n)/s]}}})}loadTexture(){const{waterTexture:t}=this.layer.getLayerConfig(),{createTexture2D:r}=this.rendererService;this.texture=r({height:1,width:1});const n=new Image;n.crossOrigin="",t?(console.warn("L7 recommend:https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ"),n.src=t):n.src="https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ",n.onload=()=>{this.texture=r({data:n,width:n.width,height:n.height,wrapS:m.MIRRORED_REPEAT,wrapT:m.MIRRORED_REPEAT,min:m.LINEAR,mag:m.LINEAR}),this.layerService.reRender()}}}const kY={fill:PY,line:BS,extrude:xY,text:jS,point_fill:kS,point_image:$S,point_normal:zS,point_extrude:US,water:UY,ocean:FY,extrusion:CY};class XS extends Ka{constructor(...t){super(...t),E(this,"type","PolygonLayer"),E(this,"enableShaderEncodeStyles",["opacity","extrusionBase","rotation","offsets","stroke"])}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new kY[r](t),yield t.initLayerModels()})()}getModelType(){var t;const r=this.styleAttributeService.getLayerStyleAttribute("shape"),n=r==null||(t=r.scale)===null||t===void 0?void 0:t.field;return n==="fill"||!n?"fill":n==="extrude"?"extrude":n==="extrusion"?"extrusion":n==="water"?"water":n==="ocean"?"ocean":n==="line"?"line":this.getPointModelType()}getPointModelType(){const t=this.getEncodedData(),{shape2d:r,shape3d:n}=this.getLayerConfig(),i=this.iconService.getIconMap(),o=t.find(a=>a.hasOwnProperty("shape"));if(o){const a=o.shape;return a==="dot"?"point_normal":(r==null?void 0:r.indexOf(a))!==-1?"point_fill":(n==null?void 0:n.indexOf(a))!==-1?"point_extrude":i.hasOwnProperty(a)?"point_image":"text"}else return"fill"}}const $Y=`layout(std140) uniform commonUniforms { vec2 u_domain; float u_opacity; float u_noDataValue; float u_clampLow; float u_clampHigh; }; uniform sampler2D u_rasterTexture; uniform sampler2D u_colorTexture; in vec2 v_texCoord; bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; } out vec4 outputColor; void main() { // Can use any component here since u_rasterTexture is under luminance format. float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r; if (value == u_noDataValue || isnan_emu(value)) { discard; } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) { discard; } else { float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]); vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(normalisedValue, 0)); outputColor = color; outputColor.a = outputColor.a * u_opacity ; if (outputColor.a < 0.01) discard; } } `,zY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv; layout(std140) uniform commonUniforms { vec2 u_domain; float u_opacity; float u_noDataValue; float u_clampLow; float u_clampHigh; }; out vec2 v_texCoord; #pragma include "projection" void main() { v_texCoord = a_Uv; vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0)); } `;let o1=class extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"colorTexture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,clampLow:r=!0,clampHigh:n=!0,noDataValue:i=-9999999,domain:o,rampColors:a}=this.layer.getLayerConfig(),s=o||gp(a);this.colorTexture=this.layer.textureService.getColorTexture(a,s);const u={u_domain:s,u_opacity:t||1,u_noDataValue:i,u_clampLow:r?1:0,u_clampHigh:(typeof n<"u"?n:r)?1:0,u_rasterTexture:this.texture,u_colorTexture:this.colorTexture};return this.textures=[this.texture,this.colorTexture],this.getUniformsBufferInfo(u)}getRasterData(t){return ve(function*(){if(Array.isArray(t.data))return{data:t.data,width:t.width,height:t.height};{const{rasterData:r,width:n,height:i}=yield t.data;return{data:Array.from(r),width:n,height:i}}})()}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n,queryVerdorInfo:i}=t.rendererService,o=r.data.dataArray[0],{data:a,width:s,height:u}=yield t.getRasterData(o);return t.texture=n({data:new Float32Array(a),width:s,height:u,format:i()==="WebGL1"?m.LUMINANCE:m.RED,type:m.FLOAT,alignment:1}),[yield t.layer.buildLayerModel({moduleName:"rasterImageData",vertexShader:zY,fragmentShader:$Y,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1})]})()}clearModels(){var t,r;(t=this.texture)===null||t===void 0||t.destroy(),(r=this.colorTexture)===null||r===void 0||r.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.UV,name:"a_Uv",buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}};const VY=["data"],HY=["rasterData"],jY=`uniform sampler2D u_texture; layout(std140) uniform commonUniforms { vec2 u_rminmax; vec2 u_gminmax; vec2 u_bminmax; float u_opacity; float u_noDataValue; }; in vec2 v_texCoord; out vec4 outputColor; void main() { vec3 rgb = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y)).rgb; if(rgb == vec3(u_noDataValue)) { outputColor = vec4(0.0, 0, 0, 0.0); } else { outputColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity); } if(outputColor.a < 0.01) discard; }`,XY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv; layout(std140) uniform commonUniforms { vec2 u_rminmax; vec2 u_gminmax; vec2 u_bminmax; float u_opacity; float u_noDataValue; }; out vec2 v_texCoord; #pragma include "projection" void main() { v_texCoord = a_Uv; vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0)); } `;class WY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"dataOption",{})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,noDataValue:r=0}=this.layer.getLayerConfig(),{rMinMax:n=[0,255],gMinMax:i=[0,255],bMinMax:o=[0,255]}=this.dataOption,a={u_rminmax:n,u_gminmax:i,u_bminmax:o,u_opacity:t||1,u_noDataValue:r,u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(a)}getRasterData(t){var r=this;return ve(function*(){if(Array.isArray(t.data)){const{data:a}=t,s=ai(t,VY);return r.dataOption=s,he({data:a},s)}const n=yield t.data,{rasterData:i}=n,o=ai(n,HY);return r.dataOption=o,Array.isArray(i)?he({data:i},o):he({data:Array.from(i)},o)})()}initModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n}=t.rendererService,i=r.data.dataArray[0],{data:o,width:a,height:s}=yield t.getRasterData(i);return t.texture=n({data:new Float32Array(o),width:a,height:s,format:m.RGB,type:m.FLOAT}),[yield t.layer.buildLayerModel({moduleName:"rasterImageDataRGBA",vertexShader:XY,fragmentShader:jY,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1})]})()}buildModels(){var t=this;return ve(function*(){return t.initModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}}const GY=`uniform sampler2D u_texture; uniform sampler2D u_colorTexture; layout(std140) uniform commonUniforms { vec4 u_unpack; vec2 u_domain; float u_opacity; float u_noDataValue; float u_clampLow; float u_clampHigh; }; in vec2 v_texCoord; out vec4 outputColor; float getElevation(vec2 coord, float bias) { // Convert encoded elevation value to meters vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0; data.a = -1.0; return dot(data, u_unpack); } vec4 getColor(float value) { float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]); vec2 coord = vec2(normalisedValue, 0); return texture(SAMPLER_2D(u_colorTexture), coord); } void main() { float value = getElevation(v_texCoord,0.0); if (value == u_noDataValue) { outputColor = vec4(0.0, 0, 0, 0.0); } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) { outputColor = vec4(0.0, 0, 0, 0.0); } else { outputColor = getColor(value); outputColor.a = outputColor.a * u_opacity ; if(outputColor.a < 0.01) discard; } } `,YY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv; layout(std140) uniform commonUniforms { vec4 u_unpack; vec2 u_domain; float u_opacity; float u_noDataValue; float u_clampLow; float u_clampHigh; }; out vec2 v_texCoord; #pragma include "projection" void main() { v_texCoord = a_Uv; vec4 project_pos = project_position(vec4(a_Position, 1.0)); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0)); } `;class ZY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getCommonUniformsInfo(){const{opacity:t,clampLow:r=!0,clampHigh:n=!0,noDataValue:i=-9999999,domain:o,rampColors:a,colorTexture:s,rScaler:u=6553.6,gScaler:l=25.6,bScaler:f=.1,offset:c=1e4}=this.layer.getLayerConfig(),h=o||gp(a);let d=s;s?this.layer.textureService.setColorTexture(s,a,h):d=this.layer.textureService.getColorTexture(a,h);const p={u_unpack:[u,l,f,c],u_domain:h,u_opacity:t||1,u_noDataValue:i,u_clampLow:r,u_clampHigh:typeof n<"u"?n:r,u_texture:this.texture,u_colorTexture:d};return this.textures=[this.texture,d],this.getUniformsBufferInfo(p)}initModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n}=t.rendererService,i=yield r.data.images;return t.texture=n({data:i[0],width:i[0].width,height:i[0].height,min:m.LINEAR,mag:m.LINEAR}),[yield t.layer.buildLayerModel({moduleName:"RasterTileDataImage",vertexShader:YY,fragmentShader:GY,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}buildModels(){var t=this;return ve(function*(){return t.initModels()})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}}const qY={raster:o1,rasterRgb:WY,raster3d:o1,rasterTerrainRgb:ZY};class n_ extends Ka{constructor(...t){super(...t),E(this,"type","RasterLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new qY[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{raster:{},rasterRgb:{},raster3d:{},rasterTerrainRgb:{}}[t]}getModelType(){switch(this.layerSource.getParserType()){case"raster":return"raster";case"rasterRgb":return"rasterRgb";case"rgb":return"rasterRgb";case"image":return"rasterTerrainRgb";default:return"raster"}}getLegend(t){if(t!=="color")return{type:void 0,field:void 0,items:[]};const r=this.getLayerConfig().rampColors;return tG(r,t)}}class KY{constructor({rendererService:t,layerService:r,parent:n}){E(this,"tileResource",new Map),E(this,"rendererService",void 0),E(this,"layerService",void 0),E(this,"parent",void 0),E(this,"layerTiles",[]),this.rendererService=t,this.layerService=r,this.parent=n}get tiles(){return this.layerTiles}hasTile(t){return this.layerTiles.some(r=>r.key===t)}addTile(t){this.layerTiles.push(t)}getTile(t){return this.layerTiles.find(r=>r.key===t)}getVisibleTileBylngLat(t){return this.layerTiles.find(r=>r.isLoaded&&r.visible&&r.lnglatInBounds(t))}removeTile(t){const r=this.layerTiles.findIndex(i=>i.key===t),n=this.layerTiles.splice(r,1);n[0]&&n[0].destroy()}updateTileVisible(t){const r=this.getTile(t.key);if(t.isVisible)if(t.parent){const n=this.isChildrenLoaded(t.parent);r==null||r.updateVisible(n)}else r==null||r.updateVisible(!0);else if(t.parent){const n=this.isChildrenLoaded(t.parent);r==null||r.updateVisible(!n)}else r==null||r.updateVisible(!1)}isParentLoaded(t){const r=t.parent;if(!r)return!0;const n=this.getTile(r==null?void 0:r.key);return!!(n!=null&&n.isLoaded)}isChildrenLoaded(t){const r=t==null?void 0:t.children;return r.length===0?!0:r.every(n=>{const i=this.getTile(n==null?void 0:n.key);return i?(i==null?void 0:i.isLoaded)===!0:!0})}render(){var t=this;return ve(function*(){const n=t.getRenderLayers().map(function(){var i=ve(function*(o){yield t.layerService.renderTileLayer(o)});return function(o){return i.apply(this,arguments)}}());yield Promise.all(n)})()}getRenderLayers(){const t=this.layerTiles.filter(n=>n.visible&&n.isLoaded),r=[];return t.map(n=>r.push(...n.getLayers())),r}getLayers(){const t=this.layerTiles.filter(n=>n.isLoaded),r=[];return t.map(n=>r.push(...n.getLayers())),r}getTiles(){return this.layerTiles}destroy(){this.layerTiles.forEach(t=>t.destroy()),this.tileResource.clear()}}/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * * @author Alexander Milevski * @license MIT * @preserve *//*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function QY(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]t?1:e0){if(t.right===null)break;if(r(e,t.right.key)>0){var s=t.right;if(t.right=s.left,s.left=t,t=s,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function Jh(e,t,r,n){var i=new Gi(e,t);if(r===null)return i.left=i.right=null,i;r=$i(e,r,n);var o=n(e,r.key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function a1(e,t,r){var n=null,i=null;if(t){t=$i(e,t,r);var o=r(t.key,e);o===0?(n=t.left,i=t.right):o<0?(i=t.right,t.right=null,n=t):(n=t.left,t.left=null,i=t)}return{left:n,right:i}}function eZ(e,t,r){return t===null?e:(e===null||(t=$i(e.key,t,r),t.left=e),t)}function Jd(e,t,r,n,i){if(e){n(""+t+(r?"└── ":"├── ")+i(e)+` `);var o=t+(r?" ":"│ ");e.left&&Jd(e.left,o,!1,n,i),e.right&&Jd(e.right,o,!0,n,i)}}var i_=function(){function e(t){t===void 0&&(t=JY),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,r){return this._size++,this._root=Jh(t,r,this._root,this._comparator)},e.prototype.add=function(t,r){var n=new Gi(t,r);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,o=$i(t,this._root,i),a=i(t,o.key);return a===0?this._root=o:(a<0?(n.left=o.left,n.right=o,o.left=null):a>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,r,n){var i;if(r===null)return null;r=$i(t,r,n);var o=n(t,r.key);return o===0?(r.left===null?i=r.right:(i=$i(t,r.left,n),i.right=r.right),this._size--,i):r},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=$i(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var r=this._root,n=this._comparator;r;){var i=n(t,r.key);if(i===0)return r;i<0?r=r.left:r=r.right}return null},e.prototype.find=function(t){return this._root&&(this._root=$i(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var r=this._root,n=this._comparator;r;){var i=n(t,r.key);if(i===0)return!0;i<0?r=r.left:r=r.right}return!1},e.prototype.forEach=function(t,r){for(var n=this._root,i=[],o=!1;!o;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(r,n),n=n.right):o=!0;return this},e.prototype.range=function(t,r,n,i){for(var o=[],a=this._comparator,s=this._root,u;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),u=a(s.key,r),u>0)break;if(a(s.key,t)>=0&&n.call(i,s))return this;s=s.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(r){var n=r.key;return t.push(n)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(r){var n=r.data;return t.push(n)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var r=this._root,n=!1,i=0,o=[];!n;)if(r)o.push(r),r=r.left;else if(o.length>0){if(r=o.pop(),i===t)return r;i++,r=r.right}else n=!0;return null},e.prototype.next=function(t){var r=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;r;){var o=i(t.key,r.key);if(o===0)break;o<0?(n=r,r=r.left):r=r.right}return n},e.prototype.prev=function(t){var r=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;r;){var o=i(t.key,r.key);if(o===0)break;o<0?r=r.left:(n=r,r=r.right)}return n},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return rZ(this._root)},e.prototype.load=function(t,r,n){r===void 0&&(r=[]),n===void 0&&(n=!1);var i=t.length,o=this._comparator;if(n&&rp(t,r,0,i-1,o),this._root===null)this._root=ep(t,r,0,i),this._size=i;else{var a=nZ(this.toList(),tZ(t,r),o);i=this._size+i,this._root=tp({head:a},0,i)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var r=[];return Jd(this._root,"",!0,function(n){return r.push(n)},t),r.join("")},e.prototype.update=function(t,r,n){var i=this._comparator,o=a1(t,this._root,i),a=o.left,s=o.right;i(t,r)<0?s=Jh(r,n,s,i):a=Jh(r,n,a,i),this._root=eZ(a,s,i)},e.prototype.split=function(t){return a1(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,r,n;return QY(this,function(i){switch(i.label){case 0:t=this._root,r=[],n=!1,i.label=1;case 1:return n?[3,6]:t===null?[3,2]:(r.push(t),t=t.left,[3,5]);case 2:return r.length===0?[3,4]:(t=r.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:n=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function ep(e,t,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),a=e[o],s=t[o],u=new Gi(a,s);return u.left=ep(e,t,r,o),u.right=ep(e,t,o+1,n),u}return null}function tZ(e,t){for(var r=new Gi(null,null),n=r,i=0;i0?(t=o=o.next=r.pop(),t=t.right):n=!0;return o.next=null,i.next}function tp(e,t,r){var n=r-t;if(n>0){var i=t+Math.floor(n/2),o=tp(e,t,i),a=e.head;return a.left=o,e.head=e.head.next,a.right=tp(e,i+1,r),a}return null}function nZ(e,t,r){for(var n=new Gi(null,null),i=n,o=e,a=t;o!==null&&a!==null;)r(o.key,a.key)<0?(i.next=o,o=o.next):(i.next=a,a=a.next),i=i.next;return o!==null?i.next=o:a!==null&&(i.next=a),n.next}function rp(e,t,r,n,i){if(!(r>=n)){for(var o=e[r+n>>1],a=r-1,s=n+1;;){do a++;while(i(e[a],o)<0);do s--;while(i(e[s],o)>0);if(a>=s)break;var u=e[a];e[a]=e[s],e[s]=u,u=t[a],t[a]=t[s],t[s]=u}rp(e,t,r,s,i),rp(e,t,s+1,n,i)}}const Ei=11102230246251565e-32,Gr=134217729,iZ=(3+8*Ei)*Ei;function ed(e,t,r,n,i){let o,a,s,u,l=t[0],f=n[0],c=0,h=0;f>l==f>-l?(o=l,l=t[++c]):(o=f,f=n[++h]);let d=0;if(cl==f>-l?(a=l+o,s=o-(a-l),l=t[++c]):(a=f+o,s=o-(a-f),f=n[++h]),o=a,s!==0&&(i[d++]=s);cl==f>-l?(a=o+l,u=a-o,s=o-(a-u)+(l-u),l=t[++c]):(a=o+f,u=a-o,s=o-(a-u)+(f-u),f=n[++h]),o=a,s!==0&&(i[d++]=s);for(;c=ce||-K>=ce||(c=e-ge,s=e-(ge+c)+(c-i),c=r-q,l=r-(q+c)+(c-i),c=t-k,u=t-(k+c)+(c-o),c=n-G,f=n-(G+c)+(c-o),s===0&&u===0&&l===0&&f===0)||(ce=uZ*a+iZ*Math.abs(K),K+=ge*f+G*s-(k*l+q*u),K>=ce||-K>=ce))return K;x=s*G,h=Gr*s,d=h-(h-s),p=s-d,h=Gr*G,v=h-(h-G),g=G-v,M=p*g-(x-d*v-p*v-d*g),$=u*q,h=Gr*u,d=h-(h-u),p=u-d,h=Gr*q,v=h-(h-q),g=q-v,F=p*g-($-d*v-p*v-d*g),y=M-F,c=M-y,Jr[0]=M-(y+c)+(c-F),S=x+y,c=S-x,R=x-(S-c)+(y-c),y=R-$,c=R-y,Jr[1]=R-(y+c)+(c-$),Y=S+y,c=Y-S,Jr[2]=S-(Y-c)+(y-c),Jr[3]=Y;const Pe=ed(4,ha,4,Jr,s1);x=ge*f,h=Gr*ge,d=h-(h-ge),p=ge-d,h=Gr*f,v=h-(h-f),g=f-v,M=p*g-(x-d*v-p*v-d*g),$=k*l,h=Gr*k,d=h-(h-k),p=k-d,h=Gr*l,v=h-(h-l),g=l-v,F=p*g-($-d*v-p*v-d*g),y=M-F,c=M-y,Jr[0]=M-(y+c)+(c-F),S=x+y,c=S-x,R=x-(S-c)+(y-c),y=R-$,c=R-y,Jr[1]=R-(y+c)+(c-$),Y=S+y,c=Y-S,Jr[2]=S-(Y-c)+(y-c),Jr[3]=Y;const Xe=ed(Pe,s1,4,Jr,u1);x=s*f,h=Gr*s,d=h-(h-s),p=s-d,h=Gr*f,v=h-(h-f),g=f-v,M=p*g-(x-d*v-p*v-d*g),$=u*l,h=Gr*u,d=h-(h-u),p=u-d,h=Gr*l,v=h-(h-l),g=l-v,F=p*g-($-d*v-p*v-d*g),y=M-F,c=M-y,Jr[0]=M-(y+c)+(c-F),S=x+y,c=S-x,R=x-(S-c)+(y-c),y=R-$,c=R-y,Jr[1]=R-(y+c)+(c-$),Y=S+y,c=Y-S,Jr[2]=S-(Y-c)+(y-c),Jr[3]=Y;const Je=ed(Xe,u1,4,Jr,l1);return l1[Je-1]}function cZ(e,t,r,n,i,o){const a=(t-o)*(r-i),s=(e-i)*(n-o),u=a-s,l=Math.abs(a+s);return Math.abs(u)>=aZ*l?u:-lZ(e,t,r,n,i,o,l)}var WS={};const ks=(e,t)=>e.ll.x<=t.x&&t.x<=e.ur.x&&e.ll.y<=t.y&&t.y<=e.ur.y,np=(e,t)=>{if(t.ur.x{if(-Vie.x*t.y-e.y*t.x,GS=(e,t)=>e.x*t.x+e.y*t.y,h1=(e,t,r)=>{const n=cZ(e.x,e.y,t.x,t.y,r.x,r.y);return n>0?-1:n<0?1:0},Bc=e=>Math.sqrt(GS(e,e)),dZ=(e,t,r)=>{const n={x:t.x-e.x,y:t.y-e.y},i={x:r.x-e.x,y:r.y-e.y};return ec(i,n)/Bc(i)/Bc(n)},pZ=(e,t,r)=>{const n={x:t.x-e.x,y:t.y-e.y},i={x:r.x-e.x,y:r.y-e.y};return GS(i,n)/Bc(i)/Bc(n)},d1=(e,t,r)=>t.y===0?null:{x:e.x+t.x/t.y*(r-e.y),y:r},p1=(e,t,r)=>t.x===0?null:{x:r,y:e.y+t.y/t.x*(r-e.x)},_Z=(e,t,r,n)=>{if(t.x===0)return p1(r,n,e.x);if(n.x===0)return p1(e,t,r.x);if(t.y===0)return d1(r,n,e.y);if(n.y===0)return d1(e,t,r.y);const i=ec(t,n);if(i==0)return null;const o={x:r.x-e.x,y:r.y-e.y},a=ec(o,t)/i,s=ec(o,n)/i,u=e.x+s*t.x,l=r.x+a*n.x,f=e.y+s*t.y,c=r.y+a*n.y,h=(u+l)/2,d=(f+c)/2;return{x:h,y:d}};class Nn{static compare(t,r){const n=Nn.comparePoints(t.point,r.point);return n!==0?n:(t.point!==r.point&&t.link(r),t.isLeft!==r.isLeft?t.isLeft?1:-1:ji.compare(t.segment,r.segment))}static comparePoints(t,r){return t.xr.x?1:t.yr.y?1:0}constructor(t,r){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=r}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const r=t.point.events;for(let n=0,i=r.length;n{const o=i.otherSE;r.set(i,{sine:dZ(this.point,t.point,o.point),cosine:pZ(this.point,t.point,o.point)})};return(i,o)=>{r.has(i)||n(i),r.has(o)||n(o);const{sine:a,cosine:s}=r.get(i),{sine:u,cosine:l}=r.get(o);return a>=0&&u>=0?sl?-1:0:a<0&&u<0?sl?1:0:ua?1:0}}}let vZ=0;class ji{static compare(t,r){const n=t.leftSE.point.x,i=r.leftSE.point.x,o=t.rightSE.point.x,a=r.rightSE.point.x;if(as&&u>l)return-1;const c=t.comparePoint(r.leftSE.point);if(c<0)return 1;if(c>0)return-1;const h=r.comparePoint(t.rightSE.point);return h!==0?h:-1}if(n>i){if(su&&s>f)return 1;const c=r.comparePoint(t.leftSE.point);if(c!==0)return c;const h=t.comparePoint(r.rightSE.point);return h<0?1:h>0?-1:1}if(su)return 1;if(oa){const c=t.comparePoint(r.rightSE.point);if(c<0)return 1;if(c>0)return-1}if(o!==a){const c=l-s,h=o-n,d=f-u,p=a-i;if(c>h&&dp)return-1}return o>a?1:of?1:t.idr.id?1:0}constructor(t,r,n,i){this.id=++vZ,this.leftSE=t,t.segment=this,t.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=t,this.rings=n,this.windings=i}static fromRing(t,r,n){let i,o,a;const s=Nn.comparePoints(t,r);if(s<0)i=t,o=r,a=1;else if(s>0)i=r,o=t,a=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const u=new Nn(i,!0),l=new Nn(o,!1);return new ji(u,l,[n],[a])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tr?t:r}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const r=this.leftSE.point,n=this.rightSE.point,i=this.vector();if(r.x===n.x)return t.x===r.x?0:t.x0&&s.swapEvents(),Nn.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let r=0,n=this.windings.length;r0){const o=r;r=n,n=o}if(r.prev===n){const o=r;r=n,n=o}for(let o=0,a=n.rings.length;oi.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(r);break}default:throw new Error(`Unrecognized operation type found ${Gn.type}`)}return this._isInResult}}class _1{constructor(t,r,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=Ru.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let o=i;for(let a=1,s=t.length;athis.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(ji.fromRing(o,i,this))}getSweepEvents(){const t=[];for(let r=0,n=this.segments.length;rthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let r=0,n=this.interiorRings.length;rthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}getSweepEvents(){const t=[];for(let r=0,n=this.polys.length;r0&&(t=a)}let r=t.segment.prevInResult(),n=r?r.prevInResult():null;for(;;){if(!r)return null;if(!n)return r.ringOut;if(n.ringOut!==r.ringOut)return n.ringOut.enclosingRing()!==r.ringOut?r.ringOut:r.ringOut.enclosingRing();r=n.prevInResult(),n=r?r.prevInResult():null}}}class m1{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let r=0,n=this.interiorRings.length;r1&&arguments[1]!==void 0?arguments[1]:ji.compare;this.queue=t,this.tree=new i_(r),this.segments=[]}process(t){const r=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(r),n;const i=t.isLeft?this.tree.add(r):this.tree.find(r);if(!i)throw new Error(`Unable to find segment #${r.id} [${r.leftSE.point.x}, ${r.leftSE.point.y}] -> [${r.rightSE.point.x}, ${r.rightSE.point.y}] in SweepLine tree.`);let o=i,a=i,s,u;for(;s===void 0;)o=this.tree.prev(o),o===null?s=null:o.key.consumedBy===void 0&&(s=o.key);for(;u===void 0;)a=this.tree.next(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);if(t.isLeft){let l=null;if(s){const c=s.getIntersection(r);if(c!==null&&(r.isAnEndpoint(c)||(l=c),!s.isAnEndpoint(c))){const h=this._splitSafely(s,c);for(let d=0,p=h.length;d0?(this.tree.remove(r),n.push(t)):(this.segments.push(r),r.prev=s)}else{if(s&&u){const l=s.getIntersection(u);if(l!==null){if(!s.isAnEndpoint(l)){const f=this._splitSafely(s,l);for(let c=0,h=f.length;cg1)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const a=new EZ(o);let s=o.size,u=o.pop();for(;u;){const c=u.key;if(o.size===s){const d=c.segment;throw new Error(`Unable to pop() ${c.isLeft?"left":"right"} SweepEvent [${c.point.x}, ${c.point.y}] from segment #${d.id} [${d.leftSE.point.x}, ${d.leftSE.point.y}] -> [${d.rightSE.point.x}, ${d.rightSE.point.y}] from queue.`)}if(o.size>g1)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(a.segments.length>yZ)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=a.process(c);for(let d=0,p=h.length;d1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n{const o=cp(i.coordinates);r===null?r=o:r=CZ(r,o)}),n&&(r.properties=he({},n)),r}}const $s="select",zs="active";class IZ{constructor({layerService:t,tileLayerService:r,parent:n}){E(this,"layerService",void 0),E(this,"tileLayerService",void 0),E(this,"tileSourceService",void 0),E(this,"parent",void 0),E(this,"tilePickID",new Map),this.layerService=t,this.tileLayerService=r,this.parent=n,this.tileSourceService=new OZ}pickRender(t){const r=this.tileLayerService.getVisibleTileBylngLat(t.lngLat);if(r){const n=r.getMainLayer();n==null||n.layerPickService.pickRender(t)}}pick(t,r){var n=this;return ve(function*(){const o=n.parent.getContainer().pickingService;if(t.type==="RasterLayer"){const a=n.tileLayerService.getVisibleTileBylngLat(r.lngLat);if(a&&a.getMainLayer()!==void 0){const s=a.getMainLayer();return s.layerPickService.pickRasterLayer(s,r,n.parent)}return!1}return n.pickRender(r),o.pickFromPickingFBO(t,r)})()}selectFeature(t){const[r,n,i]=t,o=this.color2PickId(r,n,i);this.tilePickID.set($s,o),this.updateHighLight(r,n,i,$s)}highlightPickedFeature(t){const[r,n,i]=t,o=this.color2PickId(r,n,i);this.tilePickID.set(zs,o),this.updateHighLight(r,n,i,zs)}updateHighLight(t,r,n,i){this.tileLayerService.tiles.map(o=>{const a=o.getMainLayer();switch(i){case $s:a==null||a.hooks.beforeSelect.call([t,r,n]);break;case zs:a==null||a.hooks.beforeHighlight.call([t,r,n]);break}})}setPickState(){const t=this.tilePickID.get($s),r=this.tilePickID.get(zs);if(t){const[n,i,o]=this.pickId2Color(t);this.updateHighLight(n,i,o,$s);return}if(r){const[n,i,o]=this.pickId2Color(r);this.updateHighLight(n,i,o,zs);return}}color2PickId(t,r,n){return yo(new Uint8Array([t,r,n]))}pickId2Color(t){return La(t)}getFeatureById(t){const r=this.tileLayerService.getTiles().filter(i=>i.visible),n=[];return r.forEach(i=>{n.push(...i.getFeatureById(t))}),n}pickRasterLayer(){return!1}}function MZ(e){return e==="PolygonLayer"?XS:e==="LineLayer"?DS:Kd}function NZ(e){return["PolygonLayer","LineLayer"].indexOf(e)!==-1}class Lo extends Bn.EventEmitter{constructor(t,r){super(),E(this,"x",void 0),E(this,"y",void 0),E(this,"z",void 0),E(this,"key",void 0),E(this,"parent",void 0),E(this,"sourceTile",void 0),E(this,"visible",!0),E(this,"layers",[]),E(this,"isLoaded",!1),E(this,"tileMaskLayers",[]),E(this,"tileMask",void 0),this.parent=r,this.sourceTile=t,this.x=t.x,this.y=t.y,this.z=t.z,this.key=`${this.x}_${this.y}_${this.z}`}getLayers(){return this.layers}styleUpdate(...t){}lnglatInBounds(t){const[r,n,i,o]=this.sourceTile.bounds,{lng:a,lat:s}=t;return a>=r&&a<=i&&s>=n&&s<=o}getLayerOptions(){var t;const r=this.parent.getLayerConfig();return he(he({},r),{},{textAllowOverlap:!0,autoFit:!1,maskLayers:this.getMaskLayer(),tileMask:NZ(this.parent.type),mask:r.mask||((t=r.maskLayers)===null||t===void 0?void 0:t.length)!==0&&r.enableMask})}getMaskLayer(){const{maskLayers:t}=this.parent.getLayerConfig(),r=[];return t==null||t.forEach(n=>{if(!n.tileLayer)return r.push(n),n;const o=n.tileLayer.getTile(this.sourceTile.key),a=o==null?void 0:o.getLayers()[0];a&&r.push(a)}),r}addTileMask(){var t=this;return ve(function*(){const r=new XS({name:"mask",visible:!0,enablePicking:!1}).source({type:"FeatureCollection",features:[t.sourceTile.bboxPolygon]},{parser:{type:"geojson",featureId:"id"}}).shape("fill").color("#0f0").style({opacity:.5}),n=su(t.parent.container);r.setContainer(n),yield r.init(),t.tileMask=r;const i=t.getMainLayer();return i!==void 0&&(i.tileMask=r),r})()}addMask(t,r){var n=this;return ve(function*(){const i=su(n.parent.container);r.setContainer(i),yield r.init(),t.addMask(r),n.tileMaskLayers.push(r)})()}addLayer(t){var r=this;return ve(function*(){t.isTileLayer=!0;const n=su(r.parent.container);t.setContainer(n),r.layers.push(t),yield t.init()})()}updateVisible(t){this.visible=t,this.updateOptions("visible",t)}updateOptions(t,r){this.layers.forEach(n=>{n.updateLayerConfig({[t]:r})})}getMainLayer(){return this.layers[0]}getFeatures(t){return[]}getFeatureById(t){return[]}destroy(){var t;(t=this.tileMask)===null||t===void 0||t.destroy(),this.layers.forEach(r=>r.destroy())}}class PZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.getSourceOption(),n=r.data.features[0].properties,i=new DS().source(r.data,r.options).size(1).shape("line").color("red"),o=new Kd({minZoom:t.z-1,maxZoom:t.z+1,textAllowOverlap:!0}).source([n],{parser:{type:"json",x:"x",y:"y"}}).size(20).color("red").shape(t.key).style({stroke:"#fff",strokeWidth:2});yield t.addLayer(i),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource();return{data:{type:"FeatureCollection",features:this.sourceTile.data.layers.testTile.features},options:{parser:{type:"geojson"},transforms:t.transforms}}}}class LZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new aG(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource();return{data:this.sourceTile.data,options:{parser:{type:"image",extent:this.sourceTile.bounds},transforms:t.transforms}}}}const wZ=`layout(std140) uniform commonUniorm { vec4 u_color; float u_opacity; }; out vec4 outputColor; void main() { outputColor = u_color; outputColor.a *= u_opacity; } `,FZ=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position; layout(std140) uniform commonUniorm { vec4 u_color; float u_opacity; }; #pragma include "projection" void main() { vec4 project_pos = project_position(vec4(a_Position, 1.0)); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); } `;class BZ extends Qt{getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,color:r="#000"}=this.layer.getLayerConfig(),n={u_color:Zt(r),u_opacity:t||1};return this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"mask",vertexShader:FZ,fragmentShader:wZ,defines:t.getDefines(),triangulation:ku,depth:{enable:!1},pick:!1})]})()}clearModels(t=!0){t&&this.layerService.clear()}registerBuiltinAttributes(){return""}}const DZ={fill:BZ};class YS extends Ka{constructor(...t){super(...t),E(this,"type","MaskLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new DZ[r](t),yield t.initLayerModels()})()}getModelType(){return"fill"}}class UZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new YS(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getFeatures(t){return t?this.sourceTile.data.getTileData(t):[]}getSourceOption(){const t=this.parent.getSource(),{sourceLayer:r,featureId:n}=this.parent.getLayerConfig();return{data:{type:"FeatureCollection",features:this.getFeatures(r)},options:{parser:{type:"geojson",featureId:n},transforms:t.transforms}}}}const kZ=["rasterData"];let $Z=class extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new n_(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource(),r=this.sourceTile.data.data,{rasterData:n}=r,i=ai(r,kZ);return{data:n,options:{parser:he({type:"rasterRgb",extent:this.sourceTile.bounds},i),transforms:t.transforms}}}};class zZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new n_(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource();return{data:this.sourceTile.data,options:{parser:{type:"image",extent:this.sourceTile.bounds},transforms:t.transforms}}}}const VZ=["rasterData"],HZ={positions:[0,1],colors:["#000","#fff"]};class jZ extends Lo{constructor(...t){super(...t),E(this,"colorTexture",void 0)}initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),{rampColors:o,domain:a}=t.getLayerOptions();t.colorTexture=t.parent.textureService.getColorTexture(o,a);const s=new n_(he(he({},n),{},{colorTexture:t.colorTexture})).source(i.data,i.options);r&&Object.keys(r).forEach(u=>{var l,f;const c=u;s[c]((l=r[c])===null||l===void 0?void 0:l.field,(f=r[c])===null||f===void 0?void 0:f.values)}),yield t.addLayer(s),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource(),r=this.sourceTile.data.data,{rasterData:n}=r,i=ai(r,VZ);return{data:n,options:{parser:he({type:"raster",extent:this.sourceTile.bounds},i),transforms:t.transforms}}}styleUpdate(...t){const{rampColors:r=HZ,domain:n}=t;this.colorTexture=this.parent.textureService.getColorTexture(r,n||gp(r)),this.layers.forEach(i=>i.style({colorTexture:this.colorTexture}))}destroy(){this.layers.forEach(t=>t.destroy())}}class kl extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=MZ(t.parent.type),o=t.getSourceOption();if(!o){t.isLoaded=!0,t.emit("loaded");return}const a=new i(he({},n)).source(o.data,o.options);Object.keys(r).forEach(s=>{var u,l;const f=s;a[f]((u=r[f])===null||u===void 0?void 0:u.field,(l=r[f])===null||l===void 0?void 0:l.values)}),yield t.addLayer(a),n.tileMask&&(yield t.addTileMask()),t.setLayerMinMaxZoom(a),t.isLoaded=!0,t.emit("loaded")})()}getSourceOption(){const t=this.parent.getSource(),{sourceLayer:r="defaultLayer",featureId:n="id"}=this.parent.getLayerConfig();return{data:{type:"FeatureCollection",features:this.getFeatures(r)},options:{parser:{type:"geojson",featureId:n},transforms:t.transforms}}}setLayerMinMaxZoom(t){t.getModelType()==="text"&&t.updateLayerConfig({maxZoom:this.z+1,minZoom:this.z-1})}getFeatures(t){return this.sourceTile.data.getTileData(t)}getFeatureById(t){const r=this.getMainLayer();return r?r.getSource().data.dataArray.filter(i=>i._id===t):[]}}function XZ(e){switch(e.type){case"PolygonLayer":return kl;case"LineLayer":return kl;case"PointLayer":return kl;case"TileDebugLayer":return PZ;case"MaskLayer":return UZ;case"RasterLayer":const{dataType:r}=e.getSource().parser;switch(r){case Hr.RGB:case Hr.CUSTOMRGB:return $Z;case Hr.ARRAYBUFFER:case Hr.CUSTOMARRAYBUFFER:return jZ;case Hr.TERRAINRGB:case Hr.CUSTOMTERRAINRGB:return zZ;default:return LZ}default:return kl}}const WZ=["shape","color","size","style","animate","filter","rotate","scale","setBlend","setSelect","setActive","disableMask","enableMask","addMask","removeMask"],{debounce:GZ}=Sr;class YZ{constructor(t){E(this,"parent",void 0),E(this,"tileLayerService",void 0),E(this,"mapService",void 0),E(this,"layerService",void 0),E(this,"rendererService",void 0),E(this,"pickingService",void 0),E(this,"tilePickService",void 0),E(this,"tilesetManager",void 0),E(this,"initedTileset",!1),E(this,"lastViewStates",void 0),E(this,"mapchange",()=>{var n;if(this.parent.isVisible()===!1)return;const{latLonBounds:i,zoom:o}=this.getCurrentView();this.lastViewStates&&this.lastViewStates.zoom===o&&this.lastViewStates.latLonBounds.toString()===i.toString()||(this.lastViewStates={zoom:o,latLonBounds:i},(n=this.tilesetManager)===null||n===void 0||n.throttleUpdate(o,i))}),E(this,"viewchange",GZ(this.mapchange,24)),this.parent=t;const r=this.parent.getContainer();this.rendererService=r.rendererService,this.layerService=r.layerService,this.mapService=r.mapService,this.pickingService=r.pickingService,this.tileLayerService=new KY({rendererService:this.rendererService,layerService:this.layerService,parent:t}),this.tilePickService=new IZ({tileLayerService:this.tileLayerService,layerService:this.layerService,parent:t}),this.parent.setLayerPickService(this.tilePickService),this.proxy(t),this.initTileSetManager()}initTileSetManager(){var t;const r=this.parent.getSource();if(this.tilesetManager=r.tileset,this.initedTileset||(this.bindTilesetEvent(),this.initedTileset=!0),this.parent.isVisible()===!1)return;const{latLonBounds:n,zoom:i}=this.getCurrentView();(t=this.tilesetManager)===null||t===void 0||t.update(i,n)}getCurrentView(){const t=this.mapService.getBounds(),r=[t[0][0],t[0][1],t[1][0],t[1][1]],n=this.mapService.getZoom();return{latLonBounds:r,zoom:n}}bindTilesetEvent(){this.tilesetManager.on("tile-loaded",t=>{}),this.tilesetManager.on("tile-unload",t=>{this.tileUnLoad(t)}),this.tilesetManager.on("tile-error",(t,r)=>{this.tileError(t)}),this.tilesetManager.on("tile-update",()=>{this.tileUpdate()}),this.mapService.on("zoomend",this.mapchange),this.mapService.on("moveend",this.viewchange)}render(){this.tileLayerService.render()}getLayers(){return this.tileLayerService.getLayers()}getTiles(){return this.tileLayerService.getTiles()}getTile(t){return this.tileLayerService.getTile(t)}tileLoaded(t){}tileError(t){console.warn("error:",t)}destroy(){var t;this.mapService.off("zoomend",this.mapchange),this.mapService.off("moveend",this.viewchange),(t=this.tilesetManager)===null||t===void 0||t.destroy(),this.tileLayerService.destroy()}reload(){var t;this.tilesetManager.clear();const{latLonBounds:r,zoom:n}=this.getCurrentView();(t=this.tilesetManager)===null||t===void 0||t.update(n,r)}tileUnLoad(t){this.tileLayerService.removeTile(t.key)}tileUpdate(){var t=this;return ve(function*(){if(!t.tilesetManager)return;const r=t.parent.getMinZoom(),n=t.parent.getMaxZoom(),i=t.tilesetManager.tiles.filter(o=>o.isLoaded).filter(o=>o.isVisibleChange).filter(o=>o.data).filter(o=>o.z>=r&&o.z{const n=t[r].bind(t);t[r]=(...i)=>(n(...i),this.getLayers().map(o=>{o[r](...i)}),r==="style"&&this.getTiles().forEach(o=>o.styleUpdate(...i)),t)})}}function ZZ(e,t){var r=typeof my<"u"&&!!my&&typeof my.showToast=="function"&&my.isFRM!==!0,n=typeof wx<"u"&&wx!==null&&(typeof wx.request<"u"||typeof wx.miniProgram<"u");if(!(r||n)&&(t||(t=document),!!t)){var i=t.head||t.getElementsByTagName("head")[0];if(!i){i=t.createElement("head");var o=t.body||t.getElementsByTagName("body")[0];o?o.parentNode.insertBefore(i,o):t.documentElement.appendChild(i)}var a=t.createElement("style");return a.type="text/css",a.styleSheet?a.styleSheet.cssText=e:a.appendChild(t.createTextNode(e)),i.appendChild(a),a}}ZZ(`.l7-marker-container { position: absolute; width: 100%; height: 100%; overflow: hidden; } .l7-marker { position: absolute !important; top: 0; left: 0; z-index: 5; cursor: pointer; } .l7-marker-cluster { width: 40px; height: 40px; background-color: rgba(181, 226, 140, 0.6); background-clip: padding-box; border-radius: 20px; } .l7-marker-cluster div { width: 30px; height: 30px; margin-top: 5px; margin-left: 5px; font: 12px 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: center; background-color: rgba(110, 204, 57, 0.6); border-radius: 15px; } .l7-marker-cluster span { line-height: 30px; } .l7-touch .l7-control-attribution, .l7-touch .l7-control-layers, .l7-touch .l7-bar { box-shadow: none; } .l7-touch .l7-control-layers, .l7-touch .l7-bar { background-clip: padding-box; border: 2px solid rgba(0, 0, 0, 0.2); } .mapboxgl-ctrl-logo, .amap-logo { display: none !important; } .l7-select-box { border: 3px dashed gray; border-radius: 2px; position: absolute; z-index: 999; box-sizing: border-box; } .l7-control-container { font: 12px/1.5 'Helvetica Neue', Arial, Helvetica, sans-serif; } .l7-control-container .l7-control { position: relative; z-index: 999; float: left; clear: both; color: #595959; font-size: 12px; pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ pointer-events: auto; } .l7-control-container .l7-control.l7-control--hide { display: none; } .l7-control-container .l7-top { top: 0; display: flex; position: absolute; z-index: 999; pointer-events: none; } .l7-control-container .l7-top .l7-control:not(.l7-control--hide) { margin-top: 8px; } .l7-control-container .l7-right { right: 0; display: flex; position: absolute; z-index: 999; pointer-events: none; } .l7-control-container .l7-right .l7-control:not(.l7-control--hide) { margin-right: 8px; } .l7-control-container .l7-bottom { bottom: 0; display: flex; position: absolute; z-index: 999; pointer-events: none; } .l7-control-container .l7-bottom .l7-control:not(.l7-control--hide) { margin-bottom: 8px; } .l7-control-container .l7-left { left: 0; display: flex; position: absolute; z-index: 999; pointer-events: none; } .l7-control-container .l7-left .l7-control:not(.l7-control--hide) { margin-left: 8px; } .l7-control-container .l7-center { position: absolute; display: flex; justify-content: center; } .l7-control-container .l7-center.l7-top, .l7-control-container .l7-center.l7-bottom { width: 100%; } .l7-control-container .l7-center.l7-left, .l7-control-container .l7-center.l7-right { height: 100%; } .l7-control-container .l7-center .l7-control { margin-right: 8px; margin-bottom: 8px; } .l7-control-container .l7-row { flex-direction: row; } .l7-control-container .l7-row.l7-top { align-items: flex-start; } .l7-control-container .l7-row.l7-bottom { align-items: flex-end; } .l7-control-container .l7-column { flex-direction: column; } .l7-control-container .l7-column.l7-left { align-items: flex-start; } .l7-control-container .l7-column.l7-right { align-items: flex-end; } .l7-button-control { min-width: 28px; height: 28px; background-color: #fff; border-width: 0; border-radius: 2px; outline: 0; cursor: pointer; transition: all 0.2s; display: flex; justify-content: center; align-items: center; padding: 0 6px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15); line-height: 16px; } .l7-button-control .l7-iconfont { fill: #595959; color: #595959; width: 16px; height: 16px; } .l7-button-control.l7-button-control--row { padding: 0 16px 0 13px; } .l7-button-control.l7-button-control--row * + .l7-button-control__text { margin-left: 8px; } .l7-button-control.l7-button-control--column { height: 44px; flex-direction: column; } .l7-button-control.l7-button-control--column .l7-iconfont { margin-top: 3px; } .l7-button-control.l7-button-control--column .l7-button-control__text { margin-top: 3px; font-size: 10px; -webkit-transform: scale(0.83333); transform: scale(0.83333); } .l7-button-control:not(:disabled):hover { background-color: #f3f3f3; } .l7-button-control:not(:disabled):active { background-color: #f3f3f3; } .l7-button-control:disabled { background-color: #fafafa; color: #bdbdbd; cursor: not-allowed; } .l7-button-control:disabled .l7-iconfont { fill: #bdbdbd; color: #bdbdbd; } .l7-button-control:disabled:hover { background-color: #fafafa; } .l7-button-control:disabled:active { background-color: #fafafa; } .l7-popper { position: absolute; display: flex; justify-content: center; align-items: center; z-index: 5; color: #595959; } .l7-popper.l7-popper-hide { display: none; } .l7-popper .l7-popper-content { min-height: 28px; background: #fff; border-radius: 2px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15); } .l7-popper .l7-popper-arrow { width: 0; height: 0; border-width: 4px; border-style: solid; border-top-color: transparent; border-bottom-color: transparent; border-left-color: transparent; border-right-color: transparent; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15); } .l7-popper.l7-popper-left { flex-direction: row; } .l7-popper.l7-popper-left .l7-popper-arrow { border-left-color: #fff; margin: 10px 0; } .l7-popper.l7-popper-right { flex-direction: row-reverse; } .l7-popper.l7-popper-right .l7-popper-arrow { border-right-color: #fff; margin: 10px 0; } .l7-popper.l7-popper-top { flex-direction: column; } .l7-popper.l7-popper-top .l7-popper-arrow { border-top-color: #fff; margin: 0 10px; } .l7-popper.l7-popper-bottom { flex-direction: column-reverse; } .l7-popper.l7-popper-bottom .l7-popper-arrow { border-bottom-color: #fff; margin: 0 10px; } .l7-popper.l7-popper-start { align-items: flex-start; } .l7-popper.l7-popper-end { align-items: flex-end; } .l7-select-control--normal { padding: 4px 0; } .l7-select-control--normal .l7-select-control-item { display: flex; align-items: center; height: 24px; padding: 0 16px; font-size: 12px; line-height: 24px; } .l7-select-control--normal .l7-select-control-item > * + * { margin-left: 6px; } .l7-select-control--normal .l7-select-control-item input[type='checkbox'] { width: 14px; height: 14px; } .l7-select-control--normal .l7-select-control-item:hover { background-color: #f3f3f3; } .l7-select-control--image { display: flex; flex-wrap: wrap; align-items: flex-start; box-sizing: content-box; max-width: 460px; max-height: 400px; margin: 12px 0 0 12px; overflow-x: hidden; overflow-y: auto; } .l7-select-control--image .l7-select-control-item { position: relative; display: flex; flex: 0 0 calc((100% - (12px + 9px) * 2) / 3); flex-direction: column; justify-content: center; box-sizing: content-box; margin-right: 12px; margin-bottom: 12px; overflow: hidden; font-size: 12px; border: 1px solid #fff; border-radius: 2px; } .l7-select-control--image .l7-select-control-item img { width: 100%; height: 80px; } .l7-select-control--image .l7-select-control-item input[type='checkbox'] { position: absolute; top: 0; right: 0; } .l7-select-control--image .l7-select-control-item .l7-select-control-item-row { display: flex; align-items: center; justify-content: center; line-height: 26px; } .l7-select-control--image .l7-select-control-item .l7-select-control-item-row > * + * { margin-left: 8px; } .l7-select-control--image .l7-select-control-item.l7-select-control-item-active { border-color: #0370fe; } .l7-select-control-item { cursor: pointer; } .l7-select-control-item input[type='checkbox'] { margin: 0; cursor: pointer; } .l7-select-control--multiple .l7-select-control-item:hover { background-color: transparent; } .l7-control-logo { width: 89px; height: 16px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .l7-control-logo img { height: 100%; width: 100%; } .l7-control-logo .l7-control-logo-link { display: block; cursor: pointer; } .l7-control-logo .l7-control-logo-link img { cursor: pointer; } .l7-control-mouse-location { background-color: #fff; border-radius: 2px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15); padding: 2px 4px; min-width: 130px; } .l7-control-zoom { overflow: hidden; border-radius: 2px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15); } .l7-control-zoom .l7-button-control { font-size: 16px; border-bottom: 1px solid #f0f0f0; border-radius: 0; box-shadow: 0 0 0; } .l7-control-zoom .l7-button-control .l7-iconfont { width: 14px; height: 14px; } .l7-control-zoom .l7-button-control:last-child { border-bottom: 0; } .l7-control-zoom .l7-control-zoom__number { color: #595959; padding: 0; } .l7-control-zoom .l7-control-zoom__number:hover { background-color: #fff; } .l7-control-scale { display: flex; flex-direction: column; } .l7-control-scale .l7-control-scale-line { box-sizing: border-box; padding: 2px 5px 1px; overflow: hidden; color: #595959; font-size: 10px; line-height: 1.1; white-space: nowrap; background: #fff; border: 2px solid #000; border-top: 0; transition: width 0.1s; } .l7-control-scale .l7-control-scale-line + .l7-control-scale .l7-control-scale-line { margin-top: -2px; border-top: 2px solid #777; border-bottom: none; } .l7-right .l7-control-scale { display: flex; align-items: flex-end; } .l7-right .l7-control-scale .l7-control-scale-line { text-align: right; } .l7-popup { position: absolute; top: 0; left: 0; z-index: 5; display: flex; will-change: transform; pointer-events: none; } .l7-popup.l7-popup-hide { display: none; } .l7-popup .l7-popup-content { position: relative; padding: 16px; font-size: 14px; background: #fff; border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); } .l7-popup .l7-popup-content .l7-popup-content__title { margin-bottom: 8px; font-weight: bold; } .l7-popup .l7-popup-content .l7-popup-close-button, .l7-popup .l7-popup-content .l7-popup-content__title, .l7-popup .l7-popup-content .l7-popup-content__panel { white-space: normal; -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; pointer-events: initial; } .l7-popup .l7-popup-content .l7-popup-close-button { position: absolute; top: 0; right: 0; width: 18px; height: 18px; padding: 0; font-size: 14px; line-height: 18px; text-align: center; background-color: transparent; border: 0; border-radius: 0 3px 0 0; cursor: pointer; } .l7-popup .l7-popup-tip { position: relative; z-index: 1; width: 0; height: 0; border: 10px solid transparent; } .l7-popup.l7-popup-anchor-bottom, .l7-popup.l7-popup-anchor-bottom-left, .l7-popup.l7-popup-anchor-bottom-right { flex-direction: column-reverse; } .l7-popup.l7-popup-anchor-bottom .l7-popup-tip, .l7-popup.l7-popup-anchor-bottom-left .l7-popup-tip, .l7-popup.l7-popup-anchor-bottom-right .l7-popup-tip { bottom: 1px; } .l7-popup.l7-popup-anchor-top, .l7-popup.l7-popup-anchor-top-left, .l7-popup.l7-popup-anchor-top-right { flex-direction: column; } .l7-popup.l7-popup-anchor-top .l7-popup-tip, .l7-popup.l7-popup-anchor-top-left .l7-popup-tip, .l7-popup.l7-popup-anchor-top-right .l7-popup-tip { top: 1px; } .l7-popup.l7-popup-anchor-left { flex-direction: row; } .l7-popup.l7-popup-anchor-right { flex-direction: row-reverse; } .l7-popup-anchor-top .l7-popup-tip { position: relative; align-self: center; border-top: none; border-bottom-color: #fff; } .l7-popup-anchor-top-left .l7-popup-tip { align-self: flex-start; border-top: none; border-bottom-color: #fff; border-left: none; } .l7-popup-anchor-top-right .l7-popup-tip { align-self: flex-end; border-top: none; border-right: none; border-bottom-color: #fff; } .l7-popup-anchor-bottom .l7-popup-tip { align-self: center; border-top-color: #fff; border-bottom: none; } .l7-popup-anchor-bottom-left .l7-popup-tip { align-self: flex-start; border-top-color: #fff; border-bottom: none; border-left: none; } .l7-popup-anchor-bottom-right .l7-popup-tip { align-self: flex-end; border-top-color: #fff; border-right: none; border-bottom: none; } .l7-popup-anchor-left .l7-popup-tip { align-self: center; border-right-color: #fff; border-left: none; } .l7-popup-anchor-right .l7-popup-tip { right: 1px; align-self: center; border-right: none; border-left-color: #fff; } .l7-popup-anchor-top-left .l7-popup-content { border-top-left-radius: 0; } .l7-popup-anchor-top-right .l7-popup-content { border-top-right-radius: 0; } .l7-popup-anchor-bottom-left .l7-popup-content { border-bottom-left-radius: 0; } .l7-popup-anchor-bottom-right .l7-popup-content { border-bottom-right-radius: 0; } .l7-popup-track-pointer { display: none; } .l7-popup-track-pointer * { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; pointer-events: none; } .l7-map:hover .l7-popup-track-pointer { display: flex; } .l7-map:active .l7-popup-track-pointer { display: none; } .l7-layer-popup__row { font-size: 12px; } .l7-layer-popup__row + .l7-layer-popup__row { margin-top: 4px; } .l7-control-swipe { position: absolute; top: 50%; left: 50%; z-index: 6; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); touch-action: none; } .l7-control-swipe_hide { display: none; } .l7-control-swipe:before { position: absolute; top: -5000px; bottom: -5000px; left: 50%; z-index: -1; width: 4px; background: #fff; -webkit-transform: translate(-2px, 0); transform: translate(-2px, 0); content: ''; } .l7-control-swipe.horizontal:before { top: 50%; right: -5000px; bottom: auto; left: -5000px; width: auto; height: 4px; } .l7-control-swipe__button { display: block; width: 28px; height: 28px; margin: 0; padding: 0; color: #595959; font-weight: bold; font-size: inherit; text-align: center; text-decoration: none; background-color: #fff; border: none; border-radius: 2px; outline: none; } .l7-control-swipe, .l7-control-swipe__button { cursor: ew-resize; } .l7-control-swipe.horizontal, .l7-control-swipe.horizontal button { cursor: ns-resize; } .l7-control-swipe:after, .l7-control-swipe__button:before, .l7-control-swipe__button:after { position: absolute; top: 25%; bottom: 25%; left: 50%; width: 2px; background: currentColor; -webkit-transform: translate(-1px, 0); transform: translate(-1px, 0); content: ''; } .l7-control-swipe__button:after { -webkit-transform: translateX(4px); transform: translateX(4px); } .l7-control-swipe__button:before { -webkit-transform: translateX(-6px); transform: translateX(-6px); } `);class qZ{constructor(t){E(this,"configService",void 0),E(this,"config",void 0),this.config=t}setContainer(t,r){this.configService=t.globalConfigService,t.mapConfig=he(he({},this.config),{},{id:r}),t.mapService=new(this.getServiceConstructor())(t)}getServiceConstructor(){throw new Error("Method not implemented.")}}var ZS={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(mo,function(){function r(c){var h=[];return c.AMapUI&&h.push(n(c.AMapUI)),c.Loca&&h.push(i(c.Loca)),Promise.all(h)}function n(c){return new Promise(function(h,d){var p=[];if(c.plugins)for(var v=0;veq&&t?this.coordinateSystemService.setCoordinateSystem(vc.LNGLAT_OFFSET):this.coordinateSystemService.setCoordinateSystem(vc.LNGLAT)}creatMapContainer(t){let r;return typeof t=="string"?r=document.getElementById(t):r=t,r}getMapStyleValue(t){var r;return(r=this.getMapStyleConfig()[t])!==null&&r!==void 0?r:t}setBgColor(t){this.bgColor=t}getMapContainer(){return this.mapContainer}getMarkerContainer(){return this.markerContainer}getOverlayContainer(){}getCanvasOverlays(){}emit(t,...r){this.eventEmitter.emit(t,...r)}once(t,r){this.eventEmitter.once(t,r)}meterToCoord(t,r){return 1}destroy(){this.eventEmitter.removeAllListeners()}}function rq(e){if(Array.isArray(e))return e}function nq(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(f){l=!0,i=f}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}function iq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ln(e,t){return rq(e)||nq(e,t)||kR(e,t)||iq()}function uu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function tc(e,t){var r=$p([],t,e);return P9(r,r,1/r[3]),r}function Co(e,t){if(!e)throw new Error(t||"viewport-mercator-project: assertion failed.")}var Yn=Math.PI,qS=Yn/4,Xi=Yn/180,E1=180/Yn,o_=512,y1=4003e4,oq=1.5;function KS(e){return Math.pow(2,e)}function td(e,t){var r=Ln(e,2),n=r[0],i=r[1];Co(Number.isFinite(n)&&Number.isFinite(t)),Co(Number.isFinite(i)&&i>=-90&&i<=90,"invalid latitude"),t*=o_;var o=n*Xi,a=i*Xi,s=t*(o+Yn)/(2*Yn),u=t*(Yn-Math.log(Math.tan(qS+a*.5)))/(2*Yn);return[s,u]}function T1(e,t){var r=Ln(e,2),n=r[0],i=r[1];t*=o_;var o=n/t*(2*Yn)-Yn,a=2*(Math.atan(Math.exp(Yn-i/t*(2*Yn)))-qS);return[o*E1,a*E1]}function aq(e){var t=e.latitude,r=e.longitude,n=e.zoom,i=e.scale,o=e.highPrecision,a=o===void 0?!1:o;i=i!==void 0?i:KS(n),Co(Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i));var s={},u=o_*i,l=Math.cos(t*Xi),f=u/360,c=f/l,h=u/y1/l;if(s.pixelsPerMeter=[h,-h,h],s.metersPerPixel=[1/h,-1/h,1/h],s.pixelsPerDegree=[f,-c,h],s.degreesPerPixel=[1/f,-1/c,1/h],a){var d=Xi*Math.tan(t*Xi)/l,p=f*d/2,v=u/y1*d,g=v/c*h;s.pixelsPerDegree2=[0,-p,v],s.pixelsPerMeter2=[g,0,g]}return s}function sq(e){var t=e.height,r=e.pitch,n=e.bearing,i=e.altitude,o=e.center,a=o===void 0?null:o,s=e.flipY,u=s===void 0?!1:s,l=uu();return mc(l,l,[0,0,-i]),gc(l,l,[1,1,1/t]),kp(l,l,-r*Xi),fA(l,l,n*Xi),u&&gc(l,l,[1,-1,1]),a&&mc(l,l,O9([],a)),l}function uq(e){var t=e.width,r=e.height,n=e.altitude,i=n===void 0?oq:n,o=e.pitch,a=o===void 0?0:o,s=e.nearZMultiplier,u=s===void 0?1:s,l=e.farZMultiplier,f=l===void 0?1:l,c=a*Xi,h=Math.atan(.5/i),d=Math.sin(h)*i/Math.sin(Math.PI/2-c-h),p=Math.cos(Math.PI/2-c)*d+i;return{fov:2*Math.atan(r/2/i),aspect:t/r,focalDistance:i,near:u,far:p*f}}function lq(e){var t=e.width,r=e.height,n=e.pitch,i=e.altitude,o=e.nearZMultiplier,a=e.farZMultiplier,s=uq({width:t,height:r,altitude:i,pitch:n,nearZMultiplier:o,farZMultiplier:a}),u=s.fov,l=s.aspect,f=s.near,c=s.far,h=R9([],u,l,f,c);return h}function cq(e,t){var r=Ln(e,3),n=r[0],i=r[1],o=r[2],a=o===void 0?0:o;return Co(Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(a)),tc(t,[n,i,a,1])}function QS(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Ln(e,3),i=n[0],o=n[1],a=n[2];if(Co(Number.isFinite(i)&&Number.isFinite(o),"invalid pixel coordinate"),Number.isFinite(a)){var s=tc(t,[i,o,a,1]);return s}var u=tc(t,[i,o,0,1]),l=tc(t,[i,o,1,1]),f=u[2],c=l[2],h=f===c?0:((r||0)-f)/(c-f);return F9([],u,l,h)}var A1=uu(),fq=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.width,n=t.height,i=t.viewMatrix,o=i===void 0?A1:i,a=t.projectionMatrix,s=a===void 0?A1:a;cy(this,e),this.width=r||1,this.height=n||1,this.scale=1,this.pixelsPerMeter=1,this.viewMatrix=o,this.projectionMatrix=s;var u=uu();Oa(u,u,this.projectionMatrix),Oa(u,u,this.viewMatrix),this.viewProjectionMatrix=u;var l=uu();gc(l,l,[this.width/2,-this.height/2,1]),mc(l,l,[1,-1,0]),Oa(l,l,this.viewProjectionMatrix);var f=lA(uu(),l);if(!f)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=l,this.pixelUnprojectionMatrix=f,this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}return ly(e,[{key:"equals",value:function(r){return r instanceof e?r.width===this.width&&r.height===this.height&&lg(r.projectionMatrix,this.projectionMatrix)&&lg(r.viewMatrix,this.viewMatrix):!1}},{key:"project",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.topLeft,o=i===void 0?!0:i,a=this.projectPosition(r),s=cq(a,this.pixelProjectionMatrix),u=Ln(s,2),l=u[0],f=u[1],c=o?f:this.height-f;return r.length===2?[l,c]:[l,c,s[2]]}},{key:"unproject",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.topLeft,o=i===void 0?!0:i,a=n.targetZ,s=Ln(r,3),u=s[0],l=s[1],f=s[2],c=o?l:this.height-l,h=a&&a*this.pixelsPerMeter,d=QS([u,c,f],this.pixelUnprojectionMatrix,h),p=this.unprojectPosition(d),v=Ln(p,3),g=v[0],y=v[1],S=v[2];return Number.isFinite(f)?[g,y,S]:Number.isFinite(a)?[g,y,a]:[g,y]}},{key:"projectPosition",value:function(r){var n=this.projectFlat(r),i=Ln(n,2),o=i[0],a=i[1],s=(r[2]||0)*this.pixelsPerMeter;return[o,a,s]}},{key:"unprojectPosition",value:function(r){var n=this.unprojectFlat(r),i=Ln(n,2),o=i[0],a=i[1],s=(r[2]||0)/this.pixelsPerMeter;return[o,a,s]}},{key:"projectFlat",value:function(r){return arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale,r}},{key:"unprojectFlat",value:function(r){return arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale,r}}]),e}();function hq(e){var t=e.width,r=e.height,n=e.bounds,i=e.minExtent,o=i===void 0?0:i,a=e.maxZoom,s=a===void 0?24:a,u=e.padding,l=u===void 0?0:u,f=e.offset,c=f===void 0?[0,0]:f,h=Ln(n,2),d=Ln(h[0],2),p=d[0],v=d[1],g=Ln(h[1],2),y=g[0],S=g[1];if(Number.isFinite(l)){var R=l;l={top:R,bottom:R,left:R,right:R}}else Co(Number.isFinite(l.top)&&Number.isFinite(l.bottom)&&Number.isFinite(l.left)&&Number.isFinite(l.right));var x=new ip({width:t,height:r,longitude:0,latitude:0,zoom:0}),M=x.project([p,S]),$=x.project([y,v]),F=[Math.max(Math.abs($[0]-M[0]),o),Math.max(Math.abs($[1]-M[1]),o)],Y=[t-l.left-l.right-Math.abs(c[0])*2,r-l.top-l.bottom-Math.abs(c[1])*2];Co(Y[0]>0&&Y[1]>0);var ge=Y[0]/F[0],q=Y[1]/F[1],k=(l.right-l.left)/2/ge,G=(l.bottom-l.top)/2/q,K=[($[0]+M[0])/2+k,($[1]+M[1])/2+G],ce=x.unproject(K),Pe=x.zoom+Math.log2(Math.abs(Math.min(ge,q)));return{longitude:ce[0],latitude:ce[1],zoom:Math.min(Pe,s)}}var ip=function(e){$R(t,e);function t(){var r,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.width,o=n.height,a=n.latitude,s=a===void 0?0:a,u=n.longitude,l=u===void 0?0:u,f=n.zoom,c=f===void 0?0:f,h=n.pitch,d=h===void 0?0:h,p=n.bearing,v=p===void 0?0:p,g=n.altitude,y=g===void 0?1.5:g,S=n.nearZMultiplier,R=n.farZMultiplier;cy(this,t),i=i||1,o=o||1;var x=KS(c);y=Math.max(.75,y);var M=td([l,s],x);M[2]=0;var $=lq({width:i,height:o,pitch:d,bearing:v,altitude:y,nearZMultiplier:S||1/o,farZMultiplier:R||1.01}),F=sq({height:o,center:M,pitch:d,bearing:v,altitude:y,flipY:!0});return r=zR(this,VR(t).call(this,{width:i,height:o,viewMatrix:F,projectionMatrix:$})),r.latitude=s,r.longitude=l,r.zoom=c,r.pitch=d,r.bearing=v,r.altitude=y,r.scale=x,r.center=M,r.pixelsPerMeter=aq(bl(bl(r))).pixelsPerMeter[2],Object.freeze(bl(bl(r))),r}return ly(t,[{key:"projectFlat",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale;return td(n,i)}},{key:"unprojectFlat",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale;return T1(n,i)}},{key:"getMapCenterByLngLatPosition",value:function(n){var i=n.lngLat,o=n.pos,a=QS(o,this.pixelUnprojectionMatrix),s=td(i,this.scale),u=ki([],s,w9([],a)),l=ki([],this.center,u);return T1(l,this.scale)}},{key:"getLocationAtPoint",value:function(n){var i=n.lngLat,o=n.pos;return this.getMapCenterByLngLatPosition({lngLat:i,pos:o})}},{key:"fitBounds",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.width,a=this.height,s=hq(Object.assign({width:o,height:a,bounds:n},i)),u=s.longitude,l=s.latitude,f=s.zoom;return new t({width:o,height:a,longitude:u,latitude:l,zoom:f})}}]),t}(fq);class dq{constructor(){E(this,"viewport",new ip)}syncWithMapCamera(t){const{center:r,zoom:n,pitch:i,bearing:o,viewportHeight:a,viewportWidth:s}=t,u={width:this.viewport.width,height:this.viewport.height,longitude:this.viewport.center[0],latitude:this.viewport.center[1],zoom:this.viewport.zoom,pitch:this.viewport.pitch,bearing:this.viewport.bearing};this.viewport=new ip(he(he({},u),{},{width:s,height:a,longitude:r&&r[0],latitude:r&&r[1],zoom:n,pitch:i,bearing:o}))}getZoom(){return this.viewport.zoom}getZoomScale(){return Math.pow(2,this.getZoom())}getCenter(){return[this.viewport.longitude,this.viewport.latitude]}getProjectionMatrix(){return this.viewport.projectionMatrix}getModelMatrix(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}getViewMatrix(){return this.viewport.viewMatrix}getViewMatrixUncentered(){return this.viewport.viewMatrixUncentered}getViewProjectionMatrix(){return this.viewport.viewProjectionMatrix}getViewProjectionMatrixUncentered(){return this.viewport.viewProjectionMatrix}getFocalDistance(){return 1}projectFlat(t,r){return this.viewport.projectFlat(t,r)}}let pq=function(e){return e.GAODE="GAODE",e.MAPBOX="MAPBOX",e.DEFAULT="DEFAUlTMAP",e.SIMPLE="SIMPLE",e.GLOBEL="GLOBEL",e}({});function S1(e={}){const t={top:0,right:0,bottom:0,left:0};if(typeof e=="number")return{top:e,right:e,bottom:e,left:e};if(Array.isArray(e)){if(e.length===4)return{top:e[0],right:e[1],bottom:e[2],left:e[3]};if(e.length===2)return{top:e[0],right:e[1],bottom:e[0],left:e[1]}}return he(he({},t),e)}const _q={normal:"amap://styles/normal",light:"amap://styles/c422f5c0cfced5be9fe3a83f05f28a68?isPublic=true",dark:"amap://styles/c9f1d10cae34f8ab05e425462c5a58d7?isPublic=true",blank:"amap://styles/07c17002b38775b32a7a76c66cf90e99?isPublic=true",fresh:"amap://styles/fresh",grey:"amap://styles/grey",graffiti:"amap://styles/graffiti",macaron:"amap://styles/macaron",darkblue:"amap://styles/darkblue",wine:"amap://styles/wine"},vq=["id","style","minZoom","maxZoom","token","mapInstance","plugin"];function mq(e,t){var r=typeof my<"u"&&!!my&&typeof my.showToast=="function"&&my.isFRM!==!0,n=typeof wx<"u"&&wx!==null&&(typeof wx.request<"u"||typeof wx.miniProgram<"u");if(!(r||n)&&(t||(t=document),!!t)){var i=t.head||t.getElementsByTagName("head")[0];if(!i){i=t.createElement("head");var o=t.body||t.getElementsByTagName("body")[0];o?o.parentNode.insertBefore(i,o):t.documentElement.appendChild(i)}var a=t.createElement("style");return a.type="text/css",a.styleSheet?a.styleSheet.cssText=e:a.appendChild(t.createTextNode(e)),i.appendChild(a),a}}mq(`.amap-logo { display: none !important; } .amap-copyright { display: none !important; } .amap-overlays { z-index: 3 !important; } `);const gq="2.0",x1="f59bcf249433f8b05caaee19f349b3d7",po=1,b1={contextmenu:"rightclick",camerachange:"viewchange"};class Eq extends tq{constructor(...t){super(...t),E(this,"viewport",new dq),E(this,"version",pq.GAODE),E(this,"handleCameraChanged",()=>{const r=this.getViewState();this.updateView(r)})}getType(){return"amap"}init(){var t=this;return ve(function*(){const r=t.config,{id:n,style:i="light",minZoom:o=0,maxZoom:a=24,token:s=x1,mapInstance:u,plugin:l=[]}=r,f=ai(r,vq);if(window.AMap||u||(l.push("Map3D"),yield QZ.load({key:s,version:gq,plugins:l})),u)t.map=u,t.mapContainer=t.map.getContainer(),t.map.on("viewchange",t.handleCameraChanged);else{const c=he({mapStyle:t.getMapStyleValue(i),zooms:[o,a],viewMode:"3D"},f);if(c.zoom&&(c.zoom+=po),s===x1&&(window._AMapSecurityConfig={securityJsCode:"2653011adeb04230b3a26cc9a780a800"},console.warn(`%c${t.configService.getSceneWarninfo("MapToken")}!`,"color: #873bf4;font-weigh:900;font-size: 16px;")),!n)throw Error("No container id specified");window.forceWebGL=!0,t.mapContainer=t.creatMapContainer(n);const h=new AMap.Map(t.mapContainer,c);t.map=h,h.on("viewchange",t.handleCameraChanged)}t.syncInitViewPort()})()}syncInitViewPort(){const t=this.getViewState();this.updateView(t)}getViewState(){const{center:t,zoom:r}=yq(this.map);return{center:t,viewportWidth:this.map.getContainer().clientWidth,viewportHeight:this.map.getContainer().clientHeight,bearing:-this.map.getRotation(),pitch:this.map.getPitch(),zoom:r-po}}creatMapContainer(t){const r=super.creatMapContainer(t),n=document.createElement("div");return n.style.cssText+=` position: absolute; top: 0; height: 100%; width: 100%; `,n.id=Sr.uniqueId("l7_amap_div"),r.appendChild(n),n}getContainer(){return this.map.getContainer()}addMarkerContainer(){if(!this.map)return;const t=this.map.getContainer();if(t!==null){const r=t.getElementsByClassName("amap-maps")[0];r.style.zIndex="auto",this.markerContainer=yn("div","l7-marker-container2",r)}}getMarkerContainer(){return this.markerContainer}getCanvasOverlays(){var t;return(t=this.mapContainer)===null||t===void 0?void 0:t.querySelector(".amap-overlays")}on(t,r){Jm.indexOf(t)!==-1?this.eventEmitter.on(t,r):this.map.on(b1[t]||t,r)}off(t,r){Jm.indexOf(t)!==-1?this.eventEmitter.off(t,r):this.map.off(b1[t]||t,r)}getSize(){const t=this.map.getSize();return[t.getWidth(),t.getHeight()]}getMinZoom(){return this.map.getZooms()[0]-po}getMaxZoom(){return this.map.getZooms()[1]-po}getZoom(){return this.map.getZoom()-po}getCenter(t){if(t!=null&&t.padding){const n=this.getCenter(),i=S1(t.padding),o=this.lngLatToPixel([n.lng,n.lat]),a=[(i.right-i.left)/2,(i.bottom-i.top)/2];return this.pixelToLngLat([o.x-a[0],o.y-a[1]])}const r=this.map.getCenter();return{lng:r.getLng(),lat:r.getLat()}}getPitch(){return this.map.getPitch()}getRotation(){return 360-this.map.getRotation()}getBounds(){const t=this.map.getBounds(),r=t.getNorthEast(),n=t.getSouthWest(),i=this.getCenter(),o=i.lng>r.getLng()||i.lngr?r:e},ya=function(e){return Sq(e,"Number")},op=function(e,t){return op=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},op(e,t)};function sr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");op(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var nr=function(){return nr=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xn(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Vs(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n>>8&255}function si(e){return e>>>16&255}function ka(e){return e&255}function tx(e){switch(e){case de.F32:case de.U32:case de.S32:return 4;case de.U16:case de.S16:case de.F16:return 2;case de.U8:case de.S8:return 1;default:throw new Error("whoops")}}function rx(e){return tx(si(e))}function Cq(e){var t=tx(si(e)),r=a_(e);return t*r}function nx(e){var t=ka(e);if(t&$e.Depth)return or.Depth;if(t&$e.Normalized)return or.Float;var r=si(e);if(r===de.F16||r===de.F32)return or.Float;if(r===de.U8||r===de.U16||r===de.U32)return or.Uint;if(r===de.S8||r===de.S16||r===de.S32)return or.Sint;throw new Error("whoops")}function ht(e,t){if(t===void 0&&(t=""),!e)throw new Error("Assert fail: ".concat(t))}function Eo(e){if(e!=null)return e;throw new Error("Missing object")}function ix(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}function ox(e,t){e.r=t.r,e.g=t.g,e.b=t.b,e.a=t.a}function ax(e){var t=e.r,r=e.g,n=e.b,i=e.a;return{r:t,g:r,b:n,a:i}}function zu(e,t,r,n){return n===void 0&&(n=1),{r:e,g:t,b:r,a:n}}var vf=zu(0,0,0,0);zu(0,0,0,1);var Oq=zu(1,1,1,0);zu(1,1,1,1);function kc(e){return!!(e&&!(e&e-1))}function Fi(e,t){return e??t}function Iq(e){return e===void 0?null:e}function $c(e,t){var r=t-1;return e+r&~r}function Mq(e,t){for(var r=new Array(e),n=0;n1,u=r.replace(`\r `,` `).split(` `).map(function($){return $.replace(/[/][/].*$/,"")}).filter(function($){var F=!$||/^\s+$/.test($);return!F}),l="";n!==null&&(l=Object.keys(n).map(function($){return Hs($,n[$])}).join(` `));var f=u.find(function($){return $.startsWith("precision")})||"precision mediump float;",c=i?u.filter(function($){return!$.startsWith("precision")}).join(` `):u.join(` `),h="";if(e.viewportOrigin===Zn.UPPER_LEFT&&(h+="".concat(Hs("VIEWPORT_ORIGIN_TL","1"),` `)),e.clipSpaceNearZ===Ua.ZERO&&(h+="".concat(Hs("CLIPSPACE_NEAR_ZERO","1"),` `)),e.explicitBindingLocations){var d=0,p=0,v=0;c=c.replace(/^\s*(layout\((.*)\))?\s*uniform(.+{)$/gm,function($,F,Y,ge){var q=Y?"".concat(Y,", "):"";return"layout(".concat(q,"set = ").concat(d,", binding = ").concat(p++,") uniform ").concat(ge)}),d++,p=0,ht(e.separateSamplerTextures),c=c.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,function($,F,Y,ge,q){var k=F1(Y);k===null&&(k=p++);var G=Xn(B1(ge),2),K=G[0],ce=G[1];return t==="frag"?` layout(set = `.concat(d,", binding = ").concat(k*2+0,") uniform texture").concat(K," T_").concat(q,`; layout(set = `).concat(d,", binding = ").concat(k*2+1,") uniform sampler").concat(ce," S_").concat(q,";").trim():""}),c=c.replace(t==="frag"?/^\s*\b(varying|in)\b/gm:/^\s*\b(varying|out)\b/gm,function($,F){return"layout(location = ".concat(v++,") ").concat(F)}),h+="".concat(Hs("gl_VertexID","gl_VertexIndex"),` `),h+="".concat(Hs("gl_InstanceID","gl_InstanceIndex"),` `),f=f.replace(/^precision (.*) sampler(.*);$/gm,"")}else{var g=0;c=c.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,function($,F,Y,ge,q){var k=F1(Y);return k===null&&(k=g++),"uniform sampler".concat(ge," ").concat(q,"; // BINDING=").concat(k)})}if(c=c.replace(/\bPU_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"SAMPLER_".concat(F,"(P_").concat(Y,")")}),c=c.replace(/\bPF_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"PP_SAMPLER_".concat(F,"(P_").concat(Y,")")}),c=c.replace(/\bPU_TEXTURE\((.*?)\)/g,function($,F){return"TEXTURE(P_".concat(F,")")}),e.separateSamplerTextures)c=c.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){var ge=Xn(B1(F),2),q=ge[0],k=ge[1];return"texture".concat(q," T_P_").concat(Y,", sampler").concat(k," S_P_").concat(Y)}),c=c.replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"T_".concat(Y,", S_").concat(Y)}),c=c.replace(/\bSAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"sampler".concat(F,"(T_").concat(Y,", S_").concat(Y,")")}),c=c.replace(/\bTEXTURE\((.*?)\)/g,function($,F){return"T_".concat(F)});else{var y=[];c=c.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"sampler".concat(F," P_").concat(Y)}),c=c.replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return Y}),c=c.replace(/\bSAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return y.push([Y,F]),Y}),a&&y.forEach(function($){var F=Xn($,2),Y=F[0],ge=F[1];c=c.replace(new RegExp("texture\\(".concat(Y),"g"),function(){return"texture".concat(ge,"(").concat(Y)})}),c=c.replace(/\bTEXTURE\((.*?)\)/g,function($,F){return F})}var S="".concat(a?"":e.glslVersion,` `).concat(a&&s?`#extension GL_EXT_draw_buffers : require `:"",` `).concat(a&&t==="frag"?`#extension GL_OES_standard_derivatives : enable `:"").concat(i?f:"",` `).concat(h||"").concat(l?l+` `:"",` `).concat(c,` `).trim();if(e.explicitBindingLocations&&t==="frag"&&(S=S.replace(/^\b(out)\b/g,function($,F){return"layout(location = 0) ".concat(F)})),a){if(t==="frag"&&(S=S.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"varying ".concat(F," ").concat(Y,`; `)})),t==="vert"&&(S=S.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"varying ".concat(F," ").concat(Y,`; `)}),S=S.replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"attribute ".concat(F," ").concat(Y,`; `)})),S=S.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,function($,F){return F.trim().replace(/^.*$/gm,function(Y){var ge=Y.trim();return ge.startsWith("#")?ge:Y?"uniform ".concat(ge):""})}),t==="frag")if(s){var R=[];S=S.replace(/^\s*layout\(location\s*=\s*\d*\)\s*out\s+vec4\s*(.*);$/gm,function($,F){return R.push(F),"vec4 ".concat(F,`; `)});var x=S.lastIndexOf("}");S=S.substring(0,x)+` `.concat(R.map(function($,F){return"gl_FragData[".concat(F,"] = ").concat($,`; `)}).join(` `))+S.substring(x)}else{var M;if(S=S.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function($,F,Y){return M=Y,"".concat(F," ").concat(Y,`; `)}),M){var x=S.lastIndexOf("}");S=S.substring(0,x)+` gl_FragColor = vec4(`.concat(M,`); `)+S.substring(x)}}S=S.replace(/^\s*layout\((.*)\)/gm,"")}return S}var kn=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this)||this;return o.id=n,o.device=i,o.device.resourceCreationTracker!==null&&o.device.resourceCreationTracker.trackResourceCreated(o),o}return t.prototype.destroy=function(){this.device.resourceCreationTracker!==null&&this.device.resourceCreationTracker.trackResourceDestroyed(this)},t}(ex),uK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.Bindings;var s=o.uniformBufferBindings,u=o.samplerBindings;return a.uniformBufferBindings=s||[],a.samplerBindings=u||[],a.bindingLayouts=a.createBindingLayouts(),a}return t.prototype.createBindingLayouts=function(){var r=0,n=0,i=[],o=this.uniformBufferBindings.length,a=this.samplerBindings.length;return i.push({firstUniformBuffer:r,numUniformBuffers:o,firstSampler:n,numSamplers:a}),r+=o,n+=a,{numUniformBuffers:r,numSamplers:n,bindingLayoutTables:i}},t}(kn);function Ye(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function fx(e){var t=si(e);switch(t){case de.BC1:case de.BC2:case de.BC3:case de.BC4_UNORM:case de.BC4_SNORM:case de.BC5_UNORM:case de.BC5_SNORM:return!0;default:return!1}}function hx(e){var t=ka(e);if(t&$e.Normalized)return!1;var r=si(e);return r===de.S8||r===de.S16||r===de.S32||r===de.U8||r===de.U16||r===de.U32}function lK(e){switch(e){case qn.STATIC:return w.STATIC_DRAW;case qn.DYNAMIC:return w.DYNAMIC_DRAW}}function D1(e){if(e&Wt.INDEX)return w.ELEMENT_ARRAY_BUFFER;if(e&Wt.VERTEX)return w.ARRAY_BUFFER;if(e&Wt.UNIFORM)return w.UNIFORM_BUFFER}function cK(e){switch(e){case gr.TRIANGLES:return w.TRIANGLES;case gr.POINTS:return w.POINTS;case gr.TRIANGLE_STRIP:return w.TRIANGLE_STRIP;case gr.LINES:return w.LINES;case gr.LINE_STRIP:return w.LINE_STRIP;default:throw new Error("Unknown primitive topology mode")}}function fK(e){switch(e){case de.U8:return w.UNSIGNED_BYTE;case de.U16:return w.UNSIGNED_SHORT;case de.U32:return w.UNSIGNED_INT;case de.S8:return w.BYTE;case de.S16:return w.SHORT;case de.S32:return w.INT;case de.F16:return w.HALF_FLOAT;case de.F32:return w.FLOAT;default:throw new Error("whoops")}}function hK(e){switch(e){case We.R:return 1;case We.RG:return 2;case We.RGB:return 3;case We.RGBA:return 4;default:return 1}}function dK(e){var t=si(e),r=a_(e),n=ka(e),i=fK(t),o=hK(r),a=!!(n&$e.Normalized);return{size:o,type:i,normalized:a}}function pK(e){switch(e){case X.U8_R:return w.UNSIGNED_BYTE;case X.U16_R:return w.UNSIGNED_SHORT;case X.U32_R:return w.UNSIGNED_INT;default:throw new Error("whoops")}}function js(e){switch(e){case tn.CLAMP_TO_EDGE:return w.CLAMP_TO_EDGE;case tn.REPEAT:return w.REPEAT;case tn.MIRRORED_REPEAT:return w.MIRRORED_REPEAT;default:throw new Error("whoops")}}function zl(e,t){if(t===Or.LINEAR&&e===lr.BILINEAR)return w.LINEAR_MIPMAP_LINEAR;if(t===Or.LINEAR&&e===lr.POINT)return w.NEAREST_MIPMAP_LINEAR;if(t===Or.NEAREST&&e===lr.BILINEAR)return w.LINEAR_MIPMAP_NEAREST;if(t===Or.NEAREST&&e===lr.POINT)return w.NEAREST_MIPMAP_NEAREST;if(t===Or.NO_MIP&&e===lr.BILINEAR)return w.LINEAR;if(t===Or.NO_MIP&&e===lr.POINT)return w.NEAREST;throw new Error("Unknown texture filter mode")}function Na(e,t){t===void 0&&(t=0);var r=e;return r.gl_buffer_pages[t/r.pageByteSize|0]}function ga(e){var t=e;return t.gl_texture}function ap(e){var t=e;return t.gl_sampler}function Xs(e,t){e.name=t,e.__SPECTOR_Metadata={name:t}}function U1(e,t){for(var r=[];;){var n=t.exec(e);if(!n)break;r.push(n)}return r}function Di(e){return e.blendMode==wr.ADD&&e.blendSrcFactor==xt.ONE&&e.blendDstFactor===xt.ZERO}function _K(e){switch(e){case Uc.OcclusionConservative:return w.ANY_SAMPLES_PASSED_CONSERVATIVE;default:throw new Error("whoops")}}function vK(e){if(e===bt.TEXTURE_2D)return w.TEXTURE_2D;if(e===bt.TEXTURE_2D_ARRAY)return w.TEXTURE_2D_ARRAY;if(e===bt.TEXTURE_CUBE_MAP)return w.TEXTURE_CUBE_MAP;if(e===bt.TEXTURE_3D)return w.TEXTURE_3D;throw new Error("whoops")}function rd(e,t,r,n){return!(e%r!==0||t%n!==0)}var mK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.Buffer;var s=o.viewOrSize,u=o.usage,l=o.hint,f=l===void 0?qn.STATIC:l,c=i.uniformBufferMaxPageByteSize,h=i.gl,d=u&Wt.UNIFORM;d||(Ye(h)?h.bindVertexArray(null):i.OES_vertex_array_object.bindVertexArrayOES(null));var p=ya(s)?$c(s,4):$c(s.byteLength,4);a.gl_buffer_pages=[];var v;if(d){for(var g=p;g>0;)a.gl_buffer_pages.push(a.createBufferPage(Math.min(g,c),u,f)),g-=c;v=c}else a.gl_buffer_pages.push(a.createBufferPage(p,u,f)),v=p;return a.pageByteSize=v,a.byteSize=p,a.usage=u,a.gl_target=D1(u),ya(s)||a.setSubData(0,new Uint8Array(s.buffer)),d||(Ye(h)?h.bindVertexArray(a.device.currentBoundVAO):i.OES_vertex_array_object.bindVertexArrayOES(a.device.currentBoundVAO)),a}return t.prototype.setSubData=function(r,n,i,o){i===void 0&&(i=0),o===void 0&&(o=n.byteLength-i);for(var a=this.device.gl,s=this.pageByteSize,u=r+o,l=r,f=r%s;l=1,!a){f=s.device.ensureResourceExists(u.createTexture());var h=s.device.translateTextureType(o.format),d=s.device.translateTextureInternalFormat(o.format);if(s.device.setActiveTexture(u.TEXTURE0),s.device.currentTextures[0]=null,s.preprocessImage(),o.dimension===bt.TEXTURE_2D){if(l=w.TEXTURE_2D,u.bindTexture(l,f),s.immutable)if(Ye(u))u.texStorage2D(l,c,d,o.width,o.height);else{var p=(d===w.DEPTH_COMPONENT||s.isNPOT(),0);(s.format===X.D32F||s.format===X.D24_S8)&&!Ye(u)&&!i.WEBGL_depth_texture||(u.texImage2D(l,p,d,o.width,o.height,0,d,h,null),s.mipmaps&&(s.mipmaps=!1,u.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR),u.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),u.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE)))}ht(o.depthOrArrayLayers===1)}else if(o.dimension===bt.TEXTURE_2D_ARRAY)l=w.TEXTURE_2D_ARRAY,u.bindTexture(l,f),s.immutable&&Ye(u)&&u.texStorage3D(l,c,d,o.width,o.height,o.depthOrArrayLayers);else if(o.dimension===bt.TEXTURE_3D)l=w.TEXTURE_3D,u.bindTexture(l,f),s.immutable&&Ye(u)&&u.texStorage3D(l,c,d,o.width,o.height,o.depthOrArrayLayers);else if(o.dimension===bt.TEXTURE_CUBE_MAP)l=w.TEXTURE_CUBE_MAP,u.bindTexture(l,f),s.immutable&&Ye(u)&&u.texStorage2D(l,c,d,o.width,o.height),ht(o.depthOrArrayLayers===6);else throw new Error("whoops")}return s.gl_texture=f,s.gl_target=l,s.mipLevelCount=c,s}return t.prototype.setImageData=function(r,n){n===void 0&&(n=0);var i=this.device.gl;fx(this.format);var o=this.gl_target===w.TEXTURE_3D||this.gl_target===w.TEXTURE_2D_ARRAY,a=this.gl_target===w.TEXTURE_CUBE_MAP,s=oK(r[0]);this.device.setActiveTexture(i.TEXTURE0),this.device.currentTextures[0]=null;var u=r[0],l,f;s?(l=this.width,f=this.height):(l=u.width,f=u.height,this.width=l,this.height=f),i.bindTexture(this.gl_target,this.gl_texture);var c=this.device.translateTextureFormat(this.format),h=Ye(i)?this.device.translateInternalTextureFormat(this.format):c,d=this.device.translateTextureType(this.format);this.preprocessImage();for(var p=0;p1){var n=si(r.format);if(n===de.BC1)for(var i=r.width,o=r.height,a=0;a1?s.renderbufferStorageMultisample(w.RENDERBUFFER,h,v,l,f):s.renderbufferStorage(w.RENDERBUFFER,v,l,f)}return a.format=u,a.width=l,a.height=f,a.sampleCount=h,a}return t.prototype.destroy=function(){e.prototype.destroy.call(this),this.gl_renderbuffer!==null&&this.device.gl.deleteRenderbuffer(this.gl_renderbuffer),this.texture&&this.texture.destroy()},t}(kn),fn;(function(e){e[e.NeedsCompile=0]="NeedsCompile",e[e.Compiling=1]="Compiling",e[e.NeedsBind=2]="NeedsBind",e[e.ReadyToUse=3]="ReadyToUse"})(fn||(fn={}));var yK=function(e){sr(t,e);function t(r,n){var i=r.id,o=r.device,a=r.descriptor,s=e.call(this,{id:i,device:o})||this;s.rawVertexGLSL=n,s.type=Lt.Program,s.uniformSetters={},s.attributes=[];var u=s.device.gl;return s.descriptor=a,s.gl_program=s.device.ensureResourceExists(u.createProgram()),s.gl_shader_vert=null,s.gl_shader_frag=null,s.compileState=fn.NeedsCompile,s.tryCompileProgram(),s}return t.prototype.destroy=function(){e.prototype.destroy.call(this),this.device.gl.deleteProgram(this.gl_program),this.device.gl.deleteShader(this.gl_shader_vert),this.device.gl.deleteShader(this.gl_shader_frag)},t.prototype.tryCompileProgram=function(){ht(this.compileState===fn.NeedsCompile);var r=this.descriptor,n=r.vertex,i=r.fragment,o=this.device.gl;n!=null&&n.glsl&&(i!=null&&i.glsl)&&(this.gl_shader_vert=this.compileShader(n.postprocess?n.postprocess(n.glsl):n.glsl,o.VERTEX_SHADER),this.gl_shader_frag=this.compileShader(i.postprocess?i.postprocess(i.glsl):i.glsl,o.FRAGMENT_SHADER),o.attachShader(this.gl_program,this.gl_shader_vert),o.attachShader(this.gl_program,this.gl_shader_frag),o.linkProgram(this.gl_program),this.compileState=fn.Compiling,Ye(o)||(this.readUniformLocationsFromLinkedProgram(),this.readAttributesFromLinkedProgram()))},t.prototype.readAttributesFromLinkedProgram=function(){for(var r,n=this.device.gl,i=n.getProgramParameter(this.gl_program,n.ACTIVE_ATTRIBUTES),o=aK(this.descriptor.vertex.glsl),a=sK(this.rawVertexGLSL,o),s=function(f){var c=n.getActiveAttrib(u.gl_program,f),h=c.name,d=c.type,p=c.size,v=n.getAttribLocation(u.gl_program,h),g=(r=a.find(function(y){return y.name===h}))===null||r===void 0?void 0:r.location;v>=0&&!wn(g)&&(u.attributes[g]={name:h,location:v,type:d,size:p})},u=this,l=0;l1)for(var u=0;u1&&u.device.EXT_texture_filter_anisotropic!==null&&(ht(o.minFilter===lr.BILINEAR&&o.magFilter===lr.BILINEAR&&o.mipmapFilter===Or.LINEAR),l.samplerParameterf(f,u.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c)),u.gl_sampler=f}else u.descriptor=o;return u}return t.prototype.setTextureParameters=function(r,n,i){var o,a=this.device.gl,s=this.descriptor;this.isNPOT(n,i)?a.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR):a.texParameteri(r,w.TEXTURE_MIN_FILTER,zl(s.minFilter,s.mipmapFilter)),a.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,js(s.addressModeU)),a.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,js(s.addressModeV)),a.texParameteri(r,w.TEXTURE_MAG_FILTER,zl(s.magFilter,Or.NO_MIP));var u=(o=s.maxAnisotropy)!==null&&o!==void 0?o:1;u>1&&this.device.EXT_texture_filter_anisotropic!==null&&(ht(s.minFilter===lr.BILINEAR&&s.magFilter===lr.BILINEAR&&s.mipmapFilter===Or.LINEAR),a.texParameteri(r,this.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u))},t.prototype.destroy=function(){e.prototype.destroy.call(this),Ye(this.device.gl)&&this.device.gl.deleteSampler(ap(this))},t.prototype.isNPOT=function(r,n){return!kc(r)||!kc(n)},t}(kn),CK=function(){function e(){}return e.prototype.dispatchWorkgroups=function(t,r,n){},e.prototype.dispatchWorkgroupsIndirect=function(t,r){},e.prototype.setPipeline=function(t){},e.prototype.setBindings=function(t){},e.prototype.pushDebugGroup=function(t){},e.prototype.popDebugGroup=function(){},e.prototype.insertDebugMarker=function(t){},e}(),OK=function(e){sr(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Lt.RenderBundle,r.commands=[],r}return t.prototype.push=function(r){this.commands.push(r)},t.prototype.replay=function(){this.commands.forEach(function(r){return r()})},t}(kn),k1=65536,IK=/uniform(?:\s+)(\w+)(?:\s?){([^]*?)}/g,MK=function(){function e(t,r){r===void 0&&(r={}),this.shaderDebug=!1,this.OES_vertex_array_object=null,this.ANGLE_instanced_arrays=null,this.OES_texture_float=null,this.OES_draw_buffers_indexed=null,this.WEBGL_draw_buffers=null,this.WEBGL_depth_texture=null,this.WEBGL_color_buffer_float=null,this.EXT_color_buffer_half_float=null,this.WEBGL_compressed_texture_s3tc=null,this.WEBGL_compressed_texture_s3tc_srgb=null,this.EXT_texture_compression_rgtc=null,this.EXT_texture_filter_anisotropic=null,this.KHR_parallel_shader_compile=null,this.EXT_texture_norm16=null,this.EXT_color_buffer_float=null,this.OES_texture_float_linear=null,this.OES_texture_half_float_linear=null,this.scTexture=null,this.scPlatformFramebuffer=null,this.currentActiveTexture=null,this.currentBoundVAO=null,this.currentProgram=null,this.resourceCreationTracker=null,this.resourceUniqueId=0,this.currentColorAttachments=[],this.currentColorAttachmentLevels=[],this.currentColorResolveTos=[],this.currentColorResolveToLevels=[],this.currentSampleCount=-1,this.currentIndexBufferByteOffset=null,this.currentMegaState=$a(za),this.currentSamplers=[],this.currentTextures=[],this.currentUniformBuffers=[],this.currentUniformBufferByteOffsets=[],this.currentUniformBufferByteSizes=[],this.currentScissorEnabled=!1,this.currentStencilRef=null,this.currentRenderPassDescriptor=null,this.currentRenderPassDescriptorStack=[],this.debugGroupStack=[],this.resolveColorAttachmentsChanged=!1,this.resolveDepthStencilAttachmentsChanged=!1,this.explicitBindingLocations=!1,this.separateSamplerTextures=!1,this.viewportOrigin=Zn.LOWER_LEFT,this.clipSpaceNearZ=Ua.NEGATIVE_ONE,this.supportMRT=!1,this.inBlitRenderPass=!1,this.supportedSampleCounts=[],this.occlusionQueriesRecommended=!1,this.computeShadersSupported=!1,this.gl=t,this.contextAttributes=Eo(t.getContextAttributes()),Ye(t)?(this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"),this.EXT_color_buffer_float=t.getExtension("EXT_color_buffer_float")):(this.OES_vertex_array_object=t.getExtension("OES_vertex_array_object"),this.ANGLE_instanced_arrays=t.getExtension("ANGLE_instanced_arrays"),this.OES_texture_float=t.getExtension("OES_texture_float"),this.WEBGL_draw_buffers=t.getExtension("WEBGL_draw_buffers"),this.WEBGL_depth_texture=t.getExtension("WEBGL_depth_texture"),this.WEBGL_color_buffer_float=t.getExtension("WEBGL_color_buffer_float"),this.EXT_color_buffer_half_float=t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_frag_depth"),t.getExtension("OES_element_index_uint"),t.getExtension("OES_standard_derivatives")),this.WEBGL_compressed_texture_s3tc=t.getExtension("WEBGL_compressed_texture_s3tc"),this.WEBGL_compressed_texture_s3tc_srgb=t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),this.EXT_texture_compression_rgtc=t.getExtension("EXT_texture_compression_rgtc"),this.EXT_texture_filter_anisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"),this.OES_texture_float_linear=t.getExtension("OES_texture_float_linear"),this.OES_texture_half_float_linear=t.getExtension("OES_texture_half_float_linear"),this.KHR_parallel_shader_compile=t.getExtension("KHR_parallel_shader_compile"),Ye(t)?(this.platformString="WebGL2",this.glslVersion="#version 300 es"):(this.platformString="WebGL1",this.glslVersion="#version 100"),this.scTexture=new sp({id:this.getNextUniqueId(),device:this,descriptor:{width:0,height:0,depthOrArrayLayers:1,dimension:bt.TEXTURE_2D,mipLevelCount:1,usage:qr.RENDER_TARGET,format:this.contextAttributes.alpha===!1?X.U8_RGB_RT:X.U8_RGBA_RT},fake:!0}),this.scTexture.formatKind=or.Float,this.scTexture.gl_target=null,this.scTexture.gl_texture=null,this.resolveColorReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveColorDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.renderPassDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.readbackFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.fallbackTexture2D=this.createFallbackTexture(bt.TEXTURE_2D,or.Float),this.fallbackTexture2DDepth=this.createFallbackTexture(bt.TEXTURE_2D,or.Depth),this.fallbackVertexBuffer=this.createBuffer({viewOrSize:1,usage:Wt.VERTEX,hint:qn.STATIC}),Ye(t)&&(this.fallbackTexture2DArray=this.createFallbackTexture(bt.TEXTURE_2D_ARRAY,or.Float),this.fallbackTexture3D=this.createFallbackTexture(bt.TEXTURE_3D,or.Float),this.fallbackTextureCube=this.createFallbackTexture(bt.TEXTURE_CUBE_MAP,or.Float)),this.currentMegaState.depthCompare=kt.LESS,this.currentMegaState.depthWrite=!1,this.currentMegaState.attachmentsState[0].channelWriteMask=Lr.ALL,t.enable(t.DEPTH_TEST),t.enable(t.STENCIL_TEST),this.checkLimits(),r.shaderDebug&&(this.shaderDebug=!0),r.trackResources&&(this.resourceCreationTracker=new bK)}return e.prototype.destroy=function(){this.blitBindings&&this.blitBindings.destroy(),this.blitInputLayout&&this.blitInputLayout.destroy(),this.blitRenderPipeline&&this.blitRenderPipeline.destroy(),this.blitVertexBuffer&&this.blitVertexBuffer.destroy(),this.blitProgram&&this.blitProgram.destroy()},e.prototype.createFallbackTexture=function(t,r){var n=t===bt.TEXTURE_CUBE_MAP?6:1,i=r===or.Depth?X.D32F:X.U8_RGBA_NORM,o=this.createTexture({dimension:t,format:i,usage:qr.SAMPLED,width:1,height:1,depthOrArrayLayers:n,mipLevelCount:1});return r===or.Float&&o.setImageData([new Uint8Array(4*n)]),ga(o)},e.prototype.getNextUniqueId=function(){return++this.resourceUniqueId},e.prototype.checkLimits=function(){var t=this.gl;if(this.maxVertexAttribs=t.getParameter(w.MAX_VERTEX_ATTRIBS),Ye(t)){this.uniformBufferMaxPageByteSize=Math.min(t.getParameter(w.MAX_UNIFORM_BLOCK_SIZE),k1),this.uniformBufferWordAlignment=t.getParameter(t.UNIFORM_BUFFER_OFFSET_ALIGNMENT)/4;var r=t.getInternalformatParameter(t.RENDERBUFFER,t.DEPTH32F_STENCIL8,t.SAMPLES);this.supportedSampleCounts=r?Vs([],Xn(r),!1):[],this.occlusionQueriesRecommended=!0}else this.uniformBufferWordAlignment=64,this.uniformBufferMaxPageByteSize=k1;this.uniformBufferMaxPageWordSize=this.uniformBufferMaxPageByteSize/4,this.supportedSampleCounts.includes(1)||this.supportedSampleCounts.push(1),this.supportedSampleCounts.sort(function(n,i){return n-i})},e.prototype.configureSwapChain=function(t,r,n){var i=this.scTexture;i.width=t,i.height=r,this.scPlatformFramebuffer=Iq(n)},e.prototype.getDevice=function(){return this},e.prototype.getCanvas=function(){return this.gl.canvas},e.prototype.getOnscreenTexture=function(){return this.scTexture},e.prototype.beginFrame=function(){},e.prototype.endFrame=function(){},e.prototype.translateTextureInternalFormat=function(t,r){switch(r===void 0&&(r=!1),t){case X.ALPHA:return w.ALPHA;case X.U8_LUMINANCE:case X.F16_LUMINANCE:case X.F32_LUMINANCE:return w.LUMINANCE;case X.F16_R:return w.R16F;case X.F16_RG:return w.RG16F;case X.F16_RGB:return w.RGB16F;case X.F16_RGBA:return w.RGBA16F;case X.F32_R:return w.R32F;case X.F32_RG:return w.RG32F;case X.F32_RGB:return w.RGB32F;case X.F32_RGBA:return Ye(this.gl)?w.RGBA32F:r?this.WEBGL_color_buffer_float.RGBA32F_EXT:w.RGBA;case X.U8_R_NORM:return w.R8;case X.U8_RG_NORM:return w.RG8;case X.U8_RGB_NORM:case X.U8_RGB_RT:return w.RGB8;case X.U8_RGB_SRGB:return w.SRGB8;case X.U8_RGBA_NORM:case X.U8_RGBA_RT:return Ye(this.gl)?w.RGBA8:r?w.RGBA4:w.RGBA;case X.U8_RGBA:return w.RGBA;case X.U8_RGBA_SRGB:case X.U8_RGBA_RT_SRGB:return w.SRGB8_ALPHA8;case X.U16_R:return w.R16UI;case X.U16_R_NORM:return this.EXT_texture_norm16.R16_EXT;case X.U16_RG_NORM:return this.EXT_texture_norm16.RG16_EXT;case X.U16_RGBA_NORM:return this.EXT_texture_norm16.RGBA16_EXT;case X.U16_RGBA_5551:return w.RGB5_A1;case X.U16_RGB_565:return w.RGB565;case X.U32_R:return w.R32UI;case X.S8_RGBA_NORM:return w.RGBA8_SNORM;case X.S8_RG_NORM:return w.RG8_SNORM;case X.BC1:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT;case X.BC1_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case X.BC2:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT;case X.BC2_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case X.BC3:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT;case X.BC3_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case X.BC4_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_RGTC1_EXT;case X.BC4_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT;case X.BC5_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT;case X.BC5_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;case X.D32F_S8:return Ye(this.gl)?w.DEPTH32F_STENCIL8:this.WEBGL_depth_texture?w.DEPTH_STENCIL:w.DEPTH_COMPONENT16;case X.D24_S8:return Ye(this.gl)?w.DEPTH24_STENCIL8:this.WEBGL_depth_texture?w.DEPTH_STENCIL:w.DEPTH_COMPONENT16;case X.D32F:return Ye(this.gl)?w.DEPTH_COMPONENT32F:this.WEBGL_depth_texture?w.DEPTH_COMPONENT:w.DEPTH_COMPONENT16;case X.D24:return Ye(this.gl)?w.DEPTH_COMPONENT24:this.WEBGL_depth_texture?w.DEPTH_COMPONENT:w.DEPTH_COMPONENT16;default:throw new Error("whoops")}},e.prototype.translateTextureType=function(t){var r=si(t);switch(r){case de.U8:return w.UNSIGNED_BYTE;case de.U16:return w.UNSIGNED_SHORT;case de.U32:return w.UNSIGNED_INT;case de.S8:return w.BYTE;case de.F16:return w.HALF_FLOAT;case de.F32:return w.FLOAT;case de.U16_PACKED_5551:return w.UNSIGNED_SHORT_5_5_5_1;case de.D32F:return Ye(this.gl)?w.FLOAT:this.WEBGL_depth_texture?w.UNSIGNED_INT:w.UNSIGNED_BYTE;case de.D24:return Ye(this.gl)?w.UNSIGNED_INT_24_8:this.WEBGL_depth_texture?w.UNSIGNED_SHORT:w.UNSIGNED_BYTE;case de.D24S8:return Ye(this.gl)?w.UNSIGNED_INT_24_8:this.WEBGL_depth_texture?w.UNSIGNED_INT_24_8_WEBGL:w.UNSIGNED_BYTE;case de.D32FS8:return w.FLOAT_32_UNSIGNED_INT_24_8_REV;default:throw new Error("whoops")}},e.prototype.translateInternalTextureFormat=function(t){switch(t){case X.F32_R:return w.R32F;case X.F32_RG:return w.RG32F;case X.F32_RGB:return w.RGB32F;case X.F32_RGBA:return w.RGBA32F;case X.F16_R:return w.R16F;case X.F16_RG:return w.RG16F;case X.F16_RGB:return w.RGB16F;case X.F16_RGBA:return w.RGBA16F}return this.translateTextureFormat(t)},e.prototype.translateTextureFormat=function(t){if(fx(t)||t===X.F32_LUMINANCE||t===X.U8_LUMINANCE)return this.translateTextureInternalFormat(t);var r=Ye(this.gl)||!Ye(this.gl)&&!!this.WEBGL_depth_texture;switch(t){case X.D24_S8:case X.D32F_S8:return r?w.DEPTH_STENCIL:w.RGBA;case X.D24:case X.D32F:return r?w.DEPTH_COMPONENT:w.RGBA}var n=hx(t),i=a_(t);switch(i){case We.A:return w.ALPHA;case We.R:return n?w.RED_INTEGER:w.RED;case We.RG:return n?w.RG_INTEGER:w.RG;case We.RGB:return n?w.RGB_INTEGER:w.RGB;case We.RGBA:return w.RGBA}},e.prototype.setActiveTexture=function(t){this.currentActiveTexture!==t&&(this.gl.activeTexture(t),this.currentActiveTexture=t)},e.prototype.bindVAO=function(t){this.currentBoundVAO!==t&&(Ye(this.gl)?this.gl.bindVertexArray(t):this.OES_vertex_array_object.bindVertexArrayOES(t),this.currentBoundVAO=t)},e.prototype.programCompiled=function(t){ht(t.compileState!==fn.NeedsCompile),t.compileState===fn.Compiling&&(t.compileState=fn.NeedsBind,this.shaderDebug&&this.checkProgramCompilationForErrors(t))},e.prototype.useProgram=function(t){this.currentProgram!==t&&(this.programCompiled(t),this.gl.useProgram(t.gl_program),this.currentProgram=t)},e.prototype.ensureResourceExists=function(t){if(t===null){var r=this.gl.getError();throw new Error("Created resource is null; GL error encountered: ".concat(r))}else return t},e.prototype.createBuffer=function(t){return new mK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createTexture=function(t){return new sp({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createSampler=function(t){return new RK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderTarget=function(t){return new EK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderTargetFromTexture=function(t){var r=t,n=r.format,i=r.width,o=r.height,a=r.mipLevelCount;return ht(a===1),this.createRenderTarget({format:n,width:i,height:o,sampleCount:1,texture:t})},e.prototype.createProgram=function(t){var r,n,i,o=(r=t.vertex)===null||r===void 0?void 0:r.glsl;return!((n=t.vertex)===null||n===void 0)&&n.glsl&&(t.vertex.glsl=Va(this.queryVendorInfo(),"vert",t.vertex.glsl)),!((i=t.fragment)===null||i===void 0)&&i.glsl&&(t.fragment.glsl=Va(this.queryVendorInfo(),"frag",t.fragment.glsl)),this.createProgramSimple(t,o)},e.prototype.createProgramSimple=function(t,r){var n=new yK({id:this.getNextUniqueId(),device:this,descriptor:t},r);return n},e.prototype.createBindings=function(t){return new uK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createInputLayout=function(t){return new gK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderPipeline=function(t){return new SK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createComputePass=function(){return new CK},e.prototype.createComputePipeline=function(t){return new xK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createReadback=function(){return new AK({id:this.getNextUniqueId(),device:this})},e.prototype.createQueryPool=function(t,r){return new TK({id:this.getNextUniqueId(),device:this,descriptor:{type:t,elemCount:r}})},e.prototype.formatRenderPassDescriptor=function(t){var r,n,i,o,a,s,u=t.colorAttachment;t.depthClearValue=(r=t.depthClearValue)!==null&&r!==void 0?r:"load",t.stencilClearValue=(n=t.stencilClearValue)!==null&&n!==void 0?n:"load";for(var l=0;l=0;r--)this.debugGroupStack[r].drawCallCount+=t},e.prototype.debugGroupStatisticsBufferUpload=function(t){t===void 0&&(t=1);for(var r=this.debugGroupStack.length-1;r>=0;r--)this.debugGroupStack[r].bufferUploadCount+=t},e.prototype.debugGroupStatisticsTextureBind=function(t){t===void 0&&(t=1);for(var r=this.debugGroupStack.length-1;r>=0;r--)this.debugGroupStack[r].textureBindCount+=t},e.prototype.debugGroupStatisticsTriangles=function(t){for(var r=this.debugGroupStack.length-1;r>=0;r--)this.debugGroupStack[r].triangleCount+=t},e.prototype.reportShaderError=function(t,r){var n=this.gl,i=n.getShaderParameter(t,n.COMPILE_STATUS);if(!i){console.error(Nq(r));var o=n.getExtension("WEBGL_debug_shaders");o&&console.error(o.getTranslatedShaderSource(t)),console.error(n.getShaderInfoLog(t))}return i},e.prototype.checkProgramCompilationForErrors=function(t){var r=this.gl,n=t.gl_program;if(!r.getProgramParameter(n,r.LINK_STATUS)){var i=t.descriptor;if(!this.reportShaderError(t.gl_shader_vert,i.vertex.glsl)||!this.reportShaderError(t.gl_shader_frag,i.fragment.glsl))return;console.error(r.getProgramInfoLog(t.gl_program))}},e.prototype.bindFramebufferAttachment=function(t,r,n,i){var o=this.gl;if(wn(n))o.framebufferRenderbuffer(t,r,o.RENDERBUFFER,null);else if(n.type===Lt.RenderTarget)n.gl_renderbuffer!==null?o.framebufferRenderbuffer(t,r,o.RENDERBUFFER,n.gl_renderbuffer):n.texture!==null&&o.framebufferTexture2D(t,r,w.TEXTURE_2D,ga(n.texture),i);else if(n.type===Lt.Texture){var a=ga(n);n.dimension===bt.TEXTURE_2D?o.framebufferTexture2D(t,r,w.TEXTURE_2D,a,i):Ye(o)&&(n.dimension,bt.TEXTURE_2D_ARRAY)}},e.prototype.bindFramebufferDepthStencilAttachment=function(t,r){var n=this.gl,i=wn(r)?$e.Depth|$e.Stencil:ka(r.format),o=!!(i&$e.Depth),a=!!(i&$e.Stencil);if(o&&a){var s=Ye(this.gl)||!Ye(this.gl)&&!!this.WEBGL_depth_texture;s?this.bindFramebufferAttachment(t,n.DEPTH_STENCIL_ATTACHMENT,r,0):this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,r,0)}else o?(this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,r,0),this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,null,0)):a&&(this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,r,0),this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,null,0))},e.prototype.validateCurrentAttachments=function(){for(var t=-1,r=-1,n=-1,i=0;i=l.numUniformBuffers),ht(s.length>=l.numSamplers);for(var f=0;f{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&dx.decode();let ru=null;function rc(){return(ru===null||ru.byteLength===0)&&(ru=new Uint8Array(ir.memory.buffer)),ru}function Hc(e,t){return e=e>>>0,dx.decode(rc().subarray(e,e+t))}const mi=new Array(128).fill(void 0);mi.push(void 0,null,!0,!1);let lu=mi.length;function PK(e){lu===mi.length&&mi.push(mi.length+1);const t=lu;return lu=mi[t],mi[t]=e,t}function nc(e){return mi[e]}function LK(e){e<132||(mi[e]=lu,lu=e)}function wK(e){const t=nc(e);return LK(e),t}let Ha=0;const ic=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},FK=typeof ic.encodeInto=="function"?function(e,t){return ic.encodeInto(e,t)}:function(e,t){const r=ic.encode(e);return t.set(r),{read:e.length,written:r.length}};function jc(e,t,r){if(r===void 0){const s=ic.encode(e),u=t(s.length,1)>>>0;return rc().subarray(u,u+s.length).set(s),Ha=s.length,u}let n=e.length,i=t(n,1)>>>0;const o=rc();let a=0;for(;a127)break;o[i+a]=s}if(a!==n){a!==0&&(e=e.slice(a)),i=r(i,n,n=a+e.length*3,1)>>>0;const s=rc().subarray(i+a,i+n),u=FK(e,s);a+=u.written}return Ha=a,i}let nu=null;function Xc(){return(nu===null||nu.byteLength===0)&&(nu=new Int32Array(ir.memory.buffer)),nu}function BK(e,t,r){let n,i;try{const s=ir.__wbindgen_add_to_stack_pointer(-16),u=jc(e,ir.__wbindgen_malloc,ir.__wbindgen_realloc),l=Ha,f=jc(t,ir.__wbindgen_malloc,ir.__wbindgen_realloc),c=Ha;ir.glsl_compile(s,u,l,f,c,r);var o=Xc()[s/4+0],a=Xc()[s/4+1];return n=o,i=a,Hc(o,a)}finally{ir.__wbindgen_add_to_stack_pointer(16),ir.__wbindgen_free(n,i,1)}}class Ou{static __wrap(t){t=t>>>0;const r=Object.create(Ou.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();ir.__wbg_wgslcomposer_free(t)}constructor(){const t=ir.wgslcomposer_new();return Ou.__wrap(t)}load_composable(t){const r=jc(t,ir.__wbindgen_malloc,ir.__wbindgen_realloc),n=Ha;ir.wgslcomposer_load_composable(this.__wbg_ptr,r,n)}wgsl_compile(t){let r,n;try{const a=ir.__wbindgen_add_to_stack_pointer(-16),s=jc(t,ir.__wbindgen_malloc,ir.__wbindgen_realloc),u=Ha;ir.wgslcomposer_wgsl_compile(a,this.__wbg_ptr,s,u);var i=Xc()[a/4+0],o=Xc()[a/4+1];return r=i,n=o,Hc(i,o)}finally{ir.__wbindgen_add_to_stack_pointer(16),ir.__wbindgen_free(r,n,1)}}}async function DK(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{const r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function UK(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,r){const n=Hc(t,r);return PK(n)},e.wbg.__wbindgen_object_drop_ref=function(t){wK(t)},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(nc(t))},e.wbg.__wbg_log_576ca876af0d4a77=function(t,r){console.log(nc(t),nc(r))},e.wbg.__wbindgen_throw=function(t,r){throw new Error(Hc(t,r))},e}function kK(e,t){return ir=e.exports,px.__wbindgen_wasm_module=t,nu=null,ru=null,ir}async function px(e){if(ir!==void 0)return ir;const t=UK();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:r,module:n}=await DK(await e,t);return kK(r,n)}var Cr;(function(e){e[e.COPY_SRC=1]="COPY_SRC",e[e.COPY_DST=2]="COPY_DST",e[e.TEXTURE_BINDING=4]="TEXTURE_BINDING",e[e.STORAGE_BINDING=8]="STORAGE_BINDING",e[e.STORAGE=8]="STORAGE",e[e.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(Cr||(Cr={}));var up;(function(e){e[e.READ=1]="READ",e[e.WRITE=2]="WRITE"})(up||(up={}));function $K(e){var t=0;return e&qr.SAMPLED&&(t|=Cr.TEXTURE_BINDING|Cr.COPY_DST|Cr.COPY_SRC),e&qr.STORAGE&&(t|=Cr.TEXTURE_BINDING|Cr.STORAGE_BINDING|Cr.COPY_SRC|Cr.COPY_DST),e&qr.RENDER_TARGET&&(t|=Cr.RENDER_ATTACHMENT|Cr.TEXTURE_BINDING|Cr.COPY_SRC|Cr.COPY_DST),t}function u_(e){if(e===X.U8_R_NORM)return"r8unorm";if(e===X.S8_R_NORM)return"r8snorm";if(e===X.U8_RG_NORM)return"rg8unorm";if(e===X.S8_RG_NORM)return"rg8snorm";if(e===X.U32_R)return"r32uint";if(e===X.S32_R)return"r32sint";if(e===X.F32_R)return"r32float";if(e===X.U16_RG)return"rg16uint";if(e===X.S16_RG)return"rg16sint";if(e===X.F16_RG)return"rg16float";if(e===X.U8_RGBA_RT)return"bgra8unorm";if(e===X.U8_RGBA_RT_SRGB)return"bgra8unorm-srgb";if(e===X.U8_RGBA_NORM)return"rgba8unorm";if(e===X.U8_RGBA_SRGB)return"rgba8unorm-srgb";if(e===X.S8_RGBA_NORM)return"rgba8snorm";if(e===X.U32_RG)return"rg32uint";if(e===X.S32_RG)return"rg32sint";if(e===X.F32_RG)return"rg32float";if(e===X.U16_RGBA)return"rgba16uint";if(e===X.S16_RGBA)return"rgba16sint";if(e===X.F16_RGBA)return"rgba16float";if(e===X.F32_RGBA)return"rgba32float";if(e===X.U32_RGBA)return"rgba32uint";if(e===X.S32_RGBA)return"rgba32sint";if(e===X.D24)return"depth24plus";if(e===X.D24_S8)return"depth24plus-stencil8";if(e===X.D32F)return"depth32float";if(e===X.D32F_S8)return"depth32float-stencil8";if(e===X.BC1)return"bc1-rgba-unorm";if(e===X.BC1_SRGB)return"bc1-rgba-unorm-srgb";if(e===X.BC2)return"bc2-rgba-unorm";if(e===X.BC2_SRGB)return"bc2-rgba-unorm-srgb";if(e===X.BC3)return"bc3-rgba-unorm";if(e===X.BC3_SRGB)return"bc3-rgba-unorm-srgb";if(e===X.BC4_SNORM)return"bc4-r-snorm";if(e===X.BC4_UNORM)return"bc4-r-unorm";if(e===X.BC5_SNORM)return"bc5-rg-snorm";if(e===X.BC5_UNORM)return"bc5-rg-unorm";throw"whoops"}function zK(e){if(e===bt.TEXTURE_2D)return"2d";if(e===bt.TEXTURE_CUBE_MAP)return"2d";if(e===bt.TEXTURE_2D_ARRAY)return"2d";if(e===bt.TEXTURE_3D)return"3d";throw new Error("whoops")}function VK(e){if(e===bt.TEXTURE_2D)return"2d";if(e===bt.TEXTURE_CUBE_MAP)return"cube";if(e===bt.TEXTURE_2D_ARRAY)return"2d-array";if(e===bt.TEXTURE_3D)return"3d";throw new Error("whoops")}function HK(e){var t=0;return e&Wt.INDEX&&(t|=GPUBufferUsage.INDEX),e&Wt.VERTEX&&(t|=GPUBufferUsage.VERTEX),e&Wt.UNIFORM&&(t|=GPUBufferUsage.UNIFORM),e&Wt.STORAGE&&(t|=GPUBufferUsage.STORAGE),e&Wt.COPY_SRC&&(t|=GPUBufferUsage.COPY_SRC),e&Wt.INDIRECT&&(t|=GPUBufferUsage.INDIRECT),t|=GPUBufferUsage.COPY_DST,t}function nd(e){if(e===tn.CLAMP_TO_EDGE)return"clamp-to-edge";if(e===tn.REPEAT)return"repeat";if(e===tn.MIRRORED_REPEAT)return"mirror-repeat";throw new Error("whoops")}function $1(e){if(e===lr.BILINEAR)return"linear";if(e===lr.POINT)return"nearest";throw new Error("whoops")}function jK(e){if(e===Or.LINEAR)return"linear";if(e===Or.NEAREST)return"nearest";if(e===Or.NO_MIP)return"nearest";throw new Error("whoops")}function Aa(e){var t=e;return t.gpuBuffer}function XK(e){var t=e;return t.gpuSampler}function WK(e){var t=e;return t.querySet}function GK(e){if(e===Uc.OcclusionConservative)return"occlusion";throw new Error("whoops")}function YK(e){switch(e){case gr.TRIANGLES:return"triangle-list";case gr.POINTS:return"point-list";case gr.TRIANGLE_STRIP:return"triangle-strip";case gr.LINES:return"line-list";case gr.LINE_STRIP:return"line-strip";default:throw new Error("Unknown primitive topology mode")}}function ZK(e){if(e===pn.NONE)return"none";if(e===pn.FRONT)return"front";if(e===pn.BACK)return"back";throw new Error("whoops")}function qK(e){if(e===Cu.CCW)return"ccw";if(e===Cu.CW)return"cw";throw new Error("whoops")}function KK(e,t){return{topology:YK(e),cullMode:ZK(t.cullMode),frontFace:qK(t.frontFace)}}function z1(e){if(e===xt.ZERO)return"zero";if(e===xt.ONE)return"one";if(e===xt.SRC)return"src";if(e===xt.ONE_MINUS_SRC)return"one-minus-src";if(e===xt.DST)return"dst";if(e===xt.ONE_MINUS_DST)return"one-minus-dst";if(e===xt.SRC_ALPHA)return"src-alpha";if(e===xt.ONE_MINUS_SRC_ALPHA)return"one-minus-src-alpha";if(e===xt.DST_ALPHA)return"dst-alpha";if(e===xt.ONE_MINUS_DST_ALPHA)return"one-minus-dst-alpha";if(e===xt.CONST)return"constant";if(e===xt.ONE_MINUS_CONSTANT)return"one-minus-constant";if(e===xt.SRC_ALPHA_SATURATE)return"src-alpha-saturated";throw new Error("whoops")}function QK(e){if(e===wr.ADD)return"add";if(e===wr.SUBSTRACT)return"subtract";if(e===wr.REVERSE_SUBSTRACT)return"reverse-subtract";if(e===wr.MIN)return"min";if(e===wr.MAX)return"max";throw new Error("whoops")}function V1(e){return{operation:QK(e.blendMode),srcFactor:z1(e.blendSrcFactor),dstFactor:z1(e.blendDstFactor)}}function H1(e){return e.blendMode===wr.ADD&&e.blendSrcFactor===xt.ONE&&e.blendDstFactor===xt.ZERO}function JK(e){if(!(H1(e.rgbBlendState)&&H1(e.alphaBlendState)))return{color:V1(e.rgbBlendState),alpha:V1(e.alphaBlendState)}}function eQ(e,t){return{format:u_(t),blend:JK(e),writeMask:e.channelWriteMask}}function tQ(e,t){return t.attachmentsState.map(function(r,n){return eQ(r,e[n])})}function oc(e){if(e===kt.NEVER)return"never";if(e===kt.LESS)return"less";if(e===kt.EQUAL)return"equal";if(e===kt.LEQUAL)return"less-equal";if(e===kt.GREATER)return"greater";if(e===kt.NOTEQUAL)return"not-equal";if(e===kt.GEQUAL)return"greater-equal";if(e===kt.ALWAYS)return"always";throw new Error("whoops")}function da(e){if(e===ar.KEEP)return"keep";if(e===ar.REPLACE)return"replace";if(e===ar.ZERO)return"zero";if(e===ar.DECREMENT_CLAMP)return"decrement-clamp";if(e===ar.DECREMENT_WRAP)return"decrement-wrap";if(e===ar.INCREMENT_CLAMP)return"increment-clamp";if(e===ar.INCREMENT_WRAP)return"increment-wrap";if(e===ar.INVERT)return"invert";throw new Error("whoops")}function rQ(e,t){if(!wn(e))return{format:u_(e),depthWriteEnabled:!!t.depthWrite,depthCompare:oc(t.depthCompare),depthBias:t.polygonOffset?t.polygonOffsetUnits:0,depthBiasSlopeScale:t.polygonOffset?t.polygonOffsetFactor:0,stencilFront:{compare:oc(t.stencilFront.compare),passOp:da(t.stencilFront.passOp),failOp:da(t.stencilFront.failOp),depthFailOp:da(t.stencilFront.depthFailOp)},stencilBack:{compare:oc(t.stencilBack.compare),passOp:da(t.stencilBack.passOp),failOp:da(t.stencilBack.failOp),depthFailOp:da(t.stencilBack.depthFailOp)},stencilReadMask:4294967295,stencilWriteMask:4294967295}}function nQ(e){if(e!==null){if(e===X.U16_R)return"uint16";if(e===X.U32_R)return"uint32";throw new Error("whoops")}}function iQ(e){if(e===Io.VERTEX)return"vertex";if(e===Io.INSTANCE)return"instance";throw new Error("whoops")}function oQ(e){if(e===X.U8_R)return"uint8x2";if(e===X.U8_RG)return"uint8x2";if(e===X.U8_RGB)return"uint8x4";if(e===X.U8_RGBA)return"uint8x4";if(e===X.U8_RG_NORM)return"unorm8x2";if(e===X.U8_RGBA_NORM)return"unorm8x4";if(e===X.S8_RGB_NORM)return"snorm8x4";if(e===X.S8_RGBA_NORM)return"snorm8x4";if(e===X.U16_RG_NORM)return"unorm16x2";if(e===X.U16_RGBA_NORM)return"unorm16x4";if(e===X.S16_RG_NORM)return"snorm16x2";if(e===X.S16_RGBA_NORM)return"snorm16x4";if(e===X.S16_RG)return"uint16x2";if(e===X.F16_RG)return"float16x2";if(e===X.F16_RGBA)return"float16x4";if(e===X.F32_R)return"float32";if(e===X.F32_RG)return"float32x2";if(e===X.F32_RGB)return"float32x3";if(e===X.F32_RGBA)return"float32x4";throw"whoops"}function aQ(e){var t=si(e);switch(t){case de.BC1:case de.BC2:case de.BC3:case de.BC4_SNORM:case de.BC4_UNORM:case de.BC5_SNORM:case de.BC5_UNORM:return!0;default:return!1}}function sQ(e){var t=si(e);switch(t){case de.BC1:case de.BC2:case de.BC3:case de.BC4_SNORM:case de.BC4_UNORM:case de.BC5_SNORM:case de.BC5_UNORM:return 4;default:return 1}}function j1(e,t,r,n){switch(r===void 0&&(r=!1),e){case X.S8_R:case X.S8_R_NORM:case X.S8_RG_NORM:case X.S8_RGB_NORM:case X.S8_RGBA_NORM:{var i=t instanceof ArrayBuffer?new Int8Array(t):new Int8Array(t);return n&&i.set(new Int8Array(n)),i}case X.U8_R:case X.U8_R_NORM:case X.U8_RG:case X.U8_RG_NORM:case X.U8_RGB:case X.U8_RGB_NORM:case X.U8_RGB_SRGB:case X.U8_RGBA:case X.U8_RGBA_NORM:case X.U8_RGBA_SRGB:{var o=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t);return n&&o.set(new Uint8Array(n)),o}case X.S16_R:case X.S16_RG:case X.S16_RG_NORM:case X.S16_RGB_NORM:case X.S16_RGBA:case X.S16_RGBA_NORM:{var a=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(r?t/2:t);return n&&a.set(new Int16Array(n)),a}case X.U16_R:case X.U16_RGB:case X.U16_RGBA_5551:case X.U16_RGBA_NORM:case X.U16_RG_NORM:case X.U16_R_NORM:{var s=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(r?t/2:t);return n&&s.set(new Uint16Array(n)),s}case X.S32_R:{var u=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(r?t/4:t);return n&&u.set(new Int32Array(n)),u}case X.U32_R:case X.U32_RG:{var l=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(r?t/4:t);return n&&l.set(new Uint32Array(n)),l}case X.F32_R:case X.F32_RG:case X.F32_RGB:case X.F32_RGBA:{var f=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(r?t/4:t);return n&&f.set(new Float32Array(n)),f}}var c=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t);return n&&c.set(new Uint8Array(n)),c}function uQ(e){var t=(e&32768)>>15,r=(e&31744)>>10,n=e&1023;return r===0?(t?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):r==31?n?NaN:(t?-1:1)*(1/0):(t?-1:1)*Math.pow(2,r-15)*(1+n/Math.pow(2,10))}function _x(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return{width:1,height:1,length:1};case"r16uint":case"r16sint":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":return{width:1,height:1,length:2};case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb9e5ufloat":case"rgb10a2unorm":case"rg11b10ufloat":return{width:1,height:1,length:4};case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":return{width:1,height:1,length:8};case"rgba32uint":case"rgba32sint":case"rgba32float":return{width:1,height:1,length:16};case"stencil8":throw new Error("No fixed size for Stencil8 format!");case"depth16unorm":return{width:1,height:1,length:2};case"depth24plus":throw new Error("No fixed size for Depth24Plus format!");case"depth24plus-stencil8":throw new Error("No fixed size for Depth24PlusStencil8 format!");case"depth32float":return{width:1,height:1,length:4};case"depth32float-stencil8":return{width:1,height:1,length:5};case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc5-rg-unorm":case"bc5-rg-snorm":return{width:4,height:4,length:16};case"bc4-r-unorm":case"bc4-r-snorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":return{width:4,height:4,length:8};default:return{width:1,height:1,length:4}}}var Qn=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this)||this;return o.id=n,o.device=i,o}return t.prototype.destroy=function(){},t}(ex),lQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a,s,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Bindings;var l=o.pipeline;ht(!!l);var f=o.uniformBufferBindings,c=o.storageBufferBindings,h=o.samplerBindings,d=o.storageTextureBindings;u.numUniformBuffers=(f==null?void 0:f.length)||0;var p=[[],[],[],[]],v=0;if(f&&f.length)for(var g=0;gc;)this.device.device.queue.writeBuffer(a,r+h,n.buffer,s+h,c),h+=c;this.device.device.queue.writeBuffer(a,r+h,n.buffer,s+h,o-h)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.gpuBuffer.destroy()},t}(Qn),X1=function(){function e(){this.gpuComputePassEncoder=null}return e.prototype.dispatchWorkgroups=function(t,r,n){this.gpuComputePassEncoder.dispatchWorkgroups(t,r,n)},e.prototype.dispatchWorkgroupsIndirect=function(t,r){this.gpuComputePassEncoder.dispatchWorkgroupsIndirect(t.gpuBuffer,r)},e.prototype.finish=function(){this.gpuComputePassEncoder.end(),this.gpuComputePassEncoder=null,this.frameCommandEncoder=null},e.prototype.beginComputePass=function(t){ht(this.gpuComputePassEncoder===null),this.frameCommandEncoder=t,this.gpuComputePassEncoder=this.frameCommandEncoder.beginComputePass(this.gpuComputePassDescriptor)},e.prototype.setPipeline=function(t){var r=t,n=Eo(r.gpuComputePipeline);this.gpuComputePassEncoder.setPipeline(n)},e.prototype.setBindings=function(t){var r=this,n=t;n.gpuBindGroup.forEach(function(i,o){i&&r.gpuComputePassEncoder.setBindGroup(o,n.gpuBindGroup[o])})},e.prototype.pushDebugGroup=function(t){this.gpuComputePassEncoder.pushDebugGroup(t)},e.prototype.popDebugGroup=function(){this.gpuComputePassEncoder.popDebugGroup()},e.prototype.insertDebugMarker=function(t){this.gpuComputePassEncoder.insertDebugMarker(t)},e}(),fQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.ComputePipeline,a.gpuComputePipeline=null,a.descriptor=o;var s=o.program,u=s.computeStage;if(u===null)return a;var l={layout:"auto",compute:nr({},u)};return a.gpuComputePipeline=a.device.device.createComputePipeline(l),a.name!==void 0&&(a.gpuComputePipeline.label=a.name),a}return t.prototype.getBindGroupLayout=function(r){return this.gpuComputePipeline.getBindGroupLayout(r)},t}(Qn),hQ=function(e){sr(t,e);function t(r){var n,i,o,a,s=r.id,u=r.device,l=r.descriptor,f=e.call(this,{id:s,device:u})||this;f.type=Lt.InputLayout;var c=[];try{for(var h=Oo(l.vertexBufferDescriptors),d=h.next();!d.done;d=h.next()){var p=d.value,v=p.arrayStride,g=p.stepMode,y=p.attributes;c.push({arrayStride:v,stepMode:iQ(g),attributes:[]});try{for(var S=(o=void 0,Oo(y)),R=S.next();!R.done;R=S.next()){var x=R.value,M=x.shaderLocation,$=x.format,F=x.offset;c[c.length-1].attributes.push({shaderLocation:M,format:oQ($),offset:F})}}catch(Y){o={error:Y}}finally{try{R&&!R.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}}}catch(Y){n={error:Y}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return f.indexFormat=nQ(l.indexBufferFormat),f.buffers=c,f}return t}(Qn),W1=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;return a.type=Lt.Program,a.vertexStage=null,a.fragmentStage=null,a.computeStage=null,a.descriptor=o,o.vertex&&(a.vertexStage=a.createShaderStage(o.vertex,"vertex")),o.fragment&&(a.fragmentStage=a.createShaderStage(o.fragment,"fragment")),o.compute&&(a.computeStage=a.createShaderStage(o.compute,"compute")),a}return t.prototype.setUniformsLegacy=function(r){},t.prototype.createShaderStage=function(r,n){var i,o,a=r.glsl,s=r.wgsl,u=r.entryPoint,l=r.postprocess,f=!1,c=s;if(!c)try{c=this.device.glsl_compile(a,n,f)}catch(y){throw console.error(y,a),new Error("whoops")}var h=function(y){if(!c.includes(y))return"continue";c=c.replace("var T_".concat(y,": texture_2d;"),"var T_".concat(y,": texture_depth_2d;")),c=c.replace(new RegExp("textureSample\\(T_".concat(y,"(.*)\\);$"),"gm"),function(S,R){return"vec4(textureSample(T_".concat(y).concat(R,"), 0.0, 0.0, 0.0);")})};try{for(var d=Oo(["u_TextureFramebufferDepth"]),p=d.next();!p.done;p=d.next()){var v=p.value;h(v)}}catch(y){i={error:y}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}l&&(c=l(c));var g=this.device.device.createShaderModule({code:c});return{module:g,entryPoint:u||"main"}},t}(Qn),dQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.QueryPool;var s=o.elemCount,u=o.type;return a.querySet=a.device.device.createQuerySet({type:GK(u),count:s}),a.resolveBuffer=a.device.device.createBuffer({size:s*8,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),a.cpuBuffer=a.device.device.createBuffer({size:s*8,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),a.results=null,a}return t.prototype.queryResultOcclusion=function(r){return this.results===null?null:this.results[r]!==BigInt(0)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.querySet.destroy(),this.resolveBuffer.destroy(),this.cpuBuffer.destroy()},t}(Qn),pQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this,{id:n,device:i})||this;return o.type=Lt.Readback,o}return t.prototype.readTexture=function(r,n,i,o,a,s,u,l){return u===void 0&&(u=0),Ia(this,void 0,void 0,function(){var f,c,h,d,p,v,g,y;return Ma(this,function(S){return f=r,c=0,h=_x(f.gpuTextureformat),d=Math.ceil(o/h.width)*h.length,p=Math.ceil(d/256)*256,v=p*a,g=this.device.createBuffer({usage:Wt.STORAGE|Wt.MAP_READ|Wt.COPY_DST,hint:qn.STATIC,viewOrSize:v}),y=this.device.device.createCommandEncoder(),y.copyTextureToBuffer({texture:f.gpuTexture,mipLevel:0,origin:{x:n,y:i,z:Math.max(c,0)}},{buffer:g.gpuBuffer,offset:0,bytesPerRow:p},{width:o,height:a,depthOrArrayLayers:1}),this.device.device.queue.submit([y.finish()]),[2,this.readBuffer(g,0,s.byteLength===v?s:null,u,v,f.format,!0,!1,d,p,a)]})})},t.prototype.readTextureSync=function(r,n,i,o,a,s,u,l){throw new Error("ERROR_MSG_METHOD_NOT_IMPLEMENTED")},t.prototype.readBuffer=function(r,n,i,o,a,s,u,l,f,c,h){var d=this;n===void 0&&(n=0),i===void 0&&(i=null),a===void 0&&(a=0),s===void 0&&(s=X.U8_RGB),u===void 0&&(u=!1),f===void 0&&(f=0),c===void 0&&(c=0),h===void 0&&(h=0);var p=r,v=a||p.size,g=i||p.view,y=g&&g.constructor&&g.constructor.BYTES_PER_ELEMENT||rx(s),S=p;if(!(p.usage&Wt.MAP_READ&&p.usage&Wt.COPY_DST)){var R=this.device.device.createCommandEncoder();S=this.device.createBuffer({usage:Wt.STORAGE|Wt.MAP_READ|Wt.COPY_DST,hint:qn.STATIC,viewOrSize:v}),R.copyBufferToBuffer(p.gpuBuffer,n,S.gpuBuffer,0,v),this.device.device.queue.submit([R.finish()])}return new Promise(function(x,M){S.gpuBuffer.mapAsync(up.READ,n,v).then(function(){var $=S.gpuBuffer.getMappedRange(n,v),F=g;if(u)F===null?F=j1(s,v,!0,$):F=j1(s,F.buffer,void 0,$);else if(F===null)switch(y){case 1:F=new Uint8Array(v),F.set(new Uint8Array($));break;case 2:F=d.getHalfFloatAsFloatRGBAArrayBuffer(v/2,$);break;case 4:F=new Float32Array(v/4),F.set(new Float32Array($));break}else switch(y){case 1:F=new Uint8Array(F.buffer),F.set(new Uint8Array($));break;case 2:F=d.getHalfFloatAsFloatRGBAArrayBuffer(v/2,$,g);break;case 4:var Y=g&&g.constructor||Float32Array;F=new Y(F.buffer),F.set(new Y($));break}if(f!==c){y===1&&!u&&(f*=2,c*=2);for(var ge=new Uint8Array(F.buffer),q=f,k=0,G=1;G1?h.resolveTarget=this.getTextureView(c,this.gfxColorResolveToLevel[l]):h.storeOp="store")}else{this.gpuColorAttachments.length=l,this.gfxColorAttachment.length=l,this.gfxColorResolveTo.length=l;break}}if(this.gfxDepthStencilAttachment=t.depthStencilAttachment,this.gfxDepthStencilResolveTo=t.depthStencilResolveTo,t.depthStencilAttachment){var p=t.depthStencilAttachment,h=this.gpuDepthStencilAttachment;h.view=p.gpuTextureView;var v=!!(ka(p.format)&$e.Depth);v?(t.depthClearValue==="load"?h.depthLoadOp="load":(h.depthLoadOp="clear",h.depthClearValue=t.depthClearValue),t.depthStencilStore||this.gfxDepthStencilResolveTo!==null?h.depthStoreOp="store":h.depthStoreOp="discard"):(h.depthLoadOp=void 0,h.depthStoreOp=void 0);var g=!!(ka(p.format)&$e.Stencil);g?(t.stencilClearValue==="load"?h.stencilLoadOp="load":(h.stencilLoadOp="clear",h.stencilClearValue=t.stencilClearValue),t.depthStencilStore||this.gfxDepthStencilResolveTo!==null?h.stencilStoreOp="store":h.stencilStoreOp="discard"):(h.stencilLoadOp=void 0,h.stencilStoreOp=void 0),this.gpuRenderPassDescriptor.depthStencilAttachment=this.gpuDepthStencilAttachment}else this.gpuRenderPassDescriptor.depthStencilAttachment=void 0;this.gpuRenderPassDescriptor.occlusionQuerySet=wn(t.occlusionQueryPool)?void 0:WK(t.occlusionQueryPool)},e.prototype.beginRenderPass=function(t,r){ht(this.gpuRenderPassEncoder===null),this.setRenderPassDescriptor(r),this.frameCommandEncoder=t,this.gpuRenderPassEncoder=this.frameCommandEncoder.beginRenderPass(this.gpuRenderPassDescriptor)},e.prototype.flipY=function(t,r){var n=this.device.swapChainHeight;return n-t-r},e.prototype.setViewport=function(t,r,n,i,o,a){o===void 0&&(o=0),a===void 0&&(a=1),this.gpuRenderPassEncoder.setViewport(t,this.flipY(r,i),n,i,o,a)},e.prototype.setScissorRect=function(t,r,n,i){this.gpuRenderPassEncoder.setScissorRect(t,this.flipY(r,i),n,i)},e.prototype.setPipeline=function(t){var r=t,n=Eo(r.gpuRenderPipeline);this.getEncoder().setPipeline(n)},e.prototype.setVertexInput=function(t,r,n){if(t!==null){var i=this.getEncoder(),o=t;n!==null&&i.setIndexBuffer(Aa(n.buffer),Eo(o.indexFormat),n.offset);for(var a=0;a1||this.copyAttachment(this.gfxDepthStencilResolveTo,0,this.gfxDepthStencilAttachment,0)),this.frameCommandEncoder=null},e.prototype.copyAttachment=function(t,r,n,i){ht(n.sampleCount===1);var o={texture:n.gpuTexture,mipLevel:i},a={texture:t.gpuTexture,mipLevel:r};ht(n.width>>>i===t.width>>>r),ht(n.height>>>i===t.height>>>r),ht(!!(n.usage&Cr.COPY_SRC)),ht(!!(t.usage&Cr.COPY_DST)),this.frameCommandEncoder.copyTextureToTexture(o,a,[t.width,t.height,1])},e}(),_Q=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;return a.type=Lt.RenderPipeline,a.isCreatingAsync=!1,a.gpuRenderPipeline=null,a.descriptor=o,a.device.createRenderPipelineInternal(a,!1),a}return t.prototype.getBindGroupLayout=function(r){return this.gpuRenderPipeline.getBindGroupLayout(r)},t}(Qn),vQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a,s,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Sampler;var l=o.lodMinClamp,f=o.mipmapFilter===Or.NO_MIP?o.lodMinClamp:o.lodMaxClamp,c=(a=o.maxAnisotropy)!==null&&a!==void 0?a:1;return c>1&&ht(o.minFilter===lr.BILINEAR&&o.magFilter===lr.BILINEAR&&o.mipmapFilter===Or.LINEAR),u.gpuSampler=u.device.device.createSampler({addressModeU:nd(o.addressModeU),addressModeV:nd(o.addressModeV),addressModeW:nd((s=o.addressModeW)!==null&&s!==void 0?s:o.addressModeU),lodMinClamp:l,lodMaxClamp:f,minFilter:$1(o.minFilter),magFilter:$1(o.magFilter),mipmapFilter:jK(o.mipmapFilter),compare:o.compareFunction!==void 0?oc(o.compareFunction):void 0,maxAnisotropy:c}),u}return t}(Qn),Vl=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=r.skipCreate,s=r.sampleCount,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Texture,u.flipY=!1;var l=o.format,f=o.dimension,c=o.width,h=o.height,d=o.depthOrArrayLayers,p=o.mipLevelCount,v=o.usage,g=o.pixelStore;return u.flipY=!!(g!=null&&g.unpackFlipY),u.device.createTextureShared({format:l,dimension:f??bt.TEXTURE_2D,width:c,height:h,depthOrArrayLayers:d??1,mipLevelCount:p??1,usage:v,sampleCount:s??1},u,a),u}return t.prototype.textureFromImageBitmapOrCanvas=function(r,n,i){for(var o=n[0].width,a=n[0].height,s={size:{width:o,height:a,depthOrArrayLayers:i},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT},u=r.createTexture(s),l=0;l>>2,uniformBufferWordAlignment:this.device.limits.minUniformBufferOffsetAlignment>>>2,supportedSampleCounts:[1],occlusionQueriesRecommended:!0,computeShadersSupported:!0}},e.prototype.queryTextureFormatSupported=function(t,r,n){if(aQ(t)){if(!this.featureTextureCompressionBC)return!1;var i=sQ(t);return r%i!==0||n%i!==0?!1:this.featureTextureCompressionBC}switch(t){case X.U16_RGBA_NORM:return!1;case X.F32_RGBA:return!1}return!0},e.prototype.queryPlatformAvailable=function(){return!0},e.prototype.queryVendorInfo=function(){return this},e.prototype.queryRenderPass=function(t){var r=t;return r.descriptor},e.prototype.queryRenderTarget=function(t){var r=t;return r},e.prototype.setResourceName=function(t,r){if(t.name=r,t.type===Lt.Buffer){var n=t;n.gpuBuffer.label=r}else if(t.type===Lt.Texture){var n=t;n.gpuTexture.label=r,n.gpuTextureView.label=r}else if(t.type===Lt.RenderTarget){var n=t;n.gpuTexture.label=r,n.gpuTextureView.label=r}else if(t.type===Lt.Sampler){var n=t;n.gpuSampler.label=r}else if(t.type===Lt.RenderPipeline){var n=t;n.gpuRenderPipeline!==null&&(n.gpuRenderPipeline.label=r)}},e.prototype.setResourceLeakCheck=function(t,r){},e.prototype.checkForLeaks=function(){},e.prototype.programPatched=function(t){},e.prototype.pipelineQueryReady=function(t){var r=t;return r.gpuRenderPipeline!==null},e.prototype.pipelineForceReady=function(t){var r=t;this.createRenderPipelineInternal(r,!1)},e}(),EQ=function(){function e(t){this.pluginOptions=t}return e.prototype.createSwapChain=function(t){return Ia(this,void 0,void 0,function(){var r,n,i,o,a,s,u,l;return Ma(this,function(f){switch(f.label){case 0:if(globalThis.navigator.gpu===void 0)return[2,null];r=null,f.label=1;case 1:return f.trys.push([1,3,,4]),n=this.pluginOptions.xrCompatible,[4,globalThis.navigator.gpu.requestAdapter({xrCompatible:n})];case 2:return r=f.sent(),[3,4];case 3:return i=f.sent(),console.log(i),[3,4];case 4:return r===null?[2,null]:(o=["depth32float-stencil8","texture-compression-bc","float32-filterable"],a=o.filter(function(c){return r.features.has(c)}),[4,r.requestDevice({requiredFeatures:a})]);case 5:if(s=f.sent(),s&&(u=this.pluginOptions.onContextLost,s.lost.then(function(){u&&u()})),s===null)return[2,null];if(l=t.getContext("webgpu"),!l)return[2,null];f.label=6;case 6:return f.trys.push([6,8,,9]),[4,px(this.pluginOptions.shaderCompilerPath)];case 7:return f.sent(),[3,9];case 8:return f.sent(),[3,9];case 9:return[2,new gQ(r,s,t,l,BK,Ou&&new Ou)]}})})},e}(),yQ=class{constructor(e,t){const{buffer:r,offset:n,stride:i,normalized:o,size:a,divisor:s,shaderLocation:u}=t;this.buffer=r,this.attribute={shaderLocation:u,buffer:r.get(),offset:n||0,stride:i||0,normalized:o||!1,divisor:s||0},a&&(this.attribute.size=a)}get(){return this.buffer}updateBuffer(e){this.buffer.subData(e)}destroy(){this.buffer.destroy()}},Wc={[m.FLOAT]:Float32Array,[m.UNSIGNED_BYTE]:Uint8Array,[m.SHORT]:Int16Array,[m.UNSIGNED_SHORT]:Uint16Array,[m.INT]:Int32Array,[m.UNSIGNED_INT]:Uint32Array},TQ={[m.POINTS]:gr.POINTS,[m.LINES]:gr.LINES,[m.LINE_LOOP]:gr.LINES,[m.LINE_STRIP]:gr.LINE_STRIP,[m.TRIANGLES]:gr.TRIANGLES,[m.TRIANGLE_FAN]:gr.TRIANGLES,[m.TRIANGLE_STRIP]:gr.TRIANGLE_STRIP},AQ={1:X.F32_R,2:X.F32_RG,3:X.F32_RGB,4:X.F32_RGBA},SQ={[m.STATIC_DRAW]:qn.STATIC,[m.DYNAMIC_DRAW]:qn.DYNAMIC,[m.STREAM_DRAW]:qn.DYNAMIC},Y1={[m.REPEAT]:tn.REPEAT,[m.CLAMP_TO_EDGE]:tn.CLAMP_TO_EDGE,[m.MIRRORED_REPEAT]:tn.MIRRORED_REPEAT},xQ={[m.NEVER]:kt.NEVER,[m.ALWAYS]:kt.ALWAYS,[m.LESS]:kt.LESS,[m.LEQUAL]:kt.LEQUAL,[m.GREATER]:kt.GREATER,[m.GEQUAL]:kt.GEQUAL,[m.EQUAL]:kt.EQUAL,[m.NOTEQUAL]:kt.NOTEQUAL},bQ={[m.FRONT]:pn.FRONT,[m.BACK]:pn.BACK},Z1={[m.FUNC_ADD]:wr.ADD,[m.MIN_EXT]:wr.MIN,[m.MAX_EXT]:wr.MAX,[m.FUNC_SUBTRACT]:wr.SUBSTRACT,[m.FUNC_REVERSE_SUBTRACT]:wr.REVERSE_SUBSTRACT},Hl={[m.ZERO]:xt.ZERO,[m.ONE]:xt.ONE,[m.SRC_COLOR]:xt.SRC,[m.ONE_MINUS_SRC_COLOR]:xt.ONE_MINUS_SRC,[m.SRC_ALPHA]:xt.SRC_ALPHA,[m.ONE_MINUS_SRC_ALPHA]:xt.ONE_MINUS_SRC_ALPHA,[m.DST_COLOR]:xt.DST,[m.ONE_MINUS_DST_COLOR]:xt.ONE_MINUS_DST,[m.DST_ALPHA]:xt.DST_ALPHA,[m.ONE_MINUS_DST_ALPHA]:xt.ONE_MINUS_DST_ALPHA,[m.CONSTANT_COLOR]:xt.CONST,[m.ONE_MINUS_CONSTANT_COLOR]:xt.ONE_MINUS_CONSTANT,[m.CONSTANT_ALPHA]:xt.CONST,[m.ONE_MINUS_CONSTANT_ALPHA]:xt.ONE_MINUS_CONSTANT,[m.SRC_ALPHA_SATURATE]:xt.SRC_ALPHA_SATURATE},pa={[m.REPLACE]:ar.REPLACE,[m.KEEP]:ar.KEEP,[m.ZERO]:ar.ZERO,[m.INVERT]:ar.INVERT,[m.INCR]:ar.INCREMENT_CLAMP,[m.DECR]:ar.DECREMENT_CLAMP,[m.INCR_WRAP]:ar.INCREMENT_WRAP,[m.DECR_WRAP]:ar.DECREMENT_WRAP},RQ={[m.ALWAYS]:kt.ALWAYS,[m.EQUAL]:kt.EQUAL,[m.GEQUAL]:kt.GEQUAL,[m.GREATER]:kt.GREATER,[m.LEQUAL]:kt.LEQUAL,[m.LESS]:kt.LESS,[m.NEVER]:kt.NEVER,[m.NOTEQUAL]:kt.NOTEQUAL},CQ={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121};function Gc(e){return Object.prototype.toString.call(e)in CQ}function OQ(e,t){const r=e.length,n=Math.ceil(r/3),i=r+n,o=new Float32Array(i);for(let a=0;a>>6,e>>>0}function vx(e){return e+=e<<3,e^=e>>>11,e+=e<<15,e>>>0}function q1(){return 0}var MQ=class{constructor(){this.keys=[],this.values=[]}},jl=class{constructor(e,t){this.keyEqualFunc=e,this.keyHashFunc=t,this.buckets=new Map}findBucketIndex(e,t){for(let r=0;r=0;t--)yield e.values[t]}};function K1(e,t){return e=$t(e,t.blendMode),e=$t(e,t.blendSrcFactor),e=$t(e,t.blendDstFactor),e}function NQ(e,t){return e=K1(e,t.rgbBlendState),e=K1(e,t.alphaBlendState),e=$t(e,t.channelWriteMask),e}function PQ(e,t){return e=$t(e,t.r<<24|t.g<<16|t.b<<8|t.a),e}function LQ(e,t){var r,n,i,o,a,s,u,l;for(let f=0;fi&&i>0),r=this.device.createBindings(n),this.bindingsCache.add(n,r)}return r}createRenderPipeline(e){let t=this.renderPipelinesCache.get(e);if(t===null){const r=Yq(e);r.colorAttachmentFormats=r.colorAttachmentFormats.filter(n=>n),t=this.device.createRenderPipeline(r),this.renderPipelinesCache.add(r,t)}return t}createInputLayout(e){e.vertexBufferDescriptors=e.vertexBufferDescriptors.filter(r=>!!r);let t=this.inputLayoutsCache.get(e);if(t===null){const r=Kq(e);t=this.device.createInputLayout(r),this.inputLayoutsCache.add(r,t)}return t}createProgram(e){let t=this.programCache.get(e);if(t===null){const r=DQ(e);t=this.device.createProgram(e),this.programCache.add(r,t)}return t}destroy(){for(const e of this.bindingsCache.values())e.destroy();for(const e of this.renderPipelinesCache.values())e.destroy();for(const e of this.inputLayoutsCache.values())e.destroy();for(const e of this.programCache.values())e.destroy();this.bindingsCache.clear(),this.renderPipelinesCache.clear(),this.inputLayoutsCache.clear(),this.programCache.clear()}},kQ=class{constructor(e,t){const{data:r,type:n,count:i=0}=t;let o;Gc(r)?o=r:o=new Wc[this.type||m.UNSIGNED_INT](r),this.type=n,this.count=i,this.indexBuffer=e.createBuffer({viewOrSize:o,usage:Wt.INDEX})}get(){return this.indexBuffer}subData({data:e}){let t;Gc(e)?t=e:t=new Wc[this.type||m.UNSIGNED_INT](e),this.indexBuffer.setSubData(0,new Uint8Array(t.buffer))}destroy(){this.indexBuffer.destroy()}};function Q1(e){return!!(e&&e.texture)}var mx=class{constructor(e,t){this.device=e,this.options=t,this.isDestroy=!1;const{wrapS:r=m.CLAMP_TO_EDGE,wrapT:n=m.CLAMP_TO_EDGE,aniso:i,mag:o=m.NEAREST,min:a=m.NEAREST}=t;this.createTexture(t),this.sampler=e.createSampler({addressModeU:Y1[r],addressModeV:Y1[n],minFilter:a===m.NEAREST?lr.POINT:lr.BILINEAR,magFilter:o===m.NEAREST?lr.POINT:lr.BILINEAR,mipmapFilter:Or.NO_MIP,maxAnisotropy:i})}createTexture(e){const{type:t=m.UNSIGNED_BYTE,width:r,height:n,flipY:i=!1,format:o=m.RGBA,alignment:a=1,usage:s=pu.SAMPLED,unorm:u=!1,label:l}=e;let{data:f}=e;this.width=r,this.height=n;let c=X.U8_RGBA_RT;if(t===m.UNSIGNED_BYTE&&o===m.RGBA)c=u?X.U8_RGBA_NORM:X.U8_RGBA_RT;else if(t===m.UNSIGNED_BYTE&&o===m.LUMINANCE)c=X.U8_LUMINANCE;else if(t===m.FLOAT&&o===m.LUMINANCE)c=X.F32_LUMINANCE;else if(t===m.FLOAT&&o===m.RGB)this.device.queryVendorInfo().platformString==="WebGPU"?(f&&(f=OQ(f,0)),c=X.F32_RGBA):c=X.F32_RGB;else if(t===m.FLOAT&&o===m.RGBA)c=X.F32_RGBA;else if(t===m.FLOAT&&o===m.RED)c=X.F32_R;else throw new Error(`create texture error, type: ${t}, format: ${o}`);this.texture=this.device.createTexture({format:c,width:r,height:n,usage:s===pu.SAMPLED?qr.SAMPLED:qr.RENDER_TARGET,pixelStore:{unpackFlipY:i,packAlignment:a},mipLevelCount:1}),l&&this.device.setResourceName(this.texture,l),f&&this.texture.setImageData([f])}get(){return this.texture}update(e){const{data:t}=e;this.texture.setImageData([t])}bind(){}resize({width:e,height:t}){(this.width!==e||this.height!==t)&&this.destroy(),this.options.width=e,this.options.height=t,this.createTexture(this.options),this.isDestroy=!1}getSize(){return[this.width,this.height]}destroy(){var e;!this.isDestroy&&!this.texture.destroyed&&((e=this.texture)==null||e.destroy()),this.isDestroy=!0}},gx=class{constructor(e,t){this.device=e,this.options=t,this.createColorRenderTarget(),this.createDepthRenderTarget()}createColorRenderTarget(e=!1){const{width:t,height:r,color:n}=this.options;n&&(Q1(n)?(e&&n.resize({width:t,height:r}),this.colorTexture=n.get(),this.colorRenderTarget=this.device.createRenderTargetFromTexture(this.colorTexture),this.width=n.width,this.height=n.height):t&&r&&(this.colorTexture=this.device.createTexture({format:X.U8_RGBA_RT,usage:qr.RENDER_TARGET,width:t,height:r}),this.colorRenderTarget=this.device.createRenderTargetFromTexture(this.colorTexture),this.width=t,this.height=r))}createDepthRenderTarget(e=!1){const{width:t,height:r,depth:n}=this.options;n&&(Q1(n)?(e&&n.resize({width:t,height:r}),this.depthTexture=n.get(),this.depthRenderTarget=this.device.createRenderTargetFromTexture(this.depthTexture),this.width=n.width,this.height=n.height):t&&r&&(this.depthTexture=this.device.createTexture({format:X.D24_S8,usage:qr.RENDER_TARGET,width:t,height:r}),this.depthRenderTarget=this.device.createRenderTargetFromTexture(this.depthTexture),this.width=t,this.height=r))}get(){return this.colorRenderTarget}destroy(){var e,t;(e=this.colorRenderTarget)==null||e.destroy(),(t=this.depthRenderTarget)==null||t.destroy()}resize({width:e,height:t}){(this.width!==e||this.height!==t)&&(this.destroy(),this.colorTexture.destroyed=!0,this.depthTexture.destroyed=!0,this.options.width=e,this.options.height=t,this.createColorRenderTarget(!0),this.createDepthRenderTarget(!0))}},$Q=Object.defineProperty,zQ=Object.defineProperties,VQ=Object.getOwnPropertyDescriptors,J1=Object.getOwnPropertySymbols,HQ=Object.prototype.hasOwnProperty,jQ=Object.prototype.propertyIsEnumerable,ey=(e,t,r)=>t in e?$Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_o=(e,t)=>{for(var r in t||(t={}))HQ.call(t,r)&&ey(e,r,t[r]);if(J1)for(var r of J1(t))jQ.call(t,r)&&ey(e,r,t[r]);return e},XQ=(e,t)=>zQ(e,VQ(t)),{isPlainObject:WQ,isTypedArray:GQ,isNil:ty}=Sr,YQ=class{constructor(e,t,r){this.device=e,this.options=t,this.service=r,this.destroyed=!1,this.uniforms={},this.vertexBuffers=[];const{vs:n,fs:i,attributes:o,uniforms:a,count:s,elements:u,diagnosticDerivativeUniformityEnabled:l}=t;this.options=t;const f=l?"":this.service.viewportOrigin===Zn.UPPER_LEFT?"diagnostic(off,derivative_uniformity);":"";this.program=r.renderCache.createProgram({vertex:{glsl:n},fragment:{glsl:i,postprocess:p=>f+p}}),a&&(this.uniforms=this.extractUniforms(a));const c=[];let h=0;Object.keys(o).forEach(p=>{const v=o[p],g=v.get();this.vertexBuffers.push(g.get());const{offset:y=0,stride:S=0,size:R=1,divisor:x=0,shaderLocation:M=0}=v.attribute;c.push({arrayStride:S||R*4,stepMode:Io.VERTEX,attributes:[{format:AQ[R],shaderLocation:M,offset:y,divisor:x}]}),h=g.size/R}),s||(this.options.count=h),u&&(this.indexBuffer=u.get());const d=r.renderCache.createInputLayout({vertexBufferDescriptors:c,indexBufferFormat:u?X.U32_R:null,program:this.program});this.inputLayout=d,this.pipeline=this.createPipeline(t)}createPipeline(e,t){var r;const{primitive:n=m.TRIANGLES,depth:i,cull:o,blend:a,stencil:s}=e,u=this.initDepthDrawParams({depth:i}),l=!!(u&&u.enable),f=this.initCullDrawParams({cull:o}),c=!!(f&&f.enable),h=this.getBlendDrawParams({blend:a}),d=!!(h&&h.enable),p=this.getStencilDrawParams({stencil:s}),v=!!(p&&p.enable),g=this.device.createRenderPipeline({inputLayout:this.inputLayout,program:this.program,topology:TQ[n],colorAttachmentFormats:[X.U8_RGBA_RT],depthStencilAttachmentFormat:X.D24_S8,megaStateDescriptor:{attachmentsState:[t?{channelWriteMask:Lr.ALL,rgbBlendState:{blendMode:wr.ADD,blendSrcFactor:xt.ONE,blendDstFactor:xt.ZERO},alphaBlendState:{blendMode:wr.ADD,blendSrcFactor:xt.ONE,blendDstFactor:xt.ZERO}}:{channelWriteMask:v&&p.opFront.zpass===ar.REPLACE?Lr.NONE:Lr.ALL,rgbBlendState:{blendMode:d&&h.equation.rgb||wr.ADD,blendSrcFactor:d&&h.func.srcRGB||xt.SRC_ALPHA,blendDstFactor:d&&h.func.dstRGB||xt.ONE_MINUS_SRC_ALPHA},alphaBlendState:{blendMode:d&&h.equation.alpha||wr.ADD,blendSrcFactor:d&&h.func.srcAlpha||xt.ONE,blendDstFactor:d&&h.func.dstAlpha||xt.ONE}}],blendConstant:d?vf:void 0,depthWrite:l,depthCompare:l&&u.func||kt.LESS,cullMode:c&&f.face||pn.NONE,stencilWrite:v,stencilFront:{compare:v?p.func.cmp:kt.ALWAYS,passOp:p.opFront.zpass,failOp:p.opFront.fail,depthFailOp:p.opFront.zfail,mask:p.opFront.mask},stencilBack:{compare:v?p.func.cmp:kt.ALWAYS,passOp:p.opBack.zpass,failOp:p.opBack.fail,depthFailOp:p.opBack.zfail,mask:p.opBack.mask}}});return v&&!ty((r=s==null?void 0:s.func)==null?void 0:r.ref)&&(g.stencilFuncReference=s.func.ref),g}updateAttributesAndElements(){}updateAttributes(){}addUniforms(e){this.uniforms=_o(_o({},this.uniforms),this.extractUniforms(e))}draw(e,t){const r=_o(_o({},this.options),e),{count:n=0,instances:i,elements:o,uniforms:a={},uniformBuffers:s,textures:u}=r;this.uniforms=_o(_o({},this.uniforms),this.extractUniforms(a));const{renderPass:l,currentFramebuffer:f,width:c,height:h}=this.service;this.pipeline=this.createPipeline(r,t);const d=this.service.device,p=d.swapChainHeight;if(d.swapChainHeight=(f==null?void 0:f.height)||h,l.setViewport(0,0,(f==null?void 0:f.width)||c,(f==null?void 0:f.height)||h),d.swapChainHeight=p,l.setPipeline(this.pipeline),ty(this.pipeline.stencilFuncReference)||l.setStencilReference(this.pipeline.stencilFuncReference),l.setVertexInput(this.inputLayout,this.vertexBuffers.map(v=>({buffer:v})),o?{buffer:this.indexBuffer,offset:0}:null),s&&(this.bindings=d.createBindings({pipeline:this.pipeline,uniformBufferBindings:s.map((v,g)=>{const y=v;return{binding:g,buffer:y.get(),size:y.size}}),samplerBindings:u==null?void 0:u.map(v=>({texture:v.texture,sampler:v.sampler}))})),this.bindings&&(l.setBindings(this.bindings),Object.keys(this.uniforms).forEach(v=>{const g=this.uniforms[v];g instanceof mx?this.uniforms[v]=g.get():g instanceof gx&&(this.uniforms[v]=g.get().texture)}),this.program.setUniformsLegacy(this.uniforms)),o){const v=o.count;v===0?l.draw(n,i):l.drawIndexed(v,i)}else l.draw(n,i)}destroy(){var e,t,r;(e=this.vertexBuffers)==null||e.forEach(n=>n.destroy()),(t=this.indexBuffer)==null||t.destroy(),(r=this.bindings)==null||r.destroy(),this.pipeline.destroy(),this.destroyed=!0}initDepthDrawParams({depth:e}){if(e)return{enable:e.enable===void 0?!0:!!e.enable,mask:e.mask===void 0?!0:!!e.mask,func:xQ[e.func||m.LESS],range:e.range||[0,1]}}getBlendDrawParams({blend:e}){const{enable:t,func:r,equation:n,color:i=[0,0,0,0]}=e||{};return{enable:!!t,func:{srcRGB:Hl[r&&r.srcRGB||m.SRC_ALPHA],srcAlpha:Hl[r&&r.srcAlpha||m.SRC_ALPHA],dstRGB:Hl[r&&r.dstRGB||m.ONE_MINUS_SRC_ALPHA],dstAlpha:Hl[r&&r.dstAlpha||m.ONE_MINUS_SRC_ALPHA]},equation:{rgb:Z1[n&&n.rgb||m.FUNC_ADD],alpha:Z1[n&&n.alpha||m.FUNC_ADD]},color:i}}getStencilDrawParams({stencil:e}){const{enable:t,mask:r=4294967295,func:n={cmp:m.ALWAYS,ref:0,mask:4294967295},opFront:i={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP},opBack:o={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP}}=e||{};return{enable:!!t,mask:r,func:XQ(_o({},n),{cmp:RQ[n.cmp]}),opFront:{fail:pa[i.fail],zfail:pa[i.zfail],zpass:pa[i.zpass],mask:n.mask},opBack:{fail:pa[o.fail],zfail:pa[o.zfail],zpass:pa[o.zpass],mask:n.mask}}}initCullDrawParams({cull:e}){if(e){const{enable:t,face:r=m.BACK}=e;return{enable:!!t,face:bQ[r]}}}extractUniforms(e){const t={};return Object.keys(e).forEach(r=>{this.extractUniformsRecursively(r,e[r],t,"")}),t}extractUniformsRecursively(e,t,r,n){if(t===null||typeof t=="number"||typeof t=="boolean"||Array.isArray(t)&&typeof t[0]=="number"||GQ(t)||t===""||"resize"in t){r[`${n&&n+"."}${e}`]=t;return}WQ(t)&&Object.keys(t).forEach(i=>{this.extractUniformsRecursively(i,t[i],r,`${n&&n+"."}${e}`)}),Array.isArray(t)&&t.forEach((i,o)=>{Object.keys(i).forEach(a=>{this.extractUniformsRecursively(a,i[a],r,`${n&&n+"."}${e}[${o}]`)})})}};function ZQ(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}var id=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),{isUndefined:Xl}=Sr,qQ=class{constructor(){this.uniformBuffers=[],this.queryVerdorInfo=()=>this.device.queryVendorInfo().platformString,this.createModel=e=>new YQ(this.device,e,this),this.createAttribute=e=>new yQ(this.device,e),this.createBuffer=e=>new IQ(this.device,e),this.createElements=e=>new kQ(this.device,e),this.createTexture2D=e=>new mx(this.device,e),this.createFramebuffer=e=>new gx(this.device,e),this.useFramebuffer=(e,t)=>{this.currentFramebuffer=e,this.beginFrame(),t(),this.endFrame(),this.currentFramebuffer=null},this.useFramebufferAsync=(e,t)=>id(this,null,function*(){this.currentFramebuffer=e,this.preRenderPass=this.renderPass,this.beginFrame(),yield t(),this.endFrame(),this.currentFramebuffer=null,this.renderPass=this.preRenderPass}),this.clear=e=>{const{color:t,depth:r,stencil:n,framebuffer:i=null}=e;if(i)i.clearOptions={color:t,depth:r,stencil:n};else{const o=this.queryVerdorInfo();if(o==="WebGL1"){const a=this.getGLContext();Xl(n)?Xl(r)||(a.clearDepth(r),a.clear(a.DEPTH_BUFFER_BIT)):(a.clearStencil(n),a.clear(a.STENCIL_BUFFER_BIT))}else if(o==="WebGL2"){const a=this.getGLContext();Xl(n)?Xl(r)||a.clearBufferfv(a.DEPTH,0,[r]):a.clearBufferiv(a.STENCIL,0,[n])}}},this.viewport=({width:e,height:t})=>{this.swapChain.configureSwapChain(e,t),this.createMainColorDepthRT(e,t),this.width=e,this.height=t},this.readPixels=e=>{const{framebuffer:t,x:r,y:n,width:i,height:o}=e,a=this.device.createReadback(),s=t.colorTexture,u=a.readTextureSync(s,r,this.viewportOrigin===Zn.LOWER_LEFT?n:this.height-n,i,o,new Uint8Array(i*o*4));if(this.viewportOrigin!==Zn.LOWER_LEFT)for(let l=0;lid(this,null,function*(){const{framebuffer:t,x:r,y:n,width:i,height:o}=e,a=this.device.createReadback(),s=t.colorTexture,u=yield a.readTexture(s,r,this.viewportOrigin===Zn.LOWER_LEFT?n:this.height-n,i,o,new Uint8Array(i*o*4));if(this.viewportOrigin!==Zn.LOWER_LEFT)for(let l=0;l({width:this.width,height:this.height}),this.getContainer=()=>{var e;return(e=this.canvas)==null?void 0:e.parentElement},this.getCanvas=()=>this.canvas,this.getGLContext=()=>this.device.gl,this.destroy=()=>{var e;this.canvas=null,(e=this.uniformBuffers)==null||e.forEach(t=>{t.destroy()}),this.device.destroy(),this.renderCache.destroy()}}init(e,t){return id(this,null,function*(){const{enableWebGPU:r,shaderCompilerPath:n,antialias:i}=t;this.canvas=e;const a=yield(r?new EQ({shaderCompilerPath:n}):new NK({targets:["webgl2","webgl1"],antialias:i,onContextLost(u){console.warn("context lost",u)},onContextCreationError(u){console.warn("context creation error",u)},onContextRestored(u){console.warn("context restored",u)}})).createSwapChain(e);a.configureSwapChain(e.width,e.height),this.device=a.getDevice(),this.swapChain=a,this.renderCache=new UQ(this.device),this.currentFramebuffer=null,this.viewportOrigin=this.device.queryVendorInfo().viewportOrigin;const s=this.device.gl;this.extensionObject={OES_texture_float:!ZQ(s)&&this.device.OES_texture_float},this.createMainColorDepthRT(e.width,e.height)})}createMainColorDepthRT(e,t){this.mainColorRT&&this.mainColorRT.destroy(),this.mainDepthRT&&this.mainDepthRT.destroy(),this.mainColorRT=this.device.createRenderTargetFromTexture(this.device.createTexture({format:X.U8_RGBA_RT,width:e,height:t,usage:qr.RENDER_TARGET})),this.mainDepthRT=this.device.createRenderTargetFromTexture(this.device.createTexture({format:X.D24_S8,width:e,height:t,usage:qr.RENDER_TARGET}))}beginFrame(){this.device.beginFrame();const{currentFramebuffer:e,swapChain:t,mainColorRT:r,mainDepthRT:n}=this,i=e?e.colorRenderTarget:r,o=e?null:t.getOnscreenTexture(),a=e?e.depthRenderTarget:n,{color:s=[0,0,0,0],depth:u=1,stencil:l=0}=(e==null?void 0:e.clearOptions)||{},f=i?zu(s[0]*255,s[1]*255,s[2]*255,s[3]):vf,c=a?u:void 0,h=a?l:void 0,d=this.device.createRenderPass({colorAttachment:[i],colorResolveTo:[o],colorClearColor:[f],colorStore:[!0],depthStencilAttachment:a,depthClearValue:c,stencilClearValue:h});this.renderPass=d}endFrame(){this.device.submitPass(this.renderPass),this.device.endFrame()}getPointSizeRange(){const e=this.device.gl;return e.getParameter(e.ALIASED_POINT_SIZE_RANGE)}testExtension(e){return!!this.getGLContext().getExtension(e)}setState(){}setBaseState(){}setCustomLayerDefaults(){}setDirty(e){this.isDirty=e}getDirty(){return this.isDirty}},Ex={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(mo,function(){var r=function(_){return _ instanceof Uint8Array||_ instanceof Uint16Array||_ instanceof Uint32Array||_ instanceof Int8Array||_ instanceof Int16Array||_ instanceof Int32Array||_ instanceof Float32Array||_ instanceof Float64Array||_ instanceof Uint8ClampedArray},n=function(_,b){for(var D=Object.keys(b),te=0;te"u";case"symbol":return typeof _=="symbol"}}function h(_,b,D){c(_,b)||a("invalid parameter type"+u(D)+". expected "+b+", got "+typeof _)}function d(_,b){_>=0&&(_|0)===_||a("invalid parameter type, ("+_+")"+u(b)+". must be a nonnegative integer")}function p(_,b,D){b.indexOf(_)<0&&a("invalid value"+u(D)+". must be one of: "+b)}var v=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(_){Object.keys(_).forEach(function(b){v.indexOf(b)<0&&a('invalid regl constructor argument "'+b+'". must be one of '+v)})}function y(_,b){for(_=_+"";_.length0&&b.push(new x("unknown",0,D))}}),b}function ge(_,b){b.forEach(function(D){var te=_[D.file];if(te){var fe=te.index[D.line];if(fe){fe.errors.push(D),te.hasErrors=!0;return}}_.unknown.hasErrors=!0,_.unknown.lines[0].errors.push(D)})}function q(_,b,D,te,fe){if(!_.getShaderParameter(b,_.COMPILE_STATUS)){var re=_.getShaderInfoLog(b),ae=te===_.FRAGMENT_SHADER?"fragment":"vertex";Je(D,"string",ae+" shader source must be a string",fe);var xe=F(D,fe),Re=Y(re);ge(xe,Re),Object.keys(xe).forEach(function(we){var Ie=xe[we];if(!Ie.hasErrors)return;var Me=[""],Fe=[""];function Te(Ne,Z){Me.push(Ne),Fe.push(Z||"")}Te("file number "+we+": "+Ie.name+` `,"color:red;text-decoration:underline;font-weight:bold"),Ie.lines.forEach(function(Ne){if(Ne.errors.length>0){Te(y(Ne.number,4)+"| ","background-color:yellow; font-weight:bold"),Te(Ne.line+i,"color:red; background-color:yellow; font-weight:bold");var Z=0;Ne.errors.forEach(function(oe){var be=oe.message,De=/^\s*'(.*)'\s*:\s*(.*)$/.exec(be);if(De){var me=De[1];switch(be=De[2],me){case"assign":me="=";break}Z=Math.max(Ne.line.indexOf(me,Z),0)}else Z=0;Te(y("| ",6)),Te(y("^^^",Z+3)+i,"font-weight:bold"),Te(y("| ",6)),Te(be+i,"font-weight:bold")}),Te(y("| ",6)+i)}else Te(y(Ne.number,4)+"| "),Te(Ne.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(Fe[0]=Me.join("%c"),console.log.apply(console,Fe)):console.log(Me.join(""))}),s.raise("Error compiling "+ae+" shader, "+xe[0].name)}}function k(_,b,D,te,fe){if(!_.getProgramParameter(b,_.LINK_STATUS)){var re=_.getProgramInfoLog(b),ae=F(D,fe),xe=F(te,fe),Re='Error linking program with vertex shader, "'+xe[0].name+'", and fragment shader "'+ae[0].name+'"';typeof document<"u"?console.log("%c"+Re+i+"%c"+re,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Re+i+re),s.raise(Re)}}function G(_){_._commandRef=M()}function K(_,b,D,te){G(_);function fe(Re){return Re?te.id(Re):0}_._fragId=fe(_.static.frag),_._vertId=fe(_.static.vert);function re(Re,we){Object.keys(we).forEach(function(Ie){Re[te.id(Ie)]=!0})}var ae=_._uniformSet={};re(ae,b.static),re(ae,b.dynamic);var xe=_._attributeSet={};re(xe,D.static),re(xe,D.dynamic),_._hasCount="count"in _.static||"count"in _.dynamic||"elements"in _.static||"elements"in _.dynamic}function ce(_,b){var D=$();a(_+" in command "+(b||M())+(D==="unknown"?"":" called from "+D))}function Pe(_,b,D){_||ce(b,D||M())}function Xe(_,b,D,te){_ in b||ce("unknown parameter ("+_+")"+u(D)+". possible values: "+Object.keys(b).join(),te||M())}function Je(_,b,D,te){c(_,b)||ce("invalid parameter type"+u(D)+". expected "+b+", got "+typeof _,te||M())}function ft(_){_()}function Ge(_,b,D){_.texture?p(_.texture._texture.internalformat,b,"unsupported texture format for attachment"):p(_.renderbuffer._renderbuffer.format,D,"unsupported renderbuffer format for attachment")}var et=33071,vt=9728,mt=9984,It=9985,wt=9986,gt=9987,xr=5120,Gt=5121,Xr=5122,le=5123,ze=5124,nt=5125,Ae=5126,Dt=32819,Et=32820,zt=33635,Rt=34042,ut=36193,Ut={};Ut[xr]=Ut[Gt]=1,Ut[Xr]=Ut[le]=Ut[ut]=Ut[zt]=Ut[Dt]=Ut[Et]=2,Ut[ze]=Ut[nt]=Ut[Ae]=Ut[Rt]=4;function $r(_,b){return _===Et||_===Dt||_===zt?2:_===Rt?4:Ut[_]*b}function dr(_){return!(_&_-1)&&!!_}function Jt(_,b,D){var te,fe=b.width,re=b.height,ae=b.channels;s(fe>0&&fe<=D.maxTextureSize&&re>0&&re<=D.maxTextureSize,"invalid texture shape"),(_.wrapS!==et||_.wrapT!==et)&&s(dr(fe)&&dr(re),"incompatible wrap mode for texture, both width and height must be power of 2"),b.mipmask===1?fe!==1&&re!==1&&s(_.minFilter!==mt&&_.minFilter!==wt&&_.minFilter!==It&&_.minFilter!==gt,"min filter requires mipmap"):(s(dr(fe)&&dr(re),"texture must be a square power of 2 to support mipmapping"),s(b.mipmask===(fe<<1)-1,"missing or incomplete mipmap data")),b.type===Ae&&(D.extensions.indexOf("oes_texture_float_linear")<0&&s(_.minFilter===vt&&_.magFilter===vt,"filter not supported, must enable oes_texture_float_linear"),s(!_.genMipmaps,"mipmap generation not supported with float textures"));var xe=b.images;for(te=0;te<16;++te)if(xe[te]){var Re=fe>>te,we=re>>te;s(b.mipmask&1<0&&fe<=te.maxTextureSize&&re>0&&re<=te.maxTextureSize,"invalid texture shape"),s(fe===re,"cube map must be square"),s(b.wrapS===et&&b.wrapT===et,"wrap mode not supported by cube map");for(var xe=0;xe>Ie,Te=re>>Ie;s(Re.mipmask&1<1&&b===D&&(b==='"'||b==="'"))return['"'+xi(_.substr(1,_.length-2))+'"'];var te=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(_);if(te)return Kt(_.substr(0,te.index)).concat(Kt(te[1])).concat(Kt(_.substr(te.index+te[0].length)));var fe=_.split(".");if(fe.length===1)return['"'+xi(_)+'"'];for(var re=[],ae=0;ae"u"?1:window.devicePixelRatio,Ie=!1,Me=function(Ne){Ne&&N.raise(Ne)},Fe=function(){};if(typeof b=="string"?(N(typeof document<"u","selector queries only supported in DOM enviroments"),D=document.querySelector(b),N(D,"invalid query string for element")):typeof b=="object"?gf(b)?D=b:Ef(b)?(re=b,fe=re.canvas):(N.constructor(b),"gl"in b?re=b.gl:"canvas"in b?fe=es(b.canvas):"container"in b&&(te=es(b.container)),"attributes"in b&&(ae=b.attributes,N.type(ae,"object","invalid context attributes")),"extensions"in b&&(xe=Ja(b.extensions)),"optionalExtensions"in b&&(Re=Ja(b.optionalExtensions)),"onDone"in b&&(N.type(b.onDone,"function","invalid or missing onDone callback"),Me=b.onDone),"profile"in b&&(Ie=!!b.profile),"pixelRatio"in b&&(we=+b.pixelRatio,N(we>0,"invalid pixel ratio"))):N.raise("invalid arguments to regl"),D&&(D.nodeName.toLowerCase()==="canvas"?fe=D:te=D),!re){if(!fe){N(typeof document<"u","must manually specify webgl context outside of DOM environments");var Te=mf(te||document.body,Me,we);if(!Te)return null;fe=Te.canvas,Fe=Te.onDestroy}ae.premultipliedAlpha===void 0&&(ae.premultipliedAlpha=!0),re=Fo(fe,ae)}return re?{gl:re,canvas:fe,container:te,extensions:xe,optionalExtensions:Re,pixelRatio:we,profile:Ie,onDone:Me,onDestroy:Fe}:(Fe(),Me("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function yf(_,b){var D={};function te(ae){N.type(ae,"string","extension name must be string");var xe=ae.toLowerCase(),Re;try{Re=D[xe]=_.getExtension(xe)}catch{}return!!Re}for(var fe=0;fe65535)<<4,_>>>=b,D=(_>255)<<3,_>>>=D,b|=D,D=(_>15)<<2,_>>>=D,b|=D,D=(_>3)<<1,_>>>=D,b|=D,b|_>>1}function Do(){var _=Qr(8,function(){return[]});function b(re){var ae=Rf(re),xe=_[rs(ae)>>2];return xe.length>0?xe.pop():new ArrayBuffer(ae)}function D(re){_[rs(re.byteLength)>>2].push(re)}function te(re,ae){var xe=null;switch(re){case Tf:xe=new Int8Array(b(ae),0,ae);break;case Vu:xe=new Uint8Array(b(ae),0,ae);break;case Af:xe=new Int16Array(b(2*ae),0,ae);break;case Sf:xe=new Uint16Array(b(2*ae),0,ae);break;case xf:xe=new Int32Array(b(4*ae),0,ae);break;case Bo:xe=new Uint32Array(b(4*ae),0,ae);break;case bf:xe=new Float32Array(b(4*ae),0,ae);break;default:return null}return xe.length!==ae?xe.subarray(0,ae):xe}function fe(re){D(re.buffer)}return{alloc:b,free:D,allocType:te,freeType:fe}}var ur=Do();ur.zero=Do();var Hu=3408,Cf=3410,ju=3411,Xu=3412,Wu=3413,Gu=3414,ns=3415,li=33901,Qi=33902,Ji=3379,Uo=3386,is=34921,Of=36347,If=36348,ko=35661,an=35660,Ri=34930,Jn=36349,zn=34076,eo=34024,An=7936,Vn=7937,Yu=7938,Zu=35724,$o=34047,vn=36063,zo=34852,Ci=3553,Vo=34067,os=34069,as=33984,ei=6408,Sn=5126,qu=5121,Ho=36160,ss=36053,Ku=36064,Mf=16384,Nf=function(_,b){var D=1;b.ext_texture_filter_anisotropic&&(D=_.getParameter($o));var te=1,fe=1;b.webgl_draw_buffers&&(te=_.getParameter(zo),fe=_.getParameter(vn));var re=!!b.oes_texture_float;if(re){var ae=_.createTexture();_.bindTexture(Ci,ae),_.texImage2D(Ci,0,ei,1,1,0,ei,Sn,null);var xe=_.createFramebuffer();if(_.bindFramebuffer(Ho,xe),_.framebufferTexture2D(Ho,Ku,Ci,ae,0),_.bindTexture(Ci,null),_.checkFramebufferStatus(Ho)!==ss)re=!1;else{_.viewport(0,0,1,1),_.clearColor(1,0,0,1),_.clear(Mf);var Re=ur.allocType(Sn,4);_.readPixels(0,0,1,1,ei,Sn,Re),_.getError()?re=!1:(_.deleteFramebuffer(xe),_.deleteTexture(ae),re=Re[0]===1),ur.freeType(Re)}}var we=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Ie=!0;if(!we){var Me=_.createTexture(),Fe=ur.allocType(qu,36);_.activeTexture(as),_.bindTexture(Vo,Me),_.texImage2D(os,0,ei,3,3,0,ei,qu,Fe),ur.freeType(Fe),_.bindTexture(Vo,null),_.deleteTexture(Me),Ie=!_.getError()}return{colorBits:[_.getParameter(Cf),_.getParameter(ju),_.getParameter(Xu),_.getParameter(Wu)],depthBits:_.getParameter(Gu),stencilBits:_.getParameter(ns),subpixelBits:_.getParameter(Hu),extensions:Object.keys(b).filter(function(Te){return!!b[Te]}),maxAnisotropic:D,maxDrawbuffers:te,maxColorAttachments:fe,pointSizeDims:_.getParameter(li),lineWidthDims:_.getParameter(Qi),maxViewportDims:_.getParameter(Uo),maxCombinedTextureUnits:_.getParameter(ko),maxCubeMapSize:_.getParameter(zn),maxRenderbufferSize:_.getParameter(eo),maxTextureUnits:_.getParameter(Ri),maxTextureSize:_.getParameter(Ji),maxAttributes:_.getParameter(is),maxVertexUniforms:_.getParameter(Of),maxVertexTextureUnits:_.getParameter(an),maxVaryingVectors:_.getParameter(If),maxFragmentUniforms:_.getParameter(Jn),glsl:_.getParameter(Zu),renderer:_.getParameter(Vn),vendor:_.getParameter(An),version:_.getParameter(Yu),readFloat:re,npotTextureCube:Ie}};function A(_){return!!_&&typeof _=="object"&&Array.isArray(_.shape)&&Array.isArray(_.stride)&&typeof _.offset=="number"&&_.shape.length===_.stride.length&&(Array.isArray(_.data)||r(_.data))}var O=function(_){return Object.keys(_).map(function(b){return _[b]})},H={shape:Mr,flatten:br};function ue(_,b,D){for(var te=0;te0){var ke;if(Array.isArray(oe[0])){Ce=c_(oe);for(var Ee=1,Be=1;Be0)if(typeof Ee[0]=="number"){var Ue=ur.allocType(me.dtype,Ee.length);h_(Ue,Ee),Ce(Ue,tt),ur.freeType(Ue)}else if(Array.isArray(Ee[0])||r(Ee[0])){at=c_(Ee);var Oe=Pf(Ee,at,me.dtype);Ce(Oe,tt),ur.freeType(Oe)}else N.raise("invalid buffer data")}else if(A(Ee)){at=Ee.shape;var pe=Ee.stride,st=0,Ct=0,Ze=0,yt=0;at.length===1?(st=at[0],Ct=1,Ze=pe[0],yt=0):at.length===2?(st=at[0],Ct=at[1],Ze=pe[0],yt=pe[1]):N.raise("invalid shape");var lt=Array.isArray(Ee.data)?me.dtype:Ju(Ee.data),_t=ur.allocType(lt,st*Ct);d_(_t,Ee.data,st,Ct,Ze,yt,Ee.offset),Ce(_t,tt),ur.freeType(_t)}else N.raise("invalid data for buffer subdata");return Ve}return be||Ve(Z),Ve._reglType="buffer",Ve._buffer=me,Ve.subdata=ke,D.profile&&(Ve.stats=me.stats),Ve.destroy=function(){Fe(me)},Ve}function Ne(){O(re).forEach(function(Z){Z.buffer=_.createBuffer(),_.bindBuffer(Z.type,Z.buffer),_.bufferData(Z.type,Z.persistentData||Z.byteLength,Z.usage)})}return D.profile&&(b.getTotalBufferSize=function(){var Z=0;return Object.keys(re).forEach(function(oe){Z+=re[oe].stats.size}),Z}),{create:Te,createStream:Re,destroyStream:we,clear:function(){O(re).forEach(Fe),xe.forEach(Fe)},getBuffer:function(Z){return Z&&Z._buffer instanceof ae?Z._buffer:null},restore:Ne,_initBuffer:Me}}var Px=0,Lx=0,Fx=1,Bx=1,Dx=4,Ux=4,jo={points:Px,point:Lx,lines:Fx,line:Bx,triangles:Dx,triangle:Ux,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},kx=0,$x=1,us=4,zx=5120,Xo=5121,p_=5122,Wo=5123,__=5124,ro=5125,Ff=34963,Vx=35040,Hx=35044;function jx(_,b,D,te){var fe={},re=0,ae={uint8:Xo,uint16:Wo};b.oes_element_index_uint&&(ae.uint32=ro);function xe(Ne){this.id=re++,fe[this.id]=this,this.buffer=Ne,this.primType=us,this.vertCount=0,this.type=0}xe.prototype.bind=function(){this.buffer.bind()};var Re=[];function we(Ne){var Z=Re.pop();return Z||(Z=new xe(D.create(null,Ff,!0,!1)._buffer)),Me(Z,Ne,Vx,-1,-1,0,0),Z}function Ie(Ne){Re.push(Ne)}function Me(Ne,Z,oe,be,De,me,Ve){Ne.buffer.bind();var Ce;if(Z){var ke=Ve;!Ve&&(!r(Z)||A(Z)&&!r(Z.data))&&(ke=b.oes_element_index_uint?ro:Wo),D._initBuffer(Ne.buffer,Z,oe,ke,3)}else _.bufferData(Ff,me,oe),Ne.buffer.dtype=Ce||Xo,Ne.buffer.usage=oe,Ne.buffer.dimension=3,Ne.buffer.byteLength=me;if(Ce=Ve,!Ve){switch(Ne.buffer.dtype){case Xo:case zx:Ce=Xo;break;case Wo:case p_:Ce=Wo;break;case ro:case __:Ce=ro;break;default:N.raise("unsupported type for element array")}Ne.buffer.dtype=Ce}Ne.type=Ce,N(Ce!==ro||!!b.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Ee=De;Ee<0&&(Ee=Ne.buffer.byteLength,Ce===Wo?Ee>>=1:Ce===ro&&(Ee>>=2)),Ne.vertCount=Ee;var Be=be;if(be<0){Be=us;var tt=Ne.buffer.dimension;tt===1&&(Be=kx),tt===2&&(Be=$x),tt===3&&(Be=us)}Ne.primType=Be}function Fe(Ne){te.elementsCount--,N(Ne.buffer!==null,"must not double destroy elements"),delete fe[Ne.id],Ne.buffer.destroy(),Ne.buffer=null}function Te(Ne,Z){var oe=D.create(null,Ff,!0),be=new xe(oe._buffer);te.elementsCount++;function De(me){if(!me)oe(),be.primType=us,be.vertCount=0,be.type=Xo;else if(typeof me=="number")oe(me),be.primType=us,be.vertCount=me|0,be.type=Xo;else{var Ve=null,Ce=Hx,ke=-1,Ee=-1,Be=0,tt=0;Array.isArray(me)||r(me)||A(me)?Ve=me:(N.type(me,"object","invalid arguments for elements"),"data"in me&&(Ve=me.data,N(Array.isArray(Ve)||r(Ve)||A(Ve),"invalid data for element buffer")),"usage"in me&&(N.parameter(me.usage,Qu,"invalid element buffer usage"),Ce=Qu[me.usage]),"primitive"in me&&(N.parameter(me.primitive,jo,"invalid element buffer primitive"),ke=jo[me.primitive]),"count"in me&&(N(typeof me.count=="number"&&me.count>=0,"invalid vertex count for elements"),Ee=me.count|0),"type"in me&&(N.parameter(me.type,ae,"invalid buffer type"),tt=ae[me.type]),"length"in me?Be=me.length|0:(Be=Ee,tt===Wo||tt===p_?Be*=2:(tt===ro||tt===__)&&(Be*=4))),Me(be,Ve,Ce,ke,Ee,Be,tt)}return De}return De(Ne),De._reglType="elements",De._elements=be,De.subdata=function(me,Ve){return oe.subdata(me,Ve),De},De.destroy=function(){Fe(be)},De}return{create:Te,createStream:we,destroyStream:Ie,getElements:function(Ne){return typeof Ne=="function"&&Ne._elements instanceof xe?Ne._elements:null},clear:function(){O(fe).forEach(Fe)}}}var v_=new Float32Array(1),Xx=new Uint32Array(v_.buffer),Wx=5123;function m_(_){for(var b=ur.allocType(Wx,_.length),D=0;D<_.length;++D)if(isNaN(_[D]))b[D]=65535;else if(_[D]===1/0)b[D]=31744;else if(_[D]===-1/0)b[D]=64512;else{v_[0]=_[D];var te=Xx[0],fe=te>>>31<<15,re=(te<<1>>>24)-127,ae=te>>13&1023;if(re<-24)b[D]=fe;else if(re<-14){var xe=-14-re;b[D]=fe+(ae+1024>>xe)}else re>15?b[D]=fe+31744:b[D]=fe+(re+15<<10)+ae}return b}function cr(_){return Array.isArray(_)||r(_)}var g_=function(_){return!(_&_-1)&&!!_},Gx=34467,ci=3553,E_=34067,el=34069,no=6408,Bf=6406,tl=6407,ls=6409,rl=6410,y_=32854,Df=32855,T_=36194,Yx=32819,Zx=32820,qx=33635,Kx=34042,Uf=6402,nl=34041,kf=35904,$f=35906,Go=36193,zf=33776,Vf=33777,Hf=33778,jf=33779,A_=35986,S_=35987,x_=34798,b_=35840,R_=35841,C_=35842,O_=35843,I_=36196,Yo=5121,Xf=5123,Wf=5125,cs=5126,Qx=10242,Jx=10243,eb=10497,Gf=33071,tb=33648,rb=10240,nb=10241,Yf=9728,ib=9729,Zf=9984,M_=9985,N_=9986,qf=9987,ob=33170,il=4352,ab=4353,sb=4354,ub=34046,lb=3317,cb=37440,fb=37441,hb=37443,P_=37444,ol=33984,db=[Zf,N_,M_,qf],al=[0,ls,rl,tl,no],bn={};bn[ls]=bn[Bf]=bn[Uf]=1,bn[nl]=bn[rl]=2,bn[tl]=bn[kf]=3,bn[no]=bn[$f]=4;function Zo(_){return"[object "+_+"]"}var L_=Zo("HTMLCanvasElement"),w_=Zo("OffscreenCanvas"),F_=Zo("CanvasRenderingContext2D"),B_=Zo("ImageBitmap"),D_=Zo("HTMLImageElement"),U_=Zo("HTMLVideoElement"),pb=Object.keys(Nr).concat([L_,w_,F_,B_,D_,U_]),qo=[];qo[Yo]=1,qo[cs]=4,qo[Go]=2,qo[Xf]=2,qo[Wf]=4;var Dr=[];Dr[y_]=2,Dr[Df]=2,Dr[T_]=2,Dr[nl]=4,Dr[zf]=.5,Dr[Vf]=.5,Dr[Hf]=1,Dr[jf]=1,Dr[A_]=.5,Dr[S_]=1,Dr[x_]=1,Dr[b_]=.5,Dr[R_]=.25,Dr[C_]=.5,Dr[O_]=.25,Dr[I_]=.5;function k_(_){return Array.isArray(_)&&(_.length===0||typeof _[0]=="number")}function $_(_){if(!Array.isArray(_))return!1;var b=_.length;return!(b===0||!cr(_[0]))}function io(_){return Object.prototype.toString.call(_)}function z_(_){return io(_)===L_}function V_(_){return io(_)===w_}function _b(_){return io(_)===F_}function vb(_){return io(_)===B_}function mb(_){return io(_)===D_}function gb(_){return io(_)===U_}function Kf(_){if(!_)return!1;var b=io(_);return pb.indexOf(b)>=0?!0:k_(_)||$_(_)||A(_)}function H_(_){return Nr[Object.prototype.toString.call(_)]|0}function Eb(_,b){var D=b.length;switch(_.type){case Yo:case Xf:case Wf:case cs:var te=ur.allocType(_.type,D);te.set(b),_.data=te;break;case Go:_.data=m_(b);break;default:N.raise("unsupported texture type, must specify a typed array")}}function j_(_,b){return ur.allocType(_.type===Go?cs:_.type,b)}function X_(_,b){_.type===Go?(_.data=m_(b),ur.freeType(b)):_.data=b}function yb(_,b,D,te,fe,re){for(var ae=_.width,xe=_.height,Re=_.channels,we=ae*xe*Re,Ie=j_(_,we),Me=0,Fe=0;Fe=1;)xe+=ae*Re*Re,Re/=2;return xe}else return ae*D*te}function Tb(_,b,D,te,fe,re,ae){var xe={"don't care":il,"dont care":il,nice:sb,fast:ab},Re={repeat:eb,clamp:Gf,mirror:tb},we={nearest:Yf,linear:ib},Ie=n({mipmap:qf,"nearest mipmap nearest":Zf,"linear mipmap nearest":M_,"nearest mipmap linear":N_,"linear mipmap linear":qf},we),Me={none:0,browser:P_},Fe={uint8:Yo,rgba4:Yx,rgb565:qx,"rgb5 a1":Zx},Te={alpha:Bf,luminance:ls,"luminance alpha":rl,rgb:tl,rgba:no,rgba4:y_,"rgb5 a1":Df,rgb565:T_},Ne={};b.ext_srgb&&(Te.srgb=kf,Te.srgba=$f),b.oes_texture_float&&(Fe.float32=Fe.float=cs),b.oes_texture_half_float&&(Fe.float16=Fe["half float"]=Go),b.webgl_depth_texture&&(n(Te,{depth:Uf,"depth stencil":nl}),n(Fe,{uint16:Xf,uint32:Wf,"depth stencil":Kx})),b.webgl_compressed_texture_s3tc&&n(Ne,{"rgb s3tc dxt1":zf,"rgba s3tc dxt1":Vf,"rgba s3tc dxt3":Hf,"rgba s3tc dxt5":jf}),b.webgl_compressed_texture_atc&&n(Ne,{"rgb atc":A_,"rgba atc explicit alpha":S_,"rgba atc interpolated alpha":x_}),b.webgl_compressed_texture_pvrtc&&n(Ne,{"rgb pvrtc 4bppv1":b_,"rgb pvrtc 2bppv1":R_,"rgba pvrtc 4bppv1":C_,"rgba pvrtc 2bppv1":O_}),b.webgl_compressed_texture_etc1&&(Ne["rgb etc1"]=I_);var Z=Array.prototype.slice.call(_.getParameter(Gx));Object.keys(Ne).forEach(function(P){var ie=Ne[P];Z.indexOf(ie)>=0&&(Te[P]=ie)});var oe=Object.keys(Te);D.textureFormats=oe;var be=[];Object.keys(Te).forEach(function(P){var ie=Te[P];be[ie]=P});var De=[];Object.keys(Fe).forEach(function(P){var ie=Fe[P];De[ie]=P});var me=[];Object.keys(we).forEach(function(P){var ie=we[P];me[ie]=P});var Ve=[];Object.keys(Ie).forEach(function(P){var ie=Ie[P];Ve[ie]=P});var Ce=[];Object.keys(Re).forEach(function(P){var ie=Re[P];Ce[ie]=P});var ke=oe.reduce(function(P,ie){var Q=Te[ie];return Q===ls||Q===Bf||Q===ls||Q===rl||Q===Uf||Q===nl||b.ext_srgb&&(Q===kf||Q===$f)?P[Q]=Q:Q===Df||ie.indexOf("rgba")>=0?P[Q]=no:P[Q]=tl,P},{});function Ee(){this.internalformat=no,this.format=no,this.type=Yo,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=P_,this.width=0,this.height=0,this.channels=0}function Be(P,ie){P.internalformat=ie.internalformat,P.format=ie.format,P.type=ie.type,P.compressed=ie.compressed,P.premultiplyAlpha=ie.premultiplyAlpha,P.flipY=ie.flipY,P.unpackAlignment=ie.unpackAlignment,P.colorSpace=ie.colorSpace,P.width=ie.width,P.height=ie.height,P.channels=ie.channels}function tt(P,ie){if(!(typeof ie!="object"||!ie)){if("premultiplyAlpha"in ie&&(N.type(ie.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),P.premultiplyAlpha=ie.premultiplyAlpha),"flipY"in ie&&(N.type(ie.flipY,"boolean","invalid texture flip"),P.flipY=ie.flipY),"alignment"in ie&&(N.oneOf(ie.alignment,[1,2,4,8],"invalid texture unpack alignment"),P.unpackAlignment=ie.alignment),"colorSpace"in ie&&(N.parameter(ie.colorSpace,Me,"invalid colorSpace"),P.colorSpace=Me[ie.colorSpace]),"type"in ie){var Q=ie.type;N(b.oes_texture_float||!(Q==="float"||Q==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),N(b.oes_texture_half_float||!(Q==="half float"||Q==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),N(b.webgl_depth_texture||!(Q==="uint16"||Q==="uint32"||Q==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(Q,Fe,"invalid texture type"),P.type=Fe[Q]}var He=P.width,Tt=P.height,Yt=P.channels,T=!1;"shape"in ie?(N(Array.isArray(ie.shape)&&ie.shape.length>=2,"shape must be an array"),He=ie.shape[0],Tt=ie.shape[1],ie.shape.length===3&&(Yt=ie.shape[2],N(Yt>0&&Yt<=4,"invalid number of channels"),T=!0),N(He>=0&&He<=D.maxTextureSize,"invalid width"),N(Tt>=0&&Tt<=D.maxTextureSize,"invalid height")):("radius"in ie&&(He=Tt=ie.radius,N(He>=0&&He<=D.maxTextureSize,"invalid radius")),"width"in ie&&(He=ie.width,N(He>=0&&He<=D.maxTextureSize,"invalid width")),"height"in ie&&(Tt=ie.height,N(Tt>=0&&Tt<=D.maxTextureSize,"invalid height")),"channels"in ie&&(Yt=ie.channels,N(Yt>0&&Yt<=4,"invalid number of channels"),T=!0)),P.width=He|0,P.height=Tt|0,P.channels=Yt|0;var I=!1;if("format"in ie){var B=ie.format;N(b.webgl_depth_texture||!(B==="depth"||B==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(B,Te,"invalid texture format");var J=P.internalformat=Te[B];P.format=ke[J],B in Fe&&("type"in ie||(P.type=Fe[B])),B in Ne&&(P.compressed=!0),I=!0}!T&&I?P.channels=bn[P.format]:T&&!I?P.channels!==al[P.format]&&(P.format=P.internalformat=al[P.channels]):I&&T&&N(P.channels===bn[P.format],"number of channels inconsistent with specified format")}}function at(P){_.pixelStorei(cb,P.flipY),_.pixelStorei(fb,P.premultiplyAlpha),_.pixelStorei(hb,P.colorSpace),_.pixelStorei(lb,P.unpackAlignment)}function Ue(){Ee.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function Oe(P,ie){var Q=null;if(Kf(ie)?Q=ie:ie&&(N.type(ie,"object","invalid pixel data type"),tt(P,ie),"x"in ie&&(P.xOffset=ie.x|0),"y"in ie&&(P.yOffset=ie.y|0),Kf(ie.data)&&(Q=ie.data)),N(!P.compressed||Q instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),ie.copy){N(!Q,"can not specify copy and data field for the same texture");var He=fe.viewportWidth,Tt=fe.viewportHeight;P.width=P.width||He-P.xOffset,P.height=P.height||Tt-P.yOffset,P.needsCopy=!0,N(P.xOffset>=0&&P.xOffset=0&&P.yOffset0&&P.width<=He&&P.height>0&&P.height<=Tt,"copy texture read out of bounds")}else if(!Q)P.width=P.width||1,P.height=P.height||1,P.channels=P.channels||4;else if(r(Q))P.channels=P.channels||4,P.data=Q,!("type"in ie)&&P.type===Yo&&(P.type=H_(Q));else if(k_(Q))P.channels=P.channels||4,Eb(P,Q),P.alignment=1,P.needsFree=!0;else if(A(Q)){var Yt=Q.data;!Array.isArray(Yt)&&P.type===Yo&&(P.type=H_(Yt));var T=Q.shape,I=Q.stride,B,J,ee,U,j,W;T.length===3?(ee=T[2],W=I[2]):(N(T.length===2,"invalid ndarray pixel data, must be 2 or 3D"),ee=1,W=1),B=T[0],J=T[1],U=I[0],j=I[1],P.alignment=1,P.width=B,P.height=J,P.channels=ee,P.format=P.internalformat=al[ee],P.needsFree=!0,yb(P,Yt,U,j,W,Q.offset)}else if(z_(Q)||V_(Q)||_b(Q))z_(Q)||V_(Q)?P.element=Q:P.element=Q.canvas,P.width=P.element.width,P.height=P.element.height,P.channels=4;else if(vb(Q))P.element=Q,P.width=Q.width,P.height=Q.height,P.channels=4;else if(mb(Q))P.element=Q,P.width=Q.naturalWidth,P.height=Q.naturalHeight,P.channels=4;else if(gb(Q))P.element=Q,P.width=Q.videoWidth,P.height=Q.videoHeight,P.channels=4;else if($_(Q)){var L=P.width||Q[0].length,z=P.height||Q.length,C=P.channels;cr(Q[0][0])?C=C||Q[0][0].length:C=C||1;for(var V=H.shape(Q),ne=1,se=0;se=0,"oes_texture_float extension not enabled"):P.type===Go&&N(D.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function pe(P,ie,Q){var He=P.element,Tt=P.data,Yt=P.internalformat,T=P.format,I=P.type,B=P.width,J=P.height;at(P),He?_.texImage2D(ie,Q,T,T,I,He):P.compressed?_.compressedTexImage2D(ie,Q,Yt,B,J,0,Tt):P.needsCopy?(te(),_.copyTexImage2D(ie,Q,T,P.xOffset,P.yOffset,B,J,0)):_.texImage2D(ie,Q,T,B,J,0,T,I,Tt||null)}function st(P,ie,Q,He,Tt){var Yt=P.element,T=P.data,I=P.internalformat,B=P.format,J=P.type,ee=P.width,U=P.height;at(P),Yt?_.texSubImage2D(ie,Tt,Q,He,B,J,Yt):P.compressed?_.compressedTexSubImage2D(ie,Tt,Q,He,I,ee,U,T):P.needsCopy?(te(),_.copyTexSubImage2D(ie,Tt,Q,He,P.xOffset,P.yOffset,ee,U)):_.texSubImage2D(ie,Tt,Q,He,ee,U,B,J,T)}var Ct=[];function Ze(){return Ct.pop()||new Ue}function yt(P){P.needsFree&&ur.freeType(P.data),Ue.call(P),Ct.push(P)}function lt(){Ee.call(this),this.genMipmaps=!1,this.mipmapHint=il,this.mipmask=0,this.images=Array(16)}function _t(P,ie,Q){var He=P.images[0]=Ze();P.mipmask=1,He.width=P.width=ie,He.height=P.height=Q,He.channels=P.channels=4}function Pt(P,ie){var Q=null;if(Kf(ie))Q=P.images[0]=Ze(),Be(Q,P),Oe(Q,ie),P.mipmask=1;else if(tt(P,ie),Array.isArray(ie.mipmap))for(var He=ie.mipmap,Tt=0;Tt>=Tt,Q.height>>=Tt,Oe(Q,He[Tt]),P.mipmask|=1<=0&&!("faces"in ie)&&(P.genMipmaps=!0)}if("mag"in ie){var He=ie.mag;N.parameter(He,we),P.magFilter=we[He]}var Tt=P.wrapS,Yt=P.wrapT;if("wrap"in ie){var T=ie.wrap;typeof T=="string"?(N.parameter(T,Re),Tt=Yt=Re[T]):Array.isArray(T)&&(N.parameter(T[0],Re),N.parameter(T[1],Re),Tt=Re[T[0]],Yt=Re[T[1]])}else{if("wrapS"in ie){var I=ie.wrapS;N.parameter(I,Re),Tt=Re[I]}if("wrapT"in ie){var B=ie.wrapT;N.parameter(B,Re),Yt=Re[B]}}if(P.wrapS=Tt,P.wrapT=Yt,"anisotropic"in ie){var J=ie.anisotropic;N(typeof J=="number"&&J>=1&&J<=D.maxAnisotropic,"aniso samples must be between 1 and "),P.anisotropic=ie.anisotropic}if("mipmap"in ie){var ee=!1;switch(typeof ie.mipmap){case"string":N.parameter(ie.mipmap,xe,"invalid mipmap hint"),P.mipmapHint=xe[ie.mipmap],P.genMipmaps=!0,ee=!0;break;case"boolean":ee=P.genMipmaps=ie.mipmap;break;case"object":N(Array.isArray(ie.mipmap),"invalid mipmap type"),P.genMipmaps=!1,ee=!0;break;default:N.raise("invalid mipmap type")}ee&&!("min"in ie)&&(P.minFilter=Zf)}}function yr(P,ie){_.texParameteri(ie,nb,P.minFilter),_.texParameteri(ie,rb,P.magFilter),_.texParameteri(ie,Qx,P.wrapS),_.texParameteri(ie,Jx,P.wrapT),b.ext_texture_filter_anisotropic&&_.texParameteri(ie,ub,P.anisotropic),P.genMipmaps&&(_.hint(ob,P.mipmapHint),_.generateMipmap(ie))}var Tr=0,Pr={},zr=D.maxTextureUnits,Ar=Array(zr).map(function(){return null});function dt(P){Ee.call(this),this.mipmask=0,this.internalformat=no,this.id=Tr++,this.refCount=1,this.target=P,this.texture=_.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new qt,ae.profile&&(this.stats={size:0})}function Ur(P){_.activeTexture(ol),_.bindTexture(P.target,P.texture)}function Bt(){var P=Ar[0];P?_.bindTexture(P.target,P.texture):_.bindTexture(ci,null)}function it(P){var ie=P.texture;N(ie,"must not double destroy texture");var Q=P.unit,He=P.target;Q>=0&&(_.activeTexture(ol+Q),_.bindTexture(He,null),Ar[Q]=null),_.deleteTexture(ie),P.texture=null,P.params=null,P.pixels=null,P.refCount=0,delete Pr[P.id],re.textureCount--}n(dt.prototype,{bind:function(){var P=this;P.bindCount+=1;var ie=P.unit;if(ie<0){for(var Q=0;Q0)continue;He.unit=-1}Ar[Q]=P,ie=Q;break}ie>=zr&&N.raise("insufficient number of texture units"),ae.profile&&re.maxTextureUnits>j)-ee,W.height=W.height||(Q.height>>j)-U,N(Q.type===W.type&&Q.format===W.format&&Q.internalformat===W.internalformat,"incompatible format for texture.subimage"),N(ee>=0&&U>=0&&ee+W.width<=Q.width&&U+W.height<=Q.height,"texture.subimage write out of bounds"),N(Q.mipmask&1<>ee;++ee){var U=B>>ee,j=J>>ee;if(!U||!j)break;_.texImage2D(ci,ee,Q.format,U,j,0,Q.format,Q.type,null)}return Bt(),ae.profile&&(Q.stats.size=sl(Q.internalformat,Q.type,B,J,!1,!1)),He}return He(P,ie),He.subimage=Tt,He.resize=Yt,He._reglType="texture2d",He._texture=Q,ae.profile&&(He.stats=Q.stats),He.destroy=function(){Q.decRef()},He}function Nt(P,ie,Q,He,Tt,Yt){var T=new dt(E_);Pr[T.id]=T,re.cubeCount++;var I=new Array(6);function B(U,j,W,L,z,C){var V,ne=T.texInfo;for(qt.call(ne),V=0;V<6;++V)I[V]=St();if(typeof U=="number"||!U){var se=U|0||1;for(V=0;V<6;++V)_t(I[V],se,se)}else if(typeof U=="object")if(j)Pt(I[0],U),Pt(I[1],j),Pt(I[2],W),Pt(I[3],L),Pt(I[4],z),Pt(I[5],C);else if(vr(ne,U),tt(T,U),"faces"in U){var ye=U.faces;for(N(Array.isArray(ye)&&ye.length===6,"cube faces must be a length 6 array"),V=0;V<6;++V)N(typeof ye[V]=="object"&&!!ye[V],"invalid input for cube map face"),Be(I[V],T),Pt(I[V],ye[V])}else for(V=0;V<6;++V)Pt(I[V],U);else N.raise("invalid arguments to cube map");for(Be(T,I[0]),D.npotTextureCube||N(g_(T.width)&&g_(T.height),"your browser does not support non power or two texture dimensions"),ne.genMipmaps?T.mipmask=(I[0].width<<1)-1:T.mipmask=I[0].mipmask,N.textureCube(T,ne,I,D),T.internalformat=I[0].internalformat,B.width=I[0].width,B.height=I[0].height,Ur(T),V=0;V<6;++V)_r(I[V],el+V);for(yr(ne,E_),Bt(),ae.profile&&(T.stats.size=sl(T.internalformat,T.type,B.width,B.height,ne.genMipmaps,!0)),B.format=be[T.internalformat],B.type=De[T.type],B.mag=me[ne.magFilter],B.min=Ve[ne.minFilter],B.wrapS=Ce[ne.wrapS],B.wrapT=Ce[ne.wrapT],V=0;V<6;++V)Er(I[V]);return B}function J(U,j,W,L,z){N(!!j,"must specify image data"),N(typeof U=="number"&&U===(U|0)&&U>=0&&U<6,"invalid face");var C=W|0,V=L|0,ne=z|0,se=Ze();return Be(se,T),se.width=0,se.height=0,Oe(se,j),se.width=se.width||(T.width>>ne)-C,se.height=se.height||(T.height>>ne)-V,N(T.type===se.type&&T.format===se.format&&T.internalformat===se.internalformat,"incompatible format for texture.subimage"),N(C>=0&&V>=0&&C+se.width<=T.width&&V+se.height<=T.height,"texture.subimage write out of bounds"),N(T.mipmask&1<>L;++L)_.texImage2D(el+W,L,T.format,j>>L,j>>L,0,T.format,T.type,null);return Bt(),ae.profile&&(T.stats.size=sl(T.internalformat,T.type,B.width,B.height,!1,!0)),B}}return B(P,ie,Q,He,Tt,Yt),B.subimage=J,B.resize=ee,B._reglType="textureCube",B._texture=T,ae.profile&&(B.stats=T.stats),B.destroy=function(){T.decRef()},B}function fr(){for(var P=0;P>He,Q.height>>He,0,Q.internalformat,Q.type,null);else for(var Tt=0;Tt<6;++Tt)_.texImage2D(el+Tt,He,Q.internalformat,Q.width>>He,Q.height>>He,0,Q.internalformat,Q.type,null);yr(Q.texInfo,Q.target)})}return{create2D:At,createCube:Nt,clear:fr,getTexture:function(P){return null},restore:ri}}var Ii=36161,ul=32854,W_=32855,G_=36194,Y_=33189,Z_=36168,q_=34041,K_=35907,Q_=34836,J_=34842,ev=34843,Hn=[];Hn[ul]=2,Hn[W_]=2,Hn[G_]=2,Hn[Y_]=2,Hn[Z_]=1,Hn[q_]=4,Hn[K_]=4,Hn[Q_]=16,Hn[J_]=8,Hn[ev]=6;function tv(_,b,D){return Hn[_]*b*D}var Ab=function(_,b,D,te,fe){var re={rgba4:ul,rgb565:G_,"rgb5 a1":W_,depth:Y_,stencil:Z_,"depth stencil":q_};b.ext_srgb&&(re.srgba=K_),b.ext_color_buffer_half_float&&(re.rgba16f=J_,re.rgb16f=ev),b.webgl_color_buffer_float&&(re.rgba32f=Q_);var ae=[];Object.keys(re).forEach(function(Te){var Ne=re[Te];ae[Ne]=Te});var xe=0,Re={};function we(Te){this.id=xe++,this.refCount=1,this.renderbuffer=Te,this.format=ul,this.width=0,this.height=0,fe.profile&&(this.stats={size:0})}we.prototype.decRef=function(){--this.refCount<=0&&Ie(this)};function Ie(Te){var Ne=Te.renderbuffer;N(Ne,"must not double destroy renderbuffer"),_.bindRenderbuffer(Ii,null),_.deleteRenderbuffer(Ne),Te.renderbuffer=null,Te.refCount=0,delete Re[Te.id],te.renderbufferCount--}function Me(Te,Ne){var Z=new we(_.createRenderbuffer());Re[Z.id]=Z,te.renderbufferCount++;function oe(De,me){var Ve=0,Ce=0,ke=ul;if(typeof De=="object"&&De){var Ee=De;if("shape"in Ee){var Be=Ee.shape;N(Array.isArray(Be)&&Be.length>=2,"invalid renderbuffer shape"),Ve=Be[0]|0,Ce=Be[1]|0}else"radius"in Ee&&(Ve=Ce=Ee.radius|0),"width"in Ee&&(Ve=Ee.width|0),"height"in Ee&&(Ce=Ee.height|0);"format"in Ee&&(N.parameter(Ee.format,re,"invalid renderbuffer format"),ke=re[Ee.format])}else typeof De=="number"?(Ve=De|0,typeof me=="number"?Ce=me|0:Ce=Ve):De?N.raise("invalid arguments to renderbuffer constructor"):Ve=Ce=1;if(N(Ve>0&&Ce>0&&Ve<=D.maxRenderbufferSize&&Ce<=D.maxRenderbufferSize,"invalid renderbuffer size"),!(Ve===Z.width&&Ce===Z.height&&ke===Z.format))return oe.width=Z.width=Ve,oe.height=Z.height=Ce,Z.format=ke,_.bindRenderbuffer(Ii,Z.renderbuffer),_.renderbufferStorage(Ii,ke,Ve,Ce),N(_.getError()===0,"invalid render buffer format"),fe.profile&&(Z.stats.size=tv(Z.format,Z.width,Z.height)),oe.format=ae[Z.format],oe}function be(De,me){var Ve=De|0,Ce=me|0||Ve;return Ve===Z.width&&Ce===Z.height||(N(Ve>0&&Ce>0&&Ve<=D.maxRenderbufferSize&&Ce<=D.maxRenderbufferSize,"invalid renderbuffer size"),oe.width=Z.width=Ve,oe.height=Z.height=Ce,_.bindRenderbuffer(Ii,Z.renderbuffer),_.renderbufferStorage(Ii,Z.format,Ve,Ce),N(_.getError()===0,"invalid render buffer format"),fe.profile&&(Z.stats.size=tv(Z.format,Z.width,Z.height))),oe}return oe(Te,Ne),oe.resize=be,oe._reglType="renderbuffer",oe._renderbuffer=Z,fe.profile&&(oe.stats=Z.stats),oe.destroy=function(){Z.decRef()},oe}fe.profile&&(te.getTotalRenderbufferSize=function(){var Te=0;return Object.keys(Re).forEach(function(Ne){Te+=Re[Ne].stats.size}),Te});function Fe(){O(Re).forEach(function(Te){Te.renderbuffer=_.createRenderbuffer(),_.bindRenderbuffer(Ii,Te.renderbuffer),_.renderbufferStorage(Ii,Te.format,Te.width,Te.height)}),_.bindRenderbuffer(Ii,null)}return{create:Me,clear:function(){O(Re).forEach(Ie)},restore:Fe}},fi=36160,Qf=36161,oo=3553,ll=34069,rv=36064,nv=36096,iv=36128,ov=33306,av=36053,Sb=36054,xb=36055,bb=36057,Rb=36061,Cb=36193,Ob=5121,Ib=5126,sv=6407,uv=6408,Mb=6402,Nb=[sv,uv],Jf=[];Jf[uv]=4,Jf[sv]=3;var cl=[];cl[Ob]=1,cl[Ib]=4,cl[Cb]=2;var Pb=32854,Lb=32855,wb=36194,Fb=33189,Bb=36168,lv=34041,Db=35907,Ub=34836,kb=34842,$b=34843,zb=[Pb,Lb,wb,Db,kb,$b,Ub],Ko={};Ko[av]="complete",Ko[Sb]="incomplete attachment",Ko[bb]="incomplete dimensions",Ko[xb]="incomplete, missing attachment",Ko[Rb]="unsupported";function Vb(_,b,D,te,fe,re){var ae={cur:null,next:null,dirty:!1,setFBO:null},xe=["rgba"],Re=["rgba4","rgb565","rgb5 a1"];b.ext_srgb&&Re.push("srgba"),b.ext_color_buffer_half_float&&Re.push("rgba16f","rgb16f"),b.webgl_color_buffer_float&&Re.push("rgba32f");var we=["uint8"];b.oes_texture_half_float&&we.push("half float","float16"),b.oes_texture_float&&we.push("float","float32");function Ie(Ue,Oe,pe){this.target=Ue,this.texture=Oe,this.renderbuffer=pe;var st=0,Ct=0;Oe?(st=Oe.width,Ct=Oe.height):pe&&(st=pe.width,Ct=pe.height),this.width=st,this.height=Ct}function Me(Ue){Ue&&(Ue.texture&&Ue.texture._texture.decRef(),Ue.renderbuffer&&Ue.renderbuffer._renderbuffer.decRef())}function Fe(Ue,Oe,pe){if(Ue)if(Ue.texture){var st=Ue.texture._texture,Ct=Math.max(1,st.width),Ze=Math.max(1,st.height);N(Ct===Oe&&Ze===pe,"inconsistent width/height for supplied texture"),st.refCount+=1}else{var yt=Ue.renderbuffer._renderbuffer;N(yt.width===Oe&&yt.height===pe,"inconsistent width/height for renderbuffer"),yt.refCount+=1}}function Te(Ue,Oe){Oe&&(Oe.texture?_.framebufferTexture2D(fi,Ue,Oe.target,Oe.texture._texture.texture,0):_.framebufferRenderbuffer(fi,Ue,Qf,Oe.renderbuffer._renderbuffer.renderbuffer))}function Ne(Ue){var Oe=oo,pe=null,st=null,Ct=Ue;typeof Ue=="object"&&(Ct=Ue.data,"target"in Ue&&(Oe=Ue.target|0)),N.type(Ct,"function","invalid attachment data");var Ze=Ct._reglType;return Ze==="texture2d"?(pe=Ct,N(Oe===oo)):Ze==="textureCube"?(pe=Ct,N(Oe>=ll&&Oe=2,"invalid shape for framebuffer"),_t=Ur[0],Pt=Ur[1]}else"radius"in dt&&(_t=Pt=dt.radius),"width"in dt&&(_t=dt.width),"height"in dt&&(Pt=dt.height);("color"in dt||"colors"in dt)&&(St=dt.color||dt.colors,Array.isArray(St)&&N(St.length===1||b.webgl_draw_buffers,"multiple render targets not supported")),St||("colorCount"in dt&&(yr=dt.colorCount|0,N(yr>0,"invalid color buffer count")),"colorTexture"in dt&&(Er=!!dt.colorTexture,qt="rgba4"),"colorType"in dt&&(vr=dt.colorType,Er?(N(b.oes_texture_float||!(vr==="float"||vr==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),N(b.oes_texture_half_float||!(vr==="half float"||vr==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):vr==="half float"||vr==="float16"?(N(b.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),qt="rgba16f"):(vr==="float"||vr==="float32")&&(N(b.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),qt="rgba32f"),N.oneOf(vr,we,"invalid color type")),"colorFormat"in dt&&(qt=dt.colorFormat,xe.indexOf(qt)>=0?Er=!0:Re.indexOf(qt)>=0?Er=!1:Er?N.oneOf(dt.colorFormat,xe,"invalid color format for texture"):N.oneOf(dt.colorFormat,Re,"invalid color format for renderbuffer"))),("depthTexture"in dt||"depthStencilTexture"in dt)&&(Ar=!!(dt.depthTexture||dt.depthStencilTexture),N(!Ar||b.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in dt&&(typeof dt.depth=="boolean"?_r=dt.depth:(Tr=dt.depth,Rr=!1)),"stencil"in dt&&(typeof dt.stencil=="boolean"?Rr=dt.stencil:(Pr=dt.stencil,_r=!1)),"depthStencil"in dt&&(typeof dt.depthStencil=="boolean"?_r=Rr=dt.depthStencil:(zr=dt.depthStencil,_r=!1,Rr=!1))}var Bt=null,it=null,At=null,Nt=null;if(Array.isArray(St))Bt=St.map(Ne);else if(St)Bt=[Ne(St)];else for(Bt=new Array(yr),lt=0;lt=0||Bt[lt].renderbuffer&&zb.indexOf(Bt[lt].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+lt+" is invalid"),Bt[lt]&&Bt[lt].texture){var ri=Jf[Bt[lt].texture._texture.format]*cl[Bt[lt].texture._texture.type];fr===null?fr=ri:N(fr===ri,"all color attachments much have the same number of bits per pixel.")}return Fe(it,_t,Pt),N(!it||it.texture&&it.texture._texture.format===Mb||it.renderbuffer&&it.renderbuffer._renderbuffer.format===Fb,"invalid depth attachment for framebuffer object"),Fe(At,_t,Pt),N(!At||At.renderbuffer&&At.renderbuffer._renderbuffer.format===Bb,"invalid stencil attachment for framebuffer object"),Fe(Nt,_t,Pt),N(!Nt||Nt.texture&&Nt.texture._texture.format===lv||Nt.renderbuffer&&Nt.renderbuffer._renderbuffer.format===lv,"invalid depth-stencil attachment for framebuffer object"),Ce(pe),pe.width=_t,pe.height=Pt,pe.colorAttachments=Bt,pe.depthAttachment=it,pe.stencilAttachment=At,pe.depthStencilAttachment=Nt,st.color=Bt.map(oe),st.depth=oe(it),st.stencil=oe(At),st.depthStencil=oe(Nt),st.width=pe.width,st.height=pe.height,Ee(pe),st}function Ct(Ze,yt){N(ae.next!==pe,"can not resize a framebuffer which is currently in use");var lt=Math.max(Ze|0,1),_t=Math.max(yt|0||lt,1);if(lt===pe.width&&_t===pe.height)return st;for(var Pt=pe.colorAttachments,_r=0;_r=2,"invalid shape for framebuffer"),N(Er[0]===Er[1],"cube framebuffer must be square"),lt=Er[0]}else"radius"in St&&(lt=St.radius|0),"width"in St?(lt=St.width|0,"height"in St&&N(St.height===lt,"must be square")):"height"in St&&(lt=St.height|0);("color"in St||"colors"in St)&&(_t=St.color||St.colors,Array.isArray(_t)&&N(_t.length===1||b.webgl_draw_buffers,"multiple render targets not supported")),_t||("colorCount"in St&&(Rr=St.colorCount|0,N(Rr>0,"invalid color buffer count")),"colorType"in St&&(N.oneOf(St.colorType,we,"invalid color type"),_r=St.colorType),"colorFormat"in St&&(Pt=St.colorFormat,N.oneOf(St.colorFormat,xe,"invalid color format for texture"))),"depth"in St&&(yt.depth=St.depth),"stencil"in St&&(yt.stencil=St.stencil),"depthStencil"in St&&(yt.depthStencil=St.depthStencil)}var qt;if(_t)if(Array.isArray(_t))for(qt=[],Ze=0;Ze<_t.length;++Ze)qt[Ze]=_t[Ze];else qt=[_t];else{qt=Array(Rr);var vr={radius:lt,format:Pt,type:_r};for(Ze=0;Ze0&&(yt.depth=Oe[0].depth,yt.stencil=Oe[0].stencil,yt.depthStencil=Oe[0].depthStencil),Oe[Ze]?Oe[Ze](yt):Oe[Ze]=Be(yt)}return n(pe,{width:lt,height:lt,color:qt})}function st(Ct){var Ze,yt=Ct|0;if(N(yt>0&&yt<=D.maxCubeMapSize,"invalid radius for cube fbo"),yt===pe.width)return pe;var lt=pe.color;for(Ze=0;Ze0,"must specify at least one attribute");for(var tt=0;tt=1&&pe.size<=4,"size must be between 1 and 4"),N(pe.offset>=0,"invalid offset"),N(pe.stride>=0&&pe.stride<=255,"stride must be between 0 and 255"),N(pe.divisor>=0,"divisor must be positive"),N(!pe.divisor||!!b.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in Oe?(N(Ue>0,"first attribute must not be a constant"),pe.x=+Oe.x||0,pe.y=+Oe.y||0,pe.z=+Oe.z||0,pe.w=+Oe.w||0,pe.state=2):N(!1,"invalid attribute spec for location "+Ue)}return ke.refresh(),Ee}return Ee.destroy=function(){ke.destroy()},Ee._vao=ke,Ee._reglType="vao",Ee(Ce)}return Ie}var fv=35632,Xb=35633,Wb=35718,Gb=35721;function Yb(_,b,D,te){var fe={},re={};function ae(Z,oe,be,De){this.name=Z,this.id=oe,this.location=be,this.info=De}function xe(Z,oe){for(var be=0;be1)for(var at=0;atZ&&(Z=oe.stats.uniformsCount)}),Z},D.getMaxAttributesCount=function(){var Z=0;return Ie.forEach(function(oe){oe.stats.attributesCount>Z&&(Z=oe.stats.attributesCount)}),Z});function Ne(){fe={},re={};for(var Z=0;Z=0,"missing vertex shader",be),N.command(oe>=0,"missing fragment shader",be);var me=we[oe];me||(me=we[oe]={});var Ve=me[Z];if(Ve&&!De)return Ve;var Ce=new Fe(oe,Z);return D.shaderCount++,Te(Ce,be,De),Ve||(me[Z]=Ce),Ie.push(Ce),Ce},restore:Ne,shader:Re,frag:-1,vert:-1}}var Zb=6408,fs=5121,qb=3333,fl=5126;function Kb(_,b,D,te,fe,re,ae){function xe(Ie){var Me;b.next===null?(N(fe.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),Me=fs):(N(b.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),Me=b.next.colorAttachments[0].texture._texture.type,re.oes_texture_float?(N(Me===fs||Me===fl,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),Me===fl&&N(ae.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):N(Me===fs,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Fe=0,Te=0,Ne=te.framebufferWidth,Z=te.framebufferHeight,oe=null;r(Ie)?oe=Ie:Ie&&(N.type(Ie,"object","invalid arguments to regl.read()"),Fe=Ie.x|0,Te=Ie.y|0,N(Fe>=0&&Fe=0&&Te0&&Ne+Fe<=te.framebufferWidth,"invalid width for read pixels"),N(Z>0&&Z+Te<=te.framebufferHeight,"invalid height for read pixels"),D();var be=Ne*Z*4;return oe||(Me===fs?oe=new Uint8Array(be):Me===fl&&(oe=oe||new Float32Array(be))),N.isTypedArray(oe,"data buffer for regl.read() must be a typedarray"),N(oe.byteLength>=be,"data buffer for regl.read() too small"),_.pixelStorei(qb,4),_.readPixels(Fe,Te,Ne,Z,Zb,Me,oe),oe}function Re(Ie){var Me;return b.setFBO({framebuffer:Ie.framebuffer},function(){Me=xe(Ie)}),Me}function we(Ie){return!Ie||!("framebuffer"in Ie)?xe(Ie):Re(Ie)}return we}function Qo(_){return Array.prototype.slice.call(_)}function Jo(_){return Qo(_).join("")}function Qb(){var _=0,b=[],D=[];function te(Me){for(var Fe=0;Fe0&&(Me.push(Z,"="),Me.push.apply(Me,Qo(arguments)),Me.push(";")),Z}return n(Fe,{def:Ne,toString:function(){return Jo([Te.length>0?"var "+Te.join(",")+";":"",Jo(Me)])}})}function re(){var Me=fe(),Fe=fe(),Te=Me.toString,Ne=Fe.toString;function Z(oe,be){Fe(oe,be,"=",Me.def(oe,be),";")}return n(function(){Me.apply(Me,Qo(arguments))},{def:Me.def,entry:Me,exit:Fe,save:Z,set:function(oe,be,De){Z(oe,be),Me(oe,be,"=",De,";")},toString:function(){return Te()+Ne()}})}function ae(){var Me=Jo(arguments),Fe=re(),Te=re(),Ne=Fe.toString,Z=Te.toString;return n(Fe,{then:function(){return Fe.apply(Fe,Qo(arguments)),this},else:function(){return Te.apply(Te,Qo(arguments)),this},toString:function(){var oe=Z();return oe&&(oe="else{"+oe+"}"),Jo(["if(",Me,"){",Ne(),"}",oe])}})}var xe=fe(),Re={};function we(Me,Fe){var Te=[];function Ne(){var me="a"+Te.length;return Te.push(me),me}Fe=Fe||0;for(var Z=0;Z":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Ni={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Hv={frag:nR,vert:iR},gh={cw:Dv,ccw:mh};function xl(_){return Array.isArray(_)||r(_)||A(_)}function jv(_){return _.sort(function(b,D){return b===hi?-1:D===hi?1:b=1,te>=2,b)}else if(D===rh){var fe=_.data;return new mn(fe.thisDep,fe.contextDep,fe.propDep,b)}else return new mn(D===vv,D===_v,D===pv,b)}var Xv=new mn(!1,!1,!1,function(){});function yR(_,b,D,te,fe,re,ae,xe,Re,we,Ie,Me,Fe,Te,Ne){var Z=we.Record,oe={add:32774,subtract:32778,"reverse subtract":32779};D.ext_blend_minmax&&(oe.min=_R,oe.max=vR);var be=D.angle_instanced_arrays,De=D.webgl_draw_buffers,me={dirty:!0,profile:Ne.profile},Ve={},Ce=[],ke={},Ee={};function Be(T){return T.replace(".","_")}function tt(T,I,B){var J=Be(T);Ce.push(T),Ve[J]=me[J]=!!B,ke[J]=I}function at(T,I,B){var J=Be(T);Ce.push(T),Array.isArray(B)?(me[J]=B.slice(),Ve[J]=B.slice()):me[J]=Ve[J]=B,Ee[J]=I}tt(mv,uR),tt(gv,sR),at(Ev,"blendColor",[0,0,0,0]),at(nh,"blendEquationSeparate",[$v,$v]),at(ih,"blendFuncSeparate",[kv,Uv,kv,Uv]),tt(yv,cR,!0),at(Tv,"depthFunc",gR),at(Av,"depthRange",[0,1]),at(Sv,"depthMask",!0),at(oh,oh,[!0,!0,!0,!0]),tt(xv,aR),at(bv,"cullFace",co),at(ah,ah,mh),at(sh,sh,1),tt(Rv,hR),at(uh,"polygonOffset",[0,0]),tt(Cv,dR),tt(Ov,pR),at(lh,"sampleCoverage",[1,!1]),tt(Iv,lR),at(Mv,"stencilMask",-1),at(ch,"stencilFunc",[mR,0,-1]),at(fh,"stencilOpSeparate",[As,Mi,Mi,Mi]),at(hs,"stencilOpSeparate",[co,Mi,Mi,Mi]),tt(Nv,fR),at(hl,"scissor",[0,0,_.drawingBufferWidth,_.drawingBufferHeight]),at(hi,hi,[0,0,_.drawingBufferWidth,_.drawingBufferHeight]);var Ue={gl:_,context:Fe,strings:b,next:Ve,current:me,draw:Me,elements:re,buffer:fe,shader:Ie,attributes:we.state,vao:we,uniforms:Re,framebuffer:xe,extensions:D,timer:Te,isBufferArgs:xl},Oe={primTypes:jo,compareFuncs:oa,blendFuncs:ti,blendEquations:oe,stencilOps:Ni,glTypes:to,orientationType:gh};N.optional(function(){Ue.isArrayLike=cr}),De&&(Oe.backBuffer=[co],Oe.drawBuffer=Qr(te.maxDrawbuffers,function(T){return T===0?[0]:Qr(T,function(I){return ER+I})}));var pe=0;function st(){var T=Qb(),I=T.link,B=T.global;T.id=pe++,T.batchId="0";var J=I(Ue),ee=T.shared={props:"a0"};Object.keys(Ue).forEach(function(z){ee[z]=B.def(J,".",z)}),N.optional(function(){T.CHECK=I(N),T.commandStr=N.guessCommand(),T.command=I(T.commandStr),T.assert=function(z,C,V){z("if(!(",C,"))",this.CHECK,".commandRaise(",I(V),",",this.command,");")},Oe.invalidBlendCombinations=Vv});var U=T.next={},j=T.current={};Object.keys(Ee).forEach(function(z){Array.isArray(me[z])&&(U[z]=B.def(ee.next,".",z),j[z]=B.def(ee.current,".",z))});var W=T.constants={};Object.keys(Oe).forEach(function(z){W[z]=B.def(JSON.stringify(Oe[z]))}),T.invoke=function(z,C){switch(C.type){case dv:var V=["this",ee.context,ee.props,T.batchId];return z.def(I(C.data),".call(",V.slice(0,Math.max(C.data.length+1,4)),")");case pv:return z.def(ee.props,C.data);case _v:return z.def(ee.context,C.data);case vv:return z.def("this",C.data);case rh:return C.data.append(T,z),C.data.ref}},T.attribCache={};var L={};return T.scopeAttrib=function(z){var C=b.id(z);if(C in L)return L[C];var V=we.scope[C];V||(V=we.scope[C]=new Z);var ne=L[C]=I(V);return ne},T}function Ct(T){var I=T.static,B=T.dynamic,J;if(ds in I){var ee=!!I[ds];J=pr(function(j,W){return ee}),J.enable=ee}else if(ds in B){var U=B[ds];J=sn(U,function(j,W){return j.invoke(W,U)})}return J}function Ze(T,I){var B=T.static,J=T.dynamic;if(ao in B){var ee=B[ao];return ee?(ee=xe.getFramebuffer(ee),N.command(ee,"invalid framebuffer object"),pr(function(j,W){var L=j.link(ee),z=j.shared;W.set(z.framebuffer,".next",L);var C=z.context;return W.set(C,"."+ra,L+".width"),W.set(C,"."+na,L+".height"),L})):pr(function(j,W){var L=j.shared;W.set(L.framebuffer,".next","null");var z=L.context;return W.set(z,"."+ra,z+"."+Lv),W.set(z,"."+na,z+"."+wv),"null"})}else if(ao in J){var U=J[ao];return sn(U,function(j,W){var L=j.invoke(W,U),z=j.shared,C=z.framebuffer,V=W.def(C,".getFramebuffer(",L,")");N.optional(function(){j.assert(W,"!"+L+"||"+V,"invalid framebuffer object")}),W.set(C,".next",V);var ne=z.context;return W.set(ne,"."+ra,V+"?"+V+".width:"+ne+"."+Lv),W.set(ne,"."+na,V+"?"+V+".height:"+ne+"."+wv),V})}else return null}function yt(T,I,B){var J=T.static,ee=T.dynamic;function U(L){if(L in J){var z=J[L];N.commandType(z,"object","invalid "+L,B.commandStr);var C=!0,V=z.x|0,ne=z.y|0,se,ye;return"width"in z?(se=z.width|0,N.command(se>=0,"invalid "+L,B.commandStr)):C=!1,"height"in z?(ye=z.height|0,N.command(ye>=0,"invalid "+L,B.commandStr)):C=!1,new mn(!C&&I&&I.thisDep,!C&&I&&I.contextDep,!C&&I&&I.propDep,function(Ke,pt){var je=Ke.shared.context,ot=se;"width"in z||(ot=pt.def(je,".",ra,"-",V));var ct=ye;return"height"in z||(ct=pt.def(je,".",na,"-",ne)),[V,ne,ot,ct]})}else if(L in ee){var _e=ee[L],Se=sn(_e,function(Ke,pt){var je=Ke.invoke(pt,_e);N.optional(function(){Ke.assert(pt,je+"&&typeof "+je+'==="object"',"invalid "+L)});var ot=Ke.shared.context,ct=pt.def(je,".x|0"),Ft=pt.def(je,".y|0"),mr=pt.def('"width" in ',je,"?",je,".width|0:","(",ot,".",ra,"-",ct,")"),jn=pt.def('"height" in ',je,"?",je,".height|0:","(",ot,".",na,"-",Ft,")");return N.optional(function(){Ke.assert(pt,mr+">=0&&"+jn+">=0","invalid "+L)}),[ct,Ft,mr,jn]});return I&&(Se.thisDep=Se.thisDep||I.thisDep,Se.contextDep=Se.contextDep||I.contextDep,Se.propDep=Se.propDep||I.propDep),Se}else return I?new mn(I.thisDep,I.contextDep,I.propDep,function(Ke,pt){var je=Ke.shared.context;return[0,0,pt.def(je,".",ra),pt.def(je,".",na)]}):null}var j=U(hi);if(j){var W=j;j=new mn(j.thisDep,j.contextDep,j.propDep,function(L,z){var C=W.append(L,z),V=L.shared.context;return z.set(V,"."+Jb,C[2]),z.set(V,"."+eR,C[3]),C})}return{viewport:j,scissor_box:U(hl)}}function lt(T,I){var B=T.static,J=typeof B[_s]=="string"&&typeof B[ps]=="string";if(J){if(Object.keys(I.dynamic).length>0)return null;var ee=I.static,U=Object.keys(ee);if(U.length>0&&typeof ee[U[0]]=="number"){for(var j=[],W=0;W=0,"invalid "+C,I.commandStr),pr(function(ye,_e){return V&&(ye.OFFSET=ne),ne})}else if(C in J){var se=J[C];return sn(se,function(ye,_e){var Se=ye.invoke(_e,se);return V&&(ye.OFFSET=Se,N.optional(function(){ye.assert(_e,Se+">=0","invalid "+C)})),Se})}else if(V&&U)return pr(function(ye,_e){return ye.OFFSET="0",0});return null}var L=W(dl,!0);function z(){if(lo in B){var C=B[lo]|0;return N.command(typeof C=="number"&&C>=0,"invalid vertex count",I.commandStr),pr(function(){return C})}else if(lo in J){var V=J[lo];return sn(V,function(ye,_e){var Se=ye.invoke(_e,V);return N.optional(function(){ye.assert(_e,"typeof "+Se+'==="number"&&'+Se+">=0&&"+Se+"===("+Se+"|0)","invalid vertex count")}),Se})}else if(U)if(Pi(U)){if(U)return L?new mn(L.thisDep,L.contextDep,L.propDep,function(ye,_e){var Se=_e.def(ye.ELEMENTS,".vertCount-",ye.OFFSET);return N.optional(function(){ye.assert(_e,Se+">=0","invalid vertex offset/element buffer too small")}),Se}):pr(function(ye,_e){return _e.def(ye.ELEMENTS,".vertCount")});var ne=pr(function(){return-1});return N.optional(function(){ne.MISSING=!0}),ne}else{var se=new mn(U.thisDep||L.thisDep,U.contextDep||L.contextDep,U.propDep||L.propDep,function(ye,_e){var Se=ye.ELEMENTS;return ye.OFFSET?_e.def(Se,"?",Se,".vertCount-",ye.OFFSET,":-1"):_e.def(Se,"?",Se,".vertCount:-1")});return N.optional(function(){se.DYNAMIC=!0}),se}return null}return{elements:U,primitive:j(),count:z(),instances:W(pl,!1),offset:L}}function _r(T,I){var B=T.static,J=T.dynamic,ee={};return Ce.forEach(function(U){var j=Be(U);function W(L,z){if(U in B){var C=L(B[U]);ee[j]=pr(function(){return C})}else if(U in J){var V=J[U];ee[j]=sn(V,function(ne,se){return z(ne,se,ne.invoke(se,V))})}}switch(U){case xv:case gv:case mv:case Iv:case yv:case Nv:case Rv:case Cv:case Ov:case Sv:return W(function(L){return N.commandType(L,"boolean",U,I.commandStr),L},function(L,z,C){return N.optional(function(){L.assert(z,"typeof "+C+'==="boolean"',"invalid flag "+U,L.commandStr)}),C});case Tv:return W(function(L){return N.commandParameter(L,oa,"invalid "+U,I.commandStr),oa[L]},function(L,z,C){var V=L.constants.compareFuncs;return N.optional(function(){L.assert(z,C+" in "+V,"invalid "+U+", must be one of "+Object.keys(oa))}),z.def(V,"[",C,"]")});case Av:return W(function(L){return N.command(cr(L)&&L.length===2&&typeof L[0]=="number"&&typeof L[1]=="number"&&L[0]<=L[1],"depth range is 2d array",I.commandStr),L},function(L,z,C){N.optional(function(){L.assert(z,L.shared.isArrayLike+"("+C+")&&"+C+".length===2&&typeof "+C+'[0]==="number"&&typeof '+C+'[1]==="number"&&'+C+"[0]<="+C+"[1]","depth range must be a 2d array")});var V=z.def("+",C,"[0]"),ne=z.def("+",C,"[1]");return[V,ne]});case ih:return W(function(L){N.commandType(L,"object","blend.func",I.commandStr);var z="srcRGB"in L?L.srcRGB:L.src,C="srcAlpha"in L?L.srcAlpha:L.src,V="dstRGB"in L?L.dstRGB:L.dst,ne="dstAlpha"in L?L.dstAlpha:L.dst;return N.commandParameter(z,ti,j+".srcRGB",I.commandStr),N.commandParameter(C,ti,j+".srcAlpha",I.commandStr),N.commandParameter(V,ti,j+".dstRGB",I.commandStr),N.commandParameter(ne,ti,j+".dstAlpha",I.commandStr),N.command(Vv.indexOf(z+", "+V)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+z+", "+V+")",I.commandStr),[ti[z],ti[V],ti[C],ti[ne]]},function(L,z,C){var V=L.constants.blendFuncs;N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid blend func, must be an object")});function ne(je,ot){var ct=z.def('"',je,ot,'" in ',C,"?",C,".",je,ot,":",C,".",je);return N.optional(function(){L.assert(z,ct+" in "+V,"invalid "+U+"."+je+ot+", must be one of "+Object.keys(ti))}),ct}var se=ne("src","RGB"),ye=ne("dst","RGB");N.optional(function(){var je=L.constants.invalidBlendCombinations;L.assert(z,je+".indexOf("+se+'+", "+'+ye+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var _e=z.def(V,"[",se,"]"),Se=z.def(V,"[",ne("src","Alpha"),"]"),Ke=z.def(V,"[",ye,"]"),pt=z.def(V,"[",ne("dst","Alpha"),"]");return[_e,Ke,Se,pt]});case nh:return W(function(L){if(typeof L=="string")return N.commandParameter(L,oe,"invalid "+U,I.commandStr),[oe[L],oe[L]];if(typeof L=="object")return N.commandParameter(L.rgb,oe,U+".rgb",I.commandStr),N.commandParameter(L.alpha,oe,U+".alpha",I.commandStr),[oe[L.rgb],oe[L.alpha]];N.commandRaise("invalid blend.equation",I.commandStr)},function(L,z,C){var V=L.constants.blendEquations,ne=z.def(),se=z.def(),ye=L.cond("typeof ",C,'==="string"');return N.optional(function(){function _e(Se,Ke,pt){L.assert(Se,pt+" in "+V,"invalid "+Ke+", must be one of "+Object.keys(oe))}_e(ye.then,U,C),L.assert(ye.else,C+"&&typeof "+C+'==="object"',"invalid "+U),_e(ye.else,U+".rgb",C+".rgb"),_e(ye.else,U+".alpha",C+".alpha")}),ye.then(ne,"=",se,"=",V,"[",C,"];"),ye.else(ne,"=",V,"[",C,".rgb];",se,"=",V,"[",C,".alpha];"),z(ye),[ne,se]});case Ev:return W(function(L){return N.command(cr(L)&&L.length===4,"blend.color must be a 4d array",I.commandStr),Qr(4,function(z){return+L[z]})},function(L,z,C){return N.optional(function(){L.assert(z,L.shared.isArrayLike+"("+C+")&&"+C+".length===4","blend.color must be a 4d array")}),Qr(4,function(V){return z.def("+",C,"[",V,"]")})});case Mv:return W(function(L){return N.commandType(L,"number",j,I.commandStr),L|0},function(L,z,C){return N.optional(function(){L.assert(z,"typeof "+C+'==="number"',"invalid stencil.mask")}),z.def(C,"|0")});case ch:return W(function(L){N.commandType(L,"object",j,I.commandStr);var z=L.cmp||"keep",C=L.ref||0,V="mask"in L?L.mask:-1;return N.commandParameter(z,oa,U+".cmp",I.commandStr),N.commandType(C,"number",U+".ref",I.commandStr),N.commandType(V,"number",U+".mask",I.commandStr),[oa[z],C,V]},function(L,z,C){var V=L.constants.compareFuncs;N.optional(function(){function _e(){L.assert(z,Array.prototype.join.call(arguments,""),"invalid stencil.func")}_e(C+"&&typeof ",C,'==="object"'),_e('!("cmp" in ',C,")||(",C,".cmp in ",V,")")});var ne=z.def('"cmp" in ',C,"?",V,"[",C,".cmp]",":",Mi),se=z.def(C,".ref|0"),ye=z.def('"mask" in ',C,"?",C,".mask|0:-1");return[ne,se,ye]});case fh:case hs:return W(function(L){N.commandType(L,"object",j,I.commandStr);var z=L.fail||"keep",C=L.zfail||"keep",V=L.zpass||"keep";return N.commandParameter(z,Ni,U+".fail",I.commandStr),N.commandParameter(C,Ni,U+".zfail",I.commandStr),N.commandParameter(V,Ni,U+".zpass",I.commandStr),[U===hs?co:As,Ni[z],Ni[C],Ni[V]]},function(L,z,C){var V=L.constants.stencilOps;N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid "+U)});function ne(se){return N.optional(function(){L.assert(z,'!("'+se+'" in '+C+")||("+C+"."+se+" in "+V+")","invalid "+U+"."+se+", must be one of "+Object.keys(Ni))}),z.def('"',se,'" in ',C,"?",V,"[",C,".",se,"]:",Mi)}return[U===hs?co:As,ne("fail"),ne("zfail"),ne("zpass")]});case uh:return W(function(L){N.commandType(L,"object",j,I.commandStr);var z=L.factor|0,C=L.units|0;return N.commandType(z,"number",j+".factor",I.commandStr),N.commandType(C,"number",j+".units",I.commandStr),[z,C]},function(L,z,C){N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid "+U)});var V=z.def(C,".factor|0"),ne=z.def(C,".units|0");return[V,ne]});case bv:return W(function(L){var z=0;return L==="front"?z=As:L==="back"&&(z=co),N.command(!!z,j,I.commandStr),z},function(L,z,C){return N.optional(function(){L.assert(z,C+'==="front"||'+C+'==="back"',"invalid cull.face")}),z.def(C,'==="front"?',As,":",co)});case sh:return W(function(L){return N.command(typeof L=="number"&&L>=te.lineWidthDims[0]&&L<=te.lineWidthDims[1],"invalid line width, must be a positive number between "+te.lineWidthDims[0]+" and "+te.lineWidthDims[1],I.commandStr),L},function(L,z,C){return N.optional(function(){L.assert(z,"typeof "+C+'==="number"&&'+C+">="+te.lineWidthDims[0]+"&&"+C+"<="+te.lineWidthDims[1],"invalid line width")}),C});case ah:return W(function(L){return N.commandParameter(L,gh,j,I.commandStr),gh[L]},function(L,z,C){return N.optional(function(){L.assert(z,C+'==="cw"||'+C+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),z.def(C+'==="cw"?'+Dv+":"+mh)});case oh:return W(function(L){return N.command(cr(L)&&L.length===4,"color.mask must be length 4 array",I.commandStr),L.map(function(z){return!!z})},function(L,z,C){return N.optional(function(){L.assert(z,L.shared.isArrayLike+"("+C+")&&"+C+".length===4","invalid color.mask")}),Qr(4,function(V){return"!!"+C+"["+V+"]"})});case lh:return W(function(L){N.command(typeof L=="object"&&L,j,I.commandStr);var z="value"in L?L.value:1,C=!!L.invert;return N.command(typeof z=="number"&&z>=0&&z<=1,"sample.coverage.value must be a number between 0 and 1",I.commandStr),[z,C]},function(L,z,C){N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid sample.coverage")});var V=z.def('"value" in ',C,"?+",C,".value:1"),ne=z.def("!!",C,".invert");return[V,ne]})}}),ee}function Rr(T,I){var B=T.static,J=T.dynamic,ee={};return Object.keys(B).forEach(function(U){var j=B[U],W;if(typeof j=="number"||typeof j=="boolean")W=pr(function(){return j});else if(typeof j=="function"){var L=j._reglType;L==="texture2d"||L==="textureCube"?W=pr(function(z){return z.link(j)}):L==="framebuffer"||L==="framebufferCube"?(N.command(j.color.length>0,'missing color attachment for framebuffer sent to uniform "'+U+'"',I.commandStr),W=pr(function(z){return z.link(j.color[0])})):N.commandRaise('invalid data for uniform "'+U+'"',I.commandStr)}else cr(j)?W=pr(function(z){var C=z.global.def("[",Qr(j.length,function(V){return N.command(typeof j[V]=="number"||typeof j[V]=="boolean","invalid uniform "+U,z.commandStr),j[V]}),"]");return C}):N.commandRaise('invalid or missing data for uniform "'+U+'"',I.commandStr);W.value=j,ee[U]=W}),Object.keys(J).forEach(function(U){var j=J[U];ee[U]=sn(j,function(W,L){return W.invoke(L,j)})}),ee}function St(T,I){var B=T.static,J=T.dynamic,ee={};return Object.keys(B).forEach(function(U){var j=B[U],W=b.id(U),L=new Z;if(xl(j))L.state=ta,L.buffer=fe.getBuffer(fe.create(j,ia,!1,!0)),L.type=0;else{var z=fe.getBuffer(j);if(z)L.state=ta,L.buffer=z,L.type=0;else if(N.command(typeof j=="object"&&j,"invalid data for attribute "+U,I.commandStr),"constant"in j){var C=j.constant;L.buffer="null",L.state=th,typeof C=="number"?L.x=C:(N.command(cr(C)&&C.length>0&&C.length<=4,"invalid constant for attribute "+U,I.commandStr),ea.forEach(function(Ke,pt){pt=0,'invalid offset for attribute "'+U+'"',I.commandStr);var ne=j.stride|0;N.command(ne>=0&&ne<256,'invalid stride for attribute "'+U+'", must be integer betweeen [0, 255]',I.commandStr);var se=j.size|0;N.command(!("size"in j)||se>0&&se<=4,'invalid size for attribute "'+U+'", must be 1,2,3,4',I.commandStr);var ye=!!j.normalized,_e=0;"type"in j&&(N.commandParameter(j.type,to,"invalid type for attribute "+U,I.commandStr),_e=to[j.type]);var Se=j.divisor|0;"divisor"in j&&(N.command(Se===0||be,'cannot specify divisor for attribute "'+U+'", instancing not supported',I.commandStr),N.command(Se>=0,'invalid divisor for attribute "'+U+'"',I.commandStr)),N.optional(function(){var Ke=I.commandStr,pt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(j).forEach(function(je){N.command(pt.indexOf(je)>=0,'unknown parameter "'+je+'" for attribute pointer "'+U+'" (valid parameters are '+pt+")",Ke)})}),L.buffer=z,L.state=ta,L.size=se,L.normalized=ye,L.type=_e||z.dtype,L.offset=V,L.stride=ne,L.divisor=Se}}ee[U]=pr(function(Ke,pt){var je=Ke.attribCache;if(W in je)return je[W];var ot={isStream:!1};return Object.keys(L).forEach(function(ct){ot[ct]=L[ct]}),L.buffer&&(ot.buffer=Ke.link(L.buffer),ot.type=ot.type||ot.buffer+".dtype"),je[W]=ot,ot})}),Object.keys(J).forEach(function(U){var j=J[U];function W(L,z){var C=L.invoke(z,j),V=L.shared,ne=L.constants,se=V.isBufferArgs,ye=V.buffer;N.optional(function(){L.assert(z,C+"&&(typeof "+C+'==="object"||typeof '+C+'==="function")&&('+se+"("+C+")||"+ye+".getBuffer("+C+")||"+ye+".getBuffer("+C+".buffer)||"+se+"("+C+'.buffer)||("constant" in '+C+"&&(typeof "+C+'.constant==="number"||'+V.isArrayLike+"("+C+".constant))))",'invalid dynamic attribute "'+U+'"')});var _e={isStream:z.def(!1)},Se=new Z;Se.state=ta,Object.keys(Se).forEach(function(ot){_e[ot]=z.def(""+Se[ot])});var Ke=_e.buffer,pt=_e.type;z("if(",se,"(",C,")){",_e.isStream,"=true;",Ke,"=",ye,".createStream(",ia,",",C,");",pt,"=",Ke,".dtype;","}else{",Ke,"=",ye,".getBuffer(",C,");","if(",Ke,"){",pt,"=",Ke,".dtype;",'}else if("constant" in ',C,"){",_e.state,"=",th,";","if(typeof "+C+'.constant === "number"){',_e[ea[0]],"=",C,".constant;",ea.slice(1).map(function(ot){return _e[ot]}).join("="),"=0;","}else{",ea.map(function(ot,ct){return _e[ot]+"="+C+".constant.length>"+ct+"?"+C+".constant["+ct+"]:0;"}).join(""),"}}else{","if(",se,"(",C,".buffer)){",Ke,"=",ye,".createStream(",ia,",",C,".buffer);","}else{",Ke,"=",ye,".getBuffer(",C,".buffer);","}",pt,'="type" in ',C,"?",ne.glTypes,"[",C,".type]:",Ke,".dtype;",_e.normalized,"=!!",C,".normalized;");function je(ot){z(_e[ot],"=",C,".",ot,"|0;")}return je("size"),je("offset"),je("stride"),je("divisor"),z("}}"),z.exit("if(",_e.isStream,"){",ye,".destroyStream(",Ke,");","}"),_e}ee[U]=sn(j,W)}),ee}function Er(T,I){var B=T.static,J=T.dynamic;if(vs in B){var ee=B[vs];return ee!==null&&we.getVAO(ee)===null&&(ee=we.createVAO(ee)),pr(function(j){return j.link(we.getVAO(ee))})}else if(vs in J){var U=J[vs];return sn(U,function(j,W){var L=j.invoke(W,U);return W.def(j.shared.vao+".getVAO("+L+")")})}return null}function qt(T){var I=T.static,B=T.dynamic,J={};return Object.keys(I).forEach(function(ee){var U=I[ee];J[ee]=pr(function(j,W){return typeof U=="number"||typeof U=="boolean"?""+U:j.link(U)})}),Object.keys(B).forEach(function(ee){var U=B[ee];J[ee]=sn(U,function(j,W){return j.invoke(W,U)})}),J}function vr(T,I,B,J,ee){var U=T.static,j=T.dynamic;N.optional(function(){var je=[ao,ps,_s,so,uo,dl,lo,pl,ds,vs].concat(Ce);function ot(ct){Object.keys(ct).forEach(function(Ft){N.command(je.indexOf(Ft)>=0,'unknown parameter "'+Ft+'"',ee.commandStr)})}ot(U),ot(j)});var W=lt(T,I),L=Ze(T),z=yt(T,L,ee),C=Pt(T,ee),V=_r(T,ee),ne=_t(T,ee,W);function se(je){var ot=z[je];ot&&(V[je]=ot)}se(hi),se(Be(hl));var ye=Object.keys(V).length>0,_e={framebuffer:L,draw:C,shader:ne,state:V,dirty:ye,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(_e.profile=Ct(T),_e.uniforms=Rr(B,ee),_e.drawVAO=_e.scopeVAO=Er(T),!_e.drawVAO&&ne.program&&!W&&D.angle_instanced_arrays){var Se=!0,Ke=ne.program.attributes.map(function(je){var ot=I.static[je];return Se=Se&&!!ot,ot});if(Se&&Ke.length>0){var pt=we.getVAO(we.createVAO(Ke));_e.drawVAO=new mn(null,null,null,function(je,ot){return je.link(pt)}),_e.useVAO=!0}}return W?_e.useVAO=!0:_e.attributes=St(I,ee),_e.context=qt(J),_e}function yr(T,I,B){var J=T.shared,ee=J.context,U=T.scope();Object.keys(B).forEach(function(j){I.save(ee,"."+j);var W=B[j];U(ee,".",j,"=",W.append(T,I),";")}),I(U)}function Tr(T,I,B,J){var ee=T.shared,U=ee.gl,j=ee.framebuffer,W;De&&(W=I.def(ee.extensions,".webgl_draw_buffers"));var L=T.constants,z=L.drawBuffer,C=L.backBuffer,V;B?V=B.append(T,I):V=I.def(j,".next"),J||I("if(",V,"!==",j,".cur){"),I("if(",V,"){",U,".bindFramebuffer(",zv,",",V,".framebuffer);"),De&&I(W,".drawBuffersWEBGL(",z,"[",V,".colorAttachments.length]);"),I("}else{",U,".bindFramebuffer(",zv,",null);"),De&&I(W,".drawBuffersWEBGL(",C,");"),I("}",j,".cur=",V,";"),J||I("}")}function Pr(T,I,B){var J=T.shared,ee=J.gl,U=T.current,j=T.next,W=J.current,L=J.next,z=T.cond(W,".dirty");Ce.forEach(function(C){var V=Be(C);if(!(V in B.state)){var ne,se;if(V in j){ne=j[V],se=U[V];var ye=Qr(me[V].length,function(Se){return z.def(ne,"[",Se,"]")});z(T.cond(ye.map(function(Se,Ke){return Se+"!=="+se+"["+Ke+"]"}).join("||")).then(ee,".",Ee[V],"(",ye,");",ye.map(function(Se,Ke){return se+"["+Ke+"]="+Se}).join(";"),";"))}else{ne=z.def(L,".",V);var _e=T.cond(ne,"!==",W,".",V);z(_e),V in ke?_e(T.cond(ne).then(ee,".enable(",ke[V],");").else(ee,".disable(",ke[V],");"),W,".",V,"=",ne,";"):_e(ee,".",Ee[V],"(",ne,");",W,".",V,"=",ne,";")}}}),Object.keys(B.state).length===0&&z(W,".dirty=false;"),I(z)}function zr(T,I,B,J){var ee=T.shared,U=T.current,j=ee.current,W=ee.gl;jv(Object.keys(B)).forEach(function(L){var z=B[L];if(!(J&&!J(z))){var C=z.append(T,I);if(ke[L]){var V=ke[L];Pi(z)?C?I(W,".enable(",V,");"):I(W,".disable(",V,");"):I(T.cond(C).then(W,".enable(",V,");").else(W,".disable(",V,");")),I(j,".",L,"=",C,";")}else if(cr(C)){var ne=U[L];I(W,".",Ee[L],"(",C,");",C.map(function(se,ye){return ne+"["+ye+"]="+se}).join(";"),";")}else I(W,".",Ee[L],"(",C,");",j,".",L,"=",C,";")}})}function Ar(T,I){be&&(T.instancing=I.def(T.shared.extensions,".angle_instanced_arrays"))}function dt(T,I,B,J,ee){var U=T.shared,j=T.stats,W=U.current,L=U.timer,z=B.profile;function C(){return typeof performance>"u"?"Date.now()":"performance.now()"}var V,ne;function se(je){V=I.def(),je(V,"=",C(),";"),typeof ee=="string"?je(j,".count+=",ee,";"):je(j,".count++;"),Te&&(J?(ne=I.def(),je(ne,"=",L,".getNumPendingQueries();")):je(L,".beginQuery(",j,");"))}function ye(je){je(j,".cpuTime+=",C(),"-",V,";"),Te&&(J?je(L,".pushScopeStats(",ne,",",L,".getNumPendingQueries(),",j,");"):je(L,".endQuery();"))}function _e(je){var ot=I.def(W,".profile");I(W,".profile=",je,";"),I.exit(W,".profile=",ot,";")}var Se;if(z){if(Pi(z)){z.enable?(se(I),ye(I.exit),_e("true")):_e("false");return}Se=z.append(T,I),_e(Se)}else Se=I.def(W,".profile");var Ke=T.block();se(Ke),I("if(",Se,"){",Ke,"}");var pt=T.block();ye(pt),I.exit("if(",Se,"){",pt,"}")}function Ur(T,I,B,J,ee){var U=T.shared;function j(L){switch(L){case _l:case gl:case Tl:return 2;case vl:case El:case Al:return 3;case ml:case yl:case Sl:return 4;default:return 1}}function W(L,z,C){var V=U.gl,ne=I.def(L,".location"),se=I.def(U.attributes,"[",ne,"]"),ye=C.state,_e=C.buffer,Se=[C.x,C.y,C.z,C.w],Ke=["buffer","normalized","offset","stride"];function pt(){I("if(!",se,".buffer){",V,".enableVertexAttribArray(",ne,");}");var ot=C.type,ct;if(C.size?ct=I.def(C.size,"||",z):ct=z,I("if(",se,".type!==",ot,"||",se,".size!==",ct,"||",Ke.map(function(mr){return se+"."+mr+"!=="+C[mr]}).join("||"),"){",V,".bindBuffer(",ia,",",_e,".buffer);",V,".vertexAttribPointer(",[ne,ct,ot,C.normalized,C.stride,C.offset],");",se,".type=",ot,";",se,".size=",ct,";",Ke.map(function(mr){return se+"."+mr+"="+C[mr]+";"}).join(""),"}"),be){var Ft=C.divisor;I("if(",se,".divisor!==",Ft,"){",T.instancing,".vertexAttribDivisorANGLE(",[ne,Ft],");",se,".divisor=",Ft,";}")}}function je(){I("if(",se,".buffer){",V,".disableVertexAttribArray(",ne,");",se,".buffer=null;","}if(",ea.map(function(ot,ct){return se+"."+ot+"!=="+Se[ct]}).join("||"),"){",V,".vertexAttrib4f(",ne,",",Se,");",ea.map(function(ot,ct){return se+"."+ot+"="+Se[ct]+";"}).join(""),"}")}ye===ta?pt():ye===th?je():(I("if(",ye,"===",ta,"){"),pt(),I("}else{"),je(),I("}"))}J.forEach(function(L){var z=L.name,C=B.attributes[z],V;if(C){if(!ee(C))return;V=C.append(T,I)}else{if(!ee(Xv))return;var ne=T.scopeAttrib(z);N.optional(function(){T.assert(I,ne+".state","missing attribute "+z)}),V={},Object.keys(new Z).forEach(function(se){V[se]=I.def(ne,".",se)})}W(T.link(L),j(L.info.type),V)})}function Bt(T,I,B,J,ee){for(var U=T.shared,j=U.gl,W,L=0;L1?I(Qr(ot,function(jn){return _e+"["+jn+"]"})):I(_e);I(");")}}function it(T,I,B,J){var ee=T.shared,U=ee.gl,j=ee.draw,W=J.draw;function L(){var ct=W.elements,Ft,mr=I;return ct?((ct.contextDep&&J.contextDynamic||ct.propDep)&&(mr=B),Ft=ct.append(T,mr)):Ft=mr.def(j,".",so),Ft&&mr("if("+Ft+")"+U+".bindBuffer("+rR+","+Ft+".buffer.buffer);"),Ft}function z(){var ct=W.count,Ft,mr=I;return ct?((ct.contextDep&&J.contextDynamic||ct.propDep)&&(mr=B),Ft=ct.append(T,mr),N.optional(function(){ct.MISSING&&T.assert(I,"false","missing vertex count"),ct.DYNAMIC&&T.assert(mr,Ft+">=0","missing vertex count")})):(Ft=mr.def(j,".",lo),N.optional(function(){T.assert(mr,Ft+">=0","missing vertex count")})),Ft}var C=L();function V(ct){var Ft=W[ct];return Ft?Ft.contextDep&&J.contextDynamic||Ft.propDep?Ft.append(T,B):Ft.append(T,I):I.def(j,".",ct)}var ne=V(uo),se=V(dl),ye=z();if(typeof ye=="number"){if(ye===0)return}else B("if(",ye,"){"),B.exit("}");var _e,Se;be&&(_e=V(pl),Se=T.instancing);var Ke=C+".type",pt=W.elements&&Pi(W.elements);function je(){function ct(){B(Se,".drawElementsInstancedANGLE(",[ne,ye,Ke,se+"<<(("+Ke+"-"+hv+")>>1)",_e],");")}function Ft(){B(Se,".drawArraysInstancedANGLE(",[ne,se,ye,_e],");")}C?pt?ct():(B("if(",C,"){"),ct(),B("}else{"),Ft(),B("}")):Ft()}function ot(){function ct(){B(U+".drawElements("+[ne,ye,Ke,se+"<<(("+Ke+"-"+hv+")>>1)"]+");")}function Ft(){B(U+".drawArrays("+[ne,se,ye]+");")}C?pt?ct():(B("if(",C,"){"),ct(),B("}else{"),Ft(),B("}")):Ft()}be&&(typeof _e!="number"||_e>=0)?typeof _e=="string"?(B("if(",_e,">0){"),je(),B("}else if(",_e,"<0){"),ot(),B("}")):je():ot()}function At(T,I,B,J,ee){var U=st(),j=U.proc("body",ee);return N.optional(function(){U.commandStr=I.commandStr,U.command=U.link(I.commandStr)}),be&&(U.instancing=j.def(U.shared.extensions,".angle_instanced_arrays")),T(U,j,B,J),U.compile().body}function Nt(T,I,B,J){Ar(T,I),B.useVAO?B.drawVAO?I(T.shared.vao,".setVAO(",B.drawVAO.append(T,I),");"):I(T.shared.vao,".setVAO(",T.shared.vao,".targetVAO);"):(I(T.shared.vao,".setVAO(null);"),Ur(T,I,B,J.attributes,function(){return!0})),Bt(T,I,B,J.uniforms,function(){return!0}),it(T,I,I,B)}function fr(T,I){var B=T.proc("draw",1);Ar(T,B),yr(T,B,I.context),Tr(T,B,I.framebuffer),Pr(T,B,I),zr(T,B,I.state),dt(T,B,I,!1,!0);var J=I.shader.progVar.append(T,B);if(B(T.shared.gl,".useProgram(",J,".program);"),I.shader.program)Nt(T,B,I,I.shader.program);else{B(T.shared.vao,".setVAO(null);");var ee=T.global.def("{}"),U=B.def(J,".id"),j=B.def(ee,"[",U,"]");B(T.cond(j).then(j,".call(this,a0);").else(j,"=",ee,"[",U,"]=",T.link(function(W){return At(Nt,T,I,W,1)}),"(",J,");",j,".call(this,a0);"))}Object.keys(I.state).length>0&&B(T.shared.current,".dirty=true;")}function ri(T,I,B,J){T.batchId="a1",Ar(T,I);function ee(){return!0}Ur(T,I,B,J.attributes,ee),Bt(T,I,B,J.uniforms,ee),it(T,I,I,B)}function P(T,I,B,J){Ar(T,I);var ee=B.contextDep,U=I.def(),j="a0",W="a1",L=I.def();T.shared.props=L,T.batchId=U;var z=T.scope(),C=T.scope();I(z.entry,"for(",U,"=0;",U,"<",W,";++",U,"){",L,"=",j,"[",U,"];",C,"}",z.exit);function V(Ke){return Ke.contextDep&&ee||Ke.propDep}function ne(Ke){return!V(Ke)}if(B.needsContext&&yr(T,C,B.context),B.needsFramebuffer&&Tr(T,C,B.framebuffer),zr(T,C,B.state,V),B.profile&&V(B.profile)&&dt(T,C,B,!1,!0),J)B.useVAO?B.drawVAO?V(B.drawVAO)?C(T.shared.vao,".setVAO(",B.drawVAO.append(T,C),");"):z(T.shared.vao,".setVAO(",B.drawVAO.append(T,z),");"):z(T.shared.vao,".setVAO(",T.shared.vao,".targetVAO);"):(z(T.shared.vao,".setVAO(null);"),Ur(T,z,B,J.attributes,ne),Ur(T,C,B,J.attributes,V)),Bt(T,z,B,J.uniforms,ne),Bt(T,C,B,J.uniforms,V),it(T,z,C,B);else{var se=T.global.def("{}"),ye=B.shader.progVar.append(T,C),_e=C.def(ye,".id"),Se=C.def(se,"[",_e,"]");C(T.shared.gl,".useProgram(",ye,".program);","if(!",Se,"){",Se,"=",se,"[",_e,"]=",T.link(function(Ke){return At(ri,T,B,Ke,2)}),"(",ye,");}",Se,".call(this,a0[",U,"],",U,");")}}function ie(T,I){var B=T.proc("batch",2);T.batchId="0",Ar(T,B);var J=!1,ee=!0;Object.keys(I.context).forEach(function(se){J=J||I.context[se].propDep}),J||(yr(T,B,I.context),ee=!1);var U=I.framebuffer,j=!1;U?(U.propDep?J=j=!0:U.contextDep&&J&&(j=!0),j||Tr(T,B,U)):Tr(T,B,null),I.state.viewport&&I.state.viewport.propDep&&(J=!0);function W(se){return se.contextDep&&J||se.propDep}Pr(T,B,I),zr(T,B,I.state,function(se){return!W(se)}),(!I.profile||!W(I.profile))&&dt(T,B,I,!1,"a1"),I.contextDep=J,I.needsContext=ee,I.needsFramebuffer=j;var L=I.shader.progVar;if(L.contextDep&&J||L.propDep)P(T,B,I,null);else{var z=L.append(T,B);if(B(T.shared.gl,".useProgram(",z,".program);"),I.shader.program)P(T,B,I,I.shader.program);else{B(T.shared.vao,".setVAO(null);");var C=T.global.def("{}"),V=B.def(z,".id"),ne=B.def(C,"[",V,"]");B(T.cond(ne).then(ne,".call(this,a0,a1);").else(ne,"=",C,"[",V,"]=",T.link(function(se){return At(P,T,I,se,2)}),"(",z,");",ne,".call(this,a0,a1);"))}}Object.keys(I.state).length>0&&B(T.shared.current,".dirty=true;")}function Q(T,I){var B=T.proc("scope",3);T.batchId="a2";var J=T.shared,ee=J.current;yr(T,B,I.context),I.framebuffer&&I.framebuffer.append(T,B),jv(Object.keys(I.state)).forEach(function(j){var W=I.state[j],L=W.append(T,B);cr(L)?L.forEach(function(z,C){B.set(T.next[j],"["+C+"]",z)}):B.set(J.next,"."+j,L)}),dt(T,B,I,!0,!0),[so,dl,lo,pl,uo].forEach(function(j){var W=I.draw[j];W&&B.set(J.draw,"."+j,""+W.append(T,B))}),Object.keys(I.uniforms).forEach(function(j){B.set(J.uniforms,"["+b.id(j)+"]",I.uniforms[j].append(T,B))}),Object.keys(I.attributes).forEach(function(j){var W=I.attributes[j].append(T,B),L=T.scopeAttrib(j);Object.keys(new Z).forEach(function(z){B.set(L,"."+z,W[z])})}),I.scopeVAO&&B.set(J.vao,".targetVAO",I.scopeVAO.append(T,B));function U(j){var W=I.shader[j];W&&B.set(J.shader,"."+j,W.append(T,B))}U(ps),U(_s),Object.keys(I.state).length>0&&(B(ee,".dirty=true;"),B.exit(ee,".dirty=true;")),B("a1(",T.shared.context,",a0,",T.batchId,");")}function He(T){if(!(typeof T!="object"||cr(T))){for(var I=Object.keys(T),B=0;B=0;--it){var At=pe[it];At&&At(Te,null,0)}D.flush(),we&&we.update()}function _t(){!yt&&pe.length>0&&(yt=Ki.next(lt))}function Pt(){yt&&(Ki.cancel(lt),yt=null)}function _r(it){it.preventDefault(),fe=!0,Pt(),st.forEach(function(At){At()})}function Rr(it){D.getError(),fe=!1,re.restore(),Ce.restore(),be.restore(),ke.restore(),Ee.restore(),Be.restore(),De.restore(),we&&we.restore(),tt.procs.refresh(),_t(),Ct.forEach(function(At){At()})}Oe&&(Oe.addEventListener(Gv,_r,!1),Oe.addEventListener(Yv,Rr,!1));function St(){pe.length=0,Pt(),Oe&&(Oe.removeEventListener(Gv,_r),Oe.removeEventListener(Yv,Rr)),Ce.clear(),Be.clear(),Ee.clear(),ke.clear(),Ve.clear(),be.clear(),De.clear(),we&&we.clear(),Ze.forEach(function(it){it()})}function Er(it){N(!!it,"invalid args to regl({...})"),N.type(it,"object","invalid args to regl({...})");function At(ee){var U=n({},ee);delete U.uniforms,delete U.attributes,delete U.context,delete U.vao,"stencil"in U&&U.stencil.op&&(U.stencil.opBack=U.stencil.opFront=U.stencil.op,delete U.stencil.op);function j(W){if(W in U){var L=U[W];delete U[W],Object.keys(L).forEach(function(z){U[W+"."+z]=L[z]})}}return j("blend"),j("depth"),j("cull"),j("stencil"),j("polygonOffset"),j("scissor"),j("sample"),"vao"in ee&&(U.vao=ee.vao),U}function Nt(ee){var U={},j={};return Object.keys(ee).forEach(function(W){var L=ee[W];Br.isDynamic(L)?j[W]=Br.unbox(L,W):U[W]=L}),{dynamic:j,static:U}}var fr=Nt(it.context||{}),ri=Nt(it.uniforms||{}),P=Nt(it.attributes||{}),ie=Nt(At(it)),Q={gpuTime:0,cpuTime:0,count:0},He=tt.compile(ie,P,ri,fr,Q),Tt=He.draw,Yt=He.batch,T=He.scope,I=[];function B(ee){for(;I.length0)return Yt.call(this,B(ee|0),ee|0)}else if(Array.isArray(ee)){if(ee.length)return Yt.call(this,ee,ee.length)}else return Tt.call(this,ee)}return n(J,{stats:Q})}var qt=Be.setFBO=Er({framebuffer:Br.define.call(null,Zv,"framebuffer")});function vr(it,At){var Nt=0;tt.procs.poll();var fr=At.color;fr&&(D.clearColor(+fr[0]||0,+fr[1]||0,+fr[2]||0,+fr[3]||0),Nt|=bR),"depth"in At&&(D.clearDepth(+At.depth),Nt|=RR),"stencil"in At&&(D.clearStencil(At.stencil|0),Nt|=CR),N(!!Nt,"called regl.clear with no buffer specified"),D.clear(Nt)}function yr(it){if(N(typeof it=="object"&&it,"regl.clear() takes an object as input"),"framebuffer"in it)if(it.framebuffer&&it.framebuffer_reglType==="framebufferCube")for(var At=0;At<6;++At)qt(n({framebuffer:it.framebuffer.faces[At]},it),vr);else qt(it,vr);else vr(null,it)}function Tr(it){N.type(it,"function","regl.frame() callback must be a function"),pe.push(it);function At(){var Nt=qv(pe,it);N(Nt>=0,"cannot cancel a frame twice");function fr(){var ri=qv(pe,fr);pe[ri]=pe[pe.length-1],pe.length-=1,pe.length<=0&&Pt()}pe[Nt]=fr}return _t(),{cancel:At}}function Pr(){var it=Ue.viewport,At=Ue.scissor_box;it[0]=it[1]=At[0]=At[1]=0,Te.viewportWidth=Te.framebufferWidth=Te.drawingBufferWidth=it[2]=At[2]=D.drawingBufferWidth,Te.viewportHeight=Te.framebufferHeight=Te.drawingBufferHeight=it[3]=At[3]=D.drawingBufferHeight}function zr(){Te.tick+=1,Te.time=dt(),Pr(),tt.procs.poll()}function Ar(){Pr(),tt.procs.refresh(),we&&we.update()}function dt(){return(bi()-Ie)/1e3}Ar();function Ur(it,At){N.type(At,"function","listener callback must be a function");var Nt;switch(it){case"frame":return Tr(At);case"lost":Nt=st;break;case"restore":Nt=Ct;break;case"destroy":Nt=Ze;break;default:N.raise("invalid event, must be one of frame,lost,restore,destroy")}return Nt.push(At),{cancel:function(){for(var fr=0;fr=0},read:at,destroy:St,_gl:D,_refresh:Ar,poll:function(){zr(),we&&we.update()},now:dt,stats:xe});return b.onDone(null,Bt),Bt}return NR})})(Ex);var KQ=Ex.exports;const QQ=Ht(KQ);var JQ=class{constructor(e,t){const{buffer:r,offset:n,stride:i,normalized:o,size:a,divisor:s}=t;this.buffer=r,this.attribute={buffer:r.get(),offset:n||0,stride:i||0,normalized:o||!1,divisor:s||0},a&&(this.attribute.size=a)}get(){return this.attribute}updateBuffer(e){this.buffer.subData(e)}destroy(){this.buffer.destroy()}},eJ={[m.POINTS]:"points",[m.LINES]:"lines",[m.LINE_LOOP]:"line loop",[m.LINE_STRIP]:"line strip",[m.TRIANGLES]:"triangles",[m.TRIANGLE_FAN]:"triangle fan",[m.TRIANGLE_STRIP]:"triangle strip"},yx={[m.STATIC_DRAW]:"static",[m.DYNAMIC_DRAW]:"dynamic",[m.STREAM_DRAW]:"stream"},l_={[m.BYTE]:"int8",[m.INT]:"int32",[m.UNSIGNED_BYTE]:"uint8",[m.UNSIGNED_SHORT]:"uint16",[m.UNSIGNED_INT]:"uint32",[m.FLOAT]:"float"},tJ={[m.ALPHA]:"alpha",[m.LUMINANCE]:"luminance",[m.LUMINANCE_ALPHA]:"luminance alpha",[m.RGB]:"rgb",[m.RGBA]:"rgba",[m.RGBA4]:"rgba4",[m.RGB5_A1]:"rgb5 a1",[m.RGB565]:"rgb565",[m.DEPTH_COMPONENT]:"depth",[m.DEPTH_STENCIL]:"depth stencil"},rJ={[m.DONT_CARE]:"dont care",[m.NICEST]:"nice",[m.FASTEST]:"fast"},ry={[m.NEAREST]:"nearest",[m.LINEAR]:"linear",[m.LINEAR_MIPMAP_LINEAR]:"mipmap",[m.NEAREST_MIPMAP_LINEAR]:"nearest mipmap linear",[m.LINEAR_MIPMAP_NEAREST]:"linear mipmap nearest",[m.NEAREST_MIPMAP_NEAREST]:"nearest mipmap nearest"},ny={[m.REPEAT]:"repeat",[m.CLAMP_TO_EDGE]:"clamp",[m.MIRRORED_REPEAT]:"mirror"},nJ={[m.NONE]:"none",[m.BROWSER_DEFAULT_WEBGL]:"browser"},iJ={[m.NEVER]:"never",[m.ALWAYS]:"always",[m.LESS]:"less",[m.LEQUAL]:"lequal",[m.GREATER]:"greater",[m.GEQUAL]:"gequal",[m.EQUAL]:"equal",[m.NOTEQUAL]:"notequal"},iy={[m.FUNC_ADD]:"add",[m.MIN_EXT]:"min",[m.MAX_EXT]:"max",[m.FUNC_SUBTRACT]:"subtract",[m.FUNC_REVERSE_SUBTRACT]:"reverse subtract"},Wl={[m.ZERO]:"zero",[m.ONE]:"one",[m.SRC_COLOR]:"src color",[m.ONE_MINUS_SRC_COLOR]:"one minus src color",[m.SRC_ALPHA]:"src alpha",[m.ONE_MINUS_SRC_ALPHA]:"one minus src alpha",[m.DST_COLOR]:"dst color",[m.ONE_MINUS_DST_COLOR]:"one minus dst color",[m.DST_ALPHA]:"dst alpha",[m.ONE_MINUS_DST_ALPHA]:"one minus dst alpha",[m.CONSTANT_COLOR]:"constant color",[m.ONE_MINUS_CONSTANT_COLOR]:"one minus constant color",[m.CONSTANT_ALPHA]:"constant alpha",[m.ONE_MINUS_CONSTANT_ALPHA]:"one minus constant alpha",[m.SRC_ALPHA_SATURATE]:"src alpha saturate"},oJ={[m.NEVER]:"never",[m.ALWAYS]:"always",[m.LESS]:"less",[m.LEQUAL]:"lequal",[m.GREATER]:"greater",[m.GEQUAL]:"gequal",[m.EQUAL]:"equal",[m.NOTEQUAL]:"notequal"},_a={[m.ZERO]:"zero",[m.KEEP]:"keep",[m.REPLACE]:"replace",[m.INVERT]:"invert",[m.INCR]:"increment",[m.DECR]:"decrement",[m.INCR_WRAP]:"increment wrap",[m.DECR_WRAP]:"decrement wrap"},aJ={[m.FRONT]:"front",[m.BACK]:"back"},sJ=class{constructor(e,t){this.isDestroyed=!1;const{data:r,usage:n,type:i}=t;this.buffer=e.buffer({data:r,usage:yx[n||m.STATIC_DRAW],type:l_[i||m.UNSIGNED_BYTE]})}get(){return this.buffer}destroy(){this.isDestroyed||this.buffer.destroy(),this.isDestroyed=!0}subData({data:e,offset:t}){this.buffer.subdata(e,t)}},uJ=class{constructor(e,t){const{data:r,usage:n,type:i,count:o}=t;this.elements=e.elements({data:r,usage:yx[n||m.STATIC_DRAW],type:l_[i||m.UNSIGNED_BYTE],count:o})}get(){return this.elements}subData({data:e}){this.elements.subdata(e)}destroy(){}},lJ=class{constructor(e,t){const{width:r,height:n,color:i,colors:o}=t,a={width:r,height:n};Array.isArray(o)&&(a.colors=o.map(s=>s.get())),i&&typeof i!="boolean"&&(a.color=i.get()),this.framebuffer=e.framebuffer(a)}get(){return this.framebuffer}destroy(){this.framebuffer.destroy()}resize({width:e,height:t}){this.framebuffer.resize(e,t)}},cJ=Object.defineProperty,fJ=Object.defineProperties,hJ=Object.getOwnPropertyDescriptors,oy=Object.getOwnPropertySymbols,dJ=Object.prototype.hasOwnProperty,pJ=Object.prototype.propertyIsEnumerable,ay=(e,t,r)=>t in e?cJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ws=(e,t)=>{for(var r in t||(t={}))dJ.call(t,r)&&ay(e,r,t[r]);if(oy)for(var r of oy(t))pJ.call(t,r)&&ay(e,r,t[r]);return e},_J=(e,t)=>fJ(e,hJ(t)),{isPlainObject:vJ,isTypedArray:mJ}=Sr,gJ=class{constructor(e,t){this.destroyed=!1,this.uniforms={},this.reGl=e;const{vs:r,fs:n,attributes:i,uniforms:o,primitive:a,count:s,elements:u,depth:l,cull:f,instances:c}=t,h={platformString:"WebGL1",glslVersion:"#version 100",explicitBindingLocations:!1,separateSamplerTextures:!1,viewportOrigin:Zn.LOWER_LEFT,clipSpaceNearZ:Ua.NEGATIVE_ONE,supportMRT:!1},d={};this.options=t,o&&(this.uniforms=this.extractUniforms(o),Object.keys(o).forEach(S=>{d[S]=e.prop(S)}));const p={};Object.keys(i).forEach(S=>{p[S]=i[S].get()});const v=Qm(Va(h,"frag",n,null,!1)),g=Qm(Va(h,"vert",r,null,!1)),y={attributes:p,frag:v,uniforms:d,vert:g,colorMask:e.prop("colorMask"),lineWidth:1,blend:{enable:e.prop("blend.enable"),func:e.prop("blend.func"),equation:e.prop("blend.equation"),color:e.prop("blend.color")},stencil:{enable:e.prop("stencil.enable"),mask:e.prop("stencil.mask"),func:e.prop("stencil.func"),opFront:e.prop("stencil.opFront"),opBack:e.prop("stencil.opBack")},primitive:eJ[a===void 0?m.TRIANGLES:a]};c&&(y.instances=c),s?y.count=s:u&&(y.elements=u.get()),this.initDepthDrawParams({depth:l},y),this.initCullDrawParams({cull:f},y),this.drawCommand=e(y),this.drawParams=y}updateAttributesAndElements(e,t){const r={};Object.keys(e).forEach(n=>{r[n]=e[n].get()}),this.drawParams.attributes=r,this.drawParams.elements=t.get(),this.drawCommand=this.reGl(this.drawParams)}updateAttributes(e){const t={};Object.keys(e).forEach(r=>{t[r]=e[r].get()}),this.drawParams.attributes=t,this.drawCommand=this.reGl(this.drawParams)}addUniforms(e){this.uniforms=Ws(Ws({},this.uniforms),this.extractUniforms(e))}draw(e,t){if(this.drawParams.attributes&&Object.keys(this.drawParams.attributes).length===0)return;const r=Ws(Ws({},this.uniforms),this.extractUniforms(e.uniforms||{})),n={};Object.keys(r).forEach(i=>{const o=typeof r[i];o==="boolean"||o==="number"||Array.isArray(r[i])||r[i].BYTES_PER_ELEMENT?n[i]=r[i]:n[i]=r[i].get()}),n.blend=t?this.getBlendDrawParams({blend:{enable:!1}}):this.getBlendDrawParams(e),n.stencil=this.getStencilDrawParams(e),n.colorMask=this.getColorMaskDrawParams(e,t),this.drawCommand(n)}destroy(){var e,t;(t=(e=this.drawParams)==null?void 0:e.elements)==null||t.destroy(),this.options.attributes&&Object.values(this.options.attributes).forEach(r=>{r==null||r.destroy()}),this.destroyed=!0}initDepthDrawParams({depth:e},t){e&&(t.depth={enable:e.enable===void 0?!0:!!e.enable,mask:e.mask===void 0?!0:!!e.mask,func:iJ[e.func||m.LESS],range:e.range||[0,1]})}getBlendDrawParams({blend:e}){const{enable:t,func:r,equation:n,color:i=[0,0,0,0]}=e||{};return{enable:!!t,func:{srcRGB:Wl[r&&r.srcRGB||m.SRC_ALPHA],srcAlpha:Wl[r&&r.srcAlpha||m.SRC_ALPHA],dstRGB:Wl[r&&r.dstRGB||m.ONE_MINUS_SRC_ALPHA],dstAlpha:Wl[r&&r.dstAlpha||m.ONE_MINUS_SRC_ALPHA]},equation:{rgb:iy[n&&n.rgb||m.FUNC_ADD],alpha:iy[n&&n.alpha||m.FUNC_ADD]},color:i}}getStencilDrawParams({stencil:e}){const{enable:t,mask:r=-1,func:n={cmp:m.ALWAYS,ref:0,mask:-1},opFront:i={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP},opBack:o={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP}}=e||{};return{enable:!!t,mask:r,func:_J(Ws({},n),{cmp:oJ[n.cmp]}),opFront:{fail:_a[i.fail],zfail:_a[i.zfail],zpass:_a[i.zpass]},opBack:{fail:_a[o.fail],zfail:_a[o.zfail],zpass:_a[o.zpass]}}}getColorMaskDrawParams({stencil:e},t){return e!=null&&e.enable&&e.opFront&&!t?[!1,!1,!1,!1]:[!0,!0,!0,!0]}initCullDrawParams({cull:e},t){if(e){const{enable:r,face:n=m.BACK}=e;t.cull={enable:!!r,face:aJ[n]}}}extractUniforms(e){const t={};return Object.keys(e).forEach(r=>{this.extractUniformsRecursively(r,e[r],t,"")}),t}extractUniformsRecursively(e,t,r,n){if(t===null||typeof t=="number"||typeof t=="boolean"||Array.isArray(t)&&typeof t[0]=="number"||mJ(t)||t===""||"resize"in t){r[`${n&&n+"."}${e}`]=t;return}vJ(t)&&Object.keys(t).forEach(i=>{this.extractUniformsRecursively(i,t[i],r,`${n&&n+"."}${e}`)}),Array.isArray(t)&&t.forEach((i,o)=>{Object.keys(i).forEach(a=>{this.extractUniformsRecursively(a,i[a],r,`${n&&n+"."}${e}[${o}]`)})})}},EJ=class{constructor(e,t){this.isDestroy=!1;const{data:r,type:n=m.UNSIGNED_BYTE,width:i,height:o,flipY:a=!1,format:s=m.RGBA,mipmap:u=!1,wrapS:l=m.CLAMP_TO_EDGE,wrapT:f=m.CLAMP_TO_EDGE,aniso:c=0,alignment:h=1,premultiplyAlpha:d=!1,mag:p=m.NEAREST,min:v=m.NEAREST,colorSpace:g=m.BROWSER_DEFAULT_WEBGL,x:y=0,y:S=0,copy:R=!1}=t;this.width=i,this.height=o;const x={width:i,height:o,type:l_[n],format:tJ[s],wrapS:ny[l],wrapT:ny[f],mag:ry[p],min:ry[v],alignment:h,flipY:a,colorSpace:nJ[g],premultiplyAlpha:d,aniso:c,x:y,y:S,copy:R};r&&(x.data=r),typeof u=="number"?x.mipmap=rJ[u]:typeof u=="boolean"&&(x.mipmap=u),this.texture=e.texture(x)}get(){return this.texture}update(e={}){this.texture(e)}bind(){this.texture._texture.bind()}resize({width:e,height:t}){this.texture.resize(e,t),this.width=e,this.height=t}getSize(){return[this.width,this.height]}destroy(){var e;this.isDestroy||(e=this.texture)==null||e.destroy(),this.isDestroy=!0}},od=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),yJ=class{constructor(){this.uniformBuffers=[],this.queryVerdorInfo=()=>"WebGL1",this.createModel=e=>new gJ(this.gl,e),this.createAttribute=e=>new JQ(this.gl,e),this.createBuffer=e=>new sJ(this.gl,e),this.createElements=e=>new uJ(this.gl,e),this.createTexture2D=e=>new EJ(this.gl,e),this.createFramebuffer=e=>new lJ(this.gl,e),this.useFramebuffer=(e,t)=>{this.gl({framebuffer:e?e.get():null})(t)},this.useFramebufferAsync=(e,t)=>od(this,null,function*(){this.gl({framebuffer:e?e.get():null})(t)}),this.clear=e=>{var t;const{color:r,depth:n,stencil:i,framebuffer:o=null}=e,a={color:r,depth:n,stencil:i};a.framebuffer=o===null?o:o.get(),(t=this.gl)==null||t.clear(a)},this.viewport=({x:e,y:t,width:r,height:n})=>{this.gl._gl.viewport(e,t,r,n),this.width=r,this.height=n,this.gl._refresh()},this.readPixels=e=>{const{framebuffer:t,x:r,y:n,width:i,height:o}=e,a={x:r,y:n,width:i,height:o};return t&&(a.framebuffer=t.get()),this.gl.read(a)},this.readPixelsAsync=e=>od(this,null,function*(){return this.readPixels(e)}),this.getViewportSize=()=>({width:this.gl._gl.drawingBufferWidth,height:this.gl._gl.drawingBufferHeight}),this.getContainer=()=>{var e;return(e=this.canvas)==null?void 0:e.parentElement},this.getCanvas=()=>this.canvas,this.getGLContext=()=>this.gl._gl,this.destroy=()=>{var e,t,r;this.canvas=null,(r=(t=(e=this.gl)==null?void 0:e._gl)==null?void 0:t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),this.gl.destroy(),this.gl=null}}init(e,t,r){return od(this,null,function*(){this.canvas=e,r?this.gl=r:this.gl=yield new Promise((n,i)=>{QQ({canvas:this.canvas,attributes:{alpha:!0,antialias:t.antialias,premultipliedAlpha:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,stencil:t.stencil},extensions:["OES_element_index_uint","OES_standard_derivatives","ANGLE_instanced_arrays"],optionalExtensions:["oes_texture_float_linear","OES_texture_float","EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture","WEBGL_lose_context"],profile:!0,onDone:(o,a)=>{(o||!a)&&i(o),n(a)}})}),this.extensionObject={OES_texture_float:this.testExtension("OES_texture_float")}})}getPointSizeRange(){return this.gl._gl.getParameter(this.gl._gl.ALIASED_POINT_SIZE_RANGE)}testExtension(e){return!!this.getGLContext().getExtension(e)}setState(){this.gl({cull:{enable:!1,face:"back"},viewport:{x:0,y:0,height:this.width,width:this.height},blend:{enable:!0,equation:"add"},framebuffer:null}),this.gl._refresh()}setBaseState(){this.gl({cull:{enable:!1,face:"back"},viewport:{x:0,y:0,height:this.width,width:this.height},blend:{enable:!1,equation:"add"},framebuffer:null}),this.gl._refresh()}setCustomLayerDefaults(){const e=this.getGLContext();e.disable(e.CULL_FACE)}setDirty(e){this.isDirty=e}getDirty(){return this.isDirty}beginFrame(){}endFrame(){}},ad=["selectstart","selecting","selectend"],TJ=class extends Bn.EventEmitter{constructor(e,t={}){super(),this.isEnable=!1,this.onDragStart=r=>{this.box.style.display="block",this.startEvent=this.endEvent=r,this.syncBoxBound(),this.emit("selectstart",this.getLngLatBox(),this.startEvent,this.endEvent)},this.onDragging=r=>{this.endEvent=r,this.syncBoxBound(),this.emit("selecting",this.getLngLatBox(),this.startEvent,this.endEvent)},this.onDragEnd=r=>{this.endEvent=r,this.box.style.display="none",this.emit("selectend",this.getLngLatBox(),this.startEvent,this.endEvent)},this.scene=e,this.options=t}get container(){return this.scene.getMapService().getMarkerContainer()}enable(){if(this.isEnable)return;const{className:e}=this.options;if(this.scene.setMapStatus({dragEnable:!1}),this.container.style.cursor="crosshair",!this.box){const t=yn("div",void 0,this.container);t.classList.add("l7-select-box"),e&&t.classList.add(e),t.style.display="none",this.box=t}this.scene.on("dragstart",this.onDragStart),this.scene.on("dragging",this.onDragging),this.scene.on("dragend",this.onDragEnd),this.isEnable=!0}disable(){this.isEnable&&(this.scene.setMapStatus({dragEnable:!0}),this.container.style.cursor="auto",this.scene.off("dragstart",this.onDragStart),this.scene.off("dragging",this.onDragging),this.scene.off("dragend",this.onDragEnd),this.isEnable=!1)}syncBoxBound(){const{x:e,y:t}=this.startEvent,{x:r,y:n}=this.endEvent,i=Math.min(e,r),o=Math.min(t,n),a=Math.abs(e-r),s=Math.abs(t-n);this.box.style.top=`${o}px`,this.box.style.left=`${i}px`,this.box.style.width=`${a}px`,this.box.style.height=`${s}px`}getLngLatBox(){const{lngLat:{lng:e,lat:t}}=this.startEvent,{lngLat:{lng:r,lat:n}}=this.endEvent;return uU([[e,t],[r,n]])}},AJ=Object.defineProperty,SJ=Object.defineProperties,xJ=Object.getOwnPropertyDescriptors,sy=Object.getOwnPropertySymbols,bJ=Object.prototype.hasOwnProperty,RJ=Object.prototype.propertyIsEnumerable,uy=(e,t,r)=>t in e?AJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,CJ=(e,t)=>{for(var r in t||(t={}))bJ.call(t,r)&&uy(e,r,t[r]);if(sy)for(var r of sy(t))RJ.call(t,r)&&uy(e,r,t[r]);return e},OJ=(e,t)=>SJ(e,xJ(t)),Gs=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),IJ=class{constructor(e){const{id:t,map:r,renderer:n="device"}=e,i=Wz();this.container=i,r.setContainer(i,t),n==="regl"?i.rendererService=new yJ:i.rendererService=new qQ,this.sceneService=i.sceneService,this.mapService=i.mapService,this.iconService=i.iconService,this.fontService=i.fontService,this.controlService=i.controlService,this.layerService=i.layerService,this.debugService=i.debugService,this.debugService.setEnable(e.debug),this.markerService=i.markerService,this.interactionService=i.interactionService,this.popupService=i.popupService,this.boxSelect=new TJ(this,{}),this.initComponent(t),this.sceneService.init(e),this.initControl()}get map(){return this.mapService.map}get loaded(){return this.sceneService.loaded}getServiceContainer(){return this.container}getSize(){return this.mapService.getSize()}getMinZoom(){return this.mapService.getMinZoom()}getMaxZoom(){return this.mapService.getMaxZoom()}getType(){return this.mapService.getType()}getMapContainer(){return this.mapService.getMapContainer()}getMapCanvasContainer(){return this.mapService.getMapCanvasContainer()}getMapService(){return this.mapService}getDebugService(){return this.debugService}exportPng(e){return Gs(this,null,function*(){return this.sceneService.exportPng(e)})}exportMap(e){return Gs(this,null,function*(){return this.sceneService.exportPng(e)})}registerRenderService(e){this.sceneService.loaded?new e(this).init():this.on("loaded",()=>{new e(this).init()})}setBgColor(e){this.mapService.setBgColor(e)}addLayer(e){this.loaded?this.preAddLayer(e):this.once("loaded",()=>{this.preAddLayer(e)})}preAddLayer(e){const t=su(this.container);if(e.setContainer(t),this.sceneService.addLayer(e),e.inited){this.initTileLayer(e);const r=this.initMask(e);this.addMask(r,e.id)}else e.on("inited",()=>{this.initTileLayer(e);const r=this.initMask(e);this.addMask(r,e.id)})}initMask(e){const{mask:t,maskfence:r,maskColor:n="#000",maskOpacity:i=0}=e.getLayerConfig();return!t||!r?void 0:new YS().source(r).shape("fill").style({color:n,opacity:i})}addMask(e,t){if(!e)return;const r=this.getLayer(t);if(r){const n=su(this.container);e.setContainer(n),r.addMaskLayer(e),this.sceneService.addMask(e)}else console.warn("parent layer not find!")}getPickedLayer(){return this.layerService.pickedLayerId}getLayers(){return this.layerService.getLayers()}getLayer(e){return this.layerService.getLayer(e)}getLayerByName(e){return this.layerService.getLayerByName(e)}removeLayer(e,t){return Gs(this,null,function*(){yield this.layerService.remove(e,t)})}removeAllLayer(){return Gs(this,null,function*(){yield this.layerService.removeAllLayers()})}render(){this.sceneService.render()}setEnableRender(e){this.layerService.setEnableRender(e)}addIconFont(e,t){this.fontService.addIconFont(e,t)}addIconFonts(e){e.forEach(([t,r])=>{this.fontService.addIconFont(t,r)})}addFontFace(e,t){this.fontService.once("fontloaded",r=>{this.emit("fontloaded",r)}),this.fontService.addFontFace(e,t)}addImage(e,t){return Gs(this,null,function*(){yield this.iconService.addImage(e,t)})}hasImage(e){return this.iconService.hasImage(e)}removeImage(e){this.iconService.removeImage(e)}addIconFontGlyphs(e,t){this.fontService.addIconGlyphs(t)}addControl(e){this.controlService.addControl(e,this.container)}removeControl(e){this.controlService.removeControl(e)}getControlByName(e){return this.controlService.getControlByName(e)}addMarker(e){this.markerService.addMarker(e)}addMarkerLayer(e){this.markerService.addMarkerLayer(e)}removeMarkerLayer(e){this.markerService.removeMarkerLayer(e)}removeAllMarkers(){this.markerService.removeAllMarkers()}removeAllMakers(){console.warn("removeAllMakers 已废弃,请使用 removeAllMarkers"),this.markerService.removeAllMarkers()}addPopup(e){this.popupService.addPopup(e)}removePopup(e){this.popupService.removePopup(e)}on(e,t){var r;ad.includes(e)?(r=this.boxSelect)==null||r.on(e,t):Nl.includes(e)?this.sceneService.on(e,t):this.mapService.on(e,t)}once(e,t){var r;ad.includes(e)?(r=this.boxSelect)==null||r.once(e,t):Nl.includes(e)?this.sceneService.once(e,t):this.mapService.once(e,t)}emit(e,t){Nl.indexOf(e)===-1?this.mapService.on(e,t):this.sceneService.emit(e,t)}off(e,t){var r;ad.includes(e)?(r=this.boxSelect)==null||r.off(e,t):Nl.includes(e)?this.sceneService.off(e,t):this.mapService.off(e,t)}getZoom(){return this.mapService.getZoom()}getCenter(e){return this.mapService.getCenter(e)}setCenter(e,t){return this.mapService.setCenter(e,t)}getPitch(){return this.mapService.getPitch()}setPitch(e){return this.mapService.setPitch(e)}getRotation(){return this.mapService.getRotation()}getBounds(){return this.mapService.getBounds()}setRotation(e){this.mapService.setRotation(e)}zoomIn(){this.mapService.zoomIn()}zoomOut(){this.mapService.zoomOut()}panTo(e){this.mapService.panTo(e)}panBy(e,t){this.mapService.panBy(e,t)}getContainer(){return this.mapService.getContainer()}setZoom(e){this.mapService.setZoom(e)}fitBounds(e,t){const{fitBoundsOptions:r,animate:n}=this.sceneService.getSceneConfig();this.mapService.fitBounds(e,t||OJ(CJ({},r),{animate:n}))}setZoomAndCenter(e,t){this.mapService.setZoomAndCenter(e,t)}setMapStyle(e){this.mapService.setMapStyle(e)}setMapStatus(e){this.mapService.setMapStatus(e)}pixelToLngLat(e){return this.mapService.pixelToLngLat(e)}lngLatToPixel(e){return this.mapService.lngLatToPixel(e)}containerToLngLat(e){return this.mapService.containerToLngLat(e)}lngLatToContainer(e){return this.mapService.lngLatToContainer(e)}destroy(){this.sceneService.destroy()}registerPostProcessingPass(e){this.container.postProcessingPass.name=new e}enableShaderPick(){this.layerService.enableShaderPick()}diasbleShaderPick(){this.layerService.disableShaderPick()}enableBoxSelect(e=!0){this.boxSelect.enable(),e&&this.boxSelect.once("selectend",()=>{this.disableBoxSelect()})}disableBoxSelect(){this.boxSelect.disable()}static addProtocol(e,t){Gl.REGISTERED_PROTOCOLS[e]=t}static removeProtocol(e){delete Gl.REGISTERED_PROTOCOLS[e]}getProtocol(e){return Gl.REGISTERED_PROTOCOLS[e]}startAnimate(){this.layerService.startAnimate()}stopAnimate(){this.layerService.stopAnimate()}getPointSizeRange(){return this.sceneService.getPointSizeRange()}initComponent(e){this.controlService.init({container:j7(e)},this.container),this.markerService.init(this.container),this.popupService.init(this.container)}initControl(){const{logoVisible:e,logoPosition:t}=this.sceneService.getSceneConfig();e&&this.addControl(new $H({position:t}))}initTileLayer(e){e.getSource().isTile&&(e.tileLayer=new YZ(e))}};const MJ=LR({name:"EsAreaMap",components:{},props:{options:{type:Object,default:()=>({})},datasets:{type:[Array,Object,String],default:()=>[]},eventData:{type:[String,Boolean,Number],default:""},element:{type:Object,default:()=>({})}},setup(e){const t=wR(null);function r(n,i){const{theme:o,token:a,zoom:s,viewMode:u,codeConfig:l,center:f}=i;t.value&&t.value.destroy(),t.value=new IJ({id:`chart-${e.element.id}`,map:new R1({style:o,center:f,zoom:s,token:a,viewMode:u}),logoVisible:!1});const c=Array.isArray(n.values)?n.values:n;new Function("option","datas","l7Instance","GaodeMap",l)(HR(i),c,t.value,R1)}return FR([()=>e.datasets,()=>e.options],([n,i])=>{BR(()=>{r(n,i)})},{immediate:!0,deep:!0}),{myChart:t}}}),NJ=["id"];function PJ(e,t,r,n,i,o){return DR(),UR("div",{id:`chart-${e.element.id}`,style:{width:"100%",height:"100%","background-color":"transparent"}},null,8,NJ)}const qJ=PR(MJ,[["render",PJ]]);export{qJ as default};