leiting-bim 2.2.15 → 2.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,289 +0,0 @@
1
- (function(Q,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue"),require("@zumer/snapdom"),require("ant-design-vue"),require("@ant-design/icons-vue")):typeof define=="function"&&define.amd?define(["exports","vue","@zumer/snapdom","ant-design-vue","@ant-design/icons-vue"],d):(Q=typeof globalThis<"u"?globalThis:Q||self,d(Q.LeitingBim={},Q.Vue,Q.snapdom,Q.antd,Q.iconsVue))})(this,(function(Q,d,$y,re,As){"use strict";var tt;var _e=typeof document<"u"?document.currentScript:null;function jy(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const Wy=jy($y),bn={cesiumUrl:"https://leiting.chenxisoft.com/resource/js/cesiumjs/Cesium1.140/Cesium.js",cesiumCssUrl:"https://leiting.chenxisoft.com/resource/js/cesiumjs/Cesium1.140/Widgets/widgets.css",accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjZGI0MzM1ZS1hMjY4LTRlYzgtYjg1MC03NmI2ZjUxMmM5ZTUiLCJpZCI6OTUzODIsImlhdCI6MTY1MzYyMTM4OX0.ygoPAb1FvQkQGtziq5nTsWT-u7dCheu5hcG0p9TQFpU"};let $i=null,wn;function Va(i){return i.accessToken&&(wn=i.accessToken),$i||($i=new Promise((e,t)=>{if(window.Cesium){wn&&(window.Cesium.Ion.defaultAccessToken=wn),e();return}const{cesiumUrl:n,cesiumCssUrl:s}=i;if(s){const r=document.createElement("link");r.rel="stylesheet",r.href=s,document.head.appendChild(r)}const o=document.createElement("script");o.src=n,o.async=!0,o.onload=()=>{wn&&window.Cesium&&(window.Cesium.Ion.defaultAccessToken=wn),e()},o.onerror=r=>{console.error("Failed to load Cesium script",r),$i=null,t(r)},document.head.appendChild(o)}),$i)}function qy(){return window.Cesium?Promise.resolve():$i||Promise.reject(new Error("Cesium loading has not been initiated."))}function Jd(){return wn}class Ky{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}setSceneOptions(e){if(!this.viewer||!this.viewer.scene)return;const t=this.viewer.scene;typeof e.showGlobe=="boolean"&&t.globe&&(t.globe.show=e.showGlobe),typeof e.showSkyAtmosphere=="boolean"&&t.skyAtmosphere&&(t.skyAtmosphere.show=e.showSkyAtmosphere),typeof e.showSkyBox=="boolean"&&t.skyBox&&(t.skyBox.show=e.showSkyBox)}clearBackground(){!this.viewer||!this.viewer.scene||(this.viewer.scene.backgroundColor=new this.cesium.Color(0,0,0,0))}enableTestLabel(){this.viewer&&(this.viewer.extend(this.cesium.viewerCesium3DTilesInspectorMixin),this.viewer.cesium3DTilesInspector.viewModel)}enableCesiumFXAA(e){if(!this.viewer||!this.viewer.scene)return;let t=window.devicePixelRatio;for(;t>=2;)t/=2;this.viewer.resolutionScale=t,this.viewer.scene.postProcessStages.fxaa.enabled=e,this.viewer.scene.highDynamicRange=!0,this.viewer.scene.postProcessStages.tonemapper=this.cesium.Tonemapper.PBR_NEUTRAL,this.viewer.scene.postProcessStages.exposure=1}async getSnapDomSImageBase64(e="base-cx-BIM-gis",t={}){const{format:n="png",quality:s=.8,scale:o=1,returnDataUrl:r=!1}=t;try{const a=Wy,l=this.viewer&&this.viewer.container&&this.viewer.container.id;let c=null;if(l&&(c=document.getElementById(l)),!c&&this.viewer&&this.viewer.container&&(c=this.viewer.container),!c)return null;document.fonts&&document.fonts.ready&&await document.fonts.ready;let h=null;const u=a.snapdom||a.default||a;let p=null;if(n==="webp"&&u.toWebp)p=await u.toWebp(c,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(u.toPng)p=await u.toPng(c,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(u.toBlob){const m=await u.toBlob(c,{type:n==="webp"?"image/webp":"image/png",quality:s,pixelRatio:o,embedFonts:!0,className:e});p=await this.blobToDataURL(m)}else console.warn("snapdom methods not found on:",u);if(p&&typeof p!="string")p instanceof Blob?h=await this.blobToDataURL(p):p.src&&typeof p.src=="string"?h=p.src:(console.warn("getSnapDomSImageBase64 returned non-string:",p),p.data&&typeof p.data=="string"?h=p.data:h=String(p));else{const m=String(p);h=m.startsWith("data:")?m:`data:image/${n};base64,${m}`}return h?r?h:String(h):null}catch(a){return console.error("getSnapDomSImageBase64 failed",a),null}}async blobToDataURL(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=o=>n(o),s.readAsDataURL(e)})}viewBase64Image(e,t="png"){if(!e){console.warn("viewBase64Image: No base64 data provided");return}const n=`data:image/${t};base64,`,s=e.startsWith("data:")?e:n+e,o=window.open();o?(o.document.write(`
2
- <html>
3
- <head><title>Snapshot Preview</title></head>
4
- <body style="margin:0; display:flex; justify-content:center; align-items:center; height:100vh; background:#333;">
5
- <img src="${s}" style="max-width:90%; max-height:90%; border:2px solid #fff; box-shadow:0 0 10px rgba(0,0,0,0.5);"/>
6
- </body>
7
- </html>
8
- `),o.document.close()):console.warn("viewBase64Image: Failed to open new window. Please check popup blocker.")}updateModelEffect(e){const t=this.viewer,n=this.cesium;if(!t||!t.scene)return;const s=t.scene.primitives,o=s.length,r=!!n.CustomShader;for(let a=0;a<o;a++){const l=s.get(a);if(n.Cesium3DTileset&&l instanceof n.Cesium3DTileset)if(r)if(l.customShader&&l.customShader.isModelAdjustment)l.customShader.setUniform("u_tilesBrightness",e);else{const c=new n.CustomShader({uniforms:{u_tilesBrightness:{type:n.UniformType.FLOAT,value:e}},fragmentShaderText:`
9
- void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
10
- material.diffuse *= u_tilesBrightness;
11
- }
12
- `});c.isModelAdjustment=!0,l.customShader=c}else{let c="color('white')";e!==1&&(c=`${c} * ${e}`),l.style=new n.Cesium3DTileStyle({color:c})}}}}var Zd=typeof global=="object"&&global&&global.Object===Object&&global,Xy=typeof self=="object"&&self&&self.Object===Object&&self,ji=Zd||Xy||Function("return this")(),zo=ji.Symbol,eh=Object.prototype,Jy=eh.hasOwnProperty,Zy=eh.toString,vs=zo?zo.toStringTag:void 0;function eA(i){var e=Jy.call(i,vs),t=i[vs];try{i[vs]=void 0;var n=!0}catch{}var s=Zy.call(i);return n&&(e?i[vs]=t:delete i[vs]),s}var tA=Object.prototype,iA=tA.toString;function nA(i){return iA.call(i)}var sA="[object Null]",oA="[object Undefined]",th=zo?zo.toStringTag:void 0;function bs(i){return i==null?i===void 0?oA:sA:th&&th in Object(i)?eA(i):nA(i)}function Cn(i){return i!=null&&typeof i=="object"}var rA="[object Symbol]";function aA(i){return typeof i=="symbol"||Cn(i)&&bs(i)==rA}var Ho=Array.isArray,lA=/\s/;function cA(i){for(var e=i.length;e--&&lA.test(i.charAt(e)););return e}var dA=/^\s+/;function hA(i){return i&&i.slice(0,cA(i)+1).replace(dA,"")}function jt(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var ih=NaN,uA=/^[-+]0x[0-9a-f]+$/i,fA=/^0b[01]+$/i,pA=/^0o[0-7]+$/i,mA=parseInt;function nh(i){if(typeof i=="number")return i;if(aA(i))return ih;if(jt(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=jt(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=hA(i);var t=fA.test(i);return t||pA.test(i)?mA(i.slice(2),t?2:8):uA.test(i)?ih:+i}function sh(i){return i}var gA="[object AsyncFunction]",yA="[object Function]",AA="[object GeneratorFunction]",vA="[object Proxy]";function Qa(i){if(!jt(i))return!1;var e=bs(i);return e==yA||e==AA||e==gA||e==vA}var za=ji["__core-js_shared__"],oh=(function(){var i=/[^.]+$/.exec(za&&za.keys&&za.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function bA(i){return!!oh&&oh in i}var wA=Function.prototype,CA=wA.toString;function EA(i){if(i!=null){try{return CA.call(i)}catch{}try{return i+""}catch{}}return""}var xA=/[\\^$.*+?()[\]{}|]/g,IA=/^\[object .+?Constructor\]$/,SA=Function.prototype,MA=Object.prototype,TA=SA.toString,BA=MA.hasOwnProperty,_A=RegExp("^"+TA.call(BA).replace(xA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kA(i){if(!jt(i)||bA(i))return!1;var e=Qa(i)?_A:IA;return e.test(EA(i))}function PA(i,e){return i?.[e]}function Ha(i,e){var t=PA(i,e);return kA(t)?t:void 0}var rh=Object.create,DA=(function(){function i(){}return function(e){if(!jt(e))return{};if(rh)return rh(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}})();function NA(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}function LA(i,e){var t=-1,n=i.length;for(e||(e=Array(n));++t<n;)e[t]=i[t];return e}var RA=800,FA=16,OA=Date.now;function GA(i){var e=0,t=0;return function(){var n=OA(),s=FA-(n-t);if(t=n,s>0){if(++e>=RA)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}function UA(i){return function(){return i}}var Yo=(function(){try{var i=Ha(Object,"defineProperty");return i({},"",{}),i}catch{}})(),VA=Yo?function(i,e){return Yo(i,"toString",{configurable:!0,enumerable:!1,value:UA(e),writable:!0})}:sh,QA=GA(VA),zA=9007199254740991,HA=/^(?:0|[1-9]\d*)$/;function ah(i,e){var t=typeof i;return e=e??zA,!!e&&(t=="number"||t!="symbol"&&HA.test(i))&&i>-1&&i%1==0&&i<e}function Ya(i,e,t){e=="__proto__"&&Yo?Yo(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}function $o(i,e){return i===e||i!==i&&e!==e}var YA=Object.prototype,$A=YA.hasOwnProperty;function jA(i,e,t){var n=i[e];(!($A.call(i,e)&&$o(n,t))||t===void 0&&!(e in i))&&Ya(i,e,t)}function WA(i,e,t,n){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var a=e[o],l=void 0;l===void 0&&(l=i[a]),s?Ya(t,a,l):jA(t,a,l)}return t}var lh=Math.max;function qA(i,e,t){return e=lh(e===void 0?i.length-1:e,0),function(){for(var n=arguments,s=-1,o=lh(n.length-e,0),r=Array(o);++s<o;)r[s]=n[e+s];s=-1;for(var a=Array(e+1);++s<e;)a[s]=n[s];return a[e]=t(r),NA(i,this,a)}}function KA(i,e){return QA(qA(i,e,sh),i+"")}var XA=9007199254740991;function ch(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=XA}function $a(i){return i!=null&&ch(i.length)&&!Qa(i)}function JA(i,e,t){if(!jt(t))return!1;var n=typeof e;return(n=="number"?$a(t)&&ah(e,t.length):n=="string"&&e in t)?$o(t[e],i):!1}function ZA(i){return KA(function(e,t){var n=-1,s=t.length,o=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(o=i.length>3&&typeof o=="function"?(s--,o):void 0,r&&JA(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++n<s;){var a=t[n];a&&i(e,a,n,o)}return e})}var e1=Object.prototype;function dh(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||e1;return i===t}function t1(i,e){for(var t=-1,n=Array(i);++t<i;)n[t]=e(t);return n}var i1="[object Arguments]";function hh(i){return Cn(i)&&bs(i)==i1}var uh=Object.prototype,n1=uh.hasOwnProperty,s1=uh.propertyIsEnumerable,ja=hh((function(){return arguments})())?hh:function(i){return Cn(i)&&n1.call(i,"callee")&&!s1.call(i,"callee")};function o1(){return!1}var fh=typeof Q=="object"&&Q&&!Q.nodeType&&Q,ph=fh&&typeof module=="object"&&module&&!module.nodeType&&module,r1=ph&&ph.exports===fh,mh=r1?ji.Buffer:void 0,a1=mh?mh.isBuffer:void 0,gh=a1||o1,l1="[object Arguments]",c1="[object Array]",d1="[object Boolean]",h1="[object Date]",u1="[object Error]",f1="[object Function]",p1="[object Map]",m1="[object Number]",g1="[object Object]",y1="[object RegExp]",A1="[object Set]",v1="[object String]",b1="[object WeakMap]",w1="[object ArrayBuffer]",C1="[object DataView]",E1="[object Float32Array]",x1="[object Float64Array]",I1="[object Int8Array]",S1="[object Int16Array]",M1="[object Int32Array]",T1="[object Uint8Array]",B1="[object Uint8ClampedArray]",_1="[object Uint16Array]",k1="[object Uint32Array]",Ie={};Ie[E1]=Ie[x1]=Ie[I1]=Ie[S1]=Ie[M1]=Ie[T1]=Ie[B1]=Ie[_1]=Ie[k1]=!0,Ie[l1]=Ie[c1]=Ie[w1]=Ie[d1]=Ie[C1]=Ie[h1]=Ie[u1]=Ie[f1]=Ie[p1]=Ie[m1]=Ie[g1]=Ie[y1]=Ie[A1]=Ie[v1]=Ie[b1]=!1;function P1(i){return Cn(i)&&ch(i.length)&&!!Ie[bs(i)]}function D1(i){return function(e){return i(e)}}var yh=typeof Q=="object"&&Q&&!Q.nodeType&&Q,ws=yh&&typeof module=="object"&&module&&!module.nodeType&&module,N1=ws&&ws.exports===yh,Wa=N1&&Zd.process,Ah=(function(){try{var i=ws&&ws.require&&ws.require("util").types;return i||Wa&&Wa.binding&&Wa.binding("util")}catch{}})(),vh=Ah&&Ah.isTypedArray,bh=vh?D1(vh):P1;function L1(i,e){var t=Ho(i),n=!t&&ja(i),s=!t&&!n&&gh(i),o=!t&&!n&&!s&&bh(i),r=t||n||s||o,a=r?t1(i.length,String):[],l=a.length;for(var c in i)r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ah(c,l))||a.push(c);return a}function R1(i,e){return function(t){return i(e(t))}}function F1(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var O1=Object.prototype,G1=O1.hasOwnProperty;function U1(i){if(!jt(i))return F1(i);var e=dh(i),t=[];for(var n in i)n=="constructor"&&(e||!G1.call(i,n))||t.push(n);return t}function wh(i){return $a(i)?L1(i):U1(i)}var Cs=Ha(Object,"create");function V1(){this.__data__=Cs?Cs(null):{},this.size=0}function Q1(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var z1="__lodash_hash_undefined__",H1=Object.prototype,Y1=H1.hasOwnProperty;function $1(i){var e=this.__data__;if(Cs){var t=e[i];return t===z1?void 0:t}return Y1.call(e,i)?e[i]:void 0}var j1=Object.prototype,W1=j1.hasOwnProperty;function q1(i){var e=this.__data__;return Cs?e[i]!==void 0:W1.call(e,i)}var K1="__lodash_hash_undefined__";function X1(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=Cs&&e===void 0?K1:e,this}function Wi(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var n=i[e];this.set(n[0],n[1])}}Wi.prototype.clear=V1,Wi.prototype.delete=Q1,Wi.prototype.get=$1,Wi.prototype.has=q1,Wi.prototype.set=X1;function J1(){this.__data__=[],this.size=0}function jo(i,e){for(var t=i.length;t--;)if($o(i[t][0],e))return t;return-1}var Z1=Array.prototype,ev=Z1.splice;function tv(i){var e=this.__data__,t=jo(e,i);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():ev.call(e,t,1),--this.size,!0}function iv(i){var e=this.__data__,t=jo(e,i);return t<0?void 0:e[t][1]}function nv(i){return jo(this.__data__,i)>-1}function sv(i,e){var t=this.__data__,n=jo(t,i);return n<0?(++this.size,t.push([i,e])):t[n][1]=e,this}function di(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var n=i[e];this.set(n[0],n[1])}}di.prototype.clear=J1,di.prototype.delete=tv,di.prototype.get=iv,di.prototype.has=nv,di.prototype.set=sv;var Ch=Ha(ji,"Map");function ov(){this.size=0,this.__data__={hash:new Wi,map:new(Ch||di),string:new Wi}}function rv(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}function Wo(i,e){var t=i.__data__;return rv(e)?t[typeof e=="string"?"string":"hash"]:t.map}function av(i){var e=Wo(this,i).delete(i);return this.size-=e?1:0,e}function lv(i){return Wo(this,i).get(i)}function cv(i){return Wo(this,i).has(i)}function dv(i,e){var t=Wo(this,i),n=t.size;return t.set(i,e),this.size+=t.size==n?0:1,this}function En(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var n=i[e];this.set(n[0],n[1])}}En.prototype.clear=ov,En.prototype.delete=av,En.prototype.get=lv,En.prototype.has=cv,En.prototype.set=dv;var Eh=R1(Object.getPrototypeOf,Object),hv="[object Object]",uv=Function.prototype,fv=Object.prototype,xh=uv.toString,pv=fv.hasOwnProperty,mv=xh.call(Object);function gv(i){if(!Cn(i)||bs(i)!=hv)return!1;var e=Eh(i);if(e===null)return!0;var t=pv.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&xh.call(t)==mv}function yv(){this.__data__=new di,this.size=0}function Av(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}function vv(i){return this.__data__.get(i)}function bv(i){return this.__data__.has(i)}var wv=200;function Cv(i,e){var t=this.__data__;if(t instanceof di){var n=t.__data__;if(!Ch||n.length<wv-1)return n.push([i,e]),this.size=++t.size,this;t=this.__data__=new En(n)}return t.set(i,e),this.size=t.size,this}function xn(i){var e=this.__data__=new di(i);this.size=e.size}xn.prototype.clear=yv,xn.prototype.delete=Av,xn.prototype.get=vv,xn.prototype.has=bv,xn.prototype.set=Cv;var Ih=typeof Q=="object"&&Q&&!Q.nodeType&&Q,Sh=Ih&&typeof module=="object"&&module&&!module.nodeType&&module,Ev=Sh&&Sh.exports===Ih,Mh=Ev?ji.Buffer:void 0;Mh&&Mh.allocUnsafe;function xv(i,e){return i.slice()}var Th=ji.Uint8Array;function Iv(i){var e=new i.constructor(i.byteLength);return new Th(e).set(new Th(i)),e}function Sv(i,e){var t=Iv(i.buffer);return new i.constructor(t,i.byteOffset,i.length)}function Mv(i){return typeof i.constructor=="function"&&!dh(i)?DA(Eh(i)):{}}function Tv(i){return function(e,t,n){for(var s=-1,o=Object(e),r=n(e),a=r.length;a--;){var l=r[++s];if(t(o[l],l,o)===!1)break}return e}}var Bv=Tv(),qa=function(){return ji.Date.now()},_v="Expected a function",kv=Math.max,Pv=Math.min;function qo(i,e,t){var n,s,o,r,a,l,c=0,h=!1,u=!1,p=!0;if(typeof i!="function")throw new TypeError(_v);e=nh(e)||0,jt(t)&&(h=!!t.leading,u="maxWait"in t,o=u?kv(nh(t.maxWait)||0,e):o,p="trailing"in t?!!t.trailing:p);function f(I){var E=n,S=s;return n=s=void 0,c=I,r=i.apply(S,E),r}function m(I){return c=I,a=setTimeout(A,e),h?f(I):r}function y(I){var E=I-l,S=I-c,w=e-E;return u?Pv(w,o-S):w}function g(I){var E=I-l,S=I-c;return l===void 0||E>=e||E<0||u&&S>=o}function A(){var I=qa();if(g(I))return v(I);a=setTimeout(A,y(I))}function v(I){return a=void 0,p&&n?f(I):(n=s=void 0,r)}function b(){a!==void 0&&clearTimeout(a),c=0,n=l=s=a=void 0}function C(){return a===void 0?r:v(qa())}function x(){var I=qa(),E=g(I);if(n=arguments,s=this,l=I,E){if(a===void 0)return m(l);if(u)return clearTimeout(a),a=setTimeout(A,e),f(l)}return a===void 0&&(a=setTimeout(A,e)),r}return x.cancel=b,x.flush=C,x}function Ka(i,e,t){(t!==void 0&&!$o(i[e],t)||t===void 0&&!(e in i))&&Ya(i,e,t)}function Dv(i){return Cn(i)&&$a(i)}function Xa(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}function Nv(i){return WA(i,wh(i))}function Lv(i,e,t,n,s,o,r){var a=Xa(i,t),l=Xa(e,t),c=r.get(l);if(c){Ka(i,t,c);return}var h=o?o(a,l,t+"",i,e,r):void 0,u=h===void 0;if(u){var p=Ho(l),f=!p&&gh(l),m=!p&&!f&&bh(l);h=l,p||f||m?Ho(a)?h=a:Dv(a)?h=LA(a):f?(u=!1,h=xv(l)):m?(u=!1,h=Sv(l)):h=[]:gv(l)||ja(l)?(h=a,ja(a)?h=Nv(a):(!jt(a)||Qa(a))&&(h=Mv(l))):u=!1}u&&(r.set(l,h),s(h,l,n,o,r),r.delete(l)),Ka(i,t,h)}function Bh(i,e,t,n,s){i!==e&&Bv(e,function(o,r){if(s||(s=new xn),jt(o))Lv(i,e,r,t,Bh,n,s);else{var a=n?n(Xa(i,r),o,r+"",i,e,s):void 0;a===void 0&&(a=o),Ka(i,r,a)}},wh)}var Rv=ZA(function(i,e,t){Bh(i,e,t)});function Ja({Cesium:i,tileset:e}){const t=e.leiting;if(!t||!t.model||!t.model.formData)return;const n=t.model.formData,s=t.box,o=i.Quaternion.fromAxisAngle(i.Cartesian3.UNIT_Z,i.Math.toRadians(n.totalRotation||0)),r=i.Matrix4.fromRotationTranslation(i.Matrix3.fromQuaternion(o),i.Cartesian3.ZERO),a=i.Cartesian3.fromDegrees(n.longitude,n.latitude,n.height),l=i.Transforms.eastNorthUpToFixedFrame(a),c=i.Matrix4.multiply(l,r,new i.Matrix4);if(e._root){if(!s){e._root.transform=c;return}try{const{center:h}=s,u=e.root.boundingVolume.boundingSphere,p=new i.Cartesian3(h.x,h.y,0),f=i.Matrix4.multiplyByPoint(c,p,new i.Cartesian3),m=i.Cartographic.fromCartesian(f),y=u.center,g=i.Transforms.eastNorthUpToFixedFrame(new i.Cartesian3(y.x,y.y,y.z)),A=new i.Cartesian3(-h.x+(n.X||0),-h.y+(n.Y||0),n.Z||0),v=i.Matrix4.fromTranslation(A),b=i.Matrix4.multiply(r,v,new i.Matrix4),C=i.Cartesian3.fromDegrees(m.longitude/Math.PI*180,m.latitude/Math.PI*180,n.height),x=i.Transforms.eastNorthUpToFixedFrame(C),I=i.Matrix4.multiply(x,b,new i.Matrix4);i.Matrix4.multiply(g,b,g),e._root.transform=I}catch(h){console.error("Update model position failed:",h)}}}const In={NotLoaded:0,Loading:1,Loaded:2,Error:3},qi=4294967295,Wt=65535,Za=255,Fv=8,_h=9,Ov=0,Gv=99,Uv=67324752,kh=134695760,Vv=kh,Ph=33639248,Qv=101010256,Dh=101075792,zv=117853008,Sn=22,el=20,tl=56,Hv=12,Yv=20,Nh=4,$v=1,jv=39169,Wv=10,qv=1,Kv=21589,Xv=28789,Jv=25461,Zv=6534,eb=30837,tb=30805,Lh=1,ib=6,Rh=8,Fh=2048,nb=16,sb=1,ob=2,rb=4,ab=32,Oh=61440,il=16384,nl=73,lb=420,cb=2048,db=1024,hb=512,ub="/",sl=30,fb=10,pb=14,mb=18,Se=void 0,Ei="undefined",Ki="function",gb=64;let Gh=2;try{typeof navigator!=Ei&&navigator.hardwareConcurrency&&(Gh=navigator.hardwareConcurrency)}catch{}const yb={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:64*1024,maxWorkers:Gh,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof CompressionStream!=Ei&&CompressionStream,DecompressionStream:typeof DecompressionStream!=Ei&&DecompressionStream},Uh=Object.assign({},yb);function Ab(){return Uh}function vb(i){return Math.max(i.chunkSize,gb)}function Ko(i){const{baseURI:e,chunkSize:t,maxWorkers:n,terminateWorkerTimeout:s,useCompressionStream:o,useWebWorkers:r,CompressionStream:a,DecompressionStream:l,CompressionStreamZlib:c,DecompressionStreamZlib:h,workerURI:u,wasmURI:p}=i;_t("baseURI",e),_t("wasmURI",p),_t("workerURI",u),_t("chunkSize",t),_t("maxWorkers",n),_t("terminateWorkerTimeout",s),_t("useCompressionStream",o),_t("useWebWorkers",r),_t("CompressionStream",a),_t("DecompressionStream",l),_t("CompressionStreamZlib",c),_t("DecompressionStreamZlib",h)}function _t(i,e){e!==Se&&(Uh[i]=e)}function bb(i){let e;i({workerURI:()=>(e||(e="data:text/javascript,"+encodeURIComponent(`(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:i,Uint32Array:c,Int32Array:a,Map:h,DataView:f,Promise:l,TextEncoder:u,crypto:w,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:g,DecompressionStream:S}=self,b=void 0,v="undefined",k="function",z=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;z[t]=e}class C{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,s=0|t.length;s>n;n++)e=e>>>8^z[255&(e^t[n])];this.t=e}get(){return~this.t}}class A extends d{constructor(){let t;const e=new C;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new f(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}const x={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=x.o(n);return 32===s?t.concat(e):x.i(e,s,0|n,t.slice(0,t.length-1))},h(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+x.o(n)},l(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=x.u(e,t[n-1]&2147483648>>e-1,1)),t},u:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>s.round(t/1099511627776)||32,i(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=x.o(r);return s.push(x.u(e+o&31,e+o>32?n:s.pop(),1)),s}},I={bytes:{p(t){const e=x.h(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},m(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(x.u(8*(3&n),s)),e}}},R=class{constructor(t){const e=this;e.blockSize=512,e.S=[1732584193,4023233417,2562383102,271733878,3285377520],e.v=[1518500249,1859775393,2400959708,3395469782],t?(e.k=t.k.slice(0),e.C=t.C.slice(0),e.A=t.A):e.reset()}reset(){const t=this;return t.k=t.S.slice(0),t.C=[],t.A=0,t}update(t){const e=this;"string"==typeof t&&(t=I.I.m(t));const n=e.C=x.concat(e.C,t),s=e.A,o=e.A=s+x.h(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const i=new c(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.R(i.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}P(){const t=this;let e=t.C;const n=t.k;e=x.concat(e,[x.u(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.A/4294967296)),e.push(0|t.A);e.length;)t.R(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}V(t,e){return e<<t|e>>>32-t}R(e){const n=this,r=n.k,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let i=r[0],c=r[1],a=r[2],h=r[3],f=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.V(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.V(5,i)+n.U(t,c,a,h)+f+o[t]+n.v[s.floor(t/20)]|0;f=h,h=a,a=n.V(30,c),c=i,i=e}r[0]=r[0]+i|0,r[1]=r[1]+c|0,r[2]=r[2]+a|0,r[3]=r[3]+h|0,r[4]=r[4]+f|0}},P={getRandomValues(t){const e=new c(t.buffer),n=t=>{let e=987654321;const n=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&n,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,o=0;o<t.length;o+=4){const t=n(4294967296*(r||s.random()));r=987654071*t(),e[o/4]=4294967296*t()|0}return t}},U={importKey:t=>new U.M(I.bytes.m(t)),_(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let i,c,a,h,l;const u=new ArrayBuffer(o),w=new f(u);let p=0;const d=x;for(e=I.bytes.m(e),l=1;(o||1)>p;l++){for(i=c=t.encrypt(d.concat(e,[l])),a=1;n>a;a++)for(c=t.encrypt(c),h=0;h<c.length;h++)i[h]^=c[h];for(a=0;(o||1)>p&&a<i.length;a++)w.setInt32(p,i[a]),p+=4}return u.slice(0,s/8)},M:class{constructor(t){const e=this,n=e.B=R,s=[[],[]];e.D=[new n,new n];const r=e.D[0].blockSize/32;t.length>r&&(t=(new n).update(t).P());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.D[0].update(s[0]),e.D[1].update(s[1]),e.W=new n(e.D[0])}reset(){const t=this;t.W=new t.B(t.D[0]),t.K=!1}update(t){this.K=!0,this.W.update(t)}digest(){const t=this,e=t.W.P(),n=new t.B(t.D[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.K)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},V=typeof w!=v&&typeof w.getRandomValues==k,M="Invalid password",_="Invalid signature",B="zipjs-abort-check-password";function D(t){return V?w.getRandomValues(t):P.getRandomValues(t)}const W=16,K={name:"PBKDF2"},E=e.assign({hash:{name:"HMAC"}},K),L=e.assign({iterations:1e3,hash:{name:"SHA-1"}},K),O=["deriveBits"],T=[8,12,16],j=[16,24,32],H=10,Z=[0,0,0,0],F=typeof w!=v,N=F&&w.subtle,q=F&&typeof N!=v,G=I.bytes,J=class{constructor(t){const e=this;e.L=[[[],[],[],[],[]],[[],[],[],[],[]]],e.L[0][0][0]||e.O();const n=e.L[0][4],s=e.L[1],o=t.length;let i,c,a,h=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.v=[c=t.slice(0),a=[]],i=o;4*o+28>i;i++){let t=c[i-1];(i%o===0||8===o&&i%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],i%o===0&&(t=t<<8^t>>>24^h<<24,h=h<<1^283*(h>>7))),c[i]=c[i-o]^t}for(let t=0;i;t++,i--){const e=c[3&t?i:i-4];a[t]=4>=i||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.T(t,0)}decrypt(t){return this.T(t,1)}O(){const t=this.L[0],e=this.L[1],n=t[4],s=e[4],r=[],o=[];let i,c,a,h;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let f=i=0;!n[f];f^=c||1,i=o[i]||1){let o=i^i<<1^i<<2^i<<3^i<<4;o=o>>8^255&o^99,n[f]=o,s[o]=f,h=r[a=r[c=r[f]]];let l=16843009*h^65537*a^257*c^16843008*f,u=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][f]=u=u<<24^u>>>8,e[n][o]=l=l<<24^l>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}T(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.v[e],s=n.length/4-2,o=[0,0,0,0],i=this.L[e],c=i[0],a=i[1],h=i[2],f=i[3],l=i[4];let u,w,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],g=t[e?1:3]^n[3],S=4;for(let t=0;s>t;t++)u=c[d>>>24]^a[y>>16&255]^h[m>>8&255]^f[255&g]^n[S],w=c[y>>>24]^a[m>>16&255]^h[g>>8&255]^f[255&d]^n[S+1],p=c[m>>>24]^a[g>>16&255]^h[d>>8&255]^f[255&y]^n[S+2],g=c[g>>>24]^a[d>>16&255]^h[y>>8&255]^f[255&m]^n[S+3],S+=4,d=u,y=w,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&g]^n[S++],u=d,d=y,y=m,m=g,g=u;return o}},Q=class{constructor(t,e){this.j=t,this.H=e,this.Z=e}reset(){this.Z=this.H}update(t){return this.F(this.j,t,this.Z)}N(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}q(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}F(t,e,n){let s;if(!(s=e.length))return[];const r=x.h(e);for(let r=0;s>r;r+=4){this.q(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return x.l(e,r)}},X=U.M;let Y=F&&q&&typeof N.importKey==k,$=F&&q&&typeof N.deriveBits==k;class tt extends d{constructor({password:t,rawPassword:n,signed:s,encryptionStrength:i,checkPasswordOnly:c}){super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),signed:s,J:i-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:i,G:a,ready:h}=n;s?(await(async(t,e,n,s)=>{const o=await st(t,e,n,it(s,0,T[e])),i=it(s,T[e]);if(o[0]!=i[0]||o[1]!=i[1])throw new r(M)})(n,i,s,it(t,0,T[i]+2)),t=it(t,T[i]+2),c?e.error(new r(B)):a()):await h;const f=new o(t.length-H-(t.length-H)%W);e.enqueue(nt(n,t,f,0,H,!0))},async flush(t){const{signed:e,X:n,Y:s,pending:i,ready:c}=this;if(s&&n){await c;const a=it(i,0,i.length-H),h=it(i,i.length-H);let f=new o;if(a.length){const t=at(G,a);s.update(t);const e=n.update(t);f=ct(G,e)}if(e){const t=it(ct(G,s.digest()),0,H);for(let e=0;H>e;e++)if(t[e]!=h[e])throw new r(_)}t.enqueue(f)}}})}}class et extends d{constructor({password:t,rawPassword:n,encryptionStrength:s}){let r;super({start(){e.assign(this,{ready:new l(t=>this.G=t),password:rt(t,n),J:s-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:r,G:i,ready:c}=n;let a=new o;s?(a=await(async(t,e,n)=>{const s=D(new o(T[e]));return ot(s,await st(t,e,n,s))})(n,r,s),i()):await c;const h=new o(a.length+t.length-t.length%W);h.set(a,0),e.enqueue(nt(n,t,h,a.length,0))},async flush(t){const{X:e,Y:n,pending:s,ready:i}=this;if(n&&e){await i;let c=new o;if(s.length){const t=e.update(at(G,s));n.update(t),c=ct(G,t)}r.signature=ct(G,n.digest()).slice(0,H),t.enqueue(ot(c,r.signature))}}}),r=this}}function nt(t,e,n,s,r,i){const{X:c,Y:a,pending:h}=t,f=e.length-r;let l;for(h.length&&(e=ot(h,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,f-f%W)),l=0;f-W>=l;l+=W){const t=at(G,it(e,l,l+W));i&&a.update(t);const r=c.update(t);i||a.update(r),n.set(ct(G,r),l+s)}return t.pending=it(e,l),n}async function st(n,s,r,i){n.password=null;const c=await(async(t,e,n,s,r)=>{if(!Y)return U.importKey(e);try{return await N.importKey("raw",e,n,!1,r)}catch{return Y=!1,U.importKey(e)}})(0,r,E,0,O),a=await(async(t,e,n)=>{if(!$)return U._(e,t.salt,L.iterations,n);try{return await N.deriveBits(t,e,n)}catch{return $=!1,U._(e,t.salt,L.iterations,n)}})(e.assign({salt:i},L),c,8*(2*j[s]+2)),h=new o(a),f=at(G,it(h,0,j[s])),l=at(G,it(h,j[s],2*j[s])),u=it(h,2*j[s]);return e.assign(n,{keys:{key:f,$:l,passwordVerification:u},X:new Q(new J(f),t.from(Z)),Y:new X(l)}),u}function rt(t,e){return e===b?(t=>{if(typeof u==v){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new u).encode(t)})(t):e}function ot(t,e){let n=t;return t.length+e.length&&(n=new o(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function it(t,e,n){return t.subarray(e,n)}function ct(t,e){return t.p(e)}function at(t,e){return t.m(e)}class ht extends d{constructor({password:t,passwordVerification:n,checkPasswordOnly:s}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;if(n.password){const e=lt(n,t.subarray(0,12));if(n.password=null,e.at(-1)!=n.passwordVerification)throw new r(M);t=t.subarray(12)}s?e.error(new r(B)):e.enqueue(lt(n,t))}})}}class ft extends d{constructor({password:t,passwordVerification:n}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;let s,r;if(n.password){n.password=null;const e=D(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(ut(n,e),0),r=12}else s=new o(t.length),r=0;s.set(ut(n,t),r),e.enqueue(s)}})}}function lt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,n[s]);return n}function ut(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,e[s]);return n}function wt(t,n){const s=[305419896,591751049,878082192];e.assign(t,{keys:s,tt:new C(s[0]),et:new C(s[2])});for(let e=0;e<n.length;e++)pt(t,n.charCodeAt(e))}function pt(t,e){let[n,r,o]=t.keys;t.tt.append([e]),n=~t.tt.get(),r=mt(s.imul(mt(r+yt(n)),134775813)+1),t.et.append([r>>>24]),o=~t.et.get(),t.keys=[n,r,o]}function dt(t){const e=2|t.keys[2];return yt(s.imul(e,1^e)>>>8)}function yt(t){return 255&t}function mt(t){return 4294967295&t}class gt extends d{constructor(t,{chunkSize:e,nt:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:i,zipCrypto:c,signed:a,level:h}=t,l=this;let u,w,p=super.readable;o&&!c||!a||(u=new A,p=kt(p,u)),r&&(p=vt(p,i,{level:h,chunkSize:e},s,n,s)),o&&(c?p=kt(p,new ft(t)):(w=new et(t),p=kt(p,w))),bt(l,p,()=>{let t;o&&!c&&(t=w.signature),o&&!c||!a||(t=new f(u.value.buffer).getUint32(0)),l.signature=t})}}class St extends d{constructor(t,{chunkSize:e,st:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:i,signed:c,signature:a,compressed:h,useCompressionStream:l,rt:u}=t;let w,p,d=super.readable;i&&(o?d=kt(d,new ht(t)):(p=new tt(t),d=kt(d,p))),h&&(d=vt(d,l,{chunkSize:e,rt:u},s,n,s)),i&&!o||!c||(w=new A,d=kt(d,w)),bt(this,d,()=>{if((!i||o)&&c){const t=new f(w.value.buffer);if(a!=t.getUint32(0,!1))throw new r(_)}})}}function bt(t,n,s){n=kt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function vt(t,e,n,s,r,o){const i=e&&s?s:r||o,c=n.rt?"deflate64-raw":"deflate-raw";try{t=kt(t,new i(c,n))}catch(s){if(!e)throw s;if(r)t=kt(t,new r(c,n));else{if(!o)throw s;t=kt(t,new o(c,n))}}return t}function kt(t,e){return t.pipeThrough(e)}const zt="data",Ct="close";class At extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let i;o.startsWith("deflate")?i=gt:o.startsWith("inflate")&&(i=St),s.outputSize=0;let c=0;const a=new i(t,n),h=super.readable,f=new d({transform(t,e){t&&t.length&&(c+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:c})}}),l=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==b&&s.outputSize>t.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:t}=a;e.assign(s,{signature:t,inputSize:c})}});e.defineProperty(s,"readable",{get:()=>h.pipeThrough(f).pipeThrough(a).pipeThrough(l)})}}class xt extends d{constructor(t){let e;super({transform:function n(s,r){if(e){const t=new o(e.length+s.length);t.set(e),t.set(s,e.length),s=t,e=null}s.length>t?(r.enqueue(s.slice(0,t)),n(s.slice(t),r)):e=s},flush(t){e&&e.length&&t.enqueue(e)}})}}const It=new h,Rt=new h;let Pt,Ut,Vt,Mt,_t,Bt=0;async function Dt(t){try{const{options:e,config:s}=t;if(!e.useCompressionStream)try{await self.initModule(t.config)}catch{e.useCompressionStream=!0}s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream;const r={highWaterMark:1},o=t.readable||new y({async pull(t){const e=new l(t=>It.set(Bt,t));Wt({type:"pull",messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},r),i=t.writable||new m({async write(t){let e;const s=new l(t=>e=t);Rt.set(Bt,e),Wt({type:zt,value:t,messageId:Bt}),Bt=(Bt+1)%n.MAX_SAFE_INTEGER,await s}},r),c=new At(e,s);Pt=new AbortController;const{signal:a}=Pt;await o.pipeThrough(c).pipeThrough(new xt(s.chunkSize)).pipeTo(i,{signal:a,preventClose:!0,preventAbort:!0}),await i.getWriter().close();const{signature:h,inputSize:f,outputSize:u}=c;Wt({type:Ct,result:{signature:h,inputSize:f,outputSize:u}})}catch(t){t.outputSize=0,Kt(t)}}function Wt(t){let{value:e}=t;if(e)if(e.length)try{e=new o(e),t.value=e.buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t)}function Kt(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:i}=t;p({error:{message:e,stack:n,code:s,name:o,outputSize:i}})}function Et(t,e,n={}){const i="number"==typeof n.level?n.level:-1,c="number"==typeof n.ot?n.ot:65536,a="number"==typeof n.it?n.it:65536;return new d({start(){let n;if(this.ct=Vt(c),this.in=Vt(a),this.it=a,this.ht=new o(c),t?(this.ft=Ut.deflate_process,this.lt=Ut.deflate_last_consumed,this.ut=Ut.deflate_end,this.wt=Ut.deflate_new(),n="gzip"===e?Ut.deflate_init_gzip(this.wt,i):"deflate-raw"===e?Ut.deflate_init_raw(this.wt,i):Ut.deflate_init(this.wt,i)):"deflate64-raw"===e?(this.ft=Ut.inflate9_process,this.lt=Ut.inflate9_last_consumed,this.ut=Ut.inflate9_end,this.wt=Ut.inflate9_new(),n=Ut.inflate9_init_raw(this.wt)):(this.ft=Ut.inflate_process,this.lt=Ut.inflate_last_consumed,this.ut=Ut.inflate_end,this.wt=Ut.inflate_new(),n="deflate-raw"===e?Ut.inflate_init_raw(this.wt):"gzip"===e?Ut.inflate_init_gzip(this.wt):Ut.inflate_init(this.wt)),0!==n)throw new r("init failed:"+n)},transform(e,n){try{const i=e,a=new o(_t.buffer),h=this.ft,f=this.lt,l=this.ct,u=this.ht;let w=0;for(;w<i.length;){const e=s.min(i.length-w,32768);this.in&&this.it>=e||(this.in&&Mt&&Mt(this.in),this.in=Vt(e),this.it=e),a.set(i.subarray(w,w+e),this.in);const o=h(this.wt,this.in,e,l,c,0),p=16777215&o;if(p&&(u.set(a.subarray(l,l+p),0),n.enqueue(u.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=f(this.wt);if(0===d)break;w+=d}}catch(t){this.ut&&this.wt&&this.ut(this.wt),this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct),n.error(t)}},flush(e){try{const n=new o(_t.buffer),s=this.ft,i=this.ct,a=this.ht;for(;;){const o=s(this.wt,0,0,i,c,4),h=16777215&o,f=o>>24&255;if(!t){const t=128&f?f-256:f;if(0>t)throw new r("process error:"+t)}if(h&&(a.set(n.subarray(i,i+h),0),e.enqueue(a.slice(0,h))),1===f||0===h)break}}catch(t){e.error(t)}finally{if(this.ut&&this.wt){const t=this.ut(this.wt);0!==t&&e.error(new r("end error:"+t))}this.in&&Mt&&Mt(this.in),this.ct&&Mt&&Mt(this.ct)}}})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&Dt(t),e==zt){const t=It.get(n);It.delete(n),t({value:new o(s),done:r})}if("ack"==e){const t=Rt.get(n);Rt.delete(n),t()}e==Ct&&Pt.abort()}catch(t){Kt(t)}});class Lt{constructor(t="deflate",e){return Et(!0,t,e)}}class Ot{constructor(t="deflate",e){return Et(!1,t,e)}}let Tt=!1;self.initModule=async t=>{try{const e=await(async(t,{baseURI:e})=>{if(!Tt){let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(Ut=t,({malloc:Vt,free:Mt,memory:_t}=Ut),"function"!=typeof Vt||"function"!=typeof Mt||!_t)throw Ut=Vt=Mt=_t=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports),Tt=!0}})(t.wasmURI,t);return t.nt=Lt,t.st=Ot,e}catch{}}});
13
- `)),e)})}const Vh=[];for(let i=0;i<256;i++){let e=i;for(let t=0;t<8;t++)e&1?e=e>>>1^3988292384:e=e>>>1;Vh[i]=e}class Xo{constructor(e){this.crc=e||-1}append(e){let t=this.crc|0;for(let n=0,s=e.length|0;n<s;n++)t=t>>>8^Vh[(t^e[n])&255];this.crc=t}get(){return~this.crc}}class Qh extends TransformStream{constructor(){let e;const t=new Xo;super({transform(n,s){t.append(n),s.enqueue(n)},flush(){const n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}function wb(i){if(typeof TextEncoder==Ei){i=unescape(encodeURIComponent(i));const e=new Uint8Array(i.length);for(let t=0;t<e.length;t++)e[t]=i.charCodeAt(t);return e}else return new TextEncoder().encode(i)}const pt={concat(i,e){if(i.length===0||e.length===0)return i.concat(e);const t=i[i.length-1],n=pt.getPartial(t);return n===32?i.concat(e):pt._shiftRight(e,n,t|0,i.slice(0,i.length-1))},bitLength(i){const e=i.length;if(e===0)return 0;const t=i[e-1];return(e-1)*32+pt.getPartial(t)},clamp(i,e){if(i.length*32<e)return i;i=i.slice(0,Math.ceil(e/32));const t=i.length;return e=e&31,t>0&&e&&(i[t-1]=pt.partial(e,i[t-1]&2147483648>>e-1,1)),i},partial(i,e,t){return i===32?e:(t?e|0:e<<32-i)+i*1099511627776},getPartial(i){return Math.round(i/1099511627776)||32},_shiftRight(i,e,t,n){for(n===void 0&&(n=[]);e>=32;e-=32)n.push(t),t=0;if(e===0)return n.concat(i);for(let r=0;r<i.length;r++)n.push(t|i[r]>>>e),t=i[r]<<32-e;const s=i.length?i[i.length-1]:0,o=pt.getPartial(s);return n.push(pt.partial(e+o&31,e+o>32?t:n.pop(),1)),n}},Jo={bytes:{fromBits(i){const t=pt.bitLength(i)/8,n=new Uint8Array(t);let s;for(let o=0;o<t;o++)(o&3)===0&&(s=i[o/4]),n[o]=s>>>24,s<<=8;return n},toBits(i){const e=[];let t,n=0;for(t=0;t<i.length;t++)n=n<<8|i[t],(t&3)===3&&(e.push(n),n=0);return t&3&&e.push(pt.partial(8*(t&3),n)),e}}},zh={};zh.sha1=class{constructor(i){const e=this;e.blockSize=512,e._init=[1732584193,4023233417,2562383102,271733878,3285377520],e._key=[1518500249,1859775393,2400959708,3395469782],i?(e._h=i._h.slice(0),e._buffer=i._buffer.slice(0),e._length=i._length):e.reset()}reset(){const i=this;return i._h=i._init.slice(0),i._buffer=[],i._length=0,i}update(i){const e=this;typeof i=="string"&&(i=Jo.utf8String.toBits(i));const t=e._buffer=pt.concat(e._buffer,i),n=e._length,s=e._length=n+pt.bitLength(i);if(s>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const o=new Uint32Array(t);let r=0;for(let a=e.blockSize+n-(e.blockSize+n&e.blockSize-1);a<=s;a+=e.blockSize)e._block(o.subarray(16*r,16*(r+1))),r+=1;return t.splice(0,16*r),e}finalize(){const i=this;let e=i._buffer;const t=i._h;e=pt.concat(e,[pt.partial(1,1)]);for(let n=e.length+2;n&15;n++)e.push(0);for(e.push(Math.floor(i._length/4294967296)),e.push(i._length|0);e.length;)i._block(e.splice(0,16));return i.reset(),t}_f(i,e,t,n){if(i<=19)return e&t|~e&n;if(i<=39)return e^t^n;if(i<=59)return e&t|e&n|t&n;if(i<=79)return e^t^n}_S(i,e){return e<<i|e>>>32-i}_block(i){const e=this,t=e._h,n=Array(80);for(let c=0;c<16;c++)n[c]=i[c];let s=t[0],o=t[1],r=t[2],a=t[3],l=t[4];for(let c=0;c<=79;c++){c>=16&&(n[c]=e._S(1,n[c-3]^n[c-8]^n[c-14]^n[c-16]));const h=e._S(5,s)+e._f(c,o,r,a)+l+n[c]+e._key[Math.floor(c/20)]|0;l=a,a=r,r=e._S(30,o),o=s,s=h}t[0]=t[0]+s|0,t[1]=t[1]+o|0,t[2]=t[2]+r|0,t[3]=t[3]+a|0,t[4]=t[4]+l|0}};const Hh={};Hh.aes=class{constructor(i){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const t=e._tables[0][4],n=e._tables[1],s=i.length;let o,r,a,l=1;if(s!==4&&s!==6&&s!==8)throw new Error("invalid aes key size");for(e._key=[r=i.slice(0),a=[]],o=s;o<4*s+28;o++){let c=r[o-1];(o%s===0||s===8&&o%s===4)&&(c=t[c>>>24]<<24^t[c>>16&255]<<16^t[c>>8&255]<<8^t[c&255],o%s===0&&(c=c<<8^c>>>24^l<<24,l=l<<1^(l>>7)*283)),r[o]=r[o-s]^c}for(let c=0;o;c++,o--){const h=r[c&3?o:o-4];o<=4||c<4?a[c]=h:a[c]=n[0][t[h>>>24]]^n[1][t[h>>16&255]]^n[2][t[h>>8&255]]^n[3][t[h&255]]}}encrypt(i){return this._crypt(i,0)}decrypt(i){return this._crypt(i,1)}_precompute(){const i=this._tables[0],e=this._tables[1],t=i[4],n=e[4],s=[],o=[];let r,a,l,c;for(let h=0;h<256;h++)o[(s[h]=h<<1^(h>>7)*283)^h]=h;for(let h=r=0;!t[h];h^=a||1,r=o[r]||1){let u=r^r<<1^r<<2^r<<3^r<<4;u=u>>8^u&255^99,t[h]=u,n[u]=h,c=s[l=s[a=s[h]]];let p=c*16843009^l*65537^a*257^h*16843008,f=s[u]*257^u*16843008;for(let m=0;m<4;m++)i[m][h]=f=f<<24^f>>>8,e[m][u]=p=p<<24^p>>>8}for(let h=0;h<5;h++)i[h]=i[h].slice(0),e[h]=e[h].slice(0)}_crypt(i,e){if(i.length!==4)throw new Error("invalid aes block size");const t=this._key[e],n=t.length/4-2,s=[0,0,0,0],o=this._tables[e],r=o[0],a=o[1],l=o[2],c=o[3],h=o[4];let u=i[0]^t[0],p=i[e?3:1]^t[1],f=i[2]^t[2],m=i[e?1:3]^t[3],y=4,g,A,v;for(let b=0;b<n;b++)g=r[u>>>24]^a[p>>16&255]^l[f>>8&255]^c[m&255]^t[y],A=r[p>>>24]^a[f>>16&255]^l[m>>8&255]^c[u&255]^t[y+1],v=r[f>>>24]^a[m>>16&255]^l[u>>8&255]^c[p&255]^t[y+2],m=r[m>>>24]^a[u>>16&255]^l[p>>8&255]^c[f&255]^t[y+3],y+=4,u=g,p=A,f=v;for(let b=0;b<4;b++)s[e?3&-b:b]=h[u>>>24]<<24^h[p>>16&255]<<16^h[f>>8&255]<<8^h[m&255]^t[y++],g=u,u=p,p=f,f=m,m=g;return s}};const Cb={getRandomValues(i){const e=new Uint32Array(i.buffer),t=n=>{let s=987654321;const o=4294967295;return function(){return s=36969*(s&65535)+(s>>16)&o,n=18e3*(n&65535)+(n>>16)&o,(((s<<16)+n&o)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let n=0,s;n<i.length;n+=4){const o=t((s||Math.random())*4294967296);s=o()*987654071,e[n/4]=o()*4294967296|0}return i}},Yh={};Yh.ctrGladman=class{constructor(i,e){this._prf=i,this._initIv=e,this._iv=e}reset(){this._iv=this._initIv}update(i){return this.calculate(this._prf,i,this._iv)}incWord(i){if((i>>24&255)===255){let e=i>>16&255,t=i>>8&255,n=i&255;e===255?(e=0,t===255?(t=0,n===255?n=0:++n):++t):++e,i=0,i+=e<<16,i+=t<<8,i+=n}else i+=1<<24;return i}incCounter(i){(i[0]=this.incWord(i[0]))===0&&(i[1]=this.incWord(i[1]))}calculate(i,e,t){let n;if(!(n=e.length))return[];const s=pt.bitLength(e);for(let o=0;o<n;o+=4){this.incCounter(t);const r=i.encrypt(t);e[o]^=r[0],e[o+1]^=r[1],e[o+2]^=r[2],e[o+3]^=r[3]}return pt.clamp(e,s)}};const Xi={importKey(i){return new Xi.hmacSha1(Jo.bytes.toBits(i))},pbkdf2(i,e,t,n){if(t=t||1e4,n<0||t<0)throw new Error("invalid params to pbkdf2");const s=(n>>5)+1<<2;let o,r,a,l,c;const h=new ArrayBuffer(s),u=new DataView(h);let p=0;const f=pt;for(e=Jo.bytes.toBits(e),c=1;p<(s||1);c++){for(o=r=i.encrypt(f.concat(e,[c])),a=1;a<t;a++)for(r=i.encrypt(r),l=0;l<r.length;l++)o[l]^=r[l];for(a=0;p<(s||1)&&a<o.length;a++)u.setInt32(p,o[a]),p+=4}return h.slice(0,n/8)}};Xi.hmacSha1=class{constructor(i){const e=this,t=e._hash=zh.sha1,n=[[],[]];e._baseHash=[new t,new t];const s=e._baseHash[0].blockSize/32;i.length>s&&(i=new t().update(i).finalize());for(let o=0;o<s;o++)n[0][o]=i[o]^909522486,n[1][o]=i[o]^1549556828;e._baseHash[0].update(n[0]),e._baseHash[1].update(n[1]),e._resultHash=new t(e._baseHash[0])}reset(){const i=this;i._resultHash=new i._hash(i._baseHash[0]),i._updated=!1}update(i){const e=this;e._updated=!0,e._resultHash.update(i)}digest(){const i=this,e=i._resultHash.finalize(),t=new i._hash(i._baseHash[1]).update(e).finalize();return i.reset(),t}encrypt(i){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(i),this.digest(i)}};const Eb=typeof crypto!=Ei&&typeof crypto.getRandomValues==Ki,$h="Invalid password",jh="Invalid signature",ol="zipjs-abort-check-password";function Wh(i){return Eb?crypto.getRandomValues(i):Cb.getRandomValues(i)}const Mn=16,xb="raw",qh={name:"PBKDF2"},Ib={name:"HMAC"},Sb="SHA-1",Mb=Object.assign({hash:Ib},qh),rl=Object.assign({iterations:1e3,hash:{name:Sb}},qh),Tb=["deriveBits"],Es=[8,12,16],xs=[16,24,32],xi=10,Bb=[0,0,0,0],Zo=typeof crypto!=Ei,Is=Zo&&crypto.subtle,Kh=Zo&&typeof Is!=Ei,qt=Jo.bytes,_b=Hh.aes,kb=Yh.ctrGladman,Pb=Xi.hmacSha1;let Xh=Zo&&Kh&&typeof Is.importKey==Ki,Jh=Zo&&Kh&&typeof Is.deriveBits==Ki;class Db extends TransformStream{constructor({password:e,rawPassword:t,signed:n,encryptionStrength:s,checkPasswordOnly:o}){super({start(){Object.assign(this,{ready:new Promise(r=>this.resolveReady=r),password:tu(e,t),signed:n,strength:s-1,pending:new Uint8Array})},async transform(r,a){const l=this,{password:c,strength:h,resolveReady:u,ready:p}=l;c?(await Lb(l,h,c,kt(r,0,Es[h]+2)),r=kt(r,Es[h]+2),o?a.error(new Error(ol)):u()):await p;const f=new Uint8Array(r.length-xi-(r.length-xi)%Mn);a.enqueue(Zh(l,r,f,0,xi,!0))},async flush(r){const{signed:a,ctr:l,hmac:c,pending:h,ready:u}=this;if(c&&l){await u;const p=kt(h,0,h.length-xi),f=kt(h,h.length-xi);let m=new Uint8Array;if(p.length){const y=Ms(qt,p);c.update(y);const g=l.update(y);m=Ss(qt,g)}if(a){const y=kt(Ss(qt,c.digest()),0,xi);for(let g=0;g<xi;g++)if(y[g]!=f[g])throw new Error(jh)}r.enqueue(m)}}})}}class Nb extends TransformStream{constructor({password:e,rawPassword:t,encryptionStrength:n}){let s;super({start(){Object.assign(this,{ready:new Promise(o=>this.resolveReady=o),password:tu(e,t),strength:n-1,pending:new Uint8Array})},async transform(o,r){const a=this,{password:l,strength:c,resolveReady:h,ready:u}=a;let p=new Uint8Array;l?(p=await Rb(a,c,l),h()):await u;const f=new Uint8Array(p.length+o.length-o.length%Mn);f.set(p,0),r.enqueue(Zh(a,o,f,p.length,0))},async flush(o){const{ctr:r,hmac:a,pending:l,ready:c}=this;if(a&&r){await c;let h=new Uint8Array;if(l.length){const u=r.update(Ms(qt,l));a.update(u),h=Ss(qt,u)}s.signature=Ss(qt,a.digest()).slice(0,xi),o.enqueue(al(h,s.signature))}}}),s=this}}function Zh(i,e,t,n,s,o){const{ctr:r,hmac:a,pending:l}=i,c=e.length-s;l.length&&(e=al(l,e),t=Gb(t,c-c%Mn));let h;for(h=0;h<=c-Mn;h+=Mn){const u=Ms(qt,kt(e,h,h+Mn));o&&a.update(u);const p=r.update(u);o||a.update(p),t.set(Ss(qt,p),h+n)}return i.pending=kt(e,h),t}async function Lb(i,e,t,n){const s=await eu(i,e,t,kt(n,0,Es[e])),o=kt(n,Es[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new Error($h)}async function Rb(i,e,t){const n=Wh(new Uint8Array(Es[e])),s=await eu(i,e,t,n);return al(n,s)}async function eu(i,e,t,n){i.password=null;const s=await Fb(xb,t,Mb,!1,Tb),o=await Ob(Object.assign({salt:n},rl),s,8*(xs[e]*2+2)),r=new Uint8Array(o),a=Ms(qt,kt(r,0,xs[e])),l=Ms(qt,kt(r,xs[e],xs[e]*2)),c=kt(r,xs[e]*2);return Object.assign(i,{keys:{key:a,authentication:l,passwordVerification:c},ctr:new kb(new _b(a),Array.from(Bb)),hmac:new Pb(l)}),c}async function Fb(i,e,t,n,s){if(Xh)try{return await Is.importKey(i,e,t,n,s)}catch{return Xh=!1,Xi.importKey(e)}else return Xi.importKey(e)}async function Ob(i,e,t){if(Jh)try{return await Is.deriveBits(i,e,t)}catch{return Jh=!1,Xi.pbkdf2(e,i.salt,rl.iterations,t)}else return Xi.pbkdf2(e,i.salt,rl.iterations,t)}function tu(i,e){return e===Se?wb(i):e}function al(i,e){let t=i;return i.length+e.length&&(t=new Uint8Array(i.length+e.length),t.set(i,0),t.set(e,i.length)),t}function Gb(i,e){if(e&&e>i.length){const t=i;i=new Uint8Array(e),i.set(t,0)}return i}function kt(i,e,t){return i.subarray(e,t)}function Ss(i,e){return i.fromBits(e)}function Ms(i,e){return i.toBits(e)}const Ts=12;class Ub extends TransformStream{constructor({password:e,passwordVerification:t,checkPasswordOnly:n}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),su(this,e)},transform(s,o){const r=this;if(r.password){const a=iu(r,s.subarray(0,Ts));if(r.password=null,a.at(-1)!=r.passwordVerification)throw new Error($h);s=s.subarray(Ts)}n?o.error(new Error(ol)):o.enqueue(iu(r,s))}})}}class Vb extends TransformStream{constructor({password:e,passwordVerification:t}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),su(this,e)},transform(n,s){const o=this;let r,a;if(o.password){o.password=null;const l=Wh(new Uint8Array(Ts));l[Ts-1]=o.passwordVerification,r=new Uint8Array(n.length+l.length),r.set(nu(o,l),0),a=Ts}else r=new Uint8Array(n.length),a=0;r.set(nu(o,n),a),s.enqueue(r)}})}}function iu(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=ou(i)^e[n],ll(i,t[n]);return t}function nu(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=ou(i)^e[n],ll(i,e[n]);return t}function su(i,e){const t=[305419896,591751049,878082192];Object.assign(i,{keys:t,crcKey0:new Xo(t[0]),crcKey2:new Xo(t[2])});for(let n=0;n<e.length;n++)ll(i,e.charCodeAt(n))}function ll(i,e){let[t,n,s]=i.keys;i.crcKey0.append([e]),t=~i.crcKey0.get(),n=au(Math.imul(au(n+ru(t)),134775813)+1),i.crcKey2.append([n>>>24]),s=~i.crcKey2.get(),i.keys=[t,n,s]}function ou(i){const e=i.keys[2]|2;return ru(Math.imul(e,e^1)>>>8)}function ru(i){return i&255}function au(i){return i&4294967295}const lu="Invalid uncompressed size",Qb="deflate-raw",zb="deflate64-raw";class Hb extends TransformStream{constructor(e,{chunkSize:t,CompressionStreamZlib:n,CompressionStream:s}){super({});const{compressed:o,encrypted:r,useCompressionStream:a,zipCrypto:l,signed:c,level:h}=e,u=this;let p,f,m=super.readable;(!r||l)&&c&&(p=new Qh,m=Kt(m,p)),o&&(m=du(m,a,{level:h,chunkSize:t},s,n,s)),r&&(l?m=Kt(m,new Vb(e)):(f=new Nb(e),m=Kt(m,f))),cu(u,m,()=>{let y;r&&!l&&(y=f.signature),(!r||l)&&c&&(y=new DataView(p.value.buffer).getUint32(0)),u.signature=y})}}class Yb extends TransformStream{constructor(e,{chunkSize:t,DecompressionStreamZlib:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:r,signed:a,signature:l,compressed:c,useCompressionStream:h,deflate64:u}=e;let p,f,m=super.readable;r&&(o?m=Kt(m,new Ub(e)):(f=new Db(e),m=Kt(m,f))),c&&(m=du(m,h,{chunkSize:t,deflate64:u},s,n,s)),(!r||o)&&a&&(p=new Qh,m=Kt(m,p)),cu(this,m,()=>{if((!r||o)&&a){const y=new DataView(p.value.buffer);if(l!=y.getUint32(0,!1))throw new Error(jh)}})}}function cu(i,e,t){e=Kt(e,new TransformStream({flush:t})),Object.defineProperty(i,"readable",{get(){return e}})}function du(i,e,t,n,s,o){const r=e&&n?n:s||o,a=t.deflate64?zb:Qb;try{i=Kt(i,new r(a,t))}catch(l){if(e)if(s)i=Kt(i,new s(a,t));else if(o)i=Kt(i,new o(a,t));else throw l;else throw l}return i}function Kt(i,e){return i.pipeThrough(e)}const $b="message",jb="start",Wb="pull",hu="data",qb="ack",uu="close",Kb="deflate",fu="inflate";class Xb extends TransformStream{constructor(e,t){super({});const n=this,{codecType:s}=e;let o;s.startsWith(Kb)?o=Hb:s.startsWith(fu)&&(o=Yb),n.outputSize=0;let r=0;const a=new o(e,t),l=super.readable,c=new TransformStream({transform(u,p){u&&u.length&&(r+=u.length,p.enqueue(u))},flush(){Object.assign(n,{inputSize:r})}}),h=new TransformStream({transform(u,p){if(u&&u.length&&(p.enqueue(u),n.outputSize+=u.length,e.outputSize!==Se&&n.outputSize>e.outputSize))throw new Error(lu)},flush(){const{signature:u}=a;Object.assign(n,{signature:u,inputSize:r})}});Object.defineProperty(n,"readable",{get(){return l.pipeThrough(c).pipeThrough(a).pipeThrough(h)}})}}class Jb extends TransformStream{constructor(e){let t;super({transform:n,flush(s){t&&t.length&&s.enqueue(t)}});function n(s,o){if(t){const r=new Uint8Array(t.length+s.length);r.set(t),r.set(s,t.length),s=r,t=null}s.length>e?(o.enqueue(s.slice(0,e)),n(s.slice(e),o)):t=s}}}let pu=typeof Worker!=Ei,mu=()=>{};function Zb({initModule:i}){mu=i}class cl{constructor(e,{readable:t,writable:n},{options:s,config:o,streamOptions:r,useWebWorkers:a,transferStreams:l,workerURI:c},h){const{signal:u}=r;return Object.assign(e,{busy:!0,readable:t.pipeThrough(new Jb(o.chunkSize)).pipeThrough(new ew(r),{signal:u}),writable:n,options:Object.assign({},s),workerURI:c,transferStreams:l,terminate(){return new Promise(p=>{const{worker:f,busy:m}=e;f?(m?e.resolveTerminated=p:(f.terminate(),p()),e.interface=null):p()})},onTaskFinished(){const{resolveTerminated:p}=e;p&&(e.resolveTerminated=null,e.terminated=!0,e.worker.terminate(),p()),e.busy=!1,h(e)}}),(a&&pu?tw:gu)(e,o)}}class ew extends TransformStream{constructor({onstart:e,onprogress:t,size:n,onend:s}){let o=0;super({async start(){e&&await dl(e,n)},async transform(r,a){o+=r.length,t&&await dl(t,o,n),a.enqueue(r)},async flush(){s&&await dl(s,o)}})}}async function dl(i,...e){try{await i(...e)}catch{}}function gu(i,e){return{run:()=>iw(i,e)}}function tw(i,e){const{baseURI:t,chunkSize:n}=e;let{wasmURI:s}=e;if(!i.interface){typeof s==Ki&&(s=s());let o;try{o=ow(i.workerURI,t,i)}catch{return pu=!1,gu(i,e)}Object.assign(i,{worker:o,interface:{run:()=>nw(i,{chunkSize:n,wasmURI:s,baseURI:t})}})}return i.interface}async function iw({options:i,readable:e,writable:t,onTaskFinished:n},s){let o;try{if(!i.useCompressionStream)try{await mu(s)}catch{i.useCompressionStream=!0}o=new Xb(i,s),await e.pipeThrough(o).pipeTo(t,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:a,outputSize:l}=o;return{signature:r,inputSize:a,outputSize:l}}catch(r){throw o&&(r.outputSize=o.outputSize),r}finally{n()}}async function nw(i,e){let t,n;const s=new Promise((u,p)=>{t=u,n=p});Object.assign(i,{reader:null,writer:null,resolveResult:t,rejectResult:n,result:s});const{readable:o,options:r}=i,{writable:a,closed:l}=sw(i.writable),c=er({type:jb,options:r,config:e,readable:o,writable:a},i);c||Object.assign(i,{reader:o.getReader(),writer:a.getWriter()});const h=await s;return c||await a.getWriter().close(),await l,h}function sw(i){let e;const t=new Promise(s=>e=s);return{writable:new WritableStream({async write(s){const o=i.getWriter();await o.ready,await o.write(s),o.releaseLock()},close(){e()},abort(s){return i.getWriter().abort(s)}}),closed:t}}let yu=!0;function ow(i,e,t){const n={type:"module"};let s,o;if(typeof i==Ki&&(i=i()),i.startsWith("data:")||i.startsWith("blob:"))try{o=new Worker(i)}catch{o=new Worker(i,n)}else{try{s=new URL(i,e)}catch{s=i}o=new Worker(s,n)}return o.addEventListener($b,r=>rw(r,t)),o}function er(i,{worker:e,writer:t,onTaskFinished:n,transferStreams:s}){try{const{value:o,readable:r,writable:a}=i,l=[];if(o&&(i.value=o,l.push(i.value.buffer)),s&&yu?(r&&l.push(r),a&&l.push(a)):i.readable=i.writable=null,l.length)try{return e.postMessage(i,l),!0}catch{yu=!1,i.readable=i.writable=null,e.postMessage(i)}else e.postMessage(i)}catch(o){throw t&&t.releaseLock(),n(),o}}async function rw({data:i},e){const{type:t,value:n,messageId:s,result:o,error:r}=i,{reader:a,writer:l,resolveResult:c,rejectResult:h,onTaskFinished:u}=e;try{if(r){const{message:f,stack:m,code:y,name:g,outputSize:A}=r,v=new Error(f);Object.assign(v,{stack:m,code:y,name:g,outputSize:A}),p(v)}else{if(t==Wb){const{value:f,done:m}=await a.read();er({type:hu,value:f,done:m,messageId:s},e)}t==hu&&(await l.ready,await l.write(new Uint8Array(n)),er({type:qb,messageId:s},e)),t==uu&&p(null,o)}}catch(f){er({type:uu,messageId:s},e),p(f)}function p(f,m){f?h(f):c(m),l&&l.releaseLock(),u()}}let Ji=[];const hl=[];let Au=0;async function aw(i,e){const{options:t,config:n}=e,{transferStreams:s,useWebWorkers:o,useCompressionStream:r,compressed:a,signed:l,encrypted:c}=t,{workerURI:h,maxWorkers:u}=n;e.transferStreams=s||s===Se;const p=!a&&!l&&!c&&!e.transferStreams;return e.useWebWorkers=!p&&(o||o===Se&&n.useWebWorkers),e.workerURI=e.useWebWorkers&&h?h:Se,t.useCompressionStream=r||r===Se&&n.useCompressionStream,(await f()).run();async function f(){const y=Ji.find(g=>!g.busy);if(y)return vu(y),new cl(y,i,e,m);if(Ji.length<u){const g={indexWorker:Au};return Au++,Ji.push(g),new cl(g,i,e,m)}else return new Promise(g=>hl.push({resolve:g,stream:i,workerOptions:e}))}function m(y){if(hl.length){const[{resolve:g,stream:A,workerOptions:v}]=hl.splice(0,1);g(new cl(y,A,v,m))}else y.worker?(vu(y),lw(y,e)):Ji=Ji.filter(g=>g!=y)}}function lw(i,e){const{config:t}=e,{terminateWorkerTimeout:n}=t;Number.isFinite(n)&&n>=0&&(i.terminated?i.terminated=!1:i.terminateTimeout=setTimeout(async()=>{Ji=Ji.filter(s=>s!=i);try{await i.terminate()}catch{}},n))}function vu(i){const{terminateTimeout:e}=i;e&&(clearTimeout(e),i.terminateTimeout=null)}const cw="Writer iterator completed too soon",dw="Content-Type",hw=64*1024,bu="writable";class ul{constructor(){this.size=0}init(){this.initialized=!0}}class wu extends ul{get readable(){const e=this,{chunkSize:t=hw}=e,n=new ReadableStream({start(){this.chunkOffset=0},async pull(s){const{offset:o=0,size:r,diskNumberStart:a}=n,{chunkOffset:l}=this,c=r===Se?t:Math.min(t,r-l),h=await it(e,o+l,c,a);s.enqueue(h),l+t>r||r===Se&&!h.length&&c?s.close():this.chunkOffset+=t}});return n}}class tr extends wu{constructor(e){super(),Object.assign(this,{blob:e,size:e.size})}async readUint8Array(e,t){const n=this,s=e+t;let r=await(e||s<n.size?n.blob.slice(e,s):n.blob).arrayBuffer();return r.byteLength>t&&(r=r.slice(e,s)),new Uint8Array(r)}}class uw extends ul{constructor(e){super();const t=this,n=new TransformStream,s=[];e&&s.push([dw,e]),Object.defineProperty(t,bu,{get(){return n.writable}}),t.blob=new Response(n.readable,{headers:s}).blob()}getData(){return this.blob}}class fw extends uw{constructor(e){super(e),Object.assign(this,{encoding:e,utf8:!e||e.toLowerCase()=="utf-8"})}async getData(){const{encoding:e,utf8:t}=this,n=await super.getData();if(n.text&&t)return n.text();{const s=new FileReader;return new Promise((o,r)=>{Object.assign(s,{onload:({target:a})=>o(a.result),onerror:()=>r(s.error)}),s.readAsText(n,e)})}}}class pw extends wu{constructor(e){super(),this.readers=e}async init(){const e=this,{readers:t}=e;e.lastDiskNumber=0,e.lastDiskOffset=0,await Promise.all(t.map(async(n,s)=>{await n.init(),s!=t.length-1&&(e.lastDiskOffset+=n.size),e.size+=n.size})),super.init()}async readUint8Array(e,t,n=0){const s=this,{readers:o}=this;let r,a=n;a==-1&&(a=o.length-1);let l=e;for(;o[a]&&l>=o[a].size;)l-=o[a].size,a++;const c=o[a];if(c){const h=c.size;if(l+t<=h)r=await it(c,l,t);else{const u=h-l;r=new Uint8Array(t);const p=await it(c,l,u);r.set(p,0);const f=await s.readUint8Array(e+u,t-u,n);r.set(f,u),p.length+f.length<t&&(r=r.subarray(0,p.length+f.length))}}else r=new Uint8Array;return s.lastDiskNumber=Math.max(a,s.lastDiskNumber),r}}class Cu extends ul{constructor(e,t=4294967295){super();const n=this;Object.assign(n,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});let s,o,r;const a=new WritableStream({async write(h){const{availableSize:u}=n;if(r)h.length>=u?(await l(h.subarray(0,u)),await c(),n.diskOffset+=s.size,n.diskNumber++,r=null,await this.write(h.subarray(u))):await l(h);else{const{value:p,done:f}=await e.next();if(f&&!p)throw new Error(cw);s=p,s.size=0,s.maxSize&&(n.maxSize=s.maxSize),n.availableSize=n.maxSize,await ir(s),o=p.writable,r=o.getWriter(),await this.write(h)}},async close(){await r.ready,await c()}});Object.defineProperty(n,bu,{get(){return a}});async function l(h){const u=h.length;u&&(await r.ready,await r.write(h),s.size+=u,n.size+=u,n.availableSize-=u)}async function c(){await r.close()}}}class mw{constructor(e){return Array.isArray(e)&&(e=new pw(e)),e instanceof ReadableStream&&(e={readable:e}),e}}class gw{constructor(e){return e.writable===Se&&typeof e.next==Ki&&(e=new Cu(e)),e instanceof WritableStream&&(e={writable:e}),e.size===Se&&(e.size=0),e instanceof Cu||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}}async function ir(i,e){if(i.init&&!i.initialized)await i.init(e);else return Promise.resolve()}function it(i,e,t,n){return i.readUint8Array(e,t,n)}const Eu="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),yw=Eu.length==256;function Aw(i){if(yw){let e="";for(let t=0;t<i.length;t++)e+=Eu[i[t]];return e}else return new TextDecoder().decode(i)}function nr(i,e){return e&&e.trim().toLowerCase()=="cp437"?Aw(i):new TextDecoder(e).decode(i)}const xu="filename",Iu="rawFilename",Su="comment",Mu="rawComment",Tu="uncompressedSize",Bu="compressedSize",_u="offset",ku="diskNumberStart",fl="lastModDate",pl="rawLastModDate",Pu="lastAccessDate",vw="rawLastAccessDate",Du="creationDate",Nu="rawCreationDate",bw=[xu,Iu,Tu,Bu,fl,pl,Su,Mu,Pu,Du,Nu,_u,ku,"internalFileAttributes","externalFileAttributes","msdosAttributesRaw","msdosAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","compressionMethod","signature","extraField","extraFieldUnix","extraFieldInfoZip","uid","gid","unixMode","setuid","setgid","sticky","bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class Lu{constructor(e){bw.forEach(t=>this[t]=e[t])}}const ww="filenameEncoding",Cw="commentEncoding",Ew="decodeText",xw="extractPrependedData",Iw="extractAppendedData",Sw="password",Mw="rawPassword",Tw="passThrough",Bw="signal",_w="checkPasswordOnly",kw="checkOverlappingEntryOnly",Pw="checkOverlappingEntry",Dw="checkSignature",Nw="useWebWorkers",Lw="useCompressionStream",Rw="transferStreams",Fw="preventClose",ml="File format is not recognized",Ow="End of central directory not found",Gw="End of Zip64 central directory locator not found",Uw="Central directory header not found",Vw="Local file header not found",Qw="Zip64 extra field not found",zw="File contains encrypted entry",Hw="Encryption method not supported",Ru="Compression method not supported",Fu="Split zip file",Yw="Overlapping entry found",Ou="utf-8",$w="UTF8",Gu="cp437",jw=[[Tu,qi],[Bu,qi],[_u,qi],[ku,Wt]],Ww={[Wt]:{getValue:Me,bytes:4},[qi]:{getValue:Tn,bytes:8}};class gl{constructor(e,t={}){Object.assign(this,{reader:new mw(e),options:t,config:Ab(),readRanges:[]})}async*getEntriesGenerator(e={}){const t=this;let{reader:n}=t;const{config:s}=t;if(await ir(n),(n.size===Se||!n.readUint8Array)&&(n=new tr(await new Response(n.readable).blob()),await ir(n)),n.size<Sn)throw new Error(ml);n.chunkSize=vb(s);const o=await tC(n,Qv,n.size,Sn,Wt*16);if(!o){const T=await it(n,0,4),_=Te(T);throw Me(_)==kh?new Error(Fu):new Error(Ow)}const r=Te(o);let a=Me(r,12),l=Me(r,16);const c=o.offset,h=et(r,20),u=c+Sn+h;let p=et(r,4);const f=n.lastDiskNumber||0;let m=et(r,6),y=et(r,8),g=0,A=0;if(l==qi||a==qi||y==Wt||m==Wt){const T=await it(n,o.offset-el,el),_=Te(T);if(Me(_,0)==zv){l=Tn(_,8);let F=await it(n,l,tl,-1),U=Te(F);const L=o.offset-el-tl;if(Me(U,0)!=Dh&&l!=L){const D=l;l=L,l>D&&(g=l-D),F=await it(n,l,tl,-1),U=Te(F)}if(Me(U,0)!=Dh)throw new Error(Gw);p==Wt&&(p=Me(U,16)),m==Wt&&(m=Me(U,20)),y==Wt&&(y=Tn(U,32)),a==qi&&(a=Tn(U,40)),l-=a}}if(l>=n.size&&(g=n.size-l-a-Sn,l=n.size-a-Sn),f!=p)throw new Error(Fu);if(l<0)throw new Error(ml);let v=0,b=await it(n,l,a,m),C=Te(b);if(a){const T=o.offset-a;if(Me(C,v)!=Ph&&l!=T){const _=l;l=T,l>_&&(g+=l-_),b=await it(n,l,a,m),C=Te(b)}}const x=o.offset-l-(n.lastDiskOffset||0);if(a!=x&&x>=0&&(a=x,b=await it(n,l,a,m),C=Te(b)),l<0||l>=n.size)throw new Error(ml);const I=nt(t,e,ww),E=nt(t,e,Cw);for(let T=0;T<y;T++){const _=new qw(n,s,t.options);if(Me(C,v)!=Ph)throw new Error(Uw);Uu(_,C,v+6);const F=!!_.bitFlag.languageEncodingFlag,U=v+46,L=U+_.filenameLength,D=L+_.extraFieldLength,M=et(C,v+4),k=M>>8==0,B=M>>8==3,P=b.subarray(U,L),V=et(C,v+32),G=D+V,R=b.subarray(D,G),N=F,O=F,z=Me(C,v+38),j=z&Za,Z={readOnly:!!(j&sb),hidden:!!(j&ob),system:!!(j&rb),directory:!!(j&nb),archive:!!(j&ab)},te=Me(C,v+42)+g,de=nt(t,e,Ew)||nr,pe=N?Ou:I||Gu,Ae=O?Ou:E||Gu;let Pe=de(P,pe);Pe===Se&&(Pe=nr(P,pe));let Ge=de(R,Ae);Ge===Se&&(Ge=nr(R,Ae)),Object.assign(_,{versionMadeBy:M,msDosCompatible:k,compressedSize:0,uncompressedSize:0,commentLength:V,offset:te,diskNumberStart:et(C,v+34),internalFileAttributes:et(C,v+36),externalFileAttributes:z,msdosAttributesRaw:j,msdosAttributes:Z,rawFilename:P,filenameUTF8:N,commentUTF8:O,rawExtraField:b.subarray(L,D),rawComment:R,filename:Pe,comment:Ge}),A=Math.max(te,A),Vu(_,_,C,v+6);const Je=_.externalFileAttributes>>16&Wt;_.unixMode===Se&&(Je&(lb|nl|il))!=0&&(_.unixMode=Je);const vt=!!(_.unixMode&cb),ct=!!(_.unixMode&db),Bt=!!(_.unixMode&hb),W=_.unixMode!==Se?(_.unixMode&nl)!=0:B&&(Je&nl)!=0,Y=_.unixMode!==Se&&(_.unixMode&Oh)==il,ee=(Je&Oh)==il;Object.assign(_,{setuid:vt,setgid:ct,sticky:Bt,unixExternalUpper:Je,internalFileAttribute:_.internalFileAttributes,externalFileAttribute:_.externalFileAttributes,executable:W,directory:Y||ee||k&&Z.directory||Pe.endsWith(ub)&&!_.uncompressedSize,zipCrypto:_.encrypted&&!_.extraFieldAES});const Ze=new Lu(_);Ze.getData=(Yt,yn)=>_.getData(Yt,Ze,t.readRanges,yn),Ze.arrayBuffer=async Yt=>{const yn=new TransformStream,[Yi]=await Promise.all([new Response(yn.readable).arrayBuffer(),_.getData(yn,Ze,t.readRanges,Yt)]);return Yi},v=G;const{onprogress:li}=e;if(li)try{await li(T+1,y,new Lu(_))}catch{}yield Ze}const S=nt(t,e,xw),w=nt(t,e,Iw);return S&&(t.prependedData=A>0?await it(n,0,A):new Uint8Array),t.comment=h?await it(n,c+Sn,h):new Uint8Array,w&&(t.appendedData=u<n.size?await it(n,u,n.size-u):new Uint8Array),!0}async getEntries(e={}){const t=[];for await(const n of this.getEntriesGenerator(e))t.push(n);return t}async close(){}}class qw{constructor(e,t,n){Object.assign(this,{reader:e,config:t,options:n})}async getData(e,t,n,s={}){const o=this,{reader:r,offset:a,diskNumberStart:l,extraFieldAES:c,extraFieldZip64:h,compressionMethod:u,config:p,bitFlag:f,signature:m,rawLastModDate:y,uncompressedSize:g,compressedSize:A}=o,{dataDescriptor:v}=f,b=t.localDirectory={},C=await it(r,a,sl,l),x=Te(C);let I=nt(o,s,Sw),E=nt(o,s,Mw);const S=nt(o,s,Tw);if(I=I&&I.length&&I,E=E&&E.length&&E,c&&c.originalCompressionMethod!=Gv)throw new Error(Ru);if(u!=Ov&&u!=Fv&&u!=_h&&!S)throw new Error(Ru);if(Me(x,0)!=Uv)throw new Error(Vw);Uu(b,x,4);const{extraFieldLength:w,filenameLength:T,lastAccessDate:_,creationDate:F}=b;b.rawExtraField=w?await it(r,a+sl+T,w,l):new Uint8Array,Vu(o,b,x,4,!0),Object.assign(t,{lastAccessDate:_,creationDate:F});const U=o.encrypted&&b.encrypted&&!S,L=U&&!c;if(S||(t.zipCrypto=L),U){if(!L&&c.strength===Se)throw new Error(Hw);if(!I&&!E)throw new Error(zw)}const D=a+sl+T+w,M=A,k=r.readable;Object.assign(k,{diskNumberStart:l,offset:D,size:M});const B=nt(o,s,Bw),P=nt(o,s,_w);let V=nt(o,s,Pw);const G=nt(o,s,kw);G&&(V=!0);const{onstart:R,onprogress:N,onend:O}=s,z=u==_h;let j=nt(o,s,Lw);z&&(j=!1);const Z={options:{codecType:fu,password:I,rawPassword:E,zipCrypto:L,encryptionStrength:c&&c.strength,signed:nt(o,s,Dw)&&!S,passwordVerification:L&&(v?y>>>8&Za:m>>>24&Za),outputSize:S?A:g,signature:m,compressed:u!=0&&!S,encrypted:o.encrypted&&!S,useWebWorkers:nt(o,s,Nw),useCompressionStream:j,transferStreams:nt(o,s,Rw),deflate64:z,checkPasswordOnly:P},config:p,streamOptions:{signal:B,size:M,onstart:R,onprogress:N,onend:O}};V&&await eC({reader:r,fileEntry:t,offset:a,diskNumberStart:l,signature:m,compressedSize:A,uncompressedSize:g,dataOffset:D,dataDescriptor:v||b.bitFlag.dataDescriptor,extraFieldZip64:h||b.extraFieldZip64,readRanges:n});let te;try{if(!G){P&&(e=new WritableStream),e=new gw(e),await ir(e,S?A:g),{writable:te}=e;const{outputSize:de}=await aw({readable:k,writable:te},Z);if(e.size+=de,de!=(S?A:g))throw new Error(lu)}}catch(de){if(de.outputSize!==Se&&(e.size+=de.outputSize),!P||de.message!=ol)throw de}finally{!nt(o,s,Fw)&&te&&!te.locked&&await te.getWriter().close()}return P||G?Se:e.getData?e.getData():te}}function Uu(i,e,t){const n=i.rawBitFlag=et(e,t+2),s=(n&Lh)==Lh,o=Me(e,t+6);Object.assign(i,{encrypted:s,version:et(e,t),bitFlag:{level:(n&ib)>>1,dataDescriptor:(n&Rh)==Rh,languageEncodingFlag:(n&Fh)==Fh},rawLastModDate:o,lastModDate:iC(o),filenameLength:et(e,t+22),extraFieldLength:et(e,t+24)})}function Vu(i,e,t,n,s){const{rawExtraField:o}=e,r=e.extraField=new Map,a=Te(new Uint8Array(o));let l=0;try{for(;l<o.length;){const v=et(a,l),b=et(a,l+2);r.set(v,{type:v,data:o.slice(l+4,l+4+b)}),l+=4+b}}catch{}const c=et(t,n+4);Object.assign(e,{signature:Me(t,n+fb),compressedSize:Me(t,n+pb),uncompressedSize:Me(t,n+mb)});const h=r.get($v);h&&(Kw(h,e),e.extraFieldZip64=h);const u=r.get(Xv);u&&(Qu(u,xu,Iu,e,i),e.extraFieldUnicodePath=u);const p=r.get(Jv);p&&(Qu(p,Su,Mu,e,i),e.extraFieldUnicodeComment=p);const f=r.get(jv);f?(Xw(f,e,c),e.extraFieldAES=f):e.compressionMethod=c;const m=r.get(Wv);m&&(Jw(m,e),e.extraFieldNTFS=m);const y=r.get(tb);if(y)zu(y,e,!1),e.extraFieldUnix=y;else{const v=r.get(eb);v&&(zu(v,e,!0),e.extraFieldInfoZip=v)}const g=r.get(Kv);g&&(Zw(g,e,s),e.extraFieldExtendedTimestamp=g);const A=r.get(Zv);A&&(e.extraFieldUSDZ=A)}function Kw(i,e){e.zip64=!0;const t=Te(i.data),n=jw.filter(([s,o])=>e[s]==o);for(let s=0,o=0;s<n.length;s++){const[r,a]=n[s];if(e[r]==a){const l=Ww[a];e[r]=i[r]=l.getValue(t,o),o+=l.bytes}else if(i[r])throw new Error(Qw)}}function Qu(i,e,t,n,s){const o=Te(i.data),r=new Xo;r.append(s[t]);const a=Te(new Uint8Array(4));a.setUint32(0,r.get(),!0);const l=Me(o,1);Object.assign(i,{version:Ii(o,0),[e]:nr(i.data.subarray(5)),valid:!s.bitFlag.languageEncodingFlag&&l==Me(a,0)}),i.valid&&(n[e]=i[e],n[e+$w]=!0)}function Xw(i,e,t){const n=Te(i.data),s=Ii(n,4);Object.assign(i,{vendorVersion:Ii(n,0),vendorId:Ii(n,2),strength:s,originalCompressionMethod:t,compressionMethod:et(n,5)}),e.compressionMethod=i.compressionMethod}function Jw(i,e){const t=Te(i.data);let n=4,s;try{for(;n<i.data.length&&!s;){const o=et(t,n),r=et(t,n+2);o==qv&&(s=i.data.slice(n+4,n+4+r)),n+=4+r}}catch{}try{if(s&&s.length==24){const o=Te(s),r=o.getBigUint64(0,!0),a=o.getBigUint64(8,!0),l=o.getBigUint64(16,!0);Object.assign(i,{rawLastModDate:r,rawLastAccessDate:a,rawCreationDate:l});const c=yl(r),h=yl(a),u=yl(l),p={lastModDate:c,lastAccessDate:h,creationDate:u};Object.assign(i,p),Object.assign(e,p)}}catch{}}function zu(i,e,t){try{const n=Te(new Uint8Array(i.data));let s=0;const o=Ii(n,s++),r=Ii(n,s++),a=i.data.subarray(s,s+r);s+=r;const l=Hu(a),c=Ii(n,s++),h=i.data.subarray(s,s+c);s+=c;const u=Hu(h);let p=Se;if(!t&&s+2<=i.data.length){const f=i.data;p=new DataView(f.buffer,f.byteOffset+s,2).getUint16(0,!0)}Object.assign(i,{version:o,uid:l,gid:u,unixMode:p}),l!==Se&&(e.uid=l),u!==Se&&(e.gid=u),p!==Se&&(e.unixMode=p)}catch{}}function Hu(i){const e=new Uint8Array(4);return e.set(i,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function Zw(i,e,t){const n=Te(i.data),s=Ii(n,0),o=[],r=[];t?((s&1)==1&&(o.push(fl),r.push(pl)),(s&2)==2&&(o.push(Pu),r.push(vw)),(s&4)==4&&(o.push(Du),r.push(Nu))):i.data.length>=5&&(o.push(fl),r.push(pl));let a=1;o.forEach((l,c)=>{if(i.data.length>=a+4){const h=Me(n,a);e[l]=i[l]=new Date(h*1e3);const u=r[c];i[u]=h}a+=4})}async function eC({reader:i,fileEntry:e,offset:t,diskNumberStart:n,signature:s,compressedSize:o,uncompressedSize:r,dataOffset:a,dataDescriptor:l,extraFieldZip64:c,readRanges:h}){let u=0;if(n)for(let m=0;m<n;m++){const y=i.readers[m];u+=y.size}let p=0;if(l&&(c?p=Yv:p=Hv),p){const m=await it(i,a+o,p+Nh,n);if(Me(Te(m),0)==Vv){const g=Me(Te(m),4);let A,v;c?(A=Tn(Te(m),8),v=Tn(Te(m),16)):(A=Me(Te(m),8),v=Me(Te(m),12)),(e.encrypted&&!e.zipCrypto||g==s)&&A==o&&v==r&&(p+=Nh)}}const f={start:u+t,end:u+a+o+p,fileEntry:e};for(const m of h)if(m.fileEntry!=e&&f.start>=m.start&&f.start<m.end){const y=new Error(Yw);throw y.overlappingEntry=m.fileEntry,y}h.push(f)}async function tC(i,e,t,n,s){const o=new Uint8Array(4),r=Te(o);nC(r,0,e);const a=n+s;return await l(n)||await l(Math.min(a,t));async function l(c){const h=t-c,u=await it(i,h,c);for(let p=u.length-n;p>=0;p--)if(u[p]==o[0]&&u[p+1]==o[1]&&u[p+2]==o[2]&&u[p+3]==o[3])return{offset:h+p,buffer:u.slice(p,p+n).buffer}}}function nt(i,e,t){return e[t]===Se?i.options[t]:e[t]}function iC(i){const e=(i&4294901760)>>16,t=i&Wt;try{return new Date(1980+((e&65024)>>9),((e&480)>>5)-1,e&31,(t&63488)>>11,(t&2016)>>5,(t&31)*2,0)}catch{}}function yl(i){return new Date(Number(i/BigInt(1e4)-BigInt(116444736e5)))}function Ii(i,e){return i.getUint8(e)}function et(i,e){return i.getUint16(e,!0)}function Me(i,e){return i.getUint32(e,!0)}function Tn(i,e){return Number(i.getBigUint64(e,!0))}function nC(i,e,t){i.setUint32(e,t,!0)}function Te(i){return new DataView(i.buffer)}try{Ko({baseURI:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href})}catch{}const It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function sC(i){let e;i({wasmURI:()=>(e||(e="data:application/wasm;base64,"+(t=>{t=(r=>{const a=(r=(r+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,l=[];for(let c=0;a>c;c+=4){const h=It.indexOf(r[c])<<18|It.indexOf(r[c+1])<<12|(63&It.indexOf(r[c+2]))<<6|63&It.indexOf(r[c+3]);l.push(h>>16&255),r[c+2]!=="="&&l.push(h>>8&255),r[c+3]!=="="&&l.push(255&h)}return new Uint8Array(l)})(t);let n=new Uint8Array(1024),s=0;for(let r=0;r<t.length;){const a=t[r++];if(128&a){const l=3+(127&a),c=t[r++]<<8|t[r++],h=s-c;o(s+l);for(let u=0;l>u;u++)n[s++]=n[h+u]}else{const l=a;o(s+l);for(let c=0;l>c&&r<t.length;c++)n[s++]=t[r++]}}return(r=>{let a="";const l=r.length;let c=0;for(;l>c+2;c+=3){const u=r[c]<<16|r[c+1]<<8|r[c+2];a+=It[u>>18&63]+It[u>>12&63]+It[u>>6&63]+It[63&u]}const h=l-c;if(h===1){const u=r[c]<<16;a+=It[u>>18&63]+It[u>>12&63]+"=="}else if(h===2){const u=r[c]<<16|r[c+1]<<8;a+=It[u>>18&63]+It[u>>12&63]+It[u>>6&63]+"="}return a})(new Uint8Array(n.buffer.slice(0,s)));function o(r){if(n.length<r){let a=2*n.length;for(;r>a;)a*=2;const l=new Uint8Array(a);l.set(n.subarray(0,s)),n=l}}})("FQBhc20BAAAAAUULYAF/AX9gAn9/AIEABYAACwIDf4IABwEBgAARAQaAAAuDAA6BABUDAGAAgAADgAANAQSBABUDAGAHgwAegAAfEgNCQQcABAEABAgIAAIABQIKAIAAB4EAAwEFgQAHAgICgQAHEAEDAAUGAAMDBQQJBAQJAQaAAAEeAAIEAwIEAgIBBAcDAwQFAXABDQ0FBgEBggKCAgYIgACYIkHQ1QQLB4oEHAZtZW1vcnkCAAxpbmZsYXRlOV9uZXcABw2GAA8HaW5pdAAIEYoAEAdfcmF3AAoQhgAUCXByb2Nlc3MAC4cARgZlbmQADhaGAA8QbGFzdF9jb25zdW1lZAARC4QAGYMAbYUANoMAbAEShQBYhwBrARSFAH+DABMHZ3ppcAAVD4UAFIUAfgEWhgBWgQB9AhgVhQAOjQB8AmRliQB8hQAOggB8AhoQiQAPggB8AhsRigATggB8AhwPhQAUhQB8AR2GAFaBAHwJHwRmcmVlAAIVhQAVjACDCgZtYWxsb2MAAQuCAFUKaWFsaXplAAAZX4AADxZkaXJlY3RfZnVuY3Rpb25fdGFibGUBgAAcG2Vtc2NyaXB0ZW5fc3RhY2tfcmVzdG9yZQAFHI4AGwJnZYAAbw51cnJlbnQABiJfX2N4YYAAWwRjcmVtgAASBl9leGNlcIIAXQZyZWZjb3WAACUtPQkSAQBBAQsMACEiDA8XGR4+NTg7CqHlAkECAAu/JwELfyMAQRBrIgokAAJAjwACEiAAQfQBTQRAQaQnKAIAIgNBEIAAEgYLakH4A3GBAAkQSRsiBkEDdiIAdiIBQQNxBIEAMgYBQX9zQQGAAB8GaiICQQN0gAAZDMwnaiIAIAEoAtQnIoAABgQIIgVGggBSCSADQX4gAndxNoACphEBCyAFIAA2AgwgACAFNgIIC4AASAMIaiGAADcBIIIARoAABQRyNgIEgQAPA2oiAYEATQMEQQGBABIHDAsLIAZBrIIAnwMITQ2AABuBAIYEQQIgAIEANQUAIAJrcoAANQQAdHFogQCjA3QiAIIAj4AAH4IAj4AABosAjwUBd3EiA4YAkQECgQCRAQKEAJEBAIAAaIMAhYAACgJqIoAAjIIA3wUgBmsiBYMAjIAAGQIBaoEALgoAIAgEQCAIQXhxgQBuBCEBQbiBAKAEIQICf4AAZQEBgAAZBwN2dCIHcUWEAHgCIAeAAD6AADyBAHWBASEDCyEDgQDpgAB2gAAchACEAQGDAAeAAJyBAIuCARyAAFYCIASAADmAAP6CAHWAAQsCQaiCAQkCC0WAAQkFC2hBAnSAAOYDKSICgQEuAnhxgACqByEEIAIhAQOCAagFKAIQIgCAAIOBAAoBFIAACgENgAB+gAEQhAAqgADZgQFuBQRJIgEbgAA2gAFJASCAAAmAATgBIYEApwILIIAAVAMYIQmAABaAAAkEDCIAR4AASIAACgEIgAA3hAHGgACxAwgMCoIAKQUUIgEEf4AByAIUaoABU4EAdwMBRQ2AANkOQRBqCyEFA0AgBSEHIAGAAZoDFGohgAIFggAwAg0AgADlARCEABCAADEGDQALIAdBgABbCAAMCQtBfyEGgAAfA79/S4IAJwELgAISgAC1AiEGhAD+CAdFDQBBHyEIgAH+ggDygALEA///B4ACxoABwQEmgQJYBnZnIgBrdoICpQpBAXRrQT5qIQgLhALxAQiFATUBAYEBngIAIYECCoEAB4AAPAEZgAAdAwF2a4AAVwgIQR9HG3QhAoUBSYUBNAQDIARPgACTAQGAALcDAyIEgACGAQCAAH8BAYAARAEDgQI/ggFoAQOAAdOBAtQGHXZBBHFqggDcAkYbgAAdAgMbgABkAQKAAI+AAWSBAO6BADECBXKDAIQBBYACzwEIgQK7gADugALPAgdxgQGuAwMgAIUB4QEhgAEdggHAgAFMiAHCAQKAAb4BIYAAbIEByYMBxAEFgQAJhQFTgAGTAQGDAW8DCyIAggByAQWAATkCIASDA02AAEGBAMsBBYEB5wEIgAA5gAAJhAHngAAKjQHngAKTgAAWgwHnAQWCAeeAAA+EAecBBYIB54ABK4ACeoAA+4MB54IDgIgB54IAEIQB5wEDgwHnAQeHA9gBBYEEgoMDQ4AEpoAAjYECnwNBEE+AAI2CA4uAATKGA4ECBWqBAJOAAFeFA66BA1WAABeGA7sBBYsEQIABX4AEJwEhgAHlgANGgQA6gQNWgAN0gQCZgQNlgAJvgABKAbCCAIgCAkmAAIgBsIAAH4IAgYEALAK8J4AAA4EAG4MAiIEAN4kAjYYEMYUAS4QCSgEvgAQ/BQJ/QfwqgAA7gABTAoQrgAAIgQJoBYgrQn83gABXBoArQoCggIAAAQEEgQAOEfwqIApBDGpBcHFB2KrVqgVzgQB6ApArggEnA0HgKoMACAaAIAsiAWqABaKAAZMBa4AEXIEEmQVNDQhB3IEAZAIiBYAAZgHUggAKAQiABKMFIgkgCE2AAUcFCUlyDQmAAvmAAEUDLQAAgAKQgAJvhQX6hADYgQA5BOQqIQCDAlqBAD+BAY2AADwBCIICagNqSQ2BAtuBAhKCAkMEQQAQBIAFdwJ/RoAB+QMBIQOAAMmCAR0BQYAAk4AD+4AGIYEC/AFrgQVTAWqCAs0DcWohgABAAQOBAKsBA4QAq4EBEYMAq4ADRQNqIgeAAHGAAUoBB4AAqwEEgAAqgABfgAFjBUcNAQwFgQA4gABMgADrgQAWggJCgABTgQCVAUaABP4BAoIDFYEAioABCQVBMGogA4EAuIAB7QMMBAuDAXGBAyADIANrgQCJBwJrcSICEASDAC6ABWWAAJaCACuAAJyAAM0ERw0CC4EBaAHggQCWAkEEgQWsgAWohADpggDygQBoAXKBBSQDTXINgANTgABQgAPoCAZBKGpNDQULgADOgwDRgQDPggGsAdiCAA4BAIECTgLYKoEDSQEAgQGFgwFxAQSHAXGDANOBA2uAANUCIgWAANeCABKDAWuBAMcBtIMCe4EBSoAAewEbgQQtAbSDAr2CAmkDQegqgQYwAQCAAFCCABUFQcQnQX+BAAgCyCeDAnuBAAwB8IMCQIEB4IMGz4MHsIAGUAHUgAMQgQZYAtgngQUngAC7A0EgR4AAeYEDAQQDQShrgAAQAXiAAOkBQYECa4AB3oMDDoQHoIIGzoADdIUDCAQCakEogQNsBMAnQYyBAXuBA+CAAc6AAYEBTYEGZAJLcoMA2gQMQQhxgQAKgAHZAgVqgQAwgABRgATNAiAEggBmgAhRggN0ArAngwOPgQFPgAAtgACJgwBvgAClggBvgABWkABvAQOCARMCDAaDAAeFAT0DIAJLiAE1gwH7AQWCAYACAkCBBpmEAYKBBPeEAXoDAQwCgQWcAi0AgQCtgATgAQuEAa6BCSyDAa4BBIECaYEHPIICjAMiBUmEB1kBCIIGTJQBQAEHkAFAAQeZAUCAAGICBUGAB/iBAEEDakEvgABPgAAoAQSABUyACZQDAUEbggksCUHsKikCADcCEIAACwHkgwALAQiAABSCCVuBAHCNAiCEAgyAACABGIAEr4ICE4AAmIMEv4AABQEEgQmQgADPgQL+AyAERoEG6YMFSQF+gAnDAQSDCC+ABnaEALaCCMEBAIAI8gMCQf+BCkOAAAiECQ+AABWEClCABSqBCd+ACQ0BAoUJDYAAEYIJDYIJgoEBNgELgAbDgADagQkNgABggAZ1AkEMgAWyAQiBBS8BH4IHMwH/hAfdAQKAB92AABmQB92AALGAAMUGNgIcIARCggEPAQCABzkDQdQpgAmaggTrgwg3gAKvgQo1AQOCAIoBqIEJlwEFgwmXggllgQCPAQKACAOAAFWCCAOACGKBCAOCB9aAB6KBAi2BCt2CB3wBAoIDqoAH44EHbIEH04MDDoAH8AIiA4EG5wEFggbngQBXARCBAJqAAe8DGEEIgAcEAgQigAgsAkEMhQoHgAHTgQDwgwCBAQiDAMOACNWAACMBGIABAgEMgAA7hAbsgQLygwRHhAapgAZkAU2ACH6AAmqBB8ixBquAAyEEoCdBMIEAOYEDMIIIwIMHFoIC14ADKIIDa4UCwwFqgAYZhQBCgAmMgAaDggAVgAUFAiAIgAbsA2shB4UE4QIgA4ELboED2YoDzAEHgwUbgQDlhAvYgAHgggfzgwAxhwrrhAifjgAxgQIlgwEGgQFAgAFogQWXBANxQQGAAD+AACSACiABCYEAFoACPYIM14MClIAAEYEIzAECgwwCgwKWgAwGgAA5AXaDDJgBAoEC7IcLg4ECd4EANQMYIQaAAEaABC+BBBqCAEWCAR+BACaBAaWAACaAAB+AABiAC1iACRMBA4IJE4IB+4EJp4AAEIEJE4ALh4IKKoAGiYEJE4IEMIAAMIADV4ELGoEJuYIAMYECLAEFgwkTggqKgACSAQaACaiDAGABHIAA5AECgAW2gQoGggEpgAF+gALYgwGrAwINAYACyIMC3oEA1YUA0oEAOwIgBoAAXYEAMAEGgQAsARCBANeCAAoBFIAC5oIMCoAI5IACl4QAtYEDXoEA2YADOoEAJQEYggEEggw0gQJFgAAZARSGABkEByAJaoALzwEDgAAHgQLtAQSBA32AB02GBCSFBNWAAAoCaiCBBPaAABKDAYwBB5MEIAEHrQQggwMpgQAHhAGxgAQoAQKBAGaEBCgBB4AEKAEHkgQogAFbgALUiAQogA8mgwQogg8dhAQoggS1A3QiBYUEKIAD24MAkoYEKAEHgAQogAUHggQoAQKEDCuCBh6DAfSBDnaCBCgBB4EEKIEMC4EB7YML+4EFfYEEKIMLQIIB/IYEKIAA1gEYgAAHhADkgQDyhQEEgQZ2gwuPgwQqgQIvgQAriAEIAQuADLWCA9qCAgABCIMCQoAAZgEcgADQgADOgAJsgAJCgQ8KgACKgQJCggNdgAbvgQDiAQeEDxmBAa+DAECACgCEAkCACgiEAkCCAAqAAkCEDkoCIAiBAISDAMiCC6mAAIaABomCAMaFDC+BAkCCABkBFIUAGYAAXAMEQQ+DCmMBBIEEqYADi4cLuYMEfYYEIYEMCoQAH4AACoEEb4QAHIEFXQFqggGPgAASgwJegQFxkAJeAQSiAl6BD3aAAByAAAcBDIECzYMAB4cCXoIAZoQCXgEEgAJeAQSVBoaCADwDHCADkQaGgQMaghC1hQJYgAK0hAaAgQelgwBxARiBAJgBBJYGh4MCX4UP74AHo4QGh4IJHYEAJoEF8oECXwEHhw9VgQBeARCDEGiBA9iFAOWBAPOCBvSDBN2CABaDEH+DDaGABBuDBPKCANSBDgGDAl+CBPoBCYMCX4AAPIQCX4AB74ACX4EFZ4AAKI0CXwELgwJfhgJdAwIgCYQCXQEJhgJdggAKiAJdAQmBAIKDEEyPAl2DEHOZAl2BC/uKAl2ACXaNAl2ABQKEAB+AAAqAA5KGAl2AAm6EAl2KEeaBDjqCAYWAAmGGEeQBIIMIT4gR5ogCW4ABO4ICRoMB3IEH6YICW4IB8QEIgQb/ghHXgQ6ZgQBugQiAgQFjAQuADg4DEGokgABKBgveCwEIf4EGz4IA7AJBCIEMd4AJqAFrgwLeAXiBCzQCIQWCE5QCAXGBCa8BQYACXYEGgIEFv4AAIoAAL4MLB4AKo4ISvIME6IAE6oQHeoQG3oAHNIAAPIQJxoMG7wEEgA0ViQcygBMMhAcygQ2YggchigcfiwdFgQ3KhRAwiAcdghAwgwcdAQSAAsoBBIISF4IHHYABhIUQMIIHHYIAEIsSF4AIo4ACZoAJQ4EH9QIDR4AOUIABOIICZ4AQ9oQGf4EBHoMBxIIUbQIAD4QF8YEAmYIFUIAN6Y4HYoICwQEEhwdiAQSWB2KJAsWrB2KBAsWCARyBAsWIB2KCAsWCABmBAsWFA6MBBYQRmoEA7QEBgAHShhW7gwHigglggQHAghTZgAlrggvlhglrgA1IggEXhwENAQODAfACRw2BEXGDEE8BuIMACAEPhAmFgQ/4hAmHggBNhgmHjwBNgQ2YhQFdgQKEgAAjgQw3iwJGghJEgAF7jAl4igJGiwGagAIzghKMgQJXAQWIEoeJAleDAgOREoeAADS0AleAAg2RAkCGAOaDDlmHAjOHB1ODAjOCB1OjAjOABsSjAjOGB1WMAjOHB1WOAjOOALiAABQBCIAPz4UDJYABrYULFIELLIMWt4YHKoAE+oILFIAUhIUEz4AG9I0WtYQGq4AICIUGRYIE1oMGIYACSoEJh4AAZYQHKQEAgAcpgASzgAcpAQGDBymAAsyGCYeCBlyGBymGCYeAEzWAAucBf4sJiYMXSIIJiYMFYoABqIECpIENJYMJIpEJj4ABnoAVnYECD4YNtwEAhgmPgQzagxWKgAG7hgcwgBXRhQcwgQBdgAu9gAfpgQD3AgMihgEGgALVggD8gwEKgAAngADjgRRhAQuAAnWBEF6DBjiEARqCAY2CD/qAEZoBxIICEoAFlIASTQIgAIAPwYATTwSMCwEHgAANgQWagAXHgxBjgRJ3ggXOgAEWggXOghB3gACOhAhIgQAmgRKBhAaPhBC7AQyABm2FD4mAAZGRBcOBD4mGA32AACKBA2yEBgSCADCCB/6BAc+BGJmBA5CCDLABBIADbIEV04QWVgEEghaZiBXzAQeAAWGBBeOAATCCBNKAAUWCBeODABCFAVWLBcOAAIqHBcOCDuKAFD2EA4OBBsaFBcOBABuCBcOEAJmHBcOAAEqEA5CAAJYBHIAAUYYDkAEAhwOQgwlXiwOQhBqPggOQgA8VhgOQgQH1gwOQgAAKgAOQAQOCA5CABeWBA5CCAPoBAoIBWoEDuIMJKIADd4IBIYADuoEB8YEDx4UAGYYFr4QA7pEFtIIFhoYFtIATf4QW1oYPsqkFtIIAH4YFtJAATYEauIQBToERp4ICTYMFtIcCN4QFtIIPj5UCN4sBi4cFtIAGtIYFtIsCSIUFtIECSIgFtIACSIUFtK8CSIIFtI8CMYYA5oMFtIcCJIIFtIgCJIgFtJ0CJIkFtJoCJIIA1pACJIIA/ZACJJEAuIENVYQFtIQBrYUHUIEHaYIFtIAcY4YdrIEVzIEFtIAII4UM3oEK0IAEHoUL2YEM3oMQsoUKfIQQx4MKmIIFtIAErIYFtAEBhhtAAQKDBbSBBSeCBbSCEiGAALkDHCAAgwW0AQOFBbSAEW+GDzuBBkiAFmWGBbKAEAWDAJGEDBCCBq+CBUuABbOAAMGCBbMBA4MFs4ABH4EFs4ICDoEBqIIFswEBgQWzAQOBBbOBAAeABbOAAnqAAJWGBbMBAoMFs4QQu4AClYIBWYQA6oMGl4EGCoYa0IMTZIADXYIM4oQTgIMBDQMLC0mBBxEBkIMGe4EVGwFqgQtiAQKCCzWAAHSCA1CCF4UDIAA/gAUCAXSAHo2HE0UBf4ABTAGQhAqQAwELBoAALQYkAAsEACOAE7MCAQGABtUEQcQAEIAQGYMLyAIEa4EZj4AMOoIADoAGHgMA/AuBGM6CBWuAASMBJIEHjQU2AiAgAIASGQMLCxGAACaBAVEBfoIHxQsQEAkL2QIBA39BeoAHMARAQZQIgQBNATGBAjgBfoEcBYQAVYQEuAEggwJ8gAAKASSEAAgKKEEBQdg3IAIRA4AGVoEAVwF8gQBXgweQgADmAzYCOIUBrwQCQb/+gAAJgABlBCAAECODFg8GQR91IgNzgBlXgQKAgBQFgBYugwLSASiDDnwCdkGCGfoEAUEAToAeWYEfa4ABYIIAPYIAXAM0IAKBAj8BLIkAFIAA54EAB4ABloEAG4AI1YIN8YAAX4ADhgEwgALIgQAWATyDACsBJIAAB4AbNYIOHAFCgRtAAXCCCD8BQoAAqAE3gQ3IAkKBgwAUAcyAAOCAACsCtAqCCr4BcIMA0QFUgwAHAlBBggkNgAEJgxmBAyQRAYQBMQEcgAIsjAFtAXCAAW0BEoIB+oEA5oIXlAgEEA0L/SQBIoQhWQIUJIEBeAEZhgEkgQeMAiIShAFsAwQhE4QbV4ECNwETgARnAwAhE4IAfYEEkAHcgAs6AR+AAKcF9AVqIRWAAAgB2IAAEAEbgAAIAfCAAAgBGoMAvwIhFoEAIIAAEAMRQZyBGBkEIRxBmIIACAQdQZQrgAH4AiEegQM2A0AhCoEABwE8gQr5AUGAGDIIAkkhIEF9IQ2AAA4GBkchISATgQIYgQMvAxchEIEY+JEiCpIAAoEJjpEiNoEQgoAiGoABdxdrDhMEBQYHCAkDAgwNARkAGw8iIhQhIoIEfwVMIQYMGYYACoAW0IAACgFsgR5MgQAIASKAC9YDKAJggh8wAwxJG4AAIQQGCyAggR/agABWgAZSBA4hDQyAAZGBBMYCDQ+ADxICCHKAFeABCIEEAIIXjQMKQQKCBrQDRQ0OgRqIAWuBH5KAARADIAp0gBR4gRSggBrSgAAtAwkhCoMgzoERfoACUAMIQcGAAF6AAtKGAMuAABgBdoIWRwZrDgMAAQKABOgBHoENdIIfmAUIA0BBkIAKBoAP7QGQghokARGBICIFdGpBCDuAAjSAAAuAIFiBAF+AACcCgAKAH0YBBIAAB4MAJ4AFCYAAJwEJgQAngAALgArZhAAnApgCggBOAZiEACeDAE4BB40AToAANAGgigBJggBwhwBJgSB3gAIIA0GgK4EEewKgPIMACQMgFEGAETYBDIAFgwERgAA/gAAXgAARBwxqIBUQJBqCAFMBIIkAUgEFjABSAZyAAE4BPIECqgEcgwBKgBCZAQyAIJYDEUEgigBJgAJ2A0EBOoAEcASgKyEdgQFXAR2AA1GAA3gBiYADeAHQgAOEAViAABOAAEKAA2sCQceCBDwCQQGAAqMBIYAKNAQKQQNrgAKngRXuAiEHgQAdgQg2gSB6gAERgQHsBB8LQcSBAZuDC9ECwguBGTQB0YEAEYIcR4AASoERF4gAQ4UAPQIMGoEAGYAX/gEFgAYIAQqAGJaAAByBGa0CQR+CE66CB+mAAh+AAXaBAh8BBYQCH4MBboMS1AMFDAKABWeAAVKBAhsBBoAAVAEKggCRAR2ABZOBCHID//8DgB6CgAAJgCT3AhB2ggsuAkHdgxKfgQChggqqgAJmBBoLQcKCAEABAoEACIMSVoAE/gFEgABagAi2gABUgQOMgAQWgQBbgACzAwJBw4IAJoIC4gNEIgOCCDmCFNiAG+ACAyCBE7EBEIEACoECiYAAKoQDEYAAOQESgBWIAwMQJYMjmQFEgAWJgABkgAAtBBJqIRKBADYCayGBADuAANaBGlCAAA4CBAyBEzCEBckCDBeACNOCAz0CDUuADFmNAR2FAzyEAR2AA3QBaoMDP4IBHoEBnoMAhoEAUoABEAEfgAEXA0GBAoAaKQFkggAQAgV2gAATgAA7AzYCaIIAEAUKdkEPcYAcVQEigAkgAWCAAE4BDoMBvQEOggG9AkEegiHeAkGhigFKgAChgAAMAcWDAjoCACGABCOBBZgBbIADE4ADqgMGIAyBCpsBE4AACQcGQRNNGyEJgADLAwYgCYIN1oAAE4EhHoAALYAC44AADAV0LwGwDoIC6gEAgQLqAQOABGABAIEHZJgESQEKowRJgANhgBrygwBpgAAMhgBpgADbAgdxgQBsiwKnAQSAAMaFAquDAEEBFoMGi4AAB4AGmYEdgYEDNYAADoAGmYADcAUTIBogG4EDbAIiDoIBIQG/ghdnhgEhARaBASEBxoQCYYIBHYABKAEOgQ6AggJKA2QiD4EABwRoaiEMgADcAQuABVqAATKAHaMEKAJYdIACwQEhghVUA1AhIoABAQEJgACbgAOXggEFASKAAzwCGHGACdIHaiIjLQABIoADBoAfOIEK4YEWDoABFYABAYkDPwEJgQEVAQmFAz+AANeAAZ8GIy8BAiIIhRV/gAj3hgEmgAAMgAEfggTEgSPbgQEcAiAGgwEcAQuBFlABf4UGaIACegQQaw4CgAWHgSOUgAl6gg/AhgCMgBAwoQCMigBlAwUgC4IJsgJBh4sDswEJgAGTAQOAAvmAJpuBBmeAAgaBADOAJYmBAJiAJE2ADqCBJp2BALsDIBFqgAAeAi8Bgg7AgBYzjQCXARuoAJeEAhuAAJqACyyDAiCAAjaAAFSCDFiACnOMAFwBGqkAXAEHiABcAQeDAFwD/wBxgCc/gCeGgQIiAwQgDIAAKQILaoACFJYBEYAD3YEFPoIGKoMBuAEEgQG4gQHPgAJigwMhhALIgAWjAWyAF7mEADiCABQELwH0BIMBbwKUCooCtwEVgQK3gABxhQLrhAMAgQasAiAPjALyAaOLAvKCADuABEMBXIME8wFwgAM+gQaZggLuggChgQLwgABDAR+IAEMB8Y0AQ4QGcYYGloADNIQFkYAACwENgwBkAciFBZGBA1cC0DeJAzeCA1UBUIADyosDNwEMgAFugATjgQM3AQuLAzeBJuahAbgBC4ADNQIhD4AC+oAAQIAp14ELUwX/AXFBDoEARwMGIQyAAJ0BBoECGgMMIA+BAGYCIRiAAJUBBoABwoIAlYIBqQIgGIAAhAELgCgPAXaCAIcBD4EAhwEMgBjPgQHkgACIgAR8pwMzgQdCggOYgABGAQCAAe4BD4IAnYEB6wEPgQZlgAVkAiAMgAXeAtA3gAAvAQyDAmwBDIEALwELgQC0gA/SgQP5AkHNgwFzARGBGscBIIEmEYUGfYAACYAknQLQN4MAGwLAAIEAHAMAQdWBB+mHAaqAABwDAkHJhQdAgBnNAXGBBj4BTIUCZoIP0oAGoYoBhoAAvIQA7oAIUqIA7oICSYAAxwEGgwDOhAdLgAfiAiAGgQFagA5dAQyBAPGLBK2FAumAKDABEIMKHwEQgQDthAcUARKBB5qBAEeACR2GAkwCIBCBAI8DECASgQCCAhIMgh3lggebAQqBHJiAAdABCoIHWoAFz4QARoYAIoIAGIAHCIQAGIITBYUAGIIAEgEOlABMgAE8hAA0AQ2AAk6AAAeBC3cCQdCDAI+GCSGDCTIBCoQrvwJEIYIik5IAUIAAyYQAUIAA+AMCQcqFAZuAASEC1DeAK6mBAEABXIMCj4EACwFUkgMkAQuDAySCAp2HAySAB2miAa6CAoeBBmKBApcCIg+DKhiCAcGCB5SAAGIBC4gDHQEPgwMdAQ+GAx0BD4YDHYIDpIgDHaUCL4sDHYUCO4ACGoEDtYAEHIIDxYAAiAEhgAzCgQMlAQqFAyWJAj8BD4YC8wHxigLzhgJYgCsQAwJBy4UBYAEPhgL7ggVpAUiHAwKIAV8DIAYEgybGhQMBgRnrtQMBAUiJAwGBAHKSAv+BAKUBzIQFKYYDB4AAEYQCJQEGgAfOggBNgArEAhcggA8fAQmAAe2CGy4BCYEcvIAAGgEwgCS5gQAIAsw3gxCpAfyLBikBB4QAQQE0gCrEAQOBANaAAAyAEJEBKIAQM4MARAFrggcrggAWgAAiAWuBBtyBE1qBC0WBFIcDBkkbgQAgARKBCvyCLo2AABeBHYmBAZiHC1cBCYILNgMJIQOAAT4DEiAFgAEtgQO3gwOngQblgQf7gQFKAiIDgRJgARCAAHmAA8aBAE2AAWKFA92BFP6SAzOAAcSEAQ6BDLSFABuJA9mAA0aEACKACFKIB0GIBA6BABaEDIqBEZ4BEIMS4QEShiIFgRQ2gAblgRF9gAFBgQlygApJATyHD58BLIABXQQQIBdGgAhVgAP9gCmBgRG8gBgSgSYJgAARgCsIhBCHgBVdATiDBbyCGDeAEh6BFXACKHSBGhKAEj+BEiaAAG8COCCBFbGCHLUDLCIFggAugRGXATCCMO+CADCBKiICLAuDAfWAALuBA6QBBIEBXANrIAWADK6CIFMBNIMemQEsgBHXgwRwgAANgAHoAWqBDNSAACeBAd+AASWBASkGSSIJGyIEgAA4AQmBAGqBAeyBDPeAKH0DBGsggQAXghaAjABPggANATSAIhiACoWAARyDAKsCCUeAGWmAACmAAniAAJYBCYEdWIENZ4EpH4ASW4IRpAIIIIIRpAEEgABcgAAWgRrdAReDES2AEuSCLQUBFIAAF4EVt4ABVgEgggA6gBKxghF2gAPSgRpygABDBBtqQYCAEdyDERiCEMIBRoEAE4ASrYIUOIEOEoEwBYEIfoAAGYABKQcgDUF7IA0bginVAQ2AAJMBF4AAHwENgACZAROAAAiAAagERhshGYMokQHSgwiwAnwhgBFJARSDIBcGGQuUCQEMgBQrhhKngAEhgAjQgAAHgBMngAM0gANCAQ6CB40BEIIatwMCQUCAAY6HJ++CC3OAM+kBAoEz6YEozoEz6IAEwAEOgSBggCGaAQSABWSABh4BDYEFcoEUpYAASgELgADJgSBEAQuADc8CIA2BC+IBCYAEEwQNIAtrgy1rgAmIAU2BLUWCF5sDCSANgAx/gQjUgwArgQAngAGUARCBAEEBCYAAFQEPgBFgAnJBgSOIgAT9gAjNgCFFgCFNggAPAwwgDIYho4AEeQMIEAOBI4GDGTmCDf2DGS4DDWoigABVgABykwBQAQiDAHOEJoqBKSaFK36BAzKBAFKDIP+CAFKDGTOAAFIFCCALSQ2BKDyAAAmBAD2CBmeSAGABDYYm5YACU4EAOYIm5wEIgSUzhCssgyLSgQA5AiAIhQA7ggAsAgcggBa3hzCagRAagAeogBnCAQ2EIgmCJYOBBtWBAYiAMqwBcYABNYEigoEAooALkoEBRIAABwFrgASngAAiAwwhCoINNYMYJIAAEQEIgABhAQqMGcCBIqmGKOyAAB+BBEOABdaEI/+AADUBGIEUFYAAEwEMgRDchQBFigAmgAAfgAAYAxQiB4AWoQEMghnEgAAPARCBM4gBAYAAEIEZxAENgAVJAQ2ABLMDByIKgRnEgAEiggAwgANvgSLMgAAQAQqCADGBBU6AA56EAYaAERaBBkWCGaOAAFEBHIEA8IAYPYIZo4EBnIABZ4EZo4AAjIAAR4sZowEIiBmjAwwgEIQZowEQgQAsghmjggAKgBmjAQqCGaMBCoEFQAEYhAC1gAAoggDZARCDAQ2AEM2DANyBBo+CABkBFIYAGQESgw7OhAHKARGHAgUBEYsByoMB75ICigEShALajgA0gAIQAhIQggX/gAf5AgcLggCYgCi2gQbegQRJgBgtgSVlAxpBfIArbgEOhCPzgBBTAnEbgilIgQBMgRD2AwdLG4IAOgYJIA4gB/yAOmaAA8cBEIADFwILIoEEAocX2wE8gAAHAQ6ABceABA6AAC6ADPwCIAKDAC6CBk2BBluDF6qBACyBBluBBFODGbKACAYBEYEk9YEAHIIFKIAHO4EF24EFI4AMrYAaOYEf2gUYdHILCIEE6gUFEBALS4AZSIEXDgQEf0F+gh43gCExgQZmgQB7jRd4gAAdgDOcgwAXggZyiBePgRj8AR2JF48DIAERgAengQCcgADkBQAQAgsQhAAehBfSAUCMF74FDxATC9KBGSuHJUObGRiBCQyhGRgBtIcZGAEmgQ5DgC0QgAEFgApqgAYFA0giBIATuANBD0uCGwwDQYH+gAVDAXKIGSaCGR6CGSgBIIEAKYMZIYAARo4ZIYYAFI4ZIYAZXZ0ZJIEbaYsZJIAAtIoZJAHEtBkkAkF+jAFmAXGAAWaLABIBH4AAEowZNgEGgBk2BIBEASOEGTYBEIIZNgEXhQFCgxk2AQyEAYqEGS+BAm2GCKeCB1oBA4IHWoIOVAHAgwcYgAAHgRybgRj2AiEdgAAXgRlTgBkTghlTgAe0khlTgRlrghlTgxk7gBAWgxk7gggFARyFGSsDDiESiRjzgRSCgBlTgiGmpRknwwACgAHmgAG7A2sOH4IZZxszNDU2CgsMDQ4PEBEDAhQVASQAJhcYBD4/QEGEGWoDCwwkhgAKgSRZgBlsgw5aghl2ghopgxl2AQqBB/aBDkmAABIBDIAMGQEygwAKghZ0hgFiAgwzgRBnAQaDBQmACgQBN4oWMgEGixYyAQaBDGKBELGBEP+AIPWABKsEn5YCR4E45oEAWwEogwBZgBBNASiBBf2ABMKAHPyAAAICECeBAwcBHIAPLoAALgI7AYEpLwEQgABKBEECECeCIJ8BtYgXUIAEFYAAYgEzggCrASSBNr6AAlyAEFeAAwSABT0DdEGAgANugi39BWpBH3BFggMhggjBAwBBuYsMaIAAQgEHgRafAQiDF9EBh4AO0I0AHgIEdoEDxwNxIgmCDTiADUYCB02CAMYCIgqABwcBCoAMXYEpvgIoIIAhFgQFT3ENgBaXgAWmgjq4Aa6LDeEBA4AUYwEyiwFGATakAUaCC9aABpCCEhWTAKuAAbYEB0GAwIE9nYAAHQHYixL5gwHTASSEGF+BARiCBDKBNo+BADaAOBGBBGSBNOyDAAuAAXcDOgAIgAc+gQArAjoAhDv/gQGagwGPgh0kAwJBtoUTRYEIwAEGgwDbgxlvA0UNNaUA24gAmIEOToEMtwMtABWCJPSLAJSCCIaKAIoBBIYAigG3kACKhQFlgAwMrgCKgAD3gyK8ggFzgSAWmQCYgQKskwEiAbiLAJiBACSAPBsDQYAIgQGnAQeCERmFAKmBAASLAKiABLyAL4CKAKiDGqKCFq4BNoIamIICfYATlIEAvIENJYAP34EI8YIDV4AAaIEAo4AFvIUArgEogACugBvykQCuAgwohQECgQAngg2oARCAABSKAdQBMqcCr4AICoECWoADh4ADj4A8y4ECc4QDlQQYdnJygwPpgghuATCAAScBvo8BJ4EQVYMIrYEIloAC7I8O8YARF4UO8QRBAiEXgAEShgRKASiMAGGDFHsDCyAdgB8UAg0vhB5PgRohjBoGgBhuhBoGAQ+KGgaFAOyGGgaHAOmkHk+BHkeABjsCpDyAAE+BDG+BHWWCD+7/HlyXHlwFqDxBsDyCJqEBzYAABIEACoACM4keXYAAGIAAEoAeFQMUECmgHl4BrIAAUAHNggfagikfARCJHl+KAEuAASiCHmCBAdIBqIEBK48eX4AAQoceX4MXxYE7jIAR8AEGjR4bATKfHlSTADkBKoEAGYQeVIAZlrceVIAATgMGDDCpHkoBBoEAfZMeRAEGhBizAgwtnh5AAQ6AAAoBDoIeQAINLIANIZIeMwEMgA+mgQApAWuAEDyLHjOBBBOFHjMBJ4MEC4IPyoAECwErqAQLkh4hgTmHjx4jgAGbAWCAAD+AHiOBAYyCHiMEBUEeSYEl+wFNhQfBix4qASeKHiqACNeIHiqAFZqDHiqAGWGCHiqDGCcBC4MeKoIcm4QeKoEa440eKoBFTIEeKpgEJIAbR6EEJAEKgQBpgAS0gQBpgAAMjx4qiwJ9AQiAAMaLHioBFYMLkYAAB4geKoAADoALnwIhDYgeLoADOgIiFoIBJYweLgEmkR4ugR5DiR4qgQHhgBGrgT0piBrzARODGvMBGIYWcAEGggEFgRdSARODF88BGYEXT4AdNIQXz4AAvaQeKgEZgR4qhjOpAQ2IASaAAAyFHHIDBSAKggEcAiAKgwEcAQ2LHiqAPQqFHiqAHbyAAn2CAeIBCIQXCIEUcaMX2ocAZQMFIA2eHiqAFOGAAgaBADOMHioBBIIAu4oeKoAgB40AlwEkqACXhAIbgACagBEXgwIghx4qgBnHjQBcASOpAFyAHiqGAFyCHiqAEkSEHiqAA04BC4AA8oEVnwENmx4qggglgQUNhQG4ggZKgQHPgBHwgwQmhALIgBLdph4qASWIHiqBAuuEAwCIHiqHAu6MHiqCADugHioBHogAQ4weKoIAQ4YeJAEWhx4kAwUMK4keJAQEQQZJgBGXA4ICSYIM3aYIsIAFjAIOaoAFFAFrgBo3gQV9AhJrgSgDgRaRgQ7CghaJAxwiDYEXF4ADkoEWwQQgaiEhgAOXgAAMgxtmASKDAA2DA6QBI4EACwFUgAOkgAAHA1AhGYEABwFAgQLIgQ7QAQOBAAeBFheAAAcDMCEkgga/AQ6BA3KFBrSAMJuAAAuBPrgCCGqAGKGCRckBcoIKeYEDTwILIIAroQIgI4ID6oE9DIRBLwEGgQP0gAzngRl0AgR2gQQWgRuUggHKgBtZAy0AAoEZSIEjIoAcU4ADBIADpoEK8QEGgRshAQmAEhWCHdGCAC6CBO2CA9OBEB+CAJiBIYCBAt2CBk0BCogAqIIAnAIIaoAAT4IAeYABAgEEghqmgTyKgBoEgACJgTF+hADfAQqGAv+BAAuGAN+BHPOAANiBIeOBAOYBC4IEyQEihADfhwDbAQiDG+kBCIEDFIIA24AWuIFK9wF/gACWgQC7hEUegRt/ggOIiQNsgQXvghDsgD8SAQOAGuYBGoMAgQEDhAAfgS7tgQA4gACHgQNhgAC3gwBsgwFHgAEighuAgwDaAWqABVgDDCAfgBjwgxs/gBo+gRkcASSBGzyAAdABxIEbPIAbOoAGaoEdGYEXa4EBVAMOICCAACiDB4KAAIkBC4EFmQMOICGDABSBABGAAESBIhaBGQiBLWeCAbKCGvqDAbKCJUSCBpCBQrGBFawBDoEaioEAfIAUzgIiB4AXcaIANoAWOoEEYIAANANrIQmBFnYBDoEET4EAhYAAB4AUuYEZh6sASYABKwEJgQRuAwlBA4EXlogAOoIBtwE6gAFnhQJ/gBT9gQU7AQmAAFWAAjqBAFWAAAeDB5KAFVGAIMKGADwCCUGAQciAFsuDAq6AAJyCAG+BI4ABDIAcS4AAqYQAKIAADIQAZIIACoIAZIIAVoAuT4MF/IEAcoAQJwECgEqvggBmgAJNgQAqgAA+gAWPAUGCC26AEB2EAGaAAOEFLQAEOgCAOqGAFASAABSAAo0BCIMeHYAeG4EBAIId3QMIDB+BHsCBAhmBAqWCAh2AEOGAAh2DArSAANKCCKeCIUuBAf4BGYcALIcDI4YALAELgQnQgiGTAw0cGoAhdoAAFQEbgQDyhgE/gQMegCAsgBsOAU+AJNKAInGBRAiDKKqABPMByJEjD4ADpIoIHIEeLIQjDwENgQNNgAZtqwgcAiANhSMPgABAAgAigAZLiCMPAQuCHV+BJjGAAGmDIw8BE4AAlYAANYMf8oEYgwEFgBvMgBqYA3EgC4gjD4AKDoUf8qUAiIAKLIMDnQELhiMPAQ2PIw+BAFmBARuMCKwBDYIjD4IUw4YjD4Ao2AEIkSMPAsg3gwAblCMPgikPhiMPggSDgAAhiCMPgE4JgQqjiQGGgAC8hADuggqTpSAOgADHhADOiCMPAQuFBI6DIw+AARWBAOaCARWFB86AAjQBDoEPNoItz4si/oAK7YEMXIQDYYABqoIUX4EePoIHUQEKixBlASSkDFqAHwYCIA6CPQmMHZuBRLMBIIJFh4AZO4EHXAFGggecgBHOgSDHgRD4giJGgRGLgQJPgAG/AQODFGGCAJaAADeABK2AAl2DABkBKIEWV4MUcoQQToID2oARQoERQIAZyZwQ6YIAZwIbRoAAMQMAQeeKCOKABVUBEoEs7oMmkIAAEoEWqAGAgAS3AXSDACaTEMkCvf6CHleCE+wCAHGBR/+BDhUCDB6GIISABHKCIGkBBoEBaYMAFIAAZo8AHpEAMoAtyo4AFIISxwHOhSQ4hA8Fgw8WAQaCLAKBJDgBCoM3joMOnYAA2IEANAHPgwK7gRZ7hyQvgAECAcyLJC+CAZIBVIADV4sCvoAcOgIgCogkL4cERKQqioMDp4EdGIwkLwLIN4MHGYAcjIgEPYokL4EEPYAZxYQEPYEHvoEeaIUEPaUAgYsEPYUDW4ABIYEILoAFPAEKggChgB0vggN7gSfPhARFiQNfniQvggFgiyQvggQbgQ53gRBpkiQ0gAFkAiALhCQ0hQQmqic1jAQmgyQ0hAQmgyQ0iQDFgQ03gACEiSQ0AQ6BNTWAKX6AAMCHJCqCA9GBAeiCJCoBBYwkKoII7o8kKgEShiQqgAoUjSQqgQBEiCQqgAAiiiQqgSIugCD1gyY+hyQqAQuDJCqBAB6FEUGJJCqAD/eLCLGOJCoBDoEkKgEOggBNgAUThiQqhie/iANggSkGjQAUhyghhwAUgAA8hQHzggT9gThtgQEDgSvPgA1nggFVhgx4gRJ+AgN2gCFugx28gAWWAWuBEYEBIoQMngETgCNogAh0gROFgQA9AQWBTJyAE4qBA3aBCDMBBYIByIEMposbGYAABwEEgQR9AUeBBP+EBraAQr+BEt+DJKcBBoFUmoMVwQJBuYcSlwEUgAkUgxbyggFegUXxgSzagBKWggHqghZ2gB+hgB93gRtxAQ2EAAoBGIABnoAABwEUgQHEAQWBAgOADNGADKuAAZaAJEyBGriAHTkDC0sbgRLQgAAmgAoYgUSQkBjMhBbrgRL7hBeWhRL/gQD0AUSEEuyEEvqAAF2AUSqAAL8BuogRLQFEhhf9gQDFgQa0gQaohA93AWqBA80BA4UAx4EfrIFE1gEcgVWbggK2AUSACHiAABEBIIEkc4MSC4EAdYEIMwIgA4IU4YFRyoECQYEBGAJJG4ACPpYYaoYAygEFhADKgQB/ghOugA40gADCgCDkgimehBfGgR4Ygh2qgADGAbuSAM+BDNOFAM+CFNmVAM8BJI0AzwEo5ADPgzYliQDPgRzVAkG8iQJdAQWBAfWCBM2HGfSBLvSgCEWDAJyFAJGAAuIDLwEcgU7wAwBBmosJgYIXwIcYnYQaKAFBgDowgCb7gADwAQmDG1GAEhiMHMyMGIKBBGqAFDmCBGgBFIAACIoI+oJGeqAI+oEIpIEjc4IDkgEggVLLAwBB0IoFFYIApYAF6YQXyYIAuYMHo4AAGwEWgRaWgQCpgywOgSwfgUAJpRC7hBN5gQVhgTTHgAlfgVNMgySngShjhyhiAQiBCvaAABCJKGKCCw+WKGKAAG4BOIFKtIUoYoMokI0oYoAAmwEsgQG7ggYvgAbRgQfZAQiABZaFKBWQKGSCKAcENCIGaoAAJwEJgAAngU8ugCWJgSWNAUmBIagBCIAAOIESw4IoZIAAI4AFIYAQBIAmeYEoZIAAlpMoZIFO84AC74IowYsoZIIPXIsoZIAE3IMnnQEEgQGFhChzgEyChShuggDOlShphQKmhwrPgSEqgACmgwq4ARyBWaKDBweBCtSBEQ0DCBAngySPgQALAigLgQFbgQKOgAAHgijxgQXauSi4AQWAKLgBBYMouAEFggCVARuCS8kBHIYouAEXgwJkgyi4AQuAKLmADMQBEIMouQEXgyQjAQeHJCMBJsEkIwEKg0DqAw8QP4UACwFxhwALAR+AAAuMIosBCIAiiwLXJIApQoEhuoFPOAIQNIEiQYArJAIAGoIC44EBY4QiiwEcg03ZgFWegwCZg0qfgQDqgwE0BQRBmgVHgCtdgRpgAYeBA4uFKZGAJteCAx6ADEiAAHmABDCAAXiHA0KBAa0DABA2ggApgwcfgAIdgwE5gAdfASiFRpUBBIBWdYFFNgJBd4MkNQJLG4EP3IQAEAcDQQRKG2pKgAC2gBBCmCI/AwRBKoEQgYIAqoNEToAEcwELgTCxgAB3ARiDDqYB8YIEpIMwDgMwQQyAIUgB8IEY4IEEOIMAsQGIgACHAUqDBgoChAGAGdYCAkiAEoEBwIEIAgEDgBUKgAAMgAJHAcCBUPkBBoACA4MbX4BPNoAAKQIgcoMJdAFsgSUUAh9wgEChBEEfcxCCCGIBbIIX/wQALwEygQAQgQAJAzAQPIEBSYQNAoMFQIIAm4IBLYEBOIQEc4EAYwMEQTmDUfqEBXiCAC+DBhqBGYqBA0uCAHqAFVsBH4IOl5MAHAGLgRxvlQAdgCEOhkzogyMXkwAoggoV7AAcgB77gkjPggGQAQmAAeMBQYBGy4MDzIIBroE2lwICSIQBjpEARgEggBKFlgBigQfVjgF+ggLUgwKigALmgATxASSBCv6BAyaADEWBHtiAC/OABRKBCq+BBPaBAvqECgeCAF2CALKABLGCAH2ABpwCR0GBBGYDCBtyggC4AQOAAAiCXdOAAAgBEIEITQIbcoIAhIAAX4IG1IUATYMcQIAKH4QASYMAqp4AJoIi0YMAKQMvAQagAE8CLQCBE4mcACa9AX2CALeCRYWcAI6CVlmBTU6BCvShAQyZACaIAQyAAcABC4ABs4IYxIAEG4ADQ4EGn4EAN4IDUoIdZYcKQwEgglsygwOBggRbAcWAJpkGBQIJCQkDghSLAduAMFmBUaUB54EMLIJaAoICLoIoTocAxoAHbwIvAYAG6YAG54EOLYEAbYEEaIFD+YImgIJPvAFPgwPrgAoXghm4gADSgjGCASCAAL+BFpGGHtCAEbuCBzaCACMCLEWBBHgBT4QZlIcA0IAARIAGpgFrhQDTggBJhBIwhgLcgRWlgQwTAQaBBPaDDvKDAuuDQLmQAIkBBoUAhAEUglKdigCHgAClAU2RAIeBAL2GAVqBAVKCE+KGCbyAAD0BHIMGEQEUgiBzgQAThAEjgU1PgADvgkaLhADqAQePAGOAGPeAABiFAGOGBTeCAfuAAEqEChWBIPmBC4SDAQqEAiGAEzyDDAaBBb6EAjOGALeBAjCBDuOEBQ6BAIGDBg+BYPKAGBqBB2OKAIaAABaPAOkB24IA6YYARIIre+MA7IArFq4A7LEA6gHniQHLgQNXgQDIhADUgBdjgh1RhQCpgRPDg0tnATCXAImGAB6aA8uJBwaBAIeNBbiBKUeCAs2CNmaCAAqCD66CAAqADAaEAAqDAI6CK3aAADgBdIFF84FJqIED8oAIP4E0NYQIV4IKc4EE/YMHFQMBEDWCMCeFCOCABQQBAoUfnwMCQZSBESaDRHaFAFcDAhA5iABihBUJArQtgwxCgQmrgAAdAVyBYO0BToFkWYELnQIDaoE8xIEADAFsgAOmBEEBEC6DACYBbIId8IAGfQMQNkGABXSCAAuAA6MBG4MA1oAAVgFggwBAgQArhgHzgAANAqAtgUiugAFNAqAtgUhTBCgCmC2JB3SwAB+DAbCBEg+BFD6ADCuAIAmAACSBHxWCADSADPGAEk0BdIQAt4EPK4I/IIIAToEABgKkLZsA+4EQsYAB448A+IUA9IJhNYIBIwKgLYIObJ4BRpkAToACNYMBRIEBv4IjWIMhfYIAy4BF/QKDAoIVWYYBYwFsgyVogQHaAgFFhwAlAklxgA+VgDioiwAqgSFHgQ4ygQCVgBbHggInhgICgi3iwAICgQLsgwEMhCrJuAEMAQeEEWKAAK6AD7OCET+CAO+BWueAMvQBAYFJ0oANxoEV44IPA4Id/IYACoBi0YEzCgGCgRtkgAkGgBFoiQACgAT8gBvygBE6gR4vAQiDWXWAAAyAADWAGfSBAAqBTyuDAAqAAx6BMjqAAAqAC82BY6WAAAqAIKKAXYaBAAoCB0eBPR2BGMCBHoSAE+mBFdOBE7YFA0H6AUmBHreCEVuCP8iAFd6BBAOAIsiBAAqBLMWBHMwBCYJN1IEcrAEJgk26gRyigh3DgC/CgQAKgRDHgSJ8gQENgAnLgBRfgADUgl4Hgjl7gQcFggHjgAMggQMJAQOANLCAL3eCAHCCAyyCAyqBZB2HC3aBACuFAB+CBNeOA2qOAB+BAFqACAOCBaiBG20ELQCQIYADdYASjQJBhIEffYoDe4Au74IuRoMCfoER6wKIE4IAHAGIgCTjggKogicSgQOYgwyqgwOYggKUgQB/gRYUgQHmgQQ8gQNUgwnJhgDMAQOMAK2GAB+CAE2OAMyOAB8CIAWBAB+CAYmoBDaEAJyFBDeEACy0BDeAHeiBAO2BTj8GQQxsQZgggGi3AQCAM/UBC4AATwF+gBmMgzFyAZqACWiBV9gCQX2ANpSBNKSCADwBBoExVoYJ5IAA3oAExIUGCYALCYAKHgUAAQEBAoJU3IABewK4LYMDoQG8gAEKBXRyIgY7gAASghDCAwNBDoEy1JQLLQEGlwyqgREjArktgwyugFXkhQBdAmt2hABdBANBDWuCEbuAAt+AANEBNoAAHoQAcQEKvwBxgCgygQDAgQBzAkEJhABnAgdqgBRDgQBlAhAtggUQhAeaASuBT62CAaqAMZuBD8SCZkSAAA2AFxmFKHuBIluBDQqCTg6BAfyFNAKABRiCAAiAAbuDKOeGED6CACKCB7yDEJiBJK6CBVcBGIECDARMDQMagwhCgQHcgWdXlQDVggOQhAAqlQAjhQhsgA+ymAAmggAjAy0AM50AI4AAC7sAI4cAjwEKnwCPg1EKlgAjghUlgh/cgGp4AXaLEJCDAyoBGIFniAFKgwbIgGaVhlyIAkULgjTzAfqBJyQEQXsLHIBP7og1CwEQgAxhhzavArsBgDaMgRJwixL3gQ63glZcmBL+gAAgAUScACABQJwAILATXgF9ghJoAfGAE/0BC4FQ1AEBgADEAQmCE0sCbBCBcHOAACcBbYET6gcQQAu6CQEVgTXcAUCAJWSCBtICBkGBOZODDdYCIAeBEoICCkGADTSCZvYCdGqCBOWABPCAScuHBPCAABqAFvmCDXuCV76AF9cCIQmAbgwBDoEj+oFA3YIAQoAQTYIAQIEKeoAADIEkY4EAMoEkJ4AABIFOSoAW2YEZpYAlu4EsBgEQgB8JgiomgAA8gi8UgAA8gjtVgi8UgSNEgCG/gQAdgUo2hAOKgySKhABYgRuOBAhLGyGAOd6ADFEBAYImL4A8H4EA04EAzIE67YIAuYIAQYIeXwIgaoEAZQFrgAkAAgBOhGhRgAALgAIXgQCxAkdygBkegjGogCLQATuAI7KDAFKAAO2AAK6HAS6HASkBIoEJPgEKgwCfhAExgABagwEzgWEhgixSgAANgS5jhQFBAkETgUDJgE+KARWEBYwDAA4CgAuPgT3IDCESQe4IIRVBrgghFIE6bQF/gAARAvANgAARA7ANIYAyQQEBgBatBA9BCUuBaXuAZVyBYOABAoAU7QFxgGnDgARZAw90IoAHPQNrIReDEfCAKZOCDWSABIOBCiOBY84DdCEYgAosAX+BEcECIBaFAMKARQOAFDEBGoAyhgISTIRCNAHggjznARSBRSOACimBACaAQWMDBiAVgQdoAwshGoEk7oAIXwIiDoEBYIApw4BGaoMkzAIgGIIOLYEeZIA9EwEHgyyKAiAQgAFJgCUCAQ6BJMsDGSAagQP1gSZCgl+oAwFrdIMBYoE+EgF2glxhAQeAWWCJAhOGAoiAAbSEAoqAbMWAIcyBUswBB4FxF4AAy4FRjQEGgh9cgijBgEx5gwGwghzNAQyDChSCRUkDAiAXgCBFgRpQgwElgQAYBSAPIgkhgDdshwDLgQRQgQC2gBlMgQC2gRVPgRPWgD8kiACygWIHglmngD4JgmzwgwCYAQCCbV6AAJiCAqODX+8CIBOBAFaDWyCAJKGBAmMBDoEJ4oApA4YBiYQAB4Ifk4AApYEg3gFGgADKAQ+AbNeBPZqDGRkBS4Il/wQgDBsigEflAQeAALIBGIIBegERgQFNgQGTBAZ0IRCCL2eBA3EBDIAvvIEhoYA9cYEBToJKM4IC/IAFUAFKgW2bgDzfggJUgQJNggIgAyATaoACRAPTBkuEAlsFE0HRBEuAAl+CFEqAAtqAJUCCRa0CIA+BAReAAtWDCSCAM7WAUtkBdoEBMoAhOoED0oEAbIECNIMDrIEDyQEAgwMPgT5vg04QgwMdhwOTgAAYAQ2BAAiBAzyFJ0EDDgsrgAFfggHLgATbhB/hgQSTgVzwgQAHgmW8gGr4gW8AgwT1A2BB1IIE9QLEA4JxZYQ8goFV5QHVgRgkgRcbAdWABnSCAAeDUS8BAYEdcoMAHoMlpYAQVIEmy4ADNIEOkoFRBYAcz4EoKoEMDYM364AOYYAIxQdBoIbi7X5zgiASAgFxgXHngzBohBwSgAoagAoQAcCAb+6BABaCIaqBAGiBHKKDbyABc4Agu4FrpIAuKAF/gwKuggDlAyADc4InW4FyYYAAPoEQSIAAKokA8YUCXYAAQ4AYjJQAM4ACoQIIdoEAHoACwYkAHocAGYAC4ZMAGYAcDZMAGYAQuJMAGYAHMpMAGYADIZMAGYA71YoAGYIA4oAdUIEA4oAbRIIA4gMLvQWCB5aCA9qAACGAPKCEXiGBCviAADGAAPuBA60E8f8Da4ER+wRB8P8DgCDEgWqOgXKlgXaGA4CAPIAKF4AAW4IAGwMgAHKBWbqCdRKBHpiEAXaDAVSGAFGBZsKBdD2CAXGDBvSBAGMBcIAAUoEHc4EAbYFjLIIAUoAAUIACKQLbAoEMgANBsCuBD3iAbEmCDjeBAmeDAE2DAA2BMtuEAAuBDZmEAAuAb0qFAAuAALaFAAuADiGFAAuBFMCEAAuADtCFAAuBDUyEAAuBae6EAAuADqqFAAuAQOOFAAuABAmFAAuABZiFAAsBDocACwEPgQALgnWugC0IgiAsgCGJgQR3gwD4ggLZggAJgQGkArArgwGlArArhQKIAQKAAr+BAVIBEIcCyKQBUoYAWoEj/4QBzoJsS4ICuIAADYQAC4FmI4QAC4FxyYQAC4ABMIUAC4FooYQAC4FmXIQAC4FsqYQAC4ABMIUAC4ABMIUAC4E/YYQAC4ABMIUAC4ABMIUAC4ABMIUAC4ABMIUAC4UBMIACZIMBDAEQhAELgRezgS9aAnRygAFEAwsLkYkJeoARooMInocJfAEGiAl8ggUQhQl8gCjFhwl8iAjyhwl8ggBCgTpeigl5gUV3hwl4hGZsgXA+giR1BEHAAjaBDMySABeCTJKBFZGPCa2CB0+BJFCjCa2CCR2DCa2ICjeHCa2ALDyCAFyAbpiECo2CdCiABh2BCYyFLmiAEDOICa+ACMoBToEINYBbzAEggENVgWGnhAmyAg0CgFXfgSjkhgmzgQiEgD5BjAFnhwFihURoiAFqgQh/hAm1ggAXASCBCGuFAI6CBbkBFIAGzwUFIhMhFIwJtQKBAoAJMQmgDyEUQeAOIROBCbWBCUICoBCBABEBD4BaUYAHWAENkgmzAgQagQAbAnQigEraAWuAMiCECbQBDYIXHIEJtIBUJYAAIYAH0QEWhAm0gACAAiAVhQDDgCvAAWqALtMBGoAf6IADdoEGqgEOhAm3AROBABOAE4OFCboBDoABdgEUiQm6BA9rIheBAWuBCO8BD4MJugEHgCKBggs7gijzgAbZgQfmAxggDoEH0gMYIBeBB+0BGIMJugEGiQm6ggFpgQfJgilNAiAGjQm6hQLGgAG/hALIggkiAQaBCSIBBoEJuoAAz4FB9IM5f4UJuoF2v4gA64oJGAEZgClKgEaAgAAoAQ2NCRgBD4AITAQPGyIPgRq3ARGACVaHCRiAAPGACvuADKqCCRiAKcCAUESDMYCCAKyBVimDAmWAUdSBCRgBB4AkUoJldYIJFoAj9AISaoABpgHUhgkWAxJB0IIJFgEHgFQCgkX7g07lgE6/AQ2EMO6DMP8BEYAYfYQJFwELgAp+gAM8gQBrgAGRhAMWggkXgAM1ggyqgSzbgQAYgQKKgAKAhwL8giXJhwkYgQVugTXXgjBOhwqoggGkhAqohgp2ARKECnaCNjGCCncDCwuqgBHygQdSgRY6gTIzAwFBnoISRQQAQYgTgAASgAJJgmzJAkEegwAVAfyBYfaGABUBE4J8a4AACYAAWIMD4YgF0oABMAM7AZSAbC2BDqACsC2DRRIBqIAACIEAEAKgLYEToJIAOZYAGQMLrwKCAKyBD++BEi6BDwKAEkABBIASnYA8xYAAEoF04gEEgxKdgg8ugRnIgxBAgkQpgBBAghPBlAAcgAb4gxIsgmLNhABdgBKdihKbgTJGgxI0AgAQgEX5gwBKhxCmgwBKgjValQAchRELlQAfgAL7AXODFTCUAKiGHhODECKEJI+BD+oBEIA3E4MANYBtRIFAYwGngBPQgkdRggDMAwFBCYgBG4EBWIRtkIUA/wG4hAD/lQAgggEfgxK9gBKvmQAqggBKgiIggwGZgQCAgm76gAH7gQE8ghRwgTkkgQA6BMAtC6aFAKmBAeCEAK2CSie8AK2FAIKCTUqBClABSIJtXp4AVIEAP4cAuoAKgIIB9AQLC/wKgGgFgwarhQX4gRtcgxJugQwyASKAKw8BLIETvoEKnYEDVAcJQf+A/59/gjSsAQaDP3qBDB2BB0CBGVmDBzaCIyOABTaBGWyGBmKABxWCAuoBAYFwOgMvAbyEAAgByIAACAJBIINYfIAMh4E9KIAcroAMW4EAOoAhtIIRcIUWKIEYFIQpGoAOX4ANaoIpAIEBFwWYFmoQL4IACgGkhgAKgACwgQDFBJwWEDCCABCABAKBABABqIUAEAGwgwAqAkH+gYAdAkESgQYjgAECgDVggQZyAQKDL7OCN50B8IBBxIMA2oMF5oYyD4EATgEtgQAygBe6AwVBEYABgIEEEQYoAqwtQQqAIsmAWQ6ACm2AJteAAAqCLFCAABuAHKCBeOCCEYaADXyBHpKBGrSBTt6Aeq2DHmiCJjECECuBAICCBByDdcGAAnOAGA2EACGAFVOABCeANWsCciKARriSBC2NAhGJA8eXAmGBOC2FArSEBC0BAY8ELQJBoIBBjAMaEDGCAoeBJhCEAI2CdwKGAIeEAJq5AI+EAz0BDYEqpIEAmoAAlIIKi4Q3AIRMRoEAk4EB6YEt9gH+gls+ggHogUlaggEXAQyEAJCBIYuHATK4AJgBBYIH04kBKoJuggELggEohABngWwKgAKxgH88gwChgACKAQGHAIqAYzDCAIqDCF2WAIqCAGeCABKHAIoEBkH9/4MBJYIAkwENhwEdwwCTkQEfASKAPaKCAksBDIIAmYcAb4UAGAEEgACfgwHKggQ0AQqGA5iAA+uCE3UBCoJCtoEcbooDk4F/a4YAR58DBYEnV6AAwYEZz48AvIgDB4kArIYEDoEEcoAAkAMJEDKFBHCAZ84BB4IADoEgqQExgReWgH0YgiGJBywLC5YLARKBDT8EIGsiD4AqpIJ1Z4BhrYIXj4INCYEX5oElogEAgk1NAtDHgAhxAdCCRymBAAQBSoKDbwNB2CiDDtoC3BaBVeMBf4MVFIIMF4Fqa4ESWoBXbwEogW3ZgBT/ggDagQCkgFd8ASiAAUuFOeCBLzyBFG+AJjmBVP+CcE6BQtiAH0mAgh2ACPiBAMGAfvuDEqGDBPeCHB2ABO+BNG8CCRuBFoSCbjKDBP+CE5+ANG2AACMBrIEajAELgXQrgwBSgB4bgAG3hQGiAdCALZSAChWEAJCCFVSEcM2GAHCAa6GCLFeCCgyBBgWBCduCAXOAAV2DJiCABmyCAPSAB8iDBrkC0CiCABGCAO+AAISAAF2AABUB4IAMBoICQoIAh4JF4gLgFoAAEYAfRAIQM4MAjwHUgACPgjGlAdSFADKCHwiCAJeABm2EAP2JACaFAB6EATSCIYKGAOoBBYMK4YMMcYEA94INhYN4QoAMKIEfuYEWFAEEggAKgBokgR7JgADfhCHNgQr7gC1NgwsCgBw/iACthEPxhgHcgCshhAaQgwCcgACOggCcgwHhggDKgw8MAbyAAieARc2BGfqAcEqBAmYBCYYCcgEQg3wZAQiDW1ABBINOpoJD74I0hIAKRoI8T4IsCIUcOIYUEYIx1YEMrYMAhIMBYYUK94AxP4IJ7wHUgACtgACUBrwETBshEoIHboIBzoEjGIAv1IAx+IEvNoQAPIEktYAX84A0QoAB6IBSZYQ8YoFDwYEANYEHJQVMIgIbIoIXgIGD9oEqEYEFdAIgDIIV/oIX34se14IU8YA+jYEEIIBIMIFWRIMAbINsZIMHzoAAaYAAfIABpQMQamyDB9GANB+HAtmAQN2AFkeAAIaAAcOBACCDAt+AAMqChuKBRyiAAHaCRNkBAYICg4AB4IEK84KAvYE8noIO3oEI0YAASIE6poIOOoNIvIEBHIEArAECggImgl+igQ5egg+4A0ECSoEABYAtGoAAO4EAXYEAlIQAboEOP4IC/4ID8IM4LIEtKYQBR4EBEIE+HYIJWIAfxIEBQoAFfIMFT4MA9IAAFIEIVQIFa4QA8oAR+4UDbIUTBYEK4oAMuIIWuAMAQbqAAkeBAU+BEJCEAhyBGvEBf4I6nwIASIECxYIEioINWIQbhIMNBoMAgIEFBAEPgwJJgS/RggXIhgGkgoIfgQB8AXGABdiBDj2CAmgBS4QD6IQ4NIITv4JD+IIAnIUNpgEPgA5XASSAFa+DAF2AhreBHHGAbuWBA3yBABGABt6JAraBhVKAA62AA1KHAOsFC7YCAQmABxmBOSyCgmyCAsaABtECOwGAP0sBQYACQoAE7gRBB0GKgGbHARuALHGDDkaBHC4BCoE6ZoEEhoMBAYJ1voEK2ICGroADHoNCyIIaBYAZooF5K4IW7oGMzIQC2IAv24EET4EFjgFLgRBtgAbOgAVegSe5gAQHggE9gxotgALtggDHgh/2ghYqggcdhQAlgHDohgLzggLYgAtugRCLATuAAAeDQvqBCuYBCYJ1KoEAHQHAgwAdAsAVgweagAASAcSDABIBxIBivoARWAIKQYA7hIEEtgRGIgMbhQD3gCTwgAMlARuEAQ+CATgC0AiAATiDDESAJPqBAF6CCr2CCY2ACr2BAHqDBpCAIryAEYeBQNGCekOCB7YBL4EFDIEANYFDOIIikIMBgIIAkIEOsoIcfIQHlYEhwYIPJIAHp4AzgwIDSIcH8Y0OgokPI40AHIgH8YATp4UAXIAH8YMPgIEFqIAU+4EMeoEAC4MK7IAk7AKQIYFBcgJ0IoEWpAQvAYYIiwCmAoQIgDawgwBLAQeAAKeAAjaDCJmDAKsBB4gAq4EHeIEAj4JUAIUtQ58Aq4BY14UAYIAAq4MAYIEkJoEAq4QmF4UInwYJQRxrQWyBF7WCf1YCkB6BOnCDAIyAAA8BoIA0hYA0mYMAkoAaCoIJSYBJAocJ/40AhoIuOoQAHJYQcIwJ/QEEgAqSgzSVhAChhABqhAAVhQCrgACCgQB6gQq0gQ1jgCbRgUgggA4SgR8eBIECSRuAAXgBI4MBeIAW94AC4YANoYMAt4ECGYBEpokRN4AAfQEGhgDakgCupBE6hwFsgADHhABggQe6hgFsAQaGI9oDCUEEgVsjgAjFgAFpAR+ADLCAADuAAAsDoBwigACLhAKigTSwgQK8hAIVgwB/hytZqgIHgYAYiwFnjwCghwByhQLShgCwgRzFgBhsgiF/AqAtgUNygALeAy8BgoGGLYJ82AMvAYCBcryBAD2EAhSDXbubA2+iAiKBETCFALiAgMuEAQ2AiIqDALaBeM2DEKEFswsBCn+DBWuBBY8BIoAfEIEw7YAs9wEbghsvhAV5iwV1gI/CghzcgA6LgQcVgALygU2VgTgkg00Xgj+EgmoygIMmgStDggWEgwVxgQs4gj3SgBVJghVjgABmggTFggDEgATFgR1CggSagQJ9gAFbgQJ9gD2OjAElgAHyAQWIASWNAeKJASWNAByIASWAXOCEASUBBYAB3YMAYIGCjYQBJ4EACwELgQqGgSXyhR4ngRXehxA4hBRUgXrdgRA6gQX4gAD0gRTlgh2whQDmASKCSSaDix6DIeSCA0+CAqaAHluCAfWZA02iArKCI/mBBWCBAMCCEhuBbjSABByDAfOBG0GGD86CfFeBBraDAIqBKraBAQwELwG+FYB2H4YEs4kDRsAAlIEEeo0AlIAF/IAAJ4IBZAEFhQ83gB1chFsFgSoXjQ8zgQ4TgQBtggasjA8zgQJrgi9njwHtjAU2gHcFgyfhgVCZgA/HgQaFhgBxhAAagCs/gQAagkrKgDwQhHuAgQfQjQE3AcL6ATcB/oUBN4QPmeIBN4APrJABM4NOxIIBJgHEjgEmAcb6ASYB9oUBJoIqHeQBJoMqOo0BJoAIQYN+WYIj/4IDkYIKA4At4gFGgA1zgQWPAQiBBYqBCgOAAA+ALiGBBY8BCIQKBwL/AYCX+4MQmoEJsYEQmoGRooUMkIBNOoAMC4FKnYMNKIMOBYCNHYEAnYAOzgEEgAyugkONAQSAHRKCGyuAAWKABV+FAECCBLKBBKWBelmEMPOBABiALt6DABgBDYM9nQENgSpzgATvgQ9cghCPgAAIgj4agAuPgw1cgBraigBCggBjggBagXhbgQDtgQy3gQA/hA+tgXl3gQEpgg9Vg39uhA0ehQAVgCmLAwALg4EahIANGYKMDoQ7zoF2X4EACIVf84ApfoEACoEPggEggS+3gRYHgz0KAduAG6oEAUEWTYAru4AGs4BfxgSggAJxgCe4gQBNgzb1AQGAm8aCC9oDQSpGgUA4AgVGgV/lAwBBOYEtAYEG+YACXwML3AmCAYaBkPqAQs6CAhQBLIEr9oAG34Byv4EAD4AAA4BUXoIruoMpOYMXo4J74YJ64YMCLgJBKoAWwAJ1IoB5b4EBtYACSIEAFwFsgwg5AVyAJaiAAYiBi42BmLaABI6BAGuAAtyBYhyDFJsBT4ASTwFLgRbjgBwAAUWAZfIFIARHcnKBZFuCLJyEPNCADFuAanOALKmBArqCAs6AW2qAHU2EFgOFABOAIpmGGnCHABaBk/WAJCqEGmWHABiAHY6GNKSDLnaAHKKEgHOBARiBAAgBOIIAxoFD5IEAt4AfvoI33oIBBIBEMoEAJYE3q4KLFIE3fYEvroALx4EADYAD8YIDboIAXQFcggANgVH9gDfGgQF/hRk/ghyqgDWFAhA3gi0NhwARggBWggANgQdeg4kngTlhhBrqgn4/ggFjgBCcghjugQMTgn/Tg35DgQGEggJ8gRB6gYGUggSbAiwigjMagnvKgRyjgi+MgQJjgQEkgQDZhAAlgi3XggPbAWyDAEOAABeAY6iBAdiAAWQBBIKY/IAAkYEuKIE0KIEASIEDw4FFAIQBIAGwgARGAUGDg9SCCUGBAHCCALCAAEKBAAcCtC2BQI2CErcBtIMAGYEwFoQBe4ADUYNBOIIAkAFsgSTPgQCLgglSgQChgwBBgWkGgQq/AgVJgDrTgABhggBIgQC0AVyBBT+AACMCxC2BHueCABMCxC2CDtUBBIM0JwEBgAMkgZ9RhAFCgTZXgSIAgQL+gQGtgBpkhgD0gi8LhAAlggCygQLVggmMgEILgCo5gQBfgpJ7gwCggTnLgQHphAESgomvggFZmAESgEgVhBOsAWyDA1SFARyCAYeCBo6CAnCCP+yBBYqBMs2BG1iDATaADQEBA4ICP4MBLIGUmoMAjIIAOIUBLIAAo4QAPIABToMAWJABJIQBAYAMkoAKeIQDy4IDCIUD54EBDoAy2IIDt4QCUoFG+IAD0IMhhoAQtAFFhQO0AQaAYV6ElV6CAWODgx6DAKgBOIAFMYIMfINHdoGAO4ID7IAE6gEagzHAgwGWARqCOzWAGJmBA/yDA0qBAwGCAWGBA7KBEucBQYBa0AEDgorSAUGAQkuAHV6AJIUBi4Muz4JjnwEQgAqkgy9fghfJgGs+gRqTgZSshAVsgjkFgBo7hQJxgBT5ggN/gi+VgAAYgAANgUSGgQQ2ggANhAPVgRptg4FPggBdgWVqgwAcgjVdggAWgACQBBALC4SBHe6BADKAZCeCBEiBJ6WCBAOCA0SCXCyCANGBAiuHHWiAOaYBGIEyp4M4rIIAcwEwgh73gUB/hBGLhQAThDpohABGgACkhAf2gAS4gAANgSI8BQuECQEPgQd3gSDogRk+gR2ugiSDhwByA3RBhYJaSAEAgTcpggARgAKzAoYCgjy1gzCEgzmvgTU8hABuAVSDAriDAoyABwSCAe8BSIEABQNYdHOAgKOBS3qAAA2EAq4BNIAfAoMWcIBQpYMU04EHUIAJTIIDR4IStYQBlQEsgAB5gUUWAgNrgQdtggQrAhA6gjXFggD7gjU7ggT1g1N4ggA0gDTFgwNagTR/gQARgTTFggMWgAAFAXCABQSGCQ6SACqBjzybACKCNd2CBnaBhJqGNd2AEVyBNd2EFZ+DJUqBb16BUiSBXVmBDn+EEKyBRMCAF8QCkCOBCDCCDVyKADaCAHsBdIIA34EE34ABP4IADQKkLYEUSIEAlYFFVoABgIMD3QKAAYUeEoIV04AN6wFgggGIgRz7ggEkAUiDB7EBbIMEXwE0gBfTgQGMgCyFgQGCg0X7AVSATfeBAa6BLTmBAEmCAPaEBdeBFIqECR8DEHRzgE6AgXH3AUiCbhYBDIMByoAlXoIBx4EWIYJfWYELGIMKUoUAkYIpSYI1A4QAV4AksIA4K4ILfoM2+ocEuoQAd4IEIYAAD4FUqYQCQ4MCbIFU7oMBjoECXoEAGYIATYILMoIANYEASYQ7S5YBxogaprAAH4ML3IFSwJQBvYQ3FYMA1YcBTII3FIIBy4Kb1IFEoIQGToALSoE3GYIAwAECgzcZgQQXgjcZgwBGiATxgQAHgztQgpoMgaJtgwY4gAFgAU+AR+2HOqeEAF6CaZKEAF4BAYQ6V4GXJIE6pI0AXoI6pIQAYgEbg0YtAqAtgzpRnQBPmQCtgUaZgAdfgSH2Awu+BYARsoID4IALqYAD4oMKa4Kg0IEACYI03oIEUQFqgRSLggAdASyAA5qCBJaBB1SBEaaBlb6AGIyFBa8BcIAKVoFeh4QCR4AKY4I8vYQGL4EAHAFcgwR+ArQtgj7kgQuahAh0AUSBAAUBTIEd6YMRy4FEIoEAioABCIIG6oMQ7IAADIJD/gQgCE8bhCWjgAuDhAmAgwyeghqkghjOpQA7gBe5gA3PhAhogIXWgkb8gQJEgwV5gwFiAgRqgAcmAhA3ggASggfYAXSDADCBB9GBExCABYmEAneBCG6CAP+BQoGAHleCHDuHAzqBDQ2BAzyCBA8BWIAxKIAFnIAf7YBRFoEQJoEStYAAfoKUb4NAfoEqL4AD8gEIhAAmggDogAAFgEpLiAXCggE3ASKAUjSCA/uAHNyDAwWCGs6CAWSFHIeCHayCWIOBGjMBhYEACoQCHIE/0IUJbIMJaQHEgB9TgiMLgyUbggEJgCM+gAJlgWAGAYKCOwqBpCIBAYAADIAIhYEjHICKGIVKgIEDQoEISoI4p4Gc0YIPTII8CoAAQoGlpIECroGKCIEAB4QM74AHjIAUI4UAQQEBgp+Wg4b2gQCPgA0CgABDgRRxgAkhAwurBIAflIEAGQF8gRlHgCjfgQAMAXiDAX0CjAGFDTuECuUCLGuAAuOBGcCBBUoBA4Bh7YIFgAGQgJACggDbgAGVgAxUgAA0ggWQATiAHMmBoHWBURaABZQBB4I9k4Eq9YEu9oEE04NYIoEACoIAmgE0gB2AgQGYgx0pgQrWgF3AgQv/gwAvgBnzgk6gggAyAiALggiTgQAKgVo7hAANgANKgz4KgT34gxIwiGYwhj3/gACAggAtgQV9gT3QgAANgAHRgj4FgAv0gTEugAANgDpAgAKSgTEigAANgAnHgABQgTEWgAANgD4OgASegTEKgAANgD4RgAGDgTD+gAANghRqgQVKgQc8gBAMgg9KgC6rgT4XgAeMgSC4gz4egACfhD4egRB8g4WQgF9PgQAKgkAHgB3cAQaDRdOAETUBBoOhO4JbW4Ico4AA14IU84IeS4Ja5oBt5oMCFIAC7oMn2YAC5oBKAQEggiLrAQODTo2BAPmDAXeALCiCAAqAABSBTpcBDIBNGIBf84IDCYED5gEBgQuugS53AiIJgQLOgRlLgQAEBUkbC6ALgRwpgwlzgSoZhAlzhQl1ggIFiQlzAUWDAheBCXSAQJyAAV2AQuKCBX2RCXOCAmKaCXODB/WTCXOCCWyAApWFHAOCCHEDNgJ4hAVTgGUYgAIVgSJAgABPAWCBToiFAFABgIIA74EC3YIJoYQEdIUJpAEEgAmkgwf2gEy2hibRgh5MgAulgAH9AUGAAUODADWBAGeAVAMBIIEA2YgAbIIC3AF4gqObgwjoAQWFYMiAABiJB5GCBjeBA0KAAAmFCeiDCogBZIAP7oACT5sHx4BQvccJ7YEo3LQJ7QF4gR3fggkrhAF8gD9QgAeegACMgCjkgRsVglojgQDdgwahAaSCAPoCoC2OCa6AHeWEHbKEAiOBBQyCNMyJAh6ABZiVBc+DIGSLCcqCGiOECcsBeIQJy4MCE4IJvAFohQnZgQ5zgZHUhgl5AVyBUIeGCCoBBIUIKoCjT5oI14Kk+IAACgFohQWOggX+hAT38gnUhwm4iAlVkAmzggLUlAm2hANigQoOhgiahgoohgD6AQSCobKDAVWUAC6ABJiCqZ//ASGHASGCAgjoCouGAmG4CouBBF6AjxYDAAs/gg+agQAejxcghj/GlAAfgAAcglI2AgRAgAGUAQOAAA0CgweBN1qFP2KAENOAIiWBLjyATW2Al8aCULCOdeuFDu+BFfgBQYAjsIAAMAF/gFCoAQaCpL0CAEiAP46BE52BFj+CMuiAVRiCesqCBTGBNXiBF4mCBtyAF3qCkRUCCEmBIbwCS3KAFfOAUuKCBRCBdj8ByIAJjYFUz4MAcINePYNXjIEFY4KaDQJBKoEQioABX4IWuQRC//+BgmzZAVSAAAwDgICCgFF3ATeAW8SATlOBAWaACXmCVmiCFoOBAAyBWtqBCt2DVJiBAHWBI8+CAOSAAHeBVUSEABaBT4aJABmCAseCABcBTIcAF4JCFIAAHQHEgR6TgABegFkbgDjKgAAJAZyEMQgBKIEAD4AYXoQAMIEEgIFkuIAARgGcgSwPAQKAXrGAe+eDFRQBOIJXqYAE84QACAFEgks1gpMgg0Q6gAGRAYCCZ2yAQRSAeNaCB/2BAH4BiIEjhIALRQGEgQCOgCoZgGkkggpUATaCRV2BQzUBbIAFngE2gAQbg5DfAhA0ggHdgACMgBN2incXgACngY9Wg19ShRIZg0G7gAUngRpRgQokgWVJg0G9BEE5QSqBJY+AAdSCp0+CK4mBAv6DS0qCNWeDUoqACpeAS++BAGaAE6ODCCuEQ/oGQYgRNgK4gI+lgAALgB8IgBRvgo+xgHpvAayDABWACJaAALyBABUB4IAAFQGggwAVgAijgADfgQAVAX6CeBOAKpCDAL2BAK4BLIAGIoRbhIVEKIIoEgFEgDgahDK+ghZehQuBhkQhgiqgAiA3gQbcgQCrgG1ihQAShEQ3AUiDAReAMFsCDGyAGOQClCCBCVoBNoALK4EDbwJBkIQADwGMgwAPAZKEAA8BgIMADwGWhAAPAXyBDmACC0ODGVyBWjCXGVyCDWuBOE2CGVyBAAqAATmAeSgBSYIEGgMLC+OAjWKAAhQEC6EEaYCzYAVmZmljaYCy5QEgg7TZEwAxLjMuMS4xLW1vdGxleQBpbnaAs20VZCBsaXRlcmFsL2xlbmd0aHMgc2V0hgAcBWNvZGUgiQAZD3Vua25vd24gaGVhZGVyIICz0wFniwAyAmRpgLN3AW6AtAmKABYDYml0hABHECByZXBlYXQAdG9vIG1hbnmFABcHc3ltYm9sc44AGAJvcoYAU4YAJIUAVoKz9IAAXYC0QAFrhQCmAgBigAD4gACaDGVycm9yAHN0cmVhbYQADYoA1QstLSBtaXNzaW5nIIC0pwQtb2YtggBHgAAlAmNvgLQtAmN0hQDjA2NoZYoAF4QAmI0AFwRkYXRhhgAViwELASCBANQFZmFyIGKAtJABAIUAVwJyY4EAgQVtYXRjaIYAMgF3gLT0BG93IHOBtQOGATuCAN4DdHlwhwATiwGyggDQjwB1ggAWhQGvBGNvbXCAtSQBc4C06YACDgR0aG9kgDInEwwLpQIDAAQABQAGAAcACAAJAAqAKQcNDQAPABEAEwAXABsAH4CVbhYrADMAOwBDAFMAYwBzAIMAowDDAOMAgAY4ggABAYCMAAIBgYQAAgGChAACAYOEAAIBhIQAAgGFhAACBZAASQDIghjMgK1JggCEAQeAAIABDYAAegEZgCkpATGAA4wBYYAARgHBgEjqAYGBSOyAQBYEAQYBCIApDAMQARiABbwJMAFAAWABgAHAiQB4hQBwhQBoAYaAAAIBh4AAAgGIgAACAYmAAAIBioAAAgGLgAACAYyAAAIBjYAAAgGOgAACARCAAHIBEoAAiAEIggCAAQaAAQIBBYABBAMEAAyAAJaAHJwCAA6AAKIBD4CwMwQOC7cMtQEsgBzVggABARCMAAIBEYQAAgEShAACAROEAAIBFIQAAgEVhAACARDAASyJAICFAHSFAGyBAGQBFoAAAgEXgAACARiAAAIBGYAAAgEagAACARuAAAIBHIAAAgEdgAACAUCAAAIGoAgAAKANgACIgADQAR6AAAQBD4AAVAEggAAQAiAOgwDgAR6AAASBABSBAAEBoIQAFAETgAAEAQeEABQBDIABOAGMgAAEAUyAAAQBzIAABAEsgAAEAayAAAQBbIAABAHsgAAEARyAAAQBnIAABAFcgAAEAdyAAAQBPIAABAG8gAAEAXyAAAQB/IAABAECgAAEAYKAAAQBQoAABAHCgAAEASKAAAQBooAABAFigAAEAeKAAAQBEoAABAGSgAAEAVKAAAQB0oAABAEygAAEAbKAAAQBcoAABAHygAAEAQqAAAQBioAABAFKgAAEAcqAAAQBKoAABAGqgAAEAWqAAAQB6oAABAEagAAEAZqAAAQBWoAABAHagAAEgHm4AgC6gAAEAXqAAAQB+oAABAEGgAAEAYaAAAQBRoAABAHGgAAEASaAAAQBpoAABAFmgAAEAeaAAAQBFoAABAGWgAAEAVaAAAQB1oAABAE2gAAEAbaAAAQBdoAABAH2gAAEAQ6AAAQBjoAABAFOgAAEAc6AAAQBLoAABAGugAAEAW6AAAQB7oAABAEegAAEAZ6AAAQBXoAABAHegAAEAT6AAAQBvoAABAF+gAAEAf6AAAQBAYAABAGBgAAEAUGAAAQBwYAABAEhgAAEAaGAAAQBYYAABAHhgAAEARGAAAQBkYAABAFRgAAEAdGAAAQBMYAABAGxgAAEAXGAAAQB8YAABAEJgAAEAYmAAAQBSYAABAHJgAAEASmAAAQBqYAABAFpgAAEAemAAAQBGYAABAGZgAAEAVmAAAQB2YAABAE5gAAEAbmAAAQBeYAABAH5gAAEAQWAAAQBhYAABAFFgAAEAcWAAAQBJYAABAGlgAAEAWWAAAQB5YAABAEVgAAEAZWAAAQBVYAABAHVgAAEATWAAAQBtYAABAF1gAAEAfWAAAQBDYAABAGNgAAEAU2AAAQBzYAABIARMwIArYAABAFtgAAEAe2AAAQBHYAABAGdgAAEAV2AAAQB3YAABAE9gAAEAb2AAAQBfYAABAH9gAAEAROAAMIFEwEJAJOAAAgBk4AACAFTgAAIAVOAAAgB04AACAHTgAAIATOAAAgBM4AACAGzgAAIAbOAAAgBc4AACAFzgAAIAfOAAAgB84AACAELgAAIgBDagAQCgAAEgAAIAUuAAAgBS4AACAHLgAAIAcuAAAgBK4AACAErgAAIAauAAAgBq4AACAFrgAAIAWuAAAgB64AACAHrgAAIARuAAAgBG4AACAGbgAAIAZuAAAgBW4AACAFbgAAIAduAAAgB24AACAE7gAAIATuAAAgBu4AACAG7gAAIAXuAAAgBe4AACAH7gAAIAfuAAAiBA7YBB4AACAGHgAAIAYeAAAgBR4AACAFHgAAIAceAAAgBx4AACAEngAAIASeAAAgBp4AACAGngAAIAWeAAAgBZ4AACAHngAAIAeeAAAgBF4AACAEXgAAIAZeAAAgBl4AACAFXgAAIAVeAAAgB14AACAHXgAAIATeAAAgBN4AACAG3gAAIAbeAAAgBd4AACAF3gAAIAfeAAAgB94AACAEPgAAIAQ+AAAgBj4AACAGPgAAIAU+AAAgBT4AACAHPgAAIAc+AAAgBL4AACAEvgAAIAa+AAAgBr4AACAFvgAAIAW+AAAgB74AACAHvgAAIAR+AAAgBH4AACAGfgAAIAZ+AAAgBX4AACAFfgAAIAd+AAAgB34AACAE/gAAIAT+AAAgBv4AACAG/gAAIAX+AAAgBf4AACAH/gAAIAf+AAAiBBAoBQIAABAEggAAEAWCAAAQBEIAABAFQgAAEATCAAAQBcIIFVgMHAEiAAAQBKIAABAFogAAEARiAAAQBWIAABAE4gAAEAXiAAAQBBIAABAFEgAAEASSAAAQBZIAABAEUgAAEAVSAAAQBNIAABAF0gAAEAQOAAEIBg4AABAFDgAAEAcOAAAQBI4AABAGjgAAEAWOAAAQB44AABIC+K4AAdIECxgEFgABcAQWCBUoBFIAABAEMgAAEARyAAASAvlaABEQBBYIGBAEaggXqAQWAA9QBBYADuAEFgAOcgE92gAAEARGAAAQBCYAABAEZgAAEgQACARWAAAQBDYAABAEdgAAEgL59gAKkgQZAAQWAAiyBBaYBBYABtAEFgD3fAxsLTYMfuYcABIC+rooABIEHUYkABAEEjAAEAQWKAAQEQbAcC4C9CosAS40AO4UALwEGhAAEgQWIgQAEgQEKgQAEgQGSgQAEgIS2ggAEAQuEAAQBDIQABIAF24FHeQTgHQsjhQBfhQXLAhARgAVtBgcJBgoFC4A6uAQNAg4BgAclBJQeC2mFAJCFAIiFAICFAHiBAGiBAFyBBh8BEIAABAEUgAAEARiAAAQBHIAABAEggAAEASiAAAQBMIAABAE4gAAEAUCAAAQBUIAABIEGvQFwgAAEAYCAAAQBoIAABAHAgAAEAeCAAG8DHwtyjQBvgQBrgQBngQBjgQBfgQBbgQBXgQBTgQBPgQBLgQBHgQBDgQE8AYCvAEGAUc0CC22BAMcBBIAAAgEIgAAEgQEzgQJLARCAAA6DAAyBnqyAqmuEACSBB3OBAE8BCIAACIEAGIUADIEIt4MADAEggQCUgDKEgQBrAYCBCC8BBIMADIA/SAoBABAMAEGRIQv/gCUfgMDAgIKxBQgJCQoKgEk3gAABAQ2AAAEBDoAAAQEPgAABARCEAAEBEYQAAQEShAABAROEAAEBFIwAAQEVjAABARaMAAEBF4wAAQEYnAABARmcAAEBGpwAAQEbmwABARyBffsEBAQFBYHB1QEHgAABAQiEAAGAXSqCAAEBCowAAYAnsooAAYEBMJkAAYEBTJkAAYEBaLkAAYEBpLkAAYIDdYABzoUBvI0BqJ0BkLwBgAIbHLwAAQEdvAABgA9PgH05A9AqAQ==")),e)})}let Fe,Bn,St,Bs;function oC(i){if(Fe=i,{malloc:Bn,free:St,memory:Bs}=Fe,typeof Bn!="function"||typeof St!="function"||!Bs)throw Fe=Bn=St=Bs=null,new Error("Invalid WASM module")}function Yu(i,e,t={}){const n=typeof t.level=="number"?t.level:-1,s=typeof t.outBuffer=="number"?t.outBuffer:64*1024,o=typeof t.inBufferSize=="number"?t.inBufferSize:64*1024;return new TransformStream({start(){let r;if(this.out=Bn(s),this.in=Bn(o),this.inBufferSize=o,this._scratch=new Uint8Array(s),i?(this._process=Fe.deflate_process,this._last_consumed=Fe.deflate_last_consumed,this._end=Fe.deflate_end,this.streamHandle=Fe.deflate_new(),e==="gzip"?r=Fe.deflate_init_gzip(this.streamHandle,n):e==="deflate-raw"?r=Fe.deflate_init_raw(this.streamHandle,n):r=Fe.deflate_init(this.streamHandle,n)):e==="deflate64-raw"?(this._process=Fe.inflate9_process,this._last_consumed=Fe.inflate9_last_consumed,this._end=Fe.inflate9_end,this.streamHandle=Fe.inflate9_new(),r=Fe.inflate9_init_raw(this.streamHandle)):(this._process=Fe.inflate_process,this._last_consumed=Fe.inflate_last_consumed,this._end=Fe.inflate_end,this.streamHandle=Fe.inflate_new(),e==="deflate-raw"?r=Fe.inflate_init_raw(this.streamHandle):e==="gzip"?r=Fe.inflate_init_gzip(this.streamHandle):r=Fe.inflate_init(this.streamHandle)),r!==0)throw new Error("init failed:"+r)},transform(r,a){try{const l=r,c=new Uint8Array(Bs.buffer),h=this._process,u=this._last_consumed,p=this.out,f=this._scratch;let m=0;for(;m<l.length;){const y=Math.min(l.length-m,32768);(!this.in||this.inBufferSize<y)&&(this.in&&St&&St(this.in),this.in=Bn(y),this.inBufferSize=y),c.set(l.subarray(m,m+y),this.in);const g=h(this.streamHandle,this.in,y,p,s,0),A=g&16777215;if(A&&(f.set(c.subarray(p,p+A),0),a.enqueue(f.slice(0,A))),!i){const b=g>>24&255,C=b&128?b-256:b;if(C<0)throw new Error("process error:"+C)}const v=u(this.streamHandle);if(v===0)break;m+=v}}catch(l){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&St&&St(this.in),this.out&&St&&St(this.out),a.error(l)}},flush(r){try{const a=new Uint8Array(Bs.buffer),l=this._process,c=this.out,h=this._scratch;for(;;){const u=l(this.streamHandle,0,0,c,s,4),p=u&16777215,f=u>>24&255;if(!i){const m=f&128?f-256:f;if(m<0)throw new Error("process error:"+m)}if(p&&(h.set(a.subarray(c,c+p),0),r.enqueue(h.slice(0,p))),f===1||p===0)break}}catch(a){r.error(a)}finally{if(this._end&&this.streamHandle){const a=this._end(this.streamHandle);a!==0&&r.error(new Error("end error:"+a))}this.in&&St&&St(this.in),this.out&&St&&St(this.out)}}})}class rC{constructor(e="deflate",t){return Yu(!0,e,t)}}class aC{constructor(e="deflate",t){return Yu(!1,e,t)}}let $u=!1;async function lC(i,{baseURI:e}){if(!$u){let t,n;try{try{n=new URL(i,e)}catch{}t=await(await fetch(n)).arrayBuffer()}catch(o){if(i.startsWith("data:application/wasm;base64,"))t=cC(i);else throw o}const s=await WebAssembly.instantiate(t);oC(s.instance.exports),$u=!0}}function cC(i){const e=i.split(",")[1],t=atob(e),n=t.length,s=new Uint8Array(n);for(let o=0;o<n;++o)s[o]=t.charCodeAt(o);return s.buffer}let Al;sC(Ko),Zb({initModule:i=>{if(!Al){let{wasmURI:e}=i;typeof e==Ki&&(e=e()),Al=lC(e,i)}return Al}}),Ko({CompressionStreamZlib:rC,DecompressionStreamZlib:aC});const vl={application:{"andrew-inset":"ez",annodex:"anx","atom+xml":"atom","atomcat+xml":"atomcat","atomserv+xml":"atomsrv",bbolin:"lin","cu-seeme":"cu","davmount+xml":"davmount",dsptype:"tsp",ecmascript:["es","ecma"],futuresplash:"spl",hta:"hta","java-archive":"jar","java-serialized-object":"ser","java-vm":"class",m3g:"m3g","mac-binhex40":"hqx",mathematica:["nb","ma","mb"],msaccess:"mdb",msword:["doc","dot","wiz"],mxf:"mxf",oda:"oda",ogg:"ogx",pdf:"pdf","pgp-keys":"key","pgp-signature":["asc","sig"],"pics-rules":"prf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],rar:"rar","rdf+xml":"rdf","rss+xml":"rss",rtf:"rtf","xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","xpdl"],"xspf+xml":"xspf",zip:"zip","vnd.android.package-archive":"apk","vnd.cinderella":"cdy","vnd.google-earth.kml+xml":"kml","vnd.google-earth.kmz":"kmz","vnd.mozilla.xul+xml":"xul","vnd.ms-excel":["xls","xlb","xlt","xlm","xla","xlc","xlw"],"vnd.ms-pki.seccat":"cat","vnd.ms-pki.stl":"stl","vnd.ms-powerpoint":["ppt","pps","pot","ppa","pwz"],"vnd.oasis.opendocument.chart":"odc","vnd.oasis.opendocument.database":"odb","vnd.oasis.opendocument.formula":"odf","vnd.oasis.opendocument.graphics":"odg","vnd.oasis.opendocument.graphics-template":"otg","vnd.oasis.opendocument.image":"odi","vnd.oasis.opendocument.presentation":"odp","vnd.oasis.opendocument.presentation-template":"otp","vnd.oasis.opendocument.spreadsheet":"ods","vnd.oasis.opendocument.spreadsheet-template":"ots","vnd.oasis.opendocument.text":"odt","vnd.oasis.opendocument.text-master":["odm","otm"],"vnd.oasis.opendocument.text-template":"ott","vnd.oasis.opendocument.text-web":"oth","vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","vnd.openxmlformats-officedocument.presentationml.template":"potx","vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","vnd.smaf":"mmf","vnd.stardivision.calc":"sdc","vnd.stardivision.chart":"sds","vnd.stardivision.draw":"sda","vnd.stardivision.impress":"sdd","vnd.stardivision.math":["sdf","smf"],"vnd.stardivision.writer":["sdw","vor"],"vnd.stardivision.writer-global":"sgl","vnd.sun.xml.calc":"sxc","vnd.sun.xml.calc.template":"stc","vnd.sun.xml.draw":"sxd","vnd.sun.xml.draw.template":"std","vnd.sun.xml.impress":"sxi","vnd.sun.xml.impress.template":"sti","vnd.sun.xml.math":"sxm","vnd.sun.xml.writer":"sxw","vnd.sun.xml.writer.global":"sxg","vnd.sun.xml.writer.template":"stw","vnd.symbian.install":["sis","sisx"],"vnd.visio":["vsd","vst","vss","vsw","vsdx","vssx","vstx","vssm","vstm"],"vnd.wap.wbxml":"wbxml","vnd.wap.wmlc":"wmlc","vnd.wap.wmlscriptc":"wmlsc","vnd.wordperfect":"wpd","vnd.wordperfect5.1":"wp5","x-123":"wk","x-7z-compressed":"7z","x-abiword":"abw","x-apple-diskimage":"dmg","x-bcpio":"bcpio","x-bittorrent":"torrent","x-cbr":["cbr","cba","cbt","cb7"],"x-cbz":"cbz","x-cdf":["cdf","cda"],"x-cdlink":"vcd","x-chess-pgn":"pgn","x-cpio":"cpio","x-csh":"csh","x-director":["dir","dxr","cst","cct","cxt","w3d","fgd","swa"],"x-dms":"dms","x-doom":"wad","x-dvi":"dvi","x-httpd-eruby":"rhtml","x-font":"pcf.Z","x-freemind":"mm","x-gnumeric":"gnumeric","x-go-sgf":"sgf","x-graphing-calculator":"gcf","x-gtar":["gtar","taz"],"x-hdf":"hdf","x-httpd-php":["phtml","pht","php"],"x-httpd-php-source":"phps","x-httpd-php3":"php3","x-httpd-php3-preprocessed":"php3p","x-httpd-php4":"php4","x-httpd-php5":"php5","x-ica":"ica","x-info":"info","x-internet-signup":["ins","isp"],"x-iphone":"iii","x-iso9660-image":"iso","x-java-jnlp-file":"jnlp","x-jmol":"jmz","x-killustrator":"kil","x-latex":"latex","x-lyx":"lyx","x-lzx":"lzx","x-maker":["frm","fb","fbdoc"],"x-ms-wmd":"wmd","x-msdos-program":["com","exe","bat","dll"],"x-netcdf":["nc"],"x-ns-proxy-autoconfig":["pac","dat"],"x-nwc":"nwc","x-object":"o","x-oz-application":"oza","x-pkcs7-certreqresp":"p7r","x-python-code":["pyc","pyo"],"x-qgis":["qgs","shp","shx"],"x-quicktimeplayer":"qtl","x-redhat-package-manager":["rpm","rpa"],"x-ruby":"rb","x-sh":"sh","x-shar":"shar","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","x-stuffit":"sit","x-sv4cpio":"sv4cpio","x-sv4crc":"sv4crc","x-tar":"tar","x-tex-gf":"gf","x-tex-pk":"pk","x-texinfo":["texinfo","texi"],"x-trash":["~","%","bak","old","sik"],"x-ustar":"ustar","x-wais-source":"src","x-wingz":"wz","x-x509-ca-cert":["crt","der","cer"],"x-xcf":"xcf","x-xfig":"fig","x-xpinstall":"xpi",applixware:"aw","atomsvc+xml":"atomsvc","ccxml+xml":"ccxml","cdmi-capability":"cdmia","cdmi-container":"cdmic","cdmi-domain":"cdmid","cdmi-object":"cdmio","cdmi-queue":"cdmiq","docbook+xml":"dbk","dssc+der":"dssc","dssc+xml":"xdssc","emma+xml":"emma","epub+zip":"epub",exi:"exi","font-tdpfr":"pfr","gml+xml":"gml","gpx+xml":"gpx",gxf:"gxf",hyperstudio:"stk","inkml+xml":["ink","inkml"],ipfix:"ipfix","jsonml+json":"jsonml","lost+xml":"lostxml","mads+xml":"mads",marc:"mrc","marcxml+xml":"mrcx","mathml+xml":["mathml","mml"],mbox:"mbox","mediaservercontrol+xml":"mscml","metalink+xml":"metalink","metalink4+xml":"meta4","mets+xml":"mets","mods+xml":"mods",mp21:["m21","mp21"],mp4:"mp4s","oebps-package+xml":"opf","omdoc+xml":"omdoc",onenote:["onetoc","onetoc2","onetmp","onepkg"],oxps:"oxps","patch-ops-error+xml":"xer","pgp-encrypted":"pgp",pkcs10:"p10","pkcs7-mime":["p7m","p7c"],"pkcs7-signature":"p7s",pkcs8:"p8","pkix-attr-cert":"ac","pkix-crl":"crl","pkix-pkipath":"pkipath",pkixcmp:"pki","pls+xml":"pls","prs.cww":"cww","pskc+xml":"pskcxml","reginfo+xml":"rif","relax-ng-compact-syntax":"rnc","resource-lists+xml":"rl","resource-lists-diff+xml":"rld","rls-services+xml":"rs","rpki-ghostbusters":"gbr","rpki-manifest":"mft","rpki-roa":"roa","rsd+xml":"rsd","sbml+xml":"sbml","scvp-cv-request":"scq","scvp-cv-response":"scs","scvp-vp-request":"spq","scvp-vp-response":"spp",sdp:"sdp","set-payment-initiation":"setpay","set-registration-initiation":"setreg","shf+xml":"shf","sparql-query":"rq","sparql-results+xml":"srx",srgs:"gram","srgs+xml":"grxml","sru+xml":"sru","ssdl+xml":"ssdl","ssml+xml":"ssml","tei+xml":["tei","teicorpus"],"thraud+xml":"tfi","timestamped-data":"tsd","vnd.3gpp.pic-bw-large":"plb","vnd.3gpp.pic-bw-small":"psb","vnd.3gpp.pic-bw-var":"pvb","vnd.3gpp2.tcap":"tcap","vnd.3m.post-it-notes":"pwn","vnd.accpac.simply.aso":"aso","vnd.accpac.simply.imp":"imp","vnd.acucobol":"acu","vnd.acucorp":["atc","acutc"],"vnd.adobe.air-application-installer-package+zip":"air","vnd.adobe.formscentral.fcdt":"fcdt","vnd.adobe.fxp":["fxp","fxpl"],"vnd.adobe.xdp+xml":"xdp","vnd.adobe.xfdf":"xfdf","vnd.ahead.space":"ahead","vnd.airzip.filesecure.azf":"azf","vnd.airzip.filesecure.azs":"azs","vnd.amazon.ebook":"azw","vnd.americandynamics.acc":"acc","vnd.amiga.ami":"ami","vnd.anser-web-certificate-issue-initiation":"cii","vnd.anser-web-funds-transfer-initiation":"fti","vnd.antix.game-component":"atx","vnd.apple.installer+xml":"mpkg","vnd.apple.mpegurl":"m3u8","vnd.aristanetworks.swi":"swi","vnd.astraea-software.iota":"iota","vnd.audiograph":"aep","vnd.blueice.multipass":"mpm","vnd.bmi":"bmi","vnd.businessobjects":"rep","vnd.chemdraw+xml":"cdxml","vnd.chipnuts.karaoke-mmd":"mmd","vnd.claymore":"cla","vnd.cloanto.rp9":"rp9","vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"vnd.cluetrust.cartomobile-config":"c11amc","vnd.cluetrust.cartomobile-config-pkg":"c11amz","vnd.commonspace":"csp","vnd.contact.cmsg":"cdbcmsg","vnd.cosmocaller":"cmc","vnd.crick.clicker":"clkx","vnd.crick.clicker.keyboard":"clkk","vnd.crick.clicker.palette":"clkp","vnd.crick.clicker.template":"clkt","vnd.crick.clicker.wordbank":"clkw","vnd.criticaltools.wbs+xml":"wbs","vnd.ctc-posml":"pml","vnd.cups-ppd":"ppd","vnd.curl.car":"car","vnd.curl.pcurl":"pcurl","vnd.dart":"dart","vnd.data-vision.rdz":"rdz","vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"vnd.dece.ttml+xml":["uvt","uvvt"],"vnd.dece.unspecified":["uvx","uvvx"],"vnd.dece.zip":["uvz","uvvz"],"vnd.denovo.fcselayout-link":"fe_launch","vnd.dna":"dna","vnd.dolby.mlp":"mlp","vnd.dpgraph":"dpg","vnd.dreamfactory":"dfac","vnd.ds-keypoint":"kpxx","vnd.dvb.ait":"ait","vnd.dvb.service":"svc","vnd.dynageo":"geo","vnd.ecowin.chart":"mag","vnd.enliven":"nml","vnd.epson.esf":"esf","vnd.epson.msf":"msf","vnd.epson.quickanime":"qam","vnd.epson.salt":"slt","vnd.epson.ssf":"ssf","vnd.eszigno3+xml":["es3","et3"],"vnd.ezpix-album":"ez2","vnd.ezpix-package":"ez3","vnd.fdf":"fdf","vnd.fdsn.mseed":"mseed","vnd.fdsn.seed":["seed","dataless"],"vnd.flographit":"gph","vnd.fluxtime.clip":"ftc","vnd.framemaker":["fm","frame","maker","book"],"vnd.frogans.fnc":"fnc","vnd.frogans.ltf":"ltf","vnd.fsc.weblaunch":"fsc","vnd.fujitsu.oasys":"oas","vnd.fujitsu.oasys2":"oa2","vnd.fujitsu.oasys3":"oa3","vnd.fujitsu.oasysgp":"fg5","vnd.fujitsu.oasysprs":"bh2","vnd.fujixerox.ddd":"ddd","vnd.fujixerox.docuworks":"xdw","vnd.fujixerox.docuworks.binder":"xbd","vnd.fuzzysheet":"fzs","vnd.genomatix.tuxedo":"txd","vnd.geogebra.file":"ggb","vnd.geogebra.tool":"ggt","vnd.geometry-explorer":["gex","gre"],"vnd.geonext":"gxt","vnd.geoplan":"g2w","vnd.geospace":"g3w","vnd.gmx":"gmx","vnd.grafeq":["gqf","gqs"],"vnd.groove-account":"gac","vnd.groove-help":"ghf","vnd.groove-identity-message":"gim","vnd.groove-injector":"grv","vnd.groove-tool-message":"gtm","vnd.groove-tool-template":"tpl","vnd.groove-vcard":"vcg","vnd.hal+xml":"hal","vnd.handheld-entertainment+xml":"zmm","vnd.hbci":"hbci","vnd.hhe.lesson-player":"les","vnd.hp-hpgl":"hpgl","vnd.hp-hpid":"hpid","vnd.hp-hps":"hps","vnd.hp-jlyt":"jlt","vnd.hp-pcl":"pcl","vnd.hp-pclxl":"pclxl","vnd.hydrostatix.sof-data":"sfd-hdstx","vnd.ibm.minipay":"mpy","vnd.ibm.modcap":["afp","listafp","list3820"],"vnd.ibm.rights-management":"irm","vnd.ibm.secure-container":"sc","vnd.iccprofile":["icc","icm"],"vnd.igloader":"igl","vnd.immervision-ivp":"ivp","vnd.immervision-ivu":"ivu","vnd.insors.igm":"igm","vnd.intercon.formnet":["xpw","xpx"],"vnd.intergeo":"i2g","vnd.intu.qbo":"qbo","vnd.intu.qfx":"qfx","vnd.ipunplugged.rcprofile":"rcprofile","vnd.irepository.package+xml":"irp","vnd.is-xpr":"xpr","vnd.isac.fcs":"fcs","vnd.jam":"jam","vnd.jcp.javame.midlet-rms":"rms","vnd.jisp":"jisp","vnd.joost.joda-archive":"joda","vnd.kahootz":["ktz","ktr"],"vnd.kde.karbon":"karbon","vnd.kde.kchart":"chrt","vnd.kde.kformula":"kfo","vnd.kde.kivio":"flw","vnd.kde.kontour":"kon","vnd.kde.kpresenter":["kpr","kpt"],"vnd.kde.kspread":"ksp","vnd.kde.kword":["kwd","kwt"],"vnd.kenameaapp":"htke","vnd.kidspiration":"kia","vnd.kinar":["kne","knp"],"vnd.koan":["skp","skd","skt","skm"],"vnd.kodak-descriptor":"sse","vnd.las.las+xml":"lasxml","vnd.llamagraphics.life-balance.desktop":"lbd","vnd.llamagraphics.life-balance.exchange+xml":"lbe","vnd.lotus-1-2-3":"123","vnd.lotus-approach":"apr","vnd.lotus-freelance":"pre","vnd.lotus-notes":"nsf","vnd.lotus-organizer":"org","vnd.lotus-screencam":"scm","vnd.lotus-wordpro":"lwp","vnd.macports.portpkg":"portpkg","vnd.mcd":"mcd","vnd.medcalcdata":"mc1","vnd.mediastation.cdkey":"cdkey","vnd.mfer":"mwf","vnd.mfmp":"mfm","vnd.micrografx.flo":"flo","vnd.micrografx.igx":"igx","vnd.mif":"mif","vnd.mobius.daf":"daf","vnd.mobius.dis":"dis","vnd.mobius.mbk":"mbk","vnd.mobius.mqy":"mqy","vnd.mobius.msl":"msl","vnd.mobius.plc":"plc","vnd.mobius.txf":"txf","vnd.mophun.application":"mpn","vnd.mophun.certificate":"mpc","vnd.ms-artgalry":"cil","vnd.ms-cab-compressed":"cab","vnd.ms-excel.addin.macroenabled.12":"xlam","vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","vnd.ms-excel.sheet.macroenabled.12":"xlsm","vnd.ms-excel.template.macroenabled.12":"xltm","vnd.ms-fontobject":"eot","vnd.ms-htmlhelp":"chm","vnd.ms-ims":"ims","vnd.ms-lrm":"lrm","vnd.ms-officetheme":"thmx","vnd.ms-powerpoint.addin.macroenabled.12":"ppam","vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","vnd.ms-powerpoint.slide.macroenabled.12":"sldm","vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","vnd.ms-powerpoint.template.macroenabled.12":"potm","vnd.ms-project":["mpp","mpt"],"vnd.ms-word.document.macroenabled.12":"docm","vnd.ms-word.template.macroenabled.12":"dotm","vnd.ms-works":["wps","wks","wcm","wdb"],"vnd.ms-wpl":"wpl","vnd.ms-xpsdocument":"xps","vnd.mseq":"mseq","vnd.musician":"mus","vnd.muvee.style":"msty","vnd.mynfc":"taglet","vnd.neurolanguage.nlu":"nlu","vnd.nitf":["ntf","nitf"],"vnd.noblenet-directory":"nnd","vnd.noblenet-sealer":"nns","vnd.noblenet-web":"nnw","vnd.nokia.n-gage.data":"ngdat","vnd.nokia.n-gage.symbian.install":"n-gage","vnd.nokia.radio-preset":"rpst","vnd.nokia.radio-presets":"rpss","vnd.novadigm.edm":"edm","vnd.novadigm.edx":"edx","vnd.novadigm.ext":"ext","vnd.oasis.opendocument.chart-template":"otc","vnd.oasis.opendocument.formula-template":"odft","vnd.oasis.opendocument.image-template":"oti","vnd.olpc-sugar":"xo","vnd.oma.dd2+xml":"dd2","vnd.openofficeorg.extension":"oxt","vnd.openxmlformats-officedocument.presentationml.slide":"sldx","vnd.osgeo.mapguide.package":"mgp","vnd.osgi.dp":"dp","vnd.osgi.subsystem":"esa","vnd.palm":["pdb","pqa","oprc"],"vnd.pawaafile":"paw","vnd.pg.format":"str","vnd.pg.osasli":"ei6","vnd.picsel":"efif","vnd.pmi.widget":"wg","vnd.pocketlearn":"plf","vnd.powerbuilder6":"pbd","vnd.previewsystems.box":"box","vnd.proteus.magazine":"mgz","vnd.publishare-delta-tree":"qps","vnd.pvi.ptid1":"ptid","vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"vnd.realvnc.bed":"bed","vnd.recordare.musicxml":"mxl","vnd.recordare.musicxml+xml":"musicxml","vnd.rig.cryptonote":"cryptonote","vnd.rn-realmedia":"rm","vnd.rn-realmedia-vbr":"rmvb","vnd.route66.link66+xml":"link66","vnd.sailingtracker.track":"st","vnd.seemail":"see","vnd.sema":"sema","vnd.semd":"semd","vnd.semf":"semf","vnd.shana.informed.formdata":"ifm","vnd.shana.informed.formtemplate":"itp","vnd.shana.informed.interchange":"iif","vnd.shana.informed.package":"ipk","vnd.simtech-mindmapper":["twd","twds"],"vnd.smart.teacher":"teacher","vnd.solent.sdkm+xml":["sdkm","sdkd"],"vnd.spotfire.dxp":"dxp","vnd.spotfire.sfs":"sfs","vnd.stepmania.package":"smzip","vnd.stepmania.stepchart":"sm","vnd.sus-calendar":["sus","susp"],"vnd.svd":"svd","vnd.syncml+xml":"xsm","vnd.syncml.dm+wbxml":"bdm","vnd.syncml.dm+xml":"xdm","vnd.tao.intent-module-archive":"tao","vnd.tcpdump.pcap":["pcap","cap","dmp"],"vnd.tmobile-livetv":"tmo","vnd.trid.tpt":"tpt","vnd.triscape.mxs":"mxs","vnd.trueapp":"tra","vnd.ufdl":["ufd","ufdl"],"vnd.uiq.theme":"utz","vnd.umajin":"umj","vnd.unity":"unityweb","vnd.uoml+xml":"uoml","vnd.vcx":"vcx","vnd.visionary":"vis","vnd.vsf":"vsf","vnd.webturbo":"wtb","vnd.wolfram.player":"nbp","vnd.wqd":"wqd","vnd.wt.stf":"stf","vnd.xara":"xar","vnd.xfdl":"xfdl","vnd.yamaha.hv-dic":"hvd","vnd.yamaha.hv-script":"hvs","vnd.yamaha.hv-voice":"hvp","vnd.yamaha.openscoreformat":"osf","vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","vnd.yamaha.smaf-audio":"saf","vnd.yamaha.smaf-phrase":"spf","vnd.yellowriver-custom-menu":"cmp","vnd.zul":["zir","zirz"],"vnd.zzazz.deck+xml":"zaz","voicexml+xml":"vxml",widget:"wgt",winhlp:"hlp","wsdl+xml":"wsdl","wspolicy+xml":"wspolicy","x-ace-compressed":"ace","x-authorware-bin":["aab","x32","u32","vox"],"x-authorware-map":"aam","x-authorware-seg":"aas","x-blorb":["blb","blorb"],"x-bzip":"bz","x-bzip2":["bz2","boz"],"x-cfs-compressed":"cfs","x-chat":"chat","x-conference":"nsc","x-dgc-compressed":"dgc","x-dtbncx+xml":"ncx","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-eva":"eva","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-freearc":"arc","x-gca-compressed":"gca","x-glulx":"ulx","x-gramps-xml":"gramps","x-install-instructions":"install","x-lzh-compressed":["lzh","lha"],"x-mie":"mie","x-mobipocket-ebook":["prc","mobi"],"x-ms-application":"application","x-ms-shortcut":"lnk","x-ms-xbap":"xbap","x-msbinder":"obd","x-mscardfile":"crd","x-msclip":"clp","application/x-ms-installer":"msi","x-msmediaview":["mvb","m13","m14"],"x-msmetafile":["wmf","wmz","emf","emz"],"x-msmoney":"mny","x-mspublisher":"pub","x-msschedule":"scd","x-msterminal":"trm","x-mswrite":"wri","x-nzb":"nzb","x-pkcs12":["p12","pfx"],"x-pkcs7-certificates":["p7b","spc"],"x-research-info-systems":"ris","x-silverlight-app":"xap","x-sql":"sql","x-stuffitx":"sitx","x-subrip":"srt","x-t3vm-image":"t3","x-tex-tfm":"tfm","x-tgif":"obj","x-xliff+xml":"xlf","x-xz":"xz","x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"xaml+xml":"xaml","xcap-diff+xml":"xdf","xenc+xml":"xenc","xml-dtd":"dtd","xop+xml":"xop","xproc+xml":"xpl","xslt+xml":"xslt","xv+xml":["mxml","xhvml","xvml","xvm"],yang:"yang","yin+xml":"yin",envoy:"evy",fractals:"fif","internet-property-stream":"acx",olescript:"axs","vnd.ms-outlook":"msg","vnd.ms-pkicertstore":"sst","x-compress":"z","x-perfmon":["pma","pmc","pmr","pmw"],"ynd.ms-pkipko":"pko",gzip:["gz","tgz"],"smil+xml":["smi","smil"],"vnd.debian.binary-package":["deb","udeb"],"vnd.hzn-3d-crossword":"x3d","vnd.sqlite3":["db","sqlite","sqlite3","db-wal","sqlite-wal","db-shm","sqlite-shm"],"vnd.wap.sic":"sic","vnd.wap.slc":"slc","x-krita":["kra","krz"],"x-perl":["pm","pl"],yaml:["yaml","yml"]},audio:{amr:"amr","amr-wb":"awb",annodex:"axa",basic:["au","snd"],flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"prs.sid":"sid","x-aiff":"aifc","x-gsm":"gsm","x-ms-wma":"wma","x-ms-wax":"wax","x-pn-realaudio":"ram","x-realaudio":"ra","x-sd2":"sd2",adpcm:"adp",mp4:"mp4a",s3m:"s3m",silk:"sil","vnd.dece.audio":["uva","uvva"],"vnd.digital-winds":"eol","vnd.dra":"dra","vnd.dts":"dts","vnd.dts.hd":"dtshd","vnd.lucent.voice":"lvp","vnd.ms-playready.media.pya":"pya","vnd.nuera.ecelp4800":"ecelp4800","vnd.nuera.ecelp7470":"ecelp7470","vnd.nuera.ecelp9600":"ecelp9600","vnd.rip":"rip",webm:"weba","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",aac:"aac",aiff:["aiff","aif","aff"],opus:"opus",wav:"wav"},chemical:{"x-alchemy":"alc","x-cache":["cac","cache"],"x-cache-csf":"csf","x-cactvs-binary":["cbin","cascii","ctab"],"x-cdx":"cdx","x-chem3d":"c3d","x-cif":"cif","x-cmdf":"cmdf","x-cml":"cml","x-compass":"cpa","x-crossfire":"bsd","x-csml":["csml","csm"],"x-ctx":"ctx","x-cxf":["cxf","cef"],"x-embl-dl-nucleotide":["emb","embl"],"x-gamess-input":["inp","gam","gamin"],"x-gaussian-checkpoint":["fch","fchk"],"x-gaussian-cube":"cub","x-gaussian-input":["gau","gjc","gjf"],"x-gaussian-log":"gal","x-gcg8-sequence":"gcg","x-genbank":"gen","x-hin":"hin","x-isostar":["istr","ist"],"x-jcamp-dx":["jdx","dx"],"x-kinemage":"kin","x-macmolecule":"mcm","x-macromodel-input":"mmod","x-mdl-molfile":"mol","x-mdl-rdfile":"rd","x-mdl-rxnfile":"rxn","x-mdl-sdfile":"sd","x-mdl-tgf":"tgf","x-mmcif":"mcif","x-mol2":"mol2","x-molconn-Z":"b","x-mopac-graph":"gpt","x-mopac-input":["mop","mopcrt","zmt"],"x-mopac-out":"moo","x-ncbi-asn1":"asn","x-ncbi-asn1-ascii":["prt","ent"],"x-ncbi-asn1-binary":"val","x-rosdal":"ros","x-swissprot":"sw","x-vamas-iso14976":"vms","x-vmd":"vmd","x-xtel":"xtel","x-xyz":"xyz"},font:{otf:"otf",woff:"woff",woff2:"woff2"},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe","jfif","jfif-tbnl","jif"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"vnd.djvu":["djvu","djv"],"vnd.wap.wbmp":"wbmp","x-canon-cr2":"cr2","x-canon-crw":"crw","x-cmu-raster":"ras","x-coreldraw":"cdr","x-coreldrawpattern":"pat","x-coreldrawtemplate":"cdt","x-corelphotopaint":"cpt","x-epson-erf":"erf","x-icon":"ico","x-jg":"art","x-jng":"jng","x-nikon-nef":"nef","x-olympus-orf":"orf","x-portable-anymap":"pnm","x-portable-bitmap":"pbm","x-portable-graymap":"pgm","x-portable-pixmap":"ppm","x-rgb":"rgb","x-xbitmap":"xbm","x-xpixmap":"xpm","x-xwindowdump":"xwd",bmp:"bmp",cgm:"cgm",g3fax:"g3",ktx:"ktx","prs.btif":"btif",sgi:"sgi","vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"vnd.dwg":"dwg","vnd.dxf":"dxf","vnd.fastbidsheet":"fbs","vnd.fpx":"fpx","vnd.fst":"fst","vnd.fujixerox.edmics-mmr":"mmr","vnd.fujixerox.edmics-rlc":"rlc","vnd.ms-modi":"mdi","vnd.ms-photo":"wdp","vnd.net-fpx":"npx","vnd.xiff":"xif",webp:"webp","x-3ds":"3ds","x-cmx":"cmx","x-freehand":["fh","fhc","fh4","fh5","fh7"],"x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod",avif:"avifs",heic:["heif","heic"],pjpeg:["pjpg"],"vnd.adobe.photoshop":"psd","x-adobe-dng":"dng","x-fuji-raf":"raf","x-icns":"icns","x-kodak-dcr":"dcr","x-kodak-k25":"k25","x-kodak-kdc":"kdc","x-minolta-mrw":"mrw","x-panasonic-raw":["raw","rw2","rwl"],"x-pentax-pef":["pef","ptx"],"x-sigma-x3f":"x3f","x-sony-arw":"arw","x-sony-sr2":"sr2","x-sony-srf":"srf"},message:{rfc822:["eml","mime","mht","mhtml","nws"]},model:{iges:["igs","iges"],mesh:["msh","mesh","silo"],vrml:["wrl","vrml"],"x3d+vrml":["x3dv","x3dvz"],"x3d+xml":"x3dz","x3d+binary":["x3db","x3dbz"],"vnd.collada+xml":"dae","vnd.dwf":"dwf","vnd.gdl":"gdl","vnd.gtw":"gtw","vnd.mts":"mts","vnd.usdz+zip":"usdz","vnd.vtu":"vtu"},text:{"cache-manifest":["manifest","appcache"],calendar:["ics","icz","ifb"],css:"css",csv:"csv",h323:"323",html:["html","htm","shtml","stm"],iuls:"uls",plain:["txt","text","brf","conf","def","list","log","in","bas","diff","ksh"],richtext:"rtx",scriptlet:["sct","wsc"],texmacs:"tm","tab-separated-values":"tsv","vnd.sun.j2me.app-descriptor":"jad","vnd.wap.wml":"wml","vnd.wap.wmlscript":"wmls","x-bibtex":"bib","x-boo":"boo","x-c++hdr":["h++","hpp","hxx","hh"],"x-c++src":["c++","cpp","cxx","cc"],"x-component":"htc","x-dsrc":"d","x-diff":"patch","x-haskell":"hs","x-java":"java","x-literate-haskell":"lhs","x-moc":"moc","x-pascal":["p","pas","pp","inc"],"x-pcs-gcd":"gcd","x-python":"py","x-scala":"scala","x-setext":"etx","x-tcl":["tcl","tk"],"x-tex":["tex","ltx","sty","cls"],"x-vcalendar":"vcs","x-vcard":"vcf",n3:"n3","prs.lines.tag":"dsc",sgml:["sgml","sgm"],troff:["t","tr","roff","man","me","ms"],turtle:"ttl","uri-list":["uri","uris","urls"],vcard:"vcard","vnd.curl":"curl","vnd.curl.dcurl":"dcurl","vnd.curl.scurl":"scurl","vnd.curl.mcurl":"mcurl","vnd.dvb.subtitle":"sub","vnd.fly":"fly","vnd.fmi.flexstor":"flx","vnd.graphviz":"gv","vnd.in3d.3dml":"3dml","vnd.in3d.spot":"spot","x-asm":["s","asm"],"x-c":["c","h","dic"],"x-fortran":["f","for","f77","f90"],"x-opml":"opml","x-nfo":"nfo","x-sfv":"sfv","x-uuencode":"uu",webviewhtml:"htt",javascript:"js",json:"json",markdown:["md","markdown","mdown","markdn"],"vnd.wap.si":"si","vnd.wap.sl":"sl"},video:{avif:"avif","3gpp":"3gp",annodex:"axv",dl:"dl",dv:["dif","dv"],fli:"fli",gl:"gl",mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.dece.hd":["uvh","uvvh"],"vnd.dece.mobile":["uvm","uvvm"],"vnd.dece.pd":["uvp","uvvp"],"vnd.dece.sd":["uvs","uvvs"],"vnd.dece.video":["uvv","uvvv"],"vnd.dvb.file":"dvb","vnd.fvt":"fvt","vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv",mp2t:"ts"},"x-conference":{"x-cooltalk":"ice"},"x-world":{"x-vrml":["vrm","flr","wrz","xaf","xof"]}};(()=>{const i={};for(const e of Object.keys(vl))for(const t of Object.keys(vl[e])){const n=vl[e][t];if(typeof n=="string")i[n]=e+"/"+t;else for(let s=0;s<n.length;s++)i[n[s]]=e+"/"+t}return i})(),bb(Ko);const dC="E84#E3C4!8C4&A1",ju=["E84#E3C4!8C4&A1123*@!"];async function Mt(i){try{const e=await fetch(i);if(!e.ok)return!1;const t=await e.blob();try{const n=new gl(new tr(t),{password:dC}),o=(await n.getEntries()).find(a=>!a.directory&&a.filename.endsWith(".json"));if(!o)return await n.close(),!1;const r=await o.getData(new fw);return await n.close(),JSON.parse(r.trim())}catch{const n=await t.text();try{return JSON.parse(n.trim())}catch(s){throw console.error(`[loadModelFile] JSON parse error: ${i}`,s),s}}}catch(e){return console.error("[loadModelFile] 加载失败",`${i} ${e}`),!1}}function hC(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}class _s{events={};on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}emit(e,...t){this.events[e]&&this.events[e].forEach(n=>n(...t))}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(n=>n!==t))}}const Wu="35aa3175ce8b1a55331e.64c93d5e3268979d98c900",bl=new Map;function sr(i){let e=null;if(typeof i=="string")e=document.querySelector(i);else if(i instanceof HTMLElement)e=i;else if(i&&typeof i=="object"){const n=i.container??i;n instanceof HTMLElement&&(e=n)}if(!e)return;const t=bl.get(e);if(t){try{t.destroy?.()}catch{}bl.delete(e)}}async function wl(i,e){if(i)try{let t=null;if(typeof e=="string")t=document.querySelector(e);else if(e instanceof HTMLElement)t=e;else if(e&&typeof e=="object"){const o=e.container??e;o instanceof HTMLElement&&(t=o)}if(!t){console.warn("applyWatermark: 未提供有效容器,跳过水印添加");return}sr(t);const{Watermark:n}=await Promise.resolve().then(()=>wR),s=new n({content:i.content||"晨曦雷霆BIM",fontFamily:i.font||"Arial, sans-serif",fontSize:i.fontSize?`${i.fontSize}px`:"25px",fontWeight:i.fontWeight||"bold",rotate:i.rotate??0,fontColor:i.color||"rgba(225, 225, 225, 1.0)",zIndex:i.zIndex??99999,parent:t,backgroundRepeat:"no-repeat",backgroundPosition:"center"});await s.create(),bl.set(t,s)}catch(t){console.error("添加水印出错:",t)}}class qu{cesium;viewer;watermarkEnabled="";setWatermarkEnabled(e){this.watermarkEnabled=e}modelList=[];hasLoaded3dTiles={};mapRecordModelId={};mapTileset={};BIMmodelId="";lazyLoadingCount=0;events=new _s;options={flyTo:!0,flyToDuration:0,loadTreeNodeDetails:!0,loadTreeNodeDetailsUrl:"/elementInfo.zip",loadTree:!0,loadTreeUrl:"/allElementsInfo.zip",boxRegionUrl:"/BoundingBoxInfo.zip",regionUrl:"/region.zip",batchIDInfoUrl:"/batchIDInfo.zip",enabledSection:!0,delay:0,tilesetOptions:{cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,backFaceCulling:!0,colorBlendAmount:0,minimumPixelSize:128,maximumScreenSpaceError:32,skipLevelOfDetail:!0,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:128,skipLevels:5,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!1,maximumMemoryUsage:4096*10,preloadWhenHidden:!0,preferLeaves:!0,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.002,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorHeightFalloff:.25,foveatedConeSize:0,foveatedTimeDelay:10,foveatedMinimumScreenSpaceErrorRelaxation:0}};constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.options.tilesetOptions&&(this.options.tilesetOptions.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE)}deleteAllModels(){const e=[];return Object.keys(this.mapTileset).forEach(t=>{const n=this.mapTileset[t];n&&(this.viewer.scene.primitives.remove(n),e.push(t)),delete this.mapTileset[t],delete this.hasLoaded3dTiles[t],delete this.mapRecordModelId[t]}),this.modelList=[],this.viewer.scene.requestRender(),this.events.emit("updateModels",{modelList:[]}),e}deleteModels(e){const t=[];return e.forEach(({modelId:n})=>{const s=this.mapTileset[n];s&&(this.viewer.scene.primitives.remove(s),t.push(n)),delete this.mapTileset[n],delete this.hasLoaded3dTiles[n],delete this.mapRecordModelId[n]}),this.modelList=this.modelList.filter(n=>!t.includes(n.modelId)),this.viewer.scene.requestRender(),this.events.emit("updateModels",{modelList:this.modelList}),t}showModels(e){const t=[];return e.forEach(n=>{const s=`${n.modelId}`,o=this.mapTileset[s];o&&(o.show=!!n.show,t.push(s))}),t.length&&this.viewer.scene.requestRender(),t}async addModels({files:e,fileNames:t,options:n}){const s=e||t||[];s.length>0&&await this.add3DTilesModel(s,n)}async add3DTilesModel(e,t){const n=t?Rv({},this.options,t):{...this.options};if(e?.length){for(const s of e){const o=`${s.modelId}`;if(this.mapRecordModelId[o])continue;const r=`${s.outPutPath}${s.dbName}/tileset.json`;this.modelList.push({...s,url:r,state:In.NotLoaded}),this.mapRecordModelId[o]=!1}await this.load3DTilesModel(n)}}async load3DTilesModel(e){const t=this.modelList.filter(r=>r.state===In.NotLoaded);if(!t.length)return;const n=t.length;this.events.emit("loadingStatus",`正在加载 ${n} 个模型`);let s=0,o=!1;if(t.length>0){const r=t[0],a=`${r.outPutPath}${r.dbName}/config.zip`;try{const l=await Mt(a);l&&typeof l=="object"&&this.events.emit("configureLoaded",l)}catch{}}for(const r of t){s++;try{r.state=In.Loading;const a=r.url,l=this.getBaseUrlPath(a);e.loadTreeNodeDetails=!1,e.loadTreeNodeDetails&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}构件信息`);let c=e.loadTreeNodeDetails?await Mt(`${l}${e.loadTreeNodeDetailsUrl}`):!1;e.loadTree=!1,e.loadTree&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}目录树`);const h=e.loadTree?await Mt(`${l}${e.loadTreeUrl}`):!1;this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}模型数据`);const u=e.boxRegionUrl?await Mt(`${l}${e.boxRegionUrl}`):!1,p=e.batchIDInfoUrl?await Mt(`${l}${e.batchIDInfoUrl}`):!1;p&&(c||(c=p));const f=await this.loadTilesetWithZipSupport(a,r.modelId,e.tilesetOptions||{},this.cesium);this.viewer.scene.primitives.add(f),await f.readyPromise;const m=`${f?.asset?.tilesetVersion??r.modelId}`;this.mapTileset[`${r.modelId}`]=f;const y={versionId:m,selectedFn:e.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:r.url,treeUrl:`${l}${e.loadTreeUrl}`,nodeUrl:`${l}${e.loadTreeNodeDetailsUrl}`,formData:r.formData,type:"BIM"},node:c||null,tree:h||null,box:null};if(u?.min&&u?.max){const g={x:u.min.X,y:u.min.Y,z:u.min.Z},A={x:u.max.X,y:u.max.Y,z:u.max.Z},v={x:(g.x+A.x)/2,y:(g.y+A.y)/2,z:(g.z+A.z)/2};y.box={min:g,max:A,center:v}}if(!r.formData){const g=await Mt(`${r.outPutPath}${r.dbName}${e.regionUrl}`);if(g)r.formData={modelId:r.modelId.toString(),longitude:g.Longitude,latitude:g.Latitude,distance:1e-6,rotation:30,totalRotation:g.DAngle||0,height:g.MinHeight,lonlat:1e-5,heightDistance:1,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:g?.X||0,Y:g?.Y||0,Z:g?.Z||0};else{const A=t.indexOf(r);r.formData={modelId:r.modelId.toString(),longitude:118.12548706388897,latitude:24.596796919444404,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:0,lonlat:1e-5,modelOptions:[{value:A+1,label:r.modelName}],X:0,Y:0,Z:0}}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1,y.model.formData=r.formData),f.leiting=y,Ja({Cesium:this.cesium,tileset:f}),r.state=In.Loaded,this.mapRecordModelId[r.modelId]=!0,this.events.emit("tilesetLoaded",f),e.tilesLoad3dTiles&&e.tilesLoad3dTiles(f),!o&&e.flyTo&&(this.BIMmodelId=r.modelId,this.flyToTileset({modelId:this.BIMmodelId,options:{duration:e.flyToDuration??0}}),o=!0),e.delay&&await new Promise(g=>setTimeout(g,e.delay))}catch(a){console.error(`模型 ${r.modelName} 加载失败:`,a),this.events.emit("loadingStatus",`模型 ${r.modelName} 加载失败`),r.state=In.Error}}e.mountAll3Dtiles&&e.mountAll3Dtiles(this.modelList),e.onMountAll3Dtiles&&e.onMountAll3Dtiles(this.modelList),this.events.emit("loadingStatus",""),this.events.emit("mountAll3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset})}async addOSGB({files:e,options:t}){const n=this.cesium;if(!e?.length)return;this.events.emit("loadingStatus",`正在加载 ${e.length} 个倾斜摄影模型`);let s=!1,o=0;for(const r of e){o++,this.events.emit("loadingStatus",`正在加载第 ${o}/${e.length} 个模型: 加载${r.modelName}`);try{const{outPutPath:a,dbName:l,modelId:c}=r,h=/^(https?|atom):\/\//i.test(a)?a:`${window.location.origin}${a}`,u=`${h}${l}/tileset.json`,p=await n.Cesium3DTileset.fromUrl(u,{maximumScreenSpaceError:16,preferLeaves:!0,cullWithChildrenBounds:!0,...t?.tilesetOptions});if(p.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE,this.viewer.scene.primitives.add(p),await p.readyPromise,this.mapTileset[`${c}`]=p,this.hasLoaded3dTiles[`${c}`]=(this.hasLoaded3dTiles[`${c}`]||0)+1,this.mapRecordModelId[`${c}`]=!0,!r?.formData){const f=await Mt(`${h}${l}${this.options.regionUrl}`);if(f)r.formData={modelId:r.modelId.toString(),longitude:f.Longitude??f.longitude,latitude:f.Latitude??f.latitude,distance:1e-5,rotation:0,totalRotation:f.DAngle??f.totalRotation??0,heightDistance:1,height:f.MinHeight??f.height??0,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:f?.X||0,Y:f?.Y||0,Z:f?.Z||0};else{const m=p.root.computedTransform;if(m){const y=n.Matrix4.fromColumnMajorArray(m),g=n.Matrix4.getTranslation(y,new n.Cartesian3),A=n.Ellipsoid.WGS84.cartesianToCartographic(g),v=n.Math.toDegrees(A.longitude),b=n.Math.toDegrees(A.latitude),C=A.height;r.formData={modelId:r.modelId.toString(),longitude:v,latitude:b,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:C,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:0,Y:0,Z:0}}else console.warn(`OSGB模型 ${c} 无法获取初始位置信息`)}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1),p.leiting={versionId:`${p?.asset?.tilesetVersion??c}`,selectedFn:t?.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:u,formData:r.formData,type:"OSGB"},box:null},Ja({Cesium:this.cesium,tileset:p}),this.modelList.push({...r,url:u,state:In.Loaded}),!s&&t?.flyTo&&(this.BIMmodelId=r.modelId,this.viewer.zoomTo(p),s=!0)}catch(a){console.error(`OSGB模型 ${r.dbName} 加载失败:`,a);continue}}this.events.emit("loadingStatus",""),this.events.emit("onMountAllOsgb3Dtiles",{modelList:this.modelList,mapTileset:this.mapTileset}),t?.onMountAllOsgb3Dtiles(this.modelList)}updateOSGBMatrix(e){const{X:t,Y:n,Z:s,modelId:o}=e,r=this.cesium,a=this.mapTileset[o];if(!a){console.warn("tileSet not found for modelId:",o);return}let l=t||0,c=n||0,h=s||0;const u=a.boundingSphere.center,p=r.Transforms.eastNorthUpToFixedFrame(u),f=new r.Cartesian3(l,c,h),m=r.Matrix4.multiplyByPoint(p,f,new r.Cartesian3(0,0,0)),y=r.Cartesian3.subtract(m,u,new r.Cartesian3);a.modelMatrix=r.Matrix4.fromTranslation(y)}async flyToTileset({modelId:e=this.BIMmodelId,options:t={}}={}){const s=this.getMapTileset()[e];if(!s||!this.viewer)return;const{complete:o,cancel:r,...a}=t,l=this.modelList.find(h=>h.modelId===e);if(l)try{const h=`${l.outPutPath}${l.dbName}/cameraView.zip`,u=await Mt(h);if(u&&u.position&&u.orientation){const p=new this.cesium.Cartesian3(u.position.x,u.position.y,u.position.z),f=new this.cesium.HeadingPitchRoll(u.orientation.heading,u.orientation.pitch,u.orientation.roll);this.viewer.camera.flyTo({destination:p,orientation:f,duration:u.duration??1}),o&&o();return}}catch(h){console.warn("[flyToTileset] 读取 cameraView.zip 失败,回退到默认视角",h)}const c={duration:0,...a};this.viewer.flyTo(s,c).then(h=>{h?o&&o():r&&r()}).catch(h=>{r&&r(),console.error("FlyTo error",h)})}getMapTileset(){return this.mapTileset}getBIMmodelId(){return this.BIMmodelId}getModelList(){return this.modelList}setMapTileset(e){this.mapTileset=e}setBIMmodelId(e){this.BIMmodelId=e}setModelList(e){this.modelList=e}getBaseUrlPath(e){const t=/^(https?|atom):\/\//i.test(e)?e:`${window.location.origin}${e}`,n=t.lastIndexOf("/");return n===-1?".":t.substr(0,n)}async loadTilesetWithZipSupport(e,t,n,s){try{const o=encodeURI(`${this.getBaseUrlPath(e)}/tileset.zip`),a=(await fetch(o,{method:"HEAD"})).status===200;if(sr(this.viewer?.container),a){const l=await Mt(o);if(l){l?.asset?.watermark&&await wl(l.asset.watermark,this.viewer?.container),ju.includes(this.watermarkEnabled)&&sr(this.viewer?.container);const c=this.getBaseUrlPath(e),h=f=>{!f||typeof f!="object"||(typeof f.uri=="string"&&!/^(data:|https?:|atom:)\/\//i.test(f.uri)&&(f.uri=encodeURI(`${c}/${f.uri.replace(/^\.?\//,"")}`)),Object.values(f).forEach(m=>{if(Array.isArray(m)){m.forEach(y=>h(y));return}m&&typeof m=="object"&&h(m)}))};h(l);const u=`data:text/plain;base64,${btoa(unescape(encodeURIComponent(JSON.stringify(l))))}`,p=new s.Resource({url:u});try{return await s.Cesium3DTileset.fromUrl(p,{id:t,...n})}catch{return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...n})}}}return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...n})}catch{return await s.Cesium3DTileset.fromUrl(e,{url:e,id:t,...n})}}async loadTreeForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting.tree)return t.leiting.tree;const n=t.leiting.model?.modelName||e,s=t.leiting.model?.treeUrl;if(!t.leiting.model?.dbName&&!s)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${n} 目录树...`);try{if(s){const r=await Mt(s);if(Ho(r)&&r[0].name&&(r[0].name=n),r)return t.leiting.tree=r,r}}catch(r){console.error(`Failed to load tree for model ${e}:`,r)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}async _loadNodeDetailsForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting?.node?.nodeExtras)return t.leiting.node;const n=t.leiting.model?.nodeUrl,s=t.leiting.model?.modelName||e;if(!n)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${s} 构件详情...`);try{const o=await Mt(n);if(o)return o.batchIdEIDInfos||(o.batchIdEIDInfos=t.leiting.node.batchIdEIDInfos),t.leiting.node=o,o}catch(o){console.error(`Failed to load node details for model ${e}:`,o)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}async loadNodeDetailsForModel(e){const t=this.mapTileset[e];if(!t||!t.leiting)return null;if(t.leiting?.node?.nodeExtras)return t.leiting.node;const n=t.leiting.model?.nodeUrl,s=t.leiting.model?.modelName||e;if(!n)return null;this.lazyLoadingCount++,this.events.emit("loadingStatus",`正在加载 ${s} 构件详情...`);try{const o=await Mt(n);if(o)return o.batchIdEIDInfos||(o.batchIdEIDInfos=t.leiting.node.batchIdEIDInfos),t.leiting.node=o,o}catch(o){console.error(`Failed to load node details for model ${e}:`,o)}finally{this.lazyLoadingCount--,this.lazyLoadingCount<=0&&(this.lazyLoadingCount=0,this.events.emit("loadingStatus",""))}return null}}const Ku={normal:0,process:2},uC={color:1};function Xu(i){return i===1||i==="exist"?1:i===2||i==="process"?2:0}function _n(i){return Number.isNaN(i)?0:i<=1?Math.min(Math.max(i,0),1):Math.min(Math.max(i/255,0),1)}function Ju(i){return Number.isNaN(i)?1:i<=1?Math.min(Math.max(i,0),1):1}function Cl(i){if(!i)return null;const e=Number(i.r),t=Number(i.g),n=Number(i.b),s=i.a===void 0?1:Number(i.a);if([e,t,n,s].some(l=>Number.isNaN(l)))return null;const o=Math.round(e*255),r=Math.round(t*255),a=Math.round(n*255);return`rgba(${o},${r},${a},${s})`}function fC(i){if(!i||typeof i!="string")return null;const t=i.replace(/\s+/g,"").match(/^rgba?\((\d+),(\d+),(\d+)(?:,([0-9.]+))?\)$/i);if(!t)return null;const n=Number(t[1]),s=Number(t[2]),o=Number(t[3]),r=t[4]===void 0?1:Number(t[4]);return[n,s,o,r].some(a=>Number.isNaN(a))?null:{r:Math.min(Math.max(n/255,0),1),g:Math.min(Math.max(s/255,0),1),b:Math.min(Math.max(o/255,0),1),a:Math.min(Math.max(r,0),1)}}function pC(i){if(i==null)return null;const e=Number(i);return Number.isNaN(e)?null:e}function mC(i){const e=i.lastIndexOf("-"),t=i.substring(0,e),n=i.substring(e+1);return[t,n]}function El(i){if(!i)return null;const e=i.Min??i.min,t=i.Max??i.max;if(!e||!t)return null;const n=Number(e.x??e.X),s=Number(e.y??e.Y),o=Number(e.z??e.Z),r=Number(t.x??t.X),a=Number(t.y??t.Y),l=Number(t.z??t.Z);return[n,s,o,r,a,l].some(c=>Number.isNaN(c))?null:{min:{x:n,y:s,z:o},max:{x:r,y:a,z:l}}}function ks(i,e){if(e)return`${e}`;const t=i?.leiting?.model?.modelId??i?.modelId??i?.id;return t==null?null:`${t}`}function gC(i,e){if(e==null)return null;const t=i?.leiting?.node;if(!t)return null;const n=`${e}`,s=t?.[n],o=El(s?.box3??s?.box);if(o)return o;const r=t?.element?.[n]??t?.elements?.[n]??t?.nodeExtras?.element?.[n]??t?.nodeExtras?.elements?.[n];return El(r?.box3??r?.box)}function yC(i){const e=i?.leiting?.box;return e?El({min:e.min,max:e.max}):null}class AC{base;constructor(e){this.base=e}initTime(){const t=this.base.cesium.JulianDate.fromDate(new Date(2023,3,21,10,0));this.base.viewer.clock.currentTime=t,this.base.start=this.base.viewer.clock.currentTime.secondsOfDay*1e3}processAnimation(e,t,n,s=null){if(this.base.start==null)return;const o=this.base.start+(e?.delay??0),r=this.base.start+(e?.playtime??0)+(e?.delay??0);t<=o&&(e.cash=!0,e.groupData.forEach(a=>{const{batchIds:l,modelId:c,rgba:h}=a;if(Array.isArray(l)&&l[0]){l[0][1]=h;const u=n[c];u?u.push(l[0]):n[c]=[l[0]]}})),t>=o&&t<r&&(s!==null&&(this.base.viewer.scene.ambientLightIntensity=s),e.cash=!1,e.playCash=!0,e.groupData.forEach(a=>{const{batchIds:l,playTimeColor:c,modelId:h}=a;if(Array.isArray(l)&&l[0]){l[0][1]=c;const u=n[h];u?u.push(l[0]):n[h]=[l[0]]}})),t>=r&&(e.finished=!0)}onTick=e=>{if(!this.base.cesium||!this.base.viewer)return;const t=e?.currentTime?.secondsOfDay?e.currentTime.secondsOfDay*1e3:this.base.viewer.clock.currentTime.secondsOfDay*1e3,n={};Array.isArray(this.base.data)&&this.base.data.forEach(o=>{this.processAnimation(o,t,n,.1)});const s=Object.entries(n);if(s.forEach(([o,r])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:r})}),Object.keys(this.base.mapAnimations).forEach(o=>{const r=this.base.mapAnimations[o];r.length&&r.every(a=>a.finished)&&!this.base.clearedModelIds.has(o)&&(this.base.setTileSyltByConstructionProcessTracking({modelId:o,batchIds:[]}),this.base.clearedModelIds.add(o))}),this.base.recoverStaus){s.length&&(this.base.recoverStaus=!1);return}s.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(o=>{o.groupData.forEach(r=>{const{modelId:a}=r;this.base.setTileSyltByConstructionProcessTracking({modelId:a,batchIds:[]})}),this.base.recoverStaus=!0})};enableConstructionProgressTracking(){this.base.clearedModelIds.clear(),this.initTime(),this.base.groupBatchIds={},Array.isArray(this.base.data)&&(this.base.data.forEach(e=>{e.cash=!1,e.playCash=!1,e.groupData.forEach(t=>{const{batchIds:n,modelId:s,rgba:o}=t;if(Array.isArray(n)&&n[0]){n[0][1]=o;const r=this.base.groupBatchIds[s];r?r.push(n[0]):this.base.groupBatchIds[s]=[n[0]]}})}),Object.entries(this.base.groupBatchIds).forEach(([e,t])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t})})),this.base.viewer.clock.onTick.addEventListener(this.onTick)}disableConstructionProgressTracking(){this.base.viewer.clock.onTick.removeEventListener(this.onTick),this.base.viewer.scene.ambientLightIntensity=1,Array.isArray(this.base.data)&&this.base.data.forEach(e=>{e.cash=!0,e.playCash=!0,e.groupData.forEach(t=>{const{modelId:n}=t,s=[];this.base.setTileSyltByConstructionProcessTracking({modelId:n,batchIds:s})})}),this.base.start=null}freshConstructionProgressTracking(){const e=this.base.viewer.clock.currentTime.secondsOfDay*1e3,t={};Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.playCash=!1,this.processAnimation(s,e,t)});const n=Object.entries(t);n.forEach(([s,o])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:s,batchIds:o})}),n.length===0&&Array.isArray(this.base.data)&&this.base.data.forEach(s=>{s.groupData.forEach(o=>{const{modelId:r}=o;this.base.setTileSyltByConstructionProcessTracking({modelId:r,batchIds:[]})})})}reStartAnimation(){let e={};this.base.clearedModelIds.clear(),Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData.forEach(n=>{const{batchIds:s,modelId:o,rgba:r}=n;if(Array.isArray(s)&&s[0]){s[0][1]=r;const a=e[o];a?a.push(s[0]):e[o]=[s[0]]}})}),Object.entries(e).forEach(([t,n])=>{this.base.setTileSyltByConstructionProcessTracking({modelId:t,batchIds:n})}),this.initTime()}setAllConstructionProgressTracking(e){this.base.data=e,Array.isArray(this.base.data)&&this.base.data.forEach(t=>{t.cash=!1,t.playCash=!1,t.groupData=[],t.finished=!1,t.mergeCpts.forEach(n=>{const s=[];n.cpts.forEach(l=>{s.push({dbName:n.linkModelId,modelId:n.modelId,elementId:`${l}`,show:!0,rgba:t.rgba??{r:.2,g:.2,b:.2,a:.2}})});const o=Ku.process,r=uC.color,{allElements:a}=this.base.groupByModelId(s);this.base.mapAnimations[n.modelId]=this.base.mapAnimations[n.modelId]||[],this.base.mapAnimations[n.modelId].push(t),Object.entries(a).forEach(([l,c])=>{const[h,u]=mC(l),p=this.base.getTileSyltByConstructionProcessTracking({elementIds:c,modelId:h,color:u,colorRank:o,show:!0,selectionRank:r}),f=t?.playTimeColor?.r??1,m=t?.playTimeColor?.g??1,y=t?.playTimeColor?.b??0,g=t?.playTimeColor?.a??.1,A=this.base.setColor({r:f,g:m,b:y,a:g}),v=this.base.setColor(t.rgba??{r:.2,g:.2,b:.2,a:.2});t.groupData.push({modelId:h,batchIds:p,playTimeColor:A,rgba:v})})})})}}class vC{base;constructor(e){this.base=e}attachTileset(e,t,n){const s=this.base.cesium;this.base.handler||(this.base.handler=new s.ScreenSpaceEventHandler(this.base.viewer.scene.canvas));const o=ks(e,n);o&&(this.base.tilesetMap[o]=e),t&&(this.base.selectedColor=t),this.bindInputs()}bindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.setInputAction(async t=>{if(!this.base.clickToHighlightEnabled){await this.base.clearSelection();return}let n;try{n=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(n)&&n instanceof e.Cesium3DTileFeature){await this.base.clearSelection();const s=ks(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const a=this.base.viewer.scene.pickPosition(t.position);if(e.defined(a)){const h=e.Cartographic.fromCartesian(a),u=e.Math.toDegrees(h.longitude),p=e.Math.toDegrees(h.latitude),f=h.height;r=[u,p,f]}const c=(this.base.hasSelectedFeaturesMap[s]||[]).filter(h=>h.rank!==0);if(this.base.hasSelectedFeaturesMap[s]=[...c,{batchId:o,selectedColor:this.base.selectedColor,rank:0,point:r,isTrigger:!0}],this.base.setBaseStyle(s),await this.base.triggerSelectionChange(s),n.tileset.leiting?.selectedFn)if(n.tileset.leiting.node){const h=n.tileset.leiting.node.batchIdEIDInfos[o].elementID,u=n.tileset.leiting.node.nodeExtras.element[h];u.elementId=h,u.modelId=n.tileset.leiting.model.modelId,n.tileset.leiting.selectedFn({elementInfo:u,elementId:h,point:r,modelId:n.tileset.leiting.model.modelId,_propsData:u})}else n.tileset.leiting.selectedFn(null)}else await this.base.clearSelection()},e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.setInputAction(async t=>{let n;try{n=this.base.viewer.scene.pick(t.position)}catch{}if(e.defined(n)&&n instanceof e.Cesium3DTileFeature){const s=ks(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const a=this.base.viewer.scene.pickPosition(t.position);if(e.defined(a)){const l=e.Cartographic.fromCartesian(a),c=e.Math.toDegrees(l.longitude),h=e.Math.toDegrees(l.latitude),u=l.height;r=[c,h,u]}await this.base.toggleMultiSelect(s,o,this.base.selectedColor,r)}},e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{this.base.ensureSelectionDiv();const n=this.base.viewer?.scene?.screenSpaceCameraController;n&&this.base.cameraControllerState===null&&(this.base.cameraControllerState={enableRotate:n.enableRotate,enableTilt:n.enableTilt,enableLook:n.enableLook},n.enableRotate=!1,n.enableTilt=!1,n.enableLook=!1),this.base.selectStart=this.base.cesium.Cartesian2.clone(t.position),this.base.selectEnd=null,this.base.selectionDiv&&this.base.selectStart&&(this.base.selectionDiv.style.left=`${this.base.selectStart.x}px`,this.base.selectionDiv.style.top=`${this.base.selectStart.y}px`,this.base.selectionDiv.style.width="0px",this.base.selectionDiv.style.height="0px",this.base.selectionDiv.style.display="block")},e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(t=>{if(!this.base.selectStart||!this.base.selectionDiv)return;const n=performance.now();if(n-this.base.lastDrawTime<20)return;this.base.lastDrawTime=n,this.base.selectEnd=this.base.cesium.Cartesian2.clone(t.endPosition);const s=Math.min(this.base.selectStart.x,this.base.selectEnd.x),o=Math.min(this.base.selectStart.y,this.base.selectEnd.y),r=Math.abs(this.base.selectStart.x-this.base.selectEnd.x),a=Math.abs(this.base.selectStart.y-this.base.selectEnd.y);this.base.selectionDiv.style.left=`${s}px`,this.base.selectionDiv.style.top=`${o}px`,this.base.selectionDiv.style.width=`${r}px`,this.base.selectionDiv.style.height=`${a}px`,this.base.selectionDiv.style.backgroundColor="rgba(0, 255, 255, 0.5)",this.base.selectionDiv.style.position="absolute",this.base.selectionDiv.style.zIndex="2"},e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.setInputAction(async()=>{if(!this.base.selectStart||!this.base.selectionDiv)return;if(!this.base.selectStart||!this.base.selectEnd){this.base.selectionDiv.style.display="none";const n=this.base.viewer?.scene?.screenSpaceCameraController;n&&this.base.cameraControllerState!==null&&(n.enableRotate=this.base.cameraControllerState.enableRotate,n.enableTilt=this.base.cameraControllerState.enableTilt,n.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null);return}this.base.selectionDiv.style.display="none",await this.base.selectTilesInRectangle(this.base.selectStart,this.base.selectEnd,this.base.selectedColor),this.base.viewer.scene.requestRender(),this.base.selectStart=null,this.base.selectEnd=null;const t=this.base.viewer?.scene?.screenSpaceCameraController;t&&this.base.cameraControllerState!==null&&(t.enableRotate=this.base.cameraControllerState.enableRotate,t.enableTilt=this.base.cameraControllerState.enableTilt,t.enableLook=this.base.cameraControllerState.enableLook,this.base.cameraControllerState=null)},e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}unbindInputs(){if(!this.base.handler)return;const e=this.base.cesium;this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE,e.KeyboardEventModifier.CTRL),this.base.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP,e.KeyboardEventModifier.CTRL)}}class bC{cesium;viewer;data;handler;selectedColor="rgba(255,0,0,1.0)";tilesetMap={};hasSelectedFeaturesMap={};colorRankColor=[];showStateMap={};selectedPosition={x:null,y:null};selectionDiv=null;lastDrawTime=0;selectStart=null;selectEnd=null;cameraControllerState=null;start=null;groupBatchIds={};recoverStaus=!1;mapAnimations={};clearedModelIds=new Set;eidToBatchIdMap={};batchIdToElementIdMap={};animationModule;selectionModule;onSelectionChangeCallbacks=[];loadNodeDetailsForModel;loadNodeDetailsCallback;clickToHighlightEnabled=!0;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.animationModule=new AC(this),this.selectionModule=new vC(this)}attachTileset(e,t,n){this.selectionModule.attachTileset(e,t,n)}setLoadNodeDetailsCallback(e){this.loadNodeDetailsCallback=e}selectionChange(e){e&&typeof e=="function"&&this.onSelectionChangeCallbacks.push(e)}removeSelectionChange(e){this.onSelectionChangeCallbacks=this.onSelectionChangeCallbacks.filter(t=>t!==e)}async triggerSelectionChange(e){if(e)await this.loadNodeDetailsForModel(e);else{const t=Object.keys(this.hasSelectedFeaturesMap);t.length>0&&await Promise.all(t.map(n=>{try{return this.loadNodeDetailsForModel(n)}catch(s){return console.error(`Error loading node details for model ${n}:`,s),Promise.resolve()}}))}if(this.onSelectionChangeCallbacks.length>0){const t=await this.getSelected({rank:0});this.onSelectionChangeCallbacks.forEach(n=>{try{n(t)}catch(s){console.error("Selection callback error:",s)}})}}enableSelection(){this.selectionModule.bindInputs()}disableSelection(){this.selectionModule.unbindInputs()}async clearSelection(e){this.getTargetModelIds(e).forEach(n=>{const s=this.hasSelectedFeaturesMap[n];if(!s?.length)return;const o=s.filter(r=>r.rank!==0);o.length?(this.hasSelectedFeaturesMap[n]=o,this.setBaseStyle(n)):(delete this.hasSelectedFeaturesMap[n],this.applyShowStyleOnly(n))}),this.viewer.scene.requestRender(),await this.triggerSelectionChange(e)}clearExist(e){this.getTargetModelIds(e).forEach(n=>{const s=this.hasSelectedFeaturesMap[n];if(!s?.length)return;const o=s.filter(r=>r.rank!==1);o.length?(this.hasSelectedFeaturesMap[n]=o,this.setBaseStyle(n)):(delete this.hasSelectedFeaturesMap[n],this.applyShowStyleOnly(n))}),this.viewer.scene.requestRender()}clearProcess(e){this.getTargetModelIds(e).forEach(n=>{const s=this.hasSelectedFeaturesMap[n];if(!s?.length)return;const o=s.filter(r=>r.rank!==2);o.length?(this.hasSelectedFeaturesMap[n]=o,this.setBaseStyle(n)):(delete this.hasSelectedFeaturesMap[n],this.applyShowStyleOnly(n))}),this.viewer.scene.requestRender()}async clearAllHaveSelected(){this.getTargetModelIds().forEach(t=>{this.hasSelectedFeaturesMap[t]&&(delete this.hasSelectedFeaturesMap[t],this.applyShowStyleOnly(t))}),this.viewer.scene.requestRender(),await this.triggerSelectionChange()}async loadAllNodeDetailsForModel(){for(const e of Object.keys(this.tilesetMap))await this.loadNodeDetailsForModel(e)}getSelected(e){const t=e&&typeof e=="object"&&"rank"in e?e.rank:e,n=Xu(t),s=[];for(const o of Object.keys(this.hasSelectedFeaturesMap))(this.hasSelectedFeaturesMap[o]||[]).forEach(a=>{if(a.rank!==n)return;const l=fC(a.selectedColor);let c=this.getBatchIdToElementIdSync(a.batchId,o);c===null&&(c=a.batchId),a.isTrigger&&s.push({elementId:c,modelId:o,rgba:l||void 0,point:a?.point||void 0})});return s}getBatchIdToElementIdSync(e,t){if(this.batchIdToElementIdMap[t])return this.batchIdToElementIdMap[t].get(e)??null;const s=this.tilesetMap[t]?.leiting?.node?.batchIdEIDInfos;if(s&&Array.isArray(s)){const o=new Map;return s.forEach(r=>{r&&r.elementID&&o.set(`${r.batchId}`,`${r.elementID}`)}),this.batchIdToElementIdMap[t]=o,o.get(e)??null}return null}setAllConstructionProgressTracking(e){this.animationModule.setAllConstructionProgressTracking(e)}initTime(){this.animationModule.initTime()}processAnimation(e,t,n,s=null){this.animationModule.processAnimation(e,t,n,s)}onTick=e=>{this.animationModule.onTick(e)};enableConstructionProgressTracking(){this.animationModule.enableConstructionProgressTracking()}disableConstructionProgressTracking(){this.animationModule.disableConstructionProgressTracking()}freshConstructionProgressTracking(){this.animationModule.freshConstructionProgressTracking()}reStartAnimation(){this.animationModule.reStartAnimation()}setTileSyltByConstructionProcessTracking({modelId:e,batchIds:t}){const n=this.tilesetMap[e];if(!n)return;const s=n?.style?.show?.conditionsExpression?.conditions;Array.isArray(t)&&t.length?s?n.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s},color:{conditions:t}}):n.style=new this.cesium.Cesium3DTileStyle({color:{conditions:t}}):this.applyShowStyleOnly(e),this.viewer.scene.requestRender()}resumeFlyTo(){this.viewer.clock.shouldAnimate=!0}pauseFlyTo(){this.viewer.clock.shouldAnimate=!1}async flyToObjects({selectCpts:e,options:t}){if(!Array.isArray(e)||e.length===0)return;await this.clearSelection(),await this.setSelectColorUserModelCpt(e,{rank:0});const n=this.cesium,s=t?.scale??1,o=[];for(const r of e){const a=r?.modelId;if(a==null)continue;await this.loadNodeDetailsForModel(a);const l=r?.elementId,c=this.tilesetMap[`${a}`];if(!c)continue;const u=gC(c,l)||yC(c);if(!u)continue;const p=new n.Cartesian3(u.min.x,u.min.y,u.min.z),f=new n.Cartesian3(u.max.x,u.max.y,u.max.z),m=c?.root?.computedTransform??c?.modelMatrix;if(m){const y=n.Matrix4.multiplyByPoint(m,p,new n.Cartesian3),g=n.Matrix4.multiplyByPoint(m,f,new n.Cartesian3);o.push(y,g)}else o.push(p,f)}if(o.length){const r=n.BoundingSphere.fromPoints(o);r.radius=r.radius*s;const a=this.viewer.scene.camera,l=new n.HeadingPitchRange(a.heading,a.pitch,0);a.flyToBoundingSphere(r,{duration:t?.duration??0,complete:t?.complete,offset:l})}else{const r=e[0]?.modelId,a=r?this.tilesetMap[`${r}`]:null;a&&this.viewer.flyTo(a,{duration:t?.duration??0,complete:t?.complete})}}setBaseStyle(e){this.getTargetModelIds(e).forEach(n=>{this.setColorStyle(n)})}setColorStyle(e){this.updateTilesetStyle(e)}buildColorConditions(e){const t=this.tilesetMap[e],n=this.hasSelectedFeaturesMap[e];if(!t||!n?.length)return;const s=new Map;n.forEach(l=>{const c=s.get(l.batchId);(!c||l.rank>=c.rank)&&s.set(l.batchId,l)});const o=new Map;if(s.forEach(({batchId:l,selectedColor:c})=>{o.has(c)||o.set(c,new Set),o.get(c)?.add(l)}),this.colorRankColor.length){const l=new Set;this.colorRankColor.forEach(c=>{const h=o.get(c);h&&h.forEach(u=>l.add(u))}),o.forEach((c,h)=>{if(this.colorRankColor.includes(h))return;const u=new Set;c.forEach(p=>{l.has(p)||u.add(p)}),o.set(h,u)})}const r=[...this.colorRankColor.filter(l=>o.has(l)),...Array.from(o.keys()).filter(l=>!this.colorRankColor.includes(l))],a=[];return r.forEach(l=>{const c=o.get(l);if(!c||!c.size)return;const h=Array.from(c).join("|");h&&a.push([`(regExp('^(${h})$').test(\${id}))`,l])}),a.length?a:void 0}updateTilesetStyle(e){const t=this.tilesetMap[e];if(!t)return;t.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE;const n=this.showStateMap[e],s=n?this.buildShowConditions(n.batchIds,n.mode):void 0,o=this.buildColorConditions(e);s||o?t.style=new this.cesium.Cesium3DTileStyle({show:s?{conditions:s}:void 0,color:o?{conditions:o}:void 0}):t.style=void 0,this.viewer.scene.requestRender()}setShowStyle(e){this.getTargetModelIds(e?.modelId).forEach(n=>{const s=this.showStateMap[n]||{batchIds:[],mode:"include"};this.showStateMap[n]={batchIds:e?.batchIds??s.batchIds,mode:e?.mode??s.mode},this.updateTilesetStyle(n)})}setColor(e){if(!e)return this.selectedColor;if(typeof e=="string")return e;const t=_n(Number(e.r)),n=_n(Number(e.g)),s=_n(Number(e.b)),o=Ju(e.a===void 0?1:Number(e.a));return Cl({r:t,g:n,b:s,a:o})||this.selectedColor}groupByModelId(e){const t={};return e.forEach(n=>{const s=n?.modelId,o=n?.elementId;if(s==null||o===void 0||o===null)return;const r=n?.color??n?.rgba,a=this.setColor(r??{r:.4,g:.4,b:.4,a:.1}),l=`${s}-${a}`;t[l]||(t[l]=[]),t[l].push(`${o}`)}),{allElements:t,transform:null,box:null}}getBatchIds(e,t){const n=`${t}`,s=`${e}`;if(this.eidToBatchIdMap[n]){const l=this.eidToBatchIdMap[n].get(s);if(l!==void 0)return l}const r=this.tilesetMap[n]?.leiting?.node?.batchIdEIDInfos;if(r&&Array.isArray(r)){const l=new Map;r.forEach(h=>{const u=`${h.elementID}`,p=`${h.batchId}`;l.has(u)||l.set(u,[]),l.get(u).push(p)}),this.eidToBatchIdMap[n]=l;const c=l.get(s);if(c!==void 0)return c}const a=pC(e);return a!=null?[String(a)]:[]}async setComponentVisibility(e){if(Array.isArray(e)){Object.keys(this.showStateMap).forEach(t=>{this.showStateMap[t]={batchIds:[],mode:"exclude"}});for(const t of e){const n=`${t.modelId}`;this.showStateMap[n]||(this.showStateMap[n]={batchIds:[],mode:"exclude"});const s=this.showStateMap[n];if(!t.show){const o=this.getBatchIds(t.elementId,n);s.batchIds.push(...o)}}Object.keys(this.showStateMap).forEach(t=>{this.updateTilesetStyle(t)})}}async isolateComponentVisibility(e){const t={};e.forEach(n=>{const s=`${n.modelId}`;t[s]||(t[s]=new Set),t[s].add(`${n.elementId}`)});for(const n of Object.keys(this.tilesetMap)){await this.loadNodeDetailsForModel(n);const o=this.tilesetMap[n]?.leiting?.node?.batchIdEIDInfos;if(!o)continue;this.showStateMap[n]={batchIds:[],mode:"exclude"};const r=t[n];if(r&&r.size>0){const a=[];for(const l of o)r.has(`${l.elementID}`)||a.push(`${l.batchId}`);this.showStateMap[n].batchIds=a;continue}this.showStateMap[n].batchIds=o.map(a=>a.batchId)}Object.keys(this.showStateMap).forEach(n=>{this.updateTilesetStyle(n)})}async setAllComponentsVisibility(e){const t=this.getTargetModelIds();for(const n of t)await this.loadNodeDetailsForModel(n),e?this.setShowStyle({modelId:n,batchIds:[],mode:"exclude"}):this.setShowStyle({modelId:n,batchIds:[],mode:"include"})}getComponentsByVisibility(e){const t=this.getTargetModelIds(),n=[];return t.forEach(s=>{const o=this.showStateMap[s],r=this.tilesetMap[s];if(!r?.leiting?.node?.batchIdEIDInfos)return;const a=r.leiting.node.batchIdEIDInfos,l=new Set(o?.batchIds??[]),c=o?.mode??"exclude",h=new Set;a.forEach(u=>{const p=l.has(`${u.batchId}`);if((c==="include"?p:!p)===e){const m=`${u.elementID}`;h.has(m)||(n.push({elementId:m,modelId:s}),h.add(m))}})}),n}async _getComponentsByVisibility(e){const t=this.getTargetModelIds();for(const s of t)this.loadNodeDetailsForModel(s);const n=[];return t.forEach(s=>{const o=this.showStateMap[s],r=this.tilesetMap[s];if(!r?.leiting?.node?.batchIdEIDInfos)return;const a=r.leiting.node.batchIdEIDInfos,l=new Set(o?.batchIds??[]),c=o?.mode??"exclude",h=new Set;a.forEach(u=>{const p=l.has(`${u.batchId}`);if((c==="include"?p:!p)===e){const m=`${u.elementID}`;h.has(m)||(n.push({elementId:m,modelId:s}),h.add(m))}})}),n}getTileSyltByConstructionProcessTracking({elementIds:e,modelId:t,color:n,colorRank:s,show:o,selectionRank:r}){const a=this.tilesetMap[t];if(!Array.isArray(e))return[];const l=a.leiting.node,c=new Set(e),h=l.batchIdEIDInfos.filter(p=>c.has(`${p.elementID}`)).map(p=>String(p.batchId));return h.length?(s===Ku.normal&&!this.colorRankColor.includes(n)&&(this.colorRankColor=[n]),[[`(regExp('^(${h.join("|")})$').test(\${id}))`,n]]):[]}async setSelectColorUserModelCpt(e,t){if(!Array.isArray(e))return;const n=new Map,s=t?.rank===void 0?"exist":t?.rank,o=Xu(s),r=t?.isTrigger??!0;for(const a of e){const l=a?.modelId;if(l==null)continue;const c=`${l}`;await this.loadNodeDetailsForModel(c);const h=Array.isArray(a?.elementIds)?a.elementIds:a?.elementId?[a.elementId]:[];if(!h.length)continue;const u=Cl(a?.rgba)||this.selectedColor;for(const p of h){const f=this.getBatchIds(p,c);if(f.length!==0){n.has(c)||n.set(c,[]);for(const m of f)n.get(c)?.push({batchId:m,selectedColor:u,rank:o,isTrigger:r})}}}for(const[a,l]of n){const c=this.mergeSelections(a,l);this.hasSelectedFeaturesMap[a]=c,this.setBaseStyle(a)}r&&await this.triggerSelectionChange()}async setAllSelectColorUserModelCpt(e,t){const{modelId:n,rgba:s}=e,o=t?.isTrigger??!0;if(!n)return;await this.loadNodeDetailsForModel(n);const r=String(n),a=this.tilesetMap[r];if(!a)return;const l=a?.leiting?.node?.batchIdEIDInfos;if(!l||!Array.isArray(l))return;const c=[];l.forEach(h=>{h&&h.elementID!==void 0&&c.push(h.elementID)}),c.length!==0&&await this.setSelectColorUserModelCpt([{modelId:r,elementIds:c,rgba:s}],{rank:0,isTrigger:o})}getFeatureId(e){if(this.cesium.defined(e)&&this.cesium.defined(e.getProperty)){const t=e.getProperty("id");return t!=null?String(t):"-1"}return"-1"}getTargetModelIds(e){return e?[e]:Object.keys(this.tilesetMap)}buildShowConditions(e,t){const n=e.join("|");return n?t==="include"?[[`(regExp('^(${n})$').test(\${id}))`,"true"],["true","false"]]:[[`(regExp('^(${n})$').test(\${id}))`,"false"],["true","true"]]:t==="include"?[["true","false"]]:void 0}applyShowStyleOnly(e){const t=this.tilesetMap[e];if(!t)return;const n=this.showStateMap[e],s=n?this.buildShowConditions(n.batchIds,n.mode):void 0;s?t.style=new this.cesium.Cesium3DTileStyle({show:{conditions:s}}):t.style=void 0}setSelectedColorRgba(e,t,n,s=1){const o=_n(e),r=_n(t),a=_n(n),l=Ju(s),c=Cl({r:o,g:r,b:a,a:l});c&&(this.selectedColor=c)}mergeSelections(e,t){const n=new Map;return(this.hasSelectedFeaturesMap[e]||[]).forEach(o=>n.set(o.batchId,o)),t.forEach(o=>{const r=n.get(o.batchId);(!r||o.rank>r.rank||o.rank===r.rank)&&n.set(o.batchId,o)}),Array.from(n.values())}async toggleMultiSelect(e,t,n,s){const o=this.hasSelectedFeaturesMap[e]||[],r=o.filter(u=>u.rank!==0),a=o.filter(u=>u.rank===0),c=a.some(u=>u.batchId===t)?a.filter(u=>u.batchId!==t):[...a,{batchId:t,selectedColor:n,rank:0,point:s,isTrigger:!0}],h=[...r,...c];h.length?(this.hasSelectedFeaturesMap[e]=h,this.setBaseStyle(e)):(delete this.hasSelectedFeaturesMap[e],this.applyShowStyleOnly(e)),await this.triggerSelectionChange(e)}ensureSelectionDiv(){if(this.selectionDiv)return;const e=document.createElement("div");e.style.display="none",e.style.pointerEvents="none",e.style.border="1px solid rgba(0, 255, 255, 0.8)",this.viewer.container.appendChild(e),this.selectionDiv=e}isRepeatedClick(e){const t=e?.position;return!t||typeof t.x!="number"||typeof t.y!="number"?!1:this.selectedPosition.x===t.x&&this.selectedPosition.y===t.y?!0:(this.selectedPosition.x=t.x,this.selectedPosition.y=t.y,!1)}async selectTilesInRectangle(e,t,n){const s=Math.min(e.x,t.x),o=Math.max(e.x,t.x),r=Math.min(e.y,t.y),a=Math.max(e.y,t.y),l=o-s,c=a-r;if(Math.abs(l)<15||Math.abs(c)<15)return;const h=s+l/2,u=r+c/2,p=new this.cesium.Cartesian2(h,u),f=this.viewer.scene.drillPick(p,void 0,l,c);if(!Array.isArray(f))return;const m=new Map;f.forEach(y=>{if(!(y instanceof this.cesium.Cesium3DTileFeature))return;const g=ks(y.tileset);if(!g||!this.tilesetMap[g])return;const A=this.getFeatureId(y);A!=="-1"&&(m.has(g)||m.set(g,new Set),m.get(g)?.add(A))}),m.forEach((y,g)=>{const A=this.hasSelectedFeaturesMap[g]||[],v=A.filter(I=>I.rank!==0),b=new Set(A.filter(I=>I.rank===0).map(I=>I.batchId)),C=[];y.forEach(I=>{b.has(I)||C.push({batchId:I,selectedColor:n,rank:0,isTrigger:!0})});const x=A.filter(I=>I.rank===0);this.hasSelectedFeaturesMap[g]=[...v,...x,...C],this.setBaseStyle(g)}),await this.triggerSelectionChange()}}class wC{cesium;viewer;tilesetMap={};planeEntities=[];clippingPlanesMap={};activeModelIds=new Set;boxMatrix=null;boxInverseMatrix=null;boxCenter=null;boxOrientation=null;targetZPlus=0;targetZMinus=0;targetXPlus=0;targetXMinus=0;targetYPlus=0;targetYMinus=0;currentPlaneType="";selectedPlane=null;hoveredPlane=null;dragStartPoint=null;moveCallBack=null;downHandler=null;upHandler=null;moveHandler=null;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}attachTileset(e,t){this.tilesetMap[t]=e}open(e,t){!this.tilesetMap[e]||this.activeModelIds.has(e)||(this.activeModelIds.add(e),this.moveCallBack=t?.moveCallBack,this.fitToModels(),this.activeModelIds.size===1&&(this.createPlaneEntities(),this.initEventHandlers()))}setupClippingPlanes(e){const t=this.cesium,n=this.tilesetMap[e];if(!n||!this.boxMatrix)return;const s=new t.ClippingPlaneCollection({planes:[new t.ClippingPlane(new t.Cartesian3(1,0,0),this.targetXMinus),new t.ClippingPlane(new t.Cartesian3(-1,0,0),this.targetXPlus),new t.ClippingPlane(new t.Cartesian3(0,1,0),this.targetYMinus),new t.ClippingPlane(new t.Cartesian3(0,-1,0),this.targetYPlus),new t.ClippingPlane(new t.Cartesian3(0,0,1),this.targetZMinus),new t.ClippingPlane(new t.Cartesian3(0,0,-1),this.targetZPlus)],edgeWidth:2,edgeColor:t.Color.WHITE,enabled:!0,unionClippingRegions:!0}),o=t.Matrix4.inverse(n.root.transform,new t.Matrix4);s.modelMatrix=t.Matrix4.multiply(o,this.boxMatrix,new t.Matrix4),n.clippingPlanes=s,this.clippingPlanesMap[e]=s}createPlaneEntities(){const e=this.cesium,t=this.viewer;this.planeEntities.forEach(s=>t.entities.remove(s)),this.planeEntities=[];const n=["left","right","behind","front","top","down"];for(const s of n){const o=t.entities.add({name:s,position:new e.CallbackProperty(()=>{if(!this.boxMatrix)return e.Cartesian3.ZERO;const r=this.getPlaneOffsetCartesian(s);return e.Matrix4.multiplyByPoint(this.boxMatrix,r,new e.Cartesian3)},!1),orientation:new e.CallbackProperty(()=>this.boxOrientation||e.Quaternion.IDENTITY,!1),plane:{dimensions:new e.CallbackProperty(()=>{if(this.activeModelIds.size===0)return new e.Cartesian2(0,0);const r=.1,a=Math.max(r,this.targetXMinus+this.targetXPlus),l=Math.max(r,this.targetYPlus+this.targetYMinus),c=Math.max(r,this.targetZPlus+this.targetZMinus);return s==="top"||s==="down"?new e.Cartesian2(a,l):s==="left"||s==="right"?new e.Cartesian2(l,c):new e.Cartesian2(a,c)},!1),material:e.Color.WHITE.withAlpha(.1),outline:!0,outlineColor:e.Color.YELLOW,plane:new e.CallbackProperty(()=>new e.Plane(this.getNormalByType(s),0),!1)}});this.planeEntities.push(o)}}getPlaneOffsetCartesian(e){const t=(this.targetXPlus-this.targetXMinus)/2,n=(this.targetYPlus-this.targetYMinus)/2,s=(this.targetZPlus-this.targetZMinus)/2;switch(e){case"left":return new this.cesium.Cartesian3(-this.targetXMinus,n,s);case"right":return new this.cesium.Cartesian3(this.targetXPlus,n,s);case"behind":return new this.cesium.Cartesian3(t,-this.targetYMinus,s);case"front":return new this.cesium.Cartesian3(t,this.targetYPlus,s);case"top":return new this.cesium.Cartesian3(t,n,this.targetZPlus);case"down":return new this.cesium.Cartesian3(t,n,-this.targetZMinus);default:return this.cesium.Cartesian3.ZERO}}getNormalByType(e){const t=this.cesium;switch(e){case"left":return new t.Cartesian3(1,0,0);case"right":return new t.Cartesian3(-1,0,0);case"behind":return new t.Cartesian3(0,1,0);case"front":return new t.Cartesian3(0,-1,0);case"top":return new t.Cartesian3(0,0,-1);case"down":return new t.Cartesian3(0,0,1);default:return t.Cartesian3.UNIT_X}}getPlaneByType(e){const t=this.cesium,n=this.getNormalByType(e),s=t.Cartesian3.negate(n,new t.Cartesian3);let o=0;switch(e){case"left":o=this.targetXMinus;break;case"right":o=this.targetXPlus;break;case"behind":o=this.targetYMinus;break;case"front":o=this.targetYPlus;break;case"top":o=this.targetZPlus;break;case"down":o=this.targetZMinus;break}return new t.Plane(s,-o)}initEventHandlers(){const e=this.cesium,t=this.viewer.scene.canvas,n=this.viewer.scene;this.downHandler=new e.ScreenSpaceEventHandler(t),this.upHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler=new e.ScreenSpaceEventHandler(t),this.moveHandler.setInputAction(s=>{if(this.selectedPlane)return;let o;try{o=n.pick(s.endPosition)}catch{}e.defined(o)&&o.id&&o.id.plane?this.hoveredPlane!==o.id.plane&&(this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1)),this.hoveredPlane=o.id.plane,this.hoveredPlane.material=e.Color.YELLOW.withAlpha(.3),t.style.cursor="pointer"):this.hoveredPlane&&(this.hoveredPlane.material=e.Color.WHITE.withAlpha(.1),this.hoveredPlane=null,t.style.cursor="default")},e.ScreenSpaceEventType.MOUSE_MOVE),this.downHandler.setInputAction(s=>{let o;try{o=n.pick(s.position)}catch{}if(e.defined(o)&&o.id&&o.id.plane){this.currentPlaneType=o.id.name,this.selectedPlane=o.id.plane,this.selectedPlane.material=e.Color.RED.withAlpha(.4),n.screenSpaceCameraController.enableInputs=!1;const r=n.camera.getPickRay(s.position),a=this.boxInverseMatrix,l=e.Matrix4.multiplyByPoint(a,r.origin,new e.Cartesian3),c=e.Matrix4.multiplyByPointAsVector(a,r.direction,new e.Cartesian3);e.Cartesian3.normalize(c,c);const h=new e.Ray(l,c),u=this.getPlaneByType(this.currentPlaneType);this.dragStartPoint=e.IntersectionTests.rayPlane(h,u,new e.Cartesian3),this.dragStartPoint||(this.dragStartPoint=this.getPlaneOffsetCartesian(this.currentPlaneType))}},e.ScreenSpaceEventType.LEFT_DOWN),this.moveHandler.setInputAction(s=>{if(!this.selectedPlane||!this.dragStartPoint)return;const o=n.camera.getPickRay(s.endPosition),r=this.boxInverseMatrix,a=e.Matrix4.multiplyByPoint(r,o.origin,new e.Cartesian3),l=e.Matrix4.multiplyByPointAsVector(r,o.direction,new e.Cartesian3);e.Cartesian3.normalize(l,l);const c=new e.Ray(a,l);let h=new e.Cartesian3;this.currentPlaneType==="top"||this.currentPlaneType==="down"?h=Math.abs(l.x)>Math.abs(l.y)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Y:this.currentPlaneType==="left"||this.currentPlaneType==="right"?h=Math.abs(l.y)>Math.abs(l.z)?e.Cartesian3.UNIT_Y:e.Cartesian3.UNIT_Z:h=Math.abs(l.x)>Math.abs(l.z)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z;const u=-e.Cartesian3.dot(this.dragStartPoint,h),p=new e.Plane(h,u);let f=e.IntersectionTests.rayPlane(c,p,new e.Cartesian3);if(!f){const y=h===e.Cartesian3.UNIT_X?e.Cartesian3.UNIT_Y:h===e.Cartesian3.UNIT_Y&&(this.currentPlaneType==="top"||this.currentPlaneType==="down")?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z,g=-e.Cartesian3.dot(this.dragStartPoint,y);f=e.IntersectionTests.rayPlane(c,new e.Plane(y,g),new e.Cartesian3)}if(!f)return;const m=.01;switch(this.currentPlaneType){case"left":this.targetXMinus=Math.max(-this.targetXPlus+m,-f.x);break;case"right":this.targetXPlus=Math.max(-this.targetXMinus+m,f.x);break;case"behind":this.targetYMinus=Math.max(-this.targetYPlus+m,-f.y);break;case"front":this.targetYPlus=Math.max(-this.targetYMinus+m,f.y);break;case"top":this.targetZPlus=Math.max(-this.targetZMinus+m,f.z);break;case"down":this.targetZMinus=Math.max(-this.targetZPlus+m,-f.z);break}this.syncClippingPlanes(),this.moveCallBack&&this.moveCallBack(this.getRangeParams())},e.ScreenSpaceEventType.MOUSE_MOVE),this.upHandler.setInputAction(()=>{this.selectedPlane&&(this.selectedPlane.material=e.Color.WHITE.withAlpha(.1),this.selectedPlane=null,this.currentPlaneType="",this.dragStartPoint=null),n.screenSpaceCameraController.enableInputs=!0,t.style.cursor="default"},e.ScreenSpaceEventType.LEFT_UP)}syncClippingPlanes(){this.activeModelIds.size!==0&&Object.keys(this.clippingPlanesMap).forEach(e=>{const t=this.clippingPlanesMap[e],n=this.tilesetMap[e];if(t&&n&&!t.isDestroyed()){const s=this.cesium;t.get(0).distance=this.targetXMinus,t.get(1).distance=this.targetXPlus,t.get(2).distance=this.targetYMinus,t.get(3).distance=this.targetYPlus,t.get(4).distance=this.targetZMinus,t.get(5).distance=this.targetZPlus;const o=s.Matrix4.inverse(n.root.transform,new s.Matrix4);t.modelMatrix=s.Matrix4.multiply(o,this.boxMatrix,new s.Matrix4)}})}fitToModels(){const e=this.cesium;if(this.activeModelIds.size===0)return;let t=[];if(this.activeModelIds.forEach(u=>{const p=this.tilesetMap[u];p&&p.boundingSphere&&t.push(p.boundingSphere.center)}),t.length===0)return;const n=new e.Cartesian3;t.forEach(u=>e.Cartesian3.add(n,u,n)),this.boxCenter=e.Cartesian3.divideByScalar(n,t.length,new e.Cartesian3),this.boxMatrix=e.Transforms.eastNorthUpToFixedFrame(this.boxCenter),this.boxInverseMatrix=e.Matrix4.inverse(this.boxMatrix,new e.Matrix4),this.boxOrientation=e.Quaternion.fromRotationMatrix(e.Matrix4.getMatrix3(this.boxMatrix,new e.Matrix3));let s=1/0,o=-1/0,r=1/0,a=-1/0,l=1/0,c=-1/0;this.activeModelIds.forEach(u=>{const p=this.tilesetMap[u];if(!p)return;const f=[],m=p.leiting?.box,y=p.root?.boundingVolume?.boundingVolume;if(m&&m.min&&m.max){const{min:g,max:A}=m,v=[new e.Cartesian3(g.x,g.y,g.z),new e.Cartesian3(A.x,g.y,g.z),new e.Cartesian3(g.x,A.y,g.z),new e.Cartesian3(A.x,A.y,g.z),new e.Cartesian3(g.x,g.y,A.z),new e.Cartesian3(A.x,g.y,A.z),new e.Cartesian3(g.x,A.y,A.z),new e.Cartesian3(A.x,A.y,A.z)],b=p.root.transform;v.forEach(C=>{f.push(e.Matrix4.multiplyByPoint(b,C,new e.Cartesian3))})}else if(y&&y.halfAxes){const g=y.center,A=y.halfAxes,v=e.Matrix3.getColumn(A,0,new e.Cartesian3),b=e.Matrix3.getColumn(A,1,new e.Cartesian3),C=e.Matrix3.getColumn(A,2,new e.Cartesian3);for(let x=0;x<8;x++){const I=e.Cartesian3.clone(g,new e.Cartesian3);e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(v,x&1?1:-1,new e.Cartesian3),I),e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(b,x&2?1:-1,new e.Cartesian3),I),e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(C,x&4?1:-1,new e.Cartesian3),I),f.push(I)}}else if(p.boundingSphere){const g=p.boundingSphere,A=g.center,v=g.radius,b=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,A,new e.Cartesian3);s=Math.min(s,b.x-v),o=Math.max(o,b.x+v),r=Math.min(r,b.y-v),a=Math.max(a,b.y+v),l=Math.min(l,b.z-v),c=Math.max(c,b.z+v)}f.forEach(g=>{const A=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,g,new e.Cartesian3);s=Math.min(s,A.x),o=Math.max(o,A.x),r=Math.min(r,A.y),a=Math.max(a,A.y),l=Math.min(l,A.z),c=Math.max(c,A.z)})});const h=1.01;this.targetXMinus=Math.abs(s)*h,this.targetXPlus=Math.abs(o)*h,this.targetYMinus=Math.abs(r)*h,this.targetYPlus=Math.abs(a)*h,this.targetZMinus=Math.abs(l)*h,this.targetZPlus=Math.abs(c)*h,this.activeModelIds.forEach(u=>{this.setupClippingPlanes(u)}),this.viewer.scene.requestRender()}getRangeParams(){const e=this.cesium;return{targetZPlus:this.targetZPlus,targetZMinus:this.targetZMinus,targetXPlus:this.targetXPlus,targetXMinus:this.targetXMinus,targetYPlus:this.targetYPlus,targetYMinus:this.targetYMinus,maxBox:new e.Cartesian3(this.targetXPlus,this.targetYPlus,this.targetZPlus),minBox:new e.Cartesian3(-this.targetXMinus,-this.targetYMinus,-this.targetZMinus)}}updateRange(e){if(!this.boxMatrix)return;e.targetXMinus!==void 0&&(this.targetXMinus=e.targetXMinus),e.targetXPlus!==void 0&&(this.targetXPlus=e.targetXPlus),e.targetYMinus!==void 0&&(this.targetYMinus=e.targetYMinus),e.targetYPlus!==void 0&&(this.targetYPlus=e.targetYPlus),e.targetZPlus!==void 0&&(this.targetZPlus=e.targetZPlus),e.targetZMinus!==void 0&&(this.targetZMinus=e.targetZMinus);const t=.1;this.targetXMinus+this.targetXPlus<t&&(this.targetXPlus=t-this.targetXMinus),this.targetYPlus+this.targetYMinus<t&&(this.targetYPlus=t-this.targetYMinus),this.targetZPlus+this.targetZMinus<t&&(this.targetZPlus=t-this.targetZMinus),this.syncClippingPlanes(),this.viewer.scene.requestRender()}getRange(){return this.getRangeParams()}setBoxVisibility(e){this.planeEntities.forEach(t=>{t.show=e}),this.viewer.scene.requestRender()}close(e){if(e){const t=this.tilesetMap[e];t&&(t.clippingPlanes&&(t.clippingPlanes.enabled=!1),t.clippingPlanes=void 0),delete this.clippingPlanesMap[e],this.activeModelIds.delete(e),this.activeModelIds.size>0&&this.fitToModels()}else Object.keys(this.clippingPlanesMap).forEach(t=>{const n=this.tilesetMap[t];n&&(n.clippingPlanes&&(n.clippingPlanes.enabled=!1),n.clippingPlanes=void 0)}),this.clippingPlanesMap={},this.activeModelIds.clear();this.activeModelIds.size===0&&(this.planeEntities.forEach(t=>{this.viewer.entities.remove(t)}),this.planeEntities=[],this.destroyEventHandlers(),this.boxMatrix=null,this.boxInverseMatrix=null),this.viewer.scene.requestRender()}destroyEventHandlers(){this.downHandler?.destroy(),this.upHandler?.destroy(),this.moveHandler?.destroy(),this.downHandler=this.upHandler=this.moveHandler=null}}let xl=performance.now();const CC=10;class EC{cesium;viewer;modelInfo={modelName:"Person",modelId:"player_111",url:"person/model.glb",scale:.0032};startTime=0;radian=0;speed=.1;speedVector;position;hpRoll;cameralHpRoll;fixedFrameTransforms;model;transparentTest=!0;gravityTestByMove=!1;gravityTest=!0;lastMoveTime=0;moveInterval=.01;collisionTest=!0;wheelCount=2;isLeftDragging=!1;lastScreenY=0;lastScreenX=0;pauseAnimationFn;resumeAnimationFn;selectedColor;selectedColorRecover;handler;moveState={moveFront:!1,moveBack:!1,moveLeft:!1,moveRight:!1,moveUp:!1,moveDown:!1};onLoading=null;onSuccess=null;onError=null;constructor({cesium:e,viewer:t,modelInfo:n,callbacks:s}){this.cesium=e,this.viewer=t,this.radian=this.cesium.Math.toRadians(4),this.speedVector=new this.cesium.Cartesian3,this.position=new this.cesium.Cartesian3,this.hpRoll=new this.cesium.HeadingPitchRoll,this.cameralHpRoll=new this.cesium.HeadingPitchRoll,this.fixedFrameTransforms=new this.cesium.Transforms.localFrameToFixedFrameGenerator("north","west"),n&&(this.modelInfo=Object.assign(this.modelInfo,n)),s&&(this.onLoading=s.onLoading||null,this.onSuccess=s.onSuccess||null,this.onError=s.onError||null),this.selectedColor=new this.cesium.Color(1,1,1,.4),this.selectedColorRecover=new this.cesium.Color(1,1,1,1);const o=this.viewer.scene.canvas;this.handler=new this.cesium.ScreenSpaceEventHandler(o)}getModel(){return this.model}setPauseAnimation(e){this.pauseAnimationFn=e}setResumeAnimationFn(e){this.resumeAnimationFn=e}async setPersonPosition(e){e&&(this.position=e),this.getModel()?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(e,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.model.show=!0,this.initKeyBoard()):await this.openPlayer(),this.setCameralDefault(!1)}setModelInfo(e){e&&(this.modelInfo=Object.assign(this.modelInfo,e))}async openPlayer(){if(this.enablePositionSelection(),this.model){this.model.show=!0,this.initKeyBoard(),this.setCameralDefault(!1);return}this.position&&!(this.position.x===0&&this.position.y===0&&this.position.z===0)?(await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)):this.onLoading&&this.onLoading("请按住 Ctrl + 左键点击场景选择初始位置...")}enablePositionSelection(){this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null);const e=new this.cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);e.setInputAction(async t=>{const n=this.viewer.scene;let s;try{s=n.pickPosition(t.position)}catch(o){console.warn("pickPosition failed:",o)}s&&(this.position=s,this.model?(this.model.modelMatrix=this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),this.updatedCamera(),this.onSuccess&&this.onSuccess("已更新漫游位置")):(this.onSuccess&&this.onSuccess("位置已选择,正在加载模型..."),await this.loadModel(),this.initKeyBoard(),this.setCameralDefault(!1)))},this.cesium.ScreenSpaceEventType.LEFT_CLICK,this.cesium.KeyboardEventModifier.CTRL),this._positionHandler=e}_positionHandler;setDefaultPosition(){const e=this.viewer.scene,t=this.viewer.camera,n=new this.cesium.Cartesian2(e.canvas.clientWidth/2,e.canvas.clientHeight/2);let s;try{s=e.pickPosition(n)}catch(o){console.warn("pickPosition failed:",o)}if(s)this.position=s;else{const o=t.direction,a=this.cesium.Cartesian3.add(t.positionWC,this.cesium.Cartesian3.multiplyByScalar(o,10,new this.cesium.Cartesian3),new this.cesium.Cartesian3);this.position=a}}async loadModel(){let e;try{this.onLoading&&this.onLoading("正在加载漫游人物...");const t=await this.cesium.Model.fromGltfAsync({id:this.modelInfo.modelId,url:this.modelInfo.url,modelMatrix:this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms),scale:this.modelInfo.scale,allowPicking:!1,debugShowBoundingVolume:!1,debugWireframe:!1,cull:!1,gltfCallback:s=>{e=s.animations},backFaceCulling:!1}),n=()=>{if(e&&e.length>0){e.length;try{t.activeAnimations.add({index:0,loop:this.cesium.ModelAnimationLoop.REPEAT,multiplier:1})}catch(s){console.error("Failed to add animation:",s)}this.pauseAnimationFn=()=>{this.viewer.clock.shouldAnimate=!1},this.resumeAnimationFn=()=>{this.viewer.clock.shouldAnimate=!0},this.viewer.clock.shouldAnimate=!1}else console.warn("No animations found in the model.")};t.ready?n():t.readyEvent.addEventListener(n),this.model=await this.viewer.scene.primitives.add(t),this.updatedCamera(),this.onLoading&&this.onLoading(""),this.onSuccess&&this.onSuccess("漫游模型加载完成")}catch(t){console.error("Failed to load model:",t),this.onLoading&&this.onLoading(""),this.onError&&this.onError("漫游模型加载失败")}}initKeyBoard(){const e=this.handler,t=this.cesium;xl=performance.now();const n=(o,r)=>{const a=o.code,l=o.keyCode;a==="KeyA"||l===65?this.moveState.moveLeft=r:a==="KeyW"||l===87?this.moveState.moveFront=r:a==="KeyD"||l===68?this.moveState.moveRight=r:a==="KeyS"||l===83?this.moveState.moveBack=r:a==="KeyQ"||l===81?this.moveState.moveUp=r:(a==="KeyE"||l===69)&&(this.moveState.moveDown=r)};e.setInputAction(o=>{this.wheelCount-=o*.001,this.wheelCount<.1&&(this.wheelCount=.1),this.updatedCamera()},t.ScreenSpaceEventType.WHEEL),this._keydownHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(n(o,!0),this.resumeAnimationFn&&this.resumeAnimationFn())},this._keyupHandler=o=>{o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||(n(o,!1),Object.keys(this.moveState).every(r=>this.moveState[r]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())},document.addEventListener("keydown",this._keydownHandler),document.addEventListener("keyup",this._keyupHandler),e.setInputAction(o=>{this.isLeftDragging=!0,this.lastScreenY=o.position.y,this.lastScreenX=o.position.x},this.cesium.ScreenSpaceEventType.LEFT_DOWN),e.setInputAction(o=>{if(!this.isLeftDragging)return;const r=o.endPosition.x,a=o.endPosition.y,l=a-this.lastScreenY,c=r-this.lastScreenX;Math.abs(l)<Math.abs(c)&&(c>0?(this.cameralHpRoll.heading+=this.radian,this.hpRoll.heading+=this.radian):(this.cameralHpRoll.heading-=this.radian,this.hpRoll.heading-=this.radian),s(0),this.lastScreenX=r),this.lastScreenY=a;const h=this.viewer.camera;this.cameralHpRoll.pitch=h.pitch+this.cesium.Math.toRadians(-l*.1),this.updatedCamera()},t.ScreenSpaceEventType.MOUSE_MOVE),e.setInputAction(()=>{this.isLeftDragging&&(this.isLeftDragging=!1)},t.ScreenSpaceEventType.LEFT_UP);const s=o=>{const r=performance.now();if(r-xl<CC)return;xl=r;const a=1.75;if(o===1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,this.speed,this.speedVector),this.gravityTestByMove=!0):o===-1?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,-this.speed,this.speedVector),this.gravityTestByMove=!0):o===0?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_X,0,this.speedVector),this.gravityTestByMove=!1):o===2?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,.05,this.speedVector),this.gravityTestByMove=!1):o===-2?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Z,-.05,this.speedVector),this.gravityTestByMove=!1):o===3?(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Y,this.speed,this.speedVector),this.gravityTestByMove=!0):o===-3&&(this.speedVector=this.cesium.Cartesian3.multiplyByScalar(this.cesium.Cartesian3.UNIT_Y,-this.speed,this.speedVector),this.gravityTestByMove=!0),!this.viewer||!this.model)return;const l=(u,p)=>new this.cesium.Ray(u,p),c=new this.cesium.Cartesian3;this.cesium.Matrix4.getColumn(this.model.modelMatrix,0,c),this.cesium.Cartesian3.normalize(c,c);const h=new this.cesium.Cartesian3;if(this.cesium.Matrix4.getColumn(this.model.modelMatrix,1,h),this.cesium.Cartesian3.normalize(h,h),Math.abs(o)!=2&&this.collisionTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,a),u);let f=c;o===-1?f=this.cesium.Cartesian3.multiplyByScalar(c,-1,new this.cesium.Cartesian3):o===3?f=h:o===-3&&(f=this.cesium.Cartesian3.multiplyByScalar(h,-1,new this.cesium.Cartesian3));const m=l(p,f),y=this.viewer.scene.pickFromRay(m,[this.model],1);if(y&&y.position&&this.cesium.Cartesian3.distance(p,y.position)<.9&&o!==0)return}if(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,this.speedVector,this.position),this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.gravityTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=.5,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),u),m=new this.cesium.Cartesian3;this.cesium.Cartesian3.subtract(this.position,f,m),this.cesium.Cartesian3.normalize(m,m);const y=l(f,m),g=this.viewer.scene.pickFromRay(y,[this.model],1),A=a,v=this.cesium.Cartesian3.add(f,this.cesium.Cartesian3.multiplyByScalar(c,A,new this.cesium.Cartesian3),new this.cesium.Cartesian3);if(t.defined(g)){const b=t.Cartesian3.distance(f,g.position);b-p>.2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position)),b-p<-.1&&b<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,.2),this.position))}if(!g&&this.gravityTestByMove){const b=l(this.position,m),C=this.viewer.scene.pickFromRay(b,[this.model],1);if(C){const x=this.cesium.Cartesian3.distance(this.position,C.position);Math.abs(x-1)>.05&&x<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position))}}if(g&&this.gravityTestByMove&&this.gravityTest){const b=this.cesium.Cartesian3.distance(v,g.position);Math.abs(b-a)>.1&&(this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,(a-b)/Math.abs(a-b)*.05),this.position))}}if(this.transparentTest){const u=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=1.75,f=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),u),m=this.viewer.camera.positionWC,y=f,g=t.Cartesian3.subtract(y,m,new t.Cartesian3),A=t.Cartesian3.distance(f,m),v=t.Cartesian3.normalize(g,new t.Cartesian3),b=new t.Ray(m,v);let C;try{C=this.viewer.scene.pickFromRay(b,void 0,1)}catch{}t.defined(C)&&C.primitive!==this.model&&C.position&&t.Cartesian3.distance(m,C.position)<A&&(this.wheelCount-=.1,this.wheelCount<.1&&(this.wheelCount=.1))}this.cesium.Transforms.headingPitchRollToFixedFrame(this.position,this.hpRoll,this.cesium.Ellipsoid.WGS84,this.fixedFrameTransforms,this.model.modelMatrix),this.updatedCamera()};this._tickHandler=()=>{const o=performance.now()/1e3;(o-this.lastMoveTime>=this.moveInterval||this.lastMoveTime==0)&&(this.moveState.moveFront?s(1):this.moveState.moveBack?s(-1):this.moveState.moveLeft?s(3):this.moveState.moveRight?s(-3):this.moveState.moveUp?s(2):this.moveState.moveDown&&s(-2),this.lastMoveTime=o)},this.viewer.clock.onTick.addEventListener(this._tickHandler)}updatedCamera(){if(!this.model)return;const e=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),t=1.75,n=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,t),e);this.viewer.camera.viewBoundingSphere(new this.cesium.BoundingSphere(n,this.wheelCount),this.cameralHpRoll)}_keydownHandler;_keyupHandler;_tickHandler;_uiEventListeners=[];bindUiKeys(e){this.unbindUiKeys(),Object.entries(e).forEach(([t,n])=>{if(!n)return;const s=()=>this.setMoveState(t,!0),o=()=>this.setMoveState(t,!1);n.addEventListener("mousedown",s),n.addEventListener("mouseup",o),n.addEventListener("mouseleave",o),n.addEventListener("touchstart",r=>{r.preventDefault(),s()}),n.addEventListener("touchend",r=>{r.preventDefault(),o()}),this._uiEventListeners.push(()=>{n.removeEventListener("mousedown",s),n.removeEventListener("mouseup",o),n.removeEventListener("mouseleave",o),n.removeEventListener("touchstart",s),n.removeEventListener("touchend",o)})})}unbindUiKeys(){this._uiEventListeners.forEach(e=>e()),this._uiEventListeners=[]}openCameraRoam(){const e=this.cesium,t=this.viewer,n=t.camera;this.setDefaultPosition(),this.setCameralDefault(!1);const s=this.handler;let o=!1,r=0,a=0;s.setInputAction(l=>{o=!0,r=l.position.x,a=l.position.y},e.ScreenSpaceEventType.LEFT_DOWN),s.setInputAction(l=>{if(!o)return;const c=l.endPosition.x,h=l.endPosition.y,u=c-r,p=h-a;Math.abs(u)>Math.abs(p)&&(n.heading-=u*.003),n.pitch+=p*.003,r=c,a=h},e.ScreenSpaceEventType.MOUSE_MOVE),s.setInputAction(()=>{o=!1},e.ScreenSpaceEventType.LEFT_UP),s.setInputAction(l=>{this.wheelCount-=l*.001,this.wheelCount<.1&&(this.wheelCount=.1)},e.ScreenSpaceEventType.WHEEL),this._tickHandler=()=>{if(!this.moveState.moveFront&&!this.moveState.moveBack&&!this.moveState.moveLeft&&!this.moveState.moveRight&&!this.moveState.moveUp&&!this.moveState.moveDown)return;const l=(this.speed||.02)*12,c=n.direction,h=n.right,u=n.up;let p=0,f=0,m=0;this.moveState.moveFront&&(p+=c.x*l,f+=c.y*l,m+=c.z*l),this.moveState.moveBack&&(p-=c.x*l,f-=c.y*l,m-=c.z*l),this.moveState.moveRight&&(p+=h.x*l,f+=h.y*l,m+=h.z*l),this.moveState.moveLeft&&(p-=h.x*l,f-=h.y*l,m-=h.z*l),this.moveState.moveUp&&(p+=u.x*l,f+=u.y*l,m+=u.z*l),this.moveState.moveDown&&(p-=u.x*l,f-=u.y*l,m-=u.z*l),n.position=new e.Cartesian3(n.position.x+p,n.position.y+f,n.position.z+m)},t.clock.onTick.addEventListener(this._tickHandler),this.onSuccess&&this.onSuccess("视角漫游已启动")}closePlayer(){const e=this.cesium;this.model&&(this.model.show=!1),this.setCameralDefault(!0),this.handler&&(this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOWN),this.handler.removeInputAction(e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(e.ScreenSpaceEventType.LEFT_UP),this.handler.removeInputAction(e.ScreenSpaceEventType.WHEEL)),this._positionHandler&&(this._positionHandler.destroy(),this._positionHandler=null),this._keydownHandler&&document.removeEventListener("keydown",this._keydownHandler),this._keyupHandler&&document.removeEventListener("keyup",this._keyupHandler),this._tickHandler&&this.viewer.clock.onTick.removeEventListener(this._tickHandler),this.unbindUiKeys(),this.viewer.camera.lookAtTransform(e.Matrix4.IDENTITY),this.onLoading&&this.onLoading("")}setSpeed({speed:e}){this.speed=e/50}setParams({gravityTest:e,collisionTest:t,transparentTest:n}){e!==void 0&&(this.gravityTest=e),t!==void 0&&(this.collisionTest=t),n!==void 0&&(this.transparentTest=n)}setMoveState(e,t){this.moveState.hasOwnProperty(e)&&(this.moveState[e]=t,t?this.resumeAnimationFn&&this.resumeAnimationFn():Object.keys(this.moveState).every(n=>this.moveState[n]==!1)&&this.pauseAnimationFn&&this.pauseAnimationFn())}setCameralDefault(e){const t=this.viewer;t.scene.screenSpaceCameraController.enableRotate=e,t.scene.screenSpaceCameraController.enableTranslate=e,t.scene.screenSpaceCameraController.enableZoom=e,t.scene.screenSpaceCameraController.enableLook=e,t.scene.screenSpaceCameraController.enableTilt=e}}class xC{cesium;viewer;baseCesium;baseTiles;baseCompt;baseSection;basePlayer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.baseCesium=new Ky(e),this.baseTiles=new qu(e),this.baseCompt=new bC(e),this.baseSection=new wC(e),this.basePlayer=new EC({cesium:e.cesium,viewer:e.viewer,modelInfo:{url:e.options?.playerUrl,modelName:e.options?.playerModelName,modelId:e.options?.playerModelId,scale:e.options?.playerScale},callbacks:e.callbacks})}getCesium(){return this.cesium}getViewer(){return this.viewer}setSceneOptions(...e){this.baseCesium.setSceneOptions(...e)}getSnapDomSImageBase64(...e){return this.baseCesium.getSnapDomSImageBase64(...e)}clearBackground(){this.baseCesium.clearBackground()}enableTestLabel(){this.baseCesium.enableTestLabel()}enableCesiumFXAA(e){this.baseCesium.enableCesiumFXAA(e)}updateModelEffect(e){this.baseCesium.updateModelEffect(e)}addModels(...e){return this.baseTiles.addModels(...e)}}class IC{cesium;viewer;mapLayers={};renderGen={};renderGenAll=0;renderGenByModel={};modelId="default";options={flyTo:!0};dxfModelsList=[];open=!1;events=new _s;showGlobal=!0;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t}getMapLayers(e){const t=typeof e=="object"?e?.modelId:e;return t?this.mapLayers[t]||{}:this.mapLayers}setModelId(e){this.modelId=e}getModelId(){return this.modelId}flyToCadModel(e={}){const t=e.modelId||this.modelId,n=this.dxfModelsList.find(s=>s.modelId===t);n&&this.flyToBounds(n)}setDxfOpen(e){this.open=e}getDxfOpen(){return this.open}getDxfModelsList(){return this.dxfModelsList}getDxfModels(e){const t=typeof e=="object"?e?.modelId:e;return t?this.dxfModelsList.find(n=>n.modelId===t):this.dxfModelsList}showJson({modelId:e,show:t}){this.mapLayers[e]&&Object.values(this.mapLayers[e]).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t)})});const n=this.dxfModelsList.find(s=>s.modelId===e);n&&(n.show=t)}showJsonByLayer({modelId:e,show:t,layers:n}){const s=this.dxfModelsList.find(r=>r.modelId===e);if(!s){console.error("Tileset not found for modelId:",e);return}s.hiddenBatchIds||(s.hiddenBatchIds=new Set),s.layerMap&&Array.isArray(n)&&n.forEach(r=>{const a=s.layerMap[r];a!==void 0&&(t?s.hiddenBatchIds.delete(a):s.hiddenBatchIds.add(a))});const o=Array.from(s.hiddenBatchIds);if(o.length>0){const r=o.map(a=>`\${_BATCHID} !== ${a}`).join(" && ");s.style=new this.cesium.Cesium3DTileStyle({show:r})}else s.style=new this.cesium.Cesium3DTileStyle({show:!0});s.hasVisibilityListener||(s.hasVisibilityListener=!0,s.tileVisible.addEventListener(r=>{const a=r.content,l=a.featuresLength;if(l>0&&s.hiddenBatchIds)for(let c=0;c<l;c++)s.hiddenBatchIds.has(c)?a.getFeature(c).show=!1:a.getFeature(c).show=!0}))}flyToBounds(e,t){const n=this.cesium,s=e.boundingSphere?.radius||1e3,o={offset:new n.HeadingPitchRange(0,n.Math.toRadians(-90),s*2),...t},r=o.duration??0;e&&this.viewer.flyTo(e,{duration:r,offset:o.offset})}async loadModelFile(e){try{if(!e||typeof e!="string")return!1;const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);if(e.endsWith(".json")||t.headers.get("content-type")?.includes("application/json"))return await t.json();const n=await t.blob(),s=new gl(new tr(n),{password:Wu,useWebWorkers:!1}),r=(await s.getEntries()).find(c=>!c.directory&&c.filename.endsWith(".json"));if(!r)return console.error("未找到 JSON 文件"),await s.close(),!1;const a=await r.arrayBuffer({useWebWorkers:!1});await s.close();const l=new TextDecoder().decode(a);return JSON.parse(l.trim())}catch(t){return console.error("解压或获取失败:",t),!1}}getBaseUrlPath(e){const t=e.lastIndexOf("/");return t===-1?".":e.substring(0,t)}async loadTilesetWithZipSupport(e,t){const n=this.getBaseUrlPath(e),s=encodeURI(`${n}/tileset.zip`);try{if((await fetch(s,{method:"HEAD"})).status===200){const r=await this.loadModelFile(s);if(r){const a=h=>{!h||typeof h!="object"||(typeof h.uri=="string"&&!/^(data:|https?:|atom:)\/\//i.test(h.uri)&&(h.uri=encodeURI(`${n}/${h.uri.replace(/^\.?\//,"")}`)),Object.values(h).forEach(u=>{if(Array.isArray(u)){u.forEach(p=>a(p));return}u&&typeof u=="object"&&a(u)}))};a(r);const l=`data:text/plain;base64,${btoa(unescape(encodeURIComponent(JSON.stringify(r))))}`,c=new this.cesium.Resource({url:l});try{return await this.cesium.Cesium3DTileset.fromUrl(c,t)}catch{return await this.cesium.Cesium3DTileset.fromUrl(e,t)}}}}catch{}return await this.cesium.Cesium3DTileset.fromUrl(e,t)}async addDxfModel({fileNames:e,options:t}){const n=this.renderGenAll;if(e?.length){for(const s of e){if(this.renderGenAll!==n)return;const o=this.renderGenByModel[s.modelId]||0;if((this.renderGenByModel[s.modelId]||0)!==o||~this.dxfModelsList.findIndex(c=>c.modelId===s.modelId))return;/^(https?|atom):\/\//i.test(s.outPutPath)||(s.outPutPath=`${window.location.origin}${s.outPutPath}`);const a=`${s.outPutPath}${s.dbName}/tileset.json`,l={...this.options,...t};try{const c=`${s.outPutPath}${s.dbName}/layerInfo.zip`,h=await this.loadModelFile(c);if(this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;const u=await this.loadTilesetWithZipSupport(a,{allowPicking:!1,clampToTerrain:!0});if(u.maximumScreenSpaceError=0,this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;if(Object.assign(u,{modelId:s.modelId,modelName:s.modelName,deltaLatitude:s.deltaLatitude||0,deltaLongitude:s.deltaLongitude||0,relocated:!0,dbName:s.dbName,outPutPath:s.outPutPath,totalRotation:s.totalRotation||0,layerInfo:h}),s.formData?u.formData=s.formData:u.formData={modelId:u.modelId,longitude:u.deltaLongitude,latitude:u.deltaLatitude,distance:1e-6,rotation:0,totalRotation:u.totalRotation,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[{value:u.modelId,label:u.modelName}],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0},this.adjustingModelByCad({...u.formData,tileset:u}),Array.isArray(h)){const p=h;u.layerMap={};let f=this.mapLayers[s.modelId];f||(f={},this.mapLayers[s.modelId]=f),p.forEach(m=>{u.layerMap[m.layerName]=m.batchId,f[m.layerName]||(f[m.layerName]=[]),f[m.layerName].push({batchId:m.batchId,color:m.layerColor})})}if(this.dxfModelsList.push(u),this.setModelId(s.modelId),this.viewer.scene.primitives.add(u),this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;l.flyTo&&this.flyToBounds(u),l.onSuccess&&l.onSuccess(u)}catch(c){console.error(`Failed to load tileset or layer info: ${a}`,c)}}this.events.emit("mountAllCad",this.dxfModelsList)}}adjustingModelByCad(e){const t=this.cesium,n=t.Quaternion.fromAxisAngle(t.Cartesian3.UNIT_Z,t.Math.toRadians(e.totalRotation)),s=t.Matrix4.fromRotationTranslation(t.Matrix3.fromQuaternion(n),new t.Cartesian3(0,0,0)),o=t.Cartesian3.fromDegrees(e.longitude,e.latitude,e.height),r=t.Transforms.eastNorthUpToFixedFrame(o);t.Matrix4.multiply(r,s,r),e.tileset?._root&&(e.tileset._root.transform=r)}deleteCad({modelId:e}){this.mapLayers[e]&&(Object.values(this.mapLayers[e]).forEach(n=>{n.forEach(s=>{this.viewer.scene.primitives.remove(s.primitive),s.primitive?.destroy()})}),delete this.mapLayers[e]),this.renderGen[e]=(this.renderGen[e]||0)+1,this.renderGenByModel[e]=(this.renderGenByModel[e]||0)+1;const t=this.dxfModelsList.findIndex(n=>n.modelId===e);if(t>-1){const n=this.dxfModelsList[t];this.viewer.scene.primitives.remove(n),n.destroy&&!n.isDestroyed()&&n.destroy(),this.dxfModelsList.splice(t,1)}}deleteAllCad(){Object.keys(this.mapLayers).forEach(e=>{this.deleteCad({modelId:e})}),[...this.dxfModelsList].forEach(e=>{e.modelId&&this.deleteCad({modelId:e.modelId})})}}function SC(i){i("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),i("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),i("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)i("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),i("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");i("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),i("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),i.WGS84=i["EPSG:4326"],i["EPSG:3785"]=i["EPSG:3857"],i.GOOGLE=i["EPSG:3857"],i["EPSG:900913"]=i["EPSG:3857"],i["EPSG:102113"]=i["EPSG:3857"]}var Zi=1,en=2,kn=3,MC=4,Il=5,Zu=6378137,TC=6356752314e-3,ef=.0066943799901413165,Ps=484813681109536e-20,$=Math.PI/2,BC=.16666666666666666,_C=.04722222222222222,kC=.022156084656084655,K=1e-10,Oe=.017453292519943295,bt=57.29577951308232,ve=Math.PI/4,Ds=Math.PI*2,Ue=3.14159265359,wt={};wt.greenwich=0,wt.lisbon=-9.131906111111,wt.paris=2.337229166667,wt.bogota=-74.080916666667,wt.madrid=-3.687938888889,wt.rome=12.452333333333,wt.bern=7.439583333333,wt.jakarta=106.807719444444,wt.ferro=-17.666666666667,wt.brussels=4.367975,wt.stockholm=18.058277777778,wt.athens=23.7163375,wt.oslo=10.722916666667;const PC={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var tf=/[\s_\-\/\(\)]/g;function Si(i,e){if(i[e])return i[e];for(var t=Object.keys(i),n=e.toLowerCase().replace(tf,""),s=-1,o,r;++s<t.length;)if(o=t[s],r=o.toLowerCase().replace(tf,""),r===n)return i[o]}function Sl(i){var e={},t=i.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).reduce(function(a,l){var c=l.split("=");return c.push(!0),a[c[0].toLowerCase()]=c[1],a},{}),n,s,o,r={proj:"projName",datum:"datumCode",rf:function(a){e.rf=parseFloat(a)},lat_0:function(a){e.lat0=a*Oe},lat_1:function(a){e.lat1=a*Oe},lat_2:function(a){e.lat2=a*Oe},lat_ts:function(a){e.lat_ts=a*Oe},lon_0:function(a){e.long0=a*Oe},lon_1:function(a){e.long1=a*Oe},lon_2:function(a){e.long2=a*Oe},alpha:function(a){e.alpha=parseFloat(a)*Oe},gamma:function(a){e.rectified_grid_angle=parseFloat(a)*Oe},lonc:function(a){e.longc=a*Oe},x_0:function(a){e.x0=parseFloat(a)},y_0:function(a){e.y0=parseFloat(a)},k_0:function(a){e.k0=parseFloat(a)},k:function(a){e.k0=parseFloat(a)},a:function(a){e.a=parseFloat(a)},b:function(a){e.b=parseFloat(a)},r:function(a){e.a=e.b=parseFloat(a)},r_a:function(){e.R_A=!0},zone:function(a){e.zone=parseInt(a,10)},south:function(){e.utmSouth=!0},towgs84:function(a){e.datum_params=a.split(",").map(function(l){return parseFloat(l)})},to_meter:function(a){e.to_meter=parseFloat(a)},units:function(a){e.units=a;var l=Si(PC,a);l&&(e.to_meter=l.to_meter)},from_greenwich:function(a){e.from_greenwich=a*Oe},pm:function(a){var l=Si(wt,a);e.from_greenwich=(l||parseFloat(a))*Oe},nadgrids:function(a){a==="@null"?e.datumCode="none":e.nadgrids=a},axis:function(a){var l="ewnsud";a.length===3&&l.indexOf(a.substr(0,1))!==-1&&l.indexOf(a.substr(1,1))!==-1&&l.indexOf(a.substr(2,1))!==-1&&(e.axis=a)},approx:function(){e.approx=!0},over:function(){e.over=!0}};for(n in t)s=t[n],n in r?(o=r[n],typeof o=="function"?o(s):e[o]=s):e[n]=s;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e.projStr=i,e}class nf{static getId(e){const t=e.find(n=>Array.isArray(n)&&n[0]==="ID");return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t="unit"){if(!e||e.length<3)return{type:t,name:"unknown",conversion_factor:null};const n=e[1],s=parseFloat(e[2])||null,o=e.find(a=>Array.isArray(a)&&a[0]==="ID"),r=o?{authority:o[1],code:parseInt(o[2],10)}:null;return{type:t,name:n,conversion_factor:s,id:r}}static convertAxis(e){const t=e[1]||"Unknown";let n;const s=t.match(/^\((.)\)$/);if(s){const c=s[1].toUpperCase();if(c==="E")n="east";else if(c==="N")n="north";else if(c==="U")n="up";else throw new Error(`Unknown axis abbreviation: ${c}`)}else n=e[2]?e[2].toLowerCase():"unknown";const o=e.find(c=>Array.isArray(c)&&c[0]==="ORDER"),r=o?parseInt(o[1],10):null,a=e.find(c=>Array.isArray(c)&&(c[0]==="LENGTHUNIT"||c[0]==="ANGLEUNIT"||c[0]==="SCALEUNIT")),l=this.convertUnit(a);return{name:t,direction:n,unit:l,order:r}}static extractAxes(e){return e.filter(t=>Array.isArray(t)&&t[0]==="AXIS").map(t=>this.convertAxis(t)).sort((t,n)=>(t.order||0)-(n.order||0))}static convert(e,t={}){switch(e[0]){case"PROJCRS":t.type="ProjectedCRS",t.name=e[1],t.base_crs=e.find(p=>Array.isArray(p)&&p[0]==="BASEGEOGCRS")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="BASEGEOGCRS")):null,t.conversion=e.find(p=>Array.isArray(p)&&p[0]==="CONVERSION")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="CONVERSION")):null;const n=e.find(p=>Array.isArray(p)&&p[0]==="CS");n&&(t.coordinate_system={type:n[1],axis:this.extractAxes(e)});const s=e.find(p=>Array.isArray(p)&&p[0]==="LENGTHUNIT");if(s){const p=this.convertUnit(s);t.coordinate_system.unit=p}t.id=this.getId(e);break;case"BASEGEOGCRS":case"GEOGCRS":t.type="GeographicCRS",t.name=e[1];const o=e.find(p=>Array.isArray(p)&&(p[0]==="DATUM"||p[0]==="ENSEMBLE"));if(o){const p=this.convert(o);o[0]==="ENSEMBLE"?t.datum_ensemble=p:t.datum=p;const f=e.find(m=>Array.isArray(m)&&m[0]==="PRIMEM");f&&f[1]!=="Greenwich"&&(p.prime_meridian={name:f[1],longitude:parseFloat(f[2])})}t.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(e)},t.id=this.getId(e);break;case"DATUM":t.type="GeodeticReferenceFrame",t.name=e[1],t.ellipsoid=e.find(p=>Array.isArray(p)&&p[0]==="ELLIPSOID")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":t.type="DatumEnsemble",t.name=e[1],t.members=e.filter(p=>Array.isArray(p)&&p[0]==="MEMBER").map(p=>({type:"DatumEnsembleMember",name:p[1],id:this.getId(p)}));const r=e.find(p=>Array.isArray(p)&&p[0]==="ENSEMBLEACCURACY");r&&(t.accuracy=parseFloat(r[1]));const a=e.find(p=>Array.isArray(p)&&p[0]==="ELLIPSOID");a&&(t.ellipsoid=this.convert(a)),t.id=this.getId(e);break;case"ELLIPSOID":t.type="Ellipsoid",t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(p=>Array.isArray(p)&&p[0]==="LENGTHUNIT")&&this.convert(e.find(p=>Array.isArray(p)&&p[0]==="LENGTHUNIT"),t);break;case"CONVERSION":t.type="Conversion",t.name=e[1],t.method=e.find(p=>Array.isArray(p)&&p[0]==="METHOD")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="METHOD")):null,t.parameters=e.filter(p=>Array.isArray(p)&&p[0]==="PARAMETER").map(p=>this.convert(p));break;case"METHOD":t.type="Method",t.name=e[1],t.id=this.getId(e);break;case"PARAMETER":t.type="Parameter",t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(p=>Array.isArray(p)&&(p[0]==="LENGTHUNIT"||p[0]==="ANGLEUNIT"||p[0]==="SCALEUNIT"))),t.id=this.getId(e);break;case"BOUNDCRS":t.type="BoundCRS";const l=e.find(p=>Array.isArray(p)&&p[0]==="SOURCECRS");if(l){const p=l.find(f=>Array.isArray(f));t.source_crs=p?this.convert(p):null}const c=e.find(p=>Array.isArray(p)&&p[0]==="TARGETCRS");if(c){const p=c.find(f=>Array.isArray(f));t.target_crs=p?this.convert(p):null}const h=e.find(p=>Array.isArray(p)&&p[0]==="ABRIDGEDTRANSFORMATION");h?t.transformation=this.convert(h):t.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(t.type="Transformation",t.name=e[1],t.method=e.find(p=>Array.isArray(p)&&p[0]==="METHOD")?this.convert(e.find(p=>Array.isArray(p)&&p[0]==="METHOD")):null,t.parameters=e.filter(p=>Array.isArray(p)&&(p[0]==="PARAMETER"||p[0]==="PARAMETERFILE")).map(p=>{if(p[0]==="PARAMETER")return this.convert(p);if(p[0]==="PARAMETERFILE")return{name:p[1],value:p[2],id:{authority:"EPSG",code:8656}}}),t.parameters.length===7){const p=t.parameters[6];p.name==="Scale difference"&&(p.value=Math.round((p.value-1)*1e12)/1e6)}t.id=this.getId(e);break;case"AXIS":t.coordinate_system||(t.coordinate_system={type:"unspecified",axis:[]}),t.coordinate_system.axis.push(this.convertAxis(e));break;case"LENGTHUNIT":const u=this.convertUnit(e,"LinearUnit");t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(p=>{p.unit||(p.unit=u)}),u.conversion_factor&&u.conversion_factor!==1&&t.semi_major_axis&&(t.semi_major_axis={value:t.semi_major_axis,unit:u});break;default:t.keyword=e[0];break}return t}}class DC extends nf{static convert(e,t={}){return super.convert(e,t),t.coordinate_system&&t.coordinate_system.subtype==="Cartesian"&&delete t.coordinate_system,t.usage&&delete t.usage,t}}class NC extends nf{static convert(e,t={}){super.convert(e,t);const n=e.find(o=>Array.isArray(o)&&o[0]==="CS");n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});const s=e.find(o=>Array.isArray(o)&&o[0]==="USAGE");if(s){const o=s.find(l=>Array.isArray(l)&&l[0]==="SCOPE"),r=s.find(l=>Array.isArray(l)&&l[0]==="AREA"),a=s.find(l=>Array.isArray(l)&&l[0]==="BBOX");t.usage={},o&&(t.usage.scope=o[1]),r&&(t.usage.area=r[1]),a&&(t.usage.bbox=a.slice(1))}return t}}function LC(i){return i.find(e=>Array.isArray(e)&&e[0]==="USAGE")?"2019":(i.find(e=>Array.isArray(e)&&e[0]==="CS")||i[0]==="BOUNDCRS"||i[0]==="PROJCRS"||i[0]==="GEOGCRS","2015")}function RC(i){return(LC(i)==="2019"?NC:DC).convert(i)}function FC(i){const e=i.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}var Ns=1,sf=2,of=3,or=4,rf=5,Ml=-1,OC=/\s/,GC=/[A-Za-z]/,UC=/[A-Za-z84_]/,rr=/[,\]]/,af=/[\d\.E\-\+]/;function hi(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Ns}hi.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==or)for(;OC.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case Ns:return this.neutral(i);case sf:return this.keyword(i);case or:return this.quoted(i);case rf:return this.afterquote(i);case of:return this.number(i);case Ml:return}},hi.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=or;return}if(rr.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)},hi.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Ns;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Ns,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Ml);return}},hi.prototype.number=function(i){if(af.test(i)){this.word+=i;return}if(rr.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)},hi.prototype.quoted=function(i){if(i==='"'){this.state=rf;return}this.word+=i},hi.prototype.keyword=function(i){if(UC.test(i)){this.word+=i;return}if(i==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=Ns;return}if(rr.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)},hi.prototype.neutral=function(i){if(GC.test(i)){this.word=i,this.state=sf;return}if(i==='"'){this.word="",this.state=or;return}if(af.test(i)){this.word=i,this.state=of;return}if(rr.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)},hi.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Ml)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function VC(i){var e=new hi(i);return e.output()}function Tl(i,e,t){Array.isArray(e)&&(t.unshift(e),e=null);var n=e?{}:i,s=t.reduce(function(o,r){return Pn(r,o),o},n);e&&(i[e]=s)}function Pn(i,e){if(!Array.isArray(i)){e[i]=!0;return}var t=i.shift();if(t==="PARAMETER"&&(t=i.shift()),i.length===1){if(Array.isArray(i[0])){e[t]={},Pn(i[0],e[t]);return}e[t]=i[0];return}if(!i.length){e[t]=!0;return}if(t==="TOWGS84"){e[t]=i;return}if(t==="AXIS"){t in e||(e[t]=[]),e[t].push(i);return}Array.isArray(t)||(e[t]={});var n;switch(t){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[t]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&Pn(i[2],e[t]);return;case"SPHEROID":case"ELLIPSOID":e[t]={name:i[0],a:i[1],rf:i[2]},i.length===4&&Pn(i[3],e[t]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":i[0]=["name",i[0]],Tl(e,t,i);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":i[0]=["name",i[0]],Tl(e,t,i),e[t].type=t;return;default:for(n=-1;++n<i.length;)if(!Array.isArray(i[n]))return Pn(i,e[t]);return Tl(e,t,i)}}var QC=.017453292519943295;function Rt(i){return i*QC}function lf(i){const e=(i.projName||"").toLowerCase().replace(/_/g," ");!i.long0&&i.longc&&(e==="albers conic equal area"||e==="lambert azimuthal equal area")&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(e==="stereographic south pole"||e==="polar stereographic (variant b)")?(i.lat0=Rt(i.lat1>0?90:-90),i.lat_ts=i.lat1,delete i.lat1):!i.lat_ts&&i.lat0&&(e==="polar stereographic"||e==="polar stereographic (variant a)")&&(i.lat_ts=i.lat0,i.lat0=Rt(i.lat0>0?90:-90),delete i.lat1)}function cf(i){let e={units:null,to_meter:void 0};return typeof i=="string"?(e.units=i.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.units==="meter"&&(e.to_meter=1)):i&&i.name&&(e.units=i.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.to_meter=i.conversion_factor),e}function df(i){return typeof i=="object"?i.value*i.unit.conversion_factor:i}function hf(i,e){i.ellipsoid.radius?(e.a=i.ellipsoid.radius,e.rf=0):(e.a=df(i.ellipsoid.semi_major_axis),i.ellipsoid.inverse_flattening!==void 0?e.rf=i.ellipsoid.inverse_flattening:i.ellipsoid.semi_major_axis!==void 0&&i.ellipsoid.semi_minor_axis!==void 0&&(e.rf=e.a/(e.a-df(i.ellipsoid.semi_minor_axis))))}function ar(i,e={}){return!i||typeof i!="object"?i:i.type==="BoundCRS"?(ar(i.source_crs,e),i.transformation&&(i.transformation.method&&i.transformation.method.name==="NTv2"?e.nadgrids=i.transformation.parameters[0].value:e.datum_params=i.transformation.parameters.map(t=>t.value)),e):(Object.keys(i).forEach(t=>{const n=i[t];if(n!==null)switch(t){case"name":if(e.srsCode)break;e.name=n,e.srsCode=n;break;case"type":n==="GeographicCRS"?e.projName="longlat":n==="ProjectedCRS"&&i.conversion&&i.conversion.method&&(e.projName=i.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(e.ellps=n.ellipsoid.name,hf(n,e)),n.prime_meridian&&(e.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=n.name,hf(n,e);break;case"prime_meridian":e.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){if(e.axis=n.axis.map(s=>{const o=s.direction;if(o==="east")return"e";if(o==="north")return"n";if(o==="west")return"w";if(o==="south")return"s";throw new Error(`Unknown axis direction: ${o}`)}).join("")+"u",n.unit){const{units:s,to_meter:o}=cf(n.unit);e.units=s,e.to_meter=o}else if(n.axis[0]&&n.axis[0].unit){const{units:s,to_meter:o}=cf(n.axis[0].unit);e.units=s,e.to_meter=o}}break;case"id":n.authority&&n.code&&(e.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(e.projName=n.method.name),n.parameters&&n.parameters.forEach(s=>{const o=s.name.toLowerCase().replace(/\s+/g,"_"),r=s.value;s.unit&&s.unit.conversion_factor?e[o]=r*s.unit.conversion_factor:s.unit==="degree"?e[o]=r*Math.PI/180:e[o]=r});break;case"unit":n.name&&(e.units=n.name.toLowerCase(),e.units==="metre"&&(e.units="meter")),n.conversion_factor&&(e.to_meter=n.conversion_factor);break;case"base_crs":ar(n,e),e.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name;break}}),e.latitude_of_false_origin!==void 0&&(e.lat0=e.latitude_of_false_origin),e.longitude_of_false_origin!==void 0&&(e.long0=e.longitude_of_false_origin),e.latitude_of_standard_parallel!==void 0&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),e.latitude_of_1st_standard_parallel!==void 0&&(e.lat1=e.latitude_of_1st_standard_parallel),e.latitude_of_2nd_standard_parallel!==void 0&&(e.lat2=e.latitude_of_2nd_standard_parallel),e.latitude_of_projection_centre!==void 0&&(e.lat0=e.latitude_of_projection_centre),e.longitude_of_projection_centre!==void 0&&(e.longc=e.longitude_of_projection_centre),e.easting_at_false_origin!==void 0&&(e.x0=e.easting_at_false_origin),e.northing_at_false_origin!==void 0&&(e.y0=e.northing_at_false_origin),e.latitude_of_natural_origin!==void 0&&(e.lat0=e.latitude_of_natural_origin),e.longitude_of_natural_origin!==void 0&&(e.long0=e.longitude_of_natural_origin),e.longitude_of_origin!==void 0&&(e.long0=e.longitude_of_origin),e.false_easting!==void 0&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),e.false_northing!==void 0&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),e.standard_parallel_1!==void 0&&(e.lat1=e.standard_parallel_1),e.standard_parallel_2!==void 0&&(e.lat2=e.standard_parallel_2),e.scale_factor_at_natural_origin!==void 0&&(e.k0=e.scale_factor_at_natural_origin),e.scale_factor_at_projection_centre!==void 0&&(e.k0=e.scale_factor_at_projection_centre),e.scale_factor_on_pseudo_standard_parallel!==void 0&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),e.azimuth!==void 0&&(e.alpha=e.azimuth),e.azimuth_at_projection_centre!==void 0&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),lf(e),e)}var zC=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function HC(i,e){var t=e[0],n=e[1];!(t in i)&&n in i&&(i[t]=i[n],e.length===3&&(i[t]=e[2](i[t])))}function uf(i){for(var e=Object.keys(i),t=0,n=e.length;t<n;++t){var s=e[t];zC.indexOf(s)!==-1&&YC(i[s]),typeof i[s]=="object"&&uf(i[s])}}function YC(i){if(i.AUTHORITY){var e=Object.keys(i.AUTHORITY)[0];e&&e in i.AUTHORITY&&(i.title=e+":"+i.AUTHORITY[e])}if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var t="",n=0,s=i.AXIS.length;n<s;++n){var o=[i.AXIS[n][0].toLowerCase(),i.AXIS[n][1].toLowerCase()];o[0].indexOf("north")!==-1||(o[0]==="y"||o[0]==="lat")&&o[1]==="north"?t+="n":o[0].indexOf("south")!==-1||(o[0]==="y"||o[0]==="lat")&&o[1]==="south"?t+="s":o[0].indexOf("east")!==-1||(o[0]==="x"||o[0]==="lon")&&o[1]==="east"?t+="e":(o[0].indexOf("west")!==-1||(o[0]==="x"||o[0]==="lon")&&o[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(i.axis=t)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var r=i.GEOGCS;i.type==="GEOGCS"&&(r=i),r&&(r.DATUM?i.datumCode=r.DATUM.name.toLowerCase():i.datumCode=r.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),i.datumCode==="new_zealand_1949"&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode==="belge_1972"&&(i.datumCode="rnb72"),r.DATUM&&r.DATUM.SPHEROID&&(i.ellps=r.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=r.DATUM.SPHEROID.a,i.rf=parseFloat(r.DATUM.SPHEROID.rf,10)),r.DATUM&&r.DATUM.TOWGS84&&(i.datum_params=r.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a),i.rectified_grid_angle&&(i.rectified_grid_angle=Rt(i.rectified_grid_angle));function a(h){var u=i.to_meter||1;return h*u}var l=function(h){return HC(i,h)},c=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Rt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Rt],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Rt],["lat0","latitude_of_origin",Rt],["lat0","standard_parallel_1",Rt],["lat1","standard_parallel_1",Rt],["lat2","standard_parallel_2",Rt],["azimuth","Azimuth"],["alpha","azimuth",Rt],["srsCode","name"]];c.forEach(l),lf(i)}function lr(i){if(typeof i=="object")return ar(i);const e=FC(i);var t=VC(i);if(e==="WKT2"){const o=RC(t);return ar(o)}var n=t[0],s={};return Pn(t,s),uf(s),s[n]}function st(i){var e=this;if(arguments.length===2){var t=arguments[1];typeof t=="string"?t.charAt(0)==="+"?st[i]=Sl(arguments[1]):st[i]=lr(arguments[1]):t&&typeof t=="object"&&!("projName"in t)?st[i]=lr(arguments[1]):(st[i]=t,t||delete st[i])}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(n){return Array.isArray(n)?st.apply(e,n):st(n)});if(typeof i=="string"){if(i in st)return st[i]}else"EPSG"in i?st["EPSG:"+i.EPSG]=i:"ESRI"in i?st["ESRI:"+i.ESRI]=i:"IAU2000"in i&&(st["IAU2000:"+i.IAU2000]=i);return}}SC(st);function $C(i){return typeof i=="string"}function jC(i){return i in st}function WC(i){return i.indexOf("+")!==0&&i.indexOf("[")!==-1||typeof i=="object"&&!("srsCode"in i)}var qC=["3857","900913","3785","102113"];function KC(i){var e=Si(i,"authority");if(e){var t=Si(e,"epsg");return t&&qC.indexOf(t)>-1}}function XC(i){var e=Si(i,"extension");if(e)return Si(e,"proj4")}function JC(i){return i[0]==="+"}function ZC(i){if($C(i)){if(jC(i))return st[i];if(WC(i)){var e=lr(i);if(KC(e))return st["EPSG:3857"];var t=XC(e);return t?Sl(t):e}if(JC(i))return Sl(i)}else return"projName"in i?i:lr(i)}function ff(i,e){i=i||{};var t,n;if(!e)return i;for(n in e)t=e[n],t!==void 0&&(i[n]=t);return i}function Xt(i,e,t){var n=i*e;return t/Math.sqrt(1-n*n)}function Ls(i){return i<0?-1:1}function X(i,e){return e||Math.abs(i)<=Ue?i:i-Ls(i)*Ds}function Ft(i,e,t){var n=i*t,s=.5*i;return n=Math.pow((1-n)/(1+n),s),Math.tan(.5*($-e))/n}function Rs(i,e){for(var t=.5*i,n,s,o=$-2*Math.atan(e),r=0;r<=15;r++)if(n=i*Math.sin(o),s=$-2*Math.atan(e*Math.pow((1-n)/(1+n),t))-o,o+=s,Math.abs(s)<=1e-10)return o;return-9999}function eE(){var i=this.b/this.a;this.es=1-i*i,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Xt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function tE(i){var e=i.x,t=i.y;if(t*bt>90&&t*bt<-90&&e*bt>180&&e*bt<-180)return null;var n,s;if(Math.abs(Math.abs(t)-$)<=K)return null;if(this.sphere)n=this.x0+this.a*this.k0*X(e-this.long0,this.over),s=this.y0+this.a*this.k0*Math.log(Math.tan(ve+.5*t));else{var o=Math.sin(t),r=Ft(this.e,t,o);n=this.x0+this.a*this.k0*X(e-this.long0,this.over),s=this.y0-this.a*this.k0*Math.log(r)}return i.x=n,i.y=s,i}function iE(i){var e=i.x-this.x0,t=i.y-this.y0,n,s;if(this.sphere)s=$-2*Math.atan(Math.exp(-t/(this.a*this.k0)));else{var o=Math.exp(-t/(this.a*this.k0));if(s=Rs(this.e,o),s===-9999)return null}return n=X(this.long0+e/(this.a*this.k0),this.over),i.x=n,i.y=s,i}var nE=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"];const sE={init:eE,forward:tE,inverse:iE,names:nE};function oE(){}function pf(i){return i}var mf=["longlat","identity"],rE=[sE,{init:oE,forward:pf,inverse:pf,names:mf}],tn={},Dn=[];function gf(i,e){var t=Dn.length;return i.names?(Dn[t]=i,i.names.forEach(function(n){tn[n.toLowerCase()]=t}),this):!0}function yf(i){return i.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function aE(i){if(!i)return!1;var e=i.toLowerCase();if(typeof tn[e]<"u"&&Dn[tn[e]]||(e=yf(e),e in tn&&Dn[tn[e]]))return Dn[tn[e]]}function lE(){rE.forEach(gf)}const cE={start:lE,add:gf,get:aE};var Af={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};const dE=Af.WGS84;function hE(i,e,t,n){var s=i*i,o=e*e,r=(s-o)/s,a=0;n?(i*=1-r*(BC+r*(_C+r*kC)),s=i*i,r=0):a=Math.sqrt(r);var l=(s-o)/o;return{es:r,e:a,ep2:l}}function uE(i,e,t,n,s){if(!i){var o=Si(Af,n);o||(o=dE),i=o.a,e=o.b,t=o.rf}return t&&!e&&(e=(1-1/t)*i),(t===0||Math.abs(i-e)<K)&&(s=!0,e=i),{a:i,b:e,rf:t,sphere:s}}var cr={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.0276,-0.2167,0.2147,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-1.91514,1.60363,-9.09546,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243649,-1.158827,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,32.39344,-153.25684,-96.2266,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-8.393,0.749,-10.276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,1.25033e-7,4.6785e-8,5.6529e-8,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"61.55,-10.87,-40.19,39.4924,32.7221,32.8979,-9.994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"374,150,588"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"}};for(var fE in cr){var Bl=cr[fE];Bl.datumName&&(cr[Bl.datumName]=Bl)}function pE(i,e,t,n,s,o,r){var a={};return i===void 0||i==="none"?a.datum_type=Il:a.datum_type=MC,e&&(a.datum_params=e.map(parseFloat),(a.datum_params[0]!==0||a.datum_params[1]!==0||a.datum_params[2]!==0)&&(a.datum_type=Zi),a.datum_params.length>3&&(a.datum_params[3]!==0||a.datum_params[4]!==0||a.datum_params[5]!==0||a.datum_params[6]!==0)&&(a.datum_type=en,a.datum_params[3]*=Ps,a.datum_params[4]*=Ps,a.datum_params[5]*=Ps,a.datum_params[6]=a.datum_params[6]/1e6+1)),r&&(a.datum_type=kn,a.grids=r),a.a=t,a.b=n,a.es=s,a.ep2=o,a}var _l={};function mE(i,e,t){return e instanceof ArrayBuffer?gE(i,e,t):{ready:yE(i,e)}}function gE(i,e,t){var n=!0;t!==void 0&&t.includeErrorFields===!1&&(n=!1);var s=new DataView(e),o=bE(s),r=wE(s,o),a=CE(s,r,o,n),l={header:r,subgrids:a};return _l[i]=l,l}async function yE(i,e){for(var t=[],n=await e.getImageCount(),s=n-1;s>=0;s--){var o=await e.getImage(s),r=await o.readRasters(),a=r,l=[o.getWidth(),o.getHeight()],c=o.getBoundingBox().map(vf),h=[o.fileDirectory.ModelPixelScale[0],o.fileDirectory.ModelPixelScale[1]].map(vf),u=c[0]+(l[0]-1)*h[0],p=c[3]-(l[1]-1)*h[1],f=a[0],m=a[1],y=[];for(let v=l[1]-1;v>=0;v--)for(let b=l[0]-1;b>=0;b--){var g=v*l[0]+b;y.push([-Mi(m[g]),Mi(f[g])])}t.push({del:h,lim:l,ll:[-u,p],cvs:y})}var A={header:{nSubgrids:n},subgrids:t};return _l[i]=A,A}function AE(i){if(i===void 0)return null;var e=i.split(",");return e.map(vE)}function vE(i){if(i.length===0)return null;var e=i[0]==="@";return e&&(i=i.slice(1)),i==="null"?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:i,mandatory:!e,grid:_l[i]||null,isNull:!1}}function vf(i){return i*Math.PI/180}function Mi(i){return i/3600*Math.PI/180}function bE(i){var e=i.getInt32(8,!1);return e===11?!1:(e=i.getInt32(8,!0),e!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function wE(i,e){return{nFields:i.getInt32(8,e),nSubgridFields:i.getInt32(24,e),nSubgrids:i.getInt32(40,e),shiftType:kl(i,56,64).trim(),fromSemiMajorAxis:i.getFloat64(120,e),fromSemiMinorAxis:i.getFloat64(136,e),toSemiMajorAxis:i.getFloat64(152,e),toSemiMinorAxis:i.getFloat64(168,e)}}function kl(i,e,t){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(e,t)))}function CE(i,e,t,n){for(var s=176,o=[],r=0;r<e.nSubgrids;r++){var a=xE(i,s,t),l=IE(i,s,a,t,n),c=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),h=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);o.push({ll:[Mi(a.lowerLongitude),Mi(a.lowerLatitude)],del:[Mi(a.longitudeInterval),Mi(a.latitudeInterval)],lim:[c,h],count:a.gridNodeCount,cvs:EE(l)});var u=16;n===!1&&(u=8),s+=176+a.gridNodeCount*u}return o}function EE(i){return i.map(function(e){return[Mi(e.longitudeShift),Mi(e.latitudeShift)]})}function xE(i,e,t){return{name:kl(i,e+8,e+16).trim(),parent:kl(i,e+24,e+24+8).trim(),lowerLatitude:i.getFloat64(e+72,t),upperLatitude:i.getFloat64(e+88,t),lowerLongitude:i.getFloat64(e+104,t),upperLongitude:i.getFloat64(e+120,t),latitudeInterval:i.getFloat64(e+136,t),longitudeInterval:i.getFloat64(e+152,t),gridNodeCount:i.getInt32(e+168,t)}}function IE(i,e,t,n,s){var o=e+176,r=16;s===!1&&(r=8);for(var a=[],l=0;l<t.gridNodeCount;l++){var c={latitudeShift:i.getFloat32(o+l*r,n),longitudeShift:i.getFloat32(o+l*r+4,n)};s!==!1&&(c.latitudeAccuracy=i.getFloat32(o+l*r+8,n),c.longitudeAccuracy=i.getFloat32(o+l*r+12,n)),a.push(c)}return a}function Pt(i,e){if(!(this instanceof Pt))return new Pt(i);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(c){if(c)throw c};var t=ZC(i);if(typeof t!="object"){e("Could not parse to valid json: "+i);return}var n=Pt.projections.get(t.projName);if(!n){e("Could not get projection name from: "+i);return}if(t.datumCode&&t.datumCode!=="none"){var s=Si(cr,t.datumCode);s&&(t.datum_params=t.datum_params||(s.towgs84?s.towgs84.split(","):null),t.ellps=s.ellipse,t.datumName=s.datumName?s.datumName:t.datumCode)}t.k0=t.k0||1,t.axis=t.axis||"enu",t.ellps=t.ellps||"wgs84",t.lat1=t.lat1||t.lat0;var o=uE(t.a,t.b,t.rf,t.ellps,t.sphere),r=hE(o.a,o.b,o.rf,t.R_A),a=AE(t.nadgrids),l=t.datum||pE(t.datumCode,t.datum_params,o.a,o.b,r.es,r.ep2,a);ff(this,t),ff(this,n),this.a=o.a,this.b=o.b,this.rf=o.rf,this.sphere=o.sphere,this.es=r.es,this.e=r.e,this.ep2=r.ep2,this.datum=l,"init"in this&&typeof this.init=="function"&&this.init(),e(null,this)}Pt.projections=cE,Pt.projections.start();function SE(i,e){return i.datum_type!==e.datum_type||i.a!==e.a||Math.abs(i.es-e.es)>5e-11?!1:i.datum_type===Zi?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]:i.datum_type===en?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]&&i.datum_params[3]===e.datum_params[3]&&i.datum_params[4]===e.datum_params[4]&&i.datum_params[5]===e.datum_params[5]&&i.datum_params[6]===e.datum_params[6]:!0}function bf(i,e,t){var n=i.x,s=i.y,o=i.z?i.z:0,r,a,l,c;if(s<-$&&s>-1.001*$)s=-$;else if(s>$&&s<1.001*$)s=$;else{if(s<-$)return{x:-1/0,y:-1/0,z:i.z};if(s>$)return{x:1/0,y:1/0,z:i.z}}return n>Math.PI&&(n-=2*Math.PI),a=Math.sin(s),c=Math.cos(s),l=a*a,r=t/Math.sqrt(1-e*l),{x:(r+o)*c*Math.cos(n),y:(r+o)*c*Math.sin(n),z:(r*(1-e)+o)*a}}function wf(i,e,t,n){var s=1e-12,o=s*s,r=30,a,l,c,h,u,p,f,m,y,g,A,v,b,C=i.x,x=i.y,I=i.z?i.z:0,E,S,w;if(a=Math.sqrt(C*C+x*x),l=Math.sqrt(C*C+x*x+I*I),a/t<s){if(E=0,l/t<s)return S=$,w=-n,{x:i.x,y:i.y,z:i.z}}else E=Math.atan2(x,C);c=I/l,h=a/l,u=1/Math.sqrt(1-e*(2-e)*h*h),m=h*(1-e)*u,y=c*u,b=0;do b++,f=t/Math.sqrt(1-e*y*y),w=a*m+I*y-f*(1-e*y*y),p=e*f/(f+w),u=1/Math.sqrt(1-p*(2-p)*h*h),g=h*(1-p)*u,A=c*u,v=A*m-g*y,m=g,y=A;while(v*v>o&&b<r);return S=Math.atan(A/Math.abs(g)),{x:E,y:S,z:w}}function ME(i,e,t){if(e===Zi)return{x:i.x+t[0],y:i.y+t[1],z:i.z+t[2]};if(e===en){var n=t[0],s=t[1],o=t[2],r=t[3],a=t[4],l=t[5],c=t[6];return{x:c*(i.x-l*i.y+a*i.z)+n,y:c*(l*i.x+i.y-r*i.z)+s,z:c*(-a*i.x+r*i.y+i.z)+o}}}function TE(i,e,t){if(e===Zi)return{x:i.x-t[0],y:i.y-t[1],z:i.z-t[2]};if(e===en){var n=t[0],s=t[1],o=t[2],r=t[3],a=t[4],l=t[5],c=t[6],h=(i.x-n)/c,u=(i.y-s)/c,p=(i.z-o)/c;return{x:h+l*u-a*p,y:-l*h+u+r*p,z:a*h-r*u+p}}}function dr(i){return i===Zi||i===en}function BE(i,e,t){if(SE(i,e)||i.datum_type===Il||e.datum_type===Il)return t;var n=i.a,s=i.es;if(i.datum_type===kn){var o=Cf(i,!1,t);if(o!==0)return;n=Zu,s=ef}var r=e.a,a=e.b,l=e.es;if(e.datum_type===kn&&(r=Zu,a=TC,l=ef),s===l&&n===r&&!dr(i.datum_type)&&!dr(e.datum_type))return t;if(t=bf(t,s,n),dr(i.datum_type)&&(t=ME(t,i.datum_type,i.datum_params)),dr(e.datum_type)&&(t=TE(t,e.datum_type,e.datum_params)),t=wf(t,l,r,a),e.datum_type===kn){var c=Cf(e,!0,t);if(c!==0)return}return t}function Cf(i,e,t){if(i.grids===null||i.grids.length===0)return-1;var n={x:-t.x,y:t.y},s={x:Number.NaN,y:Number.NaN},o=[];e:for(var r=0;r<i.grids.length;r++){var a=i.grids[r];if(o.push(a.name),a.isNull){s=n;break}if(a.grid===null){if(a.mandatory)return""+a.name,-1;continue}for(var l=a.grid.subgrids,c=0,h=l.length;c<h;c++){var u=l[c],p=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,f=u.ll[0]-p,m=u.ll[1]-p,y=u.ll[0]+(u.lim[0]-1)*u.del[0]+p,g=u.ll[1]+(u.lim[1]-1)*u.del[1]+p;if(!(m>n.y||f>n.x||g<n.y||y<n.x)&&(s=_E(n,e,u),!isNaN(s.x)))break e}}return isNaN(s.x)?(""+-n.x*bt+n.y*bt+o,-1):(t.x=-s.x,t.y=s.y,0)}function _E(i,e,t){var n={x:Number.NaN,y:Number.NaN};if(isNaN(i.x))return n;var s={x:i.x,y:i.y};s.x-=t.ll[0],s.y-=t.ll[1],s.x=X(s.x-Math.PI)+Math.PI;var o=Ef(s,t);if(e){if(isNaN(o.x))return n;o.x=s.x-o.x,o.y=s.y-o.y;var r=9,a=1e-12,l,c;do{if(c=Ef(o,t),isNaN(c.x))break;l={x:s.x-(c.x+o.x),y:s.y-(c.y+o.y)},o.x+=l.x,o.y+=l.y}while(r--&&Math.abs(l.x)>a&&Math.abs(l.y)>a);if(r<0)return n;n.x=X(o.x+t.ll[0]),n.y=o.y+t.ll[1]}else isNaN(o.x)||(n.x=i.x+o.x,n.y=i.y+o.y);return n}function Ef(i,e){var t={x:i.x/e.del[0],y:i.y/e.del[1]},n={x:Math.floor(t.x),y:Math.floor(t.y)},s={x:t.x-1*n.x,y:t.y-1*n.y},o={x:Number.NaN,y:Number.NaN},r;if(n.x<0||n.x>=e.lim[0]||n.y<0||n.y>=e.lim[1])return o;r=n.y*e.lim[0]+n.x;var a={x:e.cvs[r][0],y:e.cvs[r][1]};r++;var l={x:e.cvs[r][0],y:e.cvs[r][1]};r+=e.lim[0];var c={x:e.cvs[r][0],y:e.cvs[r][1]};r--;var h={x:e.cvs[r][0],y:e.cvs[r][1]},u=s.x*s.y,p=s.x*(1-s.y),f=(1-s.x)*(1-s.y),m=(1-s.x)*s.y;return o.x=f*a.x+p*l.x+m*h.x+u*c.x,o.y=f*a.y+p*l.y+m*h.y+u*c.y,o}function xf(i,e,t){var n=t.x,s=t.y,o=t.z||0,r,a,l,c={};for(l=0;l<3;l++)if(!(e&&l===2&&t.z===void 0))switch(l===0?(r=n,"ew".indexOf(i.axis[l])!==-1?a="x":a="y"):l===1?(r=s,"ns".indexOf(i.axis[l])!==-1?a="y":a="x"):(r=o,a="z"),i.axis[l]){case"e":c[a]=r;break;case"w":c[a]=-r;break;case"n":c[a]=r;break;case"s":c[a]=-r;break;case"u":t[a]!==void 0&&(c.z=r);break;case"d":t[a]!==void 0&&(c.z=-r);break;default:return null}return c}function If(i){var e={x:i[0],y:i[1]};return i.length>2&&(e.z=i[2]),i.length>3&&(e.m=i[3]),e}function kE(i){Sf(i.x),Sf(i.y)}function Sf(i){if(typeof Number.isFinite=="function"){if(Number.isFinite(i))return;throw new TypeError("coordinates must be finite numbers")}if(typeof i!="number"||i!==i||!isFinite(i))throw new TypeError("coordinates must be finite numbers")}function PE(i,e){return(i.datum.datum_type===Zi||i.datum.datum_type===en||i.datum.datum_type===kn)&&e.datumCode!=="WGS84"||(e.datum.datum_type===Zi||e.datum.datum_type===en||e.datum.datum_type===kn)&&i.datumCode!=="WGS84"}function hr(i,e,t,n){var s;Array.isArray(t)?t=If(t):t={x:t.x,y:t.y,z:t.z,m:t.m};var o=t.z!==void 0;if(kE(t),i.datum&&e.datum&&PE(i,e)&&(s=new Pt("WGS84"),t=hr(i,s,t,n),i=s),n&&i.axis!=="enu"&&(t=xf(i,!1,t)),i.projName==="longlat")t={x:t.x*Oe,y:t.y*Oe,z:t.z||0};else if(i.to_meter&&(t={x:t.x*i.to_meter,y:t.y*i.to_meter,z:t.z||0}),t=i.inverse(t),!t)return;if(i.from_greenwich&&(t.x+=i.from_greenwich),t=BE(i.datum,e.datum,t),!!t)return t=t,e.from_greenwich&&(t={x:t.x-e.from_greenwich,y:t.y,z:t.z||0}),e.projName==="longlat"?t={x:t.x*bt,y:t.y*bt,z:t.z||0}:(t=e.forward(t),e.to_meter&&(t={x:t.x/e.to_meter,y:t.y/e.to_meter,z:t.z||0})),n&&e.axis!=="enu"?xf(e,!0,t):(t&&!o&&delete t.z,t)}var Mf=Pt("WGS84");function Pl(i,e,t,n){var s,o,r;return Array.isArray(t)?(s=hr(i,e,t,n)||{x:NaN,y:NaN},t.length>2?typeof i.name<"u"&&i.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"?typeof s.z=="number"?[s.x,s.y,s.z].concat(t.slice(3)):[s.x,s.y,t[2]].concat(t.slice(3)):[s.x,s.y].concat(t.slice(2)):[s.x,s.y]):(o=hr(i,e,t,n),r=Object.keys(t),r.length===2||r.forEach(function(a){if(typeof i.name<"u"&&i.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(a==="x"||a==="y"||a==="z")return}else if(a==="x"||a==="y")return;o[a]=t[a]}),o)}function ur(i){return i instanceof Pt?i:typeof i=="object"&&"oProj"in i?i.oProj:Pt(i)}function DE(i,e,t){var n,s,o=!1,r;return typeof e>"u"?(s=ur(i),n=Mf,o=!0):(typeof e.x<"u"||Array.isArray(e))&&(t=e,s=ur(i),n=Mf,o=!0),n||(n=ur(i)),s||(s=ur(e)),t?Pl(n,s,t):(r={forward:function(a,l){return Pl(n,s,a,l)},inverse:function(a,l){return Pl(s,n,a,l)}},o&&(r.oProj=s),r)}var Tf=6,Bf="AJSAJS",_f="AFAFAF",Nn=65,Ct=73,Dt=79,Fs=86,Os=90;const NE={forward:kf,inverse:LE,toPoint:Pf};function kf(i,e){return e=e||5,OE(RE({lat:i[1],lon:i[0]}),e)}function LE(i){var e=Nl(Lf(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function Pf(i){var e=Nl(Lf(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Dl(i){return i*(Math.PI/180)}function Df(i){return 180*(i/Math.PI)}function RE(i){var e=i.lat,t=i.lon,n=6378137,s=.00669438,o=.9996,r,a,l,c,h,u,p,f=Dl(e),m=Dl(t),y,g;g=Math.floor((t+180)/6)+1,t===180&&(g=60),e>=56&&e<64&&t>=3&&t<12&&(g=32),e>=72&&e<84&&(t>=0&&t<9?g=31:t>=9&&t<21?g=33:t>=21&&t<33?g=35:t>=33&&t<42&&(g=37)),r=(g-1)*6-180+3,y=Dl(r),a=s/(1-s),l=n/Math.sqrt(1-s*Math.sin(f)*Math.sin(f)),c=Math.tan(f)*Math.tan(f),h=a*Math.cos(f)*Math.cos(f),u=Math.cos(f)*(m-y),p=n*((1-s/4-3*s*s/64-5*s*s*s/256)*f-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*f)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*f)-35*s*s*s/3072*Math.sin(6*f));var A=o*l*(u+(1-c+h)*u*u*u/6+(5-18*c+c*c+72*h-58*a)*u*u*u*u*u/120)+5e5,v=o*(p+l*Math.tan(f)*(u*u/2+(5-c+9*h+4*h*h)*u*u*u*u/24+(61-58*c+c*c+600*h-330*a)*u*u*u*u*u*u/720));return e<0&&(v+=1e7),{northing:Math.round(v),easting:Math.round(A),zoneNumber:g,zoneLetter:FE(e)}}function Nl(i){var e=i.northing,t=i.easting,n=i.zoneLetter,s=i.zoneNumber;if(s<0||s>60)return null;var o=.9996,r=6378137,a=.00669438,l,c=(1-Math.sqrt(1-a))/(1+Math.sqrt(1-a)),h,u,p,f,m,y,g,A,v,b=t-5e5,C=e;n<"N"&&(C-=1e7),g=(s-1)*6-180+3,l=a/(1-a),y=C/o,A=y/(r*(1-a/4-3*a*a/64-5*a*a*a/256)),v=A+(3*c/2-27*c*c*c/32)*Math.sin(2*A)+(21*c*c/16-55*c*c*c*c/32)*Math.sin(4*A)+151*c*c*c/96*Math.sin(6*A),h=r/Math.sqrt(1-a*Math.sin(v)*Math.sin(v)),u=Math.tan(v)*Math.tan(v),p=l*Math.cos(v)*Math.cos(v),f=r*(1-a)/Math.pow(1-a*Math.sin(v)*Math.sin(v),1.5),m=b/(h*o);var x=v-h*Math.tan(v)/f*(m*m/2-(5+3*u+10*p-4*p*p-9*l)*m*m*m*m/24+(61+90*u+298*p+45*u*u-252*l-3*p*p)*m*m*m*m*m*m/720);x=Df(x);var I=(m-(1+2*u+p)*m*m*m/6+(5-2*p+28*u-3*p*p+8*l+24*u*u)*m*m*m*m*m/120)/Math.cos(v);I=g+Df(I);var E;if(i.accuracy){var S=Nl({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});E={top:S.lat,right:S.lon,bottom:x,left:I}}else E={lat:x,lon:I};return E}function FE(i){var e="Z";return 84>=i&&i>=72?e="X":72>i&&i>=64?e="W":64>i&&i>=56?e="V":56>i&&i>=48?e="U":48>i&&i>=40?e="T":40>i&&i>=32?e="S":32>i&&i>=24?e="R":24>i&&i>=16?e="Q":16>i&&i>=8?e="P":8>i&&i>=0?e="N":0>i&&i>=-8?e="M":-8>i&&i>=-16?e="L":-16>i&&i>=-24?e="K":-24>i&&i>=-32?e="J":-32>i&&i>=-40?e="H":-40>i&&i>=-48?e="G":-48>i&&i>=-56?e="F":-56>i&&i>=-64?e="E":-64>i&&i>=-72?e="D":-72>i&&i>=-80&&(e="C"),e}function OE(i,e){var t="00000"+i.easting,n="00000"+i.northing;return i.zoneNumber+i.zoneLetter+GE(i.easting,i.northing,i.zoneNumber)+t.substr(t.length-5,e)+n.substr(n.length-5,e)}function GE(i,e,t){var n=Nf(t),s=Math.floor(i/1e5),o=Math.floor(e/1e5)%20;return UE(s,o,n)}function Nf(i){var e=i%Tf;return e===0&&(e=Tf),e}function UE(i,e,t){var n=t-1,s=Bf.charCodeAt(n),o=_f.charCodeAt(n),r=s+i-1,a=o+e,l=!1;r>Os&&(r=r-Os+Nn-1,l=!0),(r===Ct||s<Ct&&r>Ct||(r>Ct||s<Ct)&&l)&&r++,(r===Dt||s<Dt&&r>Dt||(r>Dt||s<Dt)&&l)&&(r++,r===Ct&&r++),r>Os&&(r=r-Os+Nn-1),a>Fs?(a=a-Fs+Nn-1,l=!0):l=!1,(a===Ct||o<Ct&&a>Ct||(a>Ct||o<Ct)&&l)&&a++,(a===Dt||o<Dt&&a>Dt||(a>Dt||o<Dt)&&l)&&(a++,a===Ct&&a++),a>Fs&&(a=a-Fs+Nn-1);var c=String.fromCharCode(r)+String.fromCharCode(a);return c}function Lf(i){if(i&&i.length===0)throw"MGRSPoint coverting from nothing";for(var e=i.length,t=null,n="",s,o=0;!/[A-Z]/.test(s=i.charAt(o));){if(o>=2)throw"MGRSPoint bad conversion from: "+i;n+=s,o++}var r=parseInt(n,10);if(o===0||o+3>e)throw"MGRSPoint bad conversion from: "+i;var a=i.charAt(o++);if(a<="A"||a==="B"||a==="Y"||a>="Z"||a==="I"||a==="O")throw"MGRSPoint zone letter "+a+" not handled: "+i;t=i.substring(o,o+=2);for(var l=Nf(r),c=VE(t.charAt(0),l),h=QE(t.charAt(1),l);h<zE(a);)h+=2e6;var u=e-o;if(u%2!==0)throw`MGRSPoint has to have an even number
14
- of digits after the zone letter and two 100km letters - front
15
- half for easting meters, second half for
16
- northing meters`+i;var p=u/2,f=0,m=0,y,g,A,v,b;return p>0&&(y=1e5/Math.pow(10,p),g=i.substring(o,o+p),f=parseFloat(g)*y,A=i.substring(o+p),m=parseFloat(A)*y),v=f+c,b=m+h,{easting:v,northing:b,zoneLetter:a,zoneNumber:r,accuracy:y}}function VE(i,e){for(var t=Bf.charCodeAt(e-1),n=1e5,s=!1;t!==i.charCodeAt(0);){if(t++,t===Ct&&t++,t===Dt&&t++,t>Os){if(s)throw"Bad character: "+i;t=Nn,s=!0}n+=1e5}return n}function QE(i,e){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var t=_f.charCodeAt(e-1),n=0,s=!1;t!==i.charCodeAt(0);){if(t++,t===Ct&&t++,t===Dt&&t++,t>Fs){if(s)throw"Bad character: "+i;t=Nn,s=!0}n+=1e5}return n}function zE(i){var e;switch(i){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+i}function Ln(i,e,t){if(!(this instanceof Ln))return new Ln(i,e,t);if(Array.isArray(i))this.x=i[0],this.y=i[1],this.z=i[2]||0;else if(typeof i=="object")this.x=i.x,this.y=i.y,this.z=i.z||0;else if(typeof i=="string"&&typeof e>"u"){var n=i.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[2])||0}else this.x=i,this.y=e,this.z=t||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Ln.fromMGRS=function(i){return new Ln(Pf(i))},Ln.prototype.toMGRS=function(i){return kf([this.x,this.y],i)};var HE=1,YE=.25,Rf=.046875,Ff=.01953125,Of=.01068115234375,$E=.75,jE=.46875,WE=.013020833333333334,qE=.007120768229166667,KE=.3645833333333333,XE=.005696614583333333,JE=.3076171875;function Ll(i){var e=[];e[0]=HE-i*(YE+i*(Rf+i*(Ff+i*Of))),e[1]=i*($E-i*(Rf+i*(Ff+i*Of)));var t=i*i;return e[2]=t*(jE-i*(WE+i*qE)),t*=i,e[3]=t*(KE-i*XE),e[4]=t*i*JE,e}function Rn(i,e,t,n){return t*=e,e*=e,n[0]*i-t*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var ZE=20;function Rl(i,e,t){for(var n=1/(1-e),s=i,o=ZE;o;--o){var r=Math.sin(s),a=1-e*r*r;if(a=(Rn(s,r,Math.cos(s),t)-i)*(a*Math.sqrt(a))*n,s-=a,Math.abs(a)<K)return s}return s}function ex(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Ll(this.es),this.ml0=Rn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function tx(i){var e=i.x,t=i.y,n=X(e-this.long0,this.over),s,o,r,a=Math.sin(t),l=Math.cos(t);if(this.es){var h=l*n,u=Math.pow(h,2),p=this.ep2*Math.pow(l,2),f=Math.pow(p,2),m=Math.abs(l)>K?Math.tan(t):0,y=Math.pow(m,2),g=Math.pow(y,2);s=1-this.es*Math.pow(a,2),h=h/Math.sqrt(s);var A=Rn(t,a,l,this.en);o=this.a*(this.k0*h*(1+u/6*(1-y+p+u/20*(5-18*y+g+14*p-58*y*p+u/42*(61+179*g-g*y-479*y)))))+this.x0,r=this.a*(this.k0*(A-this.ml0+a*n*h/2*(1+u/12*(5-y+9*p+4*f+u/30*(61+g-58*y+270*p-330*y*p+u/56*(1385+543*g-g*y-3111*y))))))+this.y0}else{var c=l*Math.sin(n);if(Math.abs(Math.abs(c)-1)<K)return 93;if(o=.5*this.a*this.k0*Math.log((1+c)/(1-c))+this.x0,r=l*Math.cos(n)/Math.sqrt(1-Math.pow(c,2)),c=Math.abs(r),c>=1){if(c-1>K)return 93;r=0}else r=Math.acos(r);t<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return i.x=o,i.y=r,i}function ix(i){var e,t,n,s,o=(i.x-this.x0)*(1/this.a),r=(i.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+r/this.k0,t=Rl(e,this.es,this.en),Math.abs(t)<$){var u=Math.sin(t),p=Math.cos(t),f=Math.abs(p)>K?Math.tan(t):0,m=this.ep2*Math.pow(p,2),y=Math.pow(m,2),g=Math.pow(f,2),A=Math.pow(g,2);e=1-this.es*Math.pow(u,2);var v=o*Math.sqrt(e)/this.k0,b=Math.pow(v,2);e=e*f,n=t-e*b/(1-this.es)*.5*(1-b/12*(5+3*g-9*m*g+m-4*y-b/30*(61+90*g-252*m*g+45*A+46*m-b/56*(1385+3633*g+4095*A+1574*A*g)))),s=X(this.long0+v*(1-b/6*(1+2*g+m-b/20*(5+28*g+24*A+8*m*g+6*m-b/42*(61+662*g+1320*A+720*A*g))))/p,this.over)}else n=$*Ls(r),s=0;else{var a=Math.exp(o/this.k0),l=.5*(a-1/a),c=this.lat0+r/this.k0,h=Math.cos(c);e=Math.sqrt((1-Math.pow(h,2))/(1+Math.pow(l,2))),n=Math.asin(e),r<0&&(n=-n),l===0&&h===0?s=0:s=X(Math.atan2(l,h)+this.long0,this.over)}return i.x=s,i.y=n,i}var nx=["Fast_Transverse_Mercator","Fast Transverse Mercator"];const fr={init:ex,forward:tx,inverse:ix,names:nx};function Gf(i){var e=Math.exp(i);return e=(e-1/e)/2,e}function Et(i,e){i=Math.abs(i),e=Math.abs(e);var t=Math.max(i,e),n=Math.min(i,e)/(t||1);return t*Math.sqrt(1+Math.pow(n,2))}function sx(i){var e=1+i,t=e-1;return t===0?i:i*Math.log(e)/t}function ox(i){var e=Math.abs(i);return e=sx(e*(1+e/(Et(1,e)+1))),i<0?-e:e}function Fl(i,e){for(var t=2*Math.cos(2*e),n=i.length-1,s=i[n],o=0,r;--n>=0;)r=-o+t*s+i[n],o=s,s=r;return e+r*Math.sin(2*e)}function rx(i,e){for(var t=2*Math.cos(e),n=i.length-1,s=i[n],o=0,r;--n>=0;)r=-o+t*s+i[n],o=s,s=r;return Math.sin(e)*r}function ax(i){var e=Math.exp(i);return e=(e+1/e)/2,e}function Uf(i,e,t){for(var n=Math.sin(e),s=Math.cos(e),o=Gf(t),r=ax(t),a=2*s*r,l=-2*n*o,c=i.length-1,h=i[c],u=0,p=0,f=0,m,y;--c>=0;)m=p,y=u,p=h,u=f,h=-m+a*p-l*u+i[c],f=-y+l*p+a*u;return a=n*r,l=s*o,[a*h-l*f,a*f+l*h]}function lx(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(fr.init.apply(this),this.forward=fr.forward,this.inverse=fr.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var i=this.es/(1+Math.sqrt(1-this.es)),e=i/(2-i),t=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),t=t*e,this.cgb[1]=t*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=t*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),t=t*e,this.cgb[2]=t*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=t*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),t=t*e,this.cgb[3]=t*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=t*(1237/630+e*(-12/5+e*(-24832/14175))),t=t*e,this.cgb[4]=t*(4174/315+e*(-144838/6237)),this.cbg[4]=t*(-734/315+e*(109598/31185)),t=t*e,this.cgb[5]=t*(601676/22275),this.cbg[5]=t*(444337/155925),t=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+t*(1/4+t*(1/64+t/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=t*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=t*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),t=t*e,this.utg[2]=t*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=t*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),t=t*e,this.utg[3]=t*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=t*(49561/161280+e*(-179/168+e*(6601661/7257600))),t=t*e,this.utg[4]=t*(-4583/161280+e*(108847/3991680)),this.gtu[4]=t*(34729/80640+e*(-3418889/1995840)),t=t*e,this.utg[5]=t*(-20648693/638668800),this.gtu[5]=t*(212378941/319334400);var n=Fl(this.cbg,this.lat0);this.Zb=-this.Qn*(n+rx(this.gtu,2*n))}function cx(i){var e=X(i.x-this.long0,this.over),t=i.y;t=Fl(this.cbg,t);var n=Math.sin(t),s=Math.cos(t),o=Math.sin(e),r=Math.cos(e);t=Math.atan2(n,r*s),e=Math.atan2(o*s,Et(n,s*r)),e=ox(Math.tan(e));var a=Uf(this.gtu,2*t,2*e);t=t+a[0],e=e+a[1];var l,c;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,c=this.a*(this.Qn*t+this.Zb)+this.y0):(l=1/0,c=1/0),i.x=l,i.y=c,i}function dx(i){var e=(i.x-this.x0)*(1/this.a),t=(i.y-this.y0)*(1/this.a);t=(t-this.Zb)/this.Qn,e=e/this.Qn;var n,s;if(Math.abs(e)<=2.623395162778){var o=Uf(this.utg,2*t,2*e);t=t+o[0],e=e+o[1],e=Math.atan(Gf(e));var r=Math.sin(t),a=Math.cos(t),l=Math.sin(e),c=Math.cos(e);t=Math.atan2(r*c,Et(l,c*a)),e=Math.atan2(l,c*a),n=X(e+this.long0,this.over),s=Fl(this.cgb,t)}else n=1/0,s=1/0;return i.x=n,i.y=s,i}var hx=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"];const pr={init:lx,forward:cx,inverse:dx,names:hx};function ux(i,e){if(i===void 0){if(i=Math.floor((X(e)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var fx="etmerc";function px(){var i=ux(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*Oe,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,pr.init.apply(this),this.forward=pr.forward,this.inverse=pr.inverse}var mx=["Universal Transverse Mercator System","utm"];const gx={init:px,names:mx,dependsOn:fx};function Ol(i,e){return Math.pow((1-i)/(1+i),e)}var yx=20;function Ax(){var i=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*i*i),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(i/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+ve)/(Math.pow(Math.tan(.5*this.lat0+ve),this.C)*Ol(this.e*i,this.ratexp))}function vx(i){var e=i.x,t=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*t+ve),this.C)*Ol(this.e*Math.sin(t),this.ratexp))-$,i.x=this.C*e,i}function bx(i){for(var e=1e-14,t=i.x/this.C,n=i.y,s=Math.pow(Math.tan(.5*n+ve)/this.K,1/this.C),o=yx;o>0&&(n=2*Math.atan(s*Ol(this.e*Math.sin(i.y),-.5*this.e))-$,!(Math.abs(n-i.y)<e));--o)i.y=n;return o?(i.x=t,i.y=n,i):null}const Gl={init:Ax,forward:vx,inverse:bx};function wx(){Gl.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function Cx(i){var e,t,n,s;return i.x=X(i.x-this.long0,this.over),Gl.forward.apply(this,[i]),e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),s=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*t*n),i.x=s*t*Math.sin(i.x),i.y=s*(this.cosc0*e-this.sinc0*t*n),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function Ex(i){var e,t,n,s,o;if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,o=Et(i.x,i.y)){var r=2*Math.atan2(o,this.R2);e=Math.sin(r),t=Math.cos(r),s=Math.asin(t*this.sinc0+i.y*e*this.cosc0/o),n=Math.atan2(i.x*e,o*this.cosc0*t-i.y*this.sinc0*e)}else s=this.phic0,n=0;return i.x=n,i.y=s,Gl.inverse.apply(this,[i]),i.x=X(i.x+this.long0,this.over),i}var xx=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"];const Ix={init:wx,forward:Cx,inverse:Ex,names:xx};function Ul(i,e,t){return e*=t,Math.tan(.5*($+i))*Math.pow((1-e)/(1+e),.5*t)}function Sx(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=K&&(this.k0=.5*(1+Ls(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=K&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=K&&Math.abs(Math.cos(this.lat_ts))>K&&(this.k0=.5*this.cons*Xt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Ft(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Xt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Ul(this.lat0,this.sinlat0,this.e))-$,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Mx(i){var e=i.x,t=i.y,n=Math.sin(t),s=Math.cos(t),o,r,a,l,c,h,u=X(e-this.long0,this.over);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=K&&Math.abs(t+this.lat0)<=K?(i.x=NaN,i.y=NaN,i):this.sphere?(o=2*this.k0/(1+this.sinlat0*n+this.coslat0*s*Math.cos(u)),i.x=this.a*o*s*Math.sin(u)+this.x0,i.y=this.a*o*(this.coslat0*n-this.sinlat0*s*Math.cos(u))+this.y0,i):(r=2*Math.atan(Ul(t,n,this.e))-$,l=Math.cos(r),a=Math.sin(r),Math.abs(this.coslat0)<=K?(c=Ft(this.e,t*this.con,this.con*n),h=2*this.a*this.k0*c/this.cons,i.x=this.x0+h*Math.sin(e-this.long0),i.y=this.y0-this.con*h*Math.cos(e-this.long0),i):(Math.abs(this.sinlat0)<K?(o=2*this.a*this.k0/(1+l*Math.cos(u)),i.y=o*a):(o=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*l*Math.cos(u))),i.y=o*(this.cosX0*a-this.sinX0*l*Math.cos(u))+this.y0),i.x=o*l*Math.sin(u)+this.x0,i))}function Tx(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,s,o,r=Math.sqrt(i.x*i.x+i.y*i.y);if(this.sphere){var a=2*Math.atan(r/(2*this.a*this.k0));return e=this.long0,t=this.lat0,r<=K?(i.x=e,i.y=t,i):(t=Math.asin(Math.cos(a)*this.sinlat0+i.y*Math.sin(a)*this.coslat0/r),Math.abs(this.coslat0)<K?this.lat0>0?e=X(this.long0+Math.atan2(i.x,-1*i.y),this.over):e=X(this.long0+Math.atan2(i.x,i.y),this.over):e=X(this.long0+Math.atan2(i.x*Math.sin(a),r*this.coslat0*Math.cos(a)-i.y*this.sinlat0*Math.sin(a)),this.over),i.x=e,i.y=t,i)}else if(Math.abs(this.coslat0)<=K){if(r<=K)return t=this.lat0,e=this.long0,i.x=e,i.y=t,i;i.x*=this.con,i.y*=this.con,n=r*this.cons/(2*this.a*this.k0),t=this.con*Rs(this.e,n),e=this.con*X(this.con*this.long0+Math.atan2(i.x,-1*i.y),this.over)}else s=2*Math.atan(r*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,r<=K?o=this.X0:(o=Math.asin(Math.cos(s)*this.sinX0+i.y*Math.sin(s)*this.cosX0/r),e=X(this.long0+Math.atan2(i.x*Math.sin(s),r*this.cosX0*Math.cos(s)-i.y*this.sinX0*Math.sin(s)),this.over)),t=-1*Rs(this.e,Math.tan(.5*($+o)));return i.x=e,i.y=t,i}var Bx=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"];const _x={init:Sx,forward:Mx,inverse:Tx,names:Bx,ssfn_:Ul};function kx(){var i=this.lat0;this.lambda0=this.long0;var e=Math.sin(i),t=this.a,n=this.rf,s=1/n,o=2*s-Math.pow(s,2),r=this.e=Math.sqrt(o);this.R=this.k0*t*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(i),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+i/2)),c=Math.log((1+r*e)/(1-r*e));this.K=a-this.alpha*l+this.alpha*r/2*c}function Px(i){var e=Math.log(Math.tan(Math.PI/4-i.y/2)),t=this.e/2*Math.log((1+this.e*Math.sin(i.y))/(1-this.e*Math.sin(i.y))),n=-this.alpha*(e+t)+this.K,s=2*(Math.atan(Math.exp(n))-Math.PI/4),o=this.alpha*(i.x-this.lambda0),r=Math.atan(Math.sin(o)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(o))),a=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(o));return i.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,i.x=this.R*r+this.x0,i}function Dx(i){for(var e=i.x-this.x0,t=i.y-this.y0,n=e/this.R,s=2*(Math.atan(Math.exp(t/this.R))-Math.PI/4),o=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(n)),r=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+r/this.alpha,l=0,c=o,h=-1e3,u=0;Math.abs(c-h)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+o/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(c))/2)),h=c,c=2*Math.atan(Math.exp(l))-Math.PI/2}return i.x=a,i.y=c,i}var Nx=["somerc"];const Lx={init:kx,forward:Px,inverse:Dx,names:Nx};var Fn=1e-7;function Rx(i){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],t=typeof i.projName=="object"?Object.keys(i.projName)[0]:i.projName;return"no_uoff"in i||"no_off"in i||e.indexOf(t)!==-1||e.indexOf(yf(t))!==-1}function Fx(){var i,e,t,n,s,o,r,a,l,c,h=0,u,p=0,f=0,m=0,y=0,g=0,A=0;this.no_off=Rx(this),this.no_rot="no_rot"in this;var v=!1;"alpha"in this&&(v=!0);var b=!1;if("rectified_grid_angle"in this&&(b=!0),v&&(A=this.alpha),b&&(h=this.rectified_grid_angle),v||b)p=this.longc;else if(f=this.long1,y=this.lat1,m=this.long2,g=this.lat2,Math.abs(y-g)<=Fn||(i=Math.abs(y))<=Fn||Math.abs(i-$)<=Fn||Math.abs(Math.abs(this.lat0)-$)<=Fn||Math.abs(Math.abs(g)-$)<=Fn)throw new Error;var C=1-this.es;e=Math.sqrt(C),Math.abs(this.lat0)>K?(a=Math.sin(this.lat0),t=Math.cos(this.lat0),i=1-this.es*a*a,this.B=t*t,this.B=Math.sqrt(1+this.es*this.B*this.B/C),this.A=this.B*this.k0*e/i,n=this.B*e/(t*Math.sqrt(i)),s=n*n-1,s<=0?s=0:(s=Math.sqrt(s),this.lat0<0&&(s=-s)),this.E=s+=n,this.E*=Math.pow(Ft(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=s=1),v||b?(v?(u=Math.asin(Math.sin(A)/n),b||(h=A)):(u=h,A=Math.asin(n*Math.sin(u))),this.lam0=p-Math.asin(.5*(s-1/s)*Math.tan(u))/this.B):(o=Math.pow(Ft(this.e,y,Math.sin(y)),this.B),r=Math.pow(Ft(this.e,g,Math.sin(g)),this.B),s=this.E/o,l=(r-o)/(r+o),c=this.E*this.E,c=(c-r*o)/(c+r*o),i=f-m,i<-Math.PI?m-=Ds:i>Math.PI&&(m+=Ds),this.lam0=X(.5*(f+m)-Math.atan(c*Math.tan(.5*this.B*(f-m))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*X(f-this.lam0,this.over))/(s-1/s)),h=A=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(h),this.cosrot=Math.cos(h),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(A))),this.lat0<0&&(this.u_0=-this.u_0)),s=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(ve-s)),this.v_pole_s=this.ArB*Math.log(Math.tan(ve+s))}function Ox(i){var e={},t,n,s,o,r,a,l,c;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-$)>K){if(r=this.E/Math.pow(Ft(this.e,i.y,Math.sin(i.y)),this.B),a=1/r,t=.5*(r-a),n=.5*(r+a),o=Math.sin(this.B*i.x),s=(t*this.singam-o*this.cosgam)/n,Math.abs(Math.abs(s)-1)<K)throw new Error;c=.5*this.ArB*Math.log((1-s)/(1+s)),a=Math.cos(this.B*i.x),Math.abs(a)<Fn?l=this.A*i.x:l=this.ArB*Math.atan2(t*this.cosgam+o*this.singam,a)}else c=i.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*i.y;return this.no_rot?(e.x=l,e.y=c):(l-=this.u_0,e.x=c*this.cosrot+l*this.sinrot,e.y=l*this.cosrot-c*this.sinrot),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Gx(i){var e,t,n,s,o,r,a,l={};if(i.x=(i.x-this.x0)*(1/this.a),i.y=(i.y-this.y0)*(1/this.a),this.no_rot?(t=i.y,e=i.x):(t=i.x*this.cosrot-i.y*this.sinrot,e=i.y*this.cosrot+i.x*this.sinrot+this.u_0),n=Math.exp(-this.BrA*t),s=.5*(n-1/n),o=.5*(n+1/n),r=Math.sin(this.BrA*e),a=(r*this.cosgam+s*this.singam)/o,Math.abs(Math.abs(a)-1)<K)l.x=0,l.y=a<0?-$:$;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Rs(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(s*this.cosgam-r*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l}var Ux=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"];const Vx={init:Fx,forward:Ox,inverse:Gx,names:Ux};function Qx(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<K)){var i=this.b/this.a;this.e=Math.sqrt(1-i*i);var e=Math.sin(this.lat1),t=Math.cos(this.lat1),n=Xt(this.e,e,t),s=Ft(this.e,this.lat1,e),o=Math.sin(this.lat2),r=Math.cos(this.lat2),a=Xt(this.e,o,r),l=Ft(this.e,this.lat2,o),c=Math.abs(Math.abs(this.lat0)-$)<K?0:Ft(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>K?this.ns=Math.log(n/a)/Math.log(s/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function zx(i){var e=i.x,t=i.y;Math.abs(2*Math.abs(t)-Math.PI)<=K&&(t=Ls(t)*($-2*K));var n=Math.abs(Math.abs(t)-$),s,o;if(n>K)s=Ft(this.e,t,Math.sin(t)),o=this.a*this.f0*Math.pow(s,this.ns);else{if(n=t*this.ns,n<=0)return null;o=0}var r=this.ns*X(e-this.long0,this.over);return i.x=this.k0*(o*Math.sin(r))+this.x0,i.y=this.k0*(this.rh-o*Math.cos(r))+this.y0,i}function Hx(i){var e,t,n,s,o,r=(i.x-this.x0)/this.k0,a=this.rh-(i.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(r*r+a*a),t=1):(e=-Math.sqrt(r*r+a*a),t=-1);var l=0;if(e!==0&&(l=Math.atan2(t*r,t*a)),e!==0||this.ns>0){if(t=1/this.ns,n=Math.pow(e/(this.a*this.f0),t),s=Rs(this.e,n),s===-9999)return null}else s=-$;return o=X(l/this.ns+this.long0,this.over),i.x=o,i.y=s,i}var Yx=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"];const $x={init:Qx,forward:zx,inverse:Hx,names:Yx};function jx(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Wx(i){var e,t,n,s,o,r,a,l=i.x,c=i.y,h=X(l-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.alfa*this.e/2),t=2*(Math.atan(this.k*Math.pow(Math.tan(c/2+this.s45),this.alfa)/e)-this.s45),n=-h*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(t)+Math.sin(this.ad)*Math.cos(t)*Math.cos(n)),o=Math.asin(Math.cos(t)*Math.sin(n)/Math.cos(s)),r=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),i.y=a*Math.cos(r)/1,i.x=a*Math.sin(r)/1,this.czech||(i.y*=-1,i.x*=-1),i}function qx(i){var e,t,n,s,o,r,a,l,c=i.x;i.x=i.y,i.y=c,this.czech||(i.y*=-1,i.x*=-1),r=Math.sqrt(i.x*i.x+i.y*i.y),o=Math.atan2(i.y,i.x),s=o/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/r,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(s)),t=Math.asin(Math.cos(n)*Math.sin(s)/Math.cos(e)),i.x=this.long0-t/this.alfa,a=e,l=0;var h=0;do i.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-i.y)<1e-10&&(l=1),a=i.y,h+=1;while(l===0&&h<15);return h>=15?null:i}var Kx=["Krovak","krovak"];const Xx={init:jx,forward:Wx,inverse:qx,names:Kx};function mt(i,e,t,n,s){return i*s-e*Math.sin(2*s)+t*Math.sin(4*s)-n*Math.sin(6*s)}function Gs(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function Us(i){return .375*i*(1+.25*i*(1+.46875*i))}function Vs(i){return .05859375*i*i*(1+.75*i)}function Qs(i){return i*i*i*(35/3072)}function Vl(i,e,t){var n=e*t;return i/Math.sqrt(1-n*n)}function Ti(i){return Math.abs(i)<$?i:i-Ls(i)*Math.PI}function mr(i,e,t,n,s){var o,r;o=i/e;for(var a=0;a<15;a++)if(r=(i-(e*o-t*Math.sin(2*o)+n*Math.sin(4*o)-s*Math.sin(6*o)))/(e-2*t*Math.cos(2*o)+4*n*Math.cos(4*o)-6*s*Math.cos(6*o)),o+=r,Math.abs(r)<=1e-10)return o;return NaN}function Jx(){this.sphere||(this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.ml0=this.a*mt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Zx(i){var e,t,n=i.x,s=i.y;if(n=X(n-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(s)*Math.sin(n)),t=this.a*(Math.atan2(Math.tan(s),Math.cos(n))-this.lat0);else{var o=Math.sin(s),r=Math.cos(s),a=Vl(this.a,this.e,o),l=Math.tan(s)*Math.tan(s),c=n*Math.cos(s),h=c*c,u=this.es*r*r/(1-this.es),p=this.a*mt(this.e0,this.e1,this.e2,this.e3,s);e=a*c*(1-h*l*(1/6-(8-l+8*u)*h/120)),t=p-this.ml0+a*o/r*h*(.5+(5-l+6*u)*h/24)}return i.x=e+this.x0,i.y=t+this.y0,i}function e2(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,s;if(this.sphere){var o=t+this.lat0;n=Math.asin(Math.sin(o)*Math.cos(e)),s=Math.atan2(Math.tan(e),Math.cos(o))}else{var r=this.ml0/this.a+t,a=mr(r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-$)<=K)return i.x=this.long0,i.y=$,t<0&&(i.y*=-1),i;var l=Vl(this.a,this.e,Math.sin(a)),c=l*l*l/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(a),2),u=e*this.a/l,p=u*u;n=a-l*Math.tan(a)/c*u*u*(.5-(1+3*h)*u*u/24),s=u*(1-p*(h/3+(1+3*h)*h*p/15))/Math.cos(a)}return i.x=X(s+this.long0,this.over),i.y=Ti(n),i}var t2=["Cassini","Cassini_Soldner","cass"];const i2={init:Jx,forward:Zx,inverse:e2,names:t2};function Bi(i,e){var t;return i>1e-7?(t=i*e,(1-i*i)*(e/(1-t*t)-.5/i*Math.log((1-t)/(1+t)))):2*e}var Ql=1,zl=2,Hl=3,gr=4;function n2(){var i=Math.abs(this.lat0);if(Math.abs(i-$)<K?this.mode=this.lat0<0?Ql:zl:Math.abs(i)<K?this.mode=Hl:this.mode=gr,this.es>0){var e;switch(this.qp=Bi(this.e,1),this.mmf=.5/(1-this.es),this.apa=u2(this.es),this.mode){case zl:this.dd=1;break;case Ql:this.dd=1;break;case Hl:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case gr:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Bi(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===gr&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function s2(i){var e,t,n,s,o,r,a,l,c,h,u=i.x,p=i.y;if(u=X(u-this.long0,this.over),this.sphere){if(o=Math.sin(p),h=Math.cos(p),n=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t=this.mode===this.EQUIT?1+h*n:1+this.sinph0*o+this.cosph0*h*n,t<=K)return null;t=Math.sqrt(2/t),e=t*h*Math.sin(u),t*=this.mode===this.EQUIT?o:this.cosph0*o-this.sinph0*h*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(p+this.lat0)<K)return null;t=ve-p*.5,t=2*(this.mode===this.S_POLE?Math.cos(t):Math.sin(t)),e=t*Math.sin(u),t*=n}}else{switch(a=0,l=0,c=0,n=Math.cos(u),s=Math.sin(u),o=Math.sin(p),r=Bi(this.e,o),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=r/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:c=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:c=1+l*n;break;case this.N_POLE:c=$+p,r=this.qp-r;break;case this.S_POLE:c=p-$,r=this.qp+r;break}if(Math.abs(c)<K)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:c=Math.sqrt(2/c),this.mode===this.OBLIQ?t=this.ymf*c*(this.cosb1*a-this.sinb1*l*n):t=(c=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*c*l*s;break;case this.N_POLE:case this.S_POLE:r>=0?(e=(c=Math.sqrt(r))*s,t=n*(this.mode===this.S_POLE?c:-c)):e=t=0;break}}return i.x=this.a*e+this.x0,i.y=this.a*t+this.y0,i}function o2(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,n,s,o,r,a,l,c;if(this.sphere){var h=0,u,p=0;if(u=Math.sqrt(e*e+t*t),s=u*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(p=Math.sin(s),h=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(u)<=K?0:Math.asin(t*p/u),e*=p,t=h*u;break;case this.OBLIQ:s=Math.abs(u)<=K?this.lat0:Math.asin(h*this.sinph0+t*p*this.cosph0/u),e*=p*this.cosph0,t=(h-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:t=-t,s=$-s;break;case this.S_POLE:s-=$;break}n=t===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,t)}else{if(c=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,t*=this.dd,l=Math.sqrt(e*e+t*t),l<K)return i.x=this.long0,i.y=this.lat0,i;r=2*Math.asin(.5*l/this.rq),o=Math.cos(r),e*=r=Math.sin(r),this.mode===this.OBLIQ?(c=o*this.sinb1+t*r*this.cosb1/l,a=this.qp*c,t=l*this.cosb1*o-t*this.sinb1*r):(c=t*r/l,a=this.qp*c,t=l*o)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(t=-t),a=e*e+t*t,!a)return i.x=this.long0,i.y=this.lat0,i;c=1-a/this.qp,this.mode===this.S_POLE&&(c=-c)}n=Math.atan2(e,t),s=f2(Math.asin(c),this.apa)}return i.x=X(this.long0+n,this.over),i.y=s,i}var r2=.3333333333333333,a2=.17222222222222222,l2=.10257936507936508,c2=.06388888888888888,d2=.0664021164021164,h2=.016415012942191543;function u2(i){var e,t=[];return t[0]=i*r2,e=i*i,t[0]+=e*a2,t[1]=e*c2,e*=i,t[0]+=e*l2,t[1]+=e*d2,t[2]=e*h2,t}function f2(i,e){var t=i+i;return i+e[0]*Math.sin(t)+e[1]*Math.sin(t+t)+e[2]*Math.sin(t+t+t)}var p2=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"];const m2={init:n2,forward:s2,inverse:o2,names:p2,S_POLE:Ql,N_POLE:zl,EQUIT:Hl,OBLIQ:gr};function _i(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function g2(){Math.abs(this.lat1+this.lat2)<K||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Xt(this.e3,this.sin_po,this.cos_po),this.qs1=Bi(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Xt(this.e3,this.sin_po,this.cos_po),this.qs2=Bi(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Bi(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>K?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function y2(i){var e=i.x,t=i.y;this.sin_phi=Math.sin(t),this.cos_phi=Math.cos(t);var n=Bi(this.e3,this.sin_phi),s=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,o=this.ns0*X(e-this.long0,this.over),r=s*Math.sin(o)+this.x0,a=this.rh-s*Math.cos(o)+this.y0;return i.x=r,i.y=a,i}function A2(i){var e,t,n,s,o,r;return i.x-=this.x0,i.y=this.rh-i.y+this.y0,this.ns0>=0?(e=Math.sqrt(i.x*i.x+i.y*i.y),n=1):(e=-Math.sqrt(i.x*i.x+i.y*i.y),n=-1),s=0,e!==0&&(s=Math.atan2(n*i.x,n*i.y)),n=e*this.ns0/this.a,this.sphere?r=Math.asin((this.c-n*n)/(2*this.ns0)):(t=(this.c-n*n)/this.ns0,r=this.phi1z(this.e3,t)),o=X(s/this.ns0+this.long0,this.over),i.x=o,i.y=r,i}function v2(i,e){var t,n,s,o,r,a=_i(.5*e);if(i<K)return a;for(var l=i*i,c=1;c<=25;c++)if(t=Math.sin(a),n=Math.cos(a),s=i*t,o=1-s*s,r=.5*o*o/n*(e/(1-l)-t/o+.5/i*Math.log((1-s)/(1+s))),a=a+r,Math.abs(r)<=1e-7)return a;return null}var b2=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"];const w2={init:g2,forward:y2,inverse:A2,names:b2,phi1z:v2};function C2(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function E2(i){var e,t,n,s,o,r,a,l,c=i.x,h=i.y;return n=X(c-this.long0,this.over),e=Math.sin(h),t=Math.cos(h),s=Math.cos(n),r=this.sin_p14*e+this.cos_p14*t*s,o=1,r>0||Math.abs(r)<=K?(a=this.x0+this.a*o*t*Math.sin(n)/r,l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*t*s)/r):(a=this.x0+this.infinity_dist*t*Math.sin(n),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*t*s)),i.x=a,i.y=l,i}function x2(i){var e,t,n,s,o,r;return i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,(e=Math.sqrt(i.x*i.x+i.y*i.y))?(s=Math.atan2(e,this.rc),t=Math.sin(s),n=Math.cos(s),r=_i(n*this.sin_p14+i.y*t*this.cos_p14/e),o=Math.atan2(i.x*t,e*this.cos_p14*n-i.y*this.sin_p14*t),o=X(this.long0+o,this.over)):(r=this.phic0,o=0),i.x=o,i.y=r,i}var I2=["gnom"];const S2={init:C2,forward:E2,inverse:x2,names:I2};function M2(i,e){var t=1-(1-i*i)/(2*i)*Math.log((1-i)/(1+i));if(Math.abs(Math.abs(e)-t)<1e-6)return e<0?-1*$:$;for(var n=Math.asin(.5*e),s,o,r,a,l=0;l<30;l++)if(o=Math.sin(n),r=Math.cos(n),a=i*o,s=Math.pow(1-a*a,2)/(2*r)*(e/(1-i*i)-o/(1-a*a)+.5/i*Math.log((1-a)/(1+a))),n+=s,Math.abs(s)<=1e-10)return n;return NaN}function T2(){this.sphere||(this.k0=Xt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function B2(i){var e=i.x,t=i.y,n,s,o=X(e-this.long0,this.over);if(this.sphere)n=this.x0+this.a*o*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(t)/Math.cos(this.lat_ts);else{var r=Bi(this.e,Math.sin(t));n=this.x0+this.a*this.k0*o,s=this.y0+this.a*r*.5/this.k0}return i.x=n,i.y=s,i}function _2(i){i.x-=this.x0,i.y-=this.y0;var e,t;return this.sphere?(e=X(this.long0+i.x/this.a/Math.cos(this.lat_ts),this.over),t=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(t=M2(this.e,2*i.y*this.k0/this.a),e=X(this.long0+i.x/(this.a*this.k0),this.over)),i.x=e,i.y=t,i}var k2=["cea"];const P2={init:T2,forward:B2,inverse:_2,names:k2};function D2(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function N2(i){var e=i.x,t=i.y,n=X(e-this.long0,this.over),s=Ti(t-this.lat0);return i.x=this.x0+this.a*n*this.rc,i.y=this.y0+this.a*s,i}function L2(i){var e=i.x,t=i.y;return i.x=X(this.long0+(e-this.x0)/(this.a*this.rc),this.over),i.y=Ti(this.lat0+(t-this.y0)/this.a),i}var R2=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"];const F2={init:D2,forward:N2,inverse:L2,names:R2};var Vf=20;function O2(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.ml0=this.a*mt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function G2(i){var e=i.x,t=i.y,n,s,o,r=X(e-this.long0,this.over);if(o=r*Math.sin(t),this.sphere)Math.abs(t)<=K?(n=this.a*r,s=-1*this.a*this.lat0):(n=this.a*Math.sin(o)/Math.tan(t),s=this.a*(Ti(t-this.lat0)+(1-Math.cos(o))/Math.tan(t)));else if(Math.abs(t)<=K)n=this.a*r,s=-1*this.ml0;else{var a=Vl(this.a,this.e,Math.sin(t))/Math.tan(t);n=a*Math.sin(o),s=this.a*mt(this.e0,this.e1,this.e2,this.e3,t)-this.ml0+a*(1-Math.cos(o))}return i.x=n+this.x0,i.y=s+this.y0,i}function U2(i){var e,t,n,s,o,r,a,l,c;if(n=i.x-this.x0,s=i.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=K)e=X(n/this.a+this.long0,this.over),t=0;else{r=this.lat0+s/this.a,a=n*n/this.a/this.a+r*r,l=r;var h;for(o=Vf;o;--o)if(h=Math.tan(l),c=-1*(r*(l*h+1)-l-.5*(l*l+a)*h)/((l-r)/h-1),l+=c,Math.abs(c)<=K){t=l;break}e=X(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(t),this.over)}else if(Math.abs(s+this.ml0)<=K)t=0,e=X(this.long0+n/this.a,this.over);else{r=(this.ml0+s)/this.a,a=n*n/this.a/this.a+r*r,l=r;var u,p,f,m,y;for(o=Vf;o;--o)if(y=this.e*Math.sin(l),u=Math.sqrt(1-y*y)*Math.tan(l),p=this.a*mt(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),m=p/this.a,c=(r*(u*m+1)-m-.5*u*(m*m+a))/(this.es*Math.sin(2*l)*(m*m+a-2*r*m)/(4*u)+(r-m)*(u*f-2/Math.sin(2*l))-f),l-=c,Math.abs(c)<=K){t=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(t),2))*Math.tan(t),e=X(this.long0+Math.asin(n*u/this.a)/Math.sin(t),this.over)}return i.x=e,i.y=t,i}var V2=["Polyconic","American_Polyconic","poly"];const Q2={init:O2,forward:G2,inverse:U2,names:V2};function z2(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function H2(i){var e,t=i.x,n=i.y,s=n-this.lat0,o=t-this.long0,r=s/Ps*1e-5,a=o,l=1,c=0;for(e=1;e<=10;e++)l=l*r,c=c+this.A[e]*l;var h=c,u=a,p=1,f=0,m,y,g=0,A=0;for(e=1;e<=6;e++)m=p*h-f*u,y=f*h+p*u,p=m,f=y,g=g+this.B_re[e]*p-this.B_im[e]*f,A=A+this.B_im[e]*p+this.B_re[e]*f;return i.x=A*this.a+this.x0,i.y=g*this.a+this.y0,i}function Y2(i){var e,t=i.x,n=i.y,s=t-this.x0,o=n-this.y0,r=o/this.a,a=s/this.a,l=1,c=0,h,u,p=0,f=0;for(e=1;e<=6;e++)h=l*r-c*a,u=c*r+l*a,l=h,c=u,p=p+this.C_re[e]*l-this.C_im[e]*c,f=f+this.C_im[e]*l+this.C_re[e]*c;for(var m=0;m<this.iterations;m++){var y=p,g=f,A,v,b=r,C=a;for(e=2;e<=6;e++)A=y*p-g*f,v=g*p+y*f,y=A,g=v,b=b+(e-1)*(this.B_re[e]*y-this.B_im[e]*g),C=C+(e-1)*(this.B_im[e]*y+this.B_re[e]*g);y=1,g=0;var x=this.B_re[1],I=this.B_im[1];for(e=2;e<=6;e++)A=y*p-g*f,v=g*p+y*f,y=A,g=v,x=x+e*(this.B_re[e]*y-this.B_im[e]*g),I=I+e*(this.B_im[e]*y+this.B_re[e]*g);var E=x*x+I*I;p=(b*x+C*I)/E,f=(C*x-b*I)/E}var S=p,w=f,T=1,_=0;for(e=1;e<=9;e++)T=T*S,_=_+this.D[e]*T;var F=this.lat0+_*Ps*1e5,U=this.long0+w;return i.x=U,i.y=F,i}var $2=["New_Zealand_Map_Grid","nzmg"];const j2={init:z2,forward:H2,inverse:Y2,names:$2};function W2(){}function q2(i){var e=i.x,t=i.y,n=X(e-this.long0,this.over),s=this.x0+this.a*n,o=this.y0+this.a*Math.log(Math.tan(Math.PI/4+t/2.5))*1.25;return i.x=s,i.y=o,i}function K2(i){i.x-=this.x0,i.y-=this.y0;var e=X(this.long0+i.x/this.a,this.over),t=2.5*(Math.atan(Math.exp(.8*i.y/this.a))-Math.PI/4);return i.x=e,i.y=t,i}var X2=["Miller_Cylindrical","mill"];const J2={init:W2,forward:q2,inverse:K2,names:X2};var Z2=20;function eI(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Ll(this.es)}function tI(i){var e,t,n=i.x,s=i.y;if(n=X(n-this.long0,this.over),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var o=this.n*Math.sin(s),r=Z2;r;--r){var a=(this.m*s+Math.sin(s)-o)/(this.m+Math.cos(s));if(s-=a,Math.abs(a)<K)break}e=this.a*this.C_x*n*(this.m+Math.cos(s)),t=this.a*this.C_y*s}else{var l=Math.sin(s),c=Math.cos(s);t=this.a*Rn(s,l,c,this.en),e=this.a*n*c/Math.sqrt(1-this.es*l*l)}return i.x=e,i.y=t,i}function iI(i){var e,t,n,s;return i.x-=this.x0,n=i.x/this.a,i.y-=this.y0,e=i.y/this.a,this.sphere?(e/=this.C_y,n=n/(this.C_x*(this.m+Math.cos(e))),this.m?e=_i((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=_i(Math.sin(e)/this.n)),n=X(n+this.long0,this.over),e=Ti(e)):(e=Rl(i.y/this.a,this.es,this.en),s=Math.abs(e),s<$?(s=Math.sin(e),t=this.long0+i.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),n=X(t,this.over)):s-K<$&&(n=this.long0)),i.x=n,i.y=e,i}var nI=["Sinusoidal","sinu"];const sI={init:eI,forward:tI,inverse:iI,names:nI};function oI(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0}function rI(i){for(var e=i.x,t=i.y,n=X(e-this.long0,this.over),s=t,o=Math.PI*Math.sin(t);;){var r=-(s+Math.sin(s)-o)/(1+Math.cos(s));if(s+=r,Math.abs(r)<K)break}s/=2,Math.PI/2-Math.abs(t)<K&&(n=0);var a=.900316316158*this.a*n*Math.cos(s)+this.x0,l=1.4142135623731*this.a*Math.sin(s)+this.y0;return i.x=a,i.y=l,i}function aI(i){var e,t;i.x-=this.x0,i.y-=this.y0,t=i.y/(1.4142135623731*this.a),Math.abs(t)>.999999999999&&(t=.999999999999),e=Math.asin(t);var n=X(this.long0+i.x/(.900316316158*this.a*Math.cos(e)),this.over);n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),t=(2*e+Math.sin(2*e))/Math.PI,Math.abs(t)>1&&(t=1);var s=Math.asin(t);return i.x=n,i.y=s,i}var lI=["Mollweide","moll"];const cI={init:oI,forward:rI,inverse:aI,names:lI};function dI(){Math.abs(this.lat1+this.lat2)<K||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Gs(this.es),this.e1=Us(this.es),this.e2=Vs(this.es),this.e3=Qs(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Xt(this.e,this.sin_phi,this.cos_phi),this.ml1=mt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<K?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Xt(this.e,this.sin_phi,this.cos_phi),this.ml2=mt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=mt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function hI(i){var e=i.x,t=i.y,n;if(this.sphere)n=this.a*(this.g-t);else{var s=mt(this.e0,this.e1,this.e2,this.e3,t);n=this.a*(this.g-s)}var o=this.ns*X(e-this.long0,this.over),r=this.x0+n*Math.sin(o),a=this.y0+this.rh-n*Math.cos(o);return i.x=r,i.y=a,i}function uI(i){i.x-=this.x0,i.y=this.rh-i.y+this.y0;var e,t,n,s;this.ns>=0?(t=Math.sqrt(i.x*i.x+i.y*i.y),e=1):(t=-Math.sqrt(i.x*i.x+i.y*i.y),e=-1);var o=0;if(t!==0&&(o=Math.atan2(e*i.x,e*i.y)),this.sphere)return s=X(this.long0+o/this.ns,this.over),n=Ti(this.g-t/this.a),i.x=s,i.y=n,i;var r=this.g-t/this.a;return n=mr(r,this.e0,this.e1,this.e2,this.e3),s=X(this.long0+o/this.ns,this.over),i.x=s,i.y=n,i}var fI=["Equidistant_Conic","eqdc"];const pI={init:dI,forward:hI,inverse:uI,names:fI};function mI(){this.R=this.a}function gI(i){var e=i.x,t=i.y,n=X(e-this.long0,this.over),s,o;Math.abs(t)<=K&&(s=this.x0+this.R*n,o=this.y0);var r=_i(2*Math.abs(t/Math.PI));(Math.abs(n)<=K||Math.abs(Math.abs(t)-$)<=K)&&(s=this.x0,t>=0?o=this.y0+Math.PI*this.R*Math.tan(.5*r):o=this.y0+Math.PI*this.R*-Math.tan(.5*r));var a=.5*Math.abs(Math.PI/n-n/Math.PI),l=a*a,c=Math.sin(r),h=Math.cos(r),u=h/(c+h-1),p=u*u,f=u*(2/c-1),m=f*f,y=Math.PI*this.R*(a*(u-m)+Math.sqrt(l*(u-m)*(u-m)-(m+l)*(p-m)))/(m+l);n<0&&(y=-y),s=this.x0+y;var g=l+u;return y=Math.PI*this.R*(f*g-a*Math.sqrt((m+l)*(l+1)-g*g))/(m+l),t>=0?o=this.y0+y:o=this.y0-y,i.x=s,i.y=o,i}function yI(i){var e,t,n,s,o,r,a,l,c,h,u,p,f;return i.x-=this.x0,i.y-=this.y0,u=Math.PI*this.R,n=i.x/u,s=i.y/u,o=n*n+s*s,r=-Math.abs(s)*(1+o),a=r-2*s*s+n*n,l=-2*r+1+2*s*s+o*o,f=s*s/l+(2*a*a*a/l/l/l-9*r*a/l/l)/27,c=(r-a*a/3/l)/l,h=2*Math.sqrt(-c/3),u=3*f/c/h,Math.abs(u)>1&&(u>=0?u=1:u=-1),p=Math.acos(u)/3,i.y>=0?t=(-h*Math.cos(p+Math.PI/3)-a/3/l)*Math.PI:t=-(-h*Math.cos(p+Math.PI/3)-a/3/l)*Math.PI,Math.abs(n)<K?e=this.long0:e=X(this.long0+Math.PI*(o-1+Math.sqrt(1+2*(n*n-s*s)+o*o))/2/n,this.over),i.x=e,i.y=t,i}var AI=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"];const vI={init:mI,forward:gI,inverse:yI,names:AI};function bI(i,e,t,n,s,o){const r=n-e,a=Math.atan((1-o)*Math.tan(i)),l=Math.atan((1-o)*Math.tan(t)),c=Math.sin(a),h=Math.cos(a),u=Math.sin(l),p=Math.cos(l);let f=r,m,y=100,g,A,v,b,C,x,I,E,S,w,T,_,F,U;do{if(g=Math.sin(f),A=Math.cos(f),v=Math.sqrt(p*g*(p*g)+(h*u-c*p*A)*(h*u-c*p*A)),v===0)return{azi1:0,s12:0};b=c*u+h*p*A,C=Math.atan2(v,b),x=h*p*g/v,I=1-x*x,E=I!==0?b-2*c*u/I:0,S=o/16*I*(4+o*(4-3*I)),m=f,f=r+(1-S)*o*x*(C+S*v*(E+S*b*(-1+2*E*E)))}while(Math.abs(f-m)>1e-12&&--y>0);return y===0?{azi1:NaN,s12:NaN}:(w=I*(s*s-s*(1-o)*(s*(1-o)))/(s*(1-o)*(s*(1-o))),T=1+w/16384*(4096+w*(-768+w*(320-175*w))),_=w/1024*(256+w*(-128+w*(74-47*w))),F=_*v*(E+_/4*(b*(-1+2*E*E)-_/6*E*(-3+4*v*v)*(-3+4*E*E))),U=s*(1-o)*T*(C-F),{azi1:Math.atan2(p*g,h*u-c*p*A),s12:U})}function wI(i,e,t,n,s,o){const r=Math.atan((1-o)*Math.tan(i)),a=Math.sin(r),l=Math.cos(r),c=Math.sin(t),h=Math.cos(t),u=Math.atan2(a,l*h),p=l*c,f=1-p*p,m=f*(s*s-s*(1-o)*(s*(1-o)))/(s*(1-o)*(s*(1-o))),y=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m)));let A=n/(s*(1-o)*y),v,b=100,C,x,I,E;do C=Math.cos(2*u+A),x=Math.sin(A),I=Math.cos(A),E=g*x*(C+g/4*(I*(-1+2*C*C)-g/6*C*(-3+4*x*x)*(-3+4*C*C))),v=A,A=n/(s*(1-o)*y)+E;while(Math.abs(A-v)>1e-12&&--b>0);if(b===0)return{lat2:NaN,lon2:NaN};const S=a*x-l*I*h,w=Math.atan2(a*I+l*x*h,(1-o)*Math.sqrt(p*p+S*S)),T=Math.atan2(x*c,l*I-a*x*h),_=o/16*f*(4+o*(4-3*f)),F=T-(1-_)*o*p*(A+_*x*(C+_*I*(-1+2*C*C))),U=e+F;return{lat2:w,lon2:U}}function CI(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))}function EI(i){var e=i.x,t=i.y,n=Math.sin(i.y),s=Math.cos(i.y),o=X(e-this.long0,this.over),r,a,l,c,h,u,p,f,m,y,g;return this.sphere?Math.abs(this.sin_p12-1)<=K?(i.x=this.x0+this.a*($-t)*Math.sin(o),i.y=this.y0-this.a*($-t)*Math.cos(o),i):Math.abs(this.sin_p12+1)<=K?(i.x=this.x0+this.a*($+t)*Math.sin(o),i.y=this.y0+this.a*($+t)*Math.cos(o),i):(m=this.sin_p12*n+this.cos_p12*s*Math.cos(o),p=Math.acos(m),f=p?p/Math.sin(p):1,i.x=this.x0+this.a*f*s*Math.sin(o),i.y=this.y0+this.a*f*(this.cos_p12*n-this.sin_p12*s*Math.cos(o)),i):(r=Gs(this.es),a=Us(this.es),l=Vs(this.es),c=Qs(this.es),Math.abs(this.sin_p12-1)<=K?(h=this.a*mt(r,a,l,c,$),u=this.a*mt(r,a,l,c,t),i.x=this.x0+(h-u)*Math.sin(o),i.y=this.y0-(h-u)*Math.cos(o),i):Math.abs(this.sin_p12+1)<=K?(h=this.a*mt(r,a,l,c,$),u=this.a*mt(r,a,l,c,t),i.x=this.x0+(h+u)*Math.sin(o),i.y=this.y0+(h+u)*Math.cos(o),i):Math.abs(e)<K&&Math.abs(t-this.lat0)<K?(i.x=i.y=0,i):(y=bI(this.lat0,this.long0,t,e,this.a,this.f),g=y.azi1,i.x=y.s12*Math.sin(g),i.y=y.s12*Math.cos(g),i))}function xI(i){i.x-=this.x0,i.y-=this.y0;var e,t,n,s,o,r,a,l,c,h,u,p,f,m,y,g;return this.sphere?(e=Math.sqrt(i.x*i.x+i.y*i.y),e>2*$*this.a?void 0:(t=e/this.a,n=Math.sin(t),s=Math.cos(t),o=this.long0,Math.abs(e)<=K?r=this.lat0:(r=_i(s*this.sin_p12+i.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-$,Math.abs(a)<=K?this.lat0>=0?o=X(this.long0+Math.atan2(i.x,-i.y),this.over):o=X(this.long0-Math.atan2(-i.x,i.y),this.over):o=X(this.long0+Math.atan2(i.x*n,e*this.cos_p12*s-i.y*this.sin_p12*n),this.over)),i.x=o,i.y=r,i)):(l=Gs(this.es),c=Us(this.es),h=Vs(this.es),u=Qs(this.es),Math.abs(this.sin_p12-1)<=K?(p=this.a*mt(l,c,h,u,$),e=Math.sqrt(i.x*i.x+i.y*i.y),f=p-e,r=mr(f/this.a,l,c,h,u),o=X(this.long0+Math.atan2(i.x,-1*i.y),this.over),i.x=o,i.y=r,i):Math.abs(this.sin_p12+1)<=K?(p=this.a*mt(l,c,h,u,$),e=Math.sqrt(i.x*i.x+i.y*i.y),f=e-p,r=mr(f/this.a,l,c,h,u),o=X(this.long0+Math.atan2(i.x,i.y),this.over),i.x=o,i.y=r,i):(m=Math.atan2(i.x,i.y),y=Math.sqrt(i.x*i.x+i.y*i.y),g=wI(this.lat0,this.long0,m,y,this.a,this.f),i.x=g.lon2,i.y=g.lat2,i))}var II=["Azimuthal_Equidistant","aeqd"];const SI={init:CI,forward:EI,inverse:xI,names:II};function MI(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function TI(i){var e,t,n,s,o,r,a,l,c=i.x,h=i.y;return n=X(c-this.long0,this.over),e=Math.sin(h),t=Math.cos(h),s=Math.cos(n),r=this.sin_p14*e+this.cos_p14*t*s,o=1,(r>0||Math.abs(r)<=K)&&(a=this.a*o*t*Math.sin(n),l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*t*s)),i.x=a,i.y=l,i}function BI(i){var e,t,n,s,o,r,a;return i.x-=this.x0,i.y-=this.y0,e=Math.sqrt(i.x*i.x+i.y*i.y),t=_i(e/this.a),n=Math.sin(t),s=Math.cos(t),r=this.long0,Math.abs(e)<=K?(a=this.lat0,i.x=r,i.y=a,i):(a=_i(s*this.sin_p14+i.y*n*this.cos_p14/e),o=Math.abs(this.lat0)-$,Math.abs(o)<=K?(this.lat0>=0?r=X(this.long0+Math.atan2(i.x,-i.y),this.over):r=X(this.long0-Math.atan2(-i.x,i.y),this.over),i.x=r,i.y=a,i):(r=X(this.long0+Math.atan2(i.x*n,e*this.cos_p14*s-i.y*this.sin_p14*n),this.over),i.x=r,i.y=a,i))}var _I=["ortho"];const kI={init:MI,forward:TI,inverse:BI,names:_I};var De={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},be={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function PI(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=$-ve/2?this.face=De.TOP:this.lat0<=-($-ve/2)?this.face=De.BOTTOM:Math.abs(this.long0)<=ve?this.face=De.FRONT:Math.abs(this.long0)<=$+ve?this.face=this.long0>0?De.RIGHT:De.LEFT:this.face=De.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function DI(i){var e={x:0,y:0},t,n,s,o,r,a,l={value:0};if(i.x-=this.long0,this.es!==0?t=Math.atan(this.one_minus_f_squared*Math.tan(i.y)):t=i.y,n=i.x,this.face===De.TOP)o=$-t,n>=ve&&n<=$+ve?(l.value=be.AREA_0,s=n-$):n>$+ve||n<=-($+ve)?(l.value=be.AREA_1,s=n>0?n-Ue:n+Ue):n>-($+ve)&&n<=-ve?(l.value=be.AREA_2,s=n+$):(l.value=be.AREA_3,s=n);else if(this.face===De.BOTTOM)o=$+t,n>=ve&&n<=$+ve?(l.value=be.AREA_0,s=-n+$):n<ve&&n>=-ve?(l.value=be.AREA_1,s=-n):n<-ve&&n>=-($+ve)?(l.value=be.AREA_2,s=-n-$):(l.value=be.AREA_3,s=n>0?-n+Ue:-n-Ue);else{var c,h,u,p,f,m,y;this.face===De.RIGHT?n=On(n,+$):this.face===De.BACK?n=On(n,+Ue):this.face===De.LEFT&&(n=On(n,-$)),p=Math.sin(t),f=Math.cos(t),m=Math.sin(n),y=Math.cos(n),c=f*y,h=f*m,u=p,this.face===De.FRONT?(o=Math.acos(c),s=yr(o,u,h,l)):this.face===De.RIGHT?(o=Math.acos(h),s=yr(o,u,-c,l)):this.face===De.BACK?(o=Math.acos(-c),s=yr(o,u,-h,l)):this.face===De.LEFT?(o=Math.acos(-h),s=yr(o,u,c,l)):(o=s=0,l.value=be.AREA_0)}return a=Math.atan(12/Ue*(s+Math.acos(Math.sin(s)*Math.cos(ve))-$)),r=Math.sqrt((1-Math.cos(o))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(s))))),l.value===be.AREA_1?a+=$:l.value===be.AREA_2?a+=Ue:l.value===be.AREA_3&&(a+=1.5*Ue),e.x=r*Math.cos(a),e.y=r*Math.sin(a),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,i.x=e.x,i.y=e.y,i}function NI(i){var e={lam:0,phi:0},t,n,s,o,r,a,l,c,h,u={value:0};if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,n=Math.atan(Math.sqrt(i.x*i.x+i.y*i.y)),t=Math.atan2(i.y,i.x),i.x>=0&&i.x>=Math.abs(i.y)?u.value=be.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=be.AREA_1,t-=$):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=be.AREA_2,t=t<0?t+Ue:t-Ue):(u.value=be.AREA_3,t+=$),h=Ue/12*Math.tan(t),r=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),a=Math.atan(r),s=Math.cos(t),o=Math.tan(n),l=1-s*s*o*o*(1-Math.cos(Math.atan(1/Math.cos(a)))),l<-1?l=-1:l>1&&(l=1),this.face===De.TOP)c=Math.acos(l),e.phi=$-c,u.value===be.AREA_0?e.lam=a+$:u.value===be.AREA_1?e.lam=a<0?a+Ue:a-Ue:u.value===be.AREA_2?e.lam=a-$:e.lam=a;else if(this.face===De.BOTTOM)c=Math.acos(l),e.phi=c-$,u.value===be.AREA_0?e.lam=-a+$:u.value===be.AREA_1?e.lam=-a:u.value===be.AREA_2?e.lam=-a-$:e.lam=a<0?-a-Ue:-a+Ue;else{var p,f,m;p=l,h=p*p,h>=1?m=0:m=Math.sqrt(1-h)*Math.sin(a),h+=m*m,h>=1?f=0:f=Math.sqrt(1-h),u.value===be.AREA_1?(h=f,f=-m,m=h):u.value===be.AREA_2?(f=-f,m=-m):u.value===be.AREA_3&&(h=f,f=m,m=-h),this.face===De.RIGHT?(h=p,p=-f,f=h):this.face===De.BACK?(p=-p,f=-f):this.face===De.LEFT&&(h=p,p=f,f=-h),e.phi=Math.acos(-m)-$,e.lam=Math.atan2(f,p),this.face===De.RIGHT?e.lam=On(e.lam,-$):this.face===De.BACK?e.lam=On(e.lam,-Ue):this.face===De.LEFT&&(e.lam=On(e.lam,+$))}if(this.es!==0){var y,g,A;y=e.phi<0?1:0,g=Math.tan(e.phi),A=this.b/Math.sqrt(g*g+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-A*A)/(this.one_minus_f*A)),y&&(e.phi=-e.phi)}return e.lam+=this.long0,i.x=e.lam,i.y=e.phi,i}function yr(i,e,t,n){var s;return i<K?(n.value=be.AREA_0,s=0):(s=Math.atan2(e,t),Math.abs(s)<=ve?n.value=be.AREA_0:s>ve&&s<=$+ve?(n.value=be.AREA_1,s-=$):s>$+ve||s<=-($+ve)?(n.value=be.AREA_2,s=s>=0?s-Ue:s+Ue):(n.value=be.AREA_3,s+=$)),s}function On(i,e){var t=i+e;return t<-Ue?t+=Ds:t>+Ue&&(t-=Ds),t}var LI=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"];const RI={init:PI,forward:DI,inverse:NI,names:LI};var Yl=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],zs=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Qf=.8487,zf=1.3523,Hf=bt/5,FI=1/Hf,Gn=18,Ar=function(i,e){return i[0]+e*(i[1]+e*(i[2]+e*i[3]))},OI=function(i,e){return i[1]+e*(2*i[2]+e*3*i[3])};function GI(i,e,t,n){for(var s=e;n;--n){var o=i(s);if(s-=o,Math.abs(o)<t)break}return s}function UI(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function VI(i){var e=X(i.x-this.long0,this.over),t=Math.abs(i.y),n=Math.floor(t*Hf);n<0?n=0:n>=Gn&&(n=Gn-1),t=bt*(t-FI*n);var s={x:Ar(Yl[n],t)*e,y:Ar(zs[n],t)};return i.y<0&&(s.y=-s.y),s.x=s.x*this.a*Qf+this.x0,s.y=s.y*this.a*zf+this.y0,s}function QI(i){var e={x:(i.x-this.x0)/(this.a*Qf),y:Math.abs(i.y-this.y0)/(this.a*zf)};if(e.y>=1)e.x/=Yl[Gn][0],e.y=i.y<0?-$:$;else{var t=Math.floor(e.y*Gn);for(t<0?t=0:t>=Gn&&(t=Gn-1);;)if(zs[t][0]>e.y)--t;else if(zs[t+1][0]<=e.y)++t;else break;var n=zs[t],s=5*(e.y-n[0])/(zs[t+1][0]-n[0]);s=GI(function(o){return(Ar(n,o)-e.y)/OI(n,o)},s,K,100),e.x/=Ar(Yl[t],s),e.y=(5*t+s)*Oe,i.y<0&&(e.y=-e.y)}return e.x=X(e.x+this.long0,this.over),e}var zI=["Robinson","robin"];const HI={init:UI,forward:VI,inverse:QI,names:zI};function YI(){this.name="geocent"}function $I(i){var e=bf(i,this.es,this.a);return e}function jI(i){var e=wf(i,this.es,this.a,this.b);return e}var WI=["Geocentric","geocentric","geocent","Geocent"];const qI={init:YI,forward:$I,inverse:jI,names:WI};var dt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Hs={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function KI(){if(Object.keys(Hs).forEach((function(t){if(typeof this[t]>"u")this[t]=Hs[t].def;else{if(Hs[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Hs[t].num&&(this[t]=parseFloat(this[t]))}Hs[t].degrees&&(this[t]=this[t]*Oe)}).bind(this)),Math.abs(Math.abs(this.lat0)-$)<K?this.mode=this.lat0<0?dt.S_POLE:dt.N_POLE:Math.abs(this.lat0)<K?this.mode=dt.EQUIT:(this.mode=dt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var i=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(i),this.sw=Math.sin(i)}function XI(i){i.x-=this.long0;var e=Math.sin(i.y),t=Math.cos(i.y),n=Math.cos(i.x),s,o;switch(this.mode){case dt.OBLIQ:o=this.sinph0*e+this.cosph0*t*n;break;case dt.EQUIT:o=t*n;break;case dt.S_POLE:o=-e;break;case dt.N_POLE:o=e;break}switch(o=this.pn1/(this.p-o),s=o*t*Math.sin(i.x),this.mode){case dt.OBLIQ:o*=this.cosph0*e-this.sinph0*t*n;break;case dt.EQUIT:o*=e;break;case dt.N_POLE:o*=-(t*n);break;case dt.S_POLE:o*=t*n;break}var r,a;return r=o*this.cg+s*this.sg,a=1/(r*this.sw*this.h1+this.cw),s=(s*this.cg-o*this.sg)*this.cw*a,o=r*a,i.x=s*this.a,i.y=o*this.a,i}function JI(i){i.x/=this.a,i.y/=this.a;var e={x:i.x,y:i.y},t,n,s;s=1/(this.pn1-i.y*this.sw),t=this.pn1*i.x*s,n=this.pn1*i.y*this.cw*s,i.x=t*this.cg+n*this.sg,i.y=n*this.cg-t*this.sg;var o=Et(i.x,i.y);if(Math.abs(o)<K)e.x=0,e.y=i.y;else{var r,a;switch(a=1-o*o*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/o+o/this.pn1),r=Math.sqrt(1-a*a),this.mode){case dt.OBLIQ:e.y=Math.asin(r*this.sinph0+i.y*a*this.cosph0/o),i.y=(r-this.sinph0*Math.sin(e.y))*o,i.x*=a*this.cosph0;break;case dt.EQUIT:e.y=Math.asin(i.y*a/o),i.y=r*o,i.x*=a;break;case dt.N_POLE:e.y=Math.asin(r),i.y=-i.y;break;case dt.S_POLE:e.y=-Math.asin(r);break}e.x=Math.atan2(i.x,i.y)}return i.x=e.x+this.long0,i.y=e.y,i}var ZI=["Tilted_Perspective","tpers"];const eS={init:KI,forward:XI,inverse:JI,names:ZI};function tS(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var i=1-this.es,e=1/i;this.radius_p=Math.sqrt(i),this.radius_p2=i,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function iS(i){var e=i.x,t=i.y,n,s,o,r;if(e=e-this.long0,this.shape==="ellipse"){t=Math.atan(this.radius_p2*Math.tan(t));var a=this.radius_p/Et(this.radius_p*Math.cos(t),Math.sin(t));if(s=a*Math.cos(e)*Math.cos(t),o=a*Math.sin(e)*Math.cos(t),r=a*Math.sin(t),(this.radius_g-s)*s-o*o-r*r*this.radius_p_inv2<0)return i.x=Number.NaN,i.y=Number.NaN,i;n=this.radius_g-s,this.flip_axis?(i.x=this.radius_g_1*Math.atan(o/Et(r,n)),i.y=this.radius_g_1*Math.atan(r/n)):(i.x=this.radius_g_1*Math.atan(o/n),i.y=this.radius_g_1*Math.atan(r/Et(o,n)))}else this.shape==="sphere"&&(n=Math.cos(t),s=Math.cos(e)*n,o=Math.sin(e)*n,r=Math.sin(t),n=this.radius_g-s,this.flip_axis?(i.x=this.radius_g_1*Math.atan(o/Et(r,n)),i.y=this.radius_g_1*Math.atan(r/n)):(i.x=this.radius_g_1*Math.atan(o/n),i.y=this.radius_g_1*Math.atan(r/Et(o,n))));return i.x=i.x*this.a,i.y=i.y*this.a,i}function nS(i){var e=-1,t=0,n=0,s,o,r,a;if(i.x=i.x/this.a,i.y=i.y/this.a,this.shape==="ellipse"){this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Et(1,n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Et(1,t));var l=n/this.radius_p;if(s=t*t+l*l+e*e,o=2*this.radius_g*e,r=o*o-4*s*this.C,r<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-o-Math.sqrt(r))/(2*s),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e),i.y=Math.atan(this.radius_p_inv2*Math.tan(i.y))}else if(this.shape==="sphere"){if(this.flip_axis?(n=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Math.sqrt(1+n*n)):(t=Math.tan(i.x/this.radius_g_1),n=Math.tan(i.y/this.radius_g_1)*Math.sqrt(1+t*t)),s=t*t+n*n+e*e,o=2*this.radius_g*e,r=o*o-4*s*this.C,r<0)return i.x=Number.NaN,i.y=Number.NaN,i;a=(-o-Math.sqrt(r))/(2*s),e=this.radius_g+a*e,t*=a,n*=a,i.x=Math.atan2(t,e),i.y=Math.atan(n*Math.cos(i.x)/e)}return i.x=i.x+this.long0,i}var sS=["Geostationary Satellite View","Geostationary_Satellite","geos"];const oS={init:tS,forward:iS,inverse:nS,names:sS};var Ys=1.340264,$s=-.081106,js=893e-6,Ws=.003796,vr=Math.sqrt(3)/2;function rS(){this.es=0,this.long0=this.long0!==void 0?this.long0:0,this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0}function aS(i){var e=X(i.x-this.long0,this.over),t=i.y,n=Math.asin(vr*Math.sin(t)),s=n*n,o=s*s*s;return i.x=e*Math.cos(n)/(vr*(Ys+3*$s*s+o*(7*js+9*Ws*s))),i.y=n*(Ys+$s*s+o*(js+Ws*s)),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function lS(i){i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a;var e=1e-9,t=12,n=i.y,s,o,r,a,l,c;for(c=0;c<t&&(s=n*n,o=s*s*s,r=n*(Ys+$s*s+o*(js+Ws*s))-i.y,a=Ys+3*$s*s+o*(7*js+9*Ws*s),n-=l=r/a,!(Math.abs(l)<e));++c);return s=n*n,o=s*s*s,i.x=vr*i.x*(Ys+3*$s*s+o*(7*js+9*Ws*s))/Math.cos(n),i.y=Math.asin(Math.sin(n)/vr),i.x=X(i.x+this.long0,this.over),i}var cS=["eqearth","Equal Earth","Equal_Earth"];const dS={init:rS,forward:aS,inverse:lS,names:cS};var qs=1e-10;function hS(){var i;if(this.phi1=this.lat1,Math.abs(this.phi1)<qs)throw new Error;this.es?(this.en=Ll(this.es),this.m1=Rn(this.phi1,this.am1=Math.sin(this.phi1),i=Math.cos(this.phi1),this.en),this.am1=i/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=fS,this.forward=uS):(Math.abs(this.phi1)+qs>=$?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=mS,this.forward=pS)}function uS(i){var e=X(i.x-(this.long0||0),this.over),t=i.y,n,s,o;return n=this.am1+this.m1-Rn(t,s=Math.sin(t),o=Math.cos(t),this.en),s=o*e/(n*Math.sqrt(1-this.es*s*s)),i.x=n*Math.sin(s),i.y=this.am1-n*Math.cos(s),i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function fS(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n,s;if(t=Et(i.x,i.y=this.am1-i.y),s=Rl(this.am1+this.m1-t,this.es,this.en),(e=Math.abs(s))<$)e=Math.sin(s),n=t*Math.atan2(i.x,i.y)*Math.sqrt(1-this.es*e*e)/Math.cos(s);else if(Math.abs(e-$)<=qs)n=0;else throw new Error;return i.x=X(n+(this.long0||0),this.over),i.y=Ti(s),i}function pS(i){var e=X(i.x-(this.long0||0),this.over),t=i.y,n,s;return s=this.cphi1+this.phi1-t,Math.abs(s)>qs?(i.x=s*Math.sin(n=e*Math.cos(t)/s),i.y=this.cphi1-s*Math.cos(n)):i.x=i.y=0,i.x=this.a*i.x+(this.x0||0),i.y=this.a*i.y+(this.y0||0),i}function mS(i){i.x=(i.x-(this.x0||0))/this.a,i.y=(i.y-(this.y0||0))/this.a;var e,t,n=Et(i.x,i.y=this.cphi1-i.y);if(t=this.cphi1+this.phi1-n,Math.abs(t)>$)throw new Error;return Math.abs(Math.abs(t)-$)<=qs?e=0:e=n*Math.atan2(i.x,i.y)/Math.cos(t),i.x=X(e+(this.long0||0),this.over),i.y=Ti(t),i}var gS=["bonne","Bonne (Werner lat_1=90)"];const yS={init:hS,names:gS},Yf={OBLIQUE:{forward:CS,inverse:xS},TRANSVERSE:{forward:ES,inverse:IS}},br={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function AS(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=mf.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if(this.o_proj==="ob_tran")throw new Error("Invalid value for o_proj: "+this.o_proj);const i=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=Pt(i);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);e.long0=0,this.obliqueProjection=e;let t;const n=Object.keys(br),s=a=>{if(typeof this[a]>"u")return;const l=parseFloat(this[a])*Oe;if(isNaN(l))throw new Error("Invalid value for "+a+": "+this[a]);return l};for(let a=0;a<n.length;a++){const l=n[a],c=br[l],h=Object.entries(c);if(h.some(([p])=>typeof this[p]<"u")){t=c;for(let p=0;p<h.length;p++){const[f,m]=h[p],y=s(f);if(typeof y>"u")throw new Error("Missing parameter: "+f+".");this[m]=y}break}}if(!t)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:o,phip:r}=wS(this,t);this.lamp=o,Math.abs(r)>K?(this.cphip=Math.cos(r),this.sphip=Math.sin(r),this.projectionType=Yf.OBLIQUE):this.projectionType=Yf.TRANSVERSE}function vS(i){return this.projectionType.forward(this,i)}function bS(i){return this.projectionType.inverse(this,i)}function wS(i,e){let t,n;if(e===br.ROTATE){let s=i.oLongC,o=i.oLatC,r=i.oAlpha;if(Math.abs(Math.abs(o)-$)<=K)throw new Error("Invalid value for o_lat_c: "+i.o_lat_c+" should be < 90°");n=s+Math.atan2(-1*Math.cos(r),-1*Math.sin(r)*Math.sin(o)),t=Math.asin(Math.cos(o)*Math.sin(r))}else if(e===br.NEW_POLE)n=i.oLongP,t=i.oLatP;else{let s=i.oLong1,o=i.oLat1,r=i.oLong2,a=i.oLat2,l=Math.abs(o);if(Math.abs(o)>$-K)throw new Error("Invalid value for o_lat_1: "+i.o_lat_1+" should be < 90°");if(Math.abs(a)>$-K)throw new Error("Invalid value for o_lat_2: "+i.o_lat_2+" should be < 90°");if(Math.abs(o-a)<K)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(l<K)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(o)*Math.sin(a)*Math.cos(s)-Math.sin(o)*Math.cos(a)*Math.cos(r),Math.sin(o)*Math.cos(a)*Math.sin(r)-Math.cos(o)*Math.sin(a)*Math.sin(s)),t=Math.atan(-1*Math.cos(n-s)/Math.tan(o))}return{lamp:n,phip:t}}function CS(i,e){let{x:t,y:n}=e;t+=i.long0;const s=Math.cos(t),o=Math.sin(n),r=Math.cos(n);e.x=X(Math.atan2(r*Math.sin(t),i.sphip*r*s+i.cphip*o)+i.lamp),e.y=Math.asin(i.sphip*o-i.cphip*r*s);const a=i.obliqueProjection.forward(e);return i.isIdentity&&(a.x*=bt,a.y*=bt),a}function ES(i,e){let{x:t,y:n}=e;t+=i.long0;const s=Math.cos(n),o=Math.cos(t);e.x=X(Math.atan2(s*Math.sin(t),Math.sin(n))+i.lamp),e.y=Math.asin(-1*s*o);const r=i.obliqueProjection.forward(e);return i.isIdentity&&(r.x*=bt,r.y*=bt),r}function xS(i,e){i.isIdentity&&(e.x*=Oe,e.y*=Oe);const t=i.obliqueProjection.inverse(e);let{x:n,y:s}=t;if(n<Number.MAX_VALUE){n-=i.lamp;const o=Math.cos(n),r=Math.sin(s),a=Math.cos(s);e.x=Math.atan2(a*Math.sin(n),i.sphip*a*o-i.cphip*r),e.y=Math.asin(i.sphip*r+i.cphip*a*o)}return e.x=X(e.x+i.long0),e}function IS(i,e){i.isIdentity&&(e.x*=Oe,e.y*=Oe);const t=i.obliqueProjection.inverse(e);let{x:n,y:s}=t;if(n<Number.MAX_VALUE){const o=Math.cos(s);n-=i.lamp,e.x=Math.atan2(o*Math.sin(n),-1*Math.sin(s)),e.y=Math.asin(o*Math.cos(n))}return e.x=X(e.x+i.long0),e}var SS=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"];const MS={init:AS,forward:vS,inverse:bS,names:SS};function TS(i){i.Proj.projections.add(fr),i.Proj.projections.add(pr),i.Proj.projections.add(gx),i.Proj.projections.add(Ix),i.Proj.projections.add(_x),i.Proj.projections.add(Lx),i.Proj.projections.add(Vx),i.Proj.projections.add($x),i.Proj.projections.add(Xx),i.Proj.projections.add(i2),i.Proj.projections.add(m2),i.Proj.projections.add(w2),i.Proj.projections.add(S2),i.Proj.projections.add(P2),i.Proj.projections.add(F2),i.Proj.projections.add(Q2),i.Proj.projections.add(j2),i.Proj.projections.add(J2),i.Proj.projections.add(sI),i.Proj.projections.add(cI),i.Proj.projections.add(pI),i.Proj.projections.add(vI),i.Proj.projections.add(SI),i.Proj.projections.add(kI),i.Proj.projections.add(RI),i.Proj.projections.add(HI),i.Proj.projections.add(qI),i.Proj.projections.add(eS),i.Proj.projections.add(oS),i.Proj.projections.add(dS),i.Proj.projections.add(yS),i.Proj.projections.add(MS)}const Ks=Object.assign(DE,{defaultDatum:"WGS84",Proj:Pt,WGS84:new Pt("WGS84"),Point:Ln,toPoint:If,defs:st,nadgrid:mE,transform:hr,mgrs:NE,version:"__VERSION__"});TS(Ks);class BS{cesium;viewer;watermarkEnabled="";setWatermarkEnabled(e){this.watermarkEnabled=e}mapLayers={};modelId="default";options={flyTo:!0};gisCadModelsList=[];open=!1;events=new _s;heightLodThresholds={full:2e3,medium:8e3,far:3e4};heightLodEnabled=!1;heightLodHandler=null;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t}getMapLayers(e){const t=typeof e=="object"?e?.modelId:e;return t?this.mapLayers[t]||{}:this.mapLayers}setModelId(e){this.modelId=e}getModelId(){return this.modelId}setDxfOpen(e){this.open=e}getDxfOpen(){return this.open}getDxfModelsList(){return this.gisCadModelsList}async addVectorTileByUrlTemplate(e){let t=window?.VectorTileLayer||window?.CesiumVectorTileGL?.VectorTileLayer||this.cesium?.VectorTileLayer;if(!t)try{const s=await Promise.resolve().then(()=>Hd),o=s?.VectorTileLayer||s?.CesiumVectorTileGL?.VectorTileLayer||s?.default?.VectorTileLayer||s?.default;if(o)window.VectorTileLayer=o,s?.CesiumVectorTileGL&&(window.CesiumVectorTileGL=s.CesiumVectorTileGL),t=o;else{const r=s?.VectorTileset||s?.CesiumVectorTileGL?.VectorTileset||s?.default?.VectorTileset;r&&(window.VectorTileset=r)}}catch{}if(t){const s=new t(this.viewer,{urlTemplate:e.urlTemplate,minZoom:e.minZoom??0,maxZoom:e.maxZoom??24,style:e.style||{},terrain:!0,tms:e.tms??e.scheme==="tms"});try{const o=s;o?.readyEvent?.addEventListener&&o.readyEvent.addEventListener(()=>{}),o?.errorEvent?.addEventListener&&o.errorEvent.addEventListener(r=>{console.error("VectorTileLayer error:",r)})}catch{}return s}const n=window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset;if(n){const s=[],o=Array.isArray(e.sourceLayer)?e.sourceLayer:e.sourceLayer?[e.sourceLayer]:["layer","lines","line","roads","road","default","vt","g"],r=c=>[{id:`vt-fill-${c}`,type:"fill",source:"vt","source-layer":c,paint:{"fill-color":e.style?.polygon?.fill??"#00ffff66","fill-opacity":e.style?.polygon?.opacity??.4}},{id:`vt-line-${c}`,type:"line",source:"vt","source-layer":c,paint:{"line-color":e.style?.line?.color??"#ff0000","line-width":e.style?.line?.width??3}}];o.forEach(c=>s.push(...r(c)));const a={version:8,sources:{vt:{type:"vector",tiles:[e.urlTemplate],minzoom:e.minZoom??0,maxzoom:e.maxZoom??24,scheme:e.scheme??(e.tms?"tms":"xyz")}},layers:s},l=new n({style:a,terrain:e.terrain??e.clampToGround??!0});return this.viewer.scene.primitives.add(l),l?.readyEvent?.addEventListener&&l.readyEvent.addEventListener(()=>{try{Object.keys(l?.sources||{}),a?.layers?.map(c=>c?.["source-layer"]).filter((c,h,u)=>c&&u.indexOf(c)===h)}catch{}}),l?.errorEvent?.addEventListener&&l.errorEvent.addEventListener(c=>{console.error("VectorTileset error:",c)}),l}return console.error("Vector tile renderer not found. Please include cesium-vectortile-gl (or compatible) and ensure VectorTileLayer/VectorTileset is available globally."),null}async addGeoJsonLayer(e){let t=window?.VectorTileLayer||window?.CesiumVectorTileGL?.VectorTileLayer||this.cesium?.VectorTileLayer;if(!t)try{const l=await Promise.resolve().then(()=>Hd),c=l?.VectorTileLayer||l?.CesiumVectorTileGL?.VectorTileLayer||l?.default?.VectorTileLayer||l?.default;c&&(window.VectorTileLayer=c,l?.CesiumVectorTileGL&&(window.CesiumVectorTileGL=l.CesiumVectorTileGL),t=c)}catch{}if(!(window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset))try{const l=await Promise.resolve().then(()=>Hd),c=l?.VectorTileset||l?.CesiumVectorTileGL?.VectorTileset||l?.default?.VectorTileset;c&&(window.VectorTileset=c)}catch{}const s={type:"geojson"};if(e.dataUrl)s.data=e.dataUrl;else if(e.data)s.data=e.data;else return null;if(e.minZoom!==void 0&&(s.minzoom=e.minZoom),e.maxZoom!==void 0&&(s.maxzoom=e.maxZoom),e.vtOptions&&typeof e.vtOptions=="object"){const l=e.vtOptions;l.maxZoom!==void 0&&(s.maxzoom=l.maxZoom),l.indexMaxZoom!==void 0&&(s.indexMaxZoom=l.indexMaxZoom),l.indexMaxPoints!==void 0&&(s.indexMaxPoints=l.indexMaxPoints),l.tolerance!==void 0&&(s.tolerance=l.tolerance),l.extent!==void 0&&(s.extent=l.extent),l.buffer!==void 0&&(s.buffer=l.buffer),l.lineMetrics!==void 0&&(s.lineMetrics=l.lineMetrics),l.promoteId!==void 0&&(s.promoteId=l.promoteId),l.generateId!==void 0&&(s.generateId=l.generateId)}const o={version:8,sources:{g:s},layers:[{id:"g-fill",type:"fill",source:"g",paint:{"fill-color":e.style?.polygon?.fill??"#00ffff66","fill-opacity":e.style?.polygon?.opacity??.4}},{id:"g-line",type:"line",source:"g",paint:{"line-color":e.style?.line?.color??"#ff0000","line-width":e.style?.line?.width??1.5}},{id:"g-point",type:"symbol",source:"g",layout:{"icon-image":void 0,"text-field":""},paint:{}}]};if(t){const l=new t(this.viewer,{style:o,terrain:e.terrain??e.clampToGround??!0});try{const c=l;c?.readyEvent?.addEventListener&&c.readyEvent.addEventListener(()=>{}),c?.errorEvent?.addEventListener&&c.errorEvent.addEventListener(h=>{console.error("VectorTileLayer error (geojson):",h)})}catch{}try{const h=await(async()=>{if(e.data&&e.data.type==="FeatureCollection")return e.data;if(e.dataUrl){const u=await fetch(e.dataUrl,{cache:"no-store"});if(u.ok){const p=await u.json();if(p&&p.type==="FeatureCollection")return p}}return null})();if(h&&Array.isArray(h.features)&&h.features.length){let u=180,p=90,f=-180,m=-90;const y=(A,v)=>{!Number.isFinite(A)||!Number.isFinite(v)||(A<u&&(u=A),A>f&&(f=A),v<p&&(p=v),v>m&&(m=v))},g=A=>{if(Array.isArray(A)&&typeof A[0]=="number")y(Number(A[0]),Number(A[1]));else if(Array.isArray(A))for(const v of A)g(v)};for(const A of h.features){const v=A?.geometry;v?.coordinates&&g(v.coordinates)}if(u<=f&&p<=m){const A=this.cesium.Rectangle.fromDegrees(u,p,f,m);this.viewer.camera.flyTo({destination:A,duration:.6})}}}catch{}return l}const r=window?.CesiumVectorTileGL?.VectorTileset||window?.VectorTileset;if(!r)return null;const a=new r({style:o,terrain:e.terrain??e.clampToGround??!0});this.viewer.scene.primitives.add(a);try{const c=await(async()=>{if(e.data&&e.data.type==="FeatureCollection")return e.data;if(e.dataUrl){const h=await fetch(e.dataUrl,{cache:"no-store"});if(h.ok){const u=await h.json();if(u&&u.type==="FeatureCollection")return u}}return null})();if(c&&Array.isArray(c.features)&&c.features.length){let h=180,u=90,p=-180,f=-90;const m=(g,A)=>{!Number.isFinite(g)||!Number.isFinite(A)||(g<h&&(h=g),g>p&&(p=g),A<u&&(u=A),A>f&&(f=A))},y=g=>{if(Array.isArray(g)&&typeof g[0]=="number")m(Number(g[0]),Number(g[1]));else if(Array.isArray(g))for(const A of g)y(A)};for(const g of c.features){const A=g?.geometry;A?.coordinates&&y(A.coordinates)}if(h<=p&&u<=f){const g=this.cesium.Rectangle.fromDegrees(h,u,p,f);this.viewer.camera.flyTo({destination:g,duration:.6})}}}catch{}return a}async addVectorTileByTilesManifest(e){try{const t=await fetch(e.manifestUrl,{cache:"no-store"});if(!t.ok)return null;const n=await t.json();let s=null;const o=Array.isArray(n?.items)?n.items[0]:null;if(o?.url&&typeof o.url=="string"&&(s=String(o.url).replace(/\\/g,"/").replace(/\/\d+\/\d+\/\d+\.pbf$/i,"")),!s){const h=new URL(e.manifestUrl,window.location.href).href.replace(/\\/g,"/");s=h.slice(0,h.lastIndexOf("/"))}let r=e.minZoom,a=e.maxZoom;if((r===void 0||a===void 0)&&Array.isArray(n?.items)&&n.items.length){const c=n.items.map(h=>Number(h?.z)).filter(h=>Number.isFinite(h));c.length&&(r===void 0&&(r=Math.min(...c)),a===void 0&&(a=Math.max(...c)))}try{const c=Array.isArray(n?.items)?n.items:[],h=r??c[0]?.z??0,u=c.filter(p=>Number(p?.z)===h);if(u.length){let p=1/0,f=-1/0,m=1/0,y=-1/0;for(const g of u){const A=Number(g.x),v=Number(g.y);!Number.isFinite(A)||!Number.isFinite(v)||(A<p&&(p=A),A>f&&(f=A),v<m&&(m=v),v>y&&(y=v))}if(Number.isFinite(p)&&Number.isFinite(f)&&Number.isFinite(m)&&Number.isFinite(y)){const g=Math.pow(2,h),A=S=>S/g*360-180,v=S=>{const w=Math.PI-2*Math.PI*S/g;return 180/Math.PI*Math.atan(Math.sinh(w))},b=A(p),C=A(f+1),x=v(m),I=v(y+1),E=this.cesium.Rectangle.fromDegrees(b,I,C,x);this.viewer.camera.flyTo({destination:E,duration:.6})}}}catch{}const l=`${s}/{z}/{x}/{y}.pbf`;return this.addVectorTileByUrlTemplate({modelId:e.modelId,urlTemplate:l,sourceLayer:e.sourceLayer,minZoom:r,maxZoom:a,style:e.style})}catch{return null}}enableHeightLod(e=!0){this.heightLodEnabled=e,e&&!this.heightLodHandler?(this.heightLodHandler=this.viewer.camera.changed.addEventListener(()=>{this.applyHeightLod()}),this.viewer.camera.percentageChanged=.05,this.applyHeightLod()):!e&&this.heightLodHandler&&(this.heightLodHandler(),this.heightLodHandler=null,this.gisCadModelsList.forEach(t=>{const n=this.mapLayers[t.modelId];n&&Object.values(n).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t.show!==!1)})})}),this.viewer.scene.requestRender())}getCameraHeightAboveGround(e){const t=this.viewer?.camera?.positionCartographic;if(!t)return 1/0;const n=t.height,s=e?.buildOptions?.clampToGround??e?.formData?.clampToGround??!1;let o=0;if(s)try{const r=this.viewer?.scene?.globe;if(r){const a=r.getHeight(t);a!==void 0&&Number.isFinite(a)&&(o=a)}}catch{}else o=e?.transform?.originHeight??e?.formData?.height??0;return n-o}applyHeightLod(){if(!this.heightLodEnabled)return;const{full:e,medium:t,far:n}=this.heightLodThresholds;this.gisCadModelsList.forEach(s=>{const o=this.mapLayers[s.modelId];if(!o||s.show===!1)return;const r=this.getCameraHeightAboveGround(s);Object.values(o).forEach(a=>{a.forEach(l=>{if(!l.primitive)return;let c=!0;r>n?c=l.type==="polygon":r>t?c=l.type!=="point":r>e&&(c=!0),l.primitive.show=c})})}),this.viewer.scene.requestRender()}getDxfModels(e){const t=typeof e=="object"?e?.modelId:e;return t?this.gisCadModelsList.find(n=>n.modelId===t):this.gisCadModelsList}getDefaultCoordinateTransformConfig(){return{centralMeridian:118.5,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"}}buildLongLatProj4Def(e){return`+proj=longlat +ellps=${e?.ellipsoid||this.getDefaultCoordinateTransformConfig().ellipsoid} +no_defs`}buildProjectedProj4Def(e){const t={...this.getDefaultCoordinateTransformConfig(),...e};return["+proj=tmerc",`+lat_0=${t.latOrigin}`,`+lon_0=${t.centralMeridian}`,`+k=${t.scaleFactor}`,`+x_0=${t.falseEasting}`,`+y_0=${t.falseNorthing}`,`+ellps=${t.ellipsoid||"GRS80"}`,"+units=m","+no_defs"].join(" ")}transformCoordinate(e){const t={...this.getDefaultCoordinateTransformConfig(),...e.config},n=this.buildLongLatProj4Def(t),s=this.buildProjectedProj4Def(t);if(e.direction==="lonlatToProjected"){const c=Number(e.longitude),h=Number(e.latitude);if([c,h].some(f=>Number.isNaN(f)))throw new Error("经纬度参数无效");const[u,p]=Ks(n,s,[c,h]);return{direction:e.direction,x:u,y:p,config:t}}const o=Number(e.x),r=Number(e.y);if([o,r].some(c=>Number.isNaN(c)))throw new Error("投影坐标参数无效");const[a,l]=Ks(s,n,[o,r]);return{direction:e.direction,longitude:a,latitude:l,config:t}}showJson({modelId:e,show:t}){const n=this.getRuntimeModel(e);n?.root&&(n.show=t,n.root.show=t),this.mapLayers[e]&&Object.values(this.mapLayers[e]).forEach(s=>{s.forEach(o=>{o.primitive&&(o.primitive.show=t)})}),n&&(t?n._overviewLODCheck?.():(n.overviewL0Roots?.forEach(s=>{s.show=!1}),n.overviewL1Roots?.forEach(s=>{s.show=!1})))}showJsonByLayer({modelId:e,show:t,layers:n}){const s=this.mapLayers[e];!s||!Array.isArray(n)||n.forEach(o=>{const r=s[o];r&&r.forEach(a=>{a.primitive&&(a.primitive.show=t)})})}async flyToCadModel(e={}){const t=e.modelId||this.modelId,n=this.gisCadModelsList.find(o=>o.modelId===t);if(!n)return;try{const r=`${n.outPutPath?.endsWith("/")?n.outPutPath:`${n.outPutPath}/`}${n.dbName}/cameraView.zip`,a=await Mt(r);if(a&&a.position&&a.orientation){const l=new this.cesium.Cartesian3(a.position.x,a.position.y,a.position.z),c=new this.cesium.HeadingPitchRoll(a.orientation.heading,a.orientation.pitch,a.orientation.roll);this.viewer.camera.flyTo({destination:l,orientation:c,duration:a.duration??1});return}}catch(o){console.warn("[flyToCadModel] 读取 cameraView.zip 失败,回退到默认视角",o)}const s=e.minHeight??n._rebuildContext?.overviewL1Height;this.flyToBounds(n,{duration:e.duration,minHeight:s})}flyToBounds(e,t){if(!e)return;const n=t?.duration??0,s=t?.minHeight,o=this.cesium,r=(l,c,h,u)=>{let p=l,f=c,m=h,y=u;if(s){const A=(p+m)/2,v=(f+y)/2,b=s/111e3,C=Math.max((m-p)/2,b),x=Math.max((y-f)/2,b);p=A-C,m=A+C,f=v-x,y=v+x}const g=o.Rectangle.fromDegrees(p,f,m,y);this.viewer.camera.flyTo({destination:g,duration:n})};{const l=e.overviewL0Tiles;if(l?.length){let c=1/0,h=1/0,u=-1/0,p=-1/0,f=0;for(const m of l){if(!m.lonLatBounds)continue;const y=m.lonLatBounds;y.west<c&&(c=y.west),y.south<h&&(h=y.south),y.east>u&&(u=y.east),y.north>p&&(p=y.north),f++}if(f>0&&Number.isFinite(c)&&Number.isFinite(u)){r(c,h,u,p);return}}}const a=this.computeRealRectangleDegrees(e);if(a){r(a.west,a.south,a.east,a.north);return}e.root&&this.viewer.flyTo(e.root,{duration:n})}computeRealRectangleDegrees(e){const t=e?.formData||{},n=e?.bounds,s=n?.min,o=n?.max;if(t.transformConfig&&t.transformDirection==="projectedToLonlat"&&s&&o&&Number.isFinite(s.x)&&Number.isFinite(s.y)&&Number.isFinite(o.x)&&Number.isFinite(o.y))try{const r=this.buildLongLatProj4Def(t.transformConfig),a=this.buildProjectedProj4Def(t.transformConfig),l=Ks(a,r),[c,h]=l.forward([s.x,s.y]),[u,p]=l.forward([o.x,o.y]);return{west:Math.min(c,u),south:Math.min(h,p),east:Math.max(c,u),north:Math.max(h,p)}}catch(r){console.warn("Failed to compute projected rectangle",r)}if(t.longitude!==void 0&&t.latitude!==void 0){const r=Number(t.longitude),a=Number(t.latitude),l=Math.max(1e-6,Number(t.scale??1)),c=Math.max(.001,l*.001);return{west:r-c,south:a-c,east:r+c,north:a+c}}return null}parseColor(e,t=1){const n=this.cesium.Color.WHITE.withAlpha(t);if(!e||typeof e!="string")return n;const s=e.trim(),o=[s];if(s.startsWith("#")){const r=s.slice(1).replace(/[^0-9a-fA-F]/g,"");[3,4,6,8].includes(r.length)&&o.push(`#${r}`)}for(const r of Array.from(new Set(o)))try{const a=this.cesium.Color.fromCssColorString(r);if(a)return a.withAlpha(t)}catch(a){console.warn("Failed to parse CAD color candidate:",r,a)}return console.warn("Failed to parse CAD color, fallback to white:",e),n}getLineWidth(e){return typeof e!="number"||Number.isNaN(e)?1.25:Math.max(2.5,e*5)}uniqueKey(e){return e.map(t=>`${t??""}`).join("::")}normalizePoint(e){if(!Array.isArray(e)||e.length<2)return null;const t=Number(e[0]),n=Number(e[1]),s=Number(e[2]||0);return[t,n,s].some(o=>Number.isNaN(o))?null:[t,n,s]}mergeLayerItemsMap(e,t){Object.entries(t).forEach(([n,s])=>{e[n]||(e[n]=[]),e[n].push(...s)})}buildDefaultFormData(e,t){return{modelId:e.modelId,longitude:t.originLongitude,latitude:t.originLatitude,height:t.originHeight,scaleToMeter:t.scaleToMeter,scale:t.scale,localOriginX:t.localOriginX,localOriginY:t.localOriginY,totalRotation:e.totalRotation||0,distance:1e-6,heightDistance:1,rotation:1,scaleStep:.1,clampToGround:!1}}normalizeFormData(e,t,n=!1){const s=e.formData||{},o=this.buildDefaultFormData(e,t);return{...o,...s,modelId:e.modelId,longitude:Number(s.longitude??o.longitude),latitude:Number(s.latitude??o.latitude),height:Number(s.height??o.height),scaleToMeter:Number(s.scaleToMeter??o.scaleToMeter),scale:Math.max(1e-6,Number(s.scale??o.scale)),localOriginX:Number(s.localOriginX??o.localOriginX),localOriginY:Number(s.localOriginY??o.localOriginY),totalRotation:Number(s.totalRotation??o.totalRotation),distance:Number(s.distance??o.distance),heightDistance:Number(s.heightDistance??o.heightDistance),rotation:Number(s.rotation??o.rotation),scaleStep:Number(s.scaleStep??o.scaleStep),transformConfig:s.transformConfig,transformDirection:s.transformDirection,clampToGround:s.clampToGround??n}}removeModelNode(e,t){!e||!t||(e.remove(t),t.destroy&&!t.isDestroyed?.()&&t.destroy())}buildTransform(e,t){const n=this.cesium,s=t.formData||{};let o=s.longitude??t.deltaLongitude??e.longitude??e.result?.origin?.longitude??0,r=s.latitude??t.deltaLatitude??e.latitude??e.result?.origin?.latitude??0,a=s.height??0;const l=e.result?.extMin?.x??0,c=e.result?.extMin?.y??0,h=s.scaleToMeter??e.result?.scaleToMeter??e.result?.realUnits??1,u=Math.max(1e-6,Number(s.scale??1)),p=h*u;let f=null,m=null,y=null;if(s.transformConfig&&s.transformDirection==="projectedToLonlat"){const C=this.buildLongLatProj4Def(s.transformConfig),x=this.buildProjectedProj4Def(s.transformConfig);f=Ks(x,C);try{const[I,E]=f.forward([l,c]);if(!Number.isFinite(I)||!Number.isFinite(E))console.warn("proj4 returned NaN for base point",{localOriginX:l,localOriginY:c,blon:I,blat:E}),f=null;else{o=I,r=E,a=0,m=n.Cartesian3.fromDegrees(I,E,0);const S=n.Transforms.eastNorthUpToFixedFrame(m);y=n.Matrix4.inverseTransformation(S,new n.Matrix4)}}catch(I){console.warn("Failed to calculate projection base",I),f=null}}const g=n.Cartesian3.fromDegrees(o,r,a),A=n.Transforms.eastNorthUpToFixedFrame(g),v=s.totalRotation??t.totalRotation??0;if(v){const C=n.Quaternion.fromAxisAngle(n.Cartesian3.UNIT_Z,n.Math.toRadians(v)),x=n.Matrix4.fromRotationTranslation(n.Matrix3.fromQuaternion(C),new n.Cartesian3(0,0,0));n.Matrix4.multiply(A,x,A)}return{originLongitude:o,originLatitude:r,originHeight:a,localOriginX:l,localOriginY:c,scaleToMeter:h,scale:u,totalScaleToMeter:p,toWorld:C=>{const x=this.normalizePoint(C);if(!x)return null;if(f&&m&&y)try{const[E,S]=f.forward([x[0],x[1]]);if(!(!Number.isFinite(E)||!Number.isFinite(S))){const w=n.Cartesian3.fromDegrees(E,S,x[2]),T=n.Matrix4.multiplyByPoint(y,w,new n.Cartesian3);return T.x*=u,T.y*=u,T.z*=u,n.Matrix4.multiplyByPoint(A,T,new n.Cartesian3)}}catch{}const I=new n.Cartesian3((x[0]-l)*p,(x[1]-c)*p,x[2]*p);return n.Matrix4.multiplyByPoint(A,I,new n.Cartesian3)}}}createLinePrimitive(e,t){return e.length?t.clampToGround?new this.cesium.GroundPolylinePrimitive({geometryInstances:e,appearance:new this.cesium.PolylineColorAppearance,asynchronous:!0,releaseGeometryInstances:!1,classificationType:this.cesium.ClassificationType.TERRAIN,allowPicking:!1}):new this.cesium.Primitive({geometryInstances:e,appearance:new this.cesium.PolylineColorAppearance,asynchronous:!0,allowPicking:!1}):null}createPolygonPrimitive(e,t){return e.length?t.clampToGround?new this.cesium.GroundPrimitive({geometryInstances:e,appearance:new this.cesium.PerInstanceColorAppearance({flat:!0,translucent:!0,closed:!0}),asynchronous:!0,releaseGeometryInstances:!1,classificationType:this.cesium.ClassificationType.TERRAIN,allowPicking:!1}):new this.cesium.Primitive({geometryInstances:e,appearance:new this.cesium.PerInstanceColorAppearance({flat:!0,translucent:!0,closed:!0}),asynchronous:!0,allowPicking:!1}):null}createPointPrimitive(e){if(!e.length)return null;const t=new this.cesium.PointPrimitiveCollection;return e.forEach(n=>{t.add(n)}),t}buildModelPrimitives(e,t,n){const s=this.cesium,o=new s.PrimitiveCollection,r={},a={},l=this.buildTransform(t,e),c=new Map,h=new Map,u=new Map,p=Array.isArray(t.result?.lines)?t.result?.lines||[]:[],f=Array.isArray(t.result?.polygons)?t.result?.polygons||[]:[],m=Array.isArray(t.result?.points)?t.result?.points||[]:[];p.forEach(A=>{const b=(Array.isArray(A?.positions)?A.positions:[]).map(S=>l.toWorld(S)).filter(Boolean);if(b.length<2)return;const C=A.layer||"default",x=A.color||"#ffffff",I=this.uniqueKey([C,"line",this.getLineWidth(A.lineWeight)]),E=c.get(I)||[];E.push(new s.GeometryInstance({geometry:n.clampToGround?new s.GroundPolylineGeometry({positions:b,width:this.getLineWidth(A.lineWeight)}):new s.PolylineGeometry({positions:b,width:this.getLineWidth(A.lineWeight),vertexFormat:s.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:s.ColorGeometryInstanceAttribute.fromColor(this.parseColor(x,1))},id:{modelId:e.modelId,layer:C,batchId:A.batchId,type:"line"}})),c.set(I,E)}),f.forEach(A=>{const b=(Array.isArray(A?.outerPositions)?A.outerPositions:[]).map(w=>l.toWorld(w)).filter(Boolean);if(b.length<3)return;const C=Array.isArray(A?.holes)?A.holes.map(w=>{const T=Array.isArray(w)?w.map(_=>l.toWorld(_)).filter(Boolean):[];return T.length<3?null:new s.PolygonHierarchy(T)}).filter(Boolean):[],x=A.layer||"default",I=A.color||"#ffffff",E=this.uniqueKey([x,"polygon"]),S=h.get(E)||[];S.push(new s.GeometryInstance({geometry:new s.PolygonGeometry({polygonHierarchy:new s.PolygonHierarchy(b,C),vertexFormat:s.PerInstanceColorAppearance.VERTEX_FORMAT}),attributes:{color:s.ColorGeometryInstanceAttribute.fromColor(this.parseColor(I,.45))},id:{modelId:e.modelId,layer:x,batchId:A.batchId,type:"polygon"}})),h.set(E,S)});const y=1;m.forEach(A=>{const v=A?.position||A?.positions?.[0]||A,b=this.normalizePoint(v);if(!b)return;const C=b[0],x=b[1],I=b[2]||0,E=A.layer||"default",S=A.color||"#ffffff",w=this.uniqueKey([E,"line",this.getLineWidth(A.lineWeight)]),T=c.get(w)||[],_=[l.toWorld([C-y,x,I]),l.toWorld([C+y,x,I])].filter(Boolean);_.length>=2&&T.push(new s.GeometryInstance({geometry:n.clampToGround?new s.GroundPolylineGeometry({positions:_,width:this.getLineWidth(A.lineWeight)}):new s.PolylineGeometry({positions:_,width:this.getLineWidth(A.lineWeight),vertexFormat:s.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:s.ColorGeometryInstanceAttribute.fromColor(this.parseColor(S,1))},id:{modelId:e.modelId,layer:E,batchId:A.batchId,type:"point"}})),c.set(w,T)});const g=(A,v,b)=>{v&&(o.add(v),n.recordLayers!==!1&&(a[A]||(a[A]=[]),a[A].push({primitive:v,color:b.color,batchId:b.batchId,type:b.type})),r[A]||(r[A]={}),r[A][b.type]=v)};return c.forEach((A,v)=>{const[b="default"]=v.split("::");g(b,this.createLinePrimitive(A,n),{color:void 0,batchId:A[0]?.id?.batchId,type:"line"})}),h.forEach((A,v)=>{const[b="default"]=v.split("::");g(b,this.createPolygonPrimitive(A,n),{color:void 0,batchId:A[0]?.id?.batchId,type:"polygon"})}),u.forEach((A,v)=>{const[b="default"]=v.split("::");g(b,this.createPointPrimitive(A),{color:void 0,batchId:A[0]?.id?.batchId,type:"point"})}),{root:o,layerPrimitiveMap:r,layerItemsMap:a,transform:l}}buildModelRoot(e,t,n){const s=new this.cesium.PrimitiveCollection,o={};let r=null;return t.forEach(a=>{const l=this.buildModelPrimitives(e,a,n);r||(r=l),s.add(l.root),this.mergeLayerItemsMap(o,l.layerItemsMap)}),{root:s,primaryRoot:r?.root??null,transform:r.transform,layerItemsMap:o}}getRuntimeModel(e){const t=e||this.modelId;return this.gisCadModelsList.find(n=>n.modelId===t)||null}rebuildPreviewRoot(e){if(!e.editingFormData)return;e.previewRoot&&(this.removeModelNode(e.root,e.previewRoot),e.previewRoot=null);const t=this.buildModelRoot({...e,formData:e.editingFormData},e.sourceDataList,{clampToGround:e.editingFormData.clampToGround??!1,recordLayers:!1});e.previewRoot=t.root,e.root.add(e.previewRoot),e.groundRoot&&(e.groundRoot.show=!1)}replaceGroundRoot(e,t){const n=this.cesium;t.clampToGround!==void 0&&(e.buildOptions.clampToGround=t.clampToGround),e.tileCameraListenerRemove?.(),e.overviewLODListenerRemove?.(),e.tileCameraListenerRemove=void 0,e.overviewLODListenerRemove=void 0,e._overviewLODCheck=void 0,e._tileLODCheck=void 0,e.root&&(this.viewer.scene.primitives.remove(e.root),e.root.destroy&&!e.root.isDestroyed?.()&&e.root.destroy()),e.root=null,e.groundRoot=null,e.previewRoot=null,e.tileRoots?.clear(),e.overviewL0Roots?.clear(),e.overviewL1Roots?.clear(),e.formData=t;const s=e.sourceDataList?.[0];if(!s)return;const o=this.buildModelRoot({...e,formData:t},[s],e.buildOptions),r=new n.PrimitiveCollection;r.add(o.root),e.root=r,e.groundRoot=o.root,e.primaryRoot=o.primaryRoot,e.groundRoot.show=e.show!==!1,e.transform=o.transform,e.sourceDataList=[s],e.loadedChunks=1,e.tileRoots=e.manifestTiles?new Map:void 0,e.overviewL0Roots=new Map,e.overviewL1Roots=new Map,this.mapLayers[e.modelId]=o.layerItemsMap,this.viewer.scene.primitives.add(e.root),e.manifestTiles&&this.computeManifestTileLonLatBounds(e.manifestTiles,e.transform),e.overviewL0Tiles&&this.computeManifestTileLonLatBounds(e.overviewL0Tiles,e.transform),e.overviewL1Tiles&&this.computeManifestTileLonLatBounds(e.overviewL1Tiles,e.transform);const a=e._rebuildContext;a&&((e.overviewL0Tiles?.length||e.overviewL1Tiles?.length)&&this.setupOverviewLOD(e,e,a.normalizedBase,e.overviewL0Tiles||[],e.overviewL1Tiles||[],a.overviewL1Height),e.manifestTiles&&this.setupManifestTileLoading(e,e,a.normalizedBase)),this.viewer.scene.requestRender()}async loadModelFile(e){try{if(!e||typeof e!="string")return!1;const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);if(e.endsWith(".json")||t.headers.get("content-type")?.includes("application/json"))return await t.json();const n=await t.blob(),s=new gl(new tr(n),{password:Wu,useWebWorkers:!1}),r=(await s.getEntries()).find(c=>!c.directory&&c.filename.endsWith(".json"));if(!r)return await s.close(),!1;const a=await r.arrayBuffer({useWebWorkers:!1});await s.close();const l=new TextDecoder().decode(a);return JSON.parse(l.trim())}catch(t){return console.error("Failed to load GIS CAD source:",e,t),!1}}getCandidateUrls(e){const t=e.outPutPath.endsWith("/")?e.outPutPath:`${e.outPutPath}/`,n=[e.sourceUrl,`${t}${e.dbName}/cad.zip`].filter(Boolean);return Array.from(new Set(n))}getChunkCandidateUrls(e,t,n){const o=[`${e.outPutPath.endsWith("/")?e.outPutPath:`${e.outPutPath}/`}${e.dbName}/cad_${n}.zip`];try{const r=new URL(t),a=r.pathname,l=a.lastIndexOf("/"),c=l>=0?a.slice(0,l+1):"/",h=a.lastIndexOf("."),u=h>=0?a.slice(h):".zip",p=l>=0?a.slice(l+1,h>=0?h:void 0):a.slice(0,h>=0?h:void 0),f=p===e.dbName?e.dbName:p;o.unshift(`${r.origin}${c}${f}_${n}${u}`,`${r.origin}${c}${f}${n}${u}`)}catch(r){console.warn("Failed to resolve chunk urls from primary source:",t,r)}return Array.from(new Set(o))}async loadSourceData(e){const t=this.getCandidateUrls(e);for(const n of t){const s=await this.loadModelFile(n);if(s)return{url:n,data:s}}return{url:t[0]||"",data:!1}}async addGISCadModel({fileNames:e,options:t}){if(!e?.length)return;const n={...this.options,...t},s={clampToGround:n.clampToGround??n.mode!=="2d"};for(const o of e){if(this.gisCadModelsList.find(v=>v.modelId===o.modelId))continue;/^(https?|atom):\/\//i.test(o.outPutPath)||(o.outPutPath=`${window.location.origin}${o.outPutPath}`);const a=o.outPutPath.endsWith("/")?o.outPutPath:`${o.outPutPath}/`,l=`${a}${o.dbName}/region.zip`;let c=!1;try{(await fetch(l,{method:"HEAD",cache:"no-store"})).ok&&(c=await this.loadModelFile(l))}catch{}c&&typeof c=="object"&&(["longitude","latitude","scale","totalRotation","height","scaleToMeter"].some(C=>c[C]!==void 0)&&(o.formData={longitude:c.longitude,latitude:c.latitude,scale:c.scale,totalRotation:c.totalRotation,height:c.height,scaleToMeter:c.scale,...o.formData||{}}),c.centralMeridian!==void 0&&(o.formData={transformConfig:{centralMeridian:c.centralMeridian,latOrigin:c.latOrigin??0,scaleFactor:c.scaleFactor??1,falseEasting:c.falseEasting??5e5,falseNorthing:c.falseNorthing??0,ellipsoid:c.ellipsoid??"GRS80"},transformDirection:"projectedToLonlat",...o.formData||{}}));const h=`${a}${o.dbName}/manifest.zip`;let u=null,p=null,f=null,m=6e3;try{const v=await this.loadModelFile(h);v?.watermark&&await wl(v.watermark,this.viewer?.container),v&&typeof v=="object"&&(ju.includes(this.watermarkEnabled)&&sr(this.viewer?.container),v?.tiles&&Array.isArray(v.tiles)&&(u=v.tiles),Array.isArray(v?.overviewL0)&&(p=v.overviewL0),Array.isArray(v?.overviewL1)&&(f=v.overviewL1,m=Number(v.overviewL1Height)||6e3))}catch{}JSON.stringify(o.formData),u?.length,p?.length,f?.length;const y=await this.loadSourceData(o);if(!y.data){console.error("Failed to resolve GIS CAD primary source for model:",o);continue}const g=y.data,A=Math.max(1,Number(g.numbersOfFile||1));try{const v=this.buildTransform(g,o),b=this.normalizeFormData(o,v,s.clampToGround),C=this.buildModelRoot({...o,formData:b},[g],s),x=new this.cesium.PrimitiveCollection;x.add(C.root);const I=g.bounds||null,E={...o,type:"gis-cad",sourceUrl:y.url,sourceData:g,sourceDataList:[g],root:x,groundRoot:C.root,primaryRoot:C.primaryRoot,previewRoot:null,bounds:I,transform:C.transform,show:!0,formData:b,editingFormData:null,isEditing:!1,buildOptions:s,totalChunks:u?u.length:A,loadedChunks:1,chunkLoadingComplete:!u&&A<=1,manifestTiles:u||void 0,tileRoots:u?new Map:void 0,pendingFontTiles:u?u.filter(S=>S.isFont&&S.file!=="cad.zip").map(S=>S.file):[],_rebuildContext:{normalizedBase:a,overviewL1Height:m}};this.mapLayers[o.modelId]=C.layerItemsMap,this.viewer.scene.primitives.add(E.root),this.gisCadModelsList.push(E),this.setModelId(o.modelId),p&&(this.computeManifestTileLonLatBounds(p,E.transform),E.overviewL0Tiles=p),n.flyTo&&this.flyToBounds(E),n.onSuccess&&n.onSuccess(E),(p||f)&&(f&&(this.computeManifestTileLonLatBounds(f,E.transform),E.overviewL1Tiles=f),this.setupOverviewLOD(o,E,a,p||[],f||[],m)),u?(this.computeManifestTileLonLatBounds(u,E.transform),this.setupManifestTileLoading(o,E,a)):A>1&&this.loadRemainingChunksAsync(o,y.url,A,E)}catch(v){console.error("Failed to build GIS CAD model:",o,v)}}this.events.emit("mountAllGISCad",this.gisCadModelsList)}async loadRemainingChunksAsync(e,t,n,s){for(let o=1;o<n;o++){await new Promise(l=>setTimeout(l,0));const r=this.getChunkCandidateUrls(e,t,o);let a=!1;for(const l of r)try{const c=await this.loadModelFile(l);if(c?.watermark&&this.watermarkEnabled,c){const h=this.buildModelPrimitives({...s,formData:s.formData},c,s.buildOptions);s.groundRoot.add(h.root),s.sourceDataList.push(c),this.mapLayers[s.modelId]||(this.mapLayers[s.modelId]={}),this.mergeLayerItemsMap(this.mapLayers[s.modelId],h.layerItemsMap),s.loadedChunks=(s.loadedChunks||1)+1,this.events.emit("chunkProgress",{modelId:s.modelId,loaded:s.loadedChunks,total:n}),this.viewer.scene.requestRender(),a=!0;break}}catch(c){console.error("Failed to append GIS CAD chunk:",l,c)}a||console.warn(`Failed to load GIS CAD chunk ${o} for ${e.modelId}`)}s.chunkLoadingComplete=!0,this.events.emit("chunkLoadingComplete",s)}setupOverviewLOD(e,t,n,s,o,r=6e3){const a=this.cesium;t.overviewL0Roots=new Map,t.overviewL1Roots=new Map;const l=C=>{if(!C.lonLatBounds)return!1;let x=null;try{x=this.viewer?.camera?.computeViewRectangle?.()??null}catch{x=null}if(!x)return!0;const I=a.Rectangle.fromDegrees(C.lonLatBounds.west,C.lonLatBounds.south,C.lonLatBounds.east,C.lonLatBounds.north);return a.Rectangle.intersection(x,I)!==void 0},c=async(C,x)=>{if(x.has(C.file))return;const I=`${n}${e.dbName}/${C.file}`;try{const E=await this.loadModelFile(I);if(!E)return;const S=this.buildModelPrimitives({...t,formData:t.formData},E,t.buildOptions);t.groundRoot.add(S.root),x.set(C.file,S.root),this.viewer.scene.requestRender()}catch(E){console.warn(`Failed to load overview chunk ${C.file}:`,E)}},h=(C,x)=>{const I=x.get(C);if(I){try{t.groundRoot.remove(I),I.destroy&&I.destroy()}catch{}x.delete(C)}};let u=0;const p=3,f=[],m=()=>{for(;u<p&&f.length>0;){const{tile:C,rootMap:x}=f.shift();x.has(C.file)||(u++,c(C,x).finally(()=>{u--,m()}))}},y=(C,x)=>{x.has(C.file)||f.some(I=>I.tile.file===C.file)||f.push({tile:C,rootMap:x})},g=()=>{if(!t.overviewL0Roots||!t.overviewL1Roots)return;const C=this.getCameraHeightAboveGround(t),x=1500;for(const w of s)l(w)?y(w,t.overviewL0Roots):h(w.file,t.overviewL0Roots);for(const w of o)l(w)&&C>=x&&C<r?y(w,t.overviewL1Roots):h(w.file,t.overviewL1Roots);const I=(t.tileRoots?.size||0)>0,E=C>=x&&!I&&(C>=r||C<r&&t.overviewL1Roots.size===0);t.overviewL0Roots.forEach(w=>{w.show=E});const S=C>=x&&!I&&t.overviewL1Roots.size>0&&C<r;t.overviewL1Roots.forEach(w=>{w.show=S}),t.primaryRoot&&(t.primaryRoot.show=C>=x),m(),this.viewer.scene.requestRender()};t._overviewLODCheck=g;let A=null;const v=()=>{A&&clearTimeout(A),A=setTimeout(()=>{A=null,g()},200)},b=this.viewer?.camera?.moveEnd?.addEventListener?.(v);typeof b=="function"&&(t.overviewLODListenerRemove=()=>{A&&clearTimeout(A),b()}),g()}computeManifestTileLonLatBounds(e,t){if(!t?.toWorld){console.warn("[computeManifestTileLonLatBounds] modelTransform.toWorld 不存在,跳过");return}const n=this.cesium;t.originLongitude,t.originLatitude,t.localOriginX,t.localOriginY,t.scaleToMeter,t.scale,t.totalScaleToMeter;let s=0,o=0;const r=(a,l)=>{try{const c=t.toWorld([a,l,0]);if(!c)return null;const h=n.Cartographic.fromCartesian(c);return[n.Math.toDegrees(h.longitude),n.Math.toDegrees(h.latitude)]}catch{return null}};for(const a of e){if(!a.bounds)continue;const{minX:l,minY:c,maxX:h,maxY:u}=a.bounds,p=r(l,c),f=r(h,u);p&&f?(a.lonLatBounds={west:Math.min(p[0],f[0]),south:Math.min(p[1],f[1]),east:Math.max(p[0],f[0]),north:Math.max(p[1],f[1])},s++):o++}if(`${s}${o}${e.length}`,s>0){const a=e.find(l=>l.lonLatBounds);a?.file,a?.lonLatBounds}}setupManifestTileLoading(e,t,n){const a=this.cesium,l=t.manifestTiles||[];if(l.length===0)return;const c=I=>{if(!I.lonLatBounds)return!1;let E=null;try{E=this.viewer?.camera?.computeViewRectangle?.()??null}catch{E=null}if(!E)return!0;const S=a.Rectangle.fromDegrees(I.lonLatBounds.west,I.lonLatBounds.south,I.lonLatBounds.east,I.lonLatBounds.north);return a.Rectangle.intersection(E,S)!==void 0},h=I=>{const E=t.tileRoots?.get(I);if(E){try{t.groundRoot.remove(E),E.destroy&&E.destroy()}catch{}t.tileRoots?.delete(I),t.loadedChunks=Math.max(1,(t.loadedChunks||1)-1),this.events.emit("chunkProgress",{modelId:t.modelId,loaded:t.loadedChunks,total:t.totalChunks}),t._overviewLODCheck?.(),this.viewer.scene.requestRender()}},u=new Map,p=3;let f=0;const m=[],y=I=>{const E=u.get(I);E&&(clearTimeout(E),u.delete(I));const S=m.indexOf(I);S>=0&&m.splice(S,1)},g=()=>{for(;f<p&&m.length>0;){const I=m.shift(),E=l.find(S=>S.file===I);!E||t.tileRoots?.has(I)||!c(E)||(f++,A(I).finally(()=>{f--,g()}))}},A=async I=>{if(t.tileRoots?.has(I))return;const E=`${n}${e.dbName}/${I}`;try{const S=await this.loadModelFile(E);if(S?.watermark&&this.watermarkEnabled,!S)return;const w=this.buildModelPrimitives({...t,formData:t.formData},S,t.buildOptions);t.groundRoot.add(w.root),t.tileRoots?.set(I,w.root),t.sourceDataList.push(S),this.mapLayers[t.modelId]||(this.mapLayers[t.modelId]={}),this.mergeLayerItemsMap(this.mapLayers[t.modelId],w.layerItemsMap),t.loadedChunks=(t.loadedChunks||1)+1,this.events.emit("chunkProgress",{modelId:t.modelId,loaded:t.loadedChunks,total:t.totalChunks}),t._overviewLODCheck?.(),this.viewer.scene.requestRender()}catch(S){console.error("Failed to load CAD tile:",E,S)}},v=()=>{if(!t.tileRoots)return;const I=this.getCameraHeightAboveGround(t),E=I<1e3;for(const S of l){if(S.file==="cad.zip"||!t.tileRoots.has(S.file))continue;let w=!1;S.isFont?E&&c(S)||(w=!0):c(S)?I>=1500&&(w=!0):w=!0,w&&(y(S.file),h(S.file),S.isFont&&!t.pendingFontTiles?.includes(S.file)&&t.pendingFontTiles?.push(S.file))}for(const S of l)if(S.file!=="cad.zip"&&!t.tileRoots.has(S.file)&&!u.has(S.file)&&!m.includes(S.file)&&!(S.isFont&&!E)&&!(!S.isFont&&I>=1500)&&c(S)){const w=S.file,T=setTimeout(()=>{u.delete(w),!t.tileRoots?.has(w)&&c(S)&&!m.includes(w)&&(m.push(w),g())},20);u.set(S.file,T)}t.primaryRoot&&(t.primaryRoot.show=I>=1500)};let b=null;const C=()=>{b&&clearTimeout(b),b=setTimeout(()=>{b=null,v()},20)},x=this.viewer?.camera?.moveEnd?.addEventListener?.(C);typeof x=="function"&&(t.tileCameraListenerRemove=()=>{b&&clearTimeout(b),x()}),t._tileLODCheck=v,v()}beginEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t?(t.isEditing||(t.isEditing=!0,t.editingFormData={...t.formData},this.rebuildPreviewRoot(t)),t):null}adjustGISCadModel(e){const t=this.getRuntimeModel(e.modelId);return t?(t.formData={...t.formData,...e,modelId:t.modelId,scale:Math.max(1e-6,Number(e.scale??t.formData.scale))},e.clampToGround!==void 0&&(t.buildOptions.clampToGround=e.clampToGround),this.replaceGroundRoot(t,t.formData),this.flyToBounds(t,{duration:0,minHeight:t._rebuildContext?.overviewL1Height}),t.formData):null}commitEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t&&(t.previewRoot&&(this.removeModelNode(t.root,t.previewRoot),t.previewRoot=null),t.isEditing=!1,t.editingFormData=null,t)}cancelEditGISCad({modelId:e}){const t=this.getRuntimeModel(e);return t?(t.previewRoot&&(this.removeModelNode(t.root,t.previewRoot),t.previewRoot=null),t.groundRoot&&(t.groundRoot.show=t.show!==!1),t.isEditing=!1,t.editingFormData=null,t):null}deleteCad({modelId:e}){this.mapLayers[e]&&delete this.mapLayers[e];const t=this.gisCadModelsList.findIndex(n=>n.modelId===e);if(t>-1){const n=this.gisCadModelsList[t];n.tileCameraListenerRemove?.(),n.overviewLODListenerRemove?.(),this.viewer.scene.primitives.remove(n.root),n.root?.destroy&&!n.root.isDestroyed?.()&&n.root.destroy(),this.gisCadModelsList.splice(t,1)}}deleteAllCad(){[...this.gisCadModelsList].forEach(e=>{e.modelId&&this.deleteCad({modelId:e.modelId})})}}class ki{constructor(e,t){if(this.viewer=e,!this.viewer)return;this.type="prompt",t=t||{};const n=t.type==null?1:t.type;let s={id:new Date().getTime()+""+Math.floor(Math.random()*1e4),type:n,anchor:n==2,closeBtn:n==2,offset:n==2?{x:0,y:-20}:{x:10,y:10},content:"",show:!0,style:{background:"rgba(0,0,0,0.5)",color:"white"}};this.opt=Object.assign(s,t),this.attr=this.opt;const o=this.viewer.container.id;this.isShow=this.opt.show==null?!0:this.opt.show;let r="",a="";const l=this.opt.style.background,c=this.opt.style.color;this.opt.anchor&&(r+=`
17
- <div class="prompt-anchor-container">
18
- <div class="prompt-anchor" style="background:${l} !important;">
19
- </div>
20
- </div>
21
- `),this.opt.closeBtn&&(a=`<a class="prompt-close" attr="${this.opt.id}" id="prompt-close-${this.opt.id}">x</a>`);let h=this.opt.style.boxShadow;const u="prompt-"+this.opt.id,p=`
22
- <!-- 文本内容 -->
23
- <div class="prompt-content-container" style="background:${l} !important;color:${c} !important;box-shadow:${h} !important">
24
- <div class="prompt-content" id="prompt-content-${this.opt.id}">
25
- ${this.opt.content}
26
- </div>
27
- </div>
28
- <!-- 锚 -->
29
- ${r}
30
- <!-- 关闭按钮 -->
31
- ${a}
32
- `;this.promptDiv=window.document.createElement("div"),this.promptDiv.className=`easy3d-prompt ${this.opt.className}`,this.promptDiv.id=u,this.promptDiv.innerHTML=p,window.document.getElementById(o).appendChild(this.promptDiv);const m=window.document.getElementById(`prompt-close-${this.opt.id}`);let y=this;m&&m.addEventListener("click",g=>{y.hide(),y.opt.close&&y.opt.close()}),this.promptDom=window.document.getElementById(u),this.position=this.transPosition(this.opt.position),n==2&&this.bindRender(),this.opt.show==!1&&this.hide(),this.containerW=this.viewer.container.offsetWidth,this.containerH=this.viewer.container.offsetHeight,this.containerLeft=this.viewer.container.offsetLeft,this.containerTop=this.viewer.container.offsetTop,this.contentW=Math.ceil(Number(this.promptDom.offsetWidth)),this.contentH=this.promptDom.offsetHeight,this.opt.success&&this.opt.success()}destroy(){this.promptDiv&&(window.document.getElementById(this.viewer.container.id).removeChild(this.promptDiv),this.promptDiv=null),this.rendHandler&&(this.rendHandler(),this.rendHandler=null)}bindRender(){let e=this;this.rendHandler=this.viewer.scene.postRender.addEventListener(function(){if(!e.isShow&&e.promptDom){e.promptDom.style.display="none";return}if(e.position)if(e.position instanceof Cesium.Cartesian3){let t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(e.viewer.scene,e.position);if(!t)return;new Cesium.EllipsoidalOccluder(e.viewer.scene.globe.ellipsoid,e.viewer.scene.camera.position).isPointVisible(e.position)?e.promptDom&&(e.promptDom.style.display="block"):e.promptDom&&(e.promptDom.style.display="none"),e.setByPX({x:t.x,y:t.y})}else e.setByPX({x:e.position.x,y:e.position.y})},this)}update(e,t){e instanceof Cesium.Cartesian3&&(this.position=e.clone(),e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e)),this.contentW=Math.ceil(Number(this.promptDom.offsetWidth)),this.contentH=this.promptDom.offsetHeight,e&&this.setByPX(e),t&&this.setContent(t)}isInView(){if(!this.position)return!1;let e=null;this.position instanceof Cesium.Cartesian2?e=this.position:e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,this.position);const n=new Cesium.EllipsoidalOccluder(this.viewer.scene.globe.ellipsoid,this.viewer.scene.camera.position).isPointVisible(this.position);let s=!1;return e?(e.x>this.containerLeft&&e.x<this.containerLeft+this.containerW&&e.y>this.containerTop&&e.y<this.containerTop+this.containerH&&(s=!0),n&&s):s}setVisible(e){this.isInView(this.position)&&e?(this.isShow=!0,this.promptDom&&(this.promptDom.style.display="block")):(this.isShow=!1,this.promptDom&&(this.promptDom.style.display="none"))}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}setContent(e){let t=window.document.getElementById(`prompt-content-${this.opt.id}`);t.innerHTML=e}setByPX(e){e&&this.promptDom&&(this.promptDom.offsetWidth,this.promptDom.offsetHeight,this.opt.type==1?(this.promptDom.style.left=Number(e.x)+Number(this.opt.offset.x||0)+"px",this.promptDom.style.top=Number(e.y)+Number(this.opt.offset.y||0)+"px"):(this.promptDom.style.left=Number(e.x)+Number(this.opt.offset.x||0)-Number(this.contentW)/2+"px",this.promptDom.style.top=Number(e.y)+Number(this.opt.offset.y||0)-Number(this.contentH)+"px"))}transPosition(e){let t;return Array.isArray(e)?t=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0).clone():e instanceof Cesium.Cartesian3?t=e.clone():t=e,t}}const $f=Object.freeze(Object.defineProperty({__proto__:null,default:ki},Symbol.toStringTag,{value:"Module"}));let we={};we.cartesianToLnglat=function(i,e){if(!i)return[];var t=Cesium.Cartographic.fromCartesian(i),n=Cesium.Math.toDegrees(t.latitude),s=Cesium.Math.toDegrees(t.longitude),o=t.height;return[s,n,o]},we.getViewCenter=i=>{if(i){var e=i.camera.computeViewRectangle(),t=e.west/Math.PI*180,n=e.north/Math.PI*180,s=e.east/Math.PI*180,o=e.south/Math.PI*180;return[(s+t)/2,(n+o)/2]}},we.cartesiansToLnglats=function(i,e){if(!(!i||i.length<1)&&(e=e||window.viewer,!!e)){for(var t=[],n=0;n<i.length;n++)t.push(we.cartesianToLnglat(i[n],e));return t}},we.lnglatsToCartesians=function(i){if(!(!i||i.length<1)){for(var e=[],t=0;t<i.length;t++){var n=Cesium.Cartesian3.fromDegrees(i[t][0],i[t][1],i[t][2]||0);e.push(n)}return e}},we.flyTo=function(i,e){if(!e)return;i=i||{};let t=i.center;if(t&&(t instanceof Cesium.Cartesian3&&e.camera.flyToBoundingSphere(new Cesium.BoundingSphere(t),{offset:new Cesium.HeadingPitchRange(Cesium.Math.toRadians(i.heading||0),Cesium.Math.toRadians(i.pitch||-60),i.range||1e4)}),t instanceof Array)){var n=new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(t[0],t[1],t[2]));e.camera.flyToBoundingSphere(n,{offset:new Cesium.HeadingPitchRange(Cesium.Math.toRadians(i.heading||0),Cesium.Math.toRadians(i.pitch||-60),i.range||1e4)})}},we.getCameraView=function(i){if(i=i||window.viewer,!!i){var e=i.camera,t=e.position,n=e.heading,s=e.pitch,o=e.roll,r=Cesium.Cartographic.fromCartesian(t),a={x:Cesium.Math.toDegrees(r.longitude),y:Cesium.Math.toDegrees(r.latitude),z:r.height,heading:Cesium.Math.toDegrees(n),pitch:Cesium.Math.toDegrees(s),roll:Cesium.Math.toDegrees(o)};return a}},we.setCameraView=function(i,e){if(e=e||window.viewer,!!e&&i){var t=i.destination||Cesium.Cartesian3.fromDegrees(i.x,i.y,i.z);e.camera.flyTo({destination:t,orientation:{heading:Cesium.Math.toRadians(i.heading||0),pitch:Cesium.Math.toRadians(i.pitch||0),roll:Cesium.Math.toRadians(i.roll||0)},duration:i.duration===void 0?3:i.duration,complete:i.complete})}},we.computeAreaOfTriangle=function(i,e,t){if(!i||!e||!t)return 0;var n=Cesium.Cartesian3.distance(i,e),s=Cesium.Cartesian3.distance(e,t),o=Cesium.Cartesian3.distance(t,i),r=(n+s+o)/2;return Math.sqrt(r*(r-n)*(r-s)*(r-o))};class Jt{constructor(e,t){this.viewer=e,this.style=t||{},this.objId=+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0)),this.handler=void 0,this.modifyHandler=void 0,this.type="",this.positions=[],this.state=null,this.prompt=null,this.controlPoints=[],this.modifyPoint=null,this.entity=null,this.pointStyle={},this.promptStyle=this.style.prompt||{show:!0},this.properties={},this.clientScale=1}getCatesian3FromPX(e){if(e=this.transpx(e),this.viewer.scene.mode===Cesium.SceneMode.SCENE2D){let o=this.viewer.camera.getPickRay(e),r=null;return o&&(r=this.viewer.scene.globe.pick(o,this.viewer.scene)),r||(r=this.viewer.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),r}let t=this.viewer.scene.drillPick(e);this.viewer.scene.render();let n,s=!1;for(let o=0;o<t.length;o++)if(t[o]&&t[o].primitive&&t[o].primitive instanceof Cesium.Cesium3DTileset){s=!0;break}if(s)n=this.viewer.scene.pickPosition(e);else{let o=this.viewer.camera.getPickRay(e);if(!o)return null;n=this.viewer.scene.globe.pick(o,this.viewer.scene)}return n}setClientScale(e){e=e||1,this.clientScale=e}transpx(e){return{x:e.x/(this.clientScale||1),y:e.y/(this.clientScale||1)}}getEntity(){return this.entity}getPositions(e){return e?we.cartesiansToLnglats(this.positions,this.viewer):this.positions}getLnglats(){return we.cartesiansToLnglats(this.positions,this.viewer)}setOwnProp(e){this.entity&&(this.entity.ownProp=e)}remove(){this.entity&&(this.state="no",this.viewer.entities.remove(this.entity),this.entity=null)}setVisible(e){this.entity&&(this.entity.show=e)}forbidDrawWorld(e){this.viewer.scene.screenSpaceCameraController.enableRotate=!e,this.viewer.scene.screenSpaceCameraController.enableTilt=!e,this.viewer.scene.screenSpaceCameraController.enableTranslate=!e,this.viewer.scene.screenSpaceCameraController.enableInputs=!e}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.positions=[],this.style=null;for(var e=0;e<this.controlPoints.length;e++){var t=this.controlPoints[e];this.viewer.entities.remove(t)}this.controlPoints=[],this.modifyPoint=null,this.prompt&&(this.prompt.destroy(),this.prompt=null),this.state="no",this.forbidDrawWorld(!1)}startEdit(e){if(this.state=="startEdit"||this.state=="editing"||!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this;for(let n=0;n<t.controlPoints.length;n++){let s=t.controlPoints[n];s&&(s.show=!0)}this.entity.show=!0,this.modifyHandler.setInputAction(function(n){if(!t.entity)return;let s=t.viewer.scene.pick(n.position);Cesium.defined(s)&&s.id&&(s.id.objId||(t.modifyPoint=s.id),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(n){if(t.positions.length<1||!t.modifyPoint)return;let s=t.getCatesian3FromPX(n.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.position.setValue(s),t.positions[t.modifyPoint.wz]=s,t.state="editing",e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(n){t.modifyPoint&&(t.modifyPoint=null,t.forbidDrawWorld(!1),t.state="editing")},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){for(let t=0;t<this.controlPoints.length;t++){let n=this.controlPoints[t];n&&(n.show=!1)}this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}endCreate(){}done(){}createPoint(e){if(!e)return;this.pointStyle.color=this.pointStyle.color||Cesium.Color.CORNFLOWERBLUE,this.pointStyle.outlineColor=this.pointStyle.color||Cesium.Color.CORNFLOWERBLUE;let t=this.pointStyle.color instanceof Cesium.Color?this.pointStyle.color:Cesium.Color.fromCssColorString(this.pointStyle.color);t=t.withAlpha(this.pointStyle.colorAlpha||1);let n=this.pointStyle.outlineColor instanceof Cesium.Color?this.pointStyle.outlineColor:Cesium.Color.fromCssColorString(this.pointStyle.outlineColor);return n=n.withAlpha(this.pointStyle.outlineColorAlpha||1),this.viewer.entities.add({position:e,point:{pixelSize:this.pointStyle.property||10,color:t,outlineWidth:this.pointStyle.outlineWidth||0,outlineColor:n,disableDepthTestDistance:Number.POSITIVE_INFINITY},show:!1})}transfromLineMaterial(e){if(!e)return;let t={};if(e instanceof Cesium.Color){let n=e.color.getValue();t.colorAlpha=n.alpha,t.colorHex=new Cesium.Color(n.red,n.green,n.blue,1).toCssHexString()}return t}transfromGonMaterial(e){if(!e)return;let t={};if(e instanceof Cesium.Color){let n=e.color.getValue();t.colorAlpha=n.alpha,t.colorHex=new Cesium.Color(n.red,n.green,n.blue,1).toCssHexString()}return t}setAttr(e){this.properties.attr=e||{}}getAttr(){return this.properties.attr}zoomTo(){this.entity&&this.viewer.zoomTo(this.entity)}}const _S="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAptJREFUOE+FVD1oU1EYvecVCU5acHFqsggKSlUcdDGZuvhToeAgYuIuaUcHMZ0c2+JuAg4dKrS6iFPiooMUAyqCS5PFTVpBKJKa4/nez817yateeOTm3vOd75zv3u/C5QySx50b3HMO89oupyBdzTvOHawBR3t5sRhfJH+tiqiu9X4UDJH80Tc169ywGCeZcY7CDZaB6b00hyckd6WKbW2WFLQoYCtPga0JW40I3Y6wt4T1alOE382OBuaBk7l20gnIHQkoyEFA5/YrQClUGhKS/YZ+FmVpVhuejNzXemhfwU4BWAUKywlxRBoYfguYkWohosXBruY14JS3Sf6Ik1CJpqRkaAe0ovSyeGJrRPrNiJr6ziu+K8LPCqBqdraYtdRPMms/GmRPxNiTGiP3g/ykcrELnKuKcNtAPeBCKHkU/EUKgw5wWvsJ4VcLFPbMGOG2HdBN4GJJhO9UVMju5VaacHxOfjClsux0AJd8kkj5+7LdEOAKRNgWoYEqGVBWbVvqoTpRiSsTicUhQidC0ZBvjFAXdE4WJwe5qUM7ovtmmGtmbWKQr0UYiHDOCF9JmdXwulTkgddj8O2JrkrQ5EuJQRW4URThhv2pAwvT+YTNotaLQO0fJXlhTaFTXrBTXlfA0CypPndy6vPU6nMVeOAvdDox+Tx0IA4V8G4n7pRnVht7XbRYi1swCiOfyIF7DDzMeUia1v8ftd8H7lvipPVs47dZOqb+1I2v+ReEbMSWGxnLZBgTPyYFK8molyMlK9aXpk6krgHU1/JqGmPN5qaipJplYMm7ytiISA9kn7LvevpVzwZSRmWnlAb6WNWeqX6r66SXacm78ZbHlahuChhaj1uL6TH146dmSsIW8ChTggRx6N06zO7/1v8CLeIaJJK0e+4AAAAASUVORK5CYII=";class kS extends Jt{constructor(e,t){super(e,t),this.type="billboard",this.viewer=e;let n={verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:1};this.style=Object.assign({},n,t||{}),this.entity=null,this.style.hasOwnProperty("image")||console.warn("CreateBillboard: 未在 style 中指定 image,后续将使用回退图或占位图。"),this.position=null,this._defaultFallback=_S,this.prompt=null,this.modifyHandler=null,this._globalMouseUpHandler=null,this._isDragging=!1,this._editPickedEntity=null,this.controlPoints=[],this.modifyPoint=null,this._isScaling=!1,this._fileInput=null}_preloadImage(e,t=7e3){return new Promise((n,s)=>{if(!e)return s(new Error("empty url"));try{const o=new window.Image;o.crossOrigin="anonymous";let r=!1;const a=()=>{r||(r=!0,clearTimeout(c),n(o))},l=h=>{r||(r=!0,clearTimeout(c),s(new Error("image load error: "+e)))};o.onload=a,o.onerror=l;const c=setTimeout(()=>{r||(r=!0,o.onload=o.onerror=null,s(new Error("image load timeout: "+e)))},t);o.src=e}catch(o){s(o)}})}createBillboard(e){if(!e)return;const t=this.style.fallbackImage||this._defaultFallback,n=this.viewer.entities.add({position:e,billboard:{image:t,scale:this.style.scale||1,pixelOffset:this.style.pixelOffset,heightReference:this.style.heightReference==null?Cesium.HeightReference.CLAMP_TO_GROUND:Number(this.style.heightReference),verticalOrigin:Cesium.VerticalOrigin.BOTTOM,color:this.style.color?this.style.color instanceof Cesium.Color?this.style.color.withAlpha(this.style.colorAlpha||1):Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1):Cesium.Color.WHITE}});n.objId=this.objId;const s=this.style.image;if(s)this._preloadImage(s,7e3).then(o=>{try{n.billboard.image=o,this.style.image=s}catch(r){console.warn("CreateBillboard: set billboard image element failed, fallback to url string",r);try{n.billboard.image=s}catch{}}try{this.viewer.scene.requestRender()}catch{}}).catch(o=>{console.error("CreateBillboard: image load failed:",o.message," URL:",s," 使用回退图:",t);try{this.viewer.scene.requestRender()}catch{}});else try{this.viewer.scene.requestRender()}catch{}return this.position=e.clone(),this.entity=n,n}updateBillboardImage(e){if(!this.entity||!this.entity.billboard)return;const t=this.style.fallbackImage||this._defaultFallback;if(!e){try{this.entity.billboard.image=t}catch{}this.style.image=t;try{this.viewer.scene.requestRender()}catch{}return}try{this.entity.billboard.image=t}catch{}this._preloadImage(e,7e3).then(n=>{try{this.entity.billboard.image=n}catch(s){console.warn("CreateBillboard: set billboard image element failed, fallback to url string",s);try{this.entity.billboard.image=e}catch{}}this.style.image=e;try{this.viewer.scene.requestRender()}catch{}}).catch(n=>{console.error("CreateBillboard: updateBillboardImage failed to load:",n.message," URL:",e);try{this.entity.billboard.image=t}catch{}this.style.image=t;try{this.viewer.scene.requestRender()}catch{}})}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new ki(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(n){let s=t.getCatesian3FromPX(n.position,t.viewer);if(s){if(t.position=s.clone(),t.entity=t.createBillboard(t.position),t.handler){try{t.handler.destroy()}catch{}t.handler=null}if(t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}t.state="endCreate",e&&e(t.entity)}},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(n){t.prompt&&t.prompt.update&&t.prompt.update(n.endPosition,"单击新增"),t.state="creating"},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){let e=this;if(e.handler){try{e.handler.destroy()}catch{}e.handler=null}if(e.prompt){try{e.prompt.destroy()}catch{}e.prompt=null}e.state="endCreate"}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let n=null;e instanceof Cesium.Cartesian3?n=e.clone():n=Cesium.Cartesian3.fromDegrees(Number(e[0]),Number(e[1]),Number(e[2]||0)),n&&(this.position=n.clone(),this.entity=this.createBillboard(this.position),t&&t(this.entity),this.state="endCreate")}setStyle(e){if(!e)return;let t=this.entity&&this.entity.billboard;if(t){if(e.image!=null&&this.updateBillboardImage(e.image),e.heightReference!=null){let n=1;e.heightReference==!0?n=1:n=Number(e.heightReference);try{t.heightReference=n}catch{}}if(e.scale!=null)try{t.scale=Number(e.scale)}catch{}if(e.color){let n=e.color instanceof Cesium.Color?e.color:Cesium.Color.fromCssColorString(e.color);n=n.withAlpha(e.colorAlpha||1);try{t.color=n}catch{}}}this.style=Object.assign(this.style,e)}getStyle(){let e={},t=this.entity&&this.entity.billboard;if(e.image=this.style.image,t&&t.heightReference)try{let n=t.heightReference.getValue();e.heightReference=Number(n)}catch{}if(t&&t.scale)try{e.scale=t.scale.getValue()}catch{}if(t&&t.color)try{let n=t.color.getValue();e.colorAlpha=n.alpha,e.color=new Cesium.Color(n.red,n.green,n.blue,1).toCssHexString()}catch{}return e}startEdit(e){if(this._cleanupEditState(),!this.entity)return;this.state="startEdit",this.controlPoints=[],this.showControlPoints(),this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);let t=this,n=null,s=!1;const o=()=>{if(s){if(s=!1,t.entity&&Cesium.defined(t.entity.position))try{t.position=t.entity.position.getValue(Cesium.JulianDate.now()).clone()}catch(r){console.warn("更新位置引用失败:",r)}n=null,t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}t.state="editing"}};window.addEventListener("mouseup",o,!0),this._globalMouseUpHandler=o,this.modifyHandler.setInputAction(function(r){const a=t.viewer.scene.pick(r.position);if(Cesium.defined(a)&&a.id){if(a.id===t.entity){n=a.id,s=!0,t._isDragging=!0,t._editPickedEntity=n,t.modifyPoint=null;try{t.forbidDrawWorld(!0)}catch{}}else if(t.controlPoints.includes(a.id)){t.modifyPoint=a.id,s=!0,t._isDragging=!0,n=t.entity;try{t.forbidDrawWorld(!0)}catch{}}}},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(r){if(!s)return;let a=t.getCatesian3FromPX(r.endPosition,t.viewer);if(a){if(Cesium.defined(n)){try{n.position.setValue(a)}catch{n.position=a}t.position=a.clone(),t.controlPoints&&t.controlPoints.length>0&&t.controlPoints.forEach(l=>{try{l.position.setValue(a)}catch(c){console.warn("更新控制点位置失败:",c);try{l.position=a.clone()}catch(h){console.error("重新设置控制点位置失败:",h)}}})}t.state="editing",e&&e()}},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){if(s){if(s=!1,t.entity&&Cesium.defined(t.entity.position))try{t.position=t.entity.position.getValue(Cesium.JulianDate.now()).clone()}catch(r){console.warn("更新位置引用失败:",r)}t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}t.state="editing"}},Cesium.ScreenSpaceEventType.LEFT_UP),this.modifyHandler.setInputAction(function(){if(t._isScaling){t._isScaling=!1,t._isDragging=!1,t._scalingControlPoint=null,delete t._initialScale,delete t._initialMousePosition,t.viewer.canvas.style.cursor="",t._hideScaleHint();try{t.forbidDrawWorld(!1)}catch{}}if(s){s=!1,t._isDragging=!1,t._editPickedEntity=null,t.modifyPoint=null;try{t.forbidDrawWorld(!1)}catch{}}if(t.hideControlPoints(),t.modifyHandler){try{t.modifyHandler.destroy()}catch{}t.modifyHandler=null}t._globalMouseUpHandler&&(window.removeEventListener("mouseup",t._globalMouseUpHandler,!0),t._globalMouseUpHandler=null),t.state="endEdit"},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.modifyHandler.setInputAction(function(r){const a=t.viewer.scene.pick(r.position);Cesium.defined(a)&&a.id===t.entity&&t._handleDoubleClick()},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}createControlPoint(e){return e?this.viewer.entities.add({position:e,point:{pixelSize:8,color:Cesium.Color.WHITE,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}}):null}createYellowControlPoint(e){if(!e)return null;const t=this.viewer.entities.add({position:e,point:{pixelSize:10,color:Cesium.Color.YELLOW,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}});return t.isYellowControl=!0,t}createScaleControlPoint(e,t){if(!e)return null;let n=Cesium.Color.GREEN;t==="bottomLeft"&&(n=Cesium.Color.BLUE);const s=this.viewer.entities.add({position:e,point:{pixelSize:10,color:n,outlineColor:Cesium.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.MAX_VALUE}});return s.isScaleControl=!0,s.corner=t,s}_calculateSpecialPosition(e){return this._calculateCornerPosition(e,"bottomRight")}_calculateCornerPosition(e,t){if(!e)return null;const s=50*(this.style.scale||1),o=this.viewer.camera,r=new Cesium.Cartesian3,a=new Cesium.Cartesian3,l=new Cesium.Cartesian3;Cesium.Cartesian3.clone(o.direction,r),Cesium.Cartesian3.clone(o.right,a),Cesium.Cartesian3.clone(o.up,l),Cesium.Cartesian3.normalize(r,r),Cesium.Cartesian3.normalize(a,a),Cesium.Cartesian3.normalize(l,l);const c=new Cesium.Cartesian3;Cesium.Cartesian3.multiplyByScalar(a,s,c),Cesium.Cartesian3.multiplyByScalar(l,s,l),Cesium.Cartesian3.add(c,l,c);const h=new Cesium.Ray(e,r),u=this.viewer.scene.globe.pick(h,this.viewer.scene),f=Cesium.Cartesian3.distance(e,u||e)*.001;return Cesium.Cartesian3.multiplyByScalar(c,f,c),Cesium.Cartesian3.add(e,c,new Cesium.Cartesian3)}showControlPoints(){if(this.controlPoints=this.controlPoints||[],this._isDragging){this.position&&this.controlPoints.length>0&&this.controlPoints.forEach(e=>{try{e.position.setValue(this.position)}catch{try{e.position=this.position.clone()}catch(n){console.warn("更新拖拽中控制点位置失败:",n)}}});return}if(this.controlPoints.length>0&&([...this.controlPoints].forEach(t=>{try{this.viewer&&this.viewer.entities&&t&&this.viewer.entities.remove(t)}catch(n){console.warn("移除控制点失败:",n)}}),this.controlPoints.length=0),this.position&&this.viewer&&!this._isDragging){const e=this.createControlPoint(this.position);e&&(e.wz=0,this.controlPoints.push(e))}}hideControlPoints(){this.controlPoints&&Array.isArray(this.controlPoints)&&this.controlPoints.length>0?([...this.controlPoints].forEach(t=>{try{this.viewer&&this.viewer.entities&&t&&this.viewer.entities.remove(t)}catch(n){console.warn("移除控制点失败:",n)}}),this.controlPoints.length=0):(!this.controlPoints||!Array.isArray(this.controlPoints))&&(this.controlPoints=[]),this.topRightControlPoint=null,this.bottomLeftControlPoint=null,this.scaleControlPoint=null,this.modifyPoint=null}endEdit(e){if(this.hideControlPoints(),this.modifyHandler){try{this.modifyHandler.destroy()}catch{}this.modifyHandler=null}if(this._globalMouseUpHandler){try{window.removeEventListener("mouseup",this._globalMouseUpHandler,!0)}catch{}this._globalMouseUpHandler=null}try{this.forbidDrawWorld(!1)}catch{}this.viewer&&this.viewer.canvas&&(this.viewer.canvas.style.cursor=""),this._isDragging=!1,this._editPickedEntity=null,this.modifyPoint=null,this.state="endEdit",e&&e(this.entity)}_cleanupEditState(){if(this._globalMouseUpHandler){try{window.removeEventListener("mouseup",this._globalMouseUpHandler,!0)}catch{}this._globalMouseUpHandler=null}if(this.modifyHandler){try{this.modifyHandler.destroy()}catch{}this.modifyHandler=null}this.controlPoints=this.controlPoints||[],this.hideControlPoints(),this._isDragging=!1,this._editPickedEntity=null,this.modifyPoint=null;try{this.forbidDrawWorld(!1)}catch{}}_showScaleHint(e){this._scaleHintElement||(this._scaleHintElement=document.createElement("div"),this._scaleHintElement.style.position="absolute",this._scaleHintElement.style.background="rgba(0, 0, 0, 0.7)",this._scaleHintElement.style.color="white",this._scaleHintElement.style.padding="4px 8px",this._scaleHintElement.style.borderRadius="4px",this._scaleHintElement.style.fontSize="12px",this._scaleHintElement.style.pointerEvents="none",this._scaleHintElement.style.zIndex="10000",document.body.appendChild(this._scaleHintElement)),this._scaleHintElement.textContent=`缩放: ${e.toFixed(2)}x`,this._scaleHintElement.style.left=`${window.event.clientX+10}px`,this._scaleHintElement.style.top=`${window.event.clientY-30}px`,this._scaleHintElement.style.display="block"}_hideScaleHint(){this._scaleHintElement&&(this._scaleHintElement.style.display="none")}move(e){if(!this.entity)return;let t=null;e instanceof Cesium.Cartesian3?t=e:t=Cesium.Cartesian3.fromDegrees(Number(e[0]),Number(e[1]),Number(e[2]||0));try{this.entity.position.setValue(t.clone())}catch{this.entity.position=t.clone()}this.position=t.clone(),this.state="editing"}_createFileInput(){if(this._fileInput)return this._fileInput;const e=document.createElement("input");return e.type="file",e.accept="image/*",e.style.display="none",e.onchange=t=>{this._handleFileUpload(t)},document.body.appendChild(e),this._fileInput=e,e}_handleFileUpload(e){const t=e.target.files[0];if(!t)return;if(!t.type.match("image.*")){console.warn("请选择有效的图片文件");return}const n=new FileReader;n.onload=s=>{this.updateBillboardImage(s.target.result),this._fileInput&&(this._fileInput.value="")},n.onerror=s=>{console.error("文件读取失败:",s)},n.readAsDataURL(t)}_handleDoubleClick(){this._createFileInput().click()}editImage(e){return e?(this.updateBillboardImage(e),!0):(console.warn("CreateBillboard.editImage: 未提供有效的图片URL"),!1)}remove(){try{this.endEdit()}catch{}if(this.entity){this.state="no";try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}}getPositions(e){return e?we.cartesianToLnglat(this.position,this.viewer):this.position}getLnglats(){return this.getPositions(!0)}setPosition(e){let t=null;e instanceof Cesium.Cartesian3?t=e:t=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0);try{this.entity.position.setValue(t.clone())}catch{this.entity.position=t.clone()}this.position=t.clone()}destroy(){try{this.endEdit()}catch{}if(this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}this.position=null,this.state="no",this._isDragging=!1,this._editPickedEntity=null}}class PS extends Jt{constructor(e,t){super(e,t),this.type="circle",this.viewer=e,this.style=t||{},this.center=null,this.radiusPoint=null,this.radiusPointEntity=null,this.entity=null,this.handler=null,this.modifyHandler=null,this.modifyPoint=null,this._dragStartCart=null,this._dragStartCartCarto=null,this.pointsCount=64}start(e){!this.prompt&&this.promptStyle?.show&&(this.prompt=new ki(this.viewer,this.promptStyle)),this.state="startCreate",this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.handler.setInputAction(function(n){const s=t.getCatesian3FromPX(n.position,t.viewer,[]);s&&(t.entity?(t.endCreate(),e&&e(t.entity)):(t.center=s.clone(),t.radiusPoint=s.clone(),t.entity=t._createPolyline(),t.radiusPointEntity=t.createPoint(t.radiusPoint),t.radiusPointEntity.typeAttr="radius",t.radiusPointEntity.show=!1))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(n){if(!t.entity){t.prompt?.update(n.endPosition,"单击开始绘制");return}t.prompt?.update(n.endPosition,"单击结束");const s=t.getCatesian3FromPX(n.endPosition,t.viewer,[]);s&&(t.radiusPoint=s.clone(),t._updatePolyline(),t._updateAuxPoints(),t.state="creating")},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){this.handler?.destroy(),this.handler=null,this.radiusPointEntity&&(this.radiusPointEntity.show=!1),this.prompt?.destroy(),this.prompt=null,this.state="endCreate"}startEdit(e){if(!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.radiusPointEntity&&(this.radiusPointEntity.show=!0),this.modifyHandler.setInputAction(function(n){const s=t.viewer.scene.pick(n.position);if(!s?.id)return;t.modifyPoint=s.id;const o=t.getCatesian3FromPX(n.position,t.viewer,[t.entity,t.modifyPoint]);o&&(t._dragStartCart=o,t._dragStartCartCarto=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(n){if(!t.modifyPoint)return;const s=t.getCatesian3FromPX(n.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.typeAttr==="radius"&&(t.radiusPoint=s.clone()),t._updatePolyline(),t._updateAuxPoints(),e&&e(),t.state="editing")},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){t.modifyPoint=null,t._dragStartCart=null,t._dragStartCartCarto=null,t.forbidDrawWorld(!1),t._updatePolyline(),e&&e(t.entity),t.state="editing"},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.radiusPointEntity&&(this.radiusPointEntity.show=!1),this.modifyHandler?.destroy(),this.modifyHandler=null,this.forbidDrawWorld(!1),this.state="endEdit",e&&e(this.entity)}_createPolyline(){const e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(()=>e._buildCirclePositions(),!1),width:this.style.outlineWidth||this.style.width||5,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color||"#00FF00"),clampToGround:!1}});return t._plotInstance=this,t.objId=this.objId,t}_updatePolyline(){if(!this.entity)return;const e=this._buildCirclePositions();try{const t=this.entity.polyline.positions;if(t&&typeof t.getValue=="function")return;if(t&&typeof t.setValue=="function"){t.setValue(e);return}this.entity.polyline.positions=e}catch{this.entity.polyline.positions=e}}_buildCirclePositions(){if(!this.center||!this.radiusPoint)return[];const e=[],t=Cesium.Ellipsoid.WGS84,n=t.cartesianToCartographic(this.center),s=t.cartesianToCartographic(this.radiusPoint),o=Math.abs(s.longitude-n.longitude),r=Math.abs(s.latitude-n.latitude);for(let a=0;a<=this.pointsCount;a++){const l=a/this.pointsCount*Math.PI*2,c=n.longitude+o*Math.cos(l),h=n.latitude+r*Math.sin(l);e.push(Cesium.Cartesian3.fromRadians(c,h))}return e}_updateAuxPoints(){!this.radiusPoint||!this.radiusPointEntity||(this.radiusPointEntity.position=this.radiusPoint)}syncFromEntity(){if(!this.entity||!this.center||!this.radiusPoint)return;const e=this.center,t=this.entity._centerCoord;if(!t)return;const n=t.x-e.x,s=t.y-e.y,o=t.z-e.z;this.center=new Cesium.Cartesian3(this.center.x+n,this.center.y+s,this.center.z+o),this.radiusPoint=new Cesium.Cartesian3(this.radiusPoint.x+n,this.radiusPoint.y+s,this.radiusPoint.z+o);const r=this.entity.objId,a=this.entity._plotInstance;this.radiusPointEntity&&this.viewer.entities.remove(this.radiusPointEntity),this.radiusPointEntity=null,this.viewer.entities.remove(this.entity),this.entity=this._createPolyline(),this.entity._plotInstance=a,this.entity.objId=r,this.radiusPointEntity=this.createPoint(this.radiusPoint),this.radiusPointEntity.typeAttr="radius",this.radiusPointEntity.show=this.state==="editing"}updatePositions(e){if(!e||e.length<1)return!1;try{if(!this.center||!this.radiusPoint)return!1;let t;if(e[0]instanceof Cesium.Cartesian3)t=e[0];else return!1;this.center=Cesium.Cartesian3.add(this.center,t,new Cesium.Cartesian3),this.radiusPoint=Cesium.Cartesian3.add(this.radiusPoint,t,new Cesium.Cartesian3),this._updatePolyline(),this._updateAuxPoints();try{this.viewer.scene.requestRender()}catch{}return!0}catch(t){return console.warn("Failed to update circle positions:",t),!1}}getPositions(e){return e?we.cartesiansToLnglats([this.center,this.radiusPoint],this.viewer):[this.center,this.radiusPoint]}getStyle(){const e=this.entity.polyline,t=e.material.color.getValue();return{color:new Cesium.Color(t.red,t.green,t.blue,1).toCssHexString(),colorAlpha:t.alpha,outlineWidth:e.width.getValue()}}setStyle(e){if(!this.entity)return;const t={...this.style,...e};let n=t.color instanceof Cesium.Color?t.color:Cesium.Color.fromCssColorString(t.color||"#00FF00");t.colorAlpha!=null&&(n=n.withAlpha(t.colorAlpha)),this.entity.polyline.material=n,this.entity.polyline.width=t.outlineWidth||t.width||5,this.style=t}destroy(){try{this.handler?.destroy(),this.modifyHandler?.destroy(),this.entity&&this.viewer.entities.remove(this.entity),this.entity=null,this.radiusPointEntity&&this.viewer.entities.remove(this.radiusPointEntity),this.radiusPointEntity=null,this.prompt?.destroy(),this.prompt=null}catch{}}_manageRadiusPointEntity(){this.radiusPointEntity?this.radiusPoint&&(this.radiusPointEntity.position=this.radiusPoint):(this.radiusPointEntity=this.createPoint(this.radiusPoint),this.radiusPointEntity&&(this.radiusPointEntity.typeAttr="radius",this.radiusPointEntity.show=!1))}createByPositions(e,t){try{if(!e||e.length===0)return console.error("createByPositions: positions array is empty or undefined"),t&&t(null),this;const n=e[0]instanceof Cesium.Cartesian3?e:we.lnglatsToCartesians(e);if(!n||n.length===0)return console.error("createByPositions: failed to convert positions to Cartesian3"),t&&t(null),this;if(n.length>=2)this.center=Cesium.Cartesian3.clone(n[0]),this.radiusPoint=Cesium.Cartesian3.clone(n[1]);else if(n.length===1)this.center=Cesium.Cartesian3.clone(n[0]),this._createDefaultRadiusPoint();else return console.error("createByPositions: invalid positions array"),t&&t(null),this;this.entity?this._updatePolyline():this.entity=this._createPolyline(),this._manageRadiusPointEntity(),this._updateAuxPoints(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch(s){console.error("requestRender error:",s)}return t&&t(this.entity),this}catch(n){return console.error("createByPositions error:",n),t&&t(null),this}}}class DS extends Jt{constructor(e,t){if(super(e,t),this.type="gltfModel",t=t||{},this.viewer=e,!t.uri){console.warn("请输入模型地址!");return}let n={heading:0,pitch:0,roll:0,minimumPixelSize:24,maximumScale:120};this.style=Object.assign(n,t||{}),this.modelUri=t.uri,this.entity=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new ki(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(n){let s=t.getCatesian3FromPX(n.position,t.viewer);s&&(t.entity.position=s,t.position=s.clone()),t.endCreate(),e&&e(t.entity)},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(n){t.prompt.update(n.endPosition,"单击新增"),t.state="creating";let s=t.getCatesian3FromPX(n.endPosition,t.viewer,[t.entity]);s&&(t.entity?t.entity.position=s:t.entity=t.createGltfModel(s.clone()))},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}createByPositions(e,t){e&&(this.state="startCreate",e instanceof Cesium.Cartesian3?this.position=e:this.position=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0),this.entity=this.createGltfModel(this.position),t(this.entity),this.state="endCreate")}startEdit(e){if(this.state=="startEdit"||this.state=="editing")return;this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this,n;this.state="startEdit",this.modifyHandler.setInputAction(function(s){let o=t.viewer.scene.pick(s.position);Cesium.defined(o)&&o.id&&(n=o.id,t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(s){if(!n)return;let o=t.getCatesian3FromPX(s.endPosition,t.viewer,[t.entity]);o&&(t.entity&&(t.entity.position.setValue(o),t.position=o.clone()),t.state="editing",e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(s){n&&(t.forbidDrawWorld(!1),t.modifyHandler&&(t.modifyHandler.destroy(),t.modifyHandler=null),t.state="editing")},Cesium.ScreenSpaceEventType.LEFT_UP)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.prompt&&(e.prompt.destroy(),e.prompt=null)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}endEdit(e){this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}createGltfModel(e){if(!e)return;let t=Cesium.Math.toRadians(this.style.heading),n=Cesium.Math.toRadians(this.style.pitch),s=Cesium.Math.toRadians(this.style.roll),o=new Cesium.HeadingPitchRoll(t,n,s),r=Cesium.Transforms.headingPitchRollQuaternion(e,o),a=this.viewer.entities.add({position:e,orientation:r,model:{uri:this.modelUri,minimumPixelSize:this.style.minimumPixelSize,maximumScale:this.style.maximumScale,scale:this.style.scale||1,heightReference:this.style.heightReference}});return a.objId=this.objId,a}getPositions(e){return e?we.cartesianToLnglat(this.position,this.viewer):this.position}getStyle(){let e={},t=this.entity.model;e.minimumPixelSize=t.minimumPixelSize.getValue();let n=this.entity.orientation.getValue(),s=this.entity.position.getValue(this.viewer.clock.currentTime),o=we.oreatationToHpr(s.clone(),n,!0)||{};e.heading=(o.heading||0)<360?o.heading+360:o.heading,e.pitch=o.pitch||0,e.roll=o.roll||0,e.scale=t.scale.getValue(),e.uri=t.uri.getValue();let r=this.entity.heightReference&&this.entity.heightReference.getValue();return r!=null&&(e.heightReference=Number(r)),e}setStyle(e){e&&(this.setOrientation(e.heading,e.pitch,e.roll),this.entity.model.scale.setValue(e.scale==null?1:e.scale),e.uri&&this.entity.model.uri.setValue(e.uri),e.heightReference!=null&&this.entity.model.heightReference.setValue(Number(e.heightReference)),this.style=Object.assign(this.style,e))}setOrientation(e,t,n){e=e||0,t=t||0,n=n||0,this.style.heading=e,this.style.pitch=t,this.style.roll=n;var s=Cesium.Math.toRadians(e||0),o=Cesium.Math.toRadians(t||0),r=Cesium.Math.toRadians(n||0),a=new Cesium.HeadingPitchRoll(s,o,r),l=this.entity.position._value,c=Cesium.Transforms.headingPitchRollQuaternion(l,a);this.entity&&(this.entity.orientation=c)}remove(){this.entity&&(this.state="no",this.viewer.entities.remove(this.entity),this.entity=null)}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.style=null,this.prompt&&(this.prompt.destroy(),this.prompt=null)}}String.prototype.codePointAt||(function(){var i=(function(){try{var t={},n=Object.defineProperty,s=n(t,t,t)&&n}catch{}return s})(),e=function(t){if(this==null)throw TypeError();var n=String(this),s=n.length,o=t?Number(t):0;if(o!=o&&(o=0),!(o<0||o>=s)){var r=n.charCodeAt(o),a;return r>=55296&&r<=56319&&s>o+1&&(a=n.charCodeAt(o+1),a>=56320&&a<=57343)?(r-55296)*1024+a-56320+65536:r}};i?i(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e})();function nn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var $l,jf;function NS(){if(jf)return $l;jf=1;var i=0,e=-3;function t(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function n(S,w){this.source=S,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=w,this.destLen=0,this.ltree=new t,this.dtree=new t}var s=new t,o=new t,r=new Uint8Array(30),a=new Uint16Array(30),l=new Uint8Array(30),c=new Uint16Array(30),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=new t,p=new Uint8Array(320);function f(S,w,T,_){var F,U;for(F=0;F<T;++F)S[F]=0;for(F=0;F<30-T;++F)S[F+T]=F/T|0;for(U=_,F=0;F<30;++F)w[F]=U,U+=1<<S[F]}function m(S,w){var T;for(T=0;T<7;++T)S.table[T]=0;for(S.table[7]=24,S.table[8]=152,S.table[9]=112,T=0;T<24;++T)S.trans[T]=256+T;for(T=0;T<144;++T)S.trans[24+T]=T;for(T=0;T<8;++T)S.trans[168+T]=280+T;for(T=0;T<112;++T)S.trans[176+T]=144+T;for(T=0;T<5;++T)w.table[T]=0;for(w.table[5]=32,T=0;T<32;++T)w.trans[T]=T}var y=new Uint16Array(16);function g(S,w,T,_){var F,U;for(F=0;F<16;++F)S.table[F]=0;for(F=0;F<_;++F)S.table[w[T+F]]++;for(S.table[0]=0,U=0,F=0;F<16;++F)y[F]=U,U+=S.table[F];for(F=0;F<_;++F)w[T+F]&&(S.trans[y[w[T+F]]++]=F)}function A(S){S.bitcount--||(S.tag=S.source[S.sourceIndex++],S.bitcount=7);var w=S.tag&1;return S.tag>>>=1,w}function v(S,w,T){if(!w)return T;for(;S.bitcount<24;)S.tag|=S.source[S.sourceIndex++]<<S.bitcount,S.bitcount+=8;var _=S.tag&65535>>>16-w;return S.tag>>>=w,S.bitcount-=w,_+T}function b(S,w){for(;S.bitcount<24;)S.tag|=S.source[S.sourceIndex++]<<S.bitcount,S.bitcount+=8;var T=0,_=0,F=0,U=S.tag;do _=2*_+(U&1),U>>>=1,++F,T+=w.table[F],_-=w.table[F];while(_>=0);return S.tag=U,S.bitcount-=F,w.trans[T+_]}function C(S,w,T){var _,F,U,L,D,M;for(_=v(S,5,257),F=v(S,5,1),U=v(S,4,4),L=0;L<19;++L)p[L]=0;for(L=0;L<U;++L){var k=v(S,3,0);p[h[L]]=k}for(g(u,p,0,19),D=0;D<_+F;){var B=b(S,u);switch(B){case 16:var P=p[D-1];for(M=v(S,2,3);M;--M)p[D++]=P;break;case 17:for(M=v(S,3,3);M;--M)p[D++]=0;break;case 18:for(M=v(S,7,11);M;--M)p[D++]=0;break;default:p[D++]=B;break}}g(w,p,0,_),g(T,p,_,F)}function x(S,w,T){for(;;){var _=b(S,w);if(_===256)return i;if(_<256)S.dest[S.destLen++]=_;else{var F,U,L,D;for(_-=257,F=v(S,r[_],a[_]),U=b(S,T),L=S.destLen-v(S,l[U],c[U]),D=L;D<L+F;++D)S.dest[S.destLen++]=S.dest[D]}}}function I(S){for(var w,T,_;S.bitcount>8;)S.sourceIndex--,S.bitcount-=8;if(w=S.source[S.sourceIndex+1],w=256*w+S.source[S.sourceIndex],T=S.source[S.sourceIndex+3],T=256*T+S.source[S.sourceIndex+2],w!==(~T&65535))return e;for(S.sourceIndex+=4,_=w;_;--_)S.dest[S.destLen++]=S.source[S.sourceIndex++];return S.bitcount=0,i}function E(S,w){var T=new n(S,w),_,F,U;do{switch(_=A(T),F=v(T,2,0),F){case 0:U=I(T);break;case 1:U=x(T,s,o);break;case 2:C(T,T.ltree,T.dtree),U=x(T,T.ltree,T.dtree);break;default:U=e}if(U!==i)throw new Error("Data error")}while(!_);return T.destLen<T.dest.length?typeof T.dest.slice=="function"?T.dest.slice(0,T.destLen):T.dest.subarray(0,T.destLen):T.dest}return m(s,o),f(r,a,4,3),f(l,c,2,1),r[28]=0,a[28]=258,$l=E,$l}var LS=NS();const RS=nn(LS);function Un(i,e,t,n,s){return Math.pow(1-s,3)*i+3*Math.pow(1-s,2)*s*e+3*(1-s)*Math.pow(s,2)*t+Math.pow(s,3)*n}function Pi(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Pi.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Pi.prototype.addPoint=function(i,e){typeof i=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=i,this.x2=i),i<this.x1&&(this.x1=i),i>this.x2&&(this.x2=i)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},Pi.prototype.addX=function(i){this.addPoint(i,null)},Pi.prototype.addY=function(i){this.addPoint(null,i)},Pi.prototype.addBezier=function(i,e,t,n,s,o,r,a){const l=[i,e],c=[t,n],h=[s,o],u=[r,a];this.addPoint(i,e),this.addPoint(r,a);for(let p=0;p<=1;p++){const f=6*l[p]-12*c[p]+6*h[p],m=-3*l[p]+9*c[p]-9*h[p]+3*u[p],y=3*c[p]-3*l[p];if(m===0){if(f===0)continue;const b=-y/f;0<b&&b<1&&(p===0&&this.addX(Un(l[p],c[p],h[p],u[p],b)),p===1&&this.addY(Un(l[p],c[p],h[p],u[p],b)));continue}const g=Math.pow(f,2)-4*y*m;if(g<0)continue;const A=(-f+Math.sqrt(g))/(2*m);0<A&&A<1&&(p===0&&this.addX(Un(l[p],c[p],h[p],u[p],A)),p===1&&this.addY(Un(l[p],c[p],h[p],u[p],A)));const v=(-f-Math.sqrt(g))/(2*m);0<v&&v<1&&(p===0&&this.addX(Un(l[p],c[p],h[p],u[p],v)),p===1&&this.addY(Un(l[p],c[p],h[p],u[p],v)))}},Pi.prototype.addQuad=function(i,e,t,n,s,o){const r=i+.6666666666666666*(t-i),a=e+2/3*(n-e),l=r+1/3*(s-i),c=a+1/3*(o-e);this.addBezier(i,e,r,a,l,c,s,o)};function Xe(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}Xe.prototype.moveTo=function(i,e){this.commands.push({type:"M",x:i,y:e})},Xe.prototype.lineTo=function(i,e){this.commands.push({type:"L",x:i,y:e})},Xe.prototype.curveTo=Xe.prototype.bezierCurveTo=function(i,e,t,n,s,o){this.commands.push({type:"C",x1:i,y1:e,x2:t,y2:n,x:s,y:o})},Xe.prototype.quadTo=Xe.prototype.quadraticCurveTo=function(i,e,t,n){this.commands.push({type:"Q",x1:i,y1:e,x:t,y:n})},Xe.prototype.close=Xe.prototype.closePath=function(){this.commands.push({type:"Z"})},Xe.prototype.extend=function(i){if(i.commands)i=i.commands;else if(i instanceof Pi){const e=i;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,i)},Xe.prototype.getBoundingBox=function(){const i=new Pi;let e=0,t=0,n=0,s=0;for(let o=0;o<this.commands.length;o++){const r=this.commands[o];switch(r.type){case"M":i.addPoint(r.x,r.y),e=n=r.x,t=s=r.y;break;case"L":i.addPoint(r.x,r.y),n=r.x,s=r.y;break;case"Q":i.addQuad(n,s,r.x1,r.y1,r.x,r.y),n=r.x,s=r.y;break;case"C":i.addBezier(n,s,r.x1,r.y1,r.x2,r.y2,r.x,r.y),n=r.x,s=r.y;break;case"Z":n=e,s=t;break;default:throw new Error("Unexpected path command "+r.type)}}return i.isEmpty()&&i.addPoint(0,0),i},Xe.prototype.draw=function(i){i.beginPath();for(let e=0;e<this.commands.length;e+=1){const t=this.commands[e];t.type==="M"?i.moveTo(t.x,t.y):t.type==="L"?i.lineTo(t.x,t.y):t.type==="C"?i.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y):t.type==="Q"?i.quadraticCurveTo(t.x1,t.y1,t.x,t.y):t.type==="Z"&&i.closePath()}this.fill&&(i.fillStyle=this.fill,i.fill()),this.stroke&&(i.strokeStyle=this.stroke,i.lineWidth=this.strokeWidth,i.stroke())},Xe.prototype.toPathData=function(i){i=i!==void 0?i:2;function e(s){return Math.round(s)===s?""+Math.round(s):s.toFixed(i)}function t(){let s="";for(let o=0;o<arguments.length;o+=1){const r=arguments[o];r>=0&&o>0&&(s+=" "),s+=e(r)}return s}let n="";for(let s=0;s<this.commands.length;s+=1){const o=this.commands[s];o.type==="M"?n+="M"+t(o.x,o.y):o.type==="L"?n+="L"+t(o.x,o.y):o.type==="C"?n+="C"+t(o.x1,o.y1,o.x2,o.y2,o.x,o.y):o.type==="Q"?n+="Q"+t(o.x1,o.y1,o.x,o.y):o.type==="Z"&&(n+="Z")}return n},Xe.prototype.toSVG=function(i){let e='<path d="';return e+=this.toPathData(i),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e},Xe.prototype.toDOMElement=function(i){const e=this.toPathData(i),t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",e),t};function Wf(i){throw new Error(i)}function qf(i,e){i||Wf(e)}const ue={fail:Wf,argument:qf,assert:qf},Kf=32768,Xf=2147483648,Vn={},J={},le={};function Ot(i){return function(){return i}}J.BYTE=function(i){return ue.argument(i>=0&&i<=255,"Byte value should be between 0 and 255."),[i]},le.BYTE=Ot(1),J.CHAR=function(i){return[i.charCodeAt(0)]},le.CHAR=Ot(1),J.CHARARRAY=function(i){const e=[];for(let t=0;t<i.length;t+=1)e[t]=i.charCodeAt(t);return e},le.CHARARRAY=function(i){return i.length},J.USHORT=function(i){return[i>>8&255,i&255]},le.USHORT=Ot(2),J.SHORT=function(i){return i>=Kf&&(i=-(2*Kf-i)),[i>>8&255,i&255]},le.SHORT=Ot(2),J.UINT24=function(i){return[i>>16&255,i>>8&255,i&255]},le.UINT24=Ot(3),J.ULONG=function(i){return[i>>24&255,i>>16&255,i>>8&255,i&255]},le.ULONG=Ot(4),J.LONG=function(i){return i>=Xf&&(i=-(2*Xf-i)),[i>>24&255,i>>16&255,i>>8&255,i&255]},le.LONG=Ot(4),J.FIXED=J.ULONG,le.FIXED=le.ULONG,J.FWORD=J.SHORT,le.FWORD=le.SHORT,J.UFWORD=J.USHORT,le.UFWORD=le.USHORT,J.LONGDATETIME=function(i){return[0,0,0,0,i>>24&255,i>>16&255,i>>8&255,i&255]},le.LONGDATETIME=Ot(8),J.TAG=function(i){return ue.argument(i.length===4,"Tag should be exactly 4 ASCII characters."),[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]},le.TAG=Ot(4),J.Card8=J.BYTE,le.Card8=le.BYTE,J.Card16=J.USHORT,le.Card16=le.USHORT,J.OffSize=J.BYTE,le.OffSize=le.BYTE,J.SID=J.USHORT,le.SID=le.USHORT,J.NUMBER=function(i){return i>=-107&&i<=107?[i+139]:i>=108&&i<=1131?(i=i-108,[(i>>8)+247,i&255]):i>=-1131&&i<=-108?(i=-i-108,[(i>>8)+251,i&255]):i>=-32768&&i<=32767?J.NUMBER16(i):J.NUMBER32(i)},le.NUMBER=function(i){return J.NUMBER(i).length},J.NUMBER16=function(i){return[28,i>>8&255,i&255]},le.NUMBER16=Ot(3),J.NUMBER32=function(i){return[29,i>>24&255,i>>16&255,i>>8&255,i&255]},le.NUMBER32=Ot(5),J.REAL=function(i){let e=i.toString();const t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){const o=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(i*o)/o).toString()}let n="";for(let o=0,r=e.length;o<r;o+=1){const a=e[o];a==="e"?n+=e[++o]==="-"?"c":"b":a==="."?n+="a":a==="-"?n+="e":n+=a}n+=n.length&1?"f":"ff";const s=[30];for(let o=0,r=n.length;o<r;o+=2)s.push(parseInt(n.substr(o,2),16));return s},le.REAL=function(i){return J.REAL(i).length},J.NAME=J.CHARARRAY,le.NAME=le.CHARARRAY,J.STRING=J.CHARARRAY,le.STRING=le.CHARARRAY,Vn.UTF8=function(i,e,t){const n=[],s=t;for(let o=0;o<s;o++,e+=1)n[o]=i.getUint8(e);return String.fromCharCode.apply(null,n)},Vn.UTF16=function(i,e,t){const n=[],s=t/2;for(let o=0;o<s;o++,e+=2)n[o]=i.getUint16(e);return String.fromCharCode.apply(null,n)},J.UTF16=function(i){const e=[];for(let t=0;t<i.length;t+=1){const n=i.charCodeAt(t);e[e.length]=n>>8&255,e[e.length]=n&255}return e},le.UTF16=function(i){return i.length*2};const jl={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Vn.MACSTRING=function(i,e,t,n){const s=jl[n];if(s===void 0)return;let o="";for(let r=0;r<t;r++){const a=i.getUint8(e+r);a<=127?o+=String.fromCharCode(a):o+=s[a&127]}return o};const wr=typeof WeakMap=="function"&&new WeakMap;let Cr;const FS=function(i){if(!Cr){Cr={};for(let s in jl)Cr[s]=new String(s)}const e=Cr[i];if(e===void 0)return;if(wr){const s=wr.get(e);if(s!==void 0)return s}const t=jl[i];if(t===void 0)return;const n={};for(let s=0;s<t.length;s++)n[t.charCodeAt(s)]=s+128;return wr&&wr.set(e,n),n};J.MACSTRING=function(i,e){const t=FS(e);if(t===void 0)return;const n=[];for(let s=0;s<i.length;s++){let o=i.charCodeAt(s);if(o>=128&&(o=t[o],o===void 0))return;n[s]=o}return n},le.MACSTRING=function(i,e){const t=J.MACSTRING(i,e);return t!==void 0?t.length:0};function Wl(i){return i>=-128&&i<=127}function OS(i,e,t){let n=0;const s=i.length;for(;e<s&&n<64&&i[e]===0;)++e,++n;return t.push(128|n-1),e}function GS(i,e,t){let n=0;const s=i.length;let o=e;for(;o<s&&n<64;){const r=i[o];if(!Wl(r)||r===0&&o+1<s&&i[o+1]===0)break;++o,++n}t.push(n-1);for(let r=e;r<o;++r)t.push(i[r]+256&255);return o}function US(i,e,t){let n=0;const s=i.length;let o=e;for(;o<s&&n<64;){const r=i[o];if(r===0||Wl(r)&&o+1<s&&Wl(i[o+1]))break;++o,++n}t.push(64|n-1);for(let r=e;r<o;++r){const a=i[r];t.push(a+65536>>8&255,a+256&255)}return o}J.VARDELTAS=function(i){let e=0;const t=[];for(;e<i.length;){const n=i[e];n===0?e=OS(i,e,t):n>=-128&&n<=127?e=GS(i,e,t):e=US(i,e,t)}return t},J.INDEX=function(i){let e=1;const t=[e],n=[];for(let a=0;a<i.length;a+=1){const l=J.OBJECT(i[a]);Array.prototype.push.apply(n,l),e+=l.length,t.push(e)}if(n.length===0)return[0,0];const s=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,r=[void 0,J.BYTE,J.USHORT,J.UINT24,J.ULONG][o];for(let a=0;a<t.length;a+=1){const l=r(t[a]);Array.prototype.push.apply(s,l)}return Array.prototype.concat(J.Card16(i.length),J.OffSize(o),s,n)},le.INDEX=function(i){return J.INDEX(i).length},J.DICT=function(i){let e=[];const t=Object.keys(i),n=t.length;for(let s=0;s<n;s+=1){const o=parseInt(t[s],0),r=i[o];e=e.concat(J.OPERAND(r.value,r.type)),e=e.concat(J.OPERATOR(o))}return e},le.DICT=function(i){return J.DICT(i).length},J.OPERATOR=function(i){return i<1200?[i]:[12,i-1200]},J.OPERAND=function(i,e){let t=[];if(Array.isArray(e))for(let n=0;n<e.length;n+=1)ue.argument(i.length===e.length,"Not enough arguments given for type"+e),t=t.concat(J.OPERAND(i[n],e[n]));else if(e==="SID")t=t.concat(J.NUMBER(i));else if(e==="offset")t=t.concat(J.NUMBER32(i));else if(e==="number")t=t.concat(J.NUMBER(i));else if(e==="real")t=t.concat(J.REAL(i));else throw new Error("Unknown operand type "+e);return t},J.OP=J.BYTE,le.OP=le.BYTE;const Er=typeof WeakMap=="function"&&new WeakMap;J.CHARSTRING=function(i){if(Er){const n=Er.get(i);if(n!==void 0)return n}let e=[];const t=i.length;for(let n=0;n<t;n+=1){const s=i[n];e=e.concat(J[s.type](s.value))}return Er&&Er.set(i,e),e},le.CHARSTRING=function(i){return J.CHARSTRING(i).length},J.OBJECT=function(i){const e=J[i.type];return ue.argument(e!==void 0,"No encoding function for type "+i.type),e(i.value)},le.OBJECT=function(i){const e=le[i.type];return ue.argument(e!==void 0,"No sizeOf function for type "+i.type),e(i.value)},J.TABLE=function(i){let e=[];const t=i.fields.length,n=[],s=[];for(let o=0;o<t;o+=1){const r=i.fields[o],a=J[r.type];ue.argument(a!==void 0,"No encoding function for field type "+r.type+" ("+r.name+")");let l=i[r.name];l===void 0&&(l=r.value);const c=a(l);r.type==="TABLE"?(s.push(e.length),e=e.concat([0,0]),n.push(c)):e=e.concat(c)}for(let o=0;o<n.length;o+=1){const r=s[o],a=e.length;ue.argument(a<65536,"Table "+i.tableName+" too big."),e[r]=a>>8,e[r+1]=a&255,e=e.concat(n[o])}return e},le.TABLE=function(i){let e=0;const t=i.fields.length;for(let n=0;n<t;n+=1){const s=i.fields[n],o=le[s.type];ue.argument(o!==void 0,"No sizeOf function for field type "+s.type+" ("+s.name+")");let r=i[s.name];r===void 0&&(r=s.value),e+=o(r),s.type==="TABLE"&&(e+=2)}return e},J.RECORD=J.TABLE,le.RECORD=le.TABLE,J.LITERAL=function(i){return i},le.LITERAL=function(i){return i.length};function ot(i,e,t){for(let n=0;n<e.length;n+=1){const s=e[n];this[s.name]=s.value}if(this.tableName=i,this.fields=e,t){const n=Object.keys(t);for(let s=0;s<n.length;s+=1){const o=n[s],r=t[o];this[o]!==void 0&&(this[o]=r)}}}ot.prototype.encode=function(){return J.TABLE(this)},ot.prototype.sizeOf=function(){return le.TABLE(this)};function Xs(i,e,t){t===void 0&&(t=e.length);const n=new Array(e.length+1);n[0]={name:i+"Count",type:"USHORT",value:t};for(let s=0;s<e.length;s++)n[s+1]={name:i+s,type:"USHORT",value:e[s]};return n}function ql(i,e,t){const n=e.length,s=new Array(n+1);s[0]={name:i+"Count",type:"USHORT",value:n};for(let o=0;o<n;o++)s[o+1]={name:i+o,type:"TABLE",value:t(e[o],o)};return s}function xr(i,e,t){const n=e.length;let s=[];s[0]={name:i+"Count",type:"USHORT",value:n};for(let o=0;o<n;o++)s=s.concat(t(e[o],o));return s}function Ir(i){i.format===1?ot.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Xs("glyph",i.glyphs))):ue.assert(!1,"Can't create coverage table format 2 yet.")}Ir.prototype=Object.create(ot.prototype),Ir.prototype.constructor=Ir;function Sr(i){ot.call(this,"scriptListTable",xr("scriptRecord",i,function(e,t){const n=e.script;let s=n.defaultLangSys;return ue.assert(!!s,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new ot("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new ot("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:s.reqFeatureIndex}].concat(Xs("featureIndex",s.featureIndexes)))}].concat(xr("langSys",n.langSysRecords,function(o,r){const a=o.langSys;return[{name:"langSysTag"+r,type:"TAG",value:o.tag},{name:"langSys"+r,type:"TABLE",value:new ot("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:a.reqFeatureIndex}].concat(Xs("featureIndex",a.featureIndexes)))}]})))}]}))}Sr.prototype=Object.create(ot.prototype),Sr.prototype.constructor=Sr;function Mr(i){ot.call(this,"featureListTable",xr("featureRecord",i,function(e,t){const n=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new ot("featureTable",[{name:"featureParams",type:"USHORT",value:n.featureParams}].concat(Xs("lookupListIndex",n.lookupListIndexes)))}]}))}Mr.prototype=Object.create(ot.prototype),Mr.prototype.constructor=Mr;function Tr(i,e){ot.call(this,"lookupListTable",ql("lookup",i,function(t){let n=e[t.lookupType];return ue.assert(!!n,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new ot("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(ql("subtable",t.subtables,n)))}))}Tr.prototype=Object.create(ot.prototype),Tr.prototype.constructor=Tr;const oe={Table:ot,Record:ot,Coverage:Ir,ScriptList:Sr,FeatureList:Mr,LookupList:Tr,ushortList:Xs,tableList:ql,recordList:xr};function Jf(i,e){return i.getUint8(e)}function Br(i,e){return i.getUint16(e,!1)}function VS(i,e){return i.getInt16(e,!1)}function Kl(i,e){return i.getUint32(e,!1)}function Zf(i,e){const t=i.getInt16(e,!1),n=i.getUint16(e+2,!1);return t+n/65535}function QS(i,e){let t="";for(let n=e;n<e+4;n+=1)t+=String.fromCharCode(i.getInt8(n));return t}function zS(i,e,t){let n=0;for(let s=0;s<t;s+=1)n<<=8,n+=i.getUint8(e+s);return n}function HS(i,e,t){const n=[];for(let s=e;s<t;s+=1)n.push(i.getUint8(s));return n}function YS(i){let e="";for(let t=0;t<i.length;t+=1)e+=String.fromCharCode(i[t]);return e}const $S={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function H(i,e){this.data=i,this.offset=e,this.relativeOffset=0}H.prototype.parseByte=function(){const i=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},H.prototype.parseChar=function(){const i=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},H.prototype.parseCard8=H.prototype.parseByte,H.prototype.parseUShort=function(){const i=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},H.prototype.parseCard16=H.prototype.parseUShort,H.prototype.parseSID=H.prototype.parseUShort,H.prototype.parseOffset16=H.prototype.parseUShort,H.prototype.parseShort=function(){const i=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},H.prototype.parseF2Dot14=function(){const i=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,i},H.prototype.parseULong=function(){const i=Kl(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},H.prototype.parseOffset32=H.prototype.parseULong,H.prototype.parseFixed=function(){const i=Zf(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},H.prototype.parseString=function(i){const e=this.data,t=this.offset+this.relativeOffset;let n="";this.relativeOffset+=i;for(let s=0;s<i;s++)n+=String.fromCharCode(e.getUint8(t+s));return n},H.prototype.parseTag=function(){return this.parseString(4)},H.prototype.parseLongDateTime=function(){let i=Kl(this.data,this.offset+this.relativeOffset+4);return i-=2082844800,this.relativeOffset+=8,i},H.prototype.parseVersion=function(i){const e=Br(this.data,this.offset+this.relativeOffset),t=Br(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,i===void 0&&(i=4096),e+t/i/10},H.prototype.skip=function(i,e){e===void 0&&(e=1),this.relativeOffset+=$S[i]*e},H.prototype.parseULongList=function(i){i===void 0&&(i=this.parseULong());const e=new Array(i),t=this.data;let n=this.offset+this.relativeOffset;for(let s=0;s<i;s++)e[s]=t.getUint32(n),n+=4;return this.relativeOffset+=i*4,e},H.prototype.parseOffset16List=H.prototype.parseUShortList=function(i){i===void 0&&(i=this.parseUShort());const e=new Array(i),t=this.data;let n=this.offset+this.relativeOffset;for(let s=0;s<i;s++)e[s]=t.getUint16(n),n+=2;return this.relativeOffset+=i*2,e},H.prototype.parseShortList=function(i){const e=new Array(i),t=this.data;let n=this.offset+this.relativeOffset;for(let s=0;s<i;s++)e[s]=t.getInt16(n),n+=2;return this.relativeOffset+=i*2,e},H.prototype.parseByteList=function(i){const e=new Array(i),t=this.data;let n=this.offset+this.relativeOffset;for(let s=0;s<i;s++)e[s]=t.getUint8(n++);return this.relativeOffset+=i,e},H.prototype.parseList=function(i,e){e||(e=i,i=this.parseUShort());const t=new Array(i);for(let n=0;n<i;n++)t[n]=e.call(this);return t},H.prototype.parseList32=function(i,e){e||(e=i,i=this.parseULong());const t=new Array(i);for(let n=0;n<i;n++)t[n]=e.call(this);return t},H.prototype.parseRecordList=function(i,e){e||(e=i,i=this.parseUShort());const t=new Array(i),n=Object.keys(e);for(let s=0;s<i;s++){const o={};for(let r=0;r<n.length;r++){const a=n[r],l=e[a];o[a]=l.call(this)}t[s]=o}return t},H.prototype.parseRecordList32=function(i,e){e||(e=i,i=this.parseULong());const t=new Array(i),n=Object.keys(e);for(let s=0;s<i;s++){const o={};for(let r=0;r<n.length;r++){const a=n[r],l=e[a];o[a]=l.call(this)}t[s]=o}return t},H.prototype.parseStruct=function(i){if(typeof i=="function")return i.call(this);{const e=Object.keys(i),t={};for(let n=0;n<e.length;n++){const s=e[n],o=i[s];t[s]=o.call(this)}return t}},H.prototype.parseValueRecord=function(i){if(i===void 0&&(i=this.parseUShort()),i===0)return;const e={};return i&1&&(e.xPlacement=this.parseShort()),i&2&&(e.yPlacement=this.parseShort()),i&4&&(e.xAdvance=this.parseShort()),i&8&&(e.yAdvance=this.parseShort()),i&16&&(e.xPlaDevice=void 0,this.parseShort()),i&32&&(e.yPlaDevice=void 0,this.parseShort()),i&64&&(e.xAdvDevice=void 0,this.parseShort()),i&128&&(e.yAdvDevice=void 0,this.parseShort()),e},H.prototype.parseValueRecordList=function(){const i=this.parseUShort(),e=this.parseUShort(),t=new Array(e);for(let n=0;n<e;n++)t[n]=this.parseValueRecord(i);return t},H.prototype.parsePointer=function(i){const e=this.parseOffset16();if(e>0)return new H(this.data,this.offset+e).parseStruct(i)},H.prototype.parsePointer32=function(i){const e=this.parseOffset32();if(e>0)return new H(this.data,this.offset+e).parseStruct(i)},H.prototype.parseListOfLists=function(i){const e=this.parseOffset16List(),t=e.length,n=this.relativeOffset,s=new Array(t);for(let o=0;o<t;o++){const r=e[o];if(r===0){s[o]=void 0;continue}if(this.relativeOffset=r,i){const a=this.parseOffset16List(),l=new Array(a.length);for(let c=0;c<a.length;c++)this.relativeOffset=r+a[c],l[c]=i.call(this);s[o]=l}else s[o]=this.parseUShortList()}return this.relativeOffset=n,s},H.prototype.parseCoverage=function(){const i=this.offset+this.relativeOffset,e=this.parseUShort(),t=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(t)};if(e===2){const n=new Array(t);for(let s=0;s<t;s++)n[s]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:n}}throw new Error("0x"+i.toString(16)+": Coverage format must be 1 or 2.")},H.prototype.parseClassDef=function(){const i=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:H.uShort,end:H.uShort,classId:H.uShort})};throw new Error("0x"+i.toString(16)+": ClassDef format must be 1 or 2.")},H.list=function(i,e){return function(){return this.parseList(i,e)}},H.list32=function(i,e){return function(){return this.parseList32(i,e)}},H.recordList=function(i,e){return function(){return this.parseRecordList(i,e)}},H.recordList32=function(i,e){return function(){return this.parseRecordList32(i,e)}},H.pointer=function(i){return function(){return this.parsePointer(i)}},H.pointer32=function(i){return function(){return this.parsePointer32(i)}},H.tag=H.prototype.parseTag,H.byte=H.prototype.parseByte,H.uShort=H.offset16=H.prototype.parseUShort,H.uShortList=H.prototype.parseUShortList,H.uLong=H.offset32=H.prototype.parseULong,H.uLongList=H.prototype.parseULongList,H.struct=H.prototype.parseStruct,H.coverage=H.prototype.parseCoverage,H.classDef=H.prototype.parseClassDef;const ep={reserved:H.uShort,reqFeatureIndex:H.uShort,featureIndexes:H.uShortList};H.prototype.parseScriptList=function(){return this.parsePointer(H.recordList({tag:H.tag,script:H.pointer({defaultLangSys:H.pointer(ep),langSysRecords:H.recordList({tag:H.tag,langSys:H.pointer(ep)})})}))||[]},H.prototype.parseFeatureList=function(){return this.parsePointer(H.recordList({tag:H.tag,feature:H.pointer({featureParams:H.offset16,lookupListIndexes:H.uShortList})}))||[]},H.prototype.parseLookupList=function(i){return this.parsePointer(H.list(H.pointer(function(){const e=this.parseUShort();ue.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");const t=this.parseUShort(),n=t&16;return{lookupType:e,lookupFlag:t,subtables:this.parseList(H.pointer(i[e])),markFilteringSet:n?this.parseUShort():void 0}})))||[]},H.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){const i=this.parseUShort(),e=this.parseUShort();return ue.argument(i===1&&e<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:H.offset32,featureTableSubstitutionOffset:H.offset32})})||[]};const ne={getByte:Jf,getCard8:Jf,getUShort:Br,getCard16:Br,getShort:VS,getULong:Kl,getFixed:Zf,getTag:QS,getOffset:zS,getBytes:HS,bytesToString:YS,Parser:H};function jS(i,e){e.parseUShort(),i.length=e.parseULong(),i.language=e.parseULong();let t;i.groupCount=t=e.parseULong(),i.glyphIndexMap={};for(let n=0;n<t;n+=1){const s=e.parseULong(),o=e.parseULong();let r=e.parseULong();for(let a=s;a<=o;a+=1)i.glyphIndexMap[a]=r,r++}}function WS(i,e,t,n,s){i.length=e.parseUShort(),i.language=e.parseUShort();let o;i.segCount=o=e.parseUShort()>>1,e.skip("uShort",3),i.glyphIndexMap={};const r=new ne.Parser(t,n+s+14),a=new ne.Parser(t,n+s+16+o*2),l=new ne.Parser(t,n+s+16+o*4),c=new ne.Parser(t,n+s+16+o*6);let h=n+s+16+o*8;for(let u=0;u<o-1;u+=1){let p;const f=r.parseUShort(),m=a.parseUShort(),y=l.parseShort(),g=c.parseUShort();for(let A=m;A<=f;A+=1)g!==0?(h=c.offset+c.relativeOffset-2,h+=g,h+=(A-m)*2,p=ne.getUShort(t,h),p!==0&&(p=p+y&65535)):p=A+y&65535,i.glyphIndexMap[A]=p}}function qS(i,e){const t={};t.version=ne.getUShort(i,e),ue.argument(t.version===0,"cmap table version should be 0."),t.numTables=ne.getUShort(i,e+2);let n=-1;for(let o=t.numTables-1;o>=0;o-=1){const r=ne.getUShort(i,e+4+o*8),a=ne.getUShort(i,e+4+o*8+2);if(r===3&&(a===0||a===1||a===10)||r===0&&(a===0||a===1||a===2||a===3||a===4)){n=ne.getULong(i,e+4+o*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");const s=new ne.Parser(i,e+n);if(t.format=s.parseUShort(),t.format===12)jS(t,s);else if(t.format===4)WS(t,s,i,e,n);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function KS(i,e,t){i.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function XS(i){i.segments.push({end:65535,start:65535,delta:1,offset:0})}function JS(i){let e=!0,t;for(t=i.length-1;t>0;t-=1)if(i.get(t).unicode>65535){e=!1;break}let n=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(n=n.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),n=n.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);const s=new oe.Table("cmap",n);for(s.segments=[],t=0;t<i.length;t+=1){const f=i.get(t);for(let m=0;m<f.unicodes.length;m+=1)KS(s,f.unicodes[m],t);s.segments=s.segments.sort(function(m,y){return m.start-y.start})}XS(s);const o=s.segments.length;let r=0,a=[],l=[],c=[],h=[],u=[],p=[];for(t=0;t<o;t+=1){const f=s.segments[t];f.end<=65535&&f.start<=65535?(a=a.concat({name:"end_"+t,type:"USHORT",value:f.end}),l=l.concat({name:"start_"+t,type:"USHORT",value:f.start}),c=c.concat({name:"idDelta_"+t,type:"SHORT",value:f.delta}),h=h.concat({name:"idRangeOffset_"+t,type:"USHORT",value:f.offset}),f.glyphId!==void 0&&(u=u.concat({name:"glyph_"+t,type:"USHORT",value:f.glyphId}))):r+=1,!e&&f.glyphIndex!==void 0&&(p=p.concat({name:"cmap12Start_"+t,type:"ULONG",value:f.start}),p=p.concat({name:"cmap12End_"+t,type:"ULONG",value:f.end}),p=p.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:f.glyphIndex}))}if(s.segCountX2=(o-r)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(o-r)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(a),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(l),s.fields=s.fields.concat(c),s.fields=s.fields.concat(h),s.fields=s.fields.concat(u),s.cmap4Length=14+a.length*2+2+l.length*2+c.length*2+h.length*2+u.length*2,!e){const f=16+p.length*4;s.cmap12Offset=20+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:f},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:p.length/3}]),s.fields=s.fields.concat(p)}return s}const tp={parse:qS,make:JS},_r=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ZS=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],eM=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],sn=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function ip(i){this.font=i}ip.prototype.charToGlyphIndex=function(i){const e=i.codePointAt(0),t=this.font.glyphs;if(t)for(let n=0;n<t.length;n+=1){const s=t.get(n);for(let o=0;o<s.unicodes.length;o+=1)if(s.unicodes[o]===e)return n}return null};function np(i){this.cmap=i}np.prototype.charToGlyphIndex=function(i){return this.cmap.glyphIndexMap[i.codePointAt(0)]||0};function kr(i,e){this.encoding=i,this.charset=e}kr.prototype.charToGlyphIndex=function(i){const e=i.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function Xl(i){switch(i.version){case 1:this.names=sn.slice();break;case 2:this.names=new Array(i.numberOfGlyphs);for(let e=0;e<i.numberOfGlyphs;e++)i.glyphNameIndex[e]<sn.length?this.names[e]=sn[i.glyphNameIndex[e]]:this.names[e]=i.names[i.glyphNameIndex[e]-sn.length];break;case 2.5:this.names=new Array(i.numberOfGlyphs);for(let e=0;e<i.numberOfGlyphs;e++)this.names[e]=sn[e+i.glyphNameIndex[e]];break;case 3:this.names=[];break;default:this.names=[];break}}Xl.prototype.nameToGlyphIndex=function(i){return this.names.indexOf(i)},Xl.prototype.glyphIndexToName=function(i){return this.names[i]};function tM(i){let e;const t=i.tables.cmap.glyphIndexMap,n=Object.keys(t);for(let s=0;s<n.length;s+=1){const o=n[s],r=t[o];e=i.glyphs.get(r),e.addUnicode(parseInt(o))}for(let s=0;s<i.glyphs.length;s+=1)e=i.glyphs.get(s),i.cffEncoding?i.isCIDFont?e.name="gid"+s:e.name=i.cffEncoding.charset[s]:i.glyphNames.names&&(e.name=i.glyphNames.glyphIndexToName(s))}function iM(i,e,t,n,s){i.beginPath(),i.moveTo(e,t),i.lineTo(n,s),i.stroke()}const on={line:iM};function nM(i,e){let t=e||new Xe;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(n){t=n}}}function Nt(i){this.bindConstructorValues(i)}Nt.prototype.bindConstructorValues=function(i){this.index=i.index||0,this.name=i.name||null,this.unicode=i.unicode||void 0,this.unicodes=i.unicodes||i.unicode!==void 0?[i.unicode]:[],i.xMin&&(this.xMin=i.xMin),i.yMin&&(this.yMin=i.yMin),i.xMax&&(this.xMax=i.xMax),i.yMax&&(this.yMax=i.yMax),i.advanceWidth&&(this.advanceWidth=i.advanceWidth),Object.defineProperty(this,"path",nM(this,i.path))},Nt.prototype.addUnicode=function(i){this.unicodes.length===0&&(this.unicode=i),this.unicodes.push(i)},Nt.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Nt.prototype.getPath=function(i,e,t,n,s){i=i!==void 0?i:0,e=e!==void 0?e:0,t=t!==void 0?t:72;let o,r;n||(n={});let a=n.xScale,l=n.yScale;if(n.hinting&&s&&s.hinting&&(r=this.path&&s.hinting.exec(this,t)),r)o=s.hinting.getCommands(r),i=Math.round(i),e=Math.round(e),a=l=1;else{o=this.path.commands;const h=1/this.path.unitsPerEm*t;a===void 0&&(a=h),l===void 0&&(l=h)}const c=new Xe;for(let h=0;h<o.length;h+=1){const u=o[h];u.type==="M"?c.moveTo(i+u.x*a,e+-u.y*l):u.type==="L"?c.lineTo(i+u.x*a,e+-u.y*l):u.type==="Q"?c.quadraticCurveTo(i+u.x1*a,e+-u.y1*l,i+u.x*a,e+-u.y*l):u.type==="C"?c.curveTo(i+u.x1*a,e+-u.y1*l,i+u.x2*a,e+-u.y2*l,i+u.x*a,e+-u.y*l):u.type==="Z"&&c.closePath()}return c},Nt.prototype.getContours=function(){if(this.points===void 0)return[];const i=[];let e=[];for(let t=0;t<this.points.length;t+=1){const n=this.points[t];e.push(n),n.lastPointOfContour&&(i.push(e),e=[])}return ue.argument(e.length===0,"There are still points left in the current contour."),i},Nt.prototype.getMetrics=function(){const i=this.path.commands,e=[],t=[];for(let s=0;s<i.length;s+=1){const o=i[s];o.type!=="Z"&&(e.push(o.x),t.push(o.y)),(o.type==="Q"||o.type==="C")&&(e.push(o.x1),t.push(o.y1)),o.type==="C"&&(e.push(o.x2),t.push(o.y2))}const n={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,t),leftSideBearing:this.leftSideBearing};return isFinite(n.xMin)||(n.xMin=0),isFinite(n.xMax)||(n.xMax=this.advanceWidth),isFinite(n.yMin)||(n.yMin=0),isFinite(n.yMax)||(n.yMax=0),n.rightSideBearing=this.advanceWidth-n.leftSideBearing-(n.xMax-n.xMin),n},Nt.prototype.draw=function(i,e,t,n,s){this.getPath(e,t,n,s).draw(i)},Nt.prototype.drawPoints=function(i,e,t,n){function s(c,h,u,p){const f=Math.PI*2;i.beginPath();for(let m=0;m<c.length;m+=1)i.moveTo(h+c[m].x*p,u+c[m].y*p),i.arc(h+c[m].x*p,u+c[m].y*p,2,0,f,!1);i.closePath(),i.fill()}e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:24;const o=1/this.path.unitsPerEm*n,r=[],a=[],l=this.path;for(let c=0;c<l.commands.length;c+=1){const h=l.commands[c];h.x!==void 0&&r.push({x:h.x,y:-h.y}),h.x1!==void 0&&a.push({x:h.x1,y:-h.y1}),h.x2!==void 0&&a.push({x:h.x2,y:-h.y2})}i.fillStyle="blue",s(r,e,t,o),i.fillStyle="red",s(a,e,t,o)},Nt.prototype.drawMetrics=function(i,e,t,n){let s;e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:24,s=1/this.path.unitsPerEm*n,i.lineWidth=1,i.strokeStyle="black",on.line(i,e,-1e4,e,1e4),on.line(i,-1e4,t,1e4,t);const o=this.xMin||0;let r=this.yMin||0;const a=this.xMax||0;let l=this.yMax||0;const c=this.advanceWidth||0;i.strokeStyle="blue",on.line(i,e+o*s,-1e4,e+o*s,1e4),on.line(i,e+a*s,-1e4,e+a*s,1e4),on.line(i,-1e4,t+-r*s,1e4,t+-r*s),on.line(i,-1e4,t+-l*s,1e4,t+-l*s),i.strokeStyle="green",on.line(i,e+c*s,-1e4,e+c*s,1e4)};function Pr(i,e,t){Object.defineProperty(i,e,{get:function(){return i.path,i[t]},set:function(n){i[t]=n},enumerable:!0,configurable:!0})}function Jl(i,e){if(this.font=i,this.glyphs={},Array.isArray(e))for(let t=0;t<e.length;t++)this.glyphs[t]=e[t];this.length=e&&e.length||0}Jl.prototype.get=function(i){return typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]()),this.glyphs[i]},Jl.prototype.push=function(i,e){this.glyphs[i]=e,this.length++};function sM(i,e){return new Nt({index:e,font:i})}function oM(i,e,t,n,s,o){return function(){const r=new Nt({index:e,font:i});return r.path=function(){t(r,n,s);const a=o(i.glyphs,r);return a.unitsPerEm=i.unitsPerEm,a},Pr(r,"xMin","_xMin"),Pr(r,"xMax","_xMax"),Pr(r,"yMin","_yMin"),Pr(r,"yMax","_yMax"),r}}function rM(i,e,t,n){return function(){const s=new Nt({index:e,font:i});return s.path=function(){const o=t(i,s,n);return o.unitsPerEm=i.unitsPerEm,o},s}}const Qn={GlyphSet:Jl,glyphLoader:sM,ttfGlyphLoader:oM,cffGlyphLoader:rM};function sp(i,e){if(i===e)return!0;if(Array.isArray(i)&&Array.isArray(e)){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t+=1)if(!sp(i[t],e[t]))return!1;return!0}else return!1}function Zl(i){let e;return i.length<1240?e=107:i.length<33900?e=1131:e=32768,e}function Di(i,e,t){const n=[],s=[],o=ne.getCard16(i,e);let r,a;if(o!==0){const l=ne.getByte(i,e+2);r=e+(o+1)*l+2;let c=e+3;for(let h=0;h<o+1;h+=1)n.push(ne.getOffset(i,c,l)),c+=l;a=r+n[o]}else a=e+2;for(let l=0;l<n.length-1;l+=1){let c=ne.getBytes(i,r+n[l],r+n[l+1]);t&&(c=t(c)),s.push(c)}return{objects:s,startOffset:e,endOffset:a}}function aM(i){let e="";const n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=i.parseByte(),o=s>>4,r=s&15;if(o===15||(e+=n[o],r===15))break;e+=n[r]}return parseFloat(e)}function lM(i,e){let t,n,s,o;if(e===28)return t=i.parseByte(),n=i.parseByte(),t<<8|n;if(e===29)return t=i.parseByte(),n=i.parseByte(),s=i.parseByte(),o=i.parseByte(),t<<24|n<<16|s<<8|o;if(e===30)return aM(i);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=i.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=i.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function cM(i){const e={};for(let t=0;t<i.length;t+=1){const n=i[t][0],s=i[t][1];let o;if(s.length===1?o=s[0]:o=s,e.hasOwnProperty(n)&&!isNaN(e[n]))throw new Error("Object "+e+" already has key "+n);e[n]=o}return e}function op(i,e,t){e=e!==void 0?e:0;const n=new ne.Parser(i,e),s=[];let o=[];for(t=t!==void 0?t:i.length;n.relativeOffset<t;){let r=n.parseByte();r<=21?(r===12&&(r=1200+n.parseByte()),s.push([r,o]),o=[]):o.push(lM(n,r))}return cM(s)}function Js(i,e){return e<=390?e=_r[e]:e=i[e-391],e}function rp(i,e,t){const n={};let s;for(let o=0;o<e.length;o+=1){const r=e[o];if(Array.isArray(r.type)){const a=[];a.length=r.type.length;for(let l=0;l<r.type.length;l++)s=i[r.op]!==void 0?i[r.op][l]:void 0,s===void 0&&(s=r.value!==void 0&&r.value[l]!==void 0?r.value[l]:null),r.type[l]==="SID"&&(s=Js(t,s)),a[l]=s;n[r.name]=a}else s=i[r.op],s===void 0&&(s=r.value!==void 0?r.value:null),r.type==="SID"&&(s=Js(t,s)),n[r.name]=s}return n}function dM(i,e){const t={};return t.formatMajor=ne.getCard8(i,e),t.formatMinor=ne.getCard8(i,e+1),t.size=ne.getCard8(i,e+2),t.offsetSize=ne.getCard8(i,e+3),t.startOffset=e,t.endOffset=e+4,t}const ap=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],lp=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function hM(i,e){const t=op(i,0,i.byteLength);return rp(t,ap,e)}function cp(i,e,t,n){const s=op(i,e,t);return rp(s,lp,n)}function dp(i,e,t,n){const s=[];for(let o=0;o<t.length;o+=1){const r=new DataView(new Uint8Array(t[o]).buffer),a=hM(r,n);a._subrs=[],a._subrsBias=0;const l=a.private[0],c=a.private[1];if(l!==0&&c!==0){const h=cp(i,c+e,l,n);if(a._defaultWidthX=h.defaultWidthX,a._nominalWidthX=h.nominalWidthX,h.subrs!==0){const u=c+h.subrs,p=Di(i,u+e);a._subrs=p.objects,a._subrsBias=Zl(a._subrs)}a._privateDict=h}s.push(a)}return s}function uM(i,e,t,n){let s,o;const r=new ne.Parser(i,e);t-=1;const a=[".notdef"],l=r.parseCard8();if(l===0)for(let c=0;c<t;c+=1)s=r.parseSID(),a.push(Js(n,s));else if(l===1)for(;a.length<=t;){s=r.parseSID(),o=r.parseCard8();for(let c=0;c<=o;c+=1)a.push(Js(n,s)),s+=1}else if(l===2)for(;a.length<=t;){s=r.parseSID(),o=r.parseCard16();for(let c=0;c<=o;c+=1)a.push(Js(n,s)),s+=1}else throw new Error("Unknown charset format "+l);return a}function fM(i,e,t){let n;const s={},o=new ne.Parser(i,e),r=o.parseCard8();if(r===0){const a=o.parseCard8();for(let l=0;l<a;l+=1)n=o.parseCard8(),s[n]=l}else if(r===1){const a=o.parseCard8();n=1;for(let l=0;l<a;l+=1){const c=o.parseCard8(),h=o.parseCard8();for(let u=c;u<=c+h;u+=1)s[u]=n,n+=1}}else throw new Error("Unknown encoding format "+r);return new kr(s,t)}function pM(i,e,t){let n,s,o,r;const a=new Xe,l=[];let c=0,h=!1,u=!1,p=0,f=0,m,y,g,A;if(i.isCIDFont){const I=i.tables.cff.topDict._fdSelect[e.index],E=i.tables.cff.topDict._fdArray[I];m=E._subrs,y=E._subrsBias,g=E._defaultWidthX,A=E._nominalWidthX}else m=i.tables.cff.topDict._subrs,y=i.tables.cff.topDict._subrsBias,g=i.tables.cff.topDict._defaultWidthX,A=i.tables.cff.topDict._nominalWidthX;let v=g;function b(I,E){u&&a.closePath(),a.moveTo(I,E),u=!0}function C(){let I;I=l.length%2!==0,I&&!h&&(v=l.shift()+A),c+=l.length>>1,l.length=0,h=!0}function x(I){let E,S,w,T,_,F,U,L,D,M,k,B,P=0;for(;P<I.length;){let V=I[P];switch(P+=1,V){case 1:C();break;case 3:C();break;case 4:l.length>1&&!h&&(v=l.shift()+A,h=!0),f+=l.pop(),b(p,f);break;case 5:for(;l.length>0;)p+=l.shift(),f+=l.shift(),a.lineTo(p,f);break;case 6:for(;l.length>0&&(p+=l.shift(),a.lineTo(p,f),l.length!==0);)f+=l.shift(),a.lineTo(p,f);break;case 7:for(;l.length>0&&(f+=l.shift(),a.lineTo(p,f),l.length!==0);)p+=l.shift(),a.lineTo(p,f);break;case 8:for(;l.length>0;)n=p+l.shift(),s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),p=o+l.shift(),f=r+l.shift(),a.curveTo(n,s,o,r,p,f);break;case 10:_=l.pop()+y,F=m[_],F&&x(F);break;case 11:return;case 12:switch(V=I[P],P+=1,V){case 35:n=p+l.shift(),s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),U=o+l.shift(),L=r+l.shift(),D=U+l.shift(),M=L+l.shift(),k=D+l.shift(),B=M+l.shift(),p=k+l.shift(),f=B+l.shift(),l.shift(),a.curveTo(n,s,o,r,U,L),a.curveTo(D,M,k,B,p,f);break;case 34:n=p+l.shift(),s=f,o=n+l.shift(),r=s+l.shift(),U=o+l.shift(),L=r,D=U+l.shift(),M=r,k=D+l.shift(),B=f,p=k+l.shift(),a.curveTo(n,s,o,r,U,L),a.curveTo(D,M,k,B,p,f);break;case 36:n=p+l.shift(),s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),U=o+l.shift(),L=r,D=U+l.shift(),M=r,k=D+l.shift(),B=M+l.shift(),p=k+l.shift(),a.curveTo(n,s,o,r,U,L),a.curveTo(D,M,k,B,p,f);break;case 37:n=p+l.shift(),s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),U=o+l.shift(),L=r+l.shift(),D=U+l.shift(),M=L+l.shift(),k=D+l.shift(),B=M+l.shift(),Math.abs(k-p)>Math.abs(B-f)?p=k+l.shift():f=B+l.shift(),a.curveTo(n,s,o,r,U,L),a.curveTo(D,M,k,B,p,f);break;default:""+e.index+V,l.length=0}break;case 14:l.length>0&&!h&&(v=l.shift()+A,h=!0),u&&(a.closePath(),u=!1);break;case 18:C();break;case 19:case 20:C(),P+=c+7>>3;break;case 21:l.length>2&&!h&&(v=l.shift()+A,h=!0),f+=l.pop(),p+=l.pop(),b(p,f);break;case 22:l.length>1&&!h&&(v=l.shift()+A,h=!0),p+=l.pop(),b(p,f);break;case 23:C();break;case 24:for(;l.length>2;)n=p+l.shift(),s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),p=o+l.shift(),f=r+l.shift(),a.curveTo(n,s,o,r,p,f);p+=l.shift(),f+=l.shift(),a.lineTo(p,f);break;case 25:for(;l.length>6;)p+=l.shift(),f+=l.shift(),a.lineTo(p,f);n=p+l.shift(),s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),p=o+l.shift(),f=r+l.shift(),a.curveTo(n,s,o,r,p,f);break;case 26:for(l.length%2&&(p+=l.shift());l.length>0;)n=p,s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),p=o,f=r+l.shift(),a.curveTo(n,s,o,r,p,f);break;case 27:for(l.length%2&&(f+=l.shift());l.length>0;)n=p+l.shift(),s=f,o=n+l.shift(),r=s+l.shift(),p=o+l.shift(),f=r,a.curveTo(n,s,o,r,p,f);break;case 28:E=I[P],S=I[P+1],l.push((E<<24|S<<16)>>16),P+=2;break;case 29:_=l.pop()+i.gsubrsBias,F=i.gsubrs[_],F&&x(F);break;case 30:for(;l.length>0&&(n=p,s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),p=o+l.shift(),f=r+(l.length===1?l.shift():0),a.curveTo(n,s,o,r,p,f),l.length!==0);)n=p+l.shift(),s=f,o=n+l.shift(),r=s+l.shift(),f=r+l.shift(),p=o+(l.length===1?l.shift():0),a.curveTo(n,s,o,r,p,f);break;case 31:for(;l.length>0&&(n=p+l.shift(),s=f,o=n+l.shift(),r=s+l.shift(),f=r+l.shift(),p=o+(l.length===1?l.shift():0),a.curveTo(n,s,o,r,p,f),l.length!==0);)n=p,s=f+l.shift(),o=n+l.shift(),r=s+l.shift(),p=o+l.shift(),f=r+(l.length===1?l.shift():0),a.curveTo(n,s,o,r,p,f);break;default:V<32?""+e.index+V:V<247?l.push(V-139):V<251?(E=I[P],P+=1,l.push((V-247)*256+E+108)):V<255?(E=I[P],P+=1,l.push(-(V-251)*256-E-108)):(E=I[P],S=I[P+1],w=I[P+2],T=I[P+3],P+=4,l.push((E<<24|S<<16|w<<8|T)/65536))}}}return x(t),e.advanceWidth=v,a}function mM(i,e,t,n){const s=[];let o;const r=new ne.Parser(i,e),a=r.parseCard8();if(a===0)for(let l=0;l<t;l++){if(o=r.parseCard8(),o>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+n+")");s.push(o)}else if(a===3){const l=r.parseCard16();let c=r.parseCard16();if(c!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+c);let h;for(let u=0;u<l;u++){if(o=r.parseCard8(),h=r.parseCard16(),o>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+n+")");if(h>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+h);for(;c<h;c++)s.push(o);c=h}if(h!==t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+h)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+a);return s}function gM(i,e,t){t.tables.cff={};const n=dM(i,e),s=Di(i,n.endOffset,ne.bytesToString),o=Di(i,s.endOffset),r=Di(i,o.endOffset,ne.bytesToString),a=Di(i,r.endOffset);t.gsubrs=a.objects,t.gsubrsBias=Zl(t.gsubrs);const l=dp(i,e,o.objects,r.objects);if(l.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+l.length);const c=l[0];if(t.tables.cff.topDict=c,c._privateDict&&(t.defaultWidthX=c._privateDict.defaultWidthX,t.nominalWidthX=c._privateDict.nominalWidthX),c.ros[0]!==void 0&&c.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){let m=c.fdArray,y=c.fdSelect;if(m===0||y===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");m+=e;const g=Di(i,m),A=dp(i,e,g.objects,r.objects);c._fdArray=A,y+=e,c._fdSelect=mM(i,y,t.numGlyphs,A.length)}const h=e+c.private[1],u=cp(i,h,c.private[0],r.objects);if(t.defaultWidthX=u.defaultWidthX,t.nominalWidthX=u.nominalWidthX,u.subrs!==0){const m=h+u.subrs,y=Di(i,m);t.subrs=y.objects,t.subrsBias=Zl(t.subrs)}else t.subrs=[],t.subrsBias=0;const p=Di(i,e+c.charStrings);t.nGlyphs=p.objects.length;const f=uM(i,e+c.charset,t.nGlyphs,r.objects);c.encoding===0?t.cffEncoding=new kr(ZS,f):c.encoding===1?t.cffEncoding=new kr(eM,f):t.cffEncoding=fM(i,e+c.encoding,f),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new Qn.GlyphSet(t);for(let m=0;m<t.nGlyphs;m+=1){const y=p.objects[m];t.glyphs.push(m,Qn.cffGlyphLoader(t,m,pM,y))}}function hp(i,e){let t,n=_r.indexOf(i);return n>=0&&(t=n),n=e.indexOf(i),n>=0?t=n+_r.length:(t=_r.length+e.length,e.push(i)),t}function yM(){return new oe.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function AM(i){const e=new oe.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(let t=0;t<i.length;t+=1)e.names.push({name:"name_"+t,type:"NAME",value:i[t]});return e}function up(i,e,t){const n={};for(let s=0;s<i.length;s+=1){const o=i[s];let r=e[o.name];r!==void 0&&!sp(r,o.value)&&(o.type==="SID"&&(r=hp(r,t)),n[o.op]={name:o.name,type:o.type,value:r})}return n}function fp(i,e){const t=new oe.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=up(ap,i,e),t}function pp(i){const e=new oe.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:i}],e}function vM(i){const e=new oe.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(let t=0;t<i.length;t+=1)e.strings.push({name:"string_"+t,type:"STRING",value:i[t]});return e}function bM(){return new oe.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function wM(i,e){const t=new oe.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let n=0;n<i.length;n+=1){const s=i[n],o=hp(s,e);t.fields.push({name:"glyph_"+n,type:"SID",value:o})}return t}function CM(i){const e=[],t=i.path;e.push({name:"width",type:"NUMBER",value:i.advanceWidth});let n=0,s=0;for(let o=0;o<t.commands.length;o+=1){let r,a,l=t.commands[o];if(l.type==="Q"){const c=.3333333333333333,h=2/3;l={type:"C",x:l.x,y:l.y,x1:c*n+h*l.x1,y1:c*s+h*l.y1,x2:c*l.x+h*l.x1,y2:c*l.y+h*l.y1}}if(l.type==="M")r=Math.round(l.x-n),a=Math.round(l.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:a}),e.push({name:"rmoveto",type:"OP",value:21}),n=Math.round(l.x),s=Math.round(l.y);else if(l.type==="L")r=Math.round(l.x-n),a=Math.round(l.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:a}),e.push({name:"rlineto",type:"OP",value:5}),n=Math.round(l.x),s=Math.round(l.y);else if(l.type==="C"){const c=Math.round(l.x1-n),h=Math.round(l.y1-s),u=Math.round(l.x2-l.x1),p=Math.round(l.y2-l.y1);r=Math.round(l.x-l.x2),a=Math.round(l.y-l.y2),e.push({name:"dx1",type:"NUMBER",value:c}),e.push({name:"dy1",type:"NUMBER",value:h}),e.push({name:"dx2",type:"NUMBER",value:u}),e.push({name:"dy2",type:"NUMBER",value:p}),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:a}),e.push({name:"rrcurveto",type:"OP",value:8}),n=Math.round(l.x),s=Math.round(l.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function EM(i){const e=new oe.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let t=0;t<i.length;t+=1){const n=i.get(t),s=CM(n);e.charStrings.push({name:n.name,type:"CHARSTRING",value:s})}return e}function xM(i,e){const t=new oe.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=up(lp,i,e),t}function IM(i,e){const t=new oe.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),n=1/e.unitsPerEm,s={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[n,0,0,n,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},o={},r=[];let a;for(let u=1;u<i.length;u+=1)a=i.get(u),r.push(a.name);const l=[];t.header=yM(),t.nameIndex=AM([e.postScriptName]);let c=fp(s,l);t.topDictIndex=pp(c),t.globalSubrIndex=bM(),t.charsets=wM(r,l),t.charStringsIndex=EM(i),t.privateDict=xM(o,l),t.stringIndex=vM(l);const h=t.header.sizeOf()+t.nameIndex.sizeOf()+t.topDictIndex.sizeOf()+t.stringIndex.sizeOf()+t.globalSubrIndex.sizeOf();return s.charset=h,s.encoding=0,s.charStrings=s.charset+t.charsets.sizeOf(),s.private[1]=s.charStrings+t.charStringsIndex.sizeOf(),c=fp(s,l),t.topDictIndex=pp(c),t}const mp={parse:gM,make:IM};function SM(i,e){const t={},n=new ne.Parser(i,e);return t.version=n.parseVersion(),t.fontRevision=Math.round(n.parseFixed()*1e3)/1e3,t.checkSumAdjustment=n.parseULong(),t.magicNumber=n.parseULong(),ue.argument(t.magicNumber===1594834165,"Font header has wrong magic number."),t.flags=n.parseUShort(),t.unitsPerEm=n.parseUShort(),t.created=n.parseLongDateTime(),t.modified=n.parseLongDateTime(),t.xMin=n.parseShort(),t.yMin=n.parseShort(),t.xMax=n.parseShort(),t.yMax=n.parseShort(),t.macStyle=n.parseUShort(),t.lowestRecPPEM=n.parseUShort(),t.fontDirectionHint=n.parseShort(),t.indexToLocFormat=n.parseShort(),t.glyphDataFormat=n.parseShort(),t}function MM(i){const e=Math.round(new Date().getTime()/1e3)+2082844800;let t=e;return i.createdTimestamp&&(t=i.createdTimestamp+2082844800),new oe.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:t},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],i)}const gp={parse:SM,make:MM};function TM(i,e){const t={},n=new ne.Parser(i,e);return t.version=n.parseVersion(),t.ascender=n.parseShort(),t.descender=n.parseShort(),t.lineGap=n.parseShort(),t.advanceWidthMax=n.parseUShort(),t.minLeftSideBearing=n.parseShort(),t.minRightSideBearing=n.parseShort(),t.xMaxExtent=n.parseShort(),t.caretSlopeRise=n.parseShort(),t.caretSlopeRun=n.parseShort(),t.caretOffset=n.parseShort(),n.relativeOffset+=8,t.metricDataFormat=n.parseShort(),t.numberOfHMetrics=n.parseUShort(),t}function BM(i){return new oe.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],i)}const yp={parse:TM,make:BM};function _M(i,e,t,n,s){let o,r;const a=new ne.Parser(i,e);for(let l=0;l<n;l+=1){l<t&&(o=a.parseUShort(),r=a.parseShort());const c=s.get(l);c.advanceWidth=o,c.leftSideBearing=r}}function kM(i){const e=new oe.Table("hmtx",[]);for(let t=0;t<i.length;t+=1){const n=i.get(t),s=n.advanceWidth||0,o=n.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+t,type:"USHORT",value:s}),e.fields.push({name:"leftSideBearing_"+t,type:"SHORT",value:o})}return e}const Ap={parse:_M,make:kM};function PM(i){const e=new oe.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:i.length}]);let t="";const n=12+i.length*4;for(let s=0;s<i.length;++s){let o=t.indexOf(i[s]);o<0&&(o=t.length,t+=i[s]),e.fields.push({name:"offset "+s,type:"USHORT",value:n+o}),e.fields.push({name:"length "+s,type:"USHORT",value:i[s].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),e}function DM(i,e){const t=new ne.Parser(i,e),n=t.parseULong();ue.argument(n===1,"Unsupported ltag table version."),t.skip("uLong",1);const s=t.parseULong(),o=[];for(let r=0;r<s;r++){let a="";const l=e+t.parseUShort(),c=t.parseUShort();for(let h=l;h<l+c;++h)a+=String.fromCharCode(i.getInt8(h));o.push(a)}return o}const vp={make:PM,parse:DM};function NM(i,e){const t={},n=new ne.Parser(i,e);return t.version=n.parseVersion(),t.numGlyphs=n.parseUShort(),t.version===1&&(t.maxPoints=n.parseUShort(),t.maxContours=n.parseUShort(),t.maxCompositePoints=n.parseUShort(),t.maxCompositeContours=n.parseUShort(),t.maxZones=n.parseUShort(),t.maxTwilightPoints=n.parseUShort(),t.maxStorage=n.parseUShort(),t.maxFunctionDefs=n.parseUShort(),t.maxInstructionDefs=n.parseUShort(),t.maxStackElements=n.parseUShort(),t.maxSizeOfInstructions=n.parseUShort(),t.maxComponentElements=n.parseUShort(),t.maxComponentDepth=n.parseUShort()),t}function LM(i){return new oe.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:i}])}const bp={parse:NM,make:LM},wp=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Cp={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},RM={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Ep={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function FM(i,e,t){switch(i){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return Cp[e];case 3:return Ep[e]}}const ec="utf-16",OM={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},GM={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function xp(i,e,t){switch(i){case 0:return ec;case 1:return GM[t]||OM[e];case 3:if(e===1||e===10)return ec;break}}function UM(i,e,t){const n={},s=new ne.Parser(i,e),o=s.parseUShort(),r=s.parseUShort(),a=s.offset+s.parseUShort();for(let l=0;l<r;l++){const c=s.parseUShort(),h=s.parseUShort(),u=s.parseUShort(),p=s.parseUShort(),f=wp[p]||p,m=s.parseUShort(),y=s.parseUShort(),g=FM(c,u,t),A=xp(c,h,u);if(A!==void 0&&g!==void 0){let v;if(A===ec?v=Vn.UTF16(i,a+y,m):v=Vn.MACSTRING(i,a+y,m,A),v){let b=n[f];b===void 0&&(b=n[f]={}),b[g]=v}}}return o===1&&s.parseUShort(),n}function tc(i){const e={};for(let t in i)e[i[t]]=parseInt(t);return e}function Ip(i,e,t,n,s,o){return new oe.Record("NameRecord",[{name:"platformID",type:"USHORT",value:i},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:t},{name:"nameID",type:"USHORT",value:n},{name:"length",type:"USHORT",value:s},{name:"offset",type:"USHORT",value:o}])}function VM(i,e){const t=i.length,n=e.length-t+1;e:for(let s=0;s<n;s++)for(;s<n;s++){for(let o=0;o<t;o++)if(e[s+o]!==i[o])continue e;return s}return-1}function Sp(i,e){let t=VM(i,e);if(t<0){t=e.length;let n=0;const s=i.length;for(;n<s;++n)e.push(i[n])}return t}function QM(i,e){let t;const n=[],s={},o=tc(wp);for(let u in i){let p=o[u];if(p===void 0&&(p=u),t=parseInt(p),isNaN(t))throw new Error('Name table entry "'+u+'" does not exist, see nameTableNames for complete list.');s[t]=i[u],n.push(t)}const r=tc(Cp),a=tc(Ep),l=[],c=[];for(let u=0;u<n.length;u++){t=n[u];const p=s[t];for(let f in p){const m=p[f];let y=1,g=r[f],A=RM[g];const v=xp(y,A,g);let b=J.MACSTRING(m,v);b===void 0&&(y=0,g=e.indexOf(f),g<0&&(g=e.length,e.push(f)),A=4,b=J.UTF16(m));const C=Sp(b,c);l.push(Ip(y,A,g,t,b.length,C));const x=a[f];if(x!==void 0){const I=J.UTF16(m),E=Sp(I,c);l.push(Ip(3,1,x,t,I.length,E))}}}l.sort(function(u,p){return u.platformID-p.platformID||u.encodingID-p.encodingID||u.languageID-p.languageID||u.nameID-p.nameID});const h=new oe.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:l.length},{name:"stringOffset",type:"USHORT",value:6+l.length*12}]);for(let u=0;u<l.length;u++)h.fields.push({name:"record_"+u,type:"RECORD",value:l[u]});return h.fields.push({name:"strings",type:"LITERAL",value:c}),h}const Mp={parse:UM,make:QM},ic=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function zM(i){for(let e=0;e<ic.length;e+=1){const t=ic[e];if(i>=t.begin&&i<t.end)return e}return-1}function HM(i,e){const t={},n=new ne.Parser(i,e);t.version=n.parseUShort(),t.xAvgCharWidth=n.parseShort(),t.usWeightClass=n.parseUShort(),t.usWidthClass=n.parseUShort(),t.fsType=n.parseUShort(),t.ySubscriptXSize=n.parseShort(),t.ySubscriptYSize=n.parseShort(),t.ySubscriptXOffset=n.parseShort(),t.ySubscriptYOffset=n.parseShort(),t.ySuperscriptXSize=n.parseShort(),t.ySuperscriptYSize=n.parseShort(),t.ySuperscriptXOffset=n.parseShort(),t.ySuperscriptYOffset=n.parseShort(),t.yStrikeoutSize=n.parseShort(),t.yStrikeoutPosition=n.parseShort(),t.sFamilyClass=n.parseShort(),t.panose=[];for(let s=0;s<10;s++)t.panose[s]=n.parseByte();return t.ulUnicodeRange1=n.parseULong(),t.ulUnicodeRange2=n.parseULong(),t.ulUnicodeRange3=n.parseULong(),t.ulUnicodeRange4=n.parseULong(),t.achVendID=String.fromCharCode(n.parseByte(),n.parseByte(),n.parseByte(),n.parseByte()),t.fsSelection=n.parseUShort(),t.usFirstCharIndex=n.parseUShort(),t.usLastCharIndex=n.parseUShort(),t.sTypoAscender=n.parseShort(),t.sTypoDescender=n.parseShort(),t.sTypoLineGap=n.parseShort(),t.usWinAscent=n.parseUShort(),t.usWinDescent=n.parseUShort(),t.version>=1&&(t.ulCodePageRange1=n.parseULong(),t.ulCodePageRange2=n.parseULong()),t.version>=2&&(t.sxHeight=n.parseShort(),t.sCapHeight=n.parseShort(),t.usDefaultChar=n.parseUShort(),t.usBreakChar=n.parseUShort(),t.usMaxContent=n.parseUShort()),t}function YM(i){return new oe.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],i)}const nc={parse:HM,make:YM,unicodeRanges:ic,getUnicodeRange:zM};function $M(i,e){const t={},n=new ne.Parser(i,e);switch(t.version=n.parseVersion(),t.italicAngle=n.parseFixed(),t.underlinePosition=n.parseShort(),t.underlineThickness=n.parseShort(),t.isFixedPitch=n.parseULong(),t.minMemType42=n.parseULong(),t.maxMemType42=n.parseULong(),t.minMemType1=n.parseULong(),t.maxMemType1=n.parseULong(),t.version){case 1:t.names=sn.slice();break;case 2:t.numberOfGlyphs=n.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(let s=0;s<t.numberOfGlyphs;s++)t.glyphNameIndex[s]=n.parseUShort();t.names=[];for(let s=0;s<t.numberOfGlyphs;s++)if(t.glyphNameIndex[s]>=sn.length){const o=n.parseChar();t.names.push(n.parseString(o))}break;case 2.5:t.numberOfGlyphs=n.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(let s=0;s<t.numberOfGlyphs;s++)t.offset[s]=n.parseChar();break}return t}function jM(){return new oe.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}const Tp={parse:$M,make:jM},Gt=new Array(9);Gt[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(H.coverage),deltaGlyphId:this.parseUShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(H.coverage),substitute:this.parseOffset16List()};ue.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},Gt[2]=function(){const e=this.parseUShort();return ue.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),sequences:this.parseListOfLists()}},Gt[3]=function(){const e=this.parseUShort();return ue.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),alternateSets:this.parseListOfLists()}},Gt[4]=function(){const e=this.parseUShort();return ue.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};const zn={sequenceIndex:H.uShort,lookupListIndex:H.uShort};Gt[5]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(H.coverage),ruleSets:this.parseListOfLists(function(){const n=this.parseUShort(),s=this.parseUShort();return{input:this.parseUShortList(n-1),lookupRecords:this.parseRecordList(s,zn)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(H.coverage),classDef:this.parsePointer(H.classDef),classSets:this.parseListOfLists(function(){const n=this.parseUShort(),s=this.parseUShort();return{classes:this.parseUShortList(n-1),lookupRecords:this.parseRecordList(s,zn)}})};if(t===3){const n=this.parseUShort(),s=this.parseUShort();return{substFormat:t,coverages:this.parseList(n,H.pointer(H.coverage)),lookupRecords:this.parseRecordList(s,zn)}}ue.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Gt[6]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(H.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(zn)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(H.coverage),backtrackClassDef:this.parsePointer(H.classDef),inputClassDef:this.parsePointer(H.classDef),lookaheadClassDef:this.parsePointer(H.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(zn)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(H.pointer(H.coverage)),inputCoverage:this.parseList(H.pointer(H.coverage)),lookaheadCoverage:this.parseList(H.pointer(H.coverage)),lookupRecords:this.parseRecordList(zn)};ue.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Gt[7]=function(){const e=this.parseUShort();ue.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");const t=this.parseUShort(),n=new H(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:Gt[t].call(n)}},Gt[8]=function(){const e=this.parseUShort();return ue.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),backtrackCoverage:this.parseList(H.pointer(H.coverage)),lookaheadCoverage:this.parseList(H.pointer(H.coverage)),substitutes:this.parseUShortList()}};function WM(i,e){e=e||0;const t=new H(i,e),n=t.parseVersion(1);return ue.argument(n===1||n===1.1,"Unsupported GSUB table version."),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Gt)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Gt),variations:t.parseFeatureVariationsList()}}const Dr=new Array(9);Dr[1]=function(e){return e.substFormat===1?new oe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new oe.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new oe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new oe.Coverage(e.coverage)}].concat(oe.ushortList("substitute",e.substitute)))},Dr[3]=function(e){return ue.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new oe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new oe.Coverage(e.coverage)}].concat(oe.tableList("altSet",e.alternateSets,function(t){return new oe.Table("alternateSetTable",oe.ushortList("alternate",t))})))},Dr[4]=function(e){return ue.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new oe.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new oe.Coverage(e.coverage)}].concat(oe.tableList("ligSet",e.ligatureSets,function(t){return new oe.Table("ligatureSetTable",oe.tableList("ligature",t,function(n){return new oe.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:n.ligGlyph}].concat(oe.ushortList("component",n.components,n.components.length+1)))}))})))};function qM(i){return new oe.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new oe.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new oe.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new oe.LookupList(i.lookups,Dr)}])}const Bp={parse:WM,make:qM};function KM(i,e){const t=new ne.Parser(i,e),n=t.parseULong();ue.argument(n===1,"Unsupported META table version."),t.parseULong(),t.parseULong();const s=t.parseULong(),o={};for(let r=0;r<s;r++){const a=t.parseTag(),l=t.parseULong(),c=t.parseULong(),h=Vn.UTF8(i,e+l,c);o[a]=h}return o}function XM(i){const e=Object.keys(i).length;let t="";const n=16+e*12,s=new oe.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:n},{name:"numTags",type:"ULONG",value:e}]);for(let o in i){const r=t.length;t+=i[o],s.fields.push({name:"tag "+o,type:"TAG",value:o}),s.fields.push({name:"offset "+o,type:"ULONG",value:n+r}),s.fields.push({name:"length "+o,type:"ULONG",value:i[o].length})}return s.fields.push({name:"stringPool",type:"CHARARRAY",value:t}),s}const _p={parse:KM,make:XM};function kp(i){return Math.log(i)/Math.log(2)|0}function sc(i){for(;i.length%4!==0;)i.push(0);let e=0;for(let t=0;t<i.length;t+=4)e+=(i[t]<<24)+(i[t+1]<<16)+(i[t+2]<<8)+i[t+3];return e%=Math.pow(2,32),e}function Pp(i,e,t,n){return new oe.Record("Table Record",[{name:"tag",type:"TAG",value:i!==void 0?i:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:t!==void 0?t:0},{name:"length",type:"ULONG",value:n!==void 0?n:0}])}function Dp(i){const e=new oe.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=i,e.numTables=i.length;const t=Math.pow(2,kp(e.numTables));e.searchRange=16*t,e.entrySelector=kp(t),e.rangeShift=e.numTables*16-e.searchRange;const n=[],s=[];let o=e.sizeOf()+Pp().sizeOf()*e.numTables;for(;o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0});for(let r=0;r<i.length;r+=1){const a=i[r];ue.argument(a.tableName.length===4,"Table name"+a.tableName+" is invalid.");const l=a.sizeOf(),c=Pp(a.tableName,sc(a.encode()),o,l);for(n.push({name:c.tag+" Table Record",type:"RECORD",value:c}),s.push({name:a.tableName+" table",type:"RECORD",value:a}),o+=l,ue.argument(!isNaN(o),"Something went wrong calculating the offset.");o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0})}return n.sort(function(r,a){return r.value.tag>a.value.tag?1:-1}),e.fields=e.fields.concat(n),e.fields=e.fields.concat(s),e}function Np(i,e,t){for(let n=0;n<e.length;n+=1){const s=i.charToGlyphIndex(e[n]);if(s>0)return i.glyphs.get(s).getMetrics()}return t}function JM(i){let e=0;for(let t=0;t<i.length;t+=1)e+=i[t];return e/i.length}function ZM(i){const e=[],t=[],n=[],s=[],o=[],r=[],a=[];let l,c=0,h=0,u=0,p=0,f=0;for(let R=0;R<i.glyphs.length;R+=1){const N=i.glyphs.get(R),O=N.unicode|0;if(isNaN(N.advanceWidth))throw new Error("Glyph "+N.name+" ("+R+"): advanceWidth is not a number.");(l>O||l===void 0)&&O>0&&(l=O),c<O&&(c=O);const z=nc.getUnicodeRange(O);if(z<32)h|=1<<z;else if(z<64)u|=1<<z-32;else if(z<96)p|=1<<z-64;else if(z<123)f|=1<<z-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(N.name===".notdef")continue;const j=N.getMetrics();e.push(j.xMin),t.push(j.yMin),n.push(j.xMax),s.push(j.yMax),r.push(j.leftSideBearing),a.push(j.rightSideBearing),o.push(N.advanceWidth)}const m={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,n),yMax:Math.max.apply(null,s),advanceWidthMax:Math.max.apply(null,o),advanceWidthAvg:JM(o),minLeftSideBearing:Math.min.apply(null,r),maxLeftSideBearing:Math.max.apply(null,r),minRightSideBearing:Math.min.apply(null,a)};m.ascender=i.ascender,m.descender=i.descender;const y=gp.make({flags:3,unitsPerEm:i.unitsPerEm,xMin:m.xMin,yMin:m.yMin,xMax:m.xMax,yMax:m.yMax,lowestRecPPEM:3,createdTimestamp:i.createdTimestamp}),g=yp.make({ascender:m.ascender,descender:m.descender,advanceWidthMax:m.advanceWidthMax,minLeftSideBearing:m.minLeftSideBearing,minRightSideBearing:m.minRightSideBearing,xMaxExtent:m.maxLeftSideBearing+(m.xMax-m.xMin),numberOfHMetrics:i.glyphs.length}),A=bp.make(i.glyphs.length),v=nc.make({xAvgCharWidth:Math.round(m.advanceWidthAvg),usWeightClass:i.tables.os2.usWeightClass,usWidthClass:i.tables.os2.usWidthClass,usFirstCharIndex:l,usLastCharIndex:c,ulUnicodeRange1:h,ulUnicodeRange2:u,ulUnicodeRange3:p,ulUnicodeRange4:f,fsSelection:i.tables.os2.fsSelection,sTypoAscender:m.ascender,sTypoDescender:m.descender,sTypoLineGap:0,usWinAscent:m.yMax,usWinDescent:Math.abs(m.yMin),ulCodePageRange1:1,sxHeight:Np(i,"xyvw",{yMax:Math.round(m.ascender/2)}).yMax,sCapHeight:Np(i,"HIKLEFJMNTZBDPRAGOQSUVWXY",m).yMax,usDefaultChar:i.hasChar(" ")?32:0,usBreakChar:i.hasChar(" ")?32:0}),b=Ap.make(i.glyphs),C=tp.make(i.glyphs),x=i.getEnglishName("fontFamily"),I=i.getEnglishName("fontSubfamily"),E=x+" "+I;let S=i.getEnglishName("postScriptName");S||(S=x.replace(/\s/g,"")+"-"+I);const w={};for(let R in i.names)w[R]=i.names[R];w.uniqueID||(w.uniqueID={en:i.getEnglishName("manufacturer")+":"+E}),w.postScriptName||(w.postScriptName={en:S}),w.preferredFamily||(w.preferredFamily=i.names.fontFamily),w.preferredSubfamily||(w.preferredSubfamily=i.names.fontSubfamily);const T=[],_=Mp.make(w,T),F=T.length>0?vp.make(T):void 0,U=Tp.make(),L=mp.make(i.glyphs,{version:i.getEnglishName("version"),fullName:E,familyName:x,weightName:I,postScriptName:S,unitsPerEm:i.unitsPerEm,fontBBox:[0,m.yMin,m.ascender,m.advanceWidthMax]}),D=i.metas&&Object.keys(i.metas).length>0?_p.make(i.metas):void 0,M=[y,g,A,v,_,C,U,L,b];F&&M.push(F),i.tables.gsub&&M.push(Bp.make(i.tables.gsub)),D&&M.push(D);const k=Dp(M),B=k.encode(),P=sc(B),V=k.fields;let G=!1;for(let R=0;R<V.length;R+=1)if(V[R].name==="head table"){V[R].value.checkSumAdjustment=2981146554-P,G=!0;break}if(!G)throw new Error("Could not find head table with checkSum to adjust.");return k}const eT={make:Dp,fontToTable:ZM,computeCheckSum:sc};function oc(i,e){let t=0,n=i.length-1;for(;t<=n;){const s=t+n>>>1,o=i[s].tag;if(o===e)return s;o<e?t=s+1:n=s-1}return-t-1}function Lp(i,e){let t=0,n=i.length-1;for(;t<=n;){const s=t+n>>>1,o=i[s];if(o===e)return s;o<e?t=s+1:n=s-1}return-t-1}function Rp(i,e){let t,n=0,s=i.length-1;for(;n<=s;){const o=n+s>>>1;t=i[o];const r=t.start;if(r===e)return t;r<e?n=o+1:s=o-1}if(n>0)return t=i[n-1],e>t.end?0:t}function Zs(i,e){this.font=i,this.tableName=e}Zs.prototype={searchTag:oc,binSearch:Lp,getTable:function(i){let e=this.font.tables[this.tableName];return!e&&i&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){let i=this.getTable();return i?i.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){let i=this.getTable();if(!i)return;let e=!1;for(let t=0;t<i.scripts.length;t++){const n=i.scripts[t].tag;if(n==="DFLT")return n;n==="latn"&&(e=!0)}if(e)return"latn"},getScriptTable:function(i,e){const t=this.getTable(e);if(t){i=i||"DFLT";const n=t.scripts,s=oc(t.scripts,i);if(s>=0)return n[s].script;if(e){const o={tag:i,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return n.splice(-1-s,0,o),o.script}}},getLangSysTable:function(i,e,t){const n=this.getScriptTable(i,t);if(n){if(!e||e==="dflt"||e==="DFLT")return n.defaultLangSys;const s=oc(n.langSysRecords,e);if(s>=0)return n.langSysRecords[s].langSys;if(t){const o={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return n.langSysRecords.splice(-1-s,0,o),o.langSys}}},getFeatureTable:function(i,e,t,n){const s=this.getLangSysTable(i,e,n);if(s){let o;const r=s.featureIndexes,a=this.font.tables[this.tableName].features;for(let l=0;l<r.length;l++)if(o=a[r[l]],o.tag===t)return o.feature;if(n){const l=a.length;return ue.assert(l===0||t>=a[l-1].tag,"Features must be added in alphabetical order."),o={tag:t,feature:{params:0,lookupListIndexes:[]}},a.push(o),r.push(l),o.feature}}},getLookupTables:function(i,e,t,n,s){const o=this.getFeatureTable(i,e,t,s),r=[];if(o){let a;const l=o.lookupListIndexes,c=this.font.tables[this.tableName].lookups;for(let h=0;h<l.length;h++)a=c[l[h]],a.lookupType===n&&r.push(a);if(r.length===0&&s){a={lookupType:n,lookupFlag:0,subtables:[],markFilteringSet:void 0};const h=c.length;return c.push(a),l.push(h),[a]}}return r},getGlyphClass:function(i,e){switch(i.format){case 1:return i.startGlyph<=e&&e<i.startGlyph+i.classes.length?i.classes[e-i.startGlyph]:0;case 2:const t=Rp(i.ranges,e);return t?t.classId:0}},getCoverageIndex:function(i,e){switch(i.format){case 1:const t=Lp(i.glyphs,e);return t>=0?t:-1;case 2:const n=Rp(i.ranges,e);return n?n.index+e-n.start:-1}},expandCoverage:function(i){if(i.format===1)return i.glyphs;{const e=[],t=i.ranges;for(let n=0;n<t.length;n++){const s=t[n],o=s.start,r=s.end;for(let a=o;a<=r;a++)e.push(a)}return e}}};function eo(i){Zs.call(this,i,"gpos")}eo.prototype=Zs.prototype,eo.prototype.init=function(){const i=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(i)},eo.prototype.getKerningValue=function(i,e,t){for(let n=0;n<i.length;n++){const s=i[n].subtables;for(let o=0;o<s.length;o++){const r=s[o],a=this.getCoverageIndex(r.coverage,e);if(!(a<0))switch(r.posFormat){case 1:let l=r.pairSets[a];for(let p=0;p<l.length;p++){let f=l[p];if(f.secondGlyph===t)return f.value1&&f.value1.xAdvance||0}break;case 2:const c=this.getGlyphClass(r.classDef1,e),h=this.getGlyphClass(r.classDef2,t),u=r.classRecords[c][h];return u.value1&&u.value1.xAdvance||0}}}return 0},eo.prototype.getKerningTables=function(i,e){if(this.font.tables.gpos)return this.getLookupTables(i,e,"kern",2)};function Ut(i){Zs.call(this,i,"gsub")}function tT(i,e){const t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function Fp(i,e,t){const n=i.subtables;for(let s=0;s<n.length;s++){const o=n[s];if(o.substFormat===e)return o}if(t)return n.push(t),t}Ut.prototype=Zs.prototype,Ut.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ut.prototype.getSingle=function(i,e,t){const n=[],s=this.getLookupTables(e,t,i,1);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let a=0;a<r.length;a++){const l=r[a],c=this.expandCoverage(l.coverage);let h;if(l.substFormat===1){const u=l.deltaGlyphId;for(h=0;h<c.length;h++){const p=c[h];n.push({sub:p,by:p+u})}}else{const u=l.substitute;for(h=0;h<c.length;h++)n.push({sub:c[h],by:u[h]})}}}return n},Ut.prototype.getAlternates=function(i,e,t){const n=[],s=this.getLookupTables(e,t,i,3);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let a=0;a<r.length;a++){const l=r[a],c=this.expandCoverage(l.coverage),h=l.alternateSets;for(let u=0;u<c.length;u++)n.push({sub:c[u],by:h[u]})}}return n},Ut.prototype.getLigatures=function(i,e,t){const n=[],s=this.getLookupTables(e,t,i,4);for(let o=0;o<s.length;o++){const r=s[o].subtables;for(let a=0;a<r.length;a++){const l=r[a],c=this.expandCoverage(l.coverage),h=l.ligatureSets;for(let u=0;u<c.length;u++){const p=c[u],f=h[u];for(let m=0;m<f.length;m++){const y=f[m];n.push({sub:[p].concat(y.components),by:y.ligGlyph})}}}}return n},Ut.prototype.addSingle=function(i,e,t,n){const s=this.getLookupTables(t,n,i,1,!0)[0],o=Fp(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ue.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let a=this.binSearch(o.coverage.glyphs,r);a<0&&(a=-1-a,o.coverage.glyphs.splice(a,0,r),o.substitute.splice(a,0,0)),o.substitute[a]=e.by},Ut.prototype.addAlternate=function(i,e,t,n){const s=this.getLookupTables(t,n,i,3,!0)[0],o=Fp(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ue.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let a=this.binSearch(o.coverage.glyphs,r);a<0&&(a=-1-a,o.coverage.glyphs.splice(a,0,r),o.alternateSets.splice(a,0,0)),o.alternateSets[a]=e.by},Ut.prototype.addLigature=function(i,e,t,n){const s=this.getLookupTables(t,n,i,4,!0)[0];let o=s.subtables[0];o||(o={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},s.subtables[0]=o),ue.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub[0],a=e.sub.slice(1),l={ligGlyph:e.by,components:a};let c=this.binSearch(o.coverage.glyphs,r);if(c>=0){const h=o.ligatureSets[c];for(let u=0;u<h.length;u++)if(tT(h[u].components,a))return;h.push(l)}else c=-1-c,o.coverage.glyphs.splice(c,0,r),o.ligatureSets.splice(c,0,[l])},Ut.prototype.getFeature=function(i,e,t){if(/ss\d\d/.test(i))return this.getSingle(i,e,t);switch(i){case"aalt":case"salt":return this.getSingle(i,e,t).concat(this.getAlternates(i,e,t));case"dlig":case"liga":case"rlig":return this.getLigatures(i,e,t)}},Ut.prototype.add=function(i,e,t,n){if(/ss\d\d/.test(i))return this.addSingle(i,e,t,n);switch(i){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(i,e,t,n):this.addAlternate(i,e,t,n);case"dlig":case"liga":case"rlig":return this.addLigature(i,e,t,n)}};function iT(){return typeof window<"u"}function nT(i){const e=new ArrayBuffer(i.length),t=new Uint8Array(e);for(let n=0;n<i.length;++n)t[n]=i[n];return e}function sT(i){const e=new Buffer(i.byteLength),t=new Uint8Array(i);for(let n=0;n<e.length;++n)e[n]=t[n];return e}function Hn(i,e){if(!i)throw e}function Op(i,e,t,n,s){let o;return(e&n)>0?(o=i.parseByte(),(e&s)===0&&(o=-o),o=t+o):(e&s)>0?o=t:o=t+i.parseShort(),o}function oT(i,e,t){const n=new ne.Parser(e,t);i.numberOfContours=n.parseShort(),i._xMin=n.parseShort(),i._yMin=n.parseShort(),i._xMax=n.parseShort(),i._yMax=n.parseShort();let s,o;if(i.numberOfContours>0){const r=i.endPointIndices=[];for(let l=0;l<i.numberOfContours;l+=1)r.push(n.parseUShort());i.instructionLength=n.parseUShort(),i.instructions=[];for(let l=0;l<i.instructionLength;l+=1)i.instructions.push(n.parseByte());const a=r[r.length-1]+1;s=[];for(let l=0;l<a;l+=1)if(o=n.parseByte(),s.push(o),(o&8)>0){const c=n.parseByte();for(let h=0;h<c;h+=1)s.push(o),l+=1}if(ue.argument(s.length===a,"Bad flags."),r.length>0){const l=[];let c;if(a>0){for(let p=0;p<a;p+=1)o=s[p],c={},c.onCurve=!!(o&1),c.lastPointOfContour=r.indexOf(p)>=0,l.push(c);let h=0;for(let p=0;p<a;p+=1)o=s[p],c=l[p],c.x=Op(n,o,h,2,16),h=c.x;let u=0;for(let p=0;p<a;p+=1)o=s[p],c=l[p],c.y=Op(n,o,u,4,32),u=c.y}i.points=l}else i.points=[]}else if(i.numberOfContours===0)i.points=[];else{i.isComposite=!0,i.points=[],i.components=[];let r=!0;for(;r;){s=n.parseUShort();const a={glyphIndex:n.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(a.dx=n.parseShort(),a.dy=n.parseShort()):a.matchedPoints=[n.parseUShort(),n.parseUShort()]:(s&2)>0?(a.dx=n.parseChar(),a.dy=n.parseChar()):a.matchedPoints=[n.parseByte(),n.parseByte()],(s&8)>0?a.xScale=a.yScale=n.parseF2Dot14():(s&64)>0?(a.xScale=n.parseF2Dot14(),a.yScale=n.parseF2Dot14()):(s&128)>0&&(a.xScale=n.parseF2Dot14(),a.scale01=n.parseF2Dot14(),a.scale10=n.parseF2Dot14(),a.yScale=n.parseF2Dot14()),i.components.push(a),r=!!(s&32)}if(s&256){i.instructionLength=n.parseUShort(),i.instructions=[];for(let a=0;a<i.instructionLength;a+=1)i.instructions.push(n.parseByte())}}}function rc(i,e){const t=[];for(let n=0;n<i.length;n+=1){const s=i[n],o={x:e.xScale*s.x+e.scale01*s.y+e.dx,y:e.scale10*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};t.push(o)}return t}function rT(i){const e=[];let t=[];for(let n=0;n<i.length;n+=1){const s=i[n];t.push(s),s.lastPointOfContour&&(e.push(t),t=[])}return ue.argument(t.length===0,"There are still points left in the current contour."),e}function Gp(i){const e=new Xe;if(!i)return e;const t=rT(i);for(let n=0;n<t.length;++n){const s=t[n];let o=null,r=s[s.length-1],a=s[0];if(r.onCurve)e.moveTo(r.x,r.y);else if(a.onCurve)e.moveTo(a.x,a.y);else{const l={x:(r.x+a.x)*.5,y:(r.y+a.y)*.5};e.moveTo(l.x,l.y)}for(let l=0;l<s.length;++l)if(o=r,r=a,a=s[(l+1)%s.length],r.onCurve)e.lineTo(r.x,r.y);else{let c=a;o.onCurve||((r.x+o.x)*.5,(r.y+o.y)*.5),a.onCurve||(c={x:(r.x+a.x)*.5,y:(r.y+a.y)*.5}),e.quadraticCurveTo(r.x,r.y,c.x,c.y)}e.closePath()}return e}function aT(i,e){if(e.isComposite)for(let t=0;t<e.components.length;t+=1){const n=e.components[t],s=i.get(n.glyphIndex);if(s.getPath(),s.points){let o;if(n.matchedPoints===void 0)o=rc(s.points,n);else{if(n.matchedPoints[0]>e.points.length-1||n.matchedPoints[1]>s.points.length-1)throw Error("Matched points out of range in "+e.name);const r=e.points[n.matchedPoints[0]];let a=s.points[n.matchedPoints[1]];const l={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};a=rc([a],l)[0],l.dx=r.x-a.x,l.dy=r.y-a.y,o=rc(s.points,l)}e.points=e.points.concat(o)}}return Gp(e.points)}function lT(i,e,t,n){const s=new Qn.GlyphSet(n);for(let o=0;o<t.length-1;o+=1){const r=t[o],a=t[o+1];r!==a?s.push(o,Qn.ttfGlyphLoader(n,o,oT,i,e+r,aT)):s.push(o,Qn.glyphLoader(n,o))}return s}const Up={getPath:Gp,parse:lT};let Vp,rn,Qp,ac;function zp(i){this.font=i,this.getCommands=function(e){return Up.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function cT(i){return i}function Hp(i){return Math.sign(i)*Math.round(Math.abs(i))}function dT(i){return Math.sign(i)*Math.round(Math.abs(i*2))/2}function hT(i){return Math.sign(i)*(Math.round(Math.abs(i)+.5)-.5)}function uT(i){return Math.sign(i)*Math.ceil(Math.abs(i))}function fT(i){return Math.sign(i)*Math.floor(Math.abs(i))}const Yp=function(i){const e=this.srPeriod;let t=this.srPhase;const n=this.srThreshold;let s=1;return i<0&&(i=-i,s=-1),i+=n-t,i=Math.trunc(i/e)*e,i+=t,i<0?t*s:i*s},Zt={x:1,y:0,axis:"x",distance:function(i,e,t,n){return(t?i.xo:i.x)-(n?e.xo:e.x)},interpolate:function(i,e,t,n){let s,o,r,a,l,c,h;if(!n||n===this){if(s=i.xo-e.xo,o=i.xo-t.xo,l=e.x-e.xo,c=t.x-t.xo,r=Math.abs(s),a=Math.abs(o),h=r+a,h===0){i.x=i.xo+(l+c)/2;return}i.x=i.xo+(l*a+c*r)/h;return}if(s=n.distance(i,e,!0,!0),o=n.distance(i,t,!0,!0),l=n.distance(e,e,!1,!0),c=n.distance(t,t,!1,!0),r=Math.abs(s),a=Math.abs(o),h=r+a,h===0){Zt.setRelative(i,i,(l+c)/2,n,!0);return}Zt.setRelative(i,i,(l*a+c*r)/h,n,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(i,e,t,n,s){if(!n||n===this){i.x=(s?e.xo:e.x)+t;return}const o=s?e.xo:e.x,r=s?e.yo:e.y,a=o+t*n.x,l=r+t*n.y;i.x=a+(i.y-l)/n.normalSlope},slope:0,touch:function(i){i.xTouched=!0},touched:function(i){return i.xTouched},untouch:function(i){i.xTouched=!1}},ui={x:0,y:1,axis:"y",distance:function(i,e,t,n){return(t?i.yo:i.y)-(n?e.yo:e.y)},interpolate:function(i,e,t,n){let s,o,r,a,l,c,h;if(!n||n===this){if(s=i.yo-e.yo,o=i.yo-t.yo,l=e.y-e.yo,c=t.y-t.yo,r=Math.abs(s),a=Math.abs(o),h=r+a,h===0){i.y=i.yo+(l+c)/2;return}i.y=i.yo+(l*a+c*r)/h;return}if(s=n.distance(i,e,!0,!0),o=n.distance(i,t,!0,!0),l=n.distance(e,e,!1,!0),c=n.distance(t,t,!1,!0),r=Math.abs(s),a=Math.abs(o),h=r+a,h===0){ui.setRelative(i,i,(l+c)/2,n,!0);return}ui.setRelative(i,i,(l*a+c*r)/h,n,!0)},normalSlope:0,setRelative:function(i,e,t,n,s){if(!n||n===this){i.y=(s?e.yo:e.y)+t;return}const o=s?e.xo:e.x,r=s?e.yo:e.y,a=o+t*n.x,l=r+t*n.y;i.y=l+n.normalSlope*(i.x-a)},slope:Number.POSITIVE_INFINITY,touch:function(i){i.yTouched=!0},touched:function(i){return i.yTouched},untouch:function(i){i.yTouched=!1}};Object.freeze(Zt),Object.freeze(ui);function to(i,e){this.x=i,this.y=e,this.axis=void 0,this.slope=e/i,this.normalSlope=-i/e,Object.freeze(this)}to.prototype.distance=function(i,e,t,n){return this.x*Zt.distance(i,e,t,n)+this.y*ui.distance(i,e,t,n)},to.prototype.interpolate=function(i,e,t,n){let s,o,r,a,l,c,h;if(r=n.distance(i,e,!0,!0),a=n.distance(i,t,!0,!0),s=n.distance(e,e,!1,!0),o=n.distance(t,t,!1,!0),l=Math.abs(r),c=Math.abs(a),h=l+c,h===0){this.setRelative(i,i,(s+o)/2,n,!0);return}this.setRelative(i,i,(s*c+o*l)/h,n,!0)},to.prototype.setRelative=function(i,e,t,n,s){n=n||this;const o=s?e.xo:e.x,r=s?e.yo:e.y,a=o+t*n.x,l=r+t*n.y,c=n.normalSlope,h=this.slope,u=i.x,p=i.y;i.x=(h*u-c*a+l-p)/(h-c),i.y=h*(i.x-u)+p},to.prototype.touch=function(i){i.xTouched=!0,i.yTouched=!0};function io(i,e){const t=Math.sqrt(i*i+e*e);return i/=t,e/=t,i===1&&e===0?Zt:i===0&&e===1?ui:new to(i,e)}function fi(i,e,t,n){this.x=this.xo=Math.round(i*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=t,this.onCurve=n,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}fi.prototype.nextTouched=function(i){let e=this.nextPointOnContour;for(;!i.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},fi.prototype.prevTouched=function(i){let e=this.prevPointOnContour;for(;!i.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};const no=Object.freeze(new fi(0,0)),pT={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Ni(i,e){switch(this.env=i,this.stack=[],this.prog=e,i){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Zt,this.round=Hp}}zp.prototype.exec=function(i,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;const t=this.font;let n=this._prepState;if(!n||n.ppem!==e){let s=this._fpgmState;if(!s){Ni.prototype=pT,s=this._fpgmState=new Ni("fpgm",t.tables.fpgm),s.funcs=[],s.font=t,Q.DEBUG&&(s.step=-1);try{rn(s)}catch(r){""+r,this._errorState=3;return}}Ni.prototype=s,n=this._prepState=new Ni("prep",t.tables.prep),n.ppem=e;const o=t.tables.cvt;if(o){const r=n.cvt=new Array(o.length),a=e/t.unitsPerEm;for(let l=0;l<o.length;l++)r[l]=o[l]*a}else n.cvt=[];Q.DEBUG&&(n.step=-1);try{rn(n)}catch(r){this._errorState<2&&""+r,this._errorState=2}}if(!(this._errorState>1))try{return Qp(i,n)}catch(s){this._errorState<1&&""+s,this._errorState=1;return}},Qp=function(i,e){const t=e.ppem/e.font.unitsPerEm,n=t;let s=i.components,o,r,a;if(Ni.prototype=e,!s)a=new Ni("glyf",i.instructions),Q.DEBUG&&(a.step=-1),ac(i,a,t,n),r=a.gZone;else{const l=e.font;r=[],o=[];for(let c=0;c<s.length;c++){const h=s[c],u=l.glyphs.get(h.glyphIndex);a=new Ni("glyf",u.instructions),Q.DEBUG&&(""+c,a.step=-1),ac(u,a,t,n);const p=Math.round(h.dx*t),f=Math.round(h.dy*n),m=a.gZone,y=a.contours;for(let A=0;A<m.length;A++){const v=m[A];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+p,v.yo=v.y=v.y+f}const g=r.length;r.push.apply(r,m);for(let A=0;A<y.length;A++)o.push(y[A]+g)}i.instructions&&!a.inhibitGridFit&&(a=new Ni("glyf",i.instructions),a.gZone=a.z0=a.z1=a.z2=r,a.contours=o,r.push(new fi(0,0),new fi(Math.round(i.advanceWidth*t),0)),Q.DEBUG&&(a.step=-1),rn(a),r.length-=2)}return r},ac=function(i,e,t,n){const s=i.points||[],o=s.length,r=e.gZone=e.z0=e.z1=e.z2=[],a=e.contours=[];let l;for(let u=0;u<o;u++)l=s[u],r[u]=new fi(l.x*t,l.y*n,l.lastPointOfContour,l.onCurve);let c,h;for(let u=0;u<o;u++)l=r[u],c||(c=l,a.push(u)),l.lastPointOfContour?(l.nextPointOnContour=c,c.prevPointOnContour=l,c=void 0):(h=r[u+1],l.nextPointOnContour=h,h.prevPointOnContour=l);if(!e.inhibitGridFit){if(Q.DEBUG){e.stack;for(let u=0;u<o;u++)r[u].x,r[u].y}if(r.push(new fi(0,0),new fi(Math.round(i.advanceWidth*t),0)),rn(e),r.length-=2,Q.DEBUG){e.stack;for(let u=0;u<o;u++)r[u].x,r[u].y}}},rn=function(i){let e=i.prog;if(!e)return;const t=e.length;let n;for(i.ip=0;i.ip<t;i.ip++){if(Q.DEBUG&&i.step++,n=Vp[e[i.ip]],!n)throw new Error("unknown instruction: 0x"+Number(e[i.ip]).toString(16));n(i)}};function Nr(i){const e=i.tZone=new Array(i.gZone.length);for(let t=0;t<e.length;t++)e[t]=new fi(0,0)}function $p(i,e){const t=i.prog;let n=i.ip,s=1,o;do if(o=t[++n],o===88)s++;else if(o===89)s--;else if(o===64)n+=t[n+1]+1;else if(o===65)n+=2*t[n+1]+1;else if(o>=176&&o<=183)n+=o-176+1;else if(o>=184&&o<=191)n+=(o-184+1)*2;else if(e&&s===1&&o===27)break;while(s>0);i.ip=n}function jp(i,e){Q.DEBUG&&(e.step,""+i.axis),e.fv=e.pv=e.dpv=i}function Wp(i,e){Q.DEBUG&&(e.step,""+i.axis),e.pv=e.dpv=i}function qp(i,e){Q.DEBUG&&(e.step,""+i.axis),e.fv=i}function Kp(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];Q.DEBUG&&""+i;let a,l;i?(a=o.y-r.y,l=r.x-o.x):(a=r.x-o.x,l=r.y-o.y),e.pv=e.dpv=io(a,l)}function Xp(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];Q.DEBUG&&""+i;let a,l;i?(a=o.y-r.y,l=r.x-o.x):(a=r.x-o.x,l=r.y-o.y),e.fv=io(a,l)}function mT(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,i.pv=i.dpv=io(n,t)}function gT(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,i.fv=io(n,t)}function yT(i){const e=i.stack,t=i.pv;Q.DEBUG&&i.step,e.push(t.x*16384),e.push(t.y*16384)}function AT(i){const e=i.stack,t=i.fv;Q.DEBUG&&i.step,e.push(t.x*16384),e.push(t.y*16384)}function vT(i){i.fv=i.pv,Q.DEBUG&&i.step}function bT(i){const e=i.stack,t=e.pop(),n=e.pop(),s=e.pop(),o=e.pop(),r=e.pop(),a=i.z0,l=i.z1,c=a[t],h=a[n],u=l[s],p=l[o],f=i.z2[r];Q.DEBUG;const m=c.x,y=c.y,g=h.x,A=h.y,v=u.x,b=u.y,C=p.x,x=p.y,I=(m-g)*(b-x)-(y-A)*(v-C),E=m*A-y*g,S=v*x-b*C;f.x=(E*(v-C)-S*(m-g))/I,f.y=(E*(b-x)-S*(y-A))/I}function wT(i){i.rp0=i.stack.pop(),Q.DEBUG&&(i.step,i.rp0)}function CT(i){i.rp1=i.stack.pop(),Q.DEBUG&&(i.step,i.rp1)}function ET(i){i.rp2=i.stack.pop(),Q.DEBUG&&(i.step,i.rp2)}function xT(i){const e=i.stack.pop();switch(Q.DEBUG&&i.step,i.zp0=e,e){case 0:i.tZone||Nr(i),i.z0=i.tZone;break;case 1:i.z0=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function IT(i){const e=i.stack.pop();switch(Q.DEBUG&&i.step,i.zp1=e,e){case 0:i.tZone||Nr(i),i.z1=i.tZone;break;case 1:i.z1=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function ST(i){const e=i.stack.pop();switch(Q.DEBUG&&i.step,i.zp2=e,e){case 0:i.tZone||Nr(i),i.z2=i.tZone;break;case 1:i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function MT(i){const e=i.stack.pop();switch(Q.DEBUG&&i.step,i.zp0=i.zp1=i.zp2=e,e){case 0:i.tZone||Nr(i),i.z0=i.z1=i.z2=i.tZone;break;case 1:i.z0=i.z1=i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function TT(i){i.loop=i.stack.pop(),Q.DEBUG&&(i.step,i.loop)}function BT(i){Q.DEBUG&&i.step,i.round=Hp}function _T(i){Q.DEBUG&&i.step,i.round=hT}function kT(i){const e=i.stack.pop();Q.DEBUG&&i.step,i.minDis=e/64}function PT(i){Q.DEBUG&&i.step,$p(i,!1)}function DT(i){const e=i.stack.pop();Q.DEBUG&&i.step,i.ip+=e-1}function NT(i){const e=i.stack.pop();Q.DEBUG&&i.step,i.cvCutIn=e/64}function LT(i){const e=i.stack;Q.DEBUG&&i.step,e.push(e[e.length-1])}function lc(i){Q.DEBUG&&i.step,i.stack.pop()}function RT(i){Q.DEBUG&&i.step,i.stack.length=0}function FT(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(t),e.push(n)}function OT(i){const e=i.stack;Q.DEBUG&&i.step,e.push(e.length)}function GT(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step;const s=i.ip,o=i.prog;i.prog=i.funcs[t];for(let r=0;r<n;r++)rn(i),Q.DEBUG&&(++i.step,r+1<n);i.ip=s,i.prog=o}function UT(i){const e=i.stack.pop();Q.DEBUG&&i.step;const t=i.ip,n=i.prog;i.prog=i.funcs[e],rn(i),i.ip=t,i.prog=n,Q.DEBUG&&++i.step}function VT(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(e[e.length-t])}function QT(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(e.splice(e.length-t,1)[0])}function zT(i){if(i.env!=="fpgm")throw new Error("FDEF not allowed here");const e=i.stack,t=i.prog;let n=i.ip;const s=e.pop(),o=n;for(Q.DEBUG&&i.step;t[++n]!==45;);i.ip=n,i.funcs[s]=t.slice(o+1,n)}function Jp(i,e){const t=e.stack.pop(),n=e.z0[t],s=e.fv,o=e.pv;Q.DEBUG&&(e.step,""+i);let r=o.distance(n,no);i&&(r=e.round(r)),s.setRelative(n,no,r,o),s.touch(n),e.rp0=e.rp1=t}function Zp(i,e){const t=e.z2,n=t.length-2;let s,o,r;Q.DEBUG&&(e.step,""+i.axis);for(let a=0;a<n;a++)s=t[a],!i.touched(s)&&(o=s.prevTouched(i),o!==s&&(r=s.nextTouched(i),o===r&&i.setRelative(s,s,i.distance(o,o,!1,!0),i,!0),i.interpolate(s,o,r,i)))}function em(i,e){const t=e.stack,n=i?e.rp1:e.rp2,s=(i?e.z0:e.z1)[n],o=e.fv,r=e.pv;let a=e.loop;const l=e.z2;for(;a--;){const c=t.pop(),h=l[c],u=r.distance(s,s,!1,!0);o.setRelative(h,h,u,r),o.touch(h),Q.DEBUG&&(e.step,(e.loop>1?"loop "+(e.loop-a)+": ":"")+""+(i?"rp1":"rp2"))}e.loop=1}function tm(i,e){const t=e.stack,n=i?e.rp1:e.rp2,s=(i?e.z0:e.z1)[n],o=e.fv,r=e.pv,a=t.pop(),l=e.z2[e.contours[a]];let c=l;Q.DEBUG&&(e.step,""+i);const h=r.distance(s,s,!1,!0);do c!==s&&o.setRelative(c,c,h,r),c=c.nextPointOnContour;while(c!==l)}function im(i,e){const t=e.stack,n=i?e.rp1:e.rp2,s=(i?e.z0:e.z1)[n],o=e.fv,r=e.pv,a=t.pop();Q.DEBUG&&(e.step,""+i);let l;switch(a){case 0:l=e.tZone;break;case 1:l=e.gZone;break;default:throw new Error("Invalid zone")}let c;const h=r.distance(s,s,!1,!0),u=l.length-2;for(let p=0;p<u;p++)c=l[p],o.setRelative(c,c,h,r)}function HT(i){const e=i.stack;let t=i.loop;const n=i.fv,s=e.pop()/64,o=i.z2;for(;t--;){const r=e.pop(),a=o[r];Q.DEBUG&&(i.step,(i.loop>1?"loop "+(i.loop-t)+": ":"")+""),n.setRelative(a,a,s),n.touch(a)}i.loop=1}function YT(i){const e=i.stack,t=i.rp1,n=i.rp2;let s=i.loop;const o=i.z0[t],r=i.z1[n],a=i.fv,l=i.dpv,c=i.z2;for(;s--;){const h=e.pop(),u=c[h];Q.DEBUG&&(i.step,(i.loop>1?"loop "+(i.loop-s)+": ":"")+""),a.interpolate(u,o,r,l),a.touch(u)}i.loop=1}function nm(i,e){const t=e.stack,n=t.pop()/64,s=t.pop(),o=e.z1[s],r=e.z0[e.rp0],a=e.fv,l=e.pv;a.setRelative(o,r,n,l),a.touch(o),Q.DEBUG&&(e.step,""+i),e.rp1=e.rp0,e.rp2=s,i&&(e.rp0=s)}function $T(i){const e=i.stack,t=i.rp0,n=i.z0[t];let s=i.loop;const o=i.fv,r=i.pv,a=i.z1;for(;s--;){const l=e.pop(),c=a[l];Q.DEBUG&&(i.step,(i.loop>1?"loop "+(i.loop-s)+": ":"")+""),o.setRelative(c,n,0,r),o.touch(c)}i.loop=1}function jT(i){Q.DEBUG&&i.step,i.round=dT}function sm(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z0[s],r=e.fv,a=e.pv;let l=e.cvt[n];Q.DEBUG&&(e.step,""+i);let c=a.distance(o,no);i&&(Math.abs(c-l)<e.cvCutIn&&(c=l),c=e.round(c)),r.setRelative(o,no,c,a),e.zp0===0&&(o.xo=o.x,o.yo=o.y),r.touch(o),e.rp0=e.rp1=s}function WT(i){const e=i.prog;let t=i.ip;const n=i.stack,s=e[++t];Q.DEBUG&&i.step;for(let o=0;o<s;o++)n.push(e[++t]);i.ip=t}function qT(i){let e=i.ip;const t=i.prog,n=i.stack,s=t[++e];Q.DEBUG&&i.step;for(let o=0;o<s;o++){let r=t[++e]<<8|t[++e];r&32768&&(r=-((r^65535)+1)),n.push(r)}i.ip=e}function KT(i){const e=i.stack;let t=i.store;t||(t=i.store=[]);const n=e.pop(),s=e.pop();Q.DEBUG&&i.step,t[s]=n}function XT(i){const e=i.stack,t=i.store,n=e.pop();Q.DEBUG&&i.step;const s=t&&t[n]||0;e.push(s)}function JT(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,i.cvt[n]=t/64}function ZT(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(i.cvt[t]*64)}function om(i,e){const t=e.stack,n=t.pop(),s=e.z2[n];Q.DEBUG&&(e.step,""+i),t.push(e.dpv.distance(s,no,i,!1)*64)}function rm(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z1[n],r=e.z0[s],a=e.dpv.distance(r,o,i,i);Q.DEBUG&&(e.step,""+i),e.stack.push(Math.round(a*64))}function e4(i){Q.DEBUG&&i.step,i.stack.push(i.ppem)}function t4(i){Q.DEBUG&&i.step,i.autoFlip=!0}function i4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n<t?1:0)}function n4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n<=t?1:0)}function s4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n>t?1:0)}function o4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n>=t?1:0)}function r4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(t===n?1:0)}function a4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(t!==n?1:0)}function l4(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(Math.trunc(t)%2?1:0)}function c4(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(Math.trunc(t)%2?0:1)}function d4(i){let e=i.stack.pop();Q.DEBUG&&i.step,e||($p(i,!0),Q.DEBUG&&i.step)}function h4(i){Q.DEBUG&&i.step}function u4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(t&&n?1:0)}function f4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(t||n?1:0)}function p4(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(t?0:1)}function cc(i,e){const t=e.stack,n=t.pop(),s=e.fv,o=e.pv,r=e.ppem,a=e.deltaBase+(i-1)*16,l=e.deltaShift,c=e.z0;Q.DEBUG&&(e.step,""+i);for(let h=0;h<n;h++){const u=t.pop(),p=t.pop();if(a+((p&240)>>4)!==r)continue;let m=(p&15)-8;m>=0&&m++,Q.DEBUG&&(e.step,m*l);const y=c[u];s.setRelative(y,y,m*l,o)}}function m4(i){const t=i.stack.pop();Q.DEBUG&&i.step,i.deltaBase=t}function g4(i){const t=i.stack.pop();Q.DEBUG&&i.step,i.deltaShift=Math.pow(.5,t)}function y4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n+t)}function A4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n-t)}function v4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n*64/t)}function b4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(n*t/64)}function w4(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(Math.abs(t))}function C4(i){const e=i.stack;let t=e.pop();Q.DEBUG&&i.step,e.push(-t)}function E4(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(Math.floor(t/64)*64)}function x4(i){const e=i.stack,t=e.pop();Q.DEBUG&&i.step,e.push(Math.ceil(t/64)*64)}function Lr(i,e){const t=e.stack,n=t.pop();Q.DEBUG&&e.step,t.push(e.round(n/64)*64)}function I4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,i.cvt[n]=t*i.ppem/i.font.unitsPerEm}function dc(i,e){const t=e.stack,n=t.pop(),s=e.ppem,o=e.deltaBase+(i-1)*16,r=e.deltaShift;Q.DEBUG&&(e.step,""+i);for(let a=0;a<n;a++){const l=t.pop(),c=t.pop();if(o+((c&240)>>4)!==s)continue;let u=(c&15)-8;u>=0&&u++;const p=u*r;Q.DEBUG&&e.step,e.cvt[l]+=p}}function S4(i){let e=i.stack.pop();Q.DEBUG&&i.step,i.round=Yp;let t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(i.srPeriod=t,e&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*t;break;case 32:i.srPhase=.5*t;break;case 48:i.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?i.srThreshold=0:i.srThreshold=(e/8-.5)*t}function M4(i){let e=i.stack.pop();Q.DEBUG&&i.step,i.round=Yp;let t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(i.srPeriod=t,e&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*t;break;case 32:i.srPhase=.5*t;break;case 48:i.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?i.srThreshold=0:i.srThreshold=(e/8-.5)*t}function T4(i){Q.DEBUG&&i.step,i.round=cT}function B4(i){Q.DEBUG&&i.step,i.round=uT}function _4(i){Q.DEBUG&&i.step,i.round=fT}function k4(i){const e=i.stack.pop();Q.DEBUG&&i.step}function am(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];Q.DEBUG&&(e.step,""+i);let a,l;i?(a=o.y-r.y,l=r.x-o.x):(a=r.x-o.x,l=r.y-o.y),e.dpv=io(a,l)}function P4(i){const e=i.stack,t=e.pop();let n=0;Q.DEBUG&&i.step,t&1&&(n=35),t&32&&(n|=4096),e.push(n)}function D4(i){const e=i.stack,t=e.pop(),n=e.pop(),s=e.pop();Q.DEBUG&&i.step,e.push(n),e.push(t),e.push(s)}function N4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(Math.max(n,t))}function L4(i){const e=i.stack,t=e.pop(),n=e.pop();Q.DEBUG&&i.step,e.push(Math.min(n,t))}function R4(i){const e=i.stack.pop();Q.DEBUG&&i.step}function F4(i){const e=i.stack.pop();let t=i.stack.pop();switch(Q.DEBUG&&i.step,e){case 1:i.inhibitGridFit=!!t;return;case 2:i.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function Li(i,e){const t=e.stack,n=e.prog;let s=e.ip;Q.DEBUG&&(e.step,""+i);for(let o=0;o<i;o++)t.push(n[++s]);e.ip=s}function Ri(i,e){let t=e.ip;const n=e.prog,s=e.stack;Q.DEBUG&&(e.ip,""+i);for(let o=0;o<i;o++){let r=n[++t]<<8|n[++t];r&32768&&(r=-((r^65535)+1)),s.push(r)}e.ip=t}function ie(i,e,t,n,s,o){const r=o.stack,a=i&&r.pop(),l=r.pop(),c=o.rp0,h=o.z0[c],u=o.z1[l],p=o.minDis,f=o.fv,m=o.dpv;let y,g,A,v;g=y=m.distance(u,h,!0,!0),A=g>=0?1:-1,g=Math.abs(g),i&&(v=o.cvt[a],n&&Math.abs(g-v)<o.cvCutIn&&(g=v)),t&&g<p&&(g=p),n&&(g=o.round(g)),f.setRelative(u,h,A*g,m),f.touch(u),Q.DEBUG&&(o.step,(i?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(n?"R":"_")+(s===0?"Gr":s===1?"Bl":s===2?"Wh":"")+"",i&&a+""+o.cvt[a]+v,A*g),o.rp1=o.rp0,o.rp2=l,e&&(o.rp0=l)}Vp=[jp.bind(void 0,ui),jp.bind(void 0,Zt),Wp.bind(void 0,ui),Wp.bind(void 0,Zt),qp.bind(void 0,ui),qp.bind(void 0,Zt),Kp.bind(void 0,0),Kp.bind(void 0,1),Xp.bind(void 0,0),Xp.bind(void 0,1),mT,gT,yT,AT,vT,bT,wT,CT,ET,xT,IT,ST,MT,TT,BT,_T,kT,PT,DT,NT,void 0,void 0,LT,lc,RT,FT,OT,VT,QT,void 0,void 0,void 0,GT,UT,zT,void 0,Jp.bind(void 0,0),Jp.bind(void 0,1),Zp.bind(void 0,ui),Zp.bind(void 0,Zt),em.bind(void 0,0),em.bind(void 0,1),tm.bind(void 0,0),tm.bind(void 0,1),im.bind(void 0,0),im.bind(void 0,1),HT,YT,nm.bind(void 0,0),nm.bind(void 0,1),$T,jT,sm.bind(void 0,0),sm.bind(void 0,1),WT,qT,KT,XT,JT,ZT,om.bind(void 0,0),om.bind(void 0,1),void 0,rm.bind(void 0,0),rm.bind(void 0,1),e4,void 0,t4,void 0,void 0,i4,n4,s4,o4,r4,a4,l4,c4,d4,h4,u4,f4,p4,cc.bind(void 0,1),m4,g4,y4,A4,v4,b4,w4,C4,E4,x4,Lr.bind(void 0,0),Lr.bind(void 0,1),Lr.bind(void 0,2),Lr.bind(void 0,3),void 0,void 0,void 0,void 0,I4,cc.bind(void 0,2),cc.bind(void 0,3),dc.bind(void 0,1),dc.bind(void 0,2),dc.bind(void 0,3),S4,M4,void 0,void 0,T4,void 0,B4,_4,lc,lc,void 0,void 0,void 0,void 0,void 0,k4,am.bind(void 0,0),am.bind(void 0,1),P4,void 0,D4,N4,L4,R4,F4,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Li.bind(void 0,1),Li.bind(void 0,2),Li.bind(void 0,3),Li.bind(void 0,4),Li.bind(void 0,5),Li.bind(void 0,6),Li.bind(void 0,7),Li.bind(void 0,8),Ri.bind(void 0,1),Ri.bind(void 0,2),Ri.bind(void 0,3),Ri.bind(void 0,4),Ri.bind(void 0,5),Ri.bind(void 0,6),Ri.bind(void 0,7),Ri.bind(void 0,8),ie.bind(void 0,0,0,0,0,0),ie.bind(void 0,0,0,0,0,1),ie.bind(void 0,0,0,0,0,2),ie.bind(void 0,0,0,0,0,3),ie.bind(void 0,0,0,0,1,0),ie.bind(void 0,0,0,0,1,1),ie.bind(void 0,0,0,0,1,2),ie.bind(void 0,0,0,0,1,3),ie.bind(void 0,0,0,1,0,0),ie.bind(void 0,0,0,1,0,1),ie.bind(void 0,0,0,1,0,2),ie.bind(void 0,0,0,1,0,3),ie.bind(void 0,0,0,1,1,0),ie.bind(void 0,0,0,1,1,1),ie.bind(void 0,0,0,1,1,2),ie.bind(void 0,0,0,1,1,3),ie.bind(void 0,0,1,0,0,0),ie.bind(void 0,0,1,0,0,1),ie.bind(void 0,0,1,0,0,2),ie.bind(void 0,0,1,0,0,3),ie.bind(void 0,0,1,0,1,0),ie.bind(void 0,0,1,0,1,1),ie.bind(void 0,0,1,0,1,2),ie.bind(void 0,0,1,0,1,3),ie.bind(void 0,0,1,1,0,0),ie.bind(void 0,0,1,1,0,1),ie.bind(void 0,0,1,1,0,2),ie.bind(void 0,0,1,1,0,3),ie.bind(void 0,0,1,1,1,0),ie.bind(void 0,0,1,1,1,1),ie.bind(void 0,0,1,1,1,2),ie.bind(void 0,0,1,1,1,3),ie.bind(void 0,1,0,0,0,0),ie.bind(void 0,1,0,0,0,1),ie.bind(void 0,1,0,0,0,2),ie.bind(void 0,1,0,0,0,3),ie.bind(void 0,1,0,0,1,0),ie.bind(void 0,1,0,0,1,1),ie.bind(void 0,1,0,0,1,2),ie.bind(void 0,1,0,0,1,3),ie.bind(void 0,1,0,1,0,0),ie.bind(void 0,1,0,1,0,1),ie.bind(void 0,1,0,1,0,2),ie.bind(void 0,1,0,1,0,3),ie.bind(void 0,1,0,1,1,0),ie.bind(void 0,1,0,1,1,1),ie.bind(void 0,1,0,1,1,2),ie.bind(void 0,1,0,1,1,3),ie.bind(void 0,1,1,0,0,0),ie.bind(void 0,1,1,0,0,1),ie.bind(void 0,1,1,0,0,2),ie.bind(void 0,1,1,0,0,3),ie.bind(void 0,1,1,0,1,0),ie.bind(void 0,1,1,0,1,1),ie.bind(void 0,1,1,0,1,2),ie.bind(void 0,1,1,0,1,3),ie.bind(void 0,1,1,1,0,0),ie.bind(void 0,1,1,1,0,1),ie.bind(void 0,1,1,1,0,2),ie.bind(void 0,1,1,1,0,3),ie.bind(void 0,1,1,1,1,0),ie.bind(void 0,1,1,1,1,1),ie.bind(void 0,1,1,1,1,2),ie.bind(void 0,1,1,1,1,3)];const O4=Array.from||(i=>i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]);function Ee(i){i=i||{},i.empty||(Hn(i.familyName,"When creating a new Font object, familyName is required."),Hn(i.styleName,"When creating a new Font object, styleName is required."),Hn(i.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Hn(i.ascender,"When creating a new Font object, ascender is required."),Hn(i.descender,"When creating a new Font object, descender is required."),Hn(i.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:i.familyName||" "},fontSubfamily:{en:i.styleName||" "},fullName:{en:i.fullName||i.familyName+" "+i.styleName},postScriptName:{en:i.postScriptName||(i.familyName+i.styleName).replace(/\s/g,"")},designer:{en:i.designer||" "},designerURL:{en:i.designerURL||" "},manufacturer:{en:i.manufacturer||" "},manufacturerURL:{en:i.manufacturerURL||" "},license:{en:i.license||" "},licenseURL:{en:i.licenseURL||" "},version:{en:i.version||"Version 0.1"},description:{en:i.description||" "},copyright:{en:i.copyright||" "},trademark:{en:i.trademark||" "}},this.unitsPerEm=i.unitsPerEm||1e3,this.ascender=i.ascender,this.descender=i.descender,this.createdTimestamp=i.createdTimestamp,this.tables={os2:{usWeightClass:i.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:i.widthClass||this.usWidthClasses.MEDIUM,fsSelection:i.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new Qn.GlyphSet(this,i.glyphs||[]),this.encoding=new ip(this),this.position=new eo(this),this.substitution=new Ut(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new zp(this)}})}Ee.prototype.hasChar=function(i){return this.encoding.charToGlyphIndex(i)!==null},Ee.prototype.charToGlyphIndex=function(i){return this.encoding.charToGlyphIndex(i)},Ee.prototype.charToGlyph=function(i){const e=this.charToGlyphIndex(i);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},Ee.prototype.stringToGlyphs=function(i,e){e=e||this.defaultRenderOptions;const t=O4(i),n=[];for(let a=0;a<t.length;a+=1){const l=t[a];n.push(this.charToGlyphIndex(l))}let s=n.length;if(e.features){const a=e.script||this.substitution.getDefaultScriptName();let l=[];e.features.liga&&(l=l.concat(this.substitution.getFeature("liga",a,e.language))),e.features.rlig&&(l=l.concat(this.substitution.getFeature("rlig",a,e.language)));for(let c=0;c<s;c+=1)for(let h=0;h<l.length;h++){const u=l[h],p=u.sub,f=p.length;let m=0;for(;m<f&&p[m]===n[c+m];)m++;m===f&&(n.splice(c,f,u.by),s=s-f+1)}}const o=new Array(s),r=this.glyphs.get(0);for(let a=0;a<s;a+=1)o[a]=this.glyphs.get(n[a])||r;return o},Ee.prototype.nameToGlyphIndex=function(i){return this.glyphNames.nameToGlyphIndex(i)},Ee.prototype.nameToGlyph=function(i){const e=this.nameToGlyphIndex(i);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},Ee.prototype.glyphIndexToName=function(i){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(i):""},Ee.prototype.getKerningValue=function(i,e){i=i.index||i,e=e.index||e;const t=this.position.defaultKerningTables;return t?this.position.getKerningValue(t,i,e):this.kerningPairs[i+","+e]||0},Ee.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},Ee.prototype.forEachGlyph=function(i,e,t,n,s,o){e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:72,s=s||this.defaultRenderOptions;const r=1/this.unitsPerEm*n,a=this.stringToGlyphs(i,s);let l;if(s.kerning){const c=s.script||this.position.getDefaultScriptName();l=this.position.getKerningTables(c,s.language)}for(let c=0;c<a.length;c+=1){const h=a[c];if(o.call(this,h,e,t,n,s),h.advanceWidth&&(e+=h.advanceWidth*r),s.kerning&&c<a.length-1){const u=l?this.position.getKerningValue(l,h.index,a[c+1].index):this.getKerningValue(h,a[c+1]);e+=u*r}s.letterSpacing?e+=s.letterSpacing*n:s.tracking&&(e+=s.tracking/1e3*n)}return e},Ee.prototype.getPath=function(i,e,t,n,s){const o=new Xe;return this.forEachGlyph(i,e,t,n,s,function(r,a,l,c){const h=r.getPath(a,l,c,s,this);o.extend(h)}),o},Ee.prototype.getPaths=function(i,e,t,n,s){const o=[];return this.forEachGlyph(i,e,t,n,s,function(r,a,l,c){const h=r.getPath(a,l,c,s,this);o.push(h)}),o},Ee.prototype.getAdvanceWidth=function(i,e,t){return this.forEachGlyph(i,0,0,e,t,function(){})},Ee.prototype.draw=function(i,e,t,n,s,o){this.getPath(e,t,n,s,o).draw(i)},Ee.prototype.drawPoints=function(i,e,t,n,s,o){this.forEachGlyph(e,t,n,s,o,function(r,a,l,c){r.drawPoints(i,a,l,c)})},Ee.prototype.drawMetrics=function(i,e,t,n,s,o){this.forEachGlyph(e,t,n,s,o,function(r,a,l,c){r.drawMetrics(i,a,l,c)})},Ee.prototype.getEnglishName=function(i){const e=this.names[i];if(e)return e.en},Ee.prototype.validate=function(){const i=this;function e(n,s){}function t(n){const s=i.getEnglishName(n);s&&s.trim().length>0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0},Ee.prototype.toTables=function(){return eT.fontToTable(this)},Ee.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Ee.prototype.toArrayBuffer=function(){const e=this.toTables().encode(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let s=0;s<e.length;s++)n[s]=e[s];return t},Ee.prototype.download=function(i){const e=this.getEnglishName("fontFamily"),t=this.getEnglishName("fontSubfamily");i=i||e.replace(/\s/g,"")+"-"+t+".otf";const n=this.toArrayBuffer();if(iT())if(window.URL=window.URL||window.webkitURL,window.URL){const s=new DataView(n),o=new Blob([s],{type:"font/opentype"});let r=document.createElement("a");r.href=window.URL.createObjectURL(o),r.download=i;let a=document.createEvent("MouseEvents");a.initEvent("click",!0,!1),r.dispatchEvent(a)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{const s=require("fs"),o=sT(n);s.writeFileSync(i,o)}},Ee.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Ee.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Ee.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function lm(i,e){const t=JSON.stringify(i);let n=256;for(let s in e){let o=parseInt(s);if(!(!o||o<256)){if(JSON.stringify(e[s])===t)return o;n<=o&&(n=o+1)}}return e[n]=i,n}function G4(i,e,t){const n=lm(e.name,t);return[{name:"tag_"+i,type:"TAG",value:e.tag},{name:"minValue_"+i,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+i,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+i,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+i,type:"USHORT",value:0},{name:"nameID_"+i,type:"USHORT",value:n}]}function U4(i,e,t){const n={},s=new ne.Parser(i,e);return n.tag=s.parseTag(),n.minValue=s.parseFixed(),n.defaultValue=s.parseFixed(),n.maxValue=s.parseFixed(),s.skip("uShort",1),n.name=t[s.parseUShort()]||{},n}function V4(i,e,t,n){const s=lm(e.name,n),o=[{name:"nameID_"+i,type:"USHORT",value:s},{name:"flags_"+i,type:"USHORT",value:0}];for(let r=0;r<t.length;++r){const a=t[r].tag;o.push({name:"axis_"+i+" "+a,type:"FIXED",value:e.coordinates[a]<<16})}return o}function Q4(i,e,t,n){const s={},o=new ne.Parser(i,e);s.name=n[o.parseUShort()]||{},o.skip("uShort",1),s.coordinates={};for(let r=0;r<t.length;++r)s.coordinates[t[r].tag]=o.parseFixed();return s}function z4(i,e){const t=new oe.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:i.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:i.instances.length},{name:"instanceSize",type:"USHORT",value:4+i.axes.length*4}]);t.offsetToData=t.sizeOf();for(let n=0;n<i.axes.length;n++)t.fields=t.fields.concat(G4(n,i.axes[n],e));for(let n=0;n<i.instances.length;n++)t.fields=t.fields.concat(V4(n,i.instances[n],i.axes,e));return t}function H4(i,e,t){const n=new ne.Parser(i,e),s=n.parseULong();ue.argument(s===65536,"Unsupported fvar table version.");const o=n.parseOffset16();n.skip("uShort",1);const r=n.parseUShort(),a=n.parseUShort(),l=n.parseUShort(),c=n.parseUShort(),h=[];for(let f=0;f<r;f++)h.push(U4(i,e+o+f*a,t));const u=[],p=e+o+r*a;for(let f=0;f<l;f++)u.push(Q4(i,p+f*c,h,t));return{axes:h,instances:u}}const Y4={make:z4,parse:H4},Vt=new Array(10);Vt[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(H.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(H.coverage),values:this.parseValueRecordList()};ue.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Vt[2]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();ue.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");const n=this.parsePointer(H.coverage),s=this.parseUShort(),o=this.parseUShort();if(t===1)return{posFormat:t,coverage:n,valueFormat1:s,valueFormat2:o,pairSets:this.parseList(H.pointer(H.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}})))};if(t===2){const r=this.parsePointer(H.classDef),a=this.parsePointer(H.classDef),l=this.parseUShort(),c=this.parseUShort();return{posFormat:t,coverage:n,valueFormat1:s,valueFormat2:o,classDef1:r,classDef2:a,class1Count:l,class2Count:c,classRecords:this.parseList(l,H.list(c,function(){return{value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}}))}}},Vt[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Vt[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Vt[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Vt[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Vt[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Vt[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Vt[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function $4(i,e){e=e||0;const t=new H(i,e),n=t.parseVersion(1);return ue.argument(n===1||n===1.1,"Unsupported GPOS table version "+n),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Vt)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Vt),variations:t.parseFeatureVariationsList()}}const j4=new Array(10);function W4(i){return new oe.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new oe.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new oe.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new oe.LookupList(i.lookups,j4)}])}const q4={parse:$4,make:W4};function K4(i){const e={};i.skip("uShort");const t=i.parseUShort();ue.argument(t===0,"Unsupported kern sub-table version."),i.skip("uShort",2);const n=i.parseUShort();i.skip("uShort",3);for(let s=0;s<n;s+=1){const o=i.parseUShort(),r=i.parseUShort(),a=i.parseShort();e[o+","+r]=a}return e}function X4(i){const e={};i.skip("uShort"),i.parseULong()>1&&console.warn("Only the first kern subtable is supported."),i.skip("uLong");const s=i.parseUShort()&255;if(i.skip("uShort"),s===0){const o=i.parseUShort();i.skip("uShort",3);for(let r=0;r<o;r+=1){const a=i.parseUShort(),l=i.parseUShort(),c=i.parseShort();e[a+","+l]=c}}return e}function J4(i,e){const t=new ne.Parser(i,e),n=t.parseUShort();if(n===0)return K4(t);if(n===1)return X4(t);throw new Error("Unsupported kern table version ("+n+").")}const Z4={parse:J4};function eB(i,e,t,n){const s=new ne.Parser(i,e),o=n?s.parseUShort:s.parseULong,r=[];for(let a=0;a<t+1;a+=1){let l=o.call(s);n&&(l*=2),r.push(l)}return r}const tB={parse:eB};function iB(i,e){require("fs").readFile(i,function(n,s){if(n)return e(n.message);e(null,nT(s))})}function nB(i,e){const t=new XMLHttpRequest;t.open("get",i,!0),t.responseType="arraybuffer",t.onload=function(){return t.response?e(null,t.response):e("Font could not be loaded: "+t.statusText)},t.onerror=function(){e("Font could not be loaded")},t.send()}function cm(i,e){const t=[];let n=12;for(let s=0;s<e;s+=1){const o=ne.getTag(i,n),r=ne.getULong(i,n+4),a=ne.getULong(i,n+8),l=ne.getULong(i,n+12);t.push({tag:o,checksum:r,offset:a,length:l,compression:!1}),n+=16}return t}function sB(i,e){const t=[];let n=44;for(let s=0;s<e;s+=1){const o=ne.getTag(i,n),r=ne.getULong(i,n+4),a=ne.getULong(i,n+8),l=ne.getULong(i,n+12);let c;a<l?c="WOFF":c=!1,t.push({tag:o,offset:r,compression:c,compressedLength:a,length:l}),n+=20}return t}function Ye(i,e){if(e.compression==="WOFF"){const t=new Uint8Array(i.buffer,e.offset+2,e.compressedLength-2),n=new Uint8Array(e.length);if(RS(t,n),n.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");return{data:new DataView(n.buffer,0),offset:0}}else return{data:i,offset:e.offset}}function oB(i){let e,t;const n=new Ee({empty:!0}),s=new DataView(i,0);let o,r=[];const a=ne.getTag(s,0);if(a==="\0\0\0"||a==="true"||a==="typ1")n.outlinesFormat="truetype",o=ne.getUShort(s,4),r=cm(s,o);else if(a==="OTTO")n.outlinesFormat="cff",o=ne.getUShort(s,4),r=cm(s,o);else if(a==="wOFF"){const x=ne.getTag(s,4);if(x==="\0\0\0")n.outlinesFormat="truetype";else if(x==="OTTO")n.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+a);o=ne.getUShort(s,12),r=sB(s,o)}else throw new Error("Unsupported OpenType signature "+a);let l,c,h,u,p,f,m,y,g,A,v;for(let x=0;x<o;x+=1){const I=r[x];let E;switch(I.tag){case"cmap":E=Ye(s,I),n.tables.cmap=tp.parse(E.data,E.offset),n.encoding=new np(n.tables.cmap);break;case"cvt ":E=Ye(s,I),v=new ne.Parser(E.data,E.offset),n.tables.cvt=v.parseShortList(I.length/2);break;case"fvar":c=I;break;case"fpgm":E=Ye(s,I),v=new ne.Parser(E.data,E.offset),n.tables.fpgm=v.parseByteList(I.length);break;case"head":E=Ye(s,I),n.tables.head=gp.parse(E.data,E.offset),n.unitsPerEm=n.tables.head.unitsPerEm,e=n.tables.head.indexToLocFormat;break;case"hhea":E=Ye(s,I),n.tables.hhea=yp.parse(E.data,E.offset),n.ascender=n.tables.hhea.ascender,n.descender=n.tables.hhea.descender,n.numberOfHMetrics=n.tables.hhea.numberOfHMetrics;break;case"hmtx":f=I;break;case"ltag":E=Ye(s,I),t=vp.parse(E.data,E.offset);break;case"maxp":E=Ye(s,I),n.tables.maxp=bp.parse(E.data,E.offset),n.numGlyphs=n.tables.maxp.numGlyphs;break;case"name":g=I;break;case"OS/2":E=Ye(s,I),n.tables.os2=nc.parse(E.data,E.offset);break;case"post":E=Ye(s,I),n.tables.post=Tp.parse(E.data,E.offset),n.glyphNames=new Xl(n.tables.post);break;case"prep":E=Ye(s,I),v=new ne.Parser(E.data,E.offset),n.tables.prep=v.parseByteList(I.length);break;case"glyf":h=I;break;case"loca":y=I;break;case"CFF ":l=I;break;case"kern":m=I;break;case"GPOS":u=I;break;case"GSUB":p=I;break;case"meta":A=I;break}}const b=Ye(s,g);if(n.tables.name=Mp.parse(b.data,b.offset,t),n.names=n.tables.name,h&&y){const x=e===0,I=Ye(s,y),E=tB.parse(I.data,I.offset,n.numGlyphs,x),S=Ye(s,h);n.glyphs=Up.parse(S.data,S.offset,E,n)}else if(l){const x=Ye(s,l);mp.parse(x.data,x.offset,n)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");const C=Ye(s,f);if(Ap.parse(C.data,C.offset,n.numberOfHMetrics,n.numGlyphs,n.glyphs),tM(n),m){const x=Ye(s,m);n.kerningPairs=Z4.parse(x.data,x.offset)}else n.kerningPairs={};if(u){const x=Ye(s,u);n.tables.gpos=q4.parse(x.data,x.offset),n.position.init()}if(p){const x=Ye(s,p);n.tables.gsub=Bp.parse(x.data,x.offset)}if(c){const x=Ye(s,c);n.tables.fvar=Y4.parse(x.data,x.offset,n.names)}if(A){const x=Ye(s,A);n.tables.meta=_p.parse(x.data,x.offset),n.metas=n.tables.meta}return n}function rB(i,e){(typeof window>"u"?iB:nB)(i,function(s,o){if(s)return e(s);let r;try{r=oB(o)}catch(a){return e(a,null)}return e(null,r)})}const hc=1e-12;function so(i){if(!Array.isArray(i)||i.length===0)return i||[];const e=i[0],t=i[i.length-1];if(!e||!t||e.length<2||t.length<2)return i;const n=e[0]??0,s=e[1]??0,o=t[0]??0,r=t[1]??0;return(Math.abs(n-o)>hc||Math.abs(s-r)>hc)&&i.push([n,s]),i}function an(i){let e=0;if(!i)return 0;for(let t=0;t<i.length-1;t++){const n=i[t],s=i[t+1];if(!n||!s)continue;const o=n[0]??0,r=n[1]??0,a=s[0]??0,l=s[1]??0;e+=o*l-a*r}return e/2}function Rr(i,e=hc){const t=[];if(!i)return t;for(const n of i){if(!n||n.length<2)continue;const s=t[t.length-1],o=n[0]??0,r=n[1]??0;if(!s){t.push([o,r]);continue}const a=s[0]??0,l=s[1]??0;(Math.abs(o-a)>e||Math.abs(r-l)>e)&&t.push([o,r])}return t}function aB(i,e,t,n,s=16){const o=[],r=i?.[0]??0,a=i?.[1]??0,l=t?.[0]??0,c=t?.[1]??0,h=n?.[0]??0,u=n?.[1]??0,p=e?.[0]??0,f=e?.[1]??0;for(let m=0;m<=s;m++){const y=m/s,g=1-y,A=g*g*g*r+3*g*g*y*l+3*g*y*y*h+y*y*y*p,v=g*g*g*a+3*g*g*y*c+3*g*y*y*u+y*y*y*f;o.push([A,v])}return o}function dm(i,e){if(!i||!e)return!1;const t=i[0]??0,n=i[1]??0;let s=!1;for(let o=0,r=e.length-1;o<e.length;r=o++){const a=e[o],l=e[r];if(!a||!l)continue;const c=a[0]??0,h=a[1]??0,u=l[0]??0,p=l[1]??0;h>n!=p>n&&t<(u-c)*(n-h)/(p-h+0)+c&&(s=!s)}return s}function uc(i){return i?(an(i)<0&&i.reverse(),so(i),i):[]}function lB(i){return i?(an(i)>0&&i.reverse(),so(i),i):[]}function hm(i,e=16){if(!i||!Array.isArray(i.commands))return[];const t=[];let n=[];for(const s of i.commands){let o=function(a){const l=a.x!==void 0?a.x:0,c=a.y!==void 0?-a.y:0;return[l,c]};const r=s.type;if(r==="M")n.length&&t.push(Rr(n)),n=[o(s)];else if(r==="L")n.push(o(s));else if(r==="Q"){const l=n[n.length-1]||o(s),c=[],h=s.x??0,u=s.y??0,p=s.x1??0,f=s.y1??0,m=l[0]??0,y=l[1]??0;for(let g=1;g<=e;g++){const A=g/e,v=1-A,b=v*v*m+2*v*A*p+A*A*h,C=v*v*y+2*v*A*f+A*A*-u;c.push([b,C])}c.length?n.push(...c):n.push(o(s))}else if(r==="C"){const l=n[n.length-1]||o(s),c=[s.x1||0,-(s.y1||0)],h=[s.x2||0,-(s.y2||0)],u=[s.x||0,-(s.y||0)],p=aB(l,u,c,h,e);p.length>1?n.push(...p.slice(1)):n.push(u)}else r==="Z"||r==="z"?(n.length&&t.push(Rr(n)),n=[]):s.x!==void 0&&s.y!==void 0&&n.push(o(s))}return n.length&&t.push(Rr(n)),t.map(s=>so(s)).filter(s=>s&&s.length>=4)}function fc(i,e){if(!i)return null;const t=i.map(n=>so(n.slice()));return{type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{...e.properties||{},rings:t.length,polygons:1}}}function cB(i,e,t={}){t=Object.assign({sampleSegments:16,simplifyTolerance:0,epsArea:1e-24,debug:!1,scale:1,widthScale:.6,fillWinding:"auto"},t||{scale:1});const n=!!t.debug;if(!i||!i.geometry||!Array.isArray(i.geometry.coordinates))return{type:"FeatureCollection",features:[]};const s=i.geometry.coordinates,o=i.properties||{},r=o.text||o.label||"",a=o.rotation??0,l=t.sampleSegments||16,c=t.epsArea||1e-24,u=o.height/.9||1,p=(t.scale||1)*u,f=-a*Math.PI/180,m=Math.cos(f),y=Math.sin(f),g=o.attachmentPoint||"bottom-left",A=[];if(!e||typeof e.getPaths!="function")return{type:"FeatureCollection",features:A};const v=e.getPaths(r,0,0,t.fontSize||1)||[];let b=[];for(const F of v){const U=hm(F,l);for(const L of U)if(L)for(const D of L)D&&b.push(D)}let C=1/0,x=1/0,I=-1/0,E=-1/0;for(const F of b){if(!F)continue;const U=F[0]??0,L=F[1]??0;C=Math.min(C,U),x=Math.min(x,L),I=Math.max(I,U),E=Math.max(E,L)}const S=I-C,w=E-x;let T=0,_=0;switch(g){case"top-left":T=0,_=-w;break;case"top-center":T=-S/2,_=w;break;case"top-right":T=-S,_=w;break;case"center-left":T=0,_=w/2;break;case"center":T=-S/2,_=w/2;break;case"center-right":T=-S,_=w/2;break;case"bottom-left":T=0,_=0;break;case"bottom-center":T=-S/2,_=0;break;case"bottom-right":T=-S,_=0;break;default:T=0,_=0}for(const F of v){const U=hm(F,l);if(!U||U.length===0)continue;const L=U.map(P=>{if(!P)return[];const V=P.map(G=>{if(!G)return[0,0];let R=(G[0]??0)+T,N=(G[1]??0)+_;R=R*(t.widthScale||.6);const O=R*m-N*y,z=R*y+N*m;return[s[0]+O*p,s[1]+z*p]});return so(Rr(V))}).filter(P=>P&&P.length>=4&&Math.abs(an(P))>c);if(L.length===0)continue;let D=1;if(t.fillWinding==="positive")D=1;else if(t.fillWinding==="negative")D=-1;else{let P=0,V=-1;for(let N=0;N<L.length;N++){const O=L[N];if(!O)continue;const z=an(O);Math.abs(z)>V&&(V=Math.abs(z),P=N)}const G=L[P];D=(G?an(G):0)>=0?1:-1}const M=L.map((P,V)=>({idx:V,ring:P,signedArea:an(P),absArea:Math.abs(an(P))}));for(const P of M)P.isFilled=P.signedArea*D>0,n&&(P.idx,P.signedArea.toExponential(),P.isFilled);const k=M.filter(P=>P.isFilled).sort((P,V)=>P.absArea-V.absArea),B=M.filter(P=>!P.isFilled).sort((P,V)=>V.absArea-P.absArea);for(const P of k)P.holes=[];for(const P of B){const V=(function(R){let N=0,O=0;if(!R||R.length===0)return[0,0];for(const z of R)z&&(N+=z[0]??0,O+=z[1]??0);return[N/R.length,O/R.length]})(P.ring);let G=null;for(const R of k)dm(V,R.ring)&&(G===null||R.absArea<G.absArea&&R.idx<P.idx||R.absArea>G.absArea&&R.idx<P.idx&&B.length==1)&&(G=R);if(G){if(G.absArea<P.absArea&&B.length>1)for(const R of k)dm(V,R.ring)&&R.absArea>P.absArea&&R.holes.push(P.ring);else G.holes.push(P.ring);P.assigned=!0}else P.assigned=!1,n&&P.idx}for(const P of k){const V=uc(P.ring.slice()),G=(P.holes||[]).map(R=>lB(R.slice()));A.push(fc([V,...G],i))}for(const P of B)P.assigned||A.push(fc([uc(P.ring.slice())],i));if(k.length===0)for(const P of M)A.push(fc([uc(P.ring.slice())],i))}return{type:"FeatureCollection",features:A}}class dB extends Jt{constructor(e,t){super(e,t),this.type="label",this._centerCoord=null,this._plotInstance=this,this.fontUrl="https://leiting.chenxisoft.com/resource/font/HanaMinA.ttf",this.labelText="点击编辑文本",this.fontSize=10,this.color="#ff0000",this.polygonEntities=[],t&&(this.fontSize=t.fontSize||this.fontSize,this.color=t.color||this.color,this.labelText=t.text||this.labelText)}start(e){this.startCreate(e)}startCreate(e){try{this.state="creating",this.forbidDrawWorld(!0);const t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium,n=this;if(!t){console.error("无法获取Cesium对象");return}this.handler&&this.handler.destroy(),this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(s){if(!s||!s.position)return;let o=n.getCatesian3FromPX(s.position);o&&(n.positions=[o],n._centerCoord=o,n.createLabel(o,function(){n.endCreate(e)}))},t.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(s){if(!s||!s.position)return;n.getCatesian3FromPX(s.position)&&n.state},t.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(s){!s||!s.position||n.endCreate()},t.ScreenSpaceEventType.RIGHT_CLICK)}catch(t){console.error("启动创建标签功能时出错:",t),e&&e(null)}}createLabel(e,t){const n=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium,s=this;if(!e){console.error("创建标签时位置参数无效"),t&&t();return}if(!n){console.error("创建标签时无法获取Cesium对象"),t&&t();return}this.clearPolygonEntities(),rB(this.fontUrl,(o,r)=>{try{if(o){console.error("加载字体失败:",o),t&&t();return}const a=n.Cartographic.fromCartesian(e),l=n.Math.toDegrees(a.longitude),c=n.Math.toDegrees(a.latitude),h={type:"Feature",geometry:{type:"Point",coordinates:[l,c]},properties:{text:s.labelText||"",rotation:0}},u={sampleSegments:16,fontSize:s.fontSize,scale:10},p=cB(h,r,u);if(!p||!p.features||!Array.isArray(p.features)){console.error("文本转换为多边形失败"),t&&t();return}s.drawGeoJsonLocal(p,[l,c],1,r),s.entity={_centerCoord:s._centerCoord,_plotInstance:s._plotInstance,position:e,label:{text:s.labelText},updatePosition:function(f){s.updatePositions([f])},getPosition:function(){return s._centerCoord},type:s.type,objId:s.objId,isDraggable:!0,setPosition:function(f){s._centerCoord=f,s.positions[0]=f,s.createLabel(f)}},s.addClickEditHandler(),t&&t()}catch(a){console.error("创建文本标签时发生错误:",a);try{s.clearPolygonEntities()}catch(l){console.error("清理标签多边形实体时出错:",l)}t&&t()}})}drawGeoJsonLocal(e,t,n=1,s){try{const o=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!e||!t||!Array.isArray(t)||t.length!==2){console.error("drawGeoJsonLocal: 参数无效");return}const r=t[0],a=t[1],l=o.Cartesian3.fromDegrees(r,a,0),c=o.Transforms.eastNorthUpToFixedFrame(l),h=n*1;this.clearPolygonEntities();let u=[];for(const b of e.features||[]){if(!b||!b.geometry||b.geometry.type!=="Polygon")continue;const C=b.geometry.coordinates||[];for(const x of C)x&&Array.isArray(x)&&(u=u.concat(x))}let p=1/0,f=1/0,m=-1/0,y=-1/0;for(const b of u)Array.isArray(b)&&b.length>=2&&(p=Math.min(p,b[0]),f=Math.min(f,b[1]),m=Math.max(m,b[0]),y=Math.max(y,b[1]));const g=(p+m)/2,A=(f+y)/2,v=b=>{const C=(b[0]-g)*h,x=(b[1]-A)*h,I=new o.Cartesian3(C,x,0);return o.Matrix4.multiplyByPoint(c,I,new o.Cartesian3)};for(const b of e.features||[]){if(!b||!b.geometry||b.geometry.type!=="Polygon")continue;const C=b.geometry.coordinates||[];if(C.length>0)try{const x=C[0]||[];if(x.length===0)continue;const I=x.map(v);let E;if(C.length>1){const w=C.slice(1).map(T=>!T||!Array.isArray(T)||T.length===0?null:new o.PolygonHierarchy(T.map(v))).filter(Boolean);E=new o.PolygonHierarchy(I,w)}else E=new o.PolygonHierarchy(I);const S=this.viewer.entities.add({polygon:{hierarchy:E,material:o.Color.fromCssColorString(this.color||"#000000"),outline:!1},_labelOwner:this.objId});this.polygonEntities.push(S)}catch(x){console.warn("创建多边形实体时出错:",x);continue}}}catch(o){console.error("drawGeoJsonLocal: 发生错误:",o)}}clearPolygonEntities(){for(let e of this.polygonEntities)this.viewer.entities.remove(e);this.polygonEntities=[]}addClickEditHandler(){const e=this,t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!t){console.error("添加点击编辑事件时无法获取Cesium对象");return}this.editHandler&&(this.editHandler.destroy(),this.editHandler=null),this.editHandler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.editHandler.setInputAction(function(n){if(!n||!n.position)return;const s=e.viewer.scene.pick(n.position);t.defined(s)&&s.id&&s.id._labelOwner===e.objId&&(n.preventDefault(),e.editText())},t.ScreenSpaceEventType.LEFT_CLICK),this.editHandler.setInputAction(function(n){if(!n||!n.position)return;const s=e.viewer.scene.pick(n.position);t.defined(s)&&s.id&&s.id._labelOwner===e.objId&&(n.preventDefault(),e.openStyleEditor())},t.ScreenSpaceEventType.RIGHT_CLICK)}editText(){const e=this;(function(n,s){const o=document.createElement("div");o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.backgroundColor="rgba(0, 0, 0, 0.5)",o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center",o.style.zIndex="10000";const r=document.createElement("div");r.style.backgroundColor="white",r.style.padding="20px",r.style.borderRadius="5px",r.style.width="500px",r.style.maxWidth="90vw",r.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.2)";const a=document.createElement("h3");a.textContent="编辑文本",a.style.marginTop="0";const l=document.createElement("textarea");l.value=n,l.style.width="100%",l.style.height="150px",l.style.marginBottom="10px",l.style.fontSize="14px",l.style.padding="8px",l.style.boxSizing="border-box";const c=document.createElement("div");c.style.display="flex",c.style.justifyContent="flex-end",c.style.gap="10px";const h=document.createElement("button");h.textContent="取消",h.addEventListener("click",function(){document.body.removeChild(o),s(null)});const u=document.createElement("button");u.textContent="确认",u.addEventListener("click",function(){document.body.removeChild(o),s(l.value)}),c.appendChild(h),c.appendChild(u),r.appendChild(a),r.appendChild(l),r.appendChild(c),o.appendChild(r),document.body.appendChild(o),l.focus();const p=function(f){f.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",p),s(null))};document.addEventListener("keydown",p)})(this.labelText,function(n){n!==null&&(e.labelText=n||"点击编辑文本",e._centerCoord&&e.createLabel(e._centerCoord))})}endCreate(e){try{this.state="endCreate",this.handler&&(this.handler.destroy(),this.handler=null),this.forbidDrawWorld(!1),this.entity&&!this.entity.objId&&(this.entity.objId=this.objId),e&&e(this.entity)}catch(t){console.error("结束创建标签时出错:",t),e&&e(null)}}updatePositions(e){try{if(!e||!e.length){console.warn("更新标签位置时参数无效");return}if(!(window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium)){console.error("更新标签位置时无法获取Cesium对象");return}this.positions=e,this._centerCoord=e[0],this.entity&&(this.entity.position=e[0]),this.createLabel(e[0])}catch(t){console.error("更新标签位置时出错:",t)}}moveEntity(e){try{const t=window.Cesium||this.viewer._cesiumWidget.cesium||this.viewer.scene.cesium;if(!t){console.error("移动实体时无法获取Cesium对象");return}if(!e||!this._centerCoord)return;const n=t.Cartesian3.add(this._centerCoord,e,new t.Cartesian3);this.updatePositions([n])}catch(t){console.error("移动实体时出错:",t)}}setStyle(e){e&&(e.color&&(this.color=e.color),e.fontSize&&(this.fontSize=e.fontSize),e.text!==void 0&&(this.labelText=e.text),this._centerCoord&&this.createLabel(this._centerCoord))}openStyleEditor(){const e=this;(function(n,s){const o=document.createElement("div");o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.backgroundColor="rgba(0, 0, 0, 0.5)",o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center",o.style.zIndex="10000";const r=document.createElement("div");r.style.backgroundColor="white",r.style.padding="20px",r.style.borderRadius="5px",r.style.width="400px",r.style.maxWidth="90vw",r.style.boxShadow="0 4px 8px rgba(0, 0, 0, 0.2)";const a=document.createElement("h3");a.textContent="编辑样式",a.style.marginTop="0";const l=document.createElement("div");l.style.marginBottom="15px";const c=document.createElement("label");c.textContent="文本颜色: ",c.style.display="block",c.style.marginBottom="5px";const h=document.createElement("input");h.type="color",h.value=n.color,h.style.width="50px",l.appendChild(c),l.appendChild(h);const u=document.createElement("div");u.style.marginBottom="15px";const p=document.createElement("label");p.textContent="字体大小: ",p.style.display="block",p.style.marginBottom="5px";const f=document.createElement("input");f.type="number",f.value=n.fontSize,f.min="8",f.max="200",f.step="1",f.style.width="100%",f.style.padding="5px",f.style.boxSizing="border-box",u.appendChild(p),u.appendChild(f);const m=document.createElement("div");m.style.display="flex",m.style.justifyContent="flex-end",m.style.gap="10px",m.style.marginTop="20px";const y=document.createElement("button");y.textContent="取消",y.addEventListener("click",function(){document.body.removeChild(o),s(null)});const g=document.createElement("button");g.textContent="确认",g.addEventListener("click",function(){document.body.removeChild(o),s({color:h.value,fontSize:parseInt(f.value)})}),m.appendChild(y),m.appendChild(g),r.appendChild(a),r.appendChild(l),r.appendChild(u),r.appendChild(m),o.appendChild(r),document.body.appendChild(o);const A=function(v){v.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",A),s(null))};document.addEventListener("keydown",A)})(this.getStyle(),function(n){n&&e.setStyle(n)})}getStyle(){return{color:this.color,fontSize:this.fontSize,text:this.labelText}}destroy(){try{try{this.clearPolygonEntities()}catch(e){console.warn("清理标签多边形实体时出错:",e)}if(this.handler){try{this.handler.destroy()}catch(e){console.warn("销毁事件处理器时出错:",e)}this.handler=null}if(this.editHandler){try{this.editHandler.destroy()}catch(e){console.warn("销毁编辑事件处理器时出错:",e)}this.editHandler=null}this._centerCoord=null,this._plotInstance=null,this.entity=null,this.positions=null,this.objId=null;try{super.destroy()}catch(e){console.warn("调用父类destroy方法时出错:",e)}}catch(e){console.error("销毁CreateLabel对象时发生错误:",e)}}syncFromEntity(){this.entity&&this.entity.position&&(this._centerCoord=this.entity.position,this._plotInstance=this)}getEntityPositions(){return this.positions}calculateCenter(){return this._centerCoord}}class hB extends Jt{constructor(e,t){super(e,t),this.type="point",this.viewer=e;let n={color:Cesium.Color.AQUA,pixelSize:10,outlineWidth:1};this.style=Object.assign(n,t||{}),this.position=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new ki(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(n){let s=t.getCatesian3FromPX(n.position,t.viewer);s&&(t.entity=t.createPoint(s),t.position=s,t.handler&&(t.handler.destroy(),t.handler=null),t.prompt&&(t.prompt.destroy(),t.prompt=null),t.state="endCreate",e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(n){t.prompt.update(n.endPosition,"单击新增"),t.state="creating"},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){let e=this;e.handler&&(e.handler.destroy(),e.handler=null),e.prompt&&(e.prompt.destroy(),e.prompt=null),e.state="endCreate"}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.destroy():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let n=e instanceof Cesium.Cartesian3?e:Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]);this.position=n,n&&(this.entity=this.createPoint(n),t&&t(this.entity),this.state="endCreate")}setStyle(e){if(e){if(e.color){let t=Cesium.Color.fromCssColorString(e.color||"#ffff00");t=t.withAlpha(e.colorAlpha),this.entity.point.color=t}if(this.entity.point.outlineWidth=Number(e.outlineWidth),e.outlineColor){let t=Cesium.Color.fromCssColorString(e.outlineColor||"#000000");t=t.withAlpha(e.outlineColorAlpha),this.entity.point.outlineColor=t}this.entity.point.heightReference=Number(e.heightReference),this.entity.point.pixelSize=Number(e.pixelSize),this.style=Object.assign(this.style,e)}}getStyle(){let e={},t=this.entity.point,n=t.color.getValue();e.colorAlpha=n.alpha,e.color=new Cesium.Color(n.red,n.green,n.blue,1).toCssHexString(),e.outlineWidth=t.outlineWidth._value;let s=t.outlineColor.getValue();return e.outlineColorAlpha=s.alpha,e.outlineColor=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString(),t.heightReference!=null&&(e.heightReference=t.heightReference.getValue()),e.pixelSize=Number(t.pixelSize),e}getPositions(e){return e?we.cartesianToLnglat(this.position):this.position}getLnglats(){return this.getPositions(!0)}startEdit(e){if(this.state=="startEdit"||this.state=="editing"||!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));let t=this,n;this.modifyHandler.setInputAction(function(s){let o=t.viewer.scene.pick(s.position);Cesium.defined(o)&&o.id&&(n=o.id,t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(s){if(!n)return;let o=t.getCatesian3FromPX(s.endPosition,t.viewer);o&&(t.entity&&(t.entity.position.setValue(o),t.position=o,t.state="editing"),e&&e())},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(s){n&&(t.forbidDrawWorld(!1),t.modifyHandler&&(t.modifyHandler.destroy(),t.modifyHandler=null,t.state="editing"))},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null,e&&e(this.entity)),this.forbidDrawWorld(!1),this.state="endEdit"}createPoint(e){if(!e)return;let t=this.viewer.entities.add({position:e,point:{color:this.style.color instanceof Cesium.Color?this.style.color:this.style.color?Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1):Cesium.Color.WHITE,outlineColor:this.style.outlineColor instanceof Cesium.Color?this.style.outlineColor:this.style.outlineColor?Cesium.Color.fromCssColorString(this.style.outlineColor).withAlpha(this.style.outlineColorAlpha||1):Cesium.Color.BLACK,outlineWidth:this.style.outlineWidth||4,pixelSize:this.style.pixelSize||20,disableDepthTestDistance:Number.MAX_VALUE}});return t.objId=this.objId,t}}class uB extends Jt{constructor(e,t){super(e,t),this.type="polygon",this.viewer=e,this.entity=null,this.polyline=null;let n={outlineColor:"#000000",outlineWidth:2};this.style=Object.assign(n,t||{}),this.outline=null}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new ki(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(n){let s=t.getCatesian3FromPX(n.position,t.viewer,[]);if(!s||(t.movePush&&(t.positions.pop(),t.movePush=!1),t.positions.some(a=>Math.abs(a.x-s.x)<1e-6&&Math.abs(a.y-s.y)<1e-6&&Math.abs(a.z-s.z)<1e-6)))return;t.positions.push(s);let r=t.createPoint(s);r.wz=t.positions.length-1,t.controlPoints.push(r)},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(n){if(t.positions.length<1){t.prompt.update(n.endPosition,"单击开始绘制"),t.state="startCreate";return}t.prompt&&t.prompt.update(n.endPosition,"双击结束,右键取消上一步");let s=t.getCatesian3FromPX(n.endPosition,t.viewer,[]);t.positions.length>=1&&(t.state="creating",t.movePush?t.positions[t.positions.length-1]=s:(t.positions.push(s),t.movePush=!0),t.positions.length==2&&(Cesium.defined(t.polyline)||(t.polyline=t.createPolyline())),t.positions.length==3&&(Cesium.defined(t.entity)||(t.entity=t.createPolygon(t.style),!t.style.outline&&t.polyline&&(t.polyline.show=!1),t.entity.objId=t.objId)))},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(n){t.entity&&(t.positions.splice(t.positions.length-2,1),t.viewer.entities.remove(t.controlPoints.pop()),t.positions.length==2&&t.entity&&(t.viewer.entities.remove(t.entity),t.entity=null,t.polyline&&(t.polyline.show=!0)),t.positions.length==1&&(t.polyline&&(t.viewer.entities.remove(t.polyline),t.polyline=null),t.prompt&&t.prompt.update(n.endPosition,"单击开始绘制"),t.positions=[],t.movePush=!1))},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction(function(n){t.entity&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.movePush=!1,e.prompt&&(e.prompt.destroy(),e.prompt=null),e.viewer.trackedEntity=void 0,e.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.positions.length<=2&&this.movePush==!0?this.destroy():this.endCreate():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e)return;this.state="startCreate";let n=e[0]instanceof Cesium.Cartesian3?e:we.lnglatsToCartesians(e);if(n){this.entity=this.createPolygon(),this.polyline=this.createPolyline(),this.polyline.show=this.style.outline,this.positions=n;for(let s=0;s<n.length;s++){let o=n[s],r=Cesium.Cartographic.fromCartesian(n[s]),a=this.createPoint(o);a.point.heightReference=this.style.heightReference,a.ctgc=r,a.wz=this.controlPoints.length,this.controlPoints.push(a)}this.state="endCreate",this.entity.objId=this.objId,t&&t(this.entity)}}getStyle(){if(!this.entity)return;let e={},t=this.entity.polygon;if(t.material instanceof Cesium.ColorMaterialProperty){e.material="common";let s=t.material.color.getValue();e.colorAlpha=s.alpha,e.color=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString()}if(e.fill=t.fill?t.fill.getValue():!1,t.heightReference){let s=t.heightReference.getValue();e.heightReference=Number(s)}let n=this.polyline.polyline;if(n&&this.polyline.show){e.outlineWidth=n.width.getValue(),e.outline=!0;let s=n.material.color.getValue();e.outlineColorAlpha=s.alpha,e.outlineColor=new Cesium.Color(s.red,s.green,s.blue,1).toCssHexString()}else e.outline=!1;return e}setStyle(e){if(!e)return;this.polyline.show=e.outline;let t=this.polyline.polyline;t.width=e.outlineWidth,this.polyline.clampToGround=!!e.heightReference;let s=(e.outlineColor instanceof Cesium.Color?e.outlineColor:Cesium.Color.fromCssColorString(e.outlineColor)).withAlpha(e.outlineColorAlpha||1);t.material=s,e.heightReference!=null&&(this.entity.polygon.heightReference=Number(e.heightReference));let r=(e.color instanceof Cesium.Color?e.color:Cesium.Color.fromCssColorString(e.color)).withAlpha(e.colorAlpha||1);this.entity.polygon.material=r,e.fill!=null&&(this.entity.polygon.fill=e.fill),this.style=Object.assign(this.style,e)}createPolygon(){let e=this;this.style.color=this.style.color||Cesium.Color.WHITE,this.style.outlineColor=this.style.outlineColor||Cesium.Color.BLACK;let t={polygon:{hierarchy:new Cesium.CallbackProperty(function(){return new Cesium.PolygonHierarchy(e.positions)},!1),heightReference:Number(this.style.heightReference),show:!0,fill:this.style.fill==null?!0:this.style.fill,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color).withAlpha(this.style.colorAlpha||1)}};return this.style.heightReference||(t.polygon.height=0,t.polygon.perPositionHeight=!0),this.viewer.entities.add(t)}createPolyline(){let e=this;return this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions.concat(e.positions[0])},!1),clampToGround:!!this.style.heightReference,material:this.style.outlineColor instanceof Cesium.Color?this.style.outlineColor:Cesium.Color.fromCssColorString(this.style.outlineColor).withAlpha(this.style.outlineColorAlpha||1),width:this.style.outlineWidth||1}})}destroy(){this.handler&&(this.handler.destroy(),this.handler=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.polyline&&(this.viewer.entities.remove(this.polyline),this.polyline=null),this.positions=[],this.style=null,this.modifyPoint&&(this.viewer.entities.remove(this.modifyPoint),this.modifyPoint=null);for(let e=0;e<this.controlPoints.length;e++){let t=this.controlPoints[e];this.viewer.entities.remove(t)}this.controlPoints=[],this.state="no",this.prompt&&this.prompt.destroy(),this.polyline&&(this.polyline=null,this.viewer.entities.remove(this.polyline)),this.forbidDrawWorld(!1)}}class fB extends Jt{constructor(e,t){super(e,t),this.type="rectangle",this.viewer=e,this.style=t||{},this.leftup=null,this.rightdown=null,this.leftdownPoint=null,this.rightupPoint=null,this.entity=null,this.handler=null,this.modifyHandler=null,this.modifyPoint=null,this._dragStartCart=null,this._dragStartCartCarto=null}start(e){!this.prompt&&this.promptStyle?.show&&(this.prompt=new ki(this.viewer,this.promptStyle)),this.state="startCreate",this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.handler.setInputAction(function(n){const s=t.getCatesian3FromPX(n.position,t.viewer,[]);if(s)if(t.entity)t.endCreate(),e&&e(t.entity);else{t.leftup=s.clone(),t.rightdown=s.clone(),t.entity=t._createPolyline();const o=t._calcCornerCartesian("leftdown"),r=t._calcCornerCartesian("rightup");t.leftdownPoint=t.createPoint(o),t.leftdownPoint.typeAttr="leftdown",t.leftdownPoint.show=!1,t.rightupPoint=t.createPoint(r),t.rightupPoint.typeAttr="rightup",t.rightupPoint.show=!1}},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(n){if(!t.entity){t.prompt?.update(n.endPosition,"单击开始绘制");return}t.prompt?.update(n.endPosition,"单击结束");const s=t.getCatesian3FromPX(n.endPosition,t.viewer,[]);s&&(t.rightdown=s.clone(),t._updatePolyline(),t._updateAuxPoints(),t.state="creating")},Cesium.ScreenSpaceEventType.MOUSE_MOVE)}endCreate(){this.handler?.destroy(),this.handler=null,this.leftdownPoint&&(this.leftdownPoint.show=!1),this.rightupPoint&&(this.rightupPoint.show=!1),this.prompt?.destroy(),this.prompt=null,this.state="endCreate"}startEdit(e){if(!this.entity)return;this.state="startEdit",this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas));const t=this;this.leftdownPoint&&(this.leftdownPoint.show=!0),this.rightupPoint&&(this.rightupPoint.show=!0),this.modifyHandler.setInputAction(function(n){const s=t.viewer.scene.pick(n.position);if(!s?.id)return;t.modifyPoint=s.id;const o=t.getCatesian3FromPX(n.position,t.viewer,[t.entity,t.modifyPoint]);o&&(t._dragStartCart=o,t._dragStartCartCarto=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o),t.forbidDrawWorld(!0))},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.modifyHandler.setInputAction(function(n){if(!t.modifyPoint)return;const s=t.getCatesian3FromPX(n.endPosition,t.viewer,[t.entity,t.modifyPoint]);s&&(t.modifyPoint.typeAttr==="leftdown"?t._dragCorner(s,"leftdown"):t.modifyPoint.typeAttr==="rightup"&&t._dragCorner(s,"rightup"),t._updatePolyline(),t._updateAuxPoints(),e&&e(),t.state="editing")},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.modifyHandler.setInputAction(function(){t.modifyPoint=null,t._dragStartCart=null,t._dragStartCartCarto=null,t.forbidDrawWorld(!1),t._updatePolyline(),e&&e(t.entity),t.state="editing"},Cesium.ScreenSpaceEventType.LEFT_UP)}endEdit(e){this.leftdownPoint&&(this.leftdownPoint.show=!1),this.rightupPoint&&(this.rightupPoint.show=!1),this.modifyHandler?.destroy(),this.modifyHandler=null,this.forbidDrawWorld(!1),this.state="endEdit",e&&e(this.entity)}_createPolyline(){const e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(()=>e._buildRectPositions(),!1),width:this.style.outlineWidth||this.style.width||5,material:this.style.color instanceof Cesium.Color?this.style.color:Cesium.Color.fromCssColorString(this.style.color||"#00FF00"),clampToGround:!1}});return t._plotInstance=this,t.objId=this.objId,t}_updatePolyline(){if(!this.entity)return;const e=this._buildRectPositions();try{const t=this.entity.polyline.positions;if(t&&typeof t.getValue=="function")return;if(t&&typeof t.setValue=="function"){t.setValue(e);return}this.entity.polyline.positions=e}catch{this.entity.polyline.positions=e}}_buildRectPositions(){if(!this.leftup||!this.rightdown)return[];const e=this._calcCornerCartesian("leftdown"),t=this.leftup,n=this._calcCornerCartesian("rightup"),s=this.rightdown;return[e,s,n,t,e]}_calcCornerCartesian(e){const t=Cesium.Ellipsoid.WGS84,n=t.cartesianToCartographic(this.leftup),s=t.cartesianToCartographic(this.rightdown),o=Math.min(n.longitude,s.longitude),r=Math.max(n.longitude,s.longitude),a=Math.min(n.latitude,s.latitude),l=Math.max(n.latitude,s.latitude);if(e==="leftdown")return Cesium.Cartesian3.fromRadians(o,a);if(e==="rightup")return Cesium.Cartesian3.fromRadians(r,l)}_updateAuxPoints(){if(!this.leftup||!this.rightdown)return;const e=this._calcCornerCartesian("leftdown"),t=this._calcCornerCartesian("rightup");this.leftdownPoint&&(this.leftdownPoint.position=e),this.rightupPoint&&(this.rightupPoint.position=t)}_dragCorner(e,t){const n=Cesium.Ellipsoid.WGS84,s=n.cartesianToCartographic(this.leftup),o=n.cartesianToCartographic(this.rightdown);let r=Math.min(s.longitude,o.longitude),a=Math.max(s.longitude,o.longitude),l=Math.min(s.latitude,o.latitude),c=Math.max(s.latitude,o.latitude);const h=n.cartesianToCartographic(e);t==="leftdown"?(r=h.longitude,l=h.latitude):(a=h.longitude,c=h.latitude),this.leftup=Cesium.Cartesian3.fromRadians(r,c),this.rightdown=Cesium.Cartesian3.fromRadians(a,l)}syncFromEntity(){if(!this.entity||!this.leftup||!this.rightdown)return;const e=Cesium.Cartesian3.midpoint(this.leftup,this.rightdown,new Cesium.Cartesian3),t=this.entity._centerCoord;if(!t)return;const n=t.x-e.x,s=t.y-e.y,o=t.z-e.z;this.leftup=new Cesium.Cartesian3(this.leftup.x+n,this.leftup.y+s,this.leftup.z+o),this.rightdown=new Cesium.Cartesian3(this.rightdown.x+n,this.rightdown.y+s,this.rightdown.z+o);const r=this.entity.objId,a=this.entity._plotInstance;this.leftdownPoint&&this.viewer.entities.remove(this.leftdownPoint),this.rightupPoint&&this.viewer.entities.remove(this.rightupPoint),this.leftdownPoint=this.rightupPoint=null,this.viewer.entities.remove(this.entity),this.entity=this._createPolyline(),this.entity._plotInstance=a,this.entity.objId=r;const l=this._calcCornerCartesian("leftdown"),c=this._calcCornerCartesian("rightup");this.leftdownPoint=this.createPoint(l),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=this.state==="editing",this.rightupPoint=this.createPoint(c),this.rightupPoint.typeAttr="rightup",this.rightupPoint.show=this.state==="editing"}updatePositions(e){if(!e||e.length<1)return!1;try{if(!this.leftup||!this.rightdown)return!1;let t;if(e[0]instanceof Cesium.Cartesian3)t=e[0];else return!1;this.leftup=Cesium.Cartesian3.add(this.leftup,t,new Cesium.Cartesian3),this.rightdown=Cesium.Cartesian3.add(this.rightdown,t,new Cesium.Cartesian3),this._updatePolyline(),this._updateAuxPoints();try{this.viewer.scene.requestRender()}catch{}return!0}catch(t){return console.warn("Failed to update rectangle positions:",t),!1}}getPositions(e){return e?we.cartesiansToLnglats([this.leftup,this.rightdown],this.viewer):[this.leftup,this.rightdown]}getStyle(){const e=this.entity.polyline,t=e.material.color.getValue();return{color:new Cesium.Color(t.red,t.green,t.blue,1).toCssHexString(),colorAlpha:t.alpha,outlineWidth:e.width.getValue()}}setStyle(e){if(!this.entity)return;const t={...this.style,...e};let n=t.color instanceof Cesium.Color?t.color:Cesium.Color.fromCssColorString(t.color||"#00FF00");t.colorAlpha!=null&&(n=n.withAlpha(t.colorAlpha)),this.entity.polyline.material=n,this.entity.polyline.width=t.outlineWidth||t.width||5,this.style=t}destroy(){try{this.handler?.destroy(),this.modifyHandler?.destroy(),this.entity&&this.viewer.entities.remove(this.entity),this.entity=null,this.leftdownPoint&&this.viewer.entities.remove(this.leftdownPoint),this.rightupPoint&&this.viewer.entities.remove(this.rightupPoint),this.leftdownPoint=this.rightupPoint=null,this.prompt?.destroy(),this.prompt=null}catch{}}createByPositions(e,t){if(!e||e.length<2)return!1;const n=e[0]instanceof Cesium.Cartesian3?e:we.lnglatsToCartesians(e);if(!n||n.length<2)return!1;if(n.length===2)this.leftup=Cesium.Cartesian3.clone(n[0]),this.rightdown=Cesium.Cartesian3.clone(n[1]);else if(n.length>=4){let s=1/0,o=1/0,r=-1/0,a=-1/0;n.forEach(l=>{const c=Cesium.Ellipsoid.WGS84.cartesianToCartographic(l);c&&(s=Math.min(s,c.longitude),o=Math.min(o,c.latitude),r=Math.max(r,c.longitude),a=Math.max(a,c.latitude))}),this.leftup=Cesium.Cartesian3.fromRadians(s,a),this.rightdown=Cesium.Cartesian3.fromRadians(r,o)}if(this.entity?this._updatePolyline():this.entity=this._createPolyline(),!this.leftdownPoint){const s=this._calcCornerCartesian("leftdown");this.leftdownPoint=this.createPoint(s),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=!1}if(!this.rightupPoint){const s=this._calcCornerCartesian("rightup");this.rightupPoint=this.createPoint(s),this.rightupPoint.typeAttr="rightup",this.rightupPoint.show=!1}this._updateAuxPoints(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch(s){console.error("requestRender error:",s)}return t&&t(this.entity),!0}}class pB extends Jt{constructor(e,t){super(e,t),t=t||{},this.movePush=!1,this.type="polyline",this.maxPointNum=t.maxPointNum||Number.MAX_VALUE}updatePositions(e){if(!e||e.length<1)return!1;let t=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);return t?(this.positions=t,this.updateControlPoints(),!0):!1}updateControlPoints(){for(let e=0;e<this.controlPoints.length;e++)this.viewer.entities.remove(this.controlPoints[e]);this.controlPoints=[];for(let e=0;e<this.positions.length;e++){let t=this.positions[e],n=this.createPoint(t);this.style.clampToGround&&(n.point.heightReference=1),n.wz=this.controlPoints.length,this.controlPoints.push(n)}}start(e){!this.prompt&&this.promptStyle.show&&(this.prompt=new ki(this.viewer,this.promptStyle)),this.state="startCreate";let t=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(n){let s=t.getCatesian3FromPX(n.position,t.viewer,[t.entity]);if(!s)return;t.movePush&&(t.positions.pop(),t.movePush=!1),t.positions.push(s);let o=t.createPoint(s);o.wz=t.positions.length-1,t.controlPoints.push(o),t.positions.length==t.maxPointNum&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(function(n){if(t.state="creating",t.positions.length<1){t.prompt.update(n.endPosition,"单击开始绘制"),t.state="startCreate";return}t.prompt.update(n.endPosition,"右键取消上一步,双击结束");let s=t.getCatesian3FromPX(n.endPosition,t.viewer,[t.entity]);s&&(t.movePush?t.positions[t.positions.length-1]=s:(t.positions.push(s),t.movePush=!0),t.positions.length==2&&(Cesium.defined(t.entity)||(t.entity=t.createPolyline())))},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(n){t.entity&&(t.positions.splice(t.positions.length-2,1),t.viewer.entities.remove(t.controlPoints.pop()),t.positions.length==1&&(t.entity&&(t.viewer.entities.remove(t.entity),t.entity=null),t.prompt.update(n.endPosition,"单击开始绘制"),t.movePush=!1,t.positions=[]))},Cesium.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction(function(n){t.entity&&(t.endCreate(),e&&e(t.entity))},Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}endCreate(){let e=this;e.state="endCreate",e.handler&&(e.handler.destroy(),e.handler=null),e.positions.pop(),e.viewer.entities.remove(e.controlPoints.pop()),e.prompt&&(e.prompt.destroy(),e.prompt=null),e.viewer.trackedEntity=void 0,e.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY)}done(){this.state=="startCreate"?this.destroy():this.state=="creating"?this.positions.length<=2&&this.movePush==!0?this.destroy():this.endCreate():(this.state=="startEdit"||this.state=="editing")&&this.endEdit()}createByPositions(e,t){if(!e||e.length<1)return;this.state="startCreate";let n=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);if(n){this.entity=this.createPolyline(this.style),this.positions=n,t&&t(this.entity);for(let s=0;s<n.length;s++){let o=n[s],r=this.createPoint(o);this.style.clampToGround&&(r.point.heightReference=1),r.wz=this.controlPoints.length,this.controlPoints.push(r)}this.state="endCreate"}}setStyle(e){if(!e)return;let t=this.getMaterial(e.material,e);this.entity.polyline.material=t,this.entity.polyline.clampToGround=!!e.clampToGround,e.width&&(this.entity.polyline.width=e.width||3),this.style=Object.assign(this.style,e)}getStyle(){if(!this.entity)return;let e={},t=this.entity.polyline;this.style.animateType!=null&&(e.animateType=this.style.animateType,e.image=this.style.image,e.duration=this.style.duration),t.material instanceof Cesium.ColorMaterialProperty?e.material="common":(e.material="flowline",t.material instanceof animate.FlowLineMaterial,e.duration=t.material._duration,e.image=t.material.url);let n=t.material.color.getValue();e.colorAlpha=n.alpha,e.color=new Cesium.Color(n.red,n.green,n.blue,1).toCssHexString(),e.width=t.width._value;let s=t.clampToGround?t.clampToGround.getValue():!1;return e.clampToGround=!!s,e}createPolyline(){let e=this,t=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions},!1),show:!0,material:this.getMaterial(this.style.animateType,this.style),width:this.style.width||3,clampToGround:this.style.clampToGround}});return t.objId=this.objId,t}getMaterial(e,t){t=t||{};let n=null,s=t.color||Cesium.Color.WHITE;return s=s instanceof Cesium.Color?s:Cesium.Color.fromCssColorString(t.color),s=s.withAlpha(t.colorAlpha||1),e=="flowline"||e=="flyline"||(n=s),n}updatePositions(e){if(!e||e.length<1)return!1;let t=e[0]instanceof Cesium.Cartesian3?e:util.lnglatsToCartesians(e);return t?(this.positions=t,this.updateControlPoints(),!0):!1}updateControlPoints(){for(let e=0;e<this.controlPoints.length;e++)this.viewer.entities.remove(this.controlPoints[e]);this.controlPoints=[];for(let e=0;e<this.positions.length;e++){let t=this.positions[e],n=this.createPoint(t);this.style.clampToGround&&(n.point.heightReference=1),n.wz=this.controlPoints.length,this.controlPoints.push(n)}}getPositions(e){return e?util.cartesiansToLnglats(this.positions,this.viewer):this.positions}}class mB extends Jt{constructor(e,t={}){super(e,t),this.type="freehandLine",this.maxPositions=t.maxPositions||1e4,this.minDistance=t.minDistance||2,this.renderInterval=t.renderInterval||30,this.style=Object.assign({smoothness:2,angleThreshold:3,curveResolution:3},t||{}),this.positions=[],this._stagingBuffer=[],this._flushScheduled=!1,this._flushRAF=null,this._lastFlushTime=0,this.isDrawing=!1,this.handler=null,this.startPointEntity=null,this.entity=null,this.lastAddPosition=null}start(e){if(this.state==="creating"||this.state==="startCreate")return;if(this.state="startCreate",this.positions=[],this._stagingBuffer.length=0,this._lastFlushTime=0,this.isDrawing=!1,this.lastAddPosition=null,this._cancelFlush(),!this.prompt&&this.promptStyle&&this.promptStyle.show&&Promise.resolve().then(()=>$f).then(({default:n})=>{this.prompt=new n(this.viewer,this.promptStyle)}),this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.startPointEntity){try{this.viewer.entities.remove(this.startPointEntity)}catch{}this.startPointEntity=null}this.entity=this.createFreehandLine();const t=this;this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(n){t.state="creating",t.isDrawing=!0,t.forbidDrawWorld(!0),t.positions=[],t._stagingBuffer.length=0,t.lastAddPosition=null;let s=t._fastPick(n.position);if(!s){t.isDrawing=!1;return}const o=Cesium.Cartesian3.clone(s);if(t._pushToStaging(o),t.lastAddPosition=o,t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t.startPointEntity=t.viewer.entities.add({position:o,point:{pixelSize:6,color:Cesium.Color.RED,outlineColor:Cesium.Color.WHITE,outlineWidth:1}}),t._scheduleFlush(!0)},Cesium.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction(function(n){if(!t.isDrawing){t.prompt&&n&&n.endPosition&&t.prompt.update(n.endPosition,"单击开始绘制");return}if(t.prompt&&n&&n.endPosition&&t.prompt.update(n.endPosition,"松键结束"),!n||!n.endPosition||t.positions.length+t._stagingBuffer.length>=t.maxPositions)return;let s=t._fastPick(n.endPosition);if(!s||t.lastAddPosition&&Cesium.Cartesian3.distance(t.lastAddPosition,s)<=t.minDistance)return;const o=Cesium.Cartesian3.clone(s);t._pushToStaging(o),t.lastAddPosition=o,t._scheduleFlush()},Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(n){if(t.isDrawing){if(t.prompt&&t.prompt.update(null,"单击结束绘制"),t.isDrawing=!1,t.forbidDrawWorld(!1),t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t._scheduleFlush(!0),t.endCreate(e)}},Cesium.ScreenSpaceEventType.LEFT_UP),this.handler.setInputAction(function(n){if(t.isDrawing){if(t.prompt&&t.prompt.update(null,"单击结束绘制"),t.isDrawing=!1,t.forbidDrawWorld(!1),t.startPointEntity){try{t.viewer.entities.remove(t.startPointEntity)}catch{}t.startPointEntity=null}t._scheduleFlush(!0),t.endCreate(e)}},Cesium.ScreenSpaceEventType.RIGHT_DOWN)}_pushToStaging(e){this._stagingBuffer.push(e)}_scheduleFlush(e=!1){if(this._flushRAF){e&&(this._forceImmediate=!0);return}this._forceImmediate=e||!1;const t=this,n=function(){t._flushRAF=null;const s=performance.now();(t._forceImmediate||s-t._lastFlushTime>=t.renderInterval)&&(t._flushToPositions(),t._lastFlushTime=s),t._forceImmediate=!1};this._flushRAF=requestAnimationFrame(n)}_cancelFlush(){if(this._flushRAF){try{cancelAnimationFrame(this._flushRAF)}catch{}this._flushRAF=null}this._forceImmediate=!1}_fastPick(e){if(this.viewer.scene.mode===Cesium.SceneMode.SCENE2D){const n=this.viewer.camera.getPickRay(e);let s=null;return n&&(s=this.viewer.scene.globe.pick(n,this.viewer.scene)),s||(s=this.viewer.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),s}let t=null;try{t=this.viewer.scene.pickPosition(e)}catch{}if(!t){const n=this.viewer.camera.getPickRay(e);n&&(t=this.viewer.scene.globe.pick(n,this.viewer.scene))}return t}_flushToPositions(){if(!this._stagingBuffer||this._stagingBuffer.length===0)return;const e=this._stagingBuffer;this._stagingBuffer=[];const t=Math.max(0,Math.min(2,Number(this.style.smoothness||1)));let n=e;if(t>0){const a=(h,u)=>{if(!h||h.length<2)return h;u=Math.max(1,u|0);const p=[h[0]],f=h.length;for(let m=0;m<f-1;m++){const y=m>0?h[m-1]:h[m],g=h[m],A=h[m+1],v=m+2<f?h[m+2]:h[m+1];for(let b=1;b<u;b++){const C=b/u,x=C*C,I=x*C,E=-.5*y.x+1.5*g.x-1.5*A.x+.5*v.x,S=-.5*y.y+1.5*g.y-1.5*A.y+.5*v.y,w=-.5*y.z+1.5*g.z-1.5*A.z+.5*v.z,T=y.x-2.5*g.x+2*A.x-.5*v.x,_=y.y-2.5*g.y+2*A.y-.5*v.y,F=y.z-2.5*g.z+2*A.z-.5*v.z,U=-.5*y.x+.5*A.x,L=-.5*y.y+.5*A.y,D=-.5*y.z+.5*A.z,M=g.x,k=g.y,B=g.z,P=E*I+T*x+U*C+M,V=S*I+_*x+L*C+k,G=w*I+F*x+D*C+B;p.push(new Cesium.Cartesian3(P,V,G))}p.push(A)}return p},l=Math.max(1,Number(this.style.curveResolution)||1);n.length<200&&l>1&&(n=a(n,l));const c=h=>{if(!h||h.length<2)return h;const u=[];u.push(h[0]);for(let p=0;p<h.length-1;p++){const f=h[p],m=h[p+1],y=new Cesium.Cartesian3(f.x*.75+m.x*.25,f.y*.75+m.y*.25,f.z*.75+m.z*.25),g=new Cesium.Cartesian3(f.x*.25+m.x*.75,f.y*.25+m.y*.75,f.z*.25+m.z*.75);u.push(y),u.push(g)}return u.push(h[h.length-1]),u};n=n.slice(),n.length<300&&(n=c(n),t===2&&n.length<300&&(n=c(n)))}const s=(Number(this.style.angleThreshold)||6)*(Math.PI/180),o=this.positions,r=(a,l,c,h)=>{if(!a||!l||!c)return!1;const u=l.x-a.x,p=l.y-a.y,f=l.z-a.z,m=c.x-l.x,y=c.y-l.y,g=c.z-l.z,A=Math.hypot(u,p,f),v=Math.hypot(m,y,g);if(A===0||v===0)return!1;const b=(u*m+p*y+f*g)/(A*v),C=Math.max(-1,Math.min(1,b)),x=Math.acos(C);return Math.abs(x)<=h};for(let a=0;a<n.length;a++){const l=n[a];if(o.length===0){o.push(Cesium.Cartesian3.clone(l));continue}const c=o[o.length-1];if(!(Cesium.Cartesian3.distance(c,l)<=this.minDistance*.5)){if(o.length>=2){const u=o[o.length-2],p=o[o.length-1],f=l;if(r(u,p,f,s)){o.pop(),o.push(Cesium.Cartesian3.clone(f));continue}}if(o.push(Cesium.Cartesian3.clone(l)),o.length>this.maxPositions){const u=o.length-this.maxPositions;u>0&&o.splice(0,u)}}}try{this.viewer.scene.requestRender()}catch{}}endCreate(e){if(this.state==="endCreate")return;if(this.state="endCreate",this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}if(this._flushToPositions(),this._cancelFlush(),!this.positions||this.positions.length<2){if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}e&&e(null);return}const t=this.positions.map(n=>Cesium.Cartesian3.clone(n));this.positions=t;try{this.viewer.scene.requestRender()}catch{}e&&e(this.entity)}done(e){this.isDrawing&&(this.isDrawing=!1,this.forbidDrawWorld(!1),this.endCreate(e))}createFreehandLine(){const e=this,t=this.getMaterial(this.style.animateType,this.style),n=this.viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(function(){return e.positions||[]},!1),show:!0,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1}});return n.objId=this.objId||null,this.entity=n,n}getMaterial(e,t){t=t||{};try{let n=t.color||Cesium.Color.RED;typeof n=="string"&&(n=Cesium.Color.fromCssColorString(n));const s=t.colorAlpha!==void 0?t.colorAlpha:1;return n=n.withAlpha(s),n}catch{return Cesium.Color.RED}}updatePositions(e){if(!e||e.length<1)return!1;try{let t=[];if(e[0]instanceof Cesium.Cartesian3?t=e.map(n=>Cesium.Cartesian3.clone(n)):t=we&&we.lnglatsToCartesians?we.lnglatsToCartesians(e):e,!t||t.length===0)return!1;this.positions=t.map(n=>Cesium.Cartesian3.clone(n)),this._stagingBuffer.length=0;try{this.viewer.scene.requestRender()}catch{}return!0}catch{return!1}}setStyle(e){if(!e||(this.style=Object.assign(this.style||{},e),!this.entity||!this.entity.polyline))return;const t=this.getMaterial(this.style.animateType,this.style);try{this.entity.polyline.material=t}catch{}if(e.width!==void 0)try{this.entity.polyline.width=e.width}catch{}if(e.clampToGround!==void 0)try{this.entity.polyline.clampToGround=!!e.clampToGround}catch{}}createByPositions(e,t){if(!e||e.length<1)return!1;const n=e[0]instanceof Cesium.Cartesian3?e:we.lnglatsToCartesians(e);if(!n||n.length<1)return!1;this.positions=n.map(s=>Cesium.Cartesian3.clone(s)),this.entity||this.createFreehandLine(),this.state="endCreate";try{this.viewer.scene.requestRender()}catch{}return t&&t(this.entity),!0}destroy(){if(this._cancelFlush(),this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this.entity){try{this.viewer.entities.remove(this.entity)}catch{}this.entity=null}if(this.startPointEntity){try{this.viewer.entities.remove(this.startPointEntity)}catch{}this.startPointEntity=null}this.positions=[],this._stagingBuffer=[],this.isDrawing=!1;try{this.endCreate()}catch{}}}class gB extends Jt{constructor(e,t={}){if(!e)throw new Error("CreateArrow requires viewer");if(super(e,t),this.type="arrow",this.style=t||{},this.arrowAngle=t.arrowAngle||Math.PI/6,this.positions=[],this.lineEntity=null,this.arrowEntity=null,this.controlPoints=[],this.handler=null,this._finalized=!1,this._editRenderHandler=null,this.Cesium=this._getCesium(),!this.Cesium)throw new Error("Cesium not found")}_getCesium(){return typeof window<"u"&&window.Cesium?window.Cesium:typeof Cesium<"u"?Cesium:this.viewer&&this.viewer.constructor&&this.viewer.constructor.Cesium?this.viewer.constructor.Cesium:null}start(e){if(!this.viewer||!this.Cesium)return e&&e(null),this;if(this.state==="creating"||this.state==="startCreate")return this;this.state="startCreate",this._cleanup(!1),!this.prompt&&this.promptStyle&&this.promptStyle.show&&Promise.resolve().then(()=>$f).then(({default:n})=>{this.prompt=new n(this.viewer,this.promptStyle)}).catch(()=>{});try{this.forbidDrawWorld(!0)}catch{}const t=this;return this.handler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(function(n){if(t.state==="startCreate"){t.state="creating",t._finalized=!1;let s=t.getCatesian3FromPX(n.position);if(!s)return;t.positions=[t.Cesium.Cartesian3.clone(s),t.Cesium.Cartesian3.clone(s)],t._createLineEntity(),t._createArrowEntity(),t._createControlPoints(),t.prompt&&n&&n.position&&t.prompt.update(n.position,"再次单击完成绘制")}else if(t.state==="creating"){if(t.state="endCreate",t._finalized=!0,t._finalizeEntities(),t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}if(t.handler){try{t.handler.destroy()}catch{}t.handler=null}try{t.forbidDrawWorld(!1)}catch{}e&&e(t.entity||t.lineEntity)}try{t.viewer.scene.requestRender()}catch{}},this.Cesium.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction(function(n){if(t.state==="startCreate"){t.prompt&&n&&n.endPosition&&t.prompt.update(n.endPosition,"单击开始绘制");return}if(t.state==="creating"){let s=t.getCatesian3FromPX(n.endPosition);if(!s)return;if(t.positions[1]=s,t.controlPoints[1])try{t.controlPoints[1].position.setValue(s)}catch{}try{t.viewer.scene.requestRender()}catch{}}},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(function(){if(t.state==="creating"){if(t.state="endCreate",t._finalized=!1,t.lineEntity){try{t.viewer.entities.remove(t.lineEntity)}catch{}t.lineEntity=null}if(t.arrowEntity){try{t.viewer.entities.remove(t.arrowEntity)}catch{}t.arrowEntity=null}t.controlPoints.length&&(t.controlPoints.forEach(n=>{try{t.viewer.entities.remove(n)}catch{}}),t.controlPoints=[])}if(t.prompt){try{t.prompt.destroy()}catch{}t.prompt=null}if(t.handler){try{t.handler.destroy()}catch{}t.handler=null}try{t.forbidDrawWorld(!1)}catch{}e&&e(null)},this.Cesium.ScreenSpaceEventType.RIGHT_DOWN),this}_computeArrowPositions(e,t){if(!e||!t)return[];const n=this.Cesium.Cartesian3.distance(e,t);if(n<=1e-6)return[];const s=this.style.arrowLengthFactor!==void 0?this.style.arrowLengthFactor:.15,o=this.style.arrowMinSize!==void 0?this.style.arrowMinSize:1.5,r=this.style.arrowMaxSize!==void 0?this.style.arrowMaxSize:Number.MAX_VALUE;let a=this.style.arrowFixedSize!==void 0?this.style.arrowFixedSize:n*s;a<o&&(a=o),a>r&&(a=r);const l=this.Cesium.Cartesian3.subtract(t,e,new this.Cesium.Cartesian3);this.Cesium.Cartesian3.normalize(l,l);const c=this.Cesium.Transforms.eastNorthUpToFixedFrame(t),h=this.Cesium.Matrix4.getColumn(c,2,new this.Cesium.Cartesian3),u=new this.Cesium.Cartesian3(l.x-h.x*this.Cesium.Cartesian3.dot(l,h),l.y-h.y*this.Cesium.Cartesian3.dot(l,h),l.z-h.z*this.Cesium.Cartesian3.dot(l,h));let p;this.Cesium.Cartesian3.magnitudeSquared(u)<1e-6?p=this.Cesium.Matrix4.getColumn(c,0,new this.Cesium.Cartesian3):(this.Cesium.Cartesian3.normalize(u,u),p=this.Cesium.Cartesian3.cross(h,u,new this.Cesium.Cartesian3),this.Cesium.Cartesian3.normalize(p,p));const f=this.Cesium.Cartesian3.multiplyByScalar(l,-a,new this.Cesium.Cartesian3),m=this.Cesium.Cartesian3.add(t,f,new this.Cesium.Cartesian3),y=this.style.arrowWidthScale!==void 0?this.style.arrowWidthScale:1,g=Math.sin(this.arrowAngle)*a*y,A=this.Cesium.Cartesian3.multiplyByScalar(p,g,new this.Cesium.Cartesian3),v=this.Cesium.Cartesian3.multiplyByScalar(p,-g,new this.Cesium.Cartesian3),b=this.Cesium.Cartesian3.add(m,A,new this.Cesium.Cartesian3),C=this.Cesium.Cartesian3.add(m,v,new this.Cesium.Cartesian3);return[t,b,C,t]}_createLineEntity(){if(this.lineEntity){try{this.viewer.entities.remove(this.lineEntity)}catch{}this.lineEntity=null}const e=this,t=this._getMaterial(),n=new this.Cesium.CallbackProperty(function(){return!e.positions||e.positions.length<2?[]:[e.positions[0],e.positions[1]]},!1);this.lineEntity=this.viewer.entities.add({polyline:{positions:n,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1},objId:this.objId}),this.entity=this.lineEntity}_createArrowEntity(){if(this.arrowEntity){try{this.viewer.entities.remove(this.arrowEntity)}catch{}this.arrowEntity=null}const e=this,t=this._getMaterial(),n=new this.Cesium.CallbackProperty(function(){if(!e.positions||e.positions.length<2)return[];const s=e.positions[0],o=e.positions[1];return e._computeArrowPositions(s,o)},!1);this.arrowEntity=this.viewer.entities.add({polyline:{positions:n,material:t,width:this.style.width||3,clampToGround:!!this.style.clampToGround||!1},objId:this.objId}),this.arrowEntity}_createControlPoints(){if(this.controlPoints&&this.controlPoints.length&&(this.controlPoints.forEach(e=>{try{this.viewer.entities.remove(e)}catch{}}),this.controlPoints=[]),!(!this.positions||this.positions.length<2))for(let e=0;e<2;e++)try{const t=this.createPoint(this.positions[e]);t.wz=e,this.controlPoints.push(t)}catch{}}_finalizeEntities(){if(this.lineEntity&&this.lineEntity.polyline)try{const e=this.Cesium.Cartesian3.clone(this.positions[0]),t=this.Cesium.Cartesian3.clone(this.positions[1]);this.lineEntity.polyline.positions=[e,t]}catch{}if(this.arrowEntity&&this.arrowEntity.polyline)try{const e=this.positions[0],t=this.positions[1];this.arrowEntity.polyline.positions=this._computeArrowPositions(e,t)}catch{}this.entity=this.lineEntity,this.entity&&(this.entity.arrowEntity=this.arrowEntity,this.entity.positions=[this.positions[0],this.positions[1]],this.positions=[this.positions[0],this.positions[1]]);try{this.viewer.scene.requestRender()}catch{}}startEdit(e){super.startEdit(e),(!this.controlPoints||this.controlPoints.length<2)&&this._createControlPoints();for(let t=0;t<this.controlPoints.length;t++)try{this.controlPoints[t].show=!0}catch{}if(this.lineEntity&&this.lineEntity.polyline)try{const t=this;this.lineEntity.polyline.positions=new this.Cesium.CallbackProperty(function(){return!t.positions||t.positions.length<2?[]:[t.positions[0],t.positions[1]]},!1)}catch{}if(this.arrowEntity&&this.arrowEntity.polyline)try{const t=this;this.arrowEntity.polyline.positions=new this.Cesium.CallbackProperty(function(){if(!t.positions||t.positions.length<2)return[];const n=t.positions[0],s=t.positions[1];return t._computeArrowPositions(n,s)},!1)}catch{}if(!this._editRenderHandler){this._editRenderHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);const t=this;this._editRenderHandler.setInputAction(function(n){if(t.modifyPoint)try{t.viewer.scene.requestRender()}catch{}},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE)}}endEdit(e){if(super.endEdit(e),this._editRenderHandler){try{this._editRenderHandler.destroy()}catch{}this._editRenderHandler=null}this._finalized=!0,this._finalizeEntities()}createByPositions(e,t){if(!e||e.length<2)return!1;let n=e[0],s=e[1];if(!(n instanceof this.Cesium.Cartesian3))if(Array.isArray(n)&&n.length>=2)n=this.Cesium.Cartesian3.fromDegrees(n[0],n[1]),s=this.Cesium.Cartesian3.fromDegrees(s[0],s[1]);else return!1;return this.positions=[this.Cesium.Cartesian3.clone(n),this.Cesium.Cartesian3.clone(s)],this._createLineEntity(),this._createArrowEntity(),this._createControlPoints(),this._finalized=!0,this._finalizeEntities(),this.state="endCreate",t&&t(this.entity||this.lineEntity),!0}updatePositions(e){if(!e||e.length<2)return!1;let t=e[0],n=e[1];if(!(t instanceof this.Cesium.Cartesian3))if(Array.isArray(t)&&t.length>=2)t=this.Cesium.Cartesian3.fromDegrees(t[0],t[1]),n=this.Cesium.Cartesian3.fromDegrees(n[0],n[1]);else return!1;return this.positions=[this.Cesium.Cartesian3.clone(t),this.Cesium.Cartesian3.clone(n)],this.lineEntity||this._createLineEntity(),this.arrowEntity||this._createArrowEntity(),this._createControlPoints(),this._finalized=!0,this._finalizeEntities(),!0}setStyle(e){if(!e)return;this.style=Object.assign(this.style||{},e),e.arrowAngle!==void 0&&(this.arrowAngle=e.arrowAngle);const t=this._getMaterial();if(this.lineEntity&&this.lineEntity.polyline){try{this.lineEntity.polyline.material=t}catch{}if(e.width!==void 0)try{this.lineEntity.polyline.width=e.width}catch{}}if(this.arrowEntity&&this.arrowEntity.polyline)try{this.arrowEntity.polyline.material=t}catch{}}endCreate(e){if(this.state!=="endCreate"){if(this.state="endCreate",this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}if(this._finalized=!0,this._finalizeEntities(),this.handler){try{this.handler.destroy()}catch{}this.handler=null}try{this.forbidDrawWorld(!1)}catch{}e&&e(this.entity||this.lineEntity)}}done(e){this.isDrawing&&(this.isDrawing=!1,this.endCreate(e))}getEntity(){return this.entity||this.lineEntity}destroy(){this._cleanup(!0),this.state=null}_cleanup(e=!0){if(this.handler){try{this.handler.destroy()}catch{}this.handler=null}if(this._editRenderHandler){try{this._editRenderHandler.destroy()}catch{}this._editRenderHandler=null}if(e){if(this.lineEntity){try{this.viewer.entities.remove(this.lineEntity)}catch{}this.lineEntity=null}if(this.arrowEntity){try{this.viewer.entities.remove(this.arrowEntity)}catch{}this.arrowEntity=null}this.controlPoints&&this.controlPoints.length&&(this.controlPoints.forEach(t=>{try{this.viewer.entities.remove(t)}catch{}}),this.controlPoints=[]),this.entity=null}if(this.prompt){try{this.prompt.destroy()}catch{}this.prompt=null}this.positions=[],this.isDrawing=!1,this._finalized=!1;try{this.forbidDrawWorld(!1)}catch{}}_getMaterial(){try{let e=this.style.color||this.Cesium.Color.RED;typeof e=="string"&&(e=this.Cesium.Color.fromCssColorString(e));const t=this.style.colorAlpha!==void 0?this.style.colorAlpha:1;return e.withAlpha(t)}catch{return this.Cesium.Color.RED}}}class yB{constructor(e,t){if(!e){console.warn("缺少必要参数!--viewer");return}if(t=t||{},this.viewer=e,this.Cesium=window.Cesium||window.cesium,this.entityObjArr=[],this.handler=null,!this.Cesium){console.error("Cesium实例未找到!");return}this.removeHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.startEditFun=null,this.endEditFun=null,this.removeFun=null,this.editingFun=void 0,this.deleteEntityObj=null,this.bindEdit(),this.bindRemove(),this.canEdit=t.canEdit==null?!0:t.canEdit,this.fireEdit=t.fireEdit==null?!0:t.fireEdit,this.nowDrawEntityObj=null,this.nowEditEntityObj=null}on(e,t){e=="startEdit"&&(this.startEditFun=t),e=="endEdit"&&(this.endEditFun=t),e=="remove"&&(this.removeFun=t),e=="endCreate"&&(this.endCreateFun=t),e=="editing"&&(this.editingFun=t)}openEdit(){this.canEdit=!0}closeEdit(){this.endEdit(),this.canEdit=!1}start(e){if(!e||!e.type)return;e.id=e.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0));let t=this;this.endEdit(),this.nowDrawEntityObj&&(this.nowDrawEntityObj.state=="startCreate"||this.nowDrawEntityObj.state=="creating")&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null);let n=this.createByType(e);if(n)return n.attr=e||{},n.start(function(s){t.nowDrawEntityObj=void 0,t.entityObjArr.push(n),e.success&&e.success(n,s),t.endCreateFun&&t.endCreateFun(n,s),e.show==!1&&n.setVisible(!1),t.canEdit&&t.fireEdit&&(n.startEdit(function(){t.editingFun&&t.editingFun(n,n.entity)}),t.nowEditEntityObj=n,t.startEditFun&&t.startEditFun(n,s))}),this.nowDrawEntityObj=n,n}end(){this.nowDrawEntityObj}startEditOne(e){if(!this.canEdit)return;this.nowEditEntityObj&&(this.nowEditEntityObj.endEdit(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=null);let t=this;e&&(e.startEdit(function(){t.editingFun&&t.editingFun(e,e.entity)}),this.startEditFun&&this.startEditFun(e,e.getEntity()),this.nowEditEntityObj=e)}updateOneStyle(e,t){e&&e.setStyle(t)}createByPositions(e){if(e=e||{},e||(e={}),!e.positions)return;e.id=e.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0));let t=this,n=this.createByType(e);if(n)return n.attr=e,n.createByPositions(e.positions,function(s){t.entityObjArr.push(n),n.setStyle(e.style),e.success&&e.success(n,s),t.endCreateFun&&t.endCreateFun(n,s),e.show==!1&&n.setVisible(!1),t.canEdit&&t.fireEdit&&(n.startEdit(function(){t.editingFun&&t.editingFun(n,n.entity)}),t.startEditFun&&t.startEditFun(n,s),t.nowEditEntityObj=n)}),n}createByGeojson(e){let{features:t}=e,n=[];for(let s=0;s<t.length;s++){let o=t[s];const{properties:r,geometry:a}=o;let l=r.plotType;const c=a.type,h=a.coordinates;let u=[],p="";switch(c){case"LineString":u=we.lnglatsToCartesians(h),p="polyline";break;case"Polygon":u=we.lnglatsToCartesians(h[0]),p="polygon";break;case"Point":u=we.lnglatsToCartesians([h])[0],p=l;break}this.fireEdit=!1;let f=this.createByPositions({type:p,styleType:l,positions:u,style:r.style});f&&n.push(f)}return n}toGeojson(){let e={type:"FeatureCollection",features:[]};if(this.entityObjArr.length==0)return null;for(let t=0;t<this.entityObjArr.length;t++){let n=this.entityObjArr[t],s=n.getPositions(!0),o=[];for(let c=0;c<s.length;c++)o.push([s[c][0],s[c][1]]);let r=n.getStyle(),a=this.transType(n.type),l={type:"Feature",properties:{plotType:n.type,style:r},geometry:{type:a,coordinates:[]}};switch(a){case"Polygon":l.geometry.coordinates=[o];break;case"Point":l.geometry.coordinates=o;break;case"LineString":l.geometry.coordinates=o;break}l.properties=Object.assign(l.properties,n.properties),e.features.push(l)}return e}transType(e){let t="";switch(e){case"polyline":t="LineString";break;case"polygon":t="Polygon";break;case"point":case"gltfModel":case"label":case"billboard":t="Point";break;default:t=e}return t}destroy(){this.nowEditEntityObj&&(this.nowEditEntityObj.destroy(),this.nowEditEntityObj=null),this.nowDrawEntityObj&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].destroy();this.entityObjArr=[],this.nowEditEntityObj=null,this.handler&&(this.handler.destroy(),this.handler=null),this.removeHandler&&(this.removeHandler.destroy(),this.removeHandler=null)}removeOne(e){e&&e&&(e.state!="endCreate"||e.state!="endEdit"?e.destroy():this.removeByObjId(e.objId))}removeAll(){this.nowDrawEntityObj&&(this.nowDrawEntityObj.destroy(),this.nowDrawEntityObj=null),this.nowEditEntityObj&&(this.nowEditEntityObj.destroy(),this.nowEditEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].destroy();this.entityObjArr=[],this.nowEditEntityObj=null}hasEntityObj(e){return e?this.getEntityObjByObjId(e.objId)!={}:!1}removeByObjId(e){let t=this.getEntityObjByObjId(e);this.entityObjArr.splice(t.index,1),this.removeFun&&this.removeFun(t.entityObj,t.entityObj.getEntity()),t.entityObj&&t.entityObj.destroy()}removeById(e){let t=this.getEntityObjById(e);this.entityObjArr.splice(t.index,1),this.removeFun&&this.removeFun(t.entityObj,t.entityObj.getEntity()),t.entityObj&&t.entityObj.destroy()}zoomToByObjId(e){let t=this.getEntityObjByObjId(e);t.entityObj&&t.entityObj.zoomTo()}getEntityObjByField(e,t){let n={};if(t)for(let s=0;s<this.entityObjArr.length;s++){let o=this.entityObjArr[s];if(o.attr[e]==t){n.entityObj=o,n.index=s;break}}else for(let s=0;s<this.entityObjArr.length;s++){let o=this.entityObjArr[s];if(o.attr.id==e){n.entityObj=o,n.index=s;break}}return n}setVisible(e,t){let n=this.getEntityObjByField("id",e);n.entityObj&&n.entityObj.setVisible(t)}getEntityObjByObjId(e){if(!e)return;let t={};for(let n=0;n<this.entityObjArr.length;n++){let s=this.entityObjArr[n];if(s.objId==e){t.entityObj=s,t.index=n;break}}return t}getEntityObjById(e){if(!e)return;let t={};for(let n=0;n<this.entityObjArr.length;n++){let s=this.entityObjArr[n];if(s.attr.id==e){t.entityObj=s,t.index=n;break}}return t}bindEdit(){let e=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(t){if(!e.canEdit||e.nowDrawEntityObj)return;const n=e.viewer.scene.drillPick(t.position)||[];let s=-1,o;for(let r=0;r<n.length&&s===-1;r++){const a=n[r].id;if(a){for(let l=0;l<e.entityObjArr.length;l++)if(a.objId==e.entityObjArr[l].objId&&e.entityObjArr[l].state!="startCreate"&&e.entityObjArr[l].state!="creating"){s=l,o=a;break}}}s!==-1?(e.nowEditEntityObj&&(e.nowEditEntityObj.endEdit(),e.endEditFun&&e.endEditFun(e.nowEditEntityObj,e.nowEditEntityObj.getEntity()),e.nowEditEntityObj=null),e.entityObjArr[s].startEdit(function(){e.editingFun&&e.editingFun(e.nowEditEntityObj,e.nowEditEntityObj.entity)}),e.startEditFun&&e.startEditFun(e.entityObjArr[s],o),e.nowEditEntityObj=e.entityObjArr[s]):e.nowEditEntityObj&&(e.nowEditEntityObj.endEdit(),e.endEditFun&&e.endEditFun(e.nowEditEntityObj,e.nowEditEntityObj.getEntity()),e.nowEditEntityObj=void 0)},Cesium.ScreenSpaceEventType.LEFT_CLICK)}bindRemove(){let e=this;this.handler||(this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.handler.setInputAction(function(t){if(!e.canEdit||e.nowDrawEntityObj)return;const n=e.viewer.scene.drillPick(t.position)||[];let s;for(let o=0;o<n.length;o++){const r=n[o].id;if(r){for(let a=0;a<e.entityObjArr.length;a++)if(r.objId==e.entityObjArr[a].objId){s=r.objId;break}if(s)break}}s&&e.createDelteDom(t.position,s)},Cesium.ScreenSpaceEventType.RIGHT_CLICK)}createDelteDom(e,t){if(!t)return;let n=window.document.createElement("span");n.style.background="rgba(0,0,0,0.5)",n.style.position="absolute",n.style.color="white",n.style.left=e.x+10+"px",n.style.top=e.y+10+"px",n.style.padding="4px",n.style.cursor="pointer",n.id="easy3d-plot-delete",n.setAttribute("objId",t),n.innerHTML="删除",window.document.getElementById(this.viewer.container.id).appendChild(n);const o=window.document.getElementById("easy3d-plot-delete");if(!o)return;let r=this;o.addEventListener("click",a=>{let l=n.getAttribute("objId");r.removeByObjId(l)}),document.addEventListener("click",function(){o.remove()})}endEdit(){this.nowEditEntityObj&&(this.nowEditEntityObj.endEdit(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=null);for(let e=0;e<this.entityObjArr.length;e++)this.entityObjArr[e].endEdit()}done(){this.nowEditEntityObj&&(this.nowEditEntityObj.done(),this.endEditFun&&this.endEditFun(this.nowEditEntityObj,this.nowEditEntityObj.getEntity()),this.nowEditEntityObj=void 0),this.nowDrawEntityObj&&(this.nowDrawEntityObj.done(),this.entityObjArr.push(this.nowDrawEntityObj),this.endCreateFun&&this.endCreateFun(this.nowDrawEntityObj,this.nowDrawEntityObj.getEntity()),this.nowDrawEntityObj=void 0)}getEntityObjArr(){return this.entityObjArr}createByType(e){let t,n="";return e=e||{},e.type=="polyline"&&(t=new pB(this.viewer,e.style),n="折线_"),e.type=="freehandLine"&&(t=new mB(this.viewer,e.style),n="手绘线_"),e.type=="polygon"&&(t=new uB(this.viewer,e.style),n="面_"),e.type=="billboard"&&(t=new kS(this.viewer,e.style),n="图标_"),(e.type=="circle"||e.type=="ellipse")&&(t=new PS(this.viewer,e.style),n="圆_"),e.type=="rectangle"&&(t=new fB(this.viewer,e.style),n="矩形_"),e.type=="gltfModel"&&(t=new DS(this.viewer,e.style),n="模型_"),e.type=="point"&&(t=new hB(this.viewer,e.style),n="点_"),e.type=="label"&&(t=new dB(this.viewer,e.style),n="文字_"),e.type=="arrow"&&(t=new gB(this.viewer,e.style)),t&&(t.name=n+new Date().getTime()),t}}class um{viewer;Cesium;drawTool;flatTool;tileset;tilesets;flatTools;selectedEntityObj;selectionOutline;centerHandle;_dragHandler;_listeners;currentColor;currentWidth;originalDoubleClickAction=null;constructor({viewer:e,cesium:t}){window.Cesium=t,this.viewer=e,this.Cesium=t,this.drawTool=null,this.flatTool=null,this.tileset=null,this.tilesets=null,this.flatTools=null,this.selectedEntityObj=null,this.selectionOutline=null,this.centerHandle=null,this._dragHandler=null,this._listeners=[],this.currentColor=this.Cesium.Color.fromCssColorString("#ff0000"),this.currentWidth=1,this.originalDoubleClickAction=this.viewer.screenSpaceEventHandler.getInputAction(this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.viewer.screenSpaceEventHandler.removeInputAction(this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.initDrawTool()}setCurrentColor(e){typeof e=="string"?this.currentColor=this.Cesium.Color.fromCssColorString(e):this.currentColor=e}setCurrentWidth(e){this.currentWidth=e}initDrawTool(){this.drawTool||(this.drawTool=new yB(this.viewer,{canEdit:!0,fireEdit:!0}),this.drawTool.on("startEdit",(e,t)=>{this.selectedEntityObj=e,this.showEntityOutline(e)}),this.drawTool.on("endEdit",(e,t)=>{this.selectedEntityObj=null,this.hideEntityOutline()}),this.drawTool.on("remove",(e,t)=>{this.selectedEntityObj===e&&(this.selectedEntityObj=null,this.hideEntityOutline())}))}showEntityOutline(e){this.hideEntityOutline(),!(!e||!e.getEntity())&&this.createCenterHandle(e)}hideEntityOutline(){if(this.selectionOutline){try{this.viewer.entities.remove(this.selectionOutline)}catch{}this.selectionOutline=null}if(this.centerHandle){try{this.viewer.entities.remove(this.centerHandle)}catch{}this.centerHandle=null}if(this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}}createCenterHandle(e){if(!e||!e.getEntity())return;if(this.centerHandle){try{this.viewer.entities.remove(this.centerHandle)}catch{}this.centerHandle=null}const t=e.getEntity();let n=null;if(t._plotInstance&&typeof t._plotInstance.syncFromEntity=="function")try{t._plotInstance.syncFromEntity();const s=t._plotInstance;s.leftup&&s.rightdown&&(n=this.Cesium.Cartesian3.midpoint(s.leftup,s.rightdown,new this.Cesium.Cartesian3))}catch(s){console.warn("plotInstance.syncFromEntity failed",s)}if(!n){if(e.positions&&e.positions.length)n=this.calculateCenter(e.positions);else if(t.position&&t.position.getValue)n=t.position.getValue();else if(t.polyline&&t.polyline.positions&&t.polyline.positions.getValue){const s=t.polyline.positions.getValue();n=this.calculateCenter(s)}else if(t.polygon&&t.polygon.hierarchy&&t.polygon.hierarchy.getValue){const s=t.polygon.hierarchy.getValue().positions;n=this.calculateCenter(s)}else if(t.rectangle&&t.rectangle.coordinates&&t.rectangle.coordinates.getValue)try{const s=t.rectangle.coordinates.getValue(),o=(s.west+s.east)/2,r=(s.south+s.north)/2;n=this.Cesium.Cartesian3.fromRadians(o,r,0)}catch{}}n&&(this.centerHandle=this.viewer.entities.add({position:n,point:{pixelSize:10,color:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLUE,outlineWidth:2}}),this.addDragHandler(e,n))}calculateCenter(e){if(!e||e.length===0)return null;const t=e.map(r=>r);let n=0,s=0,o=0;for(let r=0;r<t.length;r++)n+=t[r].x,s+=t[r].y,o+=t[r].z;return new this.Cesium.Cartesian3(n/t.length,s/t.length,o/t.length)}getEntityPositions(e){const t=e.getEntity();if(e.positions&&Array.isArray(e.positions))return e.positions.slice();if(t.polyline&&t.polyline.positions&&t.polyline.positions.getValue){const n=t.polyline.positions.getValue();return Array.isArray(n)?n.slice():[]}if(t.polygon&&t.polygon.hierarchy&&t.polygon.hierarchy.getValue){const n=t.polygon.hierarchy.getValue();return n&&n.positions?n.positions.slice():[]}if(t.position&&t.position.getValue)return[t.position.getValue()];if(t.rectangle&&t.rectangle.coordinates&&t.rectangle.coordinates.getValue){const n=t.rectangle.coordinates.getValue();return[this.Cesium.Cartesian3.fromDegrees(n.west,n.south),this.Cesium.Cartesian3.fromDegrees(n.east,n.south),this.Cesium.Cartesian3.fromDegrees(n.east,n.north),this.Cesium.Cartesian3.fromDegrees(n.west,n.north)]}return[]}addDragHandler(e,t){if(this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}let n=!1,s,o=0;const r=16,a=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);this._dragHandler=a;const l=c=>{let h;try{h=this.viewer.scene.pickPosition(c)}catch{}if(!this.Cesium.defined(h)){const u=this.viewer.camera.getPickRay(c);u&&(h=this.viewer.scene.globe.pick(u,this.viewer.scene))}return this.Cesium.defined(h)||(h=this.viewer.scene.camera.pickEllipsoid(c,this.viewer.scene.globe.ellipsoid)),h};a.setInputAction(c=>{let h=!1;const u=this.viewer.scene.drillPick(c.position)||[];for(let p=0;p<u.length;p++){const f=u[p].id;if(f&&f===this.centerHandle){h=!0;break}}if(h){n=!0;const p=l(c.position);this.Cesium.defined(p)&&(s=p.clone()),o=performance.now(),this.viewer.scene.screenSpaceCameraController.enableRotate=!1,this.viewer.scene.screenSpaceCameraController.enableTranslate=!1,this.viewer.scene.screenSpaceCameraController.enableZoom=!1,this.viewer.scene.screenSpaceCameraController.enableTilt=!1,this.viewer.scene.screenSpaceCameraController.enableLook=!1}},this.Cesium.ScreenSpaceEventType.LEFT_DOWN),a.setInputAction(c=>{if(!n||!this.Cesium.defined(s))return;const h=performance.now();if(h-o<r)return;o=h;const u=l(c.endPosition);if(!this.Cesium.defined(u))return;const p=this.Cesium.Cartesian3.subtract(u,s,new this.Cesium.Cartesian3);if(this.centerHandle&&this.centerHandle.position&&this.centerHandle.position.setValue){const f=this.centerHandle.position.getValue(this.Cesium.JulianDate.now());if(f){const m=this.Cesium.Cartesian3.add(f,p,new this.Cesium.Cartesian3);this.centerHandle.position.setValue(m)}}this.moveEntity(e,p);try{this.viewer.scene.requestRender()}catch{}s=u.clone()},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),a.setInputAction(()=>{if(n){n=!1,this.viewer.scene.screenSpaceCameraController.enableRotate=!0,this.viewer.scene.screenSpaceCameraController.enableTranslate=!0,this.viewer.scene.screenSpaceCameraController.enableZoom=!0,this.viewer.scene.screenSpaceCameraController.enableTilt=!0,this.viewer.scene.screenSpaceCameraController.enableLook=!0;const c=e.getEntity();if(c.state="done",c&&c.rectangle&&c.rectangle.coordinates)try{const h=c.rectangle.coordinates.getValue?c.rectangle.coordinates.getValue():c.rectangle.coordinates;h&&c.rectangle.coordinates.setValue(h)}catch(h){console.warn("Failed to refresh rectangle coordinates",h)}e&&this.selectedEntityObj!==e&&this.showEntityOutline(e)}},this.Cesium.ScreenSpaceEventType.LEFT_UP)}moveEntity(e,t){const n=e.getEntity();if(!n)return;const s=o=>this.Cesium.Cartesian3.add(o,t,new this.Cesium.Cartesian3);if(n.position){const o=n.position.getValue?n.position.getValue():n.position,r=s(o);n.position.setValue?n.position.setValue(r):n.position=r,n.state="moving",e.positions&&e.positions.length===1&&(e.positions[0]=r);return}if(n.polyline){if(n._plotInstance&&n._plotInstance.type==="rectangle"&&typeof n._plotInstance.updatePositions=="function")try{const a=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(n._plotInstance.updatePositions([a]))return}catch(a){console.warn("Failed to update rectangle positions:",a)}if(n._plotInstance&&n._plotInstance.type==="circle"&&typeof n._plotInstance.updatePositions=="function")try{const a=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(n._plotInstance.updatePositions([a]))return}catch(a){console.warn("Failed to update circle positions:",a)}const r=(e.positions&&Array.isArray(e.positions)?e.positions:n.polyline.positions.getValue?n.polyline.positions.getValue():[]).map(a=>s(a));if(e.updatePositions&&typeof e.updatePositions=="function")e.updatePositions(r);else if(e.positions&&Array.isArray(e.positions)&&(e.positions=r),n.polyline&&n.polyline.positions)try{n.polyline.positions instanceof this.Cesium.CallbackProperty||(n.polyline.positions=r)}catch{n.polyline.positions=r}}}startFreehandLine(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"freehandLine",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t,smoothness:2,minDistance:.01,angleThreshold:.8,renderInterval:16,curveResolution:3},e)})}startArrow(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"arrow",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t},e)})}startStraightLine(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"polyline",style:Object.assign({color:this.currentColor,width:this.currentWidth,clampToGround:!t},e)})}startEllipse(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"circle",style:Object.assign({color:this.currentColor.withAlpha(1),outlineColor:this.currentColor,outlineWidth:this.currentWidth,outline:!0,fill:!1,clampToGround:!t},e)})}startImage(e,t){this.initDrawTool();const n=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"billboard",style:Object.assign({image:e,width:t&&t.width?t.width:50,height:t&&t.height?t.height:50,clampToGround:!n},t)})}startRectangle(e={}){this.initDrawTool();const t=this.viewer.scene.mode===this.Cesium.SceneMode.SCENE2D;return this.drawTool.start({type:"rectangle",style:Object.assign({color:this.currentColor.withAlpha(1),outlineColor:this.currentColor,outlineWidth:this.currentWidth,clampToGround:!t},e)})}clearAll(){this.drawTool&&this.drawTool.removeAll(),this.hideEntityOutline()}destroy(){this.clearAll(),this.originalDoubleClickAction&&(this.viewer.screenSpaceEventHandler.setInputAction(this.originalDoubleClickAction,this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.originalDoubleClickAction=null)}getAllEntities(){return this.drawTool&&typeof this.drawTool.getEntityObjArr=="function"?this.drawTool.getEntityObjArr():[]}saveAnnotations(){try{const e=this.getAllEntities(),t={freehand:[],arrow:[],text:[],image:[],polyline:[],rectangle:[],ellipse:[],other:[]};e.forEach(o=>{if(o&&typeof o=="object"){const r=o.type||o.constructor&&o.constructor.name,a={type:r,style:{}};switch(!0){case["freehandLine","CreateFreehandLine","polyline","CreatePolyline","arrow","CreateArrow"].includes(r):a.id=o.objId||o.id||Date.now().toString(),o.style&&(a.style={color:o.style.color,width:o.style.width,opacity:o.style.opacity,...o.style}),o.positions&&Array.isArray(o.positions)&&(a.positions=o.positions.map(l=>l&&typeof l=="object"&&l.x!==void 0&&l.y!==void 0&&l.z!==void 0?{x:l.x,y:l.y,z:l.z}:l)),["freehandLine","CreateFreehandLine"].includes(r)&&(a.isEdit=o.isEdit!==void 0?o.isEdit:!0,a.isFreehand=!0);break;case["rectangle","CreateRectangle"].includes(r):try{a.id=o.objId||o.id||Date.now().toString();let l=[];if(o.positions&&Array.isArray(o.positions)&&o.positions.length)l=o.positions.map(c=>({x:c.x,y:c.y,z:c.z}));else{const c=o.getEntity?o.getEntity():o;if(c)try{if(c.polyline&&c.polyline.positions&&c.polyline.positions.getValue){const h=c.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(h)&&(l=h.map(u=>({x:u.x,y:u.y,z:u.z})))}else if(c.rectangle&&c.rectangle.coordinates&&c.rectangle.coordinates.getValue){const h=c.rectangle.coordinates.getValue(this.viewer.clock.currentTime);l=[{west:h.west,south:h.south,east:h.east,north:h.north}]}}catch{}}o.style&&(a.style=Object.assign({},o.style)),l&&l.length&&(a.positions=l)}catch{}break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):try{a.id=o.objId||o.id||Date.now().toString();let l=[];const c=o.getEntity?o.getEntity():o;if(c&&c._plotInstance&&c._plotInstance.type==="circle"&&c._plotInstance.center&&c._plotInstance.radiusPoint){const h=c._plotInstance;l=[{x:h.center.x,y:h.center.y,z:h.center.z},{x:h.radiusPoint.x,y:h.radiusPoint.y,z:h.radiusPoint.z}]}else if(o.positions&&Array.isArray(o.positions)&&o.positions.length)l=o.positions.map(h=>({x:h.x,y:h.y,z:h.z}));else if(c)try{if(c.polyline&&c.polyline.positions&&c.polyline.positions.getValue){const h=c.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(h)&&(l=h.map(u=>({x:u.x,y:u.y,z:u.z})))}else if(c.ellipse&&c.ellipse.center&&c.ellipse.center.getValue&&c.ellipse.semiMajorAxis&&c.ellipse.semiMajorAxis.getValue){const h=c.ellipse.center.getValue(this.viewer.clock.currentTime),u=c.ellipse.semiMajorAxis.getValue(this.viewer.clock.currentTime);if(h&&u){const p={x:h.x,y:h.y,z:h.z||0},f={x:p.x+u,y:p.y,z:p.z};l=[p,f]}}}catch{}o.style&&(a.style=Object.assign({},o.style)),l&&l.length&&(a.positions=l)}catch{}break;case["label","CreateLabel"].includes(r):if(o.style)a.style=Object.assign({},o.style);else try{const l=o.getEntity?o.getEntity():o;if(l&&l.label){const c={};try{const h=l.label.fillColor&&l.label.fillColor.getValue?l.label.fillColor.getValue(this.viewer.clock.currentTime):l.label.fillColor;h&&(c.color=h)}catch{}l.label.font&&(c.font=l.label.font),a.style=c}}catch{}if(o.text)a.text=o.text;else try{const l=o.getEntity?o.getEntity():o;if(l&&l.label&&l.label.text){const c=l.label.text.getValue?l.label.text.getValue(this.viewer.clock.currentTime):l.label.text;c&&(a.text=c)}}catch{}if(o.position)a.position=o.position;else try{const l=o.getEntity?o.getEntity():o;if(l&&l.position&&l.position.getValue){const c=l.position.getValue(this.viewer.clock.currentTime);c&&(a.position={x:c.x,y:c.y,z:c.z})}}catch{}break;case["billboard","CreateBillboard"].includes(r):if(o.style)a.style=Object.assign({},o.style);else try{const l=o.getEntity?o.getEntity():o;if(l&&l.billboard){const c={};try{const h=l.billboard.image&&l.billboard.image.getValue?l.billboard.image.getValue(this.viewer.clock.currentTime):l.billboard.image;if(h){if(typeof h=="string")c.image=h;else if(h&&h.src)try{const u=h;if(typeof document<"u"&&u instanceof HTMLImageElement){const p=document.createElement("canvas");p.width=u.naturalWidth||u.width||1,p.height=u.naturalHeight||u.height||1;const f=p.getContext("2d");f?(f.drawImage(u,0,0),c.image=p.toDataURL()):c.image=u.src}else c.image=h.src}catch{c.image=h.src}}}catch{}l.billboard.width&&(c.width=l.billboard.width),l.billboard.height&&(c.height=l.billboard.height),a.style=c}}catch{}if(o.position)a.position=o.position;else try{const l=o.getEntity?o.getEntity():o;if(l&&l.position&&l.position.getValue){const c=l.position.getValue(this.viewer.clock.currentTime);c&&(a.position={x:c.x,y:c.y,z:c.z})}}catch{}break;default:o.style&&(a.style=o.style),o.position&&(a.position=o.position);break}switch(!0){case["freehandLine","CreateFreehandLine"].includes(r):t.freehand.push(a);break;case["arrow","CreateArrow"].includes(r):t.arrow.push(a);break;case["label","CreateLabel"].includes(r):t.text.push(a);break;case["billboard","CreateBillboard"].includes(r):t.image.push(a);break;case["polyline","CreatePolyline"].includes(r):t.polyline.push(a);break;case["rectangle","CreateRectangle"].includes(r):t.rectangle.push(a);break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):t.ellipse.push(a);break;default:t.other.push(a)}}});const n={version:"1.0",exportTime:new Date().toISOString(),totalEntities:e.length,annotations:t},s=JSON.stringify(n);return s}catch(e){return console.error("保存标注失败:",e),!1}}loadAnnotations(e){try{const t=typeof e=="string"?JSON.parse(e):e;if(!t.annotations)return console.error("标注数据格式错误,缺少annotations字段"),!1;const n=t.annotations;let s=0;const o=(r,a)=>{Array.isArray(r)&&r.forEach(l=>{if(l.style){if(l.style.color&&typeof l.style.color=="object"){const c=l.style.color;l.style.color=`rgba(${Math.round(c.red*255)}, ${Math.round(c.green*255)}, ${Math.round(c.blue*255)}, ${c.alpha||1})`}if(l.style.outlineColor&&typeof l.style.outlineColor=="object"){const c=l.style.outlineColor;l.style.outlineColor=`rgba(${Math.round(c.red*255)}, ${Math.round(c.green*255)}, ${Math.round(c.blue*255)}, ${c.alpha||1})`}}switch(a){case"freehand":case"polyline":case"arrow":if(l.positions&&l.positions.length>0){const c=l.positions.map(p=>p&&typeof p=="object"?new this.Cesium.Cartesian3(p.x,p.y,p.z):p),h={type:a==="freehand"?"freehandLine":a,style:l.style||{},positions:c,id:l.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))},u=this.drawTool.createByPositions(h);if(u&&u.getEntity()){s++,u.isEdit=!0;const p=u.getEntity();p&&!p._plotInstance&&(p._plotInstance=u),p&&!p.objId&&(p.objId=u.objId),`${a}${u.objId}`}}break;case"rectangle":{try{if(l.positions&&l.positions.length){let c=[];if(l.positions[0]&&l.positions[0].x!==void 0)c=l.positions.map(h=>new this.Cesium.Cartesian3(h.x,h.y,h.z!==void 0?h.z:0));else if(l.positions[0]&&l.positions[0].west!==void 0){const h=l.positions[0];c=[this.Cesium.Cartesian3.fromRadians(h.west,h.south),this.Cesium.Cartesian3.fromRadians(h.east,h.south),this.Cesium.Cartesian3.fromRadians(h.east,h.north),this.Cesium.Cartesian3.fromRadians(h.west,h.north),this.Cesium.Cartesian3.fromRadians(h.west,h.south)]}if(c.length){const h=JSON.parse(JSON.stringify(l.style||{}));if(h.color&&typeof h.color=="string"&&!h.color.startsWith("rgba"))try{const f=JSON.parse(h.color);f.red!==void 0&&(h.color=`rgba(${Math.round(f.red*255)}, ${Math.round(f.green*255)}, ${Math.round(f.blue*255)}, ${f.alpha||1})`)}catch{}const u={type:"rectangle",positions:c,style:h,id:l.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let p=null;try{p=this.drawTool.createByPositions(u)}catch(f){console.warn("drawTool.createByPositions(rectangle) failed",f)}if(p){s++,p.isEdit=!0;const f=p.getEntity?p.getEntity():p.entity||p;f&&(f._plotInstance=p,f.objId=p.objId||l.id,f.pickable=!0,f.polyline&&(f.polyline.pickWidth=10),`${f.objId}${h.color}`)}}}}catch(c){console.warn("load rectangle failed",c)}break}case"text":if(l.position){const c=l.text||"文字标注",h={type:"label",style:l.style||{},text:c,position:new this.Cesium.Cartesian3(l.position.x,l.position.y,l.position.z||0)};h.style.fontSize||(h.style.fontSize=14),h.style.fontFamily||(h.style.fontFamily="Arial");let u;try{!h.positions&&h.position&&(h.positions=h.position),u=this.drawTool.createByPositions(h),!u&&this.drawTool.startText&&(this.drawTool.startText(h.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.text=c,this.drawTool.currentEntity.position=h.position,u=this.drawTool.currentEntity))}catch(p){}if(!u)try{const p=this.viewer.entities.add({position:h.position,label:Object.assign({text:c,font:h.style&&h.style.font||"14pt Source Han Sans CN",fillColor:h.style&&h.style.fillColor||this.Cesium.Color.WHITE,outlineColor:h.style&&h.style.outlineColor||this.Cesium.Color.BLACK,outlineWidth:h.style&&h.style.outlineWidth||2,verticalOrigin:h.style&&h.style.verticalOrigin||this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:h.style&&h.style.pixelOffset||new this.Cesium.Cartesian2(0,-10)},h.style&&h.style.label?h.style.label:{})}),f={getEntity:()=>p,entity:p,style:h.style||{},type:"label",objId:l.id||`label_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(p)};try{p.objId=f.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(f)),u=f}catch(p){console.warn("回退创建文字实体失败",p)}u&&(s++,u.isEdit=!0)}break;case"image":if(l.position){const c={type:"billboard",style:l.style||{},position:new this.Cesium.Cartesian3(l.position.x,l.position.y,l.position.z||0)};c.style.image||(c.style.image="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4="),c.style.width||(c.style.width=50),c.style.height||(c.style.height=50);let h;try{!c.positions&&c.position&&(c.positions=c.position),h=this.drawTool.createByPositions(c),!h&&this.drawTool.startImage&&(this.drawTool.startImage(c.style.image,c.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.position=c.position,h=this.drawTool.currentEntity))}catch(u){}if(!h)try{const u=c.style&&c.style.image?c.style.image:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4=",p=this.viewer.entities.add({position:c.position,billboard:{image:u,width:c.style&&c.style.width?c.style.width:50,height:c.style&&c.style.height?c.style.height:50,verticalOrigin:c.style&&c.style.verticalOrigin||this.Cesium.VerticalOrigin.CENTER,scale:c.style&&c.style.scale||1}}),f={getEntity:()=>p,entity:p,style:c.style||{},type:"billboard",objId:l.id||`billboard_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(p)};try{p.objId=f.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(f)),h=f}catch(u){console.warn("回退创建图片实体失败",u)}h&&(s++,h.isEdit=!0)}break;case"ellipse":case"circle":{try{const c=JSON.parse(JSON.stringify(l.style||{}));if(c.color&&typeof c.color=="string"&&!c.color.startsWith("rgba"))try{const p=JSON.parse(c.color);p.red!==void 0&&(c.color=`rgba(${Math.round(p.red*255)}, ${Math.round(p.green*255)}, ${Math.round(p.blue*255)}, ${p.alpha||1})`)}catch{}let h=[],u=!1;if(l.positions&&l.positions.length&&(l.positions[0]&&l.positions[0].x!==void 0&&(h=l.positions.map(p=>new this.Cesium.Cartesian3(p.x,p.y,p.z!==void 0?p.z:0))),h.length)){const p={type:a,positions:h,style:c,id:l.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let f=null;try{if(f=this.drawTool.createByPositions(p),f){s++,f.isEdit=!0;const m=f.getEntity?f.getEntity():f.entity||f;m&&(m._plotInstance=f,m.objId=f.objId||l.id,m.pickable=!0,m.polyline&&(m.polyline.pickWidth=10),`${a}${m.objId}`),u=!0}}catch(m){console.warn(`drawTool.createByPositions(${a}) failed`,m)}}if(!u&&l.center&&l.radius)try{const p=new this.Cesium.Cartesian3(l.center.x,l.center.y,l.center.z||0),f=this.Cesium.Cartesian3.add(p,new this.Cesium.Cartesian3(l.radius,0,0),new this.Cesium.Cartesian3),y={type:a,positions:[p,f],style:c,id:l.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let g=null;try{if(g=this.drawTool.createByPositions(y),g){s++,g.isEdit=!0;const A=g.getEntity?g.getEntity():g.entity||g;A&&(A._plotInstance=g,A.objId=g.objId||l.id,A.pickable=!0,A.polyline&&(A.polyline.pickWidth=10),`${a}${A.objId}`)}}catch(A){console.warn(`drawTool.createByPositions(${a}) with center/radius failed`,A)}}catch(p){console.warn(`Fallback creation for ${a} failed`,p)}}catch(c){console.warn(`load ${a} failed`,c)}break}default:`${a}`;break}})};return Object.keys(n).forEach(r=>{o(n[r],r)}),`${s}`,this.drawTool&&typeof this.drawTool.bindEdit=="function"&&this.drawTool.bindEdit(),!0}catch(t){return console.error("加载标注失败:",t),!1}}changeEntityColor(e){try{if(!this.selectedEntityObj)return!1;if(this.selectedEntityObj.setStyle&&typeof this.selectedEntityObj.setStyle=="function")try{return this.selectedEntityObj.setStyle({color:e}),!0}catch(s){console.warn("通过setStyle修改颜色失败,尝试直接修改实体:",s)}const t=this.selectedEntityObj.getEntity();if(!t)return!1;let n;try{n=this.Cesium.Color.fromCssColorString(e)}catch(s){console.warn("Invalid color format:",e,s),n=e}if(t.polyline)try{t.polyline.material=new this.Cesium.ColorMaterialProperty(n)}catch{t.polyline.material=n}else if(t.polygon)try{t.polygon.material=new this.Cesium.ColorMaterialProperty(n)}catch{t.polygon.material=n}else if(t.rectangle){const s=t.rectangle.outline,o=t.rectangle.outlineWidth;try{t.rectangle.material=new this.Cesium.ColorMaterialProperty(n)}catch{t.rectangle.material=n}t.rectangle.outlineColor=n,s!==void 0&&(t.rectangle.outline=s),o!==void 0&&(t.rectangle.outlineWidth=o)}else if(t.ellipse||t.circle){const s=t.ellipse||t.circle,o=s.outline,r=s.outlineColor,a=s.outlineWidth;s.material=n,o!==void 0&&(s.outline=o),r!==void 0&&(s.outlineColor=r),a!==void 0&&(s.outlineWidth=a)}return!0}catch(t){return console.error("changeEntityColor failed",t),!1}}changeColor(e){return this.changeEntityColor(e)}setLineWidth(e){if(!this.selectedEntityObj)return!1;const t=this.selectedEntityObj.getEntity();let n=2;if(typeof e=="number")n=e;else switch(e){case"thin":n=2;break;case"medium":n=4;break;case"thick":n=8;break}if(t.polyline)t.polyline.width=n;else if(t.polygon&&t.polygon.outline)t.polygon.outlineWidth=n;else if(t.rectangle&&t.rectangle.outline)t.rectangle.outlineWidth=n;else if((t.ellipse||t.circle)&&(t.ellipse?.outline||t.circle?.outline)){const s=t.ellipse||t.circle;s.outlineWidth=n}return!0}changeWidth(e){return this.setLineWidth(e)}deleteSelectedEntity(){if(!this.selectedEntityObj)return!1;if(typeof this.drawTool.removeOne=="function")this.drawTool.removeOne(this.selectedEntityObj);else if(typeof this.drawTool.remove=="function")this.drawTool.remove(this.selectedEntityObj);else return console.error("No remove method found on drawTool"),!1;return this.selectedEntityObj=null,this.hideEntityOutline(),!0}}class pc{viewer;cesium;handler=null;measureEntities=[];originalDoubleClickAction=null;onMeasure=()=>{};activePoints=[];floatingPoint=null;activeShape=null;type=null;unit="m";cursorPosition=null;isSnapping=!1;snapIndicator=null;isMobile=!1;lastTapTime=0;tapTimeout=null;originalPickEnabled=!0;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t,this.isMobile="ontouchstart"in window||navigator.maxTouchPoints>0;const n=this.cesium;this.originalDoubleClickAction=this.viewer.screenSpaceEventHandler.getInputAction(n.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.viewer.screenSpaceEventHandler.removeInputAction(n.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}setUnit(e){this.unit=e}setSnapping(e){this.isSnapping=e,!e&&this.snapIndicator&&(this.viewer.entities.remove(this.snapIndicator),this.snapIndicator=null)}start(e){const t=this.cesium;this.clearActive(),this.type=e,this.viewer.scene&&this.viewer.scene.screenSpaceCameraController&&(this.originalPickEnabled=this.viewer.scene.screenSpaceCameraController.enableInputs),this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(n=>{if(this.isMobile&&this.type==="area"){const s=Date.now(),o=s-this.lastTapTime;if(this.lastTapTime=s,o<300&&o>0){this.tapTimeout&&(clearTimeout(this.tapTimeout),this.tapTimeout=null),this.finish();return}this.tapTimeout=setTimeout(()=>{const r=this.getPickPosition(n.position);r&&this.addPoint(r),this.tapTimeout=null},300)}else{const s=this.getPickPosition(n.position);s&&this.addPoint(s)}},t.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(n=>{const s=this.getPickPosition(n.endPosition);s&&(this.cursorPosition=s,this.updateFloatingPoint(s))},t.ScreenSpaceEventType.MOUSE_MOVE),this.type==="area"&&!this.isMobile&&this.handler.setInputAction(()=>{this.finish()},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}addPoint(e){const t=this.cesium;this.activePoints.push(e);const n=this.viewer.entities.add({position:e,point:{pixelSize:8,color:t.Color.YELLOW,outlineColor:t.Color.BLACK,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY}});if(this.measureEntities.push(n),this.type==="distance"){if(this.activePoints.length===1)this.onMeasure(null),this.activeShape=this.viewer.entities.add({polyline:{positions:new t.CallbackProperty(()=>{if(this.activePoints.length===0)return[];const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}}),this.measureEntities.push(this.activeShape);else if(this.activePoints.length===2){const s=this.activePoints[0],o=this.activePoints[1];this.activeShape&&(this.viewer.entities.remove(this.activeShape),this.activeShape=null);const r=this.viewer.entities.add({polyline:{positions:[s,o],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(r);const a=t.Cartesian3.distance(s,o),l=t.Cartesian3.midpoint(s,o,new t.Cartesian3);this.addLabel(l,this.formatDistance(a));const c=t.Transforms.eastNorthUpToFixedFrame(s),h=t.Matrix4.inverse(c,new t.Matrix4),u=t.Matrix4.multiplyByPoint(h,o,new t.Cartesian3),p=u.x,f=u.y,m=u.z,y=t.Matrix4.getColumn(c,0,new t.Cartesian3),g=t.Matrix4.getColumn(c,1,new t.Cartesian3),A=t.Cartesian3.multiplyByScalar(y,p,new t.Cartesian3),v=t.Cartesian3.add(s,A,new t.Cartesian3),b=t.Cartesian3.multiplyByScalar(g,f,new t.Cartesian3),C=t.Cartesian3.add(v,b,new t.Cartesian3);if(this.viewer.scene.mode!==t.SceneMode.SCENE2D){const x=this.viewer.entities.add({polyline:{positions:[s,v],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.RED}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(1,0,0,.5)})}}),I=this.viewer.entities.add({polyline:{positions:[v,C],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.GREEN}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,1,0,.5)})}}),E=this.viewer.entities.add({polyline:{positions:[C,o],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.BLUE}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,0,1,.5)})}});this.measureEntities.push(x,I,E)}this.onMeasure({type:"distance",dx:p,dy:f,dz:m,dist:a}),this.activePoints=[]}}else if(this.type==="angle"){if(this.activePoints.length===1)this.onMeasure(null);else if(this.activePoints.length===2)this.activeShape=this.viewer.entities.add({polyline:{positions:new t.CallbackProperty(()=>{if(this.activePoints.length<2)return[];const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}}),this.measureEntities.push(this.activeShape);else if(this.activePoints.length===3){const s=this.activePoints[0],o=this.activePoints[1],r=this.activePoints[2];if(this.activeShape){this.viewer.entities.remove(this.activeShape);const l=this.viewer.entities.add({polyline:{positions:[s,o,r],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(l)}const a=this.calculateAngle(s,o,r);this.addLabel(o,`${a.toFixed(1)}°`),this.onMeasure({type:"angle",angle:a}),this.finish()}}else this.type==="area"&&this.activePoints.length===1&&(this.onMeasure(null),this.activeShape=this.viewer.entities.add({polygon:{hierarchy:new t.CallbackProperty(()=>{if(this.activePoints.length===0)return new t.PolygonHierarchy([]);const s=[...this.activePoints];return this.cursorPosition&&s.push(this.cursorPosition),new t.PolygonHierarchy(s)},!1),material:t.Color.YELLOW.withAlpha(.3),perPositionHeight:!0,outline:!0,outlineColor:t.Color.YELLOW,outlineWidth:2},polyline:{positions:new t.CallbackProperty(()=>{const s=[...this.activePoints];return this.cursorPosition&&(s.push(this.cursorPosition),s.push(s[0])),s},!1),width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW,clampToGround:!1}}),this.measureEntities.push(this.activeShape))}updateFloatingPoint(e){const t=this.cesium;this.floatingPoint||(this.floatingPoint=this.viewer.entities.add({position:new t.CallbackProperty(()=>this.cursorPosition,!1),point:{pixelSize:5,color:t.Color.RED,disableDepthTestDistance:Number.POSITIVE_INFINITY}}))}finish(){const e=this.cesium;if(this.type==="distance"&&this.activePoints.length>1){let t=0;for(let s=0;s<this.activePoints.length-1;s++)t+=e.Cartesian3.distance(this.activePoints[s],this.activePoints[s+1]);const n=this.activePoints[this.activePoints.length-1];this.addLabel(n,`Total: ${this.formatDistance(t)}`)}else if(this.type==="area"&&this.activePoints.length>=3){const t=this.calculateArea(this.activePoints),n=this.calculateCenter(this.activePoints);this.addLabel(n,`面积: ${this.formatArea(t)}`),this.onMeasure({type:"area",area:t})}this.clearActive()}clearAll(){this.clear(),this.onMeasure(null)}clear(){this.clearActive(),this.measureEntities.forEach(e=>this.viewer.entities.remove(e)),this.measureEntities=[]}stop(){this.clearActive(),this.onMeasure(null)}destroy(){if(this.clear(),this.originalDoubleClickAction){const e=this.cesium;this.viewer.screenSpaceEventHandler.setInputAction(this.originalDoubleClickAction,e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.originalDoubleClickAction=null}}clearActive(){const e=this.cesium;if(this.handler&&(this.handler.destroy(),this.handler=null),this.tapTimeout&&(clearTimeout(this.tapTimeout),this.tapTimeout=null),this.lastTapTime=0,this.viewer.scene&&this.viewer.scene.screenSpaceCameraController&&!this.originalPickEnabled&&(this.viewer.scene.screenSpaceCameraController.enableInputs=!0),this.floatingPoint&&(this.viewer.entities.remove(this.floatingPoint),this.floatingPoint=null),this.snapIndicator&&(this.viewer.entities.remove(this.snapIndicator),this.snapIndicator=null),this.activeShape){if(this.type==="distance"){const t=[...this.activePoints];this.viewer.entities.remove(this.activeShape);const n=this.viewer.entities.add({polyline:{positions:t,width:2,material:e.Color.YELLOW,depthFailMaterial:e.Color.YELLOW}});this.measureEntities.push(n)}else if(this.type==="area"){const t=[...this.activePoints];this.viewer.entities.remove(this.activeShape);const n=this.viewer.entities.add({polygon:{hierarchy:new e.PolygonHierarchy(t),material:e.Color.YELLOW.withAlpha(.3),perPositionHeight:!0,outline:!0,outlineColor:e.Color.YELLOW,outlineWidth:2},polyline:{positions:[...t,t[0]],width:2,material:e.Color.YELLOW,depthFailMaterial:e.Color.YELLOW}});this.measureEntities.push(n)}this.activeShape=null}this.activePoints=[],this.type=null,this.cursorPosition=null}getPickPosition(e){const t=this.cesium;let n;try{n=this.viewer.scene.pickPosition(e)}catch{}if(!n||!t.defined(n)){const s=this.viewer.camera.getPickRay(e);s&&(n=this.viewer.scene.globe.pick(s,this.viewer.scene))}if((!n||!t.defined(n))&&(n=this.viewer.scene.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid)),!n||!t.defined(n))return null;if(this.isSnapping){const s=this.snapToVertex(e);if(s)n=s;else{const o=this.snapTo3DTileFeature(e);o&&(n=o)}}return this.isSnapping&&(this.snapIndicator||(this.snapIndicator=this.viewer.entities.add({position:new t.CallbackProperty(()=>this.cursorPosition,!1),point:{pixelSize:10,color:t.Color.GREEN.withAlpha(.5),outlineColor:t.Color.GREEN,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY}}))),n}snapTo3DTileFeature(e){const t=this.cesium,n=10,s=[{x:0,y:0},{x:-n,y:0},{x:n,y:0},{x:0,y:-n},{x:0,y:n},{x:-n,y:-n},{x:n,y:-n},{x:-n,y:n},{x:n,y:n}];for(let o=0;o<s.length;o++){const r=s[o];if(!r)continue;const a=new t.Cartesian2(e.x+r.x,e.y+r.y);let l=null;try{l=this.viewer.scene.pick(a)}catch{}if(t.defined(l)&&(l instanceof t.Cesium3DTileFeature||l.primitive&&l.primitive instanceof t.PointPrimitive))try{const c=this.viewer.scene.pickPosition(a);if(c)return c}catch{}}return null}snapToVertex(e){const t=this.cesium,n=this.viewer.entities.values;let s=20,o=null;for(let r=0;r<n.length;r++){const a=n[r];if(!a.show)continue;let l=[];if(a.polyline&&a.polyline.positions){const c=a.polyline.positions.getValue(t.JulianDate.now());c&&(l=c)}else if(a.polygon&&a.polygon.hierarchy){const c=a.polygon.hierarchy.getValue(t.JulianDate.now());c&&c.positions&&(l=c.positions)}else if(a.position){const c=a.position.getValue(t.JulianDate.now());c&&(l=[c])}else if(a.rectangle&&a.rectangle.coordinates){const c=a.rectangle.coordinates.getValue(t.JulianDate.now());c&&(l=[t.Cartesian3.fromRadians(c.west,c.south),t.Cartesian3.fromRadians(c.east,c.south),t.Cartesian3.fromRadians(c.east,c.north),t.Cartesian3.fromRadians(c.west,c.north)])}for(let c=0;c<l.length;c++){const h=l[c];try{const u=this.viewer.scene.cartesianToCanvasCoordinates(h);if(u){const p=t.Cartesian2.distance(u,e);p<s&&(s=p,o=h)}}catch{}}}return o}addLabel(e,t){const n=this.cesium,s=this.viewer.entities.add({position:e,label:{text:t,font:"14px sans-serif",fillColor:n.Color.WHITE,style:n.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:n.VerticalOrigin.BOTTOM,pixelOffset:new n.Cartesian2(0,-10),disableDepthTestDistance:Number.POSITIVE_INFINITY,showBackground:!0,backgroundColor:new n.Color(0,0,0,.5)}});this.measureEntities.push(s)}formatDistance(e){return this.unit==="mm"?`${(e*1e3).toFixed(0)}mm`:this.unit==="cm"?`${(e*100).toFixed(1)}cm`:`${e.toFixed(2)}m`}calculateAngle(e,t,n){const s=this.cesium,o=s.Cartesian3.subtract(e,t,new s.Cartesian3),r=s.Cartesian3.subtract(n,t,new s.Cartesian3);s.Cartesian3.normalize(o,o),s.Cartesian3.normalize(r,r);const a=s.Cartesian3.dot(o,r),l=Math.max(-1,Math.min(1,a)),c=Math.acos(l);return s.Math.toDegrees(c)}calculateArea(e){const t=this.cesium;if(e.length<3)return 0;const n=e[0],s=new t.Cartesian3(0,0,0);for(let o=1;o<e.length-1;o++){const r=e[o],a=e[o+1],l=t.Cartesian3.subtract(r,n,new t.Cartesian3),c=t.Cartesian3.subtract(a,n,new t.Cartesian3),h=t.Cartesian3.cross(l,c,new t.Cartesian3);t.Cartesian3.add(s,h,s)}return t.Cartesian3.magnitude(s)*.5}calculateCenter(e){const t=this.cesium;if(!e||e.length===0)return null;let n=0,s=0,o=0;for(let r=0;r<e.length;r++)n+=e[r].x,s+=e[r].y,o+=e[r].z;return new t.Cartesian3(n/e.length,s/e.length,o/e.length)}formatArea(e){return e>1e6?`${(e/1e6).toFixed(2)} km²`:`${e.toFixed(2)} m²`}}const $e=d.reactive({visible:!1,type:"info",title:"",description:"",closable:!1,showIcon:!0,duration:3});let Ve=null,fm=null,pm=!1,mc=null,Fr=null,gc=null;function AB(){if(Fr||typeof document>"u")return;const i=`
33
- .tech-alert-wrapper {
34
- position: absolute;
35
- top: 20px;
36
- left: 50%;
37
- transform: translateX(-50%);
38
- z-index: 10000;
39
- pointer-events: none;
40
- }
41
- .tech-alert {
42
- min-width: 300px;
43
- max-width: 80%;
44
- background: rgba(0, 15, 30, 0.85) !important;
45
- border: 1px solid #00f3ff !important;
46
- box-shadow: 0 0 15px rgba(0, 243, 255, 0.3), inset 0 0 10px rgba(0, 243, 255, 0.2) !important;
47
- color: #00f3ff !important;
48
- font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
49
- text-transform: uppercase;
50
- letter-spacing: 1px;
51
- backdrop-filter: blur(8px);
52
- border-radius: 2px !important;
53
- padding: 12px 20px !important;
54
- pointer-events: auto;
55
- position: relative;
56
- overflow: hidden;
57
- }
58
- .tech-alert::before {
59
- content: "";
60
- position: absolute;
61
- top: 0;
62
- left: -100%;
63
- width: 100%;
64
- height: 2px;
65
- background: linear-gradient(90deg, transparent, #00f3ff, transparent);
66
- animation: tech-scan 3s infinite linear;
67
- }
68
- @keyframes tech-scan {
69
- 0% { left: -100%; }
70
- 100% { left: 100%; }
71
- }
72
- .tech-alert .ant-alert-message {
73
- color: #00f3ff !important;
74
- font-weight: bold !important;
75
- font-size: 14px !important;
76
- }
77
- .tech-alert .ant-alert-description {
78
- color: rgba(0, 243, 255, 0.8) !important;
79
- font-size: 12px !important;
80
- margin-top: 4px;
81
- }
82
- .tech-alert .ant-alert-icon {
83
- color: #00f3ff !important;
84
- font-size: 18px !important;
85
- }
86
- .tech-alert-success { border-color: #00ff9d !important; box-shadow: 0 0 15px rgba(0, 255, 157, 0.3) !important; color: #00ff9d !important; }
87
- .tech-alert-success .ant-alert-icon, .tech-alert-success .ant-alert-message { color: #00ff9d !important; }
88
- .tech-alert-error { border-color: #ff0055 !important; box-shadow: 0 0 15px rgba(255, 0, 85, 0.3) !important; color: #ff0055 !important; }
89
- .tech-alert-error .ant-alert-icon, .tech-alert-error .ant-alert-message { color: #ff0055 !important; }
90
- .tech-alert-warning { border-color: #ffcc00 !important; box-shadow: 0 0 15px rgba(255, 204, 0, 0.3) !important; color: #ffcc00 !important; }
91
- .tech-alert-warning .ant-alert-icon, .tech-alert-warning .ant-alert-message { color: #ffcc00 !important; }
92
-
93
- /* Loading specific styles */
94
- .tech-alert-loading .ant-alert-icon {
95
- animation: tech-spin 2s infinite linear;
96
- }
97
- @keyframes tech-spin {
98
- from { transform: rotate(0deg); }
99
- to { transform: rotate(360deg); }
100
- }
101
- `;Fr=document.createElement("style"),Fr.textContent=i,document.head.appendChild(Fr)}function vB(){if(pm)return;AB(),Ve=document.createElement("div"),Ve.className="tech-alert-wrapper",(gc||document.body).appendChild(Ve);const e={setup(){return()=>$e.visible?d.h(re.Alert,{class:`tech-alert tech-alert-${$e.type}`,message:$e.title,description:$e.description,showIcon:$e.showIcon,closable:$e.closable,onClose:()=>{$e.visible=!1}},{icon:()=>$e.type==="loading"?d.h(As.LoadingOutlined):$e.type==="success"?d.h(As.CheckCircleOutlined):$e.type==="error"?d.h(As.CloseCircleOutlined):$e.type==="warning"?d.h(As.ExclamationCircleOutlined):d.h(As.InfoCircleOutlined)}):null}};fm=d.createVNode(e),d.render(fm,Ve),pm=!0}function oo(i){vB(),mc&&clearTimeout(mc),$e.type=i.type||"info",$e.title=i.title||"",$e.description=i.description||"",$e.closable=i.closable??!1,$e.showIcon=i.showIcon??!0,$e.visible=!0;const e=i.container||gc;Ve&&(e?(Ve.parentNode!==e&&e.appendChild(Ve),Ve.style.position="absolute",Ve.style.top="20px",Ve.style.left="50%",Ve.style.transform="translateX(-50%)"):(Ve.parentNode!==document.body&&document.body.appendChild(Ve),Ve.style.position="fixed",Ve.style.top="20px",Ve.style.left="50%",Ve.style.transform="translateX(-50%)"));const t=i.duration??($e.type==="loading"?0:3);t>0&&(mc=setTimeout(()=>{$e.visible=!1},t*1e3))}const me={setContainer:i=>{gc=i,Ve&&i&&Ve.parentNode!==i&&(i.appendChild(Ve),Ve.style.position="absolute")},info:(i,e,t,n)=>oo({type:"info",title:i,description:e,duration:t,container:n}),success:(i,e,t,n)=>oo({type:"success",title:i,description:e,duration:t,container:n}),error:(i,e,t,n)=>oo({type:"error",title:i,description:e,duration:t,container:n}),warning:(i,e,t,n)=>oo({type:"warning",title:i,description:e,duration:t,container:n}),loading:(i,e,t)=>oo({type:"loading",title:i,description:e,duration:0,container:t}),close:()=>{$e.visible=!1}};class bB{cesium;viewer;events=new _s;lastBaseMapRequestId=0;_removeCameraLockListener=null;currentMode="3d";defaultMapBound={minLon:-180,maxLon:180,minLat:-90,maxLat:90};constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}get is2d(){return this.currentMode==="2d"}setGlobeEnvironmentVisible(e){if(this.is2d){this.viewer.scene.globe.show=e,this.viewer.scene.globe.showGroundAtmosphere=!1,this.viewer.scene.skyAtmosphere.show=!1,this.viewer.scene.sun.show=!1,this.viewer.scene.moon.show=!1,this.viewer.scene.skyBox.show=!1;return}const{scene:t}=this.viewer;t.globe&&(t.globe.show=e,t.globe.showGroundAtmosphere=e,e||(t.globe.depthTestAgainstTerrain=!1)),t.skyAtmosphere&&(t.skyAtmosphere.show=e),t.sun&&(t.sun.show=e),t.moon&&(t.moon.show=e)}setSkyBoxVisible(e){this.viewer.scene.skyBox&&(this.viewer.scene.skyBox.show=e)}setGlobeColor(e){const t=this.cesium.Color.fromCssColorString(e);t&&(this.viewer.scene.backgroundColor=t,this.viewer.scene.globe.baseColor=t)}setBackgroundColor(e){const t=this.viewer.container;t&&(t.style.background=e);try{const n=this.cesium.Color.fromCssColorString(e);n?(this.viewer.scene.backgroundColor=n,this.viewer.scene.globe.baseColor=n):(this.viewer.scene.backgroundColor=this.cesium.Color.TRANSPARENT,this.viewer.scene.globe.baseColor=this.cesium.Color.TRANSPARENT)}catch{this.viewer.scene.backgroundColor=this.cesium.Color.TRANSPARENT,this.viewer.scene.globe.baseColor=this.cesium.Color.TRANSPARENT}}setSkyBox(e){const t=this.viewer.scene,n=this.cesium,s=t.skyBox?t.skyBox.show:!0;if(this._skyBoxPreUpdateListener&&(t.preUpdate.removeEventListener(this._skyBoxPreUpdateListener),this._skyBoxPreUpdateListener=null),e===null){this._defaultSkyBox&&(this._defaultSkyBox.show=s,t.skyBox=this._defaultSkyBox);return}this._defaultSkyBox||(this._defaultSkyBox=t.skyBox);const o=n.Matrix3.fromRotationZ(n.Math.toRadians(90)),r=c=>{try{const h=n.Transforms.eastNorthUpToFixedFrame(t.camera.position),u=new n.Matrix3;n.Matrix4.getRotation(h,u),n.Matrix3.multiply(u,o,c)}catch{n.Matrix3.clone(o,c)}},a=new n.Matrix3;r(a);const l=new n.CubeMapPanorama({sources:{positiveX:`${e}/px.png`,negativeX:`${e}/nx.png`,positiveY:`${e}/py.png`,negativeY:`${e}/ny.png`,positiveZ:`${e}/pz.png`,negativeZ:`${e}/nz.png`},transform:a,returnCommand:!0});this._skyBoxPreUpdateListener=()=>{r(l._transform)},t.preUpdate.addEventListener(this._skyBoxPreUpdateListener),l.show=s,t.skyBox=l}async setTerrainEnable(e){if(!(this.is2d&&e))if(e)try{const t=this.cesium.ArcGISTiledElevationTerrainProvider.fromUrl("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"),n=new Promise((s,o)=>setTimeout(()=>o(new Error("ArcGIS Terrain request timed out")),5e3));this.viewer.terrainProvider=await Promise.race([t,n])}catch(t){console.warn("Failed to load ArcGIS terrain (or timed out), trying Cesium World Terrain...",t);try{this.cesium.Terrain&&this.cesium.Terrain.fromWorldTerrain?this.viewer.terrainProvider=await this.cesium.Terrain.fromWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0}):this.viewer.terrainProvider=this.cesium.createWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0})}catch(n){console.error("Failed to enable terrain (both ArcGIS and Ion failed):",n),this.viewer.terrainProvider=new this.cesium.EllipsoidTerrainProvider}}else this.viewer.terrainProvider=new this.cesium.EllipsoidTerrainProvider}setDepthTestEnable(e){if(!this.viewer.scene.globe.show){this.viewer.scene.globe.depthTestAgainstTerrain=!1;return}this.viewer.scene.globe.depthTestAgainstTerrain=e}setCadMode(e){this.currentMode!==e&&(this.currentMode=e,this.is2d?this._enable2DMode():this._enable3DMode())}_enable2DMode(){const e=this.cesium,t=this.viewer.scene;this.setGlobeEnvironmentVisible(!0);const n=t.screenSpaceCameraController;this.setBackgroundColor("#000000"),this.setGlobeColor("#000000"),this.viewer.imageryLayers.removeAll(),n.enableZoomInertia=!1,n.enableTilt=!1,n.enableLook=!1,n.enableCollisionDetection=!1,n.inertiaSpin=0,n.inertiaZoom=0,n.inertiaTranslate=0,this.viewer.camera.setView({orientation:{heading:0,pitch:e.Math.toRadians(-90),roll:0}}),this._removeCameraLockListener&&(this._removeCameraLockListener(),this._removeCameraLockListener=null),this.viewer.resolutionScale=1,this.viewer.scene.postProcessStages&&this.viewer.scene.postProcessStages.fxaa&&(this.viewer.scene.postProcessStages.fxaa.enabled=!1);let s=window.devicePixelRatio;this.viewer.resolutionScale=s,this.viewer.scene.postProcessStages.fxaa.enabled=!1,this.viewer.scene.highDynamicRange=!1,this.setCollisionDetection(!1),this.setHeightBasedZoom(!0)}_enable3DMode(){this._removeCameraLockListener&&(this._removeCameraLockListener(),this._removeCameraLockListener=null);const e=this.viewer.scene.screenSpaceCameraController;e.enableRotate=!0,e.enableTilt=!0,e.enableLook=!0,this.viewer.scene.morphTo3D(0),this.setMouseHabit(0),this.setCollisionDetection(!0),this.viewer.scene.screenSpaceCameraController.minimumZoomDistance=1,this.setHeightBasedZoom(!1)}async changeBaseMap(e,t){if(this.is2d){this.viewer.imageryLayers.removeAll();return}const n=Date.now();this.lastBaseMapRequestId=n;const s=this.viewer.imageryLayers,o=[];if(e==="tianditu"){const r=t?.token||"c25f14fb6bd4397cf8fe45144ff768d6",a=t?.layerType||"img_w",l=a.split("_"),c=l[0]||"img",h=l[1]||"w";let u="";c==="img"?u="cia":c==="vec"?u="cva":c==="ter"&&(u="cta");const p=u?`${u}_${h}`:"";o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${a}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${c}&STYLE=default&TILEMATRIXSET=${h}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:c,style:"default",format:"tiles",tileMatrixSetID:h,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]})),t.showAnnotation!==!1&&p&&o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${p}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${u}&STYLE=default&TILEMATRIXSET=${h}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:u,style:"default",format:"tiles",tileMatrixSetID:h,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]}))}else if(e==="arcgis"){const r=t?.url||"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";try{if(this.cesium.ArcGisMapServerImageryProvider.fromUrl){const a=this.cesium.ArcGisMapServerImageryProvider.fromUrl(r,{enablePickFeatures:!1}),l=new Promise((h,u)=>setTimeout(()=>u(new Error("ArcGIS metadata request timed out")),3e3)),c=await Promise.race([a,l]);o.push(c)}else o.push(new this.cesium.ArcGisMapServerImageryProvider({url:r,enablePickFeatures:!1}))}catch(a){console.warn("ArcGIS provider failed (or timed out), fallback to XYZ template",a),o.push(new this.cesium.UrlTemplateImageryProvider({url:`${r}/tile/{z}/{y}/{x}`,maximumLevel:19,credit:"ArcGIS Layer"}))}}else if(e==="tianditu_img")return this.changeBaseMap("tianditu",{...t,layerType:"img_w"});this.lastBaseMapRequestId===n&&(s.removeAll(),o.forEach(r=>s.addImageryProvider(r)))}async searchLocation(e,t){if(!e)return null;if(!t)throw new Error("缺少天地图 Token");const s=JSON.stringify({keyWord:e,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}),o=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(s)}&type=query&tk=${encodeURIComponent(t)}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}setShadowsEnable(e){this.is2d||(this.viewer.shadows=e,this.viewer.terrainShadows=e?this.cesium.ShadowMode.ENABLED:this.cesium.ShadowMode.DISABLED,this.viewer.shadowMap&&(this._shadowDarkness===void 0?this.viewer.shadowMap.darkness=e?.7:.3:this.viewer.shadowMap.darkness=this._shadowDarkness))}_shadowDarkness;setShadowDarkness(e){this.is2d||(this._shadowDarkness=e,this.viewer.shadowMap&&(this.viewer.shadowMap.darkness=e))}setTime(e){if(this.is2d)return;let t;if(e instanceof Date)t=e;else{const s=this.cesium.JulianDate.now();t=this.cesium.JulianDate.toDate(s),t.setHours(e),t.setMinutes(0),t.setSeconds(0)}const n=this.cesium.JulianDate.fromDate(t);this.viewer.clock.currentTime=n}setModelColorAdjustment(e){if(this.is2d)return;const t=this.viewer,n=this.cesium;if(!t||!t.scene)return;const s=e.brightness!==void 0?e.brightness:1,o=e.contrast!==void 0?e.contrast:1,r=e.saturation!==void 0?e.saturation:1,a=t.scene.primitives,l=a.length,c=!!n.CustomShader;for(let h=0;h<l;++h){const u=a.get(h);if(u instanceof n.Cesium3DTileset)if(c)if(u.customShader&&u.customShader.isModelAdjustment)e.brightness!==void 0&&u.customShader.setUniform("u_brightness",s),e.contrast!==void 0&&u.customShader.setUniform("u_contrast",o),e.saturation!==void 0&&u.customShader.setUniform("u_saturation",r);else{const p=new n.CustomShader({uniforms:{u_brightness:{type:n.UniformType.FLOAT,value:s},u_contrast:{type:n.UniformType.FLOAT,value:o},u_saturation:{type:n.UniformType.FLOAT,value:r}},fragmentShaderText:`
102
- void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
103
- // 1. 亮度 (Brightness) - RGB 乘法
104
- material.diffuse *= u_brightness;
105
-
106
- // 2. 对比度 (Contrast) - (Color - 0.5) * Contrast + 0.5
107
- material.diffuse = (material.diffuse - vec3(0.5)) * u_contrast + vec3(0.5);
108
-
109
- // 3. 饱和度 (Saturation)
110
- // 计算灰度值 (Luminance)
111
- float gray = dot(material.diffuse, vec3(0.2125, 0.7154, 0.0721));
112
- vec3 grayColor = vec3(gray);
113
- // 混合灰度与原色
114
- material.diffuse = mix(grayColor, material.diffuse, u_saturation);
115
-
116
- // 防止颜色溢出或变为负数 (Clamp to 0.0 - 1.0)
117
- // material.diffuse = clamp(material.diffuse, 0.0, 1.0);
118
- // 通常不需要 clamp,除非开启 HDR 后期望超亮,但负值需要避免
119
- material.diffuse = max(material.diffuse, vec3(0.0));
120
- }
121
- `});p.isModelAdjustment=!0,u.customShader=p}else e.brightness!==void 0&&e.brightness!==1&&!u.style&&(u.style=new n.Cesium3DTileStyle({color:`color('white') * ${e.brightness}`}))}}setModelBrightness(e){this.setModelColorAdjustment({brightness:e})}_defaultSkyBox=null;_skyBoxPreUpdateListener=null;_updateLightDirection=e=>{e.light instanceof this.cesium.DirectionalLight&&(e.light.direction=e.camera.directionWC)};setEnvironmentMapEnable(e){this.is2d||(e?(this.viewer.scene.light=new this.cesium.DirectionalLight({direction:this.viewer.scene.camera.directionWC}),this.viewer.scene.preRender.addEventListener(this._updateLightDirection)):(this._defaultSkyBox&&(this.viewer.scene.skyBox=this._defaultSkyBox),this.viewer.scene.preRender.removeEventListener(this._updateLightDirection),this.viewer.scene.light=new this.cesium.SunLight),this.viewer.scene.imageBasedLighting&&(this.viewer.scene.imageBasedLighting.imageBasedLightingFactor=e?new this.cesium.Cartesian2(2,2):new this.cesium.Cartesian2(1,1)))}setAmbientOcclusion(e){if(this.is2d)return;const t=this.viewer.scene;if(!t||!t.postProcessStages||!t.postProcessStages.ambientOcclusion)return;const n=t.postProcessStages.ambientOcclusion;n.enabled=e,e&&(n.uniforms.ambientOcclusionOnly=!1,n.uniforms.intensity=3,n.uniforms.bias=.1,n.uniforms.lengthCap=.03,n.uniforms.stepSize=1,n.uniforms.blurStepSize=.86)}setCollisionDetection(e){if(this.is2d){this.viewer.scene.screenSpaceCameraController.enableCollisionDetection=!1;return}const t=this.viewer.scene.screenSpaceCameraController;t.enableCollisionDetection=e,e||t.minimumZoomDistance<1&&(t.minimumZoomDistance=1)}_customZoomHandler=null;setHeightBasedZoom(e){const t=this.viewer.scene.screenSpaceCameraController,n=this.cesium;if(this.viewer.camera.frustum.near=1e-4,this.viewer.camera.frustum.far=1e8,e||(this.viewer.camera.frustum.near=.1),this._customZoomHandler&&(this._customZoomHandler.destroy(),this._customZoomHandler=null),!e){t.zoomEventTypes.includes(n.CameraEventType.WHEEL)||t.zoomEventTypes.push(n.CameraEventType.WHEEL);return}t.zoomEventTypes=t.zoomEventTypes.filter(o=>o!==n.CameraEventType.WHEEL),this._customZoomHandler=new n.ScreenSpaceEventHandler(this.viewer.scene.canvas);let s=null;this._customZoomHandler.setInputAction(o=>{s=o.endPosition},n.ScreenSpaceEventType.MOUSE_MOVE),this._customZoomHandler.setInputAction(o=>{const r=this.viewer.camera,a=r.positionCartographic.height,l=Math.sign(o);if(a<.15&&l>0){me.info("无法继续放大");return}const c=.3;let h=0;if(l>0){const m=a-1;h=m>0?m*c:0}else h=a*c;h=Math.max(.1,h);let u=null;if(!s)u=r.direction;else{const m=r.getPickRay(s);if(m){let y=this.viewer.scene.pickPosition(s);if(!y){const g=n.IntersectionTests.rayEllipsoid(m,this.viewer.scene.globe.ellipsoid);g&&(y=n.Ray.getPoint(m,g.start))}if(y){const g=n.Cartesian3.subtract(y,r.position,new n.Cartesian3);u=n.Cartesian3.normalize(g,new n.Cartesian3)}else u=r.direction}else u=r.direction}const p=l>0?h:-h*2,f=n.Cartesian3.multiplyByScalar(u,p,new n.Cartesian3);r.position=n.Cartesian3.add(r.position,f,new n.Cartesian3)},n.ScreenSpaceEventType.WHEEL)}setMouseHabit(e){if(this.is2d)return;const t=this.viewer.scene.screenSpaceCameraController;t.enableTranslate=!0,t.enableRotate=!0,t.enableZoom=!0,t.enableTilt=!0,t.enableLook=!1,t.lookEventTypes=[],e===1?(t.rotateEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.MIDDLE_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.LEFT_DRAG]):(t.rotateEventTypes=[this.cesium.CameraEventType.LEFT_DRAG],t.zoomEventTypes=[this.cesium.CameraEventType.RIGHT_DRAG,this.cesium.CameraEventType.WHEEL,this.cesium.CameraEventType.PINCH],t.tiltEventTypes=[this.cesium.CameraEventType.PINCH,this.cesium.CameraEventType.MIDDLE_DRAG])}}class wB{cesium;viewer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer}getCameraView(){const e=this.viewer.camera;return{position:{x:e.position.x,y:e.position.y,z:e.position.z},destination:{x:e.position.x,y:e.position.y,z:e.position.z},orientation:{heading:e.heading,pitch:e.pitch,roll:e.roll},duration:1}}flyToCameraView(e){const{position:t,orientation:n,duration:s}=e,o=new this.cesium.Cartesian3(t.x,t.y,t.z),r=new this.cesium.HeadingPitchRoll(n.heading,n.pitch,n.roll);!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}getCurrentCameraPositionAndTarget(){const e=this.getCameraView();return{position:e.position,target:{heading:e.orientation.heading,pitch:e.orientation.pitch,roll:e.orientation.roll},duration:e.duration}}setCameraView(e){const t=e.target||e.orientation||{},n=e.destination||e.position||{};this.flyToCameraView({position:{x:Number(n.x),y:Number(n.y),z:Number(n.z)},destination:{x:Number(n.x),y:Number(n.y),z:Number(n.z)},orientation:{heading:Number(t.heading||0),pitch:Number(t.pitch||0),roll:Number(t.roll||0)},duration:e.duration})}flyToLonLatHeight(e,t,n,s=1){const o=this.cesium.Cartesian3.fromDegrees(e,t,n),r={heading:this.cesium.Math.toRadians(0),pitch:this.cesium.Math.toRadians(-90),roll:0};!s||s<=0?this.viewer.camera.setView({destination:o,orientation:r}):this.viewer.camera.flyTo({destination:o,orientation:r,duration:s})}}function CB(i){const{container:e,appContext:t,methods:n,viewerOptions:s,options:o,callbacks:r}=i,a=new _s,l=window.Cesium;if(!l)throw new Error("Cesium is not loaded");e.id=`cesium-container-${hC()}`;const c={animation:!1,timeline:!1,infoBox:!1,homeButton:!1,fullscreenButton:!1,sceneModePicker:!1,navigationHelpButton:!1,geocoder:!1,baseLayerPicker:!1,selectionIndicator:!1,heightBasedZoom:!0,creditContainer:document.createElement("div"),contextOptions:{webgl:{alpha:!0,preserveDrawingBuffer:!0}}},h=t?.config?.globalProperties?.$leitingBimOptions,u={...c,...h?.viewerOptions??{},...s??{}},p=new l.Viewer(e,u);p.camera.setView({destination:l.Cartesian3.fromDegrees(108,32,1e7),orientation:{heading:l.Math.toRadians(0),pitch:l.Math.toRadians(-90),roll:0}});let f=n;if(!f&&h&&(h.methods||(h.methods={}),f=h.methods),f){const m=new xC({cesium:l,viewer:p,options:o,callbacks:r}),y=new qu({cesium:l,viewer:p}),g=new bB({cesium:l,viewer:p}),A=new IC({cesium:l,viewer:p}),v=new BS({cesium:l,viewer:p}),b=new wB({cesium:l,viewer:p});let C;const x=new pc({cesium:l,viewer:p});o&&(o.globe!==void 0&&g.setGlobeEnvironmentVisible(o.globe),o.terrain!==void 0&&g.setTerrainEnable(o.terrain),o.depthTest!==void 0&&g.setDepthTestEnable(o.depthTest),o.mapProvider&&o.mode!=="2d"&&g.changeBaseMap(o.mapProvider,{token:o.tiandituToken,layerType:o.tiandituLayerType,showAnnotation:o.tiandituShowLabel,url:o.arcgisUrl}),o.shadows!==void 0&&g.setShadowsEnable(o.shadows),o.environmentMap!==void 0&&g.setEnvironmentMapEnable(o.environmentMap),o.ambientOcclusion!==void 0&&g.setAmbientOcclusion(o.ambientOcclusion),o.time!==void 0&&g.setTime(o.time),o.brightness!==void 0&&g.setModelBrightness(o.brightness),o.backgroundColor!==void 0&&g.setBackgroundColor(o.backgroundColor),o.collision!==void 0&&g.setCollisionDetection(o.collision),o.mouseHabit!==void 0&&g.setMouseHabit(o.mouseHabit),o.heightBasedZoom!==void 0&&g.setHeightBasedZoom(o.heightBasedZoom)),o&&o.mode==="2d"&&(g.setCadMode("2d"),C=new um({cesium:l,viewer:p})),y.events.on("tilesetLoaded",w=>{m.baseCompt.attachTileset(w,m.baseCompt.selectedColor),m.baseSection.attachTileset(w,w.leiting?.model?.modelId),f&&f.tilesLoad3dTiles&&f.tilesLoad3dTiles(w),o?.tilesLoad3dTiles&&o.tilesLoad3dTiles(w.leiting)}),y.events.on("loadingStatus",w=>{f&&f.onLoadingStatus&&f.onLoadingStatus(w)}),y.events.on("mountAll3Dtiles",({modelList:w})=>{o?.mountAll3Dtiles&&o.mountAll3Dtiles(w),f?.mountAll3Dtiles&&f.mountAll3Dtiles(w)}),y.events.on("configureLoaded",w=>{f.setConfigure(w)}),y.events.on("updateModels",({modelList:w})=>{o?.updateModels&&o.updateModels(w),f?.updateModels&&f.updateModels(w)}),A.events.on("mountAllCad",w=>{o?.mountAllCad&&o.mountAllCad(w),f?.mountAllCad&&f.mountAllCad(w)}),v.events.on("mountAllGISCad",w=>{o?.mountAllGISCad&&o.mountAllGISCad(w),f?.mountAllGISCad&&f.mountAllGISCad(w)}),m.baseCompt.loadNodeDetailsForModel=w=>y.loadNodeDetailsForModel(w),m.baseCompt.selectionChange(w=>{w.length!==0&&(o?.selectionChange&&o.selectionChange(w),f?.selectionChange&&f.selectionChange(w))}),f.onSearchComponent=w=>{o?.searchComponent&&o.searchComponent(w),f?.searchComponent&&f.searchComponent(w)};const I=f.saveRegion;f.saveRegion=w=>{I?I(w):o?.saveRegion&&o.saveRegion(w)};const E=f.saveCadCalibration;f.saveCadCalibration=w=>{E?E(w):o?.saveCadCalibration&&o.saveCadCalibration(w)};const S=f.saveCadRegion;f.saveCadRegion=w=>{S?S(w):o?.saveCadRegion&&o.saveCadRegion(w)},f.getCesium=()=>l,f.getViewer=()=>p,f.getAnnotationInstance=()=>C,f.getMeasureInstance=()=>x,f.flyToCamera=w=>{b.setCameraView(w)},f.flyToLonLatHeight=(w,T,_,F=1)=>{b.flyToLonLatHeight(w,T,_,F)},f.flyTo=f.flyToCamera,f.getCameraState=()=>b.getCameraView(),f.getCameraInfo=f.getCameraState,f.restoreCameraState=w=>b.flyToCameraView(w),f.flyToCameraView=f.restoreCameraState,f.getCameraPositionTarget=()=>b.getCurrentCameraPositionAndTarget(),f.getCurrentCameraPositionAndTarget=f.getCameraPositionTarget,f.setCameraLookAt=w=>b.setCameraView(w),f.setCameraView=f.setCameraLookAt,f.setCanvasBackground=w=>g.setBackgroundColor(w),f.setBackgroundColor=f.setCanvasBackground,f.setAntiAliasing=w=>m.enableCesiumFXAA(w),f.enableCesiumFXAA=f.setAntiAliasing,f.setSceneVisibility=w=>m.setSceneOptions(w),f.setSceneOptions=f.setSceneVisibility,f.addDebugPoint=(w,T,_=0)=>{p.entities.add({position:l.Cartesian3.fromDegrees(w,T,_),point:{pixelSize:10,color:l.Color.RED}})},f.addPoint=f.addDebugPoint,f.toggleDebugLabels=()=>m.enableTestLabel(),f.enableTestLabel=f.toggleDebugLabels,f.captureScreenshot=()=>{const w=p.scene.canvas;return p.render(),w.toDataURL("image/png")},f.getImageBase64=f.captureScreenshot,f.captureDomScreenshot=(w,T)=>m.getSnapDomSImageBase64(w,T),f.getSnapDomSImageBase64=f.captureDomScreenshot,f.addModels=w=>y.addModels(w),f.add3DtilesModel=f.addModels,f.addObliquePhotography=w=>y.addOSGB(w),f.addOSGB=f.addObliquePhotography,f.adjustOSGBModelMatrix=w=>y.updateOSGBMatrix(w),f.updateOSGBMatrix=f.adjustOSGBModelMatrix,f.setModelVisibility=w=>y.showModels(w),f.showModels=f.setModelVisibility,f.showTileset=f.setModelVisibility,f.removeModels=w=>y.deleteModels(w),f.deleteModels=f.removeModels,f.clearAllModels=()=>{y.deleteAllModels(),a.emit("deleteAllModels")},f.deleteAllModelList=f.clearAllModels,f.deleteAllModels=f.clearAllModels,f.flyToModel=w=>y.flyToTileset(w),f.flyToTileset=f.flyToModel,f.flyToByModelId=f.flyToModel,f.setModelBrightness=w=>m.updateModelEffect(w),f.updateModelEffect=f.setModelBrightness,f.getAllTilesets=()=>y.getMapTileset(),f.getMapTileset=f.getAllTilesets,f.getCurrentModelId=()=>y.getBIMmodelId(),f.getBIMmodelId=f.getCurrentModelId,f.getLoadedModels=()=>y.getModelList(),f.getModelList=f.getLoadedModels,f.loadModelStructure=async w=>{const T=typeof w=="string"?w:w?.modelId;if(!T){console.warn("loadModelStructure: modelId is required");return}return await y.loadTreeForModel(T)},f.loadTreeForModel=f.loadModelStructure,f.loadModelDetails=async w=>{const T=typeof w=="string"?w:w?.modelId;if(!T){console.warn("loadModelDetails: modelId is required");return}return await y.loadNodeDetailsForModel(T)},f.loadNodeDetailsForModel=f.loadModelDetails,f._loadNodeDetailsForModel=async w=>{const T=typeof w=="string"?w:w?.modelId;if(!T){console.warn("loadModelDetails: modelId is required");return}return await y._loadNodeDetailsForModel(T)},f.setMapTileset=w=>y.setMapTileset(w),f.setCurrentModelId=w=>y.setBIMmodelId(w),f.setBIMmodelId=f.setCurrentModelId,f.setModelList=w=>y.setModelList(w),f.setWatermarkEnabled=w=>{y.setWatermarkEnabled(w),v.setWatermarkEnabled(w)},f.applyWatermark=async(w=!0)=>{await wl(w,p.container)},f.highlightComponents=(w,T={})=>m.baseCompt.setSelectColorUserModelCpt(w,T),f.setSelectColorUserModelCpt=f.highlightComponents,m.baseCompt.setLoadNodeDetailsCallback(w=>y.loadNodeDetailsForModel(w)),f.highlightAllComponents=(w,T)=>m.baseCompt.setAllSelectColorUserModelCpt(w,T),f.setAllSelectColorUserModelCpt=f.highlightAllComponents,f.setSelectColorUserModelCptByClear=(w,T)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(w.selectCpts,T??{rank:0})},f.clearSelectColorUserModelCpt=()=>m.baseCompt.clearAllHaveSelected(),f.selectComponents=(w,T)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(w,T??{rank:0})},f.setSelecteds=f.selectComponents,f.setSelectionColor=(w,T,_,F)=>m.baseCompt.setSelectedColorRgba(w,T,_,F),f.setSelectedColor=f.setSelectionColor,f.clearSelection=()=>m.baseCompt.clearAllHaveSelected(),f.clearAllHaveSelected=f.clearSelection,f.getSelectedComponents=w=>m.baseCompt.getSelected(w),f.getSelected=f.getSelectedComponents,f.setClickToHighlightEnabled=w=>{m.baseCompt.clickToHighlightEnabled=w},f.getClickToHighlightEnabled=()=>m.baseCompt.clickToHighlightEnabled,f.onSelectionChange=w=>{m.baseCompt.selectionChange(w)},f.selectionChange=f.onSelectionChange,f.flyToComponents=w=>m.baseCompt.flyToObjects(w),f.flyToObjects=f.flyToComponents,f.setConstructionData=async w=>{if(w&&Array.isArray(w)){const T=new Set;w.forEach(_=>{_.mergeCpts&&Array.isArray(_.mergeCpts)&&_.mergeCpts.forEach(F=>{F.modelId&&T.add(F.modelId)})}),T.size>0&&await Promise.all(Array.from(T).map(_=>f.loadNodeDetailsForModel(_)))}m.baseCompt.setAllConstructionProgressTracking(w)},f.setAllConstructionProgressTracking=f.setConstructionData,f.startConstructionSimulation=()=>m.baseCompt.enableConstructionProgressTracking(),f.enableAllConstructionProgressTracking=f.startConstructionSimulation,f.stopConstructionSimulation=()=>m.baseCompt.disableConstructionProgressTracking(),f.disableConstructionProgressTracking=f.stopConstructionSimulation,f.disableAllConstructionProgressTracking=f.stopConstructionSimulation,f.resetConstructionSimulation=()=>m.baseCompt.freshConstructionProgressTracking(),f.freshConstructionProgressTracking=f.resetConstructionSimulation,f.restartConstructionSimulation=()=>m.baseCompt.reStartAnimation(),f.reStartAnimation=f.restartConstructionSimulation,f.resumeFlyTo=()=>m.baseCompt.resumeFlyTo(),f.pauseConstructionSimulation=()=>m.baseCompt.pauseFlyTo(),f.pauseFlyTo=f.pauseConstructionSimulation,f.pauseAnimation=f.pauseConstructionSimulation,f.resumeConstructionSimulation=()=>m.baseCompt.resumeFlyTo(),f.resumeAnimation=f.resumeConstructionSimulation,f.setComponentsVisibility=async w=>await m.baseCompt.setComponentVisibility(w),f.setElementsListVisible=f.setComponentsVisibility,f.setAllComponentsVisibility=async w=>await m.baseCompt.setAllComponentsVisibility(w),f.setAllElementsVisible=f.setAllComponentsVisibility,f.isolateComponents=w=>m.baseCompt.isolateComponentVisibility(w),f.isolateComponentVisibility=f.isolateComponents,f.getComponentsByVisibility=w=>m.baseCompt._getComponentsByVisibility(w),f.getShowCpts=w=>m.baseCompt.getComponentsByVisibility(w),f.getElementsVisible=w=>m.baseCompt.getComponentsByVisibility(w),f.setComponentVisibility=f.setComponentsVisibility,f.enableSectioning=(w,T)=>m.baseSection.open(w,T),f.openSection=f.enableSectioning,f.disableSectioning=w=>m.baseSection.close(w),f.closeSection=f.disableSectioning,f.updateSectionBox=w=>m.baseSection.updateRange(w),f.updateSectionRange=f.updateSectionBox,f.getSectionBox=()=>m.baseSection.getRange(),f.getSectionRange=f.getSectionBox,f.fitSectionToModel=()=>m.baseSection.fitToModels(),f.fitToModels=f.fitSectionToModel,f.setSectionBoxVisibility=w=>m.baseSection.setBoxVisibility(w),f.startFirstPersonMode=()=>{m.baseCompt.disableSelection(),m.basePlayer.openPlayer()},f.openPlayer=f.startFirstPersonMode,f.startCameraRoam=()=>{m.baseCompt.disableSelection(),m.basePlayer.openCameraRoam()},f.stopFirstPersonMode=()=>{m.basePlayer.closePlayer(),m.baseCompt.enableSelection()},f.closePlayer=f.stopFirstPersonMode,f.setPlayerPosition=w=>m.basePlayer.setPersonPosition(w),f.setPersonPosition=f.setPlayerPosition,f.setPlayerDefaultPosition=()=>m.basePlayer.setDefaultPosition(),f.setWalkSpeed=w=>m.basePlayer.setSpeed({speed:w}),f.setPlayerSpeed=f.setWalkSpeed,f.setPlayerConfig=w=>m.basePlayer.setParams(w),f.setPlayerParams=f.setPlayerConfig,f.setModelInfo=w=>m.basePlayer.setModelInfo(w),f.setPlayerAction=(w,T)=>m.basePlayer.setMoveState(w,T),f.setPlayerMoveState=f.setPlayerAction,f.bindPlayerControls=w=>m.basePlayer.bindUiKeys(w),f.bindPlayerUiKeys=f.bindPlayerControls,f.setGlobeVisibility=w=>g.setGlobeEnvironmentVisible(w),f.setGlobeEnvironmentVisible=f.setGlobeVisibility,f.setSkyBoxVisible=w=>g.setSkyBoxVisible(w),f.setTerrainVisibility=w=>g.setTerrainEnable(w),f.setTerrainEnable=f.setTerrainVisibility,f.setDepthTest=w=>g.setDepthTestEnable(w),f.setDepthTestEnable=f.setDepthTest,f.setBaseMap=(w,T)=>g.changeBaseMap(w,T),f.changeBaseMap=f.setBaseMap,f.setWorldTime=w=>g.setTime(w),f.setTime=f.setWorldTime,f.setGisOptions=w=>{w.globe!==void 0&&g.setGlobeEnvironmentVisible(w.globe),w.elevation!==void 0&&g.setTerrainEnable(w.elevation),w.depthTestAgainstTerrain!==void 0&&g.setDepthTestEnable(w.depthTestAgainstTerrain),w.rendering!==void 0&&g.setAmbientOcclusion(w.rendering)},f.setShadowVisibility=w=>g.setShadowsEnable(w),f.setShadowsEnable=f.setShadowVisibility,f.setEnvironmentMapVisibility=w=>g.setEnvironmentMapEnable(w),f.setEnvironmentMapEnable=f.setEnvironmentMapVisibility,f.setAOVisibility=w=>g.setAmbientOcclusion(w),f.setAmbientOcclusion=f.setAOVisibility,f.setBackgroundColor=w=>g.setBackgroundColor(w),f.setGlobeColor=f.setBackgroundColor,f.setSkyBox=w=>g.setSkyBox(w),f.setModelBrightness=w=>g.setModelBrightness(w),f.adjustModelColor=w=>g.setModelColorAdjustment(w),f.setModelColorAdjustment=f.adjustModelColor,f.setShadowIntensity=w=>{g.setShadowDarkness?g.setShadowDarkness(w):console.warn("baseSetting.setShadowDarkness is not available. Please reload the page.")},f.setShadowDarkness=f.setShadowIntensity,f.switchSceneMode=async w=>{const T=w?"2d":"3d";await g.setCadMode(T),w&&!C&&(C=new um({cesium:l,viewer:p}),f.setGlobeVisibility(!0)),a.emit("setMode",T)},f.setSceneMode=f.switchSceneMode,f.set2d=w=>f.switchSceneMode(w),f.is2dMode=()=>g.is2d,f.setMouseControlMode=w=>g.setMouseHabit(w),f.setMouseHabit=f.setMouseControlMode,f.setCollisionEnabled=w=>g.setCollisionDetection(w),f.setCollisionDetection=f.setCollisionEnabled,f.searchAndLocate=(w,T)=>g.searchLocation(w,T),f.searchLocation=f.searchAndLocate,f.getConfigure=()=>(console.warn("getConfigure is not initialized. Please ensure LeitingSetting component is mounted."),{}),f.setConfigure=w=>{console.warn("setConfigure is not initialized. Please ensure LeitingSetting component is mounted.",w)},f.addCadModel=w=>{const T={...w};return T.files&&!T.fileNames&&(T.fileNames=T.files),T.fileNames||(T.fileNames=[]),A.addDxfModel(T)},f.addDxfModel=f.addCadModel,f.addGISCadModel=w=>{const T={...w};return T.files&&!T.fileNames&&(T.fileNames=T.files),T.fileNames||(T.fileNames=[]),v.addGISCadModel(T)},f.addVectorTileByUrlTemplate=w=>v.addVectorTileByUrlTemplate(w),f.addVectorTileByTilesManifest=w=>v.addVectorTileByTilesManifest(w),f.showGISCadModel=w=>v.showJson(w),f.addGeoJsonLayer=w=>v.addGeoJsonLayer(w),f.showGISCadLayer=w=>v.showJsonByLayer(w),f.deleteGISCad=w=>v.deleteCad(w),f.deleteAllGISCad=()=>v.deleteAllCad(),f.flyToGISCadModel=(w={})=>v.flyToCadModel(w),f.flyGisCadModel=w=>v.flyToCadModel({modelId:w}),f.getGISCadModels=w=>v.getDxfModels(w),f.getGISCadModelsList=()=>v.getDxfModelsList(),f.getGISCadLayers=w=>v.getMapLayers(w),f.getGISCadModelId=()=>v.getModelId(),f.getDefaultGISCadTransformConfig=()=>v.getDefaultCoordinateTransformConfig(),f.transformGISCadCoordinate=w=>v.transformCoordinate(w),f.beginEditGISCad=w=>v.beginEditGISCad(w),f.adjustGISCadModel=w=>v.adjustGISCadModel(w),f.commitEditGISCad=w=>v.commitEditGISCad(w),f.cancelEditGISCad=w=>v.cancelEditGISCad(w),f.deleteCad=w=>A.deleteCad(w),f.deleteAllCad=()=>A.deleteAllCad(),f.showCadModel=w=>A.showJson(w),f.showGeoJson=w=>A.showJson(w),f.showDxfModel=f.showCadModel,f.showCadLayer=w=>A.showJsonByLayer(w),f.showDxfLayer=f.showCadLayer,f.flyToCadModel=(w={})=>A.flyToCadModel(w),f.getCadModels=w=>A.getDxfModels(w),f.getDxfModels=f.getCadModels,f.getCadLayers=w=>A.getMapLayers(w),f.getDxfLayers=f.getCadLayers,f.getCadModelId=()=>A.getModelId(),f.setCadOpen=w=>A.setDxfOpen(w),f.setDxfOpen=f.setCadOpen,f.getCadOpen=()=>A.getDxfOpen(),f.getDxfOpen=f.getCadOpen,f.adjustCadModel=w=>A.adjustingModelByCad(w),f.adjustingModelByCad=f.adjustCadModel,f.saveAnnotations=()=>{let w=null;return C&&(w=C.saveAnnotations()),o?.saveAnnotations&&o.saveAnnotations(w),w},f.loadAnnotations=w=>C?C.loadAnnotations(w):!1,f.flyToTopView=()=>{A.flyToCadModel()},f.menuEvents=a,f.addMenuItems=w=>{a.emit("insertMenu",w)},f.insertMenu=f.addMenuItems,f.filterMenuItems=w=>{a.emit("setMenuListFilter",w)},f.setMenuListFilter=f.filterMenuItems,f.setMenuVisibility=w=>{a.emit("showMenu",w)},f.showMenu=f.setMenuVisibility,f.setPanelVisibility=(w,T)=>{a.emit("setMenuActive",w,T)},f.setMenuActive=f.setPanelVisibility,f.addContextMenuItems=w=>{console.warn("addContextMenuItems is not initialized yet. Please wait for LeitingBIM component to mount.",w)},f.insertContextMenu=f.addContextMenuItems,f.removeContextMenuItems=w=>{console.warn("removeContextMenuItems is not initialized yet.",w)},f.deleteContextMenu=f.removeContextMenuItems,f.closeContextMenu=()=>{console.warn("closeContextMenu is not initialized yet.")},f.hideContextMenu=f.closeContextMenu,f.getModelTree=()=>{const w=[],T=y.getMapTileset();return Object.keys(T).forEach(_=>{const F=T[_];if(F&&F.leiting&&F.leiting.tree){const U=F.leiting.tree;Array.isArray(U)?w.push(...U):w.push(U)}}),w},f.getTree=f.getModelTree,f.getAllComponentDetails=()=>{const w=y.getMapTileset(),T={},_=[];try{Object.keys(w).forEach(F=>{const U=w[F];if(!U||!U.leiting)return;const L=U.leiting,D=L.node,M=L.model.formData,k=L.box;if(!D||!D.nodeExtras)return;const B=L.model.modelId;T[B]=D.nodeExtras;const P=D.nodeExtras.element;if(!P)return;const V=k?k.center:{x:0,y:0,z:0};Object.values(P).forEach(G=>{if(G.box3)try{const R=l.Quaternion.fromAxisAngle(l.Cartesian3.UNIT_Z,l.Math.toRadians(M.totalRotation||0)),N=l.Matrix4.fromRotationTranslation(l.Matrix3.fromQuaternion(R),new l.Cartesian3(0,0,0)),O=l.Cartesian3.fromDegrees(M.longitude,M.latitude,M.height),z=l.Transforms.eastNorthUpToFixedFrame(O);l.Matrix4.multiply(z,N,z);const j=new l.Cartesian3(V.x,V.y,0),Z=new l.Cartesian3;l.Matrix4.multiplyByPoint(z,j,Z);const te=l.Cartographic.fromCartesian(Z),de=G.box3?.Center?.x||0,pe=G.box3?.Center?.y||0,Ae=G.box3?.Center?.z||0,Pe=new l.Cartesian3(-V.x+de,-V.y+pe,0+Ae),Ge=l.Matrix4.fromTranslation(Pe),Je=l.Matrix4.clone(Ge);l.Matrix4.multiply(N,Je,Je);const vt=l.Cartesian3.fromDegrees(te.longitude/Math.PI*180,te.latitude/Math.PI*180,M.height),ct=l.Transforms.eastNorthUpToFixedFrame(vt);l.Matrix4.multiply(ct,Je,ct);const Bt=l.Cartographic.fromCartesian(new l.Cartesian3(ct[12],ct[13],ct[14]));G.box3.cartographic={longitude:Bt.longitude/Math.PI*180,latitude:Bt.latitude/Math.PI*180,height:Bt.height};const W={id:G.uniqueId,billboard:[{theme:"Tag9999",position:[G.box3.cartographic.longitude,G.box3.cartographic.latitude,G.box3.cartographic.height],options:{text:G.name}}]};_.push(W)}catch(R){console.warn("Error calculating component position:",R)}})})}catch(F){console.error("getAllComponents error:",F)}return T},f.getAllComponents=f.getAllComponentDetails,f.getComponentInfoList=async w=>{if(!Array.isArray(w))return[];const T=y.getMapTileset(),_=[],F=[],U={};w.forEach(D=>{const k=T[D.modelId]?.leiting?.model?.dbName;k&&D.elementId&&F.push({dbName:k,elementId:D.elementId,modelId:D.modelId})});const L=new Set;if(w.forEach(D=>{const M=T[D.modelId],k=`${D.modelId}_${D.elementId}`;U[k]||M&&M.leiting&&!M.leiting?.node?.nodeExtras&&M.leiting.model?.nodeUrl&&L.add(D.modelId)}),L.size>0&&y._loadNodeDetailsForModel)try{const D=Array.from(L).map(M=>y._loadNodeDetailsForModel(M));await Promise.all(D)}catch(D){console.error("Failed to load node details in getComponentInfoList",D)}try{w.forEach(D=>{const M=D.modelId,k=D.elementId,B=T[M];if(!B||!B.leiting)return;const P=`${M}_${k}`,V=U[P];let G=null;if(V)G=V;else{const R=B.leiting.node?.nodeExtras?.element||B.leiting.node?.nodeExtras;R&&R[k]&&(G=JSON.parse(JSON.stringify(R[k])))}if(G){if(G.elementId=k,G.modelId=M,G.box3&&!G.box3.cartographic)try{const R=B.leiting,N=R.model.formData,O=R.box,z=O?O.center:{x:0,y:0,z:0},j=l.Quaternion.fromAxisAngle(l.Cartesian3.UNIT_Z,l.Math.toRadians(N.totalRotation||0)),Z=l.Matrix4.fromRotationTranslation(l.Matrix3.fromQuaternion(j),new l.Cartesian3(0,0,0)),te=l.Cartesian3.fromDegrees(N.longitude,N.latitude,N.height),de=l.Transforms.eastNorthUpToFixedFrame(te);l.Matrix4.multiply(de,Z,de);const pe=new l.Cartesian3(z.x,z.y,0),Ae=new l.Cartesian3;l.Matrix4.multiplyByPoint(de,pe,Ae);const Pe=l.Cartographic.fromCartesian(Ae),Ge=G.box3?.Center?.x||0,Je=G.box3?.Center?.y||0,vt=G.box3?.Center?.z||0,ct=new l.Cartesian3(-z.x+Ge,-z.y+Je,0+vt),Bt=l.Matrix4.fromTranslation(ct),W=l.Matrix4.clone(Bt);l.Matrix4.multiply(Z,W,W);const Y=l.Cartesian3.fromDegrees(Pe.longitude/Math.PI*180,Pe.latitude/Math.PI*180,N.height),ee=l.Transforms.eastNorthUpToFixedFrame(Y);l.Matrix4.multiply(ee,W,ee);const Ze=l.Cartographic.fromCartesian(new l.Cartesian3(ee[12],ee[13],ee[14]));G.box3.cartographic={longitude:Ze.longitude/Math.PI*180,latitude:Ze.latitude/Math.PI*180,height:Ze.height}}catch(R){console.warn("Error calculating component position:",R)}_.push(G)}})}catch(D){console.error("getComponentInfoList processing error:",D)}return _},f.getCptInfos=f.getComponentInfoList,f.baseCompt=m.baseCompt,f.setTeleportTarget=w=>{f.onSetTeleportTarget&&f.onSetTeleportTarget(w)},window.Methods=f}return{Cesium:l,viewer:p,methods:f,menuEvents:a}}function yc(i){return d.getCurrentScope()?(d.onScopeDispose(i),!0):!1}function Ac(i){return typeof i=="function"?i():d.unref(i)}const EB=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const xB=Object.prototype.toString,IB=i=>xB.call(i)==="[object Object]",SB=()=>{};function MB(i){return d.getCurrentInstance()}function mm(i,e=!0,t){MB()?d.onMounted(i,t):e?i():d.nextTick(i)}function ln(i){var e;const t=Ac(i);return(e=t?.$el)!=null?e:t}const ro=EB?window:void 0;function TB(...i){let e,t,n,s;if(typeof i[0]=="string"||Array.isArray(i[0])?([t,n,s]=i,e=ro):[e,t,n,s]=i,!e)return SB;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},a=(h,u,p,f)=>(h.addEventListener(u,p,f),()=>h.removeEventListener(u,p,f)),l=d.watch(()=>[ln(e),Ac(s)],([h,u])=>{if(r(),!h)return;const p=IB(u)?{...u}:u;o.push(...t.flatMap(f=>n.map(m=>a(h,f,m,p))))},{immediate:!0,flush:"post"}),c=()=>{l(),r()};return yc(c),c}function BB(){const i=d.ref(!1),e=d.getCurrentInstance();return e&&d.onMounted(()=>{i.value=!0},e),i}function gm(i){const e=BB();return d.computed(()=>(e.value,!!i()))}function ym(i,e={}){const{window:t=ro}=e,n=gm(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const o=d.ref(!1),r=c=>{o.value=c.matches},a=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",r):s.removeListener(r))},l=d.watchEffect(()=>{n.value&&(a(),s=t.matchMedia(Ac(i)),"addEventListener"in s?s.addEventListener("change",r):s.addListener(r),o.value=s.matches)});return yc(()=>{l(),a(),s=void 0}),o}function _B(i,e,t={}){const{window:n=ro,...s}=t;let o;const r=gm(()=>n&&"ResizeObserver"in n),a=()=>{o&&(o.disconnect(),o=void 0)},l=d.computed(()=>Array.isArray(i)?i.map(u=>ln(u)):[ln(i)]),c=d.watch(l,u=>{if(a(),r.value&&n){o=new ResizeObserver(e);for(const p of u)p&&o.observe(p,s)}},{immediate:!0,flush:"post"}),h=()=>{a(),c()};return yc(h),{isSupported:r,stop:h}}function kB(i,e={width:0,height:0},t={}){const{window:n=ro,box:s="content-box"}=t,o=d.computed(()=>{var u,p;return(p=(u=ln(i))==null?void 0:u.namespaceURI)==null?void 0:p.includes("svg")}),r=d.ref(e.width),a=d.ref(e.height),{stop:l}=_B(i,([u])=>{const p=s==="border-box"?u.borderBoxSize:s==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(n&&o.value){const f=ln(i);if(f){const m=f.getBoundingClientRect();r.value=m.width,a.value=m.height}}else if(p){const f=Array.isArray(p)?p:[p];r.value=f.reduce((m,{inlineSize:y})=>m+y,0),a.value=f.reduce((m,{blockSize:y})=>m+y,0)}else r.value=u.contentRect.width,a.value=u.contentRect.height},t);mm(()=>{const u=ln(i);u&&(r.value="offsetWidth"in u?u.offsetWidth:e.width,a.value="offsetHeight"in u?u.offsetHeight:e.height)});const c=d.watch(()=>ln(i),u=>{r.value=u?e.width:0,a.value=u?e.height:0});function h(){l(),c()}return{width:r,height:a,stop:h}}function Am(i={}){const{window:e=ro,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:o=!0}=i,r=d.ref(t),a=d.ref(n),l=()=>{e&&(o?(r.value=e.innerWidth,a.value=e.innerHeight):(r.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))};if(l(),mm(l),TB("resize",l,{passive:!0}),s){const c=ym("(orientation: portrait)");d.watch(c,()=>l())}return{width:r,height:a}}function Or(){const{width:i,height:e}=Am(),t=ym("(pointer: coarse)"),n=d.ref(!1),s=d.ref(!1),o=d.ref(!0),r=d.ref("other"),a=d.ref("other"),l=d.ref("medium"),c=d.ref("portrait"),h=()=>{const m=navigator.userAgent.toLowerCase(),y=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i,g=navigator;if("userAgentData"in navigator&&g.userAgentData?.mobile!==void 0)return g.userAgentData.mobile||y.test(m);if(y.test(m))return!0;const A=/windows nt/i.test(m),v=/macintosh|mac os x/i.test(m)&&!/mobile/i.test(m),b=/linux/i.test(m)&&!/android/i.test(m);return!1},u=()=>{const m=navigator.userAgent.toLowerCase();n.value=h(),s.value=i.value>=768&&i.value<1024&&t.value,o.value=!n.value,/iphone|ipad|ipod/i.test(m)?r.value="ios":/android/i.test(m)?r.value="android":/win/i.test(m)?r.value="windows":/mac/i.test(m)?r.value="macos":/linux/i.test(m)&&(r.value="linux"),/safari/i.test(m)&&!/chrome/i.test(m)?a.value="safari":/chrome/i.test(m)?a.value="chrome":/firefox/i.test(m)?a.value="firefox":/edge/i.test(m)&&(a.value="edge"),i.value<576?l.value="small":i.value<1024?l.value="medium":l.value="large",c.value=i.value>e.value?"landscape":"portrait"},p=()=>{u()};d.onMounted(()=>{u(),window.addEventListener("resize",p),window.addEventListener("orientationchange",p)}),d.onUnmounted(()=>{window.removeEventListener("resize",p),window.removeEventListener("orientationchange",p)});const f=()=>({isMobile:n.value,isTablet:s.value,isDesktop:o.value,isTouchDevice:t.value,os:r.value,browser:a.value,screenSize:l.value,orientation:c.value});return{isMobile:d.readonly(n),isTablet:d.readonly(s),isDesktop:d.readonly(o),isTouchDevice:d.readonly(t),os:d.readonly(r),browser:d.readonly(a),screenSize:d.readonly(l),orientation:d.readonly(c),width:i,height:e,info:f}}const PB={class:"title"},DB={class:"actions"},NB={class:"card-body"},LB=d.defineComponent({__name:"LeitingDraggableCard",props:{visible:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},title:{type:String,default:"Title"},initialPosition:{type:Object,default:()=>({x:0,y:0})},width:{type:[Number,String],default:300},minWidth:{type:Number,default:200},fullHeight:{type:Boolean,default:!1},align:{type:String,default:""}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=d.inject("leiting-theme",d.ref("dark")),{isMobile:s}=Or(),o=e,r=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:E=>{o("update:visible",E),o("update:open",E)}}),a=d.ref(null),l=d.ref(t.initialPosition?.x||0),c=d.ref(t.initialPosition?.y||0),h=d.ref(t.width);d.watch(()=>t.width,E=>{h.value=E});const u=d.ref(t.fullHeight?"100%":"600px");d.watch(()=>t.fullHeight,E=>{E?u.value="100%":u.value==="100%"&&(u.value="600px")});const{height:p}=Am();d.watch(p,()=>{t.fullHeight&&(u.value="100%")});const f=d.ref(!1),m=E=>{f.value=!0,E.preventDefault(),E.stopPropagation();const S=E.clientX,w=E.clientY,T=typeof h.value=="number"?h.value:a.value?.offsetWidth||0,_=typeof u.value=="number"?u.value:a.value?.offsetHeight||0,F=L=>{if(!f.value)return;L.preventDefault();const D=L.clientX-S,M=L.clientY-w,k=T+D,B=_+M;k>100&&(h.value=k),B>100&&(u.value=B)},U=()=>{f.value=!1,document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",U)};document.addEventListener("mousemove",F),document.addEventListener("mouseup",U)},y=d.computed(()=>({left:`${l.value}px`,top:`${c.value}px`,width:typeof h.value=="number"?`${h.value}px`:h.value,height:typeof u.value=="number"?`${u.value}px`:u.value,position:"absolute",zIndex:2e3})),g=()=>{d.nextTick(()=>{if(a.value){const E=a.value.offsetParent||document.body,S=E.clientWidth,w=E.clientHeight,T=typeof h.value=="number"?h.value:a.value.offsetWidth||350,_=typeof u.value=="number"?u.value:a.value.offsetHeight||600;l.value+T>S&&(l.value=Math.max(0,S-T-20)),c.value+_>w&&(c.value=Math.max(0,w-_-20)),l.value<0&&(l.value=0),c.value<0&&(c.value=0)}})},A=d.ref(!1),v=E=>{if(E.target.closest(".close-btn")||E.target.closest(".actions"))return;A.value=!0,E.preventDefault(),E.stopPropagation();const S=E.clientX,w=E.clientY,T=l.value,_=c.value,F=L=>{if(!A.value)return;L.preventDefault();const D=L.clientX-S,M=L.clientY-w;l.value=T+D,c.value=_+M},U=()=>{A.value=!1,document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",U),g()};document.addEventListener("mousemove",F),document.addEventListener("mouseup",U)},b=()=>{d.nextTick(()=>{if(t.align&&a.value){const E=a.value.offsetParent||document.body,S=typeof h.value=="number"?h.value:a.value.offsetWidth||350;t.align==="right"?l.value=Math.max(0,E.clientWidth-S-20):t.align==="center"&&(l.value=Math.max(0,(E.clientWidth-S)/2))}g()})};d.onMounted(()=>{t.align?b():g()}),d.watch(r,E=>{E&&(t.align?b():g())});const C=()=>{r.value=!1,o("close")},x=E=>{if(E.target.closest(".close-btn")||E.target.closest(".actions")||E.touches.length!==1)return;A.value=!0,E.preventDefault(),E.stopPropagation();const S=E.touches[0],w=S?.clientX??0,T=S?.clientY??0,_=l.value,F=c.value,U=D=>{if(!A.value||D.touches.length!==1)return;D.preventDefault();const M=D.touches[0],k=(M?.clientX??0)-w,B=(M?.clientY??0)-T;l.value=_+k,c.value=F+B},L=()=>{A.value=!1,document.removeEventListener("touchmove",U),document.removeEventListener("touchend",L),g()};document.addEventListener("touchmove",U,{passive:!1}),document.addEventListener("touchend",L)},I=E=>{if(E.touches.length!==1)return;f.value=!0,E.preventDefault(),E.stopPropagation();const S=E.touches[0],w=S?.clientX??0,T=S?.clientY??0,_=typeof h.value=="number"?h.value:a.value?.offsetWidth||0,F=typeof u.value=="number"?u.value:a.value?.offsetHeight||0,U=D=>{if(!f.value||D.touches.length!==1)return;D.preventDefault();const M=D.touches[0],k=(M?.clientX??0)-w,B=(M?.clientY??0)-T,P=_+k,V=F+B;P>100&&(h.value=P),V>100&&(u.value=V)},L=()=>{f.value=!1,document.removeEventListener("touchmove",U),document.removeEventListener("touchend",L)};document.addEventListener("touchmove",U,{passive:!1}),document.addEventListener("touchend",L)};return(E,S)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{ref_key:"cardRef",ref:a,class:d.normalizeClass(["draggable-card leiting-scroll",["leiting-theme-"+d.unref(n)]]),style:d.normalizeStyle(y.value)},[d.createElementVNode("div",{ref:"headerRef",class:"card-header",onMousedown:v,onTouchstart:x},[d.createElementVNode("span",PB,d.toDisplayString(i.title),1),d.createElementVNode("div",DB,[d.renderSlot(E.$slots,"header-extra",{},void 0,!0),d.createElementVNode("span",{class:"close-btn",onClick:C},"×")])],544),d.createElementVNode("div",NB,[d.renderSlot(E.$slots,"default",{},void 0,!0)]),d.unref(s)?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,class:"resize-handle",onMousedown:m,onTouchstart:I},[...S[0]||(S[0]=[d.createElementVNode("svg",{viewBox:"0 0 10 10",width:"10",height:"10",fill:"currentColor"},[d.createElementVNode("path",{d:"M10 10 L10 2 L2 10 Z"})],-1)])],32))],6)),[[d.vShow,r.value]])}}),Be=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},gt=Be(LB,[["__scopeId","data-v-b158afe1"]]);function vm(i){const e=d.ref([]),t=d.ref([]),n=d.ref([]),s=d.ref(""),o=d.ref(!0);d.watch(()=>d.unref(i),u=>{if(!u||u.length===0)return;const p=[],f=(g,A)=>{g.forEach(v=>{const b=v.id||v.key||v.$id,C=v.modelId||A;C&&(v.modelId=C),b&&p.push(b),v.children&&v.children.length>0&&f(v.children,C)})};f(u);const m=new Set(n.value);let y=!1;p.forEach(g=>{m.has(g)||(m.add(g),y=!0)}),y&&(n.value=Array.from(m))},{immediate:!0,deep:!0});const r=d.computed(()=>{const u=d.unref(i);if(!u)return[];const p=[],f=(m,y)=>{m.forEach(g=>{const A=g.id||g.key||g.$id,v=g.name||g.title;p.push({key:A,title:v,parentKey:y}),g.children&&g.children.length>0&&f(g.children,A)})};return f(u),p}),a=u=>{e.value=u,o.value=!1},l=u=>{n.value=u},c=u=>{t.value=u},h=u=>r.value.find(f=>f.key===u)?.parentKey;return d.watch(s,u=>{if(!u)return;const f=r.value.filter(y=>y.title&&y.title.toLowerCase().includes(u.toLowerCase())).map(y=>y.parentKey),m=new Set;f.forEach(y=>{let g=y;for(;g;)m.add(g),g=h(g)}),e.value=[...m],o.value=!0}),{expandedKeys:e,selectedKeys:t,checkedKeys:n,searchValue:s,autoExpandParent:o,onExpand:a,onCheck:l,onSelect:c}}const RB={class:"search-box"},FB={key:0},OB={style:{color:"#f50"}},GB={key:1},UB={key:1,class:"empty-tip"},Gr=Be(d.defineComponent({__name:"LeitingTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"构件树"},width:{type:[Number,String],default:320},treeData:{type:Array,default:()=>[]},initialPosition:{type:Object,default:()=>({x:0,y:0})},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close","select","check"],setup(i,{emit:e}){const t=re.Input.Search,n=re.Tree,s=i,o=e,r=d.inject("leiting-theme",d.ref("dark")),a=d.inject("leitingMethods"),l=T=>{a?.value?.onSearchComponent&&a.value.onSearchComponent(T)},c=d.computed({get:()=>s.open!==void 0?s.open:s.visible,set:T=>{o("update:visible",T),o("update:open",T)}}),h=d.ref(null),{height:u}=kB(h),p=d.computed(()=>u.value||300),f=d.ref({children:"children",title:"name",key:"id"}),m=d.ref([]),{expandedKeys:y,selectedKeys:g,checkedKeys:A,searchValue:v,autoExpandParent:b}=vm(d.toRef(s,"treeData")),C=(T,_)=>{if(!_)return T;const F=_.toLowerCase();return T.reduce((U,L)=>{const M=(L.name||L.title||"").toLowerCase().includes(F);if(L.children&&L.children.length>0){const k=C(L.children,_);(k.length>0||M)&&U.push({...L,children:k})}else M&&U.push({...L});return U},[])};d.watch([()=>s.treeData,v],([T,_])=>{T?m.value=C(T,_||""):m.value=[]},{immediate:!0,deep:!0});const x=T=>{y.value=T,b.value=!1},I=T=>{const _=[],F=U=>{if(!U.children||U.children.length===0){const D=U.element_Id;U.modelId&&D&&_.push({modelId:U.modelId,elementId:D})}else U.children.forEach(F)};return F(T),_},E=(T,_)=>{A.value=T,o("check",T,_);const F=[],U=new Set(T.map(D=>String(D))),L=D=>{for(let M=0;M<D.length;M++){const k=D[M];if(!k.children||k.children.length===0){if(!U.has(String(k.id))){const V=k.element_Id;k.modelId&&V&&F.push({modelId:k.modelId,elementId:V,show:!1})}}else k.children&&L(k.children)}};s.treeData&&L(s.treeData),a?.value?.setComponentVisibility&&a.value.setComponentVisibility(F),a?.value?.onTreeCheck&&a.value.onTreeCheck(T,_)},S=(T,_)=>{if(g.value=T,o("select",T,_),_.selected){const F=I(_.node);F.length>0&&a?.value?.flyToObjects&&a.value.flyToObjects({selectCpts:F})}a?.value?.onTreeSelect&&a.value.onTreeSelect(T,_)},w=()=>{o("update:visible",!1),o("close")};return(T,_)=>(d.openBlock(),d.createBlock(gt,{visible:c.value,"onUpdate:visible":_[1]||(_[1]=F=>c.value=F),title:i.title,"initial-position":i.initialPosition,"full-height":i.fullHeight,onClose:w},{default:d.withCtx(()=>[d.createElementVNode("div",{class:d.normalizeClass(["leiting-tree-container",[`theme-${d.unref(r)}`]])},[d.createElementVNode("div",RB,[d.createVNode(d.unref(t),{value:d.unref(v),"onUpdate:value":_[0]||(_[0]=F=>d.isRef(v)?v.value=F:null),placeholder:"搜索构件","allow-clear":"","enter-button":"",onSearch:l},null,8,["value"])]),d.createElementVNode("div",{class:"tree-wrapper",ref_key:"treeWrapperRef",ref:h},[m.value&&m.value.length?(d.openBlock(),d.createBlock(d.unref(n),{key:0,"tree-data":m.value,"field-names":f.value,height:p.value,"expanded-keys":d.unref(y),"auto-expand-parent":d.unref(b),"selected-keys":d.unref(g),"checked-keys":d.unref(A),checkable:"","block-node":"",onExpand:x,onSelect:S,onCheck:E},{title:d.withCtx(({name:F,title:U})=>[(F||U)&&d.unref(v)&&(F||U).toLowerCase().indexOf(d.unref(v).toLowerCase())>-1?(d.openBlock(),d.createElementBlock("span",FB,[d.createTextVNode(d.toDisplayString((F||U).substr(0,(F||U).toLowerCase().indexOf(d.unref(v).toLowerCase())))+" ",1),d.createElementVNode("span",OB,d.toDisplayString(d.unref(v)),1),d.createTextVNode(" "+d.toDisplayString((F||U).substr((F||U).toLowerCase().indexOf(d.unref(v).toLowerCase())+d.unref(v).length)),1)])):(d.openBlock(),d.createElementBlock("span",GB,d.toDisplayString(F||U),1))]),_:1},8,["tree-data","field-names","height","expanded-keys","auto-expand-parent","selected-keys","checked-keys"])):(d.openBlock(),d.createElementBlock("div",UB,"暂无数据"))],512)],2)]),_:1},8,["visible","title","initial-position","full-height"]))}}),[["__scopeId","data-v-3748c20d"]]),VB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",Ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAERSURBVDhPvZTrEYIwEISTCrQD6EA7gA60AylBK1Aq0A7ECrQDoQPsADrACuLuTMJkIiHxjzezgyR7H3d5KJVSqRAigcaQUjYYX2JgZY/P/O4lEgYYFo7pgPcc2kSCBoIUzDeo0klPPEsNYlX7AKzA/M6ASrRzYoIGG5DAOCvzBvzMOxqQazSgLLI1QdAW5jWpUAPV0AVKIc7FRCuNy7RkWozJtj1BED7ANbpDXHhffFXUwUnZwRYp7qw7Rx8/lLkV9R4QD2w1A8pjW3sA4h5au+pXEBS76P8D6Ut9/nXXaiRQdnBXqBfEC+4GdzSxW5v6F7CTeHnbCVCBsWIE+RYVrdF4DSz6OwgiADDexbmT3X0A4fSDfDjUugcAAAAASUVORK5CYII=",QB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",zB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAHDSURBVDhPlZOxL0NRFIe9ECubhehoIIjJ1HYwCkIiJpUQEkN1YZBobU0kFKNI3iTGYrDRv0BIhLXCYpCwiO35fs25zWva98JNvpz37j33d8+551yvLWIEQXDG0izMe55XjvJz816MUJG1LVuvYJcQrEb5xwkV2JSHGfAhgBJiu63E4oSUzpRtusa+wBooKkWnKOujQYh7SbCShQx0m9cpds4iOseOw7BFmUPwU341IQT2MaOQgi9QND+wiqNnBxT4X7SIbrAqhNI9wiUvJ+W8A99wDEWdwrw25iVkkenAEb5LkIQPuIMJWJGQoriFd+iBCkhc8zUhfJSm7mva5l3aadubDgtpMgGKpB/eoBfuQZFoPNhBj9gTaC3kKkEEGXPswF7Y5rLro1AW8UI6GmelmAzfkUWlNaWt6/iT0DOOA5bqoSuzHfIvofATqSJQb8KoiJbtPi6x2dA9FPjXE1F/uZKrv3IwCFcNqVmoPlal7QJ9q/wZCbk7Ioo9/tehE9q1r0nIxNQbG4YEXdkVjQ5J2OZXbB88gVrgQIJNj9aaT4LboPK7J6O0Ktb1KYtc/aYxGff6h3AYY6Nvzk2GQ1WQTVj4BST70jYaqceXAAAAAElFTkSuQmCC",HB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",YB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",bm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEcSURBVDhPrZSNDYIwEIXpBOIGjMAIOIE4AbgBGwAbOIJu4Aa4gW4gI+gE9b3mjjSmibSR5ALX3H33W4y1Ns+yrIe0EH7HPC8YnyGjAegkEB5cYyiwrdWXIEc1xnSREGcuiTQEWeg7gG4+CMcl9ALnLkvogwScv+wq6FMQJJCJDgBtBcSAI3QClwe2YZAHcY2Ho4kGAVLA6U5/CEvdp4KYhesFhBPpCZIAz6jStHhproJcHyAHbb5nF+6RZ8CsGslIQaHp/gSxRzlApU4GugPxNuDN/eNarAJxapUPgm8rQ9C1SAI9AOGiHhGApSdnRN8FshbEiLwiLI1rMUM6zSQ0tX9c2lp/Iw0iMIPU38iFIN1mTmOjKa98vyWB4QM5XQnvsbFsyAAAAABJRU5ErkJggg==",$B="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",jB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",WB={class:"menu-container"},qB=["onClick","title"],KB={class:"menu-icon"},XB=["src","alt"],JB={key:3,style:{"font-size":"12px"}},ZB={key:0,class:"sub-menu"},e3=["onClick"],ao=d.defineComponent({__name:"LeitingMenu",props:{visible:{type:Boolean,default:!0},activeIds:{type:Array,default:()=>[]},is2d:{type:Boolean,default:!1},customItems:{type:Array,default:()=>[]}},emits:["action"],setup(i,{emit:e}){const t=i,n=d.inject("leiting-theme",d.ref("dark")),s=d.inject("leiting-menu-size",d.ref("medium")),o=d.inject("leitingMethods",d.ref({})),r=d.computed(()=>n.value||n),a=d.computed(()=>s.value||s),l=d.ref([{ID:"home",title:"主视角",src:VB,key:"homeView"},{ID:"tree",title:"目录树",src:Ur,key:"componentTree"},{ID:"cadLayer",title:"图层",src:Ur,key:"cadLayer"},{ID:"gisCadPosition",title:"GIS调整",src:bm,key:"gisCadPosition"},{ID:"measure",title:"量算",src:QB,key:"measurement"},{ID:"section",title:"剖切",src:zB,key:"section"},{ID:"roam",title:"人物漫游",src:HB,key:"roam"},{ID:"info",title:"构件信息",src:YB,key:"componentInfo"},{ID:"cadPosition",title:"调整位置",src:bm,key:"cadPosition"},{ID:"annotation",title:"标注",src:jB,key:"annotation"},{ID:"setting",title:"场景配置",src:$B,key:"setting"}]),c=d.ref([]),h=d.ref([...t.activeIds]);d.watch(()=>t.activeIds,C=>{h.value=[...C]},{deep:!0});const u=d.computed(()=>t.visible);o.value&&o.value.menuEvents&&(o.value.menuEvents.on("setMenuListFilter",C=>{c.value=C}),o.value.menuEvents.on("setMenuActive",(C,x)=>{x?h.value.includes(C)||h.value.push(C):h.value=h.value.filter(I=>I!==C)}));const p=d.computed(()=>{let C=l.value;if(t.is2d){const x=["homeView","measurement","cadLayer","gisCadPosition","annotation"];C=C.filter(I=>I.key&&x.includes(I.key))}else{const x=["cadLayer","cadPosition","gisCadPosition","annotation"];C=C.filter(I=>!I.key||!x.includes(I.key))}if(c.value.length>0&&(C=C.filter(x=>!x.key||!c.value.includes(x.key))),t.customItems&&t.customItems.length>0){const x=t.customItems.map(I=>({...I,key:I.ID,src:I.src||I.icon}));return[...C,...x]}return C}),f=e,m=C=>{const x=["homeView"];if(C.key&&x.includes(C.key))h.value.includes(C.ID)||(h.value.push(C.ID),setTimeout(()=>{const E=h.value.indexOf(C.ID);E>-1&&h.value.splice(E,1)},1e3));else{const E=h.value.indexOf(C.ID);E>-1?h.value.splice(E,1):h.value.push(C.ID)}const I=h.value.includes(C.ID);C.func&&C.func(C),C.key&&f("action",C.key,I)},y=C=>{c.value=C},g=C=>{},A=(C,x)=>{const I=p.value.find(E=>E.ID===C||E.key===C);if(I){const E=h.value.indexOf(I.ID);x&&E===-1?h.value.push(I.ID):!x&&E>-1&&h.value.splice(E,1)}};let v=null;const b=()=>{o.value?.menuEvents&&(v&&(v.off("setMenuListFilter",y),v.off("showMenu",g),v.off("setMenuActive",A)),v=o.value.menuEvents,v.on("setMenuListFilter",y),v.on("showMenu",g),v.on("setMenuActive",A))};return d.onMounted(()=>{b()}),d.onUnmounted(()=>{v&&(v.off("setMenuListFilter",y),v.off("showMenu",g),v.off("setMenuActive",A))}),d.watch(o,()=>{b()},{deep:!0}),(C,x)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-menu-wrapper",["leiting-theme-"+r.value,"size-"+a.value]])},[d.createElementVNode("div",WB,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p.value,I=>(d.openBlock(),d.createElementBlock("div",{key:I.ID,class:d.normalizeClass(["menu-item",{active:h.value.includes(I.ID)}]),onClick:E=>m(I),title:I.title},[d.createElementVNode("div",KB,[I.src?(d.openBlock(),d.createElementBlock("img",{key:0,src:I.src,alt:I.title},null,8,XB)):typeof I.icon=="object"?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(I.icon),{key:1})):typeof I.icon=="string"?(d.openBlock(),d.createElementBlock("i",{key:2,class:d.normalizeClass(["iconfont",`icon-${I.icon}`])},null,2)):(d.openBlock(),d.createElementBlock("span",JB,d.toDisplayString(I.title.substring(0,2)),1))]),I.children&&I.children.length>0?(d.openBlock(),d.createElementBlock("div",ZB,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(I.children,E=>(d.openBlock(),d.createElementBlock("div",{key:E.ID,class:d.normalizeClass(["sub-menu-item",{active:h.value.includes(E.ID)}]),onClick:d.withModifiers(S=>m(E),["stop"])},d.toDisplayString(E.title),11,e3))),128))])):d.createCommentVNode("",!0)],10,qB))),128))])],2)),[[d.vShow,u.value]])}}),t3={class:"leiting-section-content"},i3={class:"section-form-item"},n3={class:"radio-group"},s3={class:"section-form-item"},o3={class:"switch-container"},r3={class:"switch"},a3={class:"status-text"},l3={class:"section-form-item slider-item"},c3={class:"slider-wrapper"},d3={class:"section-form-item slider-item"},h3={class:"slider-wrapper"},u3={class:"section-form-item slider-item"},f3={class:"slider-wrapper"},p3={class:"section-form-item table-item"},m3={class:"model-table-container"},g3={class:"model-table"},y3={width:"40"},A3=["checked"],v3=["onClick"],b3=["value"],w3={class:"model-name"},lo=Be(d.defineComponent({__name:"LeitingSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"剖切控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:L=>{n("update:visible",L),n("update:open",L)}}),r=d.ref("Box"),a=d.ref(!1),l=d.ref([]),c=d.ref([]),h=d.computed(()=>c.value.length===0?!1:c.value.every(L=>l.value.includes(L.modelId))),u=L=>{L.target.checked?l.value=c.value.map(M=>M.modelId):l.value=[],w()},p=d.ref([-10,10]),f=d.ref([-10,10]),m=d.ref([-10,10]),y=d.ref([-100,100]),g=d.ref([-100,100]),A=d.ref([-100,100]);let v=!1;const b=L=>{v=!0;const{targetZPlus:D,targetZMinus:M,targetXPlus:k,targetXMinus:B,targetYPlus:P,targetYMinus:V}=L;m.value=[-M,D],p.value=[-B,k],f.value=[-V,P],setTimeout(()=>{v=!1},100)},C=()=>{v||l.value.length===0||!s?.value?.updateSectionRange||s.value.updateSectionRange({targetZPlus:m.value[1],targetZMinus:-m.value[0],targetXPlus:p.value[1],targetXMinus:-p.value[0],targetYPlus:f.value[1],targetYMinus:-f.value[0]})},x=()=>{s?.value?.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(a.value)},I=L=>{if(!s?.value?.getMapTileset||!s?.value?.openSection)return;const M=s.value.getMapTileset()[L];if(M&&M.leiting?.box){const{min:k,max:B}=M.leiting.box,P=(B.x-k.x)/2,V=(B.y-k.y)/2,G=(B.z-k.z)/2;l.value.length<=1&&(y.value=[-P*2,P*2],g.value=[-V*2,V*2],A.value=[-G*2,G*2],p.value=[-P,P],f.value=[-V,V],m.value=[-G,G],s.value.updateSectionRange&&s.value.updateSectionRange({targetZPlus:G,targetZMinus:G,targetXPlus:P,targetXMinus:P,targetYPlus:V,targetYMinus:V})),s.value.openSection(L,{moveCallBack:b}),s.value.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(a.value)}},E=L=>{const D=l.value.indexOf(L);D>-1?l.value.splice(D,1):l.value.push(L),w()};let S=[];const w=()=>{const L=l.value.filter(M=>!S.includes(M)),D=S.filter(M=>!l.value.includes(M));L.forEach(M=>I(M)),D.forEach(M=>{s?.value?.closeSection&&s.value.closeSection(M)}),S=[...l.value]},T=()=>{},_=()=>{o.value=!1,n("close")},F=()=>{a.value=!1,l.value=[],S=[],p.value=[-10,10],f.value=[-10,10],m.value=[-10,10],y.value=[-100,100],g.value=[-100,100],A.value=[-100,100]};d.watch(()=>t.visible,L=>{L?U():(s?.value?.closeSection&&s.value.closeSection(),F())});const U=()=>{s?.value&&typeof s.value.getModelList=="function"&&(c.value=s.value.getModelList()||[],c.value.length>0&&l.value.length===0&&(l.value=[c.value[0].modelId],S=[...l.value]),t.visible&&l.value.length>0&&(a.value=!0,l.value.forEach(L=>I(L))))};return d.watch(()=>s?.value,()=>{U()},{immediate:!0,deep:!0}),d.onMounted(()=>{U()}),(L,D)=>(d.openBlock(),d.createBlock(gt,{visible:o.value,title:"剖切分析","full-height":i.fullHeight,"onUpdate:visible":_},{default:d.withCtx(()=>[d.createElementVNode("div",t3,[d.createElementVNode("div",i3,[D[8]||(D[8]=d.createElementVNode("span",{class:"label"},"模式",-1)),d.createElementVNode("div",n3,[d.createElementVNode("label",{class:d.normalizeClass(["radio-item",{active:r.value==="Box"}])},[d.withDirectives(d.createElementVNode("input",{type:"radio",value:"Box","onUpdate:modelValue":D[0]||(D[0]=M=>r.value=M),onChange:T},null,544),[[d.vModelRadio,r.value]]),D[7]||(D[7]=d.createTextVNode(" 剖切盒 ",-1))],2)])]),d.createElementVNode("div",s3,[D[10]||(D[10]=d.createElementVNode("span",{class:"label"},"显示",-1)),d.createElementVNode("div",o3,[d.createElementVNode("label",r3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":D[1]||(D[1]=M=>a.value=M),onChange:x},null,544),[[d.vModelCheckbox,a.value]]),D[9]||(D[9]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",a3,d.toDisplayString(a.value?"显示":"隐藏"),1)])]),d.createElementVNode("div",l3,[D[11]||(D[11]=d.createElementVNode("span",{class:"label"},"X 轴",-1)),d.createElementVNode("div",c3,[d.createVNode(d.unref(re.Slider),{value:p.value,"onUpdate:value":D[2]||(D[2]=M=>p.value=M),range:"",min:y.value[0],max:y.value[1],step:.1,onChange:C},null,8,["value","min","max"])])]),d.createElementVNode("div",d3,[D[12]||(D[12]=d.createElementVNode("span",{class:"label"},"Y 轴",-1)),d.createElementVNode("div",h3,[d.createVNode(d.unref(re.Slider),{value:f.value,"onUpdate:value":D[3]||(D[3]=M=>f.value=M),range:"",min:g.value[0],max:g.value[1],step:.1,onChange:C},null,8,["value","min","max"])])]),d.createElementVNode("div",u3,[D[13]||(D[13]=d.createElementVNode("span",{class:"label"},"Z 轴",-1)),d.createElementVNode("div",f3,[d.createVNode(d.unref(re.Slider),{value:m.value,"onUpdate:value":D[4]||(D[4]=M=>m.value=M),range:"",min:A.value[0],max:A.value[1],step:.1,onChange:C},null,8,["value","min","max"])])]),d.createElementVNode("div",p3,[D[15]||(D[15]=d.createElementVNode("span",{class:"label"},"模型",-1)),d.createElementVNode("div",m3,[d.createElementVNode("table",g3,[d.createElementVNode("thead",null,[d.createElementVNode("tr",null,[d.createElementVNode("th",y3,[d.createElementVNode("input",{type:"checkbox",checked:h.value,onChange:u},null,40,A3)]),D[14]||(D[14]=d.createElementVNode("th",null,"名称",-1))])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,M=>(d.openBlock(),d.createElementBlock("tr",{key:M.modelId,class:d.normalizeClass({selected:l.value.includes(M.modelId)}),onClick:k=>E(M.modelId)},[d.createElementVNode("td",null,[d.withDirectives(d.createElementVNode("input",{type:"checkbox",value:M.modelId,"onUpdate:modelValue":D[5]||(D[5]=k=>l.value=k),onClick:D[6]||(D[6]=d.withModifiers(()=>{},["stop"])),onChange:w},null,40,b3),[[d.vModelCheckbox,l.value]])]),d.createElementVNode("td",w3,d.toDisplayString(M.modelName),1)],10,v3))),128))])])])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-ee4d9a12"]]),C3={class:"leiting-player-content"},E3={class:"player-form-item"},x3={class:"switch-container"},I3={class:"switch"},S3={class:"status-text"},M3={class:"player-form-item"},T3={class:"switch-container"},B3={class:"switch"},_3={class:"status-text"},k3={class:"player-form-item"},P3={class:"switch-container"},D3={class:"switch"},N3={class:"status-text"},L3={class:"player-form-item slider-item"},R3={class:"slider-wrapper"},F3={class:"value-text"},O3={class:"instructions"},G3={class:"key-map"},U3={class:"key-row"},V3={class:"key-row"},Q3={class:"key-row"},z3={class:"key-row"},H3={class:"key-row"},Y3={class:"key-row"},co=Be(d.defineComponent({__name:"LeitingPlayer",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},title:{type:String,default:"漫游控制"},fullHeight:{type:Boolean,default:!1}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(!1),r=d.ref(!1),a=d.ref(!0),l=d.ref(5),c=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:I=>{n("update:visible",I),n("update:open",I)}}),h=d.ref(null),u=d.ref(null),p=d.ref(null),f=d.ref(null),m=d.ref(null),y=d.ref(null),g=()=>{o.value?v():b()},A=()=>{s?.value?.setPlayerParams&&s.value.setPlayerParams({gravityTest:r.value,collisionTest:a.value})},v=async()=>{s?.value?.openPlayer&&(await s.value.openPlayer(),s.value.setPlayerSpeed&&s.value.setPlayerSpeed(l.value),A(),s.value.bindPlayerUiKeys&&(await d.nextTick(),s.value.bindPlayerUiKeys({moveFront:h.value,moveBack:u.value,moveLeft:p.value,moveRight:f.value,moveUp:m.value,moveDown:y.value})))},b=()=>{s?.value?.closePlayer&&s.value.closePlayer()},C=()=>{s?.value?.setPlayerSpeed&&s.value.setPlayerSpeed(l.value)},x=()=>{c.value=!1,n("close")};return d.watch(()=>t.visible,I=>{I?(o.value=!0,s?.value?v():setTimeout(()=>{s?.value&&v()},100)):o.value&&(o.value=!1,b())},{immediate:!0}),(I,E)=>(d.openBlock(),d.createBlock(gt,{title:i.title,visible:c.value,"full-height":i.fullHeight,"onUpdate:visible":x},{default:d.withCtx(()=>[d.createElementVNode("div",C3,[d.createElementVNode("div",E3,[E[5]||(E[5]=d.createElementVNode("span",{class:"label"},"启用",-1)),d.createElementVNode("div",x3,[d.createElementVNode("label",I3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":E[0]||(E[0]=S=>o.value=S),onChange:g},null,544),[[d.vModelCheckbox,o.value]]),E[4]||(E[4]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",S3,d.toDisplayString(o.value?"开启":"关闭"),1)])]),d.createElementVNode("div",M3,[E[7]||(E[7]=d.createElementVNode("span",{class:"label"},"重力",-1)),d.createElementVNode("div",T3,[d.createElementVNode("label",B3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":E[1]||(E[1]=S=>r.value=S),onChange:A},null,544),[[d.vModelCheckbox,r.value]]),E[6]||(E[6]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",_3,d.toDisplayString(r.value?"开启":"关闭"),1)])]),d.createElementVNode("div",k3,[E[9]||(E[9]=d.createElementVNode("span",{class:"label"},"碰撞",-1)),d.createElementVNode("div",P3,[d.createElementVNode("label",D3,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":E[2]||(E[2]=S=>a.value=S),onChange:A},null,544),[[d.vModelCheckbox,a.value]]),E[8]||(E[8]=d.createElementVNode("span",{class:"slider round"},null,-1))]),d.createElementVNode("span",N3,d.toDisplayString(a.value?"开启":"关闭"),1)])]),d.createElementVNode("div",L3,[E[10]||(E[10]=d.createElementVNode("span",{class:"label"},"速度",-1)),d.createElementVNode("div",R3,[d.createVNode(d.unref(re.Slider),{value:l.value,"onUpdate:value":E[3]||(E[3]=S=>l.value=S),min:1,max:10,step:1,onChange:C},null,8,["value"])]),d.createElementVNode("span",F3,d.toDisplayString(l.value),1)]),E[19]||(E[19]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",O3,[E[18]||(E[18]=d.createElementVNode("div",{class:"instruction-title"},"操作说明",-1)),d.createElementVNode("div",G3,[d.createElementVNode("div",U3,[d.createElementVNode("span",{class:"key",ref_key:"btnFront",ref:h},"W",512),E[11]||(E[11]=d.createTextVNode(" 前进 ",-1))]),d.createElementVNode("div",V3,[d.createElementVNode("span",{class:"key",ref_key:"btnBack",ref:u},"S",512),E[12]||(E[12]=d.createTextVNode(" 后退 ",-1))]),d.createElementVNode("div",Q3,[d.createElementVNode("span",{class:"key",ref_key:"btnLeft",ref:p},"A",512),E[13]||(E[13]=d.createTextVNode(" 左移 ",-1))]),d.createElementVNode("div",z3,[d.createElementVNode("span",{class:"key",ref_key:"btnRight",ref:f},"D",512),E[14]||(E[14]=d.createTextVNode(" 右移 ",-1))]),d.createElementVNode("div",H3,[d.createElementVNode("span",{class:"key",ref_key:"btnUp",ref:m},"Q",512),E[15]||(E[15]=d.createTextVNode(" 上升 ",-1))]),d.createElementVNode("div",Y3,[d.createElementVNode("span",{class:"key",ref_key:"btnDown",ref:y},"E",512),E[16]||(E[16]=d.createTextVNode(" 下降 ",-1))]),E[17]||(E[17]=d.createElementVNode("div",{class:"key-row"},[d.createElementVNode("span",{class:"mouse-icon"},"🖱️"),d.createTextVNode(" 按住左键拖拽旋转视角 ")],-1))])])])]),_:1},8,["title","visible","full-height"]))}}),[["__scopeId","data-v-ff3f266e"]]),$3={class:"info-content"},j3={key:0,class:"component-title"},ho=Be(d.defineComponent({__name:"LeitingInfo",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),a=d.ref([]),l=d.ref([]),c=d.ref(0),h=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:A=>{n("update:visible",A),n("update:open",A)}}),u=()=>{h.value=!1},p=A=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[A]||A,f=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],m=async A=>{const v=++c.value;if(l.value=A,!A||A.length===0){o.value=[];return}if(!h.value)return;let b=A;A.length>10&&(me.warning(`选中构件数量过多(${A.length}个),仅显示前10个`),b=A.slice(0,10));const C=s?.value;let x=C?.getMapTileset?C.getMapTileset():{};r.value=!0;const I=[],E={};b.forEach(T=>{const F=x[T.modelId]?.leiting?.model?.dbName;F&&T.elementId&&I.push({dbName:F,elementId:T.elementId,modelId:T.modelId})});const S=new Set;if(b.forEach(T=>{const _=x[T.modelId],F=`${T.modelId}_${T.elementId}`;E[F]||_&&_.leiting&&!_.leiting?.node?.nodeExtras&&_.leiting.model?.nodeUrl&&S.add(T.modelId)}),S.size>0&&C?._loadNodeDetailsForModel)try{const T=Array.from(S).map(_=>C._loadNodeDetailsForModel(_));await Promise.all(T)}catch(T){console.error("Failed to load node details",T)}if(v!==c.value)return;x=C?.getMapTileset?C.getMapTileset():{};const w=[];b.forEach((T,_)=>{const U=x[T.modelId]?.leiting||{},L=E[`${T.modelId}_${T.elementId}`];let D={modelName:U.model?.modelId||T.modelId};D.elementID||(D.elementID=T.elementId);let M=null;if(L)M=L;else{const P=U.node?.nodeExtras?.element||U.node?.nodeExtras;if(P){const V=D.elementID;P[V]&&(M=P[V])}}M&&M.box3&&(D.length=`${M.box3.length?.toFixed(2)||0}米`,D.width=`${M.box3.width?.toFixed(2)||0}米`,D.height=`${M.box3.height?.toFixed(2)||0}米`);const k=[];M&&(M.name&&(D.elementName=M.name),M.categoryName&&(D.categoryName=M.categoryName),M.familySymbolName&&(D.familySymbolName=M.familySymbolName),M.levelName&&(D.levelName=M.levelName));const B={};if(f.forEach(P=>{D[P]!==void 0&&(B[P]=D[P])}),k.push({name:"基础信息",params:B}),M){const P=Array.isArray(M)?M:Array.isArray(M?.parameters)?M.parameters:null;if(P){if(P.flat().forEach(G=>{if(G&&G.GroupName&&Array.isArray(G.Parameters)){const R={};G.Parameters.forEach(N=>{N.name&&(R[N.name]=N.value??"")}),Object.keys(R).length>0&&k.push({name:G.GroupName,params:R})}}),!Array.isArray(M)){const{parameters:G,...R}=M,N={};Object.keys(R).forEach(O=>{!f.includes(O)&&O!=="uniqueId"&&typeof R[O]!="object"&&(N[O]=R[O])}),Object.keys(N).length>0&&k.push({name:"其他属性",params:N})}}else{let V=!1;if(Object.keys(M).forEach(G=>{M[G]&&typeof M[G]=="object"&&!Array.isArray(M[G])&&(V=!0,k.push({name:G,params:M[G]}))}),!V){const G={};Object.keys(M).forEach(R=>{if(!f.includes(R)&&R!=="batchId"){const N=M[R];typeof N=="string"&&N.length>500?G[R]=N.substring(0,500)+"...":G[R]=N}}),Object.keys(G).length>0&&k.push({name:"属性",params:G})}}}w.push({id:_,title:`${D.modelName}${D.elementName?` - ${D.elementName}`:""}`,groups:k})}),o.value=w,v===c.value&&(r.value=!1),w.length>0?a.value=[`${w[0].id}-基础信息`]:a.value=[]};let y=!1;const g=()=>{if(y)return;const A=s?.value;A&&A.selectionChange&&(A.selectionChange(m),y=!0)};return d.watch(()=>s?.value,()=>{g()},{deep:!0,immediate:!0}),d.watch(h,A=>{A&&l.value.length>0&&m(l.value)}),d.onMounted(()=>{g()}),(A,v)=>(d.openBlock(),d.createBlock(gt,{visible:h.value,title:"构件详情",width:350,align:"right","initial-position":{x:0,y:0},"full-height":i.fullHeight,onClose:u,"onUpdate:visible":v[1]||(v[1]=b=>h.value=b),class:"base-info-card"},{default:d.withCtx(()=>[d.createElementVNode("div",$3,[d.createVNode(d.unref(re.Spin),{spinning:r.value},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,b=>(d.openBlock(),d.createElementBlock("div",{key:b.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",j3,d.toDisplayString(b.title),1)):d.createCommentVNode("",!0),d.createVNode(d.unref(re.Collapse),{activeKey:a.value,"onUpdate:activeKey":v[0]||(v[0]=C=>a.value=C),ghost:"","expand-icon-position":"end"},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(b.groups,C=>(d.openBlock(),d.createBlock(d.unref(re.CollapsePanel),{key:`${b.id}-${C.name}`,header:C.name},{default:d.withCtx(()=>[d.createVNode(d.unref(re.Descriptions),{size:"small",bordered:"",column:1,labelStyle:{width:"100px",background:"rgba(255,255,255,0.05)",color:"#aaa"},contentStyle:{color:"#fff"}},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(C.params,(x,I)=>(d.openBlock(),d.createBlock(d.unref(re.DescriptionsItem),{key:I,label:p(String(I))},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(x),1)]),_:2},1032,["label"]))),128))]),_:2},1024)]),_:2},1032,["header"]))),128))]),_:2},1032,["activeKey"])]))),128))]),_:1},8,["spinning"])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-375a1f55"]]);class vc{viewer;Cesium;pickHandler=null;bimEntityId="";mapEntityId="";constructor(e,t){this.viewer=e,this.Cesium=t}removeMarker(e){if(!this.viewer)return;const t=e==="BIM"?this.bimEntityId:this.mapEntityId;t&&(this.viewer.entities.removeById(t),e==="BIM"?this.bimEntityId="":this.mapEntityId="")}clearMarkers(){this.removeMarker("BIM"),this.removeMarker("MAP")}addMarker(e,t){if(!this.viewer||!this.Cesium)return;this.removeMarker(e);const n=`adjust-marker-${e}-${Date.now()}`;e==="BIM"?this.bimEntityId=n:this.mapEntityId=n,this.viewer.entities.add({id:n,position:this.Cesium.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),point:{pixelSize:10,color:e==="BIM"?this.Cesium.Color.RED:this.Cesium.Color.ORANGE,outlineColor:this.Cesium.Color.WHITE,outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:`${e==="BIM"?"BIM":"地图"}标记点`,font:"14pt sans-serif",style:this.Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:this.Cesium.VerticalOrigin.BOTTOM,pixelOffset:new this.Cesium.Cartesian2(0,-10),fillColor:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLACK,backgroundColor:new this.Cesium.Color(.1,.1,.1,.8),showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}})}registerPickHandler(e){this.destroyPickHandler(),!(!this.Cesium||!this.viewer)&&(this.pickHandler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.pickHandler.setInputAction(t=>{let n;try{n=this.viewer.scene.pickPosition(t.position)}catch(s){console.warn("pickPosition failed:",s)}if(!n){const s=this.viewer.camera.getPickRay(t.position);n=this.viewer.scene.globe.pick(s,this.viewer.scene)}if(n||(n=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid)),n){const s=this.Cesium.Cartographic.fromCartesian(n),o=this.Cesium.Math.toDegrees(s.longitude),r=this.Cesium.Math.toDegrees(s.latitude),a=s.height;e({longitude:o,latitude:r,height:a})}},this.Cesium.ScreenSpaceEventType.LEFT_CLICK,this.Cesium.KeyboardEventModifier.SHIFT))}destroyPickHandler(){this.pickHandler&&(this.pickHandler.destroy(),this.pickHandler=null)}calculateOffset(e,t){return{dLon:t.longitude-e.longitude,dLat:t.latitude-e.latitude,dHeight:t.height-e.height}}}const W3={class:"leitingbim-model-adjust-panel"},q3={class:"leitingbim-control-panel"},K3={class:"form-item"},X3={class:"radio-group"},J3={class:"form-item"},Z3={class:"radio-group"},e_={class:"form-item"},t_={class:"value"},i_={class:"param-row"},n_={class:"param-row"},s_={class:"param-row"},o_={class:"param-row"},r_={class:"param-row"},a_={class:"param-row"},l_={class:"param-row"},c_={class:"button-grid"},d_={key:1,class:"pick-mode-ui"},h_={class:"form-item",style:{display:"block","margin-bottom":"15px"}},u_={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},f_=["checked"],p_={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},m_={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},g_={class:"form-item",style:{display:"block","margin-bottom":"15px"}},y_={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},A_=["checked"],v_={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},b_={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},w_={class:"list-panel"},C_={class:"list-header"},E_={class:"col-check"},x_=["checked"],I_={class:"list-body"},S_={class:"col-check"},M_=["onUpdate:modelValue"],T_={class:"col-index"},B_=["title"],__={class:"col-main"},k_=["checked","onChange"],uo=Be(d.defineComponent({__name:"LeitingPosition",props:{visible:{type:Boolean},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean}},emits:["update:visible","update:open","close","save"],setup(i,{expose:e,emit:t}){const n=i,s=t,o=d.computed({get:()=>n.open!==void 0?n.open:n.visible,set:G=>{s("update:visible",G),s("update:open",G)}}),r=d.inject("leitingMethods"),a=d.ref("BIM"),l=d.ref("param"),c=d.ref(!1),h=d.ref(""),u=d.ref([]),p=d.ref("BIM"),f=d.ref(null),m=d.ref(null),y=d.ref(null),g=()=>(!y.value&&r?.value?.getViewer&&r?.value?.getCesium&&(y.value=new vc(r.value.getViewer(),r.value.getCesium())),y.value),A=()=>{g()?.clearMarkers(),f.value=null,m.value=null},v=(G,R)=>{G==="BIM"?f.value=R:m.value=R,g()?.addMarker(G,R),me.success(`${G==="BIM"?"BIM":"地图"}标记点已添加`)},b=()=>{g()?.registerPickHandler(G=>{v(p.value,G)})},C=()=>{g()?.destroyPickHandler()},x=()=>{if(!f.value||!m.value){me.warning("请先选择BIM标记点和地图标记点");return}if(!h.value){me.warning("请先选择主模型");return}const G=g();let R=0,N=0,O=0;if(G){const{dLon:z,dLat:j,dHeight:Z}=G.calculateOffset(f.value,m.value);R=z,N=j,O=Z}else R=m.value.longitude-f.value.longitude,N=m.value.latitude-f.value.latitude,O=m.value.height-f.value.height;E.value.longitude+=R,E.value.latitude+=N,E.value.height+=O,M(h.value,{longitude:E.value.longitude,latitude:E.value.latitude,height:E.value.height}),me.success("位置已调整")};d.watch(()=>l.value,G=>{G==="pick"?b():C()}),e({addMarker:v,setModelType:G=>{(G==="BIM"||G==="OSGB")&&(a.value=G)}});const E=d.ref({longitude:0,latitude:0,lonlat:1e-6,heightDistance:1,rotation:30,totalRotation:0,height:0,X:0,Y:0,Z:0}),S=d.computed(()=>{const G=u.value.find(R=>R.modelId===h.value);return G?G.modelName:""}),w=d.computed(()=>_.value.length>0&&_.value.every(G=>G.selected)),T=()=>{o.value=!1,s("close")},_=d.computed(()=>u.value.filter(G=>G.type===a.value)),F=G=>{const R=G.target.checked;_.value.forEach(N=>N.selected=R)},U=()=>{if(!r?.value)return;const G=r.value,R=G.getMapTileset?G.getMapTileset():{},N=[];if(Object.keys(R).forEach(O=>{const j=R[O].leiting||{};j.model&&N.push({modelId:j.model.modelId,modelName:j.model.modelName,selected:!1,formData:j.model.formData||{},dbName:j.model.dbName,url:j.model.url,type:j.model.type||"BIM"})}),u.value=N,N.length>0){const O=G.getBIMmodelId?G.getBIMmodelId():"";O&&N.find(z=>z.modelId===O)?L(O):L(N[0].modelId),N.forEach(z=>z.selected=!0)}},L=G=>{h.value=G;const R=u.value.find(N=>N.modelId===G);R&&R.formData&&Object.keys(E.value).forEach(N=>{R.formData[N]!==void 0&&(E.value[N]=R.formData[N])})},D=G=>r?.value?.getMapTileset?r.value.getMapTileset()[G]:null,M=(G,R)=>{const N=D(G),O=r.value.getCesium();if(N&&O){if(N.leiting?.model){N.leiting.model.formData={...N.leiting.model.formData,...R};const z=u.value.find(j=>j.modelId===G);z&&(z.formData=N.leiting.model.formData)}Ja({Cesium:O,tileset:N})}},k=G=>{if(!h.value)return;const N=u.value.find(j=>j.modelId===h.value)?.formData?.[G]??0,O=E.value[G],z=O-N;M(h.value,{[G]:O}),z!==0&&_.value.filter(Z=>Z.selected&&Z.modelId!==h.value).forEach(Z=>{const de=(Z.formData?.[G]??0)+z;M(Z.modelId,{[G]:de})})},B=G=>{const R=_.value.filter(j=>j.selected);if(R.length===0){me.warning("请先选择要调整的模型");return}const{lonlat:N,heightDistance:O,rotation:z}=E.value;R.forEach(j=>{const Z={...j.formData};switch(G){case"north":Z.latitude+=N;break;case"south":Z.latitude-=N;break;case"east":Z.longitude+=N;break;case"west":Z.longitude-=N;break;case"up":Z.height+=O;break;case"down":Z.height-=O;break;case"rotateLeft":Z.totalRotation=(Z.totalRotation||0)+z;break;case"rotateRight":Z.totalRotation=(Z.totalRotation||0)-z;break}j.modelId===h.value&&(Z.lonlat=N,Z.heightDistance=O,Z.rotation=z,Object.assign(E.value,Z)),M(j.modelId,Z)})},P=()=>{if(!h.value){me.warning("请先选择主模型");return}const G=D(h.value);if(!G||!r?.value?.getViewer)return;const R=r.value.getViewer(),N=r.value.getCesium(),O=G.boundingSphere;R.camera.flyToBoundingSphere(O,{offset:new N.HeadingPitchRange(0,N.Math.toRadians(-90),O.radius*2),duration:1.5})},V=()=>{r?.value?.saveRegion?(r.value.saveRegion(u.value),s("save",d.unref(u))):(u.value,me.warning("未找到保存接口,数据已打印控制台"))};return d.watch(()=>n.visible,G=>{G?(U(),l.value==="pick"&&b()):(C(),A())}),d.onMounted(()=>{n.visible&&(U(),l.value==="pick"&&b())}),(G,R)=>(d.openBlock(),d.createBlock(gt,{visible:o.value,title:"调整位置(调整前可选择正北俯视)","full-height":i.fullHeight,width:c.value?500:void 0,"onUpdate:visible":R[26]||(R[26]=N=>o.value=N),onClose:T,onSave:V,class:"base-position-card"},{default:d.withCtx(()=>[d.createElementVNode("div",W3,[d.createElementVNode("div",q3,[d.createElementVNode("div",K3,[R[27]||(R[27]=d.createElementVNode("label",null,"模型类型:",-1)),d.createElementVNode("div",X3,[d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="BIM"}),onClick:R[0]||(R[0]=N=>a.value="BIM")},"BIM模型",2),d.createElementVNode("span",{class:d.normalizeClass({active:a.value==="OSGB"}),onClick:R[1]||(R[1]=N=>a.value="OSGB")},"倾斜摄影",2)])]),d.createElementVNode("div",J3,[R[28]||(R[28]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",Z3,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="param"}),onClick:R[2]||(R[2]=N=>l.value="param")},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="pick"}),onClick:R[3]||(R[3]=N=>l.value="pick")},"地图点选",2)])]),d.createElementVNode("div",e_,[R[29]||(R[29]=d.createElementVNode("label",null,"主模型:",-1)),d.createElementVNode("span",t_,d.toDisplayString(S.value||"未选择"),1),d.createElementVNode("button",{class:"toggle-list-btn",onClick:R[4]||(R[4]=N=>c.value=!c.value)},d.toDisplayString(c.value?"收起":"查看详情"),1)]),R[43]||(R[43]=d.createElementVNode("div",{class:"separator"},null,-1)),l.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[R[37]||(R[37]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",i_,[R[30]||(R[30]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":R[5]||(R[5]=N=>E.value.longitude=N),onChange:R[6]||(R[6]=N=>k("longitude")),step:"0.000001"},null,544),[[d.vModelText,E.value.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",n_,[R[31]||(R[31]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":R[7]||(R[7]=N=>E.value.latitude=N),onChange:R[8]||(R[8]=N=>k("latitude")),step:"0.000001"},null,544),[[d.vModelText,E.value.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",s_,[R[32]||(R[32]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":R[9]||(R[9]=N=>E.value.height=N),onChange:R[10]||(R[10]=N=>k("height")),step:"0.1"},null,544),[[d.vModelText,E.value.height,void 0,{number:!0}]])]),d.createElementVNode("div",o_,[R[33]||(R[33]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":R[11]||(R[11]=N=>E.value.totalRotation=N),onChange:R[12]||(R[12]=N=>k("totalRotation")),step:"1"},null,544),[[d.vModelText,E.value.totalRotation,void 0,{number:!0}]])]),R[38]||(R[38]=d.createElementVNode("div",{class:"separator"},null,-1)),R[39]||(R[39]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",r_,[R[34]||(R[34]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":R[13]||(R[13]=N=>E.value.lonlat=N),step:"0.000001"},null,512),[[d.vModelText,E.value.lonlat,void 0,{number:!0}]])]),d.createElementVNode("div",a_,[R[35]||(R[35]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":R[14]||(R[14]=N=>E.value.heightDistance=N),step:"0.1"},null,512),[[d.vModelText,E.value.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",l_,[R[36]||(R[36]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":R[15]||(R[15]=N=>E.value.rotation=N),step:"1"},null,512),[[d.vModelText,E.value.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",c_,[d.createElementVNode("button",{onClick:R[16]||(R[16]=N=>B("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:R[17]||(R[17]=N=>B("north"))},"北移"),d.createElementVNode("button",{onClick:R[18]||(R[18]=N=>B("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:R[19]||(R[19]=N=>B("west"))},"西移"),d.createElementVNode("button",{onClick:R[20]||(R[20]=N=>B("south"))},"南移"),d.createElementVNode("button",{onClick:R[21]||(R[21]=N=>B("east"))},"东移"),d.createElementVNode("button",{onClick:R[22]||(R[22]=N=>B("up"))},"上移"),d.createElementVNode("button",{onClick:R[23]||(R[23]=N=>B("down"))},"下移"),d.createElementVNode("button",{onClick:P,class:"primary-btn"},"正北俯视"),d.createElementVNode("button",{onClick:V,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):l.value==="pick"?(d.openBlock(),d.createElementBlock("div",d_,[d.createElementVNode("div",h_,[d.createElementVNode("div",u_,[d.createElementVNode("div",{onClick:R[24]||(R[24]=N=>p.value="BIM"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:p.value==="BIM",style:{"margin-right":"5px"}},null,8,f_),R[40]||(R[40]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"BIM标记点:",-1))]),f.value?(d.openBlock(),d.createElementBlock("div",p_,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(f.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(f.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",m_,"未选择"))])]),d.createElementVNode("div",g_,[d.createElementVNode("div",y_,[d.createElementVNode("div",{onClick:R[25]||(R[25]=N=>p.value="MAP"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[d.createElementVNode("input",{type:"radio",checked:p.value==="MAP",style:{"margin-right":"5px"}},null,8,A_),R[41]||(R[41]=d.createElementVNode("span",{style:{"font-weight":"bold"}},"地图标记点:",-1))]),m.value?(d.openBlock(),d.createElementBlock("div",v_,[d.createElementVNode("div",null,"经度:"+d.toDisplayString(m.value.longitude.toFixed(10)),1),d.createElementVNode("div",null,"纬度:"+d.toDisplayString(m.value.latitude.toFixed(10)),1)])):(d.openBlock(),d.createElementBlock("div",b_,"未选择"))])]),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:x},"调整位置"),d.createElementVNode("button",{onClick:V},"保存")]),R[42]||(R[42]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 BIM 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“调整位置”进行校准。")],-1))])):d.createCommentVNode("",!0)]),d.withDirectives(d.createElementVNode("div",w_,[d.createElementVNode("div",C_,[d.createElementVNode("div",E_,[d.createElementVNode("input",{type:"checkbox",checked:w.value,onChange:F},null,40,x_)]),R[44]||(R[44]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),R[45]||(R[45]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),R[46]||(R[46]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",I_,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(_.value,(N,O)=>(d.openBlock(),d.createElementBlock("div",{key:N.modelId,class:d.normalizeClass(["list-item",{active:N.modelId===h.value}])},[d.createElementVNode("div",S_,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":z=>N.selected=z},null,8,M_),[[d.vModelCheckbox,N.selected]])]),d.createElementVNode("div",T_,d.toDisplayString(O+1),1),d.createElementVNode("div",{class:"col-name",title:N.modelName},d.toDisplayString(N.modelName),9,B_),d.createElementVNode("div",__,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:N.modelId===h.value,onChange:z=>L(N.modelId)},null,40,k_)])],2))),128))])],512),[[d.vShow,c.value]])])]),_:1},8,["visible","full-height","width"]))}}),[["__scopeId","data-v-7384e1ce"]]);function Vr(){return Vr=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Vr.apply(null,arguments)}const P_={locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"},D_={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},wm={lang:Vr({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},P_),timePickerLocale:Vr({},D_)};wm.lang.ok="确定";var Qr={exports:{}},N_=Qr.exports,Cm;function Em(){return Cm||(Cm=1,(function(i,e){(function(t,n){i.exports=n()})(N_,(function(){var t=1e3,n=6e4,s=36e5,o="millisecond",r="second",a="minute",l="hour",c="day",h="week",u="month",p="quarter",f="year",m="date",y="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,A=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var D=["th","st","nd","rd"],M=L%100;return"["+L+(D[(M-20)%10]||D[M]||D[0])+"]"}},b=function(L,D,M){var k=String(L);return!k||k.length>=D?L:""+Array(D+1-k.length).join(M)+L},C={s:b,z:function(L){var D=-L.utcOffset(),M=Math.abs(D),k=Math.floor(M/60),B=M%60;return(D<=0?"+":"-")+b(k,2,"0")+":"+b(B,2,"0")},m:function L(D,M){if(D.date()<M.date())return-L(M,D);var k=12*(M.year()-D.year())+(M.month()-D.month()),B=D.clone().add(k,u),P=M-B<0,V=D.clone().add(k+(P?-1:1),u);return+(-(k+(M-B)/(P?B-V:V-B))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:u,y:f,w:h,d:c,D:m,h:l,m:a,s:r,ms:o,Q:p}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},x="en",I={};I[x]=v;var E="$isDayjsObject",S=function(L){return L instanceof F||!(!L||!L[E])},w=function L(D,M,k){var B;if(!D)return x;if(typeof D=="string"){var P=D.toLowerCase();I[P]&&(B=P),M&&(I[P]=M,B=P);var V=D.split("-");if(!B&&V.length>1)return L(V[0])}else{var G=D.name;I[G]=D,B=G}return!k&&B&&(x=B),B||!k&&x},T=function(L,D){if(S(L))return L.clone();var M=typeof D=="object"?D:{};return M.date=L,M.args=arguments,new F(M)},_=C;_.l=w,_.i=S,_.w=function(L,D){return T(L,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var F=(function(){function L(M){this.$L=w(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[E]=!0}var D=L.prototype;return D.parse=function(M){this.$d=(function(k){var B=k.date,P=k.utc;if(B===null)return new Date(NaN);if(_.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var V=B.match(g);if(V){var G=V[2]-1||0,R=(V[7]||"0").substring(0,3);return P?new Date(Date.UTC(V[1],G,V[3]||1,V[4]||0,V[5]||0,V[6]||0,R)):new Date(V[1],G,V[3]||1,V[4]||0,V[5]||0,V[6]||0,R)}}return new Date(B)})(M),this.init()},D.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},D.$utils=function(){return _},D.isValid=function(){return this.$d.toString()!==y},D.isSame=function(M,k){var B=T(M);return this.startOf(k)<=B&&B<=this.endOf(k)},D.isAfter=function(M,k){return T(M)<this.startOf(k)},D.isBefore=function(M,k){return this.endOf(k)<T(M)},D.$g=function(M,k,B){return _.u(M)?this[k]:this.set(B,M)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(M,k){var B=this,P=!!_.u(k)||k,V=_.p(M),G=function(de,pe){var Ae=_.w(B.$u?Date.UTC(B.$y,pe,de):new Date(B.$y,pe,de),B);return P?Ae:Ae.endOf(c)},R=function(de,pe){return _.w(B.toDate()[de].apply(B.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(pe)),B)},N=this.$W,O=this.$M,z=this.$D,j="set"+(this.$u?"UTC":"");switch(V){case f:return P?G(1,0):G(31,11);case u:return P?G(1,O):G(0,O+1);case h:var Z=this.$locale().weekStart||0,te=(N<Z?N+7:N)-Z;return G(P?z-te:z+(6-te),O);case c:case m:return R(j+"Hours",0);case l:return R(j+"Minutes",1);case a:return R(j+"Seconds",2);case r:return R(j+"Milliseconds",3);default:return this.clone()}},D.endOf=function(M){return this.startOf(M,!1)},D.$set=function(M,k){var B,P=_.p(M),V="set"+(this.$u?"UTC":""),G=(B={},B[c]=V+"Date",B[m]=V+"Date",B[u]=V+"Month",B[f]=V+"FullYear",B[l]=V+"Hours",B[a]=V+"Minutes",B[r]=V+"Seconds",B[o]=V+"Milliseconds",B)[P],R=P===c?this.$D+(k-this.$W):k;if(P===u||P===f){var N=this.clone().set(m,1);N.$d[G](R),N.init(),this.$d=N.set(m,Math.min(this.$D,N.daysInMonth())).$d}else G&&this.$d[G](R);return this.init(),this},D.set=function(M,k){return this.clone().$set(M,k)},D.get=function(M){return this[_.p(M)]()},D.add=function(M,k){var B,P=this;M=Number(M);var V=_.p(k),G=function(O){var z=T(P);return _.w(z.date(z.date()+Math.round(O*M)),P)};if(V===u)return this.set(u,this.$M+M);if(V===f)return this.set(f,this.$y+M);if(V===c)return G(1);if(V===h)return G(7);var R=(B={},B[a]=n,B[l]=s,B[r]=t,B)[V]||1,N=this.$d.getTime()+M*R;return _.w(N,this)},D.subtract=function(M,k){return this.add(-1*M,k)},D.format=function(M){var k=this,B=this.$locale();if(!this.isValid())return B.invalidDate||y;var P=M||"YYYY-MM-DDTHH:mm:ssZ",V=_.z(this),G=this.$H,R=this.$m,N=this.$M,O=B.weekdays,z=B.months,j=B.meridiem,Z=function(pe,Ae,Pe,Ge){return pe&&(pe[Ae]||pe(k,P))||Pe[Ae].slice(0,Ge)},te=function(pe){return _.s(G%12||12,pe,"0")},de=j||function(pe,Ae,Pe){var Ge=pe<12?"AM":"PM";return Pe?Ge.toLowerCase():Ge};return P.replace(A,(function(pe,Ae){return Ae||(function(Pe){switch(Pe){case"YY":return String(k.$y).slice(-2);case"YYYY":return _.s(k.$y,4,"0");case"M":return N+1;case"MM":return _.s(N+1,2,"0");case"MMM":return Z(B.monthsShort,N,z,3);case"MMMM":return Z(z,N);case"D":return k.$D;case"DD":return _.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return Z(B.weekdaysMin,k.$W,O,2);case"ddd":return Z(B.weekdaysShort,k.$W,O,3);case"dddd":return O[k.$W];case"H":return String(G);case"HH":return _.s(G,2,"0");case"h":return te(1);case"hh":return te(2);case"a":return de(G,R,!0);case"A":return de(G,R,!1);case"m":return String(R);case"mm":return _.s(R,2,"0");case"s":return String(k.$s);case"ss":return _.s(k.$s,2,"0");case"SSS":return _.s(k.$ms,3,"0");case"Z":return V}return null})(pe)||V.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(M,k,B){var P,V=this,G=_.p(k),R=T(M),N=(R.utcOffset()-this.utcOffset())*n,O=this-R,z=function(){return _.m(V,R)};switch(G){case f:P=z()/12;break;case u:P=z();break;case p:P=z()/3;break;case h:P=(O-N)/6048e5;break;case c:P=(O-N)/864e5;break;case l:P=O/s;break;case a:P=O/n;break;case r:P=O/t;break;default:P=O}return B?P:_.a(P)},D.daysInMonth=function(){return this.endOf(u).$D},D.$locale=function(){return I[this.$L]},D.locale=function(M,k){if(!M)return this.$L;var B=this.clone(),P=w(M,k,!0);return P&&(B.$L=P),B},D.clone=function(){return _.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},L})(),U=F.prototype;return T.prototype=U,[["$ms",o],["$s",r],["$m",a],["$H",l],["$W",c],["$M",u],["$y",f],["$D",m]].forEach((function(L){U[L[1]]=function(D){return this.$g(D,L[0],L[1])}})),T.extend=function(L,D){return L.$i||(L(D,F,T),L.$i=!0),T},T.locale=w,T.isDayjs=S,T.unix=function(L){return T(1e3*L)},T.en=I[x],T.Ls=I,T.p={},T}))})(Qr)),Qr.exports}var L_=Em();const Qt=nn(L_);var zr={exports:{}},R_=zr.exports,xm;function F_(){return xm||(xm=1,(function(i,e){(function(t,n){i.exports=n(Em())})(R_,(function(t){function n(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var s=n(t),o={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(r,a){return a==="W"?r+"周":r+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(r,a){var l=100*r+a;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return s.default.locale(o,null,!0),o}))})(zr)),zr.exports}F_();var Hr={exports:{}},O_=Hr.exports,Im;function G_(){return Im||(Im=1,(function(i,e){(function(t,n){i.exports=n()})(O_,(function(){return function(t,n,s){var o=n.prototype,r=function(u){return u&&(u.indexOf?u:u.s)},a=function(u,p,f,m,y){var g=u.name?u:u.$locale(),A=r(g[p]),v=r(g[f]),b=A||v.map((function(x){return x.slice(0,m)}));if(!y)return b;var C=g.weekStart;return b.map((function(x,I){return b[(I+(C||0))%7]}))},l=function(){return s.Ls[s.locale()]},c=function(u,p){return u.formats[p]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,y,g){return y||g.slice(1)}))})(u.formats[p.toUpperCase()])},h=function(){var u=this;return{months:function(p){return p?p.format("MMMM"):a(u,"months")},monthsShort:function(p){return p?p.format("MMM"):a(u,"monthsShort","months",3)},firstDayOfWeek:function(){return u.$locale().weekStart||0},weekdays:function(p){return p?p.format("dddd"):a(u,"weekdays")},weekdaysMin:function(p){return p?p.format("dd"):a(u,"weekdaysMin","weekdays",2)},weekdaysShort:function(p){return p?p.format("ddd"):a(u,"weekdaysShort","weekdays",3)},longDateFormat:function(p){return c(u.$locale(),p)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return h.bind(this)()},s.localeData=function(){var u=l();return{firstDayOfWeek:function(){return u.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(p){return c(u,p)},meridiem:u.meridiem,ordinal:u.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(u){return a(l(),"weekdays",null,null,u)},s.weekdaysShort=function(u){return a(l(),"weekdaysShort","weekdays",3,u)},s.weekdaysMin=function(u){return a(l(),"weekdaysMin","weekdays",2,u)}}}))})(Hr)),Hr.exports}var U_=G_();const V_=nn(U_);var Yr={exports:{}},Q_=Yr.exports,Sm;function z_(){return Sm||(Sm=1,(function(i,e){(function(t,n){i.exports=n()})(Q_,(function(){return function(t,n){n.prototype.weekday=function(s){var o=this.$locale().weekStart||0,r=this.$W,a=(r<o?r+7:r)-o;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}}))})(Yr)),Yr.exports}var H_=z_();const Y_=nn(H_);var $r={exports:{}},$_=$r.exports,Mm;function j_(){return Mm||(Mm=1,(function(i,e){(function(t,n){i.exports=n()})($_,(function(){var t="week",n="year";return function(s,o,r){var a=o.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=r(this).startOf(n).add(1,n).date(c),u=r(this).endOf(t);if(h.isBefore(u))return 1}var p=r(this).startOf(n).date(c).startOf(t).subtract(1,"millisecond"),f=this.diff(p,t,!0);return f<0?r(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})($r)),$r.exports}var W_=j_();const q_=nn(W_);var jr={exports:{}},K_=jr.exports,Tm;function X_(){return Tm||(Tm=1,(function(i,e){(function(t,n){i.exports=n()})(K_,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,o=/\d\d/,r=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(g){return(g=+g)+(g>68?1900:2e3)},h=function(g){return function(A){this[g]=+A}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(g){(this.zone||(this.zone={})).offset=(function(A){if(!A||A==="Z")return 0;var v=A.match(/([+-]|\d\d)/g),b=60*v[1]+(+v[2]||0);return b===0?0:v[0]==="+"?-b:b})(g)}],p=function(g){var A=l[g];return A&&(A.indexOf?A:A.s.concat(A.f))},f=function(g,A){var v,b=l.meridiem;if(b){for(var C=1;C<=24;C+=1)if(g.indexOf(b(C,0,A))>-1){v=C>12;break}}else v=g===(A?"pm":"PM");return v},m={A:[a,function(g){this.afternoon=f(g,!1)}],a:[a,function(g){this.afternoon=f(g,!0)}],Q:[s,function(g){this.month=3*(g-1)+1}],S:[s,function(g){this.milliseconds=100*+g}],SS:[o,function(g){this.milliseconds=10*+g}],SSS:[/\d{3}/,function(g){this.milliseconds=+g}],s:[r,h("seconds")],ss:[r,h("seconds")],m:[r,h("minutes")],mm:[r,h("minutes")],H:[r,h("hours")],h:[r,h("hours")],HH:[r,h("hours")],hh:[r,h("hours")],D:[r,h("day")],DD:[o,h("day")],Do:[a,function(g){var A=l.ordinal,v=g.match(/\d+/);if(this.day=v[0],A)for(var b=1;b<=31;b+=1)A(b).replace(/\[|\]/g,"")===g&&(this.day=b)}],w:[r,h("week")],ww:[o,h("week")],M:[r,h("month")],MM:[o,h("month")],MMM:[a,function(g){var A=p("months"),v=(p("monthsShort")||A.map((function(b){return b.slice(0,3)}))).indexOf(g)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[a,function(g){var A=p("months").indexOf(g)+1;if(A<1)throw new Error;this.month=A%12||A}],Y:[/[+-]?\d+/,h("year")],YY:[o,function(g){this.year=c(g)}],YYYY:[/\d{4}/,h("year")],Z:u,ZZ:u};function y(g){var A,v;A=g,v=l&&l.formats;for(var b=(g=A.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(T,_,F){var U=F&&F.toUpperCase();return _||v[F]||t[F]||v[U].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(L,D,M){return D||M.slice(1)}))}))).match(n),C=b.length,x=0;x<C;x+=1){var I=b[x],E=m[I],S=E&&E[0],w=E&&E[1];b[x]=w?{regex:S,parser:w}:I.replace(/^\[|\]$/g,"")}return function(T){for(var _={},F=0,U=0;F<C;F+=1){var L=b[F];if(typeof L=="string")U+=L.length;else{var D=L.regex,M=L.parser,k=T.slice(U),B=D.exec(k)[0];M.call(_,B),T=T.replace(B,"")}}return(function(P){var V=P.afternoon;if(V!==void 0){var G=P.hours;V?G<12&&(P.hours+=12):G===12&&(P.hours=0),delete P.afternoon}})(_),_}}return function(g,A,v){v.p.customParseFormat=!0,g&&g.parseTwoDigitYear&&(c=g.parseTwoDigitYear);var b=A.prototype,C=b.parse;b.parse=function(x){var I=x.date,E=x.utc,S=x.args;this.$u=E;var w=S[1];if(typeof w=="string"){var T=S[2]===!0,_=S[3]===!0,F=T||_,U=S[2];_&&(U=S[2]),l=this.$locale(),!T&&U&&(l=v.Ls[U]),this.$d=(function(k,B,P,V){try{if(["x","X"].indexOf(B)>-1)return new Date((B==="X"?1e3:1)*k);var G=y(B)(k),R=G.year,N=G.month,O=G.day,z=G.hours,j=G.minutes,Z=G.seconds,te=G.milliseconds,de=G.zone,pe=G.week,Ae=new Date,Pe=O||(R||N?1:Ae.getDate()),Ge=R||Ae.getFullYear(),Je=0;R&&!N||(Je=N>0?N-1:Ae.getMonth());var vt,ct=z||0,Bt=j||0,W=Z||0,Y=te||0;return de?new Date(Date.UTC(Ge,Je,Pe,ct,Bt,W,Y+60*de.offset*1e3)):P?new Date(Date.UTC(Ge,Je,Pe,ct,Bt,W,Y)):(vt=new Date(Ge,Je,Pe,ct,Bt,W,Y),pe&&(vt=V(vt).week(pe).toDate()),vt)}catch{return new Date("")}})(I,w,E,v),this.init(),U&&U!==!0&&(this.$L=this.locale(U).$L),F&&I!=this.format(w)&&(this.$d=new Date("")),l={}}else if(w instanceof Array)for(var L=w.length,D=1;D<=L;D+=1){S[1]=w[D-1];var M=v.apply(this,S);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}D===L&&(this.$d=new Date(""))}else C.call(this,x)}}}))})(jr)),jr.exports}var J_=X_();const Z_=nn(J_),ek={class:"setting-panel"},tk={class:"tabs-header"},ik={class:"tab-content"},nk={key:0,class:"section"},sk={class:"setting-item"},ok={class:"setting-item"},rk={class:"setting-item"},ak={key:1,class:"section"},lk={class:"tabs-header",style:{"margin-bottom":"8px"}},ck={key:0},dk={class:"setting-item column"},hk={class:"setting-item"},uk={key:1},fk={class:"setting-item column"},pk={class:"setting-item column",style:{"margin-top":"12px","border-top":"1px solid rgba(255,255,255,0.1)","padding-top":"8px"}},mk={class:"search-box",style:{position:"relative"}},gk={key:0,class:"search-dropdown"},yk=["onClick"],Ak={class:"result-name"},vk={class:"result-coord"},bk={key:2,class:"section"},wk={class:"setting-item"},Ck={key:0,class:"setting-item column"},Ek={class:"sub-label"},xk={class:"setting-item"},Ik={class:"setting-item"},Sk={class:"setting-item column"},Mk={class:"setting-item column"},Tk={class:"sub-label"},Bk={class:"setting-item column"},_k={class:"sub-label"},kk={class:"setting-item column"},Pk={class:"sub-label"},Dk={class:"setting-item column"},Nk={style:{display:"flex",gap:"8px","margin-bottom":"8px"}},Lk=["onClick","title"],Rk={style:{display:"flex",gap:"8px","align-items":"center"}},Fk={key:3,class:"section"},Ok={class:"setting-item"},Gk={class:"setting-item column"},fo=Be(d.defineComponent({__name:"LeitingSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},fullHeight:{type:Boolean,default:!1},tiandituToken:{type:String,default:""},initialConfig:{type:Object,default:()=>({})}},emits:["update:visible","update:open","close"],setup(i,{emit:e}){Qt.locale("zh-cn"),Qt.extend(V_),Qt.extend(Y_),Qt.extend(q_),Qt.extend(Z_);const t=re.Switch,n=re.Radio.Group,s=re.Radio,o=re.Input,r=re.Slider,a=re.Select,l=re.Select.Option,c=re.DatePicker,h=i,u=e,p=d.inject("leitingMethods"),f=d.computed({get:()=>h.open!==void 0?h.open:h.visible,set:M=>{u("update:visible",M),u("update:open",M)}}),m=d.ref("GIS"),y=d.reactive({globe:!1,terrain:!1,depthTest:!1}),g=d.reactive({provider:"tianditu",tianditu:{token:"c25f14fb6bd4397cf8fe45144ff768d6",layerType:"img_w",showLabel:!1},arcgis:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"},baseMap:"tianditu"}),A=d.reactive({shadows:!1,shadowDarkness:.7,environmentMap:!1,ambientOcclusion:!1,time:Qt("2025-06-22 10:00"),brightness:1,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",skyBox:"",skyBoxVisible:!1}),v=d.reactive({collision:!1,habit:0}),b=M=>{M&&(M.globe!==void 0&&(y.globe=M.globe),M.terrain!==void 0&&(y.terrain=M.terrain),M.depthTest!==void 0&&(y.depthTest=M.depthTest),M.mapProvider!==void 0&&(g.provider=M.mapProvider),M.tiandituLayerType!==void 0&&(g.tianditu.layerType=M.tiandituLayerType),M.tiandituShowLabel!==void 0&&(g.tianditu.showLabel=M.tiandituShowLabel),M.arcgisUrl!==void 0&&(g.arcgis.url=M.arcgisUrl),M.shadows!==void 0&&(A.shadows=M.shadows),M.shadowDarkness!==void 0&&(A.shadowDarkness=M.shadowDarkness),M.environmentMap!==void 0&&(A.environmentMap=M.environmentMap),M.ambientOcclusion!==void 0&&(A.ambientOcclusion=M.ambientOcclusion),M.time!==void 0&&(typeof M.time=="number"?A.time=Qt().startOf("day").add(M.time,"hour"):A.time=Qt(M.time)),M.brightness!==void 0&&(A.brightness=M.brightness),M.contrast!==void 0&&(A.contrast=M.contrast),M.saturation!==void 0&&(A.saturation=M.saturation),M.backgroundColor!==void 0&&(A.backgroundColor=M.backgroundColor),M.skyBox!==void 0&&(A.skyBox=M.skyBox),M.skyBoxVisible!==void 0&&(A.skyBoxVisible=M.skyBoxVisible),M.collision!==void 0&&(v.collision=M.collision),M.mouseHabit!==void 0&&(v.habit=M.mouseHabit))};d.watch(()=>h.initialConfig,M=>{b(M)},{deep:!0,immediate:!0});const C=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],x=[{label:"全球影像地图服务(墨卡托)",value:"img_w"},{label:"全球影像地图服务(经纬度)",value:"img_c"},{label:"全球矢量地图服务(墨卡托)",value:"vec_w"},{label:"全球矢量地图服务(经纬度)",value:"vec_c"},{label:"全球地形晕渲服务(墨卡托)",value:"ter_w"},{label:"全球地形晕渲服务(经纬度)",value:"ter_c"}],I=()=>{const M=g.provider,k={};M==="tianditu"?(k.token=g.tianditu.token,k.layerType=g.tianditu.layerType,k.showAnnotation=g.tianditu.showLabel):M==="arcgis"&&(k.url=g.arcgis.url),p.value?.changeBaseMap?.(M,k)};d.watch(()=>g.provider,I),d.watch(()=>g.tianditu.layerType,I),d.watch(()=>g.tianditu.showLabel,I),d.watch(()=>g.tianditu.token,qo(I,1e3)),d.watch(()=>g.arcgis.url,qo(I,1e3)),d.onMounted(()=>{h.tiandituToken&&(g.tianditu.token=h.tiandituToken)}),d.watch(()=>y.globe,M=>p.value?.setGlobeEnvironmentVisible?.(M)),d.watch(()=>y.terrain,M=>p.value?.setTerrainEnable?.(M)),d.watch(()=>y.depthTest,M=>p.value?.setDepthTestEnable?.(M)),d.watch(()=>p?.value,M=>{if(M){if(M.getConfigure=()=>({globe:y.globe,terrain:y.terrain,depthTest:y.depthTest,mapProvider:g.provider,tiandituLayerType:g.tianditu.layerType,tiandituShowLabel:g.tianditu.showLabel,arcgisUrl:g.arcgis.url,shadows:A.shadows,shadowDarkness:A.shadowDarkness,environmentMap:A.environmentMap,ambientOcclusion:A.ambientOcclusion,time:Qt.isDayjs(A.time)?A.time.format("YYYY-MM-DD HH:mm"):A.time,brightness:A.brightness,contrast:A.contrast,saturation:A.saturation,backgroundColor:A.backgroundColor,skyBox:A.skyBox,skyBoxVisible:A.skyBoxVisible,collision:v.collision,mouseHabit:v.habit}),M.setConfigure=k=>{b(k)},M.setBackgroundColor&&A.backgroundColor&&M.setBackgroundColor(A.backgroundColor),M.setSkyBox&&M.setSkyBox(A.skyBox||null),M.setSkyBoxVisible&&M.setSkyBoxVisible(A.skyBoxVisible),M.setGlobeEnvironmentVisible&&M.setGlobeEnvironmentVisible(y.globe),M.setShadowsEnable&&M.setShadowsEnable(A.shadows),M.setShadowDarkness&&M.setShadowDarkness(A.shadowDarkness),M.setEnvironmentMapEnable&&M.setEnvironmentMapEnable(A.environmentMap),M.setAmbientOcclusion&&M.setAmbientOcclusion(A.ambientOcclusion),M.setTime){const k=Qt.isDayjs(A.time)?A.time.toDate():new Date;M.setTime(k)}M.setModelBrightness&&M.setModelBrightness(A.brightness),M.setCollisionDetection&&M.setCollisionDetection(v.collision),M.setMouseHabit&&M.setMouseHabit(v.habit),M.changeBaseMap&&g.baseMap&&M.changeBaseMap(g.baseMap,{token:g.tianditu.token,layerType:g.tianditu.layerType,showAnnotation:g.tianditu.showLabel,url:g.arcgis.url})}},{immediate:!0});const E=d.computed({get:()=>{const M=A.backgroundColor;return/^#[0-9A-Fa-f]{6}$/.test(M)?M:"#ffffff"},set:M=>{A.backgroundColor=M}}),S=d.ref(""),w=d.ref(!1),T=d.ref([]);d.watch(()=>y.globe,M=>p.value?.setGlobeEnvironmentVisible?.(M)),d.watch(()=>y.terrain,M=>p.value?.setTerrainEnable?.(M)),d.watch(()=>g.baseMap,M=>{p.value?.changeBaseMap?.(M,{token:h.tiandituToken})}),d.watch(()=>A.shadows,M=>p.value?.setShadowsEnable?.(M)),d.watch(()=>A.shadowDarkness,M=>p.value?.setShadowDarkness?.(M)),d.watch(()=>A.environmentMap,M=>p.value?.setEnvironmentMapEnable?.(M)),d.watch(()=>A.ambientOcclusion,M=>p.value?.setAmbientOcclusion?.(M)),d.watch(()=>A.time,M=>{const k=Qt.isDayjs(M)?M.toDate():new Date;p.value?.setTime?.(k)}),d.watch(()=>[A.brightness,A.contrast,A.saturation],([M,k,B])=>{const P=p.value;P?.setModelColorAdjustment?P.setModelColorAdjustment({brightness:M,contrast:k,saturation:B}):P?.setModelBrightness?.(M)}),d.watch(()=>A.backgroundColor,M=>{if(p.value?.setBackgroundColor)p.value.setBackgroundColor(M);else{const k=document.querySelector(".cesium-viewer");k&&(k.style.background=M)}}),d.watch(()=>A.skyBox,M=>{p.value?.setSkyBox?.(M||null),p.value?.setSkyBoxVisible?.(A.skyBoxVisible)}),d.watch(()=>A.skyBoxVisible,M=>{M&&p.value?.setSkyBox?.(A.skyBox||null),p.value?.setSkyBoxVisible?.(M)}),d.watch(()=>v.collision,M=>p.value?.setCollisionDetection?.(M)),d.watch(()=>v.habit,M=>p.value?.setMouseHabit?.(M));const _=M=>{const k=[];if(M?.pois&&Array.isArray(M.pois)){for(const B of M.pois)if(B.lonlat){const P=B.lonlat.split(/[, ]/).map(Number);P.length>=2&&!isNaN(P[0])&&!isNaN(P[1])&&k.push({name:B.name||"未命名",lon:P[0],lat:P[1],raw:B})}}if(M?.area&&M.area.lonlat){const B=M.area,P=B.lonlat.split(/[, ]/).map(Number);P.length>=2&&!isNaN(P[0])&&!isNaN(P[1])&&k.push({name:B.name||"未命名",lon:P[0],lat:P[1],raw:B})}if(M?.prompt&&Array.isArray(M.prompt)){for(const B of M.prompt)if(B.admins&&Array.isArray(B.admins)){for(const P of B.admins)if(P.lonlat){const V=P.lonlat.split(/[, ]/).map(Number);V.length>=2&&!isNaN(V[0])&&!isNaN(V[1])&&k.push({name:P.adminName||P.name||"未命名",lon:V[0],lat:V[1],raw:P})}}}return k},U=qo(async()=>{const M=(S.value||"").trim();if(!M){T.value=[];return}const k=h.tiandituToken||"c25f14fb6bd4397cf8fe45144ff768d6";w.value=!0,T.value=[];try{const P=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify({keyWord:M,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}))}&type=query&tk=${encodeURIComponent(k)}`,V=await fetch(P);if(!V.ok)throw new Error(`HTTP ${V.status}`);const G=await V.json();T.value=_(G)}catch(B){console.error("tianditu search error",B)}finally{w.value=!1}},800);d.watch(S,()=>{U()});const L=M=>{p.value?.flyToLonLatHeight?.(M.lon,M.lat,5e3),S.value=M.name,T.value=[]},D=()=>{f.value=!1,u("close")};return d.onMounted(()=>{}),(M,k)=>(d.openBlock(),d.createBlock(gt,{visible:f.value,title:"设置","full-height":i.fullHeight,onClose:D,"onUpdate:visible":k[25]||(k[25]=B=>f.value=B)},{default:d.withCtx(()=>[d.createElementVNode("div",ek,[d.createElementVNode("div",tk,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="GIS"}]),onClick:k[0]||(k[0]=B=>m.value="GIS")},"GIS",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="MAP"}]),onClick:k[1]||(k[1]=B=>m.value="MAP")},"地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="RENDER"}]),onClick:k[2]||(k[2]=B=>m.value="RENDER")},"渲染",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:m.value==="MOUSE"}]),onClick:k[3]||(k[3]=B=>m.value="MOUSE")},"鼠标",2)]),d.createElementVNode("div",ik,[m.value==="GIS"?(d.openBlock(),d.createElementBlock("div",nk,[d.createElementVNode("div",sk,[k[26]||(k[26]=d.createElementVNode("span",null,"地球 (含大气/日月/星空)",-1)),d.createVNode(d.unref(t),{checked:y.globe,"onUpdate:checked":k[4]||(k[4]=B=>y.globe=B),size:"small"},null,8,["checked"])]),d.createElementVNode("div",ok,[k[27]||(k[27]=d.createElementVNode("span",null,"地形 (高程)",-1)),d.createVNode(d.unref(t),{checked:y.terrain,"onUpdate:checked":k[5]||(k[5]=B=>y.terrain=B),size:"small"},null,8,["checked"])]),d.createElementVNode("div",rk,[k[28]||(k[28]=d.createElementVNode("span",null,"地形遮挡",-1)),d.createVNode(d.unref(t),{checked:y.depthTest,"onUpdate:checked":k[6]||(k[6]=B=>y.depthTest=B),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),m.value==="MAP"?(d.openBlock(),d.createElementBlock("div",ak,[d.createElementVNode("div",lk,[d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:g.provider==="tianditu"}]),onClick:k[7]||(k[7]=B=>g.provider="tianditu")},"天地图",2),d.createElementVNode("div",{class:d.normalizeClass(["tab-item",{active:g.provider==="arcgis"}]),onClick:k[8]||(k[8]=B=>g.provider="arcgis")},"ArcGIS",2)]),g.provider==="tianditu"?(d.openBlock(),d.createElementBlock("div",ck,[d.createElementVNode("div",dk,[k[29]||(k[29]=d.createElementVNode("div",{class:"sub-label"},"地图风格",-1)),d.createVNode(d.unref(a),{value:g.tianditu.layerType,"onUpdate:value":k[9]||(k[9]=B=>g.tianditu.layerType=B),size:"small",style:{width:"100%"}},{default:d.withCtx(()=>[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(x,B=>d.createVNode(d.unref(l),{key:B.value,value:B.value},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(B.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["value"])]),d.createElementVNode("div",hk,[k[30]||(k[30]=d.createElementVNode("span",null,"路网注记",-1)),d.createVNode(d.unref(t),{checked:g.tianditu.showLabel,"onUpdate:checked":k[10]||(k[10]=B=>g.tianditu.showLabel=B),size:"small"},null,8,["checked"])])])):d.createCommentVNode("",!0),g.provider==="arcgis"?(d.openBlock(),d.createElementBlock("div",uk,[d.createElementVNode("div",fk,[k[31]||(k[31]=d.createElementVNode("div",{class:"sub-label"},"服务地址",-1)),d.createVNode(d.unref(o),{value:g.arcgis.url,"onUpdate:value":k[11]||(k[11]=B=>g.arcgis.url=B),size:"small",placeholder:"输入ArcGIS MapServer地址"},null,8,["value"])])])):d.createCommentVNode("",!0),d.createElementVNode("div",pk,[k[32]||(k[32]=d.createElementVNode("div",{class:"sub-label"},"位置搜索 (天地图)",-1)),d.createElementVNode("div",mk,[d.createVNode(d.unref(o),{value:S.value,"onUpdate:value":k[12]||(k[12]=B=>S.value=B),placeholder:"输入地名搜索",size:"small","allow-clear":"",loading:w.value},null,8,["value","loading"]),T.value.length>0?(d.openBlock(),d.createElementBlock("div",gk,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(T.value,(B,P)=>(d.openBlock(),d.createElementBlock("div",{key:P,class:"search-result-item",onClick:V=>L(B)},[d.createElementVNode("span",Ak,d.toDisplayString(B.name),1),d.createElementVNode("span",vk,d.toDisplayString(B.lon.toFixed(4))+", "+d.toDisplayString(B.lat.toFixed(4)),1)],8,yk))),128))])):d.createCommentVNode("",!0)])])])):d.createCommentVNode("",!0),m.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",bk,[d.createElementVNode("div",wk,[k[33]||(k[33]=d.createElementVNode("span",null,"阴影",-1)),d.createVNode(d.unref(t),{checked:A.shadows,"onUpdate:checked":k[13]||(k[13]=B=>A.shadows=B),size:"small"},null,8,["checked"])]),A.shadows?(d.openBlock(),d.createElementBlock("div",Ck,[d.createElementVNode("div",Ek,"阴影暗度 ("+d.toDisplayString(A.shadowDarkness.toFixed(2))+")",1),d.createVNode(d.unref(r),{value:A.shadowDarkness,"onUpdate:value":k[14]||(k[14]=B=>A.shadowDarkness=B),min:0,max:1,step:.05,size:"small"},null,8,["value"])])):d.createCommentVNode("",!0),d.createElementVNode("div",xk,[k[34]||(k[34]=d.createElementVNode("span",null,"环境贴图 (HDR)",-1)),d.createVNode(d.unref(t),{checked:A.environmentMap,"onUpdate:checked":k[15]||(k[15]=B=>A.environmentMap=B),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Ik,[k[35]||(k[35]=d.createElementVNode("span",null,"环境光遮蔽 (AO)",-1)),d.createVNode(d.unref(t),{checked:A.ambientOcclusion,"onUpdate:checked":k[16]||(k[16]=B=>A.ambientOcclusion=B),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Sk,[k[36]||(k[36]=d.createElementVNode("div",{class:"sub-label"},"日期时间",-1)),d.createVNode(d.unref(c),{value:A.time,"onUpdate:value":k[17]||(k[17]=B=>A.time=B),"show-time":"",locale:d.unref(wm),format:"YYYY-MM-DD HH:mm",size:"small",style:{width:"100%"}},null,8,["value","locale"])]),d.createElementVNode("div",Mk,[d.createElementVNode("div",Tk,"模型亮度 ("+d.toDisplayString(A.brightness.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.brightness,"onUpdate:value":k[18]||(k[18]=B=>A.brightness=B),min:0,max:5,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Bk,[d.createElementVNode("div",_k,"模型对比度 ("+d.toDisplayString(A.contrast.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.contrast,"onUpdate:value":k[19]||(k[19]=B=>A.contrast=B),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",kk,[d.createElementVNode("div",Pk,"模型饱和度 ("+d.toDisplayString(A.saturation.toFixed(1))+")",1),d.createVNode(d.unref(r),{value:A.saturation,"onUpdate:value":k[20]||(k[20]=B=>A.saturation=B),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),d.createElementVNode("div",Dk,[k[37]||(k[37]=d.createElementVNode("div",{class:"sub-label"},"背景颜色",-1)),d.createElementVNode("div",Nk,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(C,(B,P)=>d.createElementVNode("div",{key:P,style:d.normalizeStyle({background:B,width:"32px",height:"24px",borderRadius:"2px",cursor:"pointer",border:"1px solid #d9d9d9",flexShrink:0}),onClick:V=>A.backgroundColor=B,title:"预设 "+(P+1)},null,12,Lk)),64))]),d.createElementVNode("div",Rk,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":k[21]||(k[21]=B=>E.value=B),style:{width:"40px",height:"24px",padding:"0",border:"1px solid #d9d9d9"}},null,512),[[d.vModelText,E.value]]),d.createVNode(d.unref(o),{value:A.backgroundColor,"onUpdate:value":k[22]||(k[22]=B=>A.backgroundColor=B),size:"small",style:{flex:"1"},placeholder:"CSS 颜色值"},null,8,["value"])])])])):d.createCommentVNode("",!0),m.value==="MOUSE"?(d.openBlock(),d.createElementBlock("div",Fk,[d.createElementVNode("div",Ok,[k[38]||(k[38]=d.createElementVNode("span",null,"碰撞检测",-1)),d.createVNode(d.unref(t),{checked:v.collision,"onUpdate:checked":k[23]||(k[23]=B=>v.collision=B),size:"small"},null,8,["checked"])]),d.createElementVNode("div",Gk,[k[41]||(k[41]=d.createElementVNode("div",{class:"sub-label"},"操作习惯",-1)),d.createVNode(d.unref(n),{value:v.habit,"onUpdate:value":k[24]||(k[24]=B=>v.habit=B),size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(s),{value:0},{default:d.withCtx(()=>[...k[39]||(k[39]=[d.createTextVNode("默认 (中键旋转)",-1)])]),_:1}),d.createVNode(d.unref(s),{value:1},{default:d.withCtx(()=>[...k[40]||(k[40]=[d.createTextVNode("习惯1 (左键旋转)",-1)])]),_:1})]),_:1},8,["value"])])])):d.createCommentVNode("",!0)])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-b69becf5"]]),Uk={class:"cad-layer-panel"},Vk={class:"layer-list-container"},Qk={class:"list-header"},zk={class:"col-check"},Hk=["checked"],Yk={class:"list-body"},$k={class:"col-check"},jk=["checked","onChange"],Wk={class:"col-index"},qk=["title"],Kk={class:"col-color"},Xk=["value"],Jk={key:0,class:"empty-text"},Zk=Be(d.defineComponent({__name:"LeitingCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),a=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(v=>({modelId:v.modelId,modelName:v.modelName}))||[])},l=d.computed(()=>r.value.map(v=>({value:v.modelId,label:v.modelName}))),c=d.ref([]),h=d.ref([]),u=d.computed(()=>c.value.length>0&&h.value.length===c.value.length),p=({modelId:v})=>{if(c.value=[],h.value=[],s.value&&s.value.getDxfLayers){const b=s.value.getDxfLayers({modelId:v});b&&Object.keys(b).forEach((C,x)=>{b[C].length&&(c.value.push({index:x+1,layerName:C,layerColor:b[C][0].color||"#ffffff",key:C}),h.value.push(C))})}},f=v=>{o.value=v,p({modelId:v})},m=v=>{v.target.checked?h.value=c.value.map(C=>C.key):h.value=[],g()},y=(v,b)=>{b.target.checked?h.value.includes(v)||h.value.push(v):h.value=h.value.filter(x=>x!==v),g()},g=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:h.value}),s.value.getDxfLayers)){const v=s.value.getDxfLayers({modelId:o.value});if(v){const b=Object.keys(v).filter(C=>!h.value.includes(C));s.value.showDxfLayer({modelId:o.value,show:!1,layers:b})}}},A=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return d.watch(()=>t.visible,v=>{v&&(a(),t.currentModelId?(o.value=t.currentModelId,p({modelId:t.currentModelId})):l.value.length>0&&(o.value=l.value[0]?.value,p({modelId:o.value})))}),d.watch(()=>t.currentModelId,v=>{v&&t.visible&&(o.value=v,p({modelId:v}))}),(v,b)=>(d.openBlock(),d.createBlock(gt,{visible:i.visible,title:"CAD图层","onUpdate:visible":b[3]||(b[3]=C=>v.$emit("update:visible",C)),onClose:A,width:360,align:"right","initial-position":{x:0,y:60}},{"header-extra":d.withCtx(()=>[d.createElementVNode("div",{class:"header-select-container",onMousedown:b[2]||(b[2]=d.withModifiers(()=>{},["stop"]))},[b[4]||(b[4]=d.createElementVNode("span",{class:"header-label"},"图纸:",-1)),d.createVNode(d.unref(re.Select),{value:o.value,"onUpdate:value":b[0]||(b[0]=C=>o.value=C),options:l.value,onChange:b[1]||(b[1]=C=>f(C)),placeholder:"选择模型",style:{width:"140px"},bordered:!1,class:"custom-header-select",popupClassName:"leiting-select-dropdown",size:"small"},null,8,["value","options"])],32)]),default:d.withCtx(()=>[d.createElementVNode("div",Uk,[d.createElementVNode("div",Vk,[d.createElementVNode("div",Qk,[d.createElementVNode("div",zk,[d.createElementVNode("input",{type:"checkbox",checked:u.value,onChange:m},null,40,Hk)]),b[5]||(b[5]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),b[6]||(b[6]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),b[7]||(b[7]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",Yk,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(c.value,C=>(d.openBlock(),d.createElementBlock("div",{key:C.key,class:"list-item"},[d.createElementVNode("div",$k,[d.createElementVNode("input",{type:"checkbox",checked:h.value.includes(C.key),onChange:x=>y(C.key,x)},null,40,jk)]),d.createElementVNode("div",Wk,d.toDisplayString(C.index),1),d.createElementVNode("div",{class:"col-name",title:C.layerName},d.toDisplayString(C.layerName),9,qk),d.createElementVNode("div",Kk,[d.createElementVNode("input",{type:"color",value:C.layerColor,disabled:""},null,8,Xk)])]))),128)),c.value.length===0?(d.openBlock(),d.createElementBlock("div",Jk,"暂无数据")):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-a4db4977"]]),eP={class:"leiting-cad-adjust-panel"},tP={class:"leitingbim-control-panel"},iP={class:"form-item"},nP={class:"radio-group"},sP={class:"form-item"},oP=["title"],rP={class:"param-row"},aP=["step"],lP={class:"param-row"},cP=["step"],dP={class:"param-row"},hP=["step"],uP={class:"param-row"},fP=["step"],pP={class:"param-row"},mP=["step"],gP={class:"param-row"},yP=["step"],AP={class:"param-row"},vP=["step"],bP={class:"button-grid"},wP={key:1,class:"pick-mode-ui"},CP=["onClick"],EP=["checked"],xP={style:{"font-size":"12px",color:"#aaa","padding-left":"10px"}},IP={class:"param-row"},SP={style:{width:"40px"}},MP=["onUpdate:modelValue"],TP={class:"param-row"},BP={style:{width:"40px"}},_P=["onUpdate:modelValue"],kP={class:"param-row"},PP={style:{width:"40px"}},DP=["onUpdate:modelValue"],NP={class:"list-panel"},LP={class:"list-header"},RP={class:"col-check"},FP=["checked"],OP={class:"list-body"},GP={class:"col-check"},UP=["onUpdate:modelValue"],VP={class:"col-index"},QP=["title"],zP={class:"col-main"},HP=["checked","onChange"],YP={key:0,style:{padding:"10px","text-align":"center",color:"#999"}},$P=Be(d.defineComponent({__name:"LeitingCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","handleSavingByCadCard","clearBimPointList","save"],setup(i,{expose:e,emit:t}){const n=i,s=t,o=d.inject("leitingMethods"),r=d.ref([]),a=d.ref(""),l=d.computed(()=>r.value.length>0&&r.value.every(k=>k.selected)),c=d.ref("param"),h=d.ref(!1),u=d.ref("bimPoint1"),p=d.ref(null),f=d.ref("bimPoint1"),m=d.reactive({bimPoint1:{longitude:void 0,latitude:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0},bimPoint2:{longitude:void 0,latitude:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程",height:void 0}}),y=d.ref(1e-6),g=d.reactive({modelId:"",longitude:0,latitude:0,distance:1e-6,rotation:1,totalRotation:0,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0}),A=d.computed(()=>{const k=r.value.find(B=>B.modelId===a.value);return k?k.modelName:""}),v=()=>{s("update:visible",!1)},b=()=>(!p.value&&o?.value?.getViewer&&o?.value?.getCesium&&(p.value=new vc(o.value.getViewer(),o.value.getCesium())),p.value),C=()=>{b()?.clearMarkers(),m.bimPoint1.longitude=void 0,m.bimPoint1.latitude=void 0,m.bimPoint1.height=void 0,m.bimPoint2.longitude=void 0,m.bimPoint2.latitude=void 0,m.bimPoint2.height=void 0},x=k=>{const B=u.value,P=m[B];if(P){P.longitude=k.longitude,P.latitude=k.latitude,P.height=k.height;const V=B==="bimPoint1"?"BIM":"MAP";b()?.addMarker(V,k),me.success(`${P.type}已添加`)}},I=()=>{b()?.registerPickHandler(k=>{x(k)})},E=()=>{b()?.destroyPickHandler()},S=k=>{c.value=k,k!=="pick"&&s("clearBimPointList")};d.watch(()=>c.value,k=>{k==="pick"?I():E()}),d.onUnmounted(()=>{E()});const w=()=>{if(!o?.value?.getDxfModels)return;const k=o.value.getDxfModels();if(Array.isArray(k)?r.value=k.map(B=>({modelId:B.modelId,modelName:B.modelName,formData:B.formData||{},selected:!1,tileset:B})):r.value=[],r.value.length>0){const B=o.value.getCadModelId?o.value.getCadModelId():"";B&&r.value.find(P=>P.modelId===B)?T(B):T(r.value[0].modelId),r.value.forEach(P=>P.selected=!0)}},T=k=>{a.value=k;const B=r.value.find(P=>P.modelId===k);B&&B.formData&&Object.keys(g).forEach(P=>{B.formData[P]!==void 0&&(g[P]=B.formData[P])})},_=(k,B)=>{if(!o?.value?.adjustingModelByCad)return;const P=r.value.find(V=>V.modelId===k);P&&P.tileset&&(P.formData={...P.formData,...B},P.tileset.formData=P.formData,o.value.adjustingModelByCad({...P.formData,tileset:P.tileset}))},F=k=>{if(!a.value)return;const B=g[k];_(a.value,{[k]:B})},U=k=>{const B=r.value.filter(R=>R.selected);if(B.length===0){me.warning("请先选择要调整的模型");return}const{distance:P,heightDistance:V,rotation:G}=g;B.forEach(R=>{const N={...R.formData};switch(k){case"north":N.latitude+=P;break;case"south":N.latitude-=P;break;case"east":N.longitude+=P;break;case"west":N.longitude-=P;break;case"up":N.height+=V;break;case"down":N.height-=V;break;case"rotateLeft":N.totalRotation=(N.totalRotation||0)-G;break;case"rotateRight":N.totalRotation=(N.totalRotation||0)+G;break}R.modelId===a.value&&Object.assign(g,N),_(R.modelId,N)})},L=k=>{const B=k.target.checked;r.value.forEach(P=>P.selected=B)},D=()=>{s("handleSavingByCadCard",r.value),s("save",r.value)},M=()=>{const k=m.bimPoint1,B=m.bimPoint2;if(k.longitude===void 0||B.longitude===void 0){me.warning("请先完成点选操作");return}const P=r.value.filter(O=>O.selected);if(P.length===0){me.warning("请先选择要调整的模型");return}let V=0,G=0,R=0;const N=b();if(N){const{dLon:O,dLat:z,dHeight:j}=N.calculateOffset(k,B);V=O,G=z,R=j}else V=B.longitude-k.longitude,G=B.latitude-k.latitude,R=B.height-k.height;P.forEach(O=>{const z={...O.formData};z.longitude+=V,z.latitude+=G,z.height+=R,O.modelId===a.value&&Object.assign(g,z),_(O.modelId,z)}),me.success("位置已调整")};return d.watch(()=>n.visible,k=>{k?w():(E(),C())}),d.onMounted(()=>{n.visible&&w()}),e({setBIMPointsList:({longitude:k,latitude:B,height:P})=>{m[f.value].longitude=k,m[f.value].latitude=B,m[f.value].height=P},addGltfOr3dTilesModelList:k=>{console.warn("addGltfOr3dTilesModelList is deprecated, use internal loading")}}),(k,B)=>(d.openBlock(),d.createBlock(gt,{visible:n.visible,title:"Cad校准",width:h.value?520:void 0,height:600,"onUpdate:visible":B[22]||(B[22]=P=>s("update:visible",P)),onClose:v},{default:d.withCtx(()=>[d.createElementVNode("div",eP,[d.createElementVNode("div",tP,[d.createElementVNode("div",iP,[B[23]||(B[23]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",nP,[d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="param"}),onClick:B[0]||(B[0]=P=>S("param"))},"参数模式",2),d.createElementVNode("span",{class:d.normalizeClass({active:c.value==="pick"}),onClick:B[1]||(B[1]=P=>S("pick"))},"地图点选",2)])]),d.createElementVNode("div",sP,[B[24]||(B[24]=d.createElementVNode("label",null,"主模型:",-1)),d.createElementVNode("span",{class:"value",title:A.value},d.toDisplayString(A.value||"未选择"),9,oP),d.createElementVNode("button",{class:"toggle-list-btn",onClick:B[2]||(B[2]=P=>h.value=!h.value)},d.toDisplayString(h.value?"收起":"查看详情"),1)]),B[36]||(B[36]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[B[32]||(B[32]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",rP,[B[25]||(B[25]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":B[3]||(B[3]=P=>g.longitude=P),onChange:B[4]||(B[4]=P=>F("longitude")),step:y.value},null,40,aP),[[d.vModelText,g.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",lP,[B[26]||(B[26]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":B[5]||(B[5]=P=>g.latitude=P),onChange:B[6]||(B[6]=P=>F("latitude")),step:y.value},null,40,cP),[[d.vModelText,g.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",dP,[B[27]||(B[27]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":B[7]||(B[7]=P=>g.height=P),onChange:B[8]||(B[8]=P=>F("height")),step:y.value},null,40,hP),[[d.vModelText,g.height,void 0,{number:!0}]])]),d.createElementVNode("div",uP,[B[28]||(B[28]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":B[9]||(B[9]=P=>g.totalRotation=P),onChange:B[10]||(B[10]=P=>F("totalRotation")),step:y.value},null,40,fP),[[d.vModelText,g.totalRotation,void 0,{number:!0}]])]),B[33]||(B[33]=d.createElementVNode("div",{class:"separator"},null,-1)),B[34]||(B[34]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",pP,[B[29]||(B[29]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":B[11]||(B[11]=P=>g.distance=P),step:y.value},null,8,mP),[[d.vModelText,g.distance,void 0,{number:!0}]])]),d.createElementVNode("div",gP,[B[30]||(B[30]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":B[12]||(B[12]=P=>g.heightDistance=P),step:y.value},null,8,yP),[[d.vModelText,g.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",AP,[B[31]||(B[31]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":B[13]||(B[13]=P=>g.rotation=P),step:y.value},null,8,vP),[[d.vModelText,g.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",bP,[d.createElementVNode("button",{onClick:B[14]||(B[14]=P=>U("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:B[15]||(B[15]=P=>U("north"))},"北移"),d.createElementVNode("button",{onClick:B[16]||(B[16]=P=>U("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:B[17]||(B[17]=P=>U("west"))},"西移"),d.createElementVNode("button",{onClick:B[18]||(B[18]=P=>U("south"))},"南移"),d.createElementVNode("button",{onClick:B[19]||(B[19]=P=>U("east"))},"东移"),d.createElementVNode("button",{onClick:B[20]||(B[20]=P=>U("up"))},"上移"),d.createElementVNode("button",{onClick:B[21]||(B[21]=P=>U("down"))},"下移"),d.createElementVNode("button",{onClick:D,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):(d.openBlock(),d.createElementBlock("div",wP,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(m,(P,V)=>(d.openBlock(),d.createElementBlock("div",{key:V,class:"form-item",style:{display:"block","margin-bottom":"15px"}},[d.createElementVNode("div",{style:{"font-weight":"bold","margin-bottom":"5px",cursor:"pointer",display:"flex","align-items":"center"},onClick:G=>u.value=V},[d.createElementVNode("input",{type:"radio",checked:u.value===V,style:{"margin-right":"5px"}},null,8,EP),d.createTextVNode(" "+d.toDisplayString(P.type)+": ",1)],8,CP),d.createElementVNode("div",xP,[d.createElementVNode("div",IP,[d.createElementVNode("label",SP,d.toDisplayString(P.longitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":G=>P.longitude=G,readonly:"",style:{width:"100px"}},null,8,MP),[[d.vModelText,P.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",TP,[d.createElementVNode("label",BP,d.toDisplayString(P.latitudeText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":G=>P.latitude=G,readonly:"",style:{width:"100px"}},null,8,_P),[[d.vModelText,P.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",kP,[d.createElementVNode("label",PP,d.toDisplayString(P.heightText),1),d.withDirectives(d.createElementVNode("input",{type:"number","onUpdate:modelValue":G=>P.height=G,readonly:"",style:{width:"100px"}},null,8,DP),[[d.vModelText,P.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[d.createElementVNode("button",{onClick:M,class:"primary-btn"},"应用校准"),d.createElementVNode("button",{onClick:D},"保存")]),B[35]||(B[35]=d.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 勾选上方 CAD 或 地图 标记点选项。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行校准。")],-1))]))]),d.withDirectives(d.createElementVNode("div",NP,[d.createElementVNode("div",LP,[d.createElementVNode("div",RP,[d.createElementVNode("input",{type:"checkbox",checked:l.value,onChange:L},null,40,FP)]),B[37]||(B[37]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),B[38]||(B[38]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),B[39]||(B[39]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",OP,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(P,V)=>(d.openBlock(),d.createElementBlock("div",{key:P.modelId,class:d.normalizeClass(["list-item",{active:P.modelId===a.value}])},[d.createElementVNode("div",GP,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":G=>P.selected=G},null,8,UP),[[d.vModelCheckbox,P.selected]])]),d.createElementVNode("div",VP,d.toDisplayString(V+1),1),d.createElementVNode("div",{class:"col-name",title:P.modelName},d.toDisplayString(P.modelName),9,QP),d.createElementVNode("div",zP,[d.createElementVNode("input",{type:"radio",name:"mainModel",checked:P.modelId===a.value,onChange:G=>T(P.modelId)},null,40,HP)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",YP,"暂无数据")):d.createCommentVNode("",!0)])],512),[[d.vShow,h.value]])])]),_:1},8,["visible","width"]))}}),[["__scopeId","data-v-db1aee6f"]]),jP={class:"coord-transform-card"},WP={class:"param-row"},qP={class:"param-row"},KP={class:"param-row"},XP={class:"param-row"},JP={class:"param-row"},ZP={class:"param-row"},eD={class:"param-row"},tD={class:"button-grid transform-actions"},iD=Be(d.defineComponent({__name:"LeitingGISCadCoordTransform",emits:["apply-transform","save-position"],setup(i,{emit:e}){const t=e,n=d.inject("leitingMethods"),s=d.ref("projectedToLonlat"),o=d.reactive({centralMeridian:117,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"}),r=()=>{const l=n?.value?.getDefaultGISCadTransformConfig?.()||{centralMeridian:117,latOrigin:0,scaleFactor:1,falseEasting:5e5,falseNorthing:0,ellipsoid:"GRS80"};Object.assign(o,l)},a=()=>{t("apply-transform",{direction:s.value,config:{...o}})};return r(),(l,c)=>(d.openBlock(),d.createElementBlock("div",jP,[d.createElementVNode("div",WP,[c[10]||(c[10]=d.createElementVNode("label",null,"转换方向:",-1)),d.createVNode(d.unref(re.Select),{value:s.value,"onUpdate:value":c[0]||(c[0]=h=>s.value=h),class:"custom-select",popupClassName:"leiting-select-dropdown",size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(re.SelectOption),{value:"projectedToLonlat"},{default:d.withCtx(()=>[...c[8]||(c[8]=[d.createTextVNode("投影转经纬 (根据模型局部坐标)",-1)])]),_:1}),d.createVNode(d.unref(re.SelectOption),{value:"lonlatToProjected"},{default:d.withCtx(()=>[...c[9]||(c[9]=[d.createTextVNode("经纬转投影 (根据模型经纬度)",-1)])]),_:1})]),_:1},8,["value"])]),d.createElementVNode("div",qP,[c[11]||(c[11]=d.createElementVNode("label",null,"中央经线:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>o.centralMeridian=h),type:"number"},null,512),[[d.vModelText,o.centralMeridian,void 0,{number:!0}]])]),d.createElementVNode("div",KP,[c[12]||(c[12]=d.createElementVNode("label",null,"纬度基线:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>o.latOrigin=h),type:"number"},null,512),[[d.vModelText,o.latOrigin,void 0,{number:!0}]])]),d.createElementVNode("div",XP,[c[13]||(c[13]=d.createElementVNode("label",null,"投影比例:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[3]||(c[3]=h=>o.scaleFactor=h),type:"number",step:"0.000001"},null,512),[[d.vModelText,o.scaleFactor,void 0,{number:!0}]])]),d.createElementVNode("div",JP,[c[14]||(c[14]=d.createElementVNode("label",null,"东偏移:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[4]||(c[4]=h=>o.falseEasting=h),type:"number"},null,512),[[d.vModelText,o.falseEasting,void 0,{number:!0}]])]),d.createElementVNode("div",ZP,[c[15]||(c[15]=d.createElementVNode("label",null,"北偏移:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":c[5]||(c[5]=h=>o.falseNorthing=h),type:"number"},null,512),[[d.vModelText,o.falseNorthing,void 0,{number:!0}]])]),d.createElementVNode("div",eD,[c[20]||(c[20]=d.createElementVNode("label",null,"椭球体:",-1)),d.createVNode(d.unref(re.Select),{value:o.ellipsoid,"onUpdate:value":c[6]||(c[6]=h=>o.ellipsoid=h),class:"custom-select",popupClassName:"leiting-select-dropdown",size:"small"},{default:d.withCtx(()=>[d.createVNode(d.unref(re.SelectOption),{value:"GRS80"},{default:d.withCtx(()=>[...c[16]||(c[16]=[d.createTextVNode("CGCS2000 (GRS80)",-1)])]),_:1}),d.createVNode(d.unref(re.SelectOption),{value:"WGS84"},{default:d.withCtx(()=>[...c[17]||(c[17]=[d.createTextVNode("WGS84",-1)])]),_:1}),d.createVNode(d.unref(re.SelectOption),{value:"krass"},{default:d.withCtx(()=>[...c[18]||(c[18]=[d.createTextVNode("北京54 (Krassovsky)",-1)])]),_:1}),d.createVNode(d.unref(re.SelectOption),{value:"IAU76"},{default:d.withCtx(()=>[...c[19]||(c[19]=[d.createTextVNode("西安80 (IAU76)",-1)])]),_:1})]),_:1},8,["value"])]),d.createElementVNode("div",tD,[d.createElementVNode("button",{class:"primary-btn",onClick:a,style:{"grid-column":"span 2"}},"应用到选中模型"),d.createElementVNode("button",{onClick:c[7]||(c[7]=h=>t("save-position"))},"保存位置")]),c[21]||(c[21]=d.createElementVNode("div",{class:"instructions"},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 在列表中勾选需要转换的模型。"),d.createElementVNode("div",null,"2. 配置对应坐标系的转换参数。"),d.createElementVNode("div",null,"3. 点击“应用到选中模型”进行批量转换预览。")],-1))]))}}),[["__scopeId","data-v-f069993f"]]),nD={class:"leiting-giscad-adjustment-panel"},sD={class:"leitingbim-control-panel"},oD={class:"form-item"},rD={class:"radio-group"},aD={class:"form-item"},lD=["title"],cD={class:"param-row"},dD=["step"],hD={class:"param-row"},uD=["step"],fD={class:"param-row"},pD=["step"],mD={class:"param-row"},gD=["step"],yD={class:"param-row"},AD=["step"],vD={class:"param-row"},bD=["step"],wD={class:"param-row"},CD=["step"],ED={class:"param-row"},xD=["step"],ID={class:"param-row"},SD=["step"],MD={class:"button-grid"},TD={class:"action-buttons"},BD={key:1,class:"pick-mode-ui"},_D=["onClick"],kD=["checked","onChange"],PD={class:"pick-point-body"},DD={class:"param-row"},ND={class:"pick-label"},LD=["onUpdate:modelValue"],RD={class:"param-row"},FD={class:"pick-label"},OD=["onUpdate:modelValue"],GD={class:"param-row"},UD={class:"pick-label"},VD=["onUpdate:modelValue"],QD={class:"button-grid pick-button-grid"},zD={class:"list-panel"},HD={class:"list-header"},YD={class:"col-check"},$D=["checked"],jD={class:"list-body"},WD={class:"col-check"},qD=["onUpdate:modelValue"],KD={class:"col-index"},XD=["title"],JD={class:"col-main"},ZD=["checked","onChange"],eN={key:0,class:"empty-text"},tN=Be(d.defineComponent({__name:"LeitingGISCadPosition",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(1e-6),r=d.ref([]),a=d.ref(""),l=d.ref("param"),c=d.ref(!1),h=d.ref("cadPoint"),u=d.ref(null),p=d.reactive({cadPoint:{longitude:void 0,latitude:void 0,height:void 0,type:"CAD标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程"},mapPoint:{longitude:void 0,latitude:void 0,height:void 0,type:"地图标记点",longitudeText:"经度",latitudeText:"纬度",heightText:"高程"}}),f=d.reactive({modelId:"",longitude:0,latitude:0,height:0,totalRotation:0,scale:1,distance:1e-4,heightDistance:1,rotation:1,scaleStep:.1,localOriginX:0,localOriginY:0,clampToGround:!1}),m=d.computed(()=>r.value.length>0&&r.value.every(N=>N.selected)),y=d.computed(()=>r.value.find(N=>N.modelId===a.value)?.modelName||""),g=()=>(!u.value&&s?.value?.getViewer&&s?.value?.getCesium&&(u.value=new vc(s.value.getViewer(),s.value.getCesium())),u.value),A=()=>{p.cadPoint.longitude=void 0,p.cadPoint.latitude=void 0,p.cadPoint.height=void 0,p.mapPoint.longitude=void 0,p.mapPoint.latitude=void 0,p.mapPoint.height=void 0},v=()=>{u.value?.clearMarkers(),A()},b=N=>{const O=h.value,z=p[O];z&&(z.longitude=N.longitude,z.latitude=N.latitude,z.height=N.height,g()?.addMarker(O==="cadPoint"?"BIM":"MAP",N),me.success(`${z.type}已添加`))},C=()=>{g()?.registerPickHandler(O=>{b(O)})},x=()=>{u.value?.destroyPickHandler()},I=N=>{l.value=N},E=N=>{(N==="cadPoint"||N==="mapPoint")&&(h.value=N)},S=N=>{const O=N?.editingFormData||N?.formData||{};return{modelId:N?.modelId||"",longitude:Number(O.longitude??0),latitude:Number(O.latitude??0),height:Number(O.height??0),totalRotation:Number(O.totalRotation??0),scale:Math.max(1e-6,Number(O.scale??1)),distance:Number(O.distance??1e-6),heightDistance:Number(O.heightDistance??1),rotation:Number(O.rotation??1),scaleStep:Number(O.scaleStep??.1),localOriginX:Number(O.localOriginX??0),localOriginY:Number(O.localOriginY??0),transformConfig:O.transformConfig||void 0,transformDirection:O.transformDirection||void 0,clampToGround:O.clampToGround??!1}},w=()=>{const N=r.value.find(O=>O.modelId===a.value);N&&Object.assign(f,N.formData,{modelId:N.modelId})},T=()=>{if(!s?.value?.getGISCadModels){r.value=[];return}const N=new Map(r.value.map(te=>[te.modelId,te.selected])),O=s.value.getGISCadModels()||[];if(r.value=Array.isArray(O)?O.map(te=>({modelId:te.modelId,modelName:te.modelName,selected:N.get(te.modelId)??!0,runtimeModel:te,formData:S(te)})):[],!r.value.length){a.value="";return}const z=r.value[0];if(!z)return;const j=s.value.getGISCadModelId?.()||a.value||z.modelId,Z=r.value.find(te=>te.modelId===j);a.value=Z?.modelId||z.modelId,w()},_=N=>{a.value=N,w()},F=(N,O)=>{if(!s?.value?.adjustGISCadModel)return null;s.value.beginEditGISCad?.({modelId:N});const z=s.value.adjustGISCadModel({modelId:N,...O}),j=r.value.find(Z=>Z.modelId===N);return j&&z&&(j.formData={...j.formData,...z,modelId:N},j.runtimeModel={...j.runtimeModel,editingFormData:z,isEditing:!0}),N===a.value&&Object.assign(f,j?.formData||f,{modelId:N}),z},U=N=>{if(!a.value)return;const O=r.value.find(te=>te.modelId===a.value);if(!O)return;if(N==="clampToGround"){const te=!!f[N];F(a.value,{[N]:te}),r.value.filter(de=>de.selected&&de.modelId!==a.value).forEach(de=>{F(de.modelId,{[N]:te})});return}const z=Number(f[N]),j=Number(O.formData[N]),Z=z-j;F(a.value,{[N]:N==="scale"?Math.max(1e-6,z):z}),!(Z===0||N==="scale")&&r.value.filter(te=>te.selected&&te.modelId!==a.value).forEach(te=>{F(te.modelId,{[N]:Number(te.formData[N])+Z})})},L=N=>{const O=r.value.filter(z=>z.selected);if(!O.length){me.warning("请先选择要调整的模型");return}O.forEach(z=>{const j={...z.formData};switch(N){case"north":j.latitude+=f.distance;break;case"south":j.latitude-=f.distance;break;case"east":j.longitude+=f.distance;break;case"west":j.longitude-=f.distance;break;case"up":j.height+=f.heightDistance;break;case"down":j.height-=f.heightDistance;break;case"rotateLeft":j.totalRotation-=f.rotation;break;case"rotateRight":j.totalRotation+=f.rotation;break;case"scaleUp":j.scale=Math.max(1e-6,j.scale+f.scaleStep);break;case"scaleDown":j.scale=Math.max(1e-6,j.scale-f.scaleStep);break;default:return}j.distance=f.distance,j.heightDistance=f.heightDistance,j.rotation=f.rotation,j.scaleStep=f.scaleStep,F(z.modelId,j)})},D=({direction:N,config:O})=>{const z=r.value.filter(te=>te.selected);if(!z.length){me.warning("请先选择要转换的模型");return}if(!s?.value?.transformGISCadCoordinate){me.warning("未找到 GIS CAD 坐标转换方法");return}let Z=0;z.forEach(te=>{try{const de=Number(te.formData.localOriginX),pe=Number(te.formData.localOriginY);let Ae={longitude:te.formData.longitude,latitude:te.formData.latitude};const Pe=s?.value?.transformGISCadCoordinate;if(Pe){const Ge=Pe({direction:N,...N==="projectedToLonlat"?{x:de,y:pe}:{longitude:te.formData.longitude,latitude:te.formData.latitude},config:{...O}});N==="projectedToLonlat"&&Ge.longitude&&(Ae.longitude=Ge.longitude,Ae.latitude=Ge.latitude)}F(te.modelId,{transformConfig:{...O},transformDirection:N,longitude:Ae.longitude,latitude:Ae.latitude}),Z++}catch(de){console.warn("Transform failed for model",te.modelId,de)}}),Z>0?me.success(`已成功转换 ${Z} 个模型的坐标并重新加载,请预览后提交贴地`):me.error("坐标转换失败,请检查参数或模型状态")},M=()=>{f.clampToGround=!f.clampToGround,U("clampToGround")},k=()=>{const N=p.cadPoint,O=p.mapPoint;if(N.longitude===void 0||N.latitude===void 0||N.height===void 0||O.longitude===void 0||O.latitude===void 0||O.height===void 0){me.warning("请先完成 CAD 和地图点位采集");return}const j=r.value.filter(pe=>pe.selected);if(!j.length){me.warning("请先选择要调整的模型");return}const{dLon:Z,dLat:te,dHeight:de}=g()?.calculateOffset(N,O)||{dLon:O.longitude-N.longitude,dLat:O.latitude-N.latitude,dHeight:O.height-N.height};j.forEach(pe=>{F(pe.modelId,{longitude:Number(pe.formData.longitude)+Z,latitude:Number(pe.formData.latitude)+te,height:Number(pe.formData.height)+de})}),me.success("点选校准预览已更新")},B=()=>{const N=r.value.filter(z=>z.selected);if(!N.length){me.warning("请先选择要提交的模型");return}const O=[];N.forEach(z=>{const j=s?.value?.commitEditGISCad?.({modelId:z.modelId});j&&j.formData&&O.push({modelId:j.modelId,formData:j.formData})}),T(),O.length>0&&s?.value?.onGISCadPositionChange&&s.value.onGISCadPositionChange(O),me.success("GIS CAD 保存成功")},P=()=>{r.value.forEach(N=>{s?.value?.cancelEditGISCad?.({modelId:N.modelId})})},V=()=>{if(!a.value){me.warning("请先选择主模型");return}if(!s?.value?.flyToGISCadModel){me.warning("飞转方法不可用");return}s.value.flyToGISCadModel({modelId:a.value,duration:1.5})},G=N=>{const O=N.target.checked;r.value.forEach(z=>{z.selected=O})},R=()=>{P(),x(),v(),n("update:visible",!1)};return d.watch(l,N=>{t.visible&&(N==="pick"?C():x())}),d.watch(()=>t.visible,N=>{N?(T(),l.value==="pick"&&C()):(x(),v(),P(),T())}),d.onMounted(()=>{t.visible&&(T(),l.value==="pick"&&C())}),d.onUnmounted(()=>{x(),v(),P()}),(N,O)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"GIS CAD调整",width:c.value?580:340,"onUpdate:visible":O[28]||(O[28]=z=>n("update:visible",z)),onClose:R},{default:d.withCtx(()=>[d.createElementVNode("div",nD,[d.createElementVNode("div",sD,[d.createElementVNode("div",oD,[O[29]||(O[29]=d.createElementVNode("label",null,"调整操作:",-1)),d.createElementVNode("div",rD,[d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="param"}),onClick:O[0]||(O[0]=z=>I("param"))}," 参数模式 ",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="pick"}),onClick:O[1]||(O[1]=z=>I("pick"))}," 地图点选 ",2),d.createElementVNode("span",{class:d.normalizeClass({active:l.value==="transform"}),onClick:O[2]||(O[2]=z=>I("transform"))}," 坐标转换 ",2)])]),d.createElementVNode("div",aD,[O[30]||(O[30]=d.createElementVNode("label",null,"主模型:",-1)),d.createElementVNode("span",{class:"value",title:y.value},d.toDisplayString(y.value||"未选择"),9,lD),d.createElementVNode("button",{class:"toggle-list-btn",onClick:O[3]||(O[3]=z=>c.value=!c.value)},d.toDisplayString(c.value?"收起":"查看详情"),1)]),O[44]||(O[44]=d.createElementVNode("div",{class:"separator"},null,-1)),l.value==="param"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[O[40]||(O[40]=d.createElementVNode("div",{class:"group-header"},"当前状态",-1)),d.createElementVNode("div",cD,[O[31]||(O[31]=d.createElementVNode("label",null,"经度(东西):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[4]||(O[4]=z=>f.longitude=z),type:"number",step:o.value,onChange:O[5]||(O[5]=z=>U("longitude"))},null,40,dD),[[d.vModelText,f.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",hD,[O[32]||(O[32]=d.createElementVNode("label",null,"纬度(南北):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[6]||(O[6]=z=>f.latitude=z),type:"number",step:o.value,onChange:O[7]||(O[7]=z=>U("latitude"))},null,40,uD),[[d.vModelText,f.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",fD,[O[33]||(O[33]=d.createElementVNode("label",null,"高度(m):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[8]||(O[8]=z=>f.height=z),type:"number",step:o.value,onChange:O[9]||(O[9]=z=>U("height"))},null,40,pD),[[d.vModelText,f.height,void 0,{number:!0}]])]),d.createElementVNode("div",mD,[O[34]||(O[34]=d.createElementVNode("label",null,"累计旋转(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[10]||(O[10]=z=>f.totalRotation=z),type:"number",step:o.value,onChange:O[11]||(O[11]=z=>U("totalRotation"))},null,40,gD),[[d.vModelText,f.totalRotation,void 0,{number:!0}]])]),d.createElementVNode("div",yD,[O[35]||(O[35]=d.createElementVNode("label",null,"缩放比例:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[12]||(O[12]=z=>f.scale=z),type:"number",min:"0.000001",step:o.value,onChange:O[13]||(O[13]=z=>U("scale"))},null,40,AD),[[d.vModelText,f.scale,void 0,{number:!0}]])]),O[41]||(O[41]=d.createElementVNode("div",{class:"separator"},null,-1)),O[42]||(O[42]=d.createElementVNode("div",{class:"group-header"},"调整步长",-1)),d.createElementVNode("div",vD,[O[36]||(O[36]=d.createElementVNode("label",null,"经纬步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[14]||(O[14]=z=>f.distance=z),type:"number",step:o.value},null,8,bD),[[d.vModelText,f.distance,void 0,{number:!0}]])]),d.createElementVNode("div",wD,[O[37]||(O[37]=d.createElementVNode("label",null,"高度步长(m):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[15]||(O[15]=z=>f.heightDistance=z),type:"number",step:o.value},null,8,CD),[[d.vModelText,f.heightDistance,void 0,{number:!0}]])]),d.createElementVNode("div",ED,[O[38]||(O[38]=d.createElementVNode("label",null,"旋转步长(°):",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[16]||(O[16]=z=>f.rotation=z),type:"number",step:o.value},null,8,xD),[[d.vModelText,f.rotation,void 0,{number:!0}]])]),d.createElementVNode("div",ID,[O[39]||(O[39]=d.createElementVNode("label",null,"缩放步长:",-1)),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":O[17]||(O[17]=z=>f.scaleStep=z),type:"number",step:o.value},null,8,SD),[[d.vModelText,f.scaleStep,void 0,{number:!0}]])]),d.createElementVNode("div",MD,[d.createElementVNode("button",{onClick:O[18]||(O[18]=z=>L("rotateLeft"))},"左转"),d.createElementVNode("button",{onClick:O[19]||(O[19]=z=>L("north"))},"北移"),d.createElementVNode("button",{onClick:O[20]||(O[20]=z=>L("rotateRight"))},"右转"),d.createElementVNode("button",{onClick:O[21]||(O[21]=z=>L("west"))},"西移"),d.createElementVNode("button",{onClick:O[22]||(O[22]=z=>L("south"))},"南移"),d.createElementVNode("button",{onClick:O[23]||(O[23]=z=>L("east"))},"东移"),d.createElementVNode("button",{onClick:O[24]||(O[24]=z=>L("up"))},"上移"),d.createElementVNode("button",{onClick:O[25]||(O[25]=z=>L("scaleDown"))},"缩小"),d.createElementVNode("button",{onClick:O[26]||(O[26]=z=>L("scaleUp"))},"放大"),d.createElementVNode("button",{onClick:O[27]||(O[27]=z=>L("down"))},"下移")]),d.createElementVNode("div",TD,[d.createElementVNode("button",{class:d.normalizeClass({"primary-btn":f.clampToGround}),onClick:M}," 贴地 ",2),d.createElementVNode("button",{onClick:B},"保存位置"),d.createElementVNode("button",{onClick:V},"正北俯视")])],64)):l.value==="pick"?(d.openBlock(),d.createElementBlock("div",BD,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p,(z,j)=>(d.openBlock(),d.createElementBlock("div",{key:j,class:"pick-point-item"},[d.createElementVNode("div",{class:"pick-point-title",onClick:Z=>E(j)},[d.createElementVNode("input",{type:"radio",name:"gisCadPickPoint",checked:h.value===j,onChange:Z=>E(j)},null,40,kD),d.createElementVNode("span",null,d.toDisplayString(z.type)+":",1)],8,_D),d.createElementVNode("div",PD,[d.createElementVNode("div",DD,[d.createElementVNode("label",ND,d.toDisplayString(z.longitudeText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":Z=>z.longitude=Z,type:"number",readonly:""},null,8,LD),[[d.vModelText,z.longitude,void 0,{number:!0}]])]),d.createElementVNode("div",RD,[d.createElementVNode("label",FD,d.toDisplayString(z.latitudeText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":Z=>z.latitude=Z,type:"number",readonly:""},null,8,OD),[[d.vModelText,z.latitude,void 0,{number:!0}]])]),d.createElementVNode("div",GD,[d.createElementVNode("label",UD,d.toDisplayString(z.heightText),1),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":Z=>z.height=Z,type:"number",readonly:""},null,8,VD),[[d.vModelText,z.height,void 0,{number:!0}]])])])]))),128)),d.createElementVNode("div",QD,[d.createElementVNode("button",{class:"primary-btn",onClick:k},"应用校准"),d.createElementVNode("button",{class:d.normalizeClass({"primary-btn":f.clampToGround}),onClick:M}," 贴地 ",2),d.createElementVNode("button",{onClick:B},"保存位置"),d.createElementVNode("button",{onClick:V},"正北俯视")]),O[43]||(O[43]=d.createElementVNode("div",{class:"instructions"},[d.createElementVNode("div",null,"操作指南:"),d.createElementVNode("div",null,"1. 先选择上方 CAD 标记点或地图标记点。"),d.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),d.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行预览。"),d.createElementVNode("div",null,"4. 确认结果后,点击“提交贴地”生效。")],-1))])):l.value==="transform"?(d.openBlock(),d.createBlock(iD,{key:2,onApplyTransform:D,onSavePosition:B})):d.createCommentVNode("",!0)]),d.withDirectives(d.createElementVNode("div",zD,[d.createElementVNode("div",HD,[d.createElementVNode("div",YD,[d.createElementVNode("input",{type:"checkbox",checked:m.value,onChange:G},null,40,$D)]),O[45]||(O[45]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),O[46]||(O[46]=d.createElementVNode("div",{class:"col-name"},"名称",-1)),O[47]||(O[47]=d.createElementVNode("div",{class:"col-main"},"主模型",-1))]),d.createElementVNode("div",jD,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.value,(z,j)=>(d.openBlock(),d.createElementBlock("div",{key:z.modelId,class:d.normalizeClass(["list-item",{active:z.modelId===a.value}])},[d.createElementVNode("div",WD,[d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":Z=>z.selected=Z,type:"checkbox"},null,8,qD),[[d.vModelCheckbox,z.selected]])]),d.createElementVNode("div",KD,d.toDisplayString(j+1),1),d.createElementVNode("div",{class:"col-name",title:z.modelName},d.toDisplayString(z.modelName),9,XD),d.createElementVNode("div",JD,[d.createElementVNode("input",{checked:z.modelId===a.value,type:"radio",name:"gisCadMainModel",onChange:Z=>_(z.modelId)},null,40,ZD)])],2))),128)),r.value.length===0?(d.openBlock(),d.createElementBlock("div",eN,"暂无 GIS CAD 数据")):d.createCommentVNode("",!0)])],512),[[d.vShow,c.value]])])]),_:1},8,["visible","width"]))}}),[["__scopeId","data-v-0380ba06"]]),iN={class:"annotation-content"},nN={class:"annotation-tools"},sN={class:"annotation-controls"},oN={class:"control-group",title:"颜色"},rN={class:"tool-item color-tool"},aN={class:"control-group line-width-container",title:"线宽"},lN=["onClick"],cN={class:"option-label"},dN=Be(d.defineComponent({__name:"LeitingAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),a=d.ref(1),l=d.ref(!1),c=d.ref(null),h=d.ref(null),u=d.ref({top:"0px",left:"0px"}),p=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],f=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,m=()=>{n("update:visible",!1)},y=E=>{o.value=E;const S=f();if(S)switch(E){case"freehandLine":S.startFreehandLine();break;case"arrow":S.startArrow();break;case"straightLine":S.startStraightLine();break;case"rectangle":S.startRectangle();break;case"ellipse":S.startEllipse();break}},g=()=>{const E=f();E&&(E.setCurrentColor(r.value),E.changeColor(r.value))},A=()=>{if(!l.value&&c.value){const E=c.value.getBoundingClientRect();u.value={top:`${E.top}px`,left:`${E.right+8}px`}}l.value=!l.value},v=E=>{a.value=E,l.value=!1;const S=f();S&&(S.setCurrentWidth(E),S.changeWidth(E))},b=()=>{const E=f();E&&E.deleteSelectedEntity()},C=()=>{const E=f();E&&E.clearAll()},x=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const E=f();E&&E.saveAnnotations()},I=E=>{const S=E.target,w=c.value&&c.value.contains(S),T=h.value&&h.value.contains(S);!w&&!T&&(l.value=!1)};return d.onMounted(()=>{document.addEventListener("click",I)}),d.onUnmounted(()=>{document.removeEventListener("click",I)}),(E,S)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"标注",width:70,"min-width":70,height:480,"onUpdate:visible":S[6]||(S[6]=w=>n("update:visible",w)),onClose:m},{default:d.withCtx(()=>[d.createElementVNode("div",iN,[d.createElementVNode("div",nN,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="freehandLine"}]),onClick:S[0]||(S[0]=w=>y("freehandLine")),title:"手绘线"},[...S[7]||(S[7]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="arrow"}]),onClick:S[1]||(S[1]=w=>y("arrow")),title:"箭头"},[...S[8]||(S[8]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="straightLine"}]),onClick:S[2]||(S[2]=w=>y("straightLine")),title:"直线"},[...S[9]||(S[9]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="rectangle"}]),onClick:S[3]||(S[3]=w=>y("rectangle")),title:"矩形"},[...S[10]||(S[10]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:o.value==="ellipse"}]),onClick:S[4]||(S[4]=w=>y("ellipse")),title:"椭圆"},[...S[11]||(S[11]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1)])],2)]),S[13]||(S[13]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",sN,[d.createElementVNode("div",oN,[d.createElementVNode("div",rN,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":S[5]||(S[5]=w=>r.value=w),onChange:g,class:"color-input-overlay"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",aN,[d.createElementVNode("div",{ref_key:"lineWidthBtnRef",ref:c,class:"tool-item",onClick:d.withModifiers(A,["stop"])},[d.createElementVNode("div",{class:"current-width-preview",style:d.normalizeStyle({height:a.value+"px",backgroundColor:"#fff"})},null,4)],512),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[l.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"line-width-dropdown",style:d.normalizeStyle(u.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(p,w=>d.createElementVNode("div",{key:w.value,class:d.normalizeClass(["line-width-option",{selected:a.value===w.value}]),onClick:d.withModifiers(T=>v(w.value),["stop"])},[d.createElementVNode("span",cN,d.toDisplayString(w.label),1),d.createElementVNode("div",{class:"line-preview",style:d.normalizeStyle({height:w.value+"px",backgroundColor:a.value===w.value?"#1890ff":"#ddd"})},null,4)],10,lN)),64))],4)):d.createCommentVNode("",!0)]))]),S[12]||(S[12]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("button",{class:"control-btn",onClick:b,title:"删除选中"}," 🗑️ "),d.createElementVNode("button",{class:"control-btn",onClick:C,title:"清空"}," ❌ "),d.createElementVNode("button",{class:"control-btn",onClick:x,title:"保存"}," 💾 ")])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-3cfc8415"]]),hN={class:"measure-content"},uN={class:"measure-tools"},fN={key:0,class:"measure-results"},pN={class:"result-row"},mN={class:"result-value"},gN={class:"result-row"},yN={class:"result-value"},AN={class:"result-row"},vN={class:"result-value"},bN={class:"result-row"},wN={class:"result-value"},CN={key:1,class:"result-row"},EN={class:"result-value"},xN={key:2,class:"result-row"},IN={class:"result-value"},SN={class:"measure-controls"},MN={class:"control-group",title:"单位"},TN={class:"unit-display"},BN=["onClick"],_N=Be(d.defineComponent({__name:"LeitingMeasurement",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(null),r=d.ref(null),a=d.ref("m"),l=d.ref(!1),c=d.ref(null),h=d.ref(!1),u=d.ref({}),p=d.ref(null),f=[{label:"米 (m)",value:"m"},{label:"厘米 (cm)",value:"cm"},{label:"毫米 (mm)",value:"mm"}],m=E=>{const S=a.value;return S==="mm"?`${(E*1e3).toFixed(0)}mm`:S==="cm"?`${(E*100).toFixed(1)}cm`:`${E.toFixed(2)}m`},y=E=>E>1e6?`${(E/1e6).toFixed(2)} km²`:`${E.toFixed(2)} m²`,g=()=>{if(!o.value&&s.value?.getViewer){const E=s.value.getViewer(),S=s.value.getCesium();E&&S&&(o.value=new pc({viewer:E,cesium:S}),o.value.setUnit(a.value),o.value.setSnapping(l.value),o.value.onMeasure=w=>{c.value=w})}},A=E=>{o.value||g(),r.value===E?(r.value=null,o.value?.stop(),s.value?.baseCompt?.enableSelection()):(r.value=E,o.value?.start(E),s.value?.baseCompt?.disableSelection())},v=E=>{a.value=E,h.value=!1},b=()=>{o.value&&(o.value.clearAll(),r.value=null,o.value.stop()),s.value?.baseCompt?.enableSelection()},C=()=>{n("update:visible",!1)},x=E=>{if(h.value){h.value=!1;return}const w=E.currentTarget.getBoundingClientRect();u.value={position:"fixed",top:`${w.top}px`,left:`${w.right+5}px`,zIndex:3e3},h.value=!0},I=E=>{h.value&&p.value&&!p.value.contains(E.target)&&(h.value=!1)};return d.onMounted(()=>{document.addEventListener("click",I),t.visible&&d.nextTick(()=>g())}),d.onUnmounted(()=>{document.removeEventListener("click",I),o.value&&o.value.destroy()}),d.watch(()=>t.visible,E=>{E?d.nextTick(()=>g()):o.value&&(o.value.stop(),r.value=null)}),d.watch(s,E=>{E&&E.getViewer&&!o.value&&t.visible&&g()}),d.watch(a,E=>{o.value&&o.value.setUnit(E)}),(E,S)=>(d.openBlock(),d.createBlock(gt,{visible:t.visible,title:"量算",width:70,"min-width":70,height:480,"onUpdate:visible":S[3]||(S[3]=w=>n("update:visible",w)),onClose:C},{default:d.withCtx(()=>[d.createElementVNode("div",hN,[d.createElementVNode("div",uN,[d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="distance"}]),onClick:S[0]||(S[0]=w=>A("distance")),title:"距离测量"},[...S[4]||(S[4]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="angle"}]),onClick:S[1]||(S[1]=w=>A("angle")),title:"角度测量"},[...S[5]||(S[5]=[d.createElementVNode("div",{class:"tool-icon"},"📐",-1)])],2),d.createElementVNode("div",{class:d.normalizeClass(["tool-item",{active:r.value==="area"}]),onClick:S[2]||(S[2]=w=>A("area")),title:"面积测量"},[...S[6]||(S[6]=[d.createElementVNode("div",{class:"tool-icon"},"🔳",-1)])],2)]),S[15]||(S[15]=d.createElementVNode("div",{class:"separator"},null,-1)),c.value?(d.openBlock(),d.createElementBlock("div",fN,[c.value.type==="distance"?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[d.createElementVNode("div",pN,[S[7]||(S[7]=d.createElementVNode("span",{class:"result-label"},"总长:",-1)),d.createElementVNode("span",mN,d.toDisplayString(m(c.value.dist)),1)]),d.createElementVNode("div",gN,[S[8]||(S[8]=d.createElementVNode("span",{class:"result-label",style:{color:"#ff4d4f"}},"ΔX:",-1)),d.createElementVNode("span",yN,d.toDisplayString(m(c.value.dx)),1)]),d.createElementVNode("div",AN,[S[9]||(S[9]=d.createElementVNode("span",{class:"result-label",style:{color:"#52c41a"}},"ΔY:",-1)),d.createElementVNode("span",vN,d.toDisplayString(m(c.value.dy)),1)]),d.createElementVNode("div",bN,[S[10]||(S[10]=d.createElementVNode("span",{class:"result-label",style:{color:"#1890ff"}},"ΔZ:",-1)),d.createElementVNode("span",wN,d.toDisplayString(m(c.value.dz)),1)])],64)):d.createCommentVNode("",!0),c.value.type==="angle"?(d.openBlock(),d.createElementBlock("div",CN,[S[11]||(S[11]=d.createElementVNode("span",{class:"result-label"},"角度:",-1)),d.createElementVNode("span",EN,d.toDisplayString(c.value.angle.toFixed(1))+"°",1)])):d.createCommentVNode("",!0),c.value.type==="area"?(d.openBlock(),d.createElementBlock("div",xN,[S[12]||(S[12]=d.createElementVNode("span",{class:"result-label"},"面积:",-1)),d.createElementVNode("span",IN,d.toDisplayString(y(c.value.area)),1)])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0),d.createElementVNode("div",SN,[d.createElementVNode("div",MN,[d.createElementVNode("div",{class:"tool-item",onClick:d.withModifiers(x,["stop"])},[d.createElementVNode("div",TN,d.toDisplayString(a.value),1)]),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[h.value?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"unitDropdownRef",ref:p,class:"unit-dropdown",style:d.normalizeStyle(u.value)},[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(f,w=>d.createElementVNode("div",{key:w.value,class:d.normalizeClass(["unit-option",{selected:a.value===w.value}]),onClick:d.withModifiers(T=>v(w.value),["stop"])},d.toDisplayString(w.label),11,BN)),64))],4)):d.createCommentVNode("",!0)]))]),S[14]||(S[14]=d.createElementVNode("div",{class:"separator"},null,-1)),d.createElementVNode("div",{class:"action-buttons"},[d.createElementVNode("div",{class:"tool-item control-btn",onClick:b,title:"清空"},[...S[13]||(S[13]=[d.createElementVNode("div",{class:"tool-icon"},"🗑️",-1)])])])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-8b1e070f"]]);function Bm(){const i=d.ref(!1),e=d.reactive({x:0,y:0}),t=d.ref([]),n=d.ref(null);return{visible:i,position:e,items:t,contextData:n,show:(l,c,h)=>{l instanceof MouseEvent?(l.preventDefault(),e.x=l.clientX,e.y=l.clientY):(e.x=l.x,e.y=l.y),t.value=c,n.value=h,i.value=!0},hide:()=>{i.value=!1},addItem:l=>{t.value.push(l)},removeItem:l=>{t.value=t.value.filter(c=>c.id!==l)}}}const kN=["onClick","onTouchend"],PN={class:"menu-label"},DN={key:0,class:"menu-arrow"},NN=Be(d.defineComponent({__name:"LeitingContextMenu",props:{visible:{type:Boolean},position:{},items:{}},emits:["update:visible","action"],setup(i,{emit:e}){const t=i,n=e,{isMobile:s}=Or(),o=d.computed(()=>{let l=t.position.x,c=t.position.y;if(s.value){const u=t.items.length*48;l+200>window.innerWidth-16&&(l=window.innerWidth-200-16),c+u>window.innerHeight-16&&(c=window.innerHeight-u-16),c<16&&(c=16)}return{left:l+"px",top:c+"px"}}),r=l=>{l.disabled||(l.action&&l.action(),n("action",l),n("update:visible",!1))},a=()=>{t.visible&&n("update:visible",!1)};return d.onMounted(()=>{document.addEventListener("click",a),document.addEventListener("contextmenu",l=>{l.target.closest(".leiting-context-menu")||a()})}),d.onUnmounted(()=>{document.removeEventListener("click",a)}),(l,c)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-context-menu",{"mobile-style":d.unref(s)}]),style:d.normalizeStyle(o.value),onContextmenu:c[0]||(c[0]=d.withModifiers(()=>{},["prevent"]))},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.items,h=>(d.openBlock(),d.createElementBlock("div",{key:h.id,class:d.normalizeClass(["menu-item",{"menu-divided":h.divided,"menu-disabled":h.disabled}]),onClick:u=>r(h),onTouchend:d.withModifiers(u=>r(h),["prevent"])},[d.createElementVNode("span",PN,d.toDisplayString(h.label),1),h.children?(d.openBlock(),d.createElementBlock("span",DN,"▶")):d.createCommentVNode("",!0)],42,kN))),128))],38)),[[d.vShow,i.visible]])}}),[["__scopeId","data-v-62c220a6"]]),LN={class:"mobile-nav-root"},RN={class:"nav-bar-container"},FN={key:"sub-mode",class:"nav-inner sub-menu-wrapper"},ON={class:"sub-icons-list"},GN=["onClick"],UN=["innerHTML"],VN={key:"main-mode",class:"nav-inner main-menu-wrapper"},QN=["onClick"],zN=["src","alt"],_m=Be(d.defineComponent({__name:"MobileBottomNav",props:{activeIds:{},is2d:{type:Boolean},customItems:{}},emits:["item-click","sub-item-click","clear-measure"],setup(i,{emit:e}){const t=i,n=e,s=d.ref(null),o=d.ref(null),r={measure:[{id:"distance",label:"距离",parentId:"measure",parentKey:"measurement"},{id:"angle",label:"角度",parentId:"measure",parentKey:"measurement"},{id:"area",label:"面积",parentId:"measure",parentKey:"measurement"},{id:"coordinate",label:"坐标",parentId:"measure",parentKey:"measurement"}],section:[{id:"box",label:"剖切盒",parentId:"section",parentKey:"section"},{id:"plane-x",label:"X轴",parentId:"section",parentKey:"section"},{id:"plane-y",label:"Y轴",parentId:"section",parentKey:"section"}]},a={distance:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 17l6-6 4 4 8-8"/><path d="M17 7h4v4"/></svg>',angle:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 20H4L14 4"/></svg>',area:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>',coordinate:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v20M2 12h20"/></svg>',box:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/></svg>'},l=g=>a[g]||a.box,c=d.ref([{ID:"home",title:"主视角",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"homeView"},{ID:"measure",title:"量算",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFESURBVDhPlZMNEcIwDIVXBQwFgAJAAcMBDgAFIGE4wAHgABSwOdgcIAEUjPd6aS/rfhi7y12bJl9f0sxEf3xVVV0RPoetjTFvnWqGcgSylfgihA0CKcgJgBfsAqMiKiM0+gkKlCyZCN8uhPWCFOSBxARWORU4W2CdeV9XjxSEJcwkjokTqBpzjxjCn7CyVRECzjg8wHLYCmabK7CplBcLhMr2DZCqP0dCovYZ9hYGXx1izLUGUkkfxI/sTQiCf4N1zLWAWCKV2nP6PEhB2Ngd7B4GC4SJnCcP8SAFoc/Ph/TqjVvTPogFKUiJ/VGU+GdmUAA5ObA7cyC+iPt/MjUfKRL4emyuK+cGH8tufFRUHywZ+RYlnRDdIwfzLzVUibtQv1oNhoAExtfpVdIAiQIOWiY9o2sQxJemOydTS1jR1di2Zn8B8f27apou9kMAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"measurement"},{ID:"roam",title:"漫游",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"roam"},{ID:"info",title:"信息",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"componentInfo"},{ID:"setting",title:"设置",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGPSURBVDhPrZT9UQIxEMUvFSgViBUoFQgVABV4VqBW4FmBUIFQgZRwVqBU4HUAVHC+X2aXycQw/sPOvLncZvdlv5JQFaTv+1upp8IyhLDHRLpLfe6FrXRt7hZShYyH+n8RauGAv/AkQNYIHICshFcRdu6fE/kGRN/mQGTIpzAzMoh6EV2fIsJ5IwNOj2IpVZ6i6difSecRVnlELZHIgHROisgXRCa78Z+IrMBf2pjLYJNENGSd1kO2pPghjKQniyqY8lFr2NfaqC18wn7nZCMlWg7xLq70TxfRLyHqtABN2lbp40mSSCzBcSebif1TPyKjDBcQ0eJJRkIUpHkMPUlnkBU+pnlWItL6ERgw8o1iqRHtgzAUGNRD2qmkvgMvNnneUQcZ4ggR6VGXG+OOA1koNvrFcY7+af++VJe0hucfyKQu+RWJc+SDZ3aNvlPpRl7T0qXdafNZYPDehLEZt/rOBR9U8QSaEKX0jHAaE4tshVrgLeJ+Xdl6rS8D3BWJXKnCEwWXEuco9grQ3bb0sP0Cn8/nPm/SMRQAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"setting"}]),h=d.ref([{ID:"home",title:"主视角",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoROakhe0HDeQmbQfFzTxJj+zTXYg1kWrarISRFKzLNAfGsbL9iDzq/0j+kQZ/k1wm7onoKW3Hq42F0jLVK//Tcebott2fJAbVK1lvKwBNd6rRIsFsfJka0G2qdpQPy7+EPC0AumexKAzoH5FbgvSbHuUW6EOYubbfwX0cLPfFJS4K6mPNrbdHb+uvP498dhVn4v9FWo9V3RZzFxAv8L9AAAAAElFTkSuQmCC",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"homeView"},{ID:"cadLayer",title:"CAD图层",src:Ur,key:"cadLayer"},{ID:"annotation",title:"标注",src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_e&&_e.tagName.toUpperCase()==="SCRIPT"&&_e.src||new URL("leiting-bim.umd.js",document.baseURI).href).href,key:"annotation"}]),u=d.computed(()=>{let A=[...t.is2d?h.value:c.value];return t.customItems&&(A=[...A,...t.customItems]),A}),p=d.computed(()=>s.value?r[s.value.ID]||[]:[]),f=g=>{if(r[g.ID]){if(g.ID==="measure"){n("item-click",g);return}if(s.value?.ID===g.ID)y();else{s.value=g,o.value=null;const A=r[g.ID];A&&A.length>0&&(o.value=A[0]?.id??null,setTimeout(()=>{n("sub-item-click",{parent:g,sub:A[0]})},50))}}else n("item-click",g)},m=g=>{o.value=g.id,n("sub-item-click",{parent:s.value,sub:g})},y=()=>{s.value=null,o.value=null};return(g,A)=>(d.openBlock(),d.createElementBlock("div",LN,[d.createElementVNode("nav",RN,[d.createVNode(d.Transition,{name:"nav-mode-switch",mode:"out-in"},{default:d.withCtx(()=>[s.value?(d.openBlock(),d.createElementBlock("div",FN,[d.createElementVNode("button",{class:"nav-back-icon",onClick:y},[...A[0]||(A[0]=[d.createElementVNode("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3"},[d.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)])]),d.createElementVNode("div",ON,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(p.value,v=>(d.openBlock(),d.createElementBlock("button",{key:v.id,class:d.normalizeClass(["sub-icon-box",{active:o.value===v.id}]),onClick:b=>m(v)},[d.createElementVNode("div",{class:"icon-svg",innerHTML:l(v.id)},null,8,UN)],10,GN))),128))])])):(d.openBlock(),d.createElementBlock("div",VN,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,v=>(d.openBlock(),d.createElementBlock("div",{key:v.ID,class:d.normalizeClass(["main-tab-item",{active:i.activeIds?.includes(v.ID)}]),onClick:b=>f(v)},[d.createElementVNode("img",{src:v.src,class:"tab-img",alt:v.title},null,8,zN)],10,QN))),128))]))]),_:1})])]))}}),[["__scopeId","data-v-2e30753b"]]),HN={key:1,class:"drawer-header"},YN={class:"drawer-title"},$N={class:"drawer-content"},jN={key:2,class:"drawer-footer"},Wr=Be(d.defineComponent({__name:"MobileDrawer",props:{visible:{type:Boolean},title:{},direction:{default:"bottom"},width:{default:"100%"},height:{default:"50vh"},showHandle:{type:Boolean,default:!1},closeOnOverlay:{type:Boolean,default:!0},maxHeight:{default:"60vh"}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.ref(null);let o=0,r=0;const a=d.computed(()=>{const f={};return t.direction==="right"||t.direction==="left"?(f.width=t.width,f.height="100%"):(f.width=t.width,f.height=t.height,f.maxHeight=t.maxHeight),f}),l=f=>{o=f.touches[0]?.clientY??0,s.value&&(s.value.style.transition="none")},c=f=>{if(!s.value)return;r=(f.touches[0]?.clientY??0)-o,r>0&&(s.value.style.transform=`translateY(${r}px)`)},h=()=>{s.value&&(s.value.style.transition="transform 300ms cubic-bezier(0.4, 0, 0.2, 1)",r>100?u():s.value.style.transform="",r=0)},u=()=>{n("update:visible",!1),n("close")},p=()=>{t.closeOnOverlay&&u()};return d.watch(()=>t.visible,f=>{f?document.body.style.overflow="hidden":document.body.style.overflow=""}),(f,m)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"drawer-fade"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-drawer-overlay",onClick:d.withModifiers(p,["self"])},[d.createElementVNode("div",{class:d.normalizeClass(["mobile-drawer-panel",[`direction-${i.direction}`]]),style:d.normalizeStyle(a.value),onClick:m[0]||(m[0]=d.withModifiers(()=>{},["stop"])),ref_key:"panelRef",ref:s},[i.direction==="bottom"&&i.showHandle?(d.openBlock(),d.createElementBlock("div",{key:0,class:"drawer-handle",onTouchstart:l,onTouchmove:c,onTouchend:h},[...m[1]||(m[1]=[d.createElementVNode("div",{class:"handle-bar"},null,-1)])],32)):d.createCommentVNode("",!0),i.title||f.$slots.title?(d.openBlock(),d.createElementBlock("div",HN,[d.renderSlot(f.$slots,"title",{},()=>[d.createElementVNode("span",YN,d.toDisplayString(i.title),1)],!0),d.createElementVNode("button",{class:"drawer-close-btn",onClick:u},[...m[2]||(m[2]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):d.createCommentVNode("",!0),d.createElementVNode("div",$N,[d.renderSlot(f.$slots,"default",{},void 0,!0)]),f.$slots.footer?(d.openBlock(),d.createElementBlock("div",jN,[d.renderSlot(f.$slots,"footer",{},void 0,!0)])):d.createCommentVNode("",!0)],6)])):d.createCommentVNode("",!0)]),_:3})]))}}),[["__scopeId","data-v-66d9d696"]]),WN={class:"mobile-tree-container"},qN={class:"search-section"},KN={class:"search-inner"},XN=["innerHTML"],km=Be(d.defineComponent({__name:"MobileTree",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},treeData:{default:()=>[]},initialCheckedKeys:{default:()=>[]}},emits:["update:visible","update:open","close","select","check","search"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:_=>{n("update:visible",_),n("update:open",_)}}),r={key:"id",title:"name",children:"children"},a=d.ref(""),l=d.ref([]),c=d.ref([]),h=d.ref(null),u=d.ref(300),p=d.ref(!1);let f=null;d.watch(()=>t.initialCheckedKeys,_=>{_&&_.length>0&&(c.value=[..._])},{immediate:!0}),d.watch(()=>t.treeData,_=>{if(!_||_.length===0)return;const F=[],U=(M,k)=>{for(let B=0;B<M.length;B++){const P=M[B],V=P.id||P.key||P.$id,G=P.modelId||k;G&&(P.modelId=G),V&&F.push(String(V)),P.children&&P.children.length>0&&U(P.children,G)}};U(_);const L=new Set(c.value);let D=!1;F.forEach(M=>{L.has(M)||(L.add(M),D=!0)}),D&&(c.value=Array.from(L),n("check",c.value))},{immediate:!0,deep:!0});const m=(_,F)=>{const U=[],L=D=>{for(let M=0;M<D.length;M++){const k=D[M],B=k.id||k.key;!k.children||k.children.length===0?!(B&&F.has(String(B)))&&k.modelId&&k.element_Id&&U.push({modelId:k.modelId,elementId:k.element_Id,show:!1}):k.children&&L(k.children)}};return L(_),U},y=d.computed(()=>{if(!a.value)return t.treeData;p.value=!0;const _=a.value.toLowerCase(),F=U=>{const L=[];for(let D=0;D<U.length;D++){const M=U[D],k=M.name||M.title||"",B=M.id||M.key,P=k.toLowerCase().includes(_);let V;M.children&&M.children.length>0&&(V=F(M.children)),(P||V&&V.length>0)&&L.push({key:String(B),title:k,children:V&&V.length>0?V:M.children?M.children:void 0,_raw:M,_searchMatched:P})}return L};return F(t.treeData)}),g=d.computed(()=>{if(!a.value)return[];const _=[],F=U=>{for(let L=0;L<U.length;L++){const D=U[L]?.children;D&&D.length>0&&(_.push(U[L]?.key),F(D))}};return F(y.value),_}),A=(_,F)=>a.value?(_||F||"").toLowerCase().includes(a.value.toLowerCase()):!1,v=_=>{if(!a.value)return _;const F=new RegExp(`(${a.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return _.replace(F,'<mark class="search-highlight">$1</mark>')},b=qo(_=>{const F=typeof _=="object"?_.target?.value??"":_;x(F)},200),C=_=>{x(_)},x=_=>{a.value=_||"",n("search",a.value),_&&d.nextTick(()=>{l.value=[...g.value]})},I=_=>{l.value=_},E=(_,F)=>{c.value=_,n("check",c.value);const U=new Set(_.map(D=>String(D))),L=m(t.treeData,U);s?.value?.setComponentVisibility&&s.value.setComponentVisibility(L),s?.value?.onTreeCheck&&s.value.onTreeCheck(_,F)},S=_=>{o.value=_},w=()=>{n("close")},T=()=>{h.value&&(u.value=h.value.clientHeight)};return d.onMounted(()=>{h.value&&(T(),f=new ResizeObserver(()=>{T()}),f.observe(h.value))}),d.onUnmounted(()=>{f&&(f.disconnect(),f=null)}),(_,F)=>(d.openBlock(),d.createBlock(Wr,{visible:o.value,title:"目录树",direction:"bottom","show-handle":!1,class:"mobile-bim-drawer","onUpdate:visible":S,onClose:w},{title:d.withCtx(()=>[...F[1]||(F[1]=[d.createElementVNode("div",{class:"custom-drawer-header"},[d.createElementVNode("span",null,"目录树")],-1)])]),default:d.withCtx(()=>[d.createElementVNode("div",WN,[F[3]||(F[3]=d.createElementVNode("div",{class:"nav-tabs"},[d.createElementVNode("div",{class:"nav-tab-item active"},"构件")],-1)),d.createElementVNode("div",qN,[d.createElementVNode("div",KN,[d.createVNode(d.unref(re.Input),{value:a.value,"onUpdate:value":F[0]||(F[0]=U=>a.value=U),placeholder:"搜索构件","allow-clear":"",class:"custom-search",onSearch:C,onChange:d.unref(b)},null,8,["value","onChange"])])]),d.createElementVNode("div",{class:"tree-content-wrapper",ref_key:"treeContentRef",ref:h},[y.value.length>0?(d.openBlock(),d.createBlock(d.unref(re.Tree),{key:0,"tree-data":y.value,"field-names":r,"expanded-keys":l.value,"checked-keys":c.value,checkable:"","block-node":"",class:"bim-dark-tree",onExpand:I,onCheck:E},{switcherIcon:d.withCtx(({expanded:U})=>[d.createElementVNode("span",{class:d.normalizeClass(["switcher-icon",{"is-open":U}])},[...F[2]||(F[2]=[d.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"12",height:"12"},[d.createElementVNode("path",{d:"M340.864 149.312l405.376 362.688-405.376 362.688z",fill:"currentColor"})],-1)])],2)]),title:d.withCtx(({name:U,title:L})=>[d.createElementVNode("span",{class:d.normalizeClass(["node-title",{"is-matched":A(U,L)}])},[d.createElementVNode("span",{innerHTML:v(U||L)},null,8,XN)],2)]),_:1},8,["tree-data","expanded-keys","checked-keys","onExpand","onCheck"])):d.createCommentVNode("",!0)],512)])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-c2e8ecbe"]]),JN={class:"tabs-header"},ZN=["onClick"],eL={class:"modal-content"},tL={key:0,class:"setting-section"},iL={class:"setting-item"},nL={class:"mobile-switch"},sL={class:"setting-item"},oL={class:"mobile-switch"},rL={class:"setting-item"},aL={class:"mobile-switch"},lL={key:1,class:"setting-section"},cL={class:"setting-item"},dL={class:"mobile-switch"},hL={key:0,class:"setting-item column"},uL={class:"setting-label-row"},fL={class:"setting-value"},pL={class:"setting-item"},mL={class:"mobile-switch"},gL={class:"setting-item"},yL={class:"mobile-switch"},AL={class:"setting-item column"},vL={class:"setting-label-row"},bL={class:"setting-value"},wL={class:"setting-item column"},CL={class:"setting-label-row"},EL={class:"setting-value"},xL={class:"setting-item column"},IL={class:"setting-label-row"},SL={class:"setting-value"},ML={class:"setting-item column"},TL={style:{display:"flex",gap:"8px","margin-bottom":"8px","flex-wrap":"wrap"}},BL=["onClick","title"],_L={style:{display:"flex",gap:"8px","align-items":"center"}},Pm=Be(d.defineComponent({__name:"MobileSetting",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0}},emits:["update:visible","update:open","close","change"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:f=>{n("update:visible",f),n("update:open",f)}}),r=[{id:"GIS",label:"GIS"},{id:"RENDER",label:"渲染"}],a=d.ref("GIS"),l=d.ref({globe:!1,terrain:!1,depthTest:!1}),c=d.ref({shadows:!1,shadowDarkness:.5,environmentMap:!0,ambientOcclusion:!1,brightness:1,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),h=["linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)","linear-gradient(0deg, #0f2027 0%, #203a43 50%, #2c5364 100%)","linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%)"],u=()=>{p()},p=()=>{n("close"),n("change",{gis:l.value,render:c.value})};return d.watch(()=>l.value.globe,f=>{s?.value&&s.value.setGlobeEnvironmentVisible?.(f)}),d.watch(()=>l.value.terrain,f=>{s?.value&&s.value.setTerrainEnable?.(f)}),d.watch(()=>l.value.depthTest,f=>{s?.value&&s.value.setDepthTestEnable?.(f)}),d.watch(()=>c.value.shadows,f=>{s?.value&&s.value.setShadowsEnable?.(f)}),d.watch(()=>c.value.shadowDarkness,f=>{s?.value&&s.value.setShadowDarkness?.(f)}),d.watch(()=>c.value.environmentMap,f=>{s?.value&&s.value.setEnvironmentMapEnable?.(f)}),d.watch(()=>c.value.ambientOcclusion,f=>{s?.value&&s.value.setAmbientOcclusion?.(f)}),d.watch(()=>[c.value.brightness,c.value.contrast,c.value.saturation],([f,m,y])=>{const g=s?.value;g&&(g.setModelColorAdjustment?g.setModelColorAdjustment({brightness:f,contrast:m,saturation:y}):g.setModelBrightness?.(f))}),d.watch(()=>c.value.backgroundColor,f=>{s?.value&&s.value.setBackgroundColor?.(f)}),d.watch(()=>o.value,f=>{f?document.body.style.overflow="hidden":document.body.style.overflow=""}),(f,m)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"setting-modal"},{default:d.withCtx(()=>[o.value?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-setting-overlay",onClick:u,onTouchmove:m[13]||(m[13]=d.withModifiers(()=>{},["prevent"]))},[d.createElementVNode("div",{class:"mobile-setting-modal",onClick:m[12]||(m[12]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("div",{class:"modal-header"},[m[15]||(m[15]=d.createElementVNode("span",{class:"modal-title"},"设置",-1)),d.createElementVNode("button",{class:"modal-close-btn",onClick:p},[...m[14]||(m[14]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),d.createElementVNode("div",JN,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(r,y=>d.createElementVNode("button",{key:y.id,class:d.normalizeClass(["tab-btn",{active:a.value===y.id}]),onClick:g=>a.value=y.id},d.toDisplayString(y.label),11,ZN)),64))]),d.createElementVNode("div",eL,[a.value==="GIS"?(d.openBlock(),d.createElementBlock("div",tL,[d.createElementVNode("div",iL,[m[17]||(m[17]=d.createElementVNode("span",{class:"setting-label"},"地球(含大气/日月/星空)",-1)),d.createElementVNode("label",nL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[0]||(m[0]=y=>l.value.globe=y)},null,512),[[d.vModelCheckbox,l.value.globe]]),m[16]||(m[16]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",sL,[m[19]||(m[19]=d.createElementVNode("span",{class:"setting-label"},"地形",-1)),d.createElementVNode("label",oL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[1]||(m[1]=y=>l.value.terrain=y)},null,512),[[d.vModelCheckbox,l.value.terrain]]),m[18]||(m[18]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",rL,[m[21]||(m[21]=d.createElementVNode("span",{class:"setting-label"},"地形遮挡",-1)),d.createElementVNode("label",aL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[2]||(m[2]=y=>l.value.depthTest=y)},null,512),[[d.vModelCheckbox,l.value.depthTest]]),m[20]||(m[20]=d.createElementVNode("span",{class:"slider"},null,-1))])])])):d.createCommentVNode("",!0),a.value==="RENDER"?(d.openBlock(),d.createElementBlock("div",lL,[d.createElementVNode("div",cL,[m[23]||(m[23]=d.createElementVNode("span",{class:"setting-label"},"阴影",-1)),d.createElementVNode("label",dL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[3]||(m[3]=y=>c.value.shadows=y)},null,512),[[d.vModelCheckbox,c.value.shadows]]),m[22]||(m[22]=d.createElementVNode("span",{class:"slider"},null,-1))])]),c.value.shadows?(d.openBlock(),d.createElementBlock("div",hL,[d.createElementVNode("div",uL,[m[24]||(m[24]=d.createElementVNode("span",{class:"setting-label"},"阴影暗度",-1)),d.createElementVNode("span",fL,d.toDisplayString(c.value.shadowDarkness.toFixed(2)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[4]||(m[4]=y=>c.value.shadowDarkness=y),min:"0",max:"1",step:"0.05",class:"mobile-slider"},null,512),[[d.vModelText,c.value.shadowDarkness,void 0,{number:!0}]])])):d.createCommentVNode("",!0),d.createElementVNode("div",pL,[m[26]||(m[26]=d.createElementVNode("span",{class:"setting-label"},"环境贴图",-1)),d.createElementVNode("label",mL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[5]||(m[5]=y=>c.value.environmentMap=y)},null,512),[[d.vModelCheckbox,c.value.environmentMap]]),m[25]||(m[25]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",gL,[m[28]||(m[28]=d.createElementVNode("span",{class:"setting-label"},"环境光遮蔽",-1)),d.createElementVNode("label",yL,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[6]||(m[6]=y=>c.value.ambientOcclusion=y)},null,512),[[d.vModelCheckbox,c.value.ambientOcclusion]]),m[27]||(m[27]=d.createElementVNode("span",{class:"slider"},null,-1))])]),d.createElementVNode("div",AL,[d.createElementVNode("div",vL,[m[29]||(m[29]=d.createElementVNode("span",{class:"setting-label"},"模型亮度",-1)),d.createElementVNode("span",bL,d.toDisplayString(c.value.brightness.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[7]||(m[7]=y=>c.value.brightness=y),min:"0",max:"5",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.brightness,void 0,{number:!0}]])]),d.createElementVNode("div",wL,[d.createElementVNode("div",CL,[m[30]||(m[30]=d.createElementVNode("span",{class:"setting-label"},"模型对比度",-1)),d.createElementVNode("span",EL,d.toDisplayString(c.value.contrast.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[8]||(m[8]=y=>c.value.contrast=y),min:"0.5",max:"2",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.contrast,void 0,{number:!0}]])]),d.createElementVNode("div",xL,[d.createElementVNode("div",IL,[m[31]||(m[31]=d.createElementVNode("span",{class:"setting-label"},"模型饱和度",-1)),d.createElementVNode("span",SL,d.toDisplayString(c.value.saturation.toFixed(1)),1)]),d.withDirectives(d.createElementVNode("input",{type:"range","onUpdate:modelValue":m[9]||(m[9]=y=>c.value.saturation=y),min:"0",max:"3",step:"0.1",class:"mobile-slider"},null,512),[[d.vModelText,c.value.saturation,void 0,{number:!0}]])]),d.createElementVNode("div",ML,[m[32]||(m[32]=d.createElementVNode("span",{class:"setting-label"},"背景颜色",-1)),d.createElementVNode("div",TL,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(h,(y,g)=>d.createElementVNode("div",{key:g,style:d.normalizeStyle({background:y,width:"60px",height:"40px",borderRadius:"6px",cursor:"pointer",border:"2px solid rgba(255,255,255,0.2)",flexShrink:0}),onClick:A=>c.value.backgroundColor=y,title:"预设 "+(g+1)},null,12,BL)),64))]),d.createElementVNode("div",_L,[d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":m[10]||(m[10]=y=>c.value.backgroundColor=y),style:{width:"50px",height:"36px",padding:"0",border:"1px solid rgba(255,255,255,0.3)","border-radius":"6px",cursor:"pointer"}},null,512),[[d.vModelText,c.value.backgroundColor]]),d.withDirectives(d.createElementVNode("input",{"onUpdate:modelValue":m[11]||(m[11]=y=>c.value.backgroundColor=y),type:"text",class:"mobile-input",placeholder:"CSS 颜色值",style:{flex:"1"}},null,512),[[d.vModelText,c.value.backgroundColor]])])])])):d.createCommentVNode("",!0)])])],32)):d.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-dcec8ca4"]]),kL={class:"mobile-section-container"},PL={class:"section-main"},DL={class:"toggle-row"},NL={class:"slider-section"},LL={class:"slider-header"},RL={class:"slider-label"},FL={class:"slider-value"},OL={class:"quick-btns"},GL={class:"section-models"},UL={class:"models-header"},VL={class:"models-count"},Dm=Be(d.defineComponent({__name:"MobileSection",props:{visible:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},modelList:{default:()=>[]}},emits:["update:visible","update:open","close","visibility-change","mode-change","axis-change","model-change"],setup(i,{emit:e}){const t=i,n=e,s=d.computed({get:()=>t.open!==void 0?t.open:t.visible,set:T=>{n("update:visible",T),n("update:open",T)}}),o=d.ref(!0),r=d.ref("Box"),a=d.ref("X"),l=d.ref([]),c=d.ref([0,100]),h=d.ref([0,100]),u=d.ref([0,100]),p=[{key:"X",label:"X轴"},{key:"Y",label:"Y轴"},{key:"Z",label:"Z轴"}],f=d.computed(()=>p.find(_=>_.key===a.value)?.label||""),m=d.computed({get:()=>{switch(a.value){case"X":return c.value[1];case"Y":return h.value[1];case"Z":return u.value[1];default:return 50}},set:T=>{switch(a.value){case"X":c.value[1]=T??0;break;case"Y":h.value[1]=T??0;break;case"Z":u.value[1]=T??0;break}}}),y=d.computed(()=>{switch(a.value){case"X":return[-50,50];case"Y":return[-50,50];case"Z":return[0,100];default:return[0,100]}}),g=d.computed(()=>m.value?.toFixed(1)??"0.0"),A=d.computed(()=>l.value.length===t.modelList.length),v=T=>{s.value=T},b=()=>{n("close")},C=()=>{n("visibility-change",o.value)},x=T=>{r.value=T,n("mode-change",T)},I=()=>{m.value=50,n("axis-change",a.value,50)},E=()=>{const T=y.value;m.value=T&&T.length>=2?(T[0]+T[1])/2:50,n("axis-change",a.value,m.value)},S=()=>{n("model-change",l.value)},w=()=>{A.value?l.value=[]:l.value=t.modelList.map(T=>T.modelId),n("model-change",l.value)};return(T,_)=>(d.openBlock(),d.createBlock(Wr,{visible:s.value,title:"剖切分析",direction:"bottom","show-handle":!0,"onUpdate:visible":v,onClose:b},{default:d.withCtx(()=>[d.createElementVNode("div",kL,[d.createElementVNode("div",PL,[d.createElementVNode("div",DL,[_[6]||(_[6]=d.createElementVNode("span",{class:"toggle-label"},"显示剖切盒",-1)),d.createVNode(d.unref(re.Switch),{checked:o.value,"onUpdate:checked":_[0]||(_[0]=F=>o.value=F),onChange:C},null,8,["checked"])]),d.createVNode(d.unref(re.RadioGroup),{value:r.value,"onUpdate:value":_[1]||(_[1]=F=>r.value=F),"button-style":"solid",class:"mode-selector",onChange:_[2]||(_[2]=F=>x(F.target.value))},{default:d.withCtx(()=>[d.createVNode(d.unref(re.RadioButton),{value:"Box"},{default:d.withCtx(()=>[..._[7]||(_[7]=[d.createTextVNode("剖切盒",-1)])]),_:1})]),_:1},8,["value"]),d.createVNode(d.unref(re.RadioGroup),{value:a.value,"onUpdate:value":_[3]||(_[3]=F=>a.value=F),"button-style":"solid",class:"axis-selector"},{default:d.withCtx(()=>[d.createVNode(d.unref(re.RadioButton),{value:"X"},{default:d.withCtx(()=>[..._[8]||(_[8]=[d.createTextVNode("X轴",-1)])]),_:1}),d.createVNode(d.unref(re.RadioButton),{value:"Y"},{default:d.withCtx(()=>[..._[9]||(_[9]=[d.createTextVNode("Y轴",-1)])]),_:1}),d.createVNode(d.unref(re.RadioButton),{value:"Z"},{default:d.withCtx(()=>[..._[10]||(_[10]=[d.createTextVNode("Z轴",-1)])]),_:1})]),_:1},8,["value"]),d.createElementVNode("div",NL,[d.createElementVNode("div",LL,[d.createElementVNode("span",RL,d.toDisplayString(f.value)+" 轴范围",1),d.createElementVNode("span",FL,d.toDisplayString(g.value),1)]),d.createVNode(d.unref(re.Slider),{Value:m.value,"onUpdate:Value":_[4]||(_[4]=F=>m.value=F),min:y.value[0],max:y.value[1],step:.5,class:"section-slider"},null,8,["Value","min","max"]),d.createElementVNode("div",OL,[d.createVNode(d.unref(re.Button),{size:"small",onClick:I},{default:d.withCtx(()=>[..._[11]||(_[11]=[d.createTextVNode("重置",-1)])]),_:1}),d.createVNode(d.unref(re.Button),{size:"small",onClick:E},{default:d.withCtx(()=>[..._[12]||(_[12]=[d.createTextVNode("居中",-1)])]),_:1})])])]),d.createElementVNode("div",GL,[d.createElementVNode("div",UL,[_[13]||(_[13]=d.createElementVNode("span",{class:"models-title"},"选择模型",-1)),d.createElementVNode("span",VL,d.toDisplayString(l.value.length)+"/"+d.toDisplayString(i.modelList.length),1)]),d.createVNode(d.unref(re.CheckboxGroup),{value:l.value,"onUpdate:value":_[5]||(_[5]=F=>l.value=F),class:"models-list",onChange:S},{default:d.withCtx(()=>[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.modelList,F=>(d.openBlock(),d.createBlock(d.unref(re.Checkbox),{key:F.modelId,value:F.modelId,class:"model-item"},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(F.modelName),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),i.modelList.length>1?(d.openBlock(),d.createBlock(d.unref(re.Button),{key:0,size:"small",type:"link",onClick:w},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(A.value?"取消全选":"全选"),1)]),_:1})):d.createCommentVNode("",!0)])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-cdacec58"]]),QL={key:0,class:"mobile-measure-root"},zL={key:0,class:"result-card"},HL={class:"card-header-row"},YL={class:"result-main"},$L={class:"type-label"},jL={class:"value-highlight"},WL={key:0,class:"coords-grid"},qL={class:"coord-item"},KL={class:"coord-item"},XL={class:"coord-item"},JL={class:"measure-toolbar-container"},ZL={class:"tools-inner-row"},e8=["onClick"],t8=["innerHTML"],Nm=Be(d.defineComponent({__name:"MobileMeasurement",props:{visible:{type:Boolean},defaultTool:{}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods");let o=null,r=!1;const a=d.ref(null),l=d.ref(null),c=d.computed(()=>t.visible&&a.value!==null),h=[{id:"distance",svg:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 17l6-6 4 4 8-8"/></svg>'},{id:"angle",svg:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 20H4L14 4"/></svg>'},{id:"area",svg:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/></svg>'}],u={distance:"距离",angle:"角度",area:"面积"},p=d.computed(()=>a.value?u[a.value]||"":l.value&&u[l.value.type]||""),f=d.computed(()=>{if(!l.value)return a.value==="distance"?"-- m":a.value==="angle"?"--°":a.value==="area"?"-- m²":"";const C=l.value;return C.type==="distance"?`${(C.dist??0).toFixed(3)} m`:C.type==="angle"?`${(C.angle??0).toFixed(2)}°`:C.type==="area"?`${(C.area??0).toFixed(2)} m²`:""}),m=d.computed(()=>l.value?.type||a.value),y=C=>C===void 0?"--":C.toFixed(3),g=()=>{if(o)return;const C=s?.value;C?.getViewer&&(o=new pc({viewer:C.getViewer(),cesium:C.getCesium()}),o.onMeasure=x=>{r||(l.value=x)})},A=C=>{g(),a.value===C?(a.value=null,o?.stop(),s?.value?.baseCompt?.enableSelection()):(a.value=C,l.value=null,o?.start(C),s?.value?.baseCompt?.disableSelection())},v=()=>{o?.clearAll(),o?.stop(),a.value=null,l.value=null,s?.value?.baseCompt?.enableSelection()},b=()=>{v(),n("update:visible",!1),n("close")};return d.watch(()=>t.visible,C=>{C?(g(),t.defaultTool&&A(t.defaultTool)):v()}),d.onUnmounted(()=>{r=!0,o?.destroy()}),(C,x)=>(d.openBlock(),d.createBlock(d.Transition,{name:"measure-fade"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",QL,[d.createVNode(d.Transition,{name:"card-slide"},{default:d.withCtx(()=>[c.value?(d.openBlock(),d.createElementBlock("div",zL,[d.createElementVNode("div",HL,[d.createElementVNode("div",YL,[d.createElementVNode("span",$L,d.toDisplayString(p.value)+":",1),d.createElementVNode("span",jL,d.toDisplayString(f.value),1)]),d.createElementVNode("button",{class:"clear-action-btn",onClick:v,title:"清空"},[...x[0]||(x[0]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2"},[d.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),d.createElementVNode("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])])]),m.value==="distance"?(d.openBlock(),d.createElementBlock("div",WL,[d.createElementVNode("div",qL,[x[1]||(x[1]=d.createElementVNode("span",{class:"label-x"},"X:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dx)),1)]),d.createElementVNode("div",KL,[x[2]||(x[2]=d.createElementVNode("span",{class:"label-y"},"Y:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dy)),1)]),d.createElementVNode("div",XL,[x[3]||(x[3]=d.createElementVNode("span",{class:"label-z"},"Z:",-1)),d.createTextVNode(" "+d.toDisplayString(y(l.value?.dz)),1)])])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0)]),_:1}),d.createElementVNode("div",JL,[d.createElementVNode("button",{class:"nav-back-icon",onClick:b},[...x[4]||(x[4]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor","stroke-width":"3"},[d.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)])]),d.createElementVNode("div",ZL,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(h,I=>d.createElementVNode("button",{key:I.id,class:d.normalizeClass(["sub-icon-box",{active:a.value===I.id}]),onClick:E=>A(I.id)},[d.createElementVNode("span",{class:"icon-svg",innerHTML:I.svg},null,8,t8)],10,e8)),64))])])])):d.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-7ff442b7"]]),i8={class:"joystick-base"},n8={class:"leitingbim-control-panel"},s8={class:"ctrl-row zoom-row"},o8={class:"zoom-label"},r8={class:"ctrl-grid"},a8={class:"gravity-toggle"},l8={class:"arrow-col"},bc=40,Lm=Be(d.defineComponent({__name:"MobilePlayer",props:{visible:{type:Boolean}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods");let o=!1;const r=d.ref(null),a=d.ref(0),l=d.ref(0),c=d.ref(!1),h=d.ref({x:0,y:0}),u=[.25,.5,1,2,4,8,16],p=d.ref(2),f=d.ref(!0);let m=null;const y=d.computed(()=>({transform:`translate(${a.value}px, ${l.value}px)`})),g=d.computed(()=>`${u[p.value]}X`),A=(G,R)=>{const N=[];return(Math.abs(G)>10||Math.abs(R)>10)&&(R<-10&&N.push("moveFront"),R>10&&N.push("moveBack"),G<-10&&N.push("moveLeft"),G>10&&N.push("moveRight")),N},v=()=>{o||["moveFront","moveBack","moveLeft","moveRight"].forEach(G=>{s?.value?.setPlayerAction?.(G,!1)})},b=G=>{if(o)return;["moveFront","moveBack","moveLeft","moveRight"].forEach(N=>{const O=G.includes(N);s?.value?.setPlayerAction?.(N,O)})},C=G=>{const R=G.touches[0],N=r.value.getBoundingClientRect();h.value={x:N.left+N.width/2,y:N.top+N.height/2},c.value=!0,R&&I(R.clientX,R.clientY)},x=G=>{if(!c.value)return;const R=G.touches[0];R&&I(R.clientX,R.clientY)},I=(G,R)=>{if(o)return;let N=G-h.value.x,O=R-h.value.y;const z=Math.sqrt(N*N+O*O);z>bc&&(N=N/z*bc,O=O/z*bc),a.value=N,l.value=O;const j=A(N,O);b(j)},E=()=>{c.value=!1,a.value=0,l.value=0,v()},S=()=>{_(),m=setInterval(()=>{p.value<u.length-1&&(p.value++,F())},150)},w=()=>{_(),m=setInterval(()=>{p.value>0&&(p.value--,F())},150)},T=()=>{_()},_=()=>{m&&(clearInterval(m),m=null)},F=()=>{o||s?.value?.setPlayerSpeed?.(u[p.value])},U=()=>{s?.value?.setPlayerAction?.("moveUp",!0)},L=()=>{s?.value?.setPlayerAction?.("moveUp",!1)},D=()=>{s?.value?.setPlayerAction?.("moveDown",!0)},M=()=>{s?.value?.setPlayerAction?.("moveDown",!1)},k=()=>{s?.value?.setPlayerParams?.({gravityTest:f.value,collisionTest:!0})},B=()=>{V(),n("update:visible",!1),n("close")},P=async()=>{if(!o)try{if(!s?.value){setTimeout(()=>P(),150);return}s.value.startCameraRoam&&s.value.startCameraRoam(),s.value.setPlayerSpeed?.(u[p.value])}catch(G){console.error("MobilePlayer startPlayer error:",G)}},V=()=>{v(),o||s?.value?.closePlayer?.(),_()};return d.watch(()=>t.visible,G=>{o||(G?P():V())},{immediate:!0}),d.onUnmounted(()=>{o=!0,V()}),(G,R)=>i.visible?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-player-overlay",onTouchmove:R[1]||(R[1]=d.withModifiers(()=>{},["prevent"]))},[d.createElementVNode("button",{class:"player-exit-btn",onClick:B}," 退出 "),d.createElementVNode("div",{class:"joystick-zone",ref_key:"joystickRef",ref:r,onTouchstart:d.withModifiers(C,["prevent"]),onTouchmove:d.withModifiers(x,["prevent"]),onTouchend:d.withModifiers(E,["prevent"]),onTouchcancel:d.withModifiers(E,["prevent"])},[d.createElementVNode("div",i8,[d.createElementVNode("div",{class:"joystick-knob",style:d.normalizeStyle(y.value)},null,4)])],544),d.createElementVNode("div",n8,[d.createElementVNode("div",s8,[d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-sm",onTouchstart:d.withModifiers(w,["prevent"]),onTouchend:d.withModifiers(T,["prevent"])},"−",32),d.createElementVNode("span",o8,d.toDisplayString(g.value),1),d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-sm",onTouchstart:d.withModifiers(S,["prevent"]),onTouchend:d.withModifiers(T,["prevent"])},"+",32)]),d.createElementVNode("div",r8,[d.createElementVNode("label",a8,[d.withDirectives(d.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":R[0]||(R[0]=N=>f.value=N),onChange:k},null,544),[[d.vModelCheckbox,f.value]]),R[2]||(R[2]=d.createElementVNode("span",{class:"toggle-checkbox"},null,-1)),R[3]||(R[3]=d.createElementVNode("span",{class:"toggle-label"},"重力",-1))]),d.createElementVNode("div",l8,[d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-arrow",onTouchstart:d.withModifiers(U,["prevent"]),onTouchend:d.withModifiers(L,["prevent"])},[...R[4]||(R[4]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"18 15 12 9 6 15"})],-1)])],32),d.createElementVNode("button",{class:"ctrl-btn ctrl-btn-arrow",onTouchstart:d.withModifiers(D,["prevent"]),onTouchend:d.withModifiers(M,["prevent"])},[...R[5]||(R[5]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],32)])])])],32)):d.createCommentVNode("",!0)}}),[["__scopeId","data-v-d80a8120"]]),c8={key:0,class:"mobile-info-sheet-wrapper"},d8={class:"info-body"},h8={key:0,class:"empty-hint"},u8={key:0,class:"component-title"},f8={class:"group-list"},p8=["onClick"],m8={class:"group-name"},g8={key:0,class:"group-content"},y8={class:"kv-key"},A8={class:"kv-value"},Rm=Be(d.defineComponent({__name:"MobileInfo",props:{visible:{type:Boolean}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref([]),r=d.ref(!1),a=d.ref(new Set),l=d.ref([]);let c=!1;const h=d.computed({get:()=>!!t.visible,set:x=>{n("update:visible",x)}}),u=x=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[x]||x,p=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],f=(x,I)=>`${x}__${I}`,m=(x,I)=>a.value.has(f(x,I)),y=(x,I)=>{const E=f(x,I);a.value.has(E)?a.value.delete(E):a.value.add(E)},g=()=>{const x=new Set;o.value.forEach(I=>{I.groups.forEach(E=>{x.add(f(I.id,E.name))})}),a.value=x},A=()=>{h.value=!1,n("close")},v=async x=>{if(c)return;if(l.value=x||[],!x||x.length===0){o.value=[];return}let I=x;x.length>10&&(me.warning(`选中构件数量过多(${x.length}个),仅显示前10个`),I=x.slice(0,10));const E=s?.value;let S=E?.getMapTileset?E.getMapTileset():{};r.value=!0;const w=new Set;if(I.forEach(_=>{const F=S[_.modelId];F&&F.leiting&&!F.leiting?.node?.nodeExtras&&F.leiting.model?.nodeUrl&&w.add(_.modelId)}),w.size>0&&E?._loadNodeDetailsForModel)try{await Promise.all(Array.from(w).map(_=>E._loadNodeDetailsForModel(_)))}catch(_){console.error("Failed to load node details",_)}if(c)return;S=E?.getMapTileset?E.getMapTileset():{};const T=[];I.forEach((_,F)=>{const L=S[_.modelId]?.leiting||{};let D={modelName:L.model?.modelId||_.modelId};D.elementID||(D.elementID=_.elementId);let M=null;const k=L.node?.nodeExtras?.element||L.node?.nodeExtras;if(k){const V=D.elementID;k[V]&&(M=k[V])}M&&M.box3&&(D.length=`${M.box3.length?.toFixed(2)||0}米`,D.width=`${M.box3.width?.toFixed(2)||0}米`,D.height=`${M.box3.height?.toFixed(2)||0}米`);const B=[];M&&(M.name&&(D.elementName=M.name),M.categoryName&&(D.categoryName=M.categoryName),M.familySymbolName&&(D.familySymbolName=M.familySymbolName),M.levelName&&(D.levelName=M.levelName));const P={};if(p.forEach(V=>{D[V]!==void 0&&(P[V]=D[V])}),B.push({name:"基本属性",params:P}),M){const V=Array.isArray(M)?M:Array.isArray(M?.parameters)?M.parameters:null;if(V)V.flat().forEach(R=>{if(R&&R.GroupName&&Array.isArray(R.Parameters)){const N={};R.Parameters.forEach(O=>{O.name&&(N[O.name]=O.value??"")}),Object.keys(N).length>0&&B.push({name:R.GroupName,params:N})}});else{let G=!1;if(Object.keys(M).forEach(R=>{M[R]&&typeof M[R]=="object"&&!Array.isArray(M[R])&&(G=!0,B.push({name:R,params:M[R]}))}),!G){const R={};Object.keys(M).forEach(N=>{if(!p.includes(N)&&N!=="batchId"){const O=M[N];R[N]=typeof O=="string"&&O.length>500?O.substring(0,500)+"...":O}}),Object.keys(R).length>0&&B.push({name:"其他属性",params:R})}}}T.push({id:F,title:`${D.modelName}${D.elementName?` - ${D.elementName}`:""}`,groups:B})}),o.value=T,r.value=!1,!c&&T.length>0&&g()};let b=!1;const C=()=>{if(b)return;const x=s?.value;x&&x.selectionChange&&(x.selectionChange(v),b=!0)};return d.watch(()=>s?.value,()=>C(),{deep:!0,immediate:!0}),d.watch(h,x=>{x&&(C(),l.value.length>0&&v(l.value))}),d.onUnmounted(()=>{c=!0}),(x,I)=>(d.openBlock(),d.createBlock(d.Transition,{name:"info-slide"},{default:d.withCtx(()=>[i.visible?(d.openBlock(),d.createElementBlock("div",c8,[d.createElementVNode("div",{class:"mobile-info-sheet",onTouchmove:I[0]||(I[0]=d.withModifiers(()=>{},["stop"])),onClick:I[1]||(I[1]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("div",{class:"info-header"},[I[3]||(I[3]=d.createElementVNode("span",{class:"info-title"},"构件详情",-1)),d.createElementVNode("button",{class:"info-close-btn",onClick:A},[...I[2]||(I[2]=[d.createElementVNode("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),I[5]||(I[5]=d.createElementVNode("div",{class:"info-tabs"},[d.createElementVNode("span",{class:"tab-item active"},"属性")],-1)),d.createElementVNode("div",d8,[d.createVNode(d.unref(re.Spin),{spinning:r.value},{default:d.withCtx(()=>[o.value.length===0&&!r.value?(d.openBlock(),d.createElementBlock("div",h8," 暂无数据 ")):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,E=>(d.openBlock(),d.createElementBlock("div",{key:E.id,class:"component-block"},[o.value.length>1?(d.openBlock(),d.createElementBlock("div",u8,d.toDisplayString(E.title),1)):d.createCommentVNode("",!0),d.createElementVNode("div",f8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(E.groups,(S,w)=>(d.openBlock(),d.createElementBlock("div",{key:`${E.id}-${w}`,class:"group-item"},[d.createElementVNode("button",{class:d.normalizeClass(["group-header",{expanded:m(E.id,S.name)}]),onClick:T=>y(E.id,S.name)},[I[4]||(I[4]=d.createElementVNode("svg",{class:"arrow-icon",viewBox:"0 0 16 16",width:"12",height:"12",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("polyline",{points:"4 6 8 10 12 6"})],-1)),d.createElementVNode("span",m8,d.toDisplayString(S.name),1)],10,p8),d.createVNode(d.Transition,{name:"group-expand"},{default:d.withCtx(()=>[m(E.id,S.name)?(d.openBlock(),d.createElementBlock("div",g8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(S.params,(T,_)=>(d.openBlock(),d.createElementBlock("div",{key:_,class:"kv-row"},[d.createElementVNode("span",y8,d.toDisplayString(u(String(_))),1),d.createElementVNode("span",A8,d.toDisplayString(T),1)]))),128))])):d.createCommentVNode("",!0)]),_:2},1024)]))),128))])]))),128))]),_:1},8,["spinning"])])],32)])):d.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-c4855585"]]),v8={class:"mobile-cad-layer-container"},b8={class:"model-selector"},w8={class:"layer-list-container"},C8={class:"list-header"},E8={class:"col-check"},x8=["checked"],I8={class:"list-body"},S8=["onClick"],M8=["checked","onChange"],T8={class:"col-index"},B8=["title"],_8={class:"col-color"},k8={key:0,class:"empty-state"},P8=Be(d.defineComponent({__name:"MobileCadLayer",props:{visible:{type:Boolean,default:!1},currentModelId:{type:String,default:""}},emits:["update:visible","handleCloseCardByCadCard"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods",d.ref({})),o=d.ref(""),r=d.ref([]),a=d.computed({get:()=>t.visible,set:C=>n("update:visible",C)}),l=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(C=>({modelId:C.modelId,modelName:C.modelName}))||[])},c=d.computed(()=>r.value.map(C=>({value:C.modelId,label:C.modelName}))),h=d.ref([]),u=d.ref([]),p=d.computed(()=>h.value.length>0&&u.value.length===h.value.length),f=({modelId:C})=>{if(h.value=[],u.value=[],s.value&&s.value.getDxfLayers){const x=s.value.getDxfLayers({modelId:C});x&&Object.keys(x).forEach((I,E)=>{x[I].length&&(h.value.push({index:E+1,layerName:I,layerColor:x[I][0].color||"#ffffff",key:I}),u.value.push(I))})}},m=C=>{o.value=C,f({modelId:C})},y=C=>{C.target.checked?u.value=h.value.map(I=>I.key):u.value=[],A()},g=(C,x)=>{x.target.checked?u.value.includes(C)||u.value.push(C):u.value=u.value.filter(E=>E!==C),A()},A=()=>{if(s.value&&s.value.showDxfLayer&&(s.value.showDxfLayer({modelId:o.value,show:!0,layers:u.value}),s.value.getDxfLayers)){const C=s.value.getDxfLayers({modelId:o.value});if(C){const x=Object.keys(C).filter(I=>!u.value.includes(I));s.value.showDxfLayer({modelId:o.value,show:!1,layers:x})}}},v=C=>{a.value=C},b=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return d.watch(()=>t.visible,C=>{C&&(l(),t.currentModelId?(o.value=t.currentModelId,f({modelId:t.currentModelId})):c.value.length>0&&(o.value=c.value[0]?.value,f({modelId:o.value})))}),d.watch(()=>t.currentModelId,C=>{C&&t.visible&&(o.value=C,f({modelId:C}))}),(C,x)=>(d.openBlock(),d.createBlock(Wr,{visible:a.value,title:"CAD图层",direction:"bottom","show-handle":!0,height:"70vh",class:"mobile-cad-layer-drawer","onUpdate:visible":v,onClose:b},{default:d.withCtx(()=>[d.createElementVNode("div",v8,[d.createElementVNode("div",b8,[x[3]||(x[3]=d.createElementVNode("span",{class:"selector-label"},"图纸:",-1)),d.createVNode(d.unref(re.Select),{value:o.value,"onUpdate:value":x[0]||(x[0]=I=>o.value=I),options:c.value,onChange:x[1]||(x[1]=I=>m(I)),placeholder:"选择模型",class:"mobile-model-select",popupClassName:"mobile-cad-select-dropdown",size:"large"},null,8,["value","options"])]),d.createElementVNode("div",w8,[d.createElementVNode("div",C8,[d.createElementVNode("div",E8,[d.createElementVNode("input",{type:"checkbox",checked:p.value,onChange:y,class:"mobile-checkbox"},null,40,x8)]),x[4]||(x[4]=d.createElementVNode("div",{class:"col-index"},"序号",-1)),x[5]||(x[5]=d.createElementVNode("div",{class:"col-name"},"图层名称",-1)),x[6]||(x[6]=d.createElementVNode("div",{class:"col-color"},"颜色",-1))]),d.createElementVNode("div",I8,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(h.value,I=>(d.openBlock(),d.createElementBlock("div",{key:I.key,class:"list-item",onClick:E=>g(I.key,{target:{checked:!u.value.includes(I.key)}})},[d.createElementVNode("div",{class:"col-check",onClick:x[2]||(x[2]=d.withModifiers(()=>{},["stop"]))},[d.createElementVNode("input",{type:"checkbox",checked:u.value.includes(I.key),onChange:E=>g(I.key,E),class:"mobile-checkbox"},null,40,M8)]),d.createElementVNode("div",T8,d.toDisplayString(I.index),1),d.createElementVNode("div",{class:"col-name",title:I.layerName},d.toDisplayString(I.layerName),9,B8),d.createElementVNode("div",_8,[d.createElementVNode("div",{class:"color-swatch",style:d.normalizeStyle({backgroundColor:I.layerColor})},null,4)])],8,S8))),128)),h.value.length===0?(d.openBlock(),d.createElementBlock("div",k8,[...x[7]||(x[7]=[d.createElementVNode("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[d.createElementVNode("path",{d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),d.createElementVNode("p",null,"暂无图层信息",-1)])])):d.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-63da9a15"]]),D8={class:"mobile-annotation-panel"},N8={class:"tools-section"},L8={class:"tools-grid"},R8={class:"style-section"},F8={class:"style-item"},O8={class:"color-picker-wrapper"},G8={class:"style-item"},U8={class:"line-width-options"},V8=["onClick"],Q8={class:"width-label"},z8=Be(d.defineComponent({__name:"MobileAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=d.inject("leitingMethods"),o=d.ref(""),r=d.ref("#ff0000"),a=d.ref(3),l=d.computed({get:()=>t.visible,set:v=>n("update:visible",v)}),c=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],h=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,u=()=>{const v=h();if(v&&(typeof v.hideEntityOutline=="function"&&v.hideEntityOutline(),v.selectedEntityObj=null,v.drawTool&&typeof v.drawTool.deactivate=="function"))try{v.drawTool.deactivate()}catch(b){console.warn("Failed to deactivate drawTool:",b)}o.value="",n("update:visible",!1)},p=v=>{if(o.value===v){o.value="";return}o.value=v;const b=h();if(b)switch(v){case"freehandLine":b.startFreehandLine();break;case"arrow":b.startArrow();break;case"straightLine":b.startStraightLine();break;case"rectangle":b.startRectangle();break;case"ellipse":b.startEllipse();break}},f=()=>{const v=h();v&&(v.setCurrentColor(r.value),v.changeColor(r.value))},m=v=>{a.value=v;const b=h();b&&(b.setCurrentWidth(v),b.changeWidth(v))},y=()=>{const v=h();v&&v.deleteSelectedEntity()},g=()=>{const v=h();v&&v.clearAll()},A=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const v=h();v&&v.saveAnnotations()};return(v,b)=>(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(d.Transition,{name:"annotation-slide"},{default:d.withCtx(()=>[l.value?(d.openBlock(),d.createElementBlock("div",{key:0,class:"mobile-annotation-overlay",onClick:d.withModifiers(u,["self"])},[d.createElementVNode("div",D8,[d.createElementVNode("div",{class:"panel-header"},[b[7]||(b[7]=d.createElementVNode("span",{class:"panel-title"},"标注",-1)),d.createElementVNode("button",{class:"panel-close-btn",onClick:u},[...b[6]||(b[6]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),d.createElementVNode("div",N8,[b[13]||(b[13]=d.createElementVNode("div",{class:"section-label"},"绘图工具",-1)),d.createElementVNode("div",L8,[d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="freehandLine"}]),onClick:b[0]||(b[0]=C=>p("freehandLine"))},[...b[8]||(b[8]=[d.createElementVNode("div",{class:"tool-icon"},"✏️",-1),d.createElementVNode("span",{class:"tool-label"},"手绘线",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="arrow"}]),onClick:b[1]||(b[1]=C=>p("arrow"))},[...b[9]||(b[9]=[d.createElementVNode("div",{class:"tool-icon"},"↗️",-1),d.createElementVNode("span",{class:"tool-label"},"箭头",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="straightLine"}]),onClick:b[2]||(b[2]=C=>p("straightLine"))},[...b[10]||(b[10]=[d.createElementVNode("div",{class:"tool-icon"},"📏",-1),d.createElementVNode("span",{class:"tool-label"},"直线",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="rectangle"}]),onClick:b[3]||(b[3]=C=>p("rectangle"))},[...b[11]||(b[11]=[d.createElementVNode("div",{class:"tool-icon"},"▭",-1),d.createElementVNode("span",{class:"tool-label"},"矩形",-1)])],2),d.createElementVNode("button",{class:d.normalizeClass(["tool-btn",{active:o.value==="ellipse"}]),onClick:b[4]||(b[4]=C=>p("ellipse"))},[...b[12]||(b[12]=[d.createElementVNode("div",{class:"tool-icon"},"⭕",-1),d.createElementVNode("span",{class:"tool-label"},"椭圆",-1)])],2)])]),b[21]||(b[21]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",R8,[b[16]||(b[16]=d.createElementVNode("div",{class:"section-label"},"样式设置",-1)),d.createElementVNode("div",F8,[b[14]||(b[14]=d.createElementVNode("span",{class:"style-label"},"颜色",-1)),d.createElementVNode("div",O8,[d.createElementVNode("div",{class:"color-preview",style:d.normalizeStyle({backgroundColor:r.value})},null,4),d.withDirectives(d.createElementVNode("input",{type:"color","onUpdate:modelValue":b[5]||(b[5]=C=>r.value=C),onChange:f,class:"color-input"},null,544),[[d.vModelText,r.value]])])]),d.createElementVNode("div",G8,[b[15]||(b[15]=d.createElementVNode("span",{class:"style-label"},"线宽",-1)),d.createElementVNode("div",U8,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(c,C=>d.createElementVNode("button",{key:C.value,class:d.normalizeClass(["width-btn",{active:a.value===C.value}]),onClick:x=>m(C.value)},[d.createElementVNode("div",{class:"width-line",style:d.normalizeStyle({height:C.value+"px",backgroundColor:a.value===C.value?"#00e5d1":"#fff"})},null,4),d.createElementVNode("span",Q8,d.toDisplayString(C.label),1)],10,V8)),64))])])]),b[22]||(b[22]=d.createElementVNode("div",{class:"divider"},null,-1)),d.createElementVNode("div",{class:"action-section"},[b[20]||(b[20]=d.createElementVNode("div",{class:"section-label"},"操作",-1)),d.createElementVNode("div",{class:"action-grid"},[d.createElementVNode("button",{class:"action-btn delete-btn",onClick:y},[...b[17]||(b[17]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("polyline",{points:"3 6 5 6 21 6"}),d.createElementVNode("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1),d.createElementVNode("span",null,"删除",-1)])]),d.createElementVNode("button",{class:"action-btn clear-btn",onClick:g},[...b[18]||(b[18]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1),d.createElementVNode("span",null,"清空",-1)])]),d.createElementVNode("button",{class:"action-btn save-btn",onClick:A},[...b[19]||(b[19]=[d.createElementVNode("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[d.createElementVNode("path",{d:"M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"}),d.createElementVNode("polyline",{points:"17 21 17 13 7 13 7 21"}),d.createElementVNode("polyline",{points:"7 3 7 8 15 8"})],-1),d.createElementVNode("span",null,"保存",-1)])])])])])])):d.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b4979c4"]]),H8=["src"],qr=Be(d.defineComponent({__name:"LeitingBIM",props:{accessToken:{},cesiumUrl:{},cesiumCssUrl:{},methods:{},viewerOptions:{},treeProps:{},showTree:{type:Boolean,default:!0},showMenu:{type:Boolean,default:!1},playerUrl:{default:"https://leiting.chenxisoft.com/resource/person/person.glb"},playerModelName:{default:"Person"},playerModelId:{default:"player_111"},playerScale:{default:.0032},tiandituToken:{default:"c25f14fb6bd4397cf8fe45144ff768d6"},globe:{type:Boolean,default:void 0},terrain:{type:Boolean,default:void 0},depthTest:{type:Boolean,default:void 0},mapProvider:{},tiandituLayerType:{},tiandituShowLabel:{type:Boolean,default:void 0},arcgisUrl:{},teleportTarget:{},shadows:{type:Boolean,default:void 0},environmentMap:{type:Boolean,default:void 0},ambientOcclusion:{type:Boolean,default:void 0},time:{},brightness:{},backgroundColor:{},collision:{type:Boolean,default:void 0},mouseHabit:{},mode:{default:"3d"},mountAll3Dtiles:{},mountAllCad:{},saveRegion:{},saveCadRegion:{},saveCadCalibration:{},selectionChange:{},searchComponent:{}},emits:["register","init","ready"],setup(i,{expose:e,emit:t}){const n=d.ref(),s=d.ref(),o=d.getCurrentInstance(),r=d.ref(!1),a=d.ref(""),l=d.ref({}),c=d.ref("3d"),{isMobile:h}=Or(),u=i,p={title:"构件树",treeData:[]},f=d.ref(!1),m=d.ref(!1),y=d.ref(!1),g=d.ref(!1),A=d.ref(!1),v=d.ref(!1),b=d.ref(!1),C=d.ref(!1),x=d.ref(!1),I=d.ref(!1),E=d.ref(!1),S=d.ref(null),{visible:w,position:T,items:_,show:F,hide:U}=Bm(),L=d.ref([]),D=W=>{L.value.push(W)},M=W=>{L.value=L.value.filter(Y=>Y.id!==W)},k=d.ref([]),B=d.ref(""),P=d.ref(null),V=d.ref([]),G=d.reactive({tree:!1,section:!1,roam:!1,info:!1,adjustModel:!1,setting:!1,cadLayer:!1,cadPosition:!1,gisCadPosition:!1,annotation:!1}),R=(W,Y)=>{W==="componentTree"&&(W="tree"),W==="componentInfo"&&(W="info"),W in G&&(G[W]=Y)},N=d.shallowRef({});d.provide("leitingMethods",N);const O=d.ref(u.showMenu),z=d.ref([]);d.watch(()=>u.showMenu,W=>{O.value=W},{immediate:!0}),d.watch(()=>u.mode,W=>{W&&N.value?.set2d&&N.value.set2d(W==="2d")});const j=d.ref("dark");d.provide("leiting-theme",j);const Z=d.ref(u.teleportTarget);d.watch(()=>u.teleportTarget,W=>{Z.value=W});const te=d.ref([]),de=d.computed(()=>{const W=[];return f.value&&(W.push("tree"),W.push("componentTree")),m.value&&W.push("section"),y.value&&W.push("roam"),g.value&&(W.push("info"),W.push("componentInfo")),A.value&&W.push("adjust"),v.value&&W.push("setting"),b.value&&W.push("cadLayer"),C.value&&W.push("cadPosition"),x.value&&W.push("gisCadPosition"),I.value&&W.push("annotation"),E.value&&(W.push("measure"),W.push("measurement")),W.push(...te.value),W}),pe=d.ref(null),Ae=(W,Y)=>{W==="componentTree"||W==="tree"?f.value=Y:W==="section"?m.value=Y:W==="roam"?y.value=Y:W==="componentInfo"||W==="info"?g.value=Y:W==="homeView"?N.value?.is2dMode?.()?N.value?.flyToTopView?.({}):N.value?.getBIMmodelId()?N.value?.flyToTileset?.({}):N.value?.getCadModelId()&&N.value?.flyToTopView?.({}):W==="adjustModel"?(A.value=Y,Y&&pe.value&&pe.value.setModelType("BIM")):W==="osgbAdjust"?(A.value=Y,Y&&pe.value&&pe.value.setModelType("OSGB")):W==="setting"?v.value=Y:W==="cadLayer"?b.value=Y:W==="cadPosition"?C.value=Y:W==="gisCadPosition"?x.value=Y:W==="annotation"?I.value=Y:W==="measurement"?E.value=Y:Y?te.value.includes(W)||te.value.push(W):te.value=te.value.filter(ee=>ee!==W)},Pe=W=>{const Y=W.key||W.ID;if(!Y)return;if(Y==="homeView"||Y==="home"){Ae(Y,!0);return}if(Y==="measurement"){S.value="distance",E.value=!0;return}const ee=!de.value.includes(W.ID);Ae(Y,ee)},Ge=W=>{const Y=W.sub;if(!Y)return;const ee=Y.parentKey||W.parent?.key;ee==="measurement"?(S.value=Y.id.replace("measure-",""),E.value=!0):ee==="section"&&(m.value=!0)};d.watch(f,async W=>{if(W&&N.value?.loadTreeForModel&&N.value?.getMapTileset){const Y=N.value.getMapTileset(),ee=Object.values(Y).map(async Ze=>{if(Ze.leiting&&Ze.leiting.model?.treeUrl){const li=Ze.leiting.model.modelId;try{Ze.leiting?.node?.batchIdEIDInfos||await N.value.loadNodeDetailsForModel(li);const Yt=await N.value.loadTreeForModel(li);Yt&&(Array.isArray(Yt)?Yt:[Yt]).forEach(Yi=>{Yi&&!V.value.find(Yd=>Yd.id===Yi.id)&&(Yi.modelId=li,V.value=[...V.value,Yi])})}catch(Yt){console.warn(`Failed to lazy load tree for ${li}`,Yt)}}});await Promise.all(ee)}});const Je=()=>{N.value&&(N.value.getDxfModels&&(k.value=N.value.getDxfModels()||[]),N.value.getCadModelId&&(B.value=N.value.getCadModelId()||""))};let vt;d.watch(b,W=>{W&&Je()}),d.watch(C,W=>{W&&(Je(),P.value&&k.value.length&&P.value.addGltfOr3dTilesModelList(k.value))});const ct=t,Bt=W=>{N.value&&N.value.saveCadCalibration&&N.value.saveCadCalibration(W),N.value&&N.value.saveCadRegion&&N.value.saveCadRegion(W)};return d.onMounted(async()=>{if(s.value&&me.setContainer(s.value),!!n.value)try{const W={...bn,cesiumUrl:u.cesiumUrl||bn.cesiumUrl,cesiumCssUrl:u.cesiumCssUrl||bn.cesiumCssUrl,accessToken:u.accessToken||Jd()||bn.accessToken};await Va(W),r.value=!0,vt=async(ee={},Ze)=>{if(n.value){const{showMenu:li,showTree:Yt,globe:yn,terrain:Yi,depthTest:Yd,mapProvider:sU,tiandituLayerType:oU,tiandituShowLabel:rU,arcgisUrl:aU,shadows:lU,environmentMap:cU,ambientOcclusion:dU,time:hU,brightness:uU,backgroundColor:fU,collision:pU,mouseHabit:mU,heightBasedZoom:gU,mode:ry,...ci}=ee||{},yU=u.showMenu!==void 0?u.showMenu:li!==void 0?li:!0;O.value=yU;const ft=(se,He,$t)=>se!==void 0?se:He!==void 0?He:$t,ay=ft(u.globe,yn,!1),ly=ft(u.terrain,Yi,!1),cy=ft(u.depthTest,Yd,!1),dy=ft(u.mapProvider,sU,"tianditu"),hy=ft(u.tiandituLayerType,oU,"img_w"),uy=ft(u.tiandituShowLabel,rU,!1),fy=ft(u.arcgisUrl,aU,"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"),py=ft(u.shadows,lU,!1),my=ft(u.environmentMap,cU,!1),gy=ft(u.ambientOcclusion,dU,!1),yy=ft(u.time,hU,void 0),Ay=ft(u.brightness,uU,1),La=u.mode||ry||"3d";u.mode,c.value=La;const AU=La==="2d"?"#000000":"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",vy=ft(u.backgroundColor,fU,AU),by=ft(u.collision,pU,!1),wy=ft(u.mouseHabit,mU,0),Cy=ft(u.heightBasedZoom,gU,!1);l.value={globe:ay,terrain:ly,depthTest:cy,mapProvider:dy,tiandituLayerType:hy,tiandituShowLabel:uy,arcgisUrl:fy,shadows:py,environmentMap:my,ambientOcclusion:gy,time:yy,brightness:Ay,backgroundColor:vy,collision:by,mouseHabit:wy,heightBasedZoom:Cy,useBrowserRecommendedResolution:!0};const No=CB({container:n.value,appContext:o?.appContext,methods:{...N.value,handleMenuAction:Ae,setCardFullHeight:R,onLoadingStatus:se=>{se?me.loading(se,"",s.value):me.close()},...ci,tilesLoad3dTiles:async se=>{let He=se.leiting?.tree;const $t=se.leiting?.model?.modelId;if(!He&&f.value&&N.value?.loadTreeForModel)try{He=await N.value.loadTreeForModel($t)}catch(Ro){console.warn("Failed to lazy load tree",Ro)}He&&(Array.isArray(He)?He:[He]).forEach(vn=>{vn&&!V.value.find(xy=>xy.id===vn.id)&&(vn.modelId=$t,V.value=[...V.value,vn])});const{brightness:$d,contrast:jd,saturation:wi}=No.methods.getConfigure();No.methods.setModelColorAdjustment({brightness:$d,contrast:jd,saturation:wi}),ci.tilesLoad3dTiles?.(se)},mountAll3Dtiles:se=>{u.mountAll3Dtiles&&u.mountAll3Dtiles(se),ci.mountAll3Dtiles?.(se)},updateModels:se=>{if(Array.isArray(se))if(se.length===0)V.value=[];else{const He=se.map($t=>$t.modelId);V.value=V.value.filter($t=>He.includes($t.modelId))}},mountAllCad:se=>{if(No.methods.setModelBrightness){const He=u.brightness!==void 0?u.brightness:l.value.brightness;He!==void 0&&No.methods.setModelBrightness(He)}u.mountAllCad&&u.mountAllCad(se),ci.mountAllCad?.(se)},saveRegion:se=>{u.saveRegion&&u.saveRegion(se),ci.saveRegion?.(se)},saveCadRegion:se=>{u.saveCadRegion&&u.saveCadRegion(se),ci.saveCadRegion?.(se)},saveCadCalibration:se=>{u.saveCadCalibration&&u.saveCadCalibration(se),ci.saveCadCalibration?.(se)},selectionChange:se=>{u.selectionChange&&u.selectionChange(se),ci.selectionChange?.(se)},onSearchComponent:se=>{u.searchComponent&&u.searchComponent(se),ci.searchComponent?.(se)}},viewerOptions:u.viewerOptions,options:{...ci,mode:La,playerUrl:u.playerUrl,playerModelName:u.playerModelName,playerModelId:u.playerModelId,playerScale:u.playerScale,globe:ay,terrain:ly,depthTest:cy,mapProvider:dy,tiandituLayerType:hy,tiandituShowLabel:uy,tiandituToken:u.tiandituToken,arcgisUrl:fy,shadows:py,environmentMap:my,ambientOcclusion:gy,time:yy,brightness:Ay,backgroundColor:vy,collision:by,mouseHabit:wy,heightBasedZoom:Cy},callbacks:{onLoading:se=>se?me.loading(se,"",s.value):me.close(),onSuccess:se=>me.success(se,"",void 0,s.value),onError:se=>me.error(se,"",void 0,s.value)}}),{Cesium:An,viewer:gs,methods:Ra,menuEvents:Lo}=No,xe=Ra;Lo.on("showMenu",se=>{O.value=se}),Lo.on("insertMenu",se=>{z.value=[...z.value,...se]}),Lo.on("setMenuActive",(se,He)=>{Ae(se,He)}),N.value=xe,Ze&&(Ze.value=xe),Lo.on("setMode",se=>{c.value=se}),Lo.on("deleteAllModels",()=>{V.value=[]}),new An.ScreenSpaceEventHandler(gs.scene.canvas).setInputAction(async se=>{if(U(),c.value==="2d")return;const He=gs.scene.pick(se.position),$t=gs.container.getBoundingClientRect(),$d=$t.left+se.position.x,jd=$t.top+se.position.y,wi=[];if(An.defined(He)&&He instanceof An.Cesium3DTileFeature){const Ro=xe.baseCompt.getFeatureId(He),vn=ks(He.tileset);xe.baseCompt.hasSelectedFeaturesMap[vn]?.some(Fo=>Fo.batchId===Ro&&Fo.rank===0)||(await xe.baseCompt.clearSelection(),await xe.baseCompt.toggleMultiSelect(vn,Ro,xe.baseCompt.selectedColor)),wi.push({id:"details",label:"构件详情",action:()=>{g.value=!0}}),wi.push({id:"hide",label:"隐藏选中构件",action:async()=>{const Oo=(await xe.baseCompt.getSelected()).map(Ci=>({elementId:Ci.elementId,modelId:Ci.modelId,show:!1}));xe.baseCompt.setComponentVisibility(Oo)}}),wi.push({id:"translucent",label:"半透明选中构件",action:async()=>{const Oo=(await xe.baseCompt.getSelected()).map(Ci=>({elementId:Ci.elementId,modelId:Ci.modelId,rgba:{...Ci.rgba,a:.3}}));await xe.baseCompt.setSelectColorUserModelCpt(Oo,{rank:0})}}),wi.push({id:"isolate",label:"隔离选中构件",divided:!0,action:async()=>{await xe.baseCompt.loadAllNodeDetailsForModel();const Oo=(await xe.baseCompt.getSelected()).map(Ci=>({elementId:Ci.elementId,modelId:Ci.modelId,show:!0}));xe.isolateComponents(Oo)}})}wi.push({id:"showAll",label:"显示所有",action:async()=>{xe.baseCompt.setAllComponentsVisibility(!0),await xe.baseCompt.clearSelection()}}),wi.push(...L.value),F({x:$d,y:jd},wi)},An.ScreenSpaceEventType.RIGHT_CLICK),xe.addContextMenuItems=D,xe.insertContextMenu=xe.addContextMenuItems,xe.removeContextMenuItems=M,xe.deleteContextMenu=xe.removeContextMenuItems,xe.closeContextMenu=U,xe.hideContextMenu=xe.closeContextMenu,xe.onSetTeleportTarget=se=>{Z.value=se},await d.nextTick();const Ey=ee?.onLoaded||ee?.onloaded;Ey&&Ey({Cesium:An,viewer:gs,methods:Ra}),ct("init",{Cesium:An,viewer:gs,methods:Ra}),ct("ready",{Cesium:An,viewer:gs,methods:Ra})}};let Y=!1;ct("register",(ee,Ze)=>{Y=!0,vt(ee,Ze)}),Y||setTimeout(()=>{N.value.getViewer||vt()},0)}catch(W){a.value="Failed to load Cesium: "+(W.message||W),console.error(W)}}),d.onUnmounted(()=>{me.setContainer(null)}),e({initMap:()=>N.value,initializeViewer:(W,Y)=>vt(W,Y)}),(W,Y)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["leiting-bim-container",[`theme-${j.value}`]]),onContextmenu:Y[29]||(Y[29]=d.withModifiers(()=>{},["prevent","stop"]))},[!r.value&&!a.value?(d.openBlock(),d.createBlock(d.unref(re.Spin),{key:0,class:"loading",size:"large",tip:"加载基础组件中..."})):d.createCommentVNode("",!0),a.value?(d.openBlock(),d.createBlock(d.unref(re.Alert),{key:1,class:"error",type:"error",message:a.value,"show-icon":""},null,8,["message"])):d.createCommentVNode("",!0),d.createElementVNode("div",{ref_key:"containerRef",ref:n,class:"cesium-viewer"},[d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(ao,{key:0,visible:O.value,"active-ids":de.value,"custom-items":z.value,onAction:Ae,"is-2d":c.value==="2d"},null,8,["visible","active-ids","custom-items","is-2d"])),d.unref(h)&&!y.value&&!E.value?(d.openBlock(),d.createBlock(_m,{key:1,"active-ids":de.value,"is-2d":c.value==="2d",onItemClick:Pe,onSubItemClick:Ge},null,8,["active-ids","is-2d"])):d.createCommentVNode("",!0),d.unref(h)&&i.showTree!==!1&&!y.value&&c.value!=="2d"?(d.openBlock(),d.createElementBlock("button",{key:2,class:d.normalizeClass(["mobile-float-tree-btn",{active:f.value}]),onClick:Y[0]||(Y[0]=ee=>f.value=!f.value)},[d.createElementVNode("img",{src:d.unref(Ur),class:"mobile-float-tree-icon",alt:"目录树"},null,8,H8)],2)):d.createCommentVNode("",!0),(d.openBlock(),d.createBlock(d.Teleport,{to:Z.value||"body",disabled:!Z.value},[d.createElementVNode("div",{ref_key:"uiOverlayRef",ref:s,class:"leiting-ui-overlay"},[d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(ho,{key:0,visible:g.value,"full-height":G.info,"onUpdate:visible":Y[1]||(Y[1]=ee=>g.value=ee)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(Rm,{key:1,visible:g.value,"onUpdate:visible":Y[2]||(Y[2]=ee=>g.value=ee),onClose:Y[3]||(Y[3]=()=>{g.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.createVNode(uo,{ref_key:"LeitingPositionRef",ref:pe,visible:A.value,"full-height":G.adjustModel,"onUpdate:visible":Y[4]||(Y[4]=ee=>A.value=ee)},null,8,["visible","full-height"]),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(fo,{key:2,visible:v.value,"full-height":G.setting,"tianditu-token":u.tiandituToken,"initial-config":l.value,"onUpdate:visible":Y[5]||(Y[5]=ee=>v.value=ee)},null,8,["visible","full-height","tianditu-token","initial-config"])),d.unref(h)?(d.openBlock(),d.createBlock(Pm,{key:3,visible:v.value,"onUpdate:visible":Y[6]||(Y[6]=ee=>v.value=ee),onClose:Y[7]||(Y[7]=()=>{v.value=!1,te.value=te.value.filter(ee=>ee!=="setting")})},null,8,["visible"])):d.createCommentVNode("",!0),i.showTree!==!1&&!d.unref(h)?(d.openBlock(),d.createBlock(Gr,d.mergeProps({key:4},{...p,...i.treeProps},{visible:f.value,"full-height":G.tree,"tree-data":V.value.length>0?V.value:i.treeProps?.treeData||[],"onUpdate:visible":Y[8]||(Y[8]=ee=>{f.value=ee})}),null,16,["visible","full-height","tree-data"])):d.createCommentVNode("",!0),i.showTree!==!1&&d.unref(h)?(d.openBlock(),d.createBlock(km,{key:5,visible:f.value,"tree-data":V.value.length>0?V.value:i.treeProps?.treeData||[],"onUpdate:visible":Y[9]||(Y[9]=ee=>{f.value=ee}),onClose:Y[10]||(Y[10]=()=>{f.value=!1})},null,8,["visible","tree-data"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(dN,{key:6,visible:I.value,"onUpdate:visible":Y[11]||(Y[11]=ee=>I.value=ee)},null,8,["visible"])),d.unref(h)?(d.openBlock(),d.createBlock(z8,{key:7,visible:I.value,"onUpdate:visible":Y[12]||(Y[12]=ee=>I.value=ee)},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(_N,{key:8,visible:E.value,"onUpdate:visible":Y[13]||(Y[13]=ee=>E.value=ee)},null,8,["visible"])),d.unref(h)?(d.openBlock(),d.createBlock(Nm,{key:9,visible:E.value,"default-tool":S.value,"onUpdate:visible":Y[14]||(Y[14]=ee=>{E.value=ee,ee||(S.value=null)}),onClose:Y[15]||(Y[15]=()=>{E.value=!1,S.value=null})},null,8,["visible","default-tool"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(lo,{key:10,visible:m.value,"full-height":G.section,"onUpdate:visible":Y[16]||(Y[16]=ee=>m.value=ee)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(Dm,{key:11,visible:m.value,"onUpdate:visible":Y[17]||(Y[17]=ee=>m.value=ee),onClose:Y[18]||(Y[18]=()=>{m.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(co,{key:12,visible:y.value,"full-height":G.roam,"onUpdate:visible":Y[19]||(Y[19]=ee=>y.value=ee)},null,8,["visible","full-height"])),d.unref(h)?(d.openBlock(),d.createBlock(Lm,{key:13,visible:y.value,"onUpdate:visible":Y[20]||(Y[20]=ee=>y.value=ee),onClose:Y[21]||(Y[21]=()=>{y.value=!1})},null,8,["visible"])):d.createCommentVNode("",!0),d.unref(h)?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(Zk,{key:14,visible:b.value,"current-model-id":B.value,"onUpdate:visible":Y[22]||(Y[22]=ee=>b.value=ee),onHandleCloseCardByCadCard:Y[23]||(Y[23]=()=>{b.value=!1})},null,8,["visible","current-model-id"])),d.unref(h)?(d.openBlock(),d.createBlock(P8,{key:15,visible:b.value,"current-model-id":B.value,"onUpdate:visible":Y[24]||(Y[24]=ee=>b.value=ee),onHandleCloseCardByCadCard:Y[25]||(Y[25]=()=>{b.value=!1})},null,8,["visible","current-model-id"])):d.createCommentVNode("",!0),d.createVNode($P,{ref_key:"cadPositionRef",ref:P,visible:C.value,"onUpdate:visible":Y[26]||(Y[26]=ee=>C.value=ee),onSave:Bt},null,8,["visible"]),d.createVNode(tN,{visible:x.value,"onUpdate:visible":Y[27]||(Y[27]=ee=>x.value=ee)},null,8,["visible"]),d.createVNode(NN,{visible:d.unref(w),position:d.unref(T),items:d.unref(_),"onUpdate:visible":Y[28]||(Y[28]=ee=>w.value=ee)},null,8,["visible","position","items"]),d.renderSlot(W.$slots,"default",d.normalizeProps(d.guardReactiveProps({methods:N.value,isReady:r.value})),void 0,!0)],512)],8,["to","disabled"]))],512)],34))}}),[["__scopeId","data-v-23352a4a"]]);function Y8(i,e={}){const{tapDelay:t=300,doubleTapDelay:n=300,moveThreshold:s=10}=e;let o=0,r={x:0,y:0},a=0,l=0,c=null;const h=[],u=[],p=[],f={},m=T=>{const _=T.touches[0]||T.changedTouches[0];return{x:_?.clientX??0,y:_?.clientY??0}},y=T=>{const _=m(T);o=Date.now(),r=_,a=0,p.forEach(({handler:F,delay:U})=>{c=window.setTimeout(()=>{F(T),c=null},U)})},g=T=>{const _=m(T),F=_.x-r.x,U=_.y-r.y;a=Math.sqrt(F*F+U*U),c&&a>s&&(clearTimeout(c),c=null)},A=T=>{const _=Date.now()-o,F=m(T),U=F.x-r.x,L=F.y-r.y;c&&(clearTimeout(c),c=null);const D=_<t&&a<s;if(D&&Date.now()-l<n&&a<s?(u.forEach(B=>B(T)),l=0):D&&(h.forEach(B=>B(T)),l=Date.now()),a>50){const B=Math.abs(U),P=Math.abs(L);B>P?U>0&&f.right?f.right(T):U<0&&f.left&&f.left(T):L>0&&f.down?f.down(T):L<0&&f.up&&f.up(T)}},v=T=>{h.push(T)},b=T=>{u.push(T)},C=(T,_=500)=>{p.push({handler:T,delay:_})},x=T=>{f.left=T},I=T=>{f.right=T},E=T=>{f.up=T},S=T=>{f.down=T},w=()=>{c&&(clearTimeout(c),c=null),h.length=0,u.length=0,p.length=0,Object.keys(f).forEach(T=>{delete f[T]})};return d.onMounted(()=>{const T=i.value;T&&(T.addEventListener("touchstart",y,{passive:!1}),T.addEventListener("touchmove",g,{passive:!1}),T.addEventListener("touchend",A,{passive:!1}))}),d.onUnmounted(()=>{w();const T=i.value;T&&(T.removeEventListener("touchstart",y),T.removeEventListener("touchmove",g),T.removeEventListener("touchend",A))}),{onTap:v,onDoubleTap:b,onLongPress:C,onSwipeLeft:x,onSwipeRight:I,onSwipeUp:E,onSwipeDown:S,destroy:w}}function $8(i){const e=t=>{t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLSelectElement||t.preventDefault()};return i.addEventListener("touchmove",e,{passive:!1}),()=>{i.removeEventListener("touchmove",e)}}function j8(){let i=0;const e=t=>{const n=Date.now();n-i<=300&&t.preventDefault(),i=n};return document.addEventListener("touchend",e,{passive:!1}),document.addEventListener("gesturestart",t=>t.preventDefault()),document.addEventListener("gesturechange",t=>t.preventDefault()),()=>{document.removeEventListener("touchend",e)}}function W8(i,e={}){const{delay:t=500,moveThreshold:n=10}=e,s=d.ref(!1);let o=null,r={x:0,y:0},a=!1;const l=f=>{if(f.touches.length!==1)return;f.preventDefault(),a=!0,s.value=!1;const m=f.touches[0];r={x:m?.clientX??0,y:m?.clientY??0},o=window.setTimeout(()=>{a&&(s.value=!0,i())},t)},c=f=>{if(!a||o===null)return;const m=f.touches[0],y=(m?.clientX??0)-r.x,g=(m?.clientY??0)-r.y;Math.sqrt(y*y+g*g)>n&&u()},h=()=>{a=!1,s.value=!1,o!==null&&(clearTimeout(o),o=null)},u=()=>{a=!1,s.value=!1,o!==null&&(clearTimeout(o),o=null)};return{isLongPressing:s,handlers:{onTouchStart:l,onTouchMove:c,onTouchEnd:h},start:l,end:h,cancel:u}}function q8(i,e,t={}){const{delay:n=500,moveThreshold:s=10}=t;let o=null,r={x:0,y:0};const a=h=>{if(h.touches.length!==1)return;h.preventDefault();const u=h.touches[0];r={x:u?.clientX??0,y:u?.clientY??0},o=window.setTimeout(()=>{e()},n)},l=h=>{if(o===null)return;const u=h.touches[0],p=(u?.clientX??0)-r.x,f=(u?.clientY??0)-r.y;Math.sqrt(p*p+f*f)>s&&(clearTimeout(o),o=null)},c=()=>{o!==null&&(clearTimeout(o),o=null)};return i.addEventListener("touchstart",a,{passive:!1}),i.addEventListener("touchmove",l,{passive:!1}),i.addEventListener("touchend",c),i.addEventListener("touchcancel",c),()=>{o!==null&&(clearTimeout(o),o=null),i.removeEventListener("touchstart",a),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",c),i.removeEventListener("touchcancel",c)}}const K8={tapThreshold:10,doubleTapInterval:300,longPressDelay:500,panThreshold:20,pinchThreshold:.02};function X8(i={}){const e={...K8,...i},t=d.reactive({type:"none",startX:0,startY:0,currentX:0,currentY:0,deltaX:0,deltaY:0,scale:1,rotation:0,velocityX:0,velocityY:0,duration:0}),n=d.ref(!1),s=d.ref(!1),o=d.ref(!1);let r=0,a=0,l=null,c=0,h=1,u=0,p=null;const f={onTap:[],onDoubleTap:[],onLongPress:[],onPanStart:[],onPanMove:[],onPanEnd:[],onPinchStart:[],onPinchMove:[],onPinchEnd:[],onRotate:[]},m=L=>{if(L.length<2)return 0;const D=L[1].clientX-L[0].clientX,M=L[1].clientY-L[0].clientY;return Math.sqrt(D*D+M*M)},y=L=>L.length<2?0:Math.atan2(L[1].clientY-L[0].clientY,L[1].clientX-L[0].clientX)*(180/Math.PI);return{state:t,isActive:n,isPanning:s,isPinching:o,handlers:{onTouchStart:L=>{if(L.touches.length===1){const D=L.touches[0];p=D.identifier,r=Date.now(),t.startX=D.clientX,t.startY=D.clientY,t.currentX=D.clientX,t.currentY=D.clientY,t.deltaX=0,t.deltaY=0,n.value=!0,l=window.setTimeout(()=>{t.type="long-press",f.onLongPress.forEach(M=>M(L))},e.longPressDelay)}else L.touches.length===2&&(l&&(clearTimeout(l),l=null),o.value=!0,c=m(L.touches),h=1,u=y(L.touches),f.onPinchStart.forEach(D=>D(L)))},onTouchMove:L=>{if(L.touches.length===1&&p!==null){let D=null;for(let P=0;P<L.touches.length;P++)if(L.touches[P].identifier===p){D=L.touches[P];break}if(!D)return;const M=D.clientX-t.startX,k=D.clientY-t.startY;Math.sqrt(M*M+k*k)>e.panThreshold&&!s.value&&(s.value=!0,t.type="pan",l&&(clearTimeout(l),l=null),f.onPanStart.forEach(P=>P(L))),s.value&&(L.preventDefault(),t.deltaX=D.clientX-t.currentX,t.deltaY=D.clientY-t.currentY,t.currentX=D.clientX,t.currentY=D.clientY,t.velocityX=t.deltaX,t.velocityY=t.deltaY,f.onPanMove.forEach(P=>P(L)))}else if(L.touches.length===2&&o.value){L.preventDefault();const D=m(L.touches),M=y(L.touches),k=D/c;t.scale=h*k,t.rotation=M-u,f.onPinchMove.forEach(B=>B(L)),f.onRotate.forEach(B=>B(L))}},onTouchEnd:L=>{if(t.duration=Date.now()-r,l&&(clearTimeout(l),l=null),L.touches.length===0){if(s.value)t.type="pan",f.onPanEnd.forEach(D=>D(L));else if(o.value)f.onPinchEnd.forEach(D=>D(L));else if(t.type==="none"&&t.duration<300){const D=Date.now();D-a<e.doubleTapInterval?(t.type="double-tap",f.onDoubleTap.forEach(M=>M(L)),a=0):(t.type="tap",f.onTap.forEach(M=>M(L)),a=D)}s.value=!1,o.value=!1,n.value=!1,p=null,setTimeout(()=>{t.type="none",t.deltaX=0,t.deltaY=0,t.scale=1,t.rotation=0},50)}}},onTap:L=>{f.onTap.push(L)},onDoubleTap:L=>{f.onDoubleTap.push(L)},onLongPress:L=>{f.onLongPress.push(L)},onPanStart:L=>{f.onPanStart.push(L)},onPanMove:L=>{f.onPanMove.push(L)},onPanEnd:L=>{f.onPanEnd.push(L)},onPinchStart:L=>{f.onPinchStart.push(L)},onPinchMove:L=>{f.onPinchMove.push(L)},onPinchEnd:L=>{f.onPinchEnd.push(L)},onRotate:L=>{f.onRotate.push(L)}}}const Kr={enableFpsLimit:!0,targetFps:30,enableResolutionScale:!0,resolutionScale:.75,enableLazyLoad:!0,lazyLoadDelay:200,enableModelLod:!0,modelQualityLevel:"medium",enablePostProcessing:!1,enableFxaa:!1,enableAmbientOcclusion:!1,enableShadows:!1,maxTextureSize:1024,enableDebounce:!0,debounceDelay:100};function J8(i={}){const e={...Kr,...i};return{requestRenderMode:e.enableFpsLimit,maximumRenderTimeChange:e.enableFpsLimit?1e3/e.targetFps:void 0,scene3DOnly:!0,shouldAnimate:!0}}function Z8(i={}){const e={...Kr,...i};return{resolutionScale:e.enableResolutionScale?e.resolutionScale:1,targetFrameRate:e.enableFpsLimit?e.targetFps:void 0,sceneModePicker:!1,navigationHelpButton:!1,animation:!1,timeline:!1,fullscreenButton:!1,vrButton:!1,infoBox:!1,selectionIndicator:!1,shadows:e.enableShadows,skyAtmosphere:e.enablePostProcessing,fog:e.enablePostProcessing}}function eR(i={}){const e={...Kr,...i},n={low:{maximumScreenSpaceError:64,skipScreenSpaceErrorFactor:256,skipLevels:8,baseScreenSpaceError:2048},medium:{maximumScreenSpaceError:48,skipScreenSpaceErrorFactor:128,skipLevels:5,baseScreenSpaceError:1024},high:{maximumScreenSpaceError:32,skipScreenSpaceErrorFactor:64,skipLevels:3,baseScreenSpaceError:512}}[e.modelQualityLevel];return{cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,backFaceCulling:!0,colorBlendAmount:0,minimumPixelSize:128,maximumScreenSpaceError:n.maximumScreenSpaceError,skipLevelOfDetail:e.enableModelLod,baseScreenSpaceError:n.baseScreenSpaceError,skipScreenSpaceErrorFactor:n.skipScreenSpaceErrorFactor,skipLevels:n.skipLevels,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!1,maximumMemoryUsage:4096*5,preloadWhenHidden:!0,preferLeaves:e.enableModelLod,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.002,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorHeightFalloff:.25,foveatedConeSize:0,foveatedTimeDelay:10,foveatedMinimumScreenSpaceErrorRelaxation:0}}function tR(i=30){const e=d.ref(60),t=d.ref(!1);let n=0,s=0,o=0;const r=1e3/i,a=()=>{t.value=!0,n=performance.now(),o=n,s=0},l=()=>{if(!t.value)return!0;const h=performance.now(),u=h-n;return s++,h-o>=1e3&&(e.value=Math.round(s*1e3/(h-o)),s=0,o=h),u>=r?(n=h-u%r,!0):!1},c=()=>{t.value=!1};return d.onUnmounted(()=>{c()}),{fps:e,isControlling:t,startControl:a,stopControl:c,tick:l}}function iR(i,e){let t=null;const n=((...s)=>{t!==null&&clearTimeout(t),t=window.setTimeout(()=>{i(...s),t=null},e)});return n.cancel=()=>{t!==null&&(clearTimeout(t),t=null)},n}function nR(i,e){let t=!1;return((...s)=>{t||(i(...s),t=!0,setTimeout(()=>{t=!1},e))})}function sR(i,e=200){let t=null;const n=()=>{t!==null&&clearTimeout(t),t=window.setTimeout(()=>{i(),t=null},e)},s=()=>{t!==null&&(clearTimeout(t),t=null)};return d.onUnmounted(()=>{s()}),{load:n,cancel:s}}function Fm(i){const e=d.ref(),t=d.ref(i.theme||"dark"),n=d.ref(i.menuSize||"medium");d.provide("leiting-theme",t),d.provide("leiting-menu-size",n);function s(a){d.onUnmounted(()=>{e.value=null}),a(i,e)}function o(){const a=d.unref(e);return a||console.error("未获取到leiting实例!"),a}const r=new Proxy({},{get(a,l){const c=o();if(!c)return;const h=c[l];return typeof h=="function"?h.bind(c):h},set(a,l,c){const h=o();return h?(h[l]=c,!0):!1}});return[s,r]}const oR=bn,rR={install:(i,e)=>{if(i.component("LeitingBIM",qr),i.component("LeitingTree",Gr),i.component("LeitingDraggableCard",gt),i.component("leiting-draggable-card",gt),i.component("LeitingMenu",ao),i.component("leiting-menu",ao),i.component("LeitingSection",lo),i.component("leiting-section",lo),i.component("LeitingPlayer",co),i.component("leiting-player",co),i.component("LeitingInfo",ho),i.component("leiting-info",ho),i.component("LeitingPosition",uo),i.component("leiting-position",uo),i.component("LeitingSetting",fo),i.component("leiting-setting",fo),!e)return;const t={...oR,...e};t.cesiumUrl&&Va(t).catch(n=>{console.error("[LeitingBim] Failed to load Cesium resources:",n)}),i.config.globalProperties.$leitingBimOptions=t}};function aR(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i))}}var lR="@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}";aR(lR);var wc=function(i,e){return wc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])},wc(i,e)};function cR(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");wc(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fi=function(){return Fi=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Fi.apply(this,arguments)};function pi(i,e,t,n){function s(o){return o instanceof t?o:new t(function(r){r(o)})}return new(t||(t=Promise))(function(o,r){function a(h){try{c(n.next(h))}catch(u){r(u)}}function l(h){try{c(n.throw(h))}catch(u){r(u)}}function c(h){h.done?o(h.value):s(h.value).then(a,l)}c((n=n.apply(i,e||[])).next())})}function ei(i,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,r=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return r.next=a(0),r.throw=a(1),r.return=a(2),typeof Symbol=="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(c){return function(h){return l([c,h])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(t=0)),t;)try{if(n=1,s&&(o=c[0]&2?s.return:c[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,c[1])).done)return o;switch(s=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,s=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(h){c=[6,h],s=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var Om=function(i){return i.toDataURL("image/png",1)},Gm=function(i){return typeof i=="function"},zt=function(i){return i===void 0},dR=function(i){return typeof i=="string"},Um=function(i,e,t){e===void 0&&(e={}),t===void 0&&(t="http://www.w3.org/2000/svg");var n=document.createElementNS(t,i);for(var s in e)n.setAttribute(s,e[s]);return n},hR=function(i,e,t){for(var n=[],s="",o="",r=0,a=e.length;r<a;r++){if(o=e.charAt(r),o===`
122
- `){n.push(s),s="";continue}s+=o,i.measureText(s).width>t&&(n.push(s.substring(0,s.length-1)),s="",r--)}return n.push(s),n},uR=function(i,e){return pi(void 0,void 0,void 0,function(){var t,n,s,o,r,a,l,c,h;return ei(this,function(u){switch(u.label){case 0:return t=Um("svg",{xmlns:"http://www.w3.org/2000/svg"}),n=document.createElement("div"),n.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),n.style.cssText=`
123
- text-align: center;
124
- display: flex;
125
- align-items: center;
126
- justify-content: center;
127
- width: 100%;
128
- height: 100%;
129
- font: `.concat(i.font,`;
130
- color: `).concat(e.fontColor,`;
131
- `),n.innerHTML="<div class='rich-text-content'>".concat(e.content,"</div>"),document.body.appendChild(n),[4,fR(n)];case 1:return u.sent(),s=(h=n.querySelector(".rich-text-content"))===null||h===void 0?void 0:h.getBoundingClientRect(),o=s?.width,r=s?.height,document.body.removeChild(n),a=e.richTextWidth||o||e.width,l=e.richTextHeight||r||e.height,t.setAttribute("width",a.toString()),t.setAttribute("height",l.toString()),c=Um("foreignObject",{width:a.toString(),height:l.toString()}),c.appendChild(n),t.appendChild(c),[2,{element:t,width:a,height:l}]}})})};function fR(i){return pi(this,void 0,void 0,function(){var e,t,n,s,o;return ei(this,function(r){switch(r.label){case 0:e=i.querySelectorAll("img"),t=function(a){var l,c,h,u,p;return ei(this,function(f){switch(f.label){case 0:if(l=a.getAttribute("src"),!l)return[3,6];f.label=1;case 1:return f.trys.push([1,5,,6]),[4,fetch(l)];case 2:return c=f.sent(),[4,c.blob()];case 3:return h=f.sent(),[4,new Promise(function(m,y){var g=new FileReader;g.onloadend=function(){return m(g.result)},g.onerror=y,g.readAsDataURL(h)})];case 4:return u=f.sent(),dR(u)&&a.setAttribute("src",u),[3,6];case 5:return p=f.sent(),console.error("Error converting ".concat(l," to base64:"),p),[3,6];case 6:return[2]}})},n=0,s=Array.from(e),r.label=1;case 1:return n<s.length?(o=s[n],[5,t(o)]):[3,4];case 2:r.sent(),r.label=3;case 3:return n++,[3,1];case 4:return[2]}})})}var pR=function(i){var e=i.outerHTML.replace(/<(img|br|input|hr|embed)(.*?)>/g,"<$1$2/>").replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");return"data:image/svg+xml;charset=utf-8,".concat(e)},rt=function(i,e){return zt(i)?e:i},Vm=function(i,e,t){e===void 0&&(e=void 0),t===void 0&&(t=void 0);var n=new Image;return n.setAttribute("crossOrigin","anonymous"),!zt(e)&&(n.width=e),!zt(t)&&(n.height=t),n.src=i,new Promise(function(s){n.onload=function(){s(n)}})},mR=function(i,e,t){return Array.from({length:i},function(){return new Array(e).fill(t)})},gR=function(i,e){if(!i)return"";var t=Math.random()*6+2,n=Math.random()*2+2;switch(e){case"repeat":return"animation: 200s linear 0s infinite alternate watermark !important;";case"repeat-x":return"animation: ".concat(t,"s linear 0s infinite alternate watermark-vertical !important;'");case"repeat-y":return"animation: ".concat(n,"s linear 0s infinite alternate watermark-horizontal !important;'");case"no-repeat":return"animation: ".concat(t,"s linear 0s infinite alternate watermark-horizontal, ").concat(n,"s linear 0s infinite alternate watermark-vertical !important;");default:return""}},Qm={width:300,height:300,rotate:45,layout:"default",auxiliaryLine:!1,translatePlacement:"middle",contentType:"text",content:"hello watermark-js-plus",textType:"fill",imageWidth:0,imageHeight:0,lineHeight:30,zIndex:2147483647,backgroundPosition:"0 0",backgroundRepeat:"repeat",fontSize:"20px",fontFamily:"sans-serif",fontStyle:"",fontVariant:"",fontColor:"#000",fontWeight:"normal",filter:"none",letterSpacing:"0px",wordSpacing:"0px",globalAlpha:.5,mode:"default",mutationObserve:!0,monitorProtection:!1,movable:!1,parent:"body",onSuccess:function(){},onBeforeDestroy:function(){},onDestroyed:function(){},onObserveError:function(){}},yR=function(i,e,t){var n=i.getContext("2d");if(n===null)throw new Error("get context error");n.font="".concat(e.fontStyle," ").concat(e.fontVariant," ").concat(e.fontWeight," ").concat(e.fontSize," ").concat(e.fontFamily),n.filter=e.filter,n.letterSpacing=e.letterSpacing,n.wordSpacing=e.wordSpacing,e?.rotate&&(e.rotate=(360-e.rotate%360)*(Math.PI/180)),zt(t.textRowMaxWidth)&&(e.textRowMaxWidth=e.width);var s={image:{rect:{width:e.imageWidth,height:e.imageHeight},position:{x:0,y:0}},textLine:{data:[],yOffsetValue:0},advancedStyleParams:{linear:{x0:0,x1:0},radial:{x0:0,y0:0,r0:0,x1:0,y1:0,r1:0},conic:{x:0,y:0,startAngle:0},pattern:{}}};switch(e.contentType){case"text":s.textLine.data=[e.content];break;case"multi-line-text":s.textLine.data=hR(n,e.content,e.textRowMaxWidth);break}var o=e.width/2,r=e.height/2,a="middle",l="center";switch(!zt(t?.translateX)&&!zt(t?.translateY)?(o=t?.translateX,r=t?.translateY,a="top",l="left"):(s.advancedStyleParams.linear.x0=-e.width/2,s.advancedStyleParams.linear.x1=e.width/2,s.advancedStyleParams.radial.r0=0,s.advancedStyleParams.radial.r1=e.width/2),t.translatePlacement){case"top":o=e.width/2,r=0,a="top",s.advancedStyleParams.linear.x0=-e.width/2,s.advancedStyleParams.linear.x1=e.width/2,s.advancedStyleParams.radial.y0=s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.radial.y1=s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.conic.y=s.textLine.data.length*e.lineHeight/2;break;case"top-start":o=0,r=0,a="top",l="start",s.advancedStyleParams.linear.x0=0,s.advancedStyleParams.linear.x1=e.width,s.advancedStyleParams.radial.x0=e.width/2,s.advancedStyleParams.radial.y0=s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.radial.x1=e.width/2,s.advancedStyleParams.radial.y1=s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.conic.x=e.width/2,s.advancedStyleParams.conic.y=s.textLine.data.length*e.lineHeight/2;break;case"top-end":o=e.width,r=0,a="top",l="end",s.advancedStyleParams.linear.x0=0,s.advancedStyleParams.linear.x1=-e.width,s.advancedStyleParams.radial.x0=-e.width/2,s.advancedStyleParams.radial.y0=s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.radial.x1=-e.width/2,s.advancedStyleParams.radial.y1=s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.conic.x=-e.width/2,s.advancedStyleParams.conic.y=s.textLine.data.length*e.lineHeight/2;break;case"bottom":o=e.width/2,r=e.height,a="bottom",s.advancedStyleParams.linear.x0=-e.width/2,s.advancedStyleParams.linear.x1=e.width/2,s.advancedStyleParams.radial.y0=-s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.radial.y1=-s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.conic.x=0,s.advancedStyleParams.conic.y=-s.textLine.data.length*e.lineHeight/2;break;case"bottom-start":o=0,r=e.height,a="bottom",l="start",s.advancedStyleParams.linear.x0=0,s.advancedStyleParams.linear.x1=e.width,s.advancedStyleParams.radial.x0=e.width/2,s.advancedStyleParams.radial.y0=-s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.radial.x1=e.width/2,s.advancedStyleParams.radial.y1=-s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.conic.x=e.width/2,s.advancedStyleParams.conic.y=-s.textLine.data.length*e.lineHeight/2;break;case"bottom-end":o=e.width,r=e.height,a="bottom",l="end",s.advancedStyleParams.linear.x0=0,s.advancedStyleParams.linear.x1=-e.width,s.advancedStyleParams.radial.x0=-e.width/2,s.advancedStyleParams.radial.y0=-s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.radial.x1=-e.width/2,s.advancedStyleParams.radial.y1=-s.textLine.data.length*e.lineHeight/2,s.advancedStyleParams.conic.x=-e.width/2,s.advancedStyleParams.conic.y=-s.textLine.data.length*e.lineHeight/2;break;case"left":o=0,r=e.height/2,l="start",s.advancedStyleParams.linear.x0=0,s.advancedStyleParams.linear.x1=e.width,s.advancedStyleParams.radial.x0=e.width/2,s.advancedStyleParams.radial.x1=e.width/2,s.advancedStyleParams.conic.x=e.width/2,s.advancedStyleParams.conic.y=0;break;case"right":o=e.width,r=e.height/2,l="end",s.advancedStyleParams.linear.x0=0,s.advancedStyleParams.linear.x1=-e.width,s.advancedStyleParams.radial.x0=-e.width/2,s.advancedStyleParams.radial.x1=-e.width/2,s.advancedStyleParams.conic.x=-e.width/2,s.advancedStyleParams.conic.y=0;break}if(e.translateX=o,e.translateY=r,zt(t?.textBaseline)&&(e.textBaseline=a),zt(t?.textAlign)&&(e.textAlign=l),["text","multi-line-text"].includes(e.contentType))switch(e.textBaseline){case"middle":s.textLine.yOffsetValue=(s.textLine.data.length-1)*e.lineHeight/2;break;case"bottom":case"alphabetic":case"ideographic":s.textLine.yOffsetValue=(s.textLine.data.length-1)*e.lineHeight+(e.lineHeight-parseInt(e.fontSize))/2;break;case"top":case"hanging":s.textLine.yOffsetValue=-e.lineHeight/2+parseInt(e.fontSize)/2;break}return s},Cc=(function(i){typeof window>"u"||i&&Object.defineProperty(window,"MutationObserver",{writable:!1,configurable:!1})}),Xr=(function(){function i(e,t){this.props=e,this.options=t,this.canvas=i.createCanvas(this.options.width,this.options.height),this.recommendOptions=yR(this.canvas,this.options,this.props)}return i.createCanvas=function(e,t){var n,s=window.devicePixelRatio||1,o=document.createElement("canvas");return o.width=e*s,o.height=t*s,o.style.width="".concat(e,"px"),o.style.height="".concat(t,"px"),(n=o.getContext("2d"))===null||n===void 0||n.setTransform(s,0,0,s,0,0),o},i.clearCanvas=function(e){var t=e.getContext("2d");if(t===null)throw new Error("get context error");t.restore(),t.resetTransform(),t.clearRect(0,0,e.width,e.height);var n=window.devicePixelRatio||1;t.setTransform(n,0,0,n,0,0)},i.prototype.getCanvas=function(){return this.canvas},i.prototype.clear=function(){i.clearCanvas(this.canvas)},i.prototype.draw=function(){var e=this,t=this.canvas.getContext("2d");if(t===null)throw new Error("get context error");return this.options.auxiliaryLine&&(t.beginPath(),t.rect(0,0,this.options.width,this.options.height),t.lineWidth=1,t.strokeStyle="#000",t.stroke(),t.closePath(),t.beginPath(),t.rect(this.options.translateX,this.options.translateY,1,1),t.lineWidth=1,t.strokeStyle="#f00",t.stroke(),t.closePath()),this.setStyle(t),t.save(),t.translate(this.options.translateX,this.options.translateY),t.rotate(this.options.rotate),new Promise(function(n){switch(e.options.contentType){case"text":e.drawText(t,n);break;case"image":e.drawImage(t,n);break;case"multi-line-text":e.drawMultiLineText(t,n);break;case"rich-text":e.drawRichText(t,n);break}})},i.prototype.setStyle=function(e){var t,n="fillStyle";this.options.textType==="stroke"&&(n="strokeStyle");var s=this.options.fontColor;if(!((t=this.options)===null||t===void 0)&&t.advancedStyle)switch(this.options.advancedStyle.type){case"linear":s=this.createLinearGradient(e);break;case"radial":s=this.createRadialGradient(e);break;case"conic":s=this.createConicGradient(e);break;case"pattern":s=this.createPattern(e);break}e[n]&&s&&(e[n]=s),this.options.textAlign&&(e.textAlign=this.options.textAlign),this.options.textBaseline&&(e.textBaseline=this.options.textBaseline),e.globalAlpha=this.options.globalAlpha,this.options.shadowStyle&&(e.shadowBlur=rt(this.options.shadowStyle.shadowBlur,0),e.shadowColor=rt(this.options.shadowStyle.shadowColor,"#00000000"),e.shadowOffsetX=rt(this.options.shadowStyle.shadowOffsetX,0),e.shadowOffsetY=rt(this.options.shadowStyle.shadowOffsetY,0)),Gm(this.options.extraDrawFunc)&&this.options.extraDrawFunc(e)},i.prototype.createLinearGradient=function(e){var t,n,s,o,r,a,l,c,h,u,p,f,m,y,g,A=e.createLinearGradient(rt((s=(n=(t=this.options.advancedStyle)===null||t===void 0?void 0:t.params)===null||n===void 0?void 0:n.linear)===null||s===void 0?void 0:s.x0,this.recommendOptions.advancedStyleParams.linear.x0),rt((a=(r=(o=this.options.advancedStyle)===null||o===void 0?void 0:o.params)===null||r===void 0?void 0:r.linear)===null||a===void 0?void 0:a.y0,0),rt((h=(c=(l=this.options.advancedStyle)===null||l===void 0?void 0:l.params)===null||c===void 0?void 0:c.linear)===null||h===void 0?void 0:h.x1,this.recommendOptions.advancedStyleParams.linear.x1),rt((f=(p=(u=this.options.advancedStyle)===null||u===void 0?void 0:u.params)===null||p===void 0?void 0:p.linear)===null||f===void 0?void 0:f.y1,0));return(g=(y=(m=this.options)===null||m===void 0?void 0:m.advancedStyle)===null||y===void 0?void 0:y.colorStops)===null||g===void 0||g.forEach(function(v){A.addColorStop(v.offset,v.color)}),A},i.prototype.createConicGradient=function(e){var t,n,s,o,r,a,l,c,h,u,p,f,m,y,g,A=e.createConicGradient(rt((o=(s=(n=(t=this.options)===null||t===void 0?void 0:t.advancedStyle)===null||n===void 0?void 0:n.params)===null||s===void 0?void 0:s.conic)===null||o===void 0?void 0:o.startAngle,0),rt((c=(l=(a=(r=this.options)===null||r===void 0?void 0:r.advancedStyle)===null||a===void 0?void 0:a.params)===null||l===void 0?void 0:l.conic)===null||c===void 0?void 0:c.x,this.recommendOptions.advancedStyleParams.conic.x),rt((f=(p=(u=(h=this.options)===null||h===void 0?void 0:h.advancedStyle)===null||u===void 0?void 0:u.params)===null||p===void 0?void 0:p.conic)===null||f===void 0?void 0:f.y,this.recommendOptions.advancedStyleParams.conic.y));return(g=(y=(m=this.options)===null||m===void 0?void 0:m.advancedStyle)===null||y===void 0?void 0:y.colorStops)===null||g===void 0||g.forEach(function(v){A.addColorStop(v.offset,v.color)}),A},i.prototype.createRadialGradient=function(e){var t,n,s,o,r,a,l,c,h,u,p,f,m,y,g,A,v,b,C,x,I,E,S,w,T,_,F,U=e.createRadialGradient(rt((o=(s=(n=(t=this.options)===null||t===void 0?void 0:t.advancedStyle)===null||n===void 0?void 0:n.params)===null||s===void 0?void 0:s.radial)===null||o===void 0?void 0:o.x0,this.recommendOptions.advancedStyleParams.radial.x0),rt((c=(l=(a=(r=this.options)===null||r===void 0?void 0:r.advancedStyle)===null||a===void 0?void 0:a.params)===null||l===void 0?void 0:l.radial)===null||c===void 0?void 0:c.y0,this.recommendOptions.advancedStyleParams.radial.y0),rt((f=(p=(u=(h=this.options)===null||h===void 0?void 0:h.advancedStyle)===null||u===void 0?void 0:u.params)===null||p===void 0?void 0:p.radial)===null||f===void 0?void 0:f.r0,this.recommendOptions.advancedStyleParams.radial.r0),rt((A=(g=(y=(m=this.options)===null||m===void 0?void 0:m.advancedStyle)===null||y===void 0?void 0:y.params)===null||g===void 0?void 0:g.radial)===null||A===void 0?void 0:A.x1,this.recommendOptions.advancedStyleParams.radial.x1),rt((x=(C=(b=(v=this.options)===null||v===void 0?void 0:v.advancedStyle)===null||b===void 0?void 0:b.params)===null||C===void 0?void 0:C.radial)===null||x===void 0?void 0:x.y1,this.recommendOptions.advancedStyleParams.radial.y1),rt((w=(S=(E=(I=this.options)===null||I===void 0?void 0:I.advancedStyle)===null||E===void 0?void 0:E.params)===null||S===void 0?void 0:S.radial)===null||w===void 0?void 0:w.r1,this.recommendOptions.advancedStyleParams.radial.r1));return(F=(_=(T=this.options)===null||T===void 0?void 0:T.advancedStyle)===null||_===void 0?void 0:_.colorStops)===null||F===void 0||F.forEach(function(L){U.addColorStop(L.offset,L.color)}),U},i.prototype.createPattern=function(e){var t,n,s,o,r,a,l,c;return e.createPattern((o=(s=(n=(t=this.options)===null||t===void 0?void 0:t.advancedStyle)===null||n===void 0?void 0:n.params)===null||s===void 0?void 0:s.pattern)===null||o===void 0?void 0:o.image,((c=(l=(a=(r=this.options)===null||r===void 0?void 0:r.advancedStyle)===null||a===void 0?void 0:a.params)===null||l===void 0?void 0:l.pattern)===null||c===void 0?void 0:c.repetition)||"")},i.prototype.setText=function(e,t){var n="fillText";this.options.textType==="stroke"&&(n="strokeText"),e[n]&&e[n](t.text,t.x,t.y,t.maxWidth)},i.prototype.drawText=function(e,t){this.setText(e,{text:this.options.content,x:0,y:0-this.recommendOptions.textLine.yOffsetValue,maxWidth:this.options.textRowMaxWidth||this.options.width}),t(e.canvas)},i.prototype.drawImage=function(e,t){var n=this;Vm(this.options.image).then(function(s){var o=n.getImageRect(s),r=o.width,a=o.height,l=n.getDrawImagePosition(r,a);e.drawImage(s,l.x,l.y,r,a),t(e.canvas)})},i.prototype.drawMultiLineText=function(e,t){var n=this,s=this.recommendOptions.textLine.data,o=this.recommendOptions.textLine.yOffsetValue;s.forEach(function(r,a){n.setText(e,{text:r,x:0,y:n.options.lineHeight*a-o,maxWidth:n.options.textRowMaxWidth||n.options.width})}),t(e.canvas)},i.prototype.drawRichText=function(e,t){return pi(this,void 0,void 0,function(){var n,s=this;return ei(this,function(o){switch(o.label){case 0:return[4,uR(e,this.options)];case 1:return n=o.sent(),Vm(pR(n.element),n.width,n.height).then(function(r){var a=s.getDrawImagePosition(r.width,r.height);e.drawImage(r,a.x,a.y,r.width,r.height),t(e.canvas)}),[2]}})})},i.prototype.getImageRect=function(e){var t={width:this.options.imageWidth||0,height:this.options.imageHeight||0};switch(!0){case(t.width!==0&&t.height===0):t.height=t.width*e.height/e.width;break;case(t.width===0&&t.height!==0):t.width=t.height*e.width/e.height;break;case(t.width===0&&t.height===0):t.width=e.width,t.height=e.height;break}return t},i.prototype.getDrawImagePosition=function(e,t){var n,s,o={x:-e/2,y:-t/2};switch(this.options.translatePlacement){case"top":o.x=-e/2,o.y=0;break;case"top-start":o.x=0,o.y=0;break;case"top-end":o.x=-e,o.y=0;break;case"bottom":o.x=-e/2,o.y=-t;break;case"bottom-start":o.x=0,o.y=-t;break;case"bottom-end":o.x=-e,o.y=-t;break;case"left":o.x=0,o.y=-t/2;break;case"right":o.x=-e,o.y=-t/2;break}return!zt((n=this.props)===null||n===void 0?void 0:n.translateX)&&(o.x=0),!zt((s=this.props)===null||s===void 0?void 0:s.translateY)&&(o.y=0),o},i})(),AR=(function(){function i(e,t){var n,s,o,r;this.options=e,this.partialWidth=this.options.width,this.partialHeight=this.options.height,this.rows=((n=this.options.gridLayoutOptions)===null||n===void 0?void 0:n.rows)||1,this.cols=((s=this.options.gridLayoutOptions)===null||s===void 0?void 0:s.cols)||1,this.matrix=((o=this.options.gridLayoutOptions)===null||o===void 0?void 0:o.matrix)||mR(this.rows,this.cols,1),this.gap=((r=this.options.gridLayoutOptions)===null||r===void 0?void 0:r.gap)||[0,0],this.partialCanvas=t}return i.prototype.draw=function(){var e,t,n,s,o,r,a,l,c=Xr.createCanvas(((e=this.options.gridLayoutOptions)===null||e===void 0?void 0:e.width)||this.partialWidth*this.cols+this.gap[0]*this.cols,((t=this.options.gridLayoutOptions)===null||t===void 0?void 0:t.height)||this.partialHeight*this.rows+this.gap[1]*this.rows),h=c.getContext("2d");!((n=this.options.gridLayoutOptions)===null||n===void 0)&&n.backgroundImage&&h?.drawImage((s=this.options.gridLayoutOptions)===null||s===void 0?void 0:s.backgroundImage,0,0,(o=this.options.gridLayoutOptions)===null||o===void 0?void 0:o.width,(r=this.options.gridLayoutOptions)===null||r===void 0?void 0:r.height);for(var u=0;u<this.rows;u++)for(var p=0;p<this.cols;p++)!((l=(a=this.matrix)===null||a===void 0?void 0:a[u])===null||l===void 0)&&l[p]&&h?.drawImage(this.partialCanvas,this.partialWidth*p+this.gap[0]*p,this.partialHeight*u+this.gap[1]*u,this.partialWidth,this.partialHeight);return c},i})(),vR=function(i,e){return i.layout==="grid"?new AR(i,e).draw():e},bR=function(i){var e,t,n;if(i.layout==="grid"){var s=((e=i.gridLayoutOptions)===null||e===void 0?void 0:e.cols)||1,o=((t=i.gridLayoutOptions)===null||t===void 0?void 0:t.rows)||1,r=((n=i.gridLayoutOptions)===null||n===void 0?void 0:n.gap)||[0,0];return[i.width*s+r[0]*s,i.height*o+r[1]*o]}else return[i.width,i.height]},zm=(function(){function i(e){e===void 0&&(e={}),this.parentElement=document.body,this.isCreating=!1,this.props=e,this.options=Fi(Fi({},Qm),e),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Xr(this.props,this.options),Cc(this.options.monitorProtection)}return i.prototype.changeOptions=function(){return pi(this,arguments,void 0,function(e,t,n){return e===void 0&&(e={}),t===void 0&&(t="overwrite"),n===void 0&&(n=!0),ei(this,function(s){switch(s.label){case 0:return this.initConfigData(e,t),Cc(this.options.monitorProtection),n?(this.remove(),[4,this.create()]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},i.prototype.create=function(){return pi(this,void 0,void 0,function(){var e,t,n,s,o,r,a,l,c,h,u,p;return ei(this,function(f){switch(f.label){case 0:return this.isCreating?[2]:(this.isCreating=!0,this.validateUnique()?this.validateContent()?(e=zt(this.watermarkDom),[4,(r=this.watermarkCanvas)===null||r===void 0?void 0:r.draw()]):(this.isCreating=!1,[2]):(this.isCreating=!1,[2]));case 1:if(f.sent(),this.layoutCanvas=vR(this.options,(a=this.watermarkCanvas)===null||a===void 0?void 0:a.getCanvas()),t=Om(this.layoutCanvas),(l=this.watermarkCanvas)===null||l===void 0||l.clear(),this.watermarkDom=document.createElement("div"),n=document.createElement("div"),this.watermarkDom.__WATERMARK__="watermark",this.watermarkDom.__WATERMARK__INSTANCE__=this,s=this.checkParentElementType(),this.watermarkDom.style.cssText=`
132
- z-index:`.concat(this.options.zIndex,`!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;
133
- `).concat(s==="custom"?"top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;":"position:relative!important;",`
134
- `),o=bR(this.options),n.style.cssText=`
135
- display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;
136
- position:`.concat(s==="root"?"fixed":"absolute",`!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;
137
- z-index:`).concat(this.options.zIndex,"!important;background-image:url(").concat(t,")!important;background-repeat:").concat(this.options.backgroundRepeat,`!important;
138
- background-size:`).concat(o[0],"px ").concat(o[1],"px!important;background-position:").concat(this.options.backgroundPosition,`;
139
- `).concat(gR(this.options.movable,this.options.backgroundRepeat),`
140
- `),this.watermarkDom.appendChild(n),this.parentElement.appendChild(this.watermarkDom),this.options.mutationObserve)try{this.bindMutationObserve()}catch{(h=(c=this.options).onObserveError)===null||h===void 0||h.call(c)}return e&&((p=(u=this.options).onSuccess)===null||p===void 0||p.call(u)),this.isCreating=!1,[2]}})})},i.prototype.destroy=function(){this.remove(),this.watermarkDom=void 0},i.prototype.check=function(){return pi(this,void 0,void 0,function(){return ei(this,function(e){return[2,this.parentElement.contains(this.watermarkDom)]})})},i.prototype.remove=function(){var e,t,n,s,o,r,a,l;(t=(e=this.options).onBeforeDestroy)===null||t===void 0||t.call(e),(n=this.observer)===null||n===void 0||n.disconnect(),(s=this.parentObserve)===null||s===void 0||s.disconnect(),(r=(o=this.watermarkDom)===null||o===void 0?void 0:o.parentNode)===null||r===void 0||r.removeChild(this.watermarkDom),(l=(a=this.options).onDestroyed)===null||l===void 0||l.call(a)},i.prototype.initConfigData=function(e,t){var n=this;t===void 0&&(t="overwrite"),t==="append"?Object.keys(e).forEach(function(s){n.props&&(n.props[s]=e[s])}):this.props=e,this.options=Fi(Fi({},Qm),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new Xr(this.props,this.options)},i.prototype.changeParentElement=function(e){if(typeof e=="string"){var t=document.querySelector(e);t&&(this.parentElement=t)}else this.parentElement=e;this.parentElement||console.error("[WatermarkJsPlus]: please pass a valid parent element.")},i.prototype.validateUnique=function(){var e=!0;return Array.from(this.parentElement.childNodes).forEach(function(t){e&&Object.hasOwnProperty.call(t,"__WATERMARK__")&&(e=!1)}),e},i.prototype.validateContent=function(){switch(this.options.contentType){case"image":return Object.hasOwnProperty.call(this.options,"image");case"multi-line-text":case"rich-text":case"text":return this.options.content.length>0}},i.prototype.checkParentElementType=function(){return["html","body"].includes(this.parentElement.tagName.toLocaleLowerCase())?"root":"custom"},i.prototype.bindMutationObserve=function(){var e=this;this.watermarkDom&&(this.observer=new MutationObserver(function(t){return pi(e,void 0,void 0,function(){return ei(this,function(n){switch(n.label){case 0:return t.length>0?(this.remove(),[4,this.create()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})}),this.observer.observe(this.watermarkDom,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.parentObserve=new MutationObserver(function(t){return pi(e,void 0,void 0,function(){var n,s,o,r;return ei(this,function(a){switch(a.label){case 0:n=0,s=t,a.label=1;case 1:return n<s.length?(o=s[n],r=Array.from(o.removedNodes).includes(this.watermarkDom),r?(this.remove(),[4,this.create()]):[3,3]):[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})}),this.parentObserve.observe(this.parentElement,{childList:!0}))},i})();(function(i){cR(e,i);function e(t){t===void 0&&(t={});var n={globalAlpha:.005,mode:"blind"};return i.call(this,Fi(Fi({},t),n))||this}return e.prototype.changeOptions=function(){return pi(this,arguments,void 0,function(t,n,s){return t===void 0&&(t={}),n===void 0&&(n="overwrite"),s===void 0&&(s=!0),ei(this,function(o){switch(o.label){case 0:return t.globalAlpha=.005,t.mode="blind",this.initConfigData(t,n),Cc(this.options.monitorProtection),s?(this.remove(),[4,this.create()]):[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})},e.decode=function(t){var n=t.url,s=n===void 0?"":n,o=t.fillColor,r=o===void 0?"#000":o,a=t.compositeOperation,l=a===void 0?"color-burn":a,c=t.mode,h=c===void 0?"canvas":c,u=t.compositeTimes,p=u===void 0?3:u,f=t.onSuccess;if(s&&h==="canvas"){var m=new Image;m.src=s,m.addEventListener("load",function(){var y=m.width,g=m.height,A=Xr.createCanvas(y,g),v=A.getContext("2d");if(!v)throw new Error("get context error");v.drawImage(m,0,0,y,g),v.globalCompositeOperation=l,v.fillStyle=r;for(var b=0;b<p;b++)v.fillRect(0,0,y,g);var C=Om(A);Gm(f)&&f?.(C)})}},e})(zm);const wR=Object.freeze(Object.defineProperty({__proto__:null,Watermark:zm},Symbol.toStringTag,{value:"Module"}));function Ne(i,e){this.x=i,this.y=e}Ne.prototype={clone(){return new Ne(this.x,this.y)},add(i){return this.clone()._add(i)},sub(i){return this.clone()._sub(i)},multByPoint(i){return this.clone()._multByPoint(i)},divByPoint(i){return this.clone()._divByPoint(i)},mult(i){return this.clone()._mult(i)},div(i){return this.clone()._div(i)},rotate(i){return this.clone()._rotate(i)},rotateAround(i,e){return this.clone()._rotateAround(i,e)},matMult(i){return this.clone()._matMult(i)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(i){return this.x===i.x&&this.y===i.y},dist(i){return Math.sqrt(this.distSqr(i))},distSqr(i){const e=i.x-this.x,t=i.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith(i){return this.angleWithSep(i.x,i.y)},angleWithSep(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult(i){const e=i[0]*this.x+i[1]*this.y,t=i[2]*this.x+i[3]*this.y;return this.x=e,this.y=t,this},_add(i){return this.x+=i.x,this.y+=i.y,this},_sub(i){return this.x-=i.x,this.y-=i.y,this},_mult(i){return this.x*=i,this.y*=i,this},_div(i){return this.x/=i,this.y/=i,this},_multByPoint(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint(i){return this.x/=i.x,this.y/=i.y,this},_unit(){return this._div(this.mag()),this},_perp(){const i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){const e=Math.cos(i),t=Math.sin(i),n=e*this.x-t*this.y,s=t*this.x+e*this.y;return this.x=n,this.y=s,this},_rotateAround(i,e){const t=Math.cos(i),n=Math.sin(i),s=e.x+t*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=s,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ne},Ne.convert=function(i){if(i instanceof Ne)return i;if(Array.isArray(i))return new Ne(+i[0],+i[1]);if(i.x!==void 0&&i.y!==void 0)return new Ne(+i.x,+i.y);throw new Error("Expected [x, y] or {x, y} point format")};class Yn{constructor(e,t,n,s,o){for(this.properties=Object.create(null),this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=s,this._values=o;e.pos<t;){const r=e.readVarint();if(r===8)this.id=e.readVarint();else if(r===18){const a=e.readVarint()+e.pos;for(;e.pos<a;){const l=s[e.readVarint()],c=o[e.readVarint()];this.properties[l]=c}}else r===24?this.type=e.readVarint():(r===34&&(this._geometry=e.pos),e.skip(r))}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,n=[];let s,o=1,r=0,a=0,l=0;for(;e.pos<t;){if(r<=0){const c=e.readVarint();if(o=c&7,r=c>>3,r===0)continue}if(r--,o===1)a+=e.readSVarint(),l+=e.readSVarint(),s&&n.push(s),s=[new Ne(a,l)];else if(o===2)a+=e.readSVarint(),l+=e.readSVarint(),s&&s.push(new Ne(a,l));else if(o===7)s&&s.push(s[0].clone());else throw new Error(`unknown command ${o}`)}return s&&n.push(s),n}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,s=0,o=0,r=0,a=1/0,l=-1/0,c=1/0,h=-1/0;for(;e.pos<t;){if(s<=0){const u=e.readVarint();if(n=u&7,s=u>>3,s===0)continue}if(s--,n===1||n===2)o+=e.readSVarint(),r+=e.readSVarint(),o<a&&(a=o),o>l&&(l=o),r<c&&(c=r),r>h&&(h=r);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,h]}toGeoJSON(e,t,n){const s=this.extent*Math.pow(2,n),o=this.extent*e,r=this.extent*t,a=this.loadGeometry();function l(p){return[(p.x+o)*360/s-180,360/Math.PI*Math.atan(Math.exp((1-(p.y+r)*2/s)*Math.PI))-90]}function c(p){return p.map(l)}let h;if(this.type===1){const p=[];for(const m of a)p.push(m[0]);const f=c(p);h=p.length===1?{type:"Point",coordinates:f[0]}:{type:"MultiPoint",coordinates:f}}else if(this.type===2){const p=a.map(c);h=p.length===1?{type:"LineString",coordinates:p[0]}:{type:"MultiLineString",coordinates:p}}else if(this.type===3){const p=Hm(a),f=[];for(const m of p)f.push(m.map(c));h=f.length===1?{type:"Polygon",coordinates:f[0]}:{type:"MultiPolygon",coordinates:f}}else throw new Error("unknown feature type");const u={type:"Feature",geometry:h,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}Yn.types=["Unknown","Point","LineString","Polygon"];function Hm(i){const e=i.length;if(e<=1)return[i];const t=[];let n,s;for(let o=0;o<e;o++){const r=CR(i[o]);r!==0&&(s===void 0&&(s=r<0),s===r<0?(n&&t.push(n),n=[i[o]]):n&&n.push(i[o]))}return n&&t.push(n),t}function CR(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}class ER{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],t===void 0&&(t=e.length);e.pos<t;){const n=e.readVarint();n===10?this.name=e.readString():n===18?(this._features.push(e.pos),e.skip(n)):n===26?this._keys.push(e.readString()):n===34?this._values.push(xR(e)):n===40?this.extent=e.readVarint():n===120?this.version=e.readVarint():e.skip(n)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Yn(this._pbf,t,this.extent,this._keys,this._values)}}function xR(i){let e=null;const t=i.readVarint()+i.pos;for(;i.pos<t;){const n=i.readVarint();e=n===10?i.readString():n===21?i.readFloat():n===25?i.readDouble():n===32?i.readVarint64():n===40?i.readVarint():n===48?i.readSVarint():n===56?i.readBoolean():(i.skip(n),null)}if(e==null)throw new Error("unknown feature value");return e}class IR{constructor(e,t=e.length){const n=Object.create(null);for(;e.pos<t;){const s=e.readVarint();if(s===26){const o=new ER(e,e.readVarint()+e.pos);o.length&&(n[o.name]=o)}else e.skip(s)}this.layers=n}}class Ec{constructor(e,t=""){this.type=e.type,this.styleSource=e,this.path=t,this.errorEvent=new Cesium.Event}async init(){}requestTile(e,t,n){}destroy(){this.styleSource=null,this.errorEvent=null}}const xc={};function Ic(i,e){xc[i]=e}class $n{constructor(e,t,n){this._name=e,this.dataBuffer=t,typeof n=="number"?this._size=n:(this.nullabilityBuffer=n,this._size=n.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Jr extends $n{}class Sc extends Jr{getValueFromBuffer(e){return this.dataBuffer[e]}}class Mc extends Jr{getValueFromBuffer(e){return this.dataBuffer[e]}}class Ym extends $n{constructor(e,t,n,s){super(e,t,s),this.delta=n}}class Tc extends Ym{constructor(e,t,n,s){super(e,Int32Array.of(t),n,s)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Bc extends $n{constructor(e,t,n,s){super(e,s?Int32Array.of(t):Uint32Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}class SR{constructor(e,t,n,s,o=4096){if(this._name=e,this._geometryVector=t,this._idVector=n,this._propertyVectors=s,this._extent=o,e.length===0)throw new Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let n=0;n<this.numFeatures;n++){let s;if(this.idVector){const a=this.idVector.getValue(n);s=this.containsMaxSafeIntegerValues(this.idVector)&&a!==null?Number(a):a}const o={coordinates:t[n],type:this.geometryVector.geometryType(n)},r={};for(const a of this.propertyVectors){if(!a)continue;const l=a.name,c=a.getValue(n);c!==null&&(r[l]=c)}e.push({id:s,geometry:o,properties:r})}return e}containsMaxSafeIntegerValues(e){return e instanceof Sc||e instanceof Bc||e instanceof Tc||e instanceof Mc}}const Zr={FEATURE:0},ge={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},po={GEOMETRY:0,STRUCT:1},_c={ID:0};class $m{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var ae;(function(i){i.NONE="NONE",i.DELTA="DELTA",i.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",i.RLE="RLE",i.MORTON="MORTON",i.PDE="PDE"})(ae||(ae={}));var ti;(function(i){i.NONE="NONE",i.FAST_PFOR="FAST_PFOR",i.VARINT="VARINT"})(ti||(ti={}));const kc=new Uint32Array(33);kc[0]=0;for(let i=1;i<=32;i++)kc[i]=i===32?4294967295:4294967295>>>32-i;const Pc=kc,jm=65536,Ht=256;function Dc(i,e){return i-i%e}function MR(i){return Dc(i+31,32)}function TR(i){if(!Number.isFinite(i)||i<=0)return jm;const e=Dc(Math.floor(i),Ht);return e===0?Ht:e}function BR(i){const e=i>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function _R(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0;t[s++]=o>>>0&3,t[s++]=o>>>2&3,t[s++]=o>>>4&3,t[s++]=o>>>6&3,t[s++]=o>>>8&3,t[s++]=o>>>10&3,t[s++]=o>>>12&3,t[s++]=o>>>14&3,t[s++]=o>>>16&3,t[s++]=o>>>18&3,t[s++]=o>>>20&3,t[s++]=o>>>22&3,t[s++]=o>>>24&3,t[s++]=o>>>26&3,t[s++]=o>>>28&3,t[s++]=o>>>30&3,t[s++]=r>>>0&3,t[s++]=r>>>2&3,t[s++]=r>>>4&3,t[s++]=r>>>6&3,t[s++]=r>>>8&3,t[s++]=r>>>10&3,t[s++]=r>>>12&3,t[s++]=r>>>14&3,t[s++]=r>>>16&3,t[s++]=r>>>18&3,t[s++]=r>>>20&3,t[s++]=r>>>22&3,t[s++]=r>>>24&3,t[s++]=r>>>26&3,t[s++]=r>>>28&3,t[s]=r>>>30&3}function kR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0;t[s++]=o>>>0&7,t[s++]=o>>>3&7,t[s++]=o>>>6&7,t[s++]=o>>>9&7,t[s++]=o>>>12&7,t[s++]=o>>>15&7,t[s++]=o>>>18&7,t[s++]=o>>>21&7,t[s++]=o>>>24&7,t[s++]=o>>>27&7,t[s++]=(o>>>30|(r&1)<<2)&7,t[s++]=r>>>1&7,t[s++]=r>>>4&7,t[s++]=r>>>7&7,t[s++]=r>>>10&7,t[s++]=r>>>13&7,t[s++]=r>>>16&7,t[s++]=r>>>19&7,t[s++]=r>>>22&7,t[s++]=r>>>25&7,t[s++]=r>>>28&7,t[s++]=(r>>>31|(a&3)<<1)&7,t[s++]=a>>>2&7,t[s++]=a>>>5&7,t[s++]=a>>>8&7,t[s++]=a>>>11&7,t[s++]=a>>>14&7,t[s++]=a>>>17&7,t[s++]=a>>>20&7,t[s++]=a>>>23&7,t[s++]=a>>>26&7,t[s]=a>>>29&7}function PR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0;t[s++]=o>>>0&15,t[s++]=o>>>4&15,t[s++]=o>>>8&15,t[s++]=o>>>12&15,t[s++]=o>>>16&15,t[s++]=o>>>20&15,t[s++]=o>>>24&15,t[s++]=o>>>28&15,t[s++]=r>>>0&15,t[s++]=r>>>4&15,t[s++]=r>>>8&15,t[s++]=r>>>12&15,t[s++]=r>>>16&15,t[s++]=r>>>20&15,t[s++]=r>>>24&15,t[s++]=r>>>28&15,t[s++]=a>>>0&15,t[s++]=a>>>4&15,t[s++]=a>>>8&15,t[s++]=a>>>12&15,t[s++]=a>>>16&15,t[s++]=a>>>20&15,t[s++]=a>>>24&15,t[s++]=a>>>28&15,t[s++]=l>>>0&15,t[s++]=l>>>4&15,t[s++]=l>>>8&15,t[s++]=l>>>12&15,t[s++]=l>>>16&15,t[s++]=l>>>20&15,t[s++]=l>>>24&15,t[s]=l>>>28&15}function DR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0;t[s++]=o>>>0&31,t[s++]=o>>>5&31,t[s++]=o>>>10&31,t[s++]=o>>>15&31,t[s++]=o>>>20&31,t[s++]=o>>>25&31,t[s++]=(o>>>30|(r&7)<<2)&31,t[s++]=r>>>3&31,t[s++]=r>>>8&31,t[s++]=r>>>13&31,t[s++]=r>>>18&31,t[s++]=r>>>23&31,t[s++]=(r>>>28|(a&1)<<4)&31,t[s++]=a>>>1&31,t[s++]=a>>>6&31,t[s++]=a>>>11&31,t[s++]=a>>>16&31,t[s++]=a>>>21&31,t[s++]=a>>>26&31,t[s++]=(a>>>31|(l&15)<<1)&31,t[s++]=l>>>4&31,t[s++]=l>>>9&31,t[s++]=l>>>14&31,t[s++]=l>>>19&31,t[s++]=l>>>24&31,t[s++]=(l>>>29|(c&3)<<3)&31,t[s++]=c>>>2&31,t[s++]=c>>>7&31,t[s++]=c>>>12&31,t[s++]=c>>>17&31,t[s++]=c>>>22&31,t[s]=c>>>27&31}function NR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0;t[s++]=o>>>0&63,t[s++]=o>>>6&63,t[s++]=o>>>12&63,t[s++]=o>>>18&63,t[s++]=o>>>24&63,t[s++]=(o>>>30|(r&15)<<2)&63,t[s++]=r>>>4&63,t[s++]=r>>>10&63,t[s++]=r>>>16&63,t[s++]=r>>>22&63,t[s++]=(r>>>28|(a&3)<<4)&63,t[s++]=a>>>2&63,t[s++]=a>>>8&63,t[s++]=a>>>14&63,t[s++]=a>>>20&63,t[s++]=a>>>26&63,t[s++]=l>>>0&63,t[s++]=l>>>6&63,t[s++]=l>>>12&63,t[s++]=l>>>18&63,t[s++]=l>>>24&63,t[s++]=(l>>>30|(c&15)<<2)&63,t[s++]=c>>>4&63,t[s++]=c>>>10&63,t[s++]=c>>>16&63,t[s++]=c>>>22&63,t[s++]=(c>>>28|(h&3)<<4)&63,t[s++]=h>>>2&63,t[s++]=h>>>8&63,t[s++]=h>>>14&63,t[s++]=h>>>20&63,t[s]=h>>>26&63}function LR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0;t[s++]=o>>>0&127,t[s++]=o>>>7&127,t[s++]=o>>>14&127,t[s++]=o>>>21&127,t[s++]=(o>>>28|(r&7)<<4)&127,t[s++]=r>>>3&127,t[s++]=r>>>10&127,t[s++]=r>>>17&127,t[s++]=r>>>24&127,t[s++]=(r>>>31|(a&63)<<1)&127,t[s++]=a>>>6&127,t[s++]=a>>>13&127,t[s++]=a>>>20&127,t[s++]=(a>>>27|(l&3)<<5)&127,t[s++]=l>>>2&127,t[s++]=l>>>9&127,t[s++]=l>>>16&127,t[s++]=l>>>23&127,t[s++]=(l>>>30|(c&31)<<2)&127,t[s++]=c>>>5&127,t[s++]=c>>>12&127,t[s++]=c>>>19&127,t[s++]=(c>>>26|(h&1)<<6)&127,t[s++]=h>>>1&127,t[s++]=h>>>8&127,t[s++]=h>>>15&127,t[s++]=h>>>22&127,t[s++]=(h>>>29|(u&15)<<3)&127,t[s++]=u>>>4&127,t[s++]=u>>>11&127,t[s++]=u>>>18&127,t[s]=u>>>25&127}function RR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0;t[s++]=o>>>0&255,t[s++]=o>>>8&255,t[s++]=o>>>16&255,t[s++]=o>>>24&255,t[s++]=r>>>0&255,t[s++]=r>>>8&255,t[s++]=r>>>16&255,t[s++]=r>>>24&255,t[s++]=a>>>0&255,t[s++]=a>>>8&255,t[s++]=a>>>16&255,t[s++]=a>>>24&255,t[s++]=l>>>0&255,t[s++]=l>>>8&255,t[s++]=l>>>16&255,t[s++]=l>>>24&255,t[s++]=c>>>0&255,t[s++]=c>>>8&255,t[s++]=c>>>16&255,t[s++]=c>>>24&255,t[s++]=h>>>0&255,t[s++]=h>>>8&255,t[s++]=h>>>16&255,t[s++]=h>>>24&255,t[s++]=u>>>0&255,t[s++]=u>>>8&255,t[s++]=u>>>16&255,t[s++]=u>>>24&255,t[s++]=p>>>0&255,t[s++]=p>>>8&255,t[s++]=p>>>16&255,t[s]=p>>>24&255}function FR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0;t[s++]=o>>>0&511,t[s++]=o>>>9&511,t[s++]=o>>>18&511,t[s++]=(o>>>27|(r&15)<<5)&511,t[s++]=r>>>4&511,t[s++]=r>>>13&511,t[s++]=r>>>22&511,t[s++]=(r>>>31|(a&255)<<1)&511,t[s++]=a>>>8&511,t[s++]=a>>>17&511,t[s++]=(a>>>26|(l&7)<<6)&511,t[s++]=l>>>3&511,t[s++]=l>>>12&511,t[s++]=l>>>21&511,t[s++]=(l>>>30|(c&127)<<2)&511,t[s++]=c>>>7&511,t[s++]=c>>>16&511,t[s++]=(c>>>25|(h&3)<<7)&511,t[s++]=h>>>2&511,t[s++]=h>>>11&511,t[s++]=h>>>20&511,t[s++]=(h>>>29|(u&63)<<3)&511,t[s++]=u>>>6&511,t[s++]=u>>>15&511,t[s++]=(u>>>24|(p&1)<<8)&511,t[s++]=p>>>1&511,t[s++]=p>>>10&511,t[s++]=p>>>19&511,t[s++]=(p>>>28|(f&31)<<4)&511,t[s++]=f>>>5&511,t[s++]=f>>>14&511,t[s]=f>>>23&511}function OR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0;t[s++]=o>>>0&1023,t[s++]=o>>>10&1023,t[s++]=o>>>20&1023,t[s++]=(o>>>30|(r&255)<<2)&1023,t[s++]=r>>>8&1023,t[s++]=r>>>18&1023,t[s++]=(r>>>28|(a&63)<<4)&1023,t[s++]=a>>>6&1023,t[s++]=a>>>16&1023,t[s++]=(a>>>26|(l&15)<<6)&1023,t[s++]=l>>>4&1023,t[s++]=l>>>14&1023,t[s++]=(l>>>24|(c&3)<<8)&1023,t[s++]=c>>>2&1023,t[s++]=c>>>12&1023,t[s++]=c>>>22&1023,t[s++]=h>>>0&1023,t[s++]=h>>>10&1023,t[s++]=h>>>20&1023,t[s++]=(h>>>30|(u&255)<<2)&1023,t[s++]=u>>>8&1023,t[s++]=u>>>18&1023,t[s++]=(u>>>28|(p&63)<<4)&1023,t[s++]=p>>>6&1023,t[s++]=p>>>16&1023,t[s++]=(p>>>26|(f&15)<<6)&1023,t[s++]=f>>>4&1023,t[s++]=f>>>14&1023,t[s++]=(f>>>24|(m&3)<<8)&1023,t[s++]=m>>>2&1023,t[s++]=m>>>12&1023,t[s]=m>>>22&1023}function GR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0;t[s++]=o>>>0&2047,t[s++]=o>>>11&2047,t[s++]=(o>>>22|(r&1)<<10)&2047,t[s++]=r>>>1&2047,t[s++]=r>>>12&2047,t[s++]=(r>>>23|(a&3)<<9)&2047,t[s++]=a>>>2&2047,t[s++]=a>>>13&2047,t[s++]=(a>>>24|(l&7)<<8)&2047,t[s++]=l>>>3&2047,t[s++]=l>>>14&2047,t[s++]=(l>>>25|(c&15)<<7)&2047,t[s++]=c>>>4&2047,t[s++]=c>>>15&2047,t[s++]=(c>>>26|(h&31)<<6)&2047,t[s++]=h>>>5&2047,t[s++]=h>>>16&2047,t[s++]=(h>>>27|(u&63)<<5)&2047,t[s++]=u>>>6&2047,t[s++]=u>>>17&2047,t[s++]=(u>>>28|(p&127)<<4)&2047,t[s++]=p>>>7&2047,t[s++]=p>>>18&2047,t[s++]=(p>>>29|(f&255)<<3)&2047,t[s++]=f>>>8&2047,t[s++]=f>>>19&2047,t[s++]=(f>>>30|(m&511)<<2)&2047,t[s++]=m>>>9&2047,t[s++]=m>>>20&2047,t[s++]=(m>>>31|(y&1023)<<1)&2047,t[s++]=y>>>10&2047,t[s]=y>>>21&2047}function UR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0,g=i[e+11]>>>0;t[s++]=o>>>0&4095,t[s++]=o>>>12&4095,t[s++]=(o>>>24|(r&15)<<8)&4095,t[s++]=r>>>4&4095,t[s++]=r>>>16&4095,t[s++]=(r>>>28|(a&255)<<4)&4095,t[s++]=a>>>8&4095,t[s++]=a>>>20&4095,t[s++]=l>>>0&4095,t[s++]=l>>>12&4095,t[s++]=(l>>>24|(c&15)<<8)&4095,t[s++]=c>>>4&4095,t[s++]=c>>>16&4095,t[s++]=(c>>>28|(h&255)<<4)&4095,t[s++]=h>>>8&4095,t[s++]=h>>>20&4095,t[s++]=u>>>0&4095,t[s++]=u>>>12&4095,t[s++]=(u>>>24|(p&15)<<8)&4095,t[s++]=p>>>4&4095,t[s++]=p>>>16&4095,t[s++]=(p>>>28|(f&255)<<4)&4095,t[s++]=f>>>8&4095,t[s++]=f>>>20&4095,t[s++]=m>>>0&4095,t[s++]=m>>>12&4095,t[s++]=(m>>>24|(y&15)<<8)&4095,t[s++]=y>>>4&4095,t[s++]=y>>>16&4095,t[s++]=(y>>>28|(g&255)<<4)&4095,t[s++]=g>>>8&4095,t[s]=g>>>20&4095}function VR(i,e,t,n){let s=n;const o=i[e]>>>0,r=i[e+1]>>>0,a=i[e+2]>>>0,l=i[e+3]>>>0,c=i[e+4]>>>0,h=i[e+5]>>>0,u=i[e+6]>>>0,p=i[e+7]>>>0,f=i[e+8]>>>0,m=i[e+9]>>>0,y=i[e+10]>>>0,g=i[e+11]>>>0,A=i[e+12]>>>0,v=i[e+13]>>>0,b=i[e+14]>>>0,C=i[e+15]>>>0;t[s++]=o>>>0&65535,t[s++]=o>>>16&65535,t[s++]=r>>>0&65535,t[s++]=r>>>16&65535,t[s++]=a>>>0&65535,t[s++]=a>>>16&65535,t[s++]=l>>>0&65535,t[s++]=l>>>16&65535,t[s++]=c>>>0&65535,t[s++]=c>>>16&65535,t[s++]=h>>>0&65535,t[s++]=h>>>16&65535,t[s++]=u>>>0&65535,t[s++]=u>>>16&65535,t[s++]=p>>>0&65535,t[s++]=p>>>16&65535,t[s++]=f>>>0&65535,t[s++]=f>>>16&65535,t[s++]=m>>>0&65535,t[s++]=m>>>16&65535,t[s++]=y>>>0&65535,t[s++]=y>>>16&65535,t[s++]=g>>>0&65535,t[s++]=g>>>16&65535,t[s++]=A>>>0&65535,t[s++]=A>>>16&65535,t[s++]=v>>>0&65535,t[s++]=v>>>16&65535,t[s++]=b>>>0&65535,t[s++]=b>>>16&65535,t[s++]=C>>>0&65535,t[s]=C>>>16&65535}function QR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0;t[s++]=a>>>0&1,t[s++]=a>>>1&1,t[s++]=a>>>2&1,t[s++]=a>>>3&1,t[s++]=a>>>4&1,t[s++]=a>>>5&1,t[s++]=a>>>6&1,t[s++]=a>>>7&1,t[s++]=a>>>8&1,t[s++]=a>>>9&1,t[s++]=a>>>10&1,t[s++]=a>>>11&1,t[s++]=a>>>12&1,t[s++]=a>>>13&1,t[s++]=a>>>14&1,t[s++]=a>>>15&1,t[s++]=a>>>16&1,t[s++]=a>>>17&1,t[s++]=a>>>18&1,t[s++]=a>>>19&1,t[s++]=a>>>20&1,t[s++]=a>>>21&1,t[s++]=a>>>22&1,t[s++]=a>>>23&1,t[s++]=a>>>24&1,t[s++]=a>>>25&1,t[s++]=a>>>26&1,t[s++]=a>>>27&1,t[s++]=a>>>28&1,t[s++]=a>>>29&1,t[s++]=a>>>30&1,t[s++]=a>>>31&1}}function zR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0;t[s++]=a>>>0&3,t[s++]=a>>>2&3,t[s++]=a>>>4&3,t[s++]=a>>>6&3,t[s++]=a>>>8&3,t[s++]=a>>>10&3,t[s++]=a>>>12&3,t[s++]=a>>>14&3,t[s++]=a>>>16&3,t[s++]=a>>>18&3,t[s++]=a>>>20&3,t[s++]=a>>>22&3,t[s++]=a>>>24&3,t[s++]=a>>>26&3,t[s++]=a>>>28&3,t[s++]=a>>>30&3,t[s++]=l>>>0&3,t[s++]=l>>>2&3,t[s++]=l>>>4&3,t[s++]=l>>>6&3,t[s++]=l>>>8&3,t[s++]=l>>>10&3,t[s++]=l>>>12&3,t[s++]=l>>>14&3,t[s++]=l>>>16&3,t[s++]=l>>>18&3,t[s++]=l>>>20&3,t[s++]=l>>>22&3,t[s++]=l>>>24&3,t[s++]=l>>>26&3,t[s++]=l>>>28&3,t[s++]=l>>>30&3}}function HR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0;t[s++]=a>>>0&7,t[s++]=a>>>3&7,t[s++]=a>>>6&7,t[s++]=a>>>9&7,t[s++]=a>>>12&7,t[s++]=a>>>15&7,t[s++]=a>>>18&7,t[s++]=a>>>21&7,t[s++]=a>>>24&7,t[s++]=a>>>27&7,t[s++]=(a>>>30|(l&1)<<2)&7,t[s++]=l>>>1&7,t[s++]=l>>>4&7,t[s++]=l>>>7&7,t[s++]=l>>>10&7,t[s++]=l>>>13&7,t[s++]=l>>>16&7,t[s++]=l>>>19&7,t[s++]=l>>>22&7,t[s++]=l>>>25&7,t[s++]=l>>>28&7,t[s++]=(l>>>31|(c&3)<<1)&7,t[s++]=c>>>2&7,t[s++]=c>>>5&7,t[s++]=c>>>8&7,t[s++]=c>>>11&7,t[s++]=c>>>14&7,t[s++]=c>>>17&7,t[s++]=c>>>20&7,t[s++]=c>>>23&7,t[s++]=c>>>26&7,t[s++]=c>>>29&7}}function YR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0;t[s++]=a>>>0&15,t[s++]=a>>>4&15,t[s++]=a>>>8&15,t[s++]=a>>>12&15,t[s++]=a>>>16&15,t[s++]=a>>>20&15,t[s++]=a>>>24&15,t[s++]=a>>>28&15,t[s++]=l>>>0&15,t[s++]=l>>>4&15,t[s++]=l>>>8&15,t[s++]=l>>>12&15,t[s++]=l>>>16&15,t[s++]=l>>>20&15,t[s++]=l>>>24&15,t[s++]=l>>>28&15,t[s++]=c>>>0&15,t[s++]=c>>>4&15,t[s++]=c>>>8&15,t[s++]=c>>>12&15,t[s++]=c>>>16&15,t[s++]=c>>>20&15,t[s++]=c>>>24&15,t[s++]=c>>>28&15,t[s++]=h>>>0&15,t[s++]=h>>>4&15,t[s++]=h>>>8&15,t[s++]=h>>>12&15,t[s++]=h>>>16&15,t[s++]=h>>>20&15,t[s++]=h>>>24&15,t[s++]=h>>>28&15}}function $R(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0;t[s++]=a>>>0&31,t[s++]=a>>>5&31,t[s++]=a>>>10&31,t[s++]=a>>>15&31,t[s++]=a>>>20&31,t[s++]=a>>>25&31,t[s++]=(a>>>30|(l&7)<<2)&31,t[s++]=l>>>3&31,t[s++]=l>>>8&31,t[s++]=l>>>13&31,t[s++]=l>>>18&31,t[s++]=l>>>23&31,t[s++]=(l>>>28|(c&1)<<4)&31,t[s++]=c>>>1&31,t[s++]=c>>>6&31,t[s++]=c>>>11&31,t[s++]=c>>>16&31,t[s++]=c>>>21&31,t[s++]=c>>>26&31,t[s++]=(c>>>31|(h&15)<<1)&31,t[s++]=h>>>4&31,t[s++]=h>>>9&31,t[s++]=h>>>14&31,t[s++]=h>>>19&31,t[s++]=h>>>24&31,t[s++]=(h>>>29|(u&3)<<3)&31,t[s++]=u>>>2&31,t[s++]=u>>>7&31,t[s++]=u>>>12&31,t[s++]=u>>>17&31,t[s++]=u>>>22&31,t[s++]=u>>>27&31}}function jR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0;t[s++]=a>>>0&63,t[s++]=a>>>6&63,t[s++]=a>>>12&63,t[s++]=a>>>18&63,t[s++]=a>>>24&63,t[s++]=(a>>>30|(l&15)<<2)&63,t[s++]=l>>>4&63,t[s++]=l>>>10&63,t[s++]=l>>>16&63,t[s++]=l>>>22&63,t[s++]=(l>>>28|(c&3)<<4)&63,t[s++]=c>>>2&63,t[s++]=c>>>8&63,t[s++]=c>>>14&63,t[s++]=c>>>20&63,t[s++]=c>>>26&63,t[s++]=h>>>0&63,t[s++]=h>>>6&63,t[s++]=h>>>12&63,t[s++]=h>>>18&63,t[s++]=h>>>24&63,t[s++]=(h>>>30|(u&15)<<2)&63,t[s++]=u>>>4&63,t[s++]=u>>>10&63,t[s++]=u>>>16&63,t[s++]=u>>>22&63,t[s++]=(u>>>28|(p&3)<<4)&63,t[s++]=p>>>2&63,t[s++]=p>>>8&63,t[s++]=p>>>14&63,t[s++]=p>>>20&63,t[s++]=p>>>26&63}}function WR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0,f=i[o++]>>>0;t[s++]=a>>>0&127,t[s++]=a>>>7&127,t[s++]=a>>>14&127,t[s++]=a>>>21&127,t[s++]=(a>>>28|(l&7)<<4)&127,t[s++]=l>>>3&127,t[s++]=l>>>10&127,t[s++]=l>>>17&127,t[s++]=l>>>24&127,t[s++]=(l>>>31|(c&63)<<1)&127,t[s++]=c>>>6&127,t[s++]=c>>>13&127,t[s++]=c>>>20&127,t[s++]=(c>>>27|(h&3)<<5)&127,t[s++]=h>>>2&127,t[s++]=h>>>9&127,t[s++]=h>>>16&127,t[s++]=h>>>23&127,t[s++]=(h>>>30|(u&31)<<2)&127,t[s++]=u>>>5&127,t[s++]=u>>>12&127,t[s++]=u>>>19&127,t[s++]=(u>>>26|(p&1)<<6)&127,t[s++]=p>>>1&127,t[s++]=p>>>8&127,t[s++]=p>>>15&127,t[s++]=p>>>22&127,t[s++]=(p>>>29|(f&15)<<3)&127,t[s++]=f>>>4&127,t[s++]=f>>>11&127,t[s++]=f>>>18&127,t[s++]=f>>>25&127}}function qR(i,e,t,n){let s=n,o=e;for(let r=0;r<8;r++){const a=i[o++]>>>0,l=i[o++]>>>0,c=i[o++]>>>0,h=i[o++]>>>0,u=i[o++]>>>0,p=i[o++]>>>0,f=i[o++]>>>0,m=i[o++]>>>0;t[s++]=a>>>0&255,t[s++]=a>>>8&255,t[s++]=a>>>16&255,t[s++]=a>>>24&255,t[s++]=l>>>0&255,t[s++]=l>>>8&255,t[s++]=l>>>16&255,t[s++]=l>>>24&255,t[s++]=c>>>0&255,t[s++]=c>>>8&255,t[s++]=c>>>16&255,t[s++]=c>>>24&255,t[s++]=h>>>0&255,t[s++]=h>>>8&255,t[s++]=h>>>16&255,t[s++]=h>>>24&255,t[s++]=u>>>0&255,t[s++]=u>>>8&255,t[s++]=u>>>16&255,t[s++]=u>>>24&255,t[s++]=p>>>0&255,t[s++]=p>>>8&255,t[s++]=p>>>16&255,t[s++]=p>>>24&255,t[s++]=f>>>0&255,t[s++]=f>>>8&255,t[s++]=f>>>16&255,t[s++]=f>>>24&255,t[s++]=m>>>0&255,t[s++]=m>>>8&255,t[s++]=m>>>16&255,t[s++]=m>>>24&255}}function KR(i,e,t,n){let s=n,o=e;for(let r=0;r<128;r++){const a=i[o++]>>>0;t[s++]=a&65535,t[s++]=a>>>16&65535}}function XR(i,e,t,n,s){const o=Pc[s]>>>0;let r=e,a=0,l=i[r]>>>0,c=n;for(let h=0;h<8;h++){for(let u=0;u<32;u++)if(a+s<=32){const p=l>>>a&o;t[c+u]=p|0,a+=s,a===32&&(a=0,r++,u!==31&&(l=i[r]>>>0))}else{const p=32-a,f=l>>>a;r++,l=i[r]>>>0;const m=s-p,y=-1>>>32-m>>>0,g=l&y,A=(f|g<<p)&o;t[c+u]=A|0,a=m}c+=32,a=0,h<7&&(l=i[r]>>>0)}}const cn=32,Nc=cn+1,Lc=TR(jm),JR=3*Lc/Ht+Lc|0;function Wm(){const i=new Uint8Array(JR);return{dataToBePacked:new Array(Nc),dataPointers:new Int32Array(Nc),byteContainer:i,byteContainerI32:new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2),exceptionSizes:new Int32Array(Nc)}}function ZR(i=16){if(i<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${i}`);const e=Math.max(16,i|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:Wm()}}function eF(i,e){if(e<=i.encodedWords.length)return i.encodedWords;const t=new Uint32Array(Math.max(16,e*2));return i.encodedWords=t,t}function tF(i,e,t,n){n.byteContainer.length<t&&(n.byteContainer=new Uint8Array(t*2),n.byteContainerI32=void 0);const s=n.byteContainer,o=t>>>2;if((s.byteOffset&3)===0){let a=n.byteContainerI32;(!a||a.buffer!==s.buffer||a.byteOffset!==s.byteOffset||a.length<o)&&(a=n.byteContainerI32=new Int32Array(s.buffer,s.byteOffset,s.byteLength>>>2)),a.set(i.subarray(e,e+o))}else for(let a=0;a<o;a=a+1|0){const l=i[e+a|0]|0,c=a<<2;s[c]=l&255,s[c+1|0]=l>>>8&255,s[c+2|0]=l>>>16&255,s[c+3|0]=l>>>24&255}const r=t&3;if(r>0){const a=e+o|0,l=i[a]|0,c=o<<2;for(let h=0;h<r;h=h+1|0)s[c+h|0]=l>>>(h<<3)&255}return s}function iF(i,e,t){const n=i[e++]|0,s=t.dataToBePacked;for(let o=2;o<=cn;o=o+1|0){if((n>>>o-1&1)===0)continue;if(e>=i.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${o}, streamWordIndex=${e}, needWords=1, availableWords=${i.length-e}, encodedWords=${i.length})`);const r=i[e++]>>>0,a=MR(r),l=r*o+31>>>5;if(e+l>i.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${o}, size=${r}, streamWordIndex=${e}, needWords=${l}, availableWords=${i.length-e}, encodedWords=${i.length})`);let c=s[o];(!c||c.length<a)&&(c=s[o]=new Uint32Array(a));let h=0;for(;h<r;h=h+32|0)uF(i,e,c,h,o),e=e+o|0;const u=h-r|0;e=e-(u*o>>>5)|0,t.exceptionSizes[o]=r}return e}function nF(i,e,t,n,s){switch(s){case 1:QR(i,e,t,n);break;case 2:zR(i,e,t,n);break;case 3:HR(i,e,t,n);break;case 4:YR(i,e,t,n);break;case 5:$R(i,e,t,n);break;case 6:jR(i,e,t,n);break;case 7:WR(i,e,t,n);break;case 8:qR(i,e,t,n);break;case 16:KR(i,e,t,n);break;default:XR(i,e,t,n,s);break}return e+(s<<3)|0}function sF(i,e,t,n){if(t+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${n} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${t}, byteSize=${e})`);const s=i[t++],o=i[t++];if(s>cn)throw new Error(`FastPFOR decode: invalid bitWidth=${s} at block=${n} (expected 0..${cn}). This likely indicates corrupted or truncated input.`);return{bitWidth:s,exceptionCount:o,bytePosIn:t}}function oF(i,e,t,n,s,o){if(t+1>e)throw new Error(`FastPFOR decode: exception header underflow at block=${o} (need 1 byte for maxBits, bytePos=${t}, byteSize=${e})`);const r=i[t++];if(r<n||r>cn)throw new Error(`FastPFOR decode: invalid maxBits=${r} at block=${o} (bitWidth=${n}, expected ${n}..${cn})`);const a=r-n|0;if(a<1||a>cn)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${a} at block=${o} (bitWidth=${n}, maxBits=${r})`);if(t+s>e)throw new Error(`FastPFOR decode: exception positions underflow at block=${o} (need=${s}, have=${e-t})`);return{maxBits:r,exceptionBitWidth:a,bytePosIn:t}}function rF(i,e,t,n,s,o,r,a,l){const{maxBits:c,exceptionBitWidth:h,bytePosIn:u}=oF(s,o,r,t,n,l);if(r=u,h===1){const g=1<<t;for(let A=0;A<n;A=A+1|0){const v=s[r++];i[v+e|0]|=g}return r}const p=a.dataToBePacked[h];if(!p)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${t}, maxBits=${c}) at block ${l}`);const f=a.dataPointers;let m=f[h]|0;const y=a.exceptionSizes[h]|0;if(m+n>y)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${m}, need ${n}, size=${y}) at block ${l}`);for(let g=0;g<n;g=g+1|0){const A=s[r++],v=p[m++]|0;i[A+e|0]|=v<<t}return f[h]=m,r}function aF(i,e,t,n,s,o,r,a,l,c){let h=t|0,u=0;for(let p=0;p<r;p=p+1|0){const f=sF(a,l,u,p);u=f.bytePosIn;const m=f.bitWidth,y=f.exceptionCount,g=o+p*Ht|0;switch(m){case 0:s.fill(0,g,g+Ht);break;case 32:for(let A=0;A<Ht;A=A+1|0)s[g+A|0]=i[h+A|0]|0;h=h+Ht|0;break;default:h=nF(i,h,s,g,m);break}y>0&&(u=rF(s,g,m,y,a,l,u,c,p))}if(h!==n)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${t}, consumedPackedEnd=${h}, expectedPackedEnd=${n}, packedWords=${n-t}, encoded.length=${i.length})`)}function lF(i,e,t,n,s,o){const r=t|0,a=i[r]|0;if(a<=0||r+a>i.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${r} (expected > 0 and pageStart+whereMeta < encoded.length=${i.length})`);const l=r+1|0,c=r+a|0,h=i[c]>>>0,u=h+3>>>2,p=c+1,f=p+u;if(f>=i.length)throw new Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${u}, pageStart=${r}, packedEnd=${c}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${i.length})`);const m=tF(i,p,h,o),y=h,g=iF(i,f,o);o.dataPointers.fill(0);const v=n|0,b=s/Ht|0;return aF(i,r,l,c,e,v,b,m,y,o),g}function cF(i,e,t,n,s,o){const r=Dc(s,Ht),a=n+r;let l=n,c=t;for(;l!==a;){const h=Math.min(Lc,a-l);c=lF(i,e,c,l,h,o),l=l+h|0}return c}function dF(i,e,t,n,s,o){if(o===0)return e;let r=0,a=e;const l=e+t,c=s;let h=s;const u=s+o;let p=0,f=0;for(;a<l&&h<u;){const y=i[a]>>>r&255;if(r+=8,a+=r>>>5,r&=31,p|=(y&127)<<f,(y&128)!==0)n[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-c}/${o}, inPos=${a}, inEnd=${l})`)}if(h!==u)throw new Error(`FastPFOR VByte: truncated stream (decoded=${h-c}, expected=${o}, consumedWords=${a-e}/${t}, vbyteStart=${e}, vbyteEnd=${l})`);return a}function hF(i,e,t){let n=0,s=0;const o=new Uint32Array(e),r=t??Wm();if(i.length>0){const c=i[n]|0;if(n=n+1|0,(c&Ht-1)!==0)throw new Error(`FastPFOR decode: invalid alignedLength=${c} (expected multiple of ${Ht})`);if(s+c>o.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${s}, alignedLength=${c}, out.length=${o.length})`);n=cF(i,o,n,s,c,r),s=s+c|0}const a=i.length-n|0,l=e-s|0;return dF(i,n,a,o,s,l),o}function uF(i,e,t,n,s){switch(s){case 2:_R(i,e,t,n);return;case 3:kR(i,e,t,n);return;case 4:PR(i,e,t,n);return;case 5:DR(i,e,t,n);return;case 6:NR(i,e,t,n);return;case 7:LR(i,e,t,n);return;case 8:RR(i,e,t,n);return;case 9:FR(i,e,t,n);return;case 10:OR(i,e,t,n);return;case 11:GR(i,e,t,n);return;case 12:UR(i,e,t,n);return;case 16:VR(i,e,t,n);return;case 32:for(let c=0;c<32;c=c+1|0)t[n+c|0]=i[e+c|0]|0;return}const o=Pc[s]>>>0;let r=e,a=0,l=i[r]>>>0;for(let c=0;c<32;c++)if(a+s<=32){const h=l>>>a&o;t[n+c]=h|0,a+=s,a===32&&(a=0,r++,c!==31&&(l=i[r]>>>0))}else{const h=32-a,u=l>>>a;r++,l=i[r]>>>0;const p=Pc[s-h]>>>0,f=l&p,m=(u|f<<h)&o;t[n+c]=m|0,a=s-h}}function fF(i,e,t,n){if(e<0||t<0||e+t>i.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${t}, bytes.length=${i.length})`);const s=Math.floor(t/4),o=t%4!==0,r=o?s+1:s;if(n.length<r)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${n.length} < ${r}`);if(s>0){const a=i.byteOffset+e;if((a&3)===0){const l=new Uint32Array(i.buffer,a,s);for(let c=0;c<s;c++)n[c]=BR(l[c])|0}else for(let l=0;l<s;l++){const c=e+l*4;n[l]=i[c]<<24|i[c+1]<<16|i[c+2]<<8|i[c+3]|0}}if(o){const a=e+s*4,l=t-s*4;let c=0;for(let h=0;h<l;h++)c|=i[a+h]<<24-h*8;n[s]=c|0}return r}function at(i,e,t){const n=new Uint32Array(t);let s=0,o=e.get();for(let r=0;r<n.length;r++){let a=i[o++],l=a&127;if(a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<7,a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<14,a<128){n[s++]=l;continue}if(a=i[o++],l|=(a&127)<<21,a<128){n[s++]=l;continue}a=i[o++],l|=(a&15)<<28,n[s++]=l}return e.set(o),n}function jn(i,e,t){const n=new BigUint64Array(t);for(let s=0;s<n.length;s++)n[s]=pF(i,e);return n}function pF(i,e){let t=0n,n=0,s=e.get();for(;s<i.length;){const o=i[s++];if(t|=BigInt(o&127)<<BigInt(n),(o&128)===0)break;if(n+=7,n>=64)throw new Error("Varint too long")}return e.set(s),t}function mF(i,e,t){const n=new Float64Array(t);for(let s=0;s<t;s++)n[s]=gF(i,e);return n}function gF(i,e){let t,n;return n=i[e.get()],e.increment(),t=n&127,n<128||(n=i[e.get()],e.increment(),t|=(n&127)<<7,n<128)||(n=i[e.get()],e.increment(),t|=(n&127)<<14,n<128)||(n=i[e.get()],e.increment(),t|=(n&127)<<21,n<128)?t:(n=i[e.get()],t|=(n&15)<<28,yF(t,i,e))}function yF(i,e,t){let n,s;if(s=e[t.get()],t.increment(),n=(s&112)>>4,s<128||(s=e[t.get()],t.increment(),n|=(s&127)<<3,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<10,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<17,s<128)||(s=e[t.get()],t.increment(),n|=(s&127)<<24,s<128)||(s=e[t.get()],t.increment(),n|=(s&1)<<31,s<128))return n*4294967296+(i>>>0);throw new Error("Expected varint not more than 10 bytes")}function AF(i,e,t,n){const s=ZR(t>>>2);return vF(i,e,t,n,s)}function vF(i,e,t,n,s){const o=n.get();if((t&3)!==0)throw new Error(`FastPFOR: invalid encodedByteLength=${t} at offset=${o} (encodedBytes.length=${i.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const r=t>>>2,a=eF(s,r);fF(i,o,t,a);const l=hF(a.subarray(0,r),e,s.decoderWorkspace);return n.add(t),l}function ye(i){return i>>>1^-(i&1)}function lt(i){return i>>1n^-(i&1n)}function dn(i){return i%2===1?(i+1)/-2:i/2}function bF(i){const e=new Int32Array(i.length);for(let t=0;t<i.length;t++)e[t]=ye(i[t]);return e}function wF(i){const e=new BigInt64Array(i.length);for(let t=0;t<i.length;t++)e[t]=lt(i[t]);return e}function Rc(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=i[o]}const n=new Uint32Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o],a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function Fc(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=Number(i[o])}const n=new BigUint64Array(t);let s=0;for(let o=0;o<e;o++){const r=Number(i[o]),a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function qm(i,e,t){const n=new Float64Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o],a=i[o+e];n.fill(a,s,s+r),s+=r}return n}function Km(i){const e=new Int32Array(i.length);e[0]=ye(i[0]);const t=i.length/4*4;let n=1;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=ye(s)+e[n-1],e[n+1]=ye(o)+e[n],e[n+2]=ye(r)+e[n+1],e[n+3]=ye(a)+e[n+2]}for(;n!==i.length;++n)e[n]=ye(i[n])+e[n-1];return e}function Xm(i){const e=new BigInt64Array(i.length);e[0]=lt(i[0]);const t=i.length/4*4;let n=1;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=lt(s)+e[n-1],e[n+1]=lt(o)+e[n],e[n+2]=lt(r)+e[n+1],e[n+3]=lt(a)+e[n+2]}for(;n!==e.length;++n)e[n]=lt(i[n])+e[n-1];return e}function CF(i){i[0]=dn(i[0]);const e=i.length/4*4;let t=1;if(e>=4)for(;t<e-4;t+=4){const n=i[t],s=i[t+1],o=i[t+2],r=i[t+3];i[t]=dn(n)+i[t-1],i[t+1]=dn(s)+i[t],i[t+2]=dn(o)+i[t+1],i[t+3]=dn(r)+i[t+2]}for(;t!==i.length;++t)i[t]=dn(i[t])+i[t-1]}function EF(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=i[o]}const n=new Int32Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o];let a=i[o+e];a=ye(a),n.fill(a,s,s+r),s+=r}return n}function xF(i,e,t){if(t===void 0){t=0;for(let o=0;o<e;o++)t+=Number(i[o])}const n=new BigInt64Array(t);let s=0;for(let o=0;o<e;o++){const r=Number(i[o]);let a=i[o+e];a=lt(a),n.fill(a,s,s+r),s+=r}return n}function IF(i,e,t){const n=new Float64Array(t);let s=0;for(let o=0;o<e;o++){const r=i[o];let a=i[o+e];a=dn(a),n.fill(a,s,s+r),s+=r}return n}function Oc(i){const e=i.length/4*4;let t=1;if(e>=4)for(let n=i[0];t<e-4;t+=4)n=i[t]+=n,n=i[t+1]+=n,n=i[t+2]+=n,n=i[t+3]+=n;for(;t!==i.length;)i[t]+=i[t-1],++t}function SF(i){let e=0;for(let t=0;t<i.length;t++)i[t]+=e,e=i[t]}function MF(i){if(i.length<2)return new Int32Array(i);const e=new Int32Array(i.length);e[0]=ye(i[0]),e[1]=ye(i[1]);const t=i.length/4*4;let n=2;if(t>=4)for(;n<t-4;n+=4){const s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];e[n]=ye(s)+e[n-2],e[n+1]=ye(o)+e[n-1],e[n+2]=ye(r)+e[n],e[n+3]=ye(a)+e[n+1]}for(;n!==i.length;n+=2)e[n]=ye(i[n])+e[n-2],e[n+1]=ye(i[n+1])+e[n-1];return e}function TF(i){const e=new Int32Array(i.length+1);e[0]=0,e[1]=ye(i[0]);let t=e[1];for(let n=2;n!==e.length;++n){const s=i[n-1],o=ye(s);t+=o,e[n]=e[n-1]+t}return new Uint32Array(e)}function BF(i,e,t){const n=new Int32Array(t+1);n[0]=0;let s=1,o=n[0];for(let r=0;r<e;r++){const a=i[r];let l=i[r+e];l=ye(l);for(let c=s;c<s+a;c++)n[c]=l+o,o=n[c];s+=a}return n}function _F(i,e,t){const n=new Uint32Array(t+1);n[0]=0;let s=1,o=n[0];for(let r=0;r<e;r++){const a=i[r],l=i[r+e];for(let c=s;c<s+a;c++)n[c]=l+o,o=n[c];s+=a}return n}function kF(i,e,t){const n=new Int32Array(t);let s=0,o=0;for(let r=0;r<e;r++){const a=i[r],l=i[r+e],c=ye(l);for(let h=0;h<a;h++)o+=c,n[s++]=o}return n}function PF(i,e,t){const n=new BigInt64Array(t);let s=0,o=0n;for(let r=0;r<e;r++){const a=Number(i[r]),l=i[r+e],c=lt(l);for(let h=0;h<a;h++)o+=c,n[s++]=o}return n}function Jm(i){const e=new Uint32Array(i.length);e[0]=ye(i[0])>>>0;for(let t=1;t<i.length;t++)e[t]=e[t-1]+ye(i[t])>>>0;return e}function Zm(i){const e=new BigUint64Array(i.length);e[0]=BigInt.asUintN(64,lt(i[0]));for(let t=1;t<i.length;t++)e[t]=BigInt.asUintN(64,e[t-1]+lt(i[t]));return e}function DF(i){if(i.length<2)return new Uint32Array(i);const e=new Uint32Array(i.length);e[0]=ye(i[0])>>>0,e[1]=ye(i[1])>>>0;for(let t=2;t<i.length;t+=2)e[t]=e[t-2]+ye(i[t])>>>0,e[t+1]=e[t-1]+ye(i[t+1])>>>0;return e}function NF(i){return i[1]}function LF(i){return ye(i[1])}function RF(i){if(i.length===2){const n=ye(i[1]);return[n,n]}const e=ye(i[2]),t=ye(i[3]);return[e,t]}function FF(i){return i[1]}function OF(i){return lt(i[1])}function GF(i){if(i.length===2){const n=lt(i[1]);return[n,n]}const e=lt(i[2]),t=lt(i[3]);return[e,t]}var Qe;(function(i){i.PRESENT="PRESENT",i.DATA="DATA",i.OFFSET="OFFSET",i.LENGTH="LENGTH"})(Qe||(Qe={}));var ht;(function(i){i.NONE="NONE",i.SINGLE="SINGLE",i.SHARED="SHARED",i.VERTEX="VERTEX",i.MORTON="MORTON",i.FSST="FSST"})(ht||(ht={}));var ii;(function(i){i.VERTEX="VERTEX",i.INDEX="INDEX",i.STRING="STRING",i.KEY="KEY"})(ii||(ii={}));var je;(function(i){i.VAR_BINARY="VAR_BINARY",i.GEOMETRIES="GEOMETRIES",i.PARTS="PARTS",i.RINGS="RINGS",i.TRIANGLES="TRIANGLES",i.SYMBOL="SYMBOL",i.DICTIONARY="DICTIONARY"})(je||(je={}));const UF=[Qe.PRESENT,Qe.DATA,Qe.OFFSET,Qe.LENGTH],eg=[ae.NONE,ae.DELTA,ae.COMPONENTWISE_DELTA,ae.RLE,ae.MORTON,ae.PDE],VF=[ti.NONE,ti.FAST_PFOR,ti.VARINT],QF=[ht.NONE,ht.SINGLE,ht.SHARED,ht.VERTEX,ht.MORTON,ht.FSST],zF=[ii.VERTEX,ii.INDEX,ii.STRING,ii.KEY],HF=[je.VAR_BINARY,je.GEOMETRIES,je.PARTS,je.RINGS,je.TRIANGLES,je.SYMBOL,je.DICTIONARY];function ut(i,e){const t=jF(i,e);return t.logicalLevelTechnique1===ae.MORTON?YF(t,i,e):(ae.RLE===t.logicalLevelTechnique1||ae.RLE===t.logicalLevelTechnique2)&&ti.NONE!==t.physicalLevelTechnique?$F(t,i,e):t}function YF(i,e,t){const n=at(e,t,2);return{physicalStreamType:i.physicalStreamType,logicalStreamType:i.logicalStreamType,logicalLevelTechnique1:i.logicalLevelTechnique1,logicalLevelTechnique2:i.logicalLevelTechnique2,physicalLevelTechnique:i.physicalLevelTechnique,numValues:i.numValues,byteLength:i.byteLength,decompressedCount:i.decompressedCount,numBits:n[0],coordinateShift:n[1]}}function $F(i,e,t){const n=at(e,t,2);return{physicalStreamType:i.physicalStreamType,logicalStreamType:i.logicalStreamType,logicalLevelTechnique1:i.logicalLevelTechnique1,logicalLevelTechnique2:i.logicalLevelTechnique2,physicalLevelTechnique:i.physicalLevelTechnique,numValues:i.numValues,byteLength:i.byteLength,decompressedCount:n[1],runs:n[0],numRleValues:n[1]}}function jF(i,e){const t=i[e.get()],n=UF[t>>4];let s={};switch(n){case Qe.DATA:s={dictionaryType:QF[t&15]};break;case Qe.OFFSET:s={offsetType:zF[t&15]};break;case Qe.LENGTH:s={lengthType:HF[t&15]};break}e.increment();const o=i[e.get()],r=eg[o>>5],a=eg[o>>2&7],l=VF[o&3];e.increment();const c=at(i,e,2),h=c[0],u=c[1];return{physicalStreamType:n,logicalStreamType:s,logicalLevelTechnique1:r,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:h,byteLength:u,decompressedCount:h}}var Ce;(function(i){i[i.FLAT=0]="FLAT",i[i.CONST=1]="CONST",i[i.SEQUENCE=2]="SEQUENCE",i[i.DICTIONARY=3]="DICTIONARY",i[i.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(Ce||(Ce={}));class mi{constructor(e,t){this.values=e,this._size=t}get(e){const t=Math.floor(e/8),n=e%8;return(this.values[t]>>n&1)===1}set(e,t){const n=Math.floor(e/8),s=e%8;this.values[n]=this.values[n]|(t?1:0)<<s}getInt(e){const t=Math.floor(e/8),n=e%8;return this.values[t]>>n&1}size(){return this._size}getBuffer(){return this.values}}function Wn(i,e,t){if(!e)return i;const n=e.size(),s=i.constructor,o=new s(n);let r=0;for(let a=0;a<n;a++)o[a]=e.get(a)?i[r++]:t;return o}function WF(i,e,t){if(!t)return i;const n=t.size(),s=new mi(i,e),o=new mi(new Uint8Array(Math.ceil(n/8)),n);let r=0;for(let a=0;a<n;a++){const l=t.get(a)?s.get(r++):!1;o.set(a,l)}return o.getBuffer()}function Gc(i,e,t,n,s){const o=qn(i,e,t);return ZF(o,t,n,s)}function xt(i,e,t,n,s){const o=qn(i,e,t);return eO(o,t,n,s)}function Oi(i,e,t){const n=qn(i,e,t);return sO(n,t)}function qn(i,e,t){const n=t.physicalLevelTechnique;switch(n){case ti.FAST_PFOR:return AF(i,t.numValues,t.byteLength,e);case ti.VARINT:return at(i,e,t.numValues);case ti.NONE:{const s=e.get(),o=t.byteLength;e.add(o);const r=i.subarray(s,e.get());return new Uint32Array(r)}default:throw new Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function qF(i,e,t){const n=qn(i,e,t);return n.length===1?ye(n[0]):LF(n)}function Uc(i,e,t){const n=qn(i,e,t);return n.length===1?t.logicalLevelTechnique1===ae.DELTA?ye(n[0]):n[0]:NF(n)}function tg(i,e,t){const n=qn(i,e,t);return RF(n)}function ig(i,e,t){const n=jn(i,e,t.numValues);return GF(n)}function KF(i,e,t,n){const s=jn(i,e,t.numValues);return tO(s,t,n)}function ng(i,e,t,n){const s=jn(i,e,t.numValues);return iO(s,t,n)}function XF(i,e,t){const n=mF(i,e,t.numValues);return nO(n,t,!1)}function JF(i,e,t){const n=jn(i,e,t.numValues);return n.length===1?lt(n[0]):OF(n)}function sg(i,e,t){const n=jn(i,e,t.numValues);return n.length===1?t.logicalLevelTechnique1===ae.DELTA?lt(n[0]):n[0]:FF(n)}function ZF(i,e,t,n){let s;switch(e.logicalLevelTechnique1){case ae.DELTA:if(e.logicalLevelTechnique2===ae.RLE){const o=e;if(!n)return kF(i,o.runs,o.numRleValues);i=Rc(i,o.runs,o.numRleValues),s=Km(i)}else s=Km(i);break;case ae.RLE:s=EF(i,e.runs,e.numRleValues);break;case ae.MORTON:Oc(i),s=new Int32Array(i);break;case ae.COMPONENTWISE_DELTA:s=MF(i);break;case ae.NONE:s=bF(i);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Wn(s,n,0):s}function eO(i,e,t,n){let s;switch(e.logicalLevelTechnique1){case ae.DELTA:if(e.logicalLevelTechnique2===ae.RLE){const o=e,r=Rc(i,o.runs,o.numRleValues);s=Jm(r)}else s=Jm(i);break;case ae.RLE:s=Rc(i,e.runs,e.numRleValues);break;case ae.MORTON:Oc(i),s=i;break;case ae.COMPONENTWISE_DELTA:s=DF(i);break;case ae.NONE:s=i;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?Wn(s,n,0):s}function tO(i,e,t){let n;switch(e.logicalLevelTechnique1){case ae.DELTA:if(e.logicalLevelTechnique2===ae.RLE){const s=e;if(!t)return PF(i,s.runs,s.numRleValues);i=Fc(i,s.runs,s.numRleValues),n=Xm(i)}else n=Xm(i);break;case ae.RLE:n=xF(i,e.runs,e.numRleValues);break;case ae.NONE:n=wF(i);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return t?Wn(n,t,0n):n}function iO(i,e,t){let n;switch(e.logicalLevelTechnique1){case ae.DELTA:if(e.logicalLevelTechnique2===ae.RLE){const s=e,o=Fc(i,s.runs,s.numRleValues);n=Zm(o)}else n=Zm(i);break;case ae.RLE:n=Fc(i,e.runs,e.numRleValues);break;case ae.NONE:n=i;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return t?Wn(n,t,0n):n}function nO(i,e,t){switch(e.logicalLevelTechnique1){case ae.DELTA:if(e.logicalLevelTechnique2===ae.RLE){const n=e;i=qm(i,n.runs,n.numRleValues)}return CF(i),i;case ae.RLE:return rO(i,e,t);case ae.NONE:return i;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function sO(i,e){if(e.logicalLevelTechnique1===ae.DELTA&&e.logicalLevelTechnique2===ae.NONE)return TF(i);if(e.logicalLevelTechnique1===ae.RLE&&e.logicalLevelTechnique2===ae.NONE){const t=e;return _F(i,t.runs,t.numRleValues)}if(e.logicalLevelTechnique1===ae.NONE&&e.logicalLevelTechnique2===ae.NONE){SF(i);const t=new Uint32Array(e.numValues+1);return t[0]=0,t.set(i,1),t}if(e.logicalLevelTechnique1===ae.DELTA&&e.logicalLevelTechnique2===ae.RLE){const t=e,n=BF(i,t.runs,t.numRleValues);return Oc(n),new Uint32Array(n)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}function ea(i,e,t,n,s="int32"){const o=i.logicalLevelTechnique1;if(o===ae.RLE)return i.runs===1?Ce.CONST:Ce.FLAT;if(o!==ae.DELTA||i.logicalLevelTechnique2!==ae.RLE)return i.numValues===1?Ce.CONST:Ce.FLAT;const r=e instanceof mi?e.size():e,a=i;if(a.numRleValues!==r)return Ce.FLAT;if(a.runs===1)return Ce.SEQUENCE;if(a.runs!==2)return i.numValues===1?Ce.CONST:Ce.FLAT;const l=n.get();if(i.physicalLevelTechnique===ti.VARINT)return oO(t,n,s)?Ce.SEQUENCE:i.numValues===1?Ce.CONST:Ce.FLAT;const c=n.get(),h=new Int32Array(t.buffer,t.byteOffset+c,4);n.set(l);const u=2;return h[2]===u&&h[3]===u?Ce.SEQUENCE:i.numValues===1?Ce.CONST:Ce.FLAT}function oO(i,e,t){const n=new $m(e.get());if(t==="int64"){const o=jn(i,n,4);return o[2]===2n&&o[3]===2n}const s=at(i,n,4);return s[2]===2&&s[3]===2}function rO(i,e,t){return t?IF(i,e.runs,e.numRleValues):qm(i,e.runs,e.numRleValues)}class og extends Jr{getValueFromBuffer(e){return this.dataBuffer[e]}}class rg extends Ym{constructor(e,t,n,s){super(e,BigInt64Array.of(t),n,s)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function Vc(i,e,t){const n=ag(i,e)-t,s=ag(i>>1,e)-t;return{x:n,y:s}}function ag(i,e){let t=0;for(let n=0;n<e;n++)t|=(i&1<<2*n)>>n;return t}var We;(function(i){i[i.POINT=0]="POINT",i[i.LINESTRING=1]="LINESTRING",i[i.POLYGON=2]="POLYGON",i[i.MULTIPOINT=3]="MULTIPOINT",i[i.MULTILINESTRING=4]="MULTILINESTRING",i[i.MULTIPOLYGON=5]="MULTIPOLYGON"})(We||(We={}));var lg;(function(i){i[i.POINT=0]="POINT",i[i.LINESTRING=1]="LINESTRING",i[i.POLYGON=2]="POLYGON"})(lg||(lg={}));var Gi;(function(i){i[i.MORTON=0]="MORTON",i[i.VEC_2=1]="VEC_2",i[i.VEC_3=2]="VEC_3"})(Gi||(Gi={}));function aO(i){const e=new Array(i.numGeometries);let t=1,n=1,s=1,o=0,r=0,a=0;const l=i.mortonSettings,c=i.topologyVector,h=c.geometryOffsets,u=c.partOffsets,p=c.ringOffsets,f=i.vertexOffsets,m=!f||f.length===0,y=i.containsPolygonGeometry(),g=i.vertexBuffer;for(let A=0;A<i.numGeometries;A++){const v=i.geometryType(A);switch(v){case We.POINT:{let b,C;if(m)b=g[r++],C=g[r++];else if(i.vertexBufferType===Gi.MORTON){const x=f[a++],I=g[x],E=Vc(I,l.numBits,l.coordinateShift);b=E.x,C=E.y}else{const x=f[a++]*2;b=g[x],C=g[x+1]}e[o++]=[[new Ne(b,C)]],h&&s++,u&&t++,p&&n++}break;case We.MULTIPOINT:{const b=h[s]-h[s-1];s++;const C=new Array(b);if(m)for(let x=0;x<b;x++){const I=g[r++],E=g[r++];C[x]=new Ne(I,E)}else for(let x=0;x<b;x++){const I=f[a++]*2,E=g[I],S=g[I+1];C[x]=new Ne(E,S)}e[o++]=C.map(x=>[x]),t+=b,n+=b}break;case We.LINESTRING:{let b;y?(b=p[n]-p[n-1],n++):b=u[t]-u[t-1],t++;let C;m?(C=Xn(g,r,b,!1),r+=b*2):(C=Kn(i.vertexBufferType,g,f,a,b,!1,l),a+=b),e[o++]=[C],h&&s++}break;case We.POLYGON:{const b=u[t]-u[t-1];t++;const C=new Array(b-1);let x,I=p[n]-p[n-1];if(n++,m){x=Xn(g,r,I,!0),r+=I*2;for(let E=0;E<C.length;E++)I=p[n]-p[n-1],n++,C[E]=Xn(g,r,I,!0),r+=I*2}else{x=Kn(i.vertexBufferType,g,f,a,I,!0,l),a+=I;for(let E=0;E<C.length;E++)I=p[n]-p[n-1],n++,C[E]=Kn(i.vertexBufferType,g,f,a,I,!0,l),a+=I}e[o++]=[x].concat(C),h&&s++}break;case We.MULTILINESTRING:{const b=h[s]-h[s-1];s++;const C=new Array(b);for(let x=0;x<b;x++){let I;if(y?(I=p[n]-p[n-1],n++):I=u[t]-u[t-1],t++,m)C[x]=Xn(g,r,I,!1),r+=I*2;else{const E=Kn(i.vertexBufferType,g,f,a,I,!1,l);C[x]=E,a+=I}}e[o++]=C}break;case We.MULTIPOLYGON:{const b=h[s]-h[s-1];s++;const C=new Array(b);for(let x=0;x<b;x++){const I=u[t]-u[t-1];t++;let E;const S=new Array(I-1),w=p[n]-p[n-1];n++,m?(E=Xn(g,r,w,!0),r+=w*2):(E=Kn(i.vertexBufferType,g,f,a,w,!0,l),a+=w);for(let T=0;T<S.length;T++){const _=p[n]-p[n-1];n++,m?(S[T]=Xn(g,r,_,!0),r+=_*2):(S[T]=Kn(i.vertexBufferType,g,f,a,_,!0,l),a+=_)}C[x]=[E].concat(S)}e[o++]=C.flat()}break;default:throw new Error(`The specified geometry type (${v}) is currently not supported.`)}}return e}function Kn(i,e,t,n,s,o,r){return i===Gi.MORTON?cO(e,t,n,s,o,r):lO(e,t,n,s,o)}function Xn(i,e,t,n){const s=new Array(n?t+1:t);for(let o=0;o<t*2;o+=2){const r=i[e+o],a=i[e+o+1];s[o/2]=new Ne(r,a)}return n&&(s[s.length-1]=s[0]),s}function lO(i,e,t,n,s){const o=new Array(s?n+1:n);for(let r=0;r<n*2;r+=2){const a=e[t+r/2]*2,l=i[a],c=i[a+1];o[r/2]=new Ne(l,c)}return s&&(o[o.length-1]=o[0]),o}function cO(i,e,t,n,s,o){const r=new Array(s?n+1:n);for(let a=0;a<n;a++){const l=e[t+a],c=i[l],h=Vc(c,o.numBits,o.coordinateShift);r[a]=new Ne(h.x,h.y)}return s&&(r[r.length-1]=r[0]),r}class cg{constructor(e,t,n,s,o){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=n,this._vertexBuffer=s,this._mortonSettings=o}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,n=this.vertexBuffer[t],s=this.vertexBuffer[t+1];return[n,s]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const o=this.vertexOffsets[e],r=this.vertexBuffer[o],a=Vc(r,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,n=this.vertexBuffer[t],s=this.vertexBuffer[t+1];return[n,s]}getGeometries(){return aO(this)}get mortonSettings(){return this._mortonSettings}}function dO(i,e,t,n,s){return new dg(i,e,Gi.VEC_2,t,n,s)}function hO(i,e,t,n,s,o){return new dg(i,e,Gi.MORTON,t,n,s,o)}class dg extends cg{constructor(e,t,n,s,o,r,a){super(n,s,o,r,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===We.POLYGON||this._geometryType===We.MULTIPOLYGON}containsSingleGeometryType(){return!0}}function uO(i,e,t,n){return new hg(Gi.VEC_2,i,e,t,n)}function fO(i,e,t,n,s){return new hg(Gi.MORTON,i,e,t,n,s)}class hg extends cg{constructor(e,t,n,s,o,r){super(e,n,s,o,r),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===We.POLYGON||this.geometryType(e)===We.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class ug{constructor(e,t,n,s){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=n,this._topologyVector=s}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,n=t.partOffsets,s=t.ringOffsets,o=t.geometryOffsets;let r=0,a=1,l=1,c=1;for(let h=0;h<this.numGeometries;h++)switch(this.geometryType(h)){case We.POLYGON:{const p=n[a]-n[a-1];a++;const f=[];for(let m=0;m<p;m++){const y=s[l]-s[l-1];l++;const g=[];for(let A=0;A<y;A++){const v=this._vertexBuffer[r++],b=this._vertexBuffer[r++];g.push(new Ne(v,b))}g.length>0&&g.push(g[0]),f.push(g)}e[h]=f,o&&c++}break;case We.MULTIPOLYGON:{const p=o[c]-o[c-1];c++;const f=[];for(let m=0;m<p;m++){const y=n[a]-n[a-1];a++;for(let g=0;g<y;g++){const A=s[l]-s[l-1];l++;const v=[];for(let b=0;b<A;b++){const C=this._vertexBuffer[r++],x=this._vertexBuffer[r++];v.push(new Ne(C,x))}v.length>0&&v.push(v[0]),f.push(v)}}e[h]=f}break}return e}[Symbol.iterator](){return null}}function fg(i,e,t,n,s,o){return new pO(i,e,t,n,s,o)}class pO extends ug{constructor(e,t,n,s,o,r){super(n,s,o,r),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function pg(i,e,t,n,s){return new mO(i,e,t,n,s)}class mO extends ug{constructor(e,t,n,s,o){super(t,n,s,o),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function gO(i,e,t,n,s){const o=ut(i,t),r=ea(o,n,i,t);let a,l,c,h;if(r===Ce.CONST){const b=Uc(i,t,o);let C,x,I,E;for(let S=0;S<e-1;S++){const w=ut(i,t);switch(w.physicalStreamType){case Qe.LENGTH:switch(w.logicalStreamType.lengthType){case je.GEOMETRIES:C=Oi(i,t,w);break;case je.PARTS:x=Oi(i,t,w);break;case je.RINGS:I=Oi(i,t,w);break;case je.TRIANGLES:E=Oi(i,t,w)}break;case Qe.OFFSET:{switch(w.logicalStreamType.offsetType){case ii.VERTEX:a=xt(i,t,w);break;case ii.INDEX:h=xt(i,t,w);break}break}case Qe.DATA:{if(ht.VERTEX===w.logicalStreamType.dictionaryType)l=Gc(i,t,w,s);else{const T=w;c={numBits:T.numBits,coordinateShift:T.coordinateShift},l=xt(i,t,w,s)}break}}}return h?C!==void 0||x!==void 0?fg(n,b,E,h,l,{geometryOffsets:C,partOffsets:x,ringOffsets:I}):fg(n,b,E,h,l):c===void 0?dO(n,b,{geometryOffsets:C,partOffsets:x,ringOffsets:I},a,l):hO(n,b,{geometryOffsets:C,partOffsets:x,ringOffsets:I},a,l,c)}const u=xt(i,t,o);let p,f,m,y;for(let b=0;b<e-1;b++){const C=ut(i,t);switch(C.physicalStreamType){case Qe.LENGTH:switch(C.logicalStreamType.lengthType){case je.GEOMETRIES:p=xt(i,t,C);break;case je.PARTS:f=xt(i,t,C);break;case je.RINGS:m=xt(i,t,C);break;case je.TRIANGLES:y=Oi(i,t,C)}break;case Qe.OFFSET:switch(C.logicalStreamType.offsetType){case ii.VERTEX:a=xt(i,t,C);break;case ii.INDEX:h=xt(i,t,C);break}break;case Qe.DATA:if(ht.VERTEX===C.logicalStreamType.dictionaryType)l=Gc(i,t,C,s);else{const x=C;c={numBits:x.numBits,coordinateShift:x.coordinateShift},l=xt(i,t,C,s)}break}}let g,A,v;return p?(g=Qc(u,p,2),f&&m?(A=mg(u,g,f,!1),v=AO(u,g,A,m)):f&&(A=yO(u,g,f))):f&&m?(A=Qc(u,f,1),v=mg(u,A,m,!0)):f&&(A=Qc(u,f,0)),h&&!A?pg(u,y,h,l):h?pg(u,y,h,l,{geometryOffsets:g,partOffsets:A,ringOffsets:v}):c===void 0?uO(u,{geometryOffsets:g,partOffsets:A,ringOffsets:v},a,l):fO(u,{geometryOffsets:g,partOffsets:A,ringOffsets:v},a,l,c)}function Qc(i,e,t){const n=new Uint32Array(i.length+1);let s=0;n[0]=s;let o=0;for(let r=0;r<i.length;r++)s=n[r+1]=s+(i[r]>t?e[o++]:1);return n}function mg(i,e,t,n){const s=new Uint32Array(e[e.length-1]+1);let o=0;s[0]=o;let r=1,a=0;for(let l=0;l<i.length;l++){const c=i[l],h=e[l+1]-e[l];if(c===5||c===2||n&&(c===4||c===1))for(let u=0;u<h;u++)o=s[r++]=o+t[a++];else for(let u=0;u<h;u++)s[r++]=++o}return s}function yO(i,e,t){const n=new Uint32Array(e[e.length-1]+1);let s=0;n[0]=s;let o=1,r=0;for(let a=0;a<i.length;a++){const l=i[a],c=e[a+1]-e[a];if(l===4||l===1)for(let h=0;h<c;h++)s=n[o++]=s+t[r++];else for(let h=0;h<c;h++)n[o++]=++s}return n}function AO(i,e,t,n){const s=new Uint32Array(t[t.length-1]+1);let o=0;s[0]=o;let r=1,a=1,l=0;for(let c=0;c<i.length;c++){const h=i[c],u=e[c+1]-e[c];if(h!==0&&h!==3)for(let p=0;p<u;p++){const f=t[r]-t[r-1];r++;for(let m=0;m<f;m++)o=s[a++]=o+n[l++]}else for(let p=0;p<u;p++)s[a++]=++o,r++}return s}class vO extends $n{constructor(e,t,n){super(e,t.getBuffer(),n),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class bO extends Jr{getValueFromBuffer(e){return this.dataBuffer[e]}}class gg extends $n{constructor(e,t,n,s){super(e,s?BigInt64Array.of(t):BigUint64Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}function mo(i,e,t,n,s){const o=Math.ceil(e/8),r=wO(i,o,t,n);return s?WF(r,e,s):r}function wO(i,e,t,n){const s=new Uint8Array(e);let o=0;const r=n.get()+t;for(;o<e&&!(n.get()>=r);){const a=i[n.increment()];if(a<=127){const l=a+3,c=i[n.increment()],h=Math.min(o+l,e);s.fill(c,o,h),o=h}else{const l=256-a;for(let c=0;c<l&&o<e;c++)s[o++]=i[n.increment()]}}return n.set(r),s}function CO(i,e,t,n){const s=e.get(),o=s+t*Float32Array.BYTES_PER_ELEMENT,r=new Uint8Array(i.subarray(s,o)).buffer,a=new Float32Array(r);return e.set(o),n?Wn(a,n,0):a}function EO(i,e,t,n){const s=e.get(),o=s+t*Float64Array.BYTES_PER_ELEMENT,r=new Uint8Array(i.subarray(s,o)).buffer,a=new Float64Array(r);return e.set(o),n?Wn(a,n,0):a}const xO=12,IO=new TextDecoder;function zc(i,e,t){return t-e>=xO?IO.decode(i.subarray(e,t)):SO(i,e,t)}function SO(i,e,t){let n="",s=e;for(;s<t;){const o=i[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=i[s+1],c=i[s+2],h=i[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}class Hc extends $n{constructor(e,t,n,s){super(e,n,s),this.offsetBuffer=t}}class yg extends Hc{constructor(e,t,n,s){super(e,t,n,s??t.length-1)}getValueFromBuffer(e){const t=this.offsetBuffer[e],n=this.offsetBuffer[e+1];return zc(this.dataBuffer,t,n)}}class Jn extends Hc{constructor(e,t,n,s,o){super(e,n,s,o??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){const t=this.indexBuffer[e],n=this.offsetBuffer[t],s=this.offsetBuffer[t+1];return zc(this.dataBuffer,n,s)}}function MO(i,e,t){const n=[],s=new Array(e.length).fill(0);for(let o=1;o<e.length;o++)s[o]=s[o-1]+e[o-1];for(let o=0;o<t.length;o++)if(t[o]===255)n.push(t[++o]);else{const r=e[t[o]],a=s[t[o]];for(let l=0;l<r;l++)n.push(i[a+l])}return new Uint8Array(n)}class Ag extends Hc{constructor(e,t,n,s,o,r,a){super(e,n,s,a??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=o,this.symbolTableBuffer=r}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=MO(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e],n=this.offsetBuffer[t],s=this.offsetBuffer[t+1];return zc(this.decodedDictionary,n,s)}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let n=e[0];for(let s=1;s<e.length;s++){const o=e[s];t[s-1]=o-n,n=o}return t}}function TO(i,e,t,n,s){let o=null,r=null,a=null,l=null,c=null,h=s??null,u=null,p=null;for(let f=0;f<n;f++){const m=ut(e,t);switch(m.physicalStreamType){case Qe.PRESENT:{const y=mo(e,m.numValues,m.byteLength,t),g=new mi(y,m.numValues);h=s??g;break}case Qe.OFFSET:{r=xt(e,t,m,void 0,h);break}case Qe.LENGTH:{const y=Oi(e,t,m);je.DICTIONARY===m.logicalStreamType.lengthType?o=y:je.SYMBOL===m.logicalStreamType.lengthType?l=y:u=y;break}case Qe.DATA:{const y=e.subarray(t.get(),t.get()+m.byteLength);t.add(m.byteLength);const g=m.logicalStreamType.dictionaryType;ht.FSST===g?c=y:ht.SINGLE===g||ht.SHARED===g?a=y:ht.NONE===g&&(p=y);break}}}return BO(i,c,r,o,a,l,h)??_O(i,a,r,o,h)??kO(i,u,p,r,h)}function BO(i,e,t,n,s,o,r){return e?new Ag(i,t,n,s,o,e,r):null}function _O(i,e,t,n,s){return e?s?new Jn(i,t,n,e,s):new Jn(i,t,n,e):null}function kO(i,e,t,n,s){if(!e||!t)return null;if(n)return s?new Jn(i,n,e,t,s):new Jn(i,n,e,t);if(s&&s.size()!==e.length-1){const o=new Uint32Array(s.size());let r=0;for(let a=0;a<s.size();a++)s.get(a)?o[a]=r++:o[a]=0;return new Jn(i,o,e,t,s)}return s?new yg(i,e,t,s):new yg(i,e,t)}function PO(i,e,t,n){let s=null,o=null,r=null,a=null,l=!1;for(;!l;){const p=ut(i,e);switch(p.physicalStreamType){case Qe.LENGTH:je.DICTIONARY===p.logicalStreamType.lengthType?s=Oi(i,e,p):r=Oi(i,e,p);break;case Qe.DATA:ht.SINGLE===p.logicalStreamType.dictionaryType||ht.SHARED===p.logicalStreamType.dictionaryType?(o=i.subarray(e.get(),e.get()+p.byteLength),l=!0):a=i.subarray(e.get(),e.get()+p.byteLength),e.add(p.byteLength);break}}const c=t.complexType.children,h=[];let u=0;for(const p of c){const f=at(i,e,1)[0];if(f===0)continue;const m=p.name?`${t.name}${p.name}`:t.name;if(p.type!=="scalarField"||p.scalarField.physicalType!==ge.STRING)throw new Error("Currently only scalar string fields are implemented for a struct.");if(f>1&&!p.nullable||f===1&&p.nullable)throw new Error(`The number of streams for the child field ${p.name} does not match its nullability. nullibilty: ${p.nullable}, numStreams: ${f}`);let y;if(p.nullable){const v=ut(i,e),b=mo(i,v.numValues,v.byteLength,e);y=new mi(b,v.numValues)}const g=ut(i,e),A=xt(i,e,g,void 0,y);h[u++]=a?new Ag(m,A,s,o,r,a,y):new Jn(m,A,s,o,y)}return h}function DO(i,e,t,n,s,o){return t.type==="scalarType"?NO(n,i,e,s,t.scalarType,t):n===0?null:PO(i,e,t)}function NO(i,e,t,n,s,o){let r=null;if(i===0)return null;if(o.nullable){const c=ut(e,t),h=c.numValues,u=t.get(),p=mo(e,h,c.byteLength,t);t.set(u+c.byteLength),r=new mi(p,c.numValues)}const a=r??n;switch(s.physicalType){case ge.UINT_32:case ge.INT_32:return GO(e,t,o,s,a);case ge.STRING:{const c=o.nullable?i-1:i;return TO(o.name,e,t,c,r)}case ge.BOOLEAN:return LO(e,t,o,n,a);case ge.UINT_64:case ge.INT_64:return OO(e,t,o,a,s);case ge.FLOAT:return RO(e,t,o,a);case ge.DOUBLE:return FO(e,t,o,a);default:throw new Error(`The specified data type for the field is currently not supported: ${s}`)}}function LO(i,e,t,n,s){const o=ut(i,e),r=o.numValues,a=e.get(),l=go(s)?s:void 0,c=mo(i,r,o.byteLength,e,l);e.set(a+o.byteLength);const h=new mi(c,r);return new vO(t.name,h,s)}function RO(i,e,t,n){const s=ut(i,e),o=go(n)?n:void 0,r=CO(i,e,s.numValues,o);return new bO(t.name,r,n)}function FO(i,e,t,n){const s=ut(i,e),o=go(n)?n:void 0,r=EO(i,e,s.numValues,o);return new Mc(t.name,r,n)}function OO(i,e,t,n,s){const o=ut(i,e),r=ea(o,n,i,e,"int64"),a=s.physicalType===ge.INT_64;if(r===Ce.FLAT){const c=go(n)?n:void 0,h=a?KF(i,e,o,c):ng(i,e,o,c);return new og(t.name,h,n)}if(r===Ce.SEQUENCE){const c=ig(i,e,o);return new rg(t.name,c[0],c[1],o.numRleValues)}const l=a?JF(i,e,o):sg(i,e,o);return new gg(t.name,l,n,a)}function GO(i,e,t,n,s){const o=ut(i,e),r=ea(o,s,i,e),a=n.physicalType===ge.INT_32;if(r===Ce.FLAT){const c=go(s)?s:void 0,h=a?Gc(i,e,o,void 0,c):xt(i,e,o,void 0,c);return new Sc(t.name,h,s)}if(r===Ce.SEQUENCE){const c=tg(i,e,o);return new Tc(t.name,c[0],c[1],o.numRleValues)}const l=a?qF(i,e,o):Uc(i,e,o);return new Bc(t.name,l,s,a)}function go(i){return i instanceof mi}function vg(i){switch(i){case 0:case 1:case 2:case 3:{const e={};e.nullable=(i&1)!==0,e.columnScope=Zr.FEATURE;const t={};return t.type="logicalType",t.logicalType=_c.ID,t.longID=(i&2)!==0,e.scalarType=t,e.type="scalarType",e}case 4:{const e={};e.nullable=!1,e.columnScope=Zr.FEATURE;const t={};return t.type="physicalType",t.physicalType=po.GEOMETRY,e.type="complexType",e.complexType=t,e}case 30:{const e={};e.nullable=!1,e.columnScope=Zr.FEATURE;const t={};return t.type="physicalType",t.physicalType=po.STRUCT,e.type="complexType",e.complexType=t,e}default:return zO(i)}}function bg(i){return i>=10}function wg(i){return i===30}function UO(i){if(i.type==="scalarType"){const e=i.scalarType;if(e.type==="physicalType")switch(e.physicalType){case ge.BOOLEAN:case ge.INT_8:case ge.UINT_8:case ge.INT_32:case ge.UINT_32:case ge.INT_64:case ge.UINT_64:case ge.FLOAT:case ge.DOUBLE:return!1;case ge.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(i.type==="complexType"){const e=i.complexType;if(e.type==="physicalType")switch(e.physicalType){case po.GEOMETRY:case po.STRUCT:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",i),!1}function VO(i){return i.type==="scalarType"&&i.scalarType?.type==="logicalType"&&i.scalarType.logicalType===_c.ID}function QO(i){return i.type==="complexType"&&i.complexType?.type==="physicalType"&&i.complexType.physicalType===po.GEOMETRY}function zO(i){let e;switch(i){case 10:case 11:e=ge.BOOLEAN;break;case 12:case 13:e=ge.INT_8;break;case 14:case 15:e=ge.UINT_8;break;case 16:case 17:e=ge.INT_32;break;case 18:case 19:e=ge.UINT_32;break;case 20:case 21:e=ge.INT_64;break;case 22:case 23:e=ge.UINT_64;break;case 24:case 25:e=ge.FLOAT;break;case 26:case 27:e=ge.DOUBLE;break;case 28:case 29:e=ge.STRING;break;default:return null}const t={};t.nullable=(i&1)!==0,t.columnScope=Zr.FEATURE;const n={};return n.type="physicalType",n.physicalType=e,t.type="scalarType",t.scalarType=n,t}const HO=new TextDecoder,YO="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)",$O="10-29(scalars), 30(STRUCT)";function Yc(i,e){const t=at(i,e,1)[0];if(t===0)return"";const n=e.get(),s=n+t,o=i.subarray(n,s);return e.add(t),HO.decode(o)}function jO(i){return{name:i.name,nullable:i.nullable,scalarField:i.scalarType,complexField:i.complexType,type:i.type==="scalarType"?"scalarField":"complexField"}}function Cg(i,e){const t=at(i,e,1)[0]>>>0;if(t<10||t>30)throw new Error(`Unsupported field type code ${t}. Supported: ${$O}`);const n=vg(t);if(bg(t)&&(n.name=Yc(i,e)),wg(t)){const s=at(i,e,1)[0]>>>0;n.complexType.children=new Array(s);for(let o=0;o<s;o++)n.complexType.children[o]=Cg(i,e)}return jO(n)}function WO(i,e){const t=at(i,e,1)[0]>>>0,n=vg(t);if(!n)throw new Error(`Unsupported column type code ${t}. Supported: ${YO}`);if(bg(t)?n.name=Yc(i,e):t>=0&&t<=3?n.name="id":t===4&&(n.name="geometry"),wg(t)){const s=at(i,e,1)[0]>>>0,o=n.complexType;o.children=new Array(s);for(let r=0;r<s;r++)o.children[r]=Cg(i,e)}return n}function qO(i,e){const t={};t.featureTables=[];const n={};if(n.name=Yc(i,e),n.name.length===0)throw new Error("Missing layer name");const s=at(i,e,1)[0]>>>0,o=at(i,e,1)[0]>>>0;n.columns=new Array(o);for(let r=0;r<o;r++)n.columns[r]=WO(i,e);return t.featureTables.push(n),[t,s]}function KO(i,e,t=!0){const n=new $m(0),s=[];for(;n.get()<i.length;){const o=at(i,n,1)[0]>>>0,a=n.get()+o;if(a>i.length)throw new Error(`Block overruns tile: ${a} > ${i.length}`);if(at(i,n,1)[0]>>>0!==1){n.set(a);continue}const[c,h]=qO(i,n),u=c.featureTables[0];let p=null,f=null;const m=[];let y=0;for(const A of u.columns){const v=A.name;if(VO(A)){let b=null;if(A.nullable){const x=ut(i,n),I=n.get(),E=mo(i,x.numValues,x.byteLength,n);n.set(I+x.byteLength),b=new mi(E,x.numValues)}const C=ut(i,n);y=b?b.size():C.decompressedCount,p=XO(i,A,n,v,C,b??y,t)}else if(QO(A)){const b=at(i,n,1)[0];if(y===0){const C=n.get();y=ut(i,n).decompressedCount,n.set(C)}f=gO(i,b,n,y,e)}else{const C=UO(A)?at(i,n,1)[0]:1;if(C===0)continue;const x=DO(i,n,A,C,y);if(x)if(Array.isArray(x))for(const I of x)m.push(I);else m.push(x)}}const g=new SR(u.name,f,p,m,h);s.push(g),n.set(a)}return s}function XO(i,e,t,n,s,o,r=!1){const a=e.scalarType;if(a?.type!=="logicalType"||a.logicalType!==_c.ID)throw new Error(`ID column must be a logical ID scalar type: ${n}`);const l=a.longID?ge.UINT_64:ge.UINT_32,c=typeof o=="number"?void 0:o,h=ea(s,o,i,t,l===ge.UINT_64?"int64":"int32");if(l===ge.UINT_32)switch(h){case Ce.FLAT:{const u=xt(i,t,s,void 0,c);return new Sc(n,u,o)}case Ce.SEQUENCE:{const u=tg(i,t,s);return new Tc(n,u[0],u[1],s.numRleValues)}case Ce.CONST:{const u=Uc(i,t,s);return new Bc(n,u,o,!1)}}switch(h){case Ce.FLAT:{if(r){const p=XF(i,t,s);return new Mc(n,p,o)}const u=ng(i,t,s,c);return new og(n,u,o)}case Ce.SEQUENCE:{const u=ig(i,t,s);return new rg(n,u[0],u[1],s.numRleValues)}case Ce.CONST:{const u=sg(i,t,s);return new gg(n,u,o,!1)}}throw new Error("Vector type not supported for id column.")}class JO{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case We.POINT:case We.MULTIPOINT:this.type=1;break;case We.LINESTRING:case We.MULTILINESTRING:this.type=2;break;case We.POLYGON:case We.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const n=[];for(const s of t)n.push(new Ne(s.x,s.y));e.push(n)}return e}}class ZO{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new JO(this.features[e],this.extent)}}class e5{constructor(e){this.layers={};const t=KO(new Uint8Array(e));this.layers=t.reduce((n,s)=>({...n,[s.name]:new ZO(s)}),{})}}const $c=65536*65536,Eg=1/$c,t5=12,xg=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),jc=0,ta=1,yo=2,ia=5;class i5{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){const s=this.readVarint(),o=s>>3,r=this.pos;this.type=s&7,e(o,t,this),this.pos===r&&this.skip(s)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*$c;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*$c;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let n,s;return s=t[this.pos++],n=s&127,s<128||(s=t[this.pos++],n|=(s&127)<<7,s<128)||(s=t[this.pos++],n|=(s&127)<<14,s<128)||(s=t[this.pos++],n|=(s&127)<<21,s<128)?n:(s=t[this.pos],n|=(s&15)<<28,n5(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=t5&&xg?xg.decode(this.buf.subarray(t,e)):g5(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===yo?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===jc)for(;this.buf[this.pos++]>127;);else if(t===yo)this.pos=this.readVarint()+this.pos;else if(t===ia)this.pos+=4;else if(t===ta)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Eg),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Eg),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){s5(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(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=y5(this.buf,e,this.pos);const n=this.pos-t;n>=128&&Ig(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const s=this.pos-n;s>=128&&Ig(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,n){this.writeTag(e,yo),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,a5,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,l5,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,h5,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,c5,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,d5,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,u5,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,f5,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,p5,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,m5,t)}writeBytesField(e,t){this.writeTag(e,yo),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,ia),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,ia),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,ta),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,ta),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,jc),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,jc),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,yo),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,ia),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,ta),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function n5(i,e,t){const n=t.buf;let s,o;if(o=n[t.pos++],s=(o&112)>>4,o<128||(o=n[t.pos++],s|=(o&127)<<3,o<128)||(o=n[t.pos++],s|=(o&127)<<10,o<128)||(o=n[t.pos++],s|=(o&127)<<17,o<128)||(o=n[t.pos++],s|=(o&127)<<24,o<128)||(o=n[t.pos++],s|=(o&1)<<31,o<128))return Zn(i,s,e);throw new Error("Expected varint not more than 10 bytes")}function Zn(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}function s5(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),o5(t,n,e),r5(n,e)}function o5(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}function r5(i,e){const t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}function Ig(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let s=t.pos-1;s>=i;s--)t.buf[s+n]=t.buf[s]}function a5(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}function l5(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function c5(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function d5(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function h5(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function u5(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function f5(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function p5(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function m5(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function g5(i,e,t){let n="",s=e;for(;s<t;){const o=i[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=i[s+1],c=i[s+2],h=i[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}function y5(i,e,t){for(let n=0,s,o;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){i[t++]=239,i[t++]=191,i[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):o=s;continue}else o&&(i[t++]=239,i[t++]=191,i[t++]=189,o=null);s<128?i[t++]=s:(s<2048?i[t++]=s>>6|192:(s<65536?i[t++]=s>>12|224:(i[t++]=s>>18|240,i[t++]=s>>12&63|128),i[t++]=s>>6&63|128),i[t++]=s&63|128)}return t}class Sg extends Ec{constructor(e,t){super(e,t),this.tilingScheme=new Cesium.WebMercatorTilingScheme}async init(){const e=this.styleSource;let t=e.url;if(t&&!e.tiles){t=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+e.url;try{const n=await Cesium.Resource.fetchJson(t);for(const s in n)e[s]||(e[s]=n[s])}catch(n){this.errorEvent.raiseEvent(n)}}}async requestTile(e,t,n){const s=this.styleSource;if(!s.tiles||!s.tiles.length)return;s.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(n)-t-1);let o=s.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",n);o=/^((http)|(https)|(data:)|\/)/.test(o)?o:this.path+o;try{const r=await fetch(o).then(l=>l.arrayBuffer());return s.encoding=="mlt"?new e5(r):new IR(new i5(r))}catch(r){this.errorEvent.raiseEvent(r)}}async requestTileBuffer(e,t,n,s){const o=this.styleSource;if(!o.tiles||!o.tiles.length)return;o.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(n)-t-1);let r=o.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",n);r=/^((http)|(https)|(data:)|\/)/.test(r)?r:this.path+r;try{const a=await fetch(r).then(c=>c.arrayBuffer()),l=o.encoding==="mlt"?"mlt":"mvt";return{buffer:a,encoding:l}}catch(a){this.errorEvent.raiseEvent(a)}}}Ic("vector",Sg);function Wc(i,e,t,n){let s=n;const o=e+(t-e>>1);let r=t-e,a;const l=i[e],c=i[e+1],h=i[t],u=i[t+1];for(let p=e+3;p<t;p+=3){const f=A5(i[p],i[p+1],l,c,h,u);if(f>s)a=p,s=f;else if(f===s){const m=Math.abs(p-o);m<r&&(a=p,r=m)}}s>n&&(a-e>3&&Wc(i,e,a,n),i[a+2]=s,t-a>3&&Wc(i,a,t,n))}function A5(i,e,t,n,s,o){let r=s-t,a=o-n;if(r!==0||a!==0){const l=((i-t)*r+(e-n)*a)/(r*r+a*a);l>1?(t=s,n=o):l>0&&(t+=r*l,n+=a*l)}return r=i-t,a=e-n,r*r+a*a}function Ao(i,e,t,n){const s={id:i??null,type:e,geometry:t,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")na(s,t);else if(e==="Polygon")na(s,t[0]);else if(e==="MultiLineString")for(const o of t)na(s,o);else if(e==="MultiPolygon")for(const o of t)na(s,o[0]);return s}function na(i,e){for(let t=0;t<e.length;t+=3)i.minX=Math.min(i.minX,e[t]),i.minY=Math.min(i.minY,e[t+1]),i.maxX=Math.max(i.maxX,e[t]),i.maxY=Math.max(i.maxY,e[t+1])}function v5(i,e){const t=[];if(i.type==="FeatureCollection")for(let n=0;n<i.features.length;n++)sa(t,i.features[n],e,n);else i.type==="Feature"?sa(t,i,e):sa(t,{geometry:i},e);return t}function sa(i,e,t,n){if(!e.geometry)return;const s=e.geometry.coordinates;if(s&&s.length===0)return;const o=e.geometry.type,r=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2);let a=[],l=e.id;if(t.promoteId?l=e.properties[t.promoteId]:t.generateId&&(l=n||0),o==="Point")Mg(s,a);else if(o==="MultiPoint")for(const c of s)Mg(c,a);else if(o==="LineString")qc(s,a,r,!1);else if(o==="MultiLineString"){if(t.lineMetrics){for(const c of s)a=[],qc(c,a,r,!1),i.push(Ao(l,"LineString",a,e.properties));return}Kc(s,a,r,!1)}else if(o==="Polygon")Kc(s,a,r,!0);else if(o==="MultiPolygon")for(const c of s){const h=[];Kc(c,h,r,!0),a.push(h)}else if(o==="GeometryCollection"){for(const c of e.geometry.geometries)sa(i,{id:l,geometry:c,properties:e.properties},t,n);return}else throw new Error("Input data is not a valid GeoJSON object.");i.push(Ao(l,o,a,e.properties))}function Mg(i,e){e.push(Tg(i[0]),Bg(i[1]),0)}function qc(i,e,t,n){let s,o,r=0;for(let l=0;l<i.length;l++){const c=Tg(i[l][0]),h=Bg(i[l][1]);e.push(c,h,0),l>0&&(n?r+=(s*h-c*o)/2:r+=Math.sqrt(Math.pow(c-s,2)+Math.pow(h-o,2))),s=c,o=h}const a=e.length-3;e[2]=1,Wc(e,0,a,t),e[a+2]=1,e.size=Math.abs(r),e.start=0,e.end=e.size}function Kc(i,e,t,n){for(let s=0;s<i.length;s++){const o=[];qc(i[s],o,t,n),e.push(o)}}function Tg(i){return i/360+.5}function Bg(i){const e=Math.sin(i*Math.PI/180),t=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return t<0?0:t>1?1:t}function gi(i,e,t,n,s,o,r,a){if(t/=e,n/=e,o>=t&&r<n)return i;if(r<t||o>=n)return null;const l=[];for(const c of i){const h=c.geometry;let u=c.type;const p=s===0?c.minX:c.minY,f=s===0?c.maxX:c.maxY;if(p>=t&&f<n){l.push(c);continue}else if(f<t||p>=n)continue;let m=[];if(u==="Point"||u==="MultiPoint")b5(h,m,t,n,s);else if(u==="LineString")_g(h,m,t,n,s,!1,a.lineMetrics);else if(u==="MultiLineString")Xc(h,m,t,n,s,!1);else if(u==="Polygon")Xc(h,m,t,n,s,!0);else if(u==="MultiPolygon")for(const y of h){const g=[];Xc(y,g,t,n,s,!0),g.length&&m.push(g)}if(m.length){if(a.lineMetrics&&u==="LineString"){for(const y of m)l.push(Ao(c.id,u,y,c.tags));continue}(u==="LineString"||u==="MultiLineString")&&(m.length===1?(u="LineString",m=m[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=m.length===3?"Point":"MultiPoint"),l.push(Ao(c.id,u,m,c.tags))}}return l.length?l:null}function b5(i,e,t,n,s){for(let o=0;o<i.length;o+=3){const r=i[o+s];r>=t&&r<=n&&es(e,i[o],i[o+1],i[o+2])}}function _g(i,e,t,n,s,o,r){let a=kg(i);const l=s===0?w5:C5;let c=i.start,h,u;for(let A=0;A<i.length-3;A+=3){const v=i[A],b=i[A+1],C=i[A+2],x=i[A+3],I=i[A+4],E=s===0?v:b,S=s===0?x:I;let w=!1;r&&(h=Math.sqrt(Math.pow(v-x,2)+Math.pow(b-I,2))),E<t?S>=t&&(u=l(a,v,b,x,I,t),r&&(a.start=c+h*u)):E>n?S<=n&&(u=l(a,v,b,x,I,n),r&&(a.start=c+h*u)):es(a,v,b,C),S<t&&E>=t&&(u=l(a,v,b,x,I,t),w=!0),S>n&&E<=n&&(u=l(a,v,b,x,I,n),w=!0),!o&&w&&(r&&(a.end=c+h*u),e.push(a),a=kg(i)),r&&(c+=h)}let p=i.length-3;const f=i[p],m=i[p+1],y=i[p+2],g=s===0?f:m;g>=t&&g<=n&&es(a,f,m,y),p=a.length-3,o&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&es(a,a[0],a[1],a[2]),a.length&&e.push(a)}function kg(i){const e=[];return e.size=i.size,e.start=i.start,e.end=i.end,e}function Xc(i,e,t,n,s,o){for(const r of i)_g(r,e,t,n,s,o,!1)}function es(i,e,t,n){i.push(e,t,n)}function w5(i,e,t,n,s,o){const r=(o-e)/(n-e);return es(i,o,t+(s-t)*r,1),r}function C5(i,e,t,n,s,o){const r=(o-t)/(s-t);return es(i,e+(n-e)*r,o,1),r}function E5(i,e){const t=e.buffer/e.extent;let n=i;const s=gi(i,1,-1-t,t,0,-1,2,e),o=gi(i,1,1-t,2+t,0,-1,2,e);return(s||o)&&(n=gi(i,1,-t,1+t,0,-1,2,e)||[],s&&(n=Pg(s,1).concat(n)),o&&(n=n.concat(Pg(o,-1)))),n}function Pg(i,e){const t=[];for(let n=0;n<i.length;n++){const s=i[n],o=s.type;let r;if(o==="Point"||o==="MultiPoint"||o==="LineString")r=Jc(s.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){r=[];for(const a of s.geometry)r.push(Jc(a,e))}else if(o==="MultiPolygon"){r=[];for(const a of s.geometry){const l=[];for(const c of a)l.push(Jc(c,e));r.push(l)}}t.push(Ao(s.id,o,r,s.tags))}return t}function Jc(i,e){const t=[];t.size=i.size,i.start!==void 0&&(t.start=i.start,t.end=i.end);for(let n=0;n<i.length;n+=3)t.push(i[n]+e,i[n+1],i[n+2]);return t}function Dg(i,e){if(i.transformed)return i;const t=1<<i.z,n=i.x,s=i.y;for(const o of i.features){const r=o.geometry,a=o.type;if(o.geometry=[],a===1)for(let l=0;l<r.length;l+=2)o.geometry.push(Ng(r[l],r[l+1],e,t,n,s));else for(let l=0;l<r.length;l++){const c=[];for(let h=0;h<r[l].length;h+=2)c.push(Ng(r[l][h],r[l][h+1],e,t,n,s));o.geometry.push(c)}}return i.transformed=!0,i}function Ng(i,e,t,n,s,o){return[Math.round(t*(i*n-s)),Math.round(t*(e*n-o))]}function x5(i,e,t,n,s){const o=e===s.maxZoom?0:s.tolerance/((1<<e)*s.extent),r={features:[],numPoints:0,numSimplified:0,numFeatures:i.length,source:null,x:t,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of i)I5(r,a,o,s);return r}function I5(i,e,t,n){const s=e.geometry,o=e.type,r=[];if(i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let a=0;a<s.length;a+=3)r.push(s[a],s[a+1]),i.numPoints++,i.numSimplified++;else if(o==="LineString")Zc(r,s,i,t,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let a=0;a<s.length;a++)Zc(r,s[a],i,t,o==="Polygon",a===0);else if(o==="MultiPolygon")for(let a=0;a<s.length;a++){const l=s[a];for(let c=0;c<l.length;c++)Zc(r,l[c],i,t,!0,c===0)}if(r.length){let a=e.tags||null;if(o==="LineString"&&n.lineMetrics){a={};for(const c in e.tags)a[c]=e.tags[c];a.mapbox_clip_start=s.start/s.size,a.mapbox_clip_end=s.end/s.size}const l={geometry:r,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:a};e.id!==null&&(l.id=e.id),i.features.push(l)}}function Zc(i,e,t,n,s,o){const r=n*n;if(n>0&&e.size<(s?r:n)){t.numPoints+=e.length/3;return}const a=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>r)&&(t.numSimplified++,a.push(e[l],e[l+1])),t.numPoints++;s&&S5(a,o),i.push(a)}function S5(i,e){let t=0;for(let n=0,s=i.length,o=s-2;n<s;o=n,n+=2)t+=(i[n]-i[o])*(i[n+1]+i[o+1]);if(t>0===e)for(let n=0,s=i.length;n<s/2;n+=2){const o=i[n],r=i[n+1];i[n]=i[s-2-n],i[n+1]=i[s-1-n],i[s-2-n]=o,i[s-1-n]=r}}const M5={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class T5{constructor(e,t){t=this.options=B5(Object.create(M5),t);const n=t.debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)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.");let s=v5(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),t.indexMaxZoom,t.indexMaxPoints,console.time("generate tiles"),this.stats={},this.total=0),s=E5(s,t),s.length&&this.splitTile(s,0,0,0),n&&(s.length&&(this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),this.total,JSON.stringify(this.stats))}splitTile(e,t,n,s,o,r,a){const l=[e,t,n,s],c=this.options,h=c.debug;for(;l.length;){s=l.pop(),n=l.pop(),t=l.pop(),e=l.pop();const u=1<<t,p=ed(t,n,s);let f=this.tiles[p];if(!f&&(h>1&&console.time("creation"),f=this.tiles[p]=x5(e,t,n,s,c),this.tileCoords.push({z:t,x:n,y:s}),h)){h>1&&(f.numFeatures,f.numPoints,f.numSimplified,console.timeEnd("creation"));const S=`z${t}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(f.source=e,o==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===o)continue;if(o!=null){const S=o-t;if(n!==r>>S||s!==a>>S)continue}}if(f.source=null,e.length===0)continue;h>1&&console.time("clipping");const m=.5*c.buffer/c.extent,y=.5-m,g=.5+m,A=1+m;let v=null,b=null,C=null,x=null;const I=gi(e,u,n-m,n+g,0,f.minX,f.maxX,c),E=gi(e,u,n+y,n+A,0,f.minX,f.maxX,c);I&&(v=gi(I,u,s-m,s+g,1,f.minY,f.maxY,c),b=gi(I,u,s+y,s+A,1,f.minY,f.maxY,c)),E&&(C=gi(E,u,s-m,s+g,1,f.minY,f.maxY,c),x=gi(E,u,s+y,s+A,1,f.minY,f.maxY,c)),h>1&&console.timeEnd("clipping"),l.push(v||[],t+1,n*2,s*2),l.push(b||[],t+1,n*2,s*2+1),l.push(C||[],t+1,n*2+1,s*2),l.push(x||[],t+1,n*2+1,s*2+1)}}getTile(e,t,n){e=+e,t=+t,n=+n;const s=this.options,{extent:o,debug:r}=s;if(e<0||e>24)return null;const a=1<<e;t=t+a&a-1;const l=ed(e,t,n);if(this.tiles[l])return Dg(this.tiles[l],o);r>1;let c=e,h=t,u=n,p;for(;!p&&c>0;)c--,h=h>>1,u=u>>1,p=this.tiles[ed(c,h,u)];return!p||!p.source?null:(r>1&&console.time("drilling down"),this.splitTile(p.source,c,h,u,e,t,n),r>1&&console.timeEnd("drilling down"),this.tiles[l]?Dg(this.tiles[l],o):null)}}function ed(i,e,t){return((1<<i)*t+e)*32+i}function B5(i,e){for(const t in e)i[t]=e[t];return i}function _5(i,e){return new T5(i,e)}typeof TextDecoder>"u"||new TextDecoder("utf-8");var k5=class{constructor(i,e){this.feature=i,this.type=i.type,this.properties=i.tags?i.tags:{},this.extent=e,"id"in i&&(typeof i.id=="string"?this.id=parseInt(i.id,10):typeof i.id=="number"&&!isNaN(i.id)&&(this.id=i.id))}loadGeometry(){const i=[],e=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const t of e){const n=[];for(const s of t)n.push(new Ne(s[0],s[1]));i.push(n)}return i}};const Lg="_geojsonTileLayer";var P5=class{constructor(i,e){this.layers={[Lg]:this},this.name=Lg,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=i.length,this.features=i}feature(i){return new k5(this.features[i],this.extent)}};const Tt=8192;class Rg extends Ec{constructor(e,t){super(e,t)}async init(){const e=this.styleSource;let t=e.data;if(typeof t=="string"){const n=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+t;try{t=await Cesium.Resource.fetchJson(n)}catch(s){this.errorEvent.raiseEvent(s)}}t&&t.features?.length&&(this.tileIndex=new _5(t,{extent:Tt,buffer:e.buffer===void 0?128:e.buffer,tolerance:e.tolerance===e.tolerance?.375:e.tolerance}))}async requestTile(e,t,n){if(this.tileIndex)try{const s=this.tileIndex.getTile(n,e,t);return s?new P5(s.features,{extent:Tt}):void 0}catch(s){this.errorEvent.raiseEvent(s)}}}Ic("geojson",Rg);var D5=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],N5=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],L5={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:D5,layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:N5,paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},Fg=L5;function Og(i,...e){for(const t of e)for(const n in t)i[n]=t[n];return i}var ni=class extends Error{constructor(i,e){super(e),this.message=e,this.key=i}},R5=class Iy{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new Iy(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}};const oa={kind:"null"},q={kind:"number"},ce={kind:"string"},fe={kind:"boolean"},si={kind:"color"},ra={kind:"projectionDefinition"},hn={kind:"object"},he={kind:"value"},F5={kind:"error"},aa={kind:"collator"},la={kind:"formatted"},ca={kind:"padding"},vo={kind:"colorArray"},da={kind:"numberArray"},bo={kind:"resolvedImage"},ha={kind:"variableAnchorOffsetCollection"};function yt(i,e){return{kind:"array",itemType:i,N:e}}function ke(i){if(i.kind==="array"){const e=ke(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}else return i.kind}const O5=[oa,q,ce,fe,si,ra,la,hn,yt(he),ca,da,vo,bo,ha];function wo(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!wo(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of O5)if(!wo(t,e))return null}}return`Expected ${ke(i)} but found ${ke(e)} instead.`}function td(i,e){return e.some(t=>t.kind===i.kind)}function un(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function Ui(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const Gg=.96422,Ug=1,Vg=.82521,Qg=4/29,ts=6/29,zg=3*ts*ts,G5=ts*ts*ts,U5=Math.PI/180,V5=180/Math.PI;function Hg(i){return i=i%360,i<0&&(i+=360),i}function Yg([i,e,t,n]){i=id(i),e=id(e),t=id(t);let s,o;const r=nd((.2225045*i+.7168786*e+.0606169*t)/Ug);i===e&&e===t?s=o=r:(s=nd((.4360747*i+.3850649*e+.1430804*t)/Gg),o=nd((.0139322*i+.0971045*e+.7141733*t)/Vg));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),n]}function id(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function nd(i){return i>G5?Math.pow(i,1/3):i/zg+Qg}function $g([i,e,t,n]){let s=(i+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=Ug*od(s),o=Gg*od(o),r=Vg*od(r),[sd(3.1338561*o-1.6168667*s-.4906146*r),sd(-.9787684*o+1.9161415*s+.033454*r),sd(.0719453*o-.2289914*s+1.4052427*r),n]}function sd(i){return i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055,i<0?0:i>1?1:i}function od(i){return i>ts?i*i*i:zg*(i-Qg)}function Q5(i){const[e,t,n,s]=Yg(i),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?Hg(Math.atan2(n,t)*V5):NaN,o,e,s]}function z5([i,e,t,n]){return i=isNaN(i)?0:i*U5,$g([t,Math.cos(i)*e,Math.sin(i)*e,n])}function H5([i,e,t,n]){i=Hg(i),e/=100,t/=100;function s(o){const r=(o+i/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(r-3,9-r,1))}return[s(0),s(8),s(4),n]}const Y5=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function jg(i,e){return Y5(i,e)?i[e]:void 0}function $5(i){if(i=i.toLowerCase().trim(),i==="transparent")return[0,0,0,0];const e=jg(j5,i);if(e){const[n,s,o]=e;return[n/255,s/255,o/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){const n=i.length<6?1:2;let s=1;return[ua(i.slice(s,s+=n)),ua(i.slice(s,s+=n)),ua(i.slice(s,s+=n)),ua(i.slice(s,s+n)||"ff")]}if(i.startsWith("rgb")){const n=i.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[s,o,r,a,l,c,h,u,p,f,m,y]=n,g=[a||" ",h||" ",f].join("");if(g===" "||g===" /"||g===",,"||g===",,,"){const A=[r,c,p].join(""),v=A==="%%%"?100:A===""?255:0;if(v){const b=[is(+o/v,0,1),is(+l/v,0,1),is(+u/v,0,1),m?Wg(+m,y):1];if(qg(b))return b}}return}}const t=i.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[n,s,o,r,a,l,c,h,u]=t,p=[o||" ",a||" ",c].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){const f=[+s,is(+r,0,100),is(+l,0,100),h?Wg(+h,u):1];if(qg(f))return H5(f)}}}function ua(i){return parseInt(i.padEnd(2,i),16)/255}function Wg(i,e){return is(e?i/100:i,0,1)}function is(i,e,t){return Math.min(Math.max(e,i),t)}function qg(i){return!i.some(Number.isNaN)}const j5={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Vi(i,e,t){return i+t*(e-i)}function ns(i,e,t){return i.map((n,s)=>Vi(n,e[s],t))}function W5(i){return i==="rgb"||i==="hcl"||i==="lab"}var qe=(tt=class{constructor(e,t,n,s=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,n,s]))}static parse(e){if(e instanceof tt)return e;if(typeof e!="string")return;const t=$5(e);if(t)return new tt(...t,!1)}get rgb(){const{r:e,g:t,b:n,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,s])}get hcl(){return this.overwriteGetter("hcl",Q5(this.rgb))}get lab(){return this.overwriteGetter("lab",Yg(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,s]=this.rgb;return`rgba(${[e,t,n].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,n,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=ns(e.rgb,t.rgb,n);return new tt(o,r,a,l,!1)}case"hcl":{const[o,r,a,l]=e.hcl,[c,h,u,p]=t.hcl;let f,m;if(!isNaN(o)&&!isNaN(c)){let b=c-o;c>o&&b>180?b-=360:c<o&&o-c>180&&(b+=360),f=o+n*b}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(a===1||a===0)&&(m=h)):(f=o,(u===1||u===0)&&(m=r));const[y,g,A,v]=z5([f,m??Vi(r,h,n),Vi(a,u,n),Vi(l,p,n)]);return new tt(y,g,A,v,!1)}case"lab":{const[o,r,a,l]=$g(ns(e.lab,t.lab,n));return new tt(o,r,a,l,!1)}}}},tt.black=new tt(0,0,0,1),tt.white=new tt(1,1,1,1),tt.transparent=new tt(0,0,0,0),tt.red=new tt(1,0,0,1),tt),rd=class{constructor(i,e,t){i?this.sensitivity=e?"variant":"case":this.sensitivity=e?"accent":"base",this.locale=t,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,e){return this.collator.compare(i,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};const q5=["bottom","center","top"];var ad=class{constructor(i,e,t,n,s,o){this.text=i,this.image=e,this.scale=t,this.fontStack=n,this.textColor=s,this.verticalAlign=o}},ss=class Fa{constructor(e){this.sections=e}static fromString(e){return new Fa([new ad(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Fa?e:Fa.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},oi=class Go{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Go)return e;if(typeof e=="number")return new Go([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new Go(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Go(ns(e.values,t.values,n))}},ri=class Uo{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Uo)return e;if(typeof e=="number")return new Uo([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new Uo(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Uo(ns(e.values,t.values,n))}},Lt=class Vo{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vo)return e;if(typeof e=="string"){const n=qe.parse(e);return n?new Vo([n]):void 0}if(!Array.isArray(e))return;const t=[];for(const n of e){if(typeof n!="string")return;const s=qe.parse(n);if(!s)return;t.push(s)}return new Vo(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,s="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let r=0;r<e.values.length;r++)o.push(qe.interpolate(e.values[r],t.values[r],n,s));return new Vo(o)}},Le=class extends Error{constructor(i){super(i),this.name="RuntimeError"}toJSON(){return this.message}};const K5=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Qi=class Oa{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oa)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const n=e[t],s=e[t+1];if(typeof n!="string"||!K5.has(n)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Oa(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){const s=e.values,o=t.values;if(s.length!==o.length)throw new Le(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const r=[];for(let a=0;a<s.length;a+=2){if(s[a]!==o[a])throw new Le(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${o[a]}`);r.push(s[a]);const[l,c]=s[a+1],[h,u]=o[a+1];r.push([Vi(l,h,n),Vi(c,u,n)])}return new Oa(r)}},zi=class Sy{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Sy({name:e,available:!1}):null}},os=class ys{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new ys(e,t,n)}static parse(e){if(e instanceof ys)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ys(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ys(e.from,e.to,e.transition);if(typeof e=="string")return new ys(e,e,1)}};function Kg(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Co(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof os||i instanceof qe||i instanceof rd||i instanceof ss||i instanceof oi||i instanceof ri||i instanceof Lt||i instanceof Qi||i instanceof zi)return!0;if(Array.isArray(i)){for(const e of i)if(!Co(e))return!1;return!0}else if(typeof i=="object"){for(const e in i)if(!Co(i[e]))return!1;return!0}else return!1}function Ke(i){if(i===null)return oa;if(typeof i=="string")return ce;if(typeof i=="boolean")return fe;if(typeof i=="number")return q;if(i instanceof qe)return si;if(i instanceof os)return ra;if(i instanceof rd)return aa;if(i instanceof ss)return la;if(i instanceof oi)return ca;if(i instanceof ri)return da;if(i instanceof Lt)return vo;if(i instanceof Qi)return ha;if(i instanceof zi)return bo;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const s=Ke(n);if(!t)t=s;else{if(t===s)continue;t=he;break}}return yt(t||he,e)}else return hn}function Eo(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof qe||i instanceof os||i instanceof ss||i instanceof oi||i instanceof ri||i instanceof Lt||i instanceof Qi||i instanceof zi?i.toString():JSON.stringify(i)}var fa=class My{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Co(e[1]))return t.error("invalid value");const n=e[1];let s=Ke(n);const o=t.expectedType;return s.kind==="array"&&s.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(s=o),new My(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const pa={string:ce,number:q,boolean:fe,object:hn};var yi=class Ty{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=1,s;const o=e[0];if(o==="array"){let a;if(e.length>2){const c=e[1];if(typeof c!="string"||!(c in pa)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=pa[c],n++}else a=he;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}s=yt(a,l)}else{if(!pa[o])throw new Error(`Types doesn't contain name = ${o}`);s=pa[o]}const r=[];for(;n<e.length;n++){const a=t.parse(e[n],n,he);if(!a)return null;r.push(a)}return new Ty(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(wo(this.type,Ke(n))){if(t===this.args.length-1)throw new Le(`Expected value to be of type ${ke(this.type)}, but found ${ke(Ke(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const Xg={"to-boolean":fe,"to-color":si,"to-number":q,"to-string":ce};var rs=class By{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(!Xg[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=Xg[n],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,he);if(!a)return null;o.push(a)}return new By(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof qe)return t;if(typeof t=="string"){const o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=Kg(t[0],t[1],t[2],t[3]),!n))return new qe(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Le(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const s=oi.parse(t);if(s)return s}throw new Le(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=ri.parse(t);if(s)return s}throw new Le(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=Lt.parse(t);if(s)return s}throw new Le(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const s=Qi.parse(t);if(s)return s}throw new Le(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new Le(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ss.fromString(Eo(this.args[0].evaluate(e)));case"resolvedImage":return zi.fromString(Eo(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Eo(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const X5=["Unknown","Point","LineString","Polygon"];var Jg=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?X5[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(i){let e=this._parseColorCache.get(i);return e||(e=qe.parse(i),this._parseColorCache.set(i,e)),e}},Zg=class _y{constructor(e,t,n=[],s,o=new R5,r=[]){this.registry=e,this.path=n,this.key=n.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,n,s,o={}){return t?this.concat(t,n,s)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(s,o,r){return r==="assert"?new yi(o,[s]):r==="coerce"?new rs(o,[s]):s}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[s];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const a=this.expectedType,l=r.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")r=n(r,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))r=n(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof fa)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new Jg;try{r=new fa(r.type,r.evaluate(a))}catch(l){return this.error(l.message),null}}return r}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const s=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new _y(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new ni(n,e))}checkSubtype(e,t){const n=wo(e,t);return n&&this.error(n),n}},e0=class ky{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let o=1;o<e.length-1;o+=2){const r=e[o];if(typeof r!="string")return t.error(`Expected string, but found ${typeof r} instead.`,o);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);const a=t.parse(e[o+1],o+1);if(!a)return null;n.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return s?new ky(n,s):null}outputDefined(){return this.result.outputDefined()}},t0=class Py{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new Py(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},J5=class Dy{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,q),s=t.parse(e[2],2,yt(t.expectedType||he));if(!n||!s)return null;const o=s.type;return new Dy(o.itemType,n,s)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Le(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Le(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Le(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Z5=class Ny{constructor(e,t){this.type=fe,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,he),s=t.parse(e[2],2,he);return!n||!s?null:td(n.type,[fe,ce,q,oa,he])?new Ny(n,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ke(n.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!un(t,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${ke(Ke(t))} instead.`);if(!un(n,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${ke(Ke(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},e6=class Wd{constructor(e,t,n){this.type=q,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,he),s=t.parse(e[2],2,he);if(!n||!s)return null;if(!td(n.type,[fe,ce,q,oa,he]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ke(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,q);return o?new Wd(n,s,o):null}else return new Wd(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!un(t,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${ke(Ke(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),un(n,["string"])){const o=n.indexOf(t,s);return o===-1?-1:[...n.slice(0,o)].length}else{if(un(n,["array"]))return n.indexOf(t,s);throw new Le(`Expected second argument to be of type array or string, but found ${ke(Ke(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},t6=class Ly{constructor(e,t,n,s,o,r){this.inputType=e,this.type=t,this.input=n,this.cases=s,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let n,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const o={},r=[];for(let c=2;c<e.length-1;c+=2){let h=e[c];const u=e[c+1];Array.isArray(h)||(h=[h]);const p=t.concat(c);if(h.length===0)return p.error("Expected at least one branch label.");for(const m of h){if(typeof m!="number"&&typeof m!="string")return p.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return p.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return p.error("Numeric branch labels must be integer values.");if(!n)n=Ke(m);else if(p.checkSubtype(n,Ke(m)))return null;if(typeof o[String(m)]<"u")return p.error("Branch labels must be unique.");o[String(m)]=r.length}const f=t.parse(u,c,s);if(!f)return null;s=s||f.type,r.push(f)}const a=t.parse(e[1],1,he);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,s);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(n,a.type)?null:new Ly(n,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(Ke(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},i6=class Ry{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,fe);if(!a)return null;const l=t.parse(e[r+1],r+1,n);if(!l)return null;s.push([a,l]),n=n||l.type}const o=t.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new Ry(n,s,o)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},n6=class qd{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,he),s=t.parse(e[2],2,q);if(!n||!s)return null;if(!td(n.type,[yt(he),ce,he]))return t.error(`Expected first argument to be of type array or string, but found ${ke(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,q);return o?new qd(n.type,n,s,o):null}else return new qd(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),un(t,["string"]))return[...t].slice(n,s).join("");if(un(t,["array"]))return t.slice(n,s);throw new Le(`Expected first argument to be of type array or string, but found ${ke(Ke(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function ma(i,e){const t=i.length-1;let n=0,s=t,o=0,r,a;for(;n<=s;)if(o=Math.floor((n+s)/2),r=i[o],a=i[o+1],r<=e){if(o===t||e<a)return o;n=o+1}else if(r>e)s=o-1;else throw new Le("Input is not a number.");return 0}var i0=class Fy{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of n)this.labels.push(s),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,q);if(!n)return null;const s=[];let o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=r===1?-1/0:e[r],l=e[r+1],c=r,h=r+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=t.parse(l,h,o);if(!u)return null;o=o||u.type,s.push([a,u])}return new Fy(o,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;return s>=t[o-1]?n[o-1].evaluate(e):n[ma(t,s)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function s6(i,e,t,n){const s=3*i,o=3*(t-i)-s,r=1-s-o,a=3*e,l=3*(n-e)-a,c=1-a-l;return function(u,p=1e-6){if(u<=0)return 0;if(u>=1)return 1;let f=u;for(let g=0;g<8;g++){const A=((r*f+o)*f+s)*f-u;if(Math.abs(A)<p)return((c*f+l)*f+a)*f;const v=(3*r*f+2*o)*f+s;if(Math.abs(v)<1e-6)break;f-=A/v}let m=0,y=1;f=u;for(let g=0;g<20;g++){const A=((r*f+o)*f+s)*f;if(Math.abs(A-u)<p)break;u>A?m=f:y=f,f=(m+y)*.5}return((c*f+l)*f+a)*f}}var Ai=class Kd{constructor(e,t,n,s,o){this.type=e,this.operator=t,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[r,a]of o)this.labels.push(r),this.outputs.push(a)}static interpolationFactor(e,t,n,s){let o=0;if(e.name==="exponential")o=ld(t,e.base,n,s);else if(e.name==="linear")o=ld(t,1,n,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=s6(r[0],r[1],r[2],r[3])(ld(t,1,n,s))}return o}static parse(e,t){let[n,s,o,...r]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,q),!o)return null;const a=[];let l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=vo?l=si:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=0;c<r.length;c+=2){const h=r[c],u=r[c+1],p=c+3,f=c+4;if(typeof h!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(a.length&&a[a.length-1][0]>=h)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);const m=t.parse(u,f,l);if(!m)return null;l=l||m.type,a.push([h,m])}return!Ui(l,q)&&!Ui(l,ra)&&!Ui(l,si)&&!Ui(l,ca)&&!Ui(l,da)&&!Ui(l,vo)&&!Ui(l,ha)&&!Ui(l,yt(q))?t.error(`Type ${ke(l)} is not interpolatable.`):new Kd(l,n,s,o,a)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=ma(t,s),a=t[r],l=t[r+1],c=Kd.interpolationFactor(this.interpolation,s,a,l),h=n[r].evaluate(e),u=n[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Vi(h,u,c);case"color":return qe.interpolate(h,u,c);case"padding":return oi.interpolate(h,u,c);case"colorArray":return Lt.interpolate(h,u,c);case"numberArray":return ri.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Qi.interpolate(h,u,c);case"array":return ns(h,u,c);case"projectionDefinition":return os.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return qe.interpolate(h,u,c,"hcl");case"colorArray":return Lt.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return qe.interpolate(h,u,c,"lab");case"colorArray":return Lt.interpolate(h,u,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function ld(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}const o6={color:qe.interpolate,number:Vi,padding:oi.interpolate,numberArray:ri.interpolate,colorArray:Lt.interpolate,variableAnchorOffsetCollection:Qi.interpolate,array:ns};var n0=class Xd{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const o=[];for(const r of e.slice(1)){const a=t.parse(r,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!a)return null;n=n||a.type,o.push(a)}if(!n)throw new Error("No output type");return s&&o.some(r=>wo(s,r.type))?new Xd(he,o):new Xd(n,o)}evaluate(e){let t=null,n=0,s;for(const o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof zi&&!t.available&&(s||(s=t.name),t=null,n===this.args.length&&(t=s)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function s0(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function r6(i,e,t){return e===t}function a6(i,e,t){return e!==t}function l6(i,e,t){return e<t}function c6(i,e,t){return e>t}function d6(i,e,t){return e<=t}function h6(i,e,t){return e>=t}function o0(i,e,t,n){return n.compare(e,t)===0}function u6(i,e,t,n){return!o0(i,e,t,n)}function f6(i,e,t,n){return n.compare(e,t)<0}function p6(i,e,t,n){return n.compare(e,t)>0}function m6(i,e,t,n){return n.compare(e,t)<=0}function g6(i,e,t,n){return n.compare(e,t)>=0}function as(i,e,t){const n=i!=="=="&&i!=="!=";return class Oy{constructor(o,r,a){this.type=fe,this.lhs=o,this.rhs=r,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||r.type.kind==="value"}static parse(o,r){if(o.length!==3&&o.length!==4)return r.error("Expected two or three arguments.");const a=o[0];let l=r.parse(o[1],1,he);if(!l)return null;if(!s0(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${ke(l.type)}'.`);let c=r.parse(o[2],2,he);if(!c)return null;if(!s0(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${ke(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${ke(l.type)}' and '${ke(c.type)}'.`);n&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new yi(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new yi(l.type,[c])));let h=null;if(o.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error("Cannot use collator to compare non-string types.");if(h=r.parse(o[3],3,aa),!h)return null}return new Oy(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const l=Ke(r),c=Ke(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new Le(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const l=Ke(r),c=Ke(a);if(l.kind!=="string"||c.kind!=="string")return e(o,r,a)}return this.collator?t(o,r,a,this.collator.evaluate(o)):e(o,r,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}const y6=as("==",r6,o0),A6=as("!=",a6,u6),v6=as("<",l6,f6),b6=as(">",c6,p6),w6=as("<=",d6,m6),C6=as(">=",h6,g6);var r0=class Gy{constructor(e,t,n){this.type=aa,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");const s=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,fe);if(!s)return null;const o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,fe);if(!o)return null;let r=null;return n.locale&&(r=t.parse(n.locale,1,ce),!r)?null:new Gy(s,o,r)}evaluate(e){return new rd(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},E6=class Uy{constructor(e,t,n,s,o,r){this.type=ce,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,q);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let o=null;if(s.locale&&(o=t.parse(s.locale,1,ce),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,ce),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,ce),!a))return null;if(r&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=t.parse(s["min-fraction-digits"],1,q),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,q),!c)?null:new Uy(n,o,r,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},x6=class Vy{constructor(e){this.type=la,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");const s=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&typeof a=="object"&&!Array.isArray(a)){o=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,q),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,yt(ce)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,si),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!q5.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=t.parse(a["vertical-align"],1,ce),!u)return null}const p=s[s.length-1];p.scale=l,p.font=c,p.textColor=h,p.verticalAlign=u}else{const l=t.parse(e[r],1,he);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Vy(s)}evaluate(e){const t=n=>{const s=n.content.evaluate(e);return Ke(s)===bo?new ad("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new ad(Eo(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new ss(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}},I6=class Qy{constructor(e){this.type=bo,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ce);return n?new Qy(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=zi.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},S6=class zy{constructor(e){this.type=q,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${ke(n.type)} instead.`):new zy(n):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Le(`Expected value to be of type string or array, but found ${ke(Ke(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}};const ai=8192;function M6(i,e){const t=T6(i[0]),n=_6(i[1]),s=Math.pow(2,e.z);return[Math.round(t*s*ai),Math.round(n*s*ai)]}function cd(i,e){const t=Math.pow(2,e.z),n=(i[0]/ai+e.x)/t,s=(i[1]/ai+e.y)/t;return[B6(n),k6(s)]}function T6(i){return(180+i)/360}function B6(i){return i*360-180}function _6(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function k6(i){return 360/Math.PI*Math.atan(Math.exp((180-i*360)*Math.PI/180))-90}function xo(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Io(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function P6(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function D6(i,e,t){const n=i[0]-e[0],s=i[1]-e[1],o=i[0]-t[0],r=i[1]-t[1];return n*r-o*s===0&&n*o<=0&&s*r<=0}function ga(i,e,t,n){const s=[e[0]-i[0],e[1]-i[1]];return F6([n[0]-t[0],n[1]-t[1]],s)===0?!1:!!(l0(i,e,t,n)&&l0(t,n,i,e))}function N6(i,e,t){for(const n of t)for(let s=0;s<n.length-1;++s)if(ga(i,e,n[s],n[s+1]))return!0;return!1}function ls(i,e,t=!1){let n=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if(D6(i,s[o],s[o+1]))return t;P6(i,s[o],s[o+1])&&(n=!n)}return n}function L6(i,e){for(const t of e)if(ls(i,t))return!0;return!1}function a0(i,e){for(const t of i)if(!ls(t,e))return!1;for(let t=0;t<i.length-1;++t)if(N6(i[t],i[t+1],e))return!1;return!0}function R6(i,e){for(const t of e)if(a0(i,t))return!0;return!1}function F6(i,e){return i[0]*e[1]-i[1]*e[0]}function l0(i,e,t,n){const s=i[0]-t[0],o=i[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=n[0]-t[0],c=n[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function dd(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=[];for(let r=0;r<i[s].length;r++){const a=M6(i[s][r],t);xo(e,a),o.push(a)}n.push(o)}return n}function c0(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=dd(i[s],e,t);n.push(o)}return n}function d0(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const s=n*.5;let o=i[0]-t[0]>s?-n:t[0]-i[0]>s?n:0;o===0&&(o=i[0]-t[2]>s?-n:t[2]-i[0]>s?n:0),i[0]+=o}xo(e,i)}function O6(i){i[0]=i[1]=1/0,i[2]=i[3]=-1/0}function h0(i,e,t,n){const s=Math.pow(2,n.z)*ai,o=[n.x*ai,n.y*ai],r=[];for(const a of i)for(const l of a){const c=[l.x+o[0],l.y+o[1]];d0(c,e,t,s),r.push(c)}return r}function u0(i,e,t,n){const s=Math.pow(2,n.z)*ai,o=[n.x*ai,n.y*ai],r=[];for(const a of i){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];xo(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){O6(e);for(const a of r)for(const l of a)d0(l,e,t,s)}return r}function G6(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=dd(e.coordinates,n,s),r=h0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!ls(a,o))return!1}if(e.type==="MultiPolygon"){const o=c0(e.coordinates,n,s),r=h0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!L6(a,o))return!1}return!0}function U6(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=dd(e.coordinates,n,s),r=u0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!a0(a,o))return!1}if(e.type==="MultiPolygon"){const o=c0(e.coordinates,n,s),r=u0(i.geometry(),t,n,s);if(!Io(t,n))return!1;for(const a of r)if(!R6(a,o))return!1}return!0}var hd=class Ga{constructor(e,t){this.type=fe,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Co(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const s=[];for(const o of n.features){const{type:r,coordinates:a}=o.geometry;r==="Polygon"&&s.push(a),r==="MultiPolygon"&&s.push(...a)}if(s.length)return new Ga(n,{type:"MultiPolygon",coordinates:s})}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Ga(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Ga(n,n)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return G6(e,this.geometries);if(e.geometryType()==="LineString")return U6(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},f0=class{constructor(i=[],e=(t,n)=>t<n?-1:t>n?1:0){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:t}=this,n=e[i];for(;i>0;){const s=i-1>>1,o=e[s];if(t(n,o)>=0)break;e[i]=o,i=s}e[i]=n}_down(i){const{data:e,compare:t}=this,n=this.length>>1,s=e[i];for(;i<n;){let o=(i<<1)+1;const r=o+1;if(r<this.length&&t(e[r],e[o])<0&&(o=r),t(e[o],s)>=0)break;e[i]=e[o],i=o}e[i]=s}};function V6(i,e){if(i.length<=1)return[i];const t=[];let n,s;for(const o of i){const r=Q6(o);r!==0&&(o.area=Math.abs(r),s===void 0&&(s=r<0),s===r<0?(n&&t.push(n),n=[o]):n.push(o))}return n&&t.push(n),t}function Q6(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}const z6=6378.137,p0=1/298.257223563,m0=p0*(2-p0),g0=Math.PI/180;var ud=class{constructor(i){const e=g0*z6*1e3,t=Math.cos(i*g0),n=1/(1-m0*(1-t*t)),s=Math.sqrt(n);this.kx=e*s*t,this.ky=e*s*n*(1-m0)}distance(i,e){const t=this.wrap(i[0]-e[0])*this.kx,n=(i[1]-e[1])*this.ky;return Math.sqrt(t*t+n*n)}pointOnLine(i,e){let t=1/0,n,s,o,r;for(let a=0;a<i.length-1;a++){let l=i[a][0],c=i[a][1],h=this.wrap(i[a+1][0]-l)*this.kx,u=(i[a+1][1]-c)*this.ky,p=0;(h!==0||u!==0)&&(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-c)*this.ky*u)/(h*h+u*u),p>1?(l=i[a+1][0],c=i[a+1][1]):p>0&&(l+=h/this.kx*p,c+=u/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,u=(e[1]-c)*this.ky;const f=h*h+u*u;f<t&&(t=f,n=l,s=c,o=a,r=p)}return{point:[n,s],index:o,t:Math.max(0,Math.min(1,r))}}wrap(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}};const fd=100,pd=50;function y0(i,e){return e[0]-i[0]}function ya(i){return i[1]-i[0]+1}function vi(i,e){return i[1]>=i[0]&&i[1]<e}function md(i,e){if(i[0]>i[1])return[null,null];const t=ya(i);if(e){if(t===2)return[i,null];const s=Math.floor(t/2);return[[i[0],i[0]+s],[i[0]+s,i[1]]]}if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function gd(i,e){if(!vi(e,i.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)xo(t,i[n]);return t}function yd(i){const e=[1/0,1/0,-1/0,-1/0];for(const t of i)for(const n of t)xo(e,n);return e}function A0(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Ad(i,e,t){if(!A0(i)||!A0(e))return NaN;let n=0,s=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=i[0]-e[2]),i[1]>e[3]&&(s=i[1]-e[3]),i[3]<e[1]&&(s=e[1]-i[3]),t.distance([0,0],[n,s])}function fn(i,e,t){const n=t.pointOnLine(e,i);return t.distance(i,n.point)}function vd(i,e,t,n,s){const o=Math.min(fn(i,[t,n],s),fn(e,[t,n],s)),r=Math.min(fn(t,[i,e],s),fn(n,[i,e],s));return Math.min(o,r)}function H6(i,e,t,n,s){if(!(vi(e,i.length)&&vi(n,t.length)))return 1/0;let o=1/0;for(let r=e[0];r<e[1];++r){const a=i[r],l=i[r+1];for(let c=n[0];c<n[1];++c){const h=t[c],u=t[c+1];if(ga(a,l,h,u))return 0;o=Math.min(o,vd(a,l,h,u,s))}}return o}function Y6(i,e,t,n,s){if(!(vi(e,i.length)&&vi(n,t.length)))return NaN;let o=1/0;for(let r=e[0];r<=e[1];++r)for(let a=n[0];a<=n[1];++a)if(o=Math.min(o,s.distance(i[r],t[a])),o===0)return o;return o}function $6(i,e,t){if(ls(i,e,!0))return 0;let n=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(n=Math.min(n,fn(i,[r,o],t)),n===0))return n;const a=t.pointOnLine(s,i);if(n=Math.min(n,t.distance(i,a.point)),n===0)return n}return n}function j6(i,e,t,n){if(!vi(e,i.length))return NaN;for(let o=e[0];o<=e[1];++o)if(ls(i[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=i[o],a=i[o+1];for(const l of t)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const p=l[u],f=l[c];if(ga(r,a,p,f))return 0;s=Math.min(s,vd(r,a,p,f,n))}}return s}function v0(i,e){for(const t of i)for(const n of t)if(ls(n,e,!0))return!0;return!1}function W6(i,e,t,n=1/0){const s=yd(i),o=yd(e);if(n!==1/0&&Ad(s,o,t)>=n)return n;if(Io(s,o)){if(v0(i,e))return 0}else if(v0(e,i))return 0;let r=1/0;for(const a of i)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],p=a[l];for(const f of e)for(let m=0,y=f.length,g=y-1;m<y;g=m++){const A=f[g],v=f[m];if(ga(u,p,A,v))return 0;r=Math.min(r,vd(u,p,A,v,t))}}return r}function b0(i,e,t,n,s,o){if(!o)return;const r=Ad(gd(n,o),s,t);r<e&&i.push([r,o,[0,0]])}function Aa(i,e,t,n,s,o,r){if(!o||!r)return;const a=Ad(gd(n,o),gd(s,r),t);a<e&&i.push([a,o,r])}function va(i,e,t,n,s=1/0){let o=Math.min(n.distance(i[0],t[0][0]),s);if(o===0)return o;const r=new f0([[0,[0,i.length-1],[0,0]]],y0),a=yd(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?pd:fd;if(ya(c)<=h){if(!vi(c,i.length))return NaN;if(e){const u=j6(i,c,t,n);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const p=$6(i[u],t,n);if(o=Math.min(o,p),o===0)return 0}}else{const u=md(c,e);b0(r,o,n,i,a,u[0]),b0(r,o,n,i,a,u[1])}}return o}function ba(i,e,t,n,s,o=1/0){let r=Math.min(o,s.distance(i[0],t[0]));if(r===0)return r;const a=new f0([[0,[0,i.length-1],[0,t.length-1]]],y0);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?pd:fd,p=n?pd:fd;if(ya(c)<=u&&ya(h)<=p){if(!vi(c,i.length)&&vi(h,t.length))return NaN;let f;if(e&&n)f=H6(i,c,t,h,s),r=Math.min(r,f);else if(e&&!n){const m=i.slice(c[0],c[1]+1);for(let y=h[0];y<=h[1];++y)if(f=fn(t[y],m,s),r=Math.min(r,f),r===0)return r}else if(!e&&n){const m=t.slice(h[0],h[1]+1);for(let y=c[0];y<=c[1];++y)if(f=fn(i[y],m,s),r=Math.min(r,f),r===0)return r}else f=Y6(i,c,t,h,s),r=Math.min(r,f)}else{const f=md(c,e),m=md(h,n);Aa(a,r,s,i,t,f[0],m[0]),Aa(a,r,s,i,t,f[0],m[1]),Aa(a,r,s,i,t,f[1],m[0]),Aa(a,r,s,i,t,f[1],m[1])}}return r}function q6(i,e){const t=i.geometry(),n=t.flat().map(r=>cd([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new ud(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ba(n,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ba(n,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,va(n,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function K6(i,e){const t=i.geometry(),n=t.flat().map(r=>cd([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new ud(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ba(n,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ba(n,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,va(n,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function X6(i,e){const t=i.geometry();if(t.length===0||t[0].length===0)return NaN;const n=V6(t).map(r=>r.map(a=>a.map(l=>cd([l.x,l.y],i.canonical)))),s=new ud(n[0][0][0][1]);let o=1/0;for(const r of e)for(const a of n){switch(r.type){case"Point":o=Math.min(o,va([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,va(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,W6(a,r.coordinates,s,o));break}if(o===0)return o}return o}function bd(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}var wd=class Ua{constructor(e,t){this.type=q,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Co(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new Ua(n,n.features.map(s=>bd(s.geometry)).flat());if(n.type==="Feature")return new Ua(n,bd(n.geometry));if("type"in n&&"coordinates"in n)return new Ua(n,bd(n))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return q6(e,this.geometries);if(e.geometryType()==="LineString")return K6(e,this.geometries);if(e.geometryType()==="Polygon")return X6(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Cd=class Hy{constructor(e){this.type=he,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Hy(n)}evaluate(e){const t=e.globals?.globalState;return!t||Object.keys(t).length===0?null:jg(t,this.key)??null}eachChild(){}outputDefined(){return!1}};const cs={"==":y6,"!=":A6,">":b6,"<":v6,">=":C6,"<=":w6,array:yi,at:J5,boolean:yi,case:i6,coalesce:n0,collator:r0,format:x6,image:I6,in:Z5,"index-of":e6,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:S6,let:e0,literal:fa,match:t6,number:yi,"number-format":E6,object:yi,slice:n6,step:i0,string:yi,"to-boolean":rs,"to-color":rs,"to-number":rs,"to-string":rs,var:t0,within:hd,distance:wd,"global-state":Cd};var pn=class Qo{constructor(e,t,n,s){this.name=e,this.type=t,this._evaluate=n,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const n=e[0],s=Qo.definitions[n];if(!s)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(s)?s[0]:s.type,r=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=r.filter(([c])=>!Array.isArray(c)||c.length===e.length-1);let l=null;for(const[c,h]of a){l=new Zg(t.registry,wa,t.path,null,t.scope);const u=[];let p=!1;for(let f=1;f<e.length;f++){const m=e[f],y=Array.isArray(c)?c[f-1]:c.type,g=l.parse(m,1+u.length,y);if(!g){p=!0;break}u.push(g)}if(!p){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let f=0;f<u.length;f++){const m=Array.isArray(c)?c[f]:c.type,y=u[f];l.concat(f+1).checkSubtype(m,y.type)}if(l.errors.length===0)return new Qo(n,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const c=(a.length?a:r).map(([u])=>Z6(u)).join(" | "),h=[];for(let u=1;u<e.length;u++){const p=t.parse(e[u],1+h.length);if(!p)return null;h.push(ke(p.type))}t.error(`Expected arguments of type ${c}, but found (${h.join(", ")}) instead.`)}return null}static register(e,t){Qo.definitions=t;for(const n in t)e[n]=Qo}};function w0(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1,r=Kg(e,t,n,o);if(r)throw new Le(r);return new qe(e/255,t/255,n/255,o,!1)}function C0(i,e){return i in e}function Ed(i,e){const t=e[i];return typeof t>"u"?null:t}function J6(i,e,t,n){for(;t<=n;){const s=t+n>>1;if(e[s]===i)return!0;e[s]>i?n=s-1:t=s+1}return!1}function mn(i){return{type:i}}pn.register(cs,{error:[F5,[ce],(i,[e])=>{throw new Le(e.evaluate(i))}],typeof:[ce,[he],(i,[e])=>ke(Ke(e.evaluate(i)))],"to-rgba":[yt(q,4),[si],(i,[e])=>{const[t,n,s,o]=e.evaluate(i).rgb;return[t*255,n*255,s*255,o]}],rgb:[si,[q,q,q],w0],rgba:[si,[q,q,q,q],w0],has:{type:fe,overloads:[[[ce],(i,[e])=>C0(e.evaluate(i),i.properties())],[[ce,hn],(i,[e,t])=>C0(e.evaluate(i),t.evaluate(i))]]},get:{type:he,overloads:[[[ce],(i,[e])=>Ed(e.evaluate(i),i.properties())],[[ce,hn],(i,[e,t])=>Ed(e.evaluate(i),t.evaluate(i))]]},"feature-state":[he,[ce],(i,[e])=>Ed(e.evaluate(i),i.featureState||{})],properties:[hn,[],i=>i.properties()],"geometry-type":[ce,[],i=>i.geometryType()],id:[he,[],i=>i.id()],zoom:[q,[],i=>i.globals.zoom],"heatmap-density":[q,[],i=>i.globals.heatmapDensity||0],elevation:[q,[],i=>i.globals.elevation||0],"line-progress":[q,[],i=>i.globals.lineProgress||0],accumulated:[he,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[q,mn(q),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[q,mn(q),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}],"-":{type:q,overloads:[[[q,q],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[q],(i,[e])=>-e.evaluate(i)]]},"/":[q,[q,q],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[q,[q,q],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[q,[],()=>Math.LN2],pi:[q,[],()=>Math.PI],e:[q,[],()=>Math.E],"^":[q,[q,q],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[q,[q],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[q,[q],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[q,[q],(i,[e])=>Math.log(e.evaluate(i))],log2:[q,[q],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[q,[q],(i,[e])=>Math.sin(e.evaluate(i))],cos:[q,[q],(i,[e])=>Math.cos(e.evaluate(i))],tan:[q,[q],(i,[e])=>Math.tan(e.evaluate(i))],asin:[q,[q],(i,[e])=>Math.asin(e.evaluate(i))],acos:[q,[q],(i,[e])=>Math.acos(e.evaluate(i))],atan:[q,[q],(i,[e])=>Math.atan(e.evaluate(i))],min:[q,mn(q),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[q,mn(q),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[q,[q],(i,[e])=>Math.abs(e.evaluate(i))],round:[q,[q],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[q,[q],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[q,[q],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[fe,[ce,he],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[fe,[he],(i,[e])=>i.id()===e.value],"filter-type-==":[fe,[ce],(i,[e])=>i.geometryType()===e.value],"filter-<":[fe,[ce,he],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[fe,[he],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[fe,[ce,he],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[fe,[he],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[fe,[ce,he],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[fe,[he],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[fe,[ce,he],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[fe,[he],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[fe,[he],(i,[e])=>e.value in i.properties()],"filter-has-id":[fe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[fe,[yt(ce)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[fe,[yt(he)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[fe,[ce,yt(he)],(i,[e,t])=>t.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[fe,[ce,yt(he)],(i,[e,t])=>J6(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:fe,overloads:[[[fe,fe],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[mn(fe),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:fe,overloads:[[[fe,fe],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[mn(fe),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[fe,[fe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[fe,[ce],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return t?t(e.evaluate(i)):!0}],upcase:[ce,[ce],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ce,[ce],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ce,mn(he),(i,e)=>e.map(t=>Eo(t.evaluate(i))).join("")],split:[yt(ce),[ce,ce],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],join:[ce,[yt(ce),ce],(i,[e,t])=>e.evaluate(i).join(t.evaluate(i))],"resolved-locale":[ce,[aa],(i,[e])=>e.evaluate(i).resolvedLocale()]});function Z6(i){return Array.isArray(i)?`(${i.map(ke).join(", ")})`:`(${ke(i.type)}...)`}function wa(i){if(i instanceof t0)return wa(i.boundExpression);if(i instanceof pn&&i.name==="error")return!1;if(i instanceof r0)return!1;if(i instanceof hd)return!1;if(i instanceof wd)return!1;if(i instanceof Cd)return!1;const e=i instanceof rs||i instanceof yi;let t=!0;return i.eachChild(n=>{e?t=t&&wa(n):t=t&&n instanceof fa}),t?xd(i)&&Sd(i,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function xd(i){if(i instanceof pn){if(i.name==="get"&&i.args.length===1)return!1;if(i.name==="feature-state")return!1;if(i.name==="has"&&i.args.length===1)return!1;if(i.name==="properties"||i.name==="geometry-type"||i.name==="id")return!1;if(/^filter-/.test(i.name))return!1}if(i instanceof hd||i instanceof wd)return!1;let e=!0;return i.eachChild(t=>{e&&!xd(t)&&(e=!1)}),e}function Id(i){if(i instanceof pn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Id(t)&&(e=!1)}),e}function Sd(i,e){if(i instanceof pn&&e.indexOf(i.name)>=0)return!1;let t=!0;return i.eachChild(n=>{t&&!Sd(n,e)&&(t=!1)}),t}function Md(i){return{result:"success",value:i}}function ds(i){return{result:"error",value:i}}function eG(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function tG(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function E0(i){return!!i.expression&&i.expression.interpolated}function Td(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function x0(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&Ke(i)===hn}function iG(i){return i}function nG(i){switch(i.type){case"color":return qe.parse;case"padding":return oi.parse;case"numberArray":return ri.parse;case"colorArray":return Lt.parse;default:return null}}function sG(i){switch(i){case"exponential":return S0;case"interval":return rG;case"categorical":return oG;case"identity":return aG;default:throw new Error(`Unknown function type "${i}"`)}}function I0(i,e){const t=i.stops&&typeof i.stops[0][0]=="object",n=t||i.property!==void 0,s=t||!n,o=i.type||(E0(e)?"exponential":"interval"),r=nG(e);if(r&&(i=Og({},i),i.stops&&(i.stops=i.stops.map(h=>[h[0],r(h[1])])),i.default?i.default=r(i.default):i.default=r(e.default)),i.colorSpace&&!W5(i.colorSpace))throw new Error(`Unknown color space: "${i.colorSpace}"`);const a=sG(o);let l,c;if(o==="categorical"){l=Object.create(null);for(const h of i.stops)l[h[0]]=h[1];c=typeof i.stops[0][0]}if(t){const h={},u=[];for(let m=0;m<i.stops.length;m++){const y=i.stops[m],g=y[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:i.type,property:i.property,default:i.default,stops:[]},u.push(g)),h[g].stops.push([y[0].value,y[1]])}const p=[];for(const m of u)p.push([h[m].zoom,I0(h[m],e)]);const f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Ai.interpolationFactor.bind(void 0,f),zoomStops:p.map(m=>m[0]),evaluate({zoom:m},y){return S0({stops:p,base:i.base},e,m).evaluate(m,y)}}}else if(s){const h=o==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:h,interpolationFactor:Ai.interpolationFactor.bind(void 0,h),zoomStops:i.stops.map(u=>u[0]),evaluate:({zoom:u})=>a(i,e,u,l,c)}}else return{kind:"source",evaluate(h,u){const p=u&&u.properties?u.properties[i.property]:void 0;return p===void 0?So(i.default,e.default):a(i,e,p,l,c)}}}function So(i,e,t){if(i!==void 0)return i;if(e!==void 0)return e;if(t!==void 0)return t}function oG(i,e,t,n,s){return So(typeof t===s?n[t]:void 0,i.default,e.default)}function rG(i,e,t){if(Td(t)!=="number")return So(i.default,e.default);const n=i.stops.length;if(n===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[n-1][0])return i.stops[n-1][1];const s=ma(i.stops.map(o=>o[0]),t);return i.stops[s][1]}function S0(i,e,t){const n=i.base!==void 0?i.base:1;if(Td(t)!=="number")return So(i.default,e.default);const s=i.stops.length;if(s===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[s-1][0])return i.stops[s-1][1];const o=ma(i.stops.map(h=>h[0]),t),r=lG(t,n,i.stops[o][0],i.stops[o+1][0]),a=i.stops[o][1],l=i.stops[o+1][1],c=o6[e.type]||iG;return typeof a.evaluate=="function"?{evaluate(...h){const u=a.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(!(u===void 0||p===void 0))return c(u,p,r,i.colorSpace)}}:c(a,l,r,i.colorSpace)}function aG(i,e,t){switch(e.type){case"color":t=qe.parse(t);break;case"formatted":t=ss.fromString(t.toString());break;case"resolvedImage":t=zi.fromString(t.toString());break;case"padding":t=oi.parse(t);break;case"colorArray":t=Lt.parse(t);break;case"numberArray":t=ri.parse(t);break;default:Td(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return So(t,i.default,e.default)}function lG(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}var Bd=class{constructor(i,e,t){this.expression=i,this._warningHistory={},this._evaluator=new Jg,this._defaultValue=e?uG(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e,this._evaluator.featureState=t,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(i,e,t,n,s,o){this._globalState&&(i=hs(i,this._globalState)),this._evaluator.globals=i,this._evaluator.feature=e||null,this._evaluator.featureState=t||null,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o||null;try{const r=this.expression.evaluate(this._evaluator);if(r==null||typeof r=="number"&&r!==r)return this._defaultValue;if(this._enumValues&&!(r in this._enumValues))throw new Le(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(r)} instead.`);return r}catch(r){return this._warningHistory[r.message]||(this._warningHistory[r.message]=!0,typeof console<"u"&&console.warn(r.message)),this._defaultValue}}};function M0(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in cs}function _d(i,e,t){const n=new Zg(cs,wa,[],e?hG(e):void 0),s=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Md(new Bd(s,e,t)):ds(n.errors)}var Ca=class{constructor(i,e,t){this.kind=i,this._styleExpression=e,this.isStateDependent=i!=="constant"&&!Id(e.expression),this.globalStateRefs=Ia(e.expression),this._globalState=t}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,s,o)}evaluate(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,s,o)}},Ea=class{constructor(i,e,t,n,s){this.kind=i,this.zoomStops=t,this._styleExpression=e,this.isStateDependent=i!=="camera"&&!Id(e.expression),this.globalStateRefs=Ia(e.expression),this.interpolationType=n,this._globalState=s}evaluateWithoutErrorHandling(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(i,e,t,n,s,o)}evaluate(i,e,t,n,s,o){return this._globalState&&(i=hs(i,this._globalState)),this._styleExpression.evaluate(i,e,t,n,s,o)}interpolationFactor(i,e,t){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,i,e,t):0}};function cG(i){return i._styleExpression!==void 0}function T0(i,e,t){const n=_d(i,e,t);if(n.result==="error")return n;const s=n.value.expression,o=xd(s);if(!o&&!eG(e))return ds([new ni("","data expressions not supported")]);const r=Sd(s,["zoom"]);if(!r&&!tG(e))return ds([new ni("","zoom expressions not supported")]);const a=xa(s);if(!a&&!r)return ds([new ni("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof ni)return ds([a]);if(a instanceof Ai&&!E0(e))return ds([new ni("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Md(o?new Ca("constant",n.value,t):new Ca("source",n.value,t));const l=a instanceof Ai?a.interpolation:void 0;return Md(o?new Ea("camera",n.value,a.labels,l,t):new Ea("composite",n.value,a.labels,l,t))}var kd=class Yy{constructor(e,t){this._parameters=e,this._specification=t,Og(this,I0(this._parameters,this._specification))}static deserialize(e){return new Yy(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function dG(i,e,t){if(x0(i))return new kd(i,e);if(M0(i)){const n=T0(i,e,t);if(n.result==="error")throw new Error(n.value.map(s=>`${s.key}: ${s.message}`).join(", "));return n.value}else{let n=i;return e.type==="color"&&typeof i=="string"?n=qe.parse(i):e.type==="padding"&&(typeof i=="number"||Array.isArray(i))?n=oi.parse(i):e.type==="numberArray"&&(typeof i=="number"||Array.isArray(i))?n=ri.parse(i):e.type==="colorArray"&&(typeof i=="string"||Array.isArray(i))?n=Lt.parse(i):e.type==="variableAnchorOffsetCollection"&&Array.isArray(i)?n=Qi.parse(i):e.type==="projectionDefinition"&&typeof i=="string"&&(n=os.parse(i)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function xa(i){let e=null;if(i instanceof e0)e=xa(i.result);else if(i instanceof n0){for(const t of i.args)if(e=xa(t),e)break}else(i instanceof i0||i instanceof Ai)&&i.input instanceof pn&&i.input.name==="zoom"&&(e=i);return e instanceof ni||i.eachChild(t=>{const n=xa(t);n instanceof ni?e=n:!e&&n?e=new ni("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new ni("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Ia(i,e=new Set){return i instanceof Cd&&e.add(i.key),i.eachChild(t=>{Ia(t,e)}),e}function hG(i){const e={color:si,string:ce,number:q,enum:ce,boolean:fe,formatted:la,padding:ca,numberArray:da,colorArray:vo,projectionDefinition:ra,resolvedImage:bo,variableAnchorOffsetCollection:ha};return i.type==="array"?yt(e[i.value]||he,i.length):e[i.type]}function uG(i){if(i.type==="color"&&x0(i.default))return new qe(0,0,0,0);switch(i.type){case"color":return qe.parse(i.default)||null;case"padding":return oi.parse(i.default)||null;case"numberArray":return ri.parse(i.default)||null;case"colorArray":return Lt.parse(i.default)||null;case"variableAnchorOffsetCollection":return Qi.parse(i.default)||null;case"projectionDefinition":return os.parse(i.default)||null;default:return i.default===void 0?null:i.default}}function hs(i,e){const{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=i??{};return{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function Pd(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Pd(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const fG={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function B0(i,e){if(i==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Pd(i)||(i=Sa(i));const t=_d(i,fG,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,s,o)=>t.value.evaluate(n,s,{},o),needGeometry:_0(i),getGlobalStateRefs:()=>Ia(t.value.expression)}}function pG(i,e){return i<e?-1:i>e?1:0}function _0(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(_0(i[e]))return!0;return!1}function Sa(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Dd(i[1],i[2],"=="):e==="!="?Ma(Dd(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Dd(i[1],i[2],e):e==="any"?mG(i.slice(1)):e==="all"?["all"].concat(i.slice(1).map(Sa)):e==="none"?["all"].concat(i.slice(1).map(Sa).map(Ma)):e==="in"?k0(i[1],i.slice(2)):e==="!in"?Ma(k0(i[1],i.slice(2))):e==="has"?P0(i[1]):e==="!has"?Ma(P0(i[1])):!0}function Dd(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function mG(i){return["any"].concat(i.map(Sa))}function k0(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",i,["literal",e.sort(pG)]]:["filter-in-small",i,["literal",e]]}}function P0(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ma(i){return["!",i]}const D0={StyleExpression:Bd,StylePropertyFunction:kd,ZoomConstantExpression:Ca,ZoomDependentExpression:Ea,createExpression:_d,createPropertyExpression:T0,isExpression:M0,isExpressionFilter:Pd,isZoomExpression:cG,normalizePropertyExpression:dG};var Nd,N0;function gG(){if(N0)return Nd;N0=1,Nd=i;function i(e,t,n,s){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=s}return i.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,s=0;s<8;s++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var r=this.sampleCurveDerivativeX(n);if(Math.abs(r)<1e-6)break;n=n-o/r}var a=0,l=1;for(n=e,s=0;s<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));s++)e>o?a=n:l=n,n=(l-a)*.5+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Nd}var yG=gG();const AG=nn(yG);function vG(i,e,t,n){const s=new AG(i,e,t,n);return o=>s.solve(o)}vG(.25,.1,.25,1);function L0(i,e,t){return Math.min(t,Math.max(e,i))}const R0={};function ze(i){R0[i]||(typeof console<"u"&&console.warn(i),R0[i]=!0)}class Ld{constructor(e,t={}){this.data=t,this.props=new Map,this.groupName=e;const n=Fg[e];for(const s in n)if(Object.hasOwnProperty.call(n,s)){const o=n[s],r=t[s],a=D0.normalizePropertyExpression(r===void 0?o.default:r,o);this.props.set(s,a)}}setProperty(e,t){const n=Fg[this.groupName];if(Object.hasOwnProperty.call(n,e)){const s=n[e];if(this.data[e]===t)return!1;const r=D0.normalizePropertyExpression(Cesium.defined(t)?t:s.default,s);return this.props.set(e,r),!0}else return ze(`maplibre样式规范不支持属性:${this.groupName}.${e}`),!1}resolveTokens(e,t){return t.replace(/{([^{}]+)}/g,(n,s)=>e&&s in e?String(e[s]):"")}getDataConstValue(e,t){const n=this.props.get(e);return n&&n.evaluate({zoom:t})}getDataValue(e,t,n){const s=this.props.get(e);return s&&s.evaluate({zoom:t},n)}}class F0{constructor(e){this.data=e,this.type=e.type,this.id=e.id,this.minzoom=e.minzoom||0,this.maxzoom=e.maxzoom||24,this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=null,this.paint=new Ld("paint_"+e.type,e.paint),this.layout=new Ld("layout_"+e.type,e.layout),e.filter&&(this.filter=B0(e.filter)),this.paintVersion=0}setLayoutProperty(e,t){return this.layout.setProperty(e,t)}setPaintProperty(e,t){const n=this.paint.setProperty(e,t);return n&&this.paintVersion++,n}setFilter(e){if(e){if(JSON.stringify(this.data.filter)!==JSON.stringify(e))return this.data.filter=e,this.filter=B0(e),!0}else{const t=Cesium.defined(this.filter);return this.filter=null,delete this.data.filter,t}return!1}convertColor(e,t){if(!e)return;const n=e.a>0?1/e.a:1;return t||(t=new Cesium.Color),t.red=e.r*n,t.green=e.g*n,t.blue=e.b*n,t.alpha=e.a,t}}class O0{constructor(e){this.styleLayers=e,this.renderLayers=[],this.layerIndexMap={},this.list=[],this.tileIdCommands=[],this.tileCommands=[],this.visualizers=[]}init(){const{styleLayers:e,renderLayers:t,layerIndexMap:n}=this;for(let s=0;s<e.length;s++){const o=e[s];t[s]=[],n[o.id]=s}this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}beginFrame(){const e=this.renderLayers;for(const t of e)t.length=0;this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}push(e){const t=this.layerIndexMap[e.id];this.renderLayers[t].push(e)}getList(){const e=this.list;e.length=0;const t=this.renderLayers;for(const n of t)n&&e.push(...n);return e}destroy(){this.styleLayers.length=0,this.renderLayers.length=0,this.layerIndexMap=null,this.init()}}var Rd,G0;function bG(){if(G0)return Rd;G0=1,Rd=i;function i(e,t){this.x=e,this.y=t}return i.prototype={clone:function(){return new i(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,n=e.y-this.y;return t*t+n*n},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,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,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),n=Math.sin(e),s=t*this.x-n*this.y,o=n*this.x+t*this.y;return this.x=s,this.y=o,this},_rotateAround:function(e,t){var n=Math.cos(e),s=Math.sin(e),o=t.x+n*(this.x-t.x)-s*(this.y-t.y),r=t.y+s*(this.x-t.x)+n*(this.y-t.y);return this.x=o,this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(e){return e instanceof i?e:Array.isArray(e)?new i(e[0],e[1]):e},Rd}bG();function wG(i,e,t=2){const n=e&&e.length,s=n?e[0]*t:i.length;let o=U0(i,0,s,t,!0);const r=[];if(!o||o.next===o.prev)return r;let a,l,c;if(n&&(o=SG(i,e,o,t)),i.length>80*t){a=i[0],l=i[1];let h=a,u=l;for(let p=t;p<s;p+=t){const f=i[p],m=i[p+1];f<a&&(a=f),m<l&&(l=m),f>h&&(h=f),m>u&&(u=m)}c=Math.max(h-a,u-l),c=c!==0?32767/c:0}return Mo(o,r,t,a,l,c,0),r}function U0(i,e,t,n,s){let o;if(s===FG(i,e,t,n)>0)for(let r=e;r<t;r+=n)o=H0(r/n|0,i[r],i[r+1],o);else for(let r=t-n;r>=e;r-=n)o=H0(r/n|0,i[r],i[r+1],o);return o&&us(o,o.next)&&(_o(o),o=o.next),o}function gn(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(us(t,t.next)||Re(t.prev,t,t.next)===0)){if(_o(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Mo(i,e,t,n,s,o,r){if(!i)return;!r&&o&&kG(i,n,s,o);let a=i;for(;i.prev!==i.next;){const l=i.prev,c=i.next;if(o?EG(i,n,s,o):CG(i)){e.push(l.i,i.i,c.i),_o(i),i=c.next,a=c.next;continue}if(i=c,i===a){r?r===1?(i=xG(gn(i),e),Mo(i,e,t,n,s,o,2)):r===2&&IG(i,e,t,n,s,o):Mo(gn(i),e,t,n,s,o,1);break}}}function CG(i){const e=i.prev,t=i,n=i.next;if(Re(e,t,n)>=0)return!1;const s=e.x,o=t.x,r=n.x,a=e.y,l=t.y,c=n.y,h=Math.min(s,o,r),u=Math.min(a,l,c),p=Math.max(s,o,r),f=Math.max(a,l,c);let m=n.next;for(;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=u&&m.y<=f&&To(s,a,o,l,r,c,m.x,m.y)&&Re(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function EG(i,e,t,n){const s=i.prev,o=i,r=i.next;if(Re(s,o,r)>=0)return!1;const a=s.x,l=o.x,c=r.x,h=s.y,u=o.y,p=r.y,f=Math.min(a,l,c),m=Math.min(h,u,p),y=Math.max(a,l,c),g=Math.max(h,u,p),A=Fd(f,m,e,t,n),v=Fd(y,g,e,t,n);let b=i.prevZ,C=i.nextZ;for(;b&&b.z>=A&&C&&C.z<=v;){if(b.x>=f&&b.x<=y&&b.y>=m&&b.y<=g&&b!==s&&b!==r&&To(a,h,l,u,c,p,b.x,b.y)&&Re(b.prev,b,b.next)>=0||(b=b.prevZ,C.x>=f&&C.x<=y&&C.y>=m&&C.y<=g&&C!==s&&C!==r&&To(a,h,l,u,c,p,C.x,C.y)&&Re(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;b&&b.z>=A;){if(b.x>=f&&b.x<=y&&b.y>=m&&b.y<=g&&b!==s&&b!==r&&To(a,h,l,u,c,p,b.x,b.y)&&Re(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;C&&C.z<=v;){if(C.x>=f&&C.x<=y&&C.y>=m&&C.y<=g&&C!==s&&C!==r&&To(a,h,l,u,c,p,C.x,C.y)&&Re(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function xG(i,e){let t=i;do{const n=t.prev,s=t.next.next;!us(n,s)&&Q0(n,t,t.next,s)&&Bo(n,s)&&Bo(s,n)&&(e.push(n.i,t.i,s.i),_o(t),_o(t.next),t=i=s),t=t.next}while(t!==i);return gn(t)}function IG(i,e,t,n,s,o){let r=i;do{let a=r.next.next;for(;a!==r.prev;){if(r.i!==a.i&&NG(r,a)){let l=z0(r,a);r=gn(r,r.next),l=gn(l,l.next),Mo(r,e,t,n,s,o,0),Mo(l,e,t,n,s,o,0);return}a=a.next}r=r.next}while(r!==i)}function SG(i,e,t,n){const s=[];for(let o=0,r=e.length;o<r;o++){const a=e[o]*n,l=o<r-1?e[o+1]*n:i.length,c=U0(i,a,l,n,!1);c===c.next&&(c.steiner=!0),s.push(DG(c))}s.sort(MG);for(let o=0;o<s.length;o++)t=TG(s[o],t);return t}function MG(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=n-s}return t}function TG(i,e){const t=BG(i,e);if(!t)return e;const n=z0(t,i);return gn(n,n.next),gn(t,t.next)}function BG(i,e){let t=e;const n=i.x,s=i.y;let o=-1/0,r;if(us(i,t))return t;do{if(us(i,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const u=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>o&&(o=u,r=t.x<t.next.x?t:t.next,u===n))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let h=1/0;t=r;do{if(n>=t.x&&t.x>=l&&n!==t.x&&V0(s<c?n:o,s,l,c,s<c?o:n,s,t.x,t.y)){const u=Math.abs(s-t.y)/(n-t.x);Bo(t,i)&&(u<h||u===h&&(t.x>r.x||t.x===r.x&&_G(r,t)))&&(r=t,h=u)}t=t.next}while(t!==a);return r}function _G(i,e){return Re(i.prev,i,e.prev)<0&&Re(e.next,i,i.next)<0}function kG(i,e,t,n){let s=i;do s.z===0&&(s.z=Fd(s.x,s.y,e,t,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,PG(s)}function PG(i){let e,t=1;do{let n=i,s;i=null;let o=null;for(e=0;n;){e++;let r=n,a=0;for(let c=0;c<t&&(a++,r=r.nextZ,!!r);c++);let l=t;for(;a>0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(s=n,n=n.nextZ,a--):(s=r,r=r.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;n=r}o.nextZ=null,t*=2}while(e>1);return i}function Fd(i,e,t,n,s){return i=(i-t)*s|0,e=(e-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function DG(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function V0(i,e,t,n,s,o,r,a){return(s-r)*(e-a)>=(i-r)*(o-a)&&(i-r)*(n-a)>=(t-r)*(e-a)&&(t-r)*(o-a)>=(s-r)*(n-a)}function To(i,e,t,n,s,o,r,a){return!(i===r&&e===a)&&V0(i,e,t,n,s,o,r,a)}function NG(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!LG(i,e)&&(Bo(i,e)&&Bo(e,i)&&RG(i,e)&&(Re(i.prev,i,e.prev)||Re(i,e.prev,e))||us(i,e)&&Re(i.prev,i,i.next)>0&&Re(e.prev,e,e.next)>0)}function Re(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function us(i,e){return i.x===e.x&&i.y===e.y}function Q0(i,e,t,n){const s=Ba(Re(i,e,t)),o=Ba(Re(i,e,n)),r=Ba(Re(t,n,i)),a=Ba(Re(t,n,e));return!!(s!==o&&r!==a||s===0&&Ta(i,t,e)||o===0&&Ta(i,n,e)||r===0&&Ta(t,i,n)||a===0&&Ta(t,e,n))}function Ta(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Ba(i){return i>0?1:i<0?-1:0}function LG(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Q0(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Bo(i,e){return Re(i.prev,i,i.next)<0?Re(i,e,i.next)>=0&&Re(i,i.prev,e)>=0:Re(i,e,i.prev)<0||Re(i,i.next,e)<0}function RG(i,e){let t=i,n=!1;const s=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function z0(i,e){const t=Od(i.i,i.x,i.y),n=Od(e.i,e.x,e.y),s=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function H0(i,e,t,n){const s=Od(i,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function _o(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Od(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function FG(i,e,t,n){let s=0;for(let o=e,r=t-n;o<t;o+=n)s+=(i[r]-i[o])*(i[o+1]+i[r+1]),r=o;return s}class bi{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){const t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}}const Na=class Na{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};Na.noSubdivision=new Na({fill:new bi(0,0),line:new bi(0,0),tile:new bi(0,0),stencil:new bi(0,0),circle:1});let _a=Na;const Hi=3;class Gd{constructor(e,t,n){const s=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const r=new Int32Array(this.arrayBuffer);e=r[0],t=r[1],n=r[2],this.d=t+2*n;for(let c=0;c<this.d*this.d;c++){const h=r[Hi+c],u=r[Hi+c+1];s.push(h===u?null:r.subarray(h,u))}const a=r[Hi+s.length],l=r[Hi+s.length+1];this.keys=r.subarray(a,l),this.bboxes=r.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let r=0;r<this.d*this.d;r++)s.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;const o=n/t*e;this.min=-o,this.max=e+o}insert(e,t,n,s,o){this._forEachCell(t,n,s,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,s,o,r){this.cells[o].push(r)}query(e,t,n,s,o){const r=this.min,a=this.max;if(e<=r&&t<=r&&a<=n&&a<=s&&!o)return[...this.keys];{const l=[],c={};return this._forEachCell(e,t,n,s,this._queryCell,l,c,o),l}}_queryCell(e,t,n,s,o,r,a,l){const c=this.cells[o];if(c!==null){const h=this.keys,u=this.bboxes;for(const p of c)if(a[p]===void 0){const f=p*4;(l?l(u[f+0],u[f+1],u[f+2],u[f+3]):e<=u[f+2]&&t<=u[f+3]&&n>=u[f+0]&&s>=u[f+1])?(a[p]=!0,r.push(h[p])):a[p]=!1}}}_forEachCell(e,t,n,s,o,r,a,l){const c=this._convertToCellCoord(e),h=this._convertToCellCoord(t),u=this._convertToCellCoord(n),p=this._convertToCellCoord(s);for(let f=c;f<=u;f++)for(let m=h;m<=p;m++){const y=this.d*m+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,t,n,s,y,r,a,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=Hi+this.cells.length+1+1;let n=0;for(const r of this.cells)n+=r.length;const s=new Int32Array(t+n+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;let o=t;for(let r=0;r<e.length;r++){const a=e[r];s[Hi+r]=o,s.set(a,o),o+=a.length}return s[Hi+e.length]=o,s.set(this.keys,o),o+=this.keys.length,s[Hi+e.length+1]=o,s.set(this.bboxes,o),o+=this.bboxes.length,s.buffer}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new Gd(e.buffer)}}class OG extends Error{constructor(e,t,n,s){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=s}}const Y0={};function At(i,e,t={}){if(Y0[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Y0[i]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}At("Object",Object),At("Set",Set),At("TransferableGridIndex",Gd),At("Color",qe),At("Error",Error),At("AJAXError",OG),At("ResolvedImage",zi),At("StylePropertyFunction",kd),At("StyleExpression",Bd,{omit:["_evaluator"]}),At("ZoomDependentExpression",Ea),At("ZoomConstantExpression",Ca),At("CompoundExpression",pn,{omit:["_evaluate"]});for(const i in cs)cs[i]._classRegistryKey||At(`Expression_${i}`,cs[i]);At("SubdivisionGranularityExpression",bi),At("SubdivisionGranularitySetting",_a);const fs=-32768,ko=32767;class GG{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Tt/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const n=Math.round(e)|0,s=Math.round(t)|0,o=this._getKey(n,s);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);const r=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,r),this._vertexBuffer.push(n,s),r}_subdivideTrianglesScanline(e){if(this._granularity<2)return QG(this._vertexBuffer,e);const t=[],n=e.length;for(let s=0;s<n;s+=3){const o=[e[s+0],e[s+1],e[s+2]],r=[this._vertexBuffer[e[s+0]*2+0],this._vertexBuffer[e[s+0]*2+1],this._vertexBuffer[e[s+1]*2+0],this._vertexBuffer[e[s+1]*2+1],this._vertexBuffer[e[s+2]*2+0],this._vertexBuffer[e[s+2]*2+1]];let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let y=0;y<3;y++){const g=r[y*2],A=r[y*2+1];a=Math.min(a,g),c=Math.max(c,g),l=Math.min(l,A),h=Math.max(h,A)}if(a===c||l===h)continue;const u=Math.floor(a/this._granularityCellSize),p=Math.ceil(c/this._granularityCellSize),f=Math.floor(l/this._granularityCellSize),m=Math.ceil(h/this._granularityCellSize);if(u===p&&f===m){t.push(...o);continue}for(let y=f;y<m;y++){const g=this._scanlineGenerateVertexRingForCellRow(y,r,o);zG(this._vertexBuffer,g,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){const s=e*this._granularityCellSize,o=s+this._granularityCellSize,r=[];for(let a=0;a<3;a++){const l=t[a*2],c=t[a*2+1],h=t[(a+1)*2%6],u=t[((a+1)*2+1)%6],p=t[(a+2)*2%6],f=t[((a+2)*2+1)%6],m=h-l,y=u-c,g=m===0,A=y===0,v=(s-c)/y,b=(o-c)/y,C=Math.min(v,b),x=Math.max(v,b);if(!A&&(C>=1||x<=0)||A&&(c<s||c>o)){u>=s&&u<=o&&r.push(n[(a+1)%3]);continue}if(!A&&C>0){const S=l+m*C,w=c+y*C;r.push(this._vertexToIndex(S,w))}const I=l+m*Math.max(C,0),E=l+m*Math.min(x,1);if(g||this._generateIntraEdgeVertices(r,l,c,h,u,I,E),!A&&x<1){const S=l+m*x,w=c+y*x;r.push(this._vertexToIndex(S,w))}(A||u>=s&&u<=o)&&r.push(n[(a+1)%3]),!A&&(u<=s||u>=o)&&this._generateInterEdgeVertices(r,l,c,h,u,p,f,E,s,o)}return r}_generateIntraEdgeVertices(e,t,n,s,o,r,a){const l=s-t,c=o-n,h=c===0,u=h?Math.min(t,s):Math.min(r,a),p=h?Math.max(t,s):Math.max(r,a),f=Math.floor(u/this._granularityCellSize)+1,m=Math.ceil(p/this._granularityCellSize)-1;if(h?t<s:r<a)for(let g=f;g<=m;g++){const A=g*this._granularityCellSize,v=n+c*(A-t)/l;e.push(this._vertexToIndex(A,v))}else for(let g=m;g>=f;g--){const A=g*this._granularityCellSize,v=n+c*(A-t)/l;e.push(this._vertexToIndex(A,v))}}_generateInterEdgeVertices(e,t,n,s,o,r,a,l,c,h){const u=o-n,p=r-s,f=a-o,m=(c-o)/f,y=(h-o)/f,g=Math.min(m,y),A=Math.max(m,y),v=s+p*g;let b=Math.floor(Math.min(v,l)/this._granularityCellSize)+1,C=Math.ceil(Math.max(v,l)/this._granularityCellSize)-1,x=l<v;const I=f===0;if(I&&(a===c||a===h))return;if(I||g>=1||A<=0){const S=t-r,w=n-a,T=(c-a)/w,_=(h-a)/w,F=Math.min(T,_),U=r+S*F;b=Math.floor(Math.min(U,l)/this._granularityCellSize)+1,C=Math.ceil(Math.max(U,l)/this._granularityCellSize)-1,x=l<U}const E=u>0?h:c;if(x)for(let S=b;S<=C;S++){const w=S*this._granularityCellSize;e.push(this._vertexToIndex(w,E))}else for(let S=C;S>=b;S--){const w=S*this._granularityCellSize;e.push(this._vertexToIndex(w,E))}}_generateOutline(e){const t=[];for(const n of e){const s=$0(n,this._granularity,!0),o=this._pointArrayToIndices(s),r=[];for(let a=1;a<o.length;a++)r.push(o[a-1]),r.push(o[a]);t.push(r)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const n=e[t+1];n===fs&&(e[t+1]=fs+1),n===ko&&(e[t+1]=ko-1)}}_generatePoleQuad(e,t,n,s,o,r){s>o!=(r===fs)?(e.push(t),e.push(n),e.push(this._vertexToIndex(s,r)),e.push(n),e.push(this._vertexToIndex(o,r)),e.push(this._vertexToIndex(s,r))):(e.push(n),e.push(t),e.push(this._vertexToIndex(s,r)),e.push(this._vertexToIndex(o,r)),e.push(n),e.push(this._vertexToIndex(s,r)))}_fillPoles(e,t,n){const s=this._vertexBuffer,o=0,r=Tt,a=e.length;for(let l=2;l<a;l+=3){const c=e[l-2],h=e[l-1],u=e[l],p=s[c*2],f=s[c*2+1],m=s[h*2],y=s[h*2+1],g=s[u*2],A=s[u*2+1];t&&(f===o&&y===o&&this._generatePoleQuad(e,c,h,p,m,fs),y===o&&A===o&&this._generatePoleQuad(e,h,u,m,g,fs),A===o&&f===o&&this._generatePoleQuad(e,u,c,g,p,fs)),n&&(f===r&&y===r&&this._generatePoleQuad(e,c,h,p,m,ko),y===r&&A===r&&this._generatePoleQuad(e,h,u,m,g,ko),A===r&&f===r&&this._generatePoleQuad(e,u,c,g,p,ko))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:n,holeIndices:s}=VG(e);this._initializeVertices(n);let o;try{const a=wG(n,s),l=this._convertIndices(n,a);o=this._subdivideTrianglesScanline(l)}catch(a){console.error(a)}let r=[];return t&&(r=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:r}}_convertIndices(e,t){const n=[];for(const s of t){const o=e[s*2],r=e[s*2+1];n.push(this._vertexToIndex(o,r))}return n}_pointArrayToIndices(e){const t=[];for(const n of e)t.push(this._vertexToIndex(n.x,n.y));return t}}function UG(i,e,t,n=!0){return new GG(t,e).subdividePolygonInternal(i,n)}function $0(i,e,t=!1){if(!i||i.length<1)return[];if(i.length<2)return[];const n=i[0],s=i[i.length-1],o=t&&(n.x!==s.x||n.y!==s.y);if(e<2)return o?[...i,i[0]]:[...i];const r=Math.floor(Tt/e),a=[];a.push(new Ne(i[0].x,i[0].y));const l=i.length,c=o?l:l-1;for(let h=0;h<c;h++){const u=i[h],p=h<l-1?i[h+1]:i[0],f=u.x,m=u.y,y=p.x,g=p.y,A=f!==y,v=m!==g;if(!A&&!v)continue;const b=y-f,C=g-m,x=Math.abs(b),I=Math.abs(C);let E=f,S=m;for(;;){const T=b>0?(Math.floor(E/r)+1)*r:(Math.ceil(E/r)-1)*r,_=C>0?(Math.floor(S/r)+1)*r:(Math.ceil(S/r)-1)*r,F=Math.abs(E-T),U=Math.abs(S-_),L=Math.abs(E-y),D=Math.abs(S-g),M=A?F/x:Number.POSITIVE_INFINITY,k=v?U/I:Number.POSITIVE_INFINITY;if((L<=F||!A)&&(D<=U||!v))break;if(M<k&&A||!v){E=T,S=S+C*M;const B=new Ne(E,Math.round(S));(a[a.length-1].x!==B.x||a[a.length-1].y!==B.y)&&a.push(B)}else{E=E+b*k,S=_;const B=new Ne(Math.round(E),S);(a[a.length-1].x!==B.x||a[a.length-1].y!==B.y)&&a.push(B)}}const w=new Ne(y,g);(a[a.length-1].x!==w.x||a[a.length-1].y!==w.y)&&a.push(w)}return a}function VG(i){const e=[],t=[];for(const n of i)if(n.length!==0){n!==i[0]&&e.push(t.length/2);for(const s of n)t.push(s.x),t.push(s.y)}return{flattened:t,holeIndices:e}}function QG(i,e){const t=[];for(let n=0;n<e.length;n+=3){const s=e[n],o=e[n+1],r=e[n+2],a=i[s*2],l=i[s*2+1],c=i[o*2],h=i[o*2+1],u=i[r*2],p=i[r*2+1],f=c-a,m=h-l,y=u-a,g=p-l;f*g-m*y>0?(t.push(s),t.push(r),t.push(o)):(t.push(s),t.push(o),t.push(r))}return t}function zG(i,e,t){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,s=i[e[0]*2];for(let l=1;l<e.length;l++){const c=i[e[l]*2];c<s&&(s=c,n=l)}const o=e.length;let r=n,a=(r+1)%o;for(;;){const l=r-1>=0?r-1:o-1,c=(a+1)%o,h=i[e[l]*2],u=i[e[l]*2+1],p=i[e[c]*2],f=i[e[c]*2+1],m=i[e[r]*2],y=i[e[r]*2+1],g=i[e[a]*2],A=i[e[a]*2+1];let v=!1;if(h<p)v=!0;else if(h>p)v=!1;else{const b=A-y,C=-(g-m),x=y<A?1:-1,I=((h-m)*b+(u-y)*C)*x,E=((p-m)*b+(f-y)*C)*x;I>E&&(v=!0)}if(v){const b=e[l],C=e[r],x=e[a];b!==C&&b!==x&&C!==x&&t.push(x,C,b),r--,r<0&&(r=o-1)}else{const b=e[c],C=e[r],x=e[a];b!==C&&b!==x&&C!==x&&t.push(x,C,b),a++,a>=o&&(a=0)}if(l===c)break}}const j0={globe:new _a({fill:new bi(128,2),line:new bi(512,0),tile:new bi(128,32),stencil:new bi(128,1),circle:3})};let Ud=null,W0=0,Vd=null;function HG(i,e){return Vd===null&&(Vd=Cesium.TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.ellipsoid,128,e.getNumberOfXTilesAtLevel(0))),Vd/(1<<i)}function YG(i,e){const t=HG(e.z,e.tilingScheme),n=e.distanceToCamera,s=i.context.drawingBufferHeight,o=i.camera.frustum.sseDenominator;let r=t*s/(n*o);return i.fog.enabled&&(r-=Cesium.Math.fog(n,i.fog.density)*i.fog.sse),r/=i.pixelRatio,r}function $G(){Ud===null&&(Ud=Cesium.RenderState.fromCache({id:"vt_tile-depth",blending:Cesium.BlendingState.DISABLED,depthTest:{enabled:!0},depthMask:!0,cull:{enabled:!0},stencilMask:Cesium.StencilConstants.CESIUM_3D_TILE_MASK,stencilTest:{backFunction:519,backOperation:{fail:7680,zFail:7680,zPass:7681},enabled:!0,frontFunction:519,frontOperation:{fail:7680,zFail:7680,zPass:7681},mask:128,reference:128},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}))}class ka{constructor(e){$G(),this.x=e.x,this.y=e.y,this.z=e.z,this.parent=e.parent,this.children=[],this.tilingScheme=e.tilingScheme,this.rectangle=this.tilingScheme.tileXYToRectangle(this.x,this.y,this.z),this.tileBoundingRegion=new Cesium.TileBoundingRegion({rectangle:this.rectangle,minimumHeight:0,maximumHeight:0,ellipsoid:this.tilingScheme.ellipsoid,computeBoundingVolumes:!0}),this.layers=[],this.visualizers=[],this.sources={},this.tileId=null,this.lastVisitTime=0,this.state="none",this.renderable=!1,this.tileId={x:this.x,y:this.y,z:this.z,key:W0++,color:Cesium.Color.fromRgba(W0-1),tileColor:Cesium.Color.fromRandom({alpha:1})};const t=Tt*Math.pow(2,this.z),n=Tt*this.x,s=Tt*this.y;this.transformPoint=function(o,r,a){return a[0]=(o+n)*360/t-180,a[1]=360/Math.PI*Math.atan(Math.exp((1-(r+s)*2/t)*Math.PI))-90,a}}createChildren(){var e=[{x:this.x*2,y:this.y*2+1,z:this.z+1},{x:this.x*2+1,y:this.y*2+1,z:this.z+1},{x:this.x*2,y:this.y*2,z:this.z+1},{x:this.x*2+1,y:this.y*2,z:this.z+1}];for(const{x:n,y:s,z:o}of e){var t=new ka({x:n,y:s,z:o,tilingScheme:this.tilingScheme,parent:this});this.children.push(t)}}visit(e,t){const n=this.tileBoundingRegion;if(this.distanceToCamera=n.distanceToCamera(e),this.visibility=e.cullingVolume.computeVisibility(n),this.visibility==Cesium.Intersect.OUTSIDE)return;const s=e.maximumScreenSpaceError;YG(e,this)>=s?t.visitChildren(this):t.accept(this)}async getSources(e){const t={},n=e._styleJson;for(const o of n.layers){const r=o.source,a=e.sources[r];a&&!t[r]&&(t[r]=a)}if(e._taskProcessor&&Object.values(t).every(o=>o.type==="vector")){for(const o in t){const r=t[o];try{const a=await r.requestTileBuffer(this.x,this.y,this.z,e);a&&a.buffer&&(this.sources[o]=a)}catch{}}this._workerBuffers=!0}else for(const o in t){const r=t[o];try{const a=await r.requestTile(this.x,this.y,this.z,e);a&&(this.sources[o]=a)}catch{}}e.numLoading--,this.state="loaded"}async createRenderLayers(e,t){const n=this.sources,s=t._styleLayers,o=this.layers,r=this.visualizers,a={};for(const l of s){const c=n[l.source],h=ps[l.type],u=ms[l.type],p=l.type==="background";if(h||ze("不支持图层类型"+l.type),!p&&!c||!h)continue;const f=[];if(!p){const g=(l.source&&t.sources[l.source].type)=="geojson"?"_geojsonTileLayer":l.sourceLayer,A=c.layers[g];if(!A)continue;const v=A.length;for(let b=0;b<v;b++){const C=A.feature(b);l.filter&&!l.filter.filter({zoom:this.z},C)||(C.toGeoJSON||(C.toGeoJSON=Yn.prototype.toGeoJSON),f.push(C))}if(!f.length)continue}const m=new h(f,l,this);if(o.push(m),u){let y=a[l.type];y||(y=new u(this),a[l.type]=y,r.push(y)),y.addLayer(f,m,e,t)}}this.state="ready"}createRenderLayersFromWorkerResult(e,t,n){if(e.error){this.state="error";return}const s=n._styleLayers,o=this.layers,r=this.visualizers,a={};for(const l of e.fill||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.fill,u=ms.fill,p=new h([],c,this);o.push(p);let f=a.fill;f||(f=new u(this),a.fill=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}for(const l of e.line||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.line,u=ms.line,p=new h([],c,this);o.push(p);let f=a.line;f||(f=new u(this),a.line=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}for(const l of e.symbol||[]){const c=s.find(m=>m.id===l.layerId);if(!c)continue;const h=ps.symbol,u=ms.symbol,p=new h([],c,this);o.push(p);let f=a.symbol;f||(f=new u(this),a.symbol=f,r.push(f)),f.addLayerFromWorkerResult(l,p,t,n)}this.state="ready"}update(e,t,n){this.primitive||(this.primitive=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({flat:!0,translucent:!1,material:Cesium.Material.fromType("Color",{color:Cesium.Color.fromAlpha(this.tileId.tileColor,.25)}),renderState:{blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!1}}})}),this.primitive.name="_tile-color_");const s=this.commandList||[],o=this.tileIdCommands||[],r=this.tileDepthCommands||[];if(!s.length){const a=e.commandList;if(e.commandList=s,this.primitive.update(e),s.length){const l=this.tileId.color;for(const c of s){c.pass=Cesium.Pass.CESIUM_3D_TILE;const h=Cesium.DrawCommand.shallowClone(c);h.renderState=Cesium.RenderState.fromCache({id:"tileId",blending:{enabled:!1},depthTest:{enabled:!1},depthMask:!0,cull:{enabled:!0}}),h.layerType="tile-id",h.uniformMap={...c.uniformMap},h.uniformMap.color_0=function(){return l},o.push(h);const u=Cesium.DrawCommand.shallowClone(c);u.pass=Cesium.Pass.CESIUM_3D_TILE,u.renderState=Ud,r.layerType="tile-depth",r.push(u)}this.tileIdCommands=o,this.tileDepthCommands=r}this.commandList=s,e.commandList=a}if(n.showTileColor&&s.length&&t.tileCommands.push(...s),this.state=="none"&&n.numLoading<=n.maxLoading&&(n.numLoading++,this.state="loading",this.getSources(n)),this.state==="loaded"&&n.numInitializing<n.maxInitializing)if(this._workerBuffers&&n._taskProcessor){const a={sources:{},x:this.x,y:this.y,z:this.z,extent:Tt,styleLayers:n._styleLayers.map(h=>({id:h.id,type:h.type,source:h.source,sourceLayer:h.sourceLayer??h.data["source-layer"],filter:h.data.filter,paint:h.data.paint,layout:h.data.layout}))},l=[];for(const h in this.sources){const u=this.sources[h];u&&u.buffer&&(a.sources[h]={buffer:u.buffer,encoding:u.encoding||"mvt"},l.push(u.buffer))}const c=n._taskProcessor.scheduleTask(a,l);Cesium.defined(c)&&(this.state="initializing",n.numInitializing++,c.then(h=>{this.createRenderLayersFromWorkerResult(h,e,n)}).catch(()=>{this.state="error"}))}else this.state="initializing",n.numInitializing++,this.createRenderLayers(e,n);if(this.state==="ready"){let a=!0,l=!0;for(const c of this.visualizers)c.update(e,n),c.state==="none"&&(a=!1);for(const c of this.layers)c.update(e,n),c.visibility!="none"&&c.state=="none"&&(l=!1);this.renderable=a&&l}}render(e,t,n){if(!this.renderable)return;this.commandList;const s=this.tileIdCommands,o=this.tileDepthCommands;for(const r of this.layers)t.push(r);for(const r of this.visualizers)t.visualizers.push(r);for(const r of s)t.tileIdCommands.push(r);o.length&&t.tileCommands.push(...o)}unload(){this.primitive&&(this.primitive.destroy(),this.primitive=null),this.tileGeometry=null,this.commandList&&(this.commandList.length=0),this.tileIdCommands&&(this.tileIdCommands.length=0),this.tileDepthCommands&&(this.tileDepthCommands.length=0);for(const e of this.visualizers)e.destroy();this.visualizers.length=0;for(const e of this.layers)e.destroy();this.layers.length=0,this.sources={},this.state="none"}destroy(){if(this.unload(),this.tileId=null,this.tilingScheme=null,this.parent=null,this.children){for(const e of this.children)e.destroy();this.children.length=0,this.children=null}}}function Pa(i,e){let t=!0;return i==="always"||(i==="never"||e==="never")&&(t=!1),t}class jG{constructor(e,t,n){const s=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let r=0;r<this.xCellCount*this.yCellCount;r++)s.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,s,o){this._forEachCell(t,n,s,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(o)}insertCircle(e,t,n,s){this._forEachCell(t-s,n-s,t+s,n+s,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(s)}_insertBoxCell(e,t,n,s,o,r){this.boxCells[o].push(r)}_insertCircleCell(e,t,n,s,o,r){this.circleCells[o].push(r)}_query(e,t,n,s,o,r,a){if(n<0||e>this.width||s<0||t>this.height)return[];const l=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=s){if(o)return[{key:null,x1:e,y1:t,x2:n,y2:s}];for(let c=0;c<this.boxKeys.length;c++)l.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){const h=this.circles[c*3],u=this.circles[c*3+1],p=this.circles[c*3+2];l.push({key:this.circleKeys[c],x1:h-p,y1:u-p,x2:h+p,y2:u+p})}}else{const c={hitTest:o,overlapMode:r,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,n,s,this._queryCell,l,c,a)}return l}query(e,t,n,s){return this._query(e,t,n,s,!1,null)}hitTest(e,t,n,s,o,r){return this._query(e,t,n,s,!0,o,r).length>0}hitTestCircle(e,t,n,s,o){const r=e-n,a=e+n,l=t-n,c=t+n;if(a<0||r>this.width||c<0||l>this.height)return!1;const h=[],u={hitTest:!0,overlapMode:s,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(r,l,a,c,this._queryCellCircle,h,u,o),h.length>0}_queryCell(e,t,n,s,o,r,a,l){const{seenUids:c,hitTest:h,overlapMode:u}=a,p=this.boxCells[o],f=1e-6;if(p!==null){const y=this.bboxes;for(const g of p)if(!c.box[g]){c.box[g]=!0;const A=g*4,v=this.boxKeys[g];if(e<=y[A+2]+f&&t<=y[A+3]+f&&n>=y[A+0]-f&&s>=y[A+1]-f&&(!l||l(v))&&(!h||!Pa(u,v.overlapMode))&&(r.push({key:v,x1:y[A],y1:y[A+1],x2:y[A+2],y2:y[A+3]}),h))return!0}}const m=this.circleCells[o];if(m!==null){const y=this.circles;for(const g of m)if(!c.circle[g]){c.circle[g]=!0;const A=g*3,v=this.circleKeys[g];if(this._circleAndRectCollide(y[A],y[A+1],y[A+2],e,t,n,s)&&(!l||l(v))&&(!h||!Pa(u,v.overlapMode))){const b=y[A],C=y[A+1],x=y[A+2];if(r.push({key:v,x1:b-x,y1:C-x,x2:b+x,y2:C+x}),h)return!0}}}return!1}_queryCellCircle(e,t,n,s,o,r,a,l){const{circle:c,seenUids:h,overlapMode:u}=a,p=this.boxCells[o];if(p!==null){const m=this.bboxes;for(const y of p)if(!h.box[y]){h.box[y]=!0;const g=y*4,A=this.boxKeys[y];if(this._circleAndRectCollide(c.x,c.y,c.radius,m[g+0],m[g+1],m[g+2],m[g+3])&&(!l||l(A))&&!Pa(u,A.overlapMode))return r.push(!0),!0}}const f=this.circleCells[o];if(f!==null){const m=this.circles;for(const y of f)if(!h.circle[y]){h.circle[y]=!0;const g=y*3,A=this.circleKeys[y];if(this._circlesCollide(m[g],m[g+1],m[g+2],c.x,c.y,c.radius)&&(!l||l(A))&&!Pa(u,A.overlapMode))return r.push(!0),!0}}}_forEachCell(e,t,n,s,o,r,a,l){const c=this._convertToXCellCoord(e),h=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),p=this._convertToYCellCoord(s);for(let f=c;f<=u;f++)for(let m=h;m<=p;m++){const y=this.xCellCount*m+f;if(o.call(this,e,t,n,s,y,r,a,l))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,s,o,r){const a=s-e,l=o-t,c=n+r;return c*c>a*a+l*l}_circleAndRectCollide(e,t,n,s,o,r,a){const l=(r-s)/2,c=Math.abs(e-(s+l));if(c>l+n)return!1;const h=(a-o)/2,u=Math.abs(t-(o+h));if(u>h+n)return!1;if(c<=l||u<=h)return!0;const p=c-l,f=u-h;return p*p+f*f<=n*n}}const q0=100;let K0=null,X0=null;class WG{constructor(){K0=new Cesium.Cartesian2,X0=new Cesium.BoundingRectangle}update(e,t,n){const s=e.context.drawingBufferWidth/e.pixelRatio,o=e.context.drawingBufferHeight/e.pixelRatio,r=e.camera._scene,a=new jG(s+2*q0,o+2*q0,25);for(const l of t){const c=l.style,h=l.labels;if(l.type!=="symbol"||l.visibility==="none"||n<c.minzoom||n>=c.maxzoom||!Cesium.defined(h)||!h.length)continue;const u=c.layout.getDataConstValue("text-allow-overlap",l.tile.z),p=c.layout.getDataConstValue("text-overlap",l.tile.z),f=qG(p,u),m=c.layout.getDataConstValue("text-padding",l.tile.z);for(const y of h){const g=y.computeScreenSpacePosition(r,K0);if(!g){y.vtPlaceable=!0;continue}const A=Cesium.Label.getScreenSpaceBoundingBox(y,g,X0),v=A.x-m,b=A.y-m,C=v+A.width+m,x=b+A.height+m;if(a.hitTest(v,b,C,x,f,null))y.vtPlaceable=!1;else{const I={overlapMode:f};a.insert(I,v,b,C,x),y.vtPlaceable=!0}}}}}function qG(i,e){let t="never";return i?t=i:e&&(t="always"),t}class KG{constructor(e){this.maximumLevel=24,this.show=!0,this.showTileColor=!!e.showTileColor,this.ready=!1,this.tilingScheme=new Cesium.WebMercatorTilingScheme,this.readyEvent=new Cesium.Event,this.errorEvent=new Cesium.Event,this._styleJson=null,this._style=e.style,this._rootTiles=[],this._cacheTiles=[],this._tilesToUpdate=[],this._tilesToRender=[],this._styleLayers=[],this._styleLayerIndexMap=new Map,this._renderList=new O0(this._styleLayers),this.numLoading=0,this.maxLoading=6,this.numInitializing=0,this.maxInitializing=6,this._taskProcessor=null,this._workerUrl=e.workerUrl||null,this._maximumActiveTasks=e.maximumActiveTasks??4,this.tileIdTexture=null,this.zoom=0,this._symbolPlacements=new WG,requestAnimationFrame(()=>{this.init()})}async init(){let e=this._style;if(!e){this.errorEvent.raiseEvent(new Error("请传入 style 参数"));return}this.path="",typeof e=="string"&&(this.path=e.split("/").slice(0,-1).join("/"),this.path&&(this.path+="/"),e=await Cesium.Resource.fetchJson(e)),this.sources={};for(const r in e.sources){const a=e.sources[r],l=xc[a.type];if(l){this.sources[r]=new l(a,this.path);try{await this.sources[r].init(),this.maximumLevel=Math.min(a.maxzoom||24,this.maximumLevel)}catch(c){this.errorEvent.raiseEvent(c)}}}for(let r=0;r<e.layers.length;r++)this._styleLayers[r]=new F0(e.layers[r]),this._styleLayerIndexMap.set(e.layers[r].id,r);const t=this.tilingScheme.getNumberOfXTilesAtLevel(0),n=this.tilingScheme.getNumberOfYTilesAtLevel(0);let s=0;for(let r=0;r<n;r++)for(let a=0;a<t;a++){var o=new ka({parent:this,x:a,y:r,z:0,tilingScheme:this.tilingScheme});o.createChildren(),this._rootTiles[s++]=o}this._renderList.init(),this._workerUrl&&typeof Cesium.TaskProcessor<"u"&&(this._taskProcessor=new Cesium.TaskProcessor(this._workerUrl,Math.min(this._maximumActiveTasks,this.maxInitializing))),this._styleJson=e,this.ready=!0,this.readyEvent.raiseEvent(this)}executeTileIdCommands(e){const t=this._renderList.tileIdCommands;if(t.length>0){const n=e.context;let s=this._tileIdFbo;s||(s=new Cesium.FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._tileIdFbo=s,this._idClearCommand=new Cesium.ClearCommand({color:new Cesium.Color(0,0,0,0),depth:1,stencil:0}));const o=n.floatingPointTexture?Cesium.PixelDatatype.FLOAT:Cesium.PixelDatatype.UNSIGNED_BYTE,r=n.drawingBufferWidth,a=n.drawingBufferHeight;s.update(n,r,a,1,o),s.clear(n,this._idClearCommand);const l=s.framebuffer;for(const c of t)c.framebuffer=l,c.execute(n);this.tileIdTexture=s.getColorTexture(0)}}update(e){if(!this.ready||!this.show)return;e.context.webgl2&&ze("webgl2模式下贴地线面的支持将导致性能下降");const t=this._renderList;t.beginFrame(),this.numInitializing=0;const n=e.camera._scene,o=n.globe._surface._debug.suspendLodUpdate;this.scene=n;const r=XG(e,this);o||r.sort((h,u)=>h.distanceToCamera-u.distanceToCamera);for(const h of r)h.lastVisitTime=e.frameNumber,h.expired=!1,h.update(e,t,this);const a=o?this._tilesToRender:JG(r,this._tilesToRender);o||a.sort((h,u)=>h.distanceToCamera-u.distanceToCamera);for(const h of a)h.lastVisitTime=e.frameNumber,h.expired=!1,h.render(e,t,this);const l=t.getList();this._symbolPlacements.update(e,l,this.zoom);for(const h of l)h.render(e,this);for(const h of t.visualizers)h.render(e,this);e.commandList.push(...t.tileCommands),this.executeTileIdCommands(e);const c=[];for(const h of this._cacheTiles)h.lastVisitTime<e.frameNumber&&(h.expired||c.push(h));if(c.sort((h,u)=>h.lastVisitTime-u.lastVisitTime),c.length>100){for(const h of c)if(h.unload(),h.expired=!0,c.length<=50)break}}setLayoutProperty(e,t,n){const s=this._styleLayerIndexMap;if(!s.has(e))return ze(`不存在图层:${e}`),!1;const o=s.get(e),a=this._styleLayers[o].setLayoutProperty(t,n);return a&&t!=="visibility"&&this._forceUpdate(),a}setPaintProperty(e,t,n){const s=this._styleLayerIndexMap;if(!s.has(e))return ze(`不存在图层:${e}`),!1;const o=s.get(e);return this._styleLayers[o].setPaintProperty(t,n)}setFilter(e,t){const n=this._styleLayerIndexMap;if(!n.has(e))return ze(`不存在图层:${e}`),!1;const s=n.get(e),r=this._styleLayers[s].setFilter(t);return r&&this._forceUpdate(),r}_forceUpdate(){for(const e of this._cacheTiles)e.unload();for(const e of this._tilesToRender)e.unload();for(const e of this._tilesToUpdate)e.unload();this._tilesToRender.length=0,this._tilesToUpdate.length=0}destroy(){const e=this.scene,t=this._rootTiles;if(this.scene=null,e&&e.primitives.contains(this)&&e.primitives.remove(this),t){for(const n of t)n.destroy();t.length=0,this._rootTiles=null}if(this._cacheTiles&&(this._cacheTiles.length=0,this._cacheTiles=null),this.sources){for(const n in this.sources)Object.hasOwnProperty.call(this.sources,n)&&this.sources[n].destroy();this.sources=null}this._styleLayers=null,this._renderList&&(this._renderList.destroy(),this._renderList=null),this._taskProcessor&&!this._taskProcessor.isDestroyed()&&(this._taskProcessor.destroy(),this._taskProcessor=null),this._tilesToUpdate&&(this._tilesToUpdate.length=0,this._tilesToUpdate=null),this._tilesToRender&&(this._tilesToRender.length=0,this._tilesToRender=null),this._tileIdFbo&&(this._tileIdFbo.destroy(),this.tileIdTexture=null,this._tileIdFbo=null,this._idClearCommand=null),this._styleJson=null}isDestroyed(){return!1}}function XG(i,e){const t=[...e._rootTiles],n=e._tilesToUpdate;let s=24,o=1/0;const r={visitChildren(a){if(a.z>=e.maximumLevel)return a.distanceToCamera<o&&(o=a.distanceToCamera,s=a.z),n.push(a);if(a.children.length==0){a.createChildren();for(const l of a.children)e._cacheTiles.push(l)}for(const l of a.children)t.push(l)},accept(a){a.distanceToCamera<o&&(o=a.distanceToCamera,s=a.z),n.push(a)}};n.length=0;do t.shift().visit(i,r);while(t.length>0);return e.zoom=s,n}function JG(i,e){const t=new Map;for(const o of i)o.renderable&&t.set(o,!0);const n=[];for(let o=0;o<e.length;o++){const r=e[o];if(r.renderable=t.has(r),r.renderable)continue;const a={tiles:[],total:0,renderable:0};n[o]=a;for(const l of i){const c=l.z-r.z;if(c!==0)if(c>0){const h=Math.pow(2,c),u=Math.floor(l.x/h),p=Math.floor(l.y/h);u===r.x&&p===r.y&&(a.total++,a.tiles.push(l),l.renderable&&a.renderable++)}else{const h=Math.pow(2,-c),u=Math.floor(r.x/h),p=Math.floor(r.y/h);u===l.x&&p===l.y&&(r.renderable=!l.renderable)}}}for(let o=0;o<e.length;o++){const r=e[o],a=n[o];if(a&&a.total){const l=a.total===a.renderable;r.renderable=!l;for(const c of a.tiles)c.renderable=l}}t.clear();let s=e.length;for(let o=0;o<s;o++){const r=e.shift();r.renderable&&(e.push(r),t.set(r,!0))}s=i.length;for(let o=0;o<s;o++){const r=i[o];r.renderable&&!t.has(r)&&(e.push(r),t.set(r,!0))}return e}class Po{constructor(e,t,n){this.sourceFeatures=e,this.style=t,this.tile=n,this.features=[],this.firstBatchId=-1,this.lastBatchId=-1,this.offsets=[],this.counts=[],this.commandList=[],this.visibility="visible",this.state="none",this.paintVersion=t.paintVersion}get id(){return this.style.id}get type(){return this.style.type}get paintNeedsUpdate(){return this.paintVersion!==this.style.paintVersion}set paintNeedsUpdate(e){e||(this.paintVersion=this.style.paintVersion)}update(e,t){const n=this.style.layout.getDataConstValue("visibility",this.tile.z);this.visibility=n}render(e,t){const n=this.style,s=t.zoom;if(this.visibility==="none"||s<n.minzoom||s>=n.maxzoom)return;const o=this.commandList;if(o&&o.length)for(const r of o)e.commandList.push(r)}isDestroyed(){return!1}destroy(){this.commandList&&(this.commandList.length=0),this.sourceFeatures&&(this.sourceFeatures.length=0),this.style=null,this.offsets=null,this.counts=null,this.tile=null,this.isDestroyed=function(){return!0}}}class Da{constructor(e,t=[]){this.tile=e,this.layers=t,this.state="none",this.commandList=[]}addLayer(e,t,n,s){}setState(e){for(const t of this.layers)t.state=e;this.state=e}update(e,t){}render(e){const t=this.commandList;if(t&&t.length)for(const n of t)e.commandList.push(n)}destroy(){this.tile=null,this.layers.length=0,this.isDestroyed=function(){return!0}}isDestroyed(){return!1}}const ps={},ms={};function Do(i,e,t){ps[i]=e,ms[i]=t}class J0 extends Po{createPrimitve(e,t){const n=this.style,s=this.tile,o=n.convertColor(n.paint.getDataConstValue("background-color",s.z)),r=n.paint.getDataConstValue("background-opacity",s.z);if(n.paint.getDataConstValue("background-pattern",s.z))return ze("background图层:不支持纹理填充");o.alpha*=r;const l=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.tile.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({translucent:!1,material:Cesium.Material.fromType("Color",{color:o}),flat:!0})});this.primitive=l}update(e,t){if(super.update(e,t),this.visibility!="none"){if(this.primitive||this.createPrimitve(e,t),this.primitive&&!this.commandList.length){const n=e.commandList,s=e.commandList=this.commandList;if(this.primitive.update(e),s.length>0){const o=Cesium.RenderState.fromCache({blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}});for(const r of s)r.renderState=o,r.pass=Cesium.Pass.CESIUM_3D_TILE;this.state="done"}this.primitive._state===Cesium.PrimitiveState.FAILED&&(this.state="error"),e.commandList=n}if(this.primitive&&this.paintNeedsUpdate){const n=this.style,s=this.tile,o=n.convertColor(n.paint.getDataConstValue("background-color",s.z)),r=n.paint.getDataConstValue("background-opacity",s.z);o.alpha*=r,this.primitive.appearance.material.uniforms.color=o,this.paintNeedsUpdate=!1}}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Do("background",J0);const Qd=Math.pow(2,15-1)-1,Z0=-Qd-1;function ey(i){const e=Tt/i.extent,t=i.loadGeometry();for(const n of t)for(const s of n){const o=Math.round(s.x*e),r=Math.round(s.y*e);s.x=L0(o,Z0,Qd),s.y=L0(r,Z0,Qd),(o<s.x||o>s.x+1||r<s.y||r>s.y+1)&&ze("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return t}class ZG extends Da{constructor(e,t){super(e,t),this.geometryInstances=[],this.outlineGeometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,n,s){const o=t.style,{tile:r,geometryInstances:a}=this,l=j0.globe.line.getGranularityForZoomLevel(r.z)/2,c=this;let h=0;const u=s.sources[t.style.source].styleSource.promoteId;for(const p of e){const f=Yn.types[p.type],m=p.properties;if(f!=="Polygon")continue;if(o.paint.getDataValue("fill-pattern",r.z,p)){ze("fill图层:不支持纹理填充(fill-pattern)");continue}const g=p.id||m[u],A=o.convertColor(o.paint.getDataValue("fill-color",r.z,p)),v=o.paint.getDataValue("fill-opacity",r.z,p),b=o.convertColor(o.paint.getDataValue("fill-outline-color",r.z,p))||A,C=ey(p),x=Hm(C);for(const I of x){if(I.some(w=>w.length<3))continue;const E=a.length;h==0&&(t.firstBatchId=E),t.lastBatchId=E;const S={coordinates:I,featureId:h,fillColor:A,fillOpacity:v,fillOutlineColor:b,properties:m,id:g,batchId:E};c.addFeature(S,l),t.features.push(S),h++}}t.offsets=[],t.counts=[],this.layers.push(t)}addLayerFromWorkerResult(e,t,n,s){const{batches:o,firstBatchId:r,lastBatchId:a}=e,l=this.geometryInstances,c=new Cesium.Cartesian3;for(const h of o){const{positions:u,normals:p,st:f,indices:m,colorBytes:y,id:g,properties:A}=h;u.length/3;const v=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:u},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:p},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:f}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:m,boundingSphere:Cesium.BoundingSphere.fromVertices(u)}),b=Cesium.Cartographic.fromCartesian(v.boundingSphere.center);b.height=0;const C=Cesium.Cartographic.toCartesian(b,null,c),x=new Cesium.GeometryInstance({geometry:v,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:Array.from(y)})},id:new Cesium.Entity({position:C,id:g,properties:A})});l.push(x)}t.firstBatchId=r,t.lastBatchId=a,t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e,t){const n=this.geometryInstances,s=this.outlineGeometryInstances,{coordinates:o,fillColor:r,fillOpacity:a,fillOutlineColor:l}=e,c=r.toBytes();c[3]=Math.floor(c[3]*a);const h=l.toBytes();h[3]=Math.floor(h[3]*a);const u=UG(o,this.tile,t,!0),p=u.verticesFlattened,f=[0,0],m=new Cesium.Cartesian3,y=p.length/2,g=new Float64Array(y*3),A=new Float32Array(y*3),v=new Float32Array(y*2);for(let _=0,F=0;_<p.length;_+=2,F++){const U=p[_],L=p[_+1],D=this.tile.transformPoint(U,L,f),M=Cesium.Cartesian3.fromDegrees(D[0],D[1],0,null,m);g[F*3]=M.x,g[F*3+1]=M.y,g[F*3+2]=M.z;const k=Cesium.Cartesian3.normalize(M,M);A[F*3]=k.x,A[F*3+1]=k.y,A[F*3+2]=k.z,v[F*2]=U/Tt,v[F*2+1]=L/Tt}const b=new(y>65535?Uint32Array:y>255?Uint16Array:Uint8Array)(u.indicesTriangles),C=new(y>65535?Uint32Array:y>255?Uint16Array:Uint8Array)(u.indicesLineList.flat(3)),x=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:g},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:A},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:v}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:b,boundingSphere:Cesium.BoundingSphere.fromVertices(g)}),I=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:g}},primitiveType:Cesium.PrimitiveType.LINES,indices:C,boundingSphere:Cesium.BoundingSphere.fromVertices(g)}),E=Cesium.Cartographic.fromCartesian(x.boundingSphere.center);E.height=0;const S=Cesium.Cartographic.toCartesian(E,null,m),w=new Cesium.GeometryInstance({geometry:x,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:c})},id:new Cesium.Entity({position:S,id:e.id,properties:e.properties})});n.push(w);const T=new Cesium.GeometryInstance({geometry:I,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:h})},id:new Cesium.Entity({position:S,id:e.id,properties:e.properties})});s.push(T)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!(this.geometryInstances[0].geometry instanceof Cesium.Geometry),appearance:new Cesium.PerInstanceColorAppearance({flat:!0,translucent:!1,renderState:{depthMask:!1},fragmentShaderSource:`
141
- in vec4 v_color;
142
-
143
- uniform vec4 tileId;
144
- uniform sampler2D tileIdTexture;
145
-
146
- void main()
147
- {
148
- vec2 id_st = gl_FragCoord.xy / czm_viewport.zw;
149
- vec4 bgId = texture(tileIdTexture, id_st);
150
- if (!all(equal(bgId, tileId)))
151
- {
152
- discard;
153
- }
154
- out_FragColor = v_color;
155
- }
156
- `})});let t=this;Object.defineProperties(e,{_geometries:{get(){return this._geometries_},set(n){this._geometries_=n,n?t.onGeometriesLoaded(n):t=null}},_batchTable:{get(){return this._batchTable_},set(n){this._batchTable_=n,n&&t.onBatchTableCreated(n)}}}),this.primitive=e}onGeometriesLoaded(e){for(let t=0;t<e.length;t++){const n={},s=e[t],o=s.attributes.batchId.values,r=s.indices;let a=-1,l=null;for(let c=0;c<r.length;c++){const h=r[c],u=o[h];a!==u&&(a=u,l=n[a]={begin:c,end:c}),l.end=c}for(const c of this.layers){const{firstBatchId:h,lastBatchId:u}=c;if(h===-1||u===-1)continue;let p=-1,f=-1;for(let m=h;m<=u;m++){const y=n[m];y&&(p===-1&&(p=y.begin),f=y.end)}p===-1||f===-1||(c.offsets[t]=p,c.counts[t]=f-p+1)}}}onBatchTableCreated(e){this._batchTable=e;for(const t of this.layers)t._batchTable=e}createOutlinePrimitive(){const e=new Cesium.Primitive({geometryInstances:this.outlineGeometryInstances,asynchronous:!(this.outlineGeometryInstances[0].geometry instanceof Cesium.Geometry),appearance:new Cesium.PerInstanceColorAppearance({flat:!0,translucent:!1,renderState:{depthMask:!1},fragmentShaderSource:`
157
- in vec4 v_color;
158
-
159
- uniform vec4 tileId;
160
- uniform sampler2D tileIdTexture;
161
-
162
- void main()
163
- {
164
- vec2 id_st = gl_FragCoord.xy / czm_viewport.zw;
165
- vec4 bgId = texture(tileIdTexture, id_st);
166
- if (!all(equal(bgId, tileId)))
167
- {
168
- discard;
169
- }
170
- out_FragColor = v_color;
171
- }
172
- `})});let t=this;Object.defineProperties(e,{_geometries:{get(){return this._geometries_},set(n){this._geometries_=n,n?t.onOutlineGeometriesLoaded(n):t=null}},_batchTable:{get(){return this._batchTable_},set(n){this._batchTable_=n,n&&t.onOutlineBatchTableCreated(n)}}}),this.outlinePrimitive=e}onOutlineGeometriesLoaded(e){for(let t=0;t<e.length;t++){const n={},s=e[t],o=s.attributes.batchId.values,r=s.indices;let a=-1,l=null;for(let c=0;c<r.length;c++){const h=r[c],u=o[h];a!==u&&(a=u,l=n[a]={begin:c,end:c}),l.end=c}for(const c of this.layers){const{firstBatchId:h,lastBatchId:u}=c;if(h===-1||u===-1)continue;let p=-1,f=-1;for(let m=h;m<=u;m++){const y=n[m];y&&(p===-1&&(p=y.begin),f=y.end)}p===-1||f===-1||(c.outlineOffsets[t]=p,c.outlineCounts[t]=f-p+1)}}}onOutlineBatchTableCreated(e){this._outlineBatchTable=e;for(const t of this.layers)t._outlineBatchTable=e}createLayerCommands(e,t){const n=Cesium.RenderState.fromCache({id:"fill",blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}}),s=this.tile.tileId;this.renderState=n;for(let o=0;o<this.layers.length;o++){const r=this.layers[o],a=r.commandList=[],l={fill:0,outline:0};for(let c=0;c<e.length;c++){const h=e[c];let u,p,f;h.primitiveType==Cesium.PrimitiveType.LINES?(u=l.outline++,p=r.outlineOffsets,f=r.outlineCounts):(u=l.fill++,p=r.offsets,f=r.counts);const m=p[u],y=f[u];if(typeof m!="number"||typeof y!="number")continue;h.uniformMap.tileIdTexture=function(){return t.tileIdTexture},h.uniformMap.tileId=function(){return s.color},h.pass=Cesium.Pass.CESIUM_3D_TILE;const g=Cesium.DrawCommand.shallowClone(h);g.pass=Cesium.Pass.CESIUM_3D_TILE,g.renderState=n,g.layerType="fill",g.offset=m,g.count=y,a.push(g)}r.state="done"}this.state="done"}update(e,t){if(this.geometryInstances){if(super.update(e,t),!this.primitive&&this.geometryInstances.length&&(this.createPrimitive(),this.createOutlinePrimitive()),this.primitive&&this.state!=="done"&&this.state!=="error"){const n=e.commandList,s=e.commandList=[];try{this.primitive.update(e),this.outlinePrimitive.update(e)}catch(o){this.geometryInstances=[],this.outlineGeometryInstances=[],this.setState("error"),o.stack?console.trace(o.stack):console.error(o);return}finally{e.commandList=n}s.length>0&&this.createLayerCommands(s,t),(this.primitive._state===Cesium.PrimitiveState.FAILED||this.outlinePrimitive._state===Cesium.PrimitiveState.FAILED)&&this.setState("error"),this.geometryInstances=[]}this._batchTable&&this._batchTable._batchValuesDirty&&this._batchTable.update(e),this._outlineBatchTable&&this._outlineBatchTable._batchValuesDirty&&this._outlineBatchTable.update(e)}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class ty extends Po{constructor(e,t,n){super(e,t,n),this.outlineOffsets=[],this.outlineCounts=[]}update(e,t){if(this.paintNeedsUpdate){const n=this.style,s=this.tile,o=this._batchTable;for(const r of this.features){const a=n.convertColor(n.paint.getDataValue("fill-color",s.z,r)),l=n.paint.getDataValue("fill-opacity",s.z,r);r.fillColor=a,r.fillOpacity=l;const c=r.batchId,h=a.toBytes();h[3]=Math.floor(h[3]*l),o.setBatchedAttribute(c,0,{x:h[0],y:h[1],z:h[2],w:h[3]})}this.paintNeedsUpdate=!1}super.update(e,t)}}Do("fill",ty,ZG);const eU=Yn.prototype.toGeoJSON;class tU extends Da{constructor(e,t){super(e,t),this.geometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,n,s){const o=t.style,{tile:r,geometryInstances:a}=this,l=j0.globe.line.getGranularityForZoomLevel(r.z),c=this,h=s.sources[t.style.source].styleSource.promoteId;let u=0;const p=o.paint.getDataConstValue("line-dasharray",r.z);if(p&&p.length){p.length%2>0&&p.push(0),t.dashLength=0;for(let m=0;m<p.length;m++)t.dashLength+=p[m];t.dasharray=p,p.length>8&&ze("line图层:line-dasharray 超过最大长度(8)")}function f(m,y,g,A,v,b){if(m.length<2)return;const C=a.length;u==0&&(t.firstBatchId=C),t.lastBatchId=C;const x={coordinates:m,featureId:u,lineColor:g,lineOpacity:A,lineWidth:y,properties:b,id:v,batchId:C};c.addFeature(x),t.features.push(x),u++}for(const m of e){const y=Yn.types[m.type];if(y==="Point"||y==="Unknown")continue;const g=m.properties,A=ey(m);for(let F=0;F<A.length;F++)A[F]=$0(A[F],l);const v=eU.call({extent:Tt,type:m.type,properties:g,loadGeometry(){return A}},r.x,r.y,r.z);if(!v.geometry)continue;const b=m.id||g[h],C=o.paint.getDataValue("line-width",r.z,m),x=o.convertColor(o.paint.getDataValue("line-color",r.z,m)),I=o.paint.getDataValue("line-opacity",r.z,m);if(o.paint.getDataValue("line-pattern",r.z,m)){ze("line图层:不支持纹理填充(line-pattern)");continue}const S=o.paint.getDataValue("line-join",r.z,m),w=o.paint.getDataValue("line-cap",r.z,m);S!=="miter"&&ze("line图层:line-join 仅支持 miter 模式"),w!=="butt"&&ze("line图层:line-cap 仅支持 butt 模式");const T=v.geometry.type,_=v.geometry.coordinates;if(T=="LineString")f(_,C,x,I,b,g);else if(T=="MultiLineString"||T=="Polygon")for(const F of _)f(F,C,x,I,b,g);else if(T=="MultiPolygon")for(const F of _)for(const U of F)f(U,C,x,I,b,g);else ze("line图层:不支持几何类型:"+T)}t.offsets=[],t.counts=[],this.layers.push(t)}addLayerFromWorkerResult(e,t,n,s){const{batches:o,firstBatchId:r,lastBatchId:a}=e,l=this.geometryInstances;for(const c of o){const{positions:h,colorBytes:u,lineWidth:p,id:f,properties:m}=c,y=[];for(let C=0;C<h.length;C+=3)y.push(new Cesium.Cartesian3(h[C],h[C+1],h[C+2]));const g=Cesium.BoundingSphere.fromPoints(y),A=Cesium.Cartographic.fromCartesian(g.center);A.height=0;const v=Cesium.Cartographic.toCartesian(A,null,new Cesium.Cartesian3),b=new Cesium.GeometryInstance({geometry:new Cesium.PolylineGeometry({positions:y,width:p}),attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:Array.from(u)})},id:new Cesium.Entity({position:v,id:f,properties:m})});l.push(b)}t.firstBatchId=r,t.lastBatchId=a,t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e){const t=this.geometryInstances,{coordinates:n,lineColor:s,lineWidth:o,lineOpacity:r}=e,a=s.toBytes();a[3]=Math.floor(a[3]*r);const l=n.map(f=>Cesium.Cartesian3.fromDegrees(f[0],f[1])),c=Cesium.BoundingSphere.fromPoints(l),h=Cesium.Cartographic.fromCartesian(c.center);h.height=0;const u=Cesium.Cartographic.toCartesian(h,null,new Cesium.Cartesian3),p=new Cesium.GeometryInstance({geometry:new Cesium.PolylineGeometry({positions:l,width:o}),attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:a})},id:new Cesium.Entity({position:u,id:e.id,properties:e.properties})});t.push(p)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!0,appearance:new Cesium.PolylineMaterialAppearance({flat:!0,translucent:!1,vertexShaderSource:`
173
- ${Cesium._shadersPolylineCommon}
174
-
175
- in vec4 color;
176
- out vec4 v_color;
177
- in vec3 position3DHigh;
178
- in vec3 position3DLow;
179
- in vec3 prevPosition3DHigh;
180
- in vec3 prevPosition3DLow;
181
- in vec3 nextPosition3DHigh;
182
- in vec3 nextPosition3DLow;
183
- in vec2 expandAndWidth;
184
- in vec2 st;
185
- in float batchId;
186
-
187
- out float v_width;
188
- out vec2 v_st;
189
- out float v_polylineAngle;
190
-
191
- void main()
192
- {
193
- float expandDir = expandAndWidth.x;
194
- float width = abs(expandAndWidth.y) + 0.5;
195
- bool usePrev = expandAndWidth.y < 0.0;
196
-
197
- vec4 p = czm_computePosition();
198
- vec4 prev = czm_computePrevPosition();
199
- vec4 next = czm_computeNextPosition();
200
-
201
- float angle;
202
- vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
203
- gl_Position = czm_viewportOrthographic * positionWC;
204
-
205
- v_width = width;
206
- v_st.s = st.s;
207
- v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
208
- v_polylineAngle = angle;
209
- v_color = color;
210
- }
211
- `,fragmentShaderSource:`
212
- in vec2 v_st;
213
-
214
- uniform vec4 tileId;
215
- uniform sampler2D tileIdTexture;
216
-
217
- void main()
218
- {
219
- vec2 id_st = gl_FragCoord.xy / czm_viewport.zw;
220
- vec4 bgId = texture(tileIdTexture, id_st);
221
- if (all(equal(bgId, tileId)) == false)
222
- {
223
- discard;
224
- }
225
-
226
- czm_materialInput materialInput;
227
-
228
- vec2 st = v_st;
229
- st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);
230
-
231
- materialInput.s = st.s;
232
- materialInput.st = st;
233
- materialInput.str = vec3(st, 0.0);
234
-
235
- czm_material material = czm_getMaterial(materialInput);
236
- out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
237
-
238
- czm_writeLogDepth();
239
- }
240
- `,material:new Cesium.Material({fabric:{source:`
241
- const int maxArrayLength = 8;
242
-
243
- in float v_width;
244
- in vec4 v_color;
245
- uniform float dashLength;
246
- uniform float arrayLength;
247
- uniform float dasharray[maxArrayLength];
248
- in float v_polylineAngle;
249
-
250
- mat2 rotate(float rad) {
251
- float c = cos(rad);
252
- float s = sin(rad);
253
- return mat2(
254
- c, s,
255
- -s, c
256
- );
257
- }
258
-
259
- czm_material czm_getMaterial(czm_materialInput materialInput)
260
- {
261
- czm_material material = czm_getDefaultMaterial(materialInput);
262
-
263
- vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
264
-
265
- // Get the relative position within the dash from 0 to 1
266
- float dashPosition = fract(pos.x / (v_width * dashLength * czm_pixelRatio));
267
-
268
- float currDashPos = 0.;
269
- for (int i = 0; i < maxArrayLength; i += 2) {
270
- if(float(i) >= arrayLength) break;
271
-
272
- float gapStart = currDashPos + dasharray[i] / dashLength;
273
- float gapEnd = gapStart + dasharray[i + 1] / dashLength;
274
-
275
- if(dashPosition > gapStart && dashPosition < gapEnd) {
276
- discard;
277
- break;
278
- }
279
-
280
- currDashPos = gapEnd;
281
- }
282
-
283
- vec4 fragColor = v_color;
284
- fragColor = czm_gammaCorrect(fragColor);
285
- material.emission = fragColor.rgb;
286
- material.alpha = fragColor.a;
287
- return material;
288
- }
289
- `}})})});let t=this;Object.defineProperties(e,{_geometries:{get(){return this._geometries_},set(n){this._geometries_=n,n?t.onGeometriesLoaded(n):t=null}},_batchTable:{get(){return this._batchTable_},set(n){this._batchTable_=n,n&&t.onBatchTableCreated(n)}}}),this.primitive=e}onGeometriesLoaded(e){for(let t=0;t<e.length;t++){const n={},s=e[t],o=s.attributes.batchId.values,r=s.indices;let a=-1,l=null;for(let c=0;c<r.length;c++){const h=r[c],u=o[h];a!==u&&(a=u,l=n[a]={begin:c,end:c}),l.end=c}for(const c of this.layers){const{firstBatchId:h,lastBatchId:u}=c;if(h===-1||u===-1)continue;let p=-1,f=-1;for(let m=h;m<=u;m++){const y=n[m];y&&(p===-1&&(p=y.begin),f=y.end)}p===-1||f===-1||(c.offsets[t]=p,c.counts[t]=f-p+1)}}}onBatchTableCreated(e){this._batchTable=e;for(const t of this.layers)t._batchTable=e}createLayerCommands(e,t){const n=Cesium.RenderState.fromCache({id:"line",blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0},colorMask:{red:!0,green:!0,blue:!0,alpha:!0}}),s=this.tile.tileId;function o(r,a){return r={...r},r.tileIdTexture=function(){return t.tileIdTexture},r.tileId=function(){return s.color},r.dasharray=function(){return a.dasharray},r.dashLength=function(){return a.dashLength},r.arrayLength=function(){return a.dasharray.length},r}for(let r=0;r<this.layers.length;r++){const a=this.layers[r],l=a.commandList=[];for(let c=0;c<e.length;c++){const h=a.offsets[c],u=a.counts[c];if(typeof h!="number"||typeof u!="number")continue;const p=e[c],f=Cesium.DrawCommand.shallowClone(p);f.pass=Cesium.Pass.CESIUM_3D_TILE,f.uniformMap=o(f.uniformMap,a),f.renderState=n,f.offset=h,f.count=u,l.push(f)}a.state="done"}this.state="done"}update(e,t){if(this.geometryInstances){if(super.update(e,t),!this.primitive&&this.geometryInstances.length&&this.createPrimitive(),this.primitive&&this.state!=="done"&&this.state!=="error"){const n=e.commandList,s=e.commandList=[];try{this.primitive.update(e)}catch(o){this.geometryInstances=[],this.setState("error"),o.stack?console.trace(o.stack):console.error(o);return}finally{e.commandList=n}s.length>0&&this.createLayerCommands(s,t),this.primitive._state===Cesium.PrimitiveState.FAILED&&this.setState("error"),this.geometryInstances=[]}this.primitive&&e.camera.pitch>-1.309&&ze("line图层:不支持透视,建议保持相机俯仰角(pitch)小于 -75 度"),this._batchTable&&this._batchTable._batchValuesDirty&&this._batchTable.update(e)}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class iy extends Po{constructor(e,t,n){super(e,t,n),this.primitive=null,this.dasharray=[],this.dashLength=0}createPrimitve(e,t){const n=new Cesium.PolylineCollection,s=this.sourceFeatures,o=this.style,r=this.tile;function a(l,c,h){if(l.length<2)return;const u=l.map(p=>Cesium.Cartesian3.fromDegrees(p[0],p[1]));n.add({positions:u,width:c,material:Cesium.Material.fromType("Color",{color:o.convertColor(h)})})}for(const l of s){const c=l.toGeoJSON(r.x,r.y,r.z);if(!c.geometry)continue;const h=o.paint.getDataValue("line-width",r.z,l),u=o.paint.getDataValue("line-color",r.z,l),p=c.geometry.type,f=c.geometry.coordinates;if(p=="LineString")a(f,h,u);else if(p=="MultiLineString"||p=="Polygon")for(const m of f)a(m,h,u);else if(p=="MultiPolygon")for(const m of f)for(const y of m)a(y,h,u);else""+p}this.primitive=n}update(e,t){if(this.paintNeedsUpdate){const n=this.style,s=this.tile,o=this._batchTable;for(const r of this.features){const a=n.paint.getDataValue("line-width",s.z,r),l=n.convertColor(n.paint.getDataValue("line-color",s.z,r)),c=n.paint.getDataValue("line-opacity",s.z,r);a!==r.lineWidth&&ze("不支持动态修改 line 图层样式属性:line-width"),r.lineColor=l,r.lineOpacity=c,r.lineWidth=a;const h=r.batchId,u=l.toBytes();u[3]=Math.floor(u[3]*c),o.setBatchedAttribute(h,0,{x:u[0],y:u[1],z:u[2],w:u[3]})}this.paintNeedsUpdate=!1}super.update(e,t)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Do("line",iy,tU);let zd=null,ny=null;const iU=.1;class nU extends Da{constructor(e,t){zd===null&&(zd=new Cesium.Cartesian3,ny=new Cesium.Cartesian3),super(e,t),this.labels=[],this.primitive=null,this.dotCutOff=.0035}isOccluded(e,t){const n=Cesium.Cartesian3.subtract(e,t,zd);Cesium.Cartesian3.normalize(n,n);const s=Cesium.Cartesian3.normalize(t,ny);return Cesium.Cartesian3.dot(n,s)<this.dotCutOff}addLayer(e,t,n,s){const o=t.style,{tile:r,labels:a}=this,l=r.rectangle;function c(h,u,p,f,m,y,g,A,v,b){if(!Cesium.Rectangle.contains(l,Cesium.Cartographic.fromDegrees(h[0],h[1]))||!u)return;const C=new Cesium.Label({position:Cesium.Cartesian3.fromDegrees(h[0],h[1]),text:u,font:f+"px "+p,fillColor:m,style:y&&Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:y*f,outlineColor:g,disableDepthTestDistance:1/0,pixelOffset:new Cesium.Cartesian2(A[0]*f,A[1]*f),horizontalOrigin:v.horizontal,verticalOrigin:v.vertical});C._baseFillColor=C.fillColor.clone(),C._baseOutlineColor=C.outlineColor.clone(),C.vtAlpha=0,C.batchId=a.length,a.push(C),t.labels.push(C),t.features.push({text:u,font:p,textSize:f,textColor:m,outlineWidth:y,outlineColor:g,textOffset:A,textOrigin:v,properties:b})}for(const h of e){const u=h.toGeoJSON(r.x,r.y,r.z);if(!u.geometry)continue;const p=h.properties,f=o.layout.getDataValue("icon-image",r.z,h),m=o.layout.getDataValue("text-field",r.z,h);let y=m;if(typeof y=="string")y=o.layout.resolveTokens(p,m);else if(y&&y.sections){for(const L of y.sections)L.text=o.layout.resolveTokens(p,L.text);y=y.toString()}if(f){ze("symbol图层:不支持图标");continue}if(!y)continue;const g=o.layout.getDataValue("text-transform",r.z,h);g==="uppercase"?y=String(y).toUpperCase():g==="lowercase"&&(y=String(y).toLowerCase());const A=o.layout.getDataValue("text-max-width",r.z,h)*3,v=o.layout.getDataValue("text-rotation-alignment",r.z,h),b=o.layout.getDataValue("text-pitch-alignment",r.z,h);y.length>A&&ze("symbol图层: 不支持 text-max-width,无自动换行效果"),v==="map"&&ze("symbol图层:text-rotation-alignment 仅支持 viewport"),b==="map"&&ze("symbol图层:text-pitch-alignment 仅支持 viewport");const C=o.layout.getDataValue("text-font",r.z,h),x=o.layout.getDataValue("text-size",r.z,h),I=o.layout.getDataValue("text-anchor",r.z,h),E=sy(I),S=o.layout.getDataValue("text-offset",r.z,h),w=o.convertColor(o.paint.getDataValue("text-color",r.z,h)),T=o.convertColor(o.paint.getDataValue("text-halo-color",r.z,h)),_=o.paint.getDataValue("text-halo-width",r.z,h);if(!x||!isFinite(x)||Number(x)<=0)continue;const F=u.geometry.type,U=u.geometry.coordinates;F=="Point"?c(U,y,C,x,w,_,T,S,E,p):F=="MultiPoint"?U.forEach(L=>{c(L,y,C,x,w,_,T,S,E,p)}):ze("symbol图层:不支持符号沿线布局")}this.layers.push(t)}addLayerFromWorkerResult(e,t,n,s){const{placements:o}=e,{labels:r}=this,a=this.tile.rectangle;for(const l of o||[]){if(!Cesium.Rectangle.contains(a,Cesium.Cartographic.fromDegrees(l.coord[0],l.coord[1])))continue;const c=Cesium.Color.fromBytes(l.textColorBytes[0],l.textColorBytes[1],l.textColorBytes[2],l.textColorBytes[3]),h=Cesium.Color.fromBytes(l.outlineColorBytes[0],l.outlineColorBytes[1],l.outlineColorBytes[2],l.outlineColorBytes[3]),u=sy(l.textAnchor),p=new Cesium.Label({position:Cesium.Cartesian3.fromDegrees(l.coord[0],l.coord[1]),text:l.text,font:l.textSize+"px "+l.font,fillColor:c,style:l.outlineWidth>0?Cesium.LabelStyle.FILL_AND_OUTLINE:Cesium.LabelStyle.FILL,outlineWidth:l.outlineWidth*l.textSize,outlineColor:h,disableDepthTestDistance:1/0,pixelOffset:new Cesium.Cartesian2((l.textOffset[0]||0)*l.textSize,(l.textOffset[1]||0)*l.textSize),horizontalOrigin:u.horizontal,verticalOrigin:u.vertical});p._baseFillColor=p.fillColor.clone(),p._baseOutlineColor=p.outlineColor.clone(),p.vtAlpha=0,p.batchId=r.length,r.push(p),t.labels.push(p)}this.layers.push(t)}createPrimitive(){const e=new Cesium.LabelCollection;for(let n=0;n<this.labels.length;n++)this.labels[n]=e.add(this.labels[n]);const t=this.layers;for(const n of t)for(let s=0;s<n.labels.length;s++)n.labels[s]=this.labels[n.labels[s].batchId];this.primitive=e}update(e,t){if(this.state==="none")if(!this.primitive&&this.labels?.length&&this.createPrimitive(),this.primitive){this.commandList.length=0;const n=e.commandList;e.commandList=this.commandList,this.primitive.update(e),e.commandList=n;for(const s of this.labels){const o=s._glyphs;if(o){let r=s.text,a=[],l=[],c=!1;for(let h=0;h<o.length;h++){const u=o[h],p=u.dimensions;p&&isFinite(p.width)&&isFinite(p.height)?(l.push(r[h]),a.push(u)):c=!0}c&&(s._glyphs=a,s.text=l.join(""))}}this.state==="none"&&n.length>0&&this.setState("done"),this.primitive._state===Cesium.PrimitiveState.FAILED&&this.setState("error")}else this.state==="none"&&this.labels.length===0&&this.setState("done")}render(e,t){if(this.state!=="done")return;const n=e.camera.positionWC,s=this.layers;for(const o of s)for(let r=0;r<o.labels.length;r++){const a=o.style,l=t.zoom;if(o.visibility==="none"||l<a.minzoom||l>=a.maxzoom)o.labels[r].show=!1;else{const c=o.labels[r];c._baseFillColor||(c._baseFillColor=c.fillColor.clone(),c._baseOutlineColor=c.outlineColor.clone(),c.vtAlpha==null&&(c.vtAlpha=c.vtPlaceable?1:0));const h=c.vtPlaceable?1:0;c.vtAlpha=Cesium.Math.lerp(c.vtAlpha??0,h,iU),c.vtAlpha<.001?(c.vtAlpha=0,c.show=!1):(c.show=!0,c.fillColor=c._baseFillColor.withAlpha(c._baseFillColor.alpha*c.vtAlpha),c.outlineColor=c._baseOutlineColor.withAlpha(c._baseOutlineColor.alpha*c.vtAlpha))}}for(const o of this.labels)o.show&&(o.show=!this.isOccluded(n,o.position));if(this.primitive){this.commandList.length=0;const o=e.commandList;e.commandList=this.commandList,this.primitive.update(e),e.commandList=o}super.render(e)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}isDestroyed(){return!1}}function sy(i){let e=Cesium.HorizontalOrigin.CENTER,t=Cesium.VerticalOrigin.CENTER;switch(i){case"left":e=Cesium.HorizontalOrigin.LEFT;break;case"right":e=Cesium.HorizontalOrigin.RIGHT;break;case"top":t=Cesium.VerticalOrigin.TOP;break;case"bottom":t=Cesium.VerticalOrigin.BOTTOM;break;case"top-left":t=Cesium.VerticalOrigin.TOP,e=Cesium.HorizontalOrigin.LEFT;break;case"top-right":t=Cesium.VerticalOrigin.TOP,e=Cesium.HorizontalOrigin.RIGHT;break;case"bottom-left":t=Cesium.VerticalOrigin.BOTTOM,e=Cesium.HorizontalOrigin.LEFT;break;case"bottom-right":t=Cesium.VerticalOrigin.BOTTOM,e=Cesium.HorizontalOrigin.RIGHT;break}return{horizontal:e,vertical:t}}class oy extends Po{constructor(e,t,n){super(e,t,n),this.labels=[]}update(e,t){if(this.paintNeedsUpdate){const n=this.style,s=this.tile;for(let o=0;o<this.features.length;o++){const r=this.features[o],a=this.labels[o],l=n.convertColor(n.paint.getDataValue("text-color",s.z,r)),c=n.convertColor(n.paint.getDataValue("text-halo-color",s.z,r)),h=n.paint.getDataValue("text-halo-width",s.z,r);r.textColor=l,r.outlineColor=c,r.outlineWidth=h,a.fillColor=l,a.style=h&&Cesium.LabelStyle.FILL_AND_OUTLINE,a.outlineWidth=h*r.textSize,a.outlineColor=c,a._baseFillColor=a.fillColor.clone(),a._baseOutlineColor=a.outlineColor.clone()}this.paintNeedsUpdate=!1}super.update(e,t)}}Do("symbol",oy,nU);const Hd=Object.freeze(Object.defineProperty({__proto__:null,BackgroundRenderLayer:J0,DEFAULT_WORKER_FILENAME:"cvt-gl-worker.js",FillRenderLayer:ty,GeoJSONSource:Rg,ILayerVisualizer:Da,IRenderLayer:Po,ISource:Ec,LayerVisualizers:ms,LineRenderLayer:iy,RenderLayers:ps,Sources:xc,StyleLayer:F0,StyleLayerProperties:Ld,SymbolRenderLayer:oy,VectorSource:Sg,VectorTileLOD:ka,VectorTileRenderList:O0,VectorTileset:KG,registerRenderLayer:Do,registerSource:Ic},Symbol.toStringTag,{value:"Module"}));Q.DEFAULT_CESIUM_CONFIG=bn,Q.LeiTingBIM=qr,Q.LeiTingDraggableCard=gt,Q.LeiTingInfo=ho,Q.LeiTingMenu=ao,Q.LeiTingPlayer=co,Q.LeiTingPosition=uo,Q.LeiTingSection=lo,Q.LeiTingSetting=fo,Q.LeiTingTree=Gr,Q.LeitingBIM=qr,Q.LeitingDraggableCard=gt,Q.LeitingInfo=ho,Q.LeitingMenu=ao,Q.LeitingPlayer=co,Q.LeitingPosition=uo,Q.LeitingSection=lo,Q.LeitingSetting=fo,Q.LeitingTree=Gr,Q.MobileBottomNav=_m,Q.MobileDrawer=Wr,Q.MobileInfo=Rm,Q.MobileMeasurement=Nm,Q.MobilePlayer=Lm,Q.MobileSection=Dm,Q.MobileSetting=Pm,Q.MobileTree=km,Q.default=rR,Q.defaultMobileConfig=Kr,Q.disableDoubleTapZoom=j8,Q.getAccessToken=Jd,Q.getCesiumOptionsForMobile=J8,Q.getTilesetOptionsForMobile=eR,Q.getViewerOptionsForMobile=Z8,Q.leitingBim=qr,Q.loadCesium=Va,Q.preventDefaultTouchEvents=$8,Q.useDebounce=iR,Q.useDevice=Or,Q.useFrameRateControl=tR,Q.useGestureDetection=X8,Q.useLazyLoad=sR,Q.useLeiTing=Fm,Q.useLeiting=Fm,Q.useLongPress=W8,Q.useLongPressOnElement=q8,Q.useModelTree=vm,Q.useRightContextMenu=Bm,Q.useThrottle=nR,Q.useTouchEvents=Y8,Q.waitForCesium=qy,Object.defineProperties(Q,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));