leiting-bim 2.1.148 → 2.1.149
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.
- package/leiting-bim.es.js +1 -1
- package/leiting-bim.umd.js +25 -25
- package/package.json +1 -1
package/leiting-bim.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(U,c){typeof exports=="object"&&typeof module<"u"?c(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"],c):(U=typeof globalThis<"u"?globalThis:U||self,c(U.LeitingBim={},U.Vue,U.snapdom,U.antd,U.iconsVue))})(this,(function(U,c,Nl,ge,$t){"use strict";var Cn=typeof document<"u"?document.currentScript:null;function _l(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 Ul=_l(Nl),mt={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 At=null,kt;function En(i){return i.accessToken&&(kt=i.accessToken),At||(At=new Promise((e,t)=>{if(window.Cesium){kt&&(window.Cesium.Ion.defaultAccessToken=kt),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=()=>{kt&&window.Cesium&&(window.Cesium.Ion.defaultAccessToken=kt),e()},o.onerror=r=>{console.error("Failed to load Cesium script",r),At=null,t(r)},document.head.appendChild(o)}),At)}function Ql(){return window.Cesium?Promise.resolve():At||Promise.reject(new Error("Cesium loading has not been initiated."))}function wn(){return kt}class Gl{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 l=Ul,a=this.viewer&&this.viewer.container&&this.viewer.container.id;let d=null;if(a&&(d=document.getElementById(a)),!d&&this.viewer&&this.viewer.container&&(d=this.viewer.container),!d)return null;document.fonts&&document.fonts.ready&&await document.fonts.ready;let h=null;const f=l.snapdom||l.default||l;let p=null;if(n==="webp"&&f.toWebp)p=await f.toWebp(d,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(f.toPng)p=await f.toPng(d,{quality:s,pixelRatio:o,embedFonts:!0,className:e});else if(f.toBlob){const m=await f.toBlob(d,{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:",f);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(l){return console.error("getSnapDomSImageBase64 failed",l),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
2
|
<html>
|
|
3
3
|
<head><title>Snapshot Preview</title></head>
|
|
4
4
|
<body style="margin:0; display:flex; justify-content:center; align-items:center; height:100vh; background:#333;">
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
|
|
10
10
|
material.diffuse *= u_tilesBrightness;
|
|
11
11
|
}
|
|
12
|
-
`});d.isModelAdjustment=!0,a.customShader=d}else{let d="color('white')";e!==1&&(d=`${d} * ${e}`),a.style=new n.Cesium3DTileStyle({color:d})}}}}var Rs=typeof global=="object"&&global&&global.Object===Object&&global,Hl=typeof self=="object"&&self&&self.Object===Object&&self,yt=Rs||Hl||Function("return this")(),Di=yt.Symbol,Os=Object.prototype,Yl=Os.hasOwnProperty,Vl=Os.toString,Xt=Di?Di.toStringTag:void 0;function zl(i){var e=Yl.call(i,Xt),t=i[Xt];try{i[Xt]=void 0;var n=!0}catch{}var s=Vl.call(i);return n&&(e?i[Xt]=t:delete i[Xt]),s}var Wl=Object.prototype,jl=Wl.toString;function Kl(i){return jl.call(i)}var $l="[object Null]",Xl="[object Undefined]",Ls=Di?Di.toStringTag:void 0;function qt(i){return i==null?i===void 0?Xl:$l:Ls&&Ls in Object(i)?zl(i):Kl(i)}function Pt(i){return i!=null&&typeof i=="object"}var ql="[object Symbol]";function Jl(i){return typeof i=="symbol"||Pt(i)&&qt(i)==ql}var bn=Array.isArray,Zl=/\s/;function ec(i){for(var e=i.length;e--&&Zl.test(i.charAt(e)););return e}var tc=/^\s+/;function ic(i){return i&&i.slice(0,ec(i)+1).replace(tc,"")}function je(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Ns=NaN,nc=/^[-+]0x[0-9a-f]+$/i,sc=/^0b[01]+$/i,oc=/^0o[0-7]+$/i,rc=parseInt;function Us(i){if(typeof i=="number")return i;if(Jl(i))return Ns;if(je(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=je(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=ic(i);var t=sc.test(i);return t||oc.test(i)?rc(i.slice(2),t?2:8):nc.test(i)?Ns:+i}function _s(i){return i}var ac="[object AsyncFunction]",lc="[object Function]",cc="[object GeneratorFunction]",dc="[object Proxy]";function vn(i){if(!je(i))return!1;var e=qt(i);return e==lc||e==cc||e==ac||e==dc}var In=yt["__core-js_shared__"],Qs=(function(){var i=/[^.]+$/.exec(In&&In.keys&&In.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function hc(i){return!!Qs&&Qs in i}var uc=Function.prototype,fc=uc.toString;function pc(i){if(i!=null){try{return fc.call(i)}catch{}try{return i+""}catch{}}return""}var gc=/[\\^$.*+?()[\]{}|]/g,mc=/^\[object .+?Constructor\]$/,Ac=Function.prototype,yc=Object.prototype,Cc=Ac.toString,Ec=yc.hasOwnProperty,wc=RegExp("^"+Cc.call(Ec).replace(gc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function bc(i){if(!je(i)||hc(i))return!1;var e=vn(i)?wc:mc;return e.test(pc(i))}function vc(i,e){return i?.[e]}function Bn(i,e){var t=vc(i,e);return bc(t)?t:void 0}var Gs=Object.create,Ic=(function(){function i(){}return function(e){if(!je(e))return{};if(Gs)return Gs(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}})();function Bc(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 xc(i,e){var t=-1,n=i.length;for(e||(e=Array(n));++t<n;)e[t]=i[t];return e}var Sc=800,Tc=16,Mc=Date.now;function Dc(i){var e=0,t=0;return function(){var n=Mc(),s=Tc-(n-t);if(t=n,s>0){if(++e>=Sc)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}function kc(i){return function(){return i}}var ki=(function(){try{var i=Bn(Object,"defineProperty");return i({},"",{}),i}catch{}})(),Pc=ki?function(i,e){return ki(i,"toString",{configurable:!0,enumerable:!1,value:kc(e),writable:!0})}:_s,Fc=Dc(Pc),Rc=9007199254740991,Oc=/^(?:0|[1-9]\d*)$/;function Hs(i,e){var t=typeof i;return e=e??Rc,!!e&&(t=="number"||t!="symbol"&&Oc.test(i))&&i>-1&&i%1==0&&i<e}function xn(i,e,t){e=="__proto__"&&ki?ki(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}function Pi(i,e){return i===e||i!==i&&e!==e}var Lc=Object.prototype,Nc=Lc.hasOwnProperty;function Uc(i,e,t){var n=i[e];(!(Nc.call(i,e)&&Pi(n,t))||t===void 0&&!(e in i))&&xn(i,e,t)}function _c(i,e,t,n){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var l=e[o],a=void 0;a===void 0&&(a=i[l]),s?xn(t,l,a):Uc(t,l,a)}return t}var Ys=Math.max;function Qc(i,e,t){return e=Ys(e===void 0?i.length-1:e,0),function(){for(var n=arguments,s=-1,o=Ys(n.length-e,0),r=Array(o);++s<o;)r[s]=n[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=n[s];return l[e]=t(r),Bc(i,this,l)}}function Gc(i,e){return Fc(Qc(i,e,_s),i+"")}var Hc=9007199254740991;function Vs(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Hc}function Sn(i){return i!=null&&Vs(i.length)&&!vn(i)}function Yc(i,e,t){if(!je(t))return!1;var n=typeof e;return(n=="number"?Sn(t)&&Hs(e,t.length):n=="string"&&e in t)?Pi(t[e],i):!1}function Vc(i){return Gc(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&&Yc(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++n<s;){var l=t[n];l&&i(e,l,n,o)}return e})}var zc=Object.prototype;function zs(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||zc;return i===t}function Wc(i,e){for(var t=-1,n=Array(i);++t<i;)n[t]=e(t);return n}var jc="[object Arguments]";function Ws(i){return Pt(i)&&qt(i)==jc}var js=Object.prototype,Kc=js.hasOwnProperty,$c=js.propertyIsEnumerable,Tn=Ws((function(){return arguments})())?Ws:function(i){return Pt(i)&&Kc.call(i,"callee")&&!$c.call(i,"callee")};function Xc(){return!1}var Ks=typeof _=="object"&&_&&!_.nodeType&&_,$s=Ks&&typeof module=="object"&&module&&!module.nodeType&&module,qc=$s&&$s.exports===Ks,Xs=qc?yt.Buffer:void 0,Jc=Xs?Xs.isBuffer:void 0,qs=Jc||Xc,Zc="[object Arguments]",ed="[object Array]",td="[object Boolean]",id="[object Date]",nd="[object Error]",sd="[object Function]",od="[object Map]",rd="[object Number]",ad="[object Object]",ld="[object RegExp]",cd="[object Set]",dd="[object String]",hd="[object WeakMap]",ud="[object ArrayBuffer]",fd="[object DataView]",pd="[object Float32Array]",gd="[object Float64Array]",md="[object Int8Array]",Ad="[object Int16Array]",yd="[object Int32Array]",Cd="[object Uint8Array]",Ed="[object Uint8ClampedArray]",wd="[object Uint16Array]",bd="[object Uint32Array]",ce={};ce[pd]=ce[gd]=ce[md]=ce[Ad]=ce[yd]=ce[Cd]=ce[Ed]=ce[wd]=ce[bd]=!0,ce[Zc]=ce[ed]=ce[ud]=ce[td]=ce[fd]=ce[id]=ce[nd]=ce[sd]=ce[od]=ce[rd]=ce[ad]=ce[ld]=ce[cd]=ce[dd]=ce[hd]=!1;function vd(i){return Pt(i)&&Vs(i.length)&&!!ce[qt(i)]}function Id(i){return function(e){return i(e)}}var Js=typeof _=="object"&&_&&!_.nodeType&&_,Jt=Js&&typeof module=="object"&&module&&!module.nodeType&&module,Bd=Jt&&Jt.exports===Js,Mn=Bd&&Rs.process,Zs=(function(){try{var i=Jt&&Jt.require&&Jt.require("util").types;return i||Mn&&Mn.binding&&Mn.binding("util")}catch{}})(),eo=Zs&&Zs.isTypedArray,to=eo?Id(eo):vd;function xd(i,e){var t=bn(i),n=!t&&Tn(i),s=!t&&!n&&qs(i),o=!t&&!n&&!s&&to(i),r=t||n||s||o,l=r?Wc(i.length,String):[],a=l.length;for(var d in i)r&&(d=="length"||s&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Hs(d,a))||l.push(d);return l}function Sd(i,e){return function(t){return i(e(t))}}function Td(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var Md=Object.prototype,Dd=Md.hasOwnProperty;function kd(i){if(!je(i))return Td(i);var e=zs(i),t=[];for(var n in i)n=="constructor"&&(e||!Dd.call(i,n))||t.push(n);return t}function io(i){return Sn(i)?xd(i):kd(i)}var Zt=Bn(Object,"create");function Pd(){this.__data__=Zt?Zt(null):{},this.size=0}function Fd(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Rd="__lodash_hash_undefined__",Od=Object.prototype,Ld=Od.hasOwnProperty;function Nd(i){var e=this.__data__;if(Zt){var t=e[i];return t===Rd?void 0:t}return Ld.call(e,i)?e[i]:void 0}var Ud=Object.prototype,_d=Ud.hasOwnProperty;function Qd(i){var e=this.__data__;return Zt?e[i]!==void 0:_d.call(e,i)}var Gd="__lodash_hash_undefined__";function Hd(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=Zt&&e===void 0?Gd:e,this}function Ct(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])}}Ct.prototype.clear=Pd,Ct.prototype.delete=Fd,Ct.prototype.get=Nd,Ct.prototype.has=Qd,Ct.prototype.set=Hd;function Yd(){this.__data__=[],this.size=0}function Fi(i,e){for(var t=i.length;t--;)if(Pi(i[t][0],e))return t;return-1}var Vd=Array.prototype,zd=Vd.splice;function Wd(i){var e=this.__data__,t=Fi(e,i);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():zd.call(e,t,1),--this.size,!0}function jd(i){var e=this.__data__,t=Fi(e,i);return t<0?void 0:e[t][1]}function Kd(i){return Fi(this.__data__,i)>-1}function $d(i,e){var t=this.__data__,n=Fi(t,i);return n<0?(++this.size,t.push([i,e])):t[n][1]=e,this}function et(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])}}et.prototype.clear=Yd,et.prototype.delete=Wd,et.prototype.get=jd,et.prototype.has=Kd,et.prototype.set=$d;var no=Bn(yt,"Map");function Xd(){this.size=0,this.__data__={hash:new Ct,map:new(no||et),string:new Ct}}function qd(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}function Ri(i,e){var t=i.__data__;return qd(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Jd(i){var e=Ri(this,i).delete(i);return this.size-=e?1:0,e}function Zd(i){return Ri(this,i).get(i)}function eh(i){return Ri(this,i).has(i)}function th(i,e){var t=Ri(this,i),n=t.size;return t.set(i,e),this.size+=t.size==n?0:1,this}function Ft(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])}}Ft.prototype.clear=Xd,Ft.prototype.delete=Jd,Ft.prototype.get=Zd,Ft.prototype.has=eh,Ft.prototype.set=th;var so=Sd(Object.getPrototypeOf,Object),ih="[object Object]",nh=Function.prototype,sh=Object.prototype,oo=nh.toString,oh=sh.hasOwnProperty,rh=oo.call(Object);function ah(i){if(!Pt(i)||qt(i)!=ih)return!1;var e=so(i);if(e===null)return!0;var t=oh.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&oo.call(t)==rh}function lh(){this.__data__=new et,this.size=0}function ch(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}function dh(i){return this.__data__.get(i)}function hh(i){return this.__data__.has(i)}var uh=200;function fh(i,e){var t=this.__data__;if(t instanceof et){var n=t.__data__;if(!no||n.length<uh-1)return n.push([i,e]),this.size=++t.size,this;t=this.__data__=new Ft(n)}return t.set(i,e),this.size=t.size,this}function Rt(i){var e=this.__data__=new et(i);this.size=e.size}Rt.prototype.clear=lh,Rt.prototype.delete=ch,Rt.prototype.get=dh,Rt.prototype.has=hh,Rt.prototype.set=fh;var ro=typeof _=="object"&&_&&!_.nodeType&&_,ao=ro&&typeof module=="object"&&module&&!module.nodeType&&module,ph=ao&&ao.exports===ro,lo=ph?yt.Buffer:void 0;lo&&lo.allocUnsafe;function gh(i,e){return i.slice()}var co=yt.Uint8Array;function mh(i){var e=new i.constructor(i.byteLength);return new co(e).set(new co(i)),e}function Ah(i,e){var t=mh(i.buffer);return new i.constructor(t,i.byteOffset,i.length)}function yh(i){return typeof i.constructor=="function"&&!zs(i)?Ic(so(i)):{}}function Ch(i){return function(e,t,n){for(var s=-1,o=Object(e),r=n(e),l=r.length;l--;){var a=r[++s];if(t(o[a],a,o)===!1)break}return e}}var Eh=Ch(),Dn=function(){return yt.Date.now()},wh="Expected a function",bh=Math.max,vh=Math.min;function kn(i,e,t){var n,s,o,r,l,a,d=0,h=!1,f=!1,p=!0;if(typeof i!="function")throw new TypeError(wh);e=Us(e)||0,je(t)&&(h=!!t.leading,f="maxWait"in t,o=f?bh(Us(t.maxWait)||0,e):o,p="trailing"in t?!!t.trailing:p);function u(I){var B=n,g=s;return n=s=void 0,d=I,r=i.apply(g,B),r}function m(I){return d=I,l=setTimeout(C,e),h?u(I):r}function b(I){var B=I-a,g=I-d,P=e-B;return f?vh(P,o-g):P}function A(I){var B=I-a,g=I-d;return a===void 0||B>=e||B<0||f&&g>=o}function C(){var I=Dn();if(A(I))return v(I);l=setTimeout(C,b(I))}function v(I){return l=void 0,p&&n?u(I):(n=s=void 0,r)}function S(){l!==void 0&&clearTimeout(l),d=0,n=a=s=l=void 0}function D(){return l===void 0?r:v(Dn())}function N(){var I=Dn(),B=A(I);if(n=arguments,s=this,a=I,B){if(l===void 0)return m(a);if(f)return clearTimeout(l),l=setTimeout(C,e),u(a)}return l===void 0&&(l=setTimeout(C,e)),r}return N.cancel=S,N.flush=D,N}function Pn(i,e,t){(t!==void 0&&!Pi(i[e],t)||t===void 0&&!(e in i))&&xn(i,e,t)}function Ih(i){return Pt(i)&&Sn(i)}function Fn(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}function Bh(i){return _c(i,io(i))}function xh(i,e,t,n,s,o,r){var l=Fn(i,t),a=Fn(e,t),d=r.get(a);if(d){Pn(i,t,d);return}var h=o?o(l,a,t+"",i,e,r):void 0,f=h===void 0;if(f){var p=bn(a),u=!p&&qs(a),m=!p&&!u&&to(a);h=a,p||u||m?bn(l)?h=l:Ih(l)?h=xc(l):u?(f=!1,h=gh(a)):m?(f=!1,h=Ah(a)):h=[]:ah(a)||Tn(a)?(h=l,Tn(l)?h=Bh(l):(!je(l)||vn(l))&&(h=yh(a))):f=!1}f&&(r.set(a,h),s(h,a,n,o,r),r.delete(a)),Pn(i,t,h)}function ho(i,e,t,n,s){i!==e&&Eh(e,function(o,r){if(s||(s=new Rt),je(o))xh(i,e,r,t,ho,n,s);else{var l=n?n(Fn(i,r),o,r+"",i,e,s):void 0;l===void 0&&(l=o),Pn(i,r,l)}},io)}var Sh=Vc(function(i,e,t){ho(i,e,t)});function Rn({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),l=i.Cartesian3.fromDegrees(n.longitude,n.latitude,n.height),a=i.Transforms.eastNorthUpToFixedFrame(l),d=i.Matrix4.multiply(a,r,new i.Matrix4);if(e._root){if(!s){e._root.transform=d;return}try{const{center:h}=s,f=e.root.boundingVolume.boundingSphere,p=new i.Cartesian3(h.x,h.y,0),u=i.Matrix4.multiplyByPoint(d,p,new i.Cartesian3),m=i.Cartographic.fromCartesian(u),b=f.center,A=i.Transforms.eastNorthUpToFixedFrame(new i.Cartesian3(b.x,b.y,b.z)),C=new i.Cartesian3(-h.x+(n.X||0),-h.y+(n.Y||0),n.Z||0),v=i.Matrix4.fromTranslation(C),S=i.Matrix4.multiply(r,v,new i.Matrix4),D=i.Cartesian3.fromDegrees(m.longitude/Math.PI*180,m.latitude/Math.PI*180,n.height),N=i.Transforms.eastNorthUpToFixedFrame(D),I=i.Matrix4.multiply(N,S,new i.Matrix4);i.Matrix4.multiply(A,S,A),e._root.transform=I}catch(h){console.error("Update model position failed:",h)}}}const Ot={NotLoaded:0,Loading:1,Loaded:2,Error:3},Et=4294967295,Ke=65535,On=255,Th=8,uo=9,Mh=0,Dh=99,kh=67324752,fo=134695760,Ph=fo,po=33639248,Fh=101010256,go=101075792,Rh=117853008,Lt=22,Ln=20,Nn=56,Oh=12,Lh=20,mo=4,Nh=1,Uh=39169,_h=10,Qh=1,Gh=21589,Hh=28789,Yh=25461,Vh=6534,zh=30837,Wh=30805,Ao=1,jh=6,yo=8,Co=2048,Kh=16,$h=1,Xh=2,qh=4,Jh=32,Eo=61440,Un=16384,_n=73,Zh=420,eu=2048,tu=1024,iu=512,nu="/",Qn=30,su=10,ou=14,ru=18,de=void 0,at="undefined",wt="function",au=64;let wo=2;try{typeof navigator!=at&&navigator.hardwareConcurrency&&(wo=navigator.hardwareConcurrency)}catch{}const lu={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:64*1024,maxWorkers:wo,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof CompressionStream!=at&&CompressionStream,DecompressionStream:typeof DecompressionStream!=at&&DecompressionStream},bo=Object.assign({},lu);function cu(){return bo}function du(i){return Math.max(i.chunkSize,au)}function Oi(i){const{baseURI:e,chunkSize:t,maxWorkers:n,terminateWorkerTimeout:s,useCompressionStream:o,useWebWorkers:r,CompressionStream:l,DecompressionStream:a,CompressionStreamZlib:d,DecompressionStreamZlib:h,workerURI:f,wasmURI:p}=i;Ue("baseURI",e),Ue("wasmURI",p),Ue("workerURI",f),Ue("chunkSize",t),Ue("maxWorkers",n),Ue("terminateWorkerTimeout",s),Ue("useCompressionStream",o),Ue("useWebWorkers",r),Ue("CompressionStream",l),Ue("DecompressionStream",a),Ue("CompressionStreamZlib",d),Ue("DecompressionStreamZlib",h)}function Ue(i,e){e!==de&&(bo[i]=e)}function hu(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 vo=[];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;vo[i]=e}class Li{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^vo[(t^e[n])&255];this.crc=t}get(){return~this.crc}}class Io extends TransformStream{constructor(){let e;const t=new Li;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 uu(i){if(typeof TextEncoder==at){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 ke={concat(i,e){if(i.length===0||e.length===0)return i.concat(e);const t=i[i.length-1],n=ke.getPartial(t);return n===32?i.concat(e):ke._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+ke.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]=ke.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=ke.getPartial(s);return n.push(ke.partial(e+o&31,e+o>32?t:n.pop(),1)),n}},Ni={bytes:{fromBits(i){const t=ke.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(ke.partial(8*(t&3),n)),e}}},Bo={};Bo.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=Ni.utf8String.toBits(i));const t=e._buffer=ke.concat(e._buffer,i),n=e._length,s=e._length=n+ke.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 l=e.blockSize+n-(e.blockSize+n&e.blockSize-1);l<=s;l+=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=ke.concat(e,[ke.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 d=0;d<16;d++)n[d]=i[d];let s=t[0],o=t[1],r=t[2],l=t[3],a=t[4];for(let d=0;d<=79;d++){d>=16&&(n[d]=e._S(1,n[d-3]^n[d-8]^n[d-14]^n[d-16]));const h=e._S(5,s)+e._f(d,o,r,l)+a+n[d]+e._key[Math.floor(d/20)]|0;a=l,l=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]+l|0,t[4]=t[4]+a|0}};const xo={};xo.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,l,a=1;if(s!==4&&s!==6&&s!==8)throw new Error("invalid aes key size");for(e._key=[r=i.slice(0),l=[]],o=s;o<4*s+28;o++){let d=r[o-1];(o%s===0||s===8&&o%s===4)&&(d=t[d>>>24]<<24^t[d>>16&255]<<16^t[d>>8&255]<<8^t[d&255],o%s===0&&(d=d<<8^d>>>24^a<<24,a=a<<1^(a>>7)*283)),r[o]=r[o-s]^d}for(let d=0;o;d++,o--){const h=r[d&3?o:o-4];o<=4||d<4?l[d]=h:l[d]=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,l,a,d;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^=l||1,r=o[r]||1){let f=r^r<<1^r<<2^r<<3^r<<4;f=f>>8^f&255^99,t[h]=f,n[f]=h,d=s[a=s[l=s[h]]];let p=d*16843009^a*65537^l*257^h*16843008,u=s[f]*257^f*16843008;for(let m=0;m<4;m++)i[m][h]=u=u<<24^u>>>8,e[m][f]=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],l=o[1],a=o[2],d=o[3],h=o[4];let f=i[0]^t[0],p=i[e?3:1]^t[1],u=i[2]^t[2],m=i[e?1:3]^t[3],b=4,A,C,v;for(let S=0;S<n;S++)A=r[f>>>24]^l[p>>16&255]^a[u>>8&255]^d[m&255]^t[b],C=r[p>>>24]^l[u>>16&255]^a[m>>8&255]^d[f&255]^t[b+1],v=r[u>>>24]^l[m>>16&255]^a[f>>8&255]^d[p&255]^t[b+2],m=r[m>>>24]^l[f>>16&255]^a[p>>8&255]^d[u&255]^t[b+3],b+=4,f=A,p=C,u=v;for(let S=0;S<4;S++)s[e?3&-S:S]=h[f>>>24]<<24^h[p>>16&255]<<16^h[u>>8&255]<<8^h[m&255]^t[b++],A=f,f=p,p=u,u=m,m=A;return s}};const fu={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}},So={};So.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=ke.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 ke.clamp(e,s)}};const bt={importKey(i){return new bt.hmacSha1(Ni.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,l,a,d;const h=new ArrayBuffer(s),f=new DataView(h);let p=0;const u=ke;for(e=Ni.bytes.toBits(e),d=1;p<(s||1);d++){for(o=r=i.encrypt(u.concat(e,[d])),l=1;l<t;l++)for(r=i.encrypt(r),a=0;a<r.length;a++)o[a]^=r[a];for(l=0;p<(s||1)&&l<o.length;l++)f.setInt32(p,o[l]),p+=4}return h.slice(0,n/8)}};bt.hmacSha1=class{constructor(i){const e=this,t=e._hash=Bo.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 pu=typeof crypto!=at&&typeof crypto.getRandomValues==wt,To="Invalid password",Mo="Invalid signature",Gn="zipjs-abort-check-password";function Do(i){return pu?crypto.getRandomValues(i):fu.getRandomValues(i)}const Nt=16,gu="raw",ko={name:"PBKDF2"},mu={name:"HMAC"},Au="SHA-1",yu=Object.assign({hash:mu},ko),Hn=Object.assign({iterations:1e3,hash:{name:Au}},ko),Cu=["deriveBits"],ei=[8,12,16],ti=[16,24,32],lt=10,Eu=[0,0,0,0],Ui=typeof crypto!=at,ii=Ui&&crypto.subtle,Po=Ui&&typeof ii!=at,$e=Ni.bytes,wu=xo.aes,bu=So.ctrGladman,vu=bt.hmacSha1;let Fo=Ui&&Po&&typeof ii.importKey==wt,Ro=Ui&&Po&&typeof ii.deriveBits==wt;class Iu 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:No(e,t),signed:n,strength:s-1,pending:new Uint8Array})},async transform(r,l){const a=this,{password:d,strength:h,resolveReady:f,ready:p}=a;d?(await xu(a,h,d,_e(r,0,ei[h]+2)),r=_e(r,ei[h]+2),o?l.error(new Error(Gn)):f()):await p;const u=new Uint8Array(r.length-lt-(r.length-lt)%Nt);l.enqueue(Oo(a,r,u,0,lt,!0))},async flush(r){const{signed:l,ctr:a,hmac:d,pending:h,ready:f}=this;if(d&&a){await f;const p=_e(h,0,h.length-lt),u=_e(h,h.length-lt);let m=new Uint8Array;if(p.length){const b=si($e,p);d.update(b);const A=a.update(b);m=ni($e,A)}if(l){const b=_e(ni($e,d.digest()),0,lt);for(let A=0;A<lt;A++)if(b[A]!=u[A])throw new Error(Mo)}r.enqueue(m)}}})}}class Bu extends TransformStream{constructor({password:e,rawPassword:t,encryptionStrength:n}){let s;super({start(){Object.assign(this,{ready:new Promise(o=>this.resolveReady=o),password:No(e,t),strength:n-1,pending:new Uint8Array})},async transform(o,r){const l=this,{password:a,strength:d,resolveReady:h,ready:f}=l;let p=new Uint8Array;a?(p=await Su(l,d,a),h()):await f;const u=new Uint8Array(p.length+o.length-o.length%Nt);u.set(p,0),r.enqueue(Oo(l,o,u,p.length,0))},async flush(o){const{ctr:r,hmac:l,pending:a,ready:d}=this;if(l&&r){await d;let h=new Uint8Array;if(a.length){const f=r.update(si($e,a));l.update(f),h=ni($e,f)}s.signature=ni($e,l.digest()).slice(0,lt),o.enqueue(Yn(h,s.signature))}}}),s=this}}function Oo(i,e,t,n,s,o){const{ctr:r,hmac:l,pending:a}=i,d=e.length-s;a.length&&(e=Yn(a,e),t=Du(t,d-d%Nt));let h;for(h=0;h<=d-Nt;h+=Nt){const f=si($e,_e(e,h,h+Nt));o&&l.update(f);const p=r.update(f);o||l.update(p),t.set(ni($e,p),h+n)}return i.pending=_e(e,h),t}async function xu(i,e,t,n){const s=await Lo(i,e,t,_e(n,0,ei[e])),o=_e(n,ei[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new Error(To)}async function Su(i,e,t){const n=Do(new Uint8Array(ei[e])),s=await Lo(i,e,t,n);return Yn(n,s)}async function Lo(i,e,t,n){i.password=null;const s=await Tu(gu,t,yu,!1,Cu),o=await Mu(Object.assign({salt:n},Hn),s,8*(ti[e]*2+2)),r=new Uint8Array(o),l=si($e,_e(r,0,ti[e])),a=si($e,_e(r,ti[e],ti[e]*2)),d=_e(r,ti[e]*2);return Object.assign(i,{keys:{key:l,authentication:a,passwordVerification:d},ctr:new bu(new wu(l),Array.from(Eu)),hmac:new vu(a)}),d}async function Tu(i,e,t,n,s){if(Fo)try{return await ii.importKey(i,e,t,n,s)}catch{return Fo=!1,bt.importKey(e)}else return bt.importKey(e)}async function Mu(i,e,t){if(Ro)try{return await ii.deriveBits(i,e,t)}catch{return Ro=!1,bt.pbkdf2(e,i.salt,Hn.iterations,t)}else return bt.pbkdf2(e,i.salt,Hn.iterations,t)}function No(i,e){return e===de?uu(i):e}function Yn(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 Du(i,e){if(e&&e>i.length){const t=i;i=new Uint8Array(e),i.set(t,0)}return i}function _e(i,e,t){return i.subarray(e,t)}function ni(i,e){return i.fromBits(e)}function si(i,e){return i.toBits(e)}const oi=12;class ku extends TransformStream{constructor({password:e,passwordVerification:t,checkPasswordOnly:n}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),Qo(this,e)},transform(s,o){const r=this;if(r.password){const l=Uo(r,s.subarray(0,oi));if(r.password=null,l.at(-1)!=r.passwordVerification)throw new Error(To);s=s.subarray(oi)}n?o.error(new Error(Gn)):o.enqueue(Uo(r,s))}})}}class Pu extends TransformStream{constructor({password:e,passwordVerification:t}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),Qo(this,e)},transform(n,s){const o=this;let r,l;if(o.password){o.password=null;const a=Do(new Uint8Array(oi));a[oi-1]=o.passwordVerification,r=new Uint8Array(n.length+a.length),r.set(_o(o,a),0),l=oi}else r=new Uint8Array(n.length),l=0;r.set(_o(o,n),l),s.enqueue(r)}})}}function Uo(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=Go(i)^e[n],Vn(i,t[n]);return t}function _o(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=Go(i)^e[n],Vn(i,e[n]);return t}function Qo(i,e){const t=[305419896,591751049,878082192];Object.assign(i,{keys:t,crcKey0:new Li(t[0]),crcKey2:new Li(t[2])});for(let n=0;n<e.length;n++)Vn(i,e.charCodeAt(n))}function Vn(i,e){let[t,n,s]=i.keys;i.crcKey0.append([e]),t=~i.crcKey0.get(),n=Yo(Math.imul(Yo(n+Ho(t)),134775813)+1),i.crcKey2.append([n>>>24]),s=~i.crcKey2.get(),i.keys=[t,n,s]}function Go(i){const e=i.keys[2]|2;return Ho(Math.imul(e,e^1)>>>8)}function Ho(i){return i&255}function Yo(i){return i&4294967295}const Vo="Invalid uncompressed size",Fu="deflate-raw",Ru="deflate64-raw";class Ou extends TransformStream{constructor(e,{chunkSize:t,CompressionStreamZlib:n,CompressionStream:s}){super({});const{compressed:o,encrypted:r,useCompressionStream:l,zipCrypto:a,signed:d,level:h}=e,f=this;let p,u,m=super.readable;(!r||a)&&d&&(p=new Io,m=Xe(m,p)),o&&(m=Wo(m,l,{level:h,chunkSize:t},s,n,s)),r&&(a?m=Xe(m,new Pu(e)):(u=new Bu(e),m=Xe(m,u))),zo(f,m,()=>{let b;r&&!a&&(b=u.signature),(!r||a)&&d&&(b=new DataView(p.value.buffer).getUint32(0)),f.signature=b})}}class Lu extends TransformStream{constructor(e,{chunkSize:t,DecompressionStreamZlib:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:r,signed:l,signature:a,compressed:d,useCompressionStream:h,deflate64:f}=e;let p,u,m=super.readable;r&&(o?m=Xe(m,new ku(e)):(u=new Iu(e),m=Xe(m,u))),d&&(m=Wo(m,h,{chunkSize:t,deflate64:f},s,n,s)),(!r||o)&&l&&(p=new Io,m=Xe(m,p)),zo(this,m,()=>{if((!r||o)&&l){const b=new DataView(p.value.buffer);if(a!=b.getUint32(0,!1))throw new Error(Mo)}})}}function zo(i,e,t){e=Xe(e,new TransformStream({flush:t})),Object.defineProperty(i,"readable",{get(){return e}})}function Wo(i,e,t,n,s,o){const r=e&&n?n:s||o,l=t.deflate64?Ru:Fu;try{i=Xe(i,new r(l,t))}catch(a){if(e)if(s)i=Xe(i,new s(l,t));else if(o)i=Xe(i,new o(l,t));else throw a;else throw a}return i}function Xe(i,e){return i.pipeThrough(e)}const Nu="message",Uu="start",_u="pull",jo="data",Qu="ack",Ko="close",Gu="deflate",$o="inflate";class Hu extends TransformStream{constructor(e,t){super({});const n=this,{codecType:s}=e;let o;s.startsWith(Gu)?o=Ou:s.startsWith($o)&&(o=Lu),n.outputSize=0;let r=0;const l=new o(e,t),a=super.readable,d=new TransformStream({transform(f,p){f&&f.length&&(r+=f.length,p.enqueue(f))},flush(){Object.assign(n,{inputSize:r})}}),h=new TransformStream({transform(f,p){if(f&&f.length&&(p.enqueue(f),n.outputSize+=f.length,e.outputSize!==de&&n.outputSize>e.outputSize))throw new Error(Vo)},flush(){const{signature:f}=l;Object.assign(n,{signature:f,inputSize:r})}});Object.defineProperty(n,"readable",{get(){return a.pipeThrough(d).pipeThrough(l).pipeThrough(h)}})}}class Yu 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 Xo=typeof Worker!=at,qo=()=>{};function Vu({initModule:i}){qo=i}class zn{constructor(e,{readable:t,writable:n},{options:s,config:o,streamOptions:r,useWebWorkers:l,transferStreams:a,workerURI:d},h){const{signal:f}=r;return Object.assign(e,{busy:!0,readable:t.pipeThrough(new Yu(o.chunkSize)).pipeThrough(new zu(r),{signal:f}),writable:n,options:Object.assign({},s),workerURI:d,transferStreams:a,terminate(){return new Promise(p=>{const{worker:u,busy:m}=e;u?(m?e.resolveTerminated=p:(u.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)}}),(l&&Xo?Wu:Jo)(e,o)}}class zu extends TransformStream{constructor({onstart:e,onprogress:t,size:n,onend:s}){let o=0;super({async start(){e&&await Wn(e,n)},async transform(r,l){o+=r.length,t&&await Wn(t,o,n),l.enqueue(r)},async flush(){s&&await Wn(s,o)}})}}async function Wn(i,...e){try{await i(...e)}catch{}}function Jo(i,e){return{run:()=>ju(i,e)}}function Wu(i,e){const{baseURI:t,chunkSize:n}=e;let{wasmURI:s}=e;if(!i.interface){typeof s==wt&&(s=s());let o;try{o=Xu(i.workerURI,t,i)}catch{return Xo=!1,Jo(i,e)}Object.assign(i,{worker:o,interface:{run:()=>Ku(i,{chunkSize:n,wasmURI:s,baseURI:t})}})}return i.interface}async function ju({options:i,readable:e,writable:t,onTaskFinished:n},s){let o;try{if(!i.useCompressionStream)try{await qo(s)}catch{i.useCompressionStream=!0}o=new Hu(i,s),await e.pipeThrough(o).pipeTo(t,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:l,outputSize:a}=o;return{signature:r,inputSize:l,outputSize:a}}catch(r){throw o&&(r.outputSize=o.outputSize),r}finally{n()}}async function Ku(i,e){let t,n;const s=new Promise((f,p)=>{t=f,n=p});Object.assign(i,{reader:null,writer:null,resolveResult:t,rejectResult:n,result:s});const{readable:o,options:r}=i,{writable:l,closed:a}=$u(i.writable),d=_i({type:Uu,options:r,config:e,readable:o,writable:l},i);d||Object.assign(i,{reader:o.getReader(),writer:l.getWriter()});const h=await s;return d||await l.getWriter().close(),await a,h}function $u(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 Zo=!0;function Xu(i,e,t){const n={type:"module"};let s,o;if(typeof i==wt&&(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(Nu,r=>qu(r,t)),o}function _i(i,{worker:e,writer:t,onTaskFinished:n,transferStreams:s}){try{const{value:o,readable:r,writable:l}=i,a=[];if(o&&(i.value=o,a.push(i.value.buffer)),s&&Zo?(r&&a.push(r),l&&a.push(l)):i.readable=i.writable=null,a.length)try{return e.postMessage(i,a),!0}catch{Zo=!1,i.readable=i.writable=null,e.postMessage(i)}else e.postMessage(i)}catch(o){throw t&&t.releaseLock(),n(),o}}async function qu({data:i},e){const{type:t,value:n,messageId:s,result:o,error:r}=i,{reader:l,writer:a,resolveResult:d,rejectResult:h,onTaskFinished:f}=e;try{if(r){const{message:u,stack:m,code:b,name:A,outputSize:C}=r,v=new Error(u);Object.assign(v,{stack:m,code:b,name:A,outputSize:C}),p(v)}else{if(t==_u){const{value:u,done:m}=await l.read();_i({type:jo,value:u,done:m,messageId:s},e)}t==jo&&(await a.ready,await a.write(new Uint8Array(n)),_i({type:Qu,messageId:s},e)),t==Ko&&p(null,o)}}catch(u){_i({type:Ko,messageId:s},e),p(u)}function p(u,m){u?h(u):d(m),a&&a.releaseLock(),f()}}let vt=[];const jn=[];let er=0;async function Ju(i,e){const{options:t,config:n}=e,{transferStreams:s,useWebWorkers:o,useCompressionStream:r,compressed:l,signed:a,encrypted:d}=t,{workerURI:h,maxWorkers:f}=n;e.transferStreams=s||s===de;const p=!l&&!a&&!d&&!e.transferStreams;return e.useWebWorkers=!p&&(o||o===de&&n.useWebWorkers),e.workerURI=e.useWebWorkers&&h?h:de,t.useCompressionStream=r||r===de&&n.useCompressionStream,(await u()).run();async function u(){const b=vt.find(A=>!A.busy);if(b)return tr(b),new zn(b,i,e,m);if(vt.length<f){const A={indexWorker:er};return er++,vt.push(A),new zn(A,i,e,m)}else return new Promise(A=>jn.push({resolve:A,stream:i,workerOptions:e}))}function m(b){if(jn.length){const[{resolve:A,stream:C,workerOptions:v}]=jn.splice(0,1);A(new zn(b,C,v,m))}else b.worker?(tr(b),Zu(b,e)):vt=vt.filter(A=>A!=b)}}function Zu(i,e){const{config:t}=e,{terminateWorkerTimeout:n}=t;Number.isFinite(n)&&n>=0&&(i.terminated?i.terminated=!1:i.terminateTimeout=setTimeout(async()=>{vt=vt.filter(s=>s!=i);try{await i.terminate()}catch{}},n))}function tr(i){const{terminateTimeout:e}=i;e&&(clearTimeout(e),i.terminateTimeout=null)}const ef="Writer iterator completed too soon",tf="Content-Type",nf=64*1024,ir="writable";class Kn{constructor(){this.size=0}init(){this.initialized=!0}}class nr extends Kn{get readable(){const e=this,{chunkSize:t=nf}=e,n=new ReadableStream({start(){this.chunkOffset=0},async pull(s){const{offset:o=0,size:r,diskNumberStart:l}=n,{chunkOffset:a}=this,d=r===de?t:Math.min(t,r-a),h=await xe(e,o+a,d,l);s.enqueue(h),a+t>r||r===de&&!h.length&&d?s.close():this.chunkOffset+=t}});return n}}class $n extends nr{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 sf extends Kn{constructor(e){super();const t=this,n=new TransformStream,s=[];e&&s.push([tf,e]),Object.defineProperty(t,ir,{get(){return n.writable}}),t.blob=new Response(n.readable,{headers:s}).blob()}getData(){return this.blob}}class of extends sf{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:l})=>o(l.result),onerror:()=>r(s.error)}),s.readAsText(n,e)})}}}class rf extends nr{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,l=n;l==-1&&(l=o.length-1);let a=e;for(;o[l]&&a>=o[l].size;)a-=o[l].size,l++;const d=o[l];if(d){const h=d.size;if(a+t<=h)r=await xe(d,a,t);else{const f=h-a;r=new Uint8Array(t);const p=await xe(d,a,f);r.set(p,0);const u=await s.readUint8Array(e+f,t-f,n);r.set(u,f),p.length+u.length<t&&(r=r.subarray(0,p.length+u.length))}}else r=new Uint8Array;return s.lastDiskNumber=Math.max(l,s.lastDiskNumber),r}}class sr extends Kn{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 l=new WritableStream({async write(h){const{availableSize:f}=n;if(r)h.length>=f?(await a(h.subarray(0,f)),await d(),n.diskOffset+=s.size,n.diskNumber++,r=null,await this.write(h.subarray(f))):await a(h);else{const{value:p,done:u}=await e.next();if(u&&!p)throw new Error(ef);s=p,s.size=0,s.maxSize&&(n.maxSize=s.maxSize),n.availableSize=n.maxSize,await Qi(s),o=p.writable,r=o.getWriter(),await this.write(h)}},async close(){await r.ready,await d()}});Object.defineProperty(n,ir,{get(){return l}});async function a(h){const f=h.length;f&&(await r.ready,await r.write(h),s.size+=f,n.size+=f,n.availableSize-=f)}async function d(){await r.close()}}}class af{constructor(e){return Array.isArray(e)&&(e=new rf(e)),e instanceof ReadableStream&&(e={readable:e}),e}}class lf{constructor(e){return e.writable===de&&typeof e.next==wt&&(e=new sr(e)),e instanceof WritableStream&&(e={writable:e}),e.size===de&&(e.size=0),e instanceof sr||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}}async function Qi(i,e){if(i.init&&!i.initialized)await i.init(e);else return Promise.resolve()}function xe(i,e,t,n){return i.readUint8Array(e,t,n)}const or="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),cf=or.length==256;function df(i){if(cf){let e="";for(let t=0;t<i.length;t++)e+=or[i[t]];return e}else return new TextDecoder().decode(i)}function Gi(i,e){return e&&e.trim().toLowerCase()=="cp437"?df(i):new TextDecoder(e).decode(i)}const rr="filename",ar="rawFilename",lr="comment",cr="rawComment",dr="uncompressedSize",hr="compressedSize",ur="offset",fr="diskNumberStart",Xn="lastModDate",qn="rawLastModDate",pr="lastAccessDate",hf="rawLastAccessDate",gr="creationDate",mr="rawCreationDate",uf=[rr,ar,dr,hr,Xn,qn,lr,cr,pr,gr,mr,ur,fr,"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 Ar{constructor(e){uf.forEach(t=>this[t]=e[t])}}const ff="filenameEncoding",pf="commentEncoding",gf="decodeText",mf="extractPrependedData",Af="extractAppendedData",yf="password",Cf="rawPassword",Ef="passThrough",wf="signal",bf="checkPasswordOnly",vf="checkOverlappingEntryOnly",If="checkOverlappingEntry",Bf="checkSignature",xf="useWebWorkers",Sf="useCompressionStream",Tf="transferStreams",Mf="preventClose",Jn="File format is not recognized",Df="End of central directory not found",kf="End of Zip64 central directory locator not found",Pf="Central directory header not found",Ff="Local file header not found",Rf="Zip64 extra field not found",Of="File contains encrypted entry",Lf="Encryption method not supported",yr="Compression method not supported",Cr="Split zip file",Nf="Overlapping entry found",Er="utf-8",Uf="UTF8",wr="cp437",_f=[[dr,Et],[hr,Et],[ur,Et],[fr,Ke]],Qf={[Ke]:{getValue:he,bytes:4},[Et]:{getValue:Ut,bytes:8}};class br{constructor(e,t={}){Object.assign(this,{reader:new af(e),options:t,config:cu(),readRanges:[]})}async*getEntriesGenerator(e={}){const t=this;let{reader:n}=t;const{config:s}=t;if(await Qi(n),(n.size===de||!n.readUint8Array)&&(n=new $n(await new Response(n.readable).blob()),await Qi(n)),n.size<Lt)throw new Error(Jn);n.chunkSize=du(s);const o=await jf(n,Fh,n.size,Lt,Ke*16);if(!o){const x=await xe(n,0,4),k=ue(x);throw he(k)==fo?new Error(Cr):new Error(Df)}const r=ue(o);let l=he(r,12),a=he(r,16);const d=o.offset,h=Be(r,20),f=d+Lt+h;let p=Be(r,4);const u=n.lastDiskNumber||0;let m=Be(r,6),b=Be(r,8),A=0,C=0;if(a==Et||l==Et||b==Ke||m==Ke){const x=await xe(n,o.offset-Ln,Ln),k=ue(x);if(he(k,0)==Rh){a=Ut(k,8);let U=await xe(n,a,Nn,-1),G=ue(U);const F=o.offset-Ln-Nn;if(he(G,0)!=go&&a!=F){const E=a;a=F,a>E&&(A=a-E),U=await xe(n,a,Nn,-1),G=ue(U)}if(he(G,0)!=go)throw new Error(kf);p==Ke&&(p=he(G,16)),m==Ke&&(m=he(G,20)),b==Ke&&(b=Ut(G,32)),l==Et&&(l=Ut(G,40)),a-=l}}if(a>=n.size&&(A=n.size-a-l-Lt,a=n.size-l-Lt),u!=p)throw new Error(Cr);if(a<0)throw new Error(Jn);let v=0,S=await xe(n,a,l,m),D=ue(S);if(l){const x=o.offset-l;if(he(D,v)!=po&&a!=x){const k=a;a=x,a>k&&(A+=a-k),S=await xe(n,a,l,m),D=ue(S)}}const N=o.offset-a-(n.lastDiskOffset||0);if(l!=N&&N>=0&&(l=N,S=await xe(n,a,l,m),D=ue(S)),a<0||a>=n.size)throw new Error(Jn);const I=Se(t,e,ff),B=Se(t,e,pf);for(let x=0;x<b;x++){const k=new Gf(n,s,t.options);if(he(D,v)!=po)throw new Error(Pf);vr(k,D,v+6);const U=!!k.bitFlag.languageEncodingFlag,G=v+46,F=G+k.filenameLength,E=F+k.extraFieldLength,y=Be(D,v+4),w=y>>8==0,T=y>>8==3,R=S.subarray(G,F),O=Be(D,v+32),L=E+O,M=S.subarray(E,L),Q=U,Y=U,W=he(D,v+38),q=W&On,Z={readOnly:!!(q&$h),hidden:!!(q&Xh),system:!!(q&qh),directory:!!(q&Kh),archive:!!(q&Jh)},oe=he(D,v+42)+A,ne=Se(t,e,gf)||Gi,se=Q?Er:I||wr,pe=Y?Er:B||wr;let ve=ne(R,se);ve===de&&(ve=Gi(R,se));let V=ne(M,pe);V===de&&(V=Gi(M,pe)),Object.assign(k,{versionMadeBy:y,msDosCompatible:w,compressedSize:0,uncompressedSize:0,commentLength:O,offset:oe,diskNumberStart:Be(D,v+34),internalFileAttributes:Be(D,v+36),externalFileAttributes:W,msdosAttributesRaw:q,msdosAttributes:Z,rawFilename:R,filenameUTF8:Q,commentUTF8:Y,rawExtraField:S.subarray(F,E),rawComment:M,filename:ve,comment:V}),C=Math.max(oe,C),Ir(k,k,D,v+6);const j=k.externalFileAttributes>>16&Ke;k.unixMode===de&&(j&(Zh|_n|Un))!=0&&(k.unixMode=j);const te=!!(k.unixMode&eu),Ae=!!(k.unixMode&tu),Ce=!!(k.unixMode&iu),Me=k.unixMode!==de?(k.unixMode&_n)!=0:T&&(j&_n)!=0,Le=k.unixMode!==de&&(k.unixMode&Eo)==Un,Ne=(j&Eo)==Un;Object.assign(k,{setuid:te,setgid:Ae,sticky:Ce,unixExternalUpper:j,internalFileAttribute:k.internalFileAttributes,externalFileAttribute:k.externalFileAttributes,executable:Me,directory:Le||Ne||w&&Z.directory||ve.endsWith(nu)&&!k.uncompressedSize,zipCrypto:k.encrypted&&!k.extraFieldAES});const st=new Ar(k);st.getData=(Ii,jt)=>k.getData(Ii,st,t.readRanges,jt),st.arrayBuffer=async Ii=>{const jt=new TransformStream,[ks]=await Promise.all([new Response(jt.readable).arrayBuffer(),k.getData(jt,st,t.readRanges,Ii)]);return ks},v=L;const{onprogress:mn}=e;if(mn)try{await mn(x+1,b,new Ar(k))}catch{}yield st}const g=Se(t,e,mf),P=Se(t,e,Af);return g&&(t.prependedData=C>0?await xe(n,0,C):new Uint8Array),t.comment=h?await xe(n,d+Lt,h):new Uint8Array,P&&(t.appendedData=f<n.size?await xe(n,f,n.size-f):new Uint8Array),!0}async getEntries(e={}){const t=[];for await(const n of this.getEntriesGenerator(e))t.push(n);return t}async close(){}}class Gf{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:l,diskNumberStart:a,extraFieldAES:d,extraFieldZip64:h,compressionMethod:f,config:p,bitFlag:u,signature:m,rawLastModDate:b,uncompressedSize:A,compressedSize:C}=o,{dataDescriptor:v}=u,S=t.localDirectory={},D=await xe(r,l,Qn,a),N=ue(D);let I=Se(o,s,yf),B=Se(o,s,Cf);const g=Se(o,s,Ef);if(I=I&&I.length&&I,B=B&&B.length&&B,d&&d.originalCompressionMethod!=Dh)throw new Error(yr);if(f!=Mh&&f!=Th&&f!=uo&&!g)throw new Error(yr);if(he(N,0)!=kh)throw new Error(Ff);vr(S,N,4);const{extraFieldLength:P,filenameLength:x,lastAccessDate:k,creationDate:U}=S;S.rawExtraField=P?await xe(r,l+Qn+x,P,a):new Uint8Array,Ir(o,S,N,4,!0),Object.assign(t,{lastAccessDate:k,creationDate:U});const G=o.encrypted&&S.encrypted&&!g,F=G&&!d;if(g||(t.zipCrypto=F),G){if(!F&&d.strength===de)throw new Error(Lf);if(!I&&!B)throw new Error(Of)}const E=l+Qn+x+P,y=C,w=r.readable;Object.assign(w,{diskNumberStart:a,offset:E,size:y});const T=Se(o,s,wf),R=Se(o,s,bf);let O=Se(o,s,If);const L=Se(o,s,vf);L&&(O=!0);const{onstart:M,onprogress:Q,onend:Y}=s,W=f==uo;let q=Se(o,s,Sf);W&&(q=!1);const Z={options:{codecType:$o,password:I,rawPassword:B,zipCrypto:F,encryptionStrength:d&&d.strength,signed:Se(o,s,Bf)&&!g,passwordVerification:F&&(v?b>>>8&On:m>>>24&On),outputSize:g?C:A,signature:m,compressed:f!=0&&!g,encrypted:o.encrypted&&!g,useWebWorkers:Se(o,s,xf),useCompressionStream:q,transferStreams:Se(o,s,Tf),deflate64:W,checkPasswordOnly:R},config:p,streamOptions:{signal:T,size:y,onstart:M,onprogress:Q,onend:Y}};O&&await Wf({reader:r,fileEntry:t,offset:l,diskNumberStart:a,signature:m,compressedSize:C,uncompressedSize:A,dataOffset:E,dataDescriptor:v||S.bitFlag.dataDescriptor,extraFieldZip64:h||S.extraFieldZip64,readRanges:n});let oe;try{if(!L){R&&(e=new WritableStream),e=new lf(e),await Qi(e,g?C:A),{writable:oe}=e;const{outputSize:ne}=await Ju({readable:w,writable:oe},Z);if(e.size+=ne,ne!=(g?C:A))throw new Error(Vo)}}catch(ne){if(ne.outputSize!==de&&(e.size+=ne.outputSize),!R||ne.message!=Gn)throw ne}finally{!Se(o,s,Mf)&&oe&&!oe.locked&&await oe.getWriter().close()}return R||L?de:e.getData?e.getData():oe}}function vr(i,e,t){const n=i.rawBitFlag=Be(e,t+2),s=(n&Ao)==Ao,o=he(e,t+6);Object.assign(i,{encrypted:s,version:Be(e,t),bitFlag:{level:(n&jh)>>1,dataDescriptor:(n&yo)==yo,languageEncodingFlag:(n&Co)==Co},rawLastModDate:o,lastModDate:Kf(o),filenameLength:Be(e,t+22),extraFieldLength:Be(e,t+24)})}function Ir(i,e,t,n,s){const{rawExtraField:o}=e,r=e.extraField=new Map,l=ue(new Uint8Array(o));let a=0;try{for(;a<o.length;){const v=Be(l,a),S=Be(l,a+2);r.set(v,{type:v,data:o.slice(a+4,a+4+S)}),a+=4+S}}catch{}const d=Be(t,n+4);Object.assign(e,{signature:he(t,n+su),compressedSize:he(t,n+ou),uncompressedSize:he(t,n+ru)});const h=r.get(Nh);h&&(Hf(h,e),e.extraFieldZip64=h);const f=r.get(Hh);f&&(Br(f,rr,ar,e,i),e.extraFieldUnicodePath=f);const p=r.get(Yh);p&&(Br(p,lr,cr,e,i),e.extraFieldUnicodeComment=p);const u=r.get(Uh);u?(Yf(u,e,d),e.extraFieldAES=u):e.compressionMethod=d;const m=r.get(_h);m&&(Vf(m,e),e.extraFieldNTFS=m);const b=r.get(Wh);if(b)xr(b,e,!1),e.extraFieldUnix=b;else{const v=r.get(zh);v&&(xr(v,e,!0),e.extraFieldInfoZip=v)}const A=r.get(Gh);A&&(zf(A,e,s),e.extraFieldExtendedTimestamp=A);const C=r.get(Vh);C&&(e.extraFieldUSDZ=C)}function Hf(i,e){e.zip64=!0;const t=ue(i.data),n=_f.filter(([s,o])=>e[s]==o);for(let s=0,o=0;s<n.length;s++){const[r,l]=n[s];if(e[r]==l){const a=Qf[l];e[r]=i[r]=a.getValue(t,o),o+=a.bytes}else if(i[r])throw new Error(Rf)}}function Br(i,e,t,n,s){const o=ue(i.data),r=new Li;r.append(s[t]);const l=ue(new Uint8Array(4));l.setUint32(0,r.get(),!0);const a=he(o,1);Object.assign(i,{version:ct(o,0),[e]:Gi(i.data.subarray(5)),valid:!s.bitFlag.languageEncodingFlag&&a==he(l,0)}),i.valid&&(n[e]=i[e],n[e+Uf]=!0)}function Yf(i,e,t){const n=ue(i.data),s=ct(n,4);Object.assign(i,{vendorVersion:ct(n,0),vendorId:ct(n,2),strength:s,originalCompressionMethod:t,compressionMethod:Be(n,5)}),e.compressionMethod=i.compressionMethod}function Vf(i,e){const t=ue(i.data);let n=4,s;try{for(;n<i.data.length&&!s;){const o=Be(t,n),r=Be(t,n+2);o==Qh&&(s=i.data.slice(n+4,n+4+r)),n+=4+r}}catch{}try{if(s&&s.length==24){const o=ue(s),r=o.getBigUint64(0,!0),l=o.getBigUint64(8,!0),a=o.getBigUint64(16,!0);Object.assign(i,{rawLastModDate:r,rawLastAccessDate:l,rawCreationDate:a});const d=Zn(r),h=Zn(l),f=Zn(a),p={lastModDate:d,lastAccessDate:h,creationDate:f};Object.assign(i,p),Object.assign(e,p)}}catch{}}function xr(i,e,t){try{const n=ue(new Uint8Array(i.data));let s=0;const o=ct(n,s++),r=ct(n,s++),l=i.data.subarray(s,s+r);s+=r;const a=Sr(l),d=ct(n,s++),h=i.data.subarray(s,s+d);s+=d;const f=Sr(h);let p=de;if(!t&&s+2<=i.data.length){const u=i.data;p=new DataView(u.buffer,u.byteOffset+s,2).getUint16(0,!0)}Object.assign(i,{version:o,uid:a,gid:f,unixMode:p}),a!==de&&(e.uid=a),f!==de&&(e.gid=f),p!==de&&(e.unixMode=p)}catch{}}function Sr(i){const e=new Uint8Array(4);return e.set(i,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function zf(i,e,t){const n=ue(i.data),s=ct(n,0),o=[],r=[];t?((s&1)==1&&(o.push(Xn),r.push(qn)),(s&2)==2&&(o.push(pr),r.push(hf)),(s&4)==4&&(o.push(gr),r.push(mr))):i.data.length>=5&&(o.push(Xn),r.push(qn));let l=1;o.forEach((a,d)=>{if(i.data.length>=l+4){const h=he(n,l);e[a]=i[a]=new Date(h*1e3);const f=r[d];i[f]=h}l+=4})}async function Wf({reader:i,fileEntry:e,offset:t,diskNumberStart:n,signature:s,compressedSize:o,uncompressedSize:r,dataOffset:l,dataDescriptor:a,extraFieldZip64:d,readRanges:h}){let f=0;if(n)for(let m=0;m<n;m++){const b=i.readers[m];f+=b.size}let p=0;if(a&&(d?p=Lh:p=Oh),p){const m=await xe(i,l+o,p+mo,n);if(he(ue(m),0)==Ph){const A=he(ue(m),4);let C,v;d?(C=Ut(ue(m),8),v=Ut(ue(m),16)):(C=he(ue(m),8),v=he(ue(m),12)),(e.encrypted&&!e.zipCrypto||A==s)&&C==o&&v==r&&(p+=mo)}}const u={start:f+t,end:f+l+o+p,fileEntry:e};for(const m of h)if(m.fileEntry!=e&&u.start>=m.start&&u.start<m.end){const b=new Error(Nf);throw b.overlappingEntry=m.fileEntry,b}h.push(u)}async function jf(i,e,t,n,s){const o=new Uint8Array(4),r=ue(o);$f(r,0,e);const l=n+s;return await a(n)||await a(Math.min(l,t));async function a(d){const h=t-d,f=await xe(i,h,d);for(let p=f.length-n;p>=0;p--)if(f[p]==o[0]&&f[p+1]==o[1]&&f[p+2]==o[2]&&f[p+3]==o[3])return{offset:h+p,buffer:f.slice(p,p+n).buffer}}}function Se(i,e,t){return e[t]===de?i.options[t]:e[t]}function Kf(i){const e=(i&4294901760)>>16,t=i&Ke;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 Zn(i){return new Date(Number(i/BigInt(1e4)-BigInt(116444736e5)))}function ct(i,e){return i.getUint8(e)}function Be(i,e){return i.getUint16(e,!0)}function he(i,e){return i.getUint32(e,!0)}function Ut(i,e){return Number(i.getBigUint64(e,!0))}function $f(i,e,t){i.setUint32(e,t,!0)}function ue(i){return new DataView(i.buffer)}try{Oi({baseURI:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Cn&&Cn.tagName.toUpperCase()==="SCRIPT"&&Cn.src||new URL("leiting-bim.umd.js",document.baseURI).href})}catch{}const Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Xf(i){let e;i({wasmURI:()=>(e||(e="data:application/wasm;base64,"+(t=>{t=(r=>{const l=(r=(r+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,a=[];for(let d=0;l>d;d+=4){const h=Fe.indexOf(r[d])<<18|Fe.indexOf(r[d+1])<<12|(63&Fe.indexOf(r[d+2]))<<6|63&Fe.indexOf(r[d+3]);a.push(h>>16&255),r[d+2]!=="="&&a.push(h>>8&255),r[d+3]!=="="&&a.push(255&h)}return new Uint8Array(a)})(t);let n=new Uint8Array(1024),s=0;for(let r=0;r<t.length;){const l=t[r++];if(128&l){const a=3+(127&l),d=t[r++]<<8|t[r++],h=s-d;o(s+a);for(let f=0;a>f;f++)n[s++]=n[h+f]}else{const a=l;o(s+a);for(let d=0;a>d&&r<t.length;d++)n[s++]=t[r++]}}return(r=>{let l="";const a=r.length;let d=0;for(;a>d+2;d+=3){const f=r[d]<<16|r[d+1]<<8|r[d+2];l+=Fe[f>>18&63]+Fe[f>>12&63]+Fe[f>>6&63]+Fe[63&f]}const h=a-d;if(h===1){const f=r[d]<<16;l+=Fe[f>>18&63]+Fe[f>>12&63]+"=="}else if(h===2){const f=r[d]<<16|r[d+1]<<8;l+=Fe[f>>18&63]+Fe[f>>12&63]+Fe[f>>6&63]+"="}return l})(new Uint8Array(n.buffer.slice(0,s)));function o(r){if(n.length<r){let l=2*n.length;for(;r>l;)l*=2;const a=new Uint8Array(l);a.set(n.subarray(0,s)),n=a}}})("FQBhc20BAAAAAUULYAF/AX9gAn9/AIEABYAACwIDf4IABwEBgAARAQaAAAuDAA6BABUDAGAAgAADgAANAQSBABUDAGAHgwAegAAfEgNCQQcABAEABAgIAAIABQIKAIAAB4EAAwEFgQAHAgICgQAHEAEDAAUGAAMDBQQJBAQJAQaAAAEeAAIEAwIEAgIBBAcDAwQFAXABDQ0FBgEBggKCAgYIgACYIkHQ1QQLB4oEHAZtZW1vcnkCAAxpbmZsYXRlOV9uZXcABw2GAA8HaW5pdAAIEYoAEAdfcmF3AAoQhgAU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QWAA9QBBYADuAEFgAOcgE92gAAEARGAAAQBCYAABAEZgAAEgQACARWAAAQBDYAABAEdgAAEgL59gAKkgQZAAQWAAiyBBaYBBYABtAEFgD3fAxsLTYMfuYcABIC+rooABIEHUYkABAEEjAAEAQWKAAQEQbAcC4C9CosAS40AO4UALwEGhAAEgQWIgQAEgQEKgQAEgQGSgQAEgIS2ggAEAQuEAAQBDIQABIAF24FHeQTgHQsjhQBfhQXLAhARgAVtBgcJBgoFC4A6uAQNAg4BgAclBJQeC2mFAJCFAIiFAICFAHiBAGiBAFyBBh8BEIAABAEUgAAEARiAAAQBHIAABAEggAAEASiAAAQBMIAABAE4gAAEAUCAAAQBUIAABIEGvQFwgAAEAYCAAAQBoIAABAHAgAAEAeCAAG8DHwtyjQBvgQBrgQBngQBjgQBfgQBbgQBXgQBTgQBPgQBLgQBHgQBDgQE8AYCvAEGAUc0CC22BAMcBBIAAAgEIgAAEgQEzgQJLARCAAA6DAAyBnqyAqmuEACSBB3OBAE8BCIAACIEAGIUADIEIt4MADAEggQCUgDKEgQBrAYCBCC8BBIMADIA/SAoBABAMAEGRIQv/gCUfgMDAgIKxBQgJCQoKgEk3gAABAQ2AAAEBDoAAAQEPgAABARCEAAEBEYQAAQEShAABAROEAAEBFIwAAQEVjAABARaMAAEBF4wAAQEYnAABARmcAAEBGpwAAQEbmwABARyBffsEBAQFBYHB1QEHgAABAQiEAAGAXSqCAAEBCowAAYAnsooAAYEBMJkAAYEBTJkAAYEBaLkAAYEBpLkAAYIDdYABzoUBvI0BqJ0BkLwBgAIbHLwAAQEdvAABgA9PgH05A9AqAQ==")),e)})}let me,_t,Re,ri;function qf(i){if(me=i,{malloc:_t,free:Re,memory:ri}=me,typeof _t!="function"||typeof Re!="function"||!ri)throw me=_t=Re=ri=null,new Error("Invalid WASM module")}function Tr(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=_t(s),this.in=_t(o),this.inBufferSize=o,this._scratch=new Uint8Array(s),i?(this._process=me.deflate_process,this._last_consumed=me.deflate_last_consumed,this._end=me.deflate_end,this.streamHandle=me.deflate_new(),e==="gzip"?r=me.deflate_init_gzip(this.streamHandle,n):e==="deflate-raw"?r=me.deflate_init_raw(this.streamHandle,n):r=me.deflate_init(this.streamHandle,n)):e==="deflate64-raw"?(this._process=me.inflate9_process,this._last_consumed=me.inflate9_last_consumed,this._end=me.inflate9_end,this.streamHandle=me.inflate9_new(),r=me.inflate9_init_raw(this.streamHandle)):(this._process=me.inflate_process,this._last_consumed=me.inflate_last_consumed,this._end=me.inflate_end,this.streamHandle=me.inflate_new(),e==="deflate-raw"?r=me.inflate_init_raw(this.streamHandle):e==="gzip"?r=me.inflate_init_gzip(this.streamHandle):r=me.inflate_init(this.streamHandle)),r!==0)throw new Error("init failed:"+r)},transform(r,l){try{const a=r,d=new Uint8Array(ri.buffer),h=this._process,f=this._last_consumed,p=this.out,u=this._scratch;let m=0;for(;m<a.length;){const b=Math.min(a.length-m,32768);(!this.in||this.inBufferSize<b)&&(this.in&&Re&&Re(this.in),this.in=_t(b),this.inBufferSize=b),d.set(a.subarray(m,m+b),this.in);const A=h(this.streamHandle,this.in,b,p,s,0),C=A&16777215;if(C&&(u.set(d.subarray(p,p+C),0),l.enqueue(u.slice(0,C))),!i){const S=A>>24&255,D=S&128?S-256:S;if(D<0)throw new Error("process error:"+D)}const v=f(this.streamHandle);if(v===0)break;m+=v}}catch(a){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Re&&Re(this.in),this.out&&Re&&Re(this.out),l.error(a)}},flush(r){try{const l=new Uint8Array(ri.buffer),a=this._process,d=this.out,h=this._scratch;for(;;){const f=a(this.streamHandle,0,0,d,s,4),p=f&16777215,u=f>>24&255;if(!i){const m=u&128?u-256:u;if(m<0)throw new Error("process error:"+m)}if(p&&(h.set(l.subarray(d,d+p),0),r.enqueue(h.slice(0,p))),u===1||p===0)break}}catch(l){r.error(l)}finally{if(this._end&&this.streamHandle){const l=this._end(this.streamHandle);l!==0&&r.error(new Error("end error:"+l))}this.in&&Re&&Re(this.in),this.out&&Re&&Re(this.out)}}})}class Jf{constructor(e="deflate",t){return Tr(!0,e,t)}}class Zf{constructor(e="deflate",t){return Tr(!1,e,t)}}let Mr=!1;async function ep(i,{baseURI:e}){if(!Mr){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=tp(i);else throw o}const s=await WebAssembly.instantiate(t);qf(s.instance.exports),Mr=!0}}function tp(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 es;Xf(Oi),Vu({initModule:i=>{if(!es){let{wasmURI:e}=i;typeof e==wt&&(e=e()),es=ep(e,i)}return es}}),Oi({CompressionStreamZlib:Jf,DecompressionStreamZlib:Zf});const ts={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(ts))for(const t of Object.keys(ts[e])){const n=ts[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})(),hu(Oi);const ip="E84#E3C4!8C4&A1";async function tt(i){try{const e=await fetch(i);if(!e.ok)return!1;const t=await e.blob();try{const n=new br(new $n(t),{password:ip}),o=(await n.getEntries()).find(l=>!l.directory&&l.filename.endsWith(".json"));if(!o)return await n.close(),!1;const r=await o.getData(new of);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}}async function Dr(i){if(!i||i.length===0)return null;try{const e=await fetch("/cx_dzpt/bim/modelComponent/listByDbNameAndElementId",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return e.ok?await e.json():(console.warn(`[fetchComponentDetails] API 请求失败: ${e.status}`),null)}catch(e){return console.error("[fetchComponentDetails] 加载异常:",e),null}}function np(){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 Hi{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))}}class kr{cesium;viewer;modelList=[];hasLoaded3dTiles={};mapRecordModelId={};mapTileset={};BIMmodelId="";lazyLoadingCount=0;events=new Hi;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?Sh({},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:Ot.NotLoaded}),this.mapRecordModelId[o]=!1}await this.load3DTilesModel(n)}}async load3DTilesModel(e){const t=this.modelList.filter(r=>r.state===Ot.NotLoaded);if(!t.length)return;const n=t.length;this.events.emit("loadingStatus",`正在加载 ${n} 个模型`);let s=0,o=!1;for(const r of t){s++;try{r.state=Ot.Loading;const l=r.url,a=this.getBaseUrlPath(l);e.loadTreeNodeDetails=!1,e.loadTreeNodeDetails&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}构件信息`);let d=e.loadTreeNodeDetails?await tt(`${a}${e.loadTreeNodeDetailsUrl}`):!1;e.loadTree=!1,e.loadTree&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}目录树`);const h=e.loadTree?await tt(`${a}${e.loadTreeUrl}`):!1;this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}模型数据`);const f=e.boxRegionUrl?await tt(`${a}${e.boxRegionUrl}`):!1,p=e.batchIDInfoUrl?await tt(`${a}${e.batchIDInfoUrl}`):!1;p&&(d||(d=p));const u=await this.loadTilesetWithZipSupport(l,r.modelId,e.tilesetOptions||{},this.cesium);this.viewer.scene.primitives.add(u),await u.readyPromise;const m=`${u?.asset?.tilesetVersion??r.modelId}`;this.mapTileset[`${r.modelId}`]=u;const b={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:`${a}${e.loadTreeUrl}`,nodeUrl:`${a}${e.loadTreeNodeDetailsUrl}`,formData:r.formData,type:"BIM"},node:d||null,tree:h||null,box:null};if(f?.min&&f?.max){const A={x:f.min.X,y:f.min.Y,z:f.min.Z},C={x:f.max.X,y:f.max.Y,z:f.max.Z},v={x:(A.x+C.x)/2,y:(A.y+C.y)/2,z:(A.z+C.z)/2};b.box={min:A,max:C,center:v}}if(!r.formData){const A=await tt(`${r.outPutPath}${r.dbName}${e.regionUrl}`);if(A)r.formData={modelId:r.modelId.toString(),longitude:A.Longitude,latitude:A.Latitude,distance:1e-6,rotation:30,totalRotation:A.DAngle||0,height:A.MinHeight,lonlat:1e-5,heightDistance:1,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:A?.X||0,Y:A?.Y||0,Z:A?.Z||0};else{const C=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:C+1,label:r.modelName}],X:0,Y:0,Z:0}}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1,b.model.formData=r.formData),u.leiting=b,Rn({Cesium:this.cesium,tileset:u}),r.state=Ot.Loaded,this.mapRecordModelId[r.modelId]=!0,this.events.emit("tilesetLoaded",u),e.tilesLoad3dTiles&&e.tilesLoad3dTiles(u),!o&&e.flyTo&&(this.BIMmodelId=r.modelId,this.flyToTileset({modelId:this.BIMmodelId,options:{duration:e.flyToDuration??0}}),o=!0),e.delay&&await new Promise(A=>setTimeout(A,e.delay))}catch(l){console.error(`模型 ${r.modelName} 加载失败:`,l),this.events.emit("loadingStatus",`模型 ${r.modelName} 加载失败`),r.state=Ot.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:l,dbName:a,modelId:d}=r,h=`${l}${a}/tileset.json`,f=await n.Cesium3DTileset.fromUrl(h,{maximumScreenSpaceError:16,preferLeaves:!0,cullWithChildrenBounds:!0,...t?.tilesetOptions});if(f.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE,this.viewer.scene.primitives.add(f),await f.readyPromise,this.mapTileset[`${d}`]=f,this.hasLoaded3dTiles[`${d}`]=(this.hasLoaded3dTiles[`${d}`]||0)+1,this.mapRecordModelId[`${d}`]=!0,!r?.formData){const p=f.root.computedTransform;if(p){const u=n.Matrix4.fromColumnMajorArray(p),m=n.Matrix4.getTranslation(u,new n.Cartesian3),b=n.Ellipsoid.WGS84.cartesianToCartographic(m),A=n.Math.toDegrees(b.longitude),C=n.Math.toDegrees(b.latitude),v=b.height;r.formData={modelId:r.modelId.toString(),longitude:A,latitude:C,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:v,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:0,Y:0,Z:0}}else console.warn(`OSGB模型 ${d} 无法获取初始位置信息`)}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1),f.leiting={versionId:`${f?.asset?.tilesetVersion??d}`,selectedFn:t?.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:h,formData:r.formData,type:"OSGB"},box:null},Rn({Cesium:this.cesium,tileset:f}),this.modelList.push({...r,url:h,state:Ot.Loaded}),!s&&t?.flyTo&&(this.BIMmodelId=r.modelId,this.viewer.zoomTo(f),s=!0)}catch(l){console.error(`OSGB模型 ${r.dbName} 加载失败:`,l);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,l=this.mapTileset[o];if(!l){console.warn("tileSet not found for modelId:",o);return}let a=t||0,d=n||0,h=s||0;const f=l.boundingSphere.center,p=r.Transforms.eastNorthUpToFixedFrame(f),u=new r.Cartesian3(a,d,h),m=r.Matrix4.multiplyByPoint(p,u,new r.Cartesian3(0,0,0)),b=r.Cartesian3.subtract(m,f,new r.Cartesian3);l.modelMatrix=r.Matrix4.fromTranslation(b)}flyToTileset({modelId:e=this.BIMmodelId,options:t={}}={}){const s=this.getMapTileset()[e];if(!s||!this.viewer)return;const{complete:o,cancel:r,...l}=t,a={duration:0,...l};this.viewer.flyTo(s,a).then(d=>{d?o&&o():r&&r()}).catch(d=>{r&&r(),console.error("FlyTo error",d)})}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=e.lastIndexOf("/");return t===-1?".":e.substr(0,t)}async loadTilesetWithZipSupport(e,t,n,s){const o=`${this.getBaseUrlPath(e)}/tileset.zip`;if((await fetch(o,{method:"HEAD"})).status===200){const a=await tt(o);if(a){const d=new Blob([JSON.stringify(a)],{type:"application/json"}),h=URL.createObjectURL(d);class f{getURL(A){return A.includes("blob://")?A.replace(/blob:\/\//g,u):A}}const p=new f,u=this.getBaseUrlPath(e),m=new s.Resource({url:h,proxy:p});try{return await s.Cesium3DTileset.fromUrl(m,{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})}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 tt(s);if(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 tt(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 tt(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 Pr={normal:0,process:2},sp={color:1};function Fr(i){return i===1||i==="exist"?1:i===2||i==="process"?2:0}function Qt(i){return Number.isNaN(i)?0:i<=1?Math.min(Math.max(i,0),1):Math.min(Math.max(i/255,0),1)}function Rr(i){return Number.isNaN(i)?1:i<=1?Math.min(Math.max(i,0),1):1}function is(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(a=>Number.isNaN(a)))return null;const o=Math.round(e*255),r=Math.round(t*255),l=Math.round(n*255);return`rgba(${o},${r},${l},${s})`}function op(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(l=>Number.isNaN(l))?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 rp(i){if(i==null)return null;const e=Number(i);return Number.isNaN(e)?null:e}function ap(i){const e=i.lastIndexOf("-"),t=i.substring(0,e),n=i.substring(e+1);return[t,n]}function ns(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),l=Number(t.y??t.Y),a=Number(t.z??t.Z);return[n,s,o,r,l,a].some(d=>Number.isNaN(d))?null:{min:{x:n,y:s,z:o},max:{x:r,y:l,z:a}}}function ai(i,e){if(e)return`${e}`;const t=i?.leiting?.model?.modelId??i?.modelId??i?.id;return t==null?null:`${t}`}function lp(i,e){if(e==null)return null;const t=i?.leiting?.node;if(!t)return null;const n=`${e}`,s=t?.[n],o=ns(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 ns(r?.box3??r?.box)}function cp(i){const e=i?.leiting?.box;return e?ns({min:e.min,max:e.max}):null}class dp{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(l=>{const{batchIds:a,modelId:d,rgba:h}=l;if(Array.isArray(a)&&a[0]){a[0][1]=h;const f=n[d];f?f.push(a[0]):n[d]=[a[0]]}})),t>=o&&t<r&&(s!==null&&(this.base.viewer.scene.ambientLightIntensity=s),e.cash=!1,e.playCash=!0,e.groupData.forEach(l=>{const{batchIds:a,playTimeColor:d,modelId:h}=l;if(Array.isArray(a)&&a[0]){a[0][1]=d;const f=n[h];f?f.push(a[0]):n[h]=[a[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(l=>l.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:l}=r;this.base.setTileSyltByConstructionProcessTracking({modelId:l,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 l=e[o];l?l.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(a=>{s.push({dbName:n.linkModelId,modelId:n.modelId,elementId:`${a}`,show:!0,rgba:t.rgba??{r:.2,g:.2,b:.2,a:.2}})});const o=Pr.process,r=sp.color,{allElements:l}=this.base.groupByModelId(s);this.base.mapAnimations[n.modelId]=this.base.mapAnimations[n.modelId]||[],this.base.mapAnimations[n.modelId].push(t),Object.entries(l).forEach(([a,d])=>{const[h,f]=ap(a),p=this.base.getTileSyltByConstructionProcessTracking({elementIds:d,modelId:h,color:f,colorRank:o,show:!0,selectionRank:r}),u=t?.playTimeColor?.r??1,m=t?.playTimeColor?.g??1,b=t?.playTimeColor?.b??0,A=t?.playTimeColor?.a??.1,C=this.base.setColor({r:u,g:m,b,a:A}),v=this.base.setColor(t.rgba??{r:.2,g:.2,b:.2,a:.2});t.groupData.push({modelId:h,batchIds:p,playTimeColor:C,rgba:v})})})})}}class hp{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=ai(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=>{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=ai(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const h=e.Cartographic.fromCartesian(l),f=e.Math.toDegrees(h.longitude),p=e.Math.toDegrees(h.latitude),u=h.height;r=[f,p,u]}const d=(this.base.hasSelectedFeaturesMap[s]||[]).filter(h=>h.rank!==0);if(this.base.hasSelectedFeaturesMap[s]=[...d,{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,f=n.tileset.leiting.node.nodeExtras.element[h];f.elementId=h,f.modelId=n.tileset.leiting.model.modelId,n.tileset.leiting.selectedFn({elementInfo:f,elementId:h,point:r,modelId:n.tileset.leiting.model.modelId,_propsData:f})}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=ai(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const a=e.Cartographic.fromCartesian(l),d=e.Math.toDegrees(a.longitude),h=e.Math.toDegrees(a.latitude),f=a.height;r=[d,h,f]}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),l=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=`${l}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 up{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;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.animationModule=new dp(this),this.selectionModule=new hp(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=Fr(t),s=[];for(const o of Object.keys(this.hasSelectedFeaturesMap))(this.hasSelectedFeaturesMap[o]||[]).forEach(l=>{if(l.rank!==n)return;const a=op(l.selectedColor);let d=this.getBatchIdToElementIdSync(l.batchId,o);d===null&&(d=l.batchId),l.isTrigger&&s.push({elementId:d,modelId:o,rgba:a||void 0,point:l?.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 l=r?.modelId;if(l==null)continue;await this.loadNodeDetailsForModel(l);const a=r?.elementId,d=this.tilesetMap[`${l}`];if(!d)continue;const f=lp(d,a)||cp(d);if(!f)continue;const p=new n.Cartesian3(f.min.x,f.min.y,f.min.z),u=new n.Cartesian3(f.max.x,f.max.y,f.max.z),m=d?.root?.computedTransform??d?.modelMatrix;if(m){const b=n.Matrix4.multiplyByPoint(m,p,new n.Cartesian3),A=n.Matrix4.multiplyByPoint(m,u,new n.Cartesian3);o.push(b,A)}else o.push(p,u)}if(o.length){const r=n.BoundingSphere.fromPoints(o);r.radius=r.radius*s;const l=this.viewer.scene.camera,a=new n.HeadingPitchRange(l.heading,l.pitch,0);l.flyToBoundingSphere(r,{duration:t?.duration??0,complete:t?.complete,offset:a})}else{const r=e[0]?.modelId,l=r?this.tilesetMap[`${r}`]:null;l&&this.viewer.flyTo(l,{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(a=>{const d=s.get(a.batchId);(!d||a.rank>=d.rank)&&s.set(a.batchId,a)});const o=new Map;if(s.forEach(({batchId:a,selectedColor:d})=>{o.has(d)||o.set(d,new Set),o.get(d)?.add(a)}),this.colorRankColor.length){const a=new Set;this.colorRankColor.forEach(d=>{const h=o.get(d);h&&h.forEach(f=>a.add(f))}),o.forEach((d,h)=>{if(this.colorRankColor.includes(h))return;const f=new Set;d.forEach(p=>{a.has(p)||f.add(p)}),o.set(h,f)})}const r=[...this.colorRankColor.filter(a=>o.has(a)),...Array.from(o.keys()).filter(a=>!this.colorRankColor.includes(a))],l=[];return r.forEach(a=>{const d=o.get(a);if(!d||!d.size)return;const h=Array.from(d).join("|");h&&l.push([`(regExp('^(${h})$').test(\${id}))`,a])}),l.length?l: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=Qt(Number(e.r)),n=Qt(Number(e.g)),s=Qt(Number(e.b)),o=Rr(e.a===void 0?1:Number(e.a));return is({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,l=this.setColor(r??{r:.4,g:.4,b:.4,a:.1}),a=`${s}-${l}`;t[a]||(t[a]=[]),t[a].push(`${o}`)}),{allElements:t,transform:null,box:null}}getBatchId(e,t){const n=`${t}`,s=`${e}`;if(this.eidToBatchIdMap[n]){const a=this.eidToBatchIdMap[n].get(s);if(a!==void 0)return a;if(!a)return s}const r=this.tilesetMap[n]?.leiting?.node?.batchIdEIDInfos;if(r&&Array.isArray(r)){const a=new Map;r.forEach(h=>{a.set(`${h.elementID}`,`${h.batchId}`)}),this.eidToBatchIdMap[n]=a;const d=a.get(s);if(d!==void 0)return d}const l=rp(e);return l!=null?String(l):null}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.getBatchId(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 l=[];for(const a of o)r.has(`${a.elementID}`)||l.push(`${a.batchId}`);this.showStateMap[n].batchIds=l;continue}this.showStateMap[n].batchIds=o.map(l=>l.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 l=r.leiting.node.batchIdEIDInfos,a=new Set(o?.batchIds??[]),d=o?.mode??"exclude";l.forEach(h=>{const f=a.has(`${h.batchId}`);(d==="include"?f:!f)===e&&n.push({elementId:`${h.elementID}`,modelId:s})})}),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 l=r.leiting.node.batchIdEIDInfos,a=new Set(o?.batchIds??[]),d=o?.mode??"exclude";l.forEach(h=>{const f=a.has(`${h.batchId}`);(d==="include"?f:!f)===e&&n.push({elementId:`${h.elementID}`,modelId:s})})}),n}getTileSyltByConstructionProcessTracking({elementIds:e,modelId:t,color:n,colorRank:s,show:o,selectionRank:r}){const l=this.tilesetMap[t];if(!Array.isArray(e))return[];const a=l.leiting.node,d=new Set(e),h=a.batchIdEIDInfos.filter(p=>d.has(`${p.elementID}`)).map(p=>String(p.batchId));return h.length?(s===Pr.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=Fr(s),r=t?.isTrigger??!0;for(const l of e){const a=l?.modelId;if(a==null)continue;const d=`${a}`;await this.loadNodeDetailsForModel(d);const h=Array.isArray(l?.elementIds)?l.elementIds:l?.elementId?[l.elementId]:[];if(!h.length)continue;const f=is(l?.rgba)||this.selectedColor;for(const p of h){const u=this.getBatchId(p,d);u!==null&&(n.has(d)||n.set(d,[]),n.get(d)?.push({batchId:u,selectedColor:f,rank:o,isTrigger:r}))}}for(const[l,a]of n){const d=this.mergeSelections(l,a);this.hasSelectedFeaturesMap[l]=d,this.setBaseStyle(l)}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),l=this.tilesetMap[r];if(!l)return;const a=l?.leiting?.node?.batchIdEIDInfos;if(!a||!Array.isArray(a))return;const d=[];a.forEach(h=>{h&&h.elementID!==void 0&&d.push(h.elementID)}),d.length!==0&&await this.setSelectColorUserModelCpt([{modelId:r,elementIds:d,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=Qt(e),r=Qt(t),l=Qt(n),a=Rr(s),d=is({r:o,g:r,b:l,a});d&&(this.selectedColor=d)}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(f=>f.rank!==0),l=o.filter(f=>f.rank===0),d=l.some(f=>f.batchId===t)?l.filter(f=>f.batchId!==t):[...l,{batchId:t,selectedColor:n,rank:0,point:s,isTrigger:!0}],h=[...r,...d];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),l=Math.max(e.y,t.y),a=o-s,d=l-r;if(Math.abs(a)<15||Math.abs(d)<15)return;const h=s+a/2,f=r+d/2,p=new this.cesium.Cartesian2(h,f),u=this.viewer.scene.drillPick(p,void 0,a,d);if(!Array.isArray(u))return;const m=new Map;u.forEach(b=>{if(!(b instanceof this.cesium.Cesium3DTileFeature))return;const A=ai(b.tileset);if(!A||!this.tilesetMap[A])return;const C=this.getFeatureId(b);C!=="-1"&&(m.has(A)||m.set(A,new Set),m.get(A)?.add(C))}),m.forEach((b,A)=>{const C=this.hasSelectedFeaturesMap[A]||[],v=C.filter(I=>I.rank!==0),S=new Set(C.filter(I=>I.rank===0).map(I=>I.batchId)),D=[];b.forEach(I=>{S.has(I)||D.push({batchId:I,selectedColor:n,rank:0,isTrigger:!0})});const N=C.filter(I=>I.rank===0);this.hasSelectedFeaturesMap[A]=[...v,...N,...D],this.setBaseStyle(A)}),await this.triggerSelectionChange()}}class fp{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,l=Math.max(r,this.targetXMinus+this.targetXPlus),a=Math.max(r,this.targetYPlus+this.targetYMinus),d=Math.max(r,this.targetZPlus+this.targetZMinus);return s==="top"||s==="down"?new e.Cartesian2(l,a):s==="left"||s==="right"?new e.Cartesian2(a,d):new e.Cartesian2(l,d)},!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),l=this.boxInverseMatrix,a=e.Matrix4.multiplyByPoint(l,r.origin,new e.Cartesian3),d=e.Matrix4.multiplyByPointAsVector(l,r.direction,new e.Cartesian3);e.Cartesian3.normalize(d,d);const h=new e.Ray(a,d),f=this.getPlaneByType(this.currentPlaneType);this.dragStartPoint=e.IntersectionTests.rayPlane(h,f,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,l=e.Matrix4.multiplyByPoint(r,o.origin,new e.Cartesian3),a=e.Matrix4.multiplyByPointAsVector(r,o.direction,new e.Cartesian3);e.Cartesian3.normalize(a,a);const d=new e.Ray(l,a);let h=new e.Cartesian3;this.currentPlaneType==="top"||this.currentPlaneType==="down"?h=Math.abs(a.x)>Math.abs(a.y)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Y:this.currentPlaneType==="left"||this.currentPlaneType==="right"?h=Math.abs(a.y)>Math.abs(a.z)?e.Cartesian3.UNIT_Y:e.Cartesian3.UNIT_Z:h=Math.abs(a.x)>Math.abs(a.z)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z;const f=-e.Cartesian3.dot(this.dragStartPoint,h),p=new e.Plane(h,f);let u=e.IntersectionTests.rayPlane(d,p,new e.Cartesian3);if(!u){const b=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,A=-e.Cartesian3.dot(this.dragStartPoint,b);u=e.IntersectionTests.rayPlane(d,new e.Plane(b,A),new e.Cartesian3)}if(!u)return;const m=.01;switch(this.currentPlaneType){case"left":this.targetXMinus=Math.max(-this.targetXPlus+m,-u.x);break;case"right":this.targetXPlus=Math.max(-this.targetXMinus+m,u.x);break;case"behind":this.targetYMinus=Math.max(-this.targetYPlus+m,-u.y);break;case"front":this.targetYPlus=Math.max(-this.targetYMinus+m,u.y);break;case"top":this.targetZPlus=Math.max(-this.targetZMinus+m,u.z);break;case"down":this.targetZMinus=Math.max(-this.targetZPlus+m,-u.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(f=>{const p=this.tilesetMap[f];p&&p.boundingSphere&&t.push(p.boundingSphere.center)}),t.length===0)return;const n=new e.Cartesian3;t.forEach(f=>e.Cartesian3.add(n,f,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,l=-1/0,a=1/0,d=-1/0;this.activeModelIds.forEach(f=>{const p=this.tilesetMap[f];if(!p)return;const u=[],m=p.leiting?.box,b=p.root?.boundingVolume?.boundingVolume;if(m&&m.min&&m.max){const{min:A,max:C}=m,v=[new e.Cartesian3(A.x,A.y,A.z),new e.Cartesian3(C.x,A.y,A.z),new e.Cartesian3(A.x,C.y,A.z),new e.Cartesian3(C.x,C.y,A.z),new e.Cartesian3(A.x,A.y,C.z),new e.Cartesian3(C.x,A.y,C.z),new e.Cartesian3(A.x,C.y,C.z),new e.Cartesian3(C.x,C.y,C.z)],S=p.root.transform;v.forEach(D=>{u.push(e.Matrix4.multiplyByPoint(S,D,new e.Cartesian3))})}else if(b&&b.halfAxes){const A=b.center,C=b.halfAxes,v=e.Matrix3.getColumn(C,0,new e.Cartesian3),S=e.Matrix3.getColumn(C,1,new e.Cartesian3),D=e.Matrix3.getColumn(C,2,new e.Cartesian3);for(let N=0;N<8;N++){const I=e.Cartesian3.clone(A,new e.Cartesian3);e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(v,N&1?1:-1,new e.Cartesian3),I),e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(S,N&2?1:-1,new e.Cartesian3),I),e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(D,N&4?1:-1,new e.Cartesian3),I),u.push(I)}}else if(p.boundingSphere){const A=p.boundingSphere,C=A.center,v=A.radius,S=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,C,new e.Cartesian3);s=Math.min(s,S.x-v),o=Math.max(o,S.x+v),r=Math.min(r,S.y-v),l=Math.max(l,S.y+v),a=Math.min(a,S.z-v),d=Math.max(d,S.z+v)}u.forEach(A=>{const C=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,A,new e.Cartesian3);s=Math.min(s,C.x),o=Math.max(o,C.x),r=Math.min(r,C.y),l=Math.max(l,C.y),a=Math.min(a,C.z),d=Math.max(d,C.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(l)*h,this.targetZMinus=Math.abs(a)*h,this.targetZPlus=Math.abs(d)*h,this.activeModelIds.forEach(f=>{this.setupClippingPlanes(f)}),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 ss=performance.now();const pp=10;class gp{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,l=this.cesium.Cartesian3.add(t.positionWC,this.cesium.Cartesian3.multiplyByScalar(o,10,new this.cesium.Cartesian3),new this.cesium.Cartesian3);this.position=l}}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){console.log("Model has animations:",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;ss=performance.now();const n=(o,r)=>{const l=o.code,a=o.keyCode;l==="KeyA"||a===65?this.moveState.moveLeft=r:l==="KeyW"||a===87?this.moveState.moveFront=r:l==="KeyD"||a===68?this.moveState.moveRight=r:l==="KeyS"||a===83?this.moveState.moveBack=r:l==="KeyQ"||a===81?this.moveState.moveUp=r:(l==="KeyE"||a===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,l=o.endPosition.y,a=l-this.lastScreenY,d=r-this.lastScreenX;Math.abs(a)<Math.abs(d)&&(d>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=l;const h=this.viewer.camera;this.cameralHpRoll.pitch=h.pitch+this.cesium.Math.toRadians(-a*.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-ss<pp)return;ss=r;const l=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 a=(f,p)=>new this.cesium.Ray(f,p),d=new this.cesium.Cartesian3;this.cesium.Matrix4.getColumn(this.model.modelMatrix,0,d),this.cesium.Cartesian3.normalize(d,d);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 f=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,l),f);let u=d;o===-1?u=this.cesium.Cartesian3.multiplyByScalar(d,-1,new this.cesium.Cartesian3):o===3?u=h:o===-3&&(u=this.cesium.Cartesian3.multiplyByScalar(h,-1,new this.cesium.Cartesian3));const m=a(p,u),b=this.viewer.scene.pickFromRay(m,[this.model],1);if(b&&b.position&&this.cesium.Cartesian3.distance(p,b.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 f=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=.5,u=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),f),m=new this.cesium.Cartesian3;this.cesium.Cartesian3.subtract(this.position,u,m),this.cesium.Cartesian3.normalize(m,m);const b=a(u,m),A=this.viewer.scene.pickFromRay(b,[this.model],1),C=l,v=this.cesium.Cartesian3.add(u,this.cesium.Cartesian3.multiplyByScalar(d,C,new this.cesium.Cartesian3),new this.cesium.Cartesian3);if(t.defined(A)){const S=t.Cartesian3.distance(u,A.position);S-p>.2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position)),S-p<-.1&&S<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,.2),this.position))}if(!A&&this.gravityTestByMove){const S=a(this.position,m),D=this.viewer.scene.pickFromRay(S,[this.model],1);if(D){const N=this.cesium.Cartesian3.distance(this.position,D.position);Math.abs(N-1)>.05&&N<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position))}}if(A&&this.gravityTestByMove&&this.gravityTest){const S=this.cesium.Cartesian3.distance(v,A.position);Math.abs(S-l)>.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,(l-S)/Math.abs(l-S)*.05),this.position))}}if(this.transparentTest){const f=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=1.75,u=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),f),m=this.viewer.camera.positionWC,b=u,A=t.Cartesian3.subtract(b,m,new t.Cartesian3),C=t.Cartesian3.distance(u,m),v=t.Cartesian3.normalize(A,new t.Cartesian3),S=new t.Ray(m,v);let D;try{D=this.viewer.scene.pickFromRay(S,void 0,1)}catch{}t.defined(D)&&D.primitive!==this.model&&D.position&&t.Cartesian3.distance(m,D.position)<C&&(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=[]}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 mp{cesium;viewer;baseCesium;baseTiles;baseCompt;baseSection;basePlayer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.baseCesium=new Gl(e),this.baseTiles=new kr(e),this.baseCompt=new up(e),this.baseSection=new fp(e),this.basePlayer=new gp({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 Ap{cesium;viewer;mapLayers={};renderGen={};renderGenAll=0;renderGenByModel={};modelId="default";options={flyTo:!0};dxfModelsList=[];open=!1;events=new Hi;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 l=s.layerMap[r];l!==void 0&&(t?s.hiddenBatchIds.delete(l):s.hiddenBatchIds.add(l))});const o=Array.from(s.hiddenBatchIds);if(o.length>0){const r=o.map(l=>`\${_BATCHID} !== ${l}`).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 l=r.content,a=l.featuresLength;if(a>0&&s.hiddenBatchIds)for(let d=0;d<a;d++)s.hiddenBatchIds.has(d)?l.getFeature(d).show=!1:l.getFeature(d).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 br(new $n(n),{password:"abc!?123",useWebWorkers:!1}),r=(await s.getEntries()).find(d=>!d.directory&&d.filename.endsWith(".json"));if(!r)return console.error("未找到 JSON 文件"),await s.close(),!1;const l=await r.arrayBuffer({useWebWorkers:!1});await s.close();const a=new TextDecoder().decode(l);return JSON.parse(a.trim())}catch(t){return console.error("解压或获取失败:",t),!1}}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(d=>d.modelId===s.modelId))return;const l=`${s.outPutPath}${s.dbName}/tileset.json`,a={...this.options,...t};try{const d=`${s.outPutPath}${s.dbName}/layerInfo.zip`,h=await this.loadModelFile(d);if(this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;const f=await this.cesium.Cesium3DTileset.fromUrl(l,{allowPicking:!1});if(f.maximumScreenSpaceError=0,this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;if(Object.assign(f,{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?f.formData=s.formData:f.formData={modelId:f.modelId,longitude:f.deltaLongitude,latitude:f.deltaLatitude,distance:1e-6,rotation:0,totalRotation:f.totalRotation,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[{value:f.modelId,label:f.modelName}],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0},this.adjustingModelByCad({...f.formData,tileset:f}),Array.isArray(h)){const p=h;f.layerMap={};let u=this.mapLayers[s.modelId];u||(u={},this.mapLayers[s.modelId]=u),p.forEach(m=>{f.layerMap[m.layerName]=m.batchId,u[m.layerName]||(u[m.layerName]=[]),u[m.layerName].push({batchId:m.batchId,color:m.layerColor})})}if(this.dxfModelsList.push(f),this.setModelId(s.modelId),this.viewer.scene.primitives.add(f),this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;a.flyTo&&this.flyToBounds(f),a.onSuccess&&a.onSuccess(f)}catch(d){console.error(`Failed to load tileset or layer info: ${l}`,d)}}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})})}}class dt{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="",l="";const a=this.opt.style.background,d=this.opt.style.color;this.opt.anchor&&(r+=`
|
|
12
|
+
`});d.isModelAdjustment=!0,a.customShader=d}else{let d="color('white')";e!==1&&(d=`${d} * ${e}`),a.style=new n.Cesium3DTileStyle({color:d})}}}}var Rs=typeof global=="object"&&global&&global.Object===Object&&global,Hl=typeof self=="object"&&self&&self.Object===Object&&self,yt=Rs||Hl||Function("return this")(),Di=yt.Symbol,Os=Object.prototype,Yl=Os.hasOwnProperty,Vl=Os.toString,Xt=Di?Di.toStringTag:void 0;function zl(i){var e=Yl.call(i,Xt),t=i[Xt];try{i[Xt]=void 0;var n=!0}catch{}var s=Vl.call(i);return n&&(e?i[Xt]=t:delete i[Xt]),s}var Wl=Object.prototype,jl=Wl.toString;function Kl(i){return jl.call(i)}var $l="[object Null]",Xl="[object Undefined]",Ls=Di?Di.toStringTag:void 0;function qt(i){return i==null?i===void 0?Xl:$l:Ls&&Ls in Object(i)?zl(i):Kl(i)}function Pt(i){return i!=null&&typeof i=="object"}var ql="[object Symbol]";function Jl(i){return typeof i=="symbol"||Pt(i)&&qt(i)==ql}var bn=Array.isArray,Zl=/\s/;function ec(i){for(var e=i.length;e--&&Zl.test(i.charAt(e)););return e}var tc=/^\s+/;function ic(i){return i&&i.slice(0,ec(i)+1).replace(tc,"")}function je(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Ns=NaN,nc=/^[-+]0x[0-9a-f]+$/i,sc=/^0b[01]+$/i,oc=/^0o[0-7]+$/i,rc=parseInt;function _s(i){if(typeof i=="number")return i;if(Jl(i))return Ns;if(je(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=je(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=ic(i);var t=sc.test(i);return t||oc.test(i)?rc(i.slice(2),t?2:8):nc.test(i)?Ns:+i}function Us(i){return i}var ac="[object AsyncFunction]",lc="[object Function]",cc="[object GeneratorFunction]",dc="[object Proxy]";function vn(i){if(!je(i))return!1;var e=qt(i);return e==lc||e==cc||e==ac||e==dc}var In=yt["__core-js_shared__"],Qs=(function(){var i=/[^.]+$/.exec(In&&In.keys&&In.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function hc(i){return!!Qs&&Qs in i}var uc=Function.prototype,fc=uc.toString;function pc(i){if(i!=null){try{return fc.call(i)}catch{}try{return i+""}catch{}}return""}var gc=/[\\^$.*+?()[\]{}|]/g,mc=/^\[object .+?Constructor\]$/,Ac=Function.prototype,yc=Object.prototype,Cc=Ac.toString,Ec=yc.hasOwnProperty,wc=RegExp("^"+Cc.call(Ec).replace(gc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function bc(i){if(!je(i)||hc(i))return!1;var e=vn(i)?wc:mc;return e.test(pc(i))}function vc(i,e){return i?.[e]}function Bn(i,e){var t=vc(i,e);return bc(t)?t:void 0}var Gs=Object.create,Ic=(function(){function i(){}return function(e){if(!je(e))return{};if(Gs)return Gs(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}})();function Bc(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 xc(i,e){var t=-1,n=i.length;for(e||(e=Array(n));++t<n;)e[t]=i[t];return e}var Sc=800,Tc=16,Mc=Date.now;function Dc(i){var e=0,t=0;return function(){var n=Mc(),s=Tc-(n-t);if(t=n,s>0){if(++e>=Sc)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}function kc(i){return function(){return i}}var ki=(function(){try{var i=Bn(Object,"defineProperty");return i({},"",{}),i}catch{}})(),Pc=ki?function(i,e){return ki(i,"toString",{configurable:!0,enumerable:!1,value:kc(e),writable:!0})}:Us,Fc=Dc(Pc),Rc=9007199254740991,Oc=/^(?:0|[1-9]\d*)$/;function Hs(i,e){var t=typeof i;return e=e??Rc,!!e&&(t=="number"||t!="symbol"&&Oc.test(i))&&i>-1&&i%1==0&&i<e}function xn(i,e,t){e=="__proto__"&&ki?ki(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}function Pi(i,e){return i===e||i!==i&&e!==e}var Lc=Object.prototype,Nc=Lc.hasOwnProperty;function _c(i,e,t){var n=i[e];(!(Nc.call(i,e)&&Pi(n,t))||t===void 0&&!(e in i))&&xn(i,e,t)}function Uc(i,e,t,n){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var l=e[o],a=void 0;a===void 0&&(a=i[l]),s?xn(t,l,a):_c(t,l,a)}return t}var Ys=Math.max;function Qc(i,e,t){return e=Ys(e===void 0?i.length-1:e,0),function(){for(var n=arguments,s=-1,o=Ys(n.length-e,0),r=Array(o);++s<o;)r[s]=n[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=n[s];return l[e]=t(r),Bc(i,this,l)}}function Gc(i,e){return Fc(Qc(i,e,Us),i+"")}var Hc=9007199254740991;function Vs(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Hc}function Sn(i){return i!=null&&Vs(i.length)&&!vn(i)}function Yc(i,e,t){if(!je(t))return!1;var n=typeof e;return(n=="number"?Sn(t)&&Hs(e,t.length):n=="string"&&e in t)?Pi(t[e],i):!1}function Vc(i){return Gc(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&&Yc(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++n<s;){var l=t[n];l&&i(e,l,n,o)}return e})}var zc=Object.prototype;function zs(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||zc;return i===t}function Wc(i,e){for(var t=-1,n=Array(i);++t<i;)n[t]=e(t);return n}var jc="[object Arguments]";function Ws(i){return Pt(i)&&qt(i)==jc}var js=Object.prototype,Kc=js.hasOwnProperty,$c=js.propertyIsEnumerable,Tn=Ws((function(){return arguments})())?Ws:function(i){return Pt(i)&&Kc.call(i,"callee")&&!$c.call(i,"callee")};function Xc(){return!1}var Ks=typeof U=="object"&&U&&!U.nodeType&&U,$s=Ks&&typeof module=="object"&&module&&!module.nodeType&&module,qc=$s&&$s.exports===Ks,Xs=qc?yt.Buffer:void 0,Jc=Xs?Xs.isBuffer:void 0,qs=Jc||Xc,Zc="[object Arguments]",ed="[object Array]",td="[object Boolean]",id="[object Date]",nd="[object Error]",sd="[object Function]",od="[object Map]",rd="[object Number]",ad="[object Object]",ld="[object RegExp]",cd="[object Set]",dd="[object String]",hd="[object WeakMap]",ud="[object ArrayBuffer]",fd="[object DataView]",pd="[object Float32Array]",gd="[object Float64Array]",md="[object Int8Array]",Ad="[object Int16Array]",yd="[object Int32Array]",Cd="[object Uint8Array]",Ed="[object Uint8ClampedArray]",wd="[object Uint16Array]",bd="[object Uint32Array]",ce={};ce[pd]=ce[gd]=ce[md]=ce[Ad]=ce[yd]=ce[Cd]=ce[Ed]=ce[wd]=ce[bd]=!0,ce[Zc]=ce[ed]=ce[ud]=ce[td]=ce[fd]=ce[id]=ce[nd]=ce[sd]=ce[od]=ce[rd]=ce[ad]=ce[ld]=ce[cd]=ce[dd]=ce[hd]=!1;function vd(i){return Pt(i)&&Vs(i.length)&&!!ce[qt(i)]}function Id(i){return function(e){return i(e)}}var Js=typeof U=="object"&&U&&!U.nodeType&&U,Jt=Js&&typeof module=="object"&&module&&!module.nodeType&&module,Bd=Jt&&Jt.exports===Js,Mn=Bd&&Rs.process,Zs=(function(){try{var i=Jt&&Jt.require&&Jt.require("util").types;return i||Mn&&Mn.binding&&Mn.binding("util")}catch{}})(),eo=Zs&&Zs.isTypedArray,to=eo?Id(eo):vd;function xd(i,e){var t=bn(i),n=!t&&Tn(i),s=!t&&!n&&qs(i),o=!t&&!n&&!s&&to(i),r=t||n||s||o,l=r?Wc(i.length,String):[],a=l.length;for(var d in i)r&&(d=="length"||s&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Hs(d,a))||l.push(d);return l}function Sd(i,e){return function(t){return i(e(t))}}function Td(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var Md=Object.prototype,Dd=Md.hasOwnProperty;function kd(i){if(!je(i))return Td(i);var e=zs(i),t=[];for(var n in i)n=="constructor"&&(e||!Dd.call(i,n))||t.push(n);return t}function io(i){return Sn(i)?xd(i):kd(i)}var Zt=Bn(Object,"create");function Pd(){this.__data__=Zt?Zt(null):{},this.size=0}function Fd(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Rd="__lodash_hash_undefined__",Od=Object.prototype,Ld=Od.hasOwnProperty;function Nd(i){var e=this.__data__;if(Zt){var t=e[i];return t===Rd?void 0:t}return Ld.call(e,i)?e[i]:void 0}var _d=Object.prototype,Ud=_d.hasOwnProperty;function Qd(i){var e=this.__data__;return Zt?e[i]!==void 0:Ud.call(e,i)}var Gd="__lodash_hash_undefined__";function Hd(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=Zt&&e===void 0?Gd:e,this}function Ct(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])}}Ct.prototype.clear=Pd,Ct.prototype.delete=Fd,Ct.prototype.get=Nd,Ct.prototype.has=Qd,Ct.prototype.set=Hd;function Yd(){this.__data__=[],this.size=0}function Fi(i,e){for(var t=i.length;t--;)if(Pi(i[t][0],e))return t;return-1}var Vd=Array.prototype,zd=Vd.splice;function Wd(i){var e=this.__data__,t=Fi(e,i);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():zd.call(e,t,1),--this.size,!0}function jd(i){var e=this.__data__,t=Fi(e,i);return t<0?void 0:e[t][1]}function Kd(i){return Fi(this.__data__,i)>-1}function $d(i,e){var t=this.__data__,n=Fi(t,i);return n<0?(++this.size,t.push([i,e])):t[n][1]=e,this}function et(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])}}et.prototype.clear=Yd,et.prototype.delete=Wd,et.prototype.get=jd,et.prototype.has=Kd,et.prototype.set=$d;var no=Bn(yt,"Map");function Xd(){this.size=0,this.__data__={hash:new Ct,map:new(no||et),string:new Ct}}function qd(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}function Ri(i,e){var t=i.__data__;return qd(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Jd(i){var e=Ri(this,i).delete(i);return this.size-=e?1:0,e}function Zd(i){return Ri(this,i).get(i)}function eh(i){return Ri(this,i).has(i)}function th(i,e){var t=Ri(this,i),n=t.size;return t.set(i,e),this.size+=t.size==n?0:1,this}function Ft(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])}}Ft.prototype.clear=Xd,Ft.prototype.delete=Jd,Ft.prototype.get=Zd,Ft.prototype.has=eh,Ft.prototype.set=th;var so=Sd(Object.getPrototypeOf,Object),ih="[object Object]",nh=Function.prototype,sh=Object.prototype,oo=nh.toString,oh=sh.hasOwnProperty,rh=oo.call(Object);function ah(i){if(!Pt(i)||qt(i)!=ih)return!1;var e=so(i);if(e===null)return!0;var t=oh.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&oo.call(t)==rh}function lh(){this.__data__=new et,this.size=0}function ch(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}function dh(i){return this.__data__.get(i)}function hh(i){return this.__data__.has(i)}var uh=200;function fh(i,e){var t=this.__data__;if(t instanceof et){var n=t.__data__;if(!no||n.length<uh-1)return n.push([i,e]),this.size=++t.size,this;t=this.__data__=new Ft(n)}return t.set(i,e),this.size=t.size,this}function Rt(i){var e=this.__data__=new et(i);this.size=e.size}Rt.prototype.clear=lh,Rt.prototype.delete=ch,Rt.prototype.get=dh,Rt.prototype.has=hh,Rt.prototype.set=fh;var ro=typeof U=="object"&&U&&!U.nodeType&&U,ao=ro&&typeof module=="object"&&module&&!module.nodeType&&module,ph=ao&&ao.exports===ro,lo=ph?yt.Buffer:void 0;lo&&lo.allocUnsafe;function gh(i,e){return i.slice()}var co=yt.Uint8Array;function mh(i){var e=new i.constructor(i.byteLength);return new co(e).set(new co(i)),e}function Ah(i,e){var t=mh(i.buffer);return new i.constructor(t,i.byteOffset,i.length)}function yh(i){return typeof i.constructor=="function"&&!zs(i)?Ic(so(i)):{}}function Ch(i){return function(e,t,n){for(var s=-1,o=Object(e),r=n(e),l=r.length;l--;){var a=r[++s];if(t(o[a],a,o)===!1)break}return e}}var Eh=Ch(),Dn=function(){return yt.Date.now()},wh="Expected a function",bh=Math.max,vh=Math.min;function kn(i,e,t){var n,s,o,r,l,a,d=0,h=!1,f=!1,p=!0;if(typeof i!="function")throw new TypeError(wh);e=_s(e)||0,je(t)&&(h=!!t.leading,f="maxWait"in t,o=f?bh(_s(t.maxWait)||0,e):o,p="trailing"in t?!!t.trailing:p);function u(I){var B=n,g=s;return n=s=void 0,d=I,r=i.apply(g,B),r}function m(I){return d=I,l=setTimeout(C,e),h?u(I):r}function w(I){var B=I-a,g=I-d,P=e-B;return f?vh(P,o-g):P}function A(I){var B=I-a,g=I-d;return a===void 0||B>=e||B<0||f&&g>=o}function C(){var I=Dn();if(A(I))return v(I);l=setTimeout(C,w(I))}function v(I){return l=void 0,p&&n?u(I):(n=s=void 0,r)}function S(){l!==void 0&&clearTimeout(l),d=0,n=a=s=l=void 0}function D(){return l===void 0?r:v(Dn())}function N(){var I=Dn(),B=A(I);if(n=arguments,s=this,a=I,B){if(l===void 0)return m(a);if(f)return clearTimeout(l),l=setTimeout(C,e),u(a)}return l===void 0&&(l=setTimeout(C,e)),r}return N.cancel=S,N.flush=D,N}function Pn(i,e,t){(t!==void 0&&!Pi(i[e],t)||t===void 0&&!(e in i))&&xn(i,e,t)}function Ih(i){return Pt(i)&&Sn(i)}function Fn(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}function Bh(i){return Uc(i,io(i))}function xh(i,e,t,n,s,o,r){var l=Fn(i,t),a=Fn(e,t),d=r.get(a);if(d){Pn(i,t,d);return}var h=o?o(l,a,t+"",i,e,r):void 0,f=h===void 0;if(f){var p=bn(a),u=!p&&qs(a),m=!p&&!u&&to(a);h=a,p||u||m?bn(l)?h=l:Ih(l)?h=xc(l):u?(f=!1,h=gh(a)):m?(f=!1,h=Ah(a)):h=[]:ah(a)||Tn(a)?(h=l,Tn(l)?h=Bh(l):(!je(l)||vn(l))&&(h=yh(a))):f=!1}f&&(r.set(a,h),s(h,a,n,o,r),r.delete(a)),Pn(i,t,h)}function ho(i,e,t,n,s){i!==e&&Eh(e,function(o,r){if(s||(s=new Rt),je(o))xh(i,e,r,t,ho,n,s);else{var l=n?n(Fn(i,r),o,r+"",i,e,s):void 0;l===void 0&&(l=o),Pn(i,r,l)}},io)}var Sh=Vc(function(i,e,t){ho(i,e,t)});function Rn({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),l=i.Cartesian3.fromDegrees(n.longitude,n.latitude,n.height),a=i.Transforms.eastNorthUpToFixedFrame(l),d=i.Matrix4.multiply(a,r,new i.Matrix4);if(e._root){if(!s){e._root.transform=d;return}try{const{center:h}=s,f=e.root.boundingVolume.boundingSphere,p=new i.Cartesian3(h.x,h.y,0),u=i.Matrix4.multiplyByPoint(d,p,new i.Cartesian3),m=i.Cartographic.fromCartesian(u),w=f.center,A=i.Transforms.eastNorthUpToFixedFrame(new i.Cartesian3(w.x,w.y,w.z)),C=new i.Cartesian3(-h.x+(n.X||0),-h.y+(n.Y||0),n.Z||0),v=i.Matrix4.fromTranslation(C),S=i.Matrix4.multiply(r,v,new i.Matrix4),D=i.Cartesian3.fromDegrees(m.longitude/Math.PI*180,m.latitude/Math.PI*180,n.height),N=i.Transforms.eastNorthUpToFixedFrame(D),I=i.Matrix4.multiply(N,S,new i.Matrix4);i.Matrix4.multiply(A,S,A),e._root.transform=I}catch(h){console.error("Update model position failed:",h)}}}const Ot={NotLoaded:0,Loading:1,Loaded:2,Error:3},Et=4294967295,Ke=65535,On=255,Th=8,uo=9,Mh=0,Dh=99,kh=67324752,fo=134695760,Ph=fo,po=33639248,Fh=101010256,go=101075792,Rh=117853008,Lt=22,Ln=20,Nn=56,Oh=12,Lh=20,mo=4,Nh=1,_h=39169,Uh=10,Qh=1,Gh=21589,Hh=28789,Yh=25461,Vh=6534,zh=30837,Wh=30805,Ao=1,jh=6,yo=8,Co=2048,Kh=16,$h=1,Xh=2,qh=4,Jh=32,Eo=61440,_n=16384,Un=73,Zh=420,eu=2048,tu=1024,iu=512,nu="/",Qn=30,su=10,ou=14,ru=18,de=void 0,at="undefined",wt="function",au=64;let wo=2;try{typeof navigator!=at&&navigator.hardwareConcurrency&&(wo=navigator.hardwareConcurrency)}catch{}const lu={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:64*1024,maxWorkers:wo,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,CompressionStream:typeof CompressionStream!=at&&CompressionStream,DecompressionStream:typeof DecompressionStream!=at&&DecompressionStream},bo=Object.assign({},lu);function cu(){return bo}function du(i){return Math.max(i.chunkSize,au)}function Oi(i){const{baseURI:e,chunkSize:t,maxWorkers:n,terminateWorkerTimeout:s,useCompressionStream:o,useWebWorkers:r,CompressionStream:l,DecompressionStream:a,CompressionStreamZlib:d,DecompressionStreamZlib:h,workerURI:f,wasmURI:p}=i;_e("baseURI",e),_e("wasmURI",p),_e("workerURI",f),_e("chunkSize",t),_e("maxWorkers",n),_e("terminateWorkerTimeout",s),_e("useCompressionStream",o),_e("useWebWorkers",r),_e("CompressionStream",l),_e("DecompressionStream",a),_e("CompressionStreamZlib",d),_e("DecompressionStreamZlib",h)}function _e(i,e){e!==de&&(bo[i]=e)}function hu(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 vo=[];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;vo[i]=e}class Li{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^vo[(t^e[n])&255];this.crc=t}get(){return~this.crc}}class Io extends TransformStream{constructor(){let e;const t=new Li;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 uu(i){if(typeof TextEncoder==at){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 ke={concat(i,e){if(i.length===0||e.length===0)return i.concat(e);const t=i[i.length-1],n=ke.getPartial(t);return n===32?i.concat(e):ke._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+ke.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]=ke.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=ke.getPartial(s);return n.push(ke.partial(e+o&31,e+o>32?t:n.pop(),1)),n}},Ni={bytes:{fromBits(i){const t=ke.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(ke.partial(8*(t&3),n)),e}}},Bo={};Bo.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=Ni.utf8String.toBits(i));const t=e._buffer=ke.concat(e._buffer,i),n=e._length,s=e._length=n+ke.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 l=e.blockSize+n-(e.blockSize+n&e.blockSize-1);l<=s;l+=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=ke.concat(e,[ke.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 d=0;d<16;d++)n[d]=i[d];let s=t[0],o=t[1],r=t[2],l=t[3],a=t[4];for(let d=0;d<=79;d++){d>=16&&(n[d]=e._S(1,n[d-3]^n[d-8]^n[d-14]^n[d-16]));const h=e._S(5,s)+e._f(d,o,r,l)+a+n[d]+e._key[Math.floor(d/20)]|0;a=l,l=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]+l|0,t[4]=t[4]+a|0}};const xo={};xo.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,l,a=1;if(s!==4&&s!==6&&s!==8)throw new Error("invalid aes key size");for(e._key=[r=i.slice(0),l=[]],o=s;o<4*s+28;o++){let d=r[o-1];(o%s===0||s===8&&o%s===4)&&(d=t[d>>>24]<<24^t[d>>16&255]<<16^t[d>>8&255]<<8^t[d&255],o%s===0&&(d=d<<8^d>>>24^a<<24,a=a<<1^(a>>7)*283)),r[o]=r[o-s]^d}for(let d=0;o;d++,o--){const h=r[d&3?o:o-4];o<=4||d<4?l[d]=h:l[d]=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,l,a,d;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^=l||1,r=o[r]||1){let f=r^r<<1^r<<2^r<<3^r<<4;f=f>>8^f&255^99,t[h]=f,n[f]=h,d=s[a=s[l=s[h]]];let p=d*16843009^a*65537^l*257^h*16843008,u=s[f]*257^f*16843008;for(let m=0;m<4;m++)i[m][h]=u=u<<24^u>>>8,e[m][f]=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],l=o[1],a=o[2],d=o[3],h=o[4];let f=i[0]^t[0],p=i[e?3:1]^t[1],u=i[2]^t[2],m=i[e?1:3]^t[3],w=4,A,C,v;for(let S=0;S<n;S++)A=r[f>>>24]^l[p>>16&255]^a[u>>8&255]^d[m&255]^t[w],C=r[p>>>24]^l[u>>16&255]^a[m>>8&255]^d[f&255]^t[w+1],v=r[u>>>24]^l[m>>16&255]^a[f>>8&255]^d[p&255]^t[w+2],m=r[m>>>24]^l[f>>16&255]^a[p>>8&255]^d[u&255]^t[w+3],w+=4,f=A,p=C,u=v;for(let S=0;S<4;S++)s[e?3&-S:S]=h[f>>>24]<<24^h[p>>16&255]<<16^h[u>>8&255]<<8^h[m&255]^t[w++],A=f,f=p,p=u,u=m,m=A;return s}};const fu={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}},So={};So.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=ke.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 ke.clamp(e,s)}};const bt={importKey(i){return new bt.hmacSha1(Ni.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,l,a,d;const h=new ArrayBuffer(s),f=new DataView(h);let p=0;const u=ke;for(e=Ni.bytes.toBits(e),d=1;p<(s||1);d++){for(o=r=i.encrypt(u.concat(e,[d])),l=1;l<t;l++)for(r=i.encrypt(r),a=0;a<r.length;a++)o[a]^=r[a];for(l=0;p<(s||1)&&l<o.length;l++)f.setInt32(p,o[l]),p+=4}return h.slice(0,n/8)}};bt.hmacSha1=class{constructor(i){const e=this,t=e._hash=Bo.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 pu=typeof crypto!=at&&typeof crypto.getRandomValues==wt,To="Invalid password",Mo="Invalid signature",Gn="zipjs-abort-check-password";function Do(i){return pu?crypto.getRandomValues(i):fu.getRandomValues(i)}const Nt=16,gu="raw",ko={name:"PBKDF2"},mu={name:"HMAC"},Au="SHA-1",yu=Object.assign({hash:mu},ko),Hn=Object.assign({iterations:1e3,hash:{name:Au}},ko),Cu=["deriveBits"],ei=[8,12,16],ti=[16,24,32],lt=10,Eu=[0,0,0,0],_i=typeof crypto!=at,ii=_i&&crypto.subtle,Po=_i&&typeof ii!=at,$e=Ni.bytes,wu=xo.aes,bu=So.ctrGladman,vu=bt.hmacSha1;let Fo=_i&&Po&&typeof ii.importKey==wt,Ro=_i&&Po&&typeof ii.deriveBits==wt;class Iu 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:No(e,t),signed:n,strength:s-1,pending:new Uint8Array})},async transform(r,l){const a=this,{password:d,strength:h,resolveReady:f,ready:p}=a;d?(await xu(a,h,d,Ue(r,0,ei[h]+2)),r=Ue(r,ei[h]+2),o?l.error(new Error(Gn)):f()):await p;const u=new Uint8Array(r.length-lt-(r.length-lt)%Nt);l.enqueue(Oo(a,r,u,0,lt,!0))},async flush(r){const{signed:l,ctr:a,hmac:d,pending:h,ready:f}=this;if(d&&a){await f;const p=Ue(h,0,h.length-lt),u=Ue(h,h.length-lt);let m=new Uint8Array;if(p.length){const w=si($e,p);d.update(w);const A=a.update(w);m=ni($e,A)}if(l){const w=Ue(ni($e,d.digest()),0,lt);for(let A=0;A<lt;A++)if(w[A]!=u[A])throw new Error(Mo)}r.enqueue(m)}}})}}class Bu extends TransformStream{constructor({password:e,rawPassword:t,encryptionStrength:n}){let s;super({start(){Object.assign(this,{ready:new Promise(o=>this.resolveReady=o),password:No(e,t),strength:n-1,pending:new Uint8Array})},async transform(o,r){const l=this,{password:a,strength:d,resolveReady:h,ready:f}=l;let p=new Uint8Array;a?(p=await Su(l,d,a),h()):await f;const u=new Uint8Array(p.length+o.length-o.length%Nt);u.set(p,0),r.enqueue(Oo(l,o,u,p.length,0))},async flush(o){const{ctr:r,hmac:l,pending:a,ready:d}=this;if(l&&r){await d;let h=new Uint8Array;if(a.length){const f=r.update(si($e,a));l.update(f),h=ni($e,f)}s.signature=ni($e,l.digest()).slice(0,lt),o.enqueue(Yn(h,s.signature))}}}),s=this}}function Oo(i,e,t,n,s,o){const{ctr:r,hmac:l,pending:a}=i,d=e.length-s;a.length&&(e=Yn(a,e),t=Du(t,d-d%Nt));let h;for(h=0;h<=d-Nt;h+=Nt){const f=si($e,Ue(e,h,h+Nt));o&&l.update(f);const p=r.update(f);o||l.update(p),t.set(ni($e,p),h+n)}return i.pending=Ue(e,h),t}async function xu(i,e,t,n){const s=await Lo(i,e,t,Ue(n,0,ei[e])),o=Ue(n,ei[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new Error(To)}async function Su(i,e,t){const n=Do(new Uint8Array(ei[e])),s=await Lo(i,e,t,n);return Yn(n,s)}async function Lo(i,e,t,n){i.password=null;const s=await Tu(gu,t,yu,!1,Cu),o=await Mu(Object.assign({salt:n},Hn),s,8*(ti[e]*2+2)),r=new Uint8Array(o),l=si($e,Ue(r,0,ti[e])),a=si($e,Ue(r,ti[e],ti[e]*2)),d=Ue(r,ti[e]*2);return Object.assign(i,{keys:{key:l,authentication:a,passwordVerification:d},ctr:new bu(new wu(l),Array.from(Eu)),hmac:new vu(a)}),d}async function Tu(i,e,t,n,s){if(Fo)try{return await ii.importKey(i,e,t,n,s)}catch{return Fo=!1,bt.importKey(e)}else return bt.importKey(e)}async function Mu(i,e,t){if(Ro)try{return await ii.deriveBits(i,e,t)}catch{return Ro=!1,bt.pbkdf2(e,i.salt,Hn.iterations,t)}else return bt.pbkdf2(e,i.salt,Hn.iterations,t)}function No(i,e){return e===de?uu(i):e}function Yn(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 Du(i,e){if(e&&e>i.length){const t=i;i=new Uint8Array(e),i.set(t,0)}return i}function Ue(i,e,t){return i.subarray(e,t)}function ni(i,e){return i.fromBits(e)}function si(i,e){return i.toBits(e)}const oi=12;class ku extends TransformStream{constructor({password:e,passwordVerification:t,checkPasswordOnly:n}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),Qo(this,e)},transform(s,o){const r=this;if(r.password){const l=_o(r,s.subarray(0,oi));if(r.password=null,l.at(-1)!=r.passwordVerification)throw new Error(To);s=s.subarray(oi)}n?o.error(new Error(Gn)):o.enqueue(_o(r,s))}})}}class Pu extends TransformStream{constructor({password:e,passwordVerification:t}){super({start(){Object.assign(this,{password:e,passwordVerification:t}),Qo(this,e)},transform(n,s){const o=this;let r,l;if(o.password){o.password=null;const a=Do(new Uint8Array(oi));a[oi-1]=o.passwordVerification,r=new Uint8Array(n.length+a.length),r.set(Uo(o,a),0),l=oi}else r=new Uint8Array(n.length),l=0;r.set(Uo(o,n),l),s.enqueue(r)}})}}function _o(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=Go(i)^e[n],Vn(i,t[n]);return t}function Uo(i,e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=Go(i)^e[n],Vn(i,e[n]);return t}function Qo(i,e){const t=[305419896,591751049,878082192];Object.assign(i,{keys:t,crcKey0:new Li(t[0]),crcKey2:new Li(t[2])});for(let n=0;n<e.length;n++)Vn(i,e.charCodeAt(n))}function Vn(i,e){let[t,n,s]=i.keys;i.crcKey0.append([e]),t=~i.crcKey0.get(),n=Yo(Math.imul(Yo(n+Ho(t)),134775813)+1),i.crcKey2.append([n>>>24]),s=~i.crcKey2.get(),i.keys=[t,n,s]}function Go(i){const e=i.keys[2]|2;return Ho(Math.imul(e,e^1)>>>8)}function Ho(i){return i&255}function Yo(i){return i&4294967295}const Vo="Invalid uncompressed size",Fu="deflate-raw",Ru="deflate64-raw";class Ou extends TransformStream{constructor(e,{chunkSize:t,CompressionStreamZlib:n,CompressionStream:s}){super({});const{compressed:o,encrypted:r,useCompressionStream:l,zipCrypto:a,signed:d,level:h}=e,f=this;let p,u,m=super.readable;(!r||a)&&d&&(p=new Io,m=Xe(m,p)),o&&(m=Wo(m,l,{level:h,chunkSize:t},s,n,s)),r&&(a?m=Xe(m,new Pu(e)):(u=new Bu(e),m=Xe(m,u))),zo(f,m,()=>{let w;r&&!a&&(w=u.signature),(!r||a)&&d&&(w=new DataView(p.value.buffer).getUint32(0)),f.signature=w})}}class Lu extends TransformStream{constructor(e,{chunkSize:t,DecompressionStreamZlib:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:r,signed:l,signature:a,compressed:d,useCompressionStream:h,deflate64:f}=e;let p,u,m=super.readable;r&&(o?m=Xe(m,new ku(e)):(u=new Iu(e),m=Xe(m,u))),d&&(m=Wo(m,h,{chunkSize:t,deflate64:f},s,n,s)),(!r||o)&&l&&(p=new Io,m=Xe(m,p)),zo(this,m,()=>{if((!r||o)&&l){const w=new DataView(p.value.buffer);if(a!=w.getUint32(0,!1))throw new Error(Mo)}})}}function zo(i,e,t){e=Xe(e,new TransformStream({flush:t})),Object.defineProperty(i,"readable",{get(){return e}})}function Wo(i,e,t,n,s,o){const r=e&&n?n:s||o,l=t.deflate64?Ru:Fu;try{i=Xe(i,new r(l,t))}catch(a){if(e)if(s)i=Xe(i,new s(l,t));else if(o)i=Xe(i,new o(l,t));else throw a;else throw a}return i}function Xe(i,e){return i.pipeThrough(e)}const Nu="message",_u="start",Uu="pull",jo="data",Qu="ack",Ko="close",Gu="deflate",$o="inflate";class Hu extends TransformStream{constructor(e,t){super({});const n=this,{codecType:s}=e;let o;s.startsWith(Gu)?o=Ou:s.startsWith($o)&&(o=Lu),n.outputSize=0;let r=0;const l=new o(e,t),a=super.readable,d=new TransformStream({transform(f,p){f&&f.length&&(r+=f.length,p.enqueue(f))},flush(){Object.assign(n,{inputSize:r})}}),h=new TransformStream({transform(f,p){if(f&&f.length&&(p.enqueue(f),n.outputSize+=f.length,e.outputSize!==de&&n.outputSize>e.outputSize))throw new Error(Vo)},flush(){const{signature:f}=l;Object.assign(n,{signature:f,inputSize:r})}});Object.defineProperty(n,"readable",{get(){return a.pipeThrough(d).pipeThrough(l).pipeThrough(h)}})}}class Yu 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 Xo=typeof Worker!=at,qo=()=>{};function Vu({initModule:i}){qo=i}class zn{constructor(e,{readable:t,writable:n},{options:s,config:o,streamOptions:r,useWebWorkers:l,transferStreams:a,workerURI:d},h){const{signal:f}=r;return Object.assign(e,{busy:!0,readable:t.pipeThrough(new Yu(o.chunkSize)).pipeThrough(new zu(r),{signal:f}),writable:n,options:Object.assign({},s),workerURI:d,transferStreams:a,terminate(){return new Promise(p=>{const{worker:u,busy:m}=e;u?(m?e.resolveTerminated=p:(u.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)}}),(l&&Xo?Wu:Jo)(e,o)}}class zu extends TransformStream{constructor({onstart:e,onprogress:t,size:n,onend:s}){let o=0;super({async start(){e&&await Wn(e,n)},async transform(r,l){o+=r.length,t&&await Wn(t,o,n),l.enqueue(r)},async flush(){s&&await Wn(s,o)}})}}async function Wn(i,...e){try{await i(...e)}catch{}}function Jo(i,e){return{run:()=>ju(i,e)}}function Wu(i,e){const{baseURI:t,chunkSize:n}=e;let{wasmURI:s}=e;if(!i.interface){typeof s==wt&&(s=s());let o;try{o=Xu(i.workerURI,t,i)}catch{return Xo=!1,Jo(i,e)}Object.assign(i,{worker:o,interface:{run:()=>Ku(i,{chunkSize:n,wasmURI:s,baseURI:t})}})}return i.interface}async function ju({options:i,readable:e,writable:t,onTaskFinished:n},s){let o;try{if(!i.useCompressionStream)try{await qo(s)}catch{i.useCompressionStream=!0}o=new Hu(i,s),await e.pipeThrough(o).pipeTo(t,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:l,outputSize:a}=o;return{signature:r,inputSize:l,outputSize:a}}catch(r){throw o&&(r.outputSize=o.outputSize),r}finally{n()}}async function Ku(i,e){let t,n;const s=new Promise((f,p)=>{t=f,n=p});Object.assign(i,{reader:null,writer:null,resolveResult:t,rejectResult:n,result:s});const{readable:o,options:r}=i,{writable:l,closed:a}=$u(i.writable),d=Ui({type:_u,options:r,config:e,readable:o,writable:l},i);d||Object.assign(i,{reader:o.getReader(),writer:l.getWriter()});const h=await s;return d||await l.getWriter().close(),await a,h}function $u(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 Zo=!0;function Xu(i,e,t){const n={type:"module"};let s,o;if(typeof i==wt&&(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(Nu,r=>qu(r,t)),o}function Ui(i,{worker:e,writer:t,onTaskFinished:n,transferStreams:s}){try{const{value:o,readable:r,writable:l}=i,a=[];if(o&&(i.value=o,a.push(i.value.buffer)),s&&Zo?(r&&a.push(r),l&&a.push(l)):i.readable=i.writable=null,a.length)try{return e.postMessage(i,a),!0}catch{Zo=!1,i.readable=i.writable=null,e.postMessage(i)}else e.postMessage(i)}catch(o){throw t&&t.releaseLock(),n(),o}}async function qu({data:i},e){const{type:t,value:n,messageId:s,result:o,error:r}=i,{reader:l,writer:a,resolveResult:d,rejectResult:h,onTaskFinished:f}=e;try{if(r){const{message:u,stack:m,code:w,name:A,outputSize:C}=r,v=new Error(u);Object.assign(v,{stack:m,code:w,name:A,outputSize:C}),p(v)}else{if(t==Uu){const{value:u,done:m}=await l.read();Ui({type:jo,value:u,done:m,messageId:s},e)}t==jo&&(await a.ready,await a.write(new Uint8Array(n)),Ui({type:Qu,messageId:s},e)),t==Ko&&p(null,o)}}catch(u){Ui({type:Ko,messageId:s},e),p(u)}function p(u,m){u?h(u):d(m),a&&a.releaseLock(),f()}}let vt=[];const jn=[];let er=0;async function Ju(i,e){const{options:t,config:n}=e,{transferStreams:s,useWebWorkers:o,useCompressionStream:r,compressed:l,signed:a,encrypted:d}=t,{workerURI:h,maxWorkers:f}=n;e.transferStreams=s||s===de;const p=!l&&!a&&!d&&!e.transferStreams;return e.useWebWorkers=!p&&(o||o===de&&n.useWebWorkers),e.workerURI=e.useWebWorkers&&h?h:de,t.useCompressionStream=r||r===de&&n.useCompressionStream,(await u()).run();async function u(){const w=vt.find(A=>!A.busy);if(w)return tr(w),new zn(w,i,e,m);if(vt.length<f){const A={indexWorker:er};return er++,vt.push(A),new zn(A,i,e,m)}else return new Promise(A=>jn.push({resolve:A,stream:i,workerOptions:e}))}function m(w){if(jn.length){const[{resolve:A,stream:C,workerOptions:v}]=jn.splice(0,1);A(new zn(w,C,v,m))}else w.worker?(tr(w),Zu(w,e)):vt=vt.filter(A=>A!=w)}}function Zu(i,e){const{config:t}=e,{terminateWorkerTimeout:n}=t;Number.isFinite(n)&&n>=0&&(i.terminated?i.terminated=!1:i.terminateTimeout=setTimeout(async()=>{vt=vt.filter(s=>s!=i);try{await i.terminate()}catch{}},n))}function tr(i){const{terminateTimeout:e}=i;e&&(clearTimeout(e),i.terminateTimeout=null)}const ef="Writer iterator completed too soon",tf="Content-Type",nf=64*1024,ir="writable";class Kn{constructor(){this.size=0}init(){this.initialized=!0}}class nr extends Kn{get readable(){const e=this,{chunkSize:t=nf}=e,n=new ReadableStream({start(){this.chunkOffset=0},async pull(s){const{offset:o=0,size:r,diskNumberStart:l}=n,{chunkOffset:a}=this,d=r===de?t:Math.min(t,r-a),h=await xe(e,o+a,d,l);s.enqueue(h),a+t>r||r===de&&!h.length&&d?s.close():this.chunkOffset+=t}});return n}}class $n extends nr{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 sf extends Kn{constructor(e){super();const t=this,n=new TransformStream,s=[];e&&s.push([tf,e]),Object.defineProperty(t,ir,{get(){return n.writable}}),t.blob=new Response(n.readable,{headers:s}).blob()}getData(){return this.blob}}class of extends sf{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:l})=>o(l.result),onerror:()=>r(s.error)}),s.readAsText(n,e)})}}}class rf extends nr{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,l=n;l==-1&&(l=o.length-1);let a=e;for(;o[l]&&a>=o[l].size;)a-=o[l].size,l++;const d=o[l];if(d){const h=d.size;if(a+t<=h)r=await xe(d,a,t);else{const f=h-a;r=new Uint8Array(t);const p=await xe(d,a,f);r.set(p,0);const u=await s.readUint8Array(e+f,t-f,n);r.set(u,f),p.length+u.length<t&&(r=r.subarray(0,p.length+u.length))}}else r=new Uint8Array;return s.lastDiskNumber=Math.max(l,s.lastDiskNumber),r}}class sr extends Kn{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 l=new WritableStream({async write(h){const{availableSize:f}=n;if(r)h.length>=f?(await a(h.subarray(0,f)),await d(),n.diskOffset+=s.size,n.diskNumber++,r=null,await this.write(h.subarray(f))):await a(h);else{const{value:p,done:u}=await e.next();if(u&&!p)throw new Error(ef);s=p,s.size=0,s.maxSize&&(n.maxSize=s.maxSize),n.availableSize=n.maxSize,await Qi(s),o=p.writable,r=o.getWriter(),await this.write(h)}},async close(){await r.ready,await d()}});Object.defineProperty(n,ir,{get(){return l}});async function a(h){const f=h.length;f&&(await r.ready,await r.write(h),s.size+=f,n.size+=f,n.availableSize-=f)}async function d(){await r.close()}}}class af{constructor(e){return Array.isArray(e)&&(e=new rf(e)),e instanceof ReadableStream&&(e={readable:e}),e}}class lf{constructor(e){return e.writable===de&&typeof e.next==wt&&(e=new sr(e)),e instanceof WritableStream&&(e={writable:e}),e.size===de&&(e.size=0),e instanceof sr||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}}async function Qi(i,e){if(i.init&&!i.initialized)await i.init(e);else return Promise.resolve()}function xe(i,e,t,n){return i.readUint8Array(e,t,n)}const or="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),cf=or.length==256;function df(i){if(cf){let e="";for(let t=0;t<i.length;t++)e+=or[i[t]];return e}else return new TextDecoder().decode(i)}function Gi(i,e){return e&&e.trim().toLowerCase()=="cp437"?df(i):new TextDecoder(e).decode(i)}const rr="filename",ar="rawFilename",lr="comment",cr="rawComment",dr="uncompressedSize",hr="compressedSize",ur="offset",fr="diskNumberStart",Xn="lastModDate",qn="rawLastModDate",pr="lastAccessDate",hf="rawLastAccessDate",gr="creationDate",mr="rawCreationDate",uf=[rr,ar,dr,hr,Xn,qn,lr,cr,pr,gr,mr,ur,fr,"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 Ar{constructor(e){uf.forEach(t=>this[t]=e[t])}}const ff="filenameEncoding",pf="commentEncoding",gf="decodeText",mf="extractPrependedData",Af="extractAppendedData",yf="password",Cf="rawPassword",Ef="passThrough",wf="signal",bf="checkPasswordOnly",vf="checkOverlappingEntryOnly",If="checkOverlappingEntry",Bf="checkSignature",xf="useWebWorkers",Sf="useCompressionStream",Tf="transferStreams",Mf="preventClose",Jn="File format is not recognized",Df="End of central directory not found",kf="End of Zip64 central directory locator not found",Pf="Central directory header not found",Ff="Local file header not found",Rf="Zip64 extra field not found",Of="File contains encrypted entry",Lf="Encryption method not supported",yr="Compression method not supported",Cr="Split zip file",Nf="Overlapping entry found",Er="utf-8",_f="UTF8",wr="cp437",Uf=[[dr,Et],[hr,Et],[ur,Et],[fr,Ke]],Qf={[Ke]:{getValue:he,bytes:4},[Et]:{getValue:_t,bytes:8}};class br{constructor(e,t={}){Object.assign(this,{reader:new af(e),options:t,config:cu(),readRanges:[]})}async*getEntriesGenerator(e={}){const t=this;let{reader:n}=t;const{config:s}=t;if(await Qi(n),(n.size===de||!n.readUint8Array)&&(n=new $n(await new Response(n.readable).blob()),await Qi(n)),n.size<Lt)throw new Error(Jn);n.chunkSize=du(s);const o=await jf(n,Fh,n.size,Lt,Ke*16);if(!o){const x=await xe(n,0,4),k=ue(x);throw he(k)==fo?new Error(Cr):new Error(Df)}const r=ue(o);let l=he(r,12),a=he(r,16);const d=o.offset,h=Be(r,20),f=d+Lt+h;let p=Be(r,4);const u=n.lastDiskNumber||0;let m=Be(r,6),w=Be(r,8),A=0,C=0;if(a==Et||l==Et||w==Ke||m==Ke){const x=await xe(n,o.offset-Ln,Ln),k=ue(x);if(he(k,0)==Rh){a=_t(k,8);let _=await xe(n,a,Nn,-1),G=ue(_);const F=o.offset-Ln-Nn;if(he(G,0)!=go&&a!=F){const E=a;a=F,a>E&&(A=a-E),_=await xe(n,a,Nn,-1),G=ue(_)}if(he(G,0)!=go)throw new Error(kf);p==Ke&&(p=he(G,16)),m==Ke&&(m=he(G,20)),w==Ke&&(w=_t(G,32)),l==Et&&(l=_t(G,40)),a-=l}}if(a>=n.size&&(A=n.size-a-l-Lt,a=n.size-l-Lt),u!=p)throw new Error(Cr);if(a<0)throw new Error(Jn);let v=0,S=await xe(n,a,l,m),D=ue(S);if(l){const x=o.offset-l;if(he(D,v)!=po&&a!=x){const k=a;a=x,a>k&&(A+=a-k),S=await xe(n,a,l,m),D=ue(S)}}const N=o.offset-a-(n.lastDiskOffset||0);if(l!=N&&N>=0&&(l=N,S=await xe(n,a,l,m),D=ue(S)),a<0||a>=n.size)throw new Error(Jn);const I=Se(t,e,ff),B=Se(t,e,pf);for(let x=0;x<w;x++){const k=new Gf(n,s,t.options);if(he(D,v)!=po)throw new Error(Pf);vr(k,D,v+6);const _=!!k.bitFlag.languageEncodingFlag,G=v+46,F=G+k.filenameLength,E=F+k.extraFieldLength,y=Be(D,v+4),b=y>>8==0,T=y>>8==3,R=S.subarray(G,F),O=Be(D,v+32),L=E+O,M=S.subarray(E,L),Q=_,Y=_,W=he(D,v+38),q=W&On,Z={readOnly:!!(q&$h),hidden:!!(q&Xh),system:!!(q&qh),directory:!!(q&Kh),archive:!!(q&Jh)},oe=he(D,v+42)+A,ne=Se(t,e,gf)||Gi,se=Q?Er:I||wr,pe=Y?Er:B||wr;let ve=ne(R,se);ve===de&&(ve=Gi(R,se));let V=ne(M,pe);V===de&&(V=Gi(M,pe)),Object.assign(k,{versionMadeBy:y,msDosCompatible:b,compressedSize:0,uncompressedSize:0,commentLength:O,offset:oe,diskNumberStart:Be(D,v+34),internalFileAttributes:Be(D,v+36),externalFileAttributes:W,msdosAttributesRaw:q,msdosAttributes:Z,rawFilename:R,filenameUTF8:Q,commentUTF8:Y,rawExtraField:S.subarray(F,E),rawComment:M,filename:ve,comment:V}),C=Math.max(oe,C),Ir(k,k,D,v+6);const j=k.externalFileAttributes>>16&Ke;k.unixMode===de&&(j&(Zh|Un|_n))!=0&&(k.unixMode=j);const te=!!(k.unixMode&eu),Ae=!!(k.unixMode&tu),Ce=!!(k.unixMode&iu),Me=k.unixMode!==de?(k.unixMode&Un)!=0:T&&(j&Un)!=0,Le=k.unixMode!==de&&(k.unixMode&Eo)==_n,Ne=(j&Eo)==_n;Object.assign(k,{setuid:te,setgid:Ae,sticky:Ce,unixExternalUpper:j,internalFileAttribute:k.internalFileAttributes,externalFileAttribute:k.externalFileAttributes,executable:Me,directory:Le||Ne||b&&Z.directory||ve.endsWith(nu)&&!k.uncompressedSize,zipCrypto:k.encrypted&&!k.extraFieldAES});const st=new Ar(k);st.getData=(Ii,jt)=>k.getData(Ii,st,t.readRanges,jt),st.arrayBuffer=async Ii=>{const jt=new TransformStream,[ks]=await Promise.all([new Response(jt.readable).arrayBuffer(),k.getData(jt,st,t.readRanges,Ii)]);return ks},v=L;const{onprogress:mn}=e;if(mn)try{await mn(x+1,w,new Ar(k))}catch{}yield st}const g=Se(t,e,mf),P=Se(t,e,Af);return g&&(t.prependedData=C>0?await xe(n,0,C):new Uint8Array),t.comment=h?await xe(n,d+Lt,h):new Uint8Array,P&&(t.appendedData=f<n.size?await xe(n,f,n.size-f):new Uint8Array),!0}async getEntries(e={}){const t=[];for await(const n of this.getEntriesGenerator(e))t.push(n);return t}async close(){}}class Gf{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:l,diskNumberStart:a,extraFieldAES:d,extraFieldZip64:h,compressionMethod:f,config:p,bitFlag:u,signature:m,rawLastModDate:w,uncompressedSize:A,compressedSize:C}=o,{dataDescriptor:v}=u,S=t.localDirectory={},D=await xe(r,l,Qn,a),N=ue(D);let I=Se(o,s,yf),B=Se(o,s,Cf);const g=Se(o,s,Ef);if(I=I&&I.length&&I,B=B&&B.length&&B,d&&d.originalCompressionMethod!=Dh)throw new Error(yr);if(f!=Mh&&f!=Th&&f!=uo&&!g)throw new Error(yr);if(he(N,0)!=kh)throw new Error(Ff);vr(S,N,4);const{extraFieldLength:P,filenameLength:x,lastAccessDate:k,creationDate:_}=S;S.rawExtraField=P?await xe(r,l+Qn+x,P,a):new Uint8Array,Ir(o,S,N,4,!0),Object.assign(t,{lastAccessDate:k,creationDate:_});const G=o.encrypted&&S.encrypted&&!g,F=G&&!d;if(g||(t.zipCrypto=F),G){if(!F&&d.strength===de)throw new Error(Lf);if(!I&&!B)throw new Error(Of)}const E=l+Qn+x+P,y=C,b=r.readable;Object.assign(b,{diskNumberStart:a,offset:E,size:y});const T=Se(o,s,wf),R=Se(o,s,bf);let O=Se(o,s,If);const L=Se(o,s,vf);L&&(O=!0);const{onstart:M,onprogress:Q,onend:Y}=s,W=f==uo;let q=Se(o,s,Sf);W&&(q=!1);const Z={options:{codecType:$o,password:I,rawPassword:B,zipCrypto:F,encryptionStrength:d&&d.strength,signed:Se(o,s,Bf)&&!g,passwordVerification:F&&(v?w>>>8&On:m>>>24&On),outputSize:g?C:A,signature:m,compressed:f!=0&&!g,encrypted:o.encrypted&&!g,useWebWorkers:Se(o,s,xf),useCompressionStream:q,transferStreams:Se(o,s,Tf),deflate64:W,checkPasswordOnly:R},config:p,streamOptions:{signal:T,size:y,onstart:M,onprogress:Q,onend:Y}};O&&await Wf({reader:r,fileEntry:t,offset:l,diskNumberStart:a,signature:m,compressedSize:C,uncompressedSize:A,dataOffset:E,dataDescriptor:v||S.bitFlag.dataDescriptor,extraFieldZip64:h||S.extraFieldZip64,readRanges:n});let oe;try{if(!L){R&&(e=new WritableStream),e=new lf(e),await Qi(e,g?C:A),{writable:oe}=e;const{outputSize:ne}=await Ju({readable:b,writable:oe},Z);if(e.size+=ne,ne!=(g?C:A))throw new Error(Vo)}}catch(ne){if(ne.outputSize!==de&&(e.size+=ne.outputSize),!R||ne.message!=Gn)throw ne}finally{!Se(o,s,Mf)&&oe&&!oe.locked&&await oe.getWriter().close()}return R||L?de:e.getData?e.getData():oe}}function vr(i,e,t){const n=i.rawBitFlag=Be(e,t+2),s=(n&Ao)==Ao,o=he(e,t+6);Object.assign(i,{encrypted:s,version:Be(e,t),bitFlag:{level:(n&jh)>>1,dataDescriptor:(n&yo)==yo,languageEncodingFlag:(n&Co)==Co},rawLastModDate:o,lastModDate:Kf(o),filenameLength:Be(e,t+22),extraFieldLength:Be(e,t+24)})}function Ir(i,e,t,n,s){const{rawExtraField:o}=e,r=e.extraField=new Map,l=ue(new Uint8Array(o));let a=0;try{for(;a<o.length;){const v=Be(l,a),S=Be(l,a+2);r.set(v,{type:v,data:o.slice(a+4,a+4+S)}),a+=4+S}}catch{}const d=Be(t,n+4);Object.assign(e,{signature:he(t,n+su),compressedSize:he(t,n+ou),uncompressedSize:he(t,n+ru)});const h=r.get(Nh);h&&(Hf(h,e),e.extraFieldZip64=h);const f=r.get(Hh);f&&(Br(f,rr,ar,e,i),e.extraFieldUnicodePath=f);const p=r.get(Yh);p&&(Br(p,lr,cr,e,i),e.extraFieldUnicodeComment=p);const u=r.get(_h);u?(Yf(u,e,d),e.extraFieldAES=u):e.compressionMethod=d;const m=r.get(Uh);m&&(Vf(m,e),e.extraFieldNTFS=m);const w=r.get(Wh);if(w)xr(w,e,!1),e.extraFieldUnix=w;else{const v=r.get(zh);v&&(xr(v,e,!0),e.extraFieldInfoZip=v)}const A=r.get(Gh);A&&(zf(A,e,s),e.extraFieldExtendedTimestamp=A);const C=r.get(Vh);C&&(e.extraFieldUSDZ=C)}function Hf(i,e){e.zip64=!0;const t=ue(i.data),n=Uf.filter(([s,o])=>e[s]==o);for(let s=0,o=0;s<n.length;s++){const[r,l]=n[s];if(e[r]==l){const a=Qf[l];e[r]=i[r]=a.getValue(t,o),o+=a.bytes}else if(i[r])throw new Error(Rf)}}function Br(i,e,t,n,s){const o=ue(i.data),r=new Li;r.append(s[t]);const l=ue(new Uint8Array(4));l.setUint32(0,r.get(),!0);const a=he(o,1);Object.assign(i,{version:ct(o,0),[e]:Gi(i.data.subarray(5)),valid:!s.bitFlag.languageEncodingFlag&&a==he(l,0)}),i.valid&&(n[e]=i[e],n[e+_f]=!0)}function Yf(i,e,t){const n=ue(i.data),s=ct(n,4);Object.assign(i,{vendorVersion:ct(n,0),vendorId:ct(n,2),strength:s,originalCompressionMethod:t,compressionMethod:Be(n,5)}),e.compressionMethod=i.compressionMethod}function Vf(i,e){const t=ue(i.data);let n=4,s;try{for(;n<i.data.length&&!s;){const o=Be(t,n),r=Be(t,n+2);o==Qh&&(s=i.data.slice(n+4,n+4+r)),n+=4+r}}catch{}try{if(s&&s.length==24){const o=ue(s),r=o.getBigUint64(0,!0),l=o.getBigUint64(8,!0),a=o.getBigUint64(16,!0);Object.assign(i,{rawLastModDate:r,rawLastAccessDate:l,rawCreationDate:a});const d=Zn(r),h=Zn(l),f=Zn(a),p={lastModDate:d,lastAccessDate:h,creationDate:f};Object.assign(i,p),Object.assign(e,p)}}catch{}}function xr(i,e,t){try{const n=ue(new Uint8Array(i.data));let s=0;const o=ct(n,s++),r=ct(n,s++),l=i.data.subarray(s,s+r);s+=r;const a=Sr(l),d=ct(n,s++),h=i.data.subarray(s,s+d);s+=d;const f=Sr(h);let p=de;if(!t&&s+2<=i.data.length){const u=i.data;p=new DataView(u.buffer,u.byteOffset+s,2).getUint16(0,!0)}Object.assign(i,{version:o,uid:a,gid:f,unixMode:p}),a!==de&&(e.uid=a),f!==de&&(e.gid=f),p!==de&&(e.unixMode=p)}catch{}}function Sr(i){const e=new Uint8Array(4);return e.set(i,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function zf(i,e,t){const n=ue(i.data),s=ct(n,0),o=[],r=[];t?((s&1)==1&&(o.push(Xn),r.push(qn)),(s&2)==2&&(o.push(pr),r.push(hf)),(s&4)==4&&(o.push(gr),r.push(mr))):i.data.length>=5&&(o.push(Xn),r.push(qn));let l=1;o.forEach((a,d)=>{if(i.data.length>=l+4){const h=he(n,l);e[a]=i[a]=new Date(h*1e3);const f=r[d];i[f]=h}l+=4})}async function Wf({reader:i,fileEntry:e,offset:t,diskNumberStart:n,signature:s,compressedSize:o,uncompressedSize:r,dataOffset:l,dataDescriptor:a,extraFieldZip64:d,readRanges:h}){let f=0;if(n)for(let m=0;m<n;m++){const w=i.readers[m];f+=w.size}let p=0;if(a&&(d?p=Lh:p=Oh),p){const m=await xe(i,l+o,p+mo,n);if(he(ue(m),0)==Ph){const A=he(ue(m),4);let C,v;d?(C=_t(ue(m),8),v=_t(ue(m),16)):(C=he(ue(m),8),v=he(ue(m),12)),(e.encrypted&&!e.zipCrypto||A==s)&&C==o&&v==r&&(p+=mo)}}const u={start:f+t,end:f+l+o+p,fileEntry:e};for(const m of h)if(m.fileEntry!=e&&u.start>=m.start&&u.start<m.end){const w=new Error(Nf);throw w.overlappingEntry=m.fileEntry,w}h.push(u)}async function jf(i,e,t,n,s){const o=new Uint8Array(4),r=ue(o);$f(r,0,e);const l=n+s;return await a(n)||await a(Math.min(l,t));async function a(d){const h=t-d,f=await xe(i,h,d);for(let p=f.length-n;p>=0;p--)if(f[p]==o[0]&&f[p+1]==o[1]&&f[p+2]==o[2]&&f[p+3]==o[3])return{offset:h+p,buffer:f.slice(p,p+n).buffer}}}function Se(i,e,t){return e[t]===de?i.options[t]:e[t]}function Kf(i){const e=(i&4294901760)>>16,t=i&Ke;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 Zn(i){return new Date(Number(i/BigInt(1e4)-BigInt(116444736e5)))}function ct(i,e){return i.getUint8(e)}function Be(i,e){return i.getUint16(e,!0)}function he(i,e){return i.getUint32(e,!0)}function _t(i,e){return Number(i.getBigUint64(e,!0))}function $f(i,e,t){i.setUint32(e,t,!0)}function ue(i){return new DataView(i.buffer)}try{Oi({baseURI:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Cn&&Cn.tagName.toUpperCase()==="SCRIPT"&&Cn.src||new URL("leiting-bim.umd.js",document.baseURI).href})}catch{}const Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Xf(i){let e;i({wasmURI:()=>(e||(e="data:application/wasm;base64,"+(t=>{t=(r=>{const l=(r=(r+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,a=[];for(let d=0;l>d;d+=4){const h=Fe.indexOf(r[d])<<18|Fe.indexOf(r[d+1])<<12|(63&Fe.indexOf(r[d+2]))<<6|63&Fe.indexOf(r[d+3]);a.push(h>>16&255),r[d+2]!=="="&&a.push(h>>8&255),r[d+3]!=="="&&a.push(255&h)}return new Uint8Array(a)})(t);let n=new Uint8Array(1024),s=0;for(let r=0;r<t.length;){const l=t[r++];if(128&l){const a=3+(127&l),d=t[r++]<<8|t[r++],h=s-d;o(s+a);for(let f=0;a>f;f++)n[s++]=n[h+f]}else{const a=l;o(s+a);for(let d=0;a>d&&r<t.length;d++)n[s++]=t[r++]}}return(r=>{let l="";const a=r.length;let d=0;for(;a>d+2;d+=3){const f=r[d]<<16|r[d+1]<<8|r[d+2];l+=Fe[f>>18&63]+Fe[f>>12&63]+Fe[f>>6&63]+Fe[63&f]}const h=a-d;if(h===1){const f=r[d]<<16;l+=Fe[f>>18&63]+Fe[f>>12&63]+"=="}else if(h===2){const f=r[d]<<16|r[d+1]<<8;l+=Fe[f>>18&63]+Fe[f>>12&63]+Fe[f>>6&63]+"="}return l})(new Uint8Array(n.buffer.slice(0,s)));function o(r){if(n.length<r){let l=2*n.length;for(;r>l;)l*=2;const a=new Uint8Array(l);a.set(n.subarray(0,s)),n=a}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sooAAYEBMJkAAYEBTJkAAYEBaLkAAYEBpLkAAYIDdYABzoUBvI0BqJ0BkLwBgAIbHLwAAQEdvAABgA9PgH05A9AqAQ==")),e)})}let me,Ut,Re,ri;function qf(i){if(me=i,{malloc:Ut,free:Re,memory:ri}=me,typeof Ut!="function"||typeof Re!="function"||!ri)throw me=Ut=Re=ri=null,new Error("Invalid WASM module")}function Tr(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=Ut(s),this.in=Ut(o),this.inBufferSize=o,this._scratch=new Uint8Array(s),i?(this._process=me.deflate_process,this._last_consumed=me.deflate_last_consumed,this._end=me.deflate_end,this.streamHandle=me.deflate_new(),e==="gzip"?r=me.deflate_init_gzip(this.streamHandle,n):e==="deflate-raw"?r=me.deflate_init_raw(this.streamHandle,n):r=me.deflate_init(this.streamHandle,n)):e==="deflate64-raw"?(this._process=me.inflate9_process,this._last_consumed=me.inflate9_last_consumed,this._end=me.inflate9_end,this.streamHandle=me.inflate9_new(),r=me.inflate9_init_raw(this.streamHandle)):(this._process=me.inflate_process,this._last_consumed=me.inflate_last_consumed,this._end=me.inflate_end,this.streamHandle=me.inflate_new(),e==="deflate-raw"?r=me.inflate_init_raw(this.streamHandle):e==="gzip"?r=me.inflate_init_gzip(this.streamHandle):r=me.inflate_init(this.streamHandle)),r!==0)throw new Error("init failed:"+r)},transform(r,l){try{const a=r,d=new Uint8Array(ri.buffer),h=this._process,f=this._last_consumed,p=this.out,u=this._scratch;let m=0;for(;m<a.length;){const w=Math.min(a.length-m,32768);(!this.in||this.inBufferSize<w)&&(this.in&&Re&&Re(this.in),this.in=Ut(w),this.inBufferSize=w),d.set(a.subarray(m,m+w),this.in);const A=h(this.streamHandle,this.in,w,p,s,0),C=A&16777215;if(C&&(u.set(d.subarray(p,p+C),0),l.enqueue(u.slice(0,C))),!i){const S=A>>24&255,D=S&128?S-256:S;if(D<0)throw new Error("process error:"+D)}const v=f(this.streamHandle);if(v===0)break;m+=v}}catch(a){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Re&&Re(this.in),this.out&&Re&&Re(this.out),l.error(a)}},flush(r){try{const l=new Uint8Array(ri.buffer),a=this._process,d=this.out,h=this._scratch;for(;;){const f=a(this.streamHandle,0,0,d,s,4),p=f&16777215,u=f>>24&255;if(!i){const m=u&128?u-256:u;if(m<0)throw new Error("process error:"+m)}if(p&&(h.set(l.subarray(d,d+p),0),r.enqueue(h.slice(0,p))),u===1||p===0)break}}catch(l){r.error(l)}finally{if(this._end&&this.streamHandle){const l=this._end(this.streamHandle);l!==0&&r.error(new Error("end error:"+l))}this.in&&Re&&Re(this.in),this.out&&Re&&Re(this.out)}}})}class Jf{constructor(e="deflate",t){return Tr(!0,e,t)}}class Zf{constructor(e="deflate",t){return Tr(!1,e,t)}}let Mr=!1;async function ep(i,{baseURI:e}){if(!Mr){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=tp(i);else throw o}const s=await WebAssembly.instantiate(t);qf(s.instance.exports),Mr=!0}}function tp(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 es;Xf(Oi),Vu({initModule:i=>{if(!es){let{wasmURI:e}=i;typeof e==wt&&(e=e()),es=ep(e,i)}return es}}),Oi({CompressionStreamZlib:Jf,DecompressionStreamZlib:Zf});const ts={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(ts))for(const t of Object.keys(ts[e])){const n=ts[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})(),hu(Oi);const ip="E84#E3C4!8C4&A1";async function tt(i){try{const e=await fetch(i);if(!e.ok)return!1;const t=await e.blob();try{const n=new br(new $n(t),{password:ip}),o=(await n.getEntries()).find(l=>!l.directory&&l.filename.endsWith(".json"));if(!o)return await n.close(),!1;const r=await o.getData(new of);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}}async function Dr(i){if(!i||i.length===0)return null;try{const e=await fetch("/cx_dzpt/bim/modelComponent/listByDbNameAndElementId",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return e.ok?await e.json():(console.warn(`[fetchComponentDetails] API 请求失败: ${e.status}`),null)}catch(e){return console.error("[fetchComponentDetails] 加载异常:",e),null}}function np(){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 Hi{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))}}class kr{cesium;viewer;modelList=[];hasLoaded3dTiles={};mapRecordModelId={};mapTileset={};BIMmodelId="";lazyLoadingCount=0;events=new Hi;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?Sh({},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:Ot.NotLoaded}),this.mapRecordModelId[o]=!1}await this.load3DTilesModel(n)}}async load3DTilesModel(e){const t=this.modelList.filter(r=>r.state===Ot.NotLoaded);if(!t.length)return;const n=t.length;this.events.emit("loadingStatus",`正在加载 ${n} 个模型`);let s=0,o=!1;for(const r of t){s++;try{r.state=Ot.Loading;const l=r.url,a=this.getBaseUrlPath(l);e.loadTreeNodeDetails=!1,e.loadTreeNodeDetails&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}构件信息`);let d=e.loadTreeNodeDetails?await tt(`${a}${e.loadTreeNodeDetailsUrl}`):!1;e.loadTree=!1,e.loadTree&&this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}目录树`);const h=e.loadTree?await tt(`${a}${e.loadTreeUrl}`):!1;this.events.emit("loadingStatus",`正在加载第 ${s}/${n} 个模型: 加载${r.modelName}模型数据`);const f=e.boxRegionUrl?await tt(`${a}${e.boxRegionUrl}`):!1,p=e.batchIDInfoUrl?await tt(`${a}${e.batchIDInfoUrl}`):!1;p&&(d||(d=p));const u=await this.loadTilesetWithZipSupport(l,r.modelId,e.tilesetOptions||{},this.cesium);this.viewer.scene.primitives.add(u),await u.readyPromise;const m=`${u?.asset?.tilesetVersion??r.modelId}`;this.mapTileset[`${r.modelId}`]=u;const w={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:`${a}${e.loadTreeUrl}`,nodeUrl:`${a}${e.loadTreeNodeDetailsUrl}`,formData:r.formData,type:"BIM"},node:d||null,tree:h||null,box:null};if(f?.min&&f?.max){const A={x:f.min.X,y:f.min.Y,z:f.min.Z},C={x:f.max.X,y:f.max.Y,z:f.max.Z},v={x:(A.x+C.x)/2,y:(A.y+C.y)/2,z:(A.z+C.z)/2};w.box={min:A,max:C,center:v}}if(!r.formData){const A=await tt(`${r.outPutPath}${r.dbName}${e.regionUrl}`);if(A)r.formData={modelId:r.modelId.toString(),longitude:A.Longitude,latitude:A.Latitude,distance:1e-6,rotation:30,totalRotation:A.DAngle||0,height:A.MinHeight,lonlat:1e-5,heightDistance:1,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:A?.X||0,Y:A?.Y||0,Z:A?.Z||0};else{const C=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:C+1,label:r.modelName}],X:0,Y:0,Z:0}}}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1,w.model.formData=r.formData),u.leiting=w,Rn({Cesium:this.cesium,tileset:u}),r.state=Ot.Loaded,this.mapRecordModelId[r.modelId]=!0,this.events.emit("tilesetLoaded",u),e.tilesLoad3dTiles&&e.tilesLoad3dTiles(u),!o&&e.flyTo&&(this.BIMmodelId=r.modelId,this.flyToTileset({modelId:this.BIMmodelId,options:{duration:e.flyToDuration??0}}),o=!0),e.delay&&await new Promise(A=>setTimeout(A,e.delay))}catch(l){console.error(`模型 ${r.modelName} 加载失败:`,l),this.events.emit("loadingStatus",`模型 ${r.modelName} 加载失败`),r.state=Ot.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:l,dbName:a,modelId:d}=r,h=`${l}${a}/tileset.json`,f=await n.Cesium3DTileset.fromUrl(h,{maximumScreenSpaceError:16,preferLeaves:!0,cullWithChildrenBounds:!0,...t?.tilesetOptions});if(f.colorBlendMode=this.cesium.Cesium3DTileColorBlendMode.REPLACE,this.viewer.scene.primitives.add(f),await f.readyPromise,this.mapTileset[`${d}`]=f,this.hasLoaded3dTiles[`${d}`]=(this.hasLoaded3dTiles[`${d}`]||0)+1,this.mapRecordModelId[`${d}`]=!0,!r?.formData){const p=f.root.computedTransform;if(p){const u=n.Matrix4.fromColumnMajorArray(p),m=n.Matrix4.getTranslation(u,new n.Cartesian3),w=n.Ellipsoid.WGS84.cartesianToCartographic(m),A=n.Math.toDegrees(w.longitude),C=n.Math.toDegrees(w.latitude),v=w.height;r.formData={modelId:r.modelId.toString(),longitude:A,latitude:C,distance:1e-5,rotation:0,totalRotation:0,heightDistance:1,height:v,lonlat:1e-5,modelOptions:[{value:r.modelId.toString(),label:r.modelName}],X:0,Y:0,Z:0}}else console.warn(`OSGB模型 ${d} 无法获取初始位置信息`)}r.formData&&(r.formData.heightDistance=r.formData.heightDistance??1),f.leiting={versionId:`${f?.asset?.tilesetVersion??d}`,selectedFn:t?.selectedFn,model:{modelId:r.modelId,modelName:r.modelName,dbName:r.dbName,fileType:r.fileType,outPutPath:r.outPutPath,url:h,formData:r.formData,type:"OSGB"},box:null},Rn({Cesium:this.cesium,tileset:f}),this.modelList.push({...r,url:h,state:Ot.Loaded}),!s&&t?.flyTo&&(this.BIMmodelId=r.modelId,this.viewer.zoomTo(f),s=!0)}catch(l){console.error(`OSGB模型 ${r.dbName} 加载失败:`,l);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,l=this.mapTileset[o];if(!l){console.warn("tileSet not found for modelId:",o);return}let a=t||0,d=n||0,h=s||0;const f=l.boundingSphere.center,p=r.Transforms.eastNorthUpToFixedFrame(f),u=new r.Cartesian3(a,d,h),m=r.Matrix4.multiplyByPoint(p,u,new r.Cartesian3(0,0,0)),w=r.Cartesian3.subtract(m,f,new r.Cartesian3);l.modelMatrix=r.Matrix4.fromTranslation(w)}flyToTileset({modelId:e=this.BIMmodelId,options:t={}}={}){const s=this.getMapTileset()[e];if(!s||!this.viewer)return;const{complete:o,cancel:r,...l}=t,a={duration:0,...l};this.viewer.flyTo(s,a).then(d=>{d?o&&o():r&&r()}).catch(d=>{r&&r(),console.error("FlyTo error",d)})}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=e.lastIndexOf("/");return t===-1?".":e.substr(0,t)}async loadTilesetWithZipSupport(e,t,n,s){const o=`${this.getBaseUrlPath(e)}/tileset.zip`;if((await fetch(o,{method:"HEAD"})).status===200){const a=await tt(o);if(a){const d=new Blob([JSON.stringify(a)],{type:"application/json"}),h=URL.createObjectURL(d);class f{getURL(A){return A.includes("blob://")?A.replace(/blob:\/\//g,u):A}}const p=new f,u=this.getBaseUrlPath(e),m=new s.Resource({url:h,proxy:p});try{return await s.Cesium3DTileset.fromUrl(m,{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})}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 tt(s);if(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 tt(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 tt(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 Pr={normal:0,process:2},sp={color:1};function Fr(i){return i===1||i==="exist"?1:i===2||i==="process"?2:0}function Qt(i){return Number.isNaN(i)?0:i<=1?Math.min(Math.max(i,0),1):Math.min(Math.max(i/255,0),1)}function Rr(i){return Number.isNaN(i)?1:i<=1?Math.min(Math.max(i,0),1):1}function is(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(a=>Number.isNaN(a)))return null;const o=Math.round(e*255),r=Math.round(t*255),l=Math.round(n*255);return`rgba(${o},${r},${l},${s})`}function op(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(l=>Number.isNaN(l))?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 rp(i){if(i==null)return null;const e=Number(i);return Number.isNaN(e)?null:e}function ap(i){const e=i.lastIndexOf("-"),t=i.substring(0,e),n=i.substring(e+1);return[t,n]}function ns(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),l=Number(t.y??t.Y),a=Number(t.z??t.Z);return[n,s,o,r,l,a].some(d=>Number.isNaN(d))?null:{min:{x:n,y:s,z:o},max:{x:r,y:l,z:a}}}function ai(i,e){if(e)return`${e}`;const t=i?.leiting?.model?.modelId??i?.modelId??i?.id;return t==null?null:`${t}`}function lp(i,e){if(e==null)return null;const t=i?.leiting?.node;if(!t)return null;const n=`${e}`,s=t?.[n],o=ns(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 ns(r?.box3??r?.box)}function cp(i){const e=i?.leiting?.box;return e?ns({min:e.min,max:e.max}):null}class dp{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(l=>{const{batchIds:a,modelId:d,rgba:h}=l;if(Array.isArray(a)&&a[0]){a[0][1]=h;const f=n[d];f?f.push(a[0]):n[d]=[a[0]]}})),t>=o&&t<r&&(s!==null&&(this.base.viewer.scene.ambientLightIntensity=s),e.cash=!1,e.playCash=!0,e.groupData.forEach(l=>{const{batchIds:a,playTimeColor:d,modelId:h}=l;if(Array.isArray(a)&&a[0]){a[0][1]=d;const f=n[h];f?f.push(a[0]):n[h]=[a[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(l=>l.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:l}=r;this.base.setTileSyltByConstructionProcessTracking({modelId:l,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 l=e[o];l?l.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(a=>{s.push({dbName:n.linkModelId,modelId:n.modelId,elementId:`${a}`,show:!0,rgba:t.rgba??{r:.2,g:.2,b:.2,a:.2}})});const o=Pr.process,r=sp.color,{allElements:l}=this.base.groupByModelId(s);this.base.mapAnimations[n.modelId]=this.base.mapAnimations[n.modelId]||[],this.base.mapAnimations[n.modelId].push(t),Object.entries(l).forEach(([a,d])=>{const[h,f]=ap(a),p=this.base.getTileSyltByConstructionProcessTracking({elementIds:d,modelId:h,color:f,colorRank:o,show:!0,selectionRank:r}),u=t?.playTimeColor?.r??1,m=t?.playTimeColor?.g??1,w=t?.playTimeColor?.b??0,A=t?.playTimeColor?.a??.1,C=this.base.setColor({r:u,g:m,b:w,a:A}),v=this.base.setColor(t.rgba??{r:.2,g:.2,b:.2,a:.2});t.groupData.push({modelId:h,batchIds:p,playTimeColor:C,rgba:v})})})})}}class hp{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=ai(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=>{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=ai(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const h=e.Cartographic.fromCartesian(l),f=e.Math.toDegrees(h.longitude),p=e.Math.toDegrees(h.latitude),u=h.height;r=[f,p,u]}const d=(this.base.hasSelectedFeaturesMap[s]||[]).filter(h=>h.rank!==0);if(this.base.hasSelectedFeaturesMap[s]=[...d,{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,f=n.tileset.leiting.node.nodeExtras.element[h];f.elementId=h,f.modelId=n.tileset.leiting.model.modelId,n.tileset.leiting.selectedFn({elementInfo:f,elementId:h,point:r,modelId:n.tileset.leiting.model.modelId,_propsData:f})}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=ai(n.tileset);if(!s||!this.base.tilesetMap[s])return;const o=this.base.getFeatureId(n);if(o==="-1")return;let r;const l=this.base.viewer.scene.pickPosition(t.position);if(e.defined(l)){const a=e.Cartographic.fromCartesian(l),d=e.Math.toDegrees(a.longitude),h=e.Math.toDegrees(a.latitude),f=a.height;r=[d,h,f]}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),l=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=`${l}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 up{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;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.animationModule=new dp(this),this.selectionModule=new hp(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=Fr(t),s=[];for(const o of Object.keys(this.hasSelectedFeaturesMap))(this.hasSelectedFeaturesMap[o]||[]).forEach(l=>{if(l.rank!==n)return;const a=op(l.selectedColor);let d=this.getBatchIdToElementIdSync(l.batchId,o);d===null&&(d=l.batchId),l.isTrigger&&s.push({elementId:d,modelId:o,rgba:a||void 0,point:l?.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 l=r?.modelId;if(l==null)continue;await this.loadNodeDetailsForModel(l);const a=r?.elementId,d=this.tilesetMap[`${l}`];if(!d)continue;const f=lp(d,a)||cp(d);if(!f)continue;const p=new n.Cartesian3(f.min.x,f.min.y,f.min.z),u=new n.Cartesian3(f.max.x,f.max.y,f.max.z),m=d?.root?.computedTransform??d?.modelMatrix;if(m){const w=n.Matrix4.multiplyByPoint(m,p,new n.Cartesian3),A=n.Matrix4.multiplyByPoint(m,u,new n.Cartesian3);o.push(w,A)}else o.push(p,u)}if(o.length){const r=n.BoundingSphere.fromPoints(o);r.radius=r.radius*s;const l=this.viewer.scene.camera,a=new n.HeadingPitchRange(l.heading,l.pitch,0);l.flyToBoundingSphere(r,{duration:t?.duration??0,complete:t?.complete,offset:a})}else{const r=e[0]?.modelId,l=r?this.tilesetMap[`${r}`]:null;l&&this.viewer.flyTo(l,{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(a=>{const d=s.get(a.batchId);(!d||a.rank>=d.rank)&&s.set(a.batchId,a)});const o=new Map;if(s.forEach(({batchId:a,selectedColor:d})=>{o.has(d)||o.set(d,new Set),o.get(d)?.add(a)}),this.colorRankColor.length){const a=new Set;this.colorRankColor.forEach(d=>{const h=o.get(d);h&&h.forEach(f=>a.add(f))}),o.forEach((d,h)=>{if(this.colorRankColor.includes(h))return;const f=new Set;d.forEach(p=>{a.has(p)||f.add(p)}),o.set(h,f)})}const r=[...this.colorRankColor.filter(a=>o.has(a)),...Array.from(o.keys()).filter(a=>!this.colorRankColor.includes(a))],l=[];return r.forEach(a=>{const d=o.get(a);if(!d||!d.size)return;const h=Array.from(d).join("|");h&&l.push([`(regExp('^(${h})$').test(\${id}))`,a])}),l.length?l: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=Qt(Number(e.r)),n=Qt(Number(e.g)),s=Qt(Number(e.b)),o=Rr(e.a===void 0?1:Number(e.a));return is({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,l=this.setColor(r??{r:.4,g:.4,b:.4,a:.1}),a=`${s}-${l}`;t[a]||(t[a]=[]),t[a].push(`${o}`)}),{allElements:t,transform:null,box:null}}getBatchId(e,t){const n=`${t}`,s=`${e}`;if(this.eidToBatchIdMap[n]){const a=this.eidToBatchIdMap[n].get(s);if(a!==void 0)return a;if(!a)return s}const r=this.tilesetMap[n]?.leiting?.node?.batchIdEIDInfos;if(r&&Array.isArray(r)){const a=new Map;r.forEach(h=>{a.set(`${h.elementID}`,`${h.batchId}`)}),this.eidToBatchIdMap[n]=a;const d=a.get(s);if(d!==void 0)return d}const l=rp(e);return l!=null?String(l):null}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.getBatchId(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 l=[];for(const a of o)r.has(`${a.elementID}`)||l.push(`${a.batchId}`);this.showStateMap[n].batchIds=l;continue}this.showStateMap[n].batchIds=o.map(l=>l.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 l=r.leiting.node.batchIdEIDInfos,a=new Set(o?.batchIds??[]),d=o?.mode??"exclude";l.forEach(h=>{const f=a.has(`${h.batchId}`);(d==="include"?f:!f)===e&&n.push({elementId:`${h.elementID}`,modelId:s})})}),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 l=r.leiting.node.batchIdEIDInfos,a=new Set(o?.batchIds??[]),d=o?.mode??"exclude";l.forEach(h=>{const f=a.has(`${h.batchId}`);(d==="include"?f:!f)===e&&n.push({elementId:`${h.elementID}`,modelId:s})})}),n}getTileSyltByConstructionProcessTracking({elementIds:e,modelId:t,color:n,colorRank:s,show:o,selectionRank:r}){const l=this.tilesetMap[t];if(!Array.isArray(e))return[];const a=l.leiting.node,d=new Set(e),h=a.batchIdEIDInfos.filter(p=>d.has(`${p.elementID}`)).map(p=>String(p.batchId));return h.length?(s===Pr.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=Fr(s),r=t?.isTrigger??!0;for(const l of e){const a=l?.modelId;if(a==null)continue;const d=`${a}`;await this.loadNodeDetailsForModel(d);const h=Array.isArray(l?.elementIds)?l.elementIds:l?.elementId?[l.elementId]:[];if(!h.length)continue;const f=is(l?.rgba)||this.selectedColor;for(const p of h){const u=this.getBatchId(p,d);u!==null&&(n.has(d)||n.set(d,[]),n.get(d)?.push({batchId:u,selectedColor:f,rank:o,isTrigger:r}))}}for(const[l,a]of n){const d=this.mergeSelections(l,a);this.hasSelectedFeaturesMap[l]=d,this.setBaseStyle(l)}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),l=this.tilesetMap[r];if(!l)return;const a=l?.leiting?.node?.batchIdEIDInfos;if(!a||!Array.isArray(a))return;const d=[];a.forEach(h=>{h&&h.elementID!==void 0&&d.push(h.elementID)}),d.length!==0&&await this.setSelectColorUserModelCpt([{modelId:r,elementIds:d,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=Qt(e),r=Qt(t),l=Qt(n),a=Rr(s),d=is({r:o,g:r,b:l,a});d&&(this.selectedColor=d)}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(f=>f.rank!==0),l=o.filter(f=>f.rank===0),d=l.some(f=>f.batchId===t)?l.filter(f=>f.batchId!==t):[...l,{batchId:t,selectedColor:n,rank:0,point:s,isTrigger:!0}],h=[...r,...d];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),l=Math.max(e.y,t.y),a=o-s,d=l-r;if(Math.abs(a)<15||Math.abs(d)<15)return;const h=s+a/2,f=r+d/2,p=new this.cesium.Cartesian2(h,f),u=this.viewer.scene.drillPick(p,void 0,a,d);if(!Array.isArray(u))return;const m=new Map;u.forEach(w=>{if(!(w instanceof this.cesium.Cesium3DTileFeature))return;const A=ai(w.tileset);if(!A||!this.tilesetMap[A])return;const C=this.getFeatureId(w);C!=="-1"&&(m.has(A)||m.set(A,new Set),m.get(A)?.add(C))}),m.forEach((w,A)=>{const C=this.hasSelectedFeaturesMap[A]||[],v=C.filter(I=>I.rank!==0),S=new Set(C.filter(I=>I.rank===0).map(I=>I.batchId)),D=[];w.forEach(I=>{S.has(I)||D.push({batchId:I,selectedColor:n,rank:0,isTrigger:!0})});const N=C.filter(I=>I.rank===0);this.hasSelectedFeaturesMap[A]=[...v,...N,...D],this.setBaseStyle(A)}),await this.triggerSelectionChange()}}class fp{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,l=Math.max(r,this.targetXMinus+this.targetXPlus),a=Math.max(r,this.targetYPlus+this.targetYMinus),d=Math.max(r,this.targetZPlus+this.targetZMinus);return s==="top"||s==="down"?new e.Cartesian2(l,a):s==="left"||s==="right"?new e.Cartesian2(a,d):new e.Cartesian2(l,d)},!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),l=this.boxInverseMatrix,a=e.Matrix4.multiplyByPoint(l,r.origin,new e.Cartesian3),d=e.Matrix4.multiplyByPointAsVector(l,r.direction,new e.Cartesian3);e.Cartesian3.normalize(d,d);const h=new e.Ray(a,d),f=this.getPlaneByType(this.currentPlaneType);this.dragStartPoint=e.IntersectionTests.rayPlane(h,f,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,l=e.Matrix4.multiplyByPoint(r,o.origin,new e.Cartesian3),a=e.Matrix4.multiplyByPointAsVector(r,o.direction,new e.Cartesian3);e.Cartesian3.normalize(a,a);const d=new e.Ray(l,a);let h=new e.Cartesian3;this.currentPlaneType==="top"||this.currentPlaneType==="down"?h=Math.abs(a.x)>Math.abs(a.y)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Y:this.currentPlaneType==="left"||this.currentPlaneType==="right"?h=Math.abs(a.y)>Math.abs(a.z)?e.Cartesian3.UNIT_Y:e.Cartesian3.UNIT_Z:h=Math.abs(a.x)>Math.abs(a.z)?e.Cartesian3.UNIT_X:e.Cartesian3.UNIT_Z;const f=-e.Cartesian3.dot(this.dragStartPoint,h),p=new e.Plane(h,f);let u=e.IntersectionTests.rayPlane(d,p,new e.Cartesian3);if(!u){const w=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,A=-e.Cartesian3.dot(this.dragStartPoint,w);u=e.IntersectionTests.rayPlane(d,new e.Plane(w,A),new e.Cartesian3)}if(!u)return;const m=.01;switch(this.currentPlaneType){case"left":this.targetXMinus=Math.max(-this.targetXPlus+m,-u.x);break;case"right":this.targetXPlus=Math.max(-this.targetXMinus+m,u.x);break;case"behind":this.targetYMinus=Math.max(-this.targetYPlus+m,-u.y);break;case"front":this.targetYPlus=Math.max(-this.targetYMinus+m,u.y);break;case"top":this.targetZPlus=Math.max(-this.targetZMinus+m,u.z);break;case"down":this.targetZMinus=Math.max(-this.targetZPlus+m,-u.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(f=>{const p=this.tilesetMap[f];p&&p.boundingSphere&&t.push(p.boundingSphere.center)}),t.length===0)return;const n=new e.Cartesian3;t.forEach(f=>e.Cartesian3.add(n,f,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,l=-1/0,a=1/0,d=-1/0;this.activeModelIds.forEach(f=>{const p=this.tilesetMap[f];if(!p)return;const u=[],m=p.leiting?.box,w=p.root?.boundingVolume?.boundingVolume;if(m&&m.min&&m.max){const{min:A,max:C}=m,v=[new e.Cartesian3(A.x,A.y,A.z),new e.Cartesian3(C.x,A.y,A.z),new e.Cartesian3(A.x,C.y,A.z),new e.Cartesian3(C.x,C.y,A.z),new e.Cartesian3(A.x,A.y,C.z),new e.Cartesian3(C.x,A.y,C.z),new e.Cartesian3(A.x,C.y,C.z),new e.Cartesian3(C.x,C.y,C.z)],S=p.root.transform;v.forEach(D=>{u.push(e.Matrix4.multiplyByPoint(S,D,new e.Cartesian3))})}else if(w&&w.halfAxes){const A=w.center,C=w.halfAxes,v=e.Matrix3.getColumn(C,0,new e.Cartesian3),S=e.Matrix3.getColumn(C,1,new e.Cartesian3),D=e.Matrix3.getColumn(C,2,new e.Cartesian3);for(let N=0;N<8;N++){const I=e.Cartesian3.clone(A,new e.Cartesian3);e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(v,N&1?1:-1,new e.Cartesian3),I),e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(S,N&2?1:-1,new e.Cartesian3),I),e.Cartesian3.add(I,e.Cartesian3.multiplyByScalar(D,N&4?1:-1,new e.Cartesian3),I),u.push(I)}}else if(p.boundingSphere){const A=p.boundingSphere,C=A.center,v=A.radius,S=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,C,new e.Cartesian3);s=Math.min(s,S.x-v),o=Math.max(o,S.x+v),r=Math.min(r,S.y-v),l=Math.max(l,S.y+v),a=Math.min(a,S.z-v),d=Math.max(d,S.z+v)}u.forEach(A=>{const C=e.Matrix4.multiplyByPoint(this.boxInverseMatrix,A,new e.Cartesian3);s=Math.min(s,C.x),o=Math.max(o,C.x),r=Math.min(r,C.y),l=Math.max(l,C.y),a=Math.min(a,C.z),d=Math.max(d,C.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(l)*h,this.targetZMinus=Math.abs(a)*h,this.targetZPlus=Math.abs(d)*h,this.activeModelIds.forEach(f=>{this.setupClippingPlanes(f)}),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 ss=performance.now();const pp=10;class gp{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,l=this.cesium.Cartesian3.add(t.positionWC,this.cesium.Cartesian3.multiplyByScalar(o,10,new this.cesium.Cartesian3),new this.cesium.Cartesian3);this.position=l}}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){console.log("Model has animations:",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;ss=performance.now();const n=(o,r)=>{const l=o.code,a=o.keyCode;l==="KeyA"||a===65?this.moveState.moveLeft=r:l==="KeyW"||a===87?this.moveState.moveFront=r:l==="KeyD"||a===68?this.moveState.moveRight=r:l==="KeyS"||a===83?this.moveState.moveBack=r:l==="KeyQ"||a===81?this.moveState.moveUp=r:(l==="KeyE"||a===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,l=o.endPosition.y,a=l-this.lastScreenY,d=r-this.lastScreenX;Math.abs(a)<Math.abs(d)&&(d>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=l;const h=this.viewer.camera;this.cameralHpRoll.pitch=h.pitch+this.cesium.Math.toRadians(-a*.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-ss<pp)return;ss=r;const l=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 a=(f,p)=>new this.cesium.Ray(f,p),d=new this.cesium.Cartesian3;this.cesium.Matrix4.getColumn(this.model.modelMatrix,0,d),this.cesium.Cartesian3.normalize(d,d);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 f=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,l),f);let u=d;o===-1?u=this.cesium.Cartesian3.multiplyByScalar(d,-1,new this.cesium.Cartesian3):o===3?u=h:o===-3&&(u=this.cesium.Cartesian3.multiplyByScalar(h,-1,new this.cesium.Cartesian3));const m=a(p,u),w=this.viewer.scene.pickFromRay(m,[this.model],1);if(w&&w.position&&this.cesium.Cartesian3.distance(p,w.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 f=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=.5,u=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),f),m=new this.cesium.Cartesian3;this.cesium.Cartesian3.subtract(this.position,u,m),this.cesium.Cartesian3.normalize(m,m);const w=a(u,m),A=this.viewer.scene.pickFromRay(w,[this.model],1),C=l,v=this.cesium.Cartesian3.add(u,this.cesium.Cartesian3.multiplyByScalar(d,C,new this.cesium.Cartesian3),new this.cesium.Cartesian3);if(t.defined(A)){const S=t.Cartesian3.distance(u,A.position);S-p>.2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position)),S-p<-.1&&S<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,.2),this.position))}if(!A&&this.gravityTestByMove){const S=a(this.position,m),D=this.viewer.scene.pickFromRay(S,[this.model],1);if(D){const N=this.cesium.Cartesian3.distance(this.position,D.position);Math.abs(N-1)>.05&&N<2&&(this.position=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,-.2),this.position))}}if(A&&this.gravityTestByMove&&this.gravityTest){const S=this.cesium.Cartesian3.distance(v,A.position);Math.abs(S-l)>.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,(l-S)/Math.abs(l-S)*.05),this.position))}}if(this.transparentTest){const f=new this.cesium.Cartesian3(this.position.x,this.position.y,this.position.z),p=1.75,u=this.cesium.Matrix4.multiplyByPoint(this.model.modelMatrix,new this.cesium.Cartesian3(0,0,p),f),m=this.viewer.camera.positionWC,w=u,A=t.Cartesian3.subtract(w,m,new t.Cartesian3),C=t.Cartesian3.distance(u,m),v=t.Cartesian3.normalize(A,new t.Cartesian3),S=new t.Ray(m,v);let D;try{D=this.viewer.scene.pickFromRay(S,void 0,1)}catch{}t.defined(D)&&D.primitive!==this.model&&D.position&&t.Cartesian3.distance(m,D.position)<C&&(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=[]}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 mp{cesium;viewer;baseCesium;baseTiles;baseCompt;baseSection;basePlayer;constructor(e){this.cesium=e.cesium,this.viewer=e.viewer,this.baseCesium=new Gl(e),this.baseTiles=new kr(e),this.baseCompt=new up(e),this.baseSection=new fp(e),this.basePlayer=new gp({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 Ap{cesium;viewer;mapLayers={};renderGen={};renderGenAll=0;renderGenByModel={};modelId="default";options={flyTo:!0};dxfModelsList=[];open=!1;events=new Hi;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 l=s.layerMap[r];l!==void 0&&(t?s.hiddenBatchIds.delete(l):s.hiddenBatchIds.add(l))});const o=Array.from(s.hiddenBatchIds);if(o.length>0){const r=o.map(l=>`\${_BATCHID} !== ${l}`).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 l=r.content,a=l.featuresLength;if(a>0&&s.hiddenBatchIds)for(let d=0;d<a;d++)s.hiddenBatchIds.has(d)?l.getFeature(d).show=!1:l.getFeature(d).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 br(new $n(n),{password:"abc!?123",useWebWorkers:!1}),r=(await s.getEntries()).find(d=>!d.directory&&d.filename.endsWith(".json"));if(!r)return console.error("未找到 JSON 文件"),await s.close(),!1;const l=await r.arrayBuffer({useWebWorkers:!1});await s.close();const a=new TextDecoder().decode(l);return JSON.parse(a.trim())}catch(t){return console.error("解压或获取失败:",t),!1}}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(d=>d.modelId===s.modelId))return;const l=`${s.outPutPath}${s.dbName}/tileset.json`,a={...this.options,...t};try{const d=`${s.outPutPath}${s.dbName}/layerInfo.zip`,h=await this.loadModelFile(d);if(this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;const f=await this.cesium.Cesium3DTileset.fromUrl(l,{allowPicking:!1});if(f.maximumScreenSpaceError=0,this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;if(Object.assign(f,{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?f.formData=s.formData:f.formData={modelId:f.modelId,longitude:f.deltaLongitude,latitude:f.deltaLatitude,distance:1e-6,rotation:0,totalRotation:f.totalRotation,heightDistance:1,height:0,lonlat:1e-6,modelOptions:[{value:f.modelId,label:f.modelName}],selectPoint:{longitude:0,latitude:0,height:0},selectedMode:!1,X:0,Y:0,Z:0},this.adjustingModelByCad({...f.formData,tileset:f}),Array.isArray(h)){const p=h;f.layerMap={};let u=this.mapLayers[s.modelId];u||(u={},this.mapLayers[s.modelId]=u),p.forEach(m=>{f.layerMap[m.layerName]=m.batchId,u[m.layerName]||(u[m.layerName]=[]),u[m.layerName].push({batchId:m.batchId,color:m.layerColor})})}if(this.dxfModelsList.push(f),this.setModelId(s.modelId),this.viewer.scene.primitives.add(f),this.renderGenAll!==n||(this.renderGenByModel[s.modelId]||0)!==o)return;a.flyTo&&this.flyToBounds(f),a.onSuccess&&a.onSuccess(f)}catch(d){console.error(`Failed to load tileset or layer info: ${l}`,d)}}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})})}}class dt{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="",l="";const a=this.opt.style.background,d=this.opt.style.color;this.opt.anchor&&(r+=`
|
|
14
14
|
<div class="prompt-anchor-container">
|
|
15
15
|
<div class="prompt-anchor" style="background:${a} !important;">
|
|
16
16
|
</div>
|
|
@@ -26,27 +26,7 @@
|
|
|
26
26
|
${r}
|
|
27
27
|
<!-- 关闭按钮 -->
|
|
28
28
|
${l}
|
|
29
|
-
`;this.promptDiv=window.document.createElement("div"),this.promptDiv.className=`easy3d-prompt ${this.opt.className}`,this.promptDiv.id=f,this.promptDiv.innerHTML=p,window.document.getElementById(o).appendChild(this.promptDiv);const m=window.document.getElementById(`prompt-close-${this.opt.id}`);let b=this;m&&m.addEventListener("click",A=>{b.hide(),b.opt.close&&b.opt.close()}),this.promptDom=window.document.getElementById(f),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 Or=Object.freeze(Object.defineProperty({__proto__:null,default:dt},Symbol.toStringTag,{value:"Module"}));let re={};re.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]},re.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]}},re.cartesiansToLnglats=function(i,e){if(!(!i||i.length<1)){if(e=e||window.viewer,!e){console.log("util.cartesiansToLnglats方法缺少viewer对象");return}for(var t=[],n=0;n<i.length;n++)t.push(re.cartesianToLnglat(i[n],e));return t}},re.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}},re.flyTo=function(i,e){if(!e){console.log("util.flyTo缺少viewer对象");return}i=i||{};let t=i.center;if(!t){console.log("缺少定位坐标!");return}if(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)})}},re.getCameraView=function(i){if(i=i||window.viewer,!i){console.log("util.getCameraView缺少viewer对象");return}var e=i.camera,t=e.position,n=e.heading,s=e.pitch,o=e.roll,r=Cesium.Cartographic.fromCartesian(t),l={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 l},re.setCameraView=function(i,e){if(e=e||window.viewer,!e){console.log("util.setCameraView缺少viewer对象");return}if(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})}},re.computeAreaOfTriangle=function(i,e,t){if(!i||!e||!t)return console.log("传入坐标有误!"),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 qe{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?re.cartesiansToLnglats(this.positions,this.viewer):this.positions}getLnglats(){return re.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 yp="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 Cp extends qe{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=yp,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 l=()=>{r||(r=!0,clearTimeout(d),n(o))},a=h=>{r||(r=!0,clearTimeout(d),s(new Error("image load error: "+e)))};o.onload=l,o.onerror=a;const d=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 dt(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 l=t.viewer.scene.pick(r.position);if(Cesium.defined(l)&&l.id){if(l.id===t.entity){n=l.id,s=!0,t._isDragging=!0,t._editPickedEntity=n,t.modifyPoint=null;try{t.forbidDrawWorld(!0)}catch{}}else if(t.controlPoints.includes(l.id)){t.modifyPoint=l.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 l=t.getCatesian3FromPX(r.endPosition,t.viewer);if(l){if(Cesium.defined(n)){try{n.position.setValue(l)}catch{n.position=l}t.position=l.clone(),t.controlPoints&&t.controlPoints.length>0&&t.controlPoints.forEach(a=>{try{a.position.setValue(l)}catch(d){console.warn("更新控制点位置失败:",d);try{a.position=l.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 l=t.viewer.scene.pick(r.position);Cesium.defined(l)&&l.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,l=new Cesium.Cartesian3,a=new Cesium.Cartesian3;Cesium.Cartesian3.clone(o.direction,r),Cesium.Cartesian3.clone(o.right,l),Cesium.Cartesian3.clone(o.up,a),Cesium.Cartesian3.normalize(r,r),Cesium.Cartesian3.normalize(l,l),Cesium.Cartesian3.normalize(a,a);const d=new Cesium.Cartesian3;Cesium.Cartesian3.multiplyByScalar(l,s,d),Cesium.Cartesian3.multiplyByScalar(a,s,a),Cesium.Cartesian3.add(d,a,d);const h=new Cesium.Ray(e,r),f=this.viewer.scene.globe.pick(h,this.viewer.scene),u=Cesium.Cartesian3.distance(e,f||e)*.001;return Cesium.Cartesian3.multiplyByScalar(d,u,d),Cesium.Cartesian3.add(e,d,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?re.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 Ep extends qe{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 dt(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 l=0;l<=this.pointsCount;l++){const a=l/this.pointsCount*Math.PI*2,d=n.longitude+o*Math.cos(a),h=n.latitude+r*Math.sin(a);e.push(Cesium.Cartesian3.fromRadians(d,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,l=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=l,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?re.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:re.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 wp extends qe{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 dt(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),l=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 l.objId=this.objId,l}getPositions(e){return e?re.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=re.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),l=new Cesium.HeadingPitchRoll(s,o,r),a=this.entity.position._value,d=Cesium.Transforms.headingPitchRollQuaternion(a,l);this.entity&&(this.entity.orientation=d)}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),l;return r>=55296&&r<=56319&&s>o+1&&(l=n.charCodeAt(o+1),l>=56320&&l<=57343)?(r-55296)*1024+l-56320+65536:r}};i?i(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e})();function Gt(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var os,Lr;function bp(){if(Lr)return os;Lr=1;var i=0,e=-3;function t(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function n(g,P){this.source=g,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=P,this.destLen=0,this.ltree=new t,this.dtree=new t}var s=new t,o=new t,r=new Uint8Array(30),l=new Uint16Array(30),a=new Uint8Array(30),d=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]),f=new t,p=new Uint8Array(320);function u(g,P,x,k){var U,G;for(U=0;U<x;++U)g[U]=0;for(U=0;U<30-x;++U)g[U+x]=U/x|0;for(G=k,U=0;U<30;++U)P[U]=G,G+=1<<g[U]}function m(g,P){var x;for(x=0;x<7;++x)g.table[x]=0;for(g.table[7]=24,g.table[8]=152,g.table[9]=112,x=0;x<24;++x)g.trans[x]=256+x;for(x=0;x<144;++x)g.trans[24+x]=x;for(x=0;x<8;++x)g.trans[168+x]=280+x;for(x=0;x<112;++x)g.trans[176+x]=144+x;for(x=0;x<5;++x)P.table[x]=0;for(P.table[5]=32,x=0;x<32;++x)P.trans[x]=x}var b=new Uint16Array(16);function A(g,P,x,k){var U,G;for(U=0;U<16;++U)g.table[U]=0;for(U=0;U<k;++U)g.table[P[x+U]]++;for(g.table[0]=0,G=0,U=0;U<16;++U)b[U]=G,G+=g.table[U];for(U=0;U<k;++U)P[x+U]&&(g.trans[b[P[x+U]]++]=U)}function C(g){g.bitcount--||(g.tag=g.source[g.sourceIndex++],g.bitcount=7);var P=g.tag&1;return g.tag>>>=1,P}function v(g,P,x){if(!P)return x;for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var k=g.tag&65535>>>16-P;return g.tag>>>=P,g.bitcount-=P,k+x}function S(g,P){for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var x=0,k=0,U=0,G=g.tag;do k=2*k+(G&1),G>>>=1,++U,x+=P.table[U],k-=P.table[U];while(k>=0);return g.tag=G,g.bitcount-=U,P.trans[x+k]}function D(g,P,x){var k,U,G,F,E,y;for(k=v(g,5,257),U=v(g,5,1),G=v(g,4,4),F=0;F<19;++F)p[F]=0;for(F=0;F<G;++F){var w=v(g,3,0);p[h[F]]=w}for(A(f,p,0,19),E=0;E<k+U;){var T=S(g,f);switch(T){case 16:var R=p[E-1];for(y=v(g,2,3);y;--y)p[E++]=R;break;case 17:for(y=v(g,3,3);y;--y)p[E++]=0;break;case 18:for(y=v(g,7,11);y;--y)p[E++]=0;break;default:p[E++]=T;break}}A(P,p,0,k),A(x,p,k,U)}function N(g,P,x){for(;;){var k=S(g,P);if(k===256)return i;if(k<256)g.dest[g.destLen++]=k;else{var U,G,F,E;for(k-=257,U=v(g,r[k],l[k]),G=S(g,x),F=g.destLen-v(g,a[G],d[G]),E=F;E<F+U;++E)g.dest[g.destLen++]=g.dest[E]}}}function I(g){for(var P,x,k;g.bitcount>8;)g.sourceIndex--,g.bitcount-=8;if(P=g.source[g.sourceIndex+1],P=256*P+g.source[g.sourceIndex],x=g.source[g.sourceIndex+3],x=256*x+g.source[g.sourceIndex+2],P!==(~x&65535))return e;for(g.sourceIndex+=4,k=P;k;--k)g.dest[g.destLen++]=g.source[g.sourceIndex++];return g.bitcount=0,i}function B(g,P){var x=new n(g,P),k,U,G;do{switch(k=C(x),U=v(x,2,0),U){case 0:G=I(x);break;case 1:G=N(x,s,o);break;case 2:D(x,x.ltree,x.dtree),G=N(x,x.ltree,x.dtree);break;default:G=e}if(G!==i)throw new Error("Data error")}while(!k);return x.destLen<x.dest.length?typeof x.dest.slice=="function"?x.dest.slice(0,x.destLen):x.dest.subarray(0,x.destLen):x.dest}return m(s,o),u(r,l,4,3),u(a,d,2,1),r[28]=0,l[28]=258,os=B,os}var vp=bp();const Ip=Gt(vp);function Ht(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 ht(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}ht.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},ht.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))},ht.prototype.addX=function(i){this.addPoint(i,null)},ht.prototype.addY=function(i){this.addPoint(null,i)},ht.prototype.addBezier=function(i,e,t,n,s,o,r,l){const a=[i,e],d=[t,n],h=[s,o],f=[r,l];this.addPoint(i,e),this.addPoint(r,l);for(let p=0;p<=1;p++){const u=6*a[p]-12*d[p]+6*h[p],m=-3*a[p]+9*d[p]-9*h[p]+3*f[p],b=3*d[p]-3*a[p];if(m===0){if(u===0)continue;const S=-b/u;0<S&&S<1&&(p===0&&this.addX(Ht(a[p],d[p],h[p],f[p],S)),p===1&&this.addY(Ht(a[p],d[p],h[p],f[p],S)));continue}const A=Math.pow(u,2)-4*b*m;if(A<0)continue;const C=(-u+Math.sqrt(A))/(2*m);0<C&&C<1&&(p===0&&this.addX(Ht(a[p],d[p],h[p],f[p],C)),p===1&&this.addY(Ht(a[p],d[p],h[p],f[p],C)));const v=(-u-Math.sqrt(A))/(2*m);0<v&&v<1&&(p===0&&this.addX(Ht(a[p],d[p],h[p],f[p],v)),p===1&&this.addY(Ht(a[p],d[p],h[p],f[p],v)))}},ht.prototype.addQuad=function(i,e,t,n,s,o){const r=i+.6666666666666666*(t-i),l=e+2/3*(n-e),a=r+1/3*(s-i),d=l+1/3*(o-e);this.addBezier(i,e,r,l,a,d,s,o)};function Ie(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}Ie.prototype.moveTo=function(i,e){this.commands.push({type:"M",x:i,y:e})},Ie.prototype.lineTo=function(i,e){this.commands.push({type:"L",x:i,y:e})},Ie.prototype.curveTo=Ie.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})},Ie.prototype.quadTo=Ie.prototype.quadraticCurveTo=function(i,e,t,n){this.commands.push({type:"Q",x1:i,y1:e,x:t,y:n})},Ie.prototype.close=Ie.prototype.closePath=function(){this.commands.push({type:"Z"})},Ie.prototype.extend=function(i){if(i.commands)i=i.commands;else if(i instanceof ht){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)},Ie.prototype.getBoundingBox=function(){const i=new ht;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},Ie.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())},Ie.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},Ie.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},Ie.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 Nr(i){throw new Error(i)}function Ur(i,e){i||Nr(e)}const ie={fail:Nr,argument:Ur,assert:Ur},_r=32768,Qr=2147483648,Yt={},z={},ee={};function Ge(i){return function(){return i}}z.BYTE=function(i){return ie.argument(i>=0&&i<=255,"Byte value should be between 0 and 255."),[i]},ee.BYTE=Ge(1),z.CHAR=function(i){return[i.charCodeAt(0)]},ee.CHAR=Ge(1),z.CHARARRAY=function(i){const e=[];for(let t=0;t<i.length;t+=1)e[t]=i.charCodeAt(t);return e},ee.CHARARRAY=function(i){return i.length},z.USHORT=function(i){return[i>>8&255,i&255]},ee.USHORT=Ge(2),z.SHORT=function(i){return i>=_r&&(i=-(2*_r-i)),[i>>8&255,i&255]},ee.SHORT=Ge(2),z.UINT24=function(i){return[i>>16&255,i>>8&255,i&255]},ee.UINT24=Ge(3),z.ULONG=function(i){return[i>>24&255,i>>16&255,i>>8&255,i&255]},ee.ULONG=Ge(4),z.LONG=function(i){return i>=Qr&&(i=-(2*Qr-i)),[i>>24&255,i>>16&255,i>>8&255,i&255]},ee.LONG=Ge(4),z.FIXED=z.ULONG,ee.FIXED=ee.ULONG,z.FWORD=z.SHORT,ee.FWORD=ee.SHORT,z.UFWORD=z.USHORT,ee.UFWORD=ee.USHORT,z.LONGDATETIME=function(i){return[0,0,0,0,i>>24&255,i>>16&255,i>>8&255,i&255]},ee.LONGDATETIME=Ge(8),z.TAG=function(i){return ie.argument(i.length===4,"Tag should be exactly 4 ASCII characters."),[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]},ee.TAG=Ge(4),z.Card8=z.BYTE,ee.Card8=ee.BYTE,z.Card16=z.USHORT,ee.Card16=ee.USHORT,z.OffSize=z.BYTE,ee.OffSize=ee.BYTE,z.SID=z.USHORT,ee.SID=ee.USHORT,z.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?z.NUMBER16(i):z.NUMBER32(i)},ee.NUMBER=function(i){return z.NUMBER(i).length},z.NUMBER16=function(i){return[28,i>>8&255,i&255]},ee.NUMBER16=Ge(3),z.NUMBER32=function(i){return[29,i>>24&255,i>>16&255,i>>8&255,i&255]},ee.NUMBER32=Ge(5),z.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 l=e[o];l==="e"?n+=e[++o]==="-"?"c":"b":l==="."?n+="a":l==="-"?n+="e":n+=l}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},ee.REAL=function(i){return z.REAL(i).length},z.NAME=z.CHARARRAY,ee.NAME=ee.CHARARRAY,z.STRING=z.CHARARRAY,ee.STRING=ee.CHARARRAY,Yt.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)},Yt.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)},z.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},ee.UTF16=function(i){return i.length*2};const rs={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Yt.MACSTRING=function(i,e,t,n){const s=rs[n];if(s===void 0)return;let o="";for(let r=0;r<t;r++){const l=i.getUint8(e+r);l<=127?o+=String.fromCharCode(l):o+=s[l&127]}return o};const Yi=typeof WeakMap=="function"&&new WeakMap;let Vi;const Bp=function(i){if(!Vi){Vi={};for(let s in rs)Vi[s]=new String(s)}const e=Vi[i];if(e===void 0)return;if(Yi){const s=Yi.get(e);if(s!==void 0)return s}const t=rs[i];if(t===void 0)return;const n={};for(let s=0;s<t.length;s++)n[t.charCodeAt(s)]=s+128;return Yi&&Yi.set(e,n),n};z.MACSTRING=function(i,e){const t=Bp(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},ee.MACSTRING=function(i,e){const t=z.MACSTRING(i,e);return t!==void 0?t.length:0};function as(i){return i>=-128&&i<=127}function xp(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 Sp(i,e,t){let n=0;const s=i.length;let o=e;for(;o<s&&n<64;){const r=i[o];if(!as(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 Tp(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||as(r)&&o+1<s&&as(i[o+1]))break;++o,++n}t.push(64|n-1);for(let r=e;r<o;++r){const l=i[r];t.push(l+65536>>8&255,l+256&255)}return o}z.VARDELTAS=function(i){let e=0;const t=[];for(;e<i.length;){const n=i[e];n===0?e=xp(i,e,t):n>=-128&&n<=127?e=Sp(i,e,t):e=Tp(i,e,t)}return t},z.INDEX=function(i){let e=1;const t=[e],n=[];for(let l=0;l<i.length;l+=1){const a=z.OBJECT(i[l]);Array.prototype.push.apply(n,a),e+=a.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,z.BYTE,z.USHORT,z.UINT24,z.ULONG][o];for(let l=0;l<t.length;l+=1){const a=r(t[l]);Array.prototype.push.apply(s,a)}return Array.prototype.concat(z.Card16(i.length),z.OffSize(o),s,n)},ee.INDEX=function(i){return z.INDEX(i).length},z.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(z.OPERAND(r.value,r.type)),e=e.concat(z.OPERATOR(o))}return e},ee.DICT=function(i){return z.DICT(i).length},z.OPERATOR=function(i){return i<1200?[i]:[12,i-1200]},z.OPERAND=function(i,e){let t=[];if(Array.isArray(e))for(let n=0;n<e.length;n+=1)ie.argument(i.length===e.length,"Not enough arguments given for type"+e),t=t.concat(z.OPERAND(i[n],e[n]));else if(e==="SID")t=t.concat(z.NUMBER(i));else if(e==="offset")t=t.concat(z.NUMBER32(i));else if(e==="number")t=t.concat(z.NUMBER(i));else if(e==="real")t=t.concat(z.REAL(i));else throw new Error("Unknown operand type "+e);return t},z.OP=z.BYTE,ee.OP=ee.BYTE;const zi=typeof WeakMap=="function"&&new WeakMap;z.CHARSTRING=function(i){if(zi){const n=zi.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(z[s.type](s.value))}return zi&&zi.set(i,e),e},ee.CHARSTRING=function(i){return z.CHARSTRING(i).length},z.OBJECT=function(i){const e=z[i.type];return ie.argument(e!==void 0,"No encoding function for type "+i.type),e(i.value)},ee.OBJECT=function(i){const e=ee[i.type];return ie.argument(e!==void 0,"No sizeOf function for type "+i.type),e(i.value)},z.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],l=z[r.type];ie.argument(l!==void 0,"No encoding function for field type "+r.type+" ("+r.name+")");let a=i[r.name];a===void 0&&(a=r.value);const d=l(a);r.type==="TABLE"?(s.push(e.length),e=e.concat([0,0]),n.push(d)):e=e.concat(d)}for(let o=0;o<n.length;o+=1){const r=s[o],l=e.length;ie.argument(l<65536,"Table "+i.tableName+" too big."),e[r]=l>>8,e[r+1]=l&255,e=e.concat(n[o])}return e},ee.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=ee[s.type];ie.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},z.RECORD=z.TABLE,ee.RECORD=ee.TABLE,z.LITERAL=function(i){return i},ee.LITERAL=function(i){return i.length};function Te(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)}}}Te.prototype.encode=function(){return z.TABLE(this)},Te.prototype.sizeOf=function(){return ee.TABLE(this)};function li(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 ls(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 Wi(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 ji(i){i.format===1?Te.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(li("glyph",i.glyphs))):ie.assert(!1,"Can't create coverage table format 2 yet.")}ji.prototype=Object.create(Te.prototype),ji.prototype.constructor=ji;function Ki(i){Te.call(this,"scriptListTable",Wi("scriptRecord",i,function(e,t){const n=e.script;let s=n.defaultLangSys;return ie.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 Te("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Te("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:s.reqFeatureIndex}].concat(li("featureIndex",s.featureIndexes)))}].concat(Wi("langSys",n.langSysRecords,function(o,r){const l=o.langSys;return[{name:"langSysTag"+r,type:"TAG",value:o.tag},{name:"langSys"+r,type:"TABLE",value:new Te("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:l.reqFeatureIndex}].concat(li("featureIndex",l.featureIndexes)))}]})))}]}))}Ki.prototype=Object.create(Te.prototype),Ki.prototype.constructor=Ki;function $i(i){Te.call(this,"featureListTable",Wi("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 Te("featureTable",[{name:"featureParams",type:"USHORT",value:n.featureParams}].concat(li("lookupListIndex",n.lookupListIndexes)))}]}))}$i.prototype=Object.create(Te.prototype),$i.prototype.constructor=$i;function Xi(i,e){Te.call(this,"lookupListTable",ls("lookup",i,function(t){let n=e[t.lookupType];return ie.assert(!!n,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new Te("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(ls("subtable",t.subtables,n)))}))}Xi.prototype=Object.create(Te.prototype),Xi.prototype.constructor=Xi;const J={Table:Te,Record:Te,Coverage:ji,ScriptList:Ki,FeatureList:$i,LookupList:Xi,ushortList:li,tableList:ls,recordList:Wi};function Gr(i,e){return i.getUint8(e)}function qi(i,e){return i.getUint16(e,!1)}function Mp(i,e){return i.getInt16(e,!1)}function cs(i,e){return i.getUint32(e,!1)}function Hr(i,e){const t=i.getInt16(e,!1),n=i.getUint16(e+2,!1);return t+n/65535}function Dp(i,e){let t="";for(let n=e;n<e+4;n+=1)t+=String.fromCharCode(i.getInt8(n));return t}function kp(i,e,t){let n=0;for(let s=0;s<t;s+=1)n<<=8,n+=i.getUint8(e+s);return n}function Pp(i,e,t){const n=[];for(let s=e;s<t;s+=1)n.push(i.getUint8(s));return n}function Fp(i){let e="";for(let t=0;t<i.length;t+=1)e+=String.fromCharCode(i[t]);return e}const Rp={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=cs(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},H.prototype.parseOffset32=H.prototype.parseULong,H.prototype.parseFixed=function(){const i=Hr(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=cs(this.data,this.offset+this.relativeOffset+4);return i-=2082844800,this.relativeOffset+=8,i},H.prototype.parseVersion=function(i){const e=qi(this.data,this.offset+this.relativeOffset),t=qi(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+=Rp[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 l=n[r],a=e[l];o[l]=a.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 l=n[r],a=e[l];o[l]=a.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 l=this.parseOffset16List(),a=new Array(l.length);for(let d=0;d<l.length;d++)this.relativeOffset=r+l[d],a[d]=i.call(this);s[o]=a}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 Yr={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(Yr),langSysRecords:H.recordList({tag:H.tag,langSys:H.pointer(Yr)})})}))||[]},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();ie.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 ie.argument(i===1&&e<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:H.offset32,featureTableSubstitutionOffset:H.offset32})})||[]};const $={getByte:Gr,getCard8:Gr,getUShort:qi,getCard16:qi,getShort:Mp,getULong:cs,getFixed:Hr,getTag:Dp,getOffset:kp,getBytes:Pp,bytesToString:Fp,Parser:H};function Op(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 l=s;l<=o;l+=1)i.glyphIndexMap[l]=r,r++}}function Lp(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 $.Parser(t,n+s+14),l=new $.Parser(t,n+s+16+o*2),a=new $.Parser(t,n+s+16+o*4),d=new $.Parser(t,n+s+16+o*6);let h=n+s+16+o*8;for(let f=0;f<o-1;f+=1){let p;const u=r.parseUShort(),m=l.parseUShort(),b=a.parseShort(),A=d.parseUShort();for(let C=m;C<=u;C+=1)A!==0?(h=d.offset+d.relativeOffset-2,h+=A,h+=(C-m)*2,p=$.getUShort(t,h),p!==0&&(p=p+b&65535)):p=C+b&65535,i.glyphIndexMap[C]=p}}function Np(i,e){const t={};t.version=$.getUShort(i,e),ie.argument(t.version===0,"cmap table version should be 0."),t.numTables=$.getUShort(i,e+2);let n=-1;for(let o=t.numTables-1;o>=0;o-=1){const r=$.getUShort(i,e+4+o*8),l=$.getUShort(i,e+4+o*8+2);if(r===3&&(l===0||l===1||l===10)||r===0&&(l===0||l===1||l===2||l===3||l===4)){n=$.getULong(i,e+4+o*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");const s=new $.Parser(i,e+n);if(t.format=s.parseUShort(),t.format===12)Op(t,s);else if(t.format===4)Lp(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 Up(i,e,t){i.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function _p(i){i.segments.push({end:65535,start:65535,delta:1,offset:0})}function Qp(i){let e=!0,t;for(t=i.length-1;t>0;t-=1)if(i.get(t).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),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 J.Table("cmap",n);for(s.segments=[],t=0;t<i.length;t+=1){const u=i.get(t);for(let m=0;m<u.unicodes.length;m+=1)Up(s,u.unicodes[m],t);s.segments=s.segments.sort(function(m,b){return m.start-b.start})}_p(s);const o=s.segments.length;let r=0,l=[],a=[],d=[],h=[],f=[],p=[];for(t=0;t<o;t+=1){const u=s.segments[t];u.end<=65535&&u.start<=65535?(l=l.concat({name:"end_"+t,type:"USHORT",value:u.end}),a=a.concat({name:"start_"+t,type:"USHORT",value:u.start}),d=d.concat({name:"idDelta_"+t,type:"SHORT",value:u.delta}),h=h.concat({name:"idRangeOffset_"+t,type:"USHORT",value:u.offset}),u.glyphId!==void 0&&(f=f.concat({name:"glyph_"+t,type:"USHORT",value:u.glyphId}))):r+=1,!e&&u.glyphIndex!==void 0&&(p=p.concat({name:"cmap12Start_"+t,type:"ULONG",value:u.start}),p=p.concat({name:"cmap12End_"+t,type:"ULONG",value:u.end}),p=p.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:u.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(l),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(a),s.fields=s.fields.concat(d),s.fields=s.fields.concat(h),s.fields=s.fields.concat(f),s.cmap4Length=14+l.length*2+2+a.length*2+d.length*2+h.length*2+f.length*2,!e){const u=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:u},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:p.length/3}]),s.fields=s.fields.concat(p)}return s}const Vr={parse:Np,make:Qp},Ji=[".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"],Gp=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Hp=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],It=[".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 zr(i){this.font=i}zr.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 Wr(i){this.cmap=i}Wr.prototype.charToGlyphIndex=function(i){return this.cmap.glyphIndexMap[i.codePointAt(0)]||0};function Zi(i,e){this.encoding=i,this.charset=e}Zi.prototype.charToGlyphIndex=function(i){const e=i.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function ds(i){switch(i.version){case 1:this.names=It.slice();break;case 2:this.names=new Array(i.numberOfGlyphs);for(let e=0;e<i.numberOfGlyphs;e++)i.glyphNameIndex[e]<It.length?this.names[e]=It[i.glyphNameIndex[e]]:this.names[e]=i.names[i.glyphNameIndex[e]-It.length];break;case 2.5:this.names=new Array(i.numberOfGlyphs);for(let e=0;e<i.numberOfGlyphs;e++)this.names[e]=It[e+i.glyphNameIndex[e]];break;case 3:this.names=[];break;default:this.names=[];break}}ds.prototype.nameToGlyphIndex=function(i){return this.names.indexOf(i)},ds.prototype.glyphIndexToName=function(i){return this.names[i]};function Yp(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 Vp(i,e,t,n,s){i.beginPath(),i.moveTo(e,t),i.lineTo(n,s),i.stroke()}const Bt={line:Vp};function zp(i,e){let t=e||new Ie;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(n){t=n}}}function Qe(i){this.bindConstructorValues(i)}Qe.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",zp(this,i.path))},Qe.prototype.addUnicode=function(i){this.unicodes.length===0&&(this.unicode=i),this.unicodes.push(i)},Qe.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Qe.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 l=n.xScale,a=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),l=a=1;else{o=this.path.commands;const h=1/this.path.unitsPerEm*t;l===void 0&&(l=h),a===void 0&&(a=h)}const d=new Ie;for(let h=0;h<o.length;h+=1){const f=o[h];f.type==="M"?d.moveTo(i+f.x*l,e+-f.y*a):f.type==="L"?d.lineTo(i+f.x*l,e+-f.y*a):f.type==="Q"?d.quadraticCurveTo(i+f.x1*l,e+-f.y1*a,i+f.x*l,e+-f.y*a):f.type==="C"?d.curveTo(i+f.x1*l,e+-f.y1*a,i+f.x2*l,e+-f.y2*a,i+f.x*l,e+-f.y*a):f.type==="Z"&&d.closePath()}return d},Qe.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 ie.argument(e.length===0,"There are still points left in the current contour."),i},Qe.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},Qe.prototype.draw=function(i,e,t,n,s){this.getPath(e,t,n,s).draw(i)},Qe.prototype.drawPoints=function(i,e,t,n){function s(d,h,f,p){const u=Math.PI*2;i.beginPath();for(let m=0;m<d.length;m+=1)i.moveTo(h+d[m].x*p,f+d[m].y*p),i.arc(h+d[m].x*p,f+d[m].y*p,2,0,u,!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=[],l=[],a=this.path;for(let d=0;d<a.commands.length;d+=1){const h=a.commands[d];h.x!==void 0&&r.push({x:h.x,y:-h.y}),h.x1!==void 0&&l.push({x:h.x1,y:-h.y1}),h.x2!==void 0&&l.push({x:h.x2,y:-h.y2})}i.fillStyle="blue",s(r,e,t,o),i.fillStyle="red",s(l,e,t,o)},Qe.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",Bt.line(i,e,-1e4,e,1e4),Bt.line(i,-1e4,t,1e4,t);const o=this.xMin||0;let r=this.yMin||0;const l=this.xMax||0;let a=this.yMax||0;const d=this.advanceWidth||0;i.strokeStyle="blue",Bt.line(i,e+o*s,-1e4,e+o*s,1e4),Bt.line(i,e+l*s,-1e4,e+l*s,1e4),Bt.line(i,-1e4,t+-r*s,1e4,t+-r*s),Bt.line(i,-1e4,t+-a*s,1e4,t+-a*s),i.strokeStyle="green",Bt.line(i,e+d*s,-1e4,e+d*s,1e4)};function en(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 hs(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}hs.prototype.get=function(i){return typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]()),this.glyphs[i]},hs.prototype.push=function(i,e){this.glyphs[i]=e,this.length++};function Wp(i,e){return new Qe({index:e,font:i})}function jp(i,e,t,n,s,o){return function(){const r=new Qe({index:e,font:i});return r.path=function(){t(r,n,s);const l=o(i.glyphs,r);return l.unitsPerEm=i.unitsPerEm,l},en(r,"xMin","_xMin"),en(r,"xMax","_xMax"),en(r,"yMin","_yMin"),en(r,"yMax","_yMax"),r}}function Kp(i,e,t,n){return function(){const s=new Qe({index:e,font:i});return s.path=function(){const o=t(i,s,n);return o.unitsPerEm=i.unitsPerEm,o},s}}const Vt={GlyphSet:hs,glyphLoader:Wp,ttfGlyphLoader:jp,cffGlyphLoader:Kp};function jr(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(!jr(i[t],e[t]))return!1;return!0}else return!1}function us(i){let e;return i.length<1240?e=107:i.length<33900?e=1131:e=32768,e}function ut(i,e,t){const n=[],s=[],o=$.getCard16(i,e);let r,l;if(o!==0){const a=$.getByte(i,e+2);r=e+(o+1)*a+2;let d=e+3;for(let h=0;h<o+1;h+=1)n.push($.getOffset(i,d,a)),d+=a;l=r+n[o]}else l=e+2;for(let a=0;a<n.length-1;a+=1){let d=$.getBytes(i,r+n[a],r+n[a+1]);t&&(d=t(d)),s.push(d)}return{objects:s,startOffset:e,endOffset:l}}function $p(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 Xp(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 $p(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 qp(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 Kr(i,e,t){e=e!==void 0?e:0;const n=new $.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(Xp(n,r))}return qp(s)}function ci(i,e){return e<=390?e=Ji[e]:e=i[e-391],e}function $r(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 l=[];l.length=r.type.length;for(let a=0;a<r.type.length;a++)s=i[r.op]!==void 0?i[r.op][a]:void 0,s===void 0&&(s=r.value!==void 0&&r.value[a]!==void 0?r.value[a]:null),r.type[a]==="SID"&&(s=ci(t,s)),l[a]=s;n[r.name]=l}else s=i[r.op],s===void 0&&(s=r.value!==void 0?r.value:null),r.type==="SID"&&(s=ci(t,s)),n[r.name]=s}return n}function Jp(i,e){const t={};return t.formatMajor=$.getCard8(i,e),t.formatMinor=$.getCard8(i,e+1),t.size=$.getCard8(i,e+2),t.offsetSize=$.getCard8(i,e+3),t.startOffset=e,t.endOffset=e+4,t}const Xr=[{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"}],qr=[{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 Zp(i,e){const t=Kr(i,0,i.byteLength);return $r(t,Xr,e)}function Jr(i,e,t,n){const s=Kr(i,e,t);return $r(s,qr,n)}function Zr(i,e,t,n){const s=[];for(let o=0;o<t.length;o+=1){const r=new DataView(new Uint8Array(t[o]).buffer),l=Zp(r,n);l._subrs=[],l._subrsBias=0;const a=l.private[0],d=l.private[1];if(a!==0&&d!==0){const h=Jr(i,d+e,a,n);if(l._defaultWidthX=h.defaultWidthX,l._nominalWidthX=h.nominalWidthX,h.subrs!==0){const f=d+h.subrs,p=ut(i,f+e);l._subrs=p.objects,l._subrsBias=us(l._subrs)}l._privateDict=h}s.push(l)}return s}function eg(i,e,t,n){let s,o;const r=new $.Parser(i,e);t-=1;const l=[".notdef"],a=r.parseCard8();if(a===0)for(let d=0;d<t;d+=1)s=r.parseSID(),l.push(ci(n,s));else if(a===1)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard8();for(let d=0;d<=o;d+=1)l.push(ci(n,s)),s+=1}else if(a===2)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard16();for(let d=0;d<=o;d+=1)l.push(ci(n,s)),s+=1}else throw new Error("Unknown charset format "+a);return l}function tg(i,e,t){let n;const s={},o=new $.Parser(i,e),r=o.parseCard8();if(r===0){const l=o.parseCard8();for(let a=0;a<l;a+=1)n=o.parseCard8(),s[n]=a}else if(r===1){const l=o.parseCard8();n=1;for(let a=0;a<l;a+=1){const d=o.parseCard8(),h=o.parseCard8();for(let f=d;f<=d+h;f+=1)s[f]=n,n+=1}}else throw new Error("Unknown encoding format "+r);return new Zi(s,t)}function ig(i,e,t){let n,s,o,r;const l=new Ie,a=[];let d=0,h=!1,f=!1,p=0,u=0,m,b,A,C;if(i.isCIDFont){const I=i.tables.cff.topDict._fdSelect[e.index],B=i.tables.cff.topDict._fdArray[I];m=B._subrs,b=B._subrsBias,A=B._defaultWidthX,C=B._nominalWidthX}else m=i.tables.cff.topDict._subrs,b=i.tables.cff.topDict._subrsBias,A=i.tables.cff.topDict._defaultWidthX,C=i.tables.cff.topDict._nominalWidthX;let v=A;function S(I,B){f&&l.closePath(),l.moveTo(I,B),f=!0}function D(){let I;I=a.length%2!==0,I&&!h&&(v=a.shift()+C),d+=a.length>>1,a.length=0,h=!0}function N(I){let B,g,P,x,k,U,G,F,E,y,w,T,R=0;for(;R<I.length;){let O=I[R];switch(R+=1,O){case 1:D();break;case 3:D();break;case 4:a.length>1&&!h&&(v=a.shift()+C,h=!0),u+=a.pop(),S(p,u);break;case 5:for(;a.length>0;)p+=a.shift(),u+=a.shift(),l.lineTo(p,u);break;case 6:for(;a.length>0&&(p+=a.shift(),l.lineTo(p,u),a.length!==0);)u+=a.shift(),l.lineTo(p,u);break;case 7:for(;a.length>0&&(u+=a.shift(),l.lineTo(p,u),a.length!==0);)p+=a.shift(),l.lineTo(p,u);break;case 8:for(;a.length>0;)n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+a.shift(),l.curveTo(n,s,o,r,p,u);break;case 10:k=a.pop()+b,U=m[k],U&&N(U);break;case 11:return;case 12:switch(O=I[R],R+=1,O){case 35:n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r+a.shift(),E=G+a.shift(),y=F+a.shift(),w=E+a.shift(),T=y+a.shift(),p=w+a.shift(),u=T+a.shift(),a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,w,T,p,u);break;case 34:n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r,E=G+a.shift(),y=r,w=E+a.shift(),T=u,p=w+a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,w,T,p,u);break;case 36:n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r,E=G+a.shift(),y=r,w=E+a.shift(),T=y+a.shift(),p=w+a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,w,T,p,u);break;case 37:n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r+a.shift(),E=G+a.shift(),y=F+a.shift(),w=E+a.shift(),T=y+a.shift(),Math.abs(w-p)>Math.abs(T-u)?p=w+a.shift():u=T+a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,w,T,p,u);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+O),a.length=0}break;case 14:a.length>0&&!h&&(v=a.shift()+C,h=!0),f&&(l.closePath(),f=!1);break;case 18:D();break;case 19:case 20:D(),R+=d+7>>3;break;case 21:a.length>2&&!h&&(v=a.shift()+C,h=!0),u+=a.pop(),p+=a.pop(),S(p,u);break;case 22:a.length>1&&!h&&(v=a.shift()+C,h=!0),p+=a.pop(),S(p,u);break;case 23:D();break;case 24:for(;a.length>2;)n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+a.shift(),l.curveTo(n,s,o,r,p,u);p+=a.shift(),u+=a.shift(),l.lineTo(p,u);break;case 25:for(;a.length>6;)p+=a.shift(),u+=a.shift(),l.lineTo(p,u);n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+a.shift(),l.curveTo(n,s,o,r,p,u);break;case 26:for(a.length%2&&(p+=a.shift());a.length>0;)n=p,s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o,u=r+a.shift(),l.curveTo(n,s,o,r,p,u);break;case 27:for(a.length%2&&(u+=a.shift());a.length>0;)n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r,l.curveTo(n,s,o,r,p,u);break;case 28:B=I[R],g=I[R+1],a.push((B<<24|g<<16)>>16),R+=2;break;case 29:k=a.pop()+i.gsubrsBias,U=i.gsubrs[k],U&&N(U);break;case 30:for(;a.length>0&&(n=p,s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u),a.length!==0);)n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),u=r+a.shift(),p=o+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u);break;case 31:for(;a.length>0&&(n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),u=r+a.shift(),p=o+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u),a.length!==0);)n=p,s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u);break;default:O<32?console.log("Glyph "+e.index+": unknown operator "+O):O<247?a.push(O-139):O<251?(B=I[R],R+=1,a.push((O-247)*256+B+108)):O<255?(B=I[R],R+=1,a.push(-(O-251)*256-B-108)):(B=I[R],g=I[R+1],P=I[R+2],x=I[R+3],R+=4,a.push((B<<24|g<<16|P<<8|x)/65536))}}}return N(t),e.advanceWidth=v,l}function ng(i,e,t,n){const s=[];let o;const r=new $.Parser(i,e),l=r.parseCard8();if(l===0)for(let a=0;a<t;a++){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(l===3){const a=r.parseCard16();let d=r.parseCard16();if(d!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+d);let h;for(let f=0;f<a;f++){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(;d<h;d++)s.push(o);d=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 "+l);return s}function sg(i,e,t){t.tables.cff={};const n=Jp(i,e),s=ut(i,n.endOffset,$.bytesToString),o=ut(i,s.endOffset),r=ut(i,o.endOffset,$.bytesToString),l=ut(i,r.endOffset);t.gsubrs=l.objects,t.gsubrsBias=us(t.gsubrs);const a=Zr(i,e,o.objects,r.objects);if(a.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+a.length);const d=a[0];if(t.tables.cff.topDict=d,d._privateDict&&(t.defaultWidthX=d._privateDict.defaultWidthX,t.nominalWidthX=d._privateDict.nominalWidthX),d.ros[0]!==void 0&&d.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){let m=d.fdArray,b=d.fdSelect;if(m===0||b===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");m+=e;const A=ut(i,m),C=Zr(i,e,A.objects,r.objects);d._fdArray=C,b+=e,d._fdSelect=ng(i,b,t.numGlyphs,C.length)}const h=e+d.private[1],f=Jr(i,h,d.private[0],r.objects);if(t.defaultWidthX=f.defaultWidthX,t.nominalWidthX=f.nominalWidthX,f.subrs!==0){const m=h+f.subrs,b=ut(i,m);t.subrs=b.objects,t.subrsBias=us(t.subrs)}else t.subrs=[],t.subrsBias=0;const p=ut(i,e+d.charStrings);t.nGlyphs=p.objects.length;const u=eg(i,e+d.charset,t.nGlyphs,r.objects);d.encoding===0?t.cffEncoding=new Zi(Gp,u):d.encoding===1?t.cffEncoding=new Zi(Hp,u):t.cffEncoding=tg(i,e+d.encoding,u),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new Vt.GlyphSet(t);for(let m=0;m<t.nGlyphs;m+=1){const b=p.objects[m];t.glyphs.push(m,Vt.cffGlyphLoader(t,m,ig,b))}}function ea(i,e){let t,n=Ji.indexOf(i);return n>=0&&(t=n),n=e.indexOf(i),n>=0?t=n+Ji.length:(t=Ji.length+e.length,e.push(i)),t}function og(){return new J.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 rg(i){const e=new J.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 ta(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&&!jr(r,o.value)&&(o.type==="SID"&&(r=ea(r,t)),n[o.op]={name:o.name,type:o.type,value:r})}return n}function ia(i,e){const t=new J.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=ta(Xr,i,e),t}function na(i){const e=new J.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:i}],e}function ag(i){const e=new J.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 lg(){return new J.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function cg(i,e){const t=new J.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let n=0;n<i.length;n+=1){const s=i[n],o=ea(s,e);t.fields.push({name:"glyph_"+n,type:"SID",value:o})}return t}function dg(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,l,a=t.commands[o];if(a.type==="Q"){const d=.3333333333333333,h=2/3;a={type:"C",x:a.x,y:a.y,x1:d*n+h*a.x1,y1:d*s+h*a.y1,x2:d*a.x+h*a.x1,y2:d*a.y+h*a.y1}}if(a.type==="M")r=Math.round(a.x-n),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rmoveto",type:"OP",value:21}),n=Math.round(a.x),s=Math.round(a.y);else if(a.type==="L")r=Math.round(a.x-n),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rlineto",type:"OP",value:5}),n=Math.round(a.x),s=Math.round(a.y);else if(a.type==="C"){const d=Math.round(a.x1-n),h=Math.round(a.y1-s),f=Math.round(a.x2-a.x1),p=Math.round(a.y2-a.y1);r=Math.round(a.x-a.x2),l=Math.round(a.y-a.y2),e.push({name:"dx1",type:"NUMBER",value:d}),e.push({name:"dy1",type:"NUMBER",value:h}),e.push({name:"dx2",type:"NUMBER",value:f}),e.push({name:"dy2",type:"NUMBER",value:p}),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rrcurveto",type:"OP",value:8}),n=Math.round(a.x),s=Math.round(a.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function hg(i){const e=new J.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let t=0;t<i.length;t+=1){const n=i.get(t),s=dg(n);e.charStrings.push({name:n.name,type:"CHARSTRING",value:s})}return e}function ug(i,e){const t=new J.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=ta(qr,i,e),t}function fg(i,e){const t=new J.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 l;for(let f=1;f<i.length;f+=1)l=i.get(f),r.push(l.name);const a=[];t.header=og(),t.nameIndex=rg([e.postScriptName]);let d=ia(s,a);t.topDictIndex=na(d),t.globalSubrIndex=lg(),t.charsets=cg(r,a),t.charStringsIndex=hg(i),t.privateDict=ug(o,a),t.stringIndex=ag(a);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(),d=ia(s,a),t.topDictIndex=na(d),t}const sa={parse:sg,make:fg};function pg(i,e){const t={},n=new $.Parser(i,e);return t.version=n.parseVersion(),t.fontRevision=Math.round(n.parseFixed()*1e3)/1e3,t.checkSumAdjustment=n.parseULong(),t.magicNumber=n.parseULong(),ie.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 gg(i){const e=Math.round(new Date().getTime()/1e3)+2082844800;let t=e;return i.createdTimestamp&&(t=i.createdTimestamp+2082844800),new J.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 oa={parse:pg,make:gg};function mg(i,e){const t={},n=new $.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 Ag(i){return new J.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 ra={parse:mg,make:Ag};function yg(i,e,t,n,s){let o,r;const l=new $.Parser(i,e);for(let a=0;a<n;a+=1){a<t&&(o=l.parseUShort(),r=l.parseShort());const d=s.get(a);d.advanceWidth=o,d.leftSideBearing=r}}function Cg(i){const e=new J.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 aa={parse:yg,make:Cg};function Eg(i){const e=new J.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 wg(i,e){const t=new $.Parser(i,e),n=t.parseULong();ie.argument(n===1,"Unsupported ltag table version."),t.skip("uLong",1);const s=t.parseULong(),o=[];for(let r=0;r<s;r++){let l="";const a=e+t.parseUShort(),d=t.parseUShort();for(let h=a;h<a+d;++h)l+=String.fromCharCode(i.getInt8(h));o.push(l)}return o}const la={make:Eg,parse:wg};function bg(i,e){const t={},n=new $.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 vg(i){return new J.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:i}])}const ca={parse:bg,make:vg},da=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],ha={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"},Ig={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},ua={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 Bg(i,e,t){switch(i){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return ha[e];case 3:return ua[e]}}const fs="utf-16",xg={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"},Sg={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 fa(i,e,t){switch(i){case 0:return fs;case 1:return Sg[t]||xg[e];case 3:if(e===1||e===10)return fs;break}}function Tg(i,e,t){const n={},s=new $.Parser(i,e),o=s.parseUShort(),r=s.parseUShort(),l=s.offset+s.parseUShort();for(let a=0;a<r;a++){const d=s.parseUShort(),h=s.parseUShort(),f=s.parseUShort(),p=s.parseUShort(),u=da[p]||p,m=s.parseUShort(),b=s.parseUShort(),A=Bg(d,f,t),C=fa(d,h,f);if(C!==void 0&&A!==void 0){let v;if(C===fs?v=Yt.UTF16(i,l+b,m):v=Yt.MACSTRING(i,l+b,m,C),v){let S=n[u];S===void 0&&(S=n[u]={}),S[A]=v}}}return o===1&&s.parseUShort(),n}function ps(i){const e={};for(let t in i)e[i[t]]=parseInt(t);return e}function pa(i,e,t,n,s,o){return new J.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 Mg(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 ga(i,e){let t=Mg(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 Dg(i,e){let t;const n=[],s={},o=ps(da);for(let f in i){let p=o[f];if(p===void 0&&(p=f),t=parseInt(p),isNaN(t))throw new Error('Name table entry "'+f+'" does not exist, see nameTableNames for complete list.');s[t]=i[f],n.push(t)}const r=ps(ha),l=ps(ua),a=[],d=[];for(let f=0;f<n.length;f++){t=n[f];const p=s[t];for(let u in p){const m=p[u];let b=1,A=r[u],C=Ig[A];const v=fa(b,C,A);let S=z.MACSTRING(m,v);S===void 0&&(b=0,A=e.indexOf(u),A<0&&(A=e.length,e.push(u)),C=4,S=z.UTF16(m));const D=ga(S,d);a.push(pa(b,C,A,t,S.length,D));const N=l[u];if(N!==void 0){const I=z.UTF16(m),B=ga(I,d);a.push(pa(3,1,N,t,I.length,B))}}}a.sort(function(f,p){return f.platformID-p.platformID||f.encodingID-p.encodingID||f.languageID-p.languageID||f.nameID-p.nameID});const h=new J.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:a.length},{name:"stringOffset",type:"USHORT",value:6+a.length*12}]);for(let f=0;f<a.length;f++)h.fields.push({name:"record_"+f,type:"RECORD",value:a[f]});return h.fields.push({name:"strings",type:"LITERAL",value:d}),h}const ma={parse:Tg,make:Dg},gs=[{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 kg(i){for(let e=0;e<gs.length;e+=1){const t=gs[e];if(i>=t.begin&&i<t.end)return e}return-1}function Pg(i,e){const t={},n=new $.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 Fg(i){return new J.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 ms={parse:Pg,make:Fg,unicodeRanges:gs,getUnicodeRange:kg};function Rg(i,e){const t={},n=new $.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=It.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]>=It.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 Og(){return new J.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 Aa={parse:Rg,make:Og},He=new Array(9);He[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()};ie.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},He[2]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),sequences:this.parseListOfLists()}},He[3]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),alternateSets:this.parseListOfLists()}},He[4]=function(){const e=this.parseUShort();return ie.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 zt={sequenceIndex:H.uShort,lookupListIndex:H.uShort};He[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,zt)}})};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,zt)}})};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,zt)}}ie.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},He[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(zt)}})};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(zt)}})};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(zt)};ie.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},He[7]=function(){const e=this.parseUShort();ie.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:He[t].call(n)}},He[8]=function(){const e=this.parseUShort();return ie.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 Lg(i,e){e=e||0;const t=new H(i,e),n=t.parseVersion(1);return ie.argument(n===1||n===1.1,"Unsupported GSUB table version."),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(He)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(He),variations:t.parseFeatureVariationsList()}}const tn=new Array(9);tn[1]=function(e){return e.substFormat===1?new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.ushortList("substitute",e.substitute)))},tn[3]=function(e){return ie.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.tableList("altSet",e.alternateSets,function(t){return new J.Table("alternateSetTable",J.ushortList("alternate",t))})))},tn[4]=function(e){return ie.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.tableList("ligSet",e.ligatureSets,function(t){return new J.Table("ligatureSetTable",J.tableList("ligature",t,function(n){return new J.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:n.ligGlyph}].concat(J.ushortList("component",n.components,n.components.length+1)))}))})))};function Ng(i){return new J.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new J.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new J.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new J.LookupList(i.lookups,tn)}])}const ya={parse:Lg,make:Ng};function Ug(i,e){const t=new $.Parser(i,e),n=t.parseULong();ie.argument(n===1,"Unsupported META table version."),t.parseULong(),t.parseULong();const s=t.parseULong(),o={};for(let r=0;r<s;r++){const l=t.parseTag(),a=t.parseULong(),d=t.parseULong(),h=Yt.UTF8(i,e+a,d);o[l]=h}return o}function _g(i){const e=Object.keys(i).length;let t="";const n=16+e*12,s=new J.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 Ca={parse:Ug,make:_g};function Ea(i){return Math.log(i)/Math.log(2)|0}function As(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 wa(i,e,t,n){return new J.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 ba(i){const e=new J.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,Ea(e.numTables));e.searchRange=16*t,e.entrySelector=Ea(t),e.rangeShift=e.numTables*16-e.searchRange;const n=[],s=[];let o=e.sizeOf()+wa().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 l=i[r];ie.argument(l.tableName.length===4,"Table name"+l.tableName+" is invalid.");const a=l.sizeOf(),d=wa(l.tableName,As(l.encode()),o,a);for(n.push({name:d.tag+" Table Record",type:"RECORD",value:d}),s.push({name:l.tableName+" table",type:"RECORD",value:l}),o+=a,ie.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,l){return r.value.tag>l.value.tag?1:-1}),e.fields=e.fields.concat(n),e.fields=e.fields.concat(s),e}function va(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 Qg(i){let e=0;for(let t=0;t<i.length;t+=1)e+=i[t];return e/i.length}function Gg(i){const e=[],t=[],n=[],s=[],o=[],r=[],l=[];let a,d=0,h=0,f=0,p=0,u=0;for(let M=0;M<i.glyphs.length;M+=1){const Q=i.glyphs.get(M),Y=Q.unicode|0;if(isNaN(Q.advanceWidth))throw new Error("Glyph "+Q.name+" ("+M+"): advanceWidth is not a number.");(a>Y||a===void 0)&&Y>0&&(a=Y),d<Y&&(d=Y);const W=ms.getUnicodeRange(Y);if(W<32)h|=1<<W;else if(W<64)f|=1<<W-32;else if(W<96)p|=1<<W-64;else if(W<123)u|=1<<W-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Q.name===".notdef")continue;const q=Q.getMetrics();e.push(q.xMin),t.push(q.yMin),n.push(q.xMax),s.push(q.yMax),r.push(q.leftSideBearing),l.push(q.rightSideBearing),o.push(Q.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:Qg(o),minLeftSideBearing:Math.min.apply(null,r),maxLeftSideBearing:Math.max.apply(null,r),minRightSideBearing:Math.min.apply(null,l)};m.ascender=i.ascender,m.descender=i.descender;const b=oa.make({flags:3,unitsPerEm:i.unitsPerEm,xMin:m.xMin,yMin:m.yMin,xMax:m.xMax,yMax:m.yMax,lowestRecPPEM:3,createdTimestamp:i.createdTimestamp}),A=ra.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}),C=ca.make(i.glyphs.length),v=ms.make({xAvgCharWidth:Math.round(m.advanceWidthAvg),usWeightClass:i.tables.os2.usWeightClass,usWidthClass:i.tables.os2.usWidthClass,usFirstCharIndex:a,usLastCharIndex:d,ulUnicodeRange1:h,ulUnicodeRange2:f,ulUnicodeRange3:p,ulUnicodeRange4:u,fsSelection:i.tables.os2.fsSelection,sTypoAscender:m.ascender,sTypoDescender:m.descender,sTypoLineGap:0,usWinAscent:m.yMax,usWinDescent:Math.abs(m.yMin),ulCodePageRange1:1,sxHeight:va(i,"xyvw",{yMax:Math.round(m.ascender/2)}).yMax,sCapHeight:va(i,"HIKLEFJMNTZBDPRAGOQSUVWXY",m).yMax,usDefaultChar:i.hasChar(" ")?32:0,usBreakChar:i.hasChar(" ")?32:0}),S=aa.make(i.glyphs),D=Vr.make(i.glyphs),N=i.getEnglishName("fontFamily"),I=i.getEnglishName("fontSubfamily"),B=N+" "+I;let g=i.getEnglishName("postScriptName");g||(g=N.replace(/\s/g,"")+"-"+I);const P={};for(let M in i.names)P[M]=i.names[M];P.uniqueID||(P.uniqueID={en:i.getEnglishName("manufacturer")+":"+B}),P.postScriptName||(P.postScriptName={en:g}),P.preferredFamily||(P.preferredFamily=i.names.fontFamily),P.preferredSubfamily||(P.preferredSubfamily=i.names.fontSubfamily);const x=[],k=ma.make(P,x),U=x.length>0?la.make(x):void 0,G=Aa.make(),F=sa.make(i.glyphs,{version:i.getEnglishName("version"),fullName:B,familyName:N,weightName:I,postScriptName:g,unitsPerEm:i.unitsPerEm,fontBBox:[0,m.yMin,m.ascender,m.advanceWidthMax]}),E=i.metas&&Object.keys(i.metas).length>0?Ca.make(i.metas):void 0,y=[b,A,C,v,k,D,G,F,S];U&&y.push(U),i.tables.gsub&&y.push(ya.make(i.tables.gsub)),E&&y.push(E);const w=ba(y),T=w.encode(),R=As(T),O=w.fields;let L=!1;for(let M=0;M<O.length;M+=1)if(O[M].name==="head table"){O[M].value.checkSumAdjustment=2981146554-R,L=!0;break}if(!L)throw new Error("Could not find head table with checkSum to adjust.");return w}const Hg={make:ba,fontToTable:Gg,computeCheckSum:As};function ys(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 Ia(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 Ba(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 di(i,e){this.font=i,this.tableName=e}di.prototype={searchTag:ys,binSearch:Ia,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=ys(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=ys(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,l=this.font.tables[this.tableName].features;for(let a=0;a<r.length;a++)if(o=l[r[a]],o.tag===t)return o.feature;if(n){const a=l.length;return ie.assert(a===0||t>=l[a-1].tag,"Features must be added in alphabetical order."),o={tag:t,feature:{params:0,lookupListIndexes:[]}},l.push(o),r.push(a),o.feature}}},getLookupTables:function(i,e,t,n,s){const o=this.getFeatureTable(i,e,t,s),r=[];if(o){let l;const a=o.lookupListIndexes,d=this.font.tables[this.tableName].lookups;for(let h=0;h<a.length;h++)l=d[a[h]],l.lookupType===n&&r.push(l);if(r.length===0&&s){l={lookupType:n,lookupFlag:0,subtables:[],markFilteringSet:void 0};const h=d.length;return d.push(l),a.push(h),[l]}}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=Ba(i.ranges,e);return t?t.classId:0}},getCoverageIndex:function(i,e){switch(i.format){case 1:const t=Ia(i.glyphs,e);return t>=0?t:-1;case 2:const n=Ba(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 l=o;l<=r;l++)e.push(l)}return e}}};function hi(i){di.call(this,i,"gpos")}hi.prototype=di.prototype,hi.prototype.init=function(){const i=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(i)},hi.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],l=this.getCoverageIndex(r.coverage,e);if(!(l<0))switch(r.posFormat){case 1:let a=r.pairSets[l];for(let p=0;p<a.length;p++){let u=a[p];if(u.secondGlyph===t)return u.value1&&u.value1.xAdvance||0}break;case 2:const d=this.getGlyphClass(r.classDef1,e),h=this.getGlyphClass(r.classDef2,t),f=r.classRecords[d][h];return f.value1&&f.value1.xAdvance||0}}}return 0},hi.prototype.getKerningTables=function(i,e){if(this.font.tables.gpos)return this.getLookupTables(i,e,"kern",2)};function Ye(i){di.call(this,i,"gsub")}function Yg(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 xa(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}Ye.prototype=di.prototype,Ye.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ye.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 l=0;l<r.length;l++){const a=r[l],d=this.expandCoverage(a.coverage);let h;if(a.substFormat===1){const f=a.deltaGlyphId;for(h=0;h<d.length;h++){const p=d[h];n.push({sub:p,by:p+f})}}else{const f=a.substitute;for(h=0;h<d.length;h++)n.push({sub:d[h],by:f[h]})}}}return n},Ye.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 l=0;l<r.length;l++){const a=r[l],d=this.expandCoverage(a.coverage),h=a.alternateSets;for(let f=0;f<d.length;f++)n.push({sub:d[f],by:h[f]})}}return n},Ye.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 l=0;l<r.length;l++){const a=r[l],d=this.expandCoverage(a.coverage),h=a.ligatureSets;for(let f=0;f<d.length;f++){const p=d[f],u=h[f];for(let m=0;m<u.length;m++){const b=u[m];n.push({sub:[p].concat(b.components),by:b.ligGlyph})}}}}return n},Ye.prototype.addSingle=function(i,e,t,n){const s=this.getLookupTables(t,n,i,1,!0)[0],o=xa(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.substitute.splice(l,0,0)),o.substitute[l]=e.by},Ye.prototype.addAlternate=function(i,e,t,n){const s=this.getLookupTables(t,n,i,3,!0)[0],o=xa(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.alternateSets.splice(l,0,0)),o.alternateSets[l]=e.by},Ye.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),ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub[0],l=e.sub.slice(1),a={ligGlyph:e.by,components:l};let d=this.binSearch(o.coverage.glyphs,r);if(d>=0){const h=o.ligatureSets[d];for(let f=0;f<h.length;f++)if(Yg(h[f].components,l))return;h.push(a)}else d=-1-d,o.coverage.glyphs.splice(d,0,r),o.ligatureSets.splice(d,0,[a])},Ye.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)}},Ye.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 Vg(){return typeof window<"u"}function zg(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 Wg(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 Wt(i,e){if(!i)throw e}function Sa(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 jg(i,e,t){const n=new $.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 a=0;a<i.numberOfContours;a+=1)r.push(n.parseUShort());i.instructionLength=n.parseUShort(),i.instructions=[];for(let a=0;a<i.instructionLength;a+=1)i.instructions.push(n.parseByte());const l=r[r.length-1]+1;s=[];for(let a=0;a<l;a+=1)if(o=n.parseByte(),s.push(o),(o&8)>0){const d=n.parseByte();for(let h=0;h<d;h+=1)s.push(o),a+=1}if(ie.argument(s.length===l,"Bad flags."),r.length>0){const a=[];let d;if(l>0){for(let p=0;p<l;p+=1)o=s[p],d={},d.onCurve=!!(o&1),d.lastPointOfContour=r.indexOf(p)>=0,a.push(d);let h=0;for(let p=0;p<l;p+=1)o=s[p],d=a[p],d.x=Sa(n,o,h,2,16),h=d.x;let f=0;for(let p=0;p<l;p+=1)o=s[p],d=a[p],d.y=Sa(n,o,f,4,32),f=d.y}i.points=a}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 l={glyphIndex:n.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(l.dx=n.parseShort(),l.dy=n.parseShort()):l.matchedPoints=[n.parseUShort(),n.parseUShort()]:(s&2)>0?(l.dx=n.parseChar(),l.dy=n.parseChar()):l.matchedPoints=[n.parseByte(),n.parseByte()],(s&8)>0?l.xScale=l.yScale=n.parseF2Dot14():(s&64)>0?(l.xScale=n.parseF2Dot14(),l.yScale=n.parseF2Dot14()):(s&128)>0&&(l.xScale=n.parseF2Dot14(),l.scale01=n.parseF2Dot14(),l.scale10=n.parseF2Dot14(),l.yScale=n.parseF2Dot14()),i.components.push(l),r=!!(s&32)}if(s&256){i.instructionLength=n.parseUShort(),i.instructions=[];for(let l=0;l<i.instructionLength;l+=1)i.instructions.push(n.parseByte())}}}function Cs(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 Kg(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 ie.argument(t.length===0,"There are still points left in the current contour."),e}function Ta(i){const e=new Ie;if(!i)return e;const t=Kg(i);for(let n=0;n<t.length;++n){const s=t[n];let o=null,r=s[s.length-1],l=s[0];if(r.onCurve)e.moveTo(r.x,r.y);else if(l.onCurve)e.moveTo(l.x,l.y);else{const a={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5};e.moveTo(a.x,a.y)}for(let a=0;a<s.length;++a)if(o=r,r=l,l=s[(a+1)%s.length],r.onCurve)e.lineTo(r.x,r.y);else{let d=l;o.onCurve||((r.x+o.x)*.5,(r.y+o.y)*.5),l.onCurve||(d={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5}),e.quadraticCurveTo(r.x,r.y,d.x,d.y)}e.closePath()}return e}function $g(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=Cs(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 l=s.points[n.matchedPoints[1]];const a={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};l=Cs([l],a)[0],a.dx=r.x-l.x,a.dy=r.y-l.y,o=Cs(s.points,a)}e.points=e.points.concat(o)}}return Ta(e.points)}function Xg(i,e,t,n){const s=new Vt.GlyphSet(n);for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];r!==l?s.push(o,Vt.ttfGlyphLoader(n,o,jg,i,e+r,$g)):s.push(o,Vt.glyphLoader(n,o))}return s}const Ma={getPath:Ta,parse:Xg};let Da,xt,ka,Es;function Pa(i){this.font=i,this.getCommands=function(e){return Ma.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function qg(i){return i}function Fa(i){return Math.sign(i)*Math.round(Math.abs(i))}function Jg(i){return Math.sign(i)*Math.round(Math.abs(i*2))/2}function Zg(i){return Math.sign(i)*(Math.round(Math.abs(i)+.5)-.5)}function em(i){return Math.sign(i)*Math.ceil(Math.abs(i))}function tm(i){return Math.sign(i)*Math.floor(Math.abs(i))}const Ra=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},Je={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,l,a,d,h;if(!n||n===this){if(s=i.xo-e.xo,o=i.xo-t.xo,a=e.x-e.xo,d=t.x-t.xo,r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){i.x=i.xo+(a+d)/2;return}i.x=i.xo+(a*l+d*r)/h;return}if(s=n.distance(i,e,!0,!0),o=n.distance(i,t,!0,!0),a=n.distance(e,e,!1,!0),d=n.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){Je.setRelative(i,i,(a+d)/2,n,!0);return}Je.setRelative(i,i,(a*l+d*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,l=o+t*n.x,a=r+t*n.y;i.x=l+(i.y-a)/n.normalSlope},slope:0,touch:function(i){i.xTouched=!0},touched:function(i){return i.xTouched},untouch:function(i){i.xTouched=!1}},it={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,l,a,d,h;if(!n||n===this){if(s=i.yo-e.yo,o=i.yo-t.yo,a=e.y-e.yo,d=t.y-t.yo,r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){i.y=i.yo+(a+d)/2;return}i.y=i.yo+(a*l+d*r)/h;return}if(s=n.distance(i,e,!0,!0),o=n.distance(i,t,!0,!0),a=n.distance(e,e,!1,!0),d=n.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){it.setRelative(i,i,(a+d)/2,n,!0);return}it.setRelative(i,i,(a*l+d*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,l=o+t*n.x,a=r+t*n.y;i.y=a+n.normalSlope*(i.x-l)},slope:Number.POSITIVE_INFINITY,touch:function(i){i.yTouched=!0},touched:function(i){return i.yTouched},untouch:function(i){i.yTouched=!1}};Object.freeze(Je),Object.freeze(it);function ui(i,e){this.x=i,this.y=e,this.axis=void 0,this.slope=e/i,this.normalSlope=-i/e,Object.freeze(this)}ui.prototype.distance=function(i,e,t,n){return this.x*Je.distance(i,e,t,n)+this.y*it.distance(i,e,t,n)},ui.prototype.interpolate=function(i,e,t,n){let s,o,r,l,a,d,h;if(r=n.distance(i,e,!0,!0),l=n.distance(i,t,!0,!0),s=n.distance(e,e,!1,!0),o=n.distance(t,t,!1,!0),a=Math.abs(r),d=Math.abs(l),h=a+d,h===0){this.setRelative(i,i,(s+o)/2,n,!0);return}this.setRelative(i,i,(s*d+o*a)/h,n,!0)},ui.prototype.setRelative=function(i,e,t,n,s){n=n||this;const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*n.x,a=r+t*n.y,d=n.normalSlope,h=this.slope,f=i.x,p=i.y;i.x=(h*f-d*l+a-p)/(h-d),i.y=h*(i.x-f)+p},ui.prototype.touch=function(i){i.xTouched=!0,i.yTouched=!0};function fi(i,e){const t=Math.sqrt(i*i+e*e);return i/=t,e/=t,i===1&&e===0?Je:i===0&&e===1?it:new ui(i,e)}function nt(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)}nt.prototype.nextTouched=function(i){let e=this.nextPointOnContour;for(;!i.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},nt.prototype.prevTouched=function(i){let e=this.prevPointOnContour;for(;!i.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};const pi=Object.freeze(new nt(0,0)),im={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function ft(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=Je,this.round=Fa}}Pa.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){ft.prototype=im,s=this._fpgmState=new ft("fpgm",t.tables.fpgm),s.funcs=[],s.font=t,_.DEBUG&&(console.log("---EXEC FPGM---"),s.step=-1);try{xt(s)}catch(r){console.log("Hinting error in FPGM:"+r),this._errorState=3;return}}ft.prototype=s,n=this._prepState=new ft("prep",t.tables.prep),n.ppem=e;const o=t.tables.cvt;if(o){const r=n.cvt=new Array(o.length),l=e/t.unitsPerEm;for(let a=0;a<o.length;a++)r[a]=o[a]*l}else n.cvt=[];_.DEBUG&&(console.log("---EXEC PREP---"),n.step=-1);try{xt(n)}catch(r){this._errorState<2&&console.log("Hinting error in PREP:"+r),this._errorState=2}}if(!(this._errorState>1))try{return ka(i,n)}catch(s){this._errorState<1&&(console.log("Hinting error:"+s),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},ka=function(i,e){const t=e.ppem/e.font.unitsPerEm,n=t;let s=i.components,o,r,l;if(ft.prototype=e,!s)l=new ft("glyf",i.instructions),_.DEBUG&&(console.log("---EXEC GLYPH---"),l.step=-1),Es(i,l,t,n),r=l.gZone;else{const a=e.font;r=[],o=[];for(let d=0;d<s.length;d++){const h=s[d],f=a.glyphs.get(h.glyphIndex);l=new ft("glyf",f.instructions),_.DEBUG&&(console.log("---EXEC COMP "+d+"---"),l.step=-1),Es(f,l,t,n);const p=Math.round(h.dx*t),u=Math.round(h.dy*n),m=l.gZone,b=l.contours;for(let C=0;C<m.length;C++){const v=m[C];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+p,v.yo=v.y=v.y+u}const A=r.length;r.push.apply(r,m);for(let C=0;C<b.length;C++)o.push(b[C]+A)}i.instructions&&!l.inhibitGridFit&&(l=new ft("glyf",i.instructions),l.gZone=l.z0=l.z1=l.z2=r,l.contours=o,r.push(new nt(0,0),new nt(Math.round(i.advanceWidth*t),0)),_.DEBUG&&(console.log("---EXEC COMPOSITE---"),l.step=-1),xt(l),r.length-=2)}return r},Es=function(i,e,t,n){const s=i.points||[],o=s.length,r=e.gZone=e.z0=e.z1=e.z2=[],l=e.contours=[];let a;for(let f=0;f<o;f++)a=s[f],r[f]=new nt(a.x*t,a.y*n,a.lastPointOfContour,a.onCurve);let d,h;for(let f=0;f<o;f++)a=r[f],d||(d=a,l.push(f)),a.lastPointOfContour?(a.nextPointOnContour=d,d.prevPointOnContour=a,d=void 0):(h=r[f+1],a.nextPointOnContour=h,h.prevPointOnContour=a);if(!e.inhibitGridFit){if(_.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(let f=0;f<o;f++)console.log(f,r[f].x,r[f].y)}if(r.push(new nt(0,0),new nt(Math.round(i.advanceWidth*t),0)),xt(e),r.length-=2,_.DEBUG){console.log("FINISHED GLYPH",e.stack);for(let f=0;f<o;f++)console.log(f,r[f].x,r[f].y)}}},xt=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(_.DEBUG&&i.step++,n=Da[e[i.ip]],!n)throw new Error("unknown instruction: 0x"+Number(e[i.ip]).toString(16));n(i)}};function nn(i){const e=i.tZone=new Array(i.gZone.length);for(let t=0;t<e.length;t++)e[t]=new nt(0,0)}function Oa(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 La(i,e){_.DEBUG&&console.log(e.step,"SVTCA["+i.axis+"]"),e.fv=e.pv=e.dpv=i}function Na(i,e){_.DEBUG&&console.log(e.step,"SPVTCA["+i.axis+"]"),e.pv=e.dpv=i}function Ua(i,e){_.DEBUG&&console.log(e.step,"SFVTCA["+i.axis+"]"),e.fv=i}function _a(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];_.DEBUG&&console.log("SPVTL["+i+"]",n,s);let l,a;i?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.pv=e.dpv=fi(l,a)}function Qa(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];_.DEBUG&&console.log("SFVTL["+i+"]",n,s);let l,a;i?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.fv=fi(l,a)}function nm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"SPVFS[]",t,n),i.pv=i.dpv=fi(n,t)}function sm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"SPVFS[]",t,n),i.fv=fi(n,t)}function om(i){const e=i.stack,t=i.pv;_.DEBUG&&console.log(i.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function rm(i){const e=i.stack,t=i.fv;_.DEBUG&&console.log(i.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function am(i){i.fv=i.pv,_.DEBUG&&console.log(i.step,"SFVTPV[]")}function lm(i){const e=i.stack,t=e.pop(),n=e.pop(),s=e.pop(),o=e.pop(),r=e.pop(),l=i.z0,a=i.z1,d=l[t],h=l[n],f=a[s],p=a[o],u=i.z2[r];_.DEBUG&&console.log("ISECT[], ",t,n,s,o,r);const m=d.x,b=d.y,A=h.x,C=h.y,v=f.x,S=f.y,D=p.x,N=p.y,I=(m-A)*(S-N)-(b-C)*(v-D),B=m*C-b*A,g=v*N-S*D;u.x=(B*(v-D)-g*(m-A))/I,u.y=(B*(S-N)-g*(b-C))/I}function cm(i){i.rp0=i.stack.pop(),_.DEBUG&&console.log(i.step,"SRP0[]",i.rp0)}function dm(i){i.rp1=i.stack.pop(),_.DEBUG&&console.log(i.step,"SRP1[]",i.rp1)}function hm(i){i.rp2=i.stack.pop(),_.DEBUG&&console.log(i.step,"SRP2[]",i.rp2)}function um(i){const e=i.stack.pop();switch(_.DEBUG&&console.log(i.step,"SZP0[]",e),i.zp0=e,e){case 0:i.tZone||nn(i),i.z0=i.tZone;break;case 1:i.z0=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function fm(i){const e=i.stack.pop();switch(_.DEBUG&&console.log(i.step,"SZP1[]",e),i.zp1=e,e){case 0:i.tZone||nn(i),i.z1=i.tZone;break;case 1:i.z1=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function pm(i){const e=i.stack.pop();switch(_.DEBUG&&console.log(i.step,"SZP2[]",e),i.zp2=e,e){case 0:i.tZone||nn(i),i.z2=i.tZone;break;case 1:i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function gm(i){const e=i.stack.pop();switch(_.DEBUG&&console.log(i.step,"SZPS[]",e),i.zp0=i.zp1=i.zp2=e,e){case 0:i.tZone||nn(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 mm(i){i.loop=i.stack.pop(),_.DEBUG&&console.log(i.step,"SLOOP[]",i.loop)}function Am(i){_.DEBUG&&console.log(i.step,"RTG[]"),i.round=Fa}function ym(i){_.DEBUG&&console.log(i.step,"RTHG[]"),i.round=Zg}function Cm(i){const e=i.stack.pop();_.DEBUG&&console.log(i.step,"SMD[]",e),i.minDis=e/64}function Em(i){_.DEBUG&&console.log(i.step,"ELSE[]"),Oa(i,!1)}function wm(i){const e=i.stack.pop();_.DEBUG&&console.log(i.step,"JMPR[]",e),i.ip+=e-1}function bm(i){const e=i.stack.pop();_.DEBUG&&console.log(i.step,"SCVTCI[]",e),i.cvCutIn=e/64}function vm(i){const e=i.stack;_.DEBUG&&console.log(i.step,"DUP[]"),e.push(e[e.length-1])}function ws(i){_.DEBUG&&console.log(i.step,"POP[]"),i.stack.pop()}function Im(i){_.DEBUG&&console.log(i.step,"CLEAR[]"),i.stack.length=0}function Bm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"SWAP[]"),e.push(t),e.push(n)}function xm(i){const e=i.stack;_.DEBUG&&console.log(i.step,"DEPTH[]"),e.push(e.length)}function Sm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"LOOPCALL[]",t,n);const s=i.ip,o=i.prog;i.prog=i.funcs[t];for(let r=0;r<n;r++)xt(i),_.DEBUG&&console.log(++i.step,r+1<n?"next loopcall":"done loopcall",r);i.ip=s,i.prog=o}function Tm(i){const e=i.stack.pop();_.DEBUG&&console.log(i.step,"CALL[]",e);const t=i.ip,n=i.prog;i.prog=i.funcs[e],xt(i),i.ip=t,i.prog=n,_.DEBUG&&console.log(++i.step,"returning from",e)}function Mm(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"CINDEX[]",t),e.push(e[e.length-t])}function Dm(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"MINDEX[]",t),e.push(e.splice(e.length-t,1)[0])}function km(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(_.DEBUG&&console.log(i.step,"FDEF[]",s);t[++n]!==45;);i.ip=n,i.funcs[s]=t.slice(o+1,n)}function Ga(i,e){const t=e.stack.pop(),n=e.z0[t],s=e.fv,o=e.pv;_.DEBUG&&console.log(e.step,"MDAP["+i+"]",t);let r=o.distance(n,pi);i&&(r=e.round(r)),s.setRelative(n,pi,r,o),s.touch(n),e.rp0=e.rp1=t}function Ha(i,e){const t=e.z2,n=t.length-2;let s,o,r;_.DEBUG&&console.log(e.step,"IUP["+i.axis+"]");for(let l=0;l<n;l++)s=t[l],!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 Ya(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 l=e.loop;const a=e.z2;for(;l--;){const d=t.pop(),h=a[d],f=r.distance(s,s,!1,!0);o.setRelative(h,h,f,r),o.touch(h),_.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-l)+": ":"")+"SHP["+(i?"rp1":"rp2")+"]",d)}e.loop=1}function Va(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,l=t.pop(),a=e.z2[e.contours[l]];let d=a;_.DEBUG&&console.log(e.step,"SHC["+i+"]",l);const h=r.distance(s,s,!1,!0);do d!==s&&o.setRelative(d,d,h,r),d=d.nextPointOnContour;while(d!==a)}function za(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,l=t.pop();_.DEBUG&&console.log(e.step,"SHZ["+i+"]",l);let a;switch(l){case 0:a=e.tZone;break;case 1:a=e.gZone;break;default:throw new Error("Invalid zone")}let d;const h=r.distance(s,s,!1,!0),f=a.length-2;for(let p=0;p<f;p++)d=a[p],o.setRelative(d,d,h,r)}function Pm(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(),l=o[r];_.DEBUG&&console.log(i.step,(i.loop>1?"loop "+(i.loop-t)+": ":"")+"SHPIX[]",r,s),n.setRelative(l,l,s),n.touch(l)}i.loop=1}function Fm(i){const e=i.stack,t=i.rp1,n=i.rp2;let s=i.loop;const o=i.z0[t],r=i.z1[n],l=i.fv,a=i.dpv,d=i.z2;for(;s--;){const h=e.pop(),f=d[h];_.DEBUG&&console.log(i.step,(i.loop>1?"loop "+(i.loop-s)+": ":"")+"IP[]",h,t,"<->",n),l.interpolate(f,o,r,a),l.touch(f)}i.loop=1}function Wa(i,e){const t=e.stack,n=t.pop()/64,s=t.pop(),o=e.z1[s],r=e.z0[e.rp0],l=e.fv,a=e.pv;l.setRelative(o,r,n,a),l.touch(o),_.DEBUG&&console.log(e.step,"MSIRP["+i+"]",n,s),e.rp1=e.rp0,e.rp2=s,i&&(e.rp0=s)}function Rm(i){const e=i.stack,t=i.rp0,n=i.z0[t];let s=i.loop;const o=i.fv,r=i.pv,l=i.z1;for(;s--;){const a=e.pop(),d=l[a];_.DEBUG&&console.log(i.step,(i.loop>1?"loop "+(i.loop-s)+": ":"")+"ALIGNRP[]",a),o.setRelative(d,n,0,r),o.touch(d)}i.loop=1}function Om(i){_.DEBUG&&console.log(i.step,"RTDG[]"),i.round=Jg}function ja(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z0[s],r=e.fv,l=e.pv;let a=e.cvt[n];_.DEBUG&&console.log(e.step,"MIAP["+i+"]",n,"(",a,")",s);let d=l.distance(o,pi);i&&(Math.abs(d-a)<e.cvCutIn&&(d=a),d=e.round(d)),r.setRelative(o,pi,d,l),e.zp0===0&&(o.xo=o.x,o.yo=o.y),r.touch(o),e.rp0=e.rp1=s}function Lm(i){const e=i.prog;let t=i.ip;const n=i.stack,s=e[++t];_.DEBUG&&console.log(i.step,"NPUSHB[]",s);for(let o=0;o<s;o++)n.push(e[++t]);i.ip=t}function Nm(i){let e=i.ip;const t=i.prog,n=i.stack,s=t[++e];_.DEBUG&&console.log(i.step,"NPUSHW[]",s);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 Um(i){const e=i.stack;let t=i.store;t||(t=i.store=[]);const n=e.pop(),s=e.pop();_.DEBUG&&console.log(i.step,"WS",n,s),t[s]=n}function _m(i){const e=i.stack,t=i.store,n=e.pop();_.DEBUG&&console.log(i.step,"RS",n);const s=t&&t[n]||0;e.push(s)}function Qm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"WCVTP",t,n),i.cvt[n]=t/64}function Gm(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"RCVT",t),e.push(i.cvt[t]*64)}function Ka(i,e){const t=e.stack,n=t.pop(),s=e.z2[n];_.DEBUG&&console.log(e.step,"GC["+i+"]",n),t.push(e.dpv.distance(s,pi,i,!1)*64)}function $a(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z1[n],r=e.z0[s],l=e.dpv.distance(r,o,i,i);_.DEBUG&&console.log(e.step,"MD["+i+"]",n,s,"->",l),e.stack.push(Math.round(l*64))}function Hm(i){_.DEBUG&&console.log(i.step,"MPPEM[]"),i.stack.push(i.ppem)}function Ym(i){_.DEBUG&&console.log(i.step,"FLIPON[]"),i.autoFlip=!0}function Vm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"LT[]",t,n),e.push(n<t?1:0)}function zm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"LTEQ[]",t,n),e.push(n<=t?1:0)}function Wm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"GT[]",t,n),e.push(n>t?1:0)}function jm(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"GTEQ[]",t,n),e.push(n>=t?1:0)}function Km(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"EQ[]",t,n),e.push(t===n?1:0)}function $m(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"NEQ[]",t,n),e.push(t!==n?1:0)}function Xm(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function qm(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function Jm(i){let e=i.stack.pop();_.DEBUG&&console.log(i.step,"IF[]",e),e||(Oa(i,!0),_.DEBUG&&console.log(i.step,"EIF[]"))}function Zm(i){_.DEBUG&&console.log(i.step,"EIF[]")}function eA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"AND[]",t,n),e.push(t&&n?1:0)}function tA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"OR[]",t,n),e.push(t||n?1:0)}function iA(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"NOT[]",t),e.push(t?0:1)}function bs(i,e){const t=e.stack,n=t.pop(),s=e.fv,o=e.pv,r=e.ppem,l=e.deltaBase+(i-1)*16,a=e.deltaShift,d=e.z0;_.DEBUG&&console.log(e.step,"DELTAP["+i+"]",n,t);for(let h=0;h<n;h++){const f=t.pop(),p=t.pop();if(l+((p&240)>>4)!==r)continue;let m=(p&15)-8;m>=0&&m++,_.DEBUG&&console.log(e.step,"DELTAPFIX",f,"by",m*a);const b=d[f];s.setRelative(b,b,m*a,o)}}function nA(i){const t=i.stack.pop();_.DEBUG&&console.log(i.step,"SDB[]",t),i.deltaBase=t}function sA(i){const t=i.stack.pop();_.DEBUG&&console.log(i.step,"SDS[]",t),i.deltaShift=Math.pow(.5,t)}function oA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"ADD[]",t,n),e.push(n+t)}function rA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"SUB[]",t,n),e.push(n-t)}function aA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"DIV[]",t,n),e.push(n*64/t)}function lA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"MUL[]",t,n),e.push(n*t/64)}function cA(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"ABS[]",t),e.push(Math.abs(t))}function dA(i){const e=i.stack;let t=e.pop();_.DEBUG&&console.log(i.step,"NEG[]",t),e.push(-t)}function hA(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function uA(i){const e=i.stack,t=e.pop();_.DEBUG&&console.log(i.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function sn(i,e){const t=e.stack,n=t.pop();_.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(n/64)*64)}function fA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"WCVTF[]",t,n),i.cvt[n]=t*i.ppem/i.font.unitsPerEm}function vs(i,e){const t=e.stack,n=t.pop(),s=e.ppem,o=e.deltaBase+(i-1)*16,r=e.deltaShift;_.DEBUG&&console.log(e.step,"DELTAC["+i+"]",n,t);for(let l=0;l<n;l++){const a=t.pop(),d=t.pop();if(o+((d&240)>>4)!==s)continue;let f=(d&15)-8;f>=0&&f++;const p=f*r;_.DEBUG&&console.log(e.step,"DELTACFIX",a,"by",p),e.cvt[a]+=p}}function pA(i){let e=i.stack.pop();_.DEBUG&&console.log(i.step,"SROUND[]",e),i.round=Ra;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 gA(i){let e=i.stack.pop();_.DEBUG&&console.log(i.step,"S45ROUND[]",e),i.round=Ra;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 mA(i){_.DEBUG&&console.log(i.step,"ROFF[]"),i.round=qg}function AA(i){_.DEBUG&&console.log(i.step,"RUTG[]"),i.round=em}function yA(i){_.DEBUG&&console.log(i.step,"RDTG[]"),i.round=tm}function CA(i){const e=i.stack.pop();_.DEBUG&&console.log(i.step,"SCANCTRL[]",e)}function Xa(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];_.DEBUG&&console.log(e.step,"SDPVTL["+i+"]",n,s);let l,a;i?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.dpv=fi(l,a)}function EA(i){const e=i.stack,t=e.pop();let n=0;_.DEBUG&&console.log(i.step,"GETINFO[]",t),t&1&&(n=35),t&32&&(n|=4096),e.push(n)}function wA(i){const e=i.stack,t=e.pop(),n=e.pop(),s=e.pop();_.DEBUG&&console.log(i.step,"ROLL[]"),e.push(n),e.push(t),e.push(s)}function bA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"MAX[]",t,n),e.push(Math.max(n,t))}function vA(i){const e=i.stack,t=e.pop(),n=e.pop();_.DEBUG&&console.log(i.step,"MIN[]",t,n),e.push(Math.min(n,t))}function IA(i){const e=i.stack.pop();_.DEBUG&&console.log(i.step,"SCANTYPE[]",e)}function BA(i){const e=i.stack.pop();let t=i.stack.pop();switch(_.DEBUG&&console.log(i.step,"INSTCTRL[]",e,t),e){case 1:i.inhibitGridFit=!!t;return;case 2:i.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function pt(i,e){const t=e.stack,n=e.prog;let s=e.ip;_.DEBUG&&console.log(e.step,"PUSHB["+i+"]");for(let o=0;o<i;o++)t.push(n[++s]);e.ip=s}function gt(i,e){let t=e.ip;const n=e.prog,s=e.stack;_.DEBUG&&console.log(e.ip,"PUSHW["+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 K(i,e,t,n,s,o){const r=o.stack,l=i&&r.pop(),a=r.pop(),d=o.rp0,h=o.z0[d],f=o.z1[a],p=o.minDis,u=o.fv,m=o.dpv;let b,A,C,v;A=b=m.distance(f,h,!0,!0),C=A>=0?1:-1,A=Math.abs(A),i&&(v=o.cvt[l],n&&Math.abs(A-v)<o.cvCutIn&&(A=v)),t&&A<p&&(A=p),n&&(A=o.round(A)),u.setRelative(f,h,C*A,m),u.touch(f),_.DEBUG&&console.log(o.step,(i?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(n?"R":"_")+(s===0?"Gr":s===1?"Bl":s===2?"Wh":"")+"]",i?l+"("+o.cvt[l]+","+v+")":"",a,"(d =",b,"->",C*A,")"),o.rp1=o.rp0,o.rp2=a,e&&(o.rp0=a)}Da=[La.bind(void 0,it),La.bind(void 0,Je),Na.bind(void 0,it),Na.bind(void 0,Je),Ua.bind(void 0,it),Ua.bind(void 0,Je),_a.bind(void 0,0),_a.bind(void 0,1),Qa.bind(void 0,0),Qa.bind(void 0,1),nm,sm,om,rm,am,lm,cm,dm,hm,um,fm,pm,gm,mm,Am,ym,Cm,Em,wm,bm,void 0,void 0,vm,ws,Im,Bm,xm,Mm,Dm,void 0,void 0,void 0,Sm,Tm,km,void 0,Ga.bind(void 0,0),Ga.bind(void 0,1),Ha.bind(void 0,it),Ha.bind(void 0,Je),Ya.bind(void 0,0),Ya.bind(void 0,1),Va.bind(void 0,0),Va.bind(void 0,1),za.bind(void 0,0),za.bind(void 0,1),Pm,Fm,Wa.bind(void 0,0),Wa.bind(void 0,1),Rm,Om,ja.bind(void 0,0),ja.bind(void 0,1),Lm,Nm,Um,_m,Qm,Gm,Ka.bind(void 0,0),Ka.bind(void 0,1),void 0,$a.bind(void 0,0),$a.bind(void 0,1),Hm,void 0,Ym,void 0,void 0,Vm,zm,Wm,jm,Km,$m,Xm,qm,Jm,Zm,eA,tA,iA,bs.bind(void 0,1),nA,sA,oA,rA,aA,lA,cA,dA,hA,uA,sn.bind(void 0,0),sn.bind(void 0,1),sn.bind(void 0,2),sn.bind(void 0,3),void 0,void 0,void 0,void 0,fA,bs.bind(void 0,2),bs.bind(void 0,3),vs.bind(void 0,1),vs.bind(void 0,2),vs.bind(void 0,3),pA,gA,void 0,void 0,mA,void 0,AA,yA,ws,ws,void 0,void 0,void 0,void 0,void 0,CA,Xa.bind(void 0,0),Xa.bind(void 0,1),EA,void 0,wA,bA,vA,IA,BA,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,pt.bind(void 0,1),pt.bind(void 0,2),pt.bind(void 0,3),pt.bind(void 0,4),pt.bind(void 0,5),pt.bind(void 0,6),pt.bind(void 0,7),pt.bind(void 0,8),gt.bind(void 0,1),gt.bind(void 0,2),gt.bind(void 0,3),gt.bind(void 0,4),gt.bind(void 0,5),gt.bind(void 0,6),gt.bind(void 0,7),gt.bind(void 0,8),K.bind(void 0,0,0,0,0,0),K.bind(void 0,0,0,0,0,1),K.bind(void 0,0,0,0,0,2),K.bind(void 0,0,0,0,0,3),K.bind(void 0,0,0,0,1,0),K.bind(void 0,0,0,0,1,1),K.bind(void 0,0,0,0,1,2),K.bind(void 0,0,0,0,1,3),K.bind(void 0,0,0,1,0,0),K.bind(void 0,0,0,1,0,1),K.bind(void 0,0,0,1,0,2),K.bind(void 0,0,0,1,0,3),K.bind(void 0,0,0,1,1,0),K.bind(void 0,0,0,1,1,1),K.bind(void 0,0,0,1,1,2),K.bind(void 0,0,0,1,1,3),K.bind(void 0,0,1,0,0,0),K.bind(void 0,0,1,0,0,1),K.bind(void 0,0,1,0,0,2),K.bind(void 0,0,1,0,0,3),K.bind(void 0,0,1,0,1,0),K.bind(void 0,0,1,0,1,1),K.bind(void 0,0,1,0,1,2),K.bind(void 0,0,1,0,1,3),K.bind(void 0,0,1,1,0,0),K.bind(void 0,0,1,1,0,1),K.bind(void 0,0,1,1,0,2),K.bind(void 0,0,1,1,0,3),K.bind(void 0,0,1,1,1,0),K.bind(void 0,0,1,1,1,1),K.bind(void 0,0,1,1,1,2),K.bind(void 0,0,1,1,1,3),K.bind(void 0,1,0,0,0,0),K.bind(void 0,1,0,0,0,1),K.bind(void 0,1,0,0,0,2),K.bind(void 0,1,0,0,0,3),K.bind(void 0,1,0,0,1,0),K.bind(void 0,1,0,0,1,1),K.bind(void 0,1,0,0,1,2),K.bind(void 0,1,0,0,1,3),K.bind(void 0,1,0,1,0,0),K.bind(void 0,1,0,1,0,1),K.bind(void 0,1,0,1,0,2),K.bind(void 0,1,0,1,0,3),K.bind(void 0,1,0,1,1,0),K.bind(void 0,1,0,1,1,1),K.bind(void 0,1,0,1,1,2),K.bind(void 0,1,0,1,1,3),K.bind(void 0,1,1,0,0,0),K.bind(void 0,1,1,0,0,1),K.bind(void 0,1,1,0,0,2),K.bind(void 0,1,1,0,0,3),K.bind(void 0,1,1,0,1,0),K.bind(void 0,1,1,0,1,1),K.bind(void 0,1,1,0,1,2),K.bind(void 0,1,1,0,1,3),K.bind(void 0,1,1,1,0,0),K.bind(void 0,1,1,1,0,1),K.bind(void 0,1,1,1,0,2),K.bind(void 0,1,1,1,0,3),K.bind(void 0,1,1,1,1,0),K.bind(void 0,1,1,1,1,1),K.bind(void 0,1,1,1,1,2),K.bind(void 0,1,1,1,1,3)];const xA=Array.from||(i=>i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]);function ae(i){i=i||{},i.empty||(Wt(i.familyName,"When creating a new Font object, familyName is required."),Wt(i.styleName,"When creating a new Font object, styleName is required."),Wt(i.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Wt(i.ascender,"When creating a new Font object, ascender is required."),Wt(i.descender,"When creating a new Font object, descender is required."),Wt(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 Vt.GlyphSet(this,i.glyphs||[]),this.encoding=new zr(this),this.position=new hi(this),this.substitution=new Ye(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 Pa(this)}})}ae.prototype.hasChar=function(i){return this.encoding.charToGlyphIndex(i)!==null},ae.prototype.charToGlyphIndex=function(i){return this.encoding.charToGlyphIndex(i)},ae.prototype.charToGlyph=function(i){const e=this.charToGlyphIndex(i);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},ae.prototype.stringToGlyphs=function(i,e){e=e||this.defaultRenderOptions;const t=xA(i),n=[];for(let l=0;l<t.length;l+=1){const a=t[l];n.push(this.charToGlyphIndex(a))}let s=n.length;if(e.features){const l=e.script||this.substitution.getDefaultScriptName();let a=[];e.features.liga&&(a=a.concat(this.substitution.getFeature("liga",l,e.language))),e.features.rlig&&(a=a.concat(this.substitution.getFeature("rlig",l,e.language)));for(let d=0;d<s;d+=1)for(let h=0;h<a.length;h++){const f=a[h],p=f.sub,u=p.length;let m=0;for(;m<u&&p[m]===n[d+m];)m++;m===u&&(n.splice(d,u,f.by),s=s-u+1)}}const o=new Array(s),r=this.glyphs.get(0);for(let l=0;l<s;l+=1)o[l]=this.glyphs.get(n[l])||r;return o},ae.prototype.nameToGlyphIndex=function(i){return this.glyphNames.nameToGlyphIndex(i)},ae.prototype.nameToGlyph=function(i){const e=this.nameToGlyphIndex(i);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},ae.prototype.glyphIndexToName=function(i){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(i):""},ae.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},ae.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},ae.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,l=this.stringToGlyphs(i,s);let a;if(s.kerning){const d=s.script||this.position.getDefaultScriptName();a=this.position.getKerningTables(d,s.language)}for(let d=0;d<l.length;d+=1){const h=l[d];if(o.call(this,h,e,t,n,s),h.advanceWidth&&(e+=h.advanceWidth*r),s.kerning&&d<l.length-1){const f=a?this.position.getKerningValue(a,h.index,l[d+1].index):this.getKerningValue(h,l[d+1]);e+=f*r}s.letterSpacing?e+=s.letterSpacing*n:s.tracking&&(e+=s.tracking/1e3*n)}return e},ae.prototype.getPath=function(i,e,t,n,s){const o=new Ie;return this.forEachGlyph(i,e,t,n,s,function(r,l,a,d){const h=r.getPath(l,a,d,s,this);o.extend(h)}),o},ae.prototype.getPaths=function(i,e,t,n,s){const o=[];return this.forEachGlyph(i,e,t,n,s,function(r,l,a,d){const h=r.getPath(l,a,d,s,this);o.push(h)}),o},ae.prototype.getAdvanceWidth=function(i,e,t){return this.forEachGlyph(i,0,0,e,t,function(){})},ae.prototype.draw=function(i,e,t,n,s,o){this.getPath(e,t,n,s,o).draw(i)},ae.prototype.drawPoints=function(i,e,t,n,s,o){this.forEachGlyph(e,t,n,s,o,function(r,l,a,d){r.drawPoints(i,l,a,d)})},ae.prototype.drawMetrics=function(i,e,t,n,s,o){this.forEachGlyph(e,t,n,s,o,function(r,l,a,d){r.drawMetrics(i,l,a,d)})},ae.prototype.getEnglishName=function(i){const e=this.names[i];if(e)return e.en},ae.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},ae.prototype.toTables=function(){return Hg.fontToTable(this)},ae.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},ae.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},ae.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(Vg())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 l=document.createEvent("MouseEvents");l.initEvent("click",!0,!1),r.dispatchEvent(l)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{const s=require("fs"),o=Wg(n);s.writeFileSync(i,o)}},ae.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},ae.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},ae.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function qa(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 SA(i,e,t){const n=qa(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 TA(i,e,t){const n={},s=new $.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 MA(i,e,t,n){const s=qa(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 l=t[r].tag;o.push({name:"axis_"+i+" "+l,type:"FIXED",value:e.coordinates[l]<<16})}return o}function DA(i,e,t,n){const s={},o=new $.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 kA(i,e){const t=new J.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(SA(n,i.axes[n],e));for(let n=0;n<i.instances.length;n++)t.fields=t.fields.concat(MA(n,i.instances[n],i.axes,e));return t}function PA(i,e,t){const n=new $.Parser(i,e),s=n.parseULong();ie.argument(s===65536,"Unsupported fvar table version.");const o=n.parseOffset16();n.skip("uShort",1);const r=n.parseUShort(),l=n.parseUShort(),a=n.parseUShort(),d=n.parseUShort(),h=[];for(let u=0;u<r;u++)h.push(TA(i,e+o+u*l,t));const f=[],p=e+o+r*l;for(let u=0;u<a;u++)f.push(DA(i,p+u*d,h,t));return{axes:h,instances:f}}const FA={make:kA,parse:PA},Ve=new Array(10);Ve[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()};ie.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Ve[2]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();ie.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),l=this.parsePointer(H.classDef),a=this.parseUShort(),d=this.parseUShort();return{posFormat:t,coverage:n,valueFormat1:s,valueFormat2:o,classDef1:r,classDef2:l,class1Count:a,class2Count:d,classRecords:this.parseList(a,H.list(d,function(){return{value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}}))}}},Ve[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Ve[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Ve[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Ve[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Ve[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Ve[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Ve[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function RA(i,e){e=e||0;const t=new H(i,e),n=t.parseVersion(1);return ie.argument(n===1||n===1.1,"Unsupported GPOS table version "+n),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ve)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ve),variations:t.parseFeatureVariationsList()}}const OA=new Array(10);function LA(i){return new J.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new J.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new J.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new J.LookupList(i.lookups,OA)}])}const NA={parse:RA,make:LA};function UA(i){const e={};i.skip("uShort");const t=i.parseUShort();ie.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(),l=i.parseShort();e[o+","+r]=l}return e}function _A(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 l=i.parseUShort(),a=i.parseUShort(),d=i.parseShort();e[l+","+a]=d}}return e}function QA(i,e){const t=new $.Parser(i,e),n=t.parseUShort();if(n===0)return UA(t);if(n===1)return _A(t);throw new Error("Unsupported kern table version ("+n+").")}const GA={parse:QA};function HA(i,e,t,n){const s=new $.Parser(i,e),o=n?s.parseUShort:s.parseULong,r=[];for(let l=0;l<t+1;l+=1){let a=o.call(s);n&&(a*=2),r.push(a)}return r}const YA={parse:HA};function VA(i,e){require("fs").readFile(i,function(n,s){if(n)return e(n.message);e(null,zg(s))})}function zA(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 Ja(i,e){const t=[];let n=12;for(let s=0;s<e;s+=1){const o=$.getTag(i,n),r=$.getULong(i,n+4),l=$.getULong(i,n+8),a=$.getULong(i,n+12);t.push({tag:o,checksum:r,offset:l,length:a,compression:!1}),n+=16}return t}function WA(i,e){const t=[];let n=44;for(let s=0;s<e;s+=1){const o=$.getTag(i,n),r=$.getULong(i,n+4),l=$.getULong(i,n+8),a=$.getULong(i,n+12);let d;l<a?d="WOFF":d=!1,t.push({tag:o,offset:r,compression:d,compressedLength:l,length:a}),n+=20}return t}function we(i,e){if(e.compression==="WOFF"){const t=new Uint8Array(i.buffer,e.offset+2,e.compressedLength-2),n=new Uint8Array(e.length);if(Ip(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 jA(i){let e,t;const n=new ae({empty:!0}),s=new DataView(i,0);let o,r=[];const l=$.getTag(s,0);if(l==="\0\0\0"||l==="true"||l==="typ1")n.outlinesFormat="truetype",o=$.getUShort(s,4),r=Ja(s,o);else if(l==="OTTO")n.outlinesFormat="cff",o=$.getUShort(s,4),r=Ja(s,o);else if(l==="wOFF"){const N=$.getTag(s,4);if(N==="\0\0\0")n.outlinesFormat="truetype";else if(N==="OTTO")n.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+l);o=$.getUShort(s,12),r=WA(s,o)}else throw new Error("Unsupported OpenType signature "+l);let a,d,h,f,p,u,m,b,A,C,v;for(let N=0;N<o;N+=1){const I=r[N];let B;switch(I.tag){case"cmap":B=we(s,I),n.tables.cmap=Vr.parse(B.data,B.offset),n.encoding=new Wr(n.tables.cmap);break;case"cvt ":B=we(s,I),v=new $.Parser(B.data,B.offset),n.tables.cvt=v.parseShortList(I.length/2);break;case"fvar":d=I;break;case"fpgm":B=we(s,I),v=new $.Parser(B.data,B.offset),n.tables.fpgm=v.parseByteList(I.length);break;case"head":B=we(s,I),n.tables.head=oa.parse(B.data,B.offset),n.unitsPerEm=n.tables.head.unitsPerEm,e=n.tables.head.indexToLocFormat;break;case"hhea":B=we(s,I),n.tables.hhea=ra.parse(B.data,B.offset),n.ascender=n.tables.hhea.ascender,n.descender=n.tables.hhea.descender,n.numberOfHMetrics=n.tables.hhea.numberOfHMetrics;break;case"hmtx":u=I;break;case"ltag":B=we(s,I),t=la.parse(B.data,B.offset);break;case"maxp":B=we(s,I),n.tables.maxp=ca.parse(B.data,B.offset),n.numGlyphs=n.tables.maxp.numGlyphs;break;case"name":A=I;break;case"OS/2":B=we(s,I),n.tables.os2=ms.parse(B.data,B.offset);break;case"post":B=we(s,I),n.tables.post=Aa.parse(B.data,B.offset),n.glyphNames=new ds(n.tables.post);break;case"prep":B=we(s,I),v=new $.Parser(B.data,B.offset),n.tables.prep=v.parseByteList(I.length);break;case"glyf":h=I;break;case"loca":b=I;break;case"CFF ":a=I;break;case"kern":m=I;break;case"GPOS":f=I;break;case"GSUB":p=I;break;case"meta":C=I;break}}const S=we(s,A);if(n.tables.name=ma.parse(S.data,S.offset,t),n.names=n.tables.name,h&&b){const N=e===0,I=we(s,b),B=YA.parse(I.data,I.offset,n.numGlyphs,N),g=we(s,h);n.glyphs=Ma.parse(g.data,g.offset,B,n)}else if(a){const N=we(s,a);sa.parse(N.data,N.offset,n)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");const D=we(s,u);if(aa.parse(D.data,D.offset,n.numberOfHMetrics,n.numGlyphs,n.glyphs),Yp(n),m){const N=we(s,m);n.kerningPairs=GA.parse(N.data,N.offset)}else n.kerningPairs={};if(f){const N=we(s,f);n.tables.gpos=NA.parse(N.data,N.offset),n.position.init()}if(p){const N=we(s,p);n.tables.gsub=ya.parse(N.data,N.offset)}if(d){const N=we(s,d);n.tables.fvar=FA.parse(N.data,N.offset,n.names)}if(C){const N=we(s,C);n.tables.meta=Ca.parse(N.data,N.offset),n.metas=n.tables.meta}return n}function KA(i,e){(typeof window>"u"?VA:zA)(i,function(s,o){if(s)return e(s);let r;try{r=jA(o)}catch(l){return e(l,null)}return e(null,r)})}const Is=1e-12;function gi(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)>Is||Math.abs(s-r)>Is)&&i.push([n,s]),i}function St(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,l=s[0]??0,a=s[1]??0;e+=o*a-l*r}return e/2}function on(i,e=Is){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 l=s[0]??0,a=s[1]??0;(Math.abs(o-l)>e||Math.abs(r-a)>e)&&t.push([o,r])}return t}function $A(i,e,t,n,s=16){const o=[],r=i?.[0]??0,l=i?.[1]??0,a=t?.[0]??0,d=t?.[1]??0,h=n?.[0]??0,f=n?.[1]??0,p=e?.[0]??0,u=e?.[1]??0;for(let m=0;m<=s;m++){const b=m/s,A=1-b,C=A*A*A*r+3*A*A*b*a+3*A*b*b*h+b*b*b*p,v=A*A*A*l+3*A*A*b*d+3*A*b*b*f+b*b*b*u;o.push([C,v])}return o}function Za(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 l=e[o],a=e[r];if(!l||!a)continue;const d=l[0]??0,h=l[1]??0,f=a[0]??0,p=a[1]??0;h>n!=p>n&&t<(f-d)*(n-h)/(p-h+0)+d&&(s=!s)}return s}function Bs(i){return i?(St(i)<0&&i.reverse(),gi(i),i):[]}function XA(i){return i?(St(i)>0&&i.reverse(),gi(i),i):[]}function el(i,e=16){if(!i||!Array.isArray(i.commands))return[];const t=[];let n=[];for(const s of i.commands){let o=function(l){const a=l.x!==void 0?l.x:0,d=l.y!==void 0?-l.y:0;return[a,d]};const r=s.type;if(r==="M")n.length&&t.push(on(n)),n=[o(s)];else if(r==="L")n.push(o(s));else if(r==="Q"){const a=n[n.length-1]||o(s),d=[],h=s.x??0,f=s.y??0,p=s.x1??0,u=s.y1??0,m=a[0]??0,b=a[1]??0;for(let A=1;A<=e;A++){const C=A/e,v=1-C,S=v*v*m+2*v*C*p+C*C*h,D=v*v*b+2*v*C*u+C*C*-f;d.push([S,D])}d.length?n.push(...d):n.push(o(s))}else if(r==="C"){const a=n[n.length-1]||o(s),d=[s.x1||0,-(s.y1||0)],h=[s.x2||0,-(s.y2||0)],f=[s.x||0,-(s.y||0)],p=$A(a,f,d,h,e);p.length>1?n.push(...p.slice(1)):n.push(f)}else r==="Z"||r==="z"?(n.length&&t.push(on(n)),n=[]):s.x!==void 0&&s.y!==void 0&&n.push(o(s))}return n.length&&t.push(on(n)),t.map(s=>gi(s)).filter(s=>s&&s.length>=4)}function xs(i,e){if(!i)return null;const t=i.map(n=>gi(n.slice()));return{type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{...e.properties||{},rings:t.length,polygons:1}}}function qA(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||"",l=o.rotation??0,a=t.sampleSegments||16,d=t.epsArea||1e-24,f=o.height/.9||1,p=(t.scale||1)*f,u=-l*Math.PI/180,m=Math.cos(u),b=Math.sin(u),A=o.attachmentPoint||"bottom-left",C=[];if(!e||typeof e.getPaths!="function")return{type:"FeatureCollection",features:C};const v=e.getPaths(r,0,0,t.fontSize||1)||[];let S=[];for(const U of v){const G=el(U,a);for(const F of G)if(F)for(const E of F)E&&S.push(E)}let D=1/0,N=1/0,I=-1/0,B=-1/0;for(const U of S){if(!U)continue;const G=U[0]??0,F=U[1]??0;D=Math.min(D,G),N=Math.min(N,F),I=Math.max(I,G),B=Math.max(B,F)}const g=I-D,P=B-N;let x=0,k=0;switch(A){case"top-left":x=0,k=-P;break;case"top-center":x=-g/2,k=P;break;case"top-right":x=-g,k=P;break;case"center-left":x=0,k=P/2;break;case"center":x=-g/2,k=P/2;break;case"center-right":x=-g,k=P/2;break;case"bottom-left":x=0,k=0;break;case"bottom-center":x=-g/2,k=0;break;case"bottom-right":x=-g,k=0;break;default:x=0,k=0}for(const U of v){const G=el(U,a);if(!G||G.length===0)continue;const F=G.map(R=>{if(!R)return[];const O=R.map(L=>{if(!L)return[0,0];let M=(L[0]??0)+x,Q=(L[1]??0)+k;M=M*(t.widthScale||.6);const Y=M*m-Q*b,W=M*b+Q*m;return[s[0]+Y*p,s[1]+W*p]});return gi(on(O))}).filter(R=>R&&R.length>=4&&Math.abs(St(R))>d);if(F.length===0)continue;let E=1;if(t.fillWinding==="positive")E=1;else if(t.fillWinding==="negative")E=-1;else{let R=0,O=-1;for(let Q=0;Q<F.length;Q++){const Y=F[Q];if(!Y)continue;const W=St(Y);Math.abs(W)>O&&(O=Math.abs(W),R=Q)}const L=F[R],M=L?St(L):0;E=M>=0?1:-1,n&&console.log("[simple] auto fillSign=",E,"largest signed area=",M)}const y=F.map((R,O)=>({idx:O,ring:R,signedArea:St(R),absArea:Math.abs(St(R))}));for(const R of y)R.isFilled=R.signedArea*E>0,n&&console.log("[simple] ring",R.idx,"signedArea=",R.signedArea.toExponential(),"isFilled=",R.isFilled);const w=y.filter(R=>R.isFilled).sort((R,O)=>R.absArea-O.absArea),T=y.filter(R=>!R.isFilled).sort((R,O)=>O.absArea-R.absArea);for(const R of w)R.holes=[];for(const R of T){const O=(function(M){let Q=0,Y=0;if(!M||M.length===0)return[0,0];for(const W of M)W&&(Q+=W[0]??0,Y+=W[1]??0);return[Q/M.length,Y/M.length]})(R.ring);let L=null;for(const M of w)Za(O,M.ring)&&(L===null||M.absArea<L.absArea&&M.idx<R.idx||M.absArea>L.absArea&&M.idx<R.idx&&T.length==1)&&(L=M);if(L){if(L.absArea<R.absArea&&T.length>1)for(const M of w)Za(O,M.ring)&&M.absArea>R.absArea&&M.holes.push(R.ring);else L.holes.push(R.ring);R.assigned=!0}else R.assigned=!1,n&&console.log("[simple] hole not assigned idx=",R.idx)}for(const R of w){const O=Bs(R.ring.slice()),L=(R.holes||[]).map(M=>XA(M.slice()));C.push(xs([O,...L],i))}for(const R of T)R.assigned||C.push(xs([Bs(R.ring.slice())],i));if(w.length===0)for(const R of y)C.push(xs([Bs(R.ring.slice())],i))}return{type:"FeatureCollection",features:C}}class JA extends qe{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(),KA(this.fontUrl,(o,r)=>{try{if(o){console.error("加载字体失败:",o),t&&t();return}const l=n.Cartographic.fromCartesian(e),a=n.Math.toDegrees(l.longitude),d=n.Math.toDegrees(l.latitude),h={type:"Feature",geometry:{type:"Point",coordinates:[a,d]},properties:{text:s.labelText||"",rotation:0}},f={sampleSegments:16,fontSize:s.fontSize,scale:10},p=qA(h,r,f);if(!p||!p.features||!Array.isArray(p.features)){console.error("文本转换为多边形失败"),t&&t();return}s.drawGeoJsonLocal(p,[a,d],1,r),s.entity={_centerCoord:s._centerCoord,_plotInstance:s._plotInstance,position:e,label:{text:s.labelText},updatePosition:function(u){s.updatePositions([u])},getPosition:function(){return s._centerCoord},type:s.type,objId:s.objId,isDraggable:!0,setPosition:function(u){s._centerCoord=u,s.positions[0]=u,s.createLabel(u)}},s.addClickEditHandler(),t&&t()}catch(l){console.error("创建文本标签时发生错误:",l);try{s.clearPolygonEntities()}catch(a){console.error("清理标签多边形实体时出错:",a)}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],l=t[1],a=o.Cartesian3.fromDegrees(r,l,0),d=o.Transforms.eastNorthUpToFixedFrame(a),h=n*1;this.clearPolygonEntities();let f=[];for(const S of e.features||[]){if(!S||!S.geometry||S.geometry.type!=="Polygon")continue;const D=S.geometry.coordinates||[];for(const N of D)N&&Array.isArray(N)&&(f=f.concat(N))}let p=1/0,u=1/0,m=-1/0,b=-1/0;for(const S of f)Array.isArray(S)&&S.length>=2&&(p=Math.min(p,S[0]),u=Math.min(u,S[1]),m=Math.max(m,S[0]),b=Math.max(b,S[1]));const A=(p+m)/2,C=(u+b)/2,v=S=>{const D=(S[0]-A)*h,N=(S[1]-C)*h,I=new o.Cartesian3(D,N,0);return o.Matrix4.multiplyByPoint(d,I,new o.Cartesian3)};for(const S of e.features||[]){if(!S||!S.geometry||S.geometry.type!=="Polygon")continue;const D=S.geometry.coordinates||[];if(D.length>0)try{const N=D[0]||[];if(N.length===0)continue;const I=N.map(v);let B;if(D.length>1){const P=D.slice(1).map(x=>!x||!Array.isArray(x)||x.length===0?null:new o.PolygonHierarchy(x.map(v))).filter(Boolean);B=new o.PolygonHierarchy(I,P)}else B=new o.PolygonHierarchy(I);const g=this.viewer.entities.add({polygon:{hierarchy:B,material:o.Color.fromCssColorString(this.color||"#000000"),outline:!1},_labelOwner:this.objId});this.polygonEntities.push(g)}catch(N){console.warn("创建多边形实体时出错:",N);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 l=document.createElement("h3");l.textContent="编辑文本",l.style.marginTop="0";const a=document.createElement("textarea");a.value=n,a.style.width="100%",a.style.height="150px",a.style.marginBottom="10px",a.style.fontSize="14px",a.style.padding="8px",a.style.boxSizing="border-box";const d=document.createElement("div");d.style.display="flex",d.style.justifyContent="flex-end",d.style.gap="10px";const h=document.createElement("button");h.textContent="取消",h.addEventListener("click",function(){document.body.removeChild(o),s(null)});const f=document.createElement("button");f.textContent="确认",f.addEventListener("click",function(){document.body.removeChild(o),s(a.value)}),d.appendChild(h),d.appendChild(f),r.appendChild(l),r.appendChild(a),r.appendChild(d),o.appendChild(r),document.body.appendChild(o),a.focus();const p=function(u){u.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 l=document.createElement("h3");l.textContent="编辑样式",l.style.marginTop="0";const a=document.createElement("div");a.style.marginBottom="15px";const d=document.createElement("label");d.textContent="文本颜色: ",d.style.display="block",d.style.marginBottom="5px";const h=document.createElement("input");h.type="color",h.value=n.color,h.style.width="50px",a.appendChild(d),a.appendChild(h);const f=document.createElement("div");f.style.marginBottom="15px";const p=document.createElement("label");p.textContent="字体大小: ",p.style.display="block",p.style.marginBottom="5px";const u=document.createElement("input");u.type="number",u.value=n.fontSize,u.min="8",u.max="200",u.step="1",u.style.width="100%",u.style.padding="5px",u.style.boxSizing="border-box",f.appendChild(p),f.appendChild(u);const m=document.createElement("div");m.style.display="flex",m.style.justifyContent="flex-end",m.style.gap="10px",m.style.marginTop="20px";const b=document.createElement("button");b.textContent="取消",b.addEventListener("click",function(){document.body.removeChild(o),s(null)});const A=document.createElement("button");A.textContent="确认",A.addEventListener("click",function(){document.body.removeChild(o),s({color:h.value,fontSize:parseInt(u.value)})}),m.appendChild(b),m.appendChild(A),r.appendChild(l),r.appendChild(a),r.appendChild(f),r.appendChild(m),o.appendChild(r),document.body.appendChild(o);const C=function(v){v.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",C),s(null))};document.addEventListener("keydown",C)})(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 ZA extends qe{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 dt(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?re.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 ey extends qe{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 dt(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(l=>Math.abs(l.x-s.x)<1e-6&&Math.abs(l.y-s.y)<1e-6&&Math.abs(l.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:re.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]),l=this.createPoint(o);l.point.heightReference=this.style.heightReference,l.ctgc=r,l.wz=this.controlPoints.length,this.controlPoints.push(l)}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 ty extends qe{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 dt(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),l=Math.min(n.latitude,s.latitude),a=Math.max(n.latitude,s.latitude);if(e==="leftdown")return Cesium.Cartesian3.fromRadians(o,l);if(e==="rightup")return Cesium.Cartesian3.fromRadians(r,a)}_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),l=Math.max(s.longitude,o.longitude),a=Math.min(s.latitude,o.latitude),d=Math.max(s.latitude,o.latitude);const h=n.cartesianToCartographic(e);t==="leftdown"?(r=h.longitude,a=h.latitude):(l=h.longitude,d=h.latitude),this.leftup=Cesium.Cartesian3.fromRadians(r,d),this.rightdown=Cesium.Cartesian3.fromRadians(l,a)}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,l=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=l,this.entity.objId=r;const a=this._calcCornerCartesian("leftdown"),d=this._calcCornerCartesian("rightup");this.leftdownPoint=this.createPoint(a),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=this.state==="editing",this.rightupPoint=this.createPoint(d),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?re.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:re.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,l=-1/0;n.forEach(a=>{const d=Cesium.Ellipsoid.WGS84.cartesianToCartographic(a);d&&(s=Math.min(s,d.longitude),o=Math.min(o,d.latitude),r=Math.max(r,d.longitude),l=Math.max(l,d.latitude))}),this.leftup=Cesium.Cartesian3.fromRadians(s,l),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 iy extends qe{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 dt(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 ny extends qe{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(()=>Or).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 l=(h,f)=>{if(!h||h.length<2)return h;f=Math.max(1,f|0);const p=[h[0]],u=h.length;for(let m=0;m<u-1;m++){const b=m>0?h[m-1]:h[m],A=h[m],C=h[m+1],v=m+2<u?h[m+2]:h[m+1];for(let S=1;S<f;S++){const D=S/f,N=D*D,I=N*D,B=-.5*b.x+1.5*A.x-1.5*C.x+.5*v.x,g=-.5*b.y+1.5*A.y-1.5*C.y+.5*v.y,P=-.5*b.z+1.5*A.z-1.5*C.z+.5*v.z,x=b.x-2.5*A.x+2*C.x-.5*v.x,k=b.y-2.5*A.y+2*C.y-.5*v.y,U=b.z-2.5*A.z+2*C.z-.5*v.z,G=-.5*b.x+.5*C.x,F=-.5*b.y+.5*C.y,E=-.5*b.z+.5*C.z,y=A.x,w=A.y,T=A.z,R=B*I+x*N+G*D+y,O=g*I+k*N+F*D+w,L=P*I+U*N+E*D+T;p.push(new Cesium.Cartesian3(R,O,L))}p.push(C)}return p},a=Math.max(1,Number(this.style.curveResolution)||1);n.length<200&&a>1&&(n=l(n,a));const d=h=>{if(!h||h.length<2)return h;const f=[];f.push(h[0]);for(let p=0;p<h.length-1;p++){const u=h[p],m=h[p+1],b=new Cesium.Cartesian3(u.x*.75+m.x*.25,u.y*.75+m.y*.25,u.z*.75+m.z*.25),A=new Cesium.Cartesian3(u.x*.25+m.x*.75,u.y*.25+m.y*.75,u.z*.25+m.z*.75);f.push(b),f.push(A)}return f.push(h[h.length-1]),f};n=n.slice(),n.length<300&&(n=d(n),t===2&&n.length<300&&(n=d(n)))}const s=(Number(this.style.angleThreshold)||6)*(Math.PI/180),o=this.positions,r=(l,a,d,h)=>{if(!l||!a||!d)return!1;const f=a.x-l.x,p=a.y-l.y,u=a.z-l.z,m=d.x-a.x,b=d.y-a.y,A=d.z-a.z,C=Math.hypot(f,p,u),v=Math.hypot(m,b,A);if(C===0||v===0)return!1;const S=(f*m+p*b+u*A)/(C*v),D=Math.max(-1,Math.min(1,S)),N=Math.acos(D);return Math.abs(N)<=h};for(let l=0;l<n.length;l++){const a=n[l];if(o.length===0){o.push(Cesium.Cartesian3.clone(a));continue}const d=o[o.length-1];if(!(Cesium.Cartesian3.distance(d,a)<=this.minDistance*.5)){if(o.length>=2){const f=o[o.length-2],p=o[o.length-1],u=a;if(r(f,p,u,s)){o.pop(),o.push(Cesium.Cartesian3.clone(u));continue}}if(o.push(Cesium.Cartesian3.clone(a)),o.length>this.maxPositions){const f=o.length-this.maxPositions;f>0&&o.splice(0,f)}}}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=re&&re.lnglatsToCartesians?re.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:re.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 sy extends qe{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(()=>Or).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 l=this.style.arrowFixedSize!==void 0?this.style.arrowFixedSize:n*s;l<o&&(l=o),l>r&&(l=r);const a=this.Cesium.Cartesian3.subtract(t,e,new this.Cesium.Cartesian3);this.Cesium.Cartesian3.normalize(a,a);const d=this.Cesium.Transforms.eastNorthUpToFixedFrame(t),h=this.Cesium.Matrix4.getColumn(d,2,new this.Cesium.Cartesian3),f=new this.Cesium.Cartesian3(a.x-h.x*this.Cesium.Cartesian3.dot(a,h),a.y-h.y*this.Cesium.Cartesian3.dot(a,h),a.z-h.z*this.Cesium.Cartesian3.dot(a,h));let p;this.Cesium.Cartesian3.magnitudeSquared(f)<1e-6?p=this.Cesium.Matrix4.getColumn(d,0,new this.Cesium.Cartesian3):(this.Cesium.Cartesian3.normalize(f,f),p=this.Cesium.Cartesian3.cross(h,f,new this.Cesium.Cartesian3),this.Cesium.Cartesian3.normalize(p,p));const u=this.Cesium.Cartesian3.multiplyByScalar(a,-l,new this.Cesium.Cartesian3),m=this.Cesium.Cartesian3.add(t,u,new this.Cesium.Cartesian3),b=this.style.arrowWidthScale!==void 0?this.style.arrowWidthScale:1,A=Math.sin(this.arrowAngle)*l*b,C=this.Cesium.Cartesian3.multiplyByScalar(p,A,new this.Cesium.Cartesian3),v=this.Cesium.Cartesian3.multiplyByScalar(p,-A,new this.Cesium.Cartesian3),S=this.Cesium.Cartesian3.add(m,C,new this.Cesium.Cartesian3),D=this.Cesium.Cartesian3.add(m,v,new this.Cesium.Cartesian3);return[t,S,D,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}),console.log("this.arrowEntity",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 oy{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:l}=o;let a=r.plotType;const d=l.type,h=l.coordinates;let f=[],p="";switch(d){case"LineString":f=re.lnglatsToCartesians(h),p="polyline";break;case"Polygon":f=re.lnglatsToCartesians(h[0]),p="polygon";break;case"Point":f=re.lnglatsToCartesians([h])[0],p=a;break}this.fireEdit=!1;let u=this.createByPositions({type:p,styleType:a,positions:f,style:r.style});u&&n.push(u)}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 d=0;d<s.length;d++)o.push([s[d][0],s[d][1]]);let r=n.getStyle(),l=this.transType(n.type),a={type:"Feature",properties:{plotType:n.type,style:r},geometry:{type:l,coordinates:[]}};switch(l){case"Polygon":a.geometry.coordinates=[o];break;case"Point":a.geometry.coordinates=o;break;case"LineString":a.geometry.coordinates=o;break}a.properties=Object.assign(a.properties,n.properties),e.features.push(a)}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 l=n[r].id;if(l){for(let a=0;a<e.entityObjArr.length;a++)if(l.objId==e.entityObjArr[a].objId&&e.entityObjArr[a].state!="startCreate"&&e.entityObjArr[a].state!="creating"){s=a,o=l;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 l=0;l<e.entityObjArr.length;l++)if(r.objId==e.entityObjArr[l].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",l=>{let a=n.getAttribute("objId");r.removeByObjId(a)}),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 iy(this.viewer,e.style),n="折线_"),e.type=="freehandLine"&&(t=new ny(this.viewer,e.style),n="手绘线_"),e.type=="polygon"&&(t=new ey(this.viewer,e.style),n="面_"),e.type=="billboard"&&(t=new Cp(this.viewer,e.style),n="图标_"),(e.type=="circle"||e.type=="ellipse")&&(t=new Ep(this.viewer,e.style),n="圆_"),e.type=="rectangle"&&(t=new ty(this.viewer,e.style),n="矩形_"),e.type=="gltfModel"&&(t=new wp(this.viewer,e.style),n="模型_"),e.type=="point"&&(t=new ZA(this.viewer,e.style),n="点_"),e.type=="label"&&(t=new JA(this.viewer,e.style),n="文字_"),e.type=="arrow"&&(t=new sy(this.viewer,e.style)),t&&(t.name=n+new Date().getTime()),t}}class tl{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 oy(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(console.log("移动线段"),this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}let n=!1,s,o=0;const r=16,l=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);this._dragHandler=l;const a=d=>{let h;try{h=this.viewer.scene.pickPosition(d)}catch{}if(!this.Cesium.defined(h)){const f=this.viewer.camera.getPickRay(d);f&&(h=this.viewer.scene.globe.pick(f,this.viewer.scene))}return this.Cesium.defined(h)||(h=this.viewer.scene.camera.pickEllipsoid(d,this.viewer.scene.globe.ellipsoid)),h};l.setInputAction(d=>{let h=!1;const f=this.viewer.scene.drillPick(d.position)||[];for(let p=0;p<f.length;p++){const u=f[p].id;if(u&&u===this.centerHandle){h=!0;break}}if(h){n=!0;const p=a(d.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),l.setInputAction(d=>{if(!n||!this.Cesium.defined(s))return;const h=performance.now();if(h-o<r)return;o=h;const f=a(d.endPosition);if(!this.Cesium.defined(f))return;const p=this.Cesium.Cartesian3.subtract(f,s,new this.Cesium.Cartesian3);if(this.centerHandle&&this.centerHandle.position&&this.centerHandle.position.setValue){const u=this.centerHandle.position.getValue(this.Cesium.JulianDate.now());if(u){const m=this.Cesium.Cartesian3.add(u,p,new this.Cesium.Cartesian3);this.centerHandle.position.setValue(m)}}this.moveEntity(e,p);try{this.viewer.scene.requestRender()}catch{}s=f.clone()},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),l.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 d=e.getEntity();if(d.state="done",d&&d.rectangle&&d.rectangle.coordinates)try{const h=d.rectangle.coordinates.getValue?d.rectangle.coordinates.getValue():d.rectangle.coordinates;h&&d.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 l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(n._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update rectangle positions:",l)}if(n._plotInstance&&n._plotInstance.type==="circle"&&typeof n._plotInstance.updatePositions=="function")try{const l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(n._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update circle positions:",l)}const r=(e.positions&&Array.isArray(e.positions)?e.positions:n.polyline.positions.getValue?n.polyline.positions.getValue():[]).map(l=>s(l));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,l={type:r,style:{}};switch(!0){case["freehandLine","CreateFreehandLine","polyline","CreatePolyline","arrow","CreateArrow"].includes(r):l.id=o.objId||o.id||Date.now().toString(),o.style&&(l.style={color:o.style.color,width:o.style.width,opacity:o.style.opacity,...o.style}),o.positions&&Array.isArray(o.positions)&&(l.positions=o.positions.map(a=>a&&typeof a=="object"&&a.x!==void 0&&a.y!==void 0&&a.z!==void 0?{x:a.x,y:a.y,z:a.z}:a)),["freehandLine","CreateFreehandLine"].includes(r)&&(l.isEdit=o.isEdit!==void 0?o.isEdit:!0,l.isFreehand=!0);break;case["rectangle","CreateRectangle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];if(o.positions&&Array.isArray(o.positions)&&o.positions.length)a=o.positions.map(d=>({x:d.x,y:d.y,z:d.z}));else{const d=o.getEntity?o.getEntity():o;if(d)try{if(d.polyline&&d.polyline.positions&&d.polyline.positions.getValue){const h=d.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(h)&&(a=h.map(f=>({x:f.x,y:f.y,z:f.z})))}else if(d.rectangle&&d.rectangle.coordinates&&d.rectangle.coordinates.getValue){const h=d.rectangle.coordinates.getValue(this.viewer.clock.currentTime);a=[{west:h.west,south:h.south,east:h.east,north:h.north}]}}catch{}}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];const d=o.getEntity?o.getEntity():o;if(d&&d._plotInstance&&d._plotInstance.type==="circle"&&d._plotInstance.center&&d._plotInstance.radiusPoint){const h=d._plotInstance;a=[{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)a=o.positions.map(h=>({x:h.x,y:h.y,z:h.z}));else if(d)try{if(d.polyline&&d.polyline.positions&&d.polyline.positions.getValue){const h=d.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(h)&&(a=h.map(f=>({x:f.x,y:f.y,z:f.z})))}else if(d.ellipse&&d.ellipse.center&&d.ellipse.center.getValue&&d.ellipse.semiMajorAxis&&d.ellipse.semiMajorAxis.getValue){const h=d.ellipse.center.getValue(this.viewer.clock.currentTime),f=d.ellipse.semiMajorAxis.getValue(this.viewer.clock.currentTime);if(h&&f){const p={x:h.x,y:h.y,z:h.z||0},u={x:p.x+f,y:p.y,z:p.z};a=[p,u]}}}catch{}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["label","CreateLabel"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label){const d={};try{const h=a.label.fillColor&&a.label.fillColor.getValue?a.label.fillColor.getValue(this.viewer.clock.currentTime):a.label.fillColor;h&&(d.color=h)}catch{}a.label.font&&(d.font=a.label.font),l.style=d}}catch{}if(o.text)l.text=o.text;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label&&a.label.text){const d=a.label.text.getValue?a.label.text.getValue(this.viewer.clock.currentTime):a.label.text;d&&(l.text=d)}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const d=a.position.getValue(this.viewer.clock.currentTime);d&&(l.position={x:d.x,y:d.y,z:d.z})}}catch{}break;case["billboard","CreateBillboard"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.billboard){const d={};try{const h=a.billboard.image&&a.billboard.image.getValue?a.billboard.image.getValue(this.viewer.clock.currentTime):a.billboard.image;if(h){if(typeof h=="string")d.image=h;else if(h&&h.src)try{const f=h;if(typeof document<"u"&&f instanceof HTMLImageElement){const p=document.createElement("canvas");p.width=f.naturalWidth||f.width||1,p.height=f.naturalHeight||f.height||1;const u=p.getContext("2d");u?(u.drawImage(f,0,0),d.image=p.toDataURL()):d.image=f.src}else d.image=h.src}catch{d.image=h.src}}}catch{}a.billboard.width&&(d.width=a.billboard.width),a.billboard.height&&(d.height=a.billboard.height),l.style=d}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const d=a.position.getValue(this.viewer.clock.currentTime);d&&(l.position={x:d.x,y:d.y,z:d.z})}}catch{}break;default:o.style&&(l.style=o.style),o.position&&(l.position=o.position);break}switch(!0){case["freehandLine","CreateFreehandLine"].includes(r):t.freehand.push(l);break;case["arrow","CreateArrow"].includes(r):t.arrow.push(l);break;case["label","CreateLabel"].includes(r):t.text.push(l);break;case["billboard","CreateBillboard"].includes(r):t.image.push(l);break;case["polyline","CreatePolyline"].includes(r):t.polyline.push(l);break;case["rectangle","CreateRectangle"].includes(r):t.rectangle.push(l);break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):t.ellipse.push(l);break;default:t.other.push(l)}}});const n={version:"1.0",exportTime:new Date().toISOString(),totalEntities:e.length,annotations:t},s=JSON.stringify(n);return console.log("标注数据已按类型分类保存,只包含重绘所需信息:",s),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,l)=>{Array.isArray(r)&&r.forEach(a=>{if(a.style){if(a.style.color&&typeof a.style.color=="object"){const d=a.style.color;a.style.color=`rgba(${Math.round(d.red*255)}, ${Math.round(d.green*255)}, ${Math.round(d.blue*255)}, ${d.alpha||1})`}if(a.style.outlineColor&&typeof a.style.outlineColor=="object"){const d=a.style.outlineColor;a.style.outlineColor=`rgba(${Math.round(d.red*255)}, ${Math.round(d.green*255)}, ${Math.round(d.blue*255)}, ${d.alpha||1})`}}switch(l){case"freehand":case"polyline":case"arrow":if(a.positions&&a.positions.length>0){const d=a.positions.map(p=>p&&typeof p=="object"?new this.Cesium.Cartesian3(p.x,p.y,p.z):p),h={type:l==="freehand"?"freehandLine":l,style:a.style||{},positions:d,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))},f=this.drawTool.createByPositions(h);if(f&&f.getEntity()){s++,f.isEdit=!0;const p=f.getEntity();p&&!p._plotInstance&&(p._plotInstance=f),p&&!p.objId&&(p.objId=f.objId),console.log(`Loaded ${l} entity with objId: ${f.objId}`)}}break;case"rectangle":{try{if(a.positions&&a.positions.length){let d=[];if(a.positions[0]&&a.positions[0].x!==void 0)d=a.positions.map(h=>new this.Cesium.Cartesian3(h.x,h.y,h.z!==void 0?h.z:0));else if(a.positions[0]&&a.positions[0].west!==void 0){const h=a.positions[0];d=[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(d.length){const h=JSON.parse(JSON.stringify(a.style||{}));if(h.color&&typeof h.color=="string"&&!h.color.startsWith("rgba"))try{const u=JSON.parse(h.color);u.red!==void 0&&(h.color=`rgba(${Math.round(u.red*255)}, ${Math.round(u.green*255)}, ${Math.round(u.blue*255)}, ${u.alpha||1})`)}catch{}const f={type:"rectangle",positions:d,style:h,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let p=null;try{p=this.drawTool.createByPositions(f)}catch(u){console.warn("drawTool.createByPositions(rectangle) failed",u)}if(p){s++,p.isEdit=!0;const u=p.getEntity?p.getEntity():p.entity||p;u&&(u._plotInstance=p,u.objId=p.objId||a.id,u.pickable=!0,u.polyline&&(u.polyline.pickWidth=10),console.log(`Loaded rectangle entity with objId: ${u.objId}, color: ${h.color}`))}}}}catch(d){console.warn("load rectangle failed",d)}break}case"text":if(a.position){const d=a.text||"文字标注",h={type:"label",style:a.style||{},text:d,position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};h.style.fontSize||(h.style.fontSize=14),h.style.fontFamily||(h.style.fontFamily="Arial");let f;try{!h.positions&&h.position&&(h.positions=h.position),f=this.drawTool.createByPositions(h),!f&&this.drawTool.startText&&(console.log("使用startText创建文字"),this.drawTool.startText(h.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.text=d,this.drawTool.currentEntity.position=h.position,f=this.drawTool.currentEntity))}catch(p){console.log("创建文字失败",p)}if(!f)try{const p=this.viewer.entities.add({position:h.position,label:Object.assign({text:d,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:{})}),u={getEntity:()=>p,entity:p,style:h.style||{},type:"label",objId:a.id||`label_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(p)};try{p.objId=u.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(u)),f=u}catch(p){console.warn("回退创建文字实体失败",p)}f&&(s++,f.isEdit=!0)}break;case"image":if(a.position){const d={type:"billboard",style:a.style||{},position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};d.style.image||(console.log("使用默认图片占位符"),d.style.image="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4="),d.style.width||(d.style.width=50),d.style.height||(d.style.height=50);let h;try{!d.positions&&d.position&&(d.positions=d.position),h=this.drawTool.createByPositions(d),!h&&this.drawTool.startImage&&(console.log("使用startImage创建图片"),this.drawTool.startImage(d.style.image,d.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.position=d.position,h=this.drawTool.currentEntity))}catch(f){console.log("创建图片失败",f)}if(!h)try{const f=d.style&&d.style.image?d.style.image:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4=",p=this.viewer.entities.add({position:d.position,billboard:{image:f,width:d.style&&d.style.width?d.style.width:50,height:d.style&&d.style.height?d.style.height:50,verticalOrigin:d.style&&d.style.verticalOrigin||this.Cesium.VerticalOrigin.CENTER,scale:d.style&&d.style.scale||1}}),u={getEntity:()=>p,entity:p,style:d.style||{},type:"billboard",objId:a.id||`billboard_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(p)};try{p.objId=u.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(u)),h=u}catch(f){console.warn("回退创建图片实体失败",f)}h&&(s++,h.isEdit=!0)}break;case"ellipse":case"circle":{try{const d=JSON.parse(JSON.stringify(a.style||{}));if(d.color&&typeof d.color=="string"&&!d.color.startsWith("rgba"))try{const p=JSON.parse(d.color);p.red!==void 0&&(d.color=`rgba(${Math.round(p.red*255)}, ${Math.round(p.green*255)}, ${Math.round(p.blue*255)}, ${p.alpha||1})`)}catch{}let h=[],f=!1;if(a.positions&&a.positions.length&&(a.positions[0]&&a.positions[0].x!==void 0&&(h=a.positions.map(p=>new this.Cesium.Cartesian3(p.x,p.y,p.z!==void 0?p.z:0))),h.length)){const p={type:l,positions:h,style:d,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let u=null;try{if(u=this.drawTool.createByPositions(p),u){s++,u.isEdit=!0;const m=u.getEntity?u.getEntity():u.entity||u;m&&(m._plotInstance=u,m.objId=u.objId||a.id,m.pickable=!0,m.polyline&&(m.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${m.objId} using positions`)),f=!0}}catch(m){console.warn(`drawTool.createByPositions(${l}) failed`,m)}}if(!f&&a.center&&a.radius)try{const p=new this.Cesium.Cartesian3(a.center.x,a.center.y,a.center.z||0),u=this.Cesium.Cartesian3.add(p,new this.Cesium.Cartesian3(a.radius,0,0),new this.Cesium.Cartesian3),b={type:l,positions:[p,u],style:d,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let A=null;try{if(A=this.drawTool.createByPositions(b),A){s++,A.isEdit=!0;const C=A.getEntity?A.getEntity():A.entity||A;C&&(C._plotInstance=A,C.objId=A.objId||a.id,C.pickable=!0,C.polyline&&(C.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${C.objId} using center and radius`))}}catch(C){console.warn(`drawTool.createByPositions(${l}) with center/radius failed`,C)}}catch(p){console.warn(`Fallback creation for ${l} failed`,p)}}catch(d){console.warn(`load ${l} failed`,d)}break}default:console.log(`尝试加载未知类型实体: ${l}`);break}})};return Object.keys(n).forEach(r=>{o(n[r],r)}),console.log(`成功加载 ${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}),console.log("通过实体对象的setStyle方法修改颜色成功"),!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,l=s.outlineWidth;s.material=n,o!==void 0&&(s.outline=o),r!==void 0&&(s.outlineColor=r),l!==void 0&&(s.outlineWidth=l)}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 il{viewer;cesium;handler=null;measureEntities=[];originalDoubleClickAction=null;onMeasure=()=>{};activePoints=[];floatingPoint=null;activeShape=null;type=null;unit="m";cursorPosition=null;isSnapping=!1;snapIndicator=null;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t;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.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(n=>{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.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 l=t.Cartesian3.distance(s,o),a=t.Cartesian3.midpoint(s,o,new t.Cartesian3);this.addLabel(a,this.formatDistance(l));const d=t.Transforms.eastNorthUpToFixedFrame(s),h=t.Matrix4.inverse(d,new t.Matrix4),f=t.Matrix4.multiplyByPoint(h,o,new t.Cartesian3),p=f.x,u=f.y,m=f.z,b=t.Matrix4.getColumn(d,0,new t.Cartesian3),A=t.Matrix4.getColumn(d,1,new t.Cartesian3),C=t.Cartesian3.multiplyByScalar(b,p,new t.Cartesian3),v=t.Cartesian3.add(s,C,new t.Cartesian3),S=t.Cartesian3.multiplyByScalar(A,u,new t.Cartesian3),D=t.Cartesian3.add(v,S,new t.Cartesian3);if(this.viewer.scene.mode!==t.SceneMode.SCENE2D){const N=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,D],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.GREEN}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,1,0,.5)})}}),B=this.viewer.entities.add({polyline:{positions:[D,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(N,I,B)}this.onMeasure({type:"distance",dx:p,dy:u,dz:m,dist:l}),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 a=this.viewer.entities.add({polyline:{positions:[s,o,r],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(a)}const l=this.calculateAngle(s,o,r);this.addLabel(o,`${l.toFixed(1)}°`),this.onMeasure({type:"angle",angle:l}),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.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 l=new t.Cartesian2(e.x+r.x,e.y+r.y);let a=null;try{a=this.viewer.scene.pick(l)}catch{}if(t.defined(a)&&(a instanceof t.Cesium3DTileFeature||a.primitive&&a.primitive instanceof t.PointPrimitive))try{const d=this.viewer.scene.pickPosition(l);if(d)return d}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 l=n[r];if(!l.show)continue;let a=[];if(l.polyline&&l.polyline.positions){const d=l.polyline.positions.getValue(t.JulianDate.now());d&&(a=d)}else if(l.polygon&&l.polygon.hierarchy){const d=l.polygon.hierarchy.getValue(t.JulianDate.now());d&&d.positions&&(a=d.positions)}else if(l.position){const d=l.position.getValue(t.JulianDate.now());d&&(a=[d])}else if(l.rectangle&&l.rectangle.coordinates){const d=l.rectangle.coordinates.getValue(t.JulianDate.now());d&&(a=[t.Cartesian3.fromRadians(d.west,d.south),t.Cartesian3.fromRadians(d.east,d.south),t.Cartesian3.fromRadians(d.east,d.north),t.Cartesian3.fromRadians(d.west,d.north)])}for(let d=0;d<a.length;d++){const h=a[d];try{const f=this.viewer.scene.cartesianToCanvasCoordinates(h);if(f){const p=t.Cartesian2.distance(f,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 l=s.Cartesian3.dot(o,r),a=Math.max(-1,Math.min(1,l)),d=Math.acos(a);return s.Math.toDegrees(d)}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],l=e[o+1],a=t.Cartesian3.subtract(r,n,new t.Cartesian3),d=t.Cartesian3.subtract(l,n,new t.Cartesian3),h=t.Cartesian3.cross(a,d,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²`}}class ry{cesium;viewer;events=new Hi;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),t.skyBox&&(t.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}}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.minimumZoomDistance=1,n.maximumZoomDistance=1e6,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);const s=()=>{const o=this.viewer.camera,r=e.Math.EPSILON3,l=0,a=e.Math.toRadians(-90),d=0,h=Math.abs(o.heading-l);((h>Math.PI?Math.abs(h-2*Math.PI):h)>r||Math.abs(o.pitch-a)>r||Math.abs(o.roll-d)>r)&&o.setView({orientation:{heading:l,pitch:o.pitch,roll:d}})};this._removeCameraLockListener=this.viewer.scene.postRender.addEventListener(s),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",l=t?.layerType||"img_w",a=l.split("_"),d=a[0]||"img",h=a[1]||"w";let f="";d==="img"?f="cia":d==="vec"?f="cva":d==="ter"&&(f="cta");const p=f?`${f}_${h}`:"";o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${l}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${d}&STYLE=default&TILEMATRIXSET=${h}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:d,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=${f}&STYLE=default&TILEMATRIXSET=${h}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:f,style:"default",format:"tiles",tileMatrixSetID:h,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]}))}else if(e==="arcgis"){console.log("Switching to ArcGIS...");const r=t?.url||"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";try{if(this.cesium.ArcGisMapServerImageryProvider.fromUrl){const l=this.cesium.ArcGisMapServerImageryProvider.fromUrl(r,{enablePickFeatures:!1}),a=new Promise((h,f)=>setTimeout(()=>f(new Error("ArcGIS metadata request timed out")),3e3)),d=await Promise.race([l,a]);o.push(d)}else o.push(new this.cesium.ArcGisMapServerImageryProvider({url:r,enablePickFeatures:!1}))}catch(l){console.warn("ArcGIS provider failed (or timed out), fallback to XYZ template",l),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"});if(this.lastBaseMapRequestId!==n){console.log("BaseMap switch cancelled due to new request.");return}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,l=t.scene.primitives,a=l.length,d=!!n.CustomShader;for(let h=0;h<a;++h){const f=l.get(h);if(f instanceof n.Cesium3DTileset)if(d)if(f.customShader&&f.customShader.isModelAdjustment)e.brightness!==void 0&&f.customShader.setUniform("u_brightness",s),e.contrast!==void 0&&f.customShader.setUniform("u_contrast",o),e.saturation!==void 0&&f.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:`
|
|
30
|
-
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
|
|
31
|
-
// 1. 亮度 (Brightness) - RGB 乘法
|
|
32
|
-
material.diffuse *= u_brightness;
|
|
33
|
-
|
|
34
|
-
// 2. 对比度 (Contrast) - (Color - 0.5) * Contrast + 0.5
|
|
35
|
-
material.diffuse = (material.diffuse - vec3(0.5)) * u_contrast + vec3(0.5);
|
|
36
|
-
|
|
37
|
-
// 3. 饱和度 (Saturation)
|
|
38
|
-
// 计算灰度值 (Luminance)
|
|
39
|
-
float gray = dot(material.diffuse, vec3(0.2125, 0.7154, 0.0721));
|
|
40
|
-
vec3 grayColor = vec3(gray);
|
|
41
|
-
// 混合灰度与原色
|
|
42
|
-
material.diffuse = mix(grayColor, material.diffuse, u_saturation);
|
|
43
|
-
|
|
44
|
-
// 防止颜色溢出或变为负数 (Clamp to 0.0 - 1.0)
|
|
45
|
-
// material.diffuse = clamp(material.diffuse, 0.0, 1.0);
|
|
46
|
-
// 通常不需要 clamp,除非开启 HDR 后期望超亮,但负值需要避免
|
|
47
|
-
material.diffuse = max(material.diffuse, vec3(0.0));
|
|
48
|
-
}
|
|
49
|
-
`});p.isModelAdjustment=!0,f.customShader=p}else e.brightness!==void 0&&e.brightness!==1&&!f.style&&(f.style=new n.Cesium3DTileStyle({color:`color('white') * ${e.brightness}`}))}}setModelBrightness(e){this.setModelColorAdjustment({brightness:e})}_defaultSkyBox=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)}setHeightBasedZoom(e){this.viewer.camera.frustum.near=1e-5,this.viewer.camera.frustum.far=1e8,e||(this.viewer.camera.frustum.near=.1)}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 ay{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 ly(i){const{container:e,appContext:t,methods:n,viewerOptions:s,options:o,callbacks:r}=i,l=new Hi,a=window.Cesium;if(!a)throw new Error("Cesium is not loaded");e.id=`cesium-container-${np()}`;const d={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}}},h=t?.config?.globalProperties?.$leitingBimOptions,f={...d,...h?.viewerOptions??{},...s??{}},p=new a.Viewer(e,f);p.camera.setView({destination:a.Cartesian3.fromDegrees(108,32,1e7),orientation:{heading:a.Math.toRadians(0),pitch:a.Math.toRadians(-90),roll:0}});let u=n;if(!u&&h&&(h.methods||(h.methods={}),u=h.methods),u){const m=new mp({cesium:a,viewer:p,options:o,callbacks:r}),b=new kr({cesium:a,viewer:p}),A=new ry({cesium:a,viewer:p}),C=new Ap({cesium:a,viewer:p}),v=new ay({cesium:a,viewer:p});let S;const D=new il({cesium:a,viewer:p});o&&(o.globe!==void 0&&A.setGlobeEnvironmentVisible(o.globe),o.terrain!==void 0&&A.setTerrainEnable(o.terrain),o.depthTest!==void 0&&A.setDepthTestEnable(o.depthTest),o.mapProvider&&o.mode!=="2d"&&A.changeBaseMap(o.mapProvider,{token:o.tiandituToken,layerType:o.tiandituLayerType,showAnnotation:o.tiandituShowLabel,url:o.arcgisUrl}),o.shadows!==void 0&&A.setShadowsEnable(o.shadows),o.environmentMap!==void 0&&A.setEnvironmentMapEnable(o.environmentMap),o.ambientOcclusion!==void 0&&A.setAmbientOcclusion(o.ambientOcclusion),o.time!==void 0&&A.setTime(o.time),o.brightness!==void 0&&A.setModelBrightness(o.brightness),o.backgroundColor!==void 0&&A.setBackgroundColor(o.backgroundColor),o.collision!==void 0&&A.setCollisionDetection(o.collision),o.mouseHabit!==void 0&&A.setMouseHabit(o.mouseHabit),o.heightBasedZoom!==void 0&&A.setHeightBasedZoom(o.heightBasedZoom)),o&&o.mode==="2d"&&(console.log("InitMap: Setting CAD Mode 2D"),A.setCadMode("2d"),S=new tl({cesium:a,viewer:p})),b.events.on("tilesetLoaded",g=>{m.baseCompt.attachTileset(g,m.baseCompt.selectedColor),m.baseSection.attachTileset(g,g.leiting?.model?.modelId),u&&u.tilesLoad3dTiles&&u.tilesLoad3dTiles(g),o?.tilesLoad3dTiles&&o.tilesLoad3dTiles(g.leiting)}),b.events.on("loadingStatus",g=>{u&&u.onLoadingStatus&&u.onLoadingStatus(g)}),b.events.on("mountAll3Dtiles",({modelList:g})=>{o?.mountAll3Dtiles&&o.mountAll3Dtiles(g),u?.mountAll3Dtiles&&u.mountAll3Dtiles(g)}),b.events.on("updateModels",({modelList:g})=>{o?.updateModels&&o.updateModels(g),u?.updateModels&&u.updateModels(g)}),C.events.on("mountAllCad",g=>{o?.mountAllCad&&o.mountAllCad(g),u?.mountAllCad&&u.mountAllCad(g)}),m.baseCompt.loadNodeDetailsForModel=g=>b.loadNodeDetailsForModel(g),m.baseCompt.selectionChange(g=>{g.length!==0&&(o?.selectionChange&&o.selectionChange(g),u?.selectionChange&&u.selectionChange(g))}),u.onSearchComponent=g=>{o?.searchComponent&&o.searchComponent(g),u?.searchComponent&&u.searchComponent(g)};const N=u.saveRegion;u.saveRegion=g=>{o?.saveRegion&&o.saveRegion(g),N&&N!==o?.saveRegion&&N(g)};const I=u.saveCadCalibration;u.saveCadCalibration=g=>{o?.saveCadCalibration&&o.saveCadCalibration(g),I&&I!==o?.saveCadCalibration&&I(g)};const B=u.saveCadRegion;u.saveCadRegion=g=>{o?.saveCadRegion&&o.saveCadRegion(g),B&&B!==o?.saveCadRegion&&B(g)},u.getCesium=()=>a,u.getViewer=()=>p,u.getAnnotationInstance=()=>S,u.getMeasureInstance=()=>D,u.flyToCamera=g=>{v.setCameraView(g)},u.flyToLonLatHeight=(g,P,x,k=1)=>{v.flyToLonLatHeight(g,P,x,k)},u.flyTo=u.flyToCamera,u.getCameraState=()=>v.getCameraView(),u.getCameraInfo=u.getCameraState,u.restoreCameraState=g=>v.flyToCameraView(g),u.flyToCameraView=u.restoreCameraState,u.getCameraPositionTarget=()=>v.getCurrentCameraPositionAndTarget(),u.getCurrentCameraPositionAndTarget=u.getCameraPositionTarget,u.setCameraLookAt=g=>v.setCameraView(g),u.setCameraView=u.setCameraLookAt,u.setCanvasBackground=g=>A.setBackgroundColor(g),u.setBackgroundColor=u.setCanvasBackground,u.setAntiAliasing=g=>m.enableCesiumFXAA(g),u.enableCesiumFXAA=u.setAntiAliasing,u.setSceneVisibility=g=>m.setSceneOptions(g),u.setSceneOptions=u.setSceneVisibility,u.addDebugPoint=(g,P,x=0)=>{p.entities.add({position:a.Cartesian3.fromDegrees(g,P,x),point:{pixelSize:10,color:a.Color.RED}})},u.addPoint=u.addDebugPoint,u.toggleDebugLabels=()=>m.enableTestLabel(),u.enableTestLabel=u.toggleDebugLabels,u.captureScreenshot=()=>{const g=p.scene.canvas;return p.render(),g.toDataURL("image/png")},u.getImageBase64=u.captureScreenshot,u.captureDomScreenshot=(g,P)=>m.getSnapDomSImageBase64(g,P),u.getSnapDomSImageBase64=u.captureDomScreenshot,u.addModels=g=>b.addModels(g),u.add3DtilesModel=u.addModels,u.addObliquePhotography=g=>b.addOSGB(g),u.addOSGB=u.addObliquePhotography,u.adjustOSGBModelMatrix=g=>b.updateOSGBMatrix(g),u.updateOSGBMatrix=u.adjustOSGBModelMatrix,u.setModelVisibility=g=>b.showModels(g),u.showModels=u.setModelVisibility,u.showTileset=u.setModelVisibility,u.removeModels=g=>b.deleteModels(g),u.deleteModels=u.removeModels,u.clearAllModels=()=>{b.deleteAllModels(),l.emit("deleteAllModels")},u.deleteAllModelList=u.clearAllModels,u.deleteAllModels=u.clearAllModels,u.flyToModel=g=>b.flyToTileset(g),u.flyToTileset=u.flyToModel,u.flyToByModelId=u.flyToModel,u.setModelBrightness=g=>m.updateModelEffect(g),u.updateModelEffect=u.setModelBrightness,u.getAllTilesets=()=>b.getMapTileset(),u.getMapTileset=u.getAllTilesets,u.getCurrentModelId=()=>b.getBIMmodelId(),u.getBIMmodelId=u.getCurrentModelId,u.getLoadedModels=()=>b.getModelList(),u.getModelList=u.getLoadedModels,u.loadModelStructure=async g=>{const P=typeof g=="string"?g:g?.modelId;if(!P){console.warn("loadModelStructure: modelId is required");return}return await b.loadTreeForModel(P)},u.loadTreeForModel=u.loadModelStructure,u.loadModelDetails=async g=>{const P=typeof g=="string"?g:g?.modelId;if(!P){console.warn("loadModelDetails: modelId is required");return}return await b.loadNodeDetailsForModel(P)},u.loadNodeDetailsForModel=u.loadModelDetails,u._loadNodeDetailsForModel=async g=>{const P=typeof g=="string"?g:g?.modelId;if(!P){console.warn("loadModelDetails: modelId is required");return}return await b._loadNodeDetailsForModel(P)},u.setMapTileset=g=>b.setMapTileset(g),u.setCurrentModelId=g=>b.setBIMmodelId(g),u.setBIMmodelId=u.setCurrentModelId,u.setModelList=g=>b.setModelList(g),u.highlightComponents=(g,P={})=>m.baseCompt.setSelectColorUserModelCpt(g,P),u.setSelectColorUserModelCpt=u.highlightComponents,m.baseCompt.setLoadNodeDetailsCallback(g=>b.loadNodeDetailsForModel(g)),u.highlightAllComponents=(g,P)=>m.baseCompt.setAllSelectColorUserModelCpt(g,P),u.setAllSelectColorUserModelCpt=u.highlightAllComponents,u.setSelectColorUserModelCptByClear=(g,P)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(g.selectCpts,P??{rank:0})},u.clearSelectColorUserModelCpt=()=>m.baseCompt.clearAllHaveSelected(),u.selectComponents=(g,P)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(g,P??{rank:0})},u.setSelecteds=u.selectComponents,u.setSelectionColor=(g,P,x,k)=>m.baseCompt.setSelectedColorRgba(g,P,x,k),u.setSelectedColor=u.setSelectionColor,u.clearSelection=()=>m.baseCompt.clearAllHaveSelected(),u.clearAllHaveSelected=u.clearSelection,u.getSelectedComponents=g=>m.baseCompt.getSelected(g),u.getSelected=u.getSelectedComponents,u.onSelectionChange=g=>{m.baseCompt.selectionChange(g)},u.selectionChange=u.onSelectionChange,u.flyToComponents=g=>m.baseCompt.flyToObjects(g),u.flyToObjects=u.flyToComponents,u.setConstructionData=async g=>{if(g&&Array.isArray(g)){const P=new Set;g.forEach(x=>{x.mergeCpts&&Array.isArray(x.mergeCpts)&&x.mergeCpts.forEach(k=>{k.modelId&&P.add(k.modelId)})}),P.size>0&&await Promise.all(Array.from(P).map(x=>u.loadNodeDetailsForModel(x)))}m.baseCompt.setAllConstructionProgressTracking(g)},u.setAllConstructionProgressTracking=u.setConstructionData,u.startConstructionSimulation=()=>m.baseCompt.enableConstructionProgressTracking(),u.enableAllConstructionProgressTracking=u.startConstructionSimulation,u.stopConstructionSimulation=()=>m.baseCompt.disableConstructionProgressTracking(),u.disableConstructionProgressTracking=u.stopConstructionSimulation,u.disableAllConstructionProgressTracking=u.stopConstructionSimulation,u.resetConstructionSimulation=()=>m.baseCompt.freshConstructionProgressTracking(),u.freshConstructionProgressTracking=u.resetConstructionSimulation,u.restartConstructionSimulation=()=>m.baseCompt.reStartAnimation(),u.reStartAnimation=u.restartConstructionSimulation,u.resumeFlyTo=()=>m.baseCompt.resumeFlyTo(),u.pauseConstructionSimulation=()=>m.baseCompt.pauseFlyTo(),u.pauseFlyTo=u.pauseConstructionSimulation,u.pauseAnimation=u.pauseConstructionSimulation,u.resumeConstructionSimulation=()=>m.baseCompt.resumeFlyTo(),u.resumeAnimation=u.resumeConstructionSimulation,u.setComponentsVisibility=async g=>await m.baseCompt.setComponentVisibility(g),u.setElementsListVisible=u.setComponentsVisibility,u.setAllComponentsVisibility=async g=>await m.baseCompt.setAllComponentsVisibility(g),u.setAllElementsVisible=u.setAllComponentsVisibility,u.isolateComponents=g=>m.baseCompt.isolateComponentVisibility(g),u.isolateComponentVisibility=u.isolateComponents,u.getComponentsByVisibility=g=>m.baseCompt._getComponentsByVisibility(g),u.getShowCpts=g=>m.baseCompt.getComponentsByVisibility(g),u.getElementsVisible=g=>m.baseCompt.getComponentsByVisibility(g),u.setComponentVisibility=u.setComponentsVisibility,u.enableSectioning=(g,P)=>m.baseSection.open(g,P),u.openSection=u.enableSectioning,u.disableSectioning=g=>m.baseSection.close(g),u.closeSection=u.disableSectioning,u.updateSectionBox=g=>m.baseSection.updateRange(g),u.updateSectionRange=u.updateSectionBox,u.getSectionBox=()=>m.baseSection.getRange(),u.getSectionRange=u.getSectionBox,u.fitSectionToModel=()=>m.baseSection.fitToModels(),u.fitToModels=u.fitSectionToModel,u.setSectionBoxVisibility=g=>m.baseSection.setBoxVisibility(g),u.startFirstPersonMode=()=>{m.baseCompt.disableSelection(),m.basePlayer.openPlayer()},u.openPlayer=u.startFirstPersonMode,u.stopFirstPersonMode=()=>{m.basePlayer.closePlayer(),m.baseCompt.enableSelection()},u.closePlayer=u.stopFirstPersonMode,u.setPlayerPosition=g=>m.basePlayer.setPersonPosition(g),u.setPersonPosition=u.setPlayerPosition,u.setWalkSpeed=g=>m.basePlayer.setSpeed({speed:g}),u.setPlayerSpeed=u.setWalkSpeed,u.setPlayerConfig=g=>m.basePlayer.setParams(g),u.setPlayerParams=u.setPlayerConfig,u.setPlayerAction=(g,P)=>m.basePlayer.setMoveState(g,P),u.setPlayerMoveState=u.setPlayerAction,u.bindPlayerControls=g=>m.basePlayer.bindUiKeys(g),u.bindPlayerUiKeys=u.bindPlayerControls,u.setGlobeVisibility=g=>A.setGlobeEnvironmentVisible(g),u.setGlobeEnvironmentVisible=u.setGlobeVisibility,u.setTerrainVisibility=g=>A.setTerrainEnable(g),u.setTerrainEnable=u.setTerrainVisibility,u.setDepthTest=g=>A.setDepthTestEnable(g),u.setDepthTestEnable=u.setDepthTest,u.setBaseMap=(g,P)=>A.changeBaseMap(g,P),u.changeBaseMap=u.setBaseMap,u.setWorldTime=g=>A.setTime(g),u.setTime=u.setWorldTime,u.setGisOptions=g=>{g.globe!==void 0&&A.setGlobeEnvironmentVisible(g.globe),g.elevation!==void 0&&A.setTerrainEnable(g.elevation),g.depthTestAgainstTerrain!==void 0&&A.setDepthTestEnable(g.depthTestAgainstTerrain),g.rendering!==void 0&&A.setAmbientOcclusion(g.rendering)},u.setShadowVisibility=g=>A.setShadowsEnable(g),u.setShadowsEnable=u.setShadowVisibility,u.setEnvironmentMapVisibility=g=>A.setEnvironmentMapEnable(g),u.setEnvironmentMapEnable=u.setEnvironmentMapVisibility,u.setAOVisibility=g=>A.setAmbientOcclusion(g),u.setAmbientOcclusion=u.setAOVisibility,u.setBackgroundColor=g=>A.setGlobeColor(g),u.setGlobeColor=u.setBackgroundColor,u.setModelBrightness=g=>A.setModelBrightness(g),u.adjustModelColor=g=>A.setModelColorAdjustment(g),u.setModelColorAdjustment=u.adjustModelColor,u.setShadowIntensity=g=>{A.setShadowDarkness?A.setShadowDarkness(g):console.warn("baseSetting.setShadowDarkness is not available. Please reload the page.")},u.setShadowDarkness=u.setShadowIntensity,u.switchSceneMode=async g=>{const P=g?"2d":"3d";await A.setCadMode(P),g&&!S&&(S=new tl({cesium:a,viewer:p}),u.setGlobeVisibility(!0)),l.emit("setMode",P)},u.setSceneMode=u.switchSceneMode,u.set2d=g=>u.switchSceneMode(g),u.is2dMode=()=>A.is2d,u.setMouseControlMode=g=>A.setMouseHabit(g),u.setMouseHabit=u.setMouseControlMode,u.setCollisionEnabled=g=>A.setCollisionDetection(g),u.setCollisionDetection=u.setCollisionEnabled,u.searchAndLocate=(g,P)=>A.searchLocation(g,P),u.searchLocation=u.searchAndLocate,u.getConfigure=()=>(console.warn("getConfigure is not initialized. Please ensure LeitingSetting component is mounted."),{}),u.setConfigure=g=>{console.warn("setConfigure is not initialized. Please ensure LeitingSetting component is mounted.",g)},u.addCadModel=g=>{const P={...g};return P.files&&!P.fileNames&&(P.fileNames=P.files),P.fileNames||(P.fileNames=[]),C.addDxfModel(P)},u.addDxfModel=u.addCadModel,u.deleteCad=g=>C.deleteCad(g),u.deleteAllCad=()=>C.deleteAllCad(),u.showCadModel=g=>C.showJson(g),u.showGeoJson=g=>C.showJson(g),u.showDxfModel=u.showCadModel,u.showCadLayer=g=>C.showJsonByLayer(g),u.showDxfLayer=u.showCadLayer,u.flyToCadModel=(g={})=>C.flyToCadModel(g),u.getCadModels=g=>C.getDxfModels(g),u.getDxfModels=u.getCadModels,u.getCadLayers=g=>C.getMapLayers(g),u.getDxfLayers=u.getCadLayers,u.getCadModelId=()=>C.getModelId(),u.setCadOpen=g=>C.setDxfOpen(g),u.setDxfOpen=u.setCadOpen,u.getCadOpen=()=>C.getDxfOpen(),u.getDxfOpen=u.getCadOpen,u.adjustCadModel=g=>C.adjustingModelByCad(g),u.adjustingModelByCad=u.adjustCadModel,u.saveAnnotations=()=>{let g=null;return S&&(g=S.saveAnnotations()),o?.saveAnnotations&&o.saveAnnotations(g),g},u.loadAnnotations=g=>S?S.loadAnnotations(g):!1,u.flyToTopView=()=>{C.flyToCadModel()},u.menuEvents=l,u.addMenuItems=g=>{l.emit("insertMenu",g)},u.insertMenu=u.addMenuItems,u.filterMenuItems=g=>{l.emit("setMenuListFilter",g)},u.setMenuListFilter=u.filterMenuItems,u.setMenuVisibility=g=>{l.emit("showMenu",g)},u.showMenu=u.setMenuVisibility,u.setPanelVisibility=(g,P)=>{l.emit("setMenuActive",g,P)},u.setMenuActive=u.setPanelVisibility,u.addContextMenuItems=g=>{console.warn("addContextMenuItems is not initialized yet. Please wait for LeitingBIM component to mount.",g)},u.insertContextMenu=u.addContextMenuItems,u.removeContextMenuItems=g=>{console.warn("removeContextMenuItems is not initialized yet.",g)},u.deleteContextMenu=u.removeContextMenuItems,u.closeContextMenu=()=>{console.warn("closeContextMenu is not initialized yet.")},u.hideContextMenu=u.closeContextMenu,u.getModelTree=()=>{const g=[],P=b.getMapTileset();return Object.keys(P).forEach(x=>{const k=P[x];if(k&&k.leiting&&k.leiting.tree){const U=k.leiting.tree;Array.isArray(U)?g.push(...U):g.push(U)}}),g},u.getTree=u.getModelTree,u.getAllComponentDetails=()=>{const g=b.getMapTileset(),P={},x=[];try{Object.keys(g).forEach(k=>{const U=g[k];if(!U||!U.leiting)return;const G=U.leiting,F=G.node,E=G.model.formData,y=G.box;if(!F||!F.nodeExtras)return;const w=G.model.modelId;P[w]=F.nodeExtras;const T=F.nodeExtras.element;if(!T)return;const R=y?y.center:{x:0,y:0,z:0};Object.values(T).forEach(O=>{if(O.box3)try{const L=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(E.totalRotation||0)),M=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(L),new a.Cartesian3(0,0,0)),Q=a.Cartesian3.fromDegrees(E.longitude,E.latitude,E.height),Y=a.Transforms.eastNorthUpToFixedFrame(Q);a.Matrix4.multiply(Y,M,Y);const W=new a.Cartesian3(R.x,R.y,0),q=new a.Cartesian3;a.Matrix4.multiplyByPoint(Y,W,q);const Z=a.Cartographic.fromCartesian(q),oe=O.box3?.Center?.x||0,ne=O.box3?.Center?.y||0,se=O.box3?.Center?.z||0,pe=new a.Cartesian3(-R.x+oe,-R.y+ne,0+se),ve=a.Matrix4.fromTranslation(pe),V=a.Matrix4.clone(ve);a.Matrix4.multiply(M,V,V);const j=a.Cartesian3.fromDegrees(Z.longitude/Math.PI*180,Z.latitude/Math.PI*180,E.height),te=a.Transforms.eastNorthUpToFixedFrame(j);a.Matrix4.multiply(te,V,te);const Ae=a.Cartographic.fromCartesian(new a.Cartesian3(te[12],te[13],te[14]));O.box3.cartographic={longitude:Ae.longitude/Math.PI*180,latitude:Ae.latitude/Math.PI*180,height:Ae.height};const Ce={id:O.uniqueId,billboard:[{theme:"Tag9999",position:[O.box3.cartographic.longitude,O.box3.cartographic.latitude,O.box3.cartographic.height],options:{text:O.name}}]};x.push(Ce)}catch(L){console.warn("Error calculating component position:",L)}})})}catch(k){console.error("getAllComponents error:",k)}return P},u.getAllComponents=u.getAllComponentDetails,u.getComponentInfoList=async g=>{if(!Array.isArray(g))return[];const P=b.getMapTileset(),x=[],k=[],U={};if(g.forEach(F=>{const y=P[F.modelId]?.leiting?.model?.dbName;y&&F.elementId&&k.push({dbName:y,elementId:F.elementId,modelId:F.modelId})}),k.length>0)try{const F=k.map(w=>({dbName:w.dbName,elementId:w.elementId})),E=await Dr(F),y=Array.isArray(E)?E:E?.data;Array.isArray(y)&&y.forEach(w=>{if(w){const T=`${w.modelId}_${w.elementId}`;U[T]=w}})}catch(F){console.warn("API fetch component details failed, falling back to local data",F)}const G=new Set;if(g.forEach(F=>{const E=P[F.modelId],y=`${F.modelId}_${F.elementId}`;U[y]||E&&E.leiting&&!E.leiting?.node?.nodeExtras&&E.leiting.model?.nodeUrl&&G.add(F.modelId)}),G.size>0&&b._loadNodeDetailsForModel)try{const F=Array.from(G).map(E=>b._loadNodeDetailsForModel(E));await Promise.all(F)}catch(F){console.error("Failed to load node details in getComponentInfoList",F)}try{g.forEach(F=>{const E=F.modelId,y=F.elementId,w=P[E];if(!w||!w.leiting)return;const T=`${E}_${y}`,R=U[T];let O=null;if(R)O=R;else{const L=w.leiting.node?.nodeExtras?.element||w.leiting.node?.nodeExtras;L&&L[y]&&(O=JSON.parse(JSON.stringify(L[y])))}if(O){if(O.elementId=y,O.modelId=E,O.box3&&!O.box3.cartographic)try{const L=w.leiting,M=L.model.formData,Q=L.box,Y=Q?Q.center:{x:0,y:0,z:0},W=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(M.totalRotation||0)),q=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(W),new a.Cartesian3(0,0,0)),Z=a.Cartesian3.fromDegrees(M.longitude,M.latitude,M.height),oe=a.Transforms.eastNorthUpToFixedFrame(Z);a.Matrix4.multiply(oe,q,oe);const ne=new a.Cartesian3(Y.x,Y.y,0),se=new a.Cartesian3;a.Matrix4.multiplyByPoint(oe,ne,se);const pe=a.Cartographic.fromCartesian(se),ve=O.box3?.Center?.x||0,V=O.box3?.Center?.y||0,j=O.box3?.Center?.z||0,te=new a.Cartesian3(-Y.x+ve,-Y.y+V,0+j),Ae=a.Matrix4.fromTranslation(te),Ce=a.Matrix4.clone(Ae);a.Matrix4.multiply(q,Ce,Ce);const Me=a.Cartesian3.fromDegrees(pe.longitude/Math.PI*180,pe.latitude/Math.PI*180,M.height),Le=a.Transforms.eastNorthUpToFixedFrame(Me);a.Matrix4.multiply(Le,Ce,Le);const Ne=a.Cartographic.fromCartesian(new a.Cartesian3(Le[12],Le[13],Le[14]));O.box3.cartographic={longitude:Ne.longitude/Math.PI*180,latitude:Ne.latitude/Math.PI*180,height:Ne.height}}catch(L){console.warn("Error calculating component position:",L)}x.push(O)}})}catch(F){console.error("getComponentInfoList processing error:",F)}return x},u.getCptInfos=u.getComponentInfoList,u.baseCompt=m.baseCompt,u.setTeleportTarget=g=>{u.onSetTeleportTarget&&u.onSetTeleportTarget(g)},window.Methods=u}return console.log("methods",u),{Cesium:a,viewer:p,methods:u,menuEvents:l}}const be=c.reactive({visible:!1,type:"info",title:"",description:"",closable:!1,showIcon:!0,duration:3});let ye=null,nl=null,sl=!1,Ss=null,rn=null,Ts=null;function cy(){if(rn||typeof document>"u")return;const i=`
|
|
29
|
+
`;this.promptDiv=window.document.createElement("div"),this.promptDiv.className=`easy3d-prompt ${this.opt.className}`,this.promptDiv.id=f,this.promptDiv.innerHTML=p,window.document.getElementById(o).appendChild(this.promptDiv);const m=window.document.getElementById(`prompt-close-${this.opt.id}`);let w=this;m&&m.addEventListener("click",A=>{w.hide(),w.opt.close&&w.opt.close()}),this.promptDom=window.document.getElementById(f),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 Or=Object.freeze(Object.defineProperty({__proto__:null,default:dt},Symbol.toStringTag,{value:"Module"}));let re={};re.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]},re.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]}},re.cartesiansToLnglats=function(i,e){if(!(!i||i.length<1)){if(e=e||window.viewer,!e){console.log("util.cartesiansToLnglats方法缺少viewer对象");return}for(var t=[],n=0;n<i.length;n++)t.push(re.cartesianToLnglat(i[n],e));return t}},re.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}},re.flyTo=function(i,e){if(!e){console.log("util.flyTo缺少viewer对象");return}i=i||{};let t=i.center;if(!t){console.log("缺少定位坐标!");return}if(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)})}},re.getCameraView=function(i){if(i=i||window.viewer,!i){console.log("util.getCameraView缺少viewer对象");return}var e=i.camera,t=e.position,n=e.heading,s=e.pitch,o=e.roll,r=Cesium.Cartographic.fromCartesian(t),l={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 l},re.setCameraView=function(i,e){if(e=e||window.viewer,!e){console.log("util.setCameraView缺少viewer对象");return}if(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})}},re.computeAreaOfTriangle=function(i,e,t){if(!i||!e||!t)return console.log("传入坐标有误!"),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 qe{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?re.cartesiansToLnglats(this.positions,this.viewer):this.positions}getLnglats(){return re.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 yp="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 Cp extends qe{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=yp,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 l=()=>{r||(r=!0,clearTimeout(d),n(o))},a=h=>{r||(r=!0,clearTimeout(d),s(new Error("image load error: "+e)))};o.onload=l,o.onerror=a;const d=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 dt(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 l=t.viewer.scene.pick(r.position);if(Cesium.defined(l)&&l.id){if(l.id===t.entity){n=l.id,s=!0,t._isDragging=!0,t._editPickedEntity=n,t.modifyPoint=null;try{t.forbidDrawWorld(!0)}catch{}}else if(t.controlPoints.includes(l.id)){t.modifyPoint=l.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 l=t.getCatesian3FromPX(r.endPosition,t.viewer);if(l){if(Cesium.defined(n)){try{n.position.setValue(l)}catch{n.position=l}t.position=l.clone(),t.controlPoints&&t.controlPoints.length>0&&t.controlPoints.forEach(a=>{try{a.position.setValue(l)}catch(d){console.warn("更新控制点位置失败:",d);try{a.position=l.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 l=t.viewer.scene.pick(r.position);Cesium.defined(l)&&l.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,l=new Cesium.Cartesian3,a=new Cesium.Cartesian3;Cesium.Cartesian3.clone(o.direction,r),Cesium.Cartesian3.clone(o.right,l),Cesium.Cartesian3.clone(o.up,a),Cesium.Cartesian3.normalize(r,r),Cesium.Cartesian3.normalize(l,l),Cesium.Cartesian3.normalize(a,a);const d=new Cesium.Cartesian3;Cesium.Cartesian3.multiplyByScalar(l,s,d),Cesium.Cartesian3.multiplyByScalar(a,s,a),Cesium.Cartesian3.add(d,a,d);const h=new Cesium.Ray(e,r),f=this.viewer.scene.globe.pick(h,this.viewer.scene),u=Cesium.Cartesian3.distance(e,f||e)*.001;return Cesium.Cartesian3.multiplyByScalar(d,u,d),Cesium.Cartesian3.add(e,d,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?re.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 Ep extends qe{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 dt(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 l=0;l<=this.pointsCount;l++){const a=l/this.pointsCount*Math.PI*2,d=n.longitude+o*Math.cos(a),h=n.latitude+r*Math.sin(a);e.push(Cesium.Cartesian3.fromRadians(d,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,l=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=l,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?re.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:re.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 wp extends qe{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 dt(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),l=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 l.objId=this.objId,l}getPositions(e){return e?re.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=re.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),l=new Cesium.HeadingPitchRoll(s,o,r),a=this.entity.position._value,d=Cesium.Transforms.headingPitchRollQuaternion(a,l);this.entity&&(this.entity.orientation=d)}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),l;return r>=55296&&r<=56319&&s>o+1&&(l=n.charCodeAt(o+1),l>=56320&&l<=57343)?(r-55296)*1024+l-56320+65536:r}};i?i(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e})();function Gt(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var os,Lr;function bp(){if(Lr)return os;Lr=1;var i=0,e=-3;function t(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function n(g,P){this.source=g,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=P,this.destLen=0,this.ltree=new t,this.dtree=new t}var s=new t,o=new t,r=new Uint8Array(30),l=new Uint16Array(30),a=new Uint8Array(30),d=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]),f=new t,p=new Uint8Array(320);function u(g,P,x,k){var _,G;for(_=0;_<x;++_)g[_]=0;for(_=0;_<30-x;++_)g[_+x]=_/x|0;for(G=k,_=0;_<30;++_)P[_]=G,G+=1<<g[_]}function m(g,P){var x;for(x=0;x<7;++x)g.table[x]=0;for(g.table[7]=24,g.table[8]=152,g.table[9]=112,x=0;x<24;++x)g.trans[x]=256+x;for(x=0;x<144;++x)g.trans[24+x]=x;for(x=0;x<8;++x)g.trans[168+x]=280+x;for(x=0;x<112;++x)g.trans[176+x]=144+x;for(x=0;x<5;++x)P.table[x]=0;for(P.table[5]=32,x=0;x<32;++x)P.trans[x]=x}var w=new Uint16Array(16);function A(g,P,x,k){var _,G;for(_=0;_<16;++_)g.table[_]=0;for(_=0;_<k;++_)g.table[P[x+_]]++;for(g.table[0]=0,G=0,_=0;_<16;++_)w[_]=G,G+=g.table[_];for(_=0;_<k;++_)P[x+_]&&(g.trans[w[P[x+_]]++]=_)}function C(g){g.bitcount--||(g.tag=g.source[g.sourceIndex++],g.bitcount=7);var P=g.tag&1;return g.tag>>>=1,P}function v(g,P,x){if(!P)return x;for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var k=g.tag&65535>>>16-P;return g.tag>>>=P,g.bitcount-=P,k+x}function S(g,P){for(;g.bitcount<24;)g.tag|=g.source[g.sourceIndex++]<<g.bitcount,g.bitcount+=8;var x=0,k=0,_=0,G=g.tag;do k=2*k+(G&1),G>>>=1,++_,x+=P.table[_],k-=P.table[_];while(k>=0);return g.tag=G,g.bitcount-=_,P.trans[x+k]}function D(g,P,x){var k,_,G,F,E,y;for(k=v(g,5,257),_=v(g,5,1),G=v(g,4,4),F=0;F<19;++F)p[F]=0;for(F=0;F<G;++F){var b=v(g,3,0);p[h[F]]=b}for(A(f,p,0,19),E=0;E<k+_;){var T=S(g,f);switch(T){case 16:var R=p[E-1];for(y=v(g,2,3);y;--y)p[E++]=R;break;case 17:for(y=v(g,3,3);y;--y)p[E++]=0;break;case 18:for(y=v(g,7,11);y;--y)p[E++]=0;break;default:p[E++]=T;break}}A(P,p,0,k),A(x,p,k,_)}function N(g,P,x){for(;;){var k=S(g,P);if(k===256)return i;if(k<256)g.dest[g.destLen++]=k;else{var _,G,F,E;for(k-=257,_=v(g,r[k],l[k]),G=S(g,x),F=g.destLen-v(g,a[G],d[G]),E=F;E<F+_;++E)g.dest[g.destLen++]=g.dest[E]}}}function I(g){for(var P,x,k;g.bitcount>8;)g.sourceIndex--,g.bitcount-=8;if(P=g.source[g.sourceIndex+1],P=256*P+g.source[g.sourceIndex],x=g.source[g.sourceIndex+3],x=256*x+g.source[g.sourceIndex+2],P!==(~x&65535))return e;for(g.sourceIndex+=4,k=P;k;--k)g.dest[g.destLen++]=g.source[g.sourceIndex++];return g.bitcount=0,i}function B(g,P){var x=new n(g,P),k,_,G;do{switch(k=C(x),_=v(x,2,0),_){case 0:G=I(x);break;case 1:G=N(x,s,o);break;case 2:D(x,x.ltree,x.dtree),G=N(x,x.ltree,x.dtree);break;default:G=e}if(G!==i)throw new Error("Data error")}while(!k);return x.destLen<x.dest.length?typeof x.dest.slice=="function"?x.dest.slice(0,x.destLen):x.dest.subarray(0,x.destLen):x.dest}return m(s,o),u(r,l,4,3),u(a,d,2,1),r[28]=0,l[28]=258,os=B,os}var vp=bp();const Ip=Gt(vp);function Ht(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 ht(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}ht.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},ht.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))},ht.prototype.addX=function(i){this.addPoint(i,null)},ht.prototype.addY=function(i){this.addPoint(null,i)},ht.prototype.addBezier=function(i,e,t,n,s,o,r,l){const a=[i,e],d=[t,n],h=[s,o],f=[r,l];this.addPoint(i,e),this.addPoint(r,l);for(let p=0;p<=1;p++){const u=6*a[p]-12*d[p]+6*h[p],m=-3*a[p]+9*d[p]-9*h[p]+3*f[p],w=3*d[p]-3*a[p];if(m===0){if(u===0)continue;const S=-w/u;0<S&&S<1&&(p===0&&this.addX(Ht(a[p],d[p],h[p],f[p],S)),p===1&&this.addY(Ht(a[p],d[p],h[p],f[p],S)));continue}const A=Math.pow(u,2)-4*w*m;if(A<0)continue;const C=(-u+Math.sqrt(A))/(2*m);0<C&&C<1&&(p===0&&this.addX(Ht(a[p],d[p],h[p],f[p],C)),p===1&&this.addY(Ht(a[p],d[p],h[p],f[p],C)));const v=(-u-Math.sqrt(A))/(2*m);0<v&&v<1&&(p===0&&this.addX(Ht(a[p],d[p],h[p],f[p],v)),p===1&&this.addY(Ht(a[p],d[p],h[p],f[p],v)))}},ht.prototype.addQuad=function(i,e,t,n,s,o){const r=i+.6666666666666666*(t-i),l=e+2/3*(n-e),a=r+1/3*(s-i),d=l+1/3*(o-e);this.addBezier(i,e,r,l,a,d,s,o)};function Ie(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}Ie.prototype.moveTo=function(i,e){this.commands.push({type:"M",x:i,y:e})},Ie.prototype.lineTo=function(i,e){this.commands.push({type:"L",x:i,y:e})},Ie.prototype.curveTo=Ie.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})},Ie.prototype.quadTo=Ie.prototype.quadraticCurveTo=function(i,e,t,n){this.commands.push({type:"Q",x1:i,y1:e,x:t,y:n})},Ie.prototype.close=Ie.prototype.closePath=function(){this.commands.push({type:"Z"})},Ie.prototype.extend=function(i){if(i.commands)i=i.commands;else if(i instanceof ht){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)},Ie.prototype.getBoundingBox=function(){const i=new ht;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},Ie.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())},Ie.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},Ie.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},Ie.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 Nr(i){throw new Error(i)}function _r(i,e){i||Nr(e)}const ie={fail:Nr,argument:_r,assert:_r},Ur=32768,Qr=2147483648,Yt={},z={},ee={};function Ge(i){return function(){return i}}z.BYTE=function(i){return ie.argument(i>=0&&i<=255,"Byte value should be between 0 and 255."),[i]},ee.BYTE=Ge(1),z.CHAR=function(i){return[i.charCodeAt(0)]},ee.CHAR=Ge(1),z.CHARARRAY=function(i){const e=[];for(let t=0;t<i.length;t+=1)e[t]=i.charCodeAt(t);return e},ee.CHARARRAY=function(i){return i.length},z.USHORT=function(i){return[i>>8&255,i&255]},ee.USHORT=Ge(2),z.SHORT=function(i){return i>=Ur&&(i=-(2*Ur-i)),[i>>8&255,i&255]},ee.SHORT=Ge(2),z.UINT24=function(i){return[i>>16&255,i>>8&255,i&255]},ee.UINT24=Ge(3),z.ULONG=function(i){return[i>>24&255,i>>16&255,i>>8&255,i&255]},ee.ULONG=Ge(4),z.LONG=function(i){return i>=Qr&&(i=-(2*Qr-i)),[i>>24&255,i>>16&255,i>>8&255,i&255]},ee.LONG=Ge(4),z.FIXED=z.ULONG,ee.FIXED=ee.ULONG,z.FWORD=z.SHORT,ee.FWORD=ee.SHORT,z.UFWORD=z.USHORT,ee.UFWORD=ee.USHORT,z.LONGDATETIME=function(i){return[0,0,0,0,i>>24&255,i>>16&255,i>>8&255,i&255]},ee.LONGDATETIME=Ge(8),z.TAG=function(i){return ie.argument(i.length===4,"Tag should be exactly 4 ASCII characters."),[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]},ee.TAG=Ge(4),z.Card8=z.BYTE,ee.Card8=ee.BYTE,z.Card16=z.USHORT,ee.Card16=ee.USHORT,z.OffSize=z.BYTE,ee.OffSize=ee.BYTE,z.SID=z.USHORT,ee.SID=ee.USHORT,z.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?z.NUMBER16(i):z.NUMBER32(i)},ee.NUMBER=function(i){return z.NUMBER(i).length},z.NUMBER16=function(i){return[28,i>>8&255,i&255]},ee.NUMBER16=Ge(3),z.NUMBER32=function(i){return[29,i>>24&255,i>>16&255,i>>8&255,i&255]},ee.NUMBER32=Ge(5),z.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 l=e[o];l==="e"?n+=e[++o]==="-"?"c":"b":l==="."?n+="a":l==="-"?n+="e":n+=l}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},ee.REAL=function(i){return z.REAL(i).length},z.NAME=z.CHARARRAY,ee.NAME=ee.CHARARRAY,z.STRING=z.CHARARRAY,ee.STRING=ee.CHARARRAY,Yt.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)},Yt.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)},z.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},ee.UTF16=function(i){return i.length*2};const rs={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Yt.MACSTRING=function(i,e,t,n){const s=rs[n];if(s===void 0)return;let o="";for(let r=0;r<t;r++){const l=i.getUint8(e+r);l<=127?o+=String.fromCharCode(l):o+=s[l&127]}return o};const Yi=typeof WeakMap=="function"&&new WeakMap;let Vi;const Bp=function(i){if(!Vi){Vi={};for(let s in rs)Vi[s]=new String(s)}const e=Vi[i];if(e===void 0)return;if(Yi){const s=Yi.get(e);if(s!==void 0)return s}const t=rs[i];if(t===void 0)return;const n={};for(let s=0;s<t.length;s++)n[t.charCodeAt(s)]=s+128;return Yi&&Yi.set(e,n),n};z.MACSTRING=function(i,e){const t=Bp(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},ee.MACSTRING=function(i,e){const t=z.MACSTRING(i,e);return t!==void 0?t.length:0};function as(i){return i>=-128&&i<=127}function xp(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 Sp(i,e,t){let n=0;const s=i.length;let o=e;for(;o<s&&n<64;){const r=i[o];if(!as(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 Tp(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||as(r)&&o+1<s&&as(i[o+1]))break;++o,++n}t.push(64|n-1);for(let r=e;r<o;++r){const l=i[r];t.push(l+65536>>8&255,l+256&255)}return o}z.VARDELTAS=function(i){let e=0;const t=[];for(;e<i.length;){const n=i[e];n===0?e=xp(i,e,t):n>=-128&&n<=127?e=Sp(i,e,t):e=Tp(i,e,t)}return t},z.INDEX=function(i){let e=1;const t=[e],n=[];for(let l=0;l<i.length;l+=1){const a=z.OBJECT(i[l]);Array.prototype.push.apply(n,a),e+=a.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,z.BYTE,z.USHORT,z.UINT24,z.ULONG][o];for(let l=0;l<t.length;l+=1){const a=r(t[l]);Array.prototype.push.apply(s,a)}return Array.prototype.concat(z.Card16(i.length),z.OffSize(o),s,n)},ee.INDEX=function(i){return z.INDEX(i).length},z.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(z.OPERAND(r.value,r.type)),e=e.concat(z.OPERATOR(o))}return e},ee.DICT=function(i){return z.DICT(i).length},z.OPERATOR=function(i){return i<1200?[i]:[12,i-1200]},z.OPERAND=function(i,e){let t=[];if(Array.isArray(e))for(let n=0;n<e.length;n+=1)ie.argument(i.length===e.length,"Not enough arguments given for type"+e),t=t.concat(z.OPERAND(i[n],e[n]));else if(e==="SID")t=t.concat(z.NUMBER(i));else if(e==="offset")t=t.concat(z.NUMBER32(i));else if(e==="number")t=t.concat(z.NUMBER(i));else if(e==="real")t=t.concat(z.REAL(i));else throw new Error("Unknown operand type "+e);return t},z.OP=z.BYTE,ee.OP=ee.BYTE;const zi=typeof WeakMap=="function"&&new WeakMap;z.CHARSTRING=function(i){if(zi){const n=zi.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(z[s.type](s.value))}return zi&&zi.set(i,e),e},ee.CHARSTRING=function(i){return z.CHARSTRING(i).length},z.OBJECT=function(i){const e=z[i.type];return ie.argument(e!==void 0,"No encoding function for type "+i.type),e(i.value)},ee.OBJECT=function(i){const e=ee[i.type];return ie.argument(e!==void 0,"No sizeOf function for type "+i.type),e(i.value)},z.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],l=z[r.type];ie.argument(l!==void 0,"No encoding function for field type "+r.type+" ("+r.name+")");let a=i[r.name];a===void 0&&(a=r.value);const d=l(a);r.type==="TABLE"?(s.push(e.length),e=e.concat([0,0]),n.push(d)):e=e.concat(d)}for(let o=0;o<n.length;o+=1){const r=s[o],l=e.length;ie.argument(l<65536,"Table "+i.tableName+" too big."),e[r]=l>>8,e[r+1]=l&255,e=e.concat(n[o])}return e},ee.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=ee[s.type];ie.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},z.RECORD=z.TABLE,ee.RECORD=ee.TABLE,z.LITERAL=function(i){return i},ee.LITERAL=function(i){return i.length};function Te(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)}}}Te.prototype.encode=function(){return z.TABLE(this)},Te.prototype.sizeOf=function(){return ee.TABLE(this)};function li(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 ls(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 Wi(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 ji(i){i.format===1?Te.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(li("glyph",i.glyphs))):ie.assert(!1,"Can't create coverage table format 2 yet.")}ji.prototype=Object.create(Te.prototype),ji.prototype.constructor=ji;function Ki(i){Te.call(this,"scriptListTable",Wi("scriptRecord",i,function(e,t){const n=e.script;let s=n.defaultLangSys;return ie.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 Te("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Te("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:s.reqFeatureIndex}].concat(li("featureIndex",s.featureIndexes)))}].concat(Wi("langSys",n.langSysRecords,function(o,r){const l=o.langSys;return[{name:"langSysTag"+r,type:"TAG",value:o.tag},{name:"langSys"+r,type:"TABLE",value:new Te("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:l.reqFeatureIndex}].concat(li("featureIndex",l.featureIndexes)))}]})))}]}))}Ki.prototype=Object.create(Te.prototype),Ki.prototype.constructor=Ki;function $i(i){Te.call(this,"featureListTable",Wi("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 Te("featureTable",[{name:"featureParams",type:"USHORT",value:n.featureParams}].concat(li("lookupListIndex",n.lookupListIndexes)))}]}))}$i.prototype=Object.create(Te.prototype),$i.prototype.constructor=$i;function Xi(i,e){Te.call(this,"lookupListTable",ls("lookup",i,function(t){let n=e[t.lookupType];return ie.assert(!!n,"Unable to write GSUB lookup type "+t.lookupType+" tables."),new Te("lookupTable",[{name:"lookupType",type:"USHORT",value:t.lookupType},{name:"lookupFlag",type:"USHORT",value:t.lookupFlag}].concat(ls("subtable",t.subtables,n)))}))}Xi.prototype=Object.create(Te.prototype),Xi.prototype.constructor=Xi;const J={Table:Te,Record:Te,Coverage:ji,ScriptList:Ki,FeatureList:$i,LookupList:Xi,ushortList:li,tableList:ls,recordList:Wi};function Gr(i,e){return i.getUint8(e)}function qi(i,e){return i.getUint16(e,!1)}function Mp(i,e){return i.getInt16(e,!1)}function cs(i,e){return i.getUint32(e,!1)}function Hr(i,e){const t=i.getInt16(e,!1),n=i.getUint16(e+2,!1);return t+n/65535}function Dp(i,e){let t="";for(let n=e;n<e+4;n+=1)t+=String.fromCharCode(i.getInt8(n));return t}function kp(i,e,t){let n=0;for(let s=0;s<t;s+=1)n<<=8,n+=i.getUint8(e+s);return n}function Pp(i,e,t){const n=[];for(let s=e;s<t;s+=1)n.push(i.getUint8(s));return n}function Fp(i){let e="";for(let t=0;t<i.length;t+=1)e+=String.fromCharCode(i[t]);return e}const Rp={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=cs(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},H.prototype.parseOffset32=H.prototype.parseULong,H.prototype.parseFixed=function(){const i=Hr(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=cs(this.data,this.offset+this.relativeOffset+4);return i-=2082844800,this.relativeOffset+=8,i},H.prototype.parseVersion=function(i){const e=qi(this.data,this.offset+this.relativeOffset),t=qi(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+=Rp[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 l=n[r],a=e[l];o[l]=a.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 l=n[r],a=e[l];o[l]=a.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 l=this.parseOffset16List(),a=new Array(l.length);for(let d=0;d<l.length;d++)this.relativeOffset=r+l[d],a[d]=i.call(this);s[o]=a}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 Yr={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(Yr),langSysRecords:H.recordList({tag:H.tag,langSys:H.pointer(Yr)})})}))||[]},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();ie.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 ie.argument(i===1&&e<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:H.offset32,featureTableSubstitutionOffset:H.offset32})})||[]};const $={getByte:Gr,getCard8:Gr,getUShort:qi,getCard16:qi,getShort:Mp,getULong:cs,getFixed:Hr,getTag:Dp,getOffset:kp,getBytes:Pp,bytesToString:Fp,Parser:H};function Op(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 l=s;l<=o;l+=1)i.glyphIndexMap[l]=r,r++}}function Lp(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 $.Parser(t,n+s+14),l=new $.Parser(t,n+s+16+o*2),a=new $.Parser(t,n+s+16+o*4),d=new $.Parser(t,n+s+16+o*6);let h=n+s+16+o*8;for(let f=0;f<o-1;f+=1){let p;const u=r.parseUShort(),m=l.parseUShort(),w=a.parseShort(),A=d.parseUShort();for(let C=m;C<=u;C+=1)A!==0?(h=d.offset+d.relativeOffset-2,h+=A,h+=(C-m)*2,p=$.getUShort(t,h),p!==0&&(p=p+w&65535)):p=C+w&65535,i.glyphIndexMap[C]=p}}function Np(i,e){const t={};t.version=$.getUShort(i,e),ie.argument(t.version===0,"cmap table version should be 0."),t.numTables=$.getUShort(i,e+2);let n=-1;for(let o=t.numTables-1;o>=0;o-=1){const r=$.getUShort(i,e+4+o*8),l=$.getUShort(i,e+4+o*8+2);if(r===3&&(l===0||l===1||l===10)||r===0&&(l===0||l===1||l===2||l===3||l===4)){n=$.getULong(i,e+4+o*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");const s=new $.Parser(i,e+n);if(t.format=s.parseUShort(),t.format===12)Op(t,s);else if(t.format===4)Lp(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 _p(i,e,t){i.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function Up(i){i.segments.push({end:65535,start:65535,delta:1,offset:0})}function Qp(i){let e=!0,t;for(t=i.length-1;t>0;t-=1)if(i.get(t).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),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 J.Table("cmap",n);for(s.segments=[],t=0;t<i.length;t+=1){const u=i.get(t);for(let m=0;m<u.unicodes.length;m+=1)_p(s,u.unicodes[m],t);s.segments=s.segments.sort(function(m,w){return m.start-w.start})}Up(s);const o=s.segments.length;let r=0,l=[],a=[],d=[],h=[],f=[],p=[];for(t=0;t<o;t+=1){const u=s.segments[t];u.end<=65535&&u.start<=65535?(l=l.concat({name:"end_"+t,type:"USHORT",value:u.end}),a=a.concat({name:"start_"+t,type:"USHORT",value:u.start}),d=d.concat({name:"idDelta_"+t,type:"SHORT",value:u.delta}),h=h.concat({name:"idRangeOffset_"+t,type:"USHORT",value:u.offset}),u.glyphId!==void 0&&(f=f.concat({name:"glyph_"+t,type:"USHORT",value:u.glyphId}))):r+=1,!e&&u.glyphIndex!==void 0&&(p=p.concat({name:"cmap12Start_"+t,type:"ULONG",value:u.start}),p=p.concat({name:"cmap12End_"+t,type:"ULONG",value:u.end}),p=p.concat({name:"cmap12Glyph_"+t,type:"ULONG",value:u.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(l),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(a),s.fields=s.fields.concat(d),s.fields=s.fields.concat(h),s.fields=s.fields.concat(f),s.cmap4Length=14+l.length*2+2+a.length*2+d.length*2+h.length*2+f.length*2,!e){const u=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:u},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:p.length/3}]),s.fields=s.fields.concat(p)}return s}const Vr={parse:Np,make:Qp},Ji=[".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"],Gp=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Hp=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],It=[".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 zr(i){this.font=i}zr.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 Wr(i){this.cmap=i}Wr.prototype.charToGlyphIndex=function(i){return this.cmap.glyphIndexMap[i.codePointAt(0)]||0};function Zi(i,e){this.encoding=i,this.charset=e}Zi.prototype.charToGlyphIndex=function(i){const e=i.codePointAt(0),t=this.encoding[e];return this.charset.indexOf(t)};function ds(i){switch(i.version){case 1:this.names=It.slice();break;case 2:this.names=new Array(i.numberOfGlyphs);for(let e=0;e<i.numberOfGlyphs;e++)i.glyphNameIndex[e]<It.length?this.names[e]=It[i.glyphNameIndex[e]]:this.names[e]=i.names[i.glyphNameIndex[e]-It.length];break;case 2.5:this.names=new Array(i.numberOfGlyphs);for(let e=0;e<i.numberOfGlyphs;e++)this.names[e]=It[e+i.glyphNameIndex[e]];break;case 3:this.names=[];break;default:this.names=[];break}}ds.prototype.nameToGlyphIndex=function(i){return this.names.indexOf(i)},ds.prototype.glyphIndexToName=function(i){return this.names[i]};function Yp(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 Vp(i,e,t,n,s){i.beginPath(),i.moveTo(e,t),i.lineTo(n,s),i.stroke()}const Bt={line:Vp};function zp(i,e){let t=e||new Ie;return{configurable:!0,get:function(){return typeof t=="function"&&(t=t()),t},set:function(n){t=n}}}function Qe(i){this.bindConstructorValues(i)}Qe.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",zp(this,i.path))},Qe.prototype.addUnicode=function(i){this.unicodes.length===0&&(this.unicode=i),this.unicodes.push(i)},Qe.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Qe.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 l=n.xScale,a=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),l=a=1;else{o=this.path.commands;const h=1/this.path.unitsPerEm*t;l===void 0&&(l=h),a===void 0&&(a=h)}const d=new Ie;for(let h=0;h<o.length;h+=1){const f=o[h];f.type==="M"?d.moveTo(i+f.x*l,e+-f.y*a):f.type==="L"?d.lineTo(i+f.x*l,e+-f.y*a):f.type==="Q"?d.quadraticCurveTo(i+f.x1*l,e+-f.y1*a,i+f.x*l,e+-f.y*a):f.type==="C"?d.curveTo(i+f.x1*l,e+-f.y1*a,i+f.x2*l,e+-f.y2*a,i+f.x*l,e+-f.y*a):f.type==="Z"&&d.closePath()}return d},Qe.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 ie.argument(e.length===0,"There are still points left in the current contour."),i},Qe.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},Qe.prototype.draw=function(i,e,t,n,s){this.getPath(e,t,n,s).draw(i)},Qe.prototype.drawPoints=function(i,e,t,n){function s(d,h,f,p){const u=Math.PI*2;i.beginPath();for(let m=0;m<d.length;m+=1)i.moveTo(h+d[m].x*p,f+d[m].y*p),i.arc(h+d[m].x*p,f+d[m].y*p,2,0,u,!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=[],l=[],a=this.path;for(let d=0;d<a.commands.length;d+=1){const h=a.commands[d];h.x!==void 0&&r.push({x:h.x,y:-h.y}),h.x1!==void 0&&l.push({x:h.x1,y:-h.y1}),h.x2!==void 0&&l.push({x:h.x2,y:-h.y2})}i.fillStyle="blue",s(r,e,t,o),i.fillStyle="red",s(l,e,t,o)},Qe.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",Bt.line(i,e,-1e4,e,1e4),Bt.line(i,-1e4,t,1e4,t);const o=this.xMin||0;let r=this.yMin||0;const l=this.xMax||0;let a=this.yMax||0;const d=this.advanceWidth||0;i.strokeStyle="blue",Bt.line(i,e+o*s,-1e4,e+o*s,1e4),Bt.line(i,e+l*s,-1e4,e+l*s,1e4),Bt.line(i,-1e4,t+-r*s,1e4,t+-r*s),Bt.line(i,-1e4,t+-a*s,1e4,t+-a*s),i.strokeStyle="green",Bt.line(i,e+d*s,-1e4,e+d*s,1e4)};function en(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 hs(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}hs.prototype.get=function(i){return typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]()),this.glyphs[i]},hs.prototype.push=function(i,e){this.glyphs[i]=e,this.length++};function Wp(i,e){return new Qe({index:e,font:i})}function jp(i,e,t,n,s,o){return function(){const r=new Qe({index:e,font:i});return r.path=function(){t(r,n,s);const l=o(i.glyphs,r);return l.unitsPerEm=i.unitsPerEm,l},en(r,"xMin","_xMin"),en(r,"xMax","_xMax"),en(r,"yMin","_yMin"),en(r,"yMax","_yMax"),r}}function Kp(i,e,t,n){return function(){const s=new Qe({index:e,font:i});return s.path=function(){const o=t(i,s,n);return o.unitsPerEm=i.unitsPerEm,o},s}}const Vt={GlyphSet:hs,glyphLoader:Wp,ttfGlyphLoader:jp,cffGlyphLoader:Kp};function jr(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(!jr(i[t],e[t]))return!1;return!0}else return!1}function us(i){let e;return i.length<1240?e=107:i.length<33900?e=1131:e=32768,e}function ut(i,e,t){const n=[],s=[],o=$.getCard16(i,e);let r,l;if(o!==0){const a=$.getByte(i,e+2);r=e+(o+1)*a+2;let d=e+3;for(let h=0;h<o+1;h+=1)n.push($.getOffset(i,d,a)),d+=a;l=r+n[o]}else l=e+2;for(let a=0;a<n.length-1;a+=1){let d=$.getBytes(i,r+n[a],r+n[a+1]);t&&(d=t(d)),s.push(d)}return{objects:s,startOffset:e,endOffset:l}}function $p(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 Xp(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 $p(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 qp(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 Kr(i,e,t){e=e!==void 0?e:0;const n=new $.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(Xp(n,r))}return qp(s)}function ci(i,e){return e<=390?e=Ji[e]:e=i[e-391],e}function $r(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 l=[];l.length=r.type.length;for(let a=0;a<r.type.length;a++)s=i[r.op]!==void 0?i[r.op][a]:void 0,s===void 0&&(s=r.value!==void 0&&r.value[a]!==void 0?r.value[a]:null),r.type[a]==="SID"&&(s=ci(t,s)),l[a]=s;n[r.name]=l}else s=i[r.op],s===void 0&&(s=r.value!==void 0?r.value:null),r.type==="SID"&&(s=ci(t,s)),n[r.name]=s}return n}function Jp(i,e){const t={};return t.formatMajor=$.getCard8(i,e),t.formatMinor=$.getCard8(i,e+1),t.size=$.getCard8(i,e+2),t.offsetSize=$.getCard8(i,e+3),t.startOffset=e,t.endOffset=e+4,t}const Xr=[{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"}],qr=[{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 Zp(i,e){const t=Kr(i,0,i.byteLength);return $r(t,Xr,e)}function Jr(i,e,t,n){const s=Kr(i,e,t);return $r(s,qr,n)}function Zr(i,e,t,n){const s=[];for(let o=0;o<t.length;o+=1){const r=new DataView(new Uint8Array(t[o]).buffer),l=Zp(r,n);l._subrs=[],l._subrsBias=0;const a=l.private[0],d=l.private[1];if(a!==0&&d!==0){const h=Jr(i,d+e,a,n);if(l._defaultWidthX=h.defaultWidthX,l._nominalWidthX=h.nominalWidthX,h.subrs!==0){const f=d+h.subrs,p=ut(i,f+e);l._subrs=p.objects,l._subrsBias=us(l._subrs)}l._privateDict=h}s.push(l)}return s}function eg(i,e,t,n){let s,o;const r=new $.Parser(i,e);t-=1;const l=[".notdef"],a=r.parseCard8();if(a===0)for(let d=0;d<t;d+=1)s=r.parseSID(),l.push(ci(n,s));else if(a===1)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard8();for(let d=0;d<=o;d+=1)l.push(ci(n,s)),s+=1}else if(a===2)for(;l.length<=t;){s=r.parseSID(),o=r.parseCard16();for(let d=0;d<=o;d+=1)l.push(ci(n,s)),s+=1}else throw new Error("Unknown charset format "+a);return l}function tg(i,e,t){let n;const s={},o=new $.Parser(i,e),r=o.parseCard8();if(r===0){const l=o.parseCard8();for(let a=0;a<l;a+=1)n=o.parseCard8(),s[n]=a}else if(r===1){const l=o.parseCard8();n=1;for(let a=0;a<l;a+=1){const d=o.parseCard8(),h=o.parseCard8();for(let f=d;f<=d+h;f+=1)s[f]=n,n+=1}}else throw new Error("Unknown encoding format "+r);return new Zi(s,t)}function ig(i,e,t){let n,s,o,r;const l=new Ie,a=[];let d=0,h=!1,f=!1,p=0,u=0,m,w,A,C;if(i.isCIDFont){const I=i.tables.cff.topDict._fdSelect[e.index],B=i.tables.cff.topDict._fdArray[I];m=B._subrs,w=B._subrsBias,A=B._defaultWidthX,C=B._nominalWidthX}else m=i.tables.cff.topDict._subrs,w=i.tables.cff.topDict._subrsBias,A=i.tables.cff.topDict._defaultWidthX,C=i.tables.cff.topDict._nominalWidthX;let v=A;function S(I,B){f&&l.closePath(),l.moveTo(I,B),f=!0}function D(){let I;I=a.length%2!==0,I&&!h&&(v=a.shift()+C),d+=a.length>>1,a.length=0,h=!0}function N(I){let B,g,P,x,k,_,G,F,E,y,b,T,R=0;for(;R<I.length;){let O=I[R];switch(R+=1,O){case 1:D();break;case 3:D();break;case 4:a.length>1&&!h&&(v=a.shift()+C,h=!0),u+=a.pop(),S(p,u);break;case 5:for(;a.length>0;)p+=a.shift(),u+=a.shift(),l.lineTo(p,u);break;case 6:for(;a.length>0&&(p+=a.shift(),l.lineTo(p,u),a.length!==0);)u+=a.shift(),l.lineTo(p,u);break;case 7:for(;a.length>0&&(u+=a.shift(),l.lineTo(p,u),a.length!==0);)p+=a.shift(),l.lineTo(p,u);break;case 8:for(;a.length>0;)n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+a.shift(),l.curveTo(n,s,o,r,p,u);break;case 10:k=a.pop()+w,_=m[k],_&&N(_);break;case 11:return;case 12:switch(O=I[R],R+=1,O){case 35:n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r+a.shift(),E=G+a.shift(),y=F+a.shift(),b=E+a.shift(),T=y+a.shift(),p=b+a.shift(),u=T+a.shift(),a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,b,T,p,u);break;case 34:n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r,E=G+a.shift(),y=r,b=E+a.shift(),T=u,p=b+a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,b,T,p,u);break;case 36:n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r,E=G+a.shift(),y=r,b=E+a.shift(),T=y+a.shift(),p=b+a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,b,T,p,u);break;case 37:n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),G=o+a.shift(),F=r+a.shift(),E=G+a.shift(),y=F+a.shift(),b=E+a.shift(),T=y+a.shift(),Math.abs(b-p)>Math.abs(T-u)?p=b+a.shift():u=T+a.shift(),l.curveTo(n,s,o,r,G,F),l.curveTo(E,y,b,T,p,u);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+O),a.length=0}break;case 14:a.length>0&&!h&&(v=a.shift()+C,h=!0),f&&(l.closePath(),f=!1);break;case 18:D();break;case 19:case 20:D(),R+=d+7>>3;break;case 21:a.length>2&&!h&&(v=a.shift()+C,h=!0),u+=a.pop(),p+=a.pop(),S(p,u);break;case 22:a.length>1&&!h&&(v=a.shift()+C,h=!0),p+=a.pop(),S(p,u);break;case 23:D();break;case 24:for(;a.length>2;)n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+a.shift(),l.curveTo(n,s,o,r,p,u);p+=a.shift(),u+=a.shift(),l.lineTo(p,u);break;case 25:for(;a.length>6;)p+=a.shift(),u+=a.shift(),l.lineTo(p,u);n=p+a.shift(),s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+a.shift(),l.curveTo(n,s,o,r,p,u);break;case 26:for(a.length%2&&(p+=a.shift());a.length>0;)n=p,s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o,u=r+a.shift(),l.curveTo(n,s,o,r,p,u);break;case 27:for(a.length%2&&(u+=a.shift());a.length>0;)n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r,l.curveTo(n,s,o,r,p,u);break;case 28:B=I[R],g=I[R+1],a.push((B<<24|g<<16)>>16),R+=2;break;case 29:k=a.pop()+i.gsubrsBias,_=i.gsubrs[k],_&&N(_);break;case 30:for(;a.length>0&&(n=p,s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u),a.length!==0);)n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),u=r+a.shift(),p=o+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u);break;case 31:for(;a.length>0&&(n=p+a.shift(),s=u,o=n+a.shift(),r=s+a.shift(),u=r+a.shift(),p=o+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u),a.length!==0);)n=p,s=u+a.shift(),o=n+a.shift(),r=s+a.shift(),p=o+a.shift(),u=r+(a.length===1?a.shift():0),l.curveTo(n,s,o,r,p,u);break;default:O<32?console.log("Glyph "+e.index+": unknown operator "+O):O<247?a.push(O-139):O<251?(B=I[R],R+=1,a.push((O-247)*256+B+108)):O<255?(B=I[R],R+=1,a.push(-(O-251)*256-B-108)):(B=I[R],g=I[R+1],P=I[R+2],x=I[R+3],R+=4,a.push((B<<24|g<<16|P<<8|x)/65536))}}}return N(t),e.advanceWidth=v,l}function ng(i,e,t,n){const s=[];let o;const r=new $.Parser(i,e),l=r.parseCard8();if(l===0)for(let a=0;a<t;a++){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(l===3){const a=r.parseCard16();let d=r.parseCard16();if(d!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+d);let h;for(let f=0;f<a;f++){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(;d<h;d++)s.push(o);d=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 "+l);return s}function sg(i,e,t){t.tables.cff={};const n=Jp(i,e),s=ut(i,n.endOffset,$.bytesToString),o=ut(i,s.endOffset),r=ut(i,o.endOffset,$.bytesToString),l=ut(i,r.endOffset);t.gsubrs=l.objects,t.gsubrsBias=us(t.gsubrs);const a=Zr(i,e,o.objects,r.objects);if(a.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+a.length);const d=a[0];if(t.tables.cff.topDict=d,d._privateDict&&(t.defaultWidthX=d._privateDict.defaultWidthX,t.nominalWidthX=d._privateDict.nominalWidthX),d.ros[0]!==void 0&&d.ros[1]!==void 0&&(t.isCIDFont=!0),t.isCIDFont){let m=d.fdArray,w=d.fdSelect;if(m===0||w===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");m+=e;const A=ut(i,m),C=Zr(i,e,A.objects,r.objects);d._fdArray=C,w+=e,d._fdSelect=ng(i,w,t.numGlyphs,C.length)}const h=e+d.private[1],f=Jr(i,h,d.private[0],r.objects);if(t.defaultWidthX=f.defaultWidthX,t.nominalWidthX=f.nominalWidthX,f.subrs!==0){const m=h+f.subrs,w=ut(i,m);t.subrs=w.objects,t.subrsBias=us(t.subrs)}else t.subrs=[],t.subrsBias=0;const p=ut(i,e+d.charStrings);t.nGlyphs=p.objects.length;const u=eg(i,e+d.charset,t.nGlyphs,r.objects);d.encoding===0?t.cffEncoding=new Zi(Gp,u):d.encoding===1?t.cffEncoding=new Zi(Hp,u):t.cffEncoding=tg(i,e+d.encoding,u),t.encoding=t.encoding||t.cffEncoding,t.glyphs=new Vt.GlyphSet(t);for(let m=0;m<t.nGlyphs;m+=1){const w=p.objects[m];t.glyphs.push(m,Vt.cffGlyphLoader(t,m,ig,w))}}function ea(i,e){let t,n=Ji.indexOf(i);return n>=0&&(t=n),n=e.indexOf(i),n>=0?t=n+Ji.length:(t=Ji.length+e.length,e.push(i)),t}function og(){return new J.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 rg(i){const e=new J.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 ta(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&&!jr(r,o.value)&&(o.type==="SID"&&(r=ea(r,t)),n[o.op]={name:o.name,type:o.type,value:r})}return n}function ia(i,e){const t=new J.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=ta(Xr,i,e),t}function na(i){const e=new J.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:i}],e}function ag(i){const e=new J.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 lg(){return new J.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function cg(i,e){const t=new J.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let n=0;n<i.length;n+=1){const s=i[n],o=ea(s,e);t.fields.push({name:"glyph_"+n,type:"SID",value:o})}return t}function dg(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,l,a=t.commands[o];if(a.type==="Q"){const d=.3333333333333333,h=2/3;a={type:"C",x:a.x,y:a.y,x1:d*n+h*a.x1,y1:d*s+h*a.y1,x2:d*a.x+h*a.x1,y2:d*a.y+h*a.y1}}if(a.type==="M")r=Math.round(a.x-n),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rmoveto",type:"OP",value:21}),n=Math.round(a.x),s=Math.round(a.y);else if(a.type==="L")r=Math.round(a.x-n),l=Math.round(a.y-s),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rlineto",type:"OP",value:5}),n=Math.round(a.x),s=Math.round(a.y);else if(a.type==="C"){const d=Math.round(a.x1-n),h=Math.round(a.y1-s),f=Math.round(a.x2-a.x1),p=Math.round(a.y2-a.y1);r=Math.round(a.x-a.x2),l=Math.round(a.y-a.y2),e.push({name:"dx1",type:"NUMBER",value:d}),e.push({name:"dy1",type:"NUMBER",value:h}),e.push({name:"dx2",type:"NUMBER",value:f}),e.push({name:"dy2",type:"NUMBER",value:p}),e.push({name:"dx",type:"NUMBER",value:r}),e.push({name:"dy",type:"NUMBER",value:l}),e.push({name:"rrcurveto",type:"OP",value:8}),n=Math.round(a.x),s=Math.round(a.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function hg(i){const e=new J.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let t=0;t<i.length;t+=1){const n=i.get(t),s=dg(n);e.charStrings.push({name:n.name,type:"CHARSTRING",value:s})}return e}function ug(i,e){const t=new J.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return t.dict=ta(qr,i,e),t}function fg(i,e){const t=new J.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 l;for(let f=1;f<i.length;f+=1)l=i.get(f),r.push(l.name);const a=[];t.header=og(),t.nameIndex=rg([e.postScriptName]);let d=ia(s,a);t.topDictIndex=na(d),t.globalSubrIndex=lg(),t.charsets=cg(r,a),t.charStringsIndex=hg(i),t.privateDict=ug(o,a),t.stringIndex=ag(a);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(),d=ia(s,a),t.topDictIndex=na(d),t}const sa={parse:sg,make:fg};function pg(i,e){const t={},n=new $.Parser(i,e);return t.version=n.parseVersion(),t.fontRevision=Math.round(n.parseFixed()*1e3)/1e3,t.checkSumAdjustment=n.parseULong(),t.magicNumber=n.parseULong(),ie.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 gg(i){const e=Math.round(new Date().getTime()/1e3)+2082844800;let t=e;return i.createdTimestamp&&(t=i.createdTimestamp+2082844800),new J.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 oa={parse:pg,make:gg};function mg(i,e){const t={},n=new $.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 Ag(i){return new J.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 ra={parse:mg,make:Ag};function yg(i,e,t,n,s){let o,r;const l=new $.Parser(i,e);for(let a=0;a<n;a+=1){a<t&&(o=l.parseUShort(),r=l.parseShort());const d=s.get(a);d.advanceWidth=o,d.leftSideBearing=r}}function Cg(i){const e=new J.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 aa={parse:yg,make:Cg};function Eg(i){const e=new J.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 wg(i,e){const t=new $.Parser(i,e),n=t.parseULong();ie.argument(n===1,"Unsupported ltag table version."),t.skip("uLong",1);const s=t.parseULong(),o=[];for(let r=0;r<s;r++){let l="";const a=e+t.parseUShort(),d=t.parseUShort();for(let h=a;h<a+d;++h)l+=String.fromCharCode(i.getInt8(h));o.push(l)}return o}const la={make:Eg,parse:wg};function bg(i,e){const t={},n=new $.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 vg(i){return new J.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:i}])}const ca={parse:bg,make:vg},da=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],ha={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"},Ig={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},ua={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 Bg(i,e,t){switch(i){case 0:if(e===65535)return"und";if(t)return t[e];break;case 1:return ha[e];case 3:return ua[e]}}const fs="utf-16",xg={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"},Sg={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 fa(i,e,t){switch(i){case 0:return fs;case 1:return Sg[t]||xg[e];case 3:if(e===1||e===10)return fs;break}}function Tg(i,e,t){const n={},s=new $.Parser(i,e),o=s.parseUShort(),r=s.parseUShort(),l=s.offset+s.parseUShort();for(let a=0;a<r;a++){const d=s.parseUShort(),h=s.parseUShort(),f=s.parseUShort(),p=s.parseUShort(),u=da[p]||p,m=s.parseUShort(),w=s.parseUShort(),A=Bg(d,f,t),C=fa(d,h,f);if(C!==void 0&&A!==void 0){let v;if(C===fs?v=Yt.UTF16(i,l+w,m):v=Yt.MACSTRING(i,l+w,m,C),v){let S=n[u];S===void 0&&(S=n[u]={}),S[A]=v}}}return o===1&&s.parseUShort(),n}function ps(i){const e={};for(let t in i)e[i[t]]=parseInt(t);return e}function pa(i,e,t,n,s,o){return new J.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 Mg(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 ga(i,e){let t=Mg(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 Dg(i,e){let t;const n=[],s={},o=ps(da);for(let f in i){let p=o[f];if(p===void 0&&(p=f),t=parseInt(p),isNaN(t))throw new Error('Name table entry "'+f+'" does not exist, see nameTableNames for complete list.');s[t]=i[f],n.push(t)}const r=ps(ha),l=ps(ua),a=[],d=[];for(let f=0;f<n.length;f++){t=n[f];const p=s[t];for(let u in p){const m=p[u];let w=1,A=r[u],C=Ig[A];const v=fa(w,C,A);let S=z.MACSTRING(m,v);S===void 0&&(w=0,A=e.indexOf(u),A<0&&(A=e.length,e.push(u)),C=4,S=z.UTF16(m));const D=ga(S,d);a.push(pa(w,C,A,t,S.length,D));const N=l[u];if(N!==void 0){const I=z.UTF16(m),B=ga(I,d);a.push(pa(3,1,N,t,I.length,B))}}}a.sort(function(f,p){return f.platformID-p.platformID||f.encodingID-p.encodingID||f.languageID-p.languageID||f.nameID-p.nameID});const h=new J.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:a.length},{name:"stringOffset",type:"USHORT",value:6+a.length*12}]);for(let f=0;f<a.length;f++)h.fields.push({name:"record_"+f,type:"RECORD",value:a[f]});return h.fields.push({name:"strings",type:"LITERAL",value:d}),h}const ma={parse:Tg,make:Dg},gs=[{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 kg(i){for(let e=0;e<gs.length;e+=1){const t=gs[e];if(i>=t.begin&&i<t.end)return e}return-1}function Pg(i,e){const t={},n=new $.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 Fg(i){return new J.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 ms={parse:Pg,make:Fg,unicodeRanges:gs,getUnicodeRange:kg};function Rg(i,e){const t={},n=new $.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=It.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]>=It.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 Og(){return new J.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 Aa={parse:Rg,make:Og},He=new Array(9);He[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()};ie.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},He[2]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),sequences:this.parseListOfLists()}},He[3]=function(){const e=this.parseUShort();return ie.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(H.coverage),alternateSets:this.parseListOfLists()}},He[4]=function(){const e=this.parseUShort();return ie.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 zt={sequenceIndex:H.uShort,lookupListIndex:H.uShort};He[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,zt)}})};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,zt)}})};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,zt)}}ie.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},He[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(zt)}})};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(zt)}})};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(zt)};ie.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},He[7]=function(){const e=this.parseUShort();ie.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:He[t].call(n)}},He[8]=function(){const e=this.parseUShort();return ie.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 Lg(i,e){e=e||0;const t=new H(i,e),n=t.parseVersion(1);return ie.argument(n===1||n===1.1,"Unsupported GSUB table version."),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(He)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(He),variations:t.parseFeatureVariationsList()}}const tn=new Array(9);tn[1]=function(e){return e.substFormat===1?new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.ushortList("substitute",e.substitute)))},tn[3]=function(e){return ie.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.tableList("altSet",e.alternateSets,function(t){return new J.Table("alternateSetTable",J.ushortList("alternate",t))})))},tn[4]=function(e){return ie.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.tableList("ligSet",e.ligatureSets,function(t){return new J.Table("ligatureSetTable",J.tableList("ligature",t,function(n){return new J.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:n.ligGlyph}].concat(J.ushortList("component",n.components,n.components.length+1)))}))})))};function Ng(i){return new J.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new J.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new J.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new J.LookupList(i.lookups,tn)}])}const ya={parse:Lg,make:Ng};function _g(i,e){const t=new $.Parser(i,e),n=t.parseULong();ie.argument(n===1,"Unsupported META table version."),t.parseULong(),t.parseULong();const s=t.parseULong(),o={};for(let r=0;r<s;r++){const l=t.parseTag(),a=t.parseULong(),d=t.parseULong(),h=Yt.UTF8(i,e+a,d);o[l]=h}return o}function Ug(i){const e=Object.keys(i).length;let t="";const n=16+e*12,s=new J.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 Ca={parse:_g,make:Ug};function Ea(i){return Math.log(i)/Math.log(2)|0}function As(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 wa(i,e,t,n){return new J.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 ba(i){const e=new J.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,Ea(e.numTables));e.searchRange=16*t,e.entrySelector=Ea(t),e.rangeShift=e.numTables*16-e.searchRange;const n=[],s=[];let o=e.sizeOf()+wa().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 l=i[r];ie.argument(l.tableName.length===4,"Table name"+l.tableName+" is invalid.");const a=l.sizeOf(),d=wa(l.tableName,As(l.encode()),o,a);for(n.push({name:d.tag+" Table Record",type:"RECORD",value:d}),s.push({name:l.tableName+" table",type:"RECORD",value:l}),o+=a,ie.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,l){return r.value.tag>l.value.tag?1:-1}),e.fields=e.fields.concat(n),e.fields=e.fields.concat(s),e}function va(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 Qg(i){let e=0;for(let t=0;t<i.length;t+=1)e+=i[t];return e/i.length}function Gg(i){const e=[],t=[],n=[],s=[],o=[],r=[],l=[];let a,d=0,h=0,f=0,p=0,u=0;for(let M=0;M<i.glyphs.length;M+=1){const Q=i.glyphs.get(M),Y=Q.unicode|0;if(isNaN(Q.advanceWidth))throw new Error("Glyph "+Q.name+" ("+M+"): advanceWidth is not a number.");(a>Y||a===void 0)&&Y>0&&(a=Y),d<Y&&(d=Y);const W=ms.getUnicodeRange(Y);if(W<32)h|=1<<W;else if(W<64)f|=1<<W-32;else if(W<96)p|=1<<W-64;else if(W<123)u|=1<<W-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Q.name===".notdef")continue;const q=Q.getMetrics();e.push(q.xMin),t.push(q.yMin),n.push(q.xMax),s.push(q.yMax),r.push(q.leftSideBearing),l.push(q.rightSideBearing),o.push(Q.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:Qg(o),minLeftSideBearing:Math.min.apply(null,r),maxLeftSideBearing:Math.max.apply(null,r),minRightSideBearing:Math.min.apply(null,l)};m.ascender=i.ascender,m.descender=i.descender;const w=oa.make({flags:3,unitsPerEm:i.unitsPerEm,xMin:m.xMin,yMin:m.yMin,xMax:m.xMax,yMax:m.yMax,lowestRecPPEM:3,createdTimestamp:i.createdTimestamp}),A=ra.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}),C=ca.make(i.glyphs.length),v=ms.make({xAvgCharWidth:Math.round(m.advanceWidthAvg),usWeightClass:i.tables.os2.usWeightClass,usWidthClass:i.tables.os2.usWidthClass,usFirstCharIndex:a,usLastCharIndex:d,ulUnicodeRange1:h,ulUnicodeRange2:f,ulUnicodeRange3:p,ulUnicodeRange4:u,fsSelection:i.tables.os2.fsSelection,sTypoAscender:m.ascender,sTypoDescender:m.descender,sTypoLineGap:0,usWinAscent:m.yMax,usWinDescent:Math.abs(m.yMin),ulCodePageRange1:1,sxHeight:va(i,"xyvw",{yMax:Math.round(m.ascender/2)}).yMax,sCapHeight:va(i,"HIKLEFJMNTZBDPRAGOQSUVWXY",m).yMax,usDefaultChar:i.hasChar(" ")?32:0,usBreakChar:i.hasChar(" ")?32:0}),S=aa.make(i.glyphs),D=Vr.make(i.glyphs),N=i.getEnglishName("fontFamily"),I=i.getEnglishName("fontSubfamily"),B=N+" "+I;let g=i.getEnglishName("postScriptName");g||(g=N.replace(/\s/g,"")+"-"+I);const P={};for(let M in i.names)P[M]=i.names[M];P.uniqueID||(P.uniqueID={en:i.getEnglishName("manufacturer")+":"+B}),P.postScriptName||(P.postScriptName={en:g}),P.preferredFamily||(P.preferredFamily=i.names.fontFamily),P.preferredSubfamily||(P.preferredSubfamily=i.names.fontSubfamily);const x=[],k=ma.make(P,x),_=x.length>0?la.make(x):void 0,G=Aa.make(),F=sa.make(i.glyphs,{version:i.getEnglishName("version"),fullName:B,familyName:N,weightName:I,postScriptName:g,unitsPerEm:i.unitsPerEm,fontBBox:[0,m.yMin,m.ascender,m.advanceWidthMax]}),E=i.metas&&Object.keys(i.metas).length>0?Ca.make(i.metas):void 0,y=[w,A,C,v,k,D,G,F,S];_&&y.push(_),i.tables.gsub&&y.push(ya.make(i.tables.gsub)),E&&y.push(E);const b=ba(y),T=b.encode(),R=As(T),O=b.fields;let L=!1;for(let M=0;M<O.length;M+=1)if(O[M].name==="head table"){O[M].value.checkSumAdjustment=2981146554-R,L=!0;break}if(!L)throw new Error("Could not find head table with checkSum to adjust.");return b}const Hg={make:ba,fontToTable:Gg,computeCheckSum:As};function ys(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 Ia(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 Ba(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 di(i,e){this.font=i,this.tableName=e}di.prototype={searchTag:ys,binSearch:Ia,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=ys(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=ys(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,l=this.font.tables[this.tableName].features;for(let a=0;a<r.length;a++)if(o=l[r[a]],o.tag===t)return o.feature;if(n){const a=l.length;return ie.assert(a===0||t>=l[a-1].tag,"Features must be added in alphabetical order."),o={tag:t,feature:{params:0,lookupListIndexes:[]}},l.push(o),r.push(a),o.feature}}},getLookupTables:function(i,e,t,n,s){const o=this.getFeatureTable(i,e,t,s),r=[];if(o){let l;const a=o.lookupListIndexes,d=this.font.tables[this.tableName].lookups;for(let h=0;h<a.length;h++)l=d[a[h]],l.lookupType===n&&r.push(l);if(r.length===0&&s){l={lookupType:n,lookupFlag:0,subtables:[],markFilteringSet:void 0};const h=d.length;return d.push(l),a.push(h),[l]}}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=Ba(i.ranges,e);return t?t.classId:0}},getCoverageIndex:function(i,e){switch(i.format){case 1:const t=Ia(i.glyphs,e);return t>=0?t:-1;case 2:const n=Ba(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 l=o;l<=r;l++)e.push(l)}return e}}};function hi(i){di.call(this,i,"gpos")}hi.prototype=di.prototype,hi.prototype.init=function(){const i=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(i)},hi.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],l=this.getCoverageIndex(r.coverage,e);if(!(l<0))switch(r.posFormat){case 1:let a=r.pairSets[l];for(let p=0;p<a.length;p++){let u=a[p];if(u.secondGlyph===t)return u.value1&&u.value1.xAdvance||0}break;case 2:const d=this.getGlyphClass(r.classDef1,e),h=this.getGlyphClass(r.classDef2,t),f=r.classRecords[d][h];return f.value1&&f.value1.xAdvance||0}}}return 0},hi.prototype.getKerningTables=function(i,e){if(this.font.tables.gpos)return this.getLookupTables(i,e,"kern",2)};function Ye(i){di.call(this,i,"gsub")}function Yg(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 xa(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}Ye.prototype=di.prototype,Ye.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ye.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 l=0;l<r.length;l++){const a=r[l],d=this.expandCoverage(a.coverage);let h;if(a.substFormat===1){const f=a.deltaGlyphId;for(h=0;h<d.length;h++){const p=d[h];n.push({sub:p,by:p+f})}}else{const f=a.substitute;for(h=0;h<d.length;h++)n.push({sub:d[h],by:f[h]})}}}return n},Ye.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 l=0;l<r.length;l++){const a=r[l],d=this.expandCoverage(a.coverage),h=a.alternateSets;for(let f=0;f<d.length;f++)n.push({sub:d[f],by:h[f]})}}return n},Ye.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 l=0;l<r.length;l++){const a=r[l],d=this.expandCoverage(a.coverage),h=a.ligatureSets;for(let f=0;f<d.length;f++){const p=d[f],u=h[f];for(let m=0;m<u.length;m++){const w=u[m];n.push({sub:[p].concat(w.components),by:w.ligGlyph})}}}}return n},Ye.prototype.addSingle=function(i,e,t,n){const s=this.getLookupTables(t,n,i,1,!0)[0],o=xa(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.substitute.splice(l,0,0)),o.substitute[l]=e.by},Ye.prototype.addAlternate=function(i,e,t,n){const s=this.getLookupTables(t,n,i,3,!0)[0],o=xa(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub;let l=this.binSearch(o.coverage.glyphs,r);l<0&&(l=-1-l,o.coverage.glyphs.splice(l,0,r),o.alternateSets.splice(l,0,0)),o.alternateSets[l]=e.by},Ye.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),ie.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const r=e.sub[0],l=e.sub.slice(1),a={ligGlyph:e.by,components:l};let d=this.binSearch(o.coverage.glyphs,r);if(d>=0){const h=o.ligatureSets[d];for(let f=0;f<h.length;f++)if(Yg(h[f].components,l))return;h.push(a)}else d=-1-d,o.coverage.glyphs.splice(d,0,r),o.ligatureSets.splice(d,0,[a])},Ye.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)}},Ye.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 Vg(){return typeof window<"u"}function zg(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 Wg(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 Wt(i,e){if(!i)throw e}function Sa(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 jg(i,e,t){const n=new $.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 a=0;a<i.numberOfContours;a+=1)r.push(n.parseUShort());i.instructionLength=n.parseUShort(),i.instructions=[];for(let a=0;a<i.instructionLength;a+=1)i.instructions.push(n.parseByte());const l=r[r.length-1]+1;s=[];for(let a=0;a<l;a+=1)if(o=n.parseByte(),s.push(o),(o&8)>0){const d=n.parseByte();for(let h=0;h<d;h+=1)s.push(o),a+=1}if(ie.argument(s.length===l,"Bad flags."),r.length>0){const a=[];let d;if(l>0){for(let p=0;p<l;p+=1)o=s[p],d={},d.onCurve=!!(o&1),d.lastPointOfContour=r.indexOf(p)>=0,a.push(d);let h=0;for(let p=0;p<l;p+=1)o=s[p],d=a[p],d.x=Sa(n,o,h,2,16),h=d.x;let f=0;for(let p=0;p<l;p+=1)o=s[p],d=a[p],d.y=Sa(n,o,f,4,32),f=d.y}i.points=a}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 l={glyphIndex:n.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(l.dx=n.parseShort(),l.dy=n.parseShort()):l.matchedPoints=[n.parseUShort(),n.parseUShort()]:(s&2)>0?(l.dx=n.parseChar(),l.dy=n.parseChar()):l.matchedPoints=[n.parseByte(),n.parseByte()],(s&8)>0?l.xScale=l.yScale=n.parseF2Dot14():(s&64)>0?(l.xScale=n.parseF2Dot14(),l.yScale=n.parseF2Dot14()):(s&128)>0&&(l.xScale=n.parseF2Dot14(),l.scale01=n.parseF2Dot14(),l.scale10=n.parseF2Dot14(),l.yScale=n.parseF2Dot14()),i.components.push(l),r=!!(s&32)}if(s&256){i.instructionLength=n.parseUShort(),i.instructions=[];for(let l=0;l<i.instructionLength;l+=1)i.instructions.push(n.parseByte())}}}function Cs(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 Kg(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 ie.argument(t.length===0,"There are still points left in the current contour."),e}function Ta(i){const e=new Ie;if(!i)return e;const t=Kg(i);for(let n=0;n<t.length;++n){const s=t[n];let o=null,r=s[s.length-1],l=s[0];if(r.onCurve)e.moveTo(r.x,r.y);else if(l.onCurve)e.moveTo(l.x,l.y);else{const a={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5};e.moveTo(a.x,a.y)}for(let a=0;a<s.length;++a)if(o=r,r=l,l=s[(a+1)%s.length],r.onCurve)e.lineTo(r.x,r.y);else{let d=l;o.onCurve||((r.x+o.x)*.5,(r.y+o.y)*.5),l.onCurve||(d={x:(r.x+l.x)*.5,y:(r.y+l.y)*.5}),e.quadraticCurveTo(r.x,r.y,d.x,d.y)}e.closePath()}return e}function $g(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=Cs(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 l=s.points[n.matchedPoints[1]];const a={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};l=Cs([l],a)[0],a.dx=r.x-l.x,a.dy=r.y-l.y,o=Cs(s.points,a)}e.points=e.points.concat(o)}}return Ta(e.points)}function Xg(i,e,t,n){const s=new Vt.GlyphSet(n);for(let o=0;o<t.length-1;o+=1){const r=t[o],l=t[o+1];r!==l?s.push(o,Vt.ttfGlyphLoader(n,o,jg,i,e+r,$g)):s.push(o,Vt.glyphLoader(n,o))}return s}const Ma={getPath:Ta,parse:Xg};let Da,xt,ka,Es;function Pa(i){this.font=i,this.getCommands=function(e){return Ma.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function qg(i){return i}function Fa(i){return Math.sign(i)*Math.round(Math.abs(i))}function Jg(i){return Math.sign(i)*Math.round(Math.abs(i*2))/2}function Zg(i){return Math.sign(i)*(Math.round(Math.abs(i)+.5)-.5)}function em(i){return Math.sign(i)*Math.ceil(Math.abs(i))}function tm(i){return Math.sign(i)*Math.floor(Math.abs(i))}const Ra=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},Je={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,l,a,d,h;if(!n||n===this){if(s=i.xo-e.xo,o=i.xo-t.xo,a=e.x-e.xo,d=t.x-t.xo,r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){i.x=i.xo+(a+d)/2;return}i.x=i.xo+(a*l+d*r)/h;return}if(s=n.distance(i,e,!0,!0),o=n.distance(i,t,!0,!0),a=n.distance(e,e,!1,!0),d=n.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){Je.setRelative(i,i,(a+d)/2,n,!0);return}Je.setRelative(i,i,(a*l+d*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,l=o+t*n.x,a=r+t*n.y;i.x=l+(i.y-a)/n.normalSlope},slope:0,touch:function(i){i.xTouched=!0},touched:function(i){return i.xTouched},untouch:function(i){i.xTouched=!1}},it={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,l,a,d,h;if(!n||n===this){if(s=i.yo-e.yo,o=i.yo-t.yo,a=e.y-e.yo,d=t.y-t.yo,r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){i.y=i.yo+(a+d)/2;return}i.y=i.yo+(a*l+d*r)/h;return}if(s=n.distance(i,e,!0,!0),o=n.distance(i,t,!0,!0),a=n.distance(e,e,!1,!0),d=n.distance(t,t,!1,!0),r=Math.abs(s),l=Math.abs(o),h=r+l,h===0){it.setRelative(i,i,(a+d)/2,n,!0);return}it.setRelative(i,i,(a*l+d*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,l=o+t*n.x,a=r+t*n.y;i.y=a+n.normalSlope*(i.x-l)},slope:Number.POSITIVE_INFINITY,touch:function(i){i.yTouched=!0},touched:function(i){return i.yTouched},untouch:function(i){i.yTouched=!1}};Object.freeze(Je),Object.freeze(it);function ui(i,e){this.x=i,this.y=e,this.axis=void 0,this.slope=e/i,this.normalSlope=-i/e,Object.freeze(this)}ui.prototype.distance=function(i,e,t,n){return this.x*Je.distance(i,e,t,n)+this.y*it.distance(i,e,t,n)},ui.prototype.interpolate=function(i,e,t,n){let s,o,r,l,a,d,h;if(r=n.distance(i,e,!0,!0),l=n.distance(i,t,!0,!0),s=n.distance(e,e,!1,!0),o=n.distance(t,t,!1,!0),a=Math.abs(r),d=Math.abs(l),h=a+d,h===0){this.setRelative(i,i,(s+o)/2,n,!0);return}this.setRelative(i,i,(s*d+o*a)/h,n,!0)},ui.prototype.setRelative=function(i,e,t,n,s){n=n||this;const o=s?e.xo:e.x,r=s?e.yo:e.y,l=o+t*n.x,a=r+t*n.y,d=n.normalSlope,h=this.slope,f=i.x,p=i.y;i.x=(h*f-d*l+a-p)/(h-d),i.y=h*(i.x-f)+p},ui.prototype.touch=function(i){i.xTouched=!0,i.yTouched=!0};function fi(i,e){const t=Math.sqrt(i*i+e*e);return i/=t,e/=t,i===1&&e===0?Je:i===0&&e===1?it:new ui(i,e)}function nt(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)}nt.prototype.nextTouched=function(i){let e=this.nextPointOnContour;for(;!i.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},nt.prototype.prevTouched=function(i){let e=this.prevPointOnContour;for(;!i.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};const pi=Object.freeze(new nt(0,0)),im={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function ft(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=Je,this.round=Fa}}Pa.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){ft.prototype=im,s=this._fpgmState=new ft("fpgm",t.tables.fpgm),s.funcs=[],s.font=t,U.DEBUG&&(console.log("---EXEC FPGM---"),s.step=-1);try{xt(s)}catch(r){console.log("Hinting error in FPGM:"+r),this._errorState=3;return}}ft.prototype=s,n=this._prepState=new ft("prep",t.tables.prep),n.ppem=e;const o=t.tables.cvt;if(o){const r=n.cvt=new Array(o.length),l=e/t.unitsPerEm;for(let a=0;a<o.length;a++)r[a]=o[a]*l}else n.cvt=[];U.DEBUG&&(console.log("---EXEC PREP---"),n.step=-1);try{xt(n)}catch(r){this._errorState<2&&console.log("Hinting error in PREP:"+r),this._errorState=2}}if(!(this._errorState>1))try{return ka(i,n)}catch(s){this._errorState<1&&(console.log("Hinting error:"+s),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},ka=function(i,e){const t=e.ppem/e.font.unitsPerEm,n=t;let s=i.components,o,r,l;if(ft.prototype=e,!s)l=new ft("glyf",i.instructions),U.DEBUG&&(console.log("---EXEC GLYPH---"),l.step=-1),Es(i,l,t,n),r=l.gZone;else{const a=e.font;r=[],o=[];for(let d=0;d<s.length;d++){const h=s[d],f=a.glyphs.get(h.glyphIndex);l=new ft("glyf",f.instructions),U.DEBUG&&(console.log("---EXEC COMP "+d+"---"),l.step=-1),Es(f,l,t,n);const p=Math.round(h.dx*t),u=Math.round(h.dy*n),m=l.gZone,w=l.contours;for(let C=0;C<m.length;C++){const v=m[C];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+p,v.yo=v.y=v.y+u}const A=r.length;r.push.apply(r,m);for(let C=0;C<w.length;C++)o.push(w[C]+A)}i.instructions&&!l.inhibitGridFit&&(l=new ft("glyf",i.instructions),l.gZone=l.z0=l.z1=l.z2=r,l.contours=o,r.push(new nt(0,0),new nt(Math.round(i.advanceWidth*t),0)),U.DEBUG&&(console.log("---EXEC COMPOSITE---"),l.step=-1),xt(l),r.length-=2)}return r},Es=function(i,e,t,n){const s=i.points||[],o=s.length,r=e.gZone=e.z0=e.z1=e.z2=[],l=e.contours=[];let a;for(let f=0;f<o;f++)a=s[f],r[f]=new nt(a.x*t,a.y*n,a.lastPointOfContour,a.onCurve);let d,h;for(let f=0;f<o;f++)a=r[f],d||(d=a,l.push(f)),a.lastPointOfContour?(a.nextPointOnContour=d,d.prevPointOnContour=a,d=void 0):(h=r[f+1],a.nextPointOnContour=h,h.prevPointOnContour=a);if(!e.inhibitGridFit){if(U.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(let f=0;f<o;f++)console.log(f,r[f].x,r[f].y)}if(r.push(new nt(0,0),new nt(Math.round(i.advanceWidth*t),0)),xt(e),r.length-=2,U.DEBUG){console.log("FINISHED GLYPH",e.stack);for(let f=0;f<o;f++)console.log(f,r[f].x,r[f].y)}}},xt=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(U.DEBUG&&i.step++,n=Da[e[i.ip]],!n)throw new Error("unknown instruction: 0x"+Number(e[i.ip]).toString(16));n(i)}};function nn(i){const e=i.tZone=new Array(i.gZone.length);for(let t=0;t<e.length;t++)e[t]=new nt(0,0)}function Oa(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 La(i,e){U.DEBUG&&console.log(e.step,"SVTCA["+i.axis+"]"),e.fv=e.pv=e.dpv=i}function Na(i,e){U.DEBUG&&console.log(e.step,"SPVTCA["+i.axis+"]"),e.pv=e.dpv=i}function _a(i,e){U.DEBUG&&console.log(e.step,"SFVTCA["+i.axis+"]"),e.fv=i}function Ua(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];U.DEBUG&&console.log("SPVTL["+i+"]",n,s);let l,a;i?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.pv=e.dpv=fi(l,a)}function Qa(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];U.DEBUG&&console.log("SFVTL["+i+"]",n,s);let l,a;i?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.fv=fi(l,a)}function nm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"SPVFS[]",t,n),i.pv=i.dpv=fi(n,t)}function sm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"SPVFS[]",t,n),i.fv=fi(n,t)}function om(i){const e=i.stack,t=i.pv;U.DEBUG&&console.log(i.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function rm(i){const e=i.stack,t=i.fv;U.DEBUG&&console.log(i.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function am(i){i.fv=i.pv,U.DEBUG&&console.log(i.step,"SFVTPV[]")}function lm(i){const e=i.stack,t=e.pop(),n=e.pop(),s=e.pop(),o=e.pop(),r=e.pop(),l=i.z0,a=i.z1,d=l[t],h=l[n],f=a[s],p=a[o],u=i.z2[r];U.DEBUG&&console.log("ISECT[], ",t,n,s,o,r);const m=d.x,w=d.y,A=h.x,C=h.y,v=f.x,S=f.y,D=p.x,N=p.y,I=(m-A)*(S-N)-(w-C)*(v-D),B=m*C-w*A,g=v*N-S*D;u.x=(B*(v-D)-g*(m-A))/I,u.y=(B*(S-N)-g*(w-C))/I}function cm(i){i.rp0=i.stack.pop(),U.DEBUG&&console.log(i.step,"SRP0[]",i.rp0)}function dm(i){i.rp1=i.stack.pop(),U.DEBUG&&console.log(i.step,"SRP1[]",i.rp1)}function hm(i){i.rp2=i.stack.pop(),U.DEBUG&&console.log(i.step,"SRP2[]",i.rp2)}function um(i){const e=i.stack.pop();switch(U.DEBUG&&console.log(i.step,"SZP0[]",e),i.zp0=e,e){case 0:i.tZone||nn(i),i.z0=i.tZone;break;case 1:i.z0=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function fm(i){const e=i.stack.pop();switch(U.DEBUG&&console.log(i.step,"SZP1[]",e),i.zp1=e,e){case 0:i.tZone||nn(i),i.z1=i.tZone;break;case 1:i.z1=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function pm(i){const e=i.stack.pop();switch(U.DEBUG&&console.log(i.step,"SZP2[]",e),i.zp2=e,e){case 0:i.tZone||nn(i),i.z2=i.tZone;break;case 1:i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function gm(i){const e=i.stack.pop();switch(U.DEBUG&&console.log(i.step,"SZPS[]",e),i.zp0=i.zp1=i.zp2=e,e){case 0:i.tZone||nn(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 mm(i){i.loop=i.stack.pop(),U.DEBUG&&console.log(i.step,"SLOOP[]",i.loop)}function Am(i){U.DEBUG&&console.log(i.step,"RTG[]"),i.round=Fa}function ym(i){U.DEBUG&&console.log(i.step,"RTHG[]"),i.round=Zg}function Cm(i){const e=i.stack.pop();U.DEBUG&&console.log(i.step,"SMD[]",e),i.minDis=e/64}function Em(i){U.DEBUG&&console.log(i.step,"ELSE[]"),Oa(i,!1)}function wm(i){const e=i.stack.pop();U.DEBUG&&console.log(i.step,"JMPR[]",e),i.ip+=e-1}function bm(i){const e=i.stack.pop();U.DEBUG&&console.log(i.step,"SCVTCI[]",e),i.cvCutIn=e/64}function vm(i){const e=i.stack;U.DEBUG&&console.log(i.step,"DUP[]"),e.push(e[e.length-1])}function ws(i){U.DEBUG&&console.log(i.step,"POP[]"),i.stack.pop()}function Im(i){U.DEBUG&&console.log(i.step,"CLEAR[]"),i.stack.length=0}function Bm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"SWAP[]"),e.push(t),e.push(n)}function xm(i){const e=i.stack;U.DEBUG&&console.log(i.step,"DEPTH[]"),e.push(e.length)}function Sm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"LOOPCALL[]",t,n);const s=i.ip,o=i.prog;i.prog=i.funcs[t];for(let r=0;r<n;r++)xt(i),U.DEBUG&&console.log(++i.step,r+1<n?"next loopcall":"done loopcall",r);i.ip=s,i.prog=o}function Tm(i){const e=i.stack.pop();U.DEBUG&&console.log(i.step,"CALL[]",e);const t=i.ip,n=i.prog;i.prog=i.funcs[e],xt(i),i.ip=t,i.prog=n,U.DEBUG&&console.log(++i.step,"returning from",e)}function Mm(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"CINDEX[]",t),e.push(e[e.length-t])}function Dm(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"MINDEX[]",t),e.push(e.splice(e.length-t,1)[0])}function km(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(U.DEBUG&&console.log(i.step,"FDEF[]",s);t[++n]!==45;);i.ip=n,i.funcs[s]=t.slice(o+1,n)}function Ga(i,e){const t=e.stack.pop(),n=e.z0[t],s=e.fv,o=e.pv;U.DEBUG&&console.log(e.step,"MDAP["+i+"]",t);let r=o.distance(n,pi);i&&(r=e.round(r)),s.setRelative(n,pi,r,o),s.touch(n),e.rp0=e.rp1=t}function Ha(i,e){const t=e.z2,n=t.length-2;let s,o,r;U.DEBUG&&console.log(e.step,"IUP["+i.axis+"]");for(let l=0;l<n;l++)s=t[l],!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 Ya(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 l=e.loop;const a=e.z2;for(;l--;){const d=t.pop(),h=a[d],f=r.distance(s,s,!1,!0);o.setRelative(h,h,f,r),o.touch(h),U.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-l)+": ":"")+"SHP["+(i?"rp1":"rp2")+"]",d)}e.loop=1}function Va(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,l=t.pop(),a=e.z2[e.contours[l]];let d=a;U.DEBUG&&console.log(e.step,"SHC["+i+"]",l);const h=r.distance(s,s,!1,!0);do d!==s&&o.setRelative(d,d,h,r),d=d.nextPointOnContour;while(d!==a)}function za(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,l=t.pop();U.DEBUG&&console.log(e.step,"SHZ["+i+"]",l);let a;switch(l){case 0:a=e.tZone;break;case 1:a=e.gZone;break;default:throw new Error("Invalid zone")}let d;const h=r.distance(s,s,!1,!0),f=a.length-2;for(let p=0;p<f;p++)d=a[p],o.setRelative(d,d,h,r)}function Pm(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(),l=o[r];U.DEBUG&&console.log(i.step,(i.loop>1?"loop "+(i.loop-t)+": ":"")+"SHPIX[]",r,s),n.setRelative(l,l,s),n.touch(l)}i.loop=1}function Fm(i){const e=i.stack,t=i.rp1,n=i.rp2;let s=i.loop;const o=i.z0[t],r=i.z1[n],l=i.fv,a=i.dpv,d=i.z2;for(;s--;){const h=e.pop(),f=d[h];U.DEBUG&&console.log(i.step,(i.loop>1?"loop "+(i.loop-s)+": ":"")+"IP[]",h,t,"<->",n),l.interpolate(f,o,r,a),l.touch(f)}i.loop=1}function Wa(i,e){const t=e.stack,n=t.pop()/64,s=t.pop(),o=e.z1[s],r=e.z0[e.rp0],l=e.fv,a=e.pv;l.setRelative(o,r,n,a),l.touch(o),U.DEBUG&&console.log(e.step,"MSIRP["+i+"]",n,s),e.rp1=e.rp0,e.rp2=s,i&&(e.rp0=s)}function Rm(i){const e=i.stack,t=i.rp0,n=i.z0[t];let s=i.loop;const o=i.fv,r=i.pv,l=i.z1;for(;s--;){const a=e.pop(),d=l[a];U.DEBUG&&console.log(i.step,(i.loop>1?"loop "+(i.loop-s)+": ":"")+"ALIGNRP[]",a),o.setRelative(d,n,0,r),o.touch(d)}i.loop=1}function Om(i){U.DEBUG&&console.log(i.step,"RTDG[]"),i.round=Jg}function ja(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z0[s],r=e.fv,l=e.pv;let a=e.cvt[n];U.DEBUG&&console.log(e.step,"MIAP["+i+"]",n,"(",a,")",s);let d=l.distance(o,pi);i&&(Math.abs(d-a)<e.cvCutIn&&(d=a),d=e.round(d)),r.setRelative(o,pi,d,l),e.zp0===0&&(o.xo=o.x,o.yo=o.y),r.touch(o),e.rp0=e.rp1=s}function Lm(i){const e=i.prog;let t=i.ip;const n=i.stack,s=e[++t];U.DEBUG&&console.log(i.step,"NPUSHB[]",s);for(let o=0;o<s;o++)n.push(e[++t]);i.ip=t}function Nm(i){let e=i.ip;const t=i.prog,n=i.stack,s=t[++e];U.DEBUG&&console.log(i.step,"NPUSHW[]",s);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 _m(i){const e=i.stack;let t=i.store;t||(t=i.store=[]);const n=e.pop(),s=e.pop();U.DEBUG&&console.log(i.step,"WS",n,s),t[s]=n}function Um(i){const e=i.stack,t=i.store,n=e.pop();U.DEBUG&&console.log(i.step,"RS",n);const s=t&&t[n]||0;e.push(s)}function Qm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"WCVTP",t,n),i.cvt[n]=t/64}function Gm(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"RCVT",t),e.push(i.cvt[t]*64)}function Ka(i,e){const t=e.stack,n=t.pop(),s=e.z2[n];U.DEBUG&&console.log(e.step,"GC["+i+"]",n),t.push(e.dpv.distance(s,pi,i,!1)*64)}function $a(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z1[n],r=e.z0[s],l=e.dpv.distance(r,o,i,i);U.DEBUG&&console.log(e.step,"MD["+i+"]",n,s,"->",l),e.stack.push(Math.round(l*64))}function Hm(i){U.DEBUG&&console.log(i.step,"MPPEM[]"),i.stack.push(i.ppem)}function Ym(i){U.DEBUG&&console.log(i.step,"FLIPON[]"),i.autoFlip=!0}function Vm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"LT[]",t,n),e.push(n<t?1:0)}function zm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"LTEQ[]",t,n),e.push(n<=t?1:0)}function Wm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"GT[]",t,n),e.push(n>t?1:0)}function jm(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"GTEQ[]",t,n),e.push(n>=t?1:0)}function Km(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"EQ[]",t,n),e.push(t===n?1:0)}function $m(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"NEQ[]",t,n),e.push(t!==n?1:0)}function Xm(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function qm(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function Jm(i){let e=i.stack.pop();U.DEBUG&&console.log(i.step,"IF[]",e),e||(Oa(i,!0),U.DEBUG&&console.log(i.step,"EIF[]"))}function Zm(i){U.DEBUG&&console.log(i.step,"EIF[]")}function eA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"AND[]",t,n),e.push(t&&n?1:0)}function tA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"OR[]",t,n),e.push(t||n?1:0)}function iA(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"NOT[]",t),e.push(t?0:1)}function bs(i,e){const t=e.stack,n=t.pop(),s=e.fv,o=e.pv,r=e.ppem,l=e.deltaBase+(i-1)*16,a=e.deltaShift,d=e.z0;U.DEBUG&&console.log(e.step,"DELTAP["+i+"]",n,t);for(let h=0;h<n;h++){const f=t.pop(),p=t.pop();if(l+((p&240)>>4)!==r)continue;let m=(p&15)-8;m>=0&&m++,U.DEBUG&&console.log(e.step,"DELTAPFIX",f,"by",m*a);const w=d[f];s.setRelative(w,w,m*a,o)}}function nA(i){const t=i.stack.pop();U.DEBUG&&console.log(i.step,"SDB[]",t),i.deltaBase=t}function sA(i){const t=i.stack.pop();U.DEBUG&&console.log(i.step,"SDS[]",t),i.deltaShift=Math.pow(.5,t)}function oA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"ADD[]",t,n),e.push(n+t)}function rA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"SUB[]",t,n),e.push(n-t)}function aA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"DIV[]",t,n),e.push(n*64/t)}function lA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"MUL[]",t,n),e.push(n*t/64)}function cA(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"ABS[]",t),e.push(Math.abs(t))}function dA(i){const e=i.stack;let t=e.pop();U.DEBUG&&console.log(i.step,"NEG[]",t),e.push(-t)}function hA(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function uA(i){const e=i.stack,t=e.pop();U.DEBUG&&console.log(i.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function sn(i,e){const t=e.stack,n=t.pop();U.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(n/64)*64)}function fA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"WCVTF[]",t,n),i.cvt[n]=t*i.ppem/i.font.unitsPerEm}function vs(i,e){const t=e.stack,n=t.pop(),s=e.ppem,o=e.deltaBase+(i-1)*16,r=e.deltaShift;U.DEBUG&&console.log(e.step,"DELTAC["+i+"]",n,t);for(let l=0;l<n;l++){const a=t.pop(),d=t.pop();if(o+((d&240)>>4)!==s)continue;let f=(d&15)-8;f>=0&&f++;const p=f*r;U.DEBUG&&console.log(e.step,"DELTACFIX",a,"by",p),e.cvt[a]+=p}}function pA(i){let e=i.stack.pop();U.DEBUG&&console.log(i.step,"SROUND[]",e),i.round=Ra;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 gA(i){let e=i.stack.pop();U.DEBUG&&console.log(i.step,"S45ROUND[]",e),i.round=Ra;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 mA(i){U.DEBUG&&console.log(i.step,"ROFF[]"),i.round=qg}function AA(i){U.DEBUG&&console.log(i.step,"RUTG[]"),i.round=em}function yA(i){U.DEBUG&&console.log(i.step,"RDTG[]"),i.round=tm}function CA(i){const e=i.stack.pop();U.DEBUG&&console.log(i.step,"SCANCTRL[]",e)}function Xa(i,e){const t=e.stack,n=t.pop(),s=t.pop(),o=e.z2[n],r=e.z1[s];U.DEBUG&&console.log(e.step,"SDPVTL["+i+"]",n,s);let l,a;i?(l=o.y-r.y,a=r.x-o.x):(l=r.x-o.x,a=r.y-o.y),e.dpv=fi(l,a)}function EA(i){const e=i.stack,t=e.pop();let n=0;U.DEBUG&&console.log(i.step,"GETINFO[]",t),t&1&&(n=35),t&32&&(n|=4096),e.push(n)}function wA(i){const e=i.stack,t=e.pop(),n=e.pop(),s=e.pop();U.DEBUG&&console.log(i.step,"ROLL[]"),e.push(n),e.push(t),e.push(s)}function bA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"MAX[]",t,n),e.push(Math.max(n,t))}function vA(i){const e=i.stack,t=e.pop(),n=e.pop();U.DEBUG&&console.log(i.step,"MIN[]",t,n),e.push(Math.min(n,t))}function IA(i){const e=i.stack.pop();U.DEBUG&&console.log(i.step,"SCANTYPE[]",e)}function BA(i){const e=i.stack.pop();let t=i.stack.pop();switch(U.DEBUG&&console.log(i.step,"INSTCTRL[]",e,t),e){case 1:i.inhibitGridFit=!!t;return;case 2:i.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function pt(i,e){const t=e.stack,n=e.prog;let s=e.ip;U.DEBUG&&console.log(e.step,"PUSHB["+i+"]");for(let o=0;o<i;o++)t.push(n[++s]);e.ip=s}function gt(i,e){let t=e.ip;const n=e.prog,s=e.stack;U.DEBUG&&console.log(e.ip,"PUSHW["+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 K(i,e,t,n,s,o){const r=o.stack,l=i&&r.pop(),a=r.pop(),d=o.rp0,h=o.z0[d],f=o.z1[a],p=o.minDis,u=o.fv,m=o.dpv;let w,A,C,v;A=w=m.distance(f,h,!0,!0),C=A>=0?1:-1,A=Math.abs(A),i&&(v=o.cvt[l],n&&Math.abs(A-v)<o.cvCutIn&&(A=v)),t&&A<p&&(A=p),n&&(A=o.round(A)),u.setRelative(f,h,C*A,m),u.touch(f),U.DEBUG&&console.log(o.step,(i?"MIRP[":"MDRP[")+(e?"M":"m")+(t?">":"_")+(n?"R":"_")+(s===0?"Gr":s===1?"Bl":s===2?"Wh":"")+"]",i?l+"("+o.cvt[l]+","+v+")":"",a,"(d =",w,"->",C*A,")"),o.rp1=o.rp0,o.rp2=a,e&&(o.rp0=a)}Da=[La.bind(void 0,it),La.bind(void 0,Je),Na.bind(void 0,it),Na.bind(void 0,Je),_a.bind(void 0,it),_a.bind(void 0,Je),Ua.bind(void 0,0),Ua.bind(void 0,1),Qa.bind(void 0,0),Qa.bind(void 0,1),nm,sm,om,rm,am,lm,cm,dm,hm,um,fm,pm,gm,mm,Am,ym,Cm,Em,wm,bm,void 0,void 0,vm,ws,Im,Bm,xm,Mm,Dm,void 0,void 0,void 0,Sm,Tm,km,void 0,Ga.bind(void 0,0),Ga.bind(void 0,1),Ha.bind(void 0,it),Ha.bind(void 0,Je),Ya.bind(void 0,0),Ya.bind(void 0,1),Va.bind(void 0,0),Va.bind(void 0,1),za.bind(void 0,0),za.bind(void 0,1),Pm,Fm,Wa.bind(void 0,0),Wa.bind(void 0,1),Rm,Om,ja.bind(void 0,0),ja.bind(void 0,1),Lm,Nm,_m,Um,Qm,Gm,Ka.bind(void 0,0),Ka.bind(void 0,1),void 0,$a.bind(void 0,0),$a.bind(void 0,1),Hm,void 0,Ym,void 0,void 0,Vm,zm,Wm,jm,Km,$m,Xm,qm,Jm,Zm,eA,tA,iA,bs.bind(void 0,1),nA,sA,oA,rA,aA,lA,cA,dA,hA,uA,sn.bind(void 0,0),sn.bind(void 0,1),sn.bind(void 0,2),sn.bind(void 0,3),void 0,void 0,void 0,void 0,fA,bs.bind(void 0,2),bs.bind(void 0,3),vs.bind(void 0,1),vs.bind(void 0,2),vs.bind(void 0,3),pA,gA,void 0,void 0,mA,void 0,AA,yA,ws,ws,void 0,void 0,void 0,void 0,void 0,CA,Xa.bind(void 0,0),Xa.bind(void 0,1),EA,void 0,wA,bA,vA,IA,BA,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,pt.bind(void 0,1),pt.bind(void 0,2),pt.bind(void 0,3),pt.bind(void 0,4),pt.bind(void 0,5),pt.bind(void 0,6),pt.bind(void 0,7),pt.bind(void 0,8),gt.bind(void 0,1),gt.bind(void 0,2),gt.bind(void 0,3),gt.bind(void 0,4),gt.bind(void 0,5),gt.bind(void 0,6),gt.bind(void 0,7),gt.bind(void 0,8),K.bind(void 0,0,0,0,0,0),K.bind(void 0,0,0,0,0,1),K.bind(void 0,0,0,0,0,2),K.bind(void 0,0,0,0,0,3),K.bind(void 0,0,0,0,1,0),K.bind(void 0,0,0,0,1,1),K.bind(void 0,0,0,0,1,2),K.bind(void 0,0,0,0,1,3),K.bind(void 0,0,0,1,0,0),K.bind(void 0,0,0,1,0,1),K.bind(void 0,0,0,1,0,2),K.bind(void 0,0,0,1,0,3),K.bind(void 0,0,0,1,1,0),K.bind(void 0,0,0,1,1,1),K.bind(void 0,0,0,1,1,2),K.bind(void 0,0,0,1,1,3),K.bind(void 0,0,1,0,0,0),K.bind(void 0,0,1,0,0,1),K.bind(void 0,0,1,0,0,2),K.bind(void 0,0,1,0,0,3),K.bind(void 0,0,1,0,1,0),K.bind(void 0,0,1,0,1,1),K.bind(void 0,0,1,0,1,2),K.bind(void 0,0,1,0,1,3),K.bind(void 0,0,1,1,0,0),K.bind(void 0,0,1,1,0,1),K.bind(void 0,0,1,1,0,2),K.bind(void 0,0,1,1,0,3),K.bind(void 0,0,1,1,1,0),K.bind(void 0,0,1,1,1,1),K.bind(void 0,0,1,1,1,2),K.bind(void 0,0,1,1,1,3),K.bind(void 0,1,0,0,0,0),K.bind(void 0,1,0,0,0,1),K.bind(void 0,1,0,0,0,2),K.bind(void 0,1,0,0,0,3),K.bind(void 0,1,0,0,1,0),K.bind(void 0,1,0,0,1,1),K.bind(void 0,1,0,0,1,2),K.bind(void 0,1,0,0,1,3),K.bind(void 0,1,0,1,0,0),K.bind(void 0,1,0,1,0,1),K.bind(void 0,1,0,1,0,2),K.bind(void 0,1,0,1,0,3),K.bind(void 0,1,0,1,1,0),K.bind(void 0,1,0,1,1,1),K.bind(void 0,1,0,1,1,2),K.bind(void 0,1,0,1,1,3),K.bind(void 0,1,1,0,0,0),K.bind(void 0,1,1,0,0,1),K.bind(void 0,1,1,0,0,2),K.bind(void 0,1,1,0,0,3),K.bind(void 0,1,1,0,1,0),K.bind(void 0,1,1,0,1,1),K.bind(void 0,1,1,0,1,2),K.bind(void 0,1,1,0,1,3),K.bind(void 0,1,1,1,0,0),K.bind(void 0,1,1,1,0,1),K.bind(void 0,1,1,1,0,2),K.bind(void 0,1,1,1,0,3),K.bind(void 0,1,1,1,1,0),K.bind(void 0,1,1,1,1,1),K.bind(void 0,1,1,1,1,2),K.bind(void 0,1,1,1,1,3)];const xA=Array.from||(i=>i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]);function ae(i){i=i||{},i.empty||(Wt(i.familyName,"When creating a new Font object, familyName is required."),Wt(i.styleName,"When creating a new Font object, styleName is required."),Wt(i.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Wt(i.ascender,"When creating a new Font object, ascender is required."),Wt(i.descender,"When creating a new Font object, descender is required."),Wt(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 Vt.GlyphSet(this,i.glyphs||[]),this.encoding=new zr(this),this.position=new hi(this),this.substitution=new Ye(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 Pa(this)}})}ae.prototype.hasChar=function(i){return this.encoding.charToGlyphIndex(i)!==null},ae.prototype.charToGlyphIndex=function(i){return this.encoding.charToGlyphIndex(i)},ae.prototype.charToGlyph=function(i){const e=this.charToGlyphIndex(i);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},ae.prototype.stringToGlyphs=function(i,e){e=e||this.defaultRenderOptions;const t=xA(i),n=[];for(let l=0;l<t.length;l+=1){const a=t[l];n.push(this.charToGlyphIndex(a))}let s=n.length;if(e.features){const l=e.script||this.substitution.getDefaultScriptName();let a=[];e.features.liga&&(a=a.concat(this.substitution.getFeature("liga",l,e.language))),e.features.rlig&&(a=a.concat(this.substitution.getFeature("rlig",l,e.language)));for(let d=0;d<s;d+=1)for(let h=0;h<a.length;h++){const f=a[h],p=f.sub,u=p.length;let m=0;for(;m<u&&p[m]===n[d+m];)m++;m===u&&(n.splice(d,u,f.by),s=s-u+1)}}const o=new Array(s),r=this.glyphs.get(0);for(let l=0;l<s;l+=1)o[l]=this.glyphs.get(n[l])||r;return o},ae.prototype.nameToGlyphIndex=function(i){return this.glyphNames.nameToGlyphIndex(i)},ae.prototype.nameToGlyph=function(i){const e=this.nameToGlyphIndex(i);let t=this.glyphs.get(e);return t||(t=this.glyphs.get(0)),t},ae.prototype.glyphIndexToName=function(i){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(i):""},ae.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},ae.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},ae.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,l=this.stringToGlyphs(i,s);let a;if(s.kerning){const d=s.script||this.position.getDefaultScriptName();a=this.position.getKerningTables(d,s.language)}for(let d=0;d<l.length;d+=1){const h=l[d];if(o.call(this,h,e,t,n,s),h.advanceWidth&&(e+=h.advanceWidth*r),s.kerning&&d<l.length-1){const f=a?this.position.getKerningValue(a,h.index,l[d+1].index):this.getKerningValue(h,l[d+1]);e+=f*r}s.letterSpacing?e+=s.letterSpacing*n:s.tracking&&(e+=s.tracking/1e3*n)}return e},ae.prototype.getPath=function(i,e,t,n,s){const o=new Ie;return this.forEachGlyph(i,e,t,n,s,function(r,l,a,d){const h=r.getPath(l,a,d,s,this);o.extend(h)}),o},ae.prototype.getPaths=function(i,e,t,n,s){const o=[];return this.forEachGlyph(i,e,t,n,s,function(r,l,a,d){const h=r.getPath(l,a,d,s,this);o.push(h)}),o},ae.prototype.getAdvanceWidth=function(i,e,t){return this.forEachGlyph(i,0,0,e,t,function(){})},ae.prototype.draw=function(i,e,t,n,s,o){this.getPath(e,t,n,s,o).draw(i)},ae.prototype.drawPoints=function(i,e,t,n,s,o){this.forEachGlyph(e,t,n,s,o,function(r,l,a,d){r.drawPoints(i,l,a,d)})},ae.prototype.drawMetrics=function(i,e,t,n,s,o){this.forEachGlyph(e,t,n,s,o,function(r,l,a,d){r.drawMetrics(i,l,a,d)})},ae.prototype.getEnglishName=function(i){const e=this.names[i];if(e)return e.en},ae.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},ae.prototype.toTables=function(){return Hg.fontToTable(this)},ae.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},ae.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},ae.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(Vg())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 l=document.createEvent("MouseEvents");l.initEvent("click",!0,!1),r.dispatchEvent(l)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{const s=require("fs"),o=Wg(n);s.writeFileSync(i,o)}},ae.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},ae.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},ae.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function qa(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 SA(i,e,t){const n=qa(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 TA(i,e,t){const n={},s=new $.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 MA(i,e,t,n){const s=qa(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 l=t[r].tag;o.push({name:"axis_"+i+" "+l,type:"FIXED",value:e.coordinates[l]<<16})}return o}function DA(i,e,t,n){const s={},o=new $.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 kA(i,e){const t=new J.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(SA(n,i.axes[n],e));for(let n=0;n<i.instances.length;n++)t.fields=t.fields.concat(MA(n,i.instances[n],i.axes,e));return t}function PA(i,e,t){const n=new $.Parser(i,e),s=n.parseULong();ie.argument(s===65536,"Unsupported fvar table version.");const o=n.parseOffset16();n.skip("uShort",1);const r=n.parseUShort(),l=n.parseUShort(),a=n.parseUShort(),d=n.parseUShort(),h=[];for(let u=0;u<r;u++)h.push(TA(i,e+o+u*l,t));const f=[],p=e+o+r*l;for(let u=0;u<a;u++)f.push(DA(i,p+u*d,h,t));return{axes:h,instances:f}}const FA={make:kA,parse:PA},Ve=new Array(10);Ve[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()};ie.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Ve[2]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();ie.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),l=this.parsePointer(H.classDef),a=this.parseUShort(),d=this.parseUShort();return{posFormat:t,coverage:n,valueFormat1:s,valueFormat2:o,classDef1:r,classDef2:l,class1Count:a,class2Count:d,classRecords:this.parseList(a,H.list(d,function(){return{value1:this.parseValueRecord(s),value2:this.parseValueRecord(o)}}))}}},Ve[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Ve[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Ve[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Ve[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Ve[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Ve[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Ve[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function RA(i,e){e=e||0;const t=new H(i,e),n=t.parseVersion(1);return ie.argument(n===1||n===1.1,"Unsupported GPOS table version "+n),n===1?{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ve)}:{version:n,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(Ve),variations:t.parseFeatureVariationsList()}}const OA=new Array(10);function LA(i){return new J.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new J.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new J.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new J.LookupList(i.lookups,OA)}])}const NA={parse:RA,make:LA};function _A(i){const e={};i.skip("uShort");const t=i.parseUShort();ie.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(),l=i.parseShort();e[o+","+r]=l}return e}function UA(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 l=i.parseUShort(),a=i.parseUShort(),d=i.parseShort();e[l+","+a]=d}}return e}function QA(i,e){const t=new $.Parser(i,e),n=t.parseUShort();if(n===0)return _A(t);if(n===1)return UA(t);throw new Error("Unsupported kern table version ("+n+").")}const GA={parse:QA};function HA(i,e,t,n){const s=new $.Parser(i,e),o=n?s.parseUShort:s.parseULong,r=[];for(let l=0;l<t+1;l+=1){let a=o.call(s);n&&(a*=2),r.push(a)}return r}const YA={parse:HA};function VA(i,e){require("fs").readFile(i,function(n,s){if(n)return e(n.message);e(null,zg(s))})}function zA(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 Ja(i,e){const t=[];let n=12;for(let s=0;s<e;s+=1){const o=$.getTag(i,n),r=$.getULong(i,n+4),l=$.getULong(i,n+8),a=$.getULong(i,n+12);t.push({tag:o,checksum:r,offset:l,length:a,compression:!1}),n+=16}return t}function WA(i,e){const t=[];let n=44;for(let s=0;s<e;s+=1){const o=$.getTag(i,n),r=$.getULong(i,n+4),l=$.getULong(i,n+8),a=$.getULong(i,n+12);let d;l<a?d="WOFF":d=!1,t.push({tag:o,offset:r,compression:d,compressedLength:l,length:a}),n+=20}return t}function we(i,e){if(e.compression==="WOFF"){const t=new Uint8Array(i.buffer,e.offset+2,e.compressedLength-2),n=new Uint8Array(e.length);if(Ip(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 jA(i){let e,t;const n=new ae({empty:!0}),s=new DataView(i,0);let o,r=[];const l=$.getTag(s,0);if(l==="\0\0\0"||l==="true"||l==="typ1")n.outlinesFormat="truetype",o=$.getUShort(s,4),r=Ja(s,o);else if(l==="OTTO")n.outlinesFormat="cff",o=$.getUShort(s,4),r=Ja(s,o);else if(l==="wOFF"){const N=$.getTag(s,4);if(N==="\0\0\0")n.outlinesFormat="truetype";else if(N==="OTTO")n.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+l);o=$.getUShort(s,12),r=WA(s,o)}else throw new Error("Unsupported OpenType signature "+l);let a,d,h,f,p,u,m,w,A,C,v;for(let N=0;N<o;N+=1){const I=r[N];let B;switch(I.tag){case"cmap":B=we(s,I),n.tables.cmap=Vr.parse(B.data,B.offset),n.encoding=new Wr(n.tables.cmap);break;case"cvt ":B=we(s,I),v=new $.Parser(B.data,B.offset),n.tables.cvt=v.parseShortList(I.length/2);break;case"fvar":d=I;break;case"fpgm":B=we(s,I),v=new $.Parser(B.data,B.offset),n.tables.fpgm=v.parseByteList(I.length);break;case"head":B=we(s,I),n.tables.head=oa.parse(B.data,B.offset),n.unitsPerEm=n.tables.head.unitsPerEm,e=n.tables.head.indexToLocFormat;break;case"hhea":B=we(s,I),n.tables.hhea=ra.parse(B.data,B.offset),n.ascender=n.tables.hhea.ascender,n.descender=n.tables.hhea.descender,n.numberOfHMetrics=n.tables.hhea.numberOfHMetrics;break;case"hmtx":u=I;break;case"ltag":B=we(s,I),t=la.parse(B.data,B.offset);break;case"maxp":B=we(s,I),n.tables.maxp=ca.parse(B.data,B.offset),n.numGlyphs=n.tables.maxp.numGlyphs;break;case"name":A=I;break;case"OS/2":B=we(s,I),n.tables.os2=ms.parse(B.data,B.offset);break;case"post":B=we(s,I),n.tables.post=Aa.parse(B.data,B.offset),n.glyphNames=new ds(n.tables.post);break;case"prep":B=we(s,I),v=new $.Parser(B.data,B.offset),n.tables.prep=v.parseByteList(I.length);break;case"glyf":h=I;break;case"loca":w=I;break;case"CFF ":a=I;break;case"kern":m=I;break;case"GPOS":f=I;break;case"GSUB":p=I;break;case"meta":C=I;break}}const S=we(s,A);if(n.tables.name=ma.parse(S.data,S.offset,t),n.names=n.tables.name,h&&w){const N=e===0,I=we(s,w),B=YA.parse(I.data,I.offset,n.numGlyphs,N),g=we(s,h);n.glyphs=Ma.parse(g.data,g.offset,B,n)}else if(a){const N=we(s,a);sa.parse(N.data,N.offset,n)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");const D=we(s,u);if(aa.parse(D.data,D.offset,n.numberOfHMetrics,n.numGlyphs,n.glyphs),Yp(n),m){const N=we(s,m);n.kerningPairs=GA.parse(N.data,N.offset)}else n.kerningPairs={};if(f){const N=we(s,f);n.tables.gpos=NA.parse(N.data,N.offset),n.position.init()}if(p){const N=we(s,p);n.tables.gsub=ya.parse(N.data,N.offset)}if(d){const N=we(s,d);n.tables.fvar=FA.parse(N.data,N.offset,n.names)}if(C){const N=we(s,C);n.tables.meta=Ca.parse(N.data,N.offset),n.metas=n.tables.meta}return n}function KA(i,e){(typeof window>"u"?VA:zA)(i,function(s,o){if(s)return e(s);let r;try{r=jA(o)}catch(l){return e(l,null)}return e(null,r)})}const Is=1e-12;function gi(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)>Is||Math.abs(s-r)>Is)&&i.push([n,s]),i}function St(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,l=s[0]??0,a=s[1]??0;e+=o*a-l*r}return e/2}function on(i,e=Is){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 l=s[0]??0,a=s[1]??0;(Math.abs(o-l)>e||Math.abs(r-a)>e)&&t.push([o,r])}return t}function $A(i,e,t,n,s=16){const o=[],r=i?.[0]??0,l=i?.[1]??0,a=t?.[0]??0,d=t?.[1]??0,h=n?.[0]??0,f=n?.[1]??0,p=e?.[0]??0,u=e?.[1]??0;for(let m=0;m<=s;m++){const w=m/s,A=1-w,C=A*A*A*r+3*A*A*w*a+3*A*w*w*h+w*w*w*p,v=A*A*A*l+3*A*A*w*d+3*A*w*w*f+w*w*w*u;o.push([C,v])}return o}function Za(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 l=e[o],a=e[r];if(!l||!a)continue;const d=l[0]??0,h=l[1]??0,f=a[0]??0,p=a[1]??0;h>n!=p>n&&t<(f-d)*(n-h)/(p-h+0)+d&&(s=!s)}return s}function Bs(i){return i?(St(i)<0&&i.reverse(),gi(i),i):[]}function XA(i){return i?(St(i)>0&&i.reverse(),gi(i),i):[]}function el(i,e=16){if(!i||!Array.isArray(i.commands))return[];const t=[];let n=[];for(const s of i.commands){let o=function(l){const a=l.x!==void 0?l.x:0,d=l.y!==void 0?-l.y:0;return[a,d]};const r=s.type;if(r==="M")n.length&&t.push(on(n)),n=[o(s)];else if(r==="L")n.push(o(s));else if(r==="Q"){const a=n[n.length-1]||o(s),d=[],h=s.x??0,f=s.y??0,p=s.x1??0,u=s.y1??0,m=a[0]??0,w=a[1]??0;for(let A=1;A<=e;A++){const C=A/e,v=1-C,S=v*v*m+2*v*C*p+C*C*h,D=v*v*w+2*v*C*u+C*C*-f;d.push([S,D])}d.length?n.push(...d):n.push(o(s))}else if(r==="C"){const a=n[n.length-1]||o(s),d=[s.x1||0,-(s.y1||0)],h=[s.x2||0,-(s.y2||0)],f=[s.x||0,-(s.y||0)],p=$A(a,f,d,h,e);p.length>1?n.push(...p.slice(1)):n.push(f)}else r==="Z"||r==="z"?(n.length&&t.push(on(n)),n=[]):s.x!==void 0&&s.y!==void 0&&n.push(o(s))}return n.length&&t.push(on(n)),t.map(s=>gi(s)).filter(s=>s&&s.length>=4)}function xs(i,e){if(!i)return null;const t=i.map(n=>gi(n.slice()));return{type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{...e.properties||{},rings:t.length,polygons:1}}}function qA(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||"",l=o.rotation??0,a=t.sampleSegments||16,d=t.epsArea||1e-24,f=o.height/.9||1,p=(t.scale||1)*f,u=-l*Math.PI/180,m=Math.cos(u),w=Math.sin(u),A=o.attachmentPoint||"bottom-left",C=[];if(!e||typeof e.getPaths!="function")return{type:"FeatureCollection",features:C};const v=e.getPaths(r,0,0,t.fontSize||1)||[];let S=[];for(const _ of v){const G=el(_,a);for(const F of G)if(F)for(const E of F)E&&S.push(E)}let D=1/0,N=1/0,I=-1/0,B=-1/0;for(const _ of S){if(!_)continue;const G=_[0]??0,F=_[1]??0;D=Math.min(D,G),N=Math.min(N,F),I=Math.max(I,G),B=Math.max(B,F)}const g=I-D,P=B-N;let x=0,k=0;switch(A){case"top-left":x=0,k=-P;break;case"top-center":x=-g/2,k=P;break;case"top-right":x=-g,k=P;break;case"center-left":x=0,k=P/2;break;case"center":x=-g/2,k=P/2;break;case"center-right":x=-g,k=P/2;break;case"bottom-left":x=0,k=0;break;case"bottom-center":x=-g/2,k=0;break;case"bottom-right":x=-g,k=0;break;default:x=0,k=0}for(const _ of v){const G=el(_,a);if(!G||G.length===0)continue;const F=G.map(R=>{if(!R)return[];const O=R.map(L=>{if(!L)return[0,0];let M=(L[0]??0)+x,Q=(L[1]??0)+k;M=M*(t.widthScale||.6);const Y=M*m-Q*w,W=M*w+Q*m;return[s[0]+Y*p,s[1]+W*p]});return gi(on(O))}).filter(R=>R&&R.length>=4&&Math.abs(St(R))>d);if(F.length===0)continue;let E=1;if(t.fillWinding==="positive")E=1;else if(t.fillWinding==="negative")E=-1;else{let R=0,O=-1;for(let Q=0;Q<F.length;Q++){const Y=F[Q];if(!Y)continue;const W=St(Y);Math.abs(W)>O&&(O=Math.abs(W),R=Q)}const L=F[R],M=L?St(L):0;E=M>=0?1:-1,n&&console.log("[simple] auto fillSign=",E,"largest signed area=",M)}const y=F.map((R,O)=>({idx:O,ring:R,signedArea:St(R),absArea:Math.abs(St(R))}));for(const R of y)R.isFilled=R.signedArea*E>0,n&&console.log("[simple] ring",R.idx,"signedArea=",R.signedArea.toExponential(),"isFilled=",R.isFilled);const b=y.filter(R=>R.isFilled).sort((R,O)=>R.absArea-O.absArea),T=y.filter(R=>!R.isFilled).sort((R,O)=>O.absArea-R.absArea);for(const R of b)R.holes=[];for(const R of T){const O=(function(M){let Q=0,Y=0;if(!M||M.length===0)return[0,0];for(const W of M)W&&(Q+=W[0]??0,Y+=W[1]??0);return[Q/M.length,Y/M.length]})(R.ring);let L=null;for(const M of b)Za(O,M.ring)&&(L===null||M.absArea<L.absArea&&M.idx<R.idx||M.absArea>L.absArea&&M.idx<R.idx&&T.length==1)&&(L=M);if(L){if(L.absArea<R.absArea&&T.length>1)for(const M of b)Za(O,M.ring)&&M.absArea>R.absArea&&M.holes.push(R.ring);else L.holes.push(R.ring);R.assigned=!0}else R.assigned=!1,n&&console.log("[simple] hole not assigned idx=",R.idx)}for(const R of b){const O=Bs(R.ring.slice()),L=(R.holes||[]).map(M=>XA(M.slice()));C.push(xs([O,...L],i))}for(const R of T)R.assigned||C.push(xs([Bs(R.ring.slice())],i));if(b.length===0)for(const R of y)C.push(xs([Bs(R.ring.slice())],i))}return{type:"FeatureCollection",features:C}}class JA extends qe{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(),KA(this.fontUrl,(o,r)=>{try{if(o){console.error("加载字体失败:",o),t&&t();return}const l=n.Cartographic.fromCartesian(e),a=n.Math.toDegrees(l.longitude),d=n.Math.toDegrees(l.latitude),h={type:"Feature",geometry:{type:"Point",coordinates:[a,d]},properties:{text:s.labelText||"",rotation:0}},f={sampleSegments:16,fontSize:s.fontSize,scale:10},p=qA(h,r,f);if(!p||!p.features||!Array.isArray(p.features)){console.error("文本转换为多边形失败"),t&&t();return}s.drawGeoJsonLocal(p,[a,d],1,r),s.entity={_centerCoord:s._centerCoord,_plotInstance:s._plotInstance,position:e,label:{text:s.labelText},updatePosition:function(u){s.updatePositions([u])},getPosition:function(){return s._centerCoord},type:s.type,objId:s.objId,isDraggable:!0,setPosition:function(u){s._centerCoord=u,s.positions[0]=u,s.createLabel(u)}},s.addClickEditHandler(),t&&t()}catch(l){console.error("创建文本标签时发生错误:",l);try{s.clearPolygonEntities()}catch(a){console.error("清理标签多边形实体时出错:",a)}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],l=t[1],a=o.Cartesian3.fromDegrees(r,l,0),d=o.Transforms.eastNorthUpToFixedFrame(a),h=n*1;this.clearPolygonEntities();let f=[];for(const S of e.features||[]){if(!S||!S.geometry||S.geometry.type!=="Polygon")continue;const D=S.geometry.coordinates||[];for(const N of D)N&&Array.isArray(N)&&(f=f.concat(N))}let p=1/0,u=1/0,m=-1/0,w=-1/0;for(const S of f)Array.isArray(S)&&S.length>=2&&(p=Math.min(p,S[0]),u=Math.min(u,S[1]),m=Math.max(m,S[0]),w=Math.max(w,S[1]));const A=(p+m)/2,C=(u+w)/2,v=S=>{const D=(S[0]-A)*h,N=(S[1]-C)*h,I=new o.Cartesian3(D,N,0);return o.Matrix4.multiplyByPoint(d,I,new o.Cartesian3)};for(const S of e.features||[]){if(!S||!S.geometry||S.geometry.type!=="Polygon")continue;const D=S.geometry.coordinates||[];if(D.length>0)try{const N=D[0]||[];if(N.length===0)continue;const I=N.map(v);let B;if(D.length>1){const P=D.slice(1).map(x=>!x||!Array.isArray(x)||x.length===0?null:new o.PolygonHierarchy(x.map(v))).filter(Boolean);B=new o.PolygonHierarchy(I,P)}else B=new o.PolygonHierarchy(I);const g=this.viewer.entities.add({polygon:{hierarchy:B,material:o.Color.fromCssColorString(this.color||"#000000"),outline:!1},_labelOwner:this.objId});this.polygonEntities.push(g)}catch(N){console.warn("创建多边形实体时出错:",N);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 l=document.createElement("h3");l.textContent="编辑文本",l.style.marginTop="0";const a=document.createElement("textarea");a.value=n,a.style.width="100%",a.style.height="150px",a.style.marginBottom="10px",a.style.fontSize="14px",a.style.padding="8px",a.style.boxSizing="border-box";const d=document.createElement("div");d.style.display="flex",d.style.justifyContent="flex-end",d.style.gap="10px";const h=document.createElement("button");h.textContent="取消",h.addEventListener("click",function(){document.body.removeChild(o),s(null)});const f=document.createElement("button");f.textContent="确认",f.addEventListener("click",function(){document.body.removeChild(o),s(a.value)}),d.appendChild(h),d.appendChild(f),r.appendChild(l),r.appendChild(a),r.appendChild(d),o.appendChild(r),document.body.appendChild(o),a.focus();const p=function(u){u.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 l=document.createElement("h3");l.textContent="编辑样式",l.style.marginTop="0";const a=document.createElement("div");a.style.marginBottom="15px";const d=document.createElement("label");d.textContent="文本颜色: ",d.style.display="block",d.style.marginBottom="5px";const h=document.createElement("input");h.type="color",h.value=n.color,h.style.width="50px",a.appendChild(d),a.appendChild(h);const f=document.createElement("div");f.style.marginBottom="15px";const p=document.createElement("label");p.textContent="字体大小: ",p.style.display="block",p.style.marginBottom="5px";const u=document.createElement("input");u.type="number",u.value=n.fontSize,u.min="8",u.max="200",u.step="1",u.style.width="100%",u.style.padding="5px",u.style.boxSizing="border-box",f.appendChild(p),f.appendChild(u);const m=document.createElement("div");m.style.display="flex",m.style.justifyContent="flex-end",m.style.gap="10px",m.style.marginTop="20px";const w=document.createElement("button");w.textContent="取消",w.addEventListener("click",function(){document.body.removeChild(o),s(null)});const A=document.createElement("button");A.textContent="确认",A.addEventListener("click",function(){document.body.removeChild(o),s({color:h.value,fontSize:parseInt(u.value)})}),m.appendChild(w),m.appendChild(A),r.appendChild(l),r.appendChild(a),r.appendChild(f),r.appendChild(m),o.appendChild(r),document.body.appendChild(o);const C=function(v){v.key==="Escape"&&(document.body.removeChild(o),document.removeEventListener("keydown",C),s(null))};document.addEventListener("keydown",C)})(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 ZA extends qe{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 dt(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?re.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 ey extends qe{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 dt(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(l=>Math.abs(l.x-s.x)<1e-6&&Math.abs(l.y-s.y)<1e-6&&Math.abs(l.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:re.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]),l=this.createPoint(o);l.point.heightReference=this.style.heightReference,l.ctgc=r,l.wz=this.controlPoints.length,this.controlPoints.push(l)}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 ty extends qe{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 dt(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),l=Math.min(n.latitude,s.latitude),a=Math.max(n.latitude,s.latitude);if(e==="leftdown")return Cesium.Cartesian3.fromRadians(o,l);if(e==="rightup")return Cesium.Cartesian3.fromRadians(r,a)}_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),l=Math.max(s.longitude,o.longitude),a=Math.min(s.latitude,o.latitude),d=Math.max(s.latitude,o.latitude);const h=n.cartesianToCartographic(e);t==="leftdown"?(r=h.longitude,a=h.latitude):(l=h.longitude,d=h.latitude),this.leftup=Cesium.Cartesian3.fromRadians(r,d),this.rightdown=Cesium.Cartesian3.fromRadians(l,a)}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,l=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=l,this.entity.objId=r;const a=this._calcCornerCartesian("leftdown"),d=this._calcCornerCartesian("rightup");this.leftdownPoint=this.createPoint(a),this.leftdownPoint.typeAttr="leftdown",this.leftdownPoint.show=this.state==="editing",this.rightupPoint=this.createPoint(d),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?re.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:re.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,l=-1/0;n.forEach(a=>{const d=Cesium.Ellipsoid.WGS84.cartesianToCartographic(a);d&&(s=Math.min(s,d.longitude),o=Math.min(o,d.latitude),r=Math.max(r,d.longitude),l=Math.max(l,d.latitude))}),this.leftup=Cesium.Cartesian3.fromRadians(s,l),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 iy extends qe{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 dt(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 ny extends qe{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(()=>Or).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 l=(h,f)=>{if(!h||h.length<2)return h;f=Math.max(1,f|0);const p=[h[0]],u=h.length;for(let m=0;m<u-1;m++){const w=m>0?h[m-1]:h[m],A=h[m],C=h[m+1],v=m+2<u?h[m+2]:h[m+1];for(let S=1;S<f;S++){const D=S/f,N=D*D,I=N*D,B=-.5*w.x+1.5*A.x-1.5*C.x+.5*v.x,g=-.5*w.y+1.5*A.y-1.5*C.y+.5*v.y,P=-.5*w.z+1.5*A.z-1.5*C.z+.5*v.z,x=w.x-2.5*A.x+2*C.x-.5*v.x,k=w.y-2.5*A.y+2*C.y-.5*v.y,_=w.z-2.5*A.z+2*C.z-.5*v.z,G=-.5*w.x+.5*C.x,F=-.5*w.y+.5*C.y,E=-.5*w.z+.5*C.z,y=A.x,b=A.y,T=A.z,R=B*I+x*N+G*D+y,O=g*I+k*N+F*D+b,L=P*I+_*N+E*D+T;p.push(new Cesium.Cartesian3(R,O,L))}p.push(C)}return p},a=Math.max(1,Number(this.style.curveResolution)||1);n.length<200&&a>1&&(n=l(n,a));const d=h=>{if(!h||h.length<2)return h;const f=[];f.push(h[0]);for(let p=0;p<h.length-1;p++){const u=h[p],m=h[p+1],w=new Cesium.Cartesian3(u.x*.75+m.x*.25,u.y*.75+m.y*.25,u.z*.75+m.z*.25),A=new Cesium.Cartesian3(u.x*.25+m.x*.75,u.y*.25+m.y*.75,u.z*.25+m.z*.75);f.push(w),f.push(A)}return f.push(h[h.length-1]),f};n=n.slice(),n.length<300&&(n=d(n),t===2&&n.length<300&&(n=d(n)))}const s=(Number(this.style.angleThreshold)||6)*(Math.PI/180),o=this.positions,r=(l,a,d,h)=>{if(!l||!a||!d)return!1;const f=a.x-l.x,p=a.y-l.y,u=a.z-l.z,m=d.x-a.x,w=d.y-a.y,A=d.z-a.z,C=Math.hypot(f,p,u),v=Math.hypot(m,w,A);if(C===0||v===0)return!1;const S=(f*m+p*w+u*A)/(C*v),D=Math.max(-1,Math.min(1,S)),N=Math.acos(D);return Math.abs(N)<=h};for(let l=0;l<n.length;l++){const a=n[l];if(o.length===0){o.push(Cesium.Cartesian3.clone(a));continue}const d=o[o.length-1];if(!(Cesium.Cartesian3.distance(d,a)<=this.minDistance*.5)){if(o.length>=2){const f=o[o.length-2],p=o[o.length-1],u=a;if(r(f,p,u,s)){o.pop(),o.push(Cesium.Cartesian3.clone(u));continue}}if(o.push(Cesium.Cartesian3.clone(a)),o.length>this.maxPositions){const f=o.length-this.maxPositions;f>0&&o.splice(0,f)}}}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=re&&re.lnglatsToCartesians?re.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:re.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 sy extends qe{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(()=>Or).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 l=this.style.arrowFixedSize!==void 0?this.style.arrowFixedSize:n*s;l<o&&(l=o),l>r&&(l=r);const a=this.Cesium.Cartesian3.subtract(t,e,new this.Cesium.Cartesian3);this.Cesium.Cartesian3.normalize(a,a);const d=this.Cesium.Transforms.eastNorthUpToFixedFrame(t),h=this.Cesium.Matrix4.getColumn(d,2,new this.Cesium.Cartesian3),f=new this.Cesium.Cartesian3(a.x-h.x*this.Cesium.Cartesian3.dot(a,h),a.y-h.y*this.Cesium.Cartesian3.dot(a,h),a.z-h.z*this.Cesium.Cartesian3.dot(a,h));let p;this.Cesium.Cartesian3.magnitudeSquared(f)<1e-6?p=this.Cesium.Matrix4.getColumn(d,0,new this.Cesium.Cartesian3):(this.Cesium.Cartesian3.normalize(f,f),p=this.Cesium.Cartesian3.cross(h,f,new this.Cesium.Cartesian3),this.Cesium.Cartesian3.normalize(p,p));const u=this.Cesium.Cartesian3.multiplyByScalar(a,-l,new this.Cesium.Cartesian3),m=this.Cesium.Cartesian3.add(t,u,new this.Cesium.Cartesian3),w=this.style.arrowWidthScale!==void 0?this.style.arrowWidthScale:1,A=Math.sin(this.arrowAngle)*l*w,C=this.Cesium.Cartesian3.multiplyByScalar(p,A,new this.Cesium.Cartesian3),v=this.Cesium.Cartesian3.multiplyByScalar(p,-A,new this.Cesium.Cartesian3),S=this.Cesium.Cartesian3.add(m,C,new this.Cesium.Cartesian3),D=this.Cesium.Cartesian3.add(m,v,new this.Cesium.Cartesian3);return[t,S,D,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}),console.log("this.arrowEntity",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 oy{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:l}=o;let a=r.plotType;const d=l.type,h=l.coordinates;let f=[],p="";switch(d){case"LineString":f=re.lnglatsToCartesians(h),p="polyline";break;case"Polygon":f=re.lnglatsToCartesians(h[0]),p="polygon";break;case"Point":f=re.lnglatsToCartesians([h])[0],p=a;break}this.fireEdit=!1;let u=this.createByPositions({type:p,styleType:a,positions:f,style:r.style});u&&n.push(u)}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 d=0;d<s.length;d++)o.push([s[d][0],s[d][1]]);let r=n.getStyle(),l=this.transType(n.type),a={type:"Feature",properties:{plotType:n.type,style:r},geometry:{type:l,coordinates:[]}};switch(l){case"Polygon":a.geometry.coordinates=[o];break;case"Point":a.geometry.coordinates=o;break;case"LineString":a.geometry.coordinates=o;break}a.properties=Object.assign(a.properties,n.properties),e.features.push(a)}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 l=n[r].id;if(l){for(let a=0;a<e.entityObjArr.length;a++)if(l.objId==e.entityObjArr[a].objId&&e.entityObjArr[a].state!="startCreate"&&e.entityObjArr[a].state!="creating"){s=a,o=l;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 l=0;l<e.entityObjArr.length;l++)if(r.objId==e.entityObjArr[l].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",l=>{let a=n.getAttribute("objId");r.removeByObjId(a)}),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 iy(this.viewer,e.style),n="折线_"),e.type=="freehandLine"&&(t=new ny(this.viewer,e.style),n="手绘线_"),e.type=="polygon"&&(t=new ey(this.viewer,e.style),n="面_"),e.type=="billboard"&&(t=new Cp(this.viewer,e.style),n="图标_"),(e.type=="circle"||e.type=="ellipse")&&(t=new Ep(this.viewer,e.style),n="圆_"),e.type=="rectangle"&&(t=new ty(this.viewer,e.style),n="矩形_"),e.type=="gltfModel"&&(t=new wp(this.viewer,e.style),n="模型_"),e.type=="point"&&(t=new ZA(this.viewer,e.style),n="点_"),e.type=="label"&&(t=new JA(this.viewer,e.style),n="文字_"),e.type=="arrow"&&(t=new sy(this.viewer,e.style)),t&&(t.name=n+new Date().getTime()),t}}class tl{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 oy(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(console.log("移动线段"),this._dragHandler){try{this._dragHandler.destroy()}catch{}this._dragHandler=null}let n=!1,s,o=0;const r=16,l=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);this._dragHandler=l;const a=d=>{let h;try{h=this.viewer.scene.pickPosition(d)}catch{}if(!this.Cesium.defined(h)){const f=this.viewer.camera.getPickRay(d);f&&(h=this.viewer.scene.globe.pick(f,this.viewer.scene))}return this.Cesium.defined(h)||(h=this.viewer.scene.camera.pickEllipsoid(d,this.viewer.scene.globe.ellipsoid)),h};l.setInputAction(d=>{let h=!1;const f=this.viewer.scene.drillPick(d.position)||[];for(let p=0;p<f.length;p++){const u=f[p].id;if(u&&u===this.centerHandle){h=!0;break}}if(h){n=!0;const p=a(d.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),l.setInputAction(d=>{if(!n||!this.Cesium.defined(s))return;const h=performance.now();if(h-o<r)return;o=h;const f=a(d.endPosition);if(!this.Cesium.defined(f))return;const p=this.Cesium.Cartesian3.subtract(f,s,new this.Cesium.Cartesian3);if(this.centerHandle&&this.centerHandle.position&&this.centerHandle.position.setValue){const u=this.centerHandle.position.getValue(this.Cesium.JulianDate.now());if(u){const m=this.Cesium.Cartesian3.add(u,p,new this.Cesium.Cartesian3);this.centerHandle.position.setValue(m)}}this.moveEntity(e,p);try{this.viewer.scene.requestRender()}catch{}s=f.clone()},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE),l.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 d=e.getEntity();if(d.state="done",d&&d.rectangle&&d.rectangle.coordinates)try{const h=d.rectangle.coordinates.getValue?d.rectangle.coordinates.getValue():d.rectangle.coordinates;h&&d.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 l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(n._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update rectangle positions:",l)}if(n._plotInstance&&n._plotInstance.type==="circle"&&typeof n._plotInstance.updatePositions=="function")try{const l=new this.Cesium.Cartesian3(t.x,t.y,t.z);if(n._plotInstance.updatePositions([l]))return}catch(l){console.warn("Failed to update circle positions:",l)}const r=(e.positions&&Array.isArray(e.positions)?e.positions:n.polyline.positions.getValue?n.polyline.positions.getValue():[]).map(l=>s(l));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,l={type:r,style:{}};switch(!0){case["freehandLine","CreateFreehandLine","polyline","CreatePolyline","arrow","CreateArrow"].includes(r):l.id=o.objId||o.id||Date.now().toString(),o.style&&(l.style={color:o.style.color,width:o.style.width,opacity:o.style.opacity,...o.style}),o.positions&&Array.isArray(o.positions)&&(l.positions=o.positions.map(a=>a&&typeof a=="object"&&a.x!==void 0&&a.y!==void 0&&a.z!==void 0?{x:a.x,y:a.y,z:a.z}:a)),["freehandLine","CreateFreehandLine"].includes(r)&&(l.isEdit=o.isEdit!==void 0?o.isEdit:!0,l.isFreehand=!0);break;case["rectangle","CreateRectangle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];if(o.positions&&Array.isArray(o.positions)&&o.positions.length)a=o.positions.map(d=>({x:d.x,y:d.y,z:d.z}));else{const d=o.getEntity?o.getEntity():o;if(d)try{if(d.polyline&&d.polyline.positions&&d.polyline.positions.getValue){const h=d.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(h)&&(a=h.map(f=>({x:f.x,y:f.y,z:f.z})))}else if(d.rectangle&&d.rectangle.coordinates&&d.rectangle.coordinates.getValue){const h=d.rectangle.coordinates.getValue(this.viewer.clock.currentTime);a=[{west:h.west,south:h.south,east:h.east,north:h.north}]}}catch{}}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):try{l.id=o.objId||o.id||Date.now().toString();let a=[];const d=o.getEntity?o.getEntity():o;if(d&&d._plotInstance&&d._plotInstance.type==="circle"&&d._plotInstance.center&&d._plotInstance.radiusPoint){const h=d._plotInstance;a=[{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)a=o.positions.map(h=>({x:h.x,y:h.y,z:h.z}));else if(d)try{if(d.polyline&&d.polyline.positions&&d.polyline.positions.getValue){const h=d.polyline.positions.getValue(this.viewer.clock.currentTime);Array.isArray(h)&&(a=h.map(f=>({x:f.x,y:f.y,z:f.z})))}else if(d.ellipse&&d.ellipse.center&&d.ellipse.center.getValue&&d.ellipse.semiMajorAxis&&d.ellipse.semiMajorAxis.getValue){const h=d.ellipse.center.getValue(this.viewer.clock.currentTime),f=d.ellipse.semiMajorAxis.getValue(this.viewer.clock.currentTime);if(h&&f){const p={x:h.x,y:h.y,z:h.z||0},u={x:p.x+f,y:p.y,z:p.z};a=[p,u]}}}catch{}o.style&&(l.style=Object.assign({},o.style)),a&&a.length&&(l.positions=a)}catch{}break;case["label","CreateLabel"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label){const d={};try{const h=a.label.fillColor&&a.label.fillColor.getValue?a.label.fillColor.getValue(this.viewer.clock.currentTime):a.label.fillColor;h&&(d.color=h)}catch{}a.label.font&&(d.font=a.label.font),l.style=d}}catch{}if(o.text)l.text=o.text;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.label&&a.label.text){const d=a.label.text.getValue?a.label.text.getValue(this.viewer.clock.currentTime):a.label.text;d&&(l.text=d)}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const d=a.position.getValue(this.viewer.clock.currentTime);d&&(l.position={x:d.x,y:d.y,z:d.z})}}catch{}break;case["billboard","CreateBillboard"].includes(r):if(o.style)l.style=Object.assign({},o.style);else try{const a=o.getEntity?o.getEntity():o;if(a&&a.billboard){const d={};try{const h=a.billboard.image&&a.billboard.image.getValue?a.billboard.image.getValue(this.viewer.clock.currentTime):a.billboard.image;if(h){if(typeof h=="string")d.image=h;else if(h&&h.src)try{const f=h;if(typeof document<"u"&&f instanceof HTMLImageElement){const p=document.createElement("canvas");p.width=f.naturalWidth||f.width||1,p.height=f.naturalHeight||f.height||1;const u=p.getContext("2d");u?(u.drawImage(f,0,0),d.image=p.toDataURL()):d.image=f.src}else d.image=h.src}catch{d.image=h.src}}}catch{}a.billboard.width&&(d.width=a.billboard.width),a.billboard.height&&(d.height=a.billboard.height),l.style=d}}catch{}if(o.position)l.position=o.position;else try{const a=o.getEntity?o.getEntity():o;if(a&&a.position&&a.position.getValue){const d=a.position.getValue(this.viewer.clock.currentTime);d&&(l.position={x:d.x,y:d.y,z:d.z})}}catch{}break;default:o.style&&(l.style=o.style),o.position&&(l.position=o.position);break}switch(!0){case["freehandLine","CreateFreehandLine"].includes(r):t.freehand.push(l);break;case["arrow","CreateArrow"].includes(r):t.arrow.push(l);break;case["label","CreateLabel"].includes(r):t.text.push(l);break;case["billboard","CreateBillboard"].includes(r):t.image.push(l);break;case["polyline","CreatePolyline"].includes(r):t.polyline.push(l);break;case["rectangle","CreateRectangle"].includes(r):t.rectangle.push(l);break;case["ellipse","CreateEllipse","circle","CreateCircle"].includes(r):t.ellipse.push(l);break;default:t.other.push(l)}}});const n={version:"1.0",exportTime:new Date().toISOString(),totalEntities:e.length,annotations:t},s=JSON.stringify(n);return console.log("标注数据已按类型分类保存,只包含重绘所需信息:",s),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,l)=>{Array.isArray(r)&&r.forEach(a=>{if(a.style){if(a.style.color&&typeof a.style.color=="object"){const d=a.style.color;a.style.color=`rgba(${Math.round(d.red*255)}, ${Math.round(d.green*255)}, ${Math.round(d.blue*255)}, ${d.alpha||1})`}if(a.style.outlineColor&&typeof a.style.outlineColor=="object"){const d=a.style.outlineColor;a.style.outlineColor=`rgba(${Math.round(d.red*255)}, ${Math.round(d.green*255)}, ${Math.round(d.blue*255)}, ${d.alpha||1})`}}switch(l){case"freehand":case"polyline":case"arrow":if(a.positions&&a.positions.length>0){const d=a.positions.map(p=>p&&typeof p=="object"?new this.Cesium.Cartesian3(p.x,p.y,p.z):p),h={type:l==="freehand"?"freehandLine":l,style:a.style||{},positions:d,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))},f=this.drawTool.createByPositions(h);if(f&&f.getEntity()){s++,f.isEdit=!0;const p=f.getEntity();p&&!p._plotInstance&&(p._plotInstance=f),p&&!p.objId&&(p.objId=f.objId),console.log(`Loaded ${l} entity with objId: ${f.objId}`)}}break;case"rectangle":{try{if(a.positions&&a.positions.length){let d=[];if(a.positions[0]&&a.positions[0].x!==void 0)d=a.positions.map(h=>new this.Cesium.Cartesian3(h.x,h.y,h.z!==void 0?h.z:0));else if(a.positions[0]&&a.positions[0].west!==void 0){const h=a.positions[0];d=[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(d.length){const h=JSON.parse(JSON.stringify(a.style||{}));if(h.color&&typeof h.color=="string"&&!h.color.startsWith("rgba"))try{const u=JSON.parse(h.color);u.red!==void 0&&(h.color=`rgba(${Math.round(u.red*255)}, ${Math.round(u.green*255)}, ${Math.round(u.blue*255)}, ${u.alpha||1})`)}catch{}const f={type:"rectangle",positions:d,style:h,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let p=null;try{p=this.drawTool.createByPositions(f)}catch(u){console.warn("drawTool.createByPositions(rectangle) failed",u)}if(p){s++,p.isEdit=!0;const u=p.getEntity?p.getEntity():p.entity||p;u&&(u._plotInstance=p,u.objId=p.objId||a.id,u.pickable=!0,u.polyline&&(u.polyline.pickWidth=10),console.log(`Loaded rectangle entity with objId: ${u.objId}, color: ${h.color}`))}}}}catch(d){console.warn("load rectangle failed",d)}break}case"text":if(a.position){const d=a.text||"文字标注",h={type:"label",style:a.style||{},text:d,position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};h.style.fontSize||(h.style.fontSize=14),h.style.fontFamily||(h.style.fontFamily="Arial");let f;try{!h.positions&&h.position&&(h.positions=h.position),f=this.drawTool.createByPositions(h),!f&&this.drawTool.startText&&(console.log("使用startText创建文字"),this.drawTool.startText(h.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.text=d,this.drawTool.currentEntity.position=h.position,f=this.drawTool.currentEntity))}catch(p){console.log("创建文字失败",p)}if(!f)try{const p=this.viewer.entities.add({position:h.position,label:Object.assign({text:d,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:{})}),u={getEntity:()=>p,entity:p,style:h.style||{},type:"label",objId:a.id||`label_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(p)};try{p.objId=u.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(u)),f=u}catch(p){console.warn("回退创建文字实体失败",p)}f&&(s++,f.isEdit=!0)}break;case"image":if(a.position){const d={type:"billboard",style:a.style||{},position:new this.Cesium.Cartesian3(a.position.x,a.position.y,a.position.z||0)};d.style.image||(console.log("使用默认图片占位符"),d.style.image="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4="),d.style.width||(d.style.width=50),d.style.height||(d.style.height=50);let h;try{!d.positions&&d.position&&(d.positions=d.position),h=this.drawTool.createByPositions(d),!h&&this.drawTool.startImage&&(console.log("使用startImage创建图片"),this.drawTool.startImage(d.style.image,d.style),this.drawTool.currentEntity&&(this.drawTool.currentEntity.position=d.position,h=this.drawTool.currentEntity))}catch(f){console.log("创建图片失败",f)}if(!h)try{const f=d.style&&d.style.image?d.style.image:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNlNTMyMzIiLz48L3N2Zz4=",p=this.viewer.entities.add({position:d.position,billboard:{image:f,width:d.style&&d.style.width?d.style.width:50,height:d.style&&d.style.height?d.style.height:50,verticalOrigin:d.style&&d.style.verticalOrigin||this.Cesium.VerticalOrigin.CENTER,scale:d.style&&d.style.scale||1}}),u={getEntity:()=>p,entity:p,style:d.style||{},type:"billboard",objId:a.id||`billboard_${Date.now()}_${Math.random().toFixed(3)}`,isEdit:!0,destroy:()=>this.viewer.entities.remove(p)};try{p.objId=u.objId}catch{}this.drawTool&&(this.drawTool.entityObjArr||(this.drawTool.entityObjArr=[]),this.drawTool.entityObjArr.push(u)),h=u}catch(f){console.warn("回退创建图片实体失败",f)}h&&(s++,h.isEdit=!0)}break;case"ellipse":case"circle":{try{const d=JSON.parse(JSON.stringify(a.style||{}));if(d.color&&typeof d.color=="string"&&!d.color.startsWith("rgba"))try{const p=JSON.parse(d.color);p.red!==void 0&&(d.color=`rgba(${Math.round(p.red*255)}, ${Math.round(p.green*255)}, ${Math.round(p.blue*255)}, ${p.alpha||1})`)}catch{}let h=[],f=!1;if(a.positions&&a.positions.length&&(a.positions[0]&&a.positions[0].x!==void 0&&(h=a.positions.map(p=>new this.Cesium.Cartesian3(p.x,p.y,p.z!==void 0?p.z:0))),h.length)){const p={type:l,positions:h,style:d,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let u=null;try{if(u=this.drawTool.createByPositions(p),u){s++,u.isEdit=!0;const m=u.getEntity?u.getEntity():u.entity||u;m&&(m._plotInstance=u,m.objId=u.objId||a.id,m.pickable=!0,m.polyline&&(m.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${m.objId} using positions`)),f=!0}}catch(m){console.warn(`drawTool.createByPositions(${l}) failed`,m)}}if(!f&&a.center&&a.radius)try{const p=new this.Cesium.Cartesian3(a.center.x,a.center.y,a.center.z||0),u=this.Cesium.Cartesian3.add(p,new this.Cesium.Cartesian3(a.radius,0,0),new this.Cesium.Cartesian3),w={type:l,positions:[p,u],style:d,id:a.id||+(new Date().getTime()+""+Number(Math.random()*1e3).toFixed(0))};let A=null;try{if(A=this.drawTool.createByPositions(w),A){s++,A.isEdit=!0;const C=A.getEntity?A.getEntity():A.entity||A;C&&(C._plotInstance=A,C.objId=A.objId||a.id,C.pickable=!0,C.polyline&&(C.polyline.pickWidth=10),console.log(`Loaded ${l} entity with objId: ${C.objId} using center and radius`))}}catch(C){console.warn(`drawTool.createByPositions(${l}) with center/radius failed`,C)}}catch(p){console.warn(`Fallback creation for ${l} failed`,p)}}catch(d){console.warn(`load ${l} failed`,d)}break}default:console.log(`尝试加载未知类型实体: ${l}`);break}})};return Object.keys(n).forEach(r=>{o(n[r],r)}),console.log(`成功加载 ${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}),console.log("通过实体对象的setStyle方法修改颜色成功"),!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,l=s.outlineWidth;s.material=n,o!==void 0&&(s.outline=o),r!==void 0&&(s.outlineColor=r),l!==void 0&&(s.outlineWidth=l)}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 il{viewer;cesium;handler=null;measureEntities=[];originalDoubleClickAction=null;onMeasure=()=>{};activePoints=[];floatingPoint=null;activeShape=null;type=null;unit="m";cursorPosition=null;isSnapping=!1;snapIndicator=null;constructor({viewer:e,cesium:t}){this.viewer=e,this.cesium=t;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.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction(n=>{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.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 l=t.Cartesian3.distance(s,o),a=t.Cartesian3.midpoint(s,o,new t.Cartesian3);this.addLabel(a,this.formatDistance(l));const d=t.Transforms.eastNorthUpToFixedFrame(s),h=t.Matrix4.inverse(d,new t.Matrix4),f=t.Matrix4.multiplyByPoint(h,o,new t.Cartesian3),p=f.x,u=f.y,m=f.z,w=t.Matrix4.getColumn(d,0,new t.Cartesian3),A=t.Matrix4.getColumn(d,1,new t.Cartesian3),C=t.Cartesian3.multiplyByScalar(w,p,new t.Cartesian3),v=t.Cartesian3.add(s,C,new t.Cartesian3),S=t.Cartesian3.multiplyByScalar(A,u,new t.Cartesian3),D=t.Cartesian3.add(v,S,new t.Cartesian3);if(this.viewer.scene.mode!==t.SceneMode.SCENE2D){const N=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,D],width:2,material:new t.PolylineDashMaterialProperty({color:t.Color.GREEN}),depthFailMaterial:new t.PolylineDashMaterialProperty({color:new t.Color(0,1,0,.5)})}}),B=this.viewer.entities.add({polyline:{positions:[D,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(N,I,B)}this.onMeasure({type:"distance",dx:p,dy:u,dz:m,dist:l}),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 a=this.viewer.entities.add({polyline:{positions:[s,o,r],width:2,material:t.Color.YELLOW,depthFailMaterial:t.Color.YELLOW}});this.measureEntities.push(a)}const l=this.calculateAngle(s,o,r);this.addLabel(o,`${l.toFixed(1)}°`),this.onMeasure({type:"angle",angle:l}),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.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 l=new t.Cartesian2(e.x+r.x,e.y+r.y);let a=null;try{a=this.viewer.scene.pick(l)}catch{}if(t.defined(a)&&(a instanceof t.Cesium3DTileFeature||a.primitive&&a.primitive instanceof t.PointPrimitive))try{const d=this.viewer.scene.pickPosition(l);if(d)return d}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 l=n[r];if(!l.show)continue;let a=[];if(l.polyline&&l.polyline.positions){const d=l.polyline.positions.getValue(t.JulianDate.now());d&&(a=d)}else if(l.polygon&&l.polygon.hierarchy){const d=l.polygon.hierarchy.getValue(t.JulianDate.now());d&&d.positions&&(a=d.positions)}else if(l.position){const d=l.position.getValue(t.JulianDate.now());d&&(a=[d])}else if(l.rectangle&&l.rectangle.coordinates){const d=l.rectangle.coordinates.getValue(t.JulianDate.now());d&&(a=[t.Cartesian3.fromRadians(d.west,d.south),t.Cartesian3.fromRadians(d.east,d.south),t.Cartesian3.fromRadians(d.east,d.north),t.Cartesian3.fromRadians(d.west,d.north)])}for(let d=0;d<a.length;d++){const h=a[d];try{const f=this.viewer.scene.cartesianToCanvasCoordinates(h);if(f){const p=t.Cartesian2.distance(f,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 l=s.Cartesian3.dot(o,r),a=Math.max(-1,Math.min(1,l)),d=Math.acos(a);return s.Math.toDegrees(d)}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],l=e[o+1],a=t.Cartesian3.subtract(r,n,new t.Cartesian3),d=t.Cartesian3.subtract(l,n,new t.Cartesian3),h=t.Cartesian3.cross(a,d,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 be=c.reactive({visible:!1,type:"info",title:"",description:"",closable:!1,showIcon:!0,duration:3});let ye=null,nl=null,sl=!1,Ss=null,rn=null,Ts=null;function ry(){if(rn||typeof document>"u")return;const i=`
|
|
50
30
|
.tech-alert-wrapper {
|
|
51
31
|
position: absolute;
|
|
52
32
|
top: 20px;
|
|
@@ -115,4 +95,24 @@
|
|
|
115
95
|
from { transform: rotate(0deg); }
|
|
116
96
|
to { transform: rotate(360deg); }
|
|
117
97
|
}
|
|
118
|
-
`;rn=document.createElement("style"),rn.textContent=i,document.head.appendChild(rn)}function dy(){if(sl)return;cy(),ye=document.createElement("div"),ye.className="tech-alert-wrapper",(Ts||document.body).appendChild(ye);const e={setup(){return()=>be.visible?c.h(ge.Alert,{class:`tech-alert tech-alert-${be.type}`,message:be.title,description:be.description,showIcon:be.showIcon,closable:be.closable,onClose:()=>{be.visible=!1}},{icon:()=>be.type==="loading"?c.h($t.LoadingOutlined):be.type==="success"?c.h($t.CheckCircleOutlined):be.type==="error"?c.h($t.CloseCircleOutlined):be.type==="warning"?c.h($t.ExclamationCircleOutlined):c.h($t.InfoCircleOutlined)}):null}};nl=c.createVNode(e),c.render(nl,ye),sl=!0}function mi(i){dy(),Ss&&clearTimeout(Ss),be.type=i.type||"info",be.title=i.title||"",be.description=i.description||"",be.closable=i.closable??!1,be.showIcon=i.showIcon??!0,be.visible=!0;const e=i.container||Ts;ye&&(e?(ye.parentNode!==e&&e.appendChild(ye),ye.style.position="absolute",ye.style.top="20px",ye.style.left="50%",ye.style.transform="translateX(-50%)"):(ye.parentNode!==document.body&&document.body.appendChild(ye),ye.style.position="fixed",ye.style.top="20px",ye.style.left="50%",ye.style.transform="translateX(-50%)"));const t=i.duration??(be.type==="loading"?0:3);t>0&&(Ss=setTimeout(()=>{be.visible=!1},t*1e3))}const fe={setContainer:i=>{Ts=i,ye&&i&&ye.parentNode!==i&&(i.appendChild(ye),ye.style.position="absolute")},info:(i,e,t,n)=>mi({type:"info",title:i,description:e,duration:t,container:n}),success:(i,e,t,n)=>mi({type:"success",title:i,description:e,duration:t,container:n}),error:(i,e,t,n)=>mi({type:"error",title:i,description:e,duration:t,container:n}),warning:(i,e,t,n)=>mi({type:"warning",title:i,description:e,duration:t,container:n}),loading:(i,e,t)=>mi({type:"loading",title:i,description:e,duration:0,container:t}),close:()=>{be.visible=!1}};function Ms(i){return c.getCurrentScope()?(c.onScopeDispose(i),!0):!1}function Ds(i){return typeof i=="function"?i():c.unref(i)}const hy=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const uy=Object.prototype.toString,fy=i=>uy.call(i)==="[object Object]",py=()=>{};function gy(i){return c.getCurrentInstance()}function ol(i,e=!0,t){gy()?c.onMounted(i,t):e?i():c.nextTick(i)}function Tt(i){var e;const t=Ds(i);return(e=t?.$el)!=null?e:t}const Ai=hy?window:void 0;function my(...i){let e,t,n,s;if(typeof i[0]=="string"||Array.isArray(i[0])?([t,n,s]=i,e=Ai):[e,t,n,s]=i,!e)return py;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},l=(h,f,p,u)=>(h.addEventListener(f,p,u),()=>h.removeEventListener(f,p,u)),a=c.watch(()=>[Tt(e),Ds(s)],([h,f])=>{if(r(),!h)return;const p=fy(f)?{...f}:f;o.push(...t.flatMap(u=>n.map(m=>l(h,u,m,p))))},{immediate:!0,flush:"post"}),d=()=>{a(),r()};return Ms(d),d}function Ay(){const i=c.ref(!1),e=c.getCurrentInstance();return e&&c.onMounted(()=>{i.value=!0},e),i}function rl(i){const e=Ay();return c.computed(()=>(e.value,!!i()))}function yy(i,e={}){const{window:t=Ai}=e,n=rl(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const o=c.ref(!1),r=d=>{o.value=d.matches},l=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",r):s.removeListener(r))},a=c.watchEffect(()=>{n.value&&(l(),s=t.matchMedia(Ds(i)),"addEventListener"in s?s.addEventListener("change",r):s.addListener(r),o.value=s.matches)});return Ms(()=>{a(),l(),s=void 0}),o}function Cy(i,e,t={}){const{window:n=Ai,...s}=t;let o;const r=rl(()=>n&&"ResizeObserver"in n),l=()=>{o&&(o.disconnect(),o=void 0)},a=c.computed(()=>Array.isArray(i)?i.map(f=>Tt(f)):[Tt(i)]),d=c.watch(a,f=>{if(l(),r.value&&n){o=new ResizeObserver(e);for(const p of f)p&&o.observe(p,s)}},{immediate:!0,flush:"post"}),h=()=>{l(),d()};return Ms(h),{isSupported:r,stop:h}}function Ey(i,e={width:0,height:0},t={}){const{window:n=Ai,box:s="content-box"}=t,o=c.computed(()=>{var f,p;return(p=(f=Tt(i))==null?void 0:f.namespaceURI)==null?void 0:p.includes("svg")}),r=c.ref(e.width),l=c.ref(e.height),{stop:a}=Cy(i,([f])=>{const p=s==="border-box"?f.borderBoxSize:s==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(n&&o.value){const u=Tt(i);if(u){const m=u.getBoundingClientRect();r.value=m.width,l.value=m.height}}else if(p){const u=Array.isArray(p)?p:[p];r.value=u.reduce((m,{inlineSize:b})=>m+b,0),l.value=u.reduce((m,{blockSize:b})=>m+b,0)}else r.value=f.contentRect.width,l.value=f.contentRect.height},t);ol(()=>{const f=Tt(i);f&&(r.value="offsetWidth"in f?f.offsetWidth:e.width,l.value="offsetHeight"in f?f.offsetHeight:e.height)});const d=c.watch(()=>Tt(i),f=>{r.value=f?e.width:0,l.value=f?e.height:0});function h(){a(),d()}return{width:r,height:l,stop:h}}function wy(i={}){const{window:e=Ai,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:o=!0}=i,r=c.ref(t),l=c.ref(n),a=()=>{e&&(o?(r.value=e.innerWidth,l.value=e.innerHeight):(r.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight))};if(a(),ol(a),my("resize",a,{passive:!0}),s){const d=yy("(orientation: portrait)");c.watch(d,()=>a())}return{width:r,height:l}}const by={class:"title"},vy={class:"actions"},Iy={class:"card-body"},By=c.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=c.inject("leiting-theme",c.ref("dark")),s=e,o=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:D=>{s("update:visible",D),s("update:open",D)}}),r=c.ref(null),l=c.ref(t.initialPosition?.x||0),a=c.ref(t.initialPosition?.y||0),d=c.ref(t.width),h=c.ref(t.fullHeight?"100%":"600px");c.watch(()=>t.fullHeight,D=>{D?h.value="100%":h.value==="100%"&&(h.value="600px")});const{height:f}=wy();c.watch(f,()=>{t.fullHeight&&(h.value="100%")});const p=c.ref(!1),u=D=>{p.value=!0,D.preventDefault(),D.stopPropagation();const N=D.clientX,I=D.clientY,B=typeof d.value=="number"?d.value:r.value?.offsetWidth||0,g=typeof h.value=="number"?h.value:r.value?.offsetHeight||0,P=k=>{if(!p.value)return;k.preventDefault();const U=k.clientX-N,G=k.clientY-I,F=B+U,E=g+G;F>100&&(d.value=F),E>100&&(h.value=E)},x=()=>{p.value=!1,document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",P),document.addEventListener("mouseup",x)},m=c.computed(()=>({left:`${l.value}px`,top:`${a.value}px`,width:typeof d.value=="number"?`${d.value}px`:d.value,height:typeof h.value=="number"?`${h.value}px`:h.value,position:"absolute",zIndex:2e3})),b=()=>{c.nextTick(()=>{if(r.value){const D=r.value.offsetParent||document.body,N=D.clientWidth,I=D.clientHeight,B=typeof d.value=="number"?d.value:r.value.offsetWidth||350,g=typeof h.value=="number"?h.value:r.value.offsetHeight||600;l.value+B>N&&(l.value=Math.max(0,N-B-20)),a.value+g>I&&(a.value=Math.max(0,I-g-20)),l.value<0&&(l.value=0),a.value<0&&(a.value=0)}})},A=c.ref(!1),C=D=>{if(D.target.closest(".close-btn")||D.target.closest(".actions"))return;A.value=!0,D.preventDefault(),D.stopPropagation();const N=D.clientX,I=D.clientY,B=l.value,g=a.value,P=k=>{if(!A.value)return;k.preventDefault();const U=k.clientX-N,G=k.clientY-I;l.value=B+U,a.value=g+G},x=()=>{A.value=!1,document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",x),b()};document.addEventListener("mousemove",P),document.addEventListener("mouseup",x)},v=()=>{c.nextTick(()=>{if(t.align&&r.value){const D=r.value.offsetParent||document.body,N=typeof d.value=="number"?d.value:r.value.offsetWidth||350;t.align==="right"?l.value=Math.max(0,D.clientWidth-N-20):t.align==="center"&&(l.value=Math.max(0,(D.clientWidth-N)/2))}b()})};c.onMounted(()=>{t.align?v():b()}),c.watch(o,D=>{D&&(t.align?v():b())});const S=()=>{o.value=!1,s("close")};return(D,N)=>c.withDirectives((c.openBlock(),c.createElementBlock("div",{ref_key:"cardRef",ref:r,class:c.normalizeClass(["draggable-card leiting-scroll",["leiting-theme-"+c.unref(n)]]),style:c.normalizeStyle(m.value)},[c.createElementVNode("div",{ref:"headerRef",class:"card-header",onMousedown:C},[c.createElementVNode("span",by,c.toDisplayString(i.title),1),c.createElementVNode("div",vy,[c.renderSlot(D.$slots,"header-extra",{},void 0,!0),c.createElementVNode("span",{class:"close-btn",onClick:S},"×")])],544),c.createElementVNode("div",Iy,[c.renderSlot(D.$slots,"default",{},void 0,!0)]),c.createElementVNode("div",{class:"resize-handle",onMousedown:u},[...N[0]||(N[0]=[c.createElementVNode("svg",{viewBox:"0 0 10 10",width:"10",height:"10",fill:"currentColor"},[c.createElementVNode("path",{d:"M10 10 L10 2 L2 10 Z"})],-1)])],32)],6)),[[c.vShow,o.value]])}}),Oe=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},Pe=Oe(By,[["__scopeId","data-v-50bf6126"]]);function xy(i){const e=c.ref([]),t=c.ref([]),n=c.ref([]),s=c.ref(""),o=c.ref(!0);c.watch(()=>c.unref(i),f=>{if(!f||f.length===0)return;const p=[],u=(A,C)=>{A.forEach(v=>{const S=v.id||v.key||v.$id,D=v.modelId||C;D&&(v.modelId=D),S&&p.push(S),v.children&&v.children.length>0&&u(v.children,D)})};u(f);const m=new Set(n.value);let b=!1;p.forEach(A=>{m.has(A)||(m.add(A),b=!0)}),b&&(n.value=Array.from(m))},{immediate:!0,deep:!0});const r=c.computed(()=>{const f=c.unref(i);if(!f)return[];const p=[],u=(m,b)=>{m.forEach(A=>{const C=A.id||A.key||A.$id,v=A.name||A.title;p.push({key:C,title:v,parentKey:b}),A.children&&A.children.length>0&&u(A.children,C)})};return u(f),p}),l=f=>{e.value=f,o.value=!1},a=f=>{n.value=f},d=f=>{t.value=f},h=f=>r.value.find(u=>u.key===f)?.parentKey;return c.watch(s,f=>{if(!f)return;const u=r.value.filter(b=>b.title&&b.title.toLowerCase().includes(f.toLowerCase())).map(b=>b.parentKey),m=new Set;u.forEach(b=>{let A=b;for(;A;)m.add(A),A=h(A)}),e.value=[...m],o.value=!0}),{expandedKeys:e,selectedKeys:t,checkedKeys:n,searchValue:s,autoExpandParent:o,onExpand:l,onCheck:a,onSelect:d}}const Sy={class:"search-box"},Ty={key:0},My={style:{color:"#f50"}},Dy={key:1},ky={key:1,class:"empty-tip"},an=Oe(c.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=ge.Input.Search,n=ge.Tree,s=i,o=e,r=c.inject("leiting-theme",c.ref("dark")),l=c.inject("leitingMethods"),a=x=>{l?.value?.onSearchComponent&&l.value.onSearchComponent(x)},d=c.computed({get:()=>s.open!==void 0?s.open:s.visible,set:x=>{o("update:visible",x),o("update:open",x)}}),h=c.ref(null),{height:f}=Ey(h),p=c.computed(()=>f.value||300),u=c.ref({children:"children",title:"name",key:"id"}),m=c.ref([]),{expandedKeys:b,selectedKeys:A,checkedKeys:C,searchValue:v,autoExpandParent:S}=xy(c.toRef(s,"treeData")),D=(x,k)=>{if(!k)return x;const U=k.toLowerCase();return x.reduce((G,F)=>{const y=(F.name||F.title||"").toLowerCase().includes(U);if(F.children&&F.children.length>0){const w=D(F.children,k);(w.length>0||y)&&G.push({...F,children:w})}else y&&G.push({...F});return G},[])};c.watch([()=>s.treeData,v],([x,k])=>{x?m.value=D(x,k||""):m.value=[]},{immediate:!0,deep:!0});const N=x=>{b.value=x,S.value=!1},I=x=>{const k=[],U=G=>{if(!G.children||G.children.length===0){const E=G.element_Id;G.modelId&&E&&k.push({modelId:G.modelId,elementId:E})}else G.children.forEach(U)};return U(x),k},B=(x,k)=>{C.value=x,o("check",x,k);const U=[],G=new Set(x.map(E=>String(E))),F=E=>{for(let y=0;y<E.length;y++){const w=E[y];if(!w.children||w.children.length===0){if(!G.has(String(w.id))){const O=w.element_Id;w.modelId&&O&&U.push({modelId:w.modelId,elementId:O,show:!1})}}else w.children&&F(w.children)}};s.treeData&&F(s.treeData),l?.value?.setComponentVisibility&&l.value.setComponentVisibility(U),l?.value?.onTreeCheck&&l.value.onTreeCheck(x,k)},g=(x,k)=>{if(A.value=x,o("select",x,k),k.selected){const U=I(k.node);U.length>0&&l?.value?.flyToObjects&&l.value.flyToObjects({selectCpts:U})}l?.value?.onTreeSelect&&l.value.onTreeSelect(x,k)},P=()=>{o("update:visible",!1),o("close")};return(x,k)=>(c.openBlock(),c.createBlock(Pe,{visible:d.value,"onUpdate:visible":k[1]||(k[1]=U=>d.value=U),title:i.title,"initial-position":i.initialPosition,"full-height":i.fullHeight,onClose:P},{default:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["leiting-tree-container",[`theme-${c.unref(r)}`]])},[c.createElementVNode("div",Sy,[c.createVNode(c.unref(t),{value:c.unref(v),"onUpdate:value":k[0]||(k[0]=U=>c.isRef(v)?v.value=U:null),placeholder:"搜索构件","allow-clear":"","enter-button":"",onSearch:a},null,8,["value"])]),c.createElementVNode("div",{class:"tree-wrapper",ref_key:"treeWrapperRef",ref:h},[m.value&&m.value.length?(c.openBlock(),c.createBlock(c.unref(n),{key:0,"tree-data":m.value,"field-names":u.value,height:p.value,"expanded-keys":c.unref(b),"auto-expand-parent":c.unref(S),"selected-keys":c.unref(A),"checked-keys":c.unref(C),checkable:"","block-node":"",onExpand:N,onSelect:g,onCheck:B},{title:c.withCtx(({name:U,title:G})=>[(U||G)&&c.unref(v)&&(U||G).toLowerCase().indexOf(c.unref(v).toLowerCase())>-1?(c.openBlock(),c.createElementBlock("span",Ty,[c.createTextVNode(c.toDisplayString((U||G).substr(0,(U||G).toLowerCase().indexOf(c.unref(v).toLowerCase())))+" ",1),c.createElementVNode("span",My,c.toDisplayString(c.unref(v)),1),c.createTextVNode(" "+c.toDisplayString((U||G).substr((U||G).toLowerCase().indexOf(c.unref(v).toLowerCase())+c.unref(v).length)),1)])):(c.openBlock(),c.createElementBlock("span",Dy,c.toDisplayString(U||G),1))]),_:1},8,["tree-data","field-names","height","expanded-keys","auto-expand-parent","selected-keys","checked-keys"])):(c.openBlock(),c.createElementBlock("div",ky,"暂无数据"))],512)],2)]),_:1},8,["visible","title","initial-position","full-height"]))}}),[["__scopeId","data-v-3748c20d"]]),Py="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEhSURBVDhP1ZRhkcIwEIWJAsDBOTgkgAJAAYcCQAFFAUgoDjgFh4Q7B+cAUFC+19kyS0hL+Ulm3nS6+/ZLNkkbOk9GURRDWUIIxyZraEoCWZLfmmcOLK/z14KAqGiGvq14zDMHNk/BHkAAehh/0ABtKMxUSFzPNfpFI+JnD7wDYVaxIIov41bIfxHfoRO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U5ErkJggg==",Qy={class:"menu-container"},Gy=["onClick","title"],Hy={class:"menu-icon"},Yy=["src","alt"],Vy={key:3,style:{"font-size":"12px"}},zy={key:0,class:"sub-menu"},Wy=["onClick"],yi=c.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=c.inject("leiting-theme",c.ref("dark")),s=c.inject("leiting-menu-size",c.ref("medium")),o=c.inject("leitingMethods",c.ref({})),r=c.computed(()=>n.value||n),l=c.computed(()=>s.value||s),a=c.ref([{ID:"home",title:"主视角",src:Py,key:"homeView"},{ID:"tree",title:"目录树",src:al,key:"componentTree"},{ID:"cadLayer",title:"图层",src:al,key:"cadLayer"},{ID:"measure",title:"量算",src:Fy,key:"measurement"},{ID:"section",title:"剖切",src:Ry,key:"section"},{ID:"roam",title:"人物漫游",src:Oy,key:"roam"},{ID:"info",title:"构件信息",src:Ly,key:"componentInfo"},{ID:"cadPosition",title:"调整位置",src:Ny,key:"cadPosition"},{ID:"annotation",title:"标注",src:_y,key:"annotation"},{ID:"setting",title:"设置",src:Uy,key:"setting"}]),d=c.ref([]),h=c.ref([...t.activeIds]);c.watch(()=>t.activeIds,D=>{h.value=[...D]},{deep:!0});const f=c.computed(()=>t.visible);o.value&&o.value.menuEvents&&(o.value.menuEvents.on("setMenuListFilter",D=>{d.value=D}),o.value.menuEvents.on("setMenuActive",(D,N)=>{N?h.value.includes(D)||h.value.push(D):h.value=h.value.filter(I=>I!==D)}));const p=c.computed(()=>{let D=a.value;if(t.is2d){const N=["homeView","measurement","cadLayer","annotation"];D=D.filter(I=>I.key&&N.includes(I.key))}else{const N=["cadLayer","cadPosition","annotation"];D=D.filter(I=>!I.key||!N.includes(I.key))}if(d.value.length>0&&(D=D.filter(N=>!N.key||!d.value.includes(N.key))),t.customItems&&t.customItems.length>0){const N=t.customItems.map(I=>({...I,key:I.ID,src:I.src||I.icon}));return[...D,...N]}return D}),u=e,m=D=>{const N=["homeView"];if(D.key&&N.includes(D.key))h.value.includes(D.ID)||(h.value.push(D.ID),setTimeout(()=>{const B=h.value.indexOf(D.ID);B>-1&&h.value.splice(B,1)},1e3));else{const B=h.value.indexOf(D.ID);B>-1?h.value.splice(B,1):h.value.push(D.ID)}const I=h.value.includes(D.ID);D.func&&D.func(D),D.key&&u("action",D.key,I)},b=D=>{d.value=D},A=D=>{console.log("LeitingMenu received showMenu event:",D)},C=(D,N)=>{const I=p.value.find(B=>B.ID===D||B.key===D);if(I){const B=h.value.indexOf(I.ID);N&&B===-1?h.value.push(I.ID):!N&&B>-1&&h.value.splice(B,1)}};let v=null;const S=()=>{o.value?.menuEvents&&(v&&(v.off("setMenuListFilter",b),v.off("showMenu",A),v.off("setMenuActive",C)),v=o.value.menuEvents,v.on("setMenuListFilter",b),v.on("showMenu",A),v.on("setMenuActive",C))};return c.onMounted(()=>{S()}),c.onUnmounted(()=>{v&&(v.off("setMenuListFilter",b),v.off("showMenu",A),v.off("setMenuActive",C))}),c.watch(o,()=>{S()},{deep:!0}),(D,N)=>c.withDirectives((c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["leiting-menu-wrapper",["leiting-theme-"+r.value,"size-"+l.value]])},[c.createElementVNode("div",Qy,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(p.value,I=>(c.openBlock(),c.createElementBlock("div",{key:I.ID,class:c.normalizeClass(["menu-item",{active:h.value.includes(I.ID)}]),onClick:B=>m(I),title:I.title},[c.createElementVNode("div",Hy,[I.src?(c.openBlock(),c.createElementBlock("img",{key:0,src:I.src,alt:I.title},null,8,Yy)):typeof I.icon=="object"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(I.icon),{key:1})):typeof I.icon=="string"?(c.openBlock(),c.createElementBlock("i",{key:2,class:c.normalizeClass(["iconfont",`icon-${I.icon}`])},null,2)):(c.openBlock(),c.createElementBlock("span",Vy,c.toDisplayString(I.title.substring(0,2)),1))]),I.children&&I.children.length>0?(c.openBlock(),c.createElementBlock("div",zy,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(I.children,B=>(c.openBlock(),c.createElementBlock("div",{key:B.ID,class:c.normalizeClass(["sub-menu-item",{active:h.value.includes(B.ID)}]),onClick:c.withModifiers(g=>m(B),["stop"])},c.toDisplayString(B.title),11,Wy))),128))])):c.createCommentVNode("",!0)],10,Gy))),128))])],2)),[[c.vShow,f.value]])}}),jy={class:"leiting-section-content"},Ky={class:"section-form-item"},$y={class:"radio-group"},Xy={class:"section-form-item"},qy={class:"switch-container"},Jy={class:"switch"},Zy={class:"status-text"},e0={class:"section-form-item slider-item"},t0={class:"slider-wrapper"},i0={class:"section-form-item slider-item"},n0={class:"slider-wrapper"},s0={class:"section-form-item slider-item"},o0={class:"slider-wrapper"},r0={class:"section-form-item table-item"},a0={class:"model-table-container"},l0={class:"model-table"},c0={width:"40"},d0=["checked"],h0=["onClick"],u0=["value"],f0={class:"model-name"},Ci=Oe(c.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=c.inject("leitingMethods"),o=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:F=>{n("update:visible",F),n("update:open",F)}}),r=c.ref("Box"),l=c.ref(!1),a=c.ref([]),d=c.ref([]),h=c.computed(()=>d.value.length===0?!1:d.value.every(F=>a.value.includes(F.modelId))),f=F=>{F.target.checked?a.value=d.value.map(y=>y.modelId):a.value=[],P()},p=c.ref([-10,10]),u=c.ref([-10,10]),m=c.ref([-10,10]),b=c.ref([-100,100]),A=c.ref([-100,100]),C=c.ref([-100,100]);let v=!1;const S=F=>{v=!0;const{targetZPlus:E,targetZMinus:y,targetXPlus:w,targetXMinus:T,targetYPlus:R,targetYMinus:O}=F;m.value=[-y,E],p.value=[-T,w],u.value=[-O,R],setTimeout(()=>{v=!1},100)},D=()=>{v||a.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:u.value[1],targetYMinus:-u.value[0]})},N=()=>{s?.value?.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)},I=F=>{if(!s?.value?.getMapTileset||!s?.value?.openSection)return;const y=s.value.getMapTileset()[F];if(y&&y.leiting?.box){const{min:w,max:T}=y.leiting.box,R=(T.x-w.x)/2,O=(T.y-w.y)/2,L=(T.z-w.z)/2;a.value.length<=1&&(b.value=[-R*2,R*2],A.value=[-O*2,O*2],C.value=[-L*2,L*2],p.value=[-R,R],u.value=[-O,O],m.value=[-L,L],s.value.updateSectionRange&&s.value.updateSectionRange({targetZPlus:L,targetZMinus:L,targetXPlus:R,targetXMinus:R,targetYPlus:O,targetYMinus:O})),s.value.openSection(F,{moveCallBack:S}),s.value.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)}},B=F=>{const E=a.value.indexOf(F);E>-1?a.value.splice(E,1):a.value.push(F),P()};let g=[];const P=()=>{const F=a.value.filter(y=>!g.includes(y)),E=g.filter(y=>!a.value.includes(y));F.forEach(y=>I(y)),E.forEach(y=>{s?.value?.closeSection&&s.value.closeSection(y)}),g=[...a.value]},x=()=>{},k=()=>{o.value=!1,n("close")},U=()=>{l.value=!1,a.value=[],g=[],p.value=[-10,10],u.value=[-10,10],m.value=[-10,10],b.value=[-100,100],A.value=[-100,100],C.value=[-100,100]};c.watch(()=>t.visible,F=>{F?G():(s?.value?.closeSection&&s.value.closeSection(),U())});const G=()=>{s?.value&&typeof s.value.getModelList=="function"&&(d.value=s.value.getModelList()||[],d.value.length>0&&a.value.length===0&&(a.value=[d.value[0].modelId],g=[...a.value]),t.visible&&a.value.length>0&&(l.value=!0,a.value.forEach(F=>I(F))))};return c.watch(()=>s?.value,()=>{G()},{immediate:!0,deep:!0}),c.onMounted(()=>{G()}),(F,E)=>(c.openBlock(),c.createBlock(Pe,{visible:o.value,title:"剖切分析","full-height":i.fullHeight,"onUpdate:visible":k},{default:c.withCtx(()=>[c.createElementVNode("div",jy,[c.createElementVNode("div",Ky,[E[8]||(E[8]=c.createElementVNode("span",{class:"label"},"模式",-1)),c.createElementVNode("div",$y,[c.createElementVNode("label",{class:c.normalizeClass(["radio-item",{active:r.value==="Box"}])},[c.withDirectives(c.createElementVNode("input",{type:"radio",value:"Box","onUpdate:modelValue":E[0]||(E[0]=y=>r.value=y),onChange:x},null,544),[[c.vModelRadio,r.value]]),E[7]||(E[7]=c.createTextVNode(" 剖切盒 ",-1))],2)])]),c.createElementVNode("div",Xy,[E[10]||(E[10]=c.createElementVNode("span",{class:"label"},"显示",-1)),c.createElementVNode("div",qy,[c.createElementVNode("label",Jy,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":E[1]||(E[1]=y=>l.value=y),onChange:N},null,544),[[c.vModelCheckbox,l.value]]),E[9]||(E[9]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",Zy,c.toDisplayString(l.value?"显示":"隐藏"),1)])]),c.createElementVNode("div",e0,[E[11]||(E[11]=c.createElementVNode("span",{class:"label"},"X 轴",-1)),c.createElementVNode("div",t0,[c.createVNode(c.unref(ge.Slider),{value:p.value,"onUpdate:value":E[2]||(E[2]=y=>p.value=y),range:"",min:b.value[0],max:b.value[1],step:.1,onChange:D},null,8,["value","min","max"])])]),c.createElementVNode("div",i0,[E[12]||(E[12]=c.createElementVNode("span",{class:"label"},"Y 轴",-1)),c.createElementVNode("div",n0,[c.createVNode(c.unref(ge.Slider),{value:u.value,"onUpdate:value":E[3]||(E[3]=y=>u.value=y),range:"",min:A.value[0],max:A.value[1],step:.1,onChange:D},null,8,["value","min","max"])])]),c.createElementVNode("div",s0,[E[13]||(E[13]=c.createElementVNode("span",{class:"label"},"Z 轴",-1)),c.createElementVNode("div",o0,[c.createVNode(c.unref(ge.Slider),{value:m.value,"onUpdate:value":E[4]||(E[4]=y=>m.value=y),range:"",min:C.value[0],max:C.value[1],step:.1,onChange:D},null,8,["value","min","max"])])]),c.createElementVNode("div",r0,[E[15]||(E[15]=c.createElementVNode("span",{class:"label"},"模型",-1)),c.createElementVNode("div",a0,[c.createElementVNode("table",l0,[c.createElementVNode("thead",null,[c.createElementVNode("tr",null,[c.createElementVNode("th",c0,[c.createElementVNode("input",{type:"checkbox",checked:h.value,onChange:f},null,40,d0)]),E[14]||(E[14]=c.createElementVNode("th",null,"名称",-1))])]),c.createElementVNode("tbody",null,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,y=>(c.openBlock(),c.createElementBlock("tr",{key:y.modelId,class:c.normalizeClass({selected:a.value.includes(y.modelId)}),onClick:w=>B(y.modelId)},[c.createElementVNode("td",null,[c.withDirectives(c.createElementVNode("input",{type:"checkbox",value:y.modelId,"onUpdate:modelValue":E[5]||(E[5]=w=>a.value=w),onClick:E[6]||(E[6]=c.withModifiers(()=>{},["stop"])),onChange:P},null,40,u0),[[c.vModelCheckbox,a.value]])]),c.createElementVNode("td",f0,c.toDisplayString(y.modelName),1)],10,h0))),128))])])])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-ee4d9a12"]]),p0={class:"leiting-player-content"},g0={class:"player-form-item"},m0={class:"switch-container"},A0={class:"switch"},y0={class:"status-text"},C0={class:"player-form-item"},E0={class:"switch-container"},w0={class:"switch"},b0={class:"status-text"},v0={class:"player-form-item"},I0={class:"switch-container"},B0={class:"switch"},x0={class:"status-text"},S0={class:"player-form-item slider-item"},T0={class:"slider-wrapper"},M0={class:"value-text"},D0={class:"instructions"},k0={class:"key-map"},P0={class:"key-row"},F0={class:"key-row"},R0={class:"key-row"},O0={class:"key-row"},L0={class:"key-row"},N0={class:"key-row"},Ei=Oe(c.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=c.inject("leitingMethods"),o=c.ref(!1),r=c.ref(!1),l=c.ref(!0),a=c.ref(5),d=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:I=>{n("update:visible",I),n("update:open",I)}}),h=c.ref(null),f=c.ref(null),p=c.ref(null),u=c.ref(null),m=c.ref(null),b=c.ref(null),A=()=>{o.value?v():S()},C=()=>{s?.value?.setPlayerParams&&s.value.setPlayerParams({gravityTest:r.value,collisionTest:l.value})},v=async()=>{s?.value?.openPlayer&&(await s.value.openPlayer(),s.value.setPlayerSpeed&&s.value.setPlayerSpeed(a.value),C(),s.value.bindPlayerUiKeys&&(await c.nextTick(),s.value.bindPlayerUiKeys({moveFront:h.value,moveBack:f.value,moveLeft:p.value,moveRight:u.value,moveUp:m.value,moveDown:b.value})))},S=()=>{s?.value?.closePlayer&&s.value.closePlayer()},D=()=>{s?.value?.setPlayerSpeed&&s.value.setPlayerSpeed(a.value)},N=()=>{d.value=!1,n("close")};return c.watch(()=>t.visible,I=>{I?(o.value=!0,s?.value?v():setTimeout(()=>{s?.value&&v()},100)):o.value&&(o.value=!1,S())},{immediate:!0}),(I,B)=>(c.openBlock(),c.createBlock(Pe,{title:i.title,visible:d.value,"full-height":i.fullHeight,"onUpdate:visible":N},{default:c.withCtx(()=>[c.createElementVNode("div",p0,[c.createElementVNode("div",g0,[B[5]||(B[5]=c.createElementVNode("span",{class:"label"},"启用",-1)),c.createElementVNode("div",m0,[c.createElementVNode("label",A0,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":B[0]||(B[0]=g=>o.value=g),onChange:A},null,544),[[c.vModelCheckbox,o.value]]),B[4]||(B[4]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",y0,c.toDisplayString(o.value?"开启":"关闭"),1)])]),c.createElementVNode("div",C0,[B[7]||(B[7]=c.createElementVNode("span",{class:"label"},"重力",-1)),c.createElementVNode("div",E0,[c.createElementVNode("label",w0,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":B[1]||(B[1]=g=>r.value=g),onChange:C},null,544),[[c.vModelCheckbox,r.value]]),B[6]||(B[6]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",b0,c.toDisplayString(r.value?"开启":"关闭"),1)])]),c.createElementVNode("div",v0,[B[9]||(B[9]=c.createElementVNode("span",{class:"label"},"碰撞",-1)),c.createElementVNode("div",I0,[c.createElementVNode("label",B0,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":B[2]||(B[2]=g=>l.value=g),onChange:C},null,544),[[c.vModelCheckbox,l.value]]),B[8]||(B[8]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",x0,c.toDisplayString(l.value?"开启":"关闭"),1)])]),c.createElementVNode("div",S0,[B[10]||(B[10]=c.createElementVNode("span",{class:"label"},"速度",-1)),c.createElementVNode("div",T0,[c.createVNode(c.unref(ge.Slider),{value:a.value,"onUpdate:value":B[3]||(B[3]=g=>a.value=g),min:1,max:10,step:1,onChange:D},null,8,["value"])]),c.createElementVNode("span",M0,c.toDisplayString(a.value),1)]),B[19]||(B[19]=c.createElementVNode("div",{class:"divider"},null,-1)),c.createElementVNode("div",D0,[B[18]||(B[18]=c.createElementVNode("div",{class:"instruction-title"},"操作说明",-1)),c.createElementVNode("div",k0,[c.createElementVNode("div",P0,[c.createElementVNode("span",{class:"key",ref_key:"btnFront",ref:h},"W",512),B[11]||(B[11]=c.createTextVNode(" 前进 ",-1))]),c.createElementVNode("div",F0,[c.createElementVNode("span",{class:"key",ref_key:"btnBack",ref:f},"S",512),B[12]||(B[12]=c.createTextVNode(" 后退 ",-1))]),c.createElementVNode("div",R0,[c.createElementVNode("span",{class:"key",ref_key:"btnLeft",ref:p},"A",512),B[13]||(B[13]=c.createTextVNode(" 左移 ",-1))]),c.createElementVNode("div",O0,[c.createElementVNode("span",{class:"key",ref_key:"btnRight",ref:u},"D",512),B[14]||(B[14]=c.createTextVNode(" 右移 ",-1))]),c.createElementVNode("div",L0,[c.createElementVNode("span",{class:"key",ref_key:"btnUp",ref:m},"Q",512),B[15]||(B[15]=c.createTextVNode(" 上升 ",-1))]),c.createElementVNode("div",N0,[c.createElementVNode("span",{class:"key",ref_key:"btnDown",ref:b},"E",512),B[16]||(B[16]=c.createTextVNode(" 下降 ",-1))]),B[17]||(B[17]=c.createElementVNode("div",{class:"key-row"},[c.createElementVNode("span",{class:"mouse-icon"},"🖱️"),c.createTextVNode(" 按住左键拖拽旋转视角 ")],-1))])])])]),_:1},8,["title","visible","full-height"]))}}),[["__scopeId","data-v-ff3f266e"]]),U0={class:"info-content"},_0={key:0,class:"component-title"},wi=Oe(c.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=c.inject("leitingMethods"),o=c.ref([]),r=c.ref(!1),l=c.ref([]),a=c.ref([]),d=c.ref(0),h=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:C=>{n("update:visible",C),n("update:open",C)}}),f=()=>{h.value=!1},p=C=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[C]||C,u=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],m=async C=>{const v=++d.value;if(a.value=C,!C||C.length===0){o.value=[];return}if(!h.value)return;let S=C;C.length>10&&(fe.warning(`选中构件数量过多(${C.length}个),仅显示前10个`),S=C.slice(0,10));const D=s?.value;let N=D?.getMapTileset?D.getMapTileset():{};r.value=!0;const I=[],B={};if(S.forEach(x=>{const U=N[x.modelId]?.leiting?.model?.dbName;U&&x.elementId&&I.push({dbName:U,elementId:x.elementId,modelId:x.modelId})}),I.length>0){try{const x=I.map(G=>({dbName:G.dbName,elementId:G.elementId})),k=await Dr(x),U=Array.isArray(k)?k:k?.data;U&&Array.isArray(U)&&U.forEach(G=>{if(G){const F=`${G.modelId}_${G.elementId}`;B[F]=G}})}catch(x){console.warn("API fetch component details failed, falling back to local data",x)}console.log("123")}const g=new Set;if(S.forEach(x=>{const k=N[x.modelId],U=`${x.modelId}_${x.elementId}`;B[U]||k&&k.leiting&&!k.leiting?.node?.nodeExtras&&k.leiting.model?.nodeUrl&&g.add(x.modelId)}),g.size>0&&D?._loadNodeDetailsForModel)try{const x=Array.from(g).map(k=>D._loadNodeDetailsForModel(k));await Promise.all(x)}catch(x){console.error("Failed to load node details",x)}if(v!==d.value)return;N=D?.getMapTileset?D.getMapTileset():{};const P=[];S.forEach((x,k)=>{const G=N[x.modelId]?.leiting||{},F=B[`${x.modelId}_${x.elementId}`];let E={modelName:G.model?.modelId||x.modelId};E.elementID||(E.elementID=x.elementId);let y=null;if(F)y=F;else{const R=G.node?.nodeExtras?.element||G.node?.nodeExtras;if(R){const O=E.elementID;R[O]&&(y=R[O])}}y&&y.box3&&(E.length=`${y.box3.length?.toFixed(2)||0}米`,E.width=`${y.box3.width?.toFixed(2)||0}米`,E.height=`${y.box3.height?.toFixed(2)||0}米`);const w=[];y&&(y.name&&(E.elementName=y.name),y.categoryName&&(E.categoryName=y.categoryName),y.familySymbolName&&(E.familySymbolName=y.familySymbolName),y.levelName&&(E.levelName=y.levelName));const T={};if(u.forEach(R=>{E[R]!==void 0&&(T[R]=E[R])}),w.push({name:"基础信息",params:T}),y){const R=Array.isArray(y)?y:Array.isArray(y?.parameters)?y.parameters:null;if(R){if(R.flat().forEach(L=>{if(L&&L.GroupName&&Array.isArray(L.Parameters)){const M={};L.Parameters.forEach(Q=>{Q.name&&(M[Q.name]=Q.value??"")}),Object.keys(M).length>0&&w.push({name:L.GroupName,params:M})}}),!Array.isArray(y)){const{parameters:L,...M}=y,Q={};Object.keys(M).forEach(Y=>{!u.includes(Y)&&Y!=="uniqueId"&&typeof M[Y]!="object"&&(Q[Y]=M[Y])}),Object.keys(Q).length>0&&w.push({name:"其他属性",params:Q})}}else{let O=!1;if(Object.keys(y).forEach(L=>{y[L]&&typeof y[L]=="object"&&!Array.isArray(y[L])&&(O=!0,w.push({name:L,params:y[L]}))}),!O){const L={};Object.keys(y).forEach(M=>{if(!u.includes(M)&&M!=="batchId"){const Q=y[M];typeof Q=="string"&&Q.length>500?L[M]=Q.substring(0,500)+"...":L[M]=Q}}),Object.keys(L).length>0&&w.push({name:"属性",params:L})}}}P.push({id:k,title:`${E.modelName}${E.elementName?` - ${E.elementName}`:""}`,groups:w})}),o.value=P,v===d.value&&(r.value=!1),P.length>0?l.value=[`${P[0].id}-基础信息`]:l.value=[]};let b=!1;const A=()=>{if(b)return;const C=s?.value;C&&C.selectionChange&&(C.selectionChange(m),b=!0)};return c.watch(()=>s?.value,()=>{A()},{deep:!0,immediate:!0}),c.watch(h,C=>{C&&a.value.length>0&&m(a.value)}),c.onMounted(()=>{A()}),(C,v)=>(c.openBlock(),c.createBlock(Pe,{visible:h.value,title:"构件详情",width:350,align:"right","initial-position":{x:0,y:0},"full-height":i.fullHeight,onClose:f,"onUpdate:visible":v[1]||(v[1]=S=>h.value=S),class:"base-info-card"},{default:c.withCtx(()=>[c.createElementVNode("div",U0,[c.createVNode(c.unref(ge.Spin),{spinning:r.value},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.value,S=>(c.openBlock(),c.createElementBlock("div",{key:S.id,class:"component-block"},[o.value.length>1?(c.openBlock(),c.createElementBlock("div",_0,c.toDisplayString(S.title),1)):c.createCommentVNode("",!0),c.createVNode(c.unref(ge.Collapse),{activeKey:l.value,"onUpdate:activeKey":v[0]||(v[0]=D=>l.value=D),ghost:"","expand-icon-position":"end"},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(S.groups,D=>(c.openBlock(),c.createBlock(c.unref(ge.CollapsePanel),{key:`${S.id}-${D.name}`,header:D.name},{default:c.withCtx(()=>[c.createVNode(c.unref(ge.Descriptions),{size:"small",bordered:"",column:1,labelStyle:{width:"100px",background:"rgba(255,255,255,0.05)",color:"#aaa"},contentStyle:{color:"#fff"}},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(D.params,(N,I)=>(c.openBlock(),c.createBlock(c.unref(ge.DescriptionsItem),{key:I,label:p(String(I))},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(N),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-1fb90635"]]);class ll{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),l=s.height;e({longitude:o,latitude:r,height:l})}},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 Q0={class:"adjust-panel"},G0={class:"control-panel"},H0={class:"form-item"},Y0={class:"radio-group"},V0={class:"form-item"},z0={class:"radio-group"},W0={class:"form-item"},j0={class:"value"},K0={class:"param-row"},$0={class:"param-row"},X0={class:"param-row"},q0={class:"param-row"},J0={class:"param-row"},Z0={class:"param-row"},eC={class:"param-row"},tC={class:"button-grid"},iC={key:1,class:"pick-mode-ui"},nC={class:"form-item",style:{display:"block","margin-bottom":"15px"}},sC={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},oC=["checked"],rC={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},aC={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},lC={class:"form-item",style:{display:"block","margin-bottom":"15px"}},cC={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},dC=["checked"],hC={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},uC={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},fC={class:"list-panel"},pC={class:"list-header"},gC={class:"col-check"},mC=["checked"],AC={class:"list-body"},yC={class:"col-check"},CC=["onUpdate:modelValue"],EC={class:"col-index"},wC=["title"],bC={class:"col-main"},vC=["checked","onChange"],bi=Oe(c.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=c.computed({get:()=>n.open!==void 0?n.open:n.visible,set:L=>{s("update:visible",L),s("update:open",L)}}),r=c.inject("leitingMethods"),l=c.ref("BIM"),a=c.ref("param"),d=c.ref(""),h=c.ref([]),f=c.ref("BIM"),p=c.ref(null),u=c.ref(null),m=c.ref(null),b=()=>(!m.value&&r?.value?.getViewer&&r?.value?.getCesium&&(m.value=new ll(r.value.getViewer(),r.value.getCesium())),m.value),A=()=>{b()?.clearMarkers(),p.value=null,u.value=null},C=(L,M)=>{L==="BIM"?p.value=M:u.value=M,b()?.addMarker(L,M),fe.success(`${L==="BIM"?"BIM":"地图"}标记点已添加`)},v=()=>{b()?.registerPickHandler(L=>{C(f.value,L)})},S=()=>{b()?.destroyPickHandler()},D=()=>{if(!p.value||!u.value){fe.warning("请先选择BIM标记点和地图标记点");return}if(!d.value){fe.warning("请先选择主模型");return}const L=b();let M=0,Q=0,Y=0;if(L){const{dLon:W,dLat:q,dHeight:Z}=L.calculateOffset(p.value,u.value);M=W,Q=q,Y=Z}else M=u.value.longitude-p.value.longitude,Q=u.value.latitude-p.value.latitude,Y=u.value.height-p.value.height;I.value.longitude+=M,I.value.latitude+=Q,I.value.height+=Y,y(d.value,{longitude:I.value.longitude,latitude:I.value.latitude,height:I.value.height}),fe.success("位置已调整")};c.watch(()=>a.value,L=>{L==="pick"?v():S()}),e({addMarker:C,setModelType:L=>{(L==="BIM"||L==="OSGB")&&(l.value=L)}});const I=c.ref({longitude:0,latitude:0,lonlat:1e-6,heightDistance:1,rotation:30,totalRotation:0,height:0,X:0,Y:0,Z:0}),B=c.computed(()=>{const L=h.value.find(M=>M.modelId===d.value);return L?L.modelName:""}),g=c.computed(()=>x.value.length>0&&x.value.every(L=>L.selected)),P=()=>{o.value=!1,s("close")},x=c.computed(()=>h.value.filter(L=>L.type===l.value)),k=L=>{const M=L.target.checked;x.value.forEach(Q=>Q.selected=M)},U=()=>{if(!r?.value)return;const L=r.value,M=L.getMapTileset?L.getMapTileset():{},Q=[];if(Object.keys(M).forEach(Y=>{const q=M[Y].leiting||{};q.model&&Q.push({modelId:q.model.modelId,modelName:q.model.modelName,selected:!1,formData:q.model.formData||{},dbName:q.model.dbName,url:q.model.url,type:q.model.type||"BIM"})}),h.value=Q,Q.length>0){const Y=L.getBIMmodelId?L.getBIMmodelId():"";Y&&Q.find(W=>W.modelId===Y)?F(Y):F(Q[0].modelId),Q.forEach(W=>W.selected=!0)}},G=()=>{fe.info("拖动右下角标,可显示模型列表",void 0,2)},F=L=>{d.value=L;const M=h.value.find(Q=>Q.modelId===L);M&&M.formData&&Object.keys(I.value).forEach(Q=>{M.formData[Q]!==void 0&&(I.value[Q]=M.formData[Q])})},E=L=>r?.value?.getMapTileset?r.value.getMapTileset()[L]:null,y=(L,M)=>{const Q=E(L),Y=r.value.getCesium();if(Q&&Y){if(Q.leiting?.model){Q.leiting.model.formData={...Q.leiting.model.formData,...M};const W=h.value.find(q=>q.modelId===L);W&&(W.formData=Q.leiting.model.formData)}Rn({Cesium:Y,tileset:Q})}},w=L=>{if(!d.value)return;const Q=h.value.find(q=>q.modelId===d.value)?.formData?.[L]??0,Y=I.value[L],W=Y-Q;y(d.value,{[L]:Y}),W!==0&&x.value.filter(Z=>Z.selected&&Z.modelId!==d.value).forEach(Z=>{const ne=(Z.formData?.[L]??0)+W;y(Z.modelId,{[L]:ne})})},T=L=>{const M=x.value.filter(q=>q.selected);if(M.length===0){fe.warning("请先选择要调整的模型");return}const{lonlat:Q,heightDistance:Y,rotation:W}=I.value;M.forEach(q=>{const Z={...q.formData};switch(L){case"north":Z.latitude+=Q;break;case"south":Z.latitude-=Q;break;case"east":Z.longitude+=Q;break;case"west":Z.longitude-=Q;break;case"up":Z.height+=Y;break;case"down":Z.height-=Y;break;case"rotateLeft":Z.totalRotation=(Z.totalRotation||0)+W;break;case"rotateRight":Z.totalRotation=(Z.totalRotation||0)-W;break}q.modelId===d.value&&(Z.lonlat=Q,Z.heightDistance=Y,Z.rotation=W,Object.assign(I.value,Z)),y(q.modelId,Z)})},R=()=>{if(!d.value){fe.warning("请先选择主模型");return}const L=E(d.value);if(!L||!r?.value?.getViewer)return;const M=r.value.getViewer(),Q=r.value.getCesium(),Y=L.boundingSphere;M.camera.flyToBoundingSphere(Y,{offset:new Q.HeadingPitchRange(0,Q.Math.toRadians(-90),Y.radius*2),duration:1.5})},O=()=>{r?.value?.saveRegion?(r.value.saveRegion(h.value),s("save",c.unref(h))):(console.log("Save models:",h.value),fe.warning("未找到保存接口,数据已打印控制台"))};return c.watch(()=>n.visible,L=>{L?(U(),G(),a.value==="pick"&&v()):(S(),A())}),c.onMounted(()=>{n.visible&&(U(),G(),a.value==="pick"&&v())}),(L,M)=>(c.openBlock(),c.createBlock(Pe,{visible:o.value,title:"调整位置(调整前可选择正北俯视)","full-height":i.fullHeight,width:260,"onUpdate:visible":M[25]||(M[25]=Q=>o.value=Q),onClose:P,onSave:O,class:"base-position-card"},{default:c.withCtx(()=>[c.createElementVNode("div",Q0,[c.createElementVNode("div",G0,[c.createElementVNode("div",H0,[M[26]||(M[26]=c.createElementVNode("label",null,"模型类型:",-1)),c.createElementVNode("div",Y0,[c.createElementVNode("span",{class:c.normalizeClass({active:l.value==="BIM"}),onClick:M[0]||(M[0]=Q=>l.value="BIM")},"BIM模型",2),c.createElementVNode("span",{class:c.normalizeClass({active:l.value==="OSGB"}),onClick:M[1]||(M[1]=Q=>l.value="OSGB")},"倾斜摄影",2)])]),c.createElementVNode("div",V0,[M[27]||(M[27]=c.createElementVNode("label",null,"调整操作:",-1)),c.createElementVNode("div",z0,[c.createElementVNode("span",{class:c.normalizeClass({active:a.value==="param"}),onClick:M[2]||(M[2]=Q=>a.value="param")},"参数模式",2),c.createElementVNode("span",{class:c.normalizeClass({active:a.value==="pick"}),onClick:M[3]||(M[3]=Q=>a.value="pick")},"地图点选",2)])]),c.createElementVNode("div",W0,[M[28]||(M[28]=c.createElementVNode("label",null,"当前主模型:",-1)),c.createElementVNode("span",j0,c.toDisplayString(B.value||"未选择"),1)]),M[42]||(M[42]=c.createElementVNode("div",{class:"separator"},null,-1)),a.value==="param"?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[M[36]||(M[36]=c.createElementVNode("div",{class:"group-header"},"当前状态",-1)),c.createElementVNode("div",K0,[M[29]||(M[29]=c.createElementVNode("label",null,"经度(东西):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[4]||(M[4]=Q=>I.value.longitude=Q),onChange:M[5]||(M[5]=Q=>w("longitude")),step:"0.000001"},null,544),[[c.vModelText,I.value.longitude,void 0,{number:!0}]])]),c.createElementVNode("div",$0,[M[30]||(M[30]=c.createElementVNode("label",null,"纬度(南北):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[6]||(M[6]=Q=>I.value.latitude=Q),onChange:M[7]||(M[7]=Q=>w("latitude")),step:"0.000001"},null,544),[[c.vModelText,I.value.latitude,void 0,{number:!0}]])]),c.createElementVNode("div",X0,[M[31]||(M[31]=c.createElementVNode("label",null,"高度(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[8]||(M[8]=Q=>I.value.height=Q),onChange:M[9]||(M[9]=Q=>w("height")),step:"0.1"},null,544),[[c.vModelText,I.value.height,void 0,{number:!0}]])]),c.createElementVNode("div",q0,[M[32]||(M[32]=c.createElementVNode("label",null,"累计旋转(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[10]||(M[10]=Q=>I.value.totalRotation=Q),onChange:M[11]||(M[11]=Q=>w("totalRotation")),step:"1"},null,544),[[c.vModelText,I.value.totalRotation,void 0,{number:!0}]])]),M[37]||(M[37]=c.createElementVNode("div",{class:"separator"},null,-1)),M[38]||(M[38]=c.createElementVNode("div",{class:"group-header"},"调整步长",-1)),c.createElementVNode("div",J0,[M[33]||(M[33]=c.createElementVNode("label",null,"经纬步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[12]||(M[12]=Q=>I.value.lonlat=Q),step:"0.000001"},null,512),[[c.vModelText,I.value.lonlat,void 0,{number:!0}]])]),c.createElementVNode("div",Z0,[M[34]||(M[34]=c.createElementVNode("label",null,"高度步长(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[13]||(M[13]=Q=>I.value.heightDistance=Q),step:"0.1"},null,512),[[c.vModelText,I.value.heightDistance,void 0,{number:!0}]])]),c.createElementVNode("div",eC,[M[35]||(M[35]=c.createElementVNode("label",null,"旋转步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[14]||(M[14]=Q=>I.value.rotation=Q),step:"1"},null,512),[[c.vModelText,I.value.rotation,void 0,{number:!0}]])]),c.createElementVNode("div",tC,[c.createElementVNode("button",{onClick:M[15]||(M[15]=Q=>T("rotateLeft"))},"左转"),c.createElementVNode("button",{onClick:M[16]||(M[16]=Q=>T("north"))},"北移"),c.createElementVNode("button",{onClick:M[17]||(M[17]=Q=>T("rotateRight"))},"右转"),c.createElementVNode("button",{onClick:M[18]||(M[18]=Q=>T("west"))},"西移"),c.createElementVNode("button",{onClick:M[19]||(M[19]=Q=>T("south"))},"南移"),c.createElementVNode("button",{onClick:M[20]||(M[20]=Q=>T("east"))},"东移"),c.createElementVNode("button",{onClick:M[21]||(M[21]=Q=>T("up"))},"上移"),c.createElementVNode("button",{onClick:M[22]||(M[22]=Q=>T("down"))},"下移"),c.createElementVNode("button",{onClick:R,class:"primary-btn"},"正北俯视"),c.createElementVNode("button",{onClick:O,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):a.value==="pick"?(c.openBlock(),c.createElementBlock("div",iC,[c.createElementVNode("div",nC,[c.createElementVNode("div",sC,[c.createElementVNode("div",{onClick:M[23]||(M[23]=Q=>f.value="BIM"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[c.createElementVNode("input",{type:"radio",checked:f.value==="BIM",style:{"margin-right":"5px"}},null,8,oC),M[39]||(M[39]=c.createElementVNode("span",{style:{"font-weight":"bold"}},"BIM标记点:",-1))]),p.value?(c.openBlock(),c.createElementBlock("div",rC,[c.createElementVNode("div",null,"经度:"+c.toDisplayString(p.value.longitude.toFixed(10)),1),c.createElementVNode("div",null,"纬度:"+c.toDisplayString(p.value.latitude.toFixed(10)),1)])):(c.openBlock(),c.createElementBlock("div",aC,"未选择"))])]),c.createElementVNode("div",lC,[c.createElementVNode("div",cC,[c.createElementVNode("div",{onClick:M[24]||(M[24]=Q=>f.value="MAP"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[c.createElementVNode("input",{type:"radio",checked:f.value==="MAP",style:{"margin-right":"5px"}},null,8,dC),M[40]||(M[40]=c.createElementVNode("span",{style:{"font-weight":"bold"}},"地图标记点:",-1))]),u.value?(c.openBlock(),c.createElementBlock("div",hC,[c.createElementVNode("div",null,"经度:"+c.toDisplayString(u.value.longitude.toFixed(10)),1),c.createElementVNode("div",null,"纬度:"+c.toDisplayString(u.value.latitude.toFixed(10)),1)])):(c.openBlock(),c.createElementBlock("div",uC,"未选择"))])]),c.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[c.createElementVNode("button",{onClick:D},"调整位置"),c.createElementVNode("button",{onClick:O},"保存")]),M[41]||(M[41]=c.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[c.createElementVNode("div",null,"操作指南:"),c.createElementVNode("div",null,"1. 勾选上方 BIM 或 地图 标记点选项。"),c.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),c.createElementVNode("div",null,"3. 采集两点后,点击“调整位置”进行校准。")],-1))])):c.createCommentVNode("",!0)]),c.createElementVNode("div",fC,[c.createElementVNode("div",pC,[c.createElementVNode("div",gC,[c.createElementVNode("input",{type:"checkbox",checked:g.value,onChange:k},null,40,mC)]),M[43]||(M[43]=c.createElementVNode("div",{class:"col-index"},"序号",-1)),M[44]||(M[44]=c.createElementVNode("div",{class:"col-name"},"名称",-1)),M[45]||(M[45]=c.createElementVNode("div",{class:"col-main"},"主模型",-1))]),c.createElementVNode("div",AC,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(x.value,(Q,Y)=>(c.openBlock(),c.createElementBlock("div",{key:Q.modelId,class:c.normalizeClass(["list-item",{active:Q.modelId===d.value}])},[c.createElementVNode("div",yC,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":W=>Q.selected=W},null,8,CC),[[c.vModelCheckbox,Q.selected]])]),c.createElementVNode("div",EC,c.toDisplayString(Y+1),1),c.createElementVNode("div",{class:"col-name",title:Q.modelName},c.toDisplayString(Q.modelName),9,wC),c.createElementVNode("div",bC,[c.createElementVNode("input",{type:"radio",name:"mainModel",checked:Q.modelId===d.value,onChange:W=>F(Q.modelId)},null,40,vC)])],2))),128))])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-9737215c"]]);function ln(){return ln=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},ln.apply(null,arguments)}const IC={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:"下一世纪"},BC={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},cl={lang:ln({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},IC),timePickerLocale:ln({},BC)};cl.lang.ok="确定";var cn={exports:{}},xC=cn.exports,dl;function hl(){return dl||(dl=1,(function(i,e){(function(t,n){i.exports=n()})(xC,(function(){var t=1e3,n=6e4,s=36e5,o="millisecond",r="second",l="minute",a="hour",d="day",h="week",f="month",p="quarter",u="year",m="date",b="Invalid Date",A=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|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(F){var E=["th","st","nd","rd"],y=F%100;return"["+F+(E[(y-20)%10]||E[y]||E[0])+"]"}},S=function(F,E,y){var w=String(F);return!w||w.length>=E?F:""+Array(E+1-w.length).join(y)+F},D={s:S,z:function(F){var E=-F.utcOffset(),y=Math.abs(E),w=Math.floor(y/60),T=y%60;return(E<=0?"+":"-")+S(w,2,"0")+":"+S(T,2,"0")},m:function F(E,y){if(E.date()<y.date())return-F(y,E);var w=12*(y.year()-E.year())+(y.month()-E.month()),T=E.clone().add(w,f),R=y-T<0,O=E.clone().add(w+(R?-1:1),f);return+(-(w+(y-T)/(R?T-O:O-T))||0)},a:function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},p:function(F){return{M:f,y:u,w:h,d,D:m,h:a,m:l,s:r,ms:o,Q:p}[F]||String(F||"").toLowerCase().replace(/s$/,"")},u:function(F){return F===void 0}},N="en",I={};I[N]=v;var B="$isDayjsObject",g=function(F){return F instanceof U||!(!F||!F[B])},P=function F(E,y,w){var T;if(!E)return N;if(typeof E=="string"){var R=E.toLowerCase();I[R]&&(T=R),y&&(I[R]=y,T=R);var O=E.split("-");if(!T&&O.length>1)return F(O[0])}else{var L=E.name;I[L]=E,T=L}return!w&&T&&(N=T),T||!w&&N},x=function(F,E){if(g(F))return F.clone();var y=typeof E=="object"?E:{};return y.date=F,y.args=arguments,new U(y)},k=D;k.l=P,k.i=g,k.w=function(F,E){return x(F,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var U=(function(){function F(y){this.$L=P(y.locale,null,!0),this.parse(y),this.$x=this.$x||y.x||{},this[B]=!0}var E=F.prototype;return E.parse=function(y){this.$d=(function(w){var T=w.date,R=w.utc;if(T===null)return new Date(NaN);if(k.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var O=T.match(A);if(O){var L=O[2]-1||0,M=(O[7]||"0").substring(0,3);return R?new Date(Date.UTC(O[1],L,O[3]||1,O[4]||0,O[5]||0,O[6]||0,M)):new Date(O[1],L,O[3]||1,O[4]||0,O[5]||0,O[6]||0,M)}}return new Date(T)})(y),this.init()},E.init=function(){var y=this.$d;this.$y=y.getFullYear(),this.$M=y.getMonth(),this.$D=y.getDate(),this.$W=y.getDay(),this.$H=y.getHours(),this.$m=y.getMinutes(),this.$s=y.getSeconds(),this.$ms=y.getMilliseconds()},E.$utils=function(){return k},E.isValid=function(){return this.$d.toString()!==b},E.isSame=function(y,w){var T=x(y);return this.startOf(w)<=T&&T<=this.endOf(w)},E.isAfter=function(y,w){return x(y)<this.startOf(w)},E.isBefore=function(y,w){return this.endOf(w)<x(y)},E.$g=function(y,w,T){return k.u(y)?this[w]:this.set(T,y)},E.unix=function(){return Math.floor(this.valueOf()/1e3)},E.valueOf=function(){return this.$d.getTime()},E.startOf=function(y,w){var T=this,R=!!k.u(w)||w,O=k.p(y),L=function(ne,se){var pe=k.w(T.$u?Date.UTC(T.$y,se,ne):new Date(T.$y,se,ne),T);return R?pe:pe.endOf(d)},M=function(ne,se){return k.w(T.toDate()[ne].apply(T.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(se)),T)},Q=this.$W,Y=this.$M,W=this.$D,q="set"+(this.$u?"UTC":"");switch(O){case u:return R?L(1,0):L(31,11);case f:return R?L(1,Y):L(0,Y+1);case h:var Z=this.$locale().weekStart||0,oe=(Q<Z?Q+7:Q)-Z;return L(R?W-oe:W+(6-oe),Y);case d:case m:return M(q+"Hours",0);case a:return M(q+"Minutes",1);case l:return M(q+"Seconds",2);case r:return M(q+"Milliseconds",3);default:return this.clone()}},E.endOf=function(y){return this.startOf(y,!1)},E.$set=function(y,w){var T,R=k.p(y),O="set"+(this.$u?"UTC":""),L=(T={},T[d]=O+"Date",T[m]=O+"Date",T[f]=O+"Month",T[u]=O+"FullYear",T[a]=O+"Hours",T[l]=O+"Minutes",T[r]=O+"Seconds",T[o]=O+"Milliseconds",T)[R],M=R===d?this.$D+(w-this.$W):w;if(R===f||R===u){var Q=this.clone().set(m,1);Q.$d[L](M),Q.init(),this.$d=Q.set(m,Math.min(this.$D,Q.daysInMonth())).$d}else L&&this.$d[L](M);return this.init(),this},E.set=function(y,w){return this.clone().$set(y,w)},E.get=function(y){return this[k.p(y)]()},E.add=function(y,w){var T,R=this;y=Number(y);var O=k.p(w),L=function(Y){var W=x(R);return k.w(W.date(W.date()+Math.round(Y*y)),R)};if(O===f)return this.set(f,this.$M+y);if(O===u)return this.set(u,this.$y+y);if(O===d)return L(1);if(O===h)return L(7);var M=(T={},T[l]=n,T[a]=s,T[r]=t,T)[O]||1,Q=this.$d.getTime()+y*M;return k.w(Q,this)},E.subtract=function(y,w){return this.add(-1*y,w)},E.format=function(y){var w=this,T=this.$locale();if(!this.isValid())return T.invalidDate||b;var R=y||"YYYY-MM-DDTHH:mm:ssZ",O=k.z(this),L=this.$H,M=this.$m,Q=this.$M,Y=T.weekdays,W=T.months,q=T.meridiem,Z=function(se,pe,ve,V){return se&&(se[pe]||se(w,R))||ve[pe].slice(0,V)},oe=function(se){return k.s(L%12||12,se,"0")},ne=q||function(se,pe,ve){var V=se<12?"AM":"PM";return ve?V.toLowerCase():V};return R.replace(C,(function(se,pe){return pe||(function(ve){switch(ve){case"YY":return String(w.$y).slice(-2);case"YYYY":return k.s(w.$y,4,"0");case"M":return Q+1;case"MM":return k.s(Q+1,2,"0");case"MMM":return Z(T.monthsShort,Q,W,3);case"MMMM":return Z(W,Q);case"D":return w.$D;case"DD":return k.s(w.$D,2,"0");case"d":return String(w.$W);case"dd":return Z(T.weekdaysMin,w.$W,Y,2);case"ddd":return Z(T.weekdaysShort,w.$W,Y,3);case"dddd":return Y[w.$W];case"H":return String(L);case"HH":return k.s(L,2,"0");case"h":return oe(1);case"hh":return oe(2);case"a":return ne(L,M,!0);case"A":return ne(L,M,!1);case"m":return String(M);case"mm":return k.s(M,2,"0");case"s":return String(w.$s);case"ss":return k.s(w.$s,2,"0");case"SSS":return k.s(w.$ms,3,"0");case"Z":return O}return null})(se)||O.replace(":","")}))},E.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},E.diff=function(y,w,T){var R,O=this,L=k.p(w),M=x(y),Q=(M.utcOffset()-this.utcOffset())*n,Y=this-M,W=function(){return k.m(O,M)};switch(L){case u:R=W()/12;break;case f:R=W();break;case p:R=W()/3;break;case h:R=(Y-Q)/6048e5;break;case d:R=(Y-Q)/864e5;break;case a:R=Y/s;break;case l:R=Y/n;break;case r:R=Y/t;break;default:R=Y}return T?R:k.a(R)},E.daysInMonth=function(){return this.endOf(f).$D},E.$locale=function(){return I[this.$L]},E.locale=function(y,w){if(!y)return this.$L;var T=this.clone(),R=P(y,w,!0);return R&&(T.$L=R),T},E.clone=function(){return k.w(this.$d,this)},E.toDate=function(){return new Date(this.valueOf())},E.toJSON=function(){return this.isValid()?this.toISOString():null},E.toISOString=function(){return this.$d.toISOString()},E.toString=function(){return this.$d.toUTCString()},F})(),G=U.prototype;return x.prototype=G,[["$ms",o],["$s",r],["$m",l],["$H",a],["$W",d],["$M",f],["$y",u],["$D",m]].forEach((function(F){G[F[1]]=function(E){return this.$g(E,F[0],F[1])}})),x.extend=function(F,E){return F.$i||(F(E,U,x),F.$i=!0),x},x.locale=P,x.isDayjs=g,x.unix=function(F){return x(1e3*F)},x.en=I[N],x.Ls=I,x.p={},x}))})(cn)),cn.exports}var SC=hl();const ze=Gt(SC);var dn={exports:{}},TC=dn.exports,ul;function MC(){return ul||(ul=1,(function(i,e){(function(t,n){i.exports=n(hl())})(TC,(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,l){return l==="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,l){var a=100*r+l;return a<600?"凌晨":a<900?"早上":a<1100?"上午":a<1300?"中午":a<1800?"下午":"晚上"}};return s.default.locale(o,null,!0),o}))})(dn)),dn.exports}MC();var hn={exports:{}},DC=hn.exports,fl;function kC(){return fl||(fl=1,(function(i,e){(function(t,n){i.exports=n()})(DC,(function(){return function(t,n,s){var o=n.prototype,r=function(f){return f&&(f.indexOf?f:f.s)},l=function(f,p,u,m,b){var A=f.name?f:f.$locale(),C=r(A[p]),v=r(A[u]),S=C||v.map((function(N){return N.slice(0,m)}));if(!b)return S;var D=A.weekStart;return S.map((function(N,I){return S[(I+(D||0))%7]}))},a=function(){return s.Ls[s.locale()]},d=function(f,p){return f.formats[p]||(function(u){return u.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,b,A){return b||A.slice(1)}))})(f.formats[p.toUpperCase()])},h=function(){var f=this;return{months:function(p){return p?p.format("MMMM"):l(f,"months")},monthsShort:function(p){return p?p.format("MMM"):l(f,"monthsShort","months",3)},firstDayOfWeek:function(){return f.$locale().weekStart||0},weekdays:function(p){return p?p.format("dddd"):l(f,"weekdays")},weekdaysMin:function(p){return p?p.format("dd"):l(f,"weekdaysMin","weekdays",2)},weekdaysShort:function(p){return p?p.format("ddd"):l(f,"weekdaysShort","weekdays",3)},longDateFormat:function(p){return d(f.$locale(),p)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return h.bind(this)()},s.localeData=function(){var f=a();return{firstDayOfWeek:function(){return f.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 d(f,p)},meridiem:f.meridiem,ordinal:f.ordinal}},s.months=function(){return l(a(),"months")},s.monthsShort=function(){return l(a(),"monthsShort","months",3)},s.weekdays=function(f){return l(a(),"weekdays",null,null,f)},s.weekdaysShort=function(f){return l(a(),"weekdaysShort","weekdays",3,f)},s.weekdaysMin=function(f){return l(a(),"weekdaysMin","weekdays",2,f)}}}))})(hn)),hn.exports}var PC=kC();const FC=Gt(PC);var un={exports:{}},RC=un.exports,pl;function OC(){return pl||(pl=1,(function(i,e){(function(t,n){i.exports=n()})(RC,(function(){return function(t,n){n.prototype.weekday=function(s){var o=this.$locale().weekStart||0,r=this.$W,l=(r<o?r+7:r)-o;return this.$utils().u(s)?l:this.subtract(l,"day").add(s,"day")}}}))})(un)),un.exports}var LC=OC();const NC=Gt(LC);var fn={exports:{}},UC=fn.exports,gl;function _C(){return gl||(gl=1,(function(i,e){(function(t,n){i.exports=n()})(UC,(function(){var t="week",n="year";return function(s,o,r){var l=o.prototype;l.week=function(a){if(a===void 0&&(a=null),a!==null)return this.add(7*(a-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=r(this).startOf(n).add(1,n).date(d),f=r(this).endOf(t);if(h.isBefore(f))return 1}var p=r(this).startOf(n).date(d).startOf(t).subtract(1,"millisecond"),u=this.diff(p,t,!0);return u<0?r(this).startOf("week").week():Math.ceil(u)},l.weeks=function(a){return a===void 0&&(a=null),this.week(a)}}}))})(fn)),fn.exports}var QC=_C();const GC=Gt(QC);var pn={exports:{}},HC=pn.exports,ml;function YC(){return ml||(ml=1,(function(i,e){(function(t,n){i.exports=n()})(HC,(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?/,l=/\d*[^-_:/,()\s\d]+/,a={},d=function(A){return(A=+A)+(A>68?1900:2e3)},h=function(A){return function(C){this[A]=+C}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(A){(this.zone||(this.zone={})).offset=(function(C){if(!C||C==="Z")return 0;var v=C.match(/([+-]|\d\d)/g),S=60*v[1]+(+v[2]||0);return S===0?0:v[0]==="+"?-S:S})(A)}],p=function(A){var C=a[A];return C&&(C.indexOf?C:C.s.concat(C.f))},u=function(A,C){var v,S=a.meridiem;if(S){for(var D=1;D<=24;D+=1)if(A.indexOf(S(D,0,C))>-1){v=D>12;break}}else v=A===(C?"pm":"PM");return v},m={A:[l,function(A){this.afternoon=u(A,!1)}],a:[l,function(A){this.afternoon=u(A,!0)}],Q:[s,function(A){this.month=3*(A-1)+1}],S:[s,function(A){this.milliseconds=100*+A}],SS:[o,function(A){this.milliseconds=10*+A}],SSS:[/\d{3}/,function(A){this.milliseconds=+A}],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:[l,function(A){var C=a.ordinal,v=A.match(/\d+/);if(this.day=v[0],C)for(var S=1;S<=31;S+=1)C(S).replace(/\[|\]/g,"")===A&&(this.day=S)}],w:[r,h("week")],ww:[o,h("week")],M:[r,h("month")],MM:[o,h("month")],MMM:[l,function(A){var C=p("months"),v=(p("monthsShort")||C.map((function(S){return S.slice(0,3)}))).indexOf(A)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[l,function(A){var C=p("months").indexOf(A)+1;if(C<1)throw new Error;this.month=C%12||C}],Y:[/[+-]?\d+/,h("year")],YY:[o,function(A){this.year=d(A)}],YYYY:[/\d{4}/,h("year")],Z:f,ZZ:f};function b(A){var C,v;C=A,v=a&&a.formats;for(var S=(A=C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,k,U){var G=U&&U.toUpperCase();return k||v[U]||t[U]||v[G].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(F,E,y){return E||y.slice(1)}))}))).match(n),D=S.length,N=0;N<D;N+=1){var I=S[N],B=m[I],g=B&&B[0],P=B&&B[1];S[N]=P?{regex:g,parser:P}:I.replace(/^\[|\]$/g,"")}return function(x){for(var k={},U=0,G=0;U<D;U+=1){var F=S[U];if(typeof F=="string")G+=F.length;else{var E=F.regex,y=F.parser,w=x.slice(G),T=E.exec(w)[0];y.call(k,T),x=x.replace(T,"")}}return(function(R){var O=R.afternoon;if(O!==void 0){var L=R.hours;O?L<12&&(R.hours+=12):L===12&&(R.hours=0),delete R.afternoon}})(k),k}}return function(A,C,v){v.p.customParseFormat=!0,A&&A.parseTwoDigitYear&&(d=A.parseTwoDigitYear);var S=C.prototype,D=S.parse;S.parse=function(N){var I=N.date,B=N.utc,g=N.args;this.$u=B;var P=g[1];if(typeof P=="string"){var x=g[2]===!0,k=g[3]===!0,U=x||k,G=g[2];k&&(G=g[2]),a=this.$locale(),!x&&G&&(a=v.Ls[G]),this.$d=(function(w,T,R,O){try{if(["x","X"].indexOf(T)>-1)return new Date((T==="X"?1e3:1)*w);var L=b(T)(w),M=L.year,Q=L.month,Y=L.day,W=L.hours,q=L.minutes,Z=L.seconds,oe=L.milliseconds,ne=L.zone,se=L.week,pe=new Date,ve=Y||(M||Q?1:pe.getDate()),V=M||pe.getFullYear(),j=0;M&&!Q||(j=Q>0?Q-1:pe.getMonth());var te,Ae=W||0,Ce=q||0,Me=Z||0,Le=oe||0;return ne?new Date(Date.UTC(V,j,ve,Ae,Ce,Me,Le+60*ne.offset*1e3)):R?new Date(Date.UTC(V,j,ve,Ae,Ce,Me,Le)):(te=new Date(V,j,ve,Ae,Ce,Me,Le),se&&(te=O(te).week(se).toDate()),te)}catch{return new Date("")}})(I,P,B,v),this.init(),G&&G!==!0&&(this.$L=this.locale(G).$L),U&&I!=this.format(P)&&(this.$d=new Date("")),a={}}else if(P instanceof Array)for(var F=P.length,E=1;E<=F;E+=1){g[1]=P[E-1];var y=v.apply(this,g);if(y.isValid()){this.$d=y.$d,this.$L=y.$L,this.init();break}E===F&&(this.$d=new Date(""))}else D.call(this,N)}}}))})(pn)),pn.exports}var VC=YC();const zC=Gt(VC),WC={class:"setting-panel"},jC={class:"tabs-header"},KC={class:"tab-content"},$C={key:0,class:"section"},XC={class:"setting-item"},qC={class:"setting-item"},JC={class:"setting-item"},ZC={key:1,class:"section"},eE={class:"tabs-header",style:{"margin-bottom":"8px"}},tE={key:0},iE={class:"setting-item column"},nE={class:"setting-item column"},sE={class:"setting-item"},oE={key:1},rE={class:"setting-item column"},aE={class:"setting-item column",style:{"margin-top":"12px","border-top":"1px solid rgba(255,255,255,0.1)","padding-top":"8px"}},lE={class:"search-box"},cE={key:2,class:"section"},dE={class:"setting-item"},hE={key:0,class:"setting-item column"},uE={class:"sub-label"},fE={class:"setting-item"},pE={class:"setting-item"},gE={class:"setting-item column"},mE={class:"setting-item column"},AE={class:"sub-label"},yE={class:"setting-item column"},CE={class:"sub-label"},EE={class:"setting-item column"},wE={class:"sub-label"},bE={class:"setting-item column"},vE={style:{display:"flex",gap:"8px","margin-bottom":"8px"}},IE=["onClick","title"],BE={style:{display:"flex",gap:"8px","align-items":"center"}},xE={key:3,class:"section"},SE={class:"setting-item"},TE={class:"setting-item column"},vi=Oe(c.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}){ze.locale("zh-cn"),ze.extend(FC),ze.extend(NC),ze.extend(GC),ze.extend(zC);const t=ge.Switch,n=ge.Radio.Group,s=ge.Radio,o=ge.Input,r=ge.Slider,l=ge.Select,a=ge.Select.Option,d=ge.DatePicker,h=i,f=e,p=c.inject("leitingMethods"),u=c.computed({get:()=>h.open!==void 0?h.open:h.visible,set:E=>{f("update:visible",E),f("update:open",E)}}),m=c.ref("GIS"),b=c.reactive({globe:!1,terrain:!1,depthTest:!1}),A=c.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"}),C=c.reactive({shadows:!1,shadowDarkness:.7,environmentMap:!1,ambientOcclusion:!1,time:ze("2025-06-22 10:00"),brightness:1.5,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),v=c.reactive({collision:!1,habit:0}),S=E=>{E&&(E.globe!==void 0&&(b.globe=E.globe),E.terrain!==void 0&&(b.terrain=E.terrain),E.depthTest!==void 0&&(b.depthTest=E.depthTest),E.mapProvider!==void 0&&(A.provider=E.mapProvider),E.tiandituLayerType!==void 0&&(A.tianditu.layerType=E.tiandituLayerType),E.tiandituShowLabel!==void 0&&(A.tianditu.showLabel=E.tiandituShowLabel),E.arcgisUrl!==void 0&&(A.arcgis.url=E.arcgisUrl),E.shadows!==void 0&&(C.shadows=E.shadows),E.shadowDarkness!==void 0&&(C.shadowDarkness=E.shadowDarkness),E.environmentMap!==void 0&&(C.environmentMap=E.environmentMap),E.ambientOcclusion!==void 0&&(C.ambientOcclusion=E.ambientOcclusion),E.time!==void 0&&(typeof E.time=="number"?C.time=ze().startOf("day").add(E.time,"hour"):C.time=ze(E.time)),E.brightness!==void 0&&(C.brightness=E.brightness),E.contrast!==void 0&&(C.contrast=E.contrast),E.saturation!==void 0&&(C.saturation=E.saturation),E.backgroundColor!==void 0&&(C.backgroundColor=E.backgroundColor),E.collision!==void 0&&(v.collision=E.collision),E.mouseHabit!==void 0&&(v.habit=E.mouseHabit))};c.watch(()=>h.initialConfig,E=>{S(E)},{deep:!0,immediate:!0});const D=["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%)"],N=[{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 E=A.provider,y={};E==="tianditu"?(y.token=A.tianditu.token,y.layerType=A.tianditu.layerType,y.showAnnotation=A.tianditu.showLabel):E==="arcgis"&&(y.url=A.arcgis.url),p.value?.changeBaseMap?.(E,y)};c.watch(()=>A.provider,I),c.watch(()=>A.tianditu.layerType,I),c.watch(()=>A.tianditu.showLabel,I),c.watch(()=>A.tianditu.token,kn(I,1e3)),c.watch(()=>A.arcgis.url,kn(I,1e3)),c.onMounted(()=>{h.tiandituToken&&(A.tianditu.token=h.tiandituToken)}),c.watch(()=>b.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),c.watch(()=>b.terrain,E=>p.value?.setTerrainEnable?.(E)),c.watch(()=>b.depthTest,E=>p.value?.setDepthTestEnable?.(E)),c.watch(()=>p?.value,E=>{if(E){if(E.getConfigure=()=>({globe:b.globe,terrain:b.terrain,depthTest:b.depthTest,mapProvider:A.provider,tiandituLayerType:A.tianditu.layerType,tiandituShowLabel:A.tianditu.showLabel,arcgisUrl:A.arcgis.url,shadows:C.shadows,shadowDarkness:C.shadowDarkness,environmentMap:C.environmentMap,ambientOcclusion:C.ambientOcclusion,time:ze.isDayjs(C.time)?C.time.format("YYYY-MM-DD HH:mm"):C.time,brightness:C.brightness,contrast:C.contrast,saturation:C.saturation,backgroundColor:C.backgroundColor,collision:v.collision,mouseHabit:v.habit}),E.setConfigure=y=>{S(y)},E.setBackgroundColor&&C.backgroundColor&&E.setBackgroundColor(C.backgroundColor),E.setGlobeEnvironmentVisible&&E.setGlobeEnvironmentVisible(b.globe),E.setShadowsEnable&&E.setShadowsEnable(C.shadows),E.setShadowDarkness&&E.setShadowDarkness(C.shadowDarkness),E.setEnvironmentMapEnable&&E.setEnvironmentMapEnable(C.environmentMap),E.setAmbientOcclusion&&E.setAmbientOcclusion(C.ambientOcclusion),E.setTime){const y=ze.isDayjs(C.time)?C.time.toDate():new Date;E.setTime(y)}E.setModelBrightness&&E.setModelBrightness(C.brightness),E.setCollisionDetection&&E.setCollisionDetection(v.collision),E.setMouseHabit&&E.setMouseHabit(v.habit),E.changeBaseMap&&A.baseMap&&E.changeBaseMap(A.baseMap,{token:A.tianditu.token,layerType:A.tianditu.layerType,showAnnotation:A.tianditu.showLabel,url:A.arcgis.url})}},{immediate:!0});const B=c.computed({get:()=>{const E=C.backgroundColor;return/^#[0-9A-Fa-f]{6}$/.test(E)?E:"#ffffff"},set:E=>{C.backgroundColor=E}}),g=c.ref(""),P=c.ref(!1),x=c.ref([]);c.watch(()=>b.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),c.watch(()=>b.terrain,E=>p.value?.setTerrainEnable?.(E)),c.watch(()=>A.baseMap,E=>{p.value?.changeBaseMap?.(E,{token:h.tiandituToken})}),c.watch(()=>C.shadows,E=>p.value?.setShadowsEnable?.(E)),c.watch(()=>C.shadowDarkness,E=>p.value?.setShadowDarkness?.(E)),c.watch(()=>C.environmentMap,E=>p.value?.setEnvironmentMapEnable?.(E)),c.watch(()=>C.ambientOcclusion,E=>p.value?.setAmbientOcclusion?.(E)),c.watch(()=>C.time,E=>{const y=ze.isDayjs(E)?E.toDate():new Date;p.value?.setTime?.(y)}),c.watch(()=>[C.brightness,C.contrast,C.saturation],([E,y,w])=>{const T=p.value;T?.setModelColorAdjustment?T.setModelColorAdjustment({brightness:E,contrast:y,saturation:w}):T?.setModelBrightness?.(E)}),c.watch(()=>C.backgroundColor,E=>{if(p.value?.setBackgroundColor)p.value.setBackgroundColor(E);else{const y=document.querySelector(".cesium-viewer");y&&(y.style.background=E)}}),c.watch(()=>v.collision,E=>p.value?.setCollisionDetection?.(E)),c.watch(()=>v.habit,E=>p.value?.setMouseHabit?.(E));const k=E=>{if(E?.pois&&Array.isArray(E.pois)&&E.pois.length>0){const y=E.pois[0],w=y.lonlat.split(/[, ]/).map(Number);if(w.length>=2&&!isNaN(w[0])&&!isNaN(w[1]))return{name:y.name,lon:w[0],lat:w[1],raw:y}}if(E?.area&&E.area.lonlat){const y=E.area,w=y.lonlat.split(/[, ]/).map(Number);if(w.length>=2&&!isNaN(w[0])&&!isNaN(w[1]))return{name:y.name,lon:w[0],lat:w[1],raw:y}}return null},G=kn(async()=>{const E=(g.value||"").trim();if(!E)return;const y=h.tiandituToken||"c25f14fb6bd4397cf8fe45144ff768d6";P.value=!0,x.value=[];try{if(p.value?.searchLocation){const w=await p.value.searchLocation(E,y),T=k(w);T&&(x.value=[T],fe.success(`找到:${T.name||""}`),p.value.flyToLonLatHeight(T.lon,T.lat,5e3))}else{const T=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify({keyWord:E,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}))}&type=query&tk=${encodeURIComponent(y)}`,R=await fetch(T);if(!R.ok)throw new Error(`HTTP ${R.status}`);const O=await R.json(),L=k(O);L&&(x.value=[L],fe.success(`找到:${L.name||""}`),p.value?.flyToLonLatHeight?.(L.lon,L.lat,5e3))}}catch(w){console.error("tianditu search error",w)}finally{P.value=!1}},800);c.watch(g,()=>{G()});const F=()=>{u.value=!1,f("close")};return c.onMounted(()=>{}),(E,y)=>(c.openBlock(),c.createBlock(Pe,{visible:u.value,title:"设置","full-height":i.fullHeight,onClose:F,"onUpdate:visible":y[26]||(y[26]=w=>u.value=w)},{default:c.withCtx(()=>[c.createElementVNode("div",WC,[c.createElementVNode("div",jC,[c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="GIS"}]),onClick:y[0]||(y[0]=w=>m.value="GIS")},"GIS",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="MAP"}]),onClick:y[1]||(y[1]=w=>m.value="MAP")},"地图",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="RENDER"}]),onClick:y[2]||(y[2]=w=>m.value="RENDER")},"渲染",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="MOUSE"}]),onClick:y[3]||(y[3]=w=>m.value="MOUSE")},"鼠标",2)]),c.createElementVNode("div",KC,[m.value==="GIS"?(c.openBlock(),c.createElementBlock("div",$C,[c.createElementVNode("div",XC,[y[27]||(y[27]=c.createElementVNode("span",null,"地球 (含大气/日月/星空)",-1)),c.createVNode(c.unref(t),{checked:b.globe,"onUpdate:checked":y[4]||(y[4]=w=>b.globe=w),size:"small"},null,8,["checked"])]),c.createElementVNode("div",qC,[y[28]||(y[28]=c.createElementVNode("span",null,"地形 (高程)",-1)),c.createVNode(c.unref(t),{checked:b.terrain,"onUpdate:checked":y[5]||(y[5]=w=>b.terrain=w),size:"small"},null,8,["checked"])]),c.createElementVNode("div",JC,[y[29]||(y[29]=c.createElementVNode("span",null,"地形遮挡",-1)),c.createVNode(c.unref(t),{checked:b.depthTest,"onUpdate:checked":y[6]||(y[6]=w=>b.depthTest=w),size:"small"},null,8,["checked"])])])):c.createCommentVNode("",!0),m.value==="MAP"?(c.openBlock(),c.createElementBlock("div",ZC,[c.createElementVNode("div",eE,[c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:A.provider==="tianditu"}]),onClick:y[7]||(y[7]=w=>A.provider="tianditu")},"天地图",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:A.provider==="arcgis"}]),onClick:y[8]||(y[8]=w=>A.provider="arcgis")},"ArcGIS",2)]),A.provider==="tianditu"?(c.openBlock(),c.createElementBlock("div",tE,[c.createElementVNode("div",iE,[y[30]||(y[30]=c.createElementVNode("div",{class:"sub-label"},"Token",-1)),c.createVNode(c.unref(o),{value:A.tianditu.token,"onUpdate:value":y[9]||(y[9]=w=>A.tianditu.token=w),size:"small",placeholder:"输入天地图Token"},null,8,["value"])]),c.createElementVNode("div",nE,[y[31]||(y[31]=c.createElementVNode("div",{class:"sub-label"},"地图风格",-1)),c.createVNode(c.unref(l),{value:A.tianditu.layerType,"onUpdate:value":y[10]||(y[10]=w=>A.tianditu.layerType=w),size:"small",style:{width:"100%"}},{default:c.withCtx(()=>[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(N,w=>c.createVNode(c.unref(a),{key:w.value,value:w.value},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(w.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["value"])]),c.createElementVNode("div",sE,[y[32]||(y[32]=c.createElementVNode("span",null,"叠加注记",-1)),c.createVNode(c.unref(t),{checked:A.tianditu.showLabel,"onUpdate:checked":y[11]||(y[11]=w=>A.tianditu.showLabel=w),size:"small"},null,8,["checked"])])])):c.createCommentVNode("",!0),A.provider==="arcgis"?(c.openBlock(),c.createElementBlock("div",oE,[c.createElementVNode("div",rE,[y[33]||(y[33]=c.createElementVNode("div",{class:"sub-label"},"服务地址",-1)),c.createVNode(c.unref(o),{value:A.arcgis.url,"onUpdate:value":y[12]||(y[12]=w=>A.arcgis.url=w),size:"small",placeholder:"输入ArcGIS MapServer地址"},null,8,["value"])])])):c.createCommentVNode("",!0),c.createElementVNode("div",aE,[y[34]||(y[34]=c.createElementVNode("div",{class:"sub-label"},"位置搜索 (天地图)",-1)),c.createElementVNode("div",lE,[c.createVNode(c.unref(o),{value:g.value,"onUpdate:value":y[13]||(y[13]=w=>g.value=w),placeholder:"输入地名搜索",size:"small","allow-clear":""},null,8,["value"])])])])):c.createCommentVNode("",!0),m.value==="RENDER"?(c.openBlock(),c.createElementBlock("div",cE,[c.createElementVNode("div",dE,[y[35]||(y[35]=c.createElementVNode("span",null,"阴影",-1)),c.createVNode(c.unref(t),{checked:C.shadows,"onUpdate:checked":y[14]||(y[14]=w=>C.shadows=w),size:"small"},null,8,["checked"])]),C.shadows?(c.openBlock(),c.createElementBlock("div",hE,[c.createElementVNode("div",uE,"阴影暗度 ("+c.toDisplayString(C.shadowDarkness.toFixed(2))+")",1),c.createVNode(c.unref(r),{value:C.shadowDarkness,"onUpdate:value":y[15]||(y[15]=w=>C.shadowDarkness=w),min:0,max:1,step:.05,size:"small"},null,8,["value"])])):c.createCommentVNode("",!0),c.createElementVNode("div",fE,[y[36]||(y[36]=c.createElementVNode("span",null,"环境贴图 (HDR)",-1)),c.createVNode(c.unref(t),{checked:C.environmentMap,"onUpdate:checked":y[16]||(y[16]=w=>C.environmentMap=w),size:"small"},null,8,["checked"])]),c.createElementVNode("div",pE,[y[37]||(y[37]=c.createElementVNode("span",null,"环境光遮蔽 (AO)",-1)),c.createVNode(c.unref(t),{checked:C.ambientOcclusion,"onUpdate:checked":y[17]||(y[17]=w=>C.ambientOcclusion=w),size:"small"},null,8,["checked"])]),c.createElementVNode("div",gE,[y[38]||(y[38]=c.createElementVNode("div",{class:"sub-label"},"日期时间",-1)),c.createVNode(c.unref(d),{value:C.time,"onUpdate:value":y[18]||(y[18]=w=>C.time=w),"show-time":"",locale:c.unref(cl),format:"YYYY-MM-DD HH:mm",size:"small",style:{width:"100%"}},null,8,["value","locale"])]),c.createElementVNode("div",mE,[c.createElementVNode("div",AE,"模型亮度 ("+c.toDisplayString(C.brightness.toFixed(1))+")",1),c.createVNode(c.unref(r),{value:C.brightness,"onUpdate:value":y[19]||(y[19]=w=>C.brightness=w),min:0,max:5,step:.1,size:"small"},null,8,["value"])]),c.createElementVNode("div",yE,[c.createElementVNode("div",CE,"模型对比度 ("+c.toDisplayString(C.contrast.toFixed(1))+")",1),c.createVNode(c.unref(r),{value:C.contrast,"onUpdate:value":y[20]||(y[20]=w=>C.contrast=w),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),c.createElementVNode("div",EE,[c.createElementVNode("div",wE,"模型饱和度 ("+c.toDisplayString(C.saturation.toFixed(1))+")",1),c.createVNode(c.unref(r),{value:C.saturation,"onUpdate:value":y[21]||(y[21]=w=>C.saturation=w),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),c.createElementVNode("div",bE,[y[39]||(y[39]=c.createElementVNode("div",{class:"sub-label"},"背景颜色",-1)),c.createElementVNode("div",vE,[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(D,(w,T)=>c.createElementVNode("div",{key:T,style:c.normalizeStyle({background:w,width:"32px",height:"24px",borderRadius:"2px",cursor:"pointer",border:"1px solid #d9d9d9",flexShrink:0}),onClick:R=>C.backgroundColor=w,title:"预设 "+(T+1)},null,12,IE)),64))]),c.createElementVNode("div",BE,[c.withDirectives(c.createElementVNode("input",{type:"color","onUpdate:modelValue":y[22]||(y[22]=w=>B.value=w),style:{width:"40px",height:"24px",padding:"0",border:"1px solid #d9d9d9"}},null,512),[[c.vModelText,B.value]]),c.createVNode(c.unref(o),{value:C.backgroundColor,"onUpdate:value":y[23]||(y[23]=w=>C.backgroundColor=w),size:"small",style:{flex:"1"},placeholder:"CSS 颜色值"},null,8,["value"])])])])):c.createCommentVNode("",!0),m.value==="MOUSE"?(c.openBlock(),c.createElementBlock("div",xE,[c.createElementVNode("div",SE,[y[40]||(y[40]=c.createElementVNode("span",null,"碰撞检测",-1)),c.createVNode(c.unref(t),{checked:v.collision,"onUpdate:checked":y[24]||(y[24]=w=>v.collision=w),size:"small"},null,8,["checked"])]),c.createElementVNode("div",TE,[y[43]||(y[43]=c.createElementVNode("div",{class:"sub-label"},"操作习惯",-1)),c.createVNode(c.unref(n),{value:v.habit,"onUpdate:value":y[25]||(y[25]=w=>v.habit=w),size:"small"},{default:c.withCtx(()=>[c.createVNode(c.unref(s),{value:0},{default:c.withCtx(()=>[...y[41]||(y[41]=[c.createTextVNode("默认 (中键旋转)",-1)])]),_:1}),c.createVNode(c.unref(s),{value:1},{default:c.withCtx(()=>[...y[42]||(y[42]=[c.createTextVNode("习惯1 (左键旋转)",-1)])]),_:1})]),_:1},8,["value"])])])):c.createCommentVNode("",!0)])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-79494025"]]),ME={class:"cad-layer-panel"},DE={class:"layer-list-container"},kE={class:"list-header"},PE={class:"col-check"},FE=["checked"],RE={class:"list-body"},OE={class:"col-check"},LE=["checked","onChange"],NE={class:"col-index"},UE=["title"],_E={class:"col-color"},QE=["value"],GE={key:0,class:"empty-text"},HE=Oe(c.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=c.inject("leitingMethods",c.ref({})),o=c.ref(""),r=c.ref([]),l=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(v=>({modelId:v.modelId,modelName:v.modelName}))||[])},a=c.computed(()=>r.value.map(v=>({value:v.modelId,label:v.modelName}))),d=c.ref([]),h=c.ref([]),f=c.computed(()=>d.value.length>0&&h.value.length===d.value.length),p=({modelId:v})=>{if(d.value=[],h.value=[],s.value&&s.value.getDxfLayers){const S=s.value.getDxfLayers({modelId:v});S&&Object.keys(S).forEach((D,N)=>{S[D].length&&(d.value.push({index:N+1,layerName:D,layerColor:S[D][0].color||"#ffffff",key:D}),h.value.push(D))})}},u=v=>{o.value=v,p({modelId:v})},m=v=>{v.target.checked?h.value=d.value.map(D=>D.key):h.value=[],A()},b=(v,S)=>{S.target.checked?h.value.includes(v)||h.value.push(v):h.value=h.value.filter(N=>N!==v),A()},A=()=>{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 S=Object.keys(v).filter(D=>!h.value.includes(D));s.value.showDxfLayer({modelId:o.value,show:!1,layers:S})}}},C=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return c.watch(()=>t.visible,v=>{v&&(l(),t.currentModelId?(o.value=t.currentModelId,p({modelId:t.currentModelId})):a.value.length>0&&(o.value=a.value[0]?.value,p({modelId:o.value})))}),c.watch(()=>t.currentModelId,v=>{v&&t.visible&&(o.value=v,p({modelId:v}))}),(v,S)=>(c.openBlock(),c.createBlock(Pe,{visible:i.visible,title:"CAD图层","onUpdate:visible":S[3]||(S[3]=D=>v.$emit("update:visible",D)),onClose:C,width:360,align:"right","initial-position":{x:0,y:60}},{"header-extra":c.withCtx(()=>[c.createElementVNode("div",{class:"header-select-container",onMousedown:S[2]||(S[2]=c.withModifiers(()=>{},["stop"]))},[S[4]||(S[4]=c.createElementVNode("span",{class:"header-label"},"图纸:",-1)),c.createVNode(c.unref(ge.Select),{value:o.value,"onUpdate:value":S[0]||(S[0]=D=>o.value=D),options:a.value,onChange:S[1]||(S[1]=D=>u(D)),placeholder:"选择模型",style:{width:"140px"},bordered:!1,class:"custom-header-select",popupClassName:"leiting-select-dropdown",size:"small"},null,8,["value","options"])],32)]),default:c.withCtx(()=>[c.createElementVNode("div",ME,[c.createElementVNode("div",DE,[c.createElementVNode("div",kE,[c.createElementVNode("div",PE,[c.createElementVNode("input",{type:"checkbox",checked:f.value,onChange:m},null,40,FE)]),S[5]||(S[5]=c.createElementVNode("div",{class:"col-index"},"序号",-1)),S[6]||(S[6]=c.createElementVNode("div",{class:"col-name"},"图层名称",-1)),S[7]||(S[7]=c.createElementVNode("div",{class:"col-color"},"颜色",-1))]),c.createElementVNode("div",RE,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,D=>(c.openBlock(),c.createElementBlock("div",{key:D.key,class:"list-item"},[c.createElementVNode("div",OE,[c.createElementVNode("input",{type:"checkbox",checked:h.value.includes(D.key),onChange:N=>b(D.key,N)},null,40,LE)]),c.createElementVNode("div",NE,c.toDisplayString(D.index),1),c.createElementVNode("div",{class:"col-name",title:D.layerName},c.toDisplayString(D.layerName),9,UE),c.createElementVNode("div",_E,[c.createElementVNode("input",{type:"color",value:D.layerColor,disabled:""},null,8,QE)])]))),128)),d.value.length===0?(c.openBlock(),c.createElementBlock("div",GE,"暂无数据")):c.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-a4db4977"]]),YE={class:"adjust-panel"},VE={class:"control-panel"},zE={class:"form-item"},WE={class:"radio-group"},jE={class:"form-item"},KE=["title"],$E={class:"param-row"},XE=["step"],qE={class:"param-row"},JE=["step"],ZE={class:"param-row"},ew=["step"],tw={class:"param-row"},iw=["step"],nw={class:"param-row"},sw=["step"],ow={class:"param-row"},rw=["step"],aw={class:"param-row"},lw=["step"],cw={class:"button-grid"},dw={key:1,class:"pick-mode-ui"},hw=["onClick"],uw=["checked"],fw={style:{"font-size":"12px",color:"#aaa","padding-left":"10px"}},pw={class:"param-row"},gw={style:{width:"40px"}},mw=["onUpdate:modelValue"],Aw={class:"param-row"},yw={style:{width:"40px"}},Cw=["onUpdate:modelValue"],Ew={class:"param-row"},ww={style:{width:"40px"}},bw=["onUpdate:modelValue"],vw={class:"list-panel"},Iw={class:"list-header"},Bw={class:"col-check"},xw=["checked"],Sw={class:"list-body"},Tw={class:"col-check"},Mw=["onUpdate:modelValue"],Dw={class:"col-index"},kw=["title"],Pw={class:"col-main"},Fw=["checked","onChange"],Rw={key:0,style:{padding:"10px","text-align":"center",color:"#999"}},Ow=Oe(c.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=c.inject("leitingMethods"),r=c.ref([]),l=c.ref(""),a=c.computed(()=>r.value.length>0&&r.value.every(y=>y.selected)),d=c.ref("param"),h=c.ref("bimPoint1"),f=c.ref(null),p=c.ref("bimPoint1"),u=c.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}}),m=c.ref(1e-6),b=c.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=c.computed(()=>{const y=r.value.find(w=>w.modelId===l.value);return y?y.modelName:""}),C=()=>{s("update:visible",!1)},v=()=>(!f.value&&o?.value?.getViewer&&o?.value?.getCesium&&(f.value=new ll(o.value.getViewer(),o.value.getCesium())),f.value),S=()=>{v()?.clearMarkers(),u.bimPoint1.longitude=void 0,u.bimPoint1.latitude=void 0,u.bimPoint1.height=void 0,u.bimPoint2.longitude=void 0,u.bimPoint2.latitude=void 0,u.bimPoint2.height=void 0},D=y=>{const w=h.value,T=u[w];if(T){T.longitude=y.longitude,T.latitude=y.latitude,T.height=y.height;const R=w==="bimPoint1"?"BIM":"MAP";v()?.addMarker(R,y),fe.success(`${T.type}已添加`)}},N=()=>{v()?.registerPickHandler(y=>{D(y)})},I=()=>{v()?.destroyPickHandler()},B=y=>{d.value=y,y!=="pick"&&s("clearBimPointList")};c.watch(()=>d.value,y=>{y==="pick"?N():I()}),c.onUnmounted(()=>{I()});const g=()=>{if(!o?.value?.getDxfModels)return;const y=o.value.getDxfModels();if(Array.isArray(y)?r.value=y.map(w=>({modelId:w.modelId,modelName:w.modelName,formData:w.formData||{},selected:!1,tileset:w})):r.value=[],r.value.length>0){const w=o.value.getCadModelId?o.value.getCadModelId():"";w&&r.value.find(T=>T.modelId===w)?P(w):P(r.value[0].modelId),r.value.forEach(T=>T.selected=!0)}},P=y=>{l.value=y;const w=r.value.find(T=>T.modelId===y);w&&w.formData&&Object.keys(b).forEach(T=>{w.formData[T]!==void 0&&(b[T]=w.formData[T])})},x=(y,w)=>{if(!o?.value?.adjustingModelByCad)return;const T=r.value.find(R=>R.modelId===y);T&&T.tileset&&(T.formData={...T.formData,...w},T.tileset.formData=T.formData,o.value.adjustingModelByCad({...T.formData,tileset:T.tileset}))},k=y=>{if(!l.value)return;const w=b[y];x(l.value,{[y]:w})},U=y=>{const w=r.value.filter(L=>L.selected);if(w.length===0){fe.warning("请先选择要调整的模型");return}const{distance:T,heightDistance:R,rotation:O}=b;w.forEach(L=>{const M={...L.formData};switch(y){case"north":M.latitude+=T;break;case"south":M.latitude-=T;break;case"east":M.longitude+=T;break;case"west":M.longitude-=T;break;case"up":M.height+=R;break;case"down":M.height-=R;break;case"rotateLeft":M.totalRotation=(M.totalRotation||0)-O;break;case"rotateRight":M.totalRotation=(M.totalRotation||0)+O;break}L.modelId===l.value&&Object.assign(b,M),x(L.modelId,M)})},G=y=>{const w=y.target.checked;r.value.forEach(T=>T.selected=w)},F=()=>{s("handleSavingByCadCard",r.value),s("save",r.value)},E=()=>{const y=u.bimPoint1,w=u.bimPoint2;if(y.longitude===void 0||w.longitude===void 0){fe.warning("请先完成点选操作");return}const T=r.value.filter(Q=>Q.selected);if(T.length===0){fe.warning("请先选择要调整的模型");return}let R=0,O=0,L=0;const M=v();if(M){const{dLon:Q,dLat:Y,dHeight:W}=M.calculateOffset(y,w);R=Q,O=Y,L=W}else R=w.longitude-y.longitude,O=w.latitude-y.latitude,L=w.height-y.height;T.forEach(Q=>{const Y={...Q.formData};Y.longitude+=R,Y.latitude+=O,Y.height+=L,Q.modelId===l.value&&Object.assign(b,Y),x(Q.modelId,Y)}),fe.success("位置已调整")};return c.watch(()=>n.visible,y=>{y?g():(I(),S())}),c.onMounted(()=>{n.visible&&g()}),e({setBIMPointsList:({longitude:y,latitude:w,height:T})=>{u[p.value].longitude=y,u[p.value].latitude=w,u[p.value].height=T},addGltfOr3dTilesModelList:y=>{console.warn("addGltfOr3dTilesModelList is deprecated, use internal loading")}}),(y,w)=>(c.openBlock(),c.createBlock(Pe,{visible:n.visible,title:"Cad校准",width:282,height:600,"onUpdate:visible":w[21]||(w[21]=T=>s("update:visible",T)),onClose:C},{default:c.withCtx(()=>[c.createElementVNode("div",YE,[c.createElementVNode("div",VE,[c.createElementVNode("div",zE,[w[22]||(w[22]=c.createElementVNode("label",null,"调整操作:",-1)),c.createElementVNode("div",WE,[c.createElementVNode("span",{class:c.normalizeClass({active:d.value==="param"}),onClick:w[0]||(w[0]=T=>B("param"))},"参数模式",2),c.createElementVNode("span",{class:c.normalizeClass({active:d.value==="pick"}),onClick:w[1]||(w[1]=T=>B("pick"))},"地图点选",2)])]),c.createElementVNode("div",jE,[w[23]||(w[23]=c.createElementVNode("label",null,"当前主模型:",-1)),c.createElementVNode("span",{class:"value",title:A.value},c.toDisplayString(A.value||"未选择"),9,KE)]),w[35]||(w[35]=c.createElementVNode("div",{class:"separator"},null,-1)),d.value==="param"?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[w[31]||(w[31]=c.createElementVNode("div",{class:"group-header"},"当前状态",-1)),c.createElementVNode("div",$E,[w[24]||(w[24]=c.createElementVNode("label",null,"经度(东西):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":w[2]||(w[2]=T=>b.longitude=T),onChange:w[3]||(w[3]=T=>k("longitude")),step:m.value},null,40,XE),[[c.vModelText,b.longitude,void 0,{number:!0}]])]),c.createElementVNode("div",qE,[w[25]||(w[25]=c.createElementVNode("label",null,"纬度(南北):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":w[4]||(w[4]=T=>b.latitude=T),onChange:w[5]||(w[5]=T=>k("latitude")),step:m.value},null,40,JE),[[c.vModelText,b.latitude,void 0,{number:!0}]])]),c.createElementVNode("div",ZE,[w[26]||(w[26]=c.createElementVNode("label",null,"高度(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":w[6]||(w[6]=T=>b.height=T),onChange:w[7]||(w[7]=T=>k("height")),step:m.value},null,40,ew),[[c.vModelText,b.height,void 0,{number:!0}]])]),c.createElementVNode("div",tw,[w[27]||(w[27]=c.createElementVNode("label",null,"累计旋转(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":w[8]||(w[8]=T=>b.totalRotation=T),onChange:w[9]||(w[9]=T=>k("totalRotation")),step:m.value},null,40,iw),[[c.vModelText,b.totalRotation,void 0,{number:!0}]])]),w[32]||(w[32]=c.createElementVNode("div",{class:"separator"},null,-1)),w[33]||(w[33]=c.createElementVNode("div",{class:"group-header"},"调整步长",-1)),c.createElementVNode("div",nw,[w[28]||(w[28]=c.createElementVNode("label",null,"经纬步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":w[10]||(w[10]=T=>b.distance=T),step:m.value},null,8,sw),[[c.vModelText,b.distance,void 0,{number:!0}]])]),c.createElementVNode("div",ow,[w[29]||(w[29]=c.createElementVNode("label",null,"高度步长(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":w[11]||(w[11]=T=>b.heightDistance=T),step:m.value},null,8,rw),[[c.vModelText,b.heightDistance,void 0,{number:!0}]])]),c.createElementVNode("div",aw,[w[30]||(w[30]=c.createElementVNode("label",null,"旋转步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":w[12]||(w[12]=T=>b.rotation=T),step:m.value},null,8,lw),[[c.vModelText,b.rotation,void 0,{number:!0}]])]),c.createElementVNode("div",cw,[c.createElementVNode("button",{onClick:w[13]||(w[13]=T=>U("rotateLeft"))},"左转"),c.createElementVNode("button",{onClick:w[14]||(w[14]=T=>U("north"))},"北移"),c.createElementVNode("button",{onClick:w[15]||(w[15]=T=>U("rotateRight"))},"右转"),c.createElementVNode("button",{onClick:w[16]||(w[16]=T=>U("west"))},"西移"),c.createElementVNode("button",{onClick:w[17]||(w[17]=T=>U("south"))},"南移"),c.createElementVNode("button",{onClick:w[18]||(w[18]=T=>U("east"))},"东移"),c.createElementVNode("button",{onClick:w[19]||(w[19]=T=>U("up"))},"上移"),c.createElementVNode("button",{onClick:w[20]||(w[20]=T=>U("down"))},"下移"),c.createElementVNode("button",{onClick:F,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):(c.openBlock(),c.createElementBlock("div",dw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u,(T,R)=>(c.openBlock(),c.createElementBlock("div",{key:R,class:"form-item",style:{display:"block","margin-bottom":"15px"}},[c.createElementVNode("div",{style:{"font-weight":"bold","margin-bottom":"5px",cursor:"pointer",display:"flex","align-items":"center"},onClick:O=>h.value=R},[c.createElementVNode("input",{type:"radio",checked:h.value===R,style:{"margin-right":"5px"}},null,8,uw),c.createTextVNode(" "+c.toDisplayString(T.type)+": ",1)],8,hw),c.createElementVNode("div",fw,[c.createElementVNode("div",pw,[c.createElementVNode("label",gw,c.toDisplayString(T.longitudeText),1),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":O=>T.longitude=O,readonly:"",style:{width:"100px"}},null,8,mw),[[c.vModelText,T.longitude,void 0,{number:!0}]])]),c.createElementVNode("div",Aw,[c.createElementVNode("label",yw,c.toDisplayString(T.latitudeText),1),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":O=>T.latitude=O,readonly:"",style:{width:"100px"}},null,8,Cw),[[c.vModelText,T.latitude,void 0,{number:!0}]])]),c.createElementVNode("div",Ew,[c.createElementVNode("label",ww,c.toDisplayString(T.heightText),1),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":O=>T.height=O,readonly:"",style:{width:"100px"}},null,8,bw),[[c.vModelText,T.height,void 0,{number:!0}]])])])]))),128)),c.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[c.createElementVNode("button",{onClick:E,class:"primary-btn"},"应用校准"),c.createElementVNode("button",{onClick:F},"保存")]),w[34]||(w[34]=c.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[c.createElementVNode("div",null,"操作指南:"),c.createElementVNode("div",null,"1. 勾选上方 CAD 或 地图 标记点选项。"),c.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),c.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行校准。")],-1))]))]),c.createElementVNode("div",vw,[c.createElementVNode("div",Iw,[c.createElementVNode("div",Bw,[c.createElementVNode("input",{type:"checkbox",checked:a.value,onChange:G},null,40,xw)]),w[36]||(w[36]=c.createElementVNode("div",{class:"col-index"},"序号",-1)),w[37]||(w[37]=c.createElementVNode("div",{class:"col-name"},"名称",-1)),w[38]||(w[38]=c.createElementVNode("div",{class:"col-main"},"主模型",-1))]),c.createElementVNode("div",Sw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(T,R)=>(c.openBlock(),c.createElementBlock("div",{key:T.modelId,class:c.normalizeClass(["list-item",{active:T.modelId===l.value}])},[c.createElementVNode("div",Tw,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":O=>T.selected=O},null,8,Mw),[[c.vModelCheckbox,T.selected]])]),c.createElementVNode("div",Dw,c.toDisplayString(R+1),1),c.createElementVNode("div",{class:"col-name",title:T.modelName},c.toDisplayString(T.modelName),9,kw),c.createElementVNode("div",Pw,[c.createElementVNode("input",{type:"radio",name:"mainModel",checked:T.modelId===l.value,onChange:O=>P(T.modelId)},null,40,Fw)])],2))),128)),r.value.length===0?(c.openBlock(),c.createElementBlock("div",Rw,"暂无数据")):c.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-e8abd49d"]]),Lw={class:"annotation-content"},Nw={class:"annotation-tools"},Uw={class:"annotation-controls"},_w={class:"control-group",title:"颜色"},Qw={class:"tool-item color-tool"},Gw={class:"control-group line-width-container",title:"线宽"},Hw=["onClick"],Yw={class:"option-label"},Vw=Oe(c.defineComponent({__name:"LeitingAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=c.inject("leitingMethods"),o=c.ref(""),r=c.ref("#ff0000"),l=c.ref(1),a=c.ref(!1),d=c.ref(null),h=c.ref(null),f=c.ref({top:"0px",left:"0px"}),p=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],u=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,m=()=>{n("update:visible",!1)},b=B=>{o.value=B;const g=u();if(g)switch(B){case"freehandLine":g.startFreehandLine();break;case"arrow":g.startArrow();break;case"straightLine":g.startStraightLine();break;case"rectangle":g.startRectangle();break;case"ellipse":g.startEllipse();break}},A=()=>{const B=u();B&&(B.setCurrentColor(r.value),B.changeColor(r.value))},C=()=>{if(!a.value&&d.value){const B=d.value.getBoundingClientRect();f.value={top:`${B.top}px`,left:`${B.right+8}px`}}a.value=!a.value},v=B=>{l.value=B,a.value=!1;const g=u();g&&(g.setCurrentWidth(B),g.changeWidth(B))},S=()=>{const B=u();B&&B.deleteSelectedEntity()},D=()=>{const B=u();B&&B.clearAll()},N=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const B=u();B&&B.saveAnnotations()},I=B=>{const g=B.target,P=d.value&&d.value.contains(g),x=h.value&&h.value.contains(g);!P&&!x&&(a.value=!1)};return c.onMounted(()=>{document.addEventListener("click",I)}),c.onUnmounted(()=>{document.removeEventListener("click",I)}),(B,g)=>(c.openBlock(),c.createBlock(Pe,{visible:t.visible,title:"标注",width:70,"min-width":70,height:480,"onUpdate:visible":g[6]||(g[6]=P=>n("update:visible",P)),onClose:m},{default:c.withCtx(()=>[c.createElementVNode("div",Lw,[c.createElementVNode("div",Nw,[c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="freehandLine"}]),onClick:g[0]||(g[0]=P=>b("freehandLine")),title:"手绘线"},[...g[7]||(g[7]=[c.createElementVNode("div",{class:"tool-icon"},"✏️",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="arrow"}]),onClick:g[1]||(g[1]=P=>b("arrow")),title:"箭头"},[...g[8]||(g[8]=[c.createElementVNode("div",{class:"tool-icon"},"↗️",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="straightLine"}]),onClick:g[2]||(g[2]=P=>b("straightLine")),title:"直线"},[...g[9]||(g[9]=[c.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="rectangle"}]),onClick:g[3]||(g[3]=P=>b("rectangle")),title:"矩形"},[...g[10]||(g[10]=[c.createElementVNode("div",{class:"tool-icon"},"▭",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="ellipse"}]),onClick:g[4]||(g[4]=P=>b("ellipse")),title:"椭圆"},[...g[11]||(g[11]=[c.createElementVNode("div",{class:"tool-icon"},"⭕",-1)])],2)]),g[13]||(g[13]=c.createElementVNode("div",{class:"separator"},null,-1)),c.createElementVNode("div",Uw,[c.createElementVNode("div",_w,[c.createElementVNode("div",Qw,[c.createElementVNode("div",{class:"color-swatch",style:c.normalizeStyle({backgroundColor:r.value})},null,4),c.withDirectives(c.createElementVNode("input",{type:"color","onUpdate:modelValue":g[5]||(g[5]=P=>r.value=P),onChange:A,class:"color-input-overlay"},null,544),[[c.vModelText,r.value]])])]),c.createElementVNode("div",Gw,[c.createElementVNode("div",{ref_key:"lineWidthBtnRef",ref:d,class:"tool-item",onClick:c.withModifiers(C,["stop"])},[c.createElementVNode("div",{class:"current-width-preview",style:c.normalizeStyle({height:l.value+"px",backgroundColor:"#fff"})},null,4)],512),(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[a.value?(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"line-width-dropdown",style:c.normalizeStyle(f.value)},[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(p,P=>c.createElementVNode("div",{key:P.value,class:c.normalizeClass(["line-width-option",{selected:l.value===P.value}]),onClick:c.withModifiers(x=>v(P.value),["stop"])},[c.createElementVNode("span",Yw,c.toDisplayString(P.label),1),c.createElementVNode("div",{class:"line-preview",style:c.normalizeStyle({height:P.value+"px",backgroundColor:l.value===P.value?"#1890ff":"#ddd"})},null,4)],10,Hw)),64))],4)):c.createCommentVNode("",!0)]))]),g[12]||(g[12]=c.createElementVNode("div",{class:"separator"},null,-1)),c.createElementVNode("div",{class:"action-buttons"},[c.createElementVNode("button",{class:"control-btn",onClick:S,title:"删除选中"}," 🗑️ "),c.createElementVNode("button",{class:"control-btn",onClick:D,title:"清空"}," ❌ "),c.createElementVNode("button",{class:"control-btn",onClick:N,title:"保存"}," 💾 ")])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-3cfc8415"]]),zw={class:"measure-content"},Ww={class:"measure-tools"},jw={key:0,class:"measure-results"},Kw={class:"result-row"},$w={class:"result-value"},Xw={class:"result-row"},qw={class:"result-value"},Jw={class:"result-row"},Zw={class:"result-value"},eb={class:"result-row"},tb={class:"result-value"},ib={key:1,class:"result-row"},nb={class:"result-value"},sb={key:2,class:"result-row"},ob={class:"result-value"},rb={class:"measure-controls"},ab={class:"control-group",title:"单位"},lb={class:"unit-display"},cb=["onClick"],db=Oe(c.defineComponent({__name:"LeitingMeasurement",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=c.inject("leitingMethods",c.ref({})),o=c.ref(null),r=c.ref(null),l=c.ref("m"),a=c.ref(!1),d=c.ref(null),h=c.ref(!1),f=c.ref({}),p=c.ref(null),u=[{label:"米 (m)",value:"m"},{label:"厘米 (cm)",value:"cm"},{label:"毫米 (mm)",value:"mm"}],m=B=>{const g=l.value;return g==="mm"?`${(B*1e3).toFixed(0)}mm`:g==="cm"?`${(B*100).toFixed(1)}cm`:`${B.toFixed(2)}m`},b=B=>B>1e6?`${(B/1e6).toFixed(2)} km²`:`${B.toFixed(2)} m²`,A=()=>{if(!o.value&&s.value?.getViewer){const B=s.value.getViewer(),g=s.value.getCesium();B&&g&&(o.value=new il({viewer:B,cesium:g}),o.value.setUnit(l.value),o.value.setSnapping(a.value),o.value.onMeasure=P=>{d.value=P})}},C=B=>{o.value||A(),r.value===B?(r.value=null,o.value?.stop()):(r.value=B,o.value?.start(B))},v=B=>{l.value=B,h.value=!1},S=()=>{o.value&&(o.value.clearAll(),r.value=null,o.value.stop())},D=()=>{n("update:visible",!1)},N=B=>{if(h.value){h.value=!1;return}const P=B.currentTarget.getBoundingClientRect();f.value={position:"fixed",top:`${P.top}px`,left:`${P.right+5}px`,zIndex:3e3},h.value=!0},I=B=>{h.value&&p.value&&!p.value.contains(B.target)&&(h.value=!1)};return c.onMounted(()=>{document.addEventListener("click",I),t.visible&&c.nextTick(()=>A())}),c.onUnmounted(()=>{document.removeEventListener("click",I),o.value&&o.value.destroy()}),c.watch(()=>t.visible,B=>{B?c.nextTick(()=>A()):o.value&&(o.value.stop(),r.value=null)}),c.watch(s,B=>{B&&B.getViewer&&!o.value&&t.visible&&A()}),c.watch(l,B=>{o.value&&o.value.setUnit(B)}),(B,g)=>(c.openBlock(),c.createBlock(Pe,{visible:t.visible,title:"量算",width:70,"min-width":70,height:480,"onUpdate:visible":g[3]||(g[3]=P=>n("update:visible",P)),onClose:D},{default:c.withCtx(()=>[c.createElementVNode("div",zw,[c.createElementVNode("div",Ww,[c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:r.value==="distance"}]),onClick:g[0]||(g[0]=P=>C("distance")),title:"距离测量"},[...g[4]||(g[4]=[c.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:r.value==="angle"}]),onClick:g[1]||(g[1]=P=>C("angle")),title:"角度测量"},[...g[5]||(g[5]=[c.createElementVNode("div",{class:"tool-icon"},"📐",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:r.value==="area"}]),onClick:g[2]||(g[2]=P=>C("area")),title:"面积测量"},[...g[6]||(g[6]=[c.createElementVNode("div",{class:"tool-icon"},"🔳",-1)])],2)]),g[15]||(g[15]=c.createElementVNode("div",{class:"separator"},null,-1)),d.value?(c.openBlock(),c.createElementBlock("div",jw,[d.value.type==="distance"?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createElementVNode("div",Kw,[g[7]||(g[7]=c.createElementVNode("span",{class:"result-label"},"总长:",-1)),c.createElementVNode("span",$w,c.toDisplayString(m(d.value.dist)),1)]),c.createElementVNode("div",Xw,[g[8]||(g[8]=c.createElementVNode("span",{class:"result-label",style:{color:"#ff4d4f"}},"ΔX:",-1)),c.createElementVNode("span",qw,c.toDisplayString(m(d.value.dx)),1)]),c.createElementVNode("div",Jw,[g[9]||(g[9]=c.createElementVNode("span",{class:"result-label",style:{color:"#52c41a"}},"ΔY:",-1)),c.createElementVNode("span",Zw,c.toDisplayString(m(d.value.dy)),1)]),c.createElementVNode("div",eb,[g[10]||(g[10]=c.createElementVNode("span",{class:"result-label",style:{color:"#1890ff"}},"ΔZ:",-1)),c.createElementVNode("span",tb,c.toDisplayString(m(d.value.dz)),1)])],64)):c.createCommentVNode("",!0),d.value.type==="angle"?(c.openBlock(),c.createElementBlock("div",ib,[g[11]||(g[11]=c.createElementVNode("span",{class:"result-label"},"角度:",-1)),c.createElementVNode("span",nb,c.toDisplayString(d.value.angle.toFixed(1))+"°",1)])):c.createCommentVNode("",!0),d.value.type==="area"?(c.openBlock(),c.createElementBlock("div",sb,[g[12]||(g[12]=c.createElementVNode("span",{class:"result-label"},"面积:",-1)),c.createElementVNode("span",ob,c.toDisplayString(b(d.value.area)),1)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("div",rb,[c.createElementVNode("div",ab,[c.createElementVNode("div",{class:"tool-item",onClick:c.withModifiers(N,["stop"])},[c.createElementVNode("div",lb,c.toDisplayString(l.value),1)]),(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[h.value?(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"unitDropdownRef",ref:p,class:"unit-dropdown",style:c.normalizeStyle(f.value)},[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(u,P=>c.createElementVNode("div",{key:P.value,class:c.normalizeClass(["unit-option",{selected:l.value===P.value}]),onClick:c.withModifiers(x=>v(P.value),["stop"])},c.toDisplayString(P.label),11,cb)),64))],4)):c.createCommentVNode("",!0)]))]),g[14]||(g[14]=c.createElementVNode("div",{class:"separator"},null,-1)),c.createElementVNode("div",{class:"action-buttons"},[c.createElementVNode("div",{class:"tool-item control-btn",onClick:S,title:"清空"},[...g[13]||(g[13]=[c.createElementVNode("div",{class:"tool-icon"},"🗑️",-1)])])])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-b766acb4"]]);function hb(){const i=c.ref(!1),e=c.reactive({x:0,y:0}),t=c.ref([]),n=c.ref(null);return{visible:i,position:e,items:t,contextData:n,show:(a,d,h)=>{a instanceof MouseEvent?(a.preventDefault(),e.x=a.clientX,e.y=a.clientY):(e.x=a.x,e.y=a.y),t.value=d,n.value=h,i.value=!0},hide:()=>{i.value=!1},addItem:a=>{t.value.push(a)},removeItem:a=>{t.value=t.value.filter(d=>d.id!==a)}}}const ub=["onClick"],fb={class:"menu-label"},pb={key:0,class:"menu-arrow"},gb=Oe(c.defineComponent({__name:"LeitingContextMenu",props:{visible:{type:Boolean},position:{},items:{}},emits:["update:visible","action"],setup(i,{emit:e}){const t=i,n=e,s=r=>{r.disabled||(r.action&&r.action(),n("action",r),n("update:visible",!1))},o=()=>{t.visible&&n("update:visible",!1)};return c.onMounted(()=>{document.addEventListener("click",o),document.addEventListener("contextmenu",r=>{r.target.closest(".leiting-context-menu")||o()})}),c.onUnmounted(()=>{document.removeEventListener("click",o)}),(r,l)=>c.withDirectives((c.openBlock(),c.createElementBlock("div",{class:"leiting-context-menu",style:c.normalizeStyle({left:i.position.x+"px",top:i.position.y+"px"}),onContextmenu:l[0]||(l[0]=c.withModifiers(()=>{},["prevent"]))},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.items,a=>(c.openBlock(),c.createElementBlock("div",{key:a.id,class:c.normalizeClass(["menu-item",{"menu-divided":a.divided,"menu-disabled":a.disabled}]),onClick:d=>s(a)},[c.createElementVNode("span",fb,c.toDisplayString(a.label),1),a.children?(c.openBlock(),c.createElementBlock("span",pb,"▶")):c.createCommentVNode("",!0)],10,ub))),128))],36)),[[c.vShow,i.visible]])}}),[["__scopeId","data-v-f288753b"]]),gn=Oe(c.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=c.ref(),s=c.ref(),o=c.getCurrentInstance(),r=c.ref(!1),l=c.ref(""),a=c.ref({}),d=c.ref("3d"),h=i,f={title:"构件树",treeData:[]},p=c.ref(!1),u=c.ref(!1),m=c.ref(!1),b=c.ref(!1),A=c.ref(!1),C=c.ref(!1),v=c.ref(!1),S=c.ref(!1),D=c.ref(!1),N=c.ref(!1),{visible:I,position:B,items:g,show:P,hide:x}=hb(),k=c.ref([]),U=V=>{k.value.push(V)},G=V=>{k.value=k.value.filter(j=>j.id!==V)},F=c.ref([]),E=c.ref(""),y=c.ref(null),w=c.ref([]),T=c.reactive({tree:!1,section:!1,roam:!1,info:!1,adjustModel:!1,setting:!1,cadLayer:!1,cadPosition:!1,annotation:!1}),R=(V,j)=>{V==="componentTree"&&(V="tree"),V==="componentInfo"&&(V="info"),V in T&&(T[V]=j)},O=c.shallowRef({});c.provide("leitingMethods",O);const L=c.ref(h.showMenu),M=c.ref([]);c.watch(()=>h.showMenu,V=>{L.value=V},{immediate:!0}),c.watch(()=>h.mode,V=>{V&&O.value?.set2d&&O.value.set2d(V==="2d")});const Q=c.ref("dark");c.provide("leiting-theme",Q);const Y=c.ref(h.teleportTarget);c.watch(()=>h.teleportTarget,V=>{Y.value=V});const W=c.ref([]),q=c.computed(()=>{const V=[];return p.value&&(V.push("tree"),V.push("componentTree")),u.value&&V.push("section"),m.value&&V.push("roam"),b.value&&(V.push("info"),V.push("componentInfo")),A.value&&V.push("adjust"),C.value&&V.push("setting"),v.value&&V.push("cadLayer"),S.value&&V.push("cadPosition"),D.value&&V.push("annotation"),N.value&&(V.push("measure"),V.push("measurement")),V.push(...W.value),V}),Z=c.ref(null),oe=(V,j)=>{V==="componentTree"||V==="tree"?p.value=j:V==="section"?u.value=j:V==="roam"?m.value=j:V==="componentInfo"||V==="info"?b.value=j:V==="homeView"?O.value?.is2dMode?.()?O.value?.flyToTopView?.({}):O.value?.getBIMmodelId()?O.value?.flyToTileset?.({}):O.value?.getCadModelId()&&O.value?.flyToTopView?.({}):V==="adjustModel"?(A.value=j,j&&Z.value&&Z.value.setModelType("BIM")):V==="osgbAdjust"?(A.value=j,j&&Z.value&&Z.value.setModelType("OSGB")):V==="setting"?C.value=j:V==="cadLayer"?v.value=j:V==="cadPosition"?S.value=j:V==="annotation"?D.value=j:V==="measurement"?N.value=j:j?W.value.includes(V)||W.value.push(V):W.value=W.value.filter(te=>te!==V)};c.watch(p,async V=>{if(V&&O.value?.loadTreeForModel&&O.value?.getMapTileset){const j=O.value.getMapTileset(),te=Object.values(j).map(async Ae=>{if(Ae.leiting&&Ae.leiting.model?.treeUrl){const Ce=Ae.leiting.model.modelId;try{Ae.leiting?.node?.batchIdEIDInfos||await O.value.loadNodeDetailsForModel(Ce);const Me=await O.value.loadTreeForModel(Ce);Me&&(Array.isArray(Me)?Me:[Me]).forEach(Ne=>{Ne&&!w.value.find(st=>st.id===Ne.id)&&(Ne.modelId=Ce,w.value=[...w.value,Ne])})}catch(Me){console.warn(`Failed to lazy load tree for ${Ce}`,Me)}}});await Promise.all(te)}});const ne=()=>{O.value&&(O.value.getDxfModels&&(F.value=O.value.getDxfModels()||[]),O.value.getCadModelId&&(E.value=O.value.getCadModelId()||""))};let se;c.watch(v,V=>{V&&ne()}),c.watch(S,V=>{V&&(ne(),y.value&&F.value.length&&y.value.addGltfOr3dTilesModelList(F.value))});const pe=t,ve=V=>{O.value&&O.value.saveCadCalibration&&O.value.saveCadCalibration(V),O.value&&O.value.saveCadRegion&&O.value.saveCadRegion(V)};return c.onMounted(async()=>{if(s.value&&fe.setContainer(s.value),!!n.value)try{const V={...mt,cesiumUrl:h.cesiumUrl||mt.cesiumUrl,cesiumCssUrl:h.cesiumCssUrl||mt.cesiumCssUrl,accessToken:h.accessToken||wn()||mt.accessToken};await En(V);const j=h.accessToken||wn()||mt.accessToken;j&&(Cesium.Ion.defaultAccessToken=j),r.value=!0,se=async(Ae={},Ce)=>{if(n.value){const{showMenu:Me,showTree:Le,globe:Ne,terrain:st,depthTest:mn,mapProvider:Ii,tiandituLayerType:jt,tiandituShowLabel:ks,arcgisUrl:yb,shadows:Cb,environmentMap:Eb,ambientOcclusion:wb,time:bb,brightness:vb,backgroundColor:Ib,collision:Bb,mouseHabit:xb,heightBasedZoom:Sb,mode:yl,...Ze}=Ae||{},Tb=h.showMenu!==void 0?h.showMenu:Me!==void 0?Me:!0;L.value=Tb;const De=(X,Ee,We)=>X!==void 0?X:Ee!==void 0?Ee:We,Cl=De(h.globe,Ne,!1),El=De(h.terrain,st,!1),wl=De(h.depthTest,mn,!1),bl=De(h.mapProvider,Ii,"tianditu"),vl=De(h.tiandituLayerType,jt,"img_w"),Il=De(h.tiandituShowLabel,ks,!1),Bl=De(h.arcgisUrl,yb,"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"),xl=De(h.shadows,Cb,!1),Sl=De(h.environmentMap,Eb,!1),Tl=De(h.ambientOcclusion,wb,!1),Ml=De(h.time,bb,void 0),Dl=De(h.brightness,vb,1),An=h.mode||yl||"3d";console.log("LeitingBIM Mode:",An,"Props:",h.mode,"Options:",yl),d.value=An;const Mb=An==="2d"?"#000000":"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",kl=De(h.backgroundColor,Ib,Mb),Pl=De(h.collision,Bb,!1),Fl=De(h.mouseHabit,xb,0),Rl=De(h.heightBasedZoom,Sb,!1);a.value={globe:Cl,terrain:El,depthTest:wl,mapProvider:bl,tiandituLayerType:vl,tiandituShowLabel:Il,arcgisUrl:Bl,shadows:xl,environmentMap:Sl,ambientOcclusion:Tl,time:Ml,brightness:Dl,backgroundColor:kl,collision:Pl,mouseHabit:Fl,heightBasedZoom:Rl};const Bi=ly({container:n.value,appContext:o?.appContext,methods:{...O.value,handleMenuAction:oe,setCardFullHeight:R,onLoadingStatus:X=>{X?fe.loading(X,"",s.value):fe.close()},...Ze,tilesLoad3dTiles:async X=>{let Ee=X.leiting?.tree;const We=X.leiting?.model?.modelId;if(!Ee&&p.value&&O.value?.loadTreeForModel)try{Ee=await O.value.loadTreeForModel(We)}catch(Si){console.warn("Failed to lazy load tree",Si)}Ee&&(Array.isArray(Ee)?Ee:[Ee]).forEach(Dt=>{Dt&&!w.value.find(Ll=>Ll.id===Dt.id)&&(Dt.modelId=We,w.value=[...w.value,Dt])});const{brightness:Ps,contrast:Fs,saturation:ot}=Bi.methods.getConfigure();Bi.methods.setModelColorAdjustment({brightness:Ps,contrast:Fs,saturation:ot}),Ze.tilesLoad3dTiles?.(X)},mountAll3Dtiles:X=>{h.mountAll3Dtiles&&h.mountAll3Dtiles(X),Ze.mountAll3Dtiles?.(X)},updateModels:X=>{if(Array.isArray(X))if(X.length===0)w.value=[];else{const Ee=X.map(We=>We.modelId);w.value=w.value.filter(We=>Ee.includes(We.modelId))}},mountAllCad:X=>{if(Bi.methods.setModelBrightness){const Ee=h.brightness!==void 0?h.brightness:a.value.brightness;Ee!==void 0&&Bi.methods.setModelBrightness(Ee)}h.mountAllCad&&h.mountAllCad(X),Ze.mountAllCad?.(X)},saveRegion:X=>{h.saveRegion&&h.saveRegion(X),Ze.saveRegion?.(X)},saveCadRegion:X=>{h.saveCadRegion&&h.saveCadRegion(X),Ze.saveCadRegion?.(X)},saveCadCalibration:X=>{h.saveCadCalibration&&h.saveCadCalibration(X),Ze.saveCadCalibration?.(X)},selectionChange:X=>{h.selectionChange&&h.selectionChange(X),Ze.selectionChange?.(X)},onSearchComponent:X=>{h.searchComponent&&h.searchComponent(X),Ze.searchComponent?.(X)}},viewerOptions:h.viewerOptions,options:{...Ze,mode:An,playerUrl:h.playerUrl,playerModelName:h.playerModelName,playerModelId:h.playerModelId,playerScale:h.playerScale,globe:Cl,terrain:El,depthTest:wl,mapProvider:bl,tiandituLayerType:vl,tiandituShowLabel:Il,tiandituToken:h.tiandituToken,arcgisUrl:Bl,shadows:xl,environmentMap:Sl,ambientOcclusion:Tl,time:Ml,brightness:Dl,backgroundColor:kl,collision:Pl,mouseHabit:Fl,heightBasedZoom:Rl},callbacks:{onLoading:X=>X?fe.loading(X,"",s.value):fe.close(),onSuccess:X=>fe.success(X,"",void 0,s.value),onError:X=>fe.error(X,"",void 0,s.value)}}),{Cesium:Mt,viewer:Kt,methods:yn,menuEvents:xi}=Bi,le=yn;xi.on("showMenu",X=>{L.value=X}),xi.on("insertMenu",X=>{M.value=[...M.value,...X]}),xi.on("setMenuActive",(X,Ee)=>{oe(X,Ee)}),O.value=le,Ce&&(Ce.value=le),xi.on("setMode",X=>{d.value=X}),xi.on("deleteAllModels",()=>{w.value=[]}),new Mt.ScreenSpaceEventHandler(Kt.scene.canvas).setInputAction(async X=>{if(x(),d.value==="2d")return;const Ee=Kt.scene.pick(X.position),We=Kt.container.getBoundingClientRect(),Ps=We.left+X.position.x,Fs=We.top+X.position.y,ot=[];if(Mt.defined(Ee)&&Ee instanceof Mt.Cesium3DTileFeature){const Si=le.baseCompt.getFeatureId(Ee),Dt=ai(Ee.tileset);le.baseCompt.hasSelectedFeaturesMap[Dt]?.some(Ti=>Ti.batchId===Si&&Ti.rank===0)||(await le.baseCompt.clearSelection(),await le.baseCompt.toggleMultiSelect(Dt,Si,le.baseCompt.selectedColor)),ot.push({id:"details",label:"构件详情",action:()=>{b.value=!0}}),ot.push({id:"hide",label:"隐藏选中构件",action:async()=>{const Mi=(await le.baseCompt.getSelected()).map(rt=>({elementId:rt.elementId,modelId:rt.modelId,show:!1}));le.baseCompt.setComponentVisibility(Mi)}}),ot.push({id:"translucent",label:"半透明选中构件",action:async()=>{const Mi=(await le.baseCompt.getSelected()).map(rt=>({elementId:rt.elementId,modelId:rt.modelId,rgba:{...rt.rgba,a:.3}}));await le.baseCompt.setSelectColorUserModelCpt(Mi,{rank:0})}}),ot.push({id:"isolate",label:"隔离选中构件",divided:!0,action:async()=>{await le.baseCompt.loadAllNodeDetailsForModel();const Mi=(await le.baseCompt.getSelected()).map(rt=>({elementId:rt.elementId,modelId:rt.modelId,show:!0}));le.isolateComponents(Mi)}})}ot.push({id:"showAll",label:"显示所有",action:async()=>{le.baseCompt.setAllComponentsVisibility(!0),await le.baseCompt.clearSelection()}}),ot.push(...k.value),P({x:Ps,y:Fs},ot)},Mt.ScreenSpaceEventType.RIGHT_CLICK),le.addContextMenuItems=U,le.insertContextMenu=le.addContextMenuItems,le.removeContextMenuItems=G,le.deleteContextMenu=le.removeContextMenuItems,le.closeContextMenu=x,le.hideContextMenu=le.closeContextMenu,le.onSetTeleportTarget=X=>{Y.value=X},await c.nextTick();const Ol=Ae?.onLoaded||Ae?.onloaded;Ol&&Ol({Cesium:Mt,viewer:Kt,methods:yn}),pe("init",{Cesium:Mt,viewer:Kt,methods:yn}),pe("ready",{Cesium:Mt,viewer:Kt,methods:yn})}};let te=!1;pe("register",(Ae,Ce)=>{te=!0,se(Ae,Ce)}),te||setTimeout(()=>{O.value.getViewer||se()},0)}catch(V){l.value="Failed to load Cesium: "+(V.message||V),console.error(V)}}),c.onUnmounted(()=>{fe.setContainer(null)}),e({initMap:()=>O.value,initializeViewer:(V,j)=>se(V,j)}),(V,j)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["leiting-bim-container",[`theme-${Q.value}`]]),onContextmenu:j[11]||(j[11]=c.withModifiers(()=>{},["prevent","stop"]))},[!r.value&&!l.value?(c.openBlock(),c.createBlock(c.unref(ge.Spin),{key:0,class:"loading",size:"large",tip:"加载基础组件中..."})):c.createCommentVNode("",!0),l.value?(c.openBlock(),c.createBlock(c.unref(ge.Alert),{key:1,class:"error",type:"error",message:l.value,"show-icon":""},null,8,["message"])):c.createCommentVNode("",!0),c.createElementVNode("div",{ref_key:"containerRef",ref:n,class:"cesium-viewer"},[c.createVNode(yi,{visible:L.value,"active-ids":q.value,"custom-items":M.value,onAction:oe,"is-2d":d.value==="2d"},null,8,["visible","active-ids","custom-items","is-2d"]),(c.openBlock(),c.createBlock(c.Teleport,{to:Y.value||"body",disabled:!Y.value},[c.createElementVNode("div",{ref_key:"uiOverlayRef",ref:s,class:"leiting-ui-overlay"},[c.createVNode(wi,{visible:b.value,"full-height":T.info,"onUpdate:visible":j[0]||(j[0]=te=>b.value=te)},null,8,["visible","full-height"]),c.createVNode(bi,{ref_key:"LeitingPositionRef",ref:Z,visible:A.value,"full-height":T.adjustModel,"onUpdate:visible":j[1]||(j[1]=te=>A.value=te)},null,8,["visible","full-height"]),c.createVNode(vi,{visible:C.value,"full-height":T.setting,"tianditu-token":h.tiandituToken,"initial-config":a.value,"onUpdate:visible":j[2]||(j[2]=te=>C.value=te)},null,8,["visible","full-height","tianditu-token","initial-config"]),i.showTree!==!1?(c.openBlock(),c.createBlock(an,c.mergeProps({key:0},{...f,...i.treeProps},{visible:p.value,"full-height":T.tree,"tree-data":w.value.length>0?w.value:i.treeProps?.treeData||[],"onUpdate:visible":j[3]||(j[3]=te=>{p.value=te})}),null,16,["visible","full-height","tree-data"])):c.createCommentVNode("",!0),c.createVNode(Vw,{visible:D.value,"onUpdate:visible":j[4]||(j[4]=te=>D.value=te)},null,8,["visible"]),c.createVNode(db,{visible:N.value,"onUpdate:visible":j[5]||(j[5]=te=>N.value=te)},null,8,["visible"]),c.createVNode(Ci,{visible:u.value,"full-height":T.section,"onUpdate:visible":j[6]||(j[6]=te=>u.value=te)},null,8,["visible","full-height"]),c.createVNode(Ei,{visible:m.value,"full-height":T.roam,"onUpdate:visible":j[7]||(j[7]=te=>m.value=te)},null,8,["visible","full-height"]),c.createVNode(HE,{visible:v.value,"current-model-id":E.value,"onUpdate:visible":j[8]||(j[8]=te=>v.value=te)},null,8,["visible","current-model-id"]),c.createVNode(Ow,{ref_key:"cadPositionRef",ref:y,visible:S.value,"onUpdate:visible":j[9]||(j[9]=te=>S.value=te),onSave:ve},null,8,["visible"]),c.createVNode(gb,{visible:c.unref(I),position:c.unref(B),items:c.unref(g),"onUpdate:visible":j[10]||(j[10]=te=>I.value=te)},null,8,["visible","position","items"]),c.renderSlot(V.$slots,"default",c.normalizeProps(c.guardReactiveProps({methods:O.value,isReady:r.value})),void 0,!0)],512)],8,["to","disabled"]))],512)],34))}}),[["__scopeId","data-v-2c7554a8"]]);function Al(i){const e=c.ref(),t=c.ref(i.theme||"dark"),n=c.ref(i.menuSize||"medium");c.provide("leiting-theme",t),c.provide("leiting-menu-size",n);function s(l){c.onUnmounted(()=>{e.value=null}),l(i,e)}function o(){const l=c.unref(e);return l||console.error("未获取到leiting实例!"),l}const r=new Proxy({},{get(l,a){const d=o();if(!d)return;const h=d[a];return typeof h=="function"?h.bind(d):h},set(l,a,d){const h=o();return h?(h[a]=d,!0):!1}});return[s,r]}const mb=mt,Ab={install:(i,e)=>{if(i.component("LeitingBIM",gn),i.component("LeitingTree",an),i.component("LeitingDraggableCard",Pe),i.component("leiting-draggable-card",Pe),i.component("LeitingMenu",yi),i.component("leiting-menu",yi),i.component("LeitingSection",Ci),i.component("leiting-section",Ci),i.component("LeitingPlayer",Ei),i.component("leiting-player",Ei),i.component("LeitingInfo",wi),i.component("leiting-info",wi),i.component("LeitingPosition",bi),i.component("leiting-position",bi),i.component("LeitingSetting",vi),i.component("leiting-setting",vi),!e)return;const t={...mb,...e};t.cesiumUrl&&En(t).catch(n=>{console.error("[LeitingBim] Failed to load Cesium resources:",n)}),i.config.globalProperties.$leitingBimOptions=t}};_.DEFAULT_CESIUM_CONFIG=mt,_.LeiTingBIM=gn,_.LeiTingDraggableCard=Pe,_.LeiTingInfo=wi,_.LeiTingMenu=yi,_.LeiTingPlayer=Ei,_.LeiTingPosition=bi,_.LeiTingSection=Ci,_.LeiTingSetting=vi,_.LeiTingTree=an,_.LeitingBIM=gn,_.LeitingDraggableCard=Pe,_.LeitingInfo=wi,_.LeitingMenu=yi,_.LeitingPlayer=Ei,_.LeitingPosition=bi,_.LeitingSection=Ci,_.LeitingSetting=vi,_.LeitingTree=an,_.default=Ab,_.getAccessToken=wn,_.leitingBim=gn,_.loadCesium=En,_.useLeiTing=Al,_.useLeiting=Al,_.waitForCesium=Ql,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
98
|
+
`;rn=document.createElement("style"),rn.textContent=i,document.head.appendChild(rn)}function ay(){if(sl)return;ry(),ye=document.createElement("div"),ye.className="tech-alert-wrapper",(Ts||document.body).appendChild(ye);const e={setup(){return()=>be.visible?c.h(ge.Alert,{class:`tech-alert tech-alert-${be.type}`,message:be.title,description:be.description,showIcon:be.showIcon,closable:be.closable,onClose:()=>{be.visible=!1}},{icon:()=>be.type==="loading"?c.h($t.LoadingOutlined):be.type==="success"?c.h($t.CheckCircleOutlined):be.type==="error"?c.h($t.CloseCircleOutlined):be.type==="warning"?c.h($t.ExclamationCircleOutlined):c.h($t.InfoCircleOutlined)}):null}};nl=c.createVNode(e),c.render(nl,ye),sl=!0}function mi(i){ay(),Ss&&clearTimeout(Ss),be.type=i.type||"info",be.title=i.title||"",be.description=i.description||"",be.closable=i.closable??!1,be.showIcon=i.showIcon??!0,be.visible=!0;const e=i.container||Ts;ye&&(e?(ye.parentNode!==e&&e.appendChild(ye),ye.style.position="absolute",ye.style.top="20px",ye.style.left="50%",ye.style.transform="translateX(-50%)"):(ye.parentNode!==document.body&&document.body.appendChild(ye),ye.style.position="fixed",ye.style.top="20px",ye.style.left="50%",ye.style.transform="translateX(-50%)"));const t=i.duration??(be.type==="loading"?0:3);t>0&&(Ss=setTimeout(()=>{be.visible=!1},t*1e3))}const fe={setContainer:i=>{Ts=i,ye&&i&&ye.parentNode!==i&&(i.appendChild(ye),ye.style.position="absolute")},info:(i,e,t,n)=>mi({type:"info",title:i,description:e,duration:t,container:n}),success:(i,e,t,n)=>mi({type:"success",title:i,description:e,duration:t,container:n}),error:(i,e,t,n)=>mi({type:"error",title:i,description:e,duration:t,container:n}),warning:(i,e,t,n)=>mi({type:"warning",title:i,description:e,duration:t,container:n}),loading:(i,e,t)=>mi({type:"loading",title:i,description:e,duration:0,container:t}),close:()=>{be.visible=!1}};class ly{cesium;viewer;events=new Hi;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),t.skyBox&&(t.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}}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.minimumZoomDistance=1,n.maximumZoomDistance=1e6,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);const s=()=>{const o=this.viewer.camera,r=e.Math.EPSILON3,l=0,a=e.Math.toRadians(-90),d=0,h=Math.abs(o.heading-l);((h>Math.PI?Math.abs(h-2*Math.PI):h)>r||Math.abs(o.pitch-a)>r||Math.abs(o.roll-d)>r)&&o.setView({orientation:{heading:l,pitch:o.pitch,roll:d}})};this._removeCameraLockListener=this.viewer.scene.postRender.addEventListener(s),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",l=t?.layerType||"img_w",a=l.split("_"),d=a[0]||"img",h=a[1]||"w";let f="";d==="img"?f="cia":d==="vec"?f="cva":d==="ter"&&(f="cta");const p=f?`${f}_${h}`:"";o.push(new this.cesium.WebMapTileServiceImageryProvider({url:`https://{s}.tianditu.gov.cn/${l}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${d}&STYLE=default&TILEMATRIXSET=${h}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:d,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=${f}&STYLE=default&TILEMATRIXSET=${h}&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk=${r}`,layer:f,style:"default",format:"tiles",tileMatrixSetID:h,maximumLevel:18,subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"]}))}else if(e==="arcgis"){console.log("Switching to ArcGIS...");const r=t?.url||"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";try{if(this.cesium.ArcGisMapServerImageryProvider.fromUrl){const l=this.cesium.ArcGisMapServerImageryProvider.fromUrl(r,{enablePickFeatures:!1}),a=new Promise((h,f)=>setTimeout(()=>f(new Error("ArcGIS metadata request timed out")),3e3)),d=await Promise.race([l,a]);o.push(d)}else o.push(new this.cesium.ArcGisMapServerImageryProvider({url:r,enablePickFeatures:!1}))}catch(l){console.warn("ArcGIS provider failed (or timed out), fallback to XYZ template",l),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"});if(this.lastBaseMapRequestId!==n){console.log("BaseMap switch cancelled due to new request.");return}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,l=t.scene.primitives,a=l.length,d=!!n.CustomShader;for(let h=0;h<a;++h){const f=l.get(h);if(f instanceof n.Cesium3DTileset)if(d)if(f.customShader&&f.customShader.isModelAdjustment)e.brightness!==void 0&&f.customShader.setUniform("u_brightness",s),e.contrast!==void 0&&f.customShader.setUniform("u_contrast",o),e.saturation!==void 0&&f.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:`
|
|
99
|
+
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
|
|
100
|
+
// 1. 亮度 (Brightness) - RGB 乘法
|
|
101
|
+
material.diffuse *= u_brightness;
|
|
102
|
+
|
|
103
|
+
// 2. 对比度 (Contrast) - (Color - 0.5) * Contrast + 0.5
|
|
104
|
+
material.diffuse = (material.diffuse - vec3(0.5)) * u_contrast + vec3(0.5);
|
|
105
|
+
|
|
106
|
+
// 3. 饱和度 (Saturation)
|
|
107
|
+
// 计算灰度值 (Luminance)
|
|
108
|
+
float gray = dot(material.diffuse, vec3(0.2125, 0.7154, 0.0721));
|
|
109
|
+
vec3 grayColor = vec3(gray);
|
|
110
|
+
// 混合灰度与原色
|
|
111
|
+
material.diffuse = mix(grayColor, material.diffuse, u_saturation);
|
|
112
|
+
|
|
113
|
+
// 防止颜色溢出或变为负数 (Clamp to 0.0 - 1.0)
|
|
114
|
+
// material.diffuse = clamp(material.diffuse, 0.0, 1.0);
|
|
115
|
+
// 通常不需要 clamp,除非开启 HDR 后期望超亮,但负值需要避免
|
|
116
|
+
material.diffuse = max(material.diffuse, vec3(0.0));
|
|
117
|
+
}
|
|
118
|
+
`});p.isModelAdjustment=!0,f.customShader=p}else e.brightness!==void 0&&e.brightness!==1&&!f.style&&(f.style=new n.Cesium3DTileStyle({color:`color('white') * ${e.brightness}`}))}}setModelBrightness(e){this.setModelColorAdjustment({brightness:e})}_defaultSkyBox=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;_zoomInertiaListener=null;setHeightBasedZoom(e){const t=this.viewer.scene.screenSpaceCameraController,n=this.cesium;if(this.viewer.camera.frustum.near=1e-5,this.viewer.camera.frustum.far=1e8,e||(this.viewer.camera.frustum.near=.1),this._customZoomHandler&&(this._customZoomHandler.destroy(),this._customZoomHandler=null),this._zoomInertiaListener&&(this._zoomInertiaListener(),this._zoomInertiaListener=null),!e){t.zoomEventTypes.includes(n.CameraEventType.WHEEL)||t.zoomEventTypes.push(n.CameraEventType.WHEEL);return}t.zoomEventTypes=t.zoomEventTypes.filter(l=>l!==n.CameraEventType.WHEEL),this._customZoomHandler=new n.ScreenSpaceEventHandler(this.viewer.scene.canvas);let s=null;this._customZoomHandler.setInputAction(l=>{s=l.endPosition},n.ScreenSpaceEventType.MOUSE_MOVE);let o=0,r=null;this._zoomInertiaListener=this.viewer.scene.preUpdate.addEventListener(()=>{if(Math.abs(o)<.001||!r){o=0;return}const l=this.viewer.camera,a=o*.2;if(s){const h=l.getPickRay(s);if(h){let f=this.viewer.scene.pickPosition(s);if(!f){const p=n.IntersectionTests.rayEllipsoid(h,this.viewer.scene.globe.ellipsoid);p&&(f=n.Ray.getPoint(h,p.start))}if(f){const p=n.Cartesian3.distance(l.position,f);if(a>0&&a>p-.01){if(o=0,p>.01){const u=n.Cartesian3.multiplyByScalar(r,p-.01,new n.Cartesian3);l.position=n.Cartesian3.add(l.position,u,new n.Cartesian3)}return}}}}const d=n.Cartesian3.multiplyByScalar(r,a,new n.Cartesian3);l.position=n.Cartesian3.add(l.position,d,new n.Cartesian3),o-=a}),this._customZoomHandler.setInputAction(l=>{const a=this.viewer.camera,d=a.positionCartographic.height,h=.2;let f=0;const p=Math.sign(l);if(p>0){const u=d-1;f=u>0?u*h:0}else f=d*h;if(f=Math.max(.01,f),d<.2&&p>0){fe.info("无法继续放大");return}if(!s)r=a.direction;else{const u=a.getPickRay(s);if(u){let m=this.viewer.scene.pickPosition(s);if(!m){const w=n.IntersectionTests.rayEllipsoid(u,this.viewer.scene.globe.ellipsoid);w&&(m=n.Ray.getPoint(u,w.start))}if(m){const w=n.Cartesian3.subtract(m,a.position,new n.Cartesian3);r=n.Cartesian3.normalize(w,new n.Cartesian3)}else r=a.direction}else r=a.direction}o+=p>0?f:-f*2},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 cy{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 dy(i){const{container:e,appContext:t,methods:n,viewerOptions:s,options:o,callbacks:r}=i,l=new Hi,a=window.Cesium;if(!a)throw new Error("Cesium is not loaded");e.id=`cesium-container-${np()}`;const d={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}}},h=t?.config?.globalProperties?.$leitingBimOptions,f={...d,...h?.viewerOptions??{},...s??{}},p=new a.Viewer(e,f);p.camera.setView({destination:a.Cartesian3.fromDegrees(108,32,1e7),orientation:{heading:a.Math.toRadians(0),pitch:a.Math.toRadians(-90),roll:0}});let u=n;if(!u&&h&&(h.methods||(h.methods={}),u=h.methods),u){const m=new mp({cesium:a,viewer:p,options:o,callbacks:r}),w=new kr({cesium:a,viewer:p}),A=new ly({cesium:a,viewer:p}),C=new Ap({cesium:a,viewer:p}),v=new cy({cesium:a,viewer:p});let S;const D=new il({cesium:a,viewer:p});o&&(o.globe!==void 0&&A.setGlobeEnvironmentVisible(o.globe),o.terrain!==void 0&&A.setTerrainEnable(o.terrain),o.depthTest!==void 0&&A.setDepthTestEnable(o.depthTest),o.mapProvider&&o.mode!=="2d"&&A.changeBaseMap(o.mapProvider,{token:o.tiandituToken,layerType:o.tiandituLayerType,showAnnotation:o.tiandituShowLabel,url:o.arcgisUrl}),o.shadows!==void 0&&A.setShadowsEnable(o.shadows),o.environmentMap!==void 0&&A.setEnvironmentMapEnable(o.environmentMap),o.ambientOcclusion!==void 0&&A.setAmbientOcclusion(o.ambientOcclusion),o.time!==void 0&&A.setTime(o.time),o.brightness!==void 0&&A.setModelBrightness(o.brightness),o.backgroundColor!==void 0&&A.setBackgroundColor(o.backgroundColor),o.collision!==void 0&&A.setCollisionDetection(o.collision),o.mouseHabit!==void 0&&A.setMouseHabit(o.mouseHabit),o.heightBasedZoom!==void 0&&A.setHeightBasedZoom(o.heightBasedZoom)),o&&o.mode==="2d"&&(console.log("InitMap: Setting CAD Mode 2D"),A.setCadMode("2d"),S=new tl({cesium:a,viewer:p})),w.events.on("tilesetLoaded",g=>{m.baseCompt.attachTileset(g,m.baseCompt.selectedColor),m.baseSection.attachTileset(g,g.leiting?.model?.modelId),u&&u.tilesLoad3dTiles&&u.tilesLoad3dTiles(g),o?.tilesLoad3dTiles&&o.tilesLoad3dTiles(g.leiting)}),w.events.on("loadingStatus",g=>{u&&u.onLoadingStatus&&u.onLoadingStatus(g)}),w.events.on("mountAll3Dtiles",({modelList:g})=>{o?.mountAll3Dtiles&&o.mountAll3Dtiles(g),u?.mountAll3Dtiles&&u.mountAll3Dtiles(g)}),w.events.on("updateModels",({modelList:g})=>{o?.updateModels&&o.updateModels(g),u?.updateModels&&u.updateModels(g)}),C.events.on("mountAllCad",g=>{o?.mountAllCad&&o.mountAllCad(g),u?.mountAllCad&&u.mountAllCad(g)}),m.baseCompt.loadNodeDetailsForModel=g=>w.loadNodeDetailsForModel(g),m.baseCompt.selectionChange(g=>{g.length!==0&&(o?.selectionChange&&o.selectionChange(g),u?.selectionChange&&u.selectionChange(g))}),u.onSearchComponent=g=>{o?.searchComponent&&o.searchComponent(g),u?.searchComponent&&u.searchComponent(g)};const N=u.saveRegion;u.saveRegion=g=>{o?.saveRegion&&o.saveRegion(g),N&&N!==o?.saveRegion&&N(g)};const I=u.saveCadCalibration;u.saveCadCalibration=g=>{o?.saveCadCalibration&&o.saveCadCalibration(g),I&&I!==o?.saveCadCalibration&&I(g)};const B=u.saveCadRegion;u.saveCadRegion=g=>{o?.saveCadRegion&&o.saveCadRegion(g),B&&B!==o?.saveCadRegion&&B(g)},u.getCesium=()=>a,u.getViewer=()=>p,u.getAnnotationInstance=()=>S,u.getMeasureInstance=()=>D,u.flyToCamera=g=>{v.setCameraView(g)},u.flyToLonLatHeight=(g,P,x,k=1)=>{v.flyToLonLatHeight(g,P,x,k)},u.flyTo=u.flyToCamera,u.getCameraState=()=>v.getCameraView(),u.getCameraInfo=u.getCameraState,u.restoreCameraState=g=>v.flyToCameraView(g),u.flyToCameraView=u.restoreCameraState,u.getCameraPositionTarget=()=>v.getCurrentCameraPositionAndTarget(),u.getCurrentCameraPositionAndTarget=u.getCameraPositionTarget,u.setCameraLookAt=g=>v.setCameraView(g),u.setCameraView=u.setCameraLookAt,u.setCanvasBackground=g=>A.setBackgroundColor(g),u.setBackgroundColor=u.setCanvasBackground,u.setAntiAliasing=g=>m.enableCesiumFXAA(g),u.enableCesiumFXAA=u.setAntiAliasing,u.setSceneVisibility=g=>m.setSceneOptions(g),u.setSceneOptions=u.setSceneVisibility,u.addDebugPoint=(g,P,x=0)=>{p.entities.add({position:a.Cartesian3.fromDegrees(g,P,x),point:{pixelSize:10,color:a.Color.RED}})},u.addPoint=u.addDebugPoint,u.toggleDebugLabels=()=>m.enableTestLabel(),u.enableTestLabel=u.toggleDebugLabels,u.captureScreenshot=()=>{const g=p.scene.canvas;return p.render(),g.toDataURL("image/png")},u.getImageBase64=u.captureScreenshot,u.captureDomScreenshot=(g,P)=>m.getSnapDomSImageBase64(g,P),u.getSnapDomSImageBase64=u.captureDomScreenshot,u.addModels=g=>w.addModels(g),u.add3DtilesModel=u.addModels,u.addObliquePhotography=g=>w.addOSGB(g),u.addOSGB=u.addObliquePhotography,u.adjustOSGBModelMatrix=g=>w.updateOSGBMatrix(g),u.updateOSGBMatrix=u.adjustOSGBModelMatrix,u.setModelVisibility=g=>w.showModels(g),u.showModels=u.setModelVisibility,u.showTileset=u.setModelVisibility,u.removeModels=g=>w.deleteModels(g),u.deleteModels=u.removeModels,u.clearAllModels=()=>{w.deleteAllModels(),l.emit("deleteAllModels")},u.deleteAllModelList=u.clearAllModels,u.deleteAllModels=u.clearAllModels,u.flyToModel=g=>w.flyToTileset(g),u.flyToTileset=u.flyToModel,u.flyToByModelId=u.flyToModel,u.setModelBrightness=g=>m.updateModelEffect(g),u.updateModelEffect=u.setModelBrightness,u.getAllTilesets=()=>w.getMapTileset(),u.getMapTileset=u.getAllTilesets,u.getCurrentModelId=()=>w.getBIMmodelId(),u.getBIMmodelId=u.getCurrentModelId,u.getLoadedModels=()=>w.getModelList(),u.getModelList=u.getLoadedModels,u.loadModelStructure=async g=>{const P=typeof g=="string"?g:g?.modelId;if(!P){console.warn("loadModelStructure: modelId is required");return}return await w.loadTreeForModel(P)},u.loadTreeForModel=u.loadModelStructure,u.loadModelDetails=async g=>{const P=typeof g=="string"?g:g?.modelId;if(!P){console.warn("loadModelDetails: modelId is required");return}return await w.loadNodeDetailsForModel(P)},u.loadNodeDetailsForModel=u.loadModelDetails,u._loadNodeDetailsForModel=async g=>{const P=typeof g=="string"?g:g?.modelId;if(!P){console.warn("loadModelDetails: modelId is required");return}return await w._loadNodeDetailsForModel(P)},u.setMapTileset=g=>w.setMapTileset(g),u.setCurrentModelId=g=>w.setBIMmodelId(g),u.setBIMmodelId=u.setCurrentModelId,u.setModelList=g=>w.setModelList(g),u.highlightComponents=(g,P={})=>m.baseCompt.setSelectColorUserModelCpt(g,P),u.setSelectColorUserModelCpt=u.highlightComponents,m.baseCompt.setLoadNodeDetailsCallback(g=>w.loadNodeDetailsForModel(g)),u.highlightAllComponents=(g,P)=>m.baseCompt.setAllSelectColorUserModelCpt(g,P),u.setAllSelectColorUserModelCpt=u.highlightAllComponents,u.setSelectColorUserModelCptByClear=(g,P)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(g.selectCpts,P??{rank:0})},u.clearSelectColorUserModelCpt=()=>m.baseCompt.clearAllHaveSelected(),u.selectComponents=(g,P)=>{m.baseCompt.clearAllHaveSelected(),m.baseCompt.setSelectColorUserModelCpt(g,P??{rank:0})},u.setSelecteds=u.selectComponents,u.setSelectionColor=(g,P,x,k)=>m.baseCompt.setSelectedColorRgba(g,P,x,k),u.setSelectedColor=u.setSelectionColor,u.clearSelection=()=>m.baseCompt.clearAllHaveSelected(),u.clearAllHaveSelected=u.clearSelection,u.getSelectedComponents=g=>m.baseCompt.getSelected(g),u.getSelected=u.getSelectedComponents,u.onSelectionChange=g=>{m.baseCompt.selectionChange(g)},u.selectionChange=u.onSelectionChange,u.flyToComponents=g=>m.baseCompt.flyToObjects(g),u.flyToObjects=u.flyToComponents,u.setConstructionData=async g=>{if(g&&Array.isArray(g)){const P=new Set;g.forEach(x=>{x.mergeCpts&&Array.isArray(x.mergeCpts)&&x.mergeCpts.forEach(k=>{k.modelId&&P.add(k.modelId)})}),P.size>0&&await Promise.all(Array.from(P).map(x=>u.loadNodeDetailsForModel(x)))}m.baseCompt.setAllConstructionProgressTracking(g)},u.setAllConstructionProgressTracking=u.setConstructionData,u.startConstructionSimulation=()=>m.baseCompt.enableConstructionProgressTracking(),u.enableAllConstructionProgressTracking=u.startConstructionSimulation,u.stopConstructionSimulation=()=>m.baseCompt.disableConstructionProgressTracking(),u.disableConstructionProgressTracking=u.stopConstructionSimulation,u.disableAllConstructionProgressTracking=u.stopConstructionSimulation,u.resetConstructionSimulation=()=>m.baseCompt.freshConstructionProgressTracking(),u.freshConstructionProgressTracking=u.resetConstructionSimulation,u.restartConstructionSimulation=()=>m.baseCompt.reStartAnimation(),u.reStartAnimation=u.restartConstructionSimulation,u.resumeFlyTo=()=>m.baseCompt.resumeFlyTo(),u.pauseConstructionSimulation=()=>m.baseCompt.pauseFlyTo(),u.pauseFlyTo=u.pauseConstructionSimulation,u.pauseAnimation=u.pauseConstructionSimulation,u.resumeConstructionSimulation=()=>m.baseCompt.resumeFlyTo(),u.resumeAnimation=u.resumeConstructionSimulation,u.setComponentsVisibility=async g=>await m.baseCompt.setComponentVisibility(g),u.setElementsListVisible=u.setComponentsVisibility,u.setAllComponentsVisibility=async g=>await m.baseCompt.setAllComponentsVisibility(g),u.setAllElementsVisible=u.setAllComponentsVisibility,u.isolateComponents=g=>m.baseCompt.isolateComponentVisibility(g),u.isolateComponentVisibility=u.isolateComponents,u.getComponentsByVisibility=g=>m.baseCompt._getComponentsByVisibility(g),u.getShowCpts=g=>m.baseCompt.getComponentsByVisibility(g),u.getElementsVisible=g=>m.baseCompt.getComponentsByVisibility(g),u.setComponentVisibility=u.setComponentsVisibility,u.enableSectioning=(g,P)=>m.baseSection.open(g,P),u.openSection=u.enableSectioning,u.disableSectioning=g=>m.baseSection.close(g),u.closeSection=u.disableSectioning,u.updateSectionBox=g=>m.baseSection.updateRange(g),u.updateSectionRange=u.updateSectionBox,u.getSectionBox=()=>m.baseSection.getRange(),u.getSectionRange=u.getSectionBox,u.fitSectionToModel=()=>m.baseSection.fitToModels(),u.fitToModels=u.fitSectionToModel,u.setSectionBoxVisibility=g=>m.baseSection.setBoxVisibility(g),u.startFirstPersonMode=()=>{m.baseCompt.disableSelection(),m.basePlayer.openPlayer()},u.openPlayer=u.startFirstPersonMode,u.stopFirstPersonMode=()=>{m.basePlayer.closePlayer(),m.baseCompt.enableSelection()},u.closePlayer=u.stopFirstPersonMode,u.setPlayerPosition=g=>m.basePlayer.setPersonPosition(g),u.setPersonPosition=u.setPlayerPosition,u.setWalkSpeed=g=>m.basePlayer.setSpeed({speed:g}),u.setPlayerSpeed=u.setWalkSpeed,u.setPlayerConfig=g=>m.basePlayer.setParams(g),u.setPlayerParams=u.setPlayerConfig,u.setPlayerAction=(g,P)=>m.basePlayer.setMoveState(g,P),u.setPlayerMoveState=u.setPlayerAction,u.bindPlayerControls=g=>m.basePlayer.bindUiKeys(g),u.bindPlayerUiKeys=u.bindPlayerControls,u.setGlobeVisibility=g=>A.setGlobeEnvironmentVisible(g),u.setGlobeEnvironmentVisible=u.setGlobeVisibility,u.setTerrainVisibility=g=>A.setTerrainEnable(g),u.setTerrainEnable=u.setTerrainVisibility,u.setDepthTest=g=>A.setDepthTestEnable(g),u.setDepthTestEnable=u.setDepthTest,u.setBaseMap=(g,P)=>A.changeBaseMap(g,P),u.changeBaseMap=u.setBaseMap,u.setWorldTime=g=>A.setTime(g),u.setTime=u.setWorldTime,u.setGisOptions=g=>{g.globe!==void 0&&A.setGlobeEnvironmentVisible(g.globe),g.elevation!==void 0&&A.setTerrainEnable(g.elevation),g.depthTestAgainstTerrain!==void 0&&A.setDepthTestEnable(g.depthTestAgainstTerrain),g.rendering!==void 0&&A.setAmbientOcclusion(g.rendering)},u.setShadowVisibility=g=>A.setShadowsEnable(g),u.setShadowsEnable=u.setShadowVisibility,u.setEnvironmentMapVisibility=g=>A.setEnvironmentMapEnable(g),u.setEnvironmentMapEnable=u.setEnvironmentMapVisibility,u.setAOVisibility=g=>A.setAmbientOcclusion(g),u.setAmbientOcclusion=u.setAOVisibility,u.setBackgroundColor=g=>A.setGlobeColor(g),u.setGlobeColor=u.setBackgroundColor,u.setModelBrightness=g=>A.setModelBrightness(g),u.adjustModelColor=g=>A.setModelColorAdjustment(g),u.setModelColorAdjustment=u.adjustModelColor,u.setShadowIntensity=g=>{A.setShadowDarkness?A.setShadowDarkness(g):console.warn("baseSetting.setShadowDarkness is not available. Please reload the page.")},u.setShadowDarkness=u.setShadowIntensity,u.switchSceneMode=async g=>{const P=g?"2d":"3d";await A.setCadMode(P),g&&!S&&(S=new tl({cesium:a,viewer:p}),u.setGlobeVisibility(!0)),l.emit("setMode",P)},u.setSceneMode=u.switchSceneMode,u.set2d=g=>u.switchSceneMode(g),u.is2dMode=()=>A.is2d,u.setMouseControlMode=g=>A.setMouseHabit(g),u.setMouseHabit=u.setMouseControlMode,u.setCollisionEnabled=g=>A.setCollisionDetection(g),u.setCollisionDetection=u.setCollisionEnabled,u.searchAndLocate=(g,P)=>A.searchLocation(g,P),u.searchLocation=u.searchAndLocate,u.getConfigure=()=>(console.warn("getConfigure is not initialized. Please ensure LeitingSetting component is mounted."),{}),u.setConfigure=g=>{console.warn("setConfigure is not initialized. Please ensure LeitingSetting component is mounted.",g)},u.addCadModel=g=>{const P={...g};return P.files&&!P.fileNames&&(P.fileNames=P.files),P.fileNames||(P.fileNames=[]),C.addDxfModel(P)},u.addDxfModel=u.addCadModel,u.deleteCad=g=>C.deleteCad(g),u.deleteAllCad=()=>C.deleteAllCad(),u.showCadModel=g=>C.showJson(g),u.showGeoJson=g=>C.showJson(g),u.showDxfModel=u.showCadModel,u.showCadLayer=g=>C.showJsonByLayer(g),u.showDxfLayer=u.showCadLayer,u.flyToCadModel=(g={})=>C.flyToCadModel(g),u.getCadModels=g=>C.getDxfModels(g),u.getDxfModels=u.getCadModels,u.getCadLayers=g=>C.getMapLayers(g),u.getDxfLayers=u.getCadLayers,u.getCadModelId=()=>C.getModelId(),u.setCadOpen=g=>C.setDxfOpen(g),u.setDxfOpen=u.setCadOpen,u.getCadOpen=()=>C.getDxfOpen(),u.getDxfOpen=u.getCadOpen,u.adjustCadModel=g=>C.adjustingModelByCad(g),u.adjustingModelByCad=u.adjustCadModel,u.saveAnnotations=()=>{let g=null;return S&&(g=S.saveAnnotations()),o?.saveAnnotations&&o.saveAnnotations(g),g},u.loadAnnotations=g=>S?S.loadAnnotations(g):!1,u.flyToTopView=()=>{C.flyToCadModel()},u.menuEvents=l,u.addMenuItems=g=>{l.emit("insertMenu",g)},u.insertMenu=u.addMenuItems,u.filterMenuItems=g=>{l.emit("setMenuListFilter",g)},u.setMenuListFilter=u.filterMenuItems,u.setMenuVisibility=g=>{l.emit("showMenu",g)},u.showMenu=u.setMenuVisibility,u.setPanelVisibility=(g,P)=>{l.emit("setMenuActive",g,P)},u.setMenuActive=u.setPanelVisibility,u.addContextMenuItems=g=>{console.warn("addContextMenuItems is not initialized yet. Please wait for LeitingBIM component to mount.",g)},u.insertContextMenu=u.addContextMenuItems,u.removeContextMenuItems=g=>{console.warn("removeContextMenuItems is not initialized yet.",g)},u.deleteContextMenu=u.removeContextMenuItems,u.closeContextMenu=()=>{console.warn("closeContextMenu is not initialized yet.")},u.hideContextMenu=u.closeContextMenu,u.getModelTree=()=>{const g=[],P=w.getMapTileset();return Object.keys(P).forEach(x=>{const k=P[x];if(k&&k.leiting&&k.leiting.tree){const _=k.leiting.tree;Array.isArray(_)?g.push(..._):g.push(_)}}),g},u.getTree=u.getModelTree,u.getAllComponentDetails=()=>{const g=w.getMapTileset(),P={},x=[];try{Object.keys(g).forEach(k=>{const _=g[k];if(!_||!_.leiting)return;const G=_.leiting,F=G.node,E=G.model.formData,y=G.box;if(!F||!F.nodeExtras)return;const b=G.model.modelId;P[b]=F.nodeExtras;const T=F.nodeExtras.element;if(!T)return;const R=y?y.center:{x:0,y:0,z:0};Object.values(T).forEach(O=>{if(O.box3)try{const L=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(E.totalRotation||0)),M=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(L),new a.Cartesian3(0,0,0)),Q=a.Cartesian3.fromDegrees(E.longitude,E.latitude,E.height),Y=a.Transforms.eastNorthUpToFixedFrame(Q);a.Matrix4.multiply(Y,M,Y);const W=new a.Cartesian3(R.x,R.y,0),q=new a.Cartesian3;a.Matrix4.multiplyByPoint(Y,W,q);const Z=a.Cartographic.fromCartesian(q),oe=O.box3?.Center?.x||0,ne=O.box3?.Center?.y||0,se=O.box3?.Center?.z||0,pe=new a.Cartesian3(-R.x+oe,-R.y+ne,0+se),ve=a.Matrix4.fromTranslation(pe),V=a.Matrix4.clone(ve);a.Matrix4.multiply(M,V,V);const j=a.Cartesian3.fromDegrees(Z.longitude/Math.PI*180,Z.latitude/Math.PI*180,E.height),te=a.Transforms.eastNorthUpToFixedFrame(j);a.Matrix4.multiply(te,V,te);const Ae=a.Cartographic.fromCartesian(new a.Cartesian3(te[12],te[13],te[14]));O.box3.cartographic={longitude:Ae.longitude/Math.PI*180,latitude:Ae.latitude/Math.PI*180,height:Ae.height};const Ce={id:O.uniqueId,billboard:[{theme:"Tag9999",position:[O.box3.cartographic.longitude,O.box3.cartographic.latitude,O.box3.cartographic.height],options:{text:O.name}}]};x.push(Ce)}catch(L){console.warn("Error calculating component position:",L)}})})}catch(k){console.error("getAllComponents error:",k)}return P},u.getAllComponents=u.getAllComponentDetails,u.getComponentInfoList=async g=>{if(!Array.isArray(g))return[];const P=w.getMapTileset(),x=[],k=[],_={};if(g.forEach(F=>{const y=P[F.modelId]?.leiting?.model?.dbName;y&&F.elementId&&k.push({dbName:y,elementId:F.elementId,modelId:F.modelId})}),k.length>0)try{const F=k.map(b=>({dbName:b.dbName,elementId:b.elementId})),E=await Dr(F),y=Array.isArray(E)?E:E?.data;Array.isArray(y)&&y.forEach(b=>{if(b){const T=`${b.modelId}_${b.elementId}`;_[T]=b}})}catch(F){console.warn("API fetch component details failed, falling back to local data",F)}const G=new Set;if(g.forEach(F=>{const E=P[F.modelId],y=`${F.modelId}_${F.elementId}`;_[y]||E&&E.leiting&&!E.leiting?.node?.nodeExtras&&E.leiting.model?.nodeUrl&&G.add(F.modelId)}),G.size>0&&w._loadNodeDetailsForModel)try{const F=Array.from(G).map(E=>w._loadNodeDetailsForModel(E));await Promise.all(F)}catch(F){console.error("Failed to load node details in getComponentInfoList",F)}try{g.forEach(F=>{const E=F.modelId,y=F.elementId,b=P[E];if(!b||!b.leiting)return;const T=`${E}_${y}`,R=_[T];let O=null;if(R)O=R;else{const L=b.leiting.node?.nodeExtras?.element||b.leiting.node?.nodeExtras;L&&L[y]&&(O=JSON.parse(JSON.stringify(L[y])))}if(O){if(O.elementId=y,O.modelId=E,O.box3&&!O.box3.cartographic)try{const L=b.leiting,M=L.model.formData,Q=L.box,Y=Q?Q.center:{x:0,y:0,z:0},W=a.Quaternion.fromAxisAngle(a.Cartesian3.UNIT_Z,a.Math.toRadians(M.totalRotation||0)),q=a.Matrix4.fromRotationTranslation(a.Matrix3.fromQuaternion(W),new a.Cartesian3(0,0,0)),Z=a.Cartesian3.fromDegrees(M.longitude,M.latitude,M.height),oe=a.Transforms.eastNorthUpToFixedFrame(Z);a.Matrix4.multiply(oe,q,oe);const ne=new a.Cartesian3(Y.x,Y.y,0),se=new a.Cartesian3;a.Matrix4.multiplyByPoint(oe,ne,se);const pe=a.Cartographic.fromCartesian(se),ve=O.box3?.Center?.x||0,V=O.box3?.Center?.y||0,j=O.box3?.Center?.z||0,te=new a.Cartesian3(-Y.x+ve,-Y.y+V,0+j),Ae=a.Matrix4.fromTranslation(te),Ce=a.Matrix4.clone(Ae);a.Matrix4.multiply(q,Ce,Ce);const Me=a.Cartesian3.fromDegrees(pe.longitude/Math.PI*180,pe.latitude/Math.PI*180,M.height),Le=a.Transforms.eastNorthUpToFixedFrame(Me);a.Matrix4.multiply(Le,Ce,Le);const Ne=a.Cartographic.fromCartesian(new a.Cartesian3(Le[12],Le[13],Le[14]));O.box3.cartographic={longitude:Ne.longitude/Math.PI*180,latitude:Ne.latitude/Math.PI*180,height:Ne.height}}catch(L){console.warn("Error calculating component position:",L)}x.push(O)}})}catch(F){console.error("getComponentInfoList processing error:",F)}return x},u.getCptInfos=u.getComponentInfoList,u.baseCompt=m.baseCompt,u.setTeleportTarget=g=>{u.onSetTeleportTarget&&u.onSetTeleportTarget(g)},window.Methods=u}return console.log("methods",u),{Cesium:a,viewer:p,methods:u,menuEvents:l}}function Ms(i){return c.getCurrentScope()?(c.onScopeDispose(i),!0):!1}function Ds(i){return typeof i=="function"?i():c.unref(i)}const hy=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const uy=Object.prototype.toString,fy=i=>uy.call(i)==="[object Object]",py=()=>{};function gy(i){return c.getCurrentInstance()}function ol(i,e=!0,t){gy()?c.onMounted(i,t):e?i():c.nextTick(i)}function Tt(i){var e;const t=Ds(i);return(e=t?.$el)!=null?e:t}const Ai=hy?window:void 0;function my(...i){let e,t,n,s;if(typeof i[0]=="string"||Array.isArray(i[0])?([t,n,s]=i,e=Ai):[e,t,n,s]=i,!e)return py;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},l=(h,f,p,u)=>(h.addEventListener(f,p,u),()=>h.removeEventListener(f,p,u)),a=c.watch(()=>[Tt(e),Ds(s)],([h,f])=>{if(r(),!h)return;const p=fy(f)?{...f}:f;o.push(...t.flatMap(u=>n.map(m=>l(h,u,m,p))))},{immediate:!0,flush:"post"}),d=()=>{a(),r()};return Ms(d),d}function Ay(){const i=c.ref(!1),e=c.getCurrentInstance();return e&&c.onMounted(()=>{i.value=!0},e),i}function rl(i){const e=Ay();return c.computed(()=>(e.value,!!i()))}function yy(i,e={}){const{window:t=Ai}=e,n=rl(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const o=c.ref(!1),r=d=>{o.value=d.matches},l=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",r):s.removeListener(r))},a=c.watchEffect(()=>{n.value&&(l(),s=t.matchMedia(Ds(i)),"addEventListener"in s?s.addEventListener("change",r):s.addListener(r),o.value=s.matches)});return Ms(()=>{a(),l(),s=void 0}),o}function Cy(i,e,t={}){const{window:n=Ai,...s}=t;let o;const r=rl(()=>n&&"ResizeObserver"in n),l=()=>{o&&(o.disconnect(),o=void 0)},a=c.computed(()=>Array.isArray(i)?i.map(f=>Tt(f)):[Tt(i)]),d=c.watch(a,f=>{if(l(),r.value&&n){o=new ResizeObserver(e);for(const p of f)p&&o.observe(p,s)}},{immediate:!0,flush:"post"}),h=()=>{l(),d()};return Ms(h),{isSupported:r,stop:h}}function Ey(i,e={width:0,height:0},t={}){const{window:n=Ai,box:s="content-box"}=t,o=c.computed(()=>{var f,p;return(p=(f=Tt(i))==null?void 0:f.namespaceURI)==null?void 0:p.includes("svg")}),r=c.ref(e.width),l=c.ref(e.height),{stop:a}=Cy(i,([f])=>{const p=s==="border-box"?f.borderBoxSize:s==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(n&&o.value){const u=Tt(i);if(u){const m=u.getBoundingClientRect();r.value=m.width,l.value=m.height}}else if(p){const u=Array.isArray(p)?p:[p];r.value=u.reduce((m,{inlineSize:w})=>m+w,0),l.value=u.reduce((m,{blockSize:w})=>m+w,0)}else r.value=f.contentRect.width,l.value=f.contentRect.height},t);ol(()=>{const f=Tt(i);f&&(r.value="offsetWidth"in f?f.offsetWidth:e.width,l.value="offsetHeight"in f?f.offsetHeight:e.height)});const d=c.watch(()=>Tt(i),f=>{r.value=f?e.width:0,l.value=f?e.height:0});function h(){a(),d()}return{width:r,height:l,stop:h}}function wy(i={}){const{window:e=Ai,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:o=!0}=i,r=c.ref(t),l=c.ref(n),a=()=>{e&&(o?(r.value=e.innerWidth,l.value=e.innerHeight):(r.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight))};if(a(),ol(a),my("resize",a,{passive:!0}),s){const d=yy("(orientation: portrait)");c.watch(d,()=>a())}return{width:r,height:l}}const by={class:"title"},vy={class:"actions"},Iy={class:"card-body"},By=c.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=c.inject("leiting-theme",c.ref("dark")),s=e,o=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:D=>{s("update:visible",D),s("update:open",D)}}),r=c.ref(null),l=c.ref(t.initialPosition?.x||0),a=c.ref(t.initialPosition?.y||0),d=c.ref(t.width),h=c.ref(t.fullHeight?"100%":"600px");c.watch(()=>t.fullHeight,D=>{D?h.value="100%":h.value==="100%"&&(h.value="600px")});const{height:f}=wy();c.watch(f,()=>{t.fullHeight&&(h.value="100%")});const p=c.ref(!1),u=D=>{p.value=!0,D.preventDefault(),D.stopPropagation();const N=D.clientX,I=D.clientY,B=typeof d.value=="number"?d.value:r.value?.offsetWidth||0,g=typeof h.value=="number"?h.value:r.value?.offsetHeight||0,P=k=>{if(!p.value)return;k.preventDefault();const _=k.clientX-N,G=k.clientY-I,F=B+_,E=g+G;F>100&&(d.value=F),E>100&&(h.value=E)},x=()=>{p.value=!1,document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",P),document.addEventListener("mouseup",x)},m=c.computed(()=>({left:`${l.value}px`,top:`${a.value}px`,width:typeof d.value=="number"?`${d.value}px`:d.value,height:typeof h.value=="number"?`${h.value}px`:h.value,position:"absolute",zIndex:2e3})),w=()=>{c.nextTick(()=>{if(r.value){const D=r.value.offsetParent||document.body,N=D.clientWidth,I=D.clientHeight,B=typeof d.value=="number"?d.value:r.value.offsetWidth||350,g=typeof h.value=="number"?h.value:r.value.offsetHeight||600;l.value+B>N&&(l.value=Math.max(0,N-B-20)),a.value+g>I&&(a.value=Math.max(0,I-g-20)),l.value<0&&(l.value=0),a.value<0&&(a.value=0)}})},A=c.ref(!1),C=D=>{if(D.target.closest(".close-btn")||D.target.closest(".actions"))return;A.value=!0,D.preventDefault(),D.stopPropagation();const N=D.clientX,I=D.clientY,B=l.value,g=a.value,P=k=>{if(!A.value)return;k.preventDefault();const _=k.clientX-N,G=k.clientY-I;l.value=B+_,a.value=g+G},x=()=>{A.value=!1,document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",x),w()};document.addEventListener("mousemove",P),document.addEventListener("mouseup",x)},v=()=>{c.nextTick(()=>{if(t.align&&r.value){const D=r.value.offsetParent||document.body,N=typeof d.value=="number"?d.value:r.value.offsetWidth||350;t.align==="right"?l.value=Math.max(0,D.clientWidth-N-20):t.align==="center"&&(l.value=Math.max(0,(D.clientWidth-N)/2))}w()})};c.onMounted(()=>{t.align?v():w()}),c.watch(o,D=>{D&&(t.align?v():w())});const S=()=>{o.value=!1,s("close")};return(D,N)=>c.withDirectives((c.openBlock(),c.createElementBlock("div",{ref_key:"cardRef",ref:r,class:c.normalizeClass(["draggable-card leiting-scroll",["leiting-theme-"+c.unref(n)]]),style:c.normalizeStyle(m.value)},[c.createElementVNode("div",{ref:"headerRef",class:"card-header",onMousedown:C},[c.createElementVNode("span",by,c.toDisplayString(i.title),1),c.createElementVNode("div",vy,[c.renderSlot(D.$slots,"header-extra",{},void 0,!0),c.createElementVNode("span",{class:"close-btn",onClick:S},"×")])],544),c.createElementVNode("div",Iy,[c.renderSlot(D.$slots,"default",{},void 0,!0)]),c.createElementVNode("div",{class:"resize-handle",onMousedown:u},[...N[0]||(N[0]=[c.createElementVNode("svg",{viewBox:"0 0 10 10",width:"10",height:"10",fill:"currentColor"},[c.createElementVNode("path",{d:"M10 10 L10 2 L2 10 Z"})],-1)])],32)],6)),[[c.vShow,o.value]])}}),Oe=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},Pe=Oe(By,[["__scopeId","data-v-50bf6126"]]);function xy(i){const e=c.ref([]),t=c.ref([]),n=c.ref([]),s=c.ref(""),o=c.ref(!0);c.watch(()=>c.unref(i),f=>{if(!f||f.length===0)return;const p=[],u=(A,C)=>{A.forEach(v=>{const S=v.id||v.key||v.$id,D=v.modelId||C;D&&(v.modelId=D),S&&p.push(S),v.children&&v.children.length>0&&u(v.children,D)})};u(f);const m=new Set(n.value);let w=!1;p.forEach(A=>{m.has(A)||(m.add(A),w=!0)}),w&&(n.value=Array.from(m))},{immediate:!0,deep:!0});const r=c.computed(()=>{const f=c.unref(i);if(!f)return[];const p=[],u=(m,w)=>{m.forEach(A=>{const C=A.id||A.key||A.$id,v=A.name||A.title;p.push({key:C,title:v,parentKey:w}),A.children&&A.children.length>0&&u(A.children,C)})};return u(f),p}),l=f=>{e.value=f,o.value=!1},a=f=>{n.value=f},d=f=>{t.value=f},h=f=>r.value.find(u=>u.key===f)?.parentKey;return c.watch(s,f=>{if(!f)return;const u=r.value.filter(w=>w.title&&w.title.toLowerCase().includes(f.toLowerCase())).map(w=>w.parentKey),m=new Set;u.forEach(w=>{let A=w;for(;A;)m.add(A),A=h(A)}),e.value=[...m],o.value=!0}),{expandedKeys:e,selectedKeys:t,checkedKeys:n,searchValue:s,autoExpandParent:o,onExpand:l,onCheck:a,onSelect:d}}const Sy={class:"search-box"},Ty={key:0},My={style:{color:"#f50"}},Dy={key:1},ky={key:1,class:"empty-tip"},an=Oe(c.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=ge.Input.Search,n=ge.Tree,s=i,o=e,r=c.inject("leiting-theme",c.ref("dark")),l=c.inject("leitingMethods"),a=x=>{l?.value?.onSearchComponent&&l.value.onSearchComponent(x)},d=c.computed({get:()=>s.open!==void 0?s.open:s.visible,set:x=>{o("update:visible",x),o("update:open",x)}}),h=c.ref(null),{height:f}=Ey(h),p=c.computed(()=>f.value||300),u=c.ref({children:"children",title:"name",key:"id"}),m=c.ref([]),{expandedKeys:w,selectedKeys:A,checkedKeys:C,searchValue:v,autoExpandParent:S}=xy(c.toRef(s,"treeData")),D=(x,k)=>{if(!k)return x;const _=k.toLowerCase();return x.reduce((G,F)=>{const y=(F.name||F.title||"").toLowerCase().includes(_);if(F.children&&F.children.length>0){const b=D(F.children,k);(b.length>0||y)&&G.push({...F,children:b})}else y&&G.push({...F});return G},[])};c.watch([()=>s.treeData,v],([x,k])=>{x?m.value=D(x,k||""):m.value=[]},{immediate:!0,deep:!0});const N=x=>{w.value=x,S.value=!1},I=x=>{const k=[],_=G=>{if(!G.children||G.children.length===0){const E=G.element_Id;G.modelId&&E&&k.push({modelId:G.modelId,elementId:E})}else G.children.forEach(_)};return _(x),k},B=(x,k)=>{C.value=x,o("check",x,k);const _=[],G=new Set(x.map(E=>String(E))),F=E=>{for(let y=0;y<E.length;y++){const b=E[y];if(!b.children||b.children.length===0){if(!G.has(String(b.id))){const O=b.element_Id;b.modelId&&O&&_.push({modelId:b.modelId,elementId:O,show:!1})}}else b.children&&F(b.children)}};s.treeData&&F(s.treeData),l?.value?.setComponentVisibility&&l.value.setComponentVisibility(_),l?.value?.onTreeCheck&&l.value.onTreeCheck(x,k)},g=(x,k)=>{if(A.value=x,o("select",x,k),k.selected){const _=I(k.node);_.length>0&&l?.value?.flyToObjects&&l.value.flyToObjects({selectCpts:_})}l?.value?.onTreeSelect&&l.value.onTreeSelect(x,k)},P=()=>{o("update:visible",!1),o("close")};return(x,k)=>(c.openBlock(),c.createBlock(Pe,{visible:d.value,"onUpdate:visible":k[1]||(k[1]=_=>d.value=_),title:i.title,"initial-position":i.initialPosition,"full-height":i.fullHeight,onClose:P},{default:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["leiting-tree-container",[`theme-${c.unref(r)}`]])},[c.createElementVNode("div",Sy,[c.createVNode(c.unref(t),{value:c.unref(v),"onUpdate:value":k[0]||(k[0]=_=>c.isRef(v)?v.value=_:null),placeholder:"搜索构件","allow-clear":"","enter-button":"",onSearch:a},null,8,["value"])]),c.createElementVNode("div",{class:"tree-wrapper",ref_key:"treeWrapperRef",ref:h},[m.value&&m.value.length?(c.openBlock(),c.createBlock(c.unref(n),{key:0,"tree-data":m.value,"field-names":u.value,height:p.value,"expanded-keys":c.unref(w),"auto-expand-parent":c.unref(S),"selected-keys":c.unref(A),"checked-keys":c.unref(C),checkable:"","block-node":"",onExpand:N,onSelect:g,onCheck:B},{title:c.withCtx(({name:_,title:G})=>[(_||G)&&c.unref(v)&&(_||G).toLowerCase().indexOf(c.unref(v).toLowerCase())>-1?(c.openBlock(),c.createElementBlock("span",Ty,[c.createTextVNode(c.toDisplayString((_||G).substr(0,(_||G).toLowerCase().indexOf(c.unref(v).toLowerCase())))+" ",1),c.createElementVNode("span",My,c.toDisplayString(c.unref(v)),1),c.createTextVNode(" "+c.toDisplayString((_||G).substr((_||G).toLowerCase().indexOf(c.unref(v).toLowerCase())+c.unref(v).length)),1)])):(c.openBlock(),c.createElementBlock("span",Dy,c.toDisplayString(_||G),1))]),_:1},8,["tree-data","field-names","height","expanded-keys","auto-expand-parent","selected-keys","checked-keys"])):(c.openBlock(),c.createElementBlock("div",ky,"暂无数据"))],512)],2)]),_:1},8,["visible","title","initial-position","full-height"]))}}),[["__scopeId","data-v-3748c20d"]]),Py="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXN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c/aYxGff6h3AYY6Nvzk2GQ1WQTVj4BST70jYaqceXAAAAAElFTkSuQmCC",Oy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgBvVOBEYIwDEw9B2ADO4IjuIEjwAa6Aa7ABMAEuIIjOIFsUDao37vgxVZbBI+/+0tI0+fJBaIIrLUFaMAHmNNcsMAIE+vdJLQykQ+0wFHBrsyiT/sL2I1DDTac/+4Klzobov7WHxt29qGmaYaQnlhLCmUTa2l4C2ljvamFlEvY0xpCW/kA924GblfGWciZaJyXQvSmlOoDITSdXQBbcA8eKfy/nHDFeY470FIX8tzUIu84FmLWuTzz7yhRLPm54dKJ4+A5uoJ3HgHBUfUmxGIa4QDuKA4n3kLk9ZInw0qu5b1R1aYAAAAASUVORK5CYII=",Ly="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADFSURBVDhPxVPBDYMwDIwnKJu0G9ANYJMyQrsBbNIRGAE2gEnSO6mpIMJxkBC1lEds52zfOeK9b51zV5wte4lIr8RWbgGQh2fGmaIHJe4EetKPtDpRcA5AvwcB7FtgCcTOH0p3YzaQNd75QBiVXJG3LRtCRyQ6Jvsekd3gTsJVoDcihZLQQjXGTRMzIzPhOCCQyNYvSuEue7Qdm02yK0u1nM2m/FQyKb8JZHH+l81Ofdpdm82tvikjThyNlbSEBvIPFj+MfwA76qSYUG3g9QAAAABJRU5ErkJggg==",Ny="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEcSURBVDhPrZSNDYIwEIXpBOIGjMAIOIE4AbgBGwAbOIJu4Aa4gW4gI+gE9b3mjjSmibSR5ALX3H33W4y1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R0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACDSURBVHgB1ZFhDYAgEIWfzgBGIIINpIEViGAkG2gEbWADjWADfMw/iDgUfji/7e3gxt3uHsDXZFrrlrFBHJNpsPAgEEmORArn3lFroEZQCjcTbAhzepPsgbuCgn8FBWvsUAMfFR5OIPGS5G80JkrG2sopHKbO1BCoHy8ZNhRUT5X4BTu6qyNSwwCiMAAAAABJRU5ErkJggg==",Qy={class:"menu-container"},Gy=["onClick","title"],Hy={class:"menu-icon"},Yy=["src","alt"],Vy={key:3,style:{"font-size":"12px"}},zy={key:0,class:"sub-menu"},Wy=["onClick"],yi=c.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=c.inject("leiting-theme",c.ref("dark")),s=c.inject("leiting-menu-size",c.ref("medium")),o=c.inject("leitingMethods",c.ref({})),r=c.computed(()=>n.value||n),l=c.computed(()=>s.value||s),a=c.ref([{ID:"home",title:"主视角",src:Py,key:"homeView"},{ID:"tree",title:"目录树",src:al,key:"componentTree"},{ID:"cadLayer",title:"图层",src:al,key:"cadLayer"},{ID:"measure",title:"量算",src:Fy,key:"measurement"},{ID:"section",title:"剖切",src:Ry,key:"section"},{ID:"roam",title:"人物漫游",src:Oy,key:"roam"},{ID:"info",title:"构件信息",src:Ly,key:"componentInfo"},{ID:"cadPosition",title:"调整位置",src:Ny,key:"cadPosition"},{ID:"annotation",title:"标注",src:Uy,key:"annotation"},{ID:"setting",title:"设置",src:_y,key:"setting"}]),d=c.ref([]),h=c.ref([...t.activeIds]);c.watch(()=>t.activeIds,D=>{h.value=[...D]},{deep:!0});const f=c.computed(()=>t.visible);o.value&&o.value.menuEvents&&(o.value.menuEvents.on("setMenuListFilter",D=>{d.value=D}),o.value.menuEvents.on("setMenuActive",(D,N)=>{N?h.value.includes(D)||h.value.push(D):h.value=h.value.filter(I=>I!==D)}));const p=c.computed(()=>{let D=a.value;if(t.is2d){const N=["homeView","measurement","cadLayer","annotation"];D=D.filter(I=>I.key&&N.includes(I.key))}else{const N=["cadLayer","cadPosition","annotation"];D=D.filter(I=>!I.key||!N.includes(I.key))}if(d.value.length>0&&(D=D.filter(N=>!N.key||!d.value.includes(N.key))),t.customItems&&t.customItems.length>0){const N=t.customItems.map(I=>({...I,key:I.ID,src:I.src||I.icon}));return[...D,...N]}return D}),u=e,m=D=>{const N=["homeView"];if(D.key&&N.includes(D.key))h.value.includes(D.ID)||(h.value.push(D.ID),setTimeout(()=>{const B=h.value.indexOf(D.ID);B>-1&&h.value.splice(B,1)},1e3));else{const B=h.value.indexOf(D.ID);B>-1?h.value.splice(B,1):h.value.push(D.ID)}const I=h.value.includes(D.ID);D.func&&D.func(D),D.key&&u("action",D.key,I)},w=D=>{d.value=D},A=D=>{console.log("LeitingMenu received showMenu event:",D)},C=(D,N)=>{const I=p.value.find(B=>B.ID===D||B.key===D);if(I){const B=h.value.indexOf(I.ID);N&&B===-1?h.value.push(I.ID):!N&&B>-1&&h.value.splice(B,1)}};let v=null;const S=()=>{o.value?.menuEvents&&(v&&(v.off("setMenuListFilter",w),v.off("showMenu",A),v.off("setMenuActive",C)),v=o.value.menuEvents,v.on("setMenuListFilter",w),v.on("showMenu",A),v.on("setMenuActive",C))};return c.onMounted(()=>{S()}),c.onUnmounted(()=>{v&&(v.off("setMenuListFilter",w),v.off("showMenu",A),v.off("setMenuActive",C))}),c.watch(o,()=>{S()},{deep:!0}),(D,N)=>c.withDirectives((c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["leiting-menu-wrapper",["leiting-theme-"+r.value,"size-"+l.value]])},[c.createElementVNode("div",Qy,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(p.value,I=>(c.openBlock(),c.createElementBlock("div",{key:I.ID,class:c.normalizeClass(["menu-item",{active:h.value.includes(I.ID)}]),onClick:B=>m(I),title:I.title},[c.createElementVNode("div",Hy,[I.src?(c.openBlock(),c.createElementBlock("img",{key:0,src:I.src,alt:I.title},null,8,Yy)):typeof I.icon=="object"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(I.icon),{key:1})):typeof I.icon=="string"?(c.openBlock(),c.createElementBlock("i",{key:2,class:c.normalizeClass(["iconfont",`icon-${I.icon}`])},null,2)):(c.openBlock(),c.createElementBlock("span",Vy,c.toDisplayString(I.title.substring(0,2)),1))]),I.children&&I.children.length>0?(c.openBlock(),c.createElementBlock("div",zy,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(I.children,B=>(c.openBlock(),c.createElementBlock("div",{key:B.ID,class:c.normalizeClass(["sub-menu-item",{active:h.value.includes(B.ID)}]),onClick:c.withModifiers(g=>m(B),["stop"])},c.toDisplayString(B.title),11,Wy))),128))])):c.createCommentVNode("",!0)],10,Gy))),128))])],2)),[[c.vShow,f.value]])}}),jy={class:"leiting-section-content"},Ky={class:"section-form-item"},$y={class:"radio-group"},Xy={class:"section-form-item"},qy={class:"switch-container"},Jy={class:"switch"},Zy={class:"status-text"},e0={class:"section-form-item slider-item"},t0={class:"slider-wrapper"},i0={class:"section-form-item slider-item"},n0={class:"slider-wrapper"},s0={class:"section-form-item slider-item"},o0={class:"slider-wrapper"},r0={class:"section-form-item table-item"},a0={class:"model-table-container"},l0={class:"model-table"},c0={width:"40"},d0=["checked"],h0=["onClick"],u0=["value"],f0={class:"model-name"},Ci=Oe(c.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=c.inject("leitingMethods"),o=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:F=>{n("update:visible",F),n("update:open",F)}}),r=c.ref("Box"),l=c.ref(!1),a=c.ref([]),d=c.ref([]),h=c.computed(()=>d.value.length===0?!1:d.value.every(F=>a.value.includes(F.modelId))),f=F=>{F.target.checked?a.value=d.value.map(y=>y.modelId):a.value=[],P()},p=c.ref([-10,10]),u=c.ref([-10,10]),m=c.ref([-10,10]),w=c.ref([-100,100]),A=c.ref([-100,100]),C=c.ref([-100,100]);let v=!1;const S=F=>{v=!0;const{targetZPlus:E,targetZMinus:y,targetXPlus:b,targetXMinus:T,targetYPlus:R,targetYMinus:O}=F;m.value=[-y,E],p.value=[-T,b],u.value=[-O,R],setTimeout(()=>{v=!1},100)},D=()=>{v||a.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:u.value[1],targetYMinus:-u.value[0]})},N=()=>{s?.value?.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)},I=F=>{if(!s?.value?.getMapTileset||!s?.value?.openSection)return;const y=s.value.getMapTileset()[F];if(y&&y.leiting?.box){const{min:b,max:T}=y.leiting.box,R=(T.x-b.x)/2,O=(T.y-b.y)/2,L=(T.z-b.z)/2;a.value.length<=1&&(w.value=[-R*2,R*2],A.value=[-O*2,O*2],C.value=[-L*2,L*2],p.value=[-R,R],u.value=[-O,O],m.value=[-L,L],s.value.updateSectionRange&&s.value.updateSectionRange({targetZPlus:L,targetZMinus:L,targetXPlus:R,targetXMinus:R,targetYPlus:O,targetYMinus:O})),s.value.openSection(F,{moveCallBack:S}),s.value.setSectionBoxVisibility&&s.value.setSectionBoxVisibility(l.value)}},B=F=>{const E=a.value.indexOf(F);E>-1?a.value.splice(E,1):a.value.push(F),P()};let g=[];const P=()=>{const F=a.value.filter(y=>!g.includes(y)),E=g.filter(y=>!a.value.includes(y));F.forEach(y=>I(y)),E.forEach(y=>{s?.value?.closeSection&&s.value.closeSection(y)}),g=[...a.value]},x=()=>{},k=()=>{o.value=!1,n("close")},_=()=>{l.value=!1,a.value=[],g=[],p.value=[-10,10],u.value=[-10,10],m.value=[-10,10],w.value=[-100,100],A.value=[-100,100],C.value=[-100,100]};c.watch(()=>t.visible,F=>{F?G():(s?.value?.closeSection&&s.value.closeSection(),_())});const G=()=>{s?.value&&typeof s.value.getModelList=="function"&&(d.value=s.value.getModelList()||[],d.value.length>0&&a.value.length===0&&(a.value=[d.value[0].modelId],g=[...a.value]),t.visible&&a.value.length>0&&(l.value=!0,a.value.forEach(F=>I(F))))};return c.watch(()=>s?.value,()=>{G()},{immediate:!0,deep:!0}),c.onMounted(()=>{G()}),(F,E)=>(c.openBlock(),c.createBlock(Pe,{visible:o.value,title:"剖切分析","full-height":i.fullHeight,"onUpdate:visible":k},{default:c.withCtx(()=>[c.createElementVNode("div",jy,[c.createElementVNode("div",Ky,[E[8]||(E[8]=c.createElementVNode("span",{class:"label"},"模式",-1)),c.createElementVNode("div",$y,[c.createElementVNode("label",{class:c.normalizeClass(["radio-item",{active:r.value==="Box"}])},[c.withDirectives(c.createElementVNode("input",{type:"radio",value:"Box","onUpdate:modelValue":E[0]||(E[0]=y=>r.value=y),onChange:x},null,544),[[c.vModelRadio,r.value]]),E[7]||(E[7]=c.createTextVNode(" 剖切盒 ",-1))],2)])]),c.createElementVNode("div",Xy,[E[10]||(E[10]=c.createElementVNode("span",{class:"label"},"显示",-1)),c.createElementVNode("div",qy,[c.createElementVNode("label",Jy,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":E[1]||(E[1]=y=>l.value=y),onChange:N},null,544),[[c.vModelCheckbox,l.value]]),E[9]||(E[9]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",Zy,c.toDisplayString(l.value?"显示":"隐藏"),1)])]),c.createElementVNode("div",e0,[E[11]||(E[11]=c.createElementVNode("span",{class:"label"},"X 轴",-1)),c.createElementVNode("div",t0,[c.createVNode(c.unref(ge.Slider),{value:p.value,"onUpdate:value":E[2]||(E[2]=y=>p.value=y),range:"",min:w.value[0],max:w.value[1],step:.1,onChange:D},null,8,["value","min","max"])])]),c.createElementVNode("div",i0,[E[12]||(E[12]=c.createElementVNode("span",{class:"label"},"Y 轴",-1)),c.createElementVNode("div",n0,[c.createVNode(c.unref(ge.Slider),{value:u.value,"onUpdate:value":E[3]||(E[3]=y=>u.value=y),range:"",min:A.value[0],max:A.value[1],step:.1,onChange:D},null,8,["value","min","max"])])]),c.createElementVNode("div",s0,[E[13]||(E[13]=c.createElementVNode("span",{class:"label"},"Z 轴",-1)),c.createElementVNode("div",o0,[c.createVNode(c.unref(ge.Slider),{value:m.value,"onUpdate:value":E[4]||(E[4]=y=>m.value=y),range:"",min:C.value[0],max:C.value[1],step:.1,onChange:D},null,8,["value","min","max"])])]),c.createElementVNode("div",r0,[E[15]||(E[15]=c.createElementVNode("span",{class:"label"},"模型",-1)),c.createElementVNode("div",a0,[c.createElementVNode("table",l0,[c.createElementVNode("thead",null,[c.createElementVNode("tr",null,[c.createElementVNode("th",c0,[c.createElementVNode("input",{type:"checkbox",checked:h.value,onChange:f},null,40,d0)]),E[14]||(E[14]=c.createElementVNode("th",null,"名称",-1))])]),c.createElementVNode("tbody",null,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,y=>(c.openBlock(),c.createElementBlock("tr",{key:y.modelId,class:c.normalizeClass({selected:a.value.includes(y.modelId)}),onClick:b=>B(y.modelId)},[c.createElementVNode("td",null,[c.withDirectives(c.createElementVNode("input",{type:"checkbox",value:y.modelId,"onUpdate:modelValue":E[5]||(E[5]=b=>a.value=b),onClick:E[6]||(E[6]=c.withModifiers(()=>{},["stop"])),onChange:P},null,40,u0),[[c.vModelCheckbox,a.value]])]),c.createElementVNode("td",f0,c.toDisplayString(y.modelName),1)],10,h0))),128))])])])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-ee4d9a12"]]),p0={class:"leiting-player-content"},g0={class:"player-form-item"},m0={class:"switch-container"},A0={class:"switch"},y0={class:"status-text"},C0={class:"player-form-item"},E0={class:"switch-container"},w0={class:"switch"},b0={class:"status-text"},v0={class:"player-form-item"},I0={class:"switch-container"},B0={class:"switch"},x0={class:"status-text"},S0={class:"player-form-item slider-item"},T0={class:"slider-wrapper"},M0={class:"value-text"},D0={class:"instructions"},k0={class:"key-map"},P0={class:"key-row"},F0={class:"key-row"},R0={class:"key-row"},O0={class:"key-row"},L0={class:"key-row"},N0={class:"key-row"},Ei=Oe(c.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=c.inject("leitingMethods"),o=c.ref(!1),r=c.ref(!1),l=c.ref(!0),a=c.ref(5),d=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:I=>{n("update:visible",I),n("update:open",I)}}),h=c.ref(null),f=c.ref(null),p=c.ref(null),u=c.ref(null),m=c.ref(null),w=c.ref(null),A=()=>{o.value?v():S()},C=()=>{s?.value?.setPlayerParams&&s.value.setPlayerParams({gravityTest:r.value,collisionTest:l.value})},v=async()=>{s?.value?.openPlayer&&(await s.value.openPlayer(),s.value.setPlayerSpeed&&s.value.setPlayerSpeed(a.value),C(),s.value.bindPlayerUiKeys&&(await c.nextTick(),s.value.bindPlayerUiKeys({moveFront:h.value,moveBack:f.value,moveLeft:p.value,moveRight:u.value,moveUp:m.value,moveDown:w.value})))},S=()=>{s?.value?.closePlayer&&s.value.closePlayer()},D=()=>{s?.value?.setPlayerSpeed&&s.value.setPlayerSpeed(a.value)},N=()=>{d.value=!1,n("close")};return c.watch(()=>t.visible,I=>{I?(o.value=!0,s?.value?v():setTimeout(()=>{s?.value&&v()},100)):o.value&&(o.value=!1,S())},{immediate:!0}),(I,B)=>(c.openBlock(),c.createBlock(Pe,{title:i.title,visible:d.value,"full-height":i.fullHeight,"onUpdate:visible":N},{default:c.withCtx(()=>[c.createElementVNode("div",p0,[c.createElementVNode("div",g0,[B[5]||(B[5]=c.createElementVNode("span",{class:"label"},"启用",-1)),c.createElementVNode("div",m0,[c.createElementVNode("label",A0,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":B[0]||(B[0]=g=>o.value=g),onChange:A},null,544),[[c.vModelCheckbox,o.value]]),B[4]||(B[4]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",y0,c.toDisplayString(o.value?"开启":"关闭"),1)])]),c.createElementVNode("div",C0,[B[7]||(B[7]=c.createElementVNode("span",{class:"label"},"重力",-1)),c.createElementVNode("div",E0,[c.createElementVNode("label",w0,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":B[1]||(B[1]=g=>r.value=g),onChange:C},null,544),[[c.vModelCheckbox,r.value]]),B[6]||(B[6]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",b0,c.toDisplayString(r.value?"开启":"关闭"),1)])]),c.createElementVNode("div",v0,[B[9]||(B[9]=c.createElementVNode("span",{class:"label"},"碰撞",-1)),c.createElementVNode("div",I0,[c.createElementVNode("label",B0,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":B[2]||(B[2]=g=>l.value=g),onChange:C},null,544),[[c.vModelCheckbox,l.value]]),B[8]||(B[8]=c.createElementVNode("span",{class:"slider round"},null,-1))]),c.createElementVNode("span",x0,c.toDisplayString(l.value?"开启":"关闭"),1)])]),c.createElementVNode("div",S0,[B[10]||(B[10]=c.createElementVNode("span",{class:"label"},"速度",-1)),c.createElementVNode("div",T0,[c.createVNode(c.unref(ge.Slider),{value:a.value,"onUpdate:value":B[3]||(B[3]=g=>a.value=g),min:1,max:10,step:1,onChange:D},null,8,["value"])]),c.createElementVNode("span",M0,c.toDisplayString(a.value),1)]),B[19]||(B[19]=c.createElementVNode("div",{class:"divider"},null,-1)),c.createElementVNode("div",D0,[B[18]||(B[18]=c.createElementVNode("div",{class:"instruction-title"},"操作说明",-1)),c.createElementVNode("div",k0,[c.createElementVNode("div",P0,[c.createElementVNode("span",{class:"key",ref_key:"btnFront",ref:h},"W",512),B[11]||(B[11]=c.createTextVNode(" 前进 ",-1))]),c.createElementVNode("div",F0,[c.createElementVNode("span",{class:"key",ref_key:"btnBack",ref:f},"S",512),B[12]||(B[12]=c.createTextVNode(" 后退 ",-1))]),c.createElementVNode("div",R0,[c.createElementVNode("span",{class:"key",ref_key:"btnLeft",ref:p},"A",512),B[13]||(B[13]=c.createTextVNode(" 左移 ",-1))]),c.createElementVNode("div",O0,[c.createElementVNode("span",{class:"key",ref_key:"btnRight",ref:u},"D",512),B[14]||(B[14]=c.createTextVNode(" 右移 ",-1))]),c.createElementVNode("div",L0,[c.createElementVNode("span",{class:"key",ref_key:"btnUp",ref:m},"Q",512),B[15]||(B[15]=c.createTextVNode(" 上升 ",-1))]),c.createElementVNode("div",N0,[c.createElementVNode("span",{class:"key",ref_key:"btnDown",ref:w},"E",512),B[16]||(B[16]=c.createTextVNode(" 下降 ",-1))]),B[17]||(B[17]=c.createElementVNode("div",{class:"key-row"},[c.createElementVNode("span",{class:"mouse-icon"},"🖱️"),c.createTextVNode(" 按住左键拖拽旋转视角 ")],-1))])])])]),_:1},8,["title","visible","full-height"]))}}),[["__scopeId","data-v-ff3f266e"]]),_0={class:"info-content"},U0={key:0,class:"component-title"},wi=Oe(c.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=c.inject("leitingMethods"),o=c.ref([]),r=c.ref(!1),l=c.ref([]),a=c.ref([]),d=c.ref(0),h=c.computed({get:()=>t.open!==void 0?t.open:t.visible,set:C=>{n("update:visible",C),n("update:open",C)}}),f=()=>{h.value=!1},p=C=>({elementID:"构件ID",elementName:"构件名",categoryName:"类别",familySymbolName:"族类型",levelName:"标高",modelName:"文件名",length:"长",width:"宽",height:"高"})[C]||C,u=["elementName","elementID","modelName","length","width","height","levelName","categoryName","familySymbolName"],m=async C=>{const v=++d.value;if(a.value=C,!C||C.length===0){o.value=[];return}if(!h.value)return;let S=C;C.length>10&&(fe.warning(`选中构件数量过多(${C.length}个),仅显示前10个`),S=C.slice(0,10));const D=s?.value;let N=D?.getMapTileset?D.getMapTileset():{};r.value=!0;const I=[],B={};if(S.forEach(x=>{const _=N[x.modelId]?.leiting?.model?.dbName;_&&x.elementId&&I.push({dbName:_,elementId:x.elementId,modelId:x.modelId})}),I.length>0){try{const x=I.map(G=>({dbName:G.dbName,elementId:G.elementId})),k=await Dr(x),_=Array.isArray(k)?k:k?.data;_&&Array.isArray(_)&&_.forEach(G=>{if(G){const F=`${G.modelId}_${G.elementId}`;B[F]=G}})}catch(x){console.warn("API fetch component details failed, falling back to local data",x)}console.log("123")}const g=new Set;if(S.forEach(x=>{const k=N[x.modelId],_=`${x.modelId}_${x.elementId}`;B[_]||k&&k.leiting&&!k.leiting?.node?.nodeExtras&&k.leiting.model?.nodeUrl&&g.add(x.modelId)}),g.size>0&&D?._loadNodeDetailsForModel)try{const x=Array.from(g).map(k=>D._loadNodeDetailsForModel(k));await Promise.all(x)}catch(x){console.error("Failed to load node details",x)}if(v!==d.value)return;N=D?.getMapTileset?D.getMapTileset():{};const P=[];S.forEach((x,k)=>{const G=N[x.modelId]?.leiting||{},F=B[`${x.modelId}_${x.elementId}`];let E={modelName:G.model?.modelId||x.modelId};E.elementID||(E.elementID=x.elementId);let y=null;if(F)y=F;else{const R=G.node?.nodeExtras?.element||G.node?.nodeExtras;if(R){const O=E.elementID;R[O]&&(y=R[O])}}y&&y.box3&&(E.length=`${y.box3.length?.toFixed(2)||0}米`,E.width=`${y.box3.width?.toFixed(2)||0}米`,E.height=`${y.box3.height?.toFixed(2)||0}米`);const b=[];y&&(y.name&&(E.elementName=y.name),y.categoryName&&(E.categoryName=y.categoryName),y.familySymbolName&&(E.familySymbolName=y.familySymbolName),y.levelName&&(E.levelName=y.levelName));const T={};if(u.forEach(R=>{E[R]!==void 0&&(T[R]=E[R])}),b.push({name:"基础信息",params:T}),y){const R=Array.isArray(y)?y:Array.isArray(y?.parameters)?y.parameters:null;if(R){if(R.flat().forEach(L=>{if(L&&L.GroupName&&Array.isArray(L.Parameters)){const M={};L.Parameters.forEach(Q=>{Q.name&&(M[Q.name]=Q.value??"")}),Object.keys(M).length>0&&b.push({name:L.GroupName,params:M})}}),!Array.isArray(y)){const{parameters:L,...M}=y,Q={};Object.keys(M).forEach(Y=>{!u.includes(Y)&&Y!=="uniqueId"&&typeof M[Y]!="object"&&(Q[Y]=M[Y])}),Object.keys(Q).length>0&&b.push({name:"其他属性",params:Q})}}else{let O=!1;if(Object.keys(y).forEach(L=>{y[L]&&typeof y[L]=="object"&&!Array.isArray(y[L])&&(O=!0,b.push({name:L,params:y[L]}))}),!O){const L={};Object.keys(y).forEach(M=>{if(!u.includes(M)&&M!=="batchId"){const Q=y[M];typeof Q=="string"&&Q.length>500?L[M]=Q.substring(0,500)+"...":L[M]=Q}}),Object.keys(L).length>0&&b.push({name:"属性",params:L})}}}P.push({id:k,title:`${E.modelName}${E.elementName?` - ${E.elementName}`:""}`,groups:b})}),o.value=P,v===d.value&&(r.value=!1),P.length>0?l.value=[`${P[0].id}-基础信息`]:l.value=[]};let w=!1;const A=()=>{if(w)return;const C=s?.value;C&&C.selectionChange&&(C.selectionChange(m),w=!0)};return c.watch(()=>s?.value,()=>{A()},{deep:!0,immediate:!0}),c.watch(h,C=>{C&&a.value.length>0&&m(a.value)}),c.onMounted(()=>{A()}),(C,v)=>(c.openBlock(),c.createBlock(Pe,{visible:h.value,title:"构件详情",width:350,align:"right","initial-position":{x:0,y:0},"full-height":i.fullHeight,onClose:f,"onUpdate:visible":v[1]||(v[1]=S=>h.value=S),class:"base-info-card"},{default:c.withCtx(()=>[c.createElementVNode("div",_0,[c.createVNode(c.unref(ge.Spin),{spinning:r.value},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.value,S=>(c.openBlock(),c.createElementBlock("div",{key:S.id,class:"component-block"},[o.value.length>1?(c.openBlock(),c.createElementBlock("div",U0,c.toDisplayString(S.title),1)):c.createCommentVNode("",!0),c.createVNode(c.unref(ge.Collapse),{activeKey:l.value,"onUpdate:activeKey":v[0]||(v[0]=D=>l.value=D),ghost:"","expand-icon-position":"end"},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(S.groups,D=>(c.openBlock(),c.createBlock(c.unref(ge.CollapsePanel),{key:`${S.id}-${D.name}`,header:D.name},{default:c.withCtx(()=>[c.createVNode(c.unref(ge.Descriptions),{size:"small",bordered:"",column:1,labelStyle:{width:"100px",background:"rgba(255,255,255,0.05)",color:"#aaa"},contentStyle:{color:"#fff"}},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(D.params,(N,I)=>(c.openBlock(),c.createBlock(c.unref(ge.DescriptionsItem),{key:I,label:p(String(I))},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(N),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-1fb90635"]]);class ll{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),l=s.height;e({longitude:o,latitude:r,height:l})}},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 Q0={class:"adjust-panel"},G0={class:"control-panel"},H0={class:"form-item"},Y0={class:"radio-group"},V0={class:"form-item"},z0={class:"radio-group"},W0={class:"form-item"},j0={class:"value"},K0={class:"param-row"},$0={class:"param-row"},X0={class:"param-row"},q0={class:"param-row"},J0={class:"param-row"},Z0={class:"param-row"},eC={class:"param-row"},tC={class:"button-grid"},iC={key:1,class:"pick-mode-ui"},nC={class:"form-item",style:{display:"block","margin-bottom":"15px"}},sC={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},oC=["checked"],rC={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},aC={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},lC={class:"form-item",style:{display:"block","margin-bottom":"15px"}},cC={class:"radio-group",style:{width:"100%",display:"flex","align-items":"flex-start","flex-direction":"column"}},dC=["checked"],hC={key:0,style:{"font-size":"12px",color:"#aaa","margin-left":"20px"}},uC={key:1,style:{"font-size":"12px",color:"#666","margin-left":"20px"}},fC={class:"list-panel"},pC={class:"list-header"},gC={class:"col-check"},mC=["checked"],AC={class:"list-body"},yC={class:"col-check"},CC=["onUpdate:modelValue"],EC={class:"col-index"},wC=["title"],bC={class:"col-main"},vC=["checked","onChange"],bi=Oe(c.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=c.computed({get:()=>n.open!==void 0?n.open:n.visible,set:L=>{s("update:visible",L),s("update:open",L)}}),r=c.inject("leitingMethods"),l=c.ref("BIM"),a=c.ref("param"),d=c.ref(""),h=c.ref([]),f=c.ref("BIM"),p=c.ref(null),u=c.ref(null),m=c.ref(null),w=()=>(!m.value&&r?.value?.getViewer&&r?.value?.getCesium&&(m.value=new ll(r.value.getViewer(),r.value.getCesium())),m.value),A=()=>{w()?.clearMarkers(),p.value=null,u.value=null},C=(L,M)=>{L==="BIM"?p.value=M:u.value=M,w()?.addMarker(L,M),fe.success(`${L==="BIM"?"BIM":"地图"}标记点已添加`)},v=()=>{w()?.registerPickHandler(L=>{C(f.value,L)})},S=()=>{w()?.destroyPickHandler()},D=()=>{if(!p.value||!u.value){fe.warning("请先选择BIM标记点和地图标记点");return}if(!d.value){fe.warning("请先选择主模型");return}const L=w();let M=0,Q=0,Y=0;if(L){const{dLon:W,dLat:q,dHeight:Z}=L.calculateOffset(p.value,u.value);M=W,Q=q,Y=Z}else M=u.value.longitude-p.value.longitude,Q=u.value.latitude-p.value.latitude,Y=u.value.height-p.value.height;I.value.longitude+=M,I.value.latitude+=Q,I.value.height+=Y,y(d.value,{longitude:I.value.longitude,latitude:I.value.latitude,height:I.value.height}),fe.success("位置已调整")};c.watch(()=>a.value,L=>{L==="pick"?v():S()}),e({addMarker:C,setModelType:L=>{(L==="BIM"||L==="OSGB")&&(l.value=L)}});const I=c.ref({longitude:0,latitude:0,lonlat:1e-6,heightDistance:1,rotation:30,totalRotation:0,height:0,X:0,Y:0,Z:0}),B=c.computed(()=>{const L=h.value.find(M=>M.modelId===d.value);return L?L.modelName:""}),g=c.computed(()=>x.value.length>0&&x.value.every(L=>L.selected)),P=()=>{o.value=!1,s("close")},x=c.computed(()=>h.value.filter(L=>L.type===l.value)),k=L=>{const M=L.target.checked;x.value.forEach(Q=>Q.selected=M)},_=()=>{if(!r?.value)return;const L=r.value,M=L.getMapTileset?L.getMapTileset():{},Q=[];if(Object.keys(M).forEach(Y=>{const q=M[Y].leiting||{};q.model&&Q.push({modelId:q.model.modelId,modelName:q.model.modelName,selected:!1,formData:q.model.formData||{},dbName:q.model.dbName,url:q.model.url,type:q.model.type||"BIM"})}),h.value=Q,Q.length>0){const Y=L.getBIMmodelId?L.getBIMmodelId():"";Y&&Q.find(W=>W.modelId===Y)?F(Y):F(Q[0].modelId),Q.forEach(W=>W.selected=!0)}},G=()=>{fe.info("拖动右下角标,可显示模型列表",void 0,2)},F=L=>{d.value=L;const M=h.value.find(Q=>Q.modelId===L);M&&M.formData&&Object.keys(I.value).forEach(Q=>{M.formData[Q]!==void 0&&(I.value[Q]=M.formData[Q])})},E=L=>r?.value?.getMapTileset?r.value.getMapTileset()[L]:null,y=(L,M)=>{const Q=E(L),Y=r.value.getCesium();if(Q&&Y){if(Q.leiting?.model){Q.leiting.model.formData={...Q.leiting.model.formData,...M};const W=h.value.find(q=>q.modelId===L);W&&(W.formData=Q.leiting.model.formData)}Rn({Cesium:Y,tileset:Q})}},b=L=>{if(!d.value)return;const Q=h.value.find(q=>q.modelId===d.value)?.formData?.[L]??0,Y=I.value[L],W=Y-Q;y(d.value,{[L]:Y}),W!==0&&x.value.filter(Z=>Z.selected&&Z.modelId!==d.value).forEach(Z=>{const ne=(Z.formData?.[L]??0)+W;y(Z.modelId,{[L]:ne})})},T=L=>{const M=x.value.filter(q=>q.selected);if(M.length===0){fe.warning("请先选择要调整的模型");return}const{lonlat:Q,heightDistance:Y,rotation:W}=I.value;M.forEach(q=>{const Z={...q.formData};switch(L){case"north":Z.latitude+=Q;break;case"south":Z.latitude-=Q;break;case"east":Z.longitude+=Q;break;case"west":Z.longitude-=Q;break;case"up":Z.height+=Y;break;case"down":Z.height-=Y;break;case"rotateLeft":Z.totalRotation=(Z.totalRotation||0)+W;break;case"rotateRight":Z.totalRotation=(Z.totalRotation||0)-W;break}q.modelId===d.value&&(Z.lonlat=Q,Z.heightDistance=Y,Z.rotation=W,Object.assign(I.value,Z)),y(q.modelId,Z)})},R=()=>{if(!d.value){fe.warning("请先选择主模型");return}const L=E(d.value);if(!L||!r?.value?.getViewer)return;const M=r.value.getViewer(),Q=r.value.getCesium(),Y=L.boundingSphere;M.camera.flyToBoundingSphere(Y,{offset:new Q.HeadingPitchRange(0,Q.Math.toRadians(-90),Y.radius*2),duration:1.5})},O=()=>{r?.value?.saveRegion?(r.value.saveRegion(h.value),s("save",c.unref(h))):(console.log("Save models:",h.value),fe.warning("未找到保存接口,数据已打印控制台"))};return c.watch(()=>n.visible,L=>{L?(_(),G(),a.value==="pick"&&v()):(S(),A())}),c.onMounted(()=>{n.visible&&(_(),G(),a.value==="pick"&&v())}),(L,M)=>(c.openBlock(),c.createBlock(Pe,{visible:o.value,title:"调整位置(调整前可选择正北俯视)","full-height":i.fullHeight,width:260,"onUpdate:visible":M[25]||(M[25]=Q=>o.value=Q),onClose:P,onSave:O,class:"base-position-card"},{default:c.withCtx(()=>[c.createElementVNode("div",Q0,[c.createElementVNode("div",G0,[c.createElementVNode("div",H0,[M[26]||(M[26]=c.createElementVNode("label",null,"模型类型:",-1)),c.createElementVNode("div",Y0,[c.createElementVNode("span",{class:c.normalizeClass({active:l.value==="BIM"}),onClick:M[0]||(M[0]=Q=>l.value="BIM")},"BIM模型",2),c.createElementVNode("span",{class:c.normalizeClass({active:l.value==="OSGB"}),onClick:M[1]||(M[1]=Q=>l.value="OSGB")},"倾斜摄影",2)])]),c.createElementVNode("div",V0,[M[27]||(M[27]=c.createElementVNode("label",null,"调整操作:",-1)),c.createElementVNode("div",z0,[c.createElementVNode("span",{class:c.normalizeClass({active:a.value==="param"}),onClick:M[2]||(M[2]=Q=>a.value="param")},"参数模式",2),c.createElementVNode("span",{class:c.normalizeClass({active:a.value==="pick"}),onClick:M[3]||(M[3]=Q=>a.value="pick")},"地图点选",2)])]),c.createElementVNode("div",W0,[M[28]||(M[28]=c.createElementVNode("label",null,"当前主模型:",-1)),c.createElementVNode("span",j0,c.toDisplayString(B.value||"未选择"),1)]),M[42]||(M[42]=c.createElementVNode("div",{class:"separator"},null,-1)),a.value==="param"?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[M[36]||(M[36]=c.createElementVNode("div",{class:"group-header"},"当前状态",-1)),c.createElementVNode("div",K0,[M[29]||(M[29]=c.createElementVNode("label",null,"经度(东西):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[4]||(M[4]=Q=>I.value.longitude=Q),onChange:M[5]||(M[5]=Q=>b("longitude")),step:"0.000001"},null,544),[[c.vModelText,I.value.longitude,void 0,{number:!0}]])]),c.createElementVNode("div",$0,[M[30]||(M[30]=c.createElementVNode("label",null,"纬度(南北):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[6]||(M[6]=Q=>I.value.latitude=Q),onChange:M[7]||(M[7]=Q=>b("latitude")),step:"0.000001"},null,544),[[c.vModelText,I.value.latitude,void 0,{number:!0}]])]),c.createElementVNode("div",X0,[M[31]||(M[31]=c.createElementVNode("label",null,"高度(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[8]||(M[8]=Q=>I.value.height=Q),onChange:M[9]||(M[9]=Q=>b("height")),step:"0.1"},null,544),[[c.vModelText,I.value.height,void 0,{number:!0}]])]),c.createElementVNode("div",q0,[M[32]||(M[32]=c.createElementVNode("label",null,"累计旋转(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[10]||(M[10]=Q=>I.value.totalRotation=Q),onChange:M[11]||(M[11]=Q=>b("totalRotation")),step:"1"},null,544),[[c.vModelText,I.value.totalRotation,void 0,{number:!0}]])]),M[37]||(M[37]=c.createElementVNode("div",{class:"separator"},null,-1)),M[38]||(M[38]=c.createElementVNode("div",{class:"group-header"},"调整步长",-1)),c.createElementVNode("div",J0,[M[33]||(M[33]=c.createElementVNode("label",null,"经纬步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[12]||(M[12]=Q=>I.value.lonlat=Q),step:"0.000001"},null,512),[[c.vModelText,I.value.lonlat,void 0,{number:!0}]])]),c.createElementVNode("div",Z0,[M[34]||(M[34]=c.createElementVNode("label",null,"高度步长(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[13]||(M[13]=Q=>I.value.heightDistance=Q),step:"0.1"},null,512),[[c.vModelText,I.value.heightDistance,void 0,{number:!0}]])]),c.createElementVNode("div",eC,[M[35]||(M[35]=c.createElementVNode("label",null,"旋转步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":M[14]||(M[14]=Q=>I.value.rotation=Q),step:"1"},null,512),[[c.vModelText,I.value.rotation,void 0,{number:!0}]])]),c.createElementVNode("div",tC,[c.createElementVNode("button",{onClick:M[15]||(M[15]=Q=>T("rotateLeft"))},"左转"),c.createElementVNode("button",{onClick:M[16]||(M[16]=Q=>T("north"))},"北移"),c.createElementVNode("button",{onClick:M[17]||(M[17]=Q=>T("rotateRight"))},"右转"),c.createElementVNode("button",{onClick:M[18]||(M[18]=Q=>T("west"))},"西移"),c.createElementVNode("button",{onClick:M[19]||(M[19]=Q=>T("south"))},"南移"),c.createElementVNode("button",{onClick:M[20]||(M[20]=Q=>T("east"))},"东移"),c.createElementVNode("button",{onClick:M[21]||(M[21]=Q=>T("up"))},"上移"),c.createElementVNode("button",{onClick:M[22]||(M[22]=Q=>T("down"))},"下移"),c.createElementVNode("button",{onClick:R,class:"primary-btn"},"正北俯视"),c.createElementVNode("button",{onClick:O,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):a.value==="pick"?(c.openBlock(),c.createElementBlock("div",iC,[c.createElementVNode("div",nC,[c.createElementVNode("div",sC,[c.createElementVNode("div",{onClick:M[23]||(M[23]=Q=>f.value="BIM"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[c.createElementVNode("input",{type:"radio",checked:f.value==="BIM",style:{"margin-right":"5px"}},null,8,oC),M[39]||(M[39]=c.createElementVNode("span",{style:{"font-weight":"bold"}},"BIM标记点:",-1))]),p.value?(c.openBlock(),c.createElementBlock("div",rC,[c.createElementVNode("div",null,"经度:"+c.toDisplayString(p.value.longitude.toFixed(10)),1),c.createElementVNode("div",null,"纬度:"+c.toDisplayString(p.value.latitude.toFixed(10)),1)])):(c.openBlock(),c.createElementBlock("div",aC,"未选择"))])]),c.createElementVNode("div",lC,[c.createElementVNode("div",cC,[c.createElementVNode("div",{onClick:M[24]||(M[24]=Q=>f.value="MAP"),style:{cursor:"pointer",display:"flex","align-items":"center","margin-bottom":"5px"}},[c.createElementVNode("input",{type:"radio",checked:f.value==="MAP",style:{"margin-right":"5px"}},null,8,dC),M[40]||(M[40]=c.createElementVNode("span",{style:{"font-weight":"bold"}},"地图标记点:",-1))]),u.value?(c.openBlock(),c.createElementBlock("div",hC,[c.createElementVNode("div",null,"经度:"+c.toDisplayString(u.value.longitude.toFixed(10)),1),c.createElementVNode("div",null,"纬度:"+c.toDisplayString(u.value.latitude.toFixed(10)),1)])):(c.openBlock(),c.createElementBlock("div",uC,"未选择"))])]),c.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[c.createElementVNode("button",{onClick:D},"调整位置"),c.createElementVNode("button",{onClick:O},"保存")]),M[41]||(M[41]=c.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[c.createElementVNode("div",null,"操作指南:"),c.createElementVNode("div",null,"1. 勾选上方 BIM 或 地图 标记点选项。"),c.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),c.createElementVNode("div",null,"3. 采集两点后,点击“调整位置”进行校准。")],-1))])):c.createCommentVNode("",!0)]),c.createElementVNode("div",fC,[c.createElementVNode("div",pC,[c.createElementVNode("div",gC,[c.createElementVNode("input",{type:"checkbox",checked:g.value,onChange:k},null,40,mC)]),M[43]||(M[43]=c.createElementVNode("div",{class:"col-index"},"序号",-1)),M[44]||(M[44]=c.createElementVNode("div",{class:"col-name"},"名称",-1)),M[45]||(M[45]=c.createElementVNode("div",{class:"col-main"},"主模型",-1))]),c.createElementVNode("div",AC,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(x.value,(Q,Y)=>(c.openBlock(),c.createElementBlock("div",{key:Q.modelId,class:c.normalizeClass(["list-item",{active:Q.modelId===d.value}])},[c.createElementVNode("div",yC,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":W=>Q.selected=W},null,8,CC),[[c.vModelCheckbox,Q.selected]])]),c.createElementVNode("div",EC,c.toDisplayString(Y+1),1),c.createElementVNode("div",{class:"col-name",title:Q.modelName},c.toDisplayString(Q.modelName),9,wC),c.createElementVNode("div",bC,[c.createElementVNode("input",{type:"radio",name:"mainModel",checked:Q.modelId===d.value,onChange:W=>F(Q.modelId)},null,40,vC)])],2))),128))])])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-9737215c"]]);function ln(){return ln=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},ln.apply(null,arguments)}const IC={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:"下一世纪"},BC={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},cl={lang:ln({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},IC),timePickerLocale:ln({},BC)};cl.lang.ok="确定";var cn={exports:{}},xC=cn.exports,dl;function hl(){return dl||(dl=1,(function(i,e){(function(t,n){i.exports=n()})(xC,(function(){var t=1e3,n=6e4,s=36e5,o="millisecond",r="second",l="minute",a="hour",d="day",h="week",f="month",p="quarter",u="year",m="date",w="Invalid Date",A=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|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(F){var E=["th","st","nd","rd"],y=F%100;return"["+F+(E[(y-20)%10]||E[y]||E[0])+"]"}},S=function(F,E,y){var b=String(F);return!b||b.length>=E?F:""+Array(E+1-b.length).join(y)+F},D={s:S,z:function(F){var E=-F.utcOffset(),y=Math.abs(E),b=Math.floor(y/60),T=y%60;return(E<=0?"+":"-")+S(b,2,"0")+":"+S(T,2,"0")},m:function F(E,y){if(E.date()<y.date())return-F(y,E);var b=12*(y.year()-E.year())+(y.month()-E.month()),T=E.clone().add(b,f),R=y-T<0,O=E.clone().add(b+(R?-1:1),f);return+(-(b+(y-T)/(R?T-O:O-T))||0)},a:function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},p:function(F){return{M:f,y:u,w:h,d,D:m,h:a,m:l,s:r,ms:o,Q:p}[F]||String(F||"").toLowerCase().replace(/s$/,"")},u:function(F){return F===void 0}},N="en",I={};I[N]=v;var B="$isDayjsObject",g=function(F){return F instanceof _||!(!F||!F[B])},P=function F(E,y,b){var T;if(!E)return N;if(typeof E=="string"){var R=E.toLowerCase();I[R]&&(T=R),y&&(I[R]=y,T=R);var O=E.split("-");if(!T&&O.length>1)return F(O[0])}else{var L=E.name;I[L]=E,T=L}return!b&&T&&(N=T),T||!b&&N},x=function(F,E){if(g(F))return F.clone();var y=typeof E=="object"?E:{};return y.date=F,y.args=arguments,new _(y)},k=D;k.l=P,k.i=g,k.w=function(F,E){return x(F,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var _=(function(){function F(y){this.$L=P(y.locale,null,!0),this.parse(y),this.$x=this.$x||y.x||{},this[B]=!0}var E=F.prototype;return E.parse=function(y){this.$d=(function(b){var T=b.date,R=b.utc;if(T===null)return new Date(NaN);if(k.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var O=T.match(A);if(O){var L=O[2]-1||0,M=(O[7]||"0").substring(0,3);return R?new Date(Date.UTC(O[1],L,O[3]||1,O[4]||0,O[5]||0,O[6]||0,M)):new Date(O[1],L,O[3]||1,O[4]||0,O[5]||0,O[6]||0,M)}}return new Date(T)})(y),this.init()},E.init=function(){var y=this.$d;this.$y=y.getFullYear(),this.$M=y.getMonth(),this.$D=y.getDate(),this.$W=y.getDay(),this.$H=y.getHours(),this.$m=y.getMinutes(),this.$s=y.getSeconds(),this.$ms=y.getMilliseconds()},E.$utils=function(){return k},E.isValid=function(){return this.$d.toString()!==w},E.isSame=function(y,b){var T=x(y);return this.startOf(b)<=T&&T<=this.endOf(b)},E.isAfter=function(y,b){return x(y)<this.startOf(b)},E.isBefore=function(y,b){return this.endOf(b)<x(y)},E.$g=function(y,b,T){return k.u(y)?this[b]:this.set(T,y)},E.unix=function(){return Math.floor(this.valueOf()/1e3)},E.valueOf=function(){return this.$d.getTime()},E.startOf=function(y,b){var T=this,R=!!k.u(b)||b,O=k.p(y),L=function(ne,se){var pe=k.w(T.$u?Date.UTC(T.$y,se,ne):new Date(T.$y,se,ne),T);return R?pe:pe.endOf(d)},M=function(ne,se){return k.w(T.toDate()[ne].apply(T.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(se)),T)},Q=this.$W,Y=this.$M,W=this.$D,q="set"+(this.$u?"UTC":"");switch(O){case u:return R?L(1,0):L(31,11);case f:return R?L(1,Y):L(0,Y+1);case h:var Z=this.$locale().weekStart||0,oe=(Q<Z?Q+7:Q)-Z;return L(R?W-oe:W+(6-oe),Y);case d:case m:return M(q+"Hours",0);case a:return M(q+"Minutes",1);case l:return M(q+"Seconds",2);case r:return M(q+"Milliseconds",3);default:return this.clone()}},E.endOf=function(y){return this.startOf(y,!1)},E.$set=function(y,b){var T,R=k.p(y),O="set"+(this.$u?"UTC":""),L=(T={},T[d]=O+"Date",T[m]=O+"Date",T[f]=O+"Month",T[u]=O+"FullYear",T[a]=O+"Hours",T[l]=O+"Minutes",T[r]=O+"Seconds",T[o]=O+"Milliseconds",T)[R],M=R===d?this.$D+(b-this.$W):b;if(R===f||R===u){var Q=this.clone().set(m,1);Q.$d[L](M),Q.init(),this.$d=Q.set(m,Math.min(this.$D,Q.daysInMonth())).$d}else L&&this.$d[L](M);return this.init(),this},E.set=function(y,b){return this.clone().$set(y,b)},E.get=function(y){return this[k.p(y)]()},E.add=function(y,b){var T,R=this;y=Number(y);var O=k.p(b),L=function(Y){var W=x(R);return k.w(W.date(W.date()+Math.round(Y*y)),R)};if(O===f)return this.set(f,this.$M+y);if(O===u)return this.set(u,this.$y+y);if(O===d)return L(1);if(O===h)return L(7);var M=(T={},T[l]=n,T[a]=s,T[r]=t,T)[O]||1,Q=this.$d.getTime()+y*M;return k.w(Q,this)},E.subtract=function(y,b){return this.add(-1*y,b)},E.format=function(y){var b=this,T=this.$locale();if(!this.isValid())return T.invalidDate||w;var R=y||"YYYY-MM-DDTHH:mm:ssZ",O=k.z(this),L=this.$H,M=this.$m,Q=this.$M,Y=T.weekdays,W=T.months,q=T.meridiem,Z=function(se,pe,ve,V){return se&&(se[pe]||se(b,R))||ve[pe].slice(0,V)},oe=function(se){return k.s(L%12||12,se,"0")},ne=q||function(se,pe,ve){var V=se<12?"AM":"PM";return ve?V.toLowerCase():V};return R.replace(C,(function(se,pe){return pe||(function(ve){switch(ve){case"YY":return String(b.$y).slice(-2);case"YYYY":return k.s(b.$y,4,"0");case"M":return Q+1;case"MM":return k.s(Q+1,2,"0");case"MMM":return Z(T.monthsShort,Q,W,3);case"MMMM":return Z(W,Q);case"D":return b.$D;case"DD":return k.s(b.$D,2,"0");case"d":return String(b.$W);case"dd":return Z(T.weekdaysMin,b.$W,Y,2);case"ddd":return Z(T.weekdaysShort,b.$W,Y,3);case"dddd":return Y[b.$W];case"H":return String(L);case"HH":return k.s(L,2,"0");case"h":return oe(1);case"hh":return oe(2);case"a":return ne(L,M,!0);case"A":return ne(L,M,!1);case"m":return String(M);case"mm":return k.s(M,2,"0");case"s":return String(b.$s);case"ss":return k.s(b.$s,2,"0");case"SSS":return k.s(b.$ms,3,"0");case"Z":return O}return null})(se)||O.replace(":","")}))},E.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},E.diff=function(y,b,T){var R,O=this,L=k.p(b),M=x(y),Q=(M.utcOffset()-this.utcOffset())*n,Y=this-M,W=function(){return k.m(O,M)};switch(L){case u:R=W()/12;break;case f:R=W();break;case p:R=W()/3;break;case h:R=(Y-Q)/6048e5;break;case d:R=(Y-Q)/864e5;break;case a:R=Y/s;break;case l:R=Y/n;break;case r:R=Y/t;break;default:R=Y}return T?R:k.a(R)},E.daysInMonth=function(){return this.endOf(f).$D},E.$locale=function(){return I[this.$L]},E.locale=function(y,b){if(!y)return this.$L;var T=this.clone(),R=P(y,b,!0);return R&&(T.$L=R),T},E.clone=function(){return k.w(this.$d,this)},E.toDate=function(){return new Date(this.valueOf())},E.toJSON=function(){return this.isValid()?this.toISOString():null},E.toISOString=function(){return this.$d.toISOString()},E.toString=function(){return this.$d.toUTCString()},F})(),G=_.prototype;return x.prototype=G,[["$ms",o],["$s",r],["$m",l],["$H",a],["$W",d],["$M",f],["$y",u],["$D",m]].forEach((function(F){G[F[1]]=function(E){return this.$g(E,F[0],F[1])}})),x.extend=function(F,E){return F.$i||(F(E,_,x),F.$i=!0),x},x.locale=P,x.isDayjs=g,x.unix=function(F){return x(1e3*F)},x.en=I[N],x.Ls=I,x.p={},x}))})(cn)),cn.exports}var SC=hl();const ze=Gt(SC);var dn={exports:{}},TC=dn.exports,ul;function MC(){return ul||(ul=1,(function(i,e){(function(t,n){i.exports=n(hl())})(TC,(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,l){return l==="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,l){var a=100*r+l;return a<600?"凌晨":a<900?"早上":a<1100?"上午":a<1300?"中午":a<1800?"下午":"晚上"}};return s.default.locale(o,null,!0),o}))})(dn)),dn.exports}MC();var hn={exports:{}},DC=hn.exports,fl;function kC(){return fl||(fl=1,(function(i,e){(function(t,n){i.exports=n()})(DC,(function(){return function(t,n,s){var o=n.prototype,r=function(f){return f&&(f.indexOf?f:f.s)},l=function(f,p,u,m,w){var A=f.name?f:f.$locale(),C=r(A[p]),v=r(A[u]),S=C||v.map((function(N){return N.slice(0,m)}));if(!w)return S;var D=A.weekStart;return S.map((function(N,I){return S[(I+(D||0))%7]}))},a=function(){return s.Ls[s.locale()]},d=function(f,p){return f.formats[p]||(function(u){return u.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,w,A){return w||A.slice(1)}))})(f.formats[p.toUpperCase()])},h=function(){var f=this;return{months:function(p){return p?p.format("MMMM"):l(f,"months")},monthsShort:function(p){return p?p.format("MMM"):l(f,"monthsShort","months",3)},firstDayOfWeek:function(){return f.$locale().weekStart||0},weekdays:function(p){return p?p.format("dddd"):l(f,"weekdays")},weekdaysMin:function(p){return p?p.format("dd"):l(f,"weekdaysMin","weekdays",2)},weekdaysShort:function(p){return p?p.format("ddd"):l(f,"weekdaysShort","weekdays",3)},longDateFormat:function(p){return d(f.$locale(),p)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return h.bind(this)()},s.localeData=function(){var f=a();return{firstDayOfWeek:function(){return f.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 d(f,p)},meridiem:f.meridiem,ordinal:f.ordinal}},s.months=function(){return l(a(),"months")},s.monthsShort=function(){return l(a(),"monthsShort","months",3)},s.weekdays=function(f){return l(a(),"weekdays",null,null,f)},s.weekdaysShort=function(f){return l(a(),"weekdaysShort","weekdays",3,f)},s.weekdaysMin=function(f){return l(a(),"weekdaysMin","weekdays",2,f)}}}))})(hn)),hn.exports}var PC=kC();const FC=Gt(PC);var un={exports:{}},RC=un.exports,pl;function OC(){return pl||(pl=1,(function(i,e){(function(t,n){i.exports=n()})(RC,(function(){return function(t,n){n.prototype.weekday=function(s){var o=this.$locale().weekStart||0,r=this.$W,l=(r<o?r+7:r)-o;return this.$utils().u(s)?l:this.subtract(l,"day").add(s,"day")}}}))})(un)),un.exports}var LC=OC();const NC=Gt(LC);var fn={exports:{}},_C=fn.exports,gl;function UC(){return gl||(gl=1,(function(i,e){(function(t,n){i.exports=n()})(_C,(function(){var t="week",n="year";return function(s,o,r){var l=o.prototype;l.week=function(a){if(a===void 0&&(a=null),a!==null)return this.add(7*(a-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=r(this).startOf(n).add(1,n).date(d),f=r(this).endOf(t);if(h.isBefore(f))return 1}var p=r(this).startOf(n).date(d).startOf(t).subtract(1,"millisecond"),u=this.diff(p,t,!0);return u<0?r(this).startOf("week").week():Math.ceil(u)},l.weeks=function(a){return a===void 0&&(a=null),this.week(a)}}}))})(fn)),fn.exports}var QC=UC();const GC=Gt(QC);var pn={exports:{}},HC=pn.exports,ml;function YC(){return ml||(ml=1,(function(i,e){(function(t,n){i.exports=n()})(HC,(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?/,l=/\d*[^-_:/,()\s\d]+/,a={},d=function(A){return(A=+A)+(A>68?1900:2e3)},h=function(A){return function(C){this[A]=+C}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(A){(this.zone||(this.zone={})).offset=(function(C){if(!C||C==="Z")return 0;var v=C.match(/([+-]|\d\d)/g),S=60*v[1]+(+v[2]||0);return S===0?0:v[0]==="+"?-S:S})(A)}],p=function(A){var C=a[A];return C&&(C.indexOf?C:C.s.concat(C.f))},u=function(A,C){var v,S=a.meridiem;if(S){for(var D=1;D<=24;D+=1)if(A.indexOf(S(D,0,C))>-1){v=D>12;break}}else v=A===(C?"pm":"PM");return v},m={A:[l,function(A){this.afternoon=u(A,!1)}],a:[l,function(A){this.afternoon=u(A,!0)}],Q:[s,function(A){this.month=3*(A-1)+1}],S:[s,function(A){this.milliseconds=100*+A}],SS:[o,function(A){this.milliseconds=10*+A}],SSS:[/\d{3}/,function(A){this.milliseconds=+A}],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:[l,function(A){var C=a.ordinal,v=A.match(/\d+/);if(this.day=v[0],C)for(var S=1;S<=31;S+=1)C(S).replace(/\[|\]/g,"")===A&&(this.day=S)}],w:[r,h("week")],ww:[o,h("week")],M:[r,h("month")],MM:[o,h("month")],MMM:[l,function(A){var C=p("months"),v=(p("monthsShort")||C.map((function(S){return S.slice(0,3)}))).indexOf(A)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[l,function(A){var C=p("months").indexOf(A)+1;if(C<1)throw new Error;this.month=C%12||C}],Y:[/[+-]?\d+/,h("year")],YY:[o,function(A){this.year=d(A)}],YYYY:[/\d{4}/,h("year")],Z:f,ZZ:f};function w(A){var C,v;C=A,v=a&&a.formats;for(var S=(A=C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,k,_){var G=_&&_.toUpperCase();return k||v[_]||t[_]||v[G].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(F,E,y){return E||y.slice(1)}))}))).match(n),D=S.length,N=0;N<D;N+=1){var I=S[N],B=m[I],g=B&&B[0],P=B&&B[1];S[N]=P?{regex:g,parser:P}:I.replace(/^\[|\]$/g,"")}return function(x){for(var k={},_=0,G=0;_<D;_+=1){var F=S[_];if(typeof F=="string")G+=F.length;else{var E=F.regex,y=F.parser,b=x.slice(G),T=E.exec(b)[0];y.call(k,T),x=x.replace(T,"")}}return(function(R){var O=R.afternoon;if(O!==void 0){var L=R.hours;O?L<12&&(R.hours+=12):L===12&&(R.hours=0),delete R.afternoon}})(k),k}}return function(A,C,v){v.p.customParseFormat=!0,A&&A.parseTwoDigitYear&&(d=A.parseTwoDigitYear);var S=C.prototype,D=S.parse;S.parse=function(N){var I=N.date,B=N.utc,g=N.args;this.$u=B;var P=g[1];if(typeof P=="string"){var x=g[2]===!0,k=g[3]===!0,_=x||k,G=g[2];k&&(G=g[2]),a=this.$locale(),!x&&G&&(a=v.Ls[G]),this.$d=(function(b,T,R,O){try{if(["x","X"].indexOf(T)>-1)return new Date((T==="X"?1e3:1)*b);var L=w(T)(b),M=L.year,Q=L.month,Y=L.day,W=L.hours,q=L.minutes,Z=L.seconds,oe=L.milliseconds,ne=L.zone,se=L.week,pe=new Date,ve=Y||(M||Q?1:pe.getDate()),V=M||pe.getFullYear(),j=0;M&&!Q||(j=Q>0?Q-1:pe.getMonth());var te,Ae=W||0,Ce=q||0,Me=Z||0,Le=oe||0;return ne?new Date(Date.UTC(V,j,ve,Ae,Ce,Me,Le+60*ne.offset*1e3)):R?new Date(Date.UTC(V,j,ve,Ae,Ce,Me,Le)):(te=new Date(V,j,ve,Ae,Ce,Me,Le),se&&(te=O(te).week(se).toDate()),te)}catch{return new Date("")}})(I,P,B,v),this.init(),G&&G!==!0&&(this.$L=this.locale(G).$L),_&&I!=this.format(P)&&(this.$d=new Date("")),a={}}else if(P instanceof Array)for(var F=P.length,E=1;E<=F;E+=1){g[1]=P[E-1];var y=v.apply(this,g);if(y.isValid()){this.$d=y.$d,this.$L=y.$L,this.init();break}E===F&&(this.$d=new Date(""))}else D.call(this,N)}}}))})(pn)),pn.exports}var VC=YC();const zC=Gt(VC),WC={class:"setting-panel"},jC={class:"tabs-header"},KC={class:"tab-content"},$C={key:0,class:"section"},XC={class:"setting-item"},qC={class:"setting-item"},JC={class:"setting-item"},ZC={key:1,class:"section"},eE={class:"tabs-header",style:{"margin-bottom":"8px"}},tE={key:0},iE={class:"setting-item column"},nE={class:"setting-item column"},sE={class:"setting-item"},oE={key:1},rE={class:"setting-item column"},aE={class:"setting-item column",style:{"margin-top":"12px","border-top":"1px solid rgba(255,255,255,0.1)","padding-top":"8px"}},lE={class:"search-box"},cE={key:2,class:"section"},dE={class:"setting-item"},hE={key:0,class:"setting-item column"},uE={class:"sub-label"},fE={class:"setting-item"},pE={class:"setting-item"},gE={class:"setting-item column"},mE={class:"setting-item column"},AE={class:"sub-label"},yE={class:"setting-item column"},CE={class:"sub-label"},EE={class:"setting-item column"},wE={class:"sub-label"},bE={class:"setting-item column"},vE={style:{display:"flex",gap:"8px","margin-bottom":"8px"}},IE=["onClick","title"],BE={style:{display:"flex",gap:"8px","align-items":"center"}},xE={key:3,class:"section"},SE={class:"setting-item"},TE={class:"setting-item column"},vi=Oe(c.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}){ze.locale("zh-cn"),ze.extend(FC),ze.extend(NC),ze.extend(GC),ze.extend(zC);const t=ge.Switch,n=ge.Radio.Group,s=ge.Radio,o=ge.Input,r=ge.Slider,l=ge.Select,a=ge.Select.Option,d=ge.DatePicker,h=i,f=e,p=c.inject("leitingMethods"),u=c.computed({get:()=>h.open!==void 0?h.open:h.visible,set:E=>{f("update:visible",E),f("update:open",E)}}),m=c.ref("GIS"),w=c.reactive({globe:!1,terrain:!1,depthTest:!1}),A=c.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"}),C=c.reactive({shadows:!1,shadowDarkness:.7,environmentMap:!1,ambientOcclusion:!1,time:ze("2025-06-22 10:00"),brightness:1.5,contrast:1,saturation:1,backgroundColor:"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)"}),v=c.reactive({collision:!1,habit:0}),S=E=>{E&&(E.globe!==void 0&&(w.globe=E.globe),E.terrain!==void 0&&(w.terrain=E.terrain),E.depthTest!==void 0&&(w.depthTest=E.depthTest),E.mapProvider!==void 0&&(A.provider=E.mapProvider),E.tiandituLayerType!==void 0&&(A.tianditu.layerType=E.tiandituLayerType),E.tiandituShowLabel!==void 0&&(A.tianditu.showLabel=E.tiandituShowLabel),E.arcgisUrl!==void 0&&(A.arcgis.url=E.arcgisUrl),E.shadows!==void 0&&(C.shadows=E.shadows),E.shadowDarkness!==void 0&&(C.shadowDarkness=E.shadowDarkness),E.environmentMap!==void 0&&(C.environmentMap=E.environmentMap),E.ambientOcclusion!==void 0&&(C.ambientOcclusion=E.ambientOcclusion),E.time!==void 0&&(typeof E.time=="number"?C.time=ze().startOf("day").add(E.time,"hour"):C.time=ze(E.time)),E.brightness!==void 0&&(C.brightness=E.brightness),E.contrast!==void 0&&(C.contrast=E.contrast),E.saturation!==void 0&&(C.saturation=E.saturation),E.backgroundColor!==void 0&&(C.backgroundColor=E.backgroundColor),E.collision!==void 0&&(v.collision=E.collision),E.mouseHabit!==void 0&&(v.habit=E.mouseHabit))};c.watch(()=>h.initialConfig,E=>{S(E)},{deep:!0,immediate:!0});const D=["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%)"],N=[{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 E=A.provider,y={};E==="tianditu"?(y.token=A.tianditu.token,y.layerType=A.tianditu.layerType,y.showAnnotation=A.tianditu.showLabel):E==="arcgis"&&(y.url=A.arcgis.url),p.value?.changeBaseMap?.(E,y)};c.watch(()=>A.provider,I),c.watch(()=>A.tianditu.layerType,I),c.watch(()=>A.tianditu.showLabel,I),c.watch(()=>A.tianditu.token,kn(I,1e3)),c.watch(()=>A.arcgis.url,kn(I,1e3)),c.onMounted(()=>{h.tiandituToken&&(A.tianditu.token=h.tiandituToken)}),c.watch(()=>w.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),c.watch(()=>w.terrain,E=>p.value?.setTerrainEnable?.(E)),c.watch(()=>w.depthTest,E=>p.value?.setDepthTestEnable?.(E)),c.watch(()=>p?.value,E=>{if(E){if(E.getConfigure=()=>({globe:w.globe,terrain:w.terrain,depthTest:w.depthTest,mapProvider:A.provider,tiandituLayerType:A.tianditu.layerType,tiandituShowLabel:A.tianditu.showLabel,arcgisUrl:A.arcgis.url,shadows:C.shadows,shadowDarkness:C.shadowDarkness,environmentMap:C.environmentMap,ambientOcclusion:C.ambientOcclusion,time:ze.isDayjs(C.time)?C.time.format("YYYY-MM-DD HH:mm"):C.time,brightness:C.brightness,contrast:C.contrast,saturation:C.saturation,backgroundColor:C.backgroundColor,collision:v.collision,mouseHabit:v.habit}),E.setConfigure=y=>{S(y)},E.setBackgroundColor&&C.backgroundColor&&E.setBackgroundColor(C.backgroundColor),E.setGlobeEnvironmentVisible&&E.setGlobeEnvironmentVisible(w.globe),E.setShadowsEnable&&E.setShadowsEnable(C.shadows),E.setShadowDarkness&&E.setShadowDarkness(C.shadowDarkness),E.setEnvironmentMapEnable&&E.setEnvironmentMapEnable(C.environmentMap),E.setAmbientOcclusion&&E.setAmbientOcclusion(C.ambientOcclusion),E.setTime){const y=ze.isDayjs(C.time)?C.time.toDate():new Date;E.setTime(y)}E.setModelBrightness&&E.setModelBrightness(C.brightness),E.setCollisionDetection&&E.setCollisionDetection(v.collision),E.setMouseHabit&&E.setMouseHabit(v.habit),E.changeBaseMap&&A.baseMap&&E.changeBaseMap(A.baseMap,{token:A.tianditu.token,layerType:A.tianditu.layerType,showAnnotation:A.tianditu.showLabel,url:A.arcgis.url})}},{immediate:!0});const B=c.computed({get:()=>{const E=C.backgroundColor;return/^#[0-9A-Fa-f]{6}$/.test(E)?E:"#ffffff"},set:E=>{C.backgroundColor=E}}),g=c.ref(""),P=c.ref(!1),x=c.ref([]);c.watch(()=>w.globe,E=>p.value?.setGlobeEnvironmentVisible?.(E)),c.watch(()=>w.terrain,E=>p.value?.setTerrainEnable?.(E)),c.watch(()=>A.baseMap,E=>{p.value?.changeBaseMap?.(E,{token:h.tiandituToken})}),c.watch(()=>C.shadows,E=>p.value?.setShadowsEnable?.(E)),c.watch(()=>C.shadowDarkness,E=>p.value?.setShadowDarkness?.(E)),c.watch(()=>C.environmentMap,E=>p.value?.setEnvironmentMapEnable?.(E)),c.watch(()=>C.ambientOcclusion,E=>p.value?.setAmbientOcclusion?.(E)),c.watch(()=>C.time,E=>{const y=ze.isDayjs(E)?E.toDate():new Date;p.value?.setTime?.(y)}),c.watch(()=>[C.brightness,C.contrast,C.saturation],([E,y,b])=>{const T=p.value;T?.setModelColorAdjustment?T.setModelColorAdjustment({brightness:E,contrast:y,saturation:b}):T?.setModelBrightness?.(E)}),c.watch(()=>C.backgroundColor,E=>{if(p.value?.setBackgroundColor)p.value.setBackgroundColor(E);else{const y=document.querySelector(".cesium-viewer");y&&(y.style.background=E)}}),c.watch(()=>v.collision,E=>p.value?.setCollisionDetection?.(E)),c.watch(()=>v.habit,E=>p.value?.setMouseHabit?.(E));const k=E=>{if(E?.pois&&Array.isArray(E.pois)&&E.pois.length>0){const y=E.pois[0],b=y.lonlat.split(/[, ]/).map(Number);if(b.length>=2&&!isNaN(b[0])&&!isNaN(b[1]))return{name:y.name,lon:b[0],lat:b[1],raw:y}}if(E?.area&&E.area.lonlat){const y=E.area,b=y.lonlat.split(/[, ]/).map(Number);if(b.length>=2&&!isNaN(b[0])&&!isNaN(b[1]))return{name:y.name,lon:b[0],lat:b[1],raw:y}}return null},G=kn(async()=>{const E=(g.value||"").trim();if(!E)return;const y=h.tiandituToken||"c25f14fb6bd4397cf8fe45144ff768d6";P.value=!0,x.value=[];try{if(p.value?.searchLocation){const b=await p.value.searchLocation(E,y),T=k(b);T&&(x.value=[T],fe.success(`找到:${T.name||""}`),p.value.flyToLonLatHeight(T.lon,T.lat,5e3))}else{const T=`https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify({keyWord:E,level:12,mapBound:"-180,-90,180,90",queryType:1,start:0,count:10}))}&type=query&tk=${encodeURIComponent(y)}`,R=await fetch(T);if(!R.ok)throw new Error(`HTTP ${R.status}`);const O=await R.json(),L=k(O);L&&(x.value=[L],fe.success(`找到:${L.name||""}`),p.value?.flyToLonLatHeight?.(L.lon,L.lat,5e3))}}catch(b){console.error("tianditu search error",b)}finally{P.value=!1}},800);c.watch(g,()=>{G()});const F=()=>{u.value=!1,f("close")};return c.onMounted(()=>{}),(E,y)=>(c.openBlock(),c.createBlock(Pe,{visible:u.value,title:"设置","full-height":i.fullHeight,onClose:F,"onUpdate:visible":y[26]||(y[26]=b=>u.value=b)},{default:c.withCtx(()=>[c.createElementVNode("div",WC,[c.createElementVNode("div",jC,[c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="GIS"}]),onClick:y[0]||(y[0]=b=>m.value="GIS")},"GIS",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="MAP"}]),onClick:y[1]||(y[1]=b=>m.value="MAP")},"地图",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="RENDER"}]),onClick:y[2]||(y[2]=b=>m.value="RENDER")},"渲染",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:m.value==="MOUSE"}]),onClick:y[3]||(y[3]=b=>m.value="MOUSE")},"鼠标",2)]),c.createElementVNode("div",KC,[m.value==="GIS"?(c.openBlock(),c.createElementBlock("div",$C,[c.createElementVNode("div",XC,[y[27]||(y[27]=c.createElementVNode("span",null,"地球 (含大气/日月/星空)",-1)),c.createVNode(c.unref(t),{checked:w.globe,"onUpdate:checked":y[4]||(y[4]=b=>w.globe=b),size:"small"},null,8,["checked"])]),c.createElementVNode("div",qC,[y[28]||(y[28]=c.createElementVNode("span",null,"地形 (高程)",-1)),c.createVNode(c.unref(t),{checked:w.terrain,"onUpdate:checked":y[5]||(y[5]=b=>w.terrain=b),size:"small"},null,8,["checked"])]),c.createElementVNode("div",JC,[y[29]||(y[29]=c.createElementVNode("span",null,"地形遮挡",-1)),c.createVNode(c.unref(t),{checked:w.depthTest,"onUpdate:checked":y[6]||(y[6]=b=>w.depthTest=b),size:"small"},null,8,["checked"])])])):c.createCommentVNode("",!0),m.value==="MAP"?(c.openBlock(),c.createElementBlock("div",ZC,[c.createElementVNode("div",eE,[c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:A.provider==="tianditu"}]),onClick:y[7]||(y[7]=b=>A.provider="tianditu")},"天地图",2),c.createElementVNode("div",{class:c.normalizeClass(["tab-item",{active:A.provider==="arcgis"}]),onClick:y[8]||(y[8]=b=>A.provider="arcgis")},"ArcGIS",2)]),A.provider==="tianditu"?(c.openBlock(),c.createElementBlock("div",tE,[c.createElementVNode("div",iE,[y[30]||(y[30]=c.createElementVNode("div",{class:"sub-label"},"Token",-1)),c.createVNode(c.unref(o),{value:A.tianditu.token,"onUpdate:value":y[9]||(y[9]=b=>A.tianditu.token=b),size:"small",placeholder:"输入天地图Token"},null,8,["value"])]),c.createElementVNode("div",nE,[y[31]||(y[31]=c.createElementVNode("div",{class:"sub-label"},"地图风格",-1)),c.createVNode(c.unref(l),{value:A.tianditu.layerType,"onUpdate:value":y[10]||(y[10]=b=>A.tianditu.layerType=b),size:"small",style:{width:"100%"}},{default:c.withCtx(()=>[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(N,b=>c.createVNode(c.unref(a),{key:b.value,value:b.value},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(b.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["value"])]),c.createElementVNode("div",sE,[y[32]||(y[32]=c.createElementVNode("span",null,"叠加注记",-1)),c.createVNode(c.unref(t),{checked:A.tianditu.showLabel,"onUpdate:checked":y[11]||(y[11]=b=>A.tianditu.showLabel=b),size:"small"},null,8,["checked"])])])):c.createCommentVNode("",!0),A.provider==="arcgis"?(c.openBlock(),c.createElementBlock("div",oE,[c.createElementVNode("div",rE,[y[33]||(y[33]=c.createElementVNode("div",{class:"sub-label"},"服务地址",-1)),c.createVNode(c.unref(o),{value:A.arcgis.url,"onUpdate:value":y[12]||(y[12]=b=>A.arcgis.url=b),size:"small",placeholder:"输入ArcGIS MapServer地址"},null,8,["value"])])])):c.createCommentVNode("",!0),c.createElementVNode("div",aE,[y[34]||(y[34]=c.createElementVNode("div",{class:"sub-label"},"位置搜索 (天地图)",-1)),c.createElementVNode("div",lE,[c.createVNode(c.unref(o),{value:g.value,"onUpdate:value":y[13]||(y[13]=b=>g.value=b),placeholder:"输入地名搜索",size:"small","allow-clear":""},null,8,["value"])])])])):c.createCommentVNode("",!0),m.value==="RENDER"?(c.openBlock(),c.createElementBlock("div",cE,[c.createElementVNode("div",dE,[y[35]||(y[35]=c.createElementVNode("span",null,"阴影",-1)),c.createVNode(c.unref(t),{checked:C.shadows,"onUpdate:checked":y[14]||(y[14]=b=>C.shadows=b),size:"small"},null,8,["checked"])]),C.shadows?(c.openBlock(),c.createElementBlock("div",hE,[c.createElementVNode("div",uE,"阴影暗度 ("+c.toDisplayString(C.shadowDarkness.toFixed(2))+")",1),c.createVNode(c.unref(r),{value:C.shadowDarkness,"onUpdate:value":y[15]||(y[15]=b=>C.shadowDarkness=b),min:0,max:1,step:.05,size:"small"},null,8,["value"])])):c.createCommentVNode("",!0),c.createElementVNode("div",fE,[y[36]||(y[36]=c.createElementVNode("span",null,"环境贴图 (HDR)",-1)),c.createVNode(c.unref(t),{checked:C.environmentMap,"onUpdate:checked":y[16]||(y[16]=b=>C.environmentMap=b),size:"small"},null,8,["checked"])]),c.createElementVNode("div",pE,[y[37]||(y[37]=c.createElementVNode("span",null,"环境光遮蔽 (AO)",-1)),c.createVNode(c.unref(t),{checked:C.ambientOcclusion,"onUpdate:checked":y[17]||(y[17]=b=>C.ambientOcclusion=b),size:"small"},null,8,["checked"])]),c.createElementVNode("div",gE,[y[38]||(y[38]=c.createElementVNode("div",{class:"sub-label"},"日期时间",-1)),c.createVNode(c.unref(d),{value:C.time,"onUpdate:value":y[18]||(y[18]=b=>C.time=b),"show-time":"",locale:c.unref(cl),format:"YYYY-MM-DD HH:mm",size:"small",style:{width:"100%"}},null,8,["value","locale"])]),c.createElementVNode("div",mE,[c.createElementVNode("div",AE,"模型亮度 ("+c.toDisplayString(C.brightness.toFixed(1))+")",1),c.createVNode(c.unref(r),{value:C.brightness,"onUpdate:value":y[19]||(y[19]=b=>C.brightness=b),min:0,max:5,step:.1,size:"small"},null,8,["value"])]),c.createElementVNode("div",yE,[c.createElementVNode("div",CE,"模型对比度 ("+c.toDisplayString(C.contrast.toFixed(1))+")",1),c.createVNode(c.unref(r),{value:C.contrast,"onUpdate:value":y[20]||(y[20]=b=>C.contrast=b),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),c.createElementVNode("div",EE,[c.createElementVNode("div",wE,"模型饱和度 ("+c.toDisplayString(C.saturation.toFixed(1))+")",1),c.createVNode(c.unref(r),{value:C.saturation,"onUpdate:value":y[21]||(y[21]=b=>C.saturation=b),min:0,max:3,step:.1,size:"small"},null,8,["value"])]),c.createElementVNode("div",bE,[y[39]||(y[39]=c.createElementVNode("div",{class:"sub-label"},"背景颜色",-1)),c.createElementVNode("div",vE,[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(D,(b,T)=>c.createElementVNode("div",{key:T,style:c.normalizeStyle({background:b,width:"32px",height:"24px",borderRadius:"2px",cursor:"pointer",border:"1px solid #d9d9d9",flexShrink:0}),onClick:R=>C.backgroundColor=b,title:"预设 "+(T+1)},null,12,IE)),64))]),c.createElementVNode("div",BE,[c.withDirectives(c.createElementVNode("input",{type:"color","onUpdate:modelValue":y[22]||(y[22]=b=>B.value=b),style:{width:"40px",height:"24px",padding:"0",border:"1px solid #d9d9d9"}},null,512),[[c.vModelText,B.value]]),c.createVNode(c.unref(o),{value:C.backgroundColor,"onUpdate:value":y[23]||(y[23]=b=>C.backgroundColor=b),size:"small",style:{flex:"1"},placeholder:"CSS 颜色值"},null,8,["value"])])])])):c.createCommentVNode("",!0),m.value==="MOUSE"?(c.openBlock(),c.createElementBlock("div",xE,[c.createElementVNode("div",SE,[y[40]||(y[40]=c.createElementVNode("span",null,"碰撞检测",-1)),c.createVNode(c.unref(t),{checked:v.collision,"onUpdate:checked":y[24]||(y[24]=b=>v.collision=b),size:"small"},null,8,["checked"])]),c.createElementVNode("div",TE,[y[43]||(y[43]=c.createElementVNode("div",{class:"sub-label"},"操作习惯",-1)),c.createVNode(c.unref(n),{value:v.habit,"onUpdate:value":y[25]||(y[25]=b=>v.habit=b),size:"small"},{default:c.withCtx(()=>[c.createVNode(c.unref(s),{value:0},{default:c.withCtx(()=>[...y[41]||(y[41]=[c.createTextVNode("默认 (中键旋转)",-1)])]),_:1}),c.createVNode(c.unref(s),{value:1},{default:c.withCtx(()=>[...y[42]||(y[42]=[c.createTextVNode("习惯1 (左键旋转)",-1)])]),_:1})]),_:1},8,["value"])])])):c.createCommentVNode("",!0)])])]),_:1},8,["visible","full-height"]))}}),[["__scopeId","data-v-79494025"]]),ME={class:"cad-layer-panel"},DE={class:"layer-list-container"},kE={class:"list-header"},PE={class:"col-check"},FE=["checked"],RE={class:"list-body"},OE={class:"col-check"},LE=["checked","onChange"],NE={class:"col-index"},_E=["title"],UE={class:"col-color"},QE=["value"],GE={key:0,class:"empty-text"},HE=Oe(c.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=c.inject("leitingMethods",c.ref({})),o=c.ref(""),r=c.ref([]),l=()=>{s.value&&s.value.getDxfModels&&(r.value=s.value.getDxfModels().map(v=>({modelId:v.modelId,modelName:v.modelName}))||[])},a=c.computed(()=>r.value.map(v=>({value:v.modelId,label:v.modelName}))),d=c.ref([]),h=c.ref([]),f=c.computed(()=>d.value.length>0&&h.value.length===d.value.length),p=({modelId:v})=>{if(d.value=[],h.value=[],s.value&&s.value.getDxfLayers){const S=s.value.getDxfLayers({modelId:v});S&&Object.keys(S).forEach((D,N)=>{S[D].length&&(d.value.push({index:N+1,layerName:D,layerColor:S[D][0].color||"#ffffff",key:D}),h.value.push(D))})}},u=v=>{o.value=v,p({modelId:v})},m=v=>{v.target.checked?h.value=d.value.map(D=>D.key):h.value=[],A()},w=(v,S)=>{S.target.checked?h.value.includes(v)||h.value.push(v):h.value=h.value.filter(N=>N!==v),A()},A=()=>{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 S=Object.keys(v).filter(D=>!h.value.includes(D));s.value.showDxfLayer({modelId:o.value,show:!1,layers:S})}}},C=()=>{n("update:visible",!1),n("handleCloseCardByCadCard")};return c.watch(()=>t.visible,v=>{v&&(l(),t.currentModelId?(o.value=t.currentModelId,p({modelId:t.currentModelId})):a.value.length>0&&(o.value=a.value[0]?.value,p({modelId:o.value})))}),c.watch(()=>t.currentModelId,v=>{v&&t.visible&&(o.value=v,p({modelId:v}))}),(v,S)=>(c.openBlock(),c.createBlock(Pe,{visible:i.visible,title:"CAD图层","onUpdate:visible":S[3]||(S[3]=D=>v.$emit("update:visible",D)),onClose:C,width:360,align:"right","initial-position":{x:0,y:60}},{"header-extra":c.withCtx(()=>[c.createElementVNode("div",{class:"header-select-container",onMousedown:S[2]||(S[2]=c.withModifiers(()=>{},["stop"]))},[S[4]||(S[4]=c.createElementVNode("span",{class:"header-label"},"图纸:",-1)),c.createVNode(c.unref(ge.Select),{value:o.value,"onUpdate:value":S[0]||(S[0]=D=>o.value=D),options:a.value,onChange:S[1]||(S[1]=D=>u(D)),placeholder:"选择模型",style:{width:"140px"},bordered:!1,class:"custom-header-select",popupClassName:"leiting-select-dropdown",size:"small"},null,8,["value","options"])],32)]),default:c.withCtx(()=>[c.createElementVNode("div",ME,[c.createElementVNode("div",DE,[c.createElementVNode("div",kE,[c.createElementVNode("div",PE,[c.createElementVNode("input",{type:"checkbox",checked:f.value,onChange:m},null,40,FE)]),S[5]||(S[5]=c.createElementVNode("div",{class:"col-index"},"序号",-1)),S[6]||(S[6]=c.createElementVNode("div",{class:"col-name"},"图层名称",-1)),S[7]||(S[7]=c.createElementVNode("div",{class:"col-color"},"颜色",-1))]),c.createElementVNode("div",RE,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,D=>(c.openBlock(),c.createElementBlock("div",{key:D.key,class:"list-item"},[c.createElementVNode("div",OE,[c.createElementVNode("input",{type:"checkbox",checked:h.value.includes(D.key),onChange:N=>w(D.key,N)},null,40,LE)]),c.createElementVNode("div",NE,c.toDisplayString(D.index),1),c.createElementVNode("div",{class:"col-name",title:D.layerName},c.toDisplayString(D.layerName),9,_E),c.createElementVNode("div",UE,[c.createElementVNode("input",{type:"color",value:D.layerColor,disabled:""},null,8,QE)])]))),128)),d.value.length===0?(c.openBlock(),c.createElementBlock("div",GE,"暂无数据")):c.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-a4db4977"]]),YE={class:"adjust-panel"},VE={class:"control-panel"},zE={class:"form-item"},WE={class:"radio-group"},jE={class:"form-item"},KE=["title"],$E={class:"param-row"},XE=["step"],qE={class:"param-row"},JE=["step"],ZE={class:"param-row"},ew=["step"],tw={class:"param-row"},iw=["step"],nw={class:"param-row"},sw=["step"],ow={class:"param-row"},rw=["step"],aw={class:"param-row"},lw=["step"],cw={class:"button-grid"},dw={key:1,class:"pick-mode-ui"},hw=["onClick"],uw=["checked"],fw={style:{"font-size":"12px",color:"#aaa","padding-left":"10px"}},pw={class:"param-row"},gw={style:{width:"40px"}},mw=["onUpdate:modelValue"],Aw={class:"param-row"},yw={style:{width:"40px"}},Cw=["onUpdate:modelValue"],Ew={class:"param-row"},ww={style:{width:"40px"}},bw=["onUpdate:modelValue"],vw={class:"list-panel"},Iw={class:"list-header"},Bw={class:"col-check"},xw=["checked"],Sw={class:"list-body"},Tw={class:"col-check"},Mw=["onUpdate:modelValue"],Dw={class:"col-index"},kw=["title"],Pw={class:"col-main"},Fw=["checked","onChange"],Rw={key:0,style:{padding:"10px","text-align":"center",color:"#999"}},Ow=Oe(c.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=c.inject("leitingMethods"),r=c.ref([]),l=c.ref(""),a=c.computed(()=>r.value.length>0&&r.value.every(y=>y.selected)),d=c.ref("param"),h=c.ref("bimPoint1"),f=c.ref(null),p=c.ref("bimPoint1"),u=c.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}}),m=c.ref(1e-6),w=c.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=c.computed(()=>{const y=r.value.find(b=>b.modelId===l.value);return y?y.modelName:""}),C=()=>{s("update:visible",!1)},v=()=>(!f.value&&o?.value?.getViewer&&o?.value?.getCesium&&(f.value=new ll(o.value.getViewer(),o.value.getCesium())),f.value),S=()=>{v()?.clearMarkers(),u.bimPoint1.longitude=void 0,u.bimPoint1.latitude=void 0,u.bimPoint1.height=void 0,u.bimPoint2.longitude=void 0,u.bimPoint2.latitude=void 0,u.bimPoint2.height=void 0},D=y=>{const b=h.value,T=u[b];if(T){T.longitude=y.longitude,T.latitude=y.latitude,T.height=y.height;const R=b==="bimPoint1"?"BIM":"MAP";v()?.addMarker(R,y),fe.success(`${T.type}已添加`)}},N=()=>{v()?.registerPickHandler(y=>{D(y)})},I=()=>{v()?.destroyPickHandler()},B=y=>{d.value=y,y!=="pick"&&s("clearBimPointList")};c.watch(()=>d.value,y=>{y==="pick"?N():I()}),c.onUnmounted(()=>{I()});const g=()=>{if(!o?.value?.getDxfModels)return;const y=o.value.getDxfModels();if(Array.isArray(y)?r.value=y.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(T=>T.modelId===b)?P(b):P(r.value[0].modelId),r.value.forEach(T=>T.selected=!0)}},P=y=>{l.value=y;const b=r.value.find(T=>T.modelId===y);b&&b.formData&&Object.keys(w).forEach(T=>{b.formData[T]!==void 0&&(w[T]=b.formData[T])})},x=(y,b)=>{if(!o?.value?.adjustingModelByCad)return;const T=r.value.find(R=>R.modelId===y);T&&T.tileset&&(T.formData={...T.formData,...b},T.tileset.formData=T.formData,o.value.adjustingModelByCad({...T.formData,tileset:T.tileset}))},k=y=>{if(!l.value)return;const b=w[y];x(l.value,{[y]:b})},_=y=>{const b=r.value.filter(L=>L.selected);if(b.length===0){fe.warning("请先选择要调整的模型");return}const{distance:T,heightDistance:R,rotation:O}=w;b.forEach(L=>{const M={...L.formData};switch(y){case"north":M.latitude+=T;break;case"south":M.latitude-=T;break;case"east":M.longitude+=T;break;case"west":M.longitude-=T;break;case"up":M.height+=R;break;case"down":M.height-=R;break;case"rotateLeft":M.totalRotation=(M.totalRotation||0)-O;break;case"rotateRight":M.totalRotation=(M.totalRotation||0)+O;break}L.modelId===l.value&&Object.assign(w,M),x(L.modelId,M)})},G=y=>{const b=y.target.checked;r.value.forEach(T=>T.selected=b)},F=()=>{s("handleSavingByCadCard",r.value),s("save",r.value)},E=()=>{const y=u.bimPoint1,b=u.bimPoint2;if(y.longitude===void 0||b.longitude===void 0){fe.warning("请先完成点选操作");return}const T=r.value.filter(Q=>Q.selected);if(T.length===0){fe.warning("请先选择要调整的模型");return}let R=0,O=0,L=0;const M=v();if(M){const{dLon:Q,dLat:Y,dHeight:W}=M.calculateOffset(y,b);R=Q,O=Y,L=W}else R=b.longitude-y.longitude,O=b.latitude-y.latitude,L=b.height-y.height;T.forEach(Q=>{const Y={...Q.formData};Y.longitude+=R,Y.latitude+=O,Y.height+=L,Q.modelId===l.value&&Object.assign(w,Y),x(Q.modelId,Y)}),fe.success("位置已调整")};return c.watch(()=>n.visible,y=>{y?g():(I(),S())}),c.onMounted(()=>{n.visible&&g()}),e({setBIMPointsList:({longitude:y,latitude:b,height:T})=>{u[p.value].longitude=y,u[p.value].latitude=b,u[p.value].height=T},addGltfOr3dTilesModelList:y=>{console.warn("addGltfOr3dTilesModelList is deprecated, use internal loading")}}),(y,b)=>(c.openBlock(),c.createBlock(Pe,{visible:n.visible,title:"Cad校准",width:282,height:600,"onUpdate:visible":b[21]||(b[21]=T=>s("update:visible",T)),onClose:C},{default:c.withCtx(()=>[c.createElementVNode("div",YE,[c.createElementVNode("div",VE,[c.createElementVNode("div",zE,[b[22]||(b[22]=c.createElementVNode("label",null,"调整操作:",-1)),c.createElementVNode("div",WE,[c.createElementVNode("span",{class:c.normalizeClass({active:d.value==="param"}),onClick:b[0]||(b[0]=T=>B("param"))},"参数模式",2),c.createElementVNode("span",{class:c.normalizeClass({active:d.value==="pick"}),onClick:b[1]||(b[1]=T=>B("pick"))},"地图点选",2)])]),c.createElementVNode("div",jE,[b[23]||(b[23]=c.createElementVNode("label",null,"当前主模型:",-1)),c.createElementVNode("span",{class:"value",title:A.value},c.toDisplayString(A.value||"未选择"),9,KE)]),b[35]||(b[35]=c.createElementVNode("div",{class:"separator"},null,-1)),d.value==="param"?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[b[31]||(b[31]=c.createElementVNode("div",{class:"group-header"},"当前状态",-1)),c.createElementVNode("div",$E,[b[24]||(b[24]=c.createElementVNode("label",null,"经度(东西):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":b[2]||(b[2]=T=>w.longitude=T),onChange:b[3]||(b[3]=T=>k("longitude")),step:m.value},null,40,XE),[[c.vModelText,w.longitude,void 0,{number:!0}]])]),c.createElementVNode("div",qE,[b[25]||(b[25]=c.createElementVNode("label",null,"纬度(南北):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":b[4]||(b[4]=T=>w.latitude=T),onChange:b[5]||(b[5]=T=>k("latitude")),step:m.value},null,40,JE),[[c.vModelText,w.latitude,void 0,{number:!0}]])]),c.createElementVNode("div",ZE,[b[26]||(b[26]=c.createElementVNode("label",null,"高度(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":b[6]||(b[6]=T=>w.height=T),onChange:b[7]||(b[7]=T=>k("height")),step:m.value},null,40,ew),[[c.vModelText,w.height,void 0,{number:!0}]])]),c.createElementVNode("div",tw,[b[27]||(b[27]=c.createElementVNode("label",null,"累计旋转(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":b[8]||(b[8]=T=>w.totalRotation=T),onChange:b[9]||(b[9]=T=>k("totalRotation")),step:m.value},null,40,iw),[[c.vModelText,w.totalRotation,void 0,{number:!0}]])]),b[32]||(b[32]=c.createElementVNode("div",{class:"separator"},null,-1)),b[33]||(b[33]=c.createElementVNode("div",{class:"group-header"},"调整步长",-1)),c.createElementVNode("div",nw,[b[28]||(b[28]=c.createElementVNode("label",null,"经纬步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":b[10]||(b[10]=T=>w.distance=T),step:m.value},null,8,sw),[[c.vModelText,w.distance,void 0,{number:!0}]])]),c.createElementVNode("div",ow,[b[29]||(b[29]=c.createElementVNode("label",null,"高度步长(m):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":b[11]||(b[11]=T=>w.heightDistance=T),step:m.value},null,8,rw),[[c.vModelText,w.heightDistance,void 0,{number:!0}]])]),c.createElementVNode("div",aw,[b[30]||(b[30]=c.createElementVNode("label",null,"旋转步长(°):",-1)),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":b[12]||(b[12]=T=>w.rotation=T),step:m.value},null,8,lw),[[c.vModelText,w.rotation,void 0,{number:!0}]])]),c.createElementVNode("div",cw,[c.createElementVNode("button",{onClick:b[13]||(b[13]=T=>_("rotateLeft"))},"左转"),c.createElementVNode("button",{onClick:b[14]||(b[14]=T=>_("north"))},"北移"),c.createElementVNode("button",{onClick:b[15]||(b[15]=T=>_("rotateRight"))},"右转"),c.createElementVNode("button",{onClick:b[16]||(b[16]=T=>_("west"))},"西移"),c.createElementVNode("button",{onClick:b[17]||(b[17]=T=>_("south"))},"南移"),c.createElementVNode("button",{onClick:b[18]||(b[18]=T=>_("east"))},"东移"),c.createElementVNode("button",{onClick:b[19]||(b[19]=T=>_("up"))},"上移"),c.createElementVNode("button",{onClick:b[20]||(b[20]=T=>_("down"))},"下移"),c.createElementVNode("button",{onClick:F,class:"primary-btn",style:{"grid-column":"span 3","margin-top":"5px"}},"保存当前位置")])],64)):(c.openBlock(),c.createElementBlock("div",dw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u,(T,R)=>(c.openBlock(),c.createElementBlock("div",{key:R,class:"form-item",style:{display:"block","margin-bottom":"15px"}},[c.createElementVNode("div",{style:{"font-weight":"bold","margin-bottom":"5px",cursor:"pointer",display:"flex","align-items":"center"},onClick:O=>h.value=R},[c.createElementVNode("input",{type:"radio",checked:h.value===R,style:{"margin-right":"5px"}},null,8,uw),c.createTextVNode(" "+c.toDisplayString(T.type)+": ",1)],8,hw),c.createElementVNode("div",fw,[c.createElementVNode("div",pw,[c.createElementVNode("label",gw,c.toDisplayString(T.longitudeText),1),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":O=>T.longitude=O,readonly:"",style:{width:"100px"}},null,8,mw),[[c.vModelText,T.longitude,void 0,{number:!0}]])]),c.createElementVNode("div",Aw,[c.createElementVNode("label",yw,c.toDisplayString(T.latitudeText),1),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":O=>T.latitude=O,readonly:"",style:{width:"100px"}},null,8,Cw),[[c.vModelText,T.latitude,void 0,{number:!0}]])]),c.createElementVNode("div",Ew,[c.createElementVNode("label",ww,c.toDisplayString(T.heightText),1),c.withDirectives(c.createElementVNode("input",{type:"number","onUpdate:modelValue":O=>T.height=O,readonly:"",style:{width:"100px"}},null,8,bw),[[c.vModelText,T.height,void 0,{number:!0}]])])])]))),128)),c.createElementVNode("div",{class:"button-grid",style:{"grid-template-columns":"1fr"}},[c.createElementVNode("button",{onClick:E,class:"primary-btn"},"应用校准"),c.createElementVNode("button",{onClick:F},"保存")]),b[34]||(b[34]=c.createElementVNode("div",{class:"instructions",style:{"margin-top":"15px",color:"#999","font-size":"12px","line-height":"1.5"}},[c.createElementVNode("div",null,"操作指南:"),c.createElementVNode("div",null,"1. 勾选上方 CAD 或 地图 标记点选项。"),c.createElementVNode("div",null,"2. Shift + 左键 点击场景拾取对应坐标。"),c.createElementVNode("div",null,"3. 采集两点后,点击“应用校准”进行校准。")],-1))]))]),c.createElementVNode("div",vw,[c.createElementVNode("div",Iw,[c.createElementVNode("div",Bw,[c.createElementVNode("input",{type:"checkbox",checked:a.value,onChange:G},null,40,xw)]),b[36]||(b[36]=c.createElementVNode("div",{class:"col-index"},"序号",-1)),b[37]||(b[37]=c.createElementVNode("div",{class:"col-name"},"名称",-1)),b[38]||(b[38]=c.createElementVNode("div",{class:"col-main"},"主模型",-1))]),c.createElementVNode("div",Sw,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(T,R)=>(c.openBlock(),c.createElementBlock("div",{key:T.modelId,class:c.normalizeClass(["list-item",{active:T.modelId===l.value}])},[c.createElementVNode("div",Tw,[c.withDirectives(c.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":O=>T.selected=O},null,8,Mw),[[c.vModelCheckbox,T.selected]])]),c.createElementVNode("div",Dw,c.toDisplayString(R+1),1),c.createElementVNode("div",{class:"col-name",title:T.modelName},c.toDisplayString(T.modelName),9,kw),c.createElementVNode("div",Pw,[c.createElementVNode("input",{type:"radio",name:"mainModel",checked:T.modelId===l.value,onChange:O=>P(T.modelId)},null,40,Fw)])],2))),128)),r.value.length===0?(c.openBlock(),c.createElementBlock("div",Rw,"暂无数据")):c.createCommentVNode("",!0)])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-e8abd49d"]]),Lw={class:"annotation-content"},Nw={class:"annotation-tools"},_w={class:"annotation-controls"},Uw={class:"control-group",title:"颜色"},Qw={class:"tool-item color-tool"},Gw={class:"control-group line-width-container",title:"线宽"},Hw=["onClick"],Yw={class:"option-label"},Vw=Oe(c.defineComponent({__name:"LeitingAnnotationCard",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(i,{emit:e}){const t=i,n=e,s=c.inject("leitingMethods"),o=c.ref(""),r=c.ref("#ff0000"),l=c.ref(1),a=c.ref(!1),d=c.ref(null),h=c.ref(null),f=c.ref({top:"0px",left:"0px"}),p=[{value:6,label:"粗"},{value:3,label:"中"},{value:1,label:"细"}],u=()=>s?.value?.getAnnotationInstance?s.value.getAnnotationInstance():null,m=()=>{n("update:visible",!1)},w=B=>{o.value=B;const g=u();if(g)switch(B){case"freehandLine":g.startFreehandLine();break;case"arrow":g.startArrow();break;case"straightLine":g.startStraightLine();break;case"rectangle":g.startRectangle();break;case"ellipse":g.startEllipse();break}},A=()=>{const B=u();B&&(B.setCurrentColor(r.value),B.changeColor(r.value))},C=()=>{if(!a.value&&d.value){const B=d.value.getBoundingClientRect();f.value={top:`${B.top}px`,left:`${B.right+8}px`}}a.value=!a.value},v=B=>{l.value=B,a.value=!1;const g=u();g&&(g.setCurrentWidth(B),g.changeWidth(B))},S=()=>{const B=u();B&&B.deleteSelectedEntity()},D=()=>{const B=u();B&&B.clearAll()},N=()=>{if(s?.value?.saveAnnotations){s.value.saveAnnotations();return}const B=u();B&&B.saveAnnotations()},I=B=>{const g=B.target,P=d.value&&d.value.contains(g),x=h.value&&h.value.contains(g);!P&&!x&&(a.value=!1)};return c.onMounted(()=>{document.addEventListener("click",I)}),c.onUnmounted(()=>{document.removeEventListener("click",I)}),(B,g)=>(c.openBlock(),c.createBlock(Pe,{visible:t.visible,title:"标注",width:70,"min-width":70,height:480,"onUpdate:visible":g[6]||(g[6]=P=>n("update:visible",P)),onClose:m},{default:c.withCtx(()=>[c.createElementVNode("div",Lw,[c.createElementVNode("div",Nw,[c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="freehandLine"}]),onClick:g[0]||(g[0]=P=>w("freehandLine")),title:"手绘线"},[...g[7]||(g[7]=[c.createElementVNode("div",{class:"tool-icon"},"✏️",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="arrow"}]),onClick:g[1]||(g[1]=P=>w("arrow")),title:"箭头"},[...g[8]||(g[8]=[c.createElementVNode("div",{class:"tool-icon"},"↗️",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="straightLine"}]),onClick:g[2]||(g[2]=P=>w("straightLine")),title:"直线"},[...g[9]||(g[9]=[c.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="rectangle"}]),onClick:g[3]||(g[3]=P=>w("rectangle")),title:"矩形"},[...g[10]||(g[10]=[c.createElementVNode("div",{class:"tool-icon"},"▭",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:o.value==="ellipse"}]),onClick:g[4]||(g[4]=P=>w("ellipse")),title:"椭圆"},[...g[11]||(g[11]=[c.createElementVNode("div",{class:"tool-icon"},"⭕",-1)])],2)]),g[13]||(g[13]=c.createElementVNode("div",{class:"separator"},null,-1)),c.createElementVNode("div",_w,[c.createElementVNode("div",Uw,[c.createElementVNode("div",Qw,[c.createElementVNode("div",{class:"color-swatch",style:c.normalizeStyle({backgroundColor:r.value})},null,4),c.withDirectives(c.createElementVNode("input",{type:"color","onUpdate:modelValue":g[5]||(g[5]=P=>r.value=P),onChange:A,class:"color-input-overlay"},null,544),[[c.vModelText,r.value]])])]),c.createElementVNode("div",Gw,[c.createElementVNode("div",{ref_key:"lineWidthBtnRef",ref:d,class:"tool-item",onClick:c.withModifiers(C,["stop"])},[c.createElementVNode("div",{class:"current-width-preview",style:c.normalizeStyle({height:l.value+"px",backgroundColor:"#fff"})},null,4)],512),(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[a.value?(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"line-width-dropdown",style:c.normalizeStyle(f.value)},[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(p,P=>c.createElementVNode("div",{key:P.value,class:c.normalizeClass(["line-width-option",{selected:l.value===P.value}]),onClick:c.withModifiers(x=>v(P.value),["stop"])},[c.createElementVNode("span",Yw,c.toDisplayString(P.label),1),c.createElementVNode("div",{class:"line-preview",style:c.normalizeStyle({height:P.value+"px",backgroundColor:l.value===P.value?"#1890ff":"#ddd"})},null,4)],10,Hw)),64))],4)):c.createCommentVNode("",!0)]))]),g[12]||(g[12]=c.createElementVNode("div",{class:"separator"},null,-1)),c.createElementVNode("div",{class:"action-buttons"},[c.createElementVNode("button",{class:"control-btn",onClick:S,title:"删除选中"}," 🗑️ "),c.createElementVNode("button",{class:"control-btn",onClick:D,title:"清空"}," ❌ "),c.createElementVNode("button",{class:"control-btn",onClick:N,title:"保存"}," 💾 ")])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-3cfc8415"]]),zw={class:"measure-content"},Ww={class:"measure-tools"},jw={key:0,class:"measure-results"},Kw={class:"result-row"},$w={class:"result-value"},Xw={class:"result-row"},qw={class:"result-value"},Jw={class:"result-row"},Zw={class:"result-value"},eb={class:"result-row"},tb={class:"result-value"},ib={key:1,class:"result-row"},nb={class:"result-value"},sb={key:2,class:"result-row"},ob={class:"result-value"},rb={class:"measure-controls"},ab={class:"control-group",title:"单位"},lb={class:"unit-display"},cb=["onClick"],db=Oe(c.defineComponent({__name:"LeitingMeasurement",props:{visible:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(i,{emit:e}){const t=i,n=e,s=c.inject("leitingMethods",c.ref({})),o=c.ref(null),r=c.ref(null),l=c.ref("m"),a=c.ref(!1),d=c.ref(null),h=c.ref(!1),f=c.ref({}),p=c.ref(null),u=[{label:"米 (m)",value:"m"},{label:"厘米 (cm)",value:"cm"},{label:"毫米 (mm)",value:"mm"}],m=B=>{const g=l.value;return g==="mm"?`${(B*1e3).toFixed(0)}mm`:g==="cm"?`${(B*100).toFixed(1)}cm`:`${B.toFixed(2)}m`},w=B=>B>1e6?`${(B/1e6).toFixed(2)} km²`:`${B.toFixed(2)} m²`,A=()=>{if(!o.value&&s.value?.getViewer){const B=s.value.getViewer(),g=s.value.getCesium();B&&g&&(o.value=new il({viewer:B,cesium:g}),o.value.setUnit(l.value),o.value.setSnapping(a.value),o.value.onMeasure=P=>{d.value=P})}},C=B=>{o.value||A(),r.value===B?(r.value=null,o.value?.stop()):(r.value=B,o.value?.start(B))},v=B=>{l.value=B,h.value=!1},S=()=>{o.value&&(o.value.clearAll(),r.value=null,o.value.stop())},D=()=>{n("update:visible",!1)},N=B=>{if(h.value){h.value=!1;return}const P=B.currentTarget.getBoundingClientRect();f.value={position:"fixed",top:`${P.top}px`,left:`${P.right+5}px`,zIndex:3e3},h.value=!0},I=B=>{h.value&&p.value&&!p.value.contains(B.target)&&(h.value=!1)};return c.onMounted(()=>{document.addEventListener("click",I),t.visible&&c.nextTick(()=>A())}),c.onUnmounted(()=>{document.removeEventListener("click",I),o.value&&o.value.destroy()}),c.watch(()=>t.visible,B=>{B?c.nextTick(()=>A()):o.value&&(o.value.stop(),r.value=null)}),c.watch(s,B=>{B&&B.getViewer&&!o.value&&t.visible&&A()}),c.watch(l,B=>{o.value&&o.value.setUnit(B)}),(B,g)=>(c.openBlock(),c.createBlock(Pe,{visible:t.visible,title:"量算",width:70,"min-width":70,height:480,"onUpdate:visible":g[3]||(g[3]=P=>n("update:visible",P)),onClose:D},{default:c.withCtx(()=>[c.createElementVNode("div",zw,[c.createElementVNode("div",Ww,[c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:r.value==="distance"}]),onClick:g[0]||(g[0]=P=>C("distance")),title:"距离测量"},[...g[4]||(g[4]=[c.createElementVNode("div",{class:"tool-icon"},"📏",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:r.value==="angle"}]),onClick:g[1]||(g[1]=P=>C("angle")),title:"角度测量"},[...g[5]||(g[5]=[c.createElementVNode("div",{class:"tool-icon"},"📐",-1)])],2),c.createElementVNode("div",{class:c.normalizeClass(["tool-item",{active:r.value==="area"}]),onClick:g[2]||(g[2]=P=>C("area")),title:"面积测量"},[...g[6]||(g[6]=[c.createElementVNode("div",{class:"tool-icon"},"🔳",-1)])],2)]),g[15]||(g[15]=c.createElementVNode("div",{class:"separator"},null,-1)),d.value?(c.openBlock(),c.createElementBlock("div",jw,[d.value.type==="distance"?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createElementVNode("div",Kw,[g[7]||(g[7]=c.createElementVNode("span",{class:"result-label"},"总长:",-1)),c.createElementVNode("span",$w,c.toDisplayString(m(d.value.dist)),1)]),c.createElementVNode("div",Xw,[g[8]||(g[8]=c.createElementVNode("span",{class:"result-label",style:{color:"#ff4d4f"}},"ΔX:",-1)),c.createElementVNode("span",qw,c.toDisplayString(m(d.value.dx)),1)]),c.createElementVNode("div",Jw,[g[9]||(g[9]=c.createElementVNode("span",{class:"result-label",style:{color:"#52c41a"}},"ΔY:",-1)),c.createElementVNode("span",Zw,c.toDisplayString(m(d.value.dy)),1)]),c.createElementVNode("div",eb,[g[10]||(g[10]=c.createElementVNode("span",{class:"result-label",style:{color:"#1890ff"}},"ΔZ:",-1)),c.createElementVNode("span",tb,c.toDisplayString(m(d.value.dz)),1)])],64)):c.createCommentVNode("",!0),d.value.type==="angle"?(c.openBlock(),c.createElementBlock("div",ib,[g[11]||(g[11]=c.createElementVNode("span",{class:"result-label"},"角度:",-1)),c.createElementVNode("span",nb,c.toDisplayString(d.value.angle.toFixed(1))+"°",1)])):c.createCommentVNode("",!0),d.value.type==="area"?(c.openBlock(),c.createElementBlock("div",sb,[g[12]||(g[12]=c.createElementVNode("span",{class:"result-label"},"面积:",-1)),c.createElementVNode("span",ob,c.toDisplayString(w(d.value.area)),1)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("div",rb,[c.createElementVNode("div",ab,[c.createElementVNode("div",{class:"tool-item",onClick:c.withModifiers(N,["stop"])},[c.createElementVNode("div",lb,c.toDisplayString(l.value),1)]),(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[h.value?(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"unitDropdownRef",ref:p,class:"unit-dropdown",style:c.normalizeStyle(f.value)},[(c.openBlock(),c.createElementBlock(c.Fragment,null,c.renderList(u,P=>c.createElementVNode("div",{key:P.value,class:c.normalizeClass(["unit-option",{selected:l.value===P.value}]),onClick:c.withModifiers(x=>v(P.value),["stop"])},c.toDisplayString(P.label),11,cb)),64))],4)):c.createCommentVNode("",!0)]))]),g[14]||(g[14]=c.createElementVNode("div",{class:"separator"},null,-1)),c.createElementVNode("div",{class:"action-buttons"},[c.createElementVNode("div",{class:"tool-item control-btn",onClick:S,title:"清空"},[...g[13]||(g[13]=[c.createElementVNode("div",{class:"tool-icon"},"🗑️",-1)])])])])])]),_:1},8,["visible"]))}}),[["__scopeId","data-v-b766acb4"]]);function hb(){const i=c.ref(!1),e=c.reactive({x:0,y:0}),t=c.ref([]),n=c.ref(null);return{visible:i,position:e,items:t,contextData:n,show:(a,d,h)=>{a instanceof MouseEvent?(a.preventDefault(),e.x=a.clientX,e.y=a.clientY):(e.x=a.x,e.y=a.y),t.value=d,n.value=h,i.value=!0},hide:()=>{i.value=!1},addItem:a=>{t.value.push(a)},removeItem:a=>{t.value=t.value.filter(d=>d.id!==a)}}}const ub=["onClick"],fb={class:"menu-label"},pb={key:0,class:"menu-arrow"},gb=Oe(c.defineComponent({__name:"LeitingContextMenu",props:{visible:{type:Boolean},position:{},items:{}},emits:["update:visible","action"],setup(i,{emit:e}){const t=i,n=e,s=r=>{r.disabled||(r.action&&r.action(),n("action",r),n("update:visible",!1))},o=()=>{t.visible&&n("update:visible",!1)};return c.onMounted(()=>{document.addEventListener("click",o),document.addEventListener("contextmenu",r=>{r.target.closest(".leiting-context-menu")||o()})}),c.onUnmounted(()=>{document.removeEventListener("click",o)}),(r,l)=>c.withDirectives((c.openBlock(),c.createElementBlock("div",{class:"leiting-context-menu",style:c.normalizeStyle({left:i.position.x+"px",top:i.position.y+"px"}),onContextmenu:l[0]||(l[0]=c.withModifiers(()=>{},["prevent"]))},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.items,a=>(c.openBlock(),c.createElementBlock("div",{key:a.id,class:c.normalizeClass(["menu-item",{"menu-divided":a.divided,"menu-disabled":a.disabled}]),onClick:d=>s(a)},[c.createElementVNode("span",fb,c.toDisplayString(a.label),1),a.children?(c.openBlock(),c.createElementBlock("span",pb,"▶")):c.createCommentVNode("",!0)],10,ub))),128))],36)),[[c.vShow,i.visible]])}}),[["__scopeId","data-v-f288753b"]]),gn=Oe(c.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=c.ref(),s=c.ref(),o=c.getCurrentInstance(),r=c.ref(!1),l=c.ref(""),a=c.ref({}),d=c.ref("3d"),h=i,f={title:"构件树",treeData:[]},p=c.ref(!1),u=c.ref(!1),m=c.ref(!1),w=c.ref(!1),A=c.ref(!1),C=c.ref(!1),v=c.ref(!1),S=c.ref(!1),D=c.ref(!1),N=c.ref(!1),{visible:I,position:B,items:g,show:P,hide:x}=hb(),k=c.ref([]),_=V=>{k.value.push(V)},G=V=>{k.value=k.value.filter(j=>j.id!==V)},F=c.ref([]),E=c.ref(""),y=c.ref(null),b=c.ref([]),T=c.reactive({tree:!1,section:!1,roam:!1,info:!1,adjustModel:!1,setting:!1,cadLayer:!1,cadPosition:!1,annotation:!1}),R=(V,j)=>{V==="componentTree"&&(V="tree"),V==="componentInfo"&&(V="info"),V in T&&(T[V]=j)},O=c.shallowRef({});c.provide("leitingMethods",O);const L=c.ref(h.showMenu),M=c.ref([]);c.watch(()=>h.showMenu,V=>{L.value=V},{immediate:!0}),c.watch(()=>h.mode,V=>{V&&O.value?.set2d&&O.value.set2d(V==="2d")});const Q=c.ref("dark");c.provide("leiting-theme",Q);const Y=c.ref(h.teleportTarget);c.watch(()=>h.teleportTarget,V=>{Y.value=V});const W=c.ref([]),q=c.computed(()=>{const V=[];return p.value&&(V.push("tree"),V.push("componentTree")),u.value&&V.push("section"),m.value&&V.push("roam"),w.value&&(V.push("info"),V.push("componentInfo")),A.value&&V.push("adjust"),C.value&&V.push("setting"),v.value&&V.push("cadLayer"),S.value&&V.push("cadPosition"),D.value&&V.push("annotation"),N.value&&(V.push("measure"),V.push("measurement")),V.push(...W.value),V}),Z=c.ref(null),oe=(V,j)=>{V==="componentTree"||V==="tree"?p.value=j:V==="section"?u.value=j:V==="roam"?m.value=j:V==="componentInfo"||V==="info"?w.value=j:V==="homeView"?O.value?.is2dMode?.()?O.value?.flyToTopView?.({}):O.value?.getBIMmodelId()?O.value?.flyToTileset?.({}):O.value?.getCadModelId()&&O.value?.flyToTopView?.({}):V==="adjustModel"?(A.value=j,j&&Z.value&&Z.value.setModelType("BIM")):V==="osgbAdjust"?(A.value=j,j&&Z.value&&Z.value.setModelType("OSGB")):V==="setting"?C.value=j:V==="cadLayer"?v.value=j:V==="cadPosition"?S.value=j:V==="annotation"?D.value=j:V==="measurement"?N.value=j:j?W.value.includes(V)||W.value.push(V):W.value=W.value.filter(te=>te!==V)};c.watch(p,async V=>{if(V&&O.value?.loadTreeForModel&&O.value?.getMapTileset){const j=O.value.getMapTileset(),te=Object.values(j).map(async Ae=>{if(Ae.leiting&&Ae.leiting.model?.treeUrl){const Ce=Ae.leiting.model.modelId;try{Ae.leiting?.node?.batchIdEIDInfos||await O.value.loadNodeDetailsForModel(Ce);const Me=await O.value.loadTreeForModel(Ce);Me&&(Array.isArray(Me)?Me:[Me]).forEach(Ne=>{Ne&&!b.value.find(st=>st.id===Ne.id)&&(Ne.modelId=Ce,b.value=[...b.value,Ne])})}catch(Me){console.warn(`Failed to lazy load tree for ${Ce}`,Me)}}});await Promise.all(te)}});const ne=()=>{O.value&&(O.value.getDxfModels&&(F.value=O.value.getDxfModels()||[]),O.value.getCadModelId&&(E.value=O.value.getCadModelId()||""))};let se;c.watch(v,V=>{V&&ne()}),c.watch(S,V=>{V&&(ne(),y.value&&F.value.length&&y.value.addGltfOr3dTilesModelList(F.value))});const pe=t,ve=V=>{O.value&&O.value.saveCadCalibration&&O.value.saveCadCalibration(V),O.value&&O.value.saveCadRegion&&O.value.saveCadRegion(V)};return c.onMounted(async()=>{if(s.value&&fe.setContainer(s.value),!!n.value)try{const V={...mt,cesiumUrl:h.cesiumUrl||mt.cesiumUrl,cesiumCssUrl:h.cesiumCssUrl||mt.cesiumCssUrl,accessToken:h.accessToken||wn()||mt.accessToken};await En(V);const j=h.accessToken||wn()||mt.accessToken;j&&(Cesium.Ion.defaultAccessToken=j),r.value=!0,se=async(Ae={},Ce)=>{if(n.value){const{showMenu:Me,showTree:Le,globe:Ne,terrain:st,depthTest:mn,mapProvider:Ii,tiandituLayerType:jt,tiandituShowLabel:ks,arcgisUrl:yb,shadows:Cb,environmentMap:Eb,ambientOcclusion:wb,time:bb,brightness:vb,backgroundColor:Ib,collision:Bb,mouseHabit:xb,heightBasedZoom:Sb,mode:yl,...Ze}=Ae||{},Tb=h.showMenu!==void 0?h.showMenu:Me!==void 0?Me:!0;L.value=Tb;const De=(X,Ee,We)=>X!==void 0?X:Ee!==void 0?Ee:We,Cl=De(h.globe,Ne,!1),El=De(h.terrain,st,!1),wl=De(h.depthTest,mn,!1),bl=De(h.mapProvider,Ii,"tianditu"),vl=De(h.tiandituLayerType,jt,"img_w"),Il=De(h.tiandituShowLabel,ks,!1),Bl=De(h.arcgisUrl,yb,"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"),xl=De(h.shadows,Cb,!1),Sl=De(h.environmentMap,Eb,!1),Tl=De(h.ambientOcclusion,wb,!1),Ml=De(h.time,bb,void 0),Dl=De(h.brightness,vb,1),An=h.mode||yl||"3d";console.log("LeitingBIM Mode:",An,"Props:",h.mode,"Options:",yl),d.value=An;const Mb=An==="2d"?"#000000":"linear-gradient(0deg, rgb(238, 247, 255) 0%, rgb(178, 218, 244) 70%, rgb(141, 190, 221) 100%)",kl=De(h.backgroundColor,Ib,Mb),Pl=De(h.collision,Bb,!1),Fl=De(h.mouseHabit,xb,0),Rl=De(h.heightBasedZoom,Sb,!1);a.value={globe:Cl,terrain:El,depthTest:wl,mapProvider:bl,tiandituLayerType:vl,tiandituShowLabel:Il,arcgisUrl:Bl,shadows:xl,environmentMap:Sl,ambientOcclusion:Tl,time:Ml,brightness:Dl,backgroundColor:kl,collision:Pl,mouseHabit:Fl,heightBasedZoom:Rl};const Bi=dy({container:n.value,appContext:o?.appContext,methods:{...O.value,handleMenuAction:oe,setCardFullHeight:R,onLoadingStatus:X=>{X?fe.loading(X,"",s.value):fe.close()},...Ze,tilesLoad3dTiles:async X=>{let Ee=X.leiting?.tree;const We=X.leiting?.model?.modelId;if(!Ee&&p.value&&O.value?.loadTreeForModel)try{Ee=await O.value.loadTreeForModel(We)}catch(Si){console.warn("Failed to lazy load tree",Si)}Ee&&(Array.isArray(Ee)?Ee:[Ee]).forEach(Dt=>{Dt&&!b.value.find(Ll=>Ll.id===Dt.id)&&(Dt.modelId=We,b.value=[...b.value,Dt])});const{brightness:Ps,contrast:Fs,saturation:ot}=Bi.methods.getConfigure();Bi.methods.setModelColorAdjustment({brightness:Ps,contrast:Fs,saturation:ot}),Ze.tilesLoad3dTiles?.(X)},mountAll3Dtiles:X=>{h.mountAll3Dtiles&&h.mountAll3Dtiles(X),Ze.mountAll3Dtiles?.(X)},updateModels:X=>{if(Array.isArray(X))if(X.length===0)b.value=[];else{const Ee=X.map(We=>We.modelId);b.value=b.value.filter(We=>Ee.includes(We.modelId))}},mountAllCad:X=>{if(Bi.methods.setModelBrightness){const Ee=h.brightness!==void 0?h.brightness:a.value.brightness;Ee!==void 0&&Bi.methods.setModelBrightness(Ee)}h.mountAllCad&&h.mountAllCad(X),Ze.mountAllCad?.(X)},saveRegion:X=>{h.saveRegion&&h.saveRegion(X),Ze.saveRegion?.(X)},saveCadRegion:X=>{h.saveCadRegion&&h.saveCadRegion(X),Ze.saveCadRegion?.(X)},saveCadCalibration:X=>{h.saveCadCalibration&&h.saveCadCalibration(X),Ze.saveCadCalibration?.(X)},selectionChange:X=>{h.selectionChange&&h.selectionChange(X),Ze.selectionChange?.(X)},onSearchComponent:X=>{h.searchComponent&&h.searchComponent(X),Ze.searchComponent?.(X)}},viewerOptions:h.viewerOptions,options:{...Ze,mode:An,playerUrl:h.playerUrl,playerModelName:h.playerModelName,playerModelId:h.playerModelId,playerScale:h.playerScale,globe:Cl,terrain:El,depthTest:wl,mapProvider:bl,tiandituLayerType:vl,tiandituShowLabel:Il,tiandituToken:h.tiandituToken,arcgisUrl:Bl,shadows:xl,environmentMap:Sl,ambientOcclusion:Tl,time:Ml,brightness:Dl,backgroundColor:kl,collision:Pl,mouseHabit:Fl,heightBasedZoom:Rl},callbacks:{onLoading:X=>X?fe.loading(X,"",s.value):fe.close(),onSuccess:X=>fe.success(X,"",void 0,s.value),onError:X=>fe.error(X,"",void 0,s.value)}}),{Cesium:Mt,viewer:Kt,methods:yn,menuEvents:xi}=Bi,le=yn;xi.on("showMenu",X=>{L.value=X}),xi.on("insertMenu",X=>{M.value=[...M.value,...X]}),xi.on("setMenuActive",(X,Ee)=>{oe(X,Ee)}),O.value=le,Ce&&(Ce.value=le),xi.on("setMode",X=>{d.value=X}),xi.on("deleteAllModels",()=>{b.value=[]}),new Mt.ScreenSpaceEventHandler(Kt.scene.canvas).setInputAction(async X=>{if(x(),d.value==="2d")return;const Ee=Kt.scene.pick(X.position),We=Kt.container.getBoundingClientRect(),Ps=We.left+X.position.x,Fs=We.top+X.position.y,ot=[];if(Mt.defined(Ee)&&Ee instanceof Mt.Cesium3DTileFeature){const Si=le.baseCompt.getFeatureId(Ee),Dt=ai(Ee.tileset);le.baseCompt.hasSelectedFeaturesMap[Dt]?.some(Ti=>Ti.batchId===Si&&Ti.rank===0)||(await le.baseCompt.clearSelection(),await le.baseCompt.toggleMultiSelect(Dt,Si,le.baseCompt.selectedColor)),ot.push({id:"details",label:"构件详情",action:()=>{w.value=!0}}),ot.push({id:"hide",label:"隐藏选中构件",action:async()=>{const Mi=(await le.baseCompt.getSelected()).map(rt=>({elementId:rt.elementId,modelId:rt.modelId,show:!1}));le.baseCompt.setComponentVisibility(Mi)}}),ot.push({id:"translucent",label:"半透明选中构件",action:async()=>{const Mi=(await le.baseCompt.getSelected()).map(rt=>({elementId:rt.elementId,modelId:rt.modelId,rgba:{...rt.rgba,a:.3}}));await le.baseCompt.setSelectColorUserModelCpt(Mi,{rank:0})}}),ot.push({id:"isolate",label:"隔离选中构件",divided:!0,action:async()=>{await le.baseCompt.loadAllNodeDetailsForModel();const Mi=(await le.baseCompt.getSelected()).map(rt=>({elementId:rt.elementId,modelId:rt.modelId,show:!0}));le.isolateComponents(Mi)}})}ot.push({id:"showAll",label:"显示所有",action:async()=>{le.baseCompt.setAllComponentsVisibility(!0),await le.baseCompt.clearSelection()}}),ot.push(...k.value),P({x:Ps,y:Fs},ot)},Mt.ScreenSpaceEventType.RIGHT_CLICK),le.addContextMenuItems=_,le.insertContextMenu=le.addContextMenuItems,le.removeContextMenuItems=G,le.deleteContextMenu=le.removeContextMenuItems,le.closeContextMenu=x,le.hideContextMenu=le.closeContextMenu,le.onSetTeleportTarget=X=>{Y.value=X},await c.nextTick();const Ol=Ae?.onLoaded||Ae?.onloaded;Ol&&Ol({Cesium:Mt,viewer:Kt,methods:yn}),pe("init",{Cesium:Mt,viewer:Kt,methods:yn}),pe("ready",{Cesium:Mt,viewer:Kt,methods:yn})}};let te=!1;pe("register",(Ae,Ce)=>{te=!0,se(Ae,Ce)}),te||setTimeout(()=>{O.value.getViewer||se()},0)}catch(V){l.value="Failed to load Cesium: "+(V.message||V),console.error(V)}}),c.onUnmounted(()=>{fe.setContainer(null)}),e({initMap:()=>O.value,initializeViewer:(V,j)=>se(V,j)}),(V,j)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["leiting-bim-container",[`theme-${Q.value}`]]),onContextmenu:j[11]||(j[11]=c.withModifiers(()=>{},["prevent","stop"]))},[!r.value&&!l.value?(c.openBlock(),c.createBlock(c.unref(ge.Spin),{key:0,class:"loading",size:"large",tip:"加载基础组件中..."})):c.createCommentVNode("",!0),l.value?(c.openBlock(),c.createBlock(c.unref(ge.Alert),{key:1,class:"error",type:"error",message:l.value,"show-icon":""},null,8,["message"])):c.createCommentVNode("",!0),c.createElementVNode("div",{ref_key:"containerRef",ref:n,class:"cesium-viewer"},[c.createVNode(yi,{visible:L.value,"active-ids":q.value,"custom-items":M.value,onAction:oe,"is-2d":d.value==="2d"},null,8,["visible","active-ids","custom-items","is-2d"]),(c.openBlock(),c.createBlock(c.Teleport,{to:Y.value||"body",disabled:!Y.value},[c.createElementVNode("div",{ref_key:"uiOverlayRef",ref:s,class:"leiting-ui-overlay"},[c.createVNode(wi,{visible:w.value,"full-height":T.info,"onUpdate:visible":j[0]||(j[0]=te=>w.value=te)},null,8,["visible","full-height"]),c.createVNode(bi,{ref_key:"LeitingPositionRef",ref:Z,visible:A.value,"full-height":T.adjustModel,"onUpdate:visible":j[1]||(j[1]=te=>A.value=te)},null,8,["visible","full-height"]),c.createVNode(vi,{visible:C.value,"full-height":T.setting,"tianditu-token":h.tiandituToken,"initial-config":a.value,"onUpdate:visible":j[2]||(j[2]=te=>C.value=te)},null,8,["visible","full-height","tianditu-token","initial-config"]),i.showTree!==!1?(c.openBlock(),c.createBlock(an,c.mergeProps({key:0},{...f,...i.treeProps},{visible:p.value,"full-height":T.tree,"tree-data":b.value.length>0?b.value:i.treeProps?.treeData||[],"onUpdate:visible":j[3]||(j[3]=te=>{p.value=te})}),null,16,["visible","full-height","tree-data"])):c.createCommentVNode("",!0),c.createVNode(Vw,{visible:D.value,"onUpdate:visible":j[4]||(j[4]=te=>D.value=te)},null,8,["visible"]),c.createVNode(db,{visible:N.value,"onUpdate:visible":j[5]||(j[5]=te=>N.value=te)},null,8,["visible"]),c.createVNode(Ci,{visible:u.value,"full-height":T.section,"onUpdate:visible":j[6]||(j[6]=te=>u.value=te)},null,8,["visible","full-height"]),c.createVNode(Ei,{visible:m.value,"full-height":T.roam,"onUpdate:visible":j[7]||(j[7]=te=>m.value=te)},null,8,["visible","full-height"]),c.createVNode(HE,{visible:v.value,"current-model-id":E.value,"onUpdate:visible":j[8]||(j[8]=te=>v.value=te)},null,8,["visible","current-model-id"]),c.createVNode(Ow,{ref_key:"cadPositionRef",ref:y,visible:S.value,"onUpdate:visible":j[9]||(j[9]=te=>S.value=te),onSave:ve},null,8,["visible"]),c.createVNode(gb,{visible:c.unref(I),position:c.unref(B),items:c.unref(g),"onUpdate:visible":j[10]||(j[10]=te=>I.value=te)},null,8,["visible","position","items"]),c.renderSlot(V.$slots,"default",c.normalizeProps(c.guardReactiveProps({methods:O.value,isReady:r.value})),void 0,!0)],512)],8,["to","disabled"]))],512)],34))}}),[["__scopeId","data-v-2c7554a8"]]);function Al(i){const e=c.ref(),t=c.ref(i.theme||"dark"),n=c.ref(i.menuSize||"medium");c.provide("leiting-theme",t),c.provide("leiting-menu-size",n);function s(l){c.onUnmounted(()=>{e.value=null}),l(i,e)}function o(){const l=c.unref(e);return l||console.error("未获取到leiting实例!"),l}const r=new Proxy({},{get(l,a){const d=o();if(!d)return;const h=d[a];return typeof h=="function"?h.bind(d):h},set(l,a,d){const h=o();return h?(h[a]=d,!0):!1}});return[s,r]}const mb=mt,Ab={install:(i,e)=>{if(i.component("LeitingBIM",gn),i.component("LeitingTree",an),i.component("LeitingDraggableCard",Pe),i.component("leiting-draggable-card",Pe),i.component("LeitingMenu",yi),i.component("leiting-menu",yi),i.component("LeitingSection",Ci),i.component("leiting-section",Ci),i.component("LeitingPlayer",Ei),i.component("leiting-player",Ei),i.component("LeitingInfo",wi),i.component("leiting-info",wi),i.component("LeitingPosition",bi),i.component("leiting-position",bi),i.component("LeitingSetting",vi),i.component("leiting-setting",vi),!e)return;const t={...mb,...e};t.cesiumUrl&&En(t).catch(n=>{console.error("[LeitingBim] Failed to load Cesium resources:",n)}),i.config.globalProperties.$leitingBimOptions=t}};U.DEFAULT_CESIUM_CONFIG=mt,U.LeiTingBIM=gn,U.LeiTingDraggableCard=Pe,U.LeiTingInfo=wi,U.LeiTingMenu=yi,U.LeiTingPlayer=Ei,U.LeiTingPosition=bi,U.LeiTingSection=Ci,U.LeiTingSetting=vi,U.LeiTingTree=an,U.LeitingBIM=gn,U.LeitingDraggableCard=Pe,U.LeitingInfo=wi,U.LeitingMenu=yi,U.LeitingPlayer=Ei,U.LeitingPosition=bi,U.LeitingSection=Ci,U.LeitingSetting=vi,U.LeitingTree=an,U.default=Ab,U.getAccessToken=wn,U.leitingBim=gn,U.loadCesium=En,U.useLeiTing=Al,U.useLeiting=Al,U.waitForCesium=Ql,Object.defineProperties(U,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|