gis-common 3.1.7 → 3.1.9
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/dist/gis-common.es.js
CHANGED
|
@@ -601,11 +601,11 @@ const tt = {
|
|
|
601
601
|
sleep(t) {
|
|
602
602
|
}
|
|
603
603
|
};
|
|
604
|
-
function
|
|
604
|
+
function U(t) {
|
|
605
605
|
return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "");
|
|
606
606
|
}
|
|
607
607
|
function L(t) {
|
|
608
|
-
return
|
|
608
|
+
return U(t).split(/\s+/);
|
|
609
609
|
}
|
|
610
610
|
const et = {
|
|
611
611
|
getStyle(t, e) {
|
|
@@ -656,7 +656,7 @@ const et = {
|
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
658
|
removeClass(t, e) {
|
|
659
|
-
t.classList !== void 0 ? L(e).forEach((r) => t.classList.remove(r)) : this.setClass(t,
|
|
659
|
+
t.classList !== void 0 ? L(e).forEach((r) => t.classList.remove(r)) : this.setClass(t, U((" " + this.getClass(t) + " ").replace(" " + e + " ", " ")));
|
|
660
660
|
},
|
|
661
661
|
setClass(t, e) {
|
|
662
662
|
t.className.baseVal === void 0 ? t.className = e : t.className.baseVal = e;
|
|
@@ -723,7 +723,7 @@ const et = {
|
|
|
723
723
|
* @returns {*} {boolean}
|
|
724
724
|
*/
|
|
725
725
|
isLnglat(t, e) {
|
|
726
|
-
return t && e && +e > -90 && +e < 90 && +t > -180 && +t < 180;
|
|
726
|
+
return !isNaN(t) && !isNaN(e) && +e > -90 && +e < 90 && +t > -180 && +t < 180;
|
|
727
727
|
},
|
|
728
728
|
/**
|
|
729
729
|
* 格式化经纬度(转度分秒)
|
|
@@ -1394,11 +1394,11 @@ Object.assign(Map.prototype, {
|
|
|
1394
1394
|
return Array.from(Map.prototype.entries.call(this));
|
|
1395
1395
|
}
|
|
1396
1396
|
});
|
|
1397
|
-
function
|
|
1397
|
+
function N() {
|
|
1398
1398
|
return /* @__PURE__ */ new Map();
|
|
1399
1399
|
}
|
|
1400
|
-
|
|
1401
|
-
const e = new
|
|
1400
|
+
N.fromEntries = function(t = []) {
|
|
1401
|
+
const e = new N();
|
|
1402
1402
|
return t.forEach((n) => {
|
|
1403
1403
|
Array.isArray(n) && n.length === 2 && e.set(n[0], n[1]);
|
|
1404
1404
|
}), e;
|
|
@@ -1543,7 +1543,7 @@ export {
|
|
|
1543
1543
|
nt as FileUtils,
|
|
1544
1544
|
j as GeoUtils,
|
|
1545
1545
|
K as GraphicType,
|
|
1546
|
-
|
|
1546
|
+
N as HashMap,
|
|
1547
1547
|
H as LayerType,
|
|
1548
1548
|
g as MathUtils,
|
|
1549
1549
|
rt as OptimizeUtils,
|
package/dist/gis-common.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["gis-common"]={}))})(this,function(l){"use strict";var ot=Object.defineProperty;var ct=(l,m,p)=>m in l?ot(l,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[m]=p;var A=(l,m,p)=>ct(l,typeof m!="symbol"?m+"":m,p);const m={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},p={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},$={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},G={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},z={animate(t,e,n,r="swing",a=5){for(var s in e)e[s]={target:s==="opacity"?parseInt(e[s]*100):e[s],iNow:parseInt(s==="opacity"?getComputedStyle(t)[s]*100:getComputedStyle(t)[s])};r==="liner"&&(a=e[s].iNow<e[s].target?Math.abs(a):-Math.abs(a)),clearInterval(t.timer),t.timer=setInterval(function(){for(var i in e){var o=e[i].target,c=e[i].iNow;if(r==="swing"&&(a=(o-c)/20,a=a>0?Math.ceil(a):Math.floor(a)),Math.abs(o-c)<=Math.abs(a)){i==="opacity"?t.style[i]=o/100:t.style[i]=o+"px",delete e[i];for(var h in e)return!1;clearInterval(t.timer),typeof n=="function"&&n()}else e[i].iNow+=a,i==="opacity"?t.style[i]=e[i].iNow/100:t.style[i]=e[i].iNow+"px"}},30)}},M={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},json2Query(t){var e=[];for(var n in t){var r=n,a=t[n];e.push(r+"="+a)}var s=e.join("&");return s},generateGuid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const a=n[r];t[0]===a&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,a,s;for(r=0,a=e.length;r<a;r++){s=e[r];for(n in s)t[n]=s[n]}return t},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},convertToTree2(t,e="id",n="parentId",r="children"){const a=[];function s(i){const o=i[e],c=t.filter(h=>h.hasOwnProperty(n)&&h[n]===o);c.length>0&&(c.forEach(s),i[r]=c)}for(const i of t)t.findIndex(o=>o[e]===i[n])===-1&&(s(i),a.push(i));return a},asyncLoadScript(t){return new Promise((e,n)=>{try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(a){n(a)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,function(r,a){var s=e[a];if(s===void 0)throw new Error(p.JSON_VALUE_ERROR+r);return typeof s=="function"&&(s=s(e)),s})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(){let t=arguments.length,e=arguments[0];this.getDataType(e)!=="Object"&&(e={});for(let n=1;n<t;n++){let r=arguments[n];if(this.getDataType(r)==="Object")for(let a in r)a==="__proto__"||e===r[a]||(this.getDataType(r[a])==="Object"?e[a]=this.deepAssign(e[a],r[a]):e[a]=r[a])}return e},handleCopyValue(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,r)=>{document.execCommand("copy")?n():r(new Error("copy failed")),e.remove()})}}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const a=t(r);!n[a]&&(n[a]=e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.clear=function(){return this.length=0,this};const j={asArray(t){return M.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},q={getUrlParams(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:a}=new URL(t),s=[r,a];let i={};for(let o=0;o<s.length;o++){const c=s[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)i[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return i},getExplorer(){var t=window.navigator.userAgent;if(t.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window)return"IE";if(t.indexOf("Firefox")>=0)return"Firefox";if(t.indexOf("Chrome")>=0)return"Chrome";if(t.indexOf("Opera")>=0)return"Opera";if(t.indexOf("Safari")>=0)return"Safari"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,a=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":a&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/e,a=16/9;let s=t/1920;r>a&&(s=e/1080),n.transformOrigin="left top",n.transform=`scale(${s}) translateX(-49.99%)`,n.width=`${t/s}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e.style.fontSize=t/192+"px"}},Y={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},H={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let a=this.transformLat(e-105,t-35),s=this.transformLon(e-105,t-35);const i=t/180*this.PI;let o=Math.sin(i);o=1-r*o*o;const c=Math.sqrt(o);return a=a*180/(6378245*(1-r)/(o*c)*this.PI),s=s*180/(6378245/c*Math.cos(i)*this.PI),{lat:a,lng:s}},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let a=.01,s=.01,i=t-a,o=e-s,c=t+a,h=e+s,u=0,d=0,f=0;for(;;){u=(i+c)/2,d=(o+h)/2;const g=this.gcjEncrypt(u,d);if(a=g.lat-t,s=g.lng-e,Math.abs(a)<1e-9&&Math.abs(s)<1e-9||(a>0?c=u:i=u,s>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(t,e){const n=e,r=t,a=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s)+.0065;return{lat:a*Math.sin(s)+.006,lng:i}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,a=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s);return{lat:a*Math.sin(s),lng:i}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},distance(t,e,n,r){const s=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180),i=Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);let o=s+i;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},randomCoordinate(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length===1?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const K={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),a=new Date(e).getTime()-n.getTime(),s=Math.floor(a/(24*3600*1e3)),i=a%(24*3600*1e3),o=Math.floor(i/(3600*1e3)),c=i%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return s>0&&(f+=s+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),s===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(t){const e=function(o){return(o>10?"":"0")+(o||0)},n=e(Math.floor(t/3600)),r=t%3600,a=e(Math.floor(r/60)),s=r%60,i=e(Math.round(s));return`${n}:${a}:${i}`},sleep(t){}};function L(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function U(t){return L(t).split(/\s+/)}const J={getStyle(t,e){let n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||n==="auto")&&document.defaultView){const r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return n==="auto"?null:n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal},hasClass(t,e){if(t.classList!==void 0)return t.classList.contains(e);const n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass(t,e){if(t.classList!==void 0){const n=U(e);for(let r=0,a=n.length;r<a;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?U(e).forEach(r=>t.classList.remove(r)):this.setClass(t,L((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},k={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return t&&e&&+e>-90&&+e<90&&+t>-180&&+t<180},formatLnglat(t,e){let n="";function r(a){const s=parseFloat(a),i=parseInt(s);let o=parseInt((s-i)*60),c=(s-i)*3600-o*60;return i+"°"+o+"′"+c.toFixed(2)+"″"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat(t,e){function n(r){for(var a=/[sw]/i.test(r),s=a?-1:1,i=r.match(/[\d.]+/g),o=0,c=0,h=i.length;c<h;c++)o+=i[c]/s,s*=60;return o}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,a=!1,s=0,i=e.length,o=i-1;s<i;o=s,s++){var c=e[s].x,h=e[s].y,u=e[o].x,d=e[o].y;if(c===n&&h===r||u===n&&d===r)return"on";if(h<r&&d>=r||h>=r&&d<r){var f=c+(r-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(a=!a)}}return a?"in":"out"},wgs84PointsDistance(t,e){var n=Math.PI;function r(it){return it*n/180}if(arguments.length!=2)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var a=6378137,s=63567523142e-4,i=1/298.257223563,o=r(lon2-lon1),c=Math.atan((1-i)*Math.tan(r(lat1))),h=Math.atan((1-i)*Math.tan(r(lat2))),u=Math.sin(c),d=Math.cos(c),f=Math.sin(h),g=Math.cos(h),O=o,F,B=100;do{var I=Math.sin(O),C=Math.cos(O),R=Math.sqrt(g*I*(g*I)+(d*f-u*g*C)*(d*f-u*g*C));if(R==0)return 0;var v=u*f+d*g*C,W=Math.atan2(R,v),_=d*g*I/R,b=1-_*_,E=v-2*u*f/b;isNaN(E)&&(E=0);var x=i/16*b*(4+i*(4-3*b));F=O,O=o+(1-x)*i*_*(W+x*R*(E+x*v*(-1+2*E*E)))}while(Math.abs(O-F)>1e-12&&--B>0);if(B==0)return NaN;var w=b*(a*a-s*s)/(s*s),rt=1+w/16384*(4096+w*(-768+w*(320-175*w))),P=w/1024*(256+w*(-128+w*(74-47*w))),st=P*R*(E+P/4*(v*(-1+2*E*E)-P/6*E*(-3+4*R*R)*(-3+4*E*E))),at=s*rt*(W-st);return at},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,a=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:a}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:a,y:s}=e,i=a-n,o=s-r,c=Math.sqrt(i*i+o*o);return{angle:(Math.atan2(o,i)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),a=parseFloat(e.lat),s=parseFloat(e.lng),i=Math.sin((s-r)*this.toRadian)*Math.cos(a*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(a*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.cos((s-r)*this.toRadian),c=Math.atan2(i,o)*(180/Math.PI),h=(a-n)*this.toRadian,u=(s-r)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),g=this.R*f;return{angle:c,distance:g}},calcPointByBearAndDis(t,e,n){const r=y.toRadians(parseFloat(t.lat)),a=y.toRadians(parseFloat(t.lng));e=parseFloat(e),n=parseFloat(n);const s=n/this.R;e=y.toRadians(e);const i=Math.asin(Math.sin(r)*Math.cos(s)+Math.cos(r)*Math.sin(s)*Math.cos(e)),o=a+Math.atan2(Math.sin(e)*Math.sin(s)*Math.cos(r),Math.cos(s)-Math.sin(r)*Math.sin(i));return{lat:y.toDegrees(i),lng:y.toDegrees(o)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const a=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:a}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var a=e*Math.PI/180;const s=n/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)));return{x:r,y:s}}},V={convertBase64ToBlob(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),a=new Uint8Array(r),s=0;s<n.length;s++)a[s]=n.charCodeAt(s);var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return i?(i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder),i.append(r),i.getBlob(e)):(i=new Blob([r],{type:e}),i)},convertUrlToBase64(t,e,n){return new Promise(function(r,a){var s=new Image;s.crossOrigin="Anonymous",s.src=t,s.onload=function(){var i=document.createElement("canvas");i.width=e||s.width,i.height=n||s.height;var o=i.getContext("2d");o.drawImage(s,0,0,s.width,s.height);var c=s.src.substring(s.src.lastIndexOf(".")+1).toLowerCase(),h=i.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};r(u)}})},convertBase64ToFile(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],a=atob(n[1]),s=a.length,i=new Uint8Array(s);s--;)i[s]=a.charCodeAt(s);return new File([i],e,{type:r})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),a=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(a)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},Q={debounce(t,e,n=!0){let r,a,s,i,o;const c=function(){const h=+new Date-i;h<e&&h>0?r=setTimeout(c,e-h):(r=null,n||(o=t.apply(s,a),r||(s=a=null)))};return function(...h){s=this,i=+new Date;const u=n&&!r;return r||(r=setTimeout(c,e)),u&&(o=t.apply(s,h),s=h=null),o}},throttle(t,e,n){if(n===1)var r=0;else if(n===2)var a;return function(){let s=this,i=arguments;if(n===1){let o=Date.now();o-r>e&&(t.apply(s,i),r=o)}else n===2&&(a||(a=setTimeout(()=>{a=null,t.apply(s,i)},e)))}},recurve(t,e=500,n=5e3){let r=0;setTimeout(function a(){r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(a,e))})}},N={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(M.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,a)=>`${n}${e[a-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var a=Math.floor(n/2),s=a;s<t.length;s++){let i=t.substring(e,s);if(i.replace(r,"mm").length>=n)return i}return t},asString(t){if(M.isEmpty(t))return"";switch(M.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},X={notNull(t){if(M.isEmpty(t))throw Error("不能为空:>>>"+t)},legalLnglat(t,e){if(!k.isLnglat(t,e))throw Error(p.COORDINATE_ERROR)},contain(t,...e){let n=!1;const r=e.length||0;for(let a=0,s=r;a<s;a++)n=t.indexOf(e[a])>=0;if(n)throw Error(p.STRING_CHECK_LOSS)},verify:{array(t){if(M.getDataType(t)!=="Array")throw Error(p.PARAMETER_ERROR_ARRAY+":>>>"+t)},function(t){if(M.getDataType(t)!=="Function")throw Error(p.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object(t){if(M.getDataType(t)!=="Object")throw Error(p.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON(t){try{JSON.parse(t)}catch{throw Error(p.JSON_PARSE_ERROR+":>>>"+t)}},legalData(t,e){const n=N.checkStr(t,e);let r="";switch(e){case"phone":r="电话";break;case"tel":r="座机";break;case"card":r="身份证";break;case"pwd":r="密码";break;case"postal":r="邮政编码";break;case"QQ":r="QQ";break;case"email":r="邮箱";break;case"money":r="金额";break;case"URL":r="网址";break;case"IP":r="IP";break;case"date":r="日期时间";break;case"number":r="数字";break;case"english":r="英文";break;case"chinese":r="中文";break;case"lower":r="小写";break;case"upper":r="大写";break;case"HTML":r="HTML标记";break}if(!n)throw Error(p.PARAMETER_ERROR+":>>>不是"+r)}};class Z{constructor(e){A(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}class tt{constructor(e){M.getDataType(e)==="String"&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}drawLine(e,n,r,a,s={}){this.cxt.beginPath();const i=s.width||1,o=s.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(e,n),this.cxt.lineTo(r,a),this.cxt.closePath(),this.cxt.fill()}drawArc(e,n,r,a,s,i,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,y.degreesToRadians(a),y.degreesToRadians(s),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,y.degreesToRadians(a),y.degreesToRadians(s),i),this.cxt.stroke())}}class et{constructor(e=1){this.magnification=e}_getSystem(){var e=navigator.userAgent.toLowerCase();if(e.indexOf("windows")>=0)return!0}_addHandler(e,n,r){e.addEventListener?e.addEventListener(n,r,!1):e.attachEvent?e.attachEvent("on"+n,r):e["on"+n]=r}_correct(){let e=window.innerWidth;if(typeof e!="number"&&(document.compatMode=="CSS1Compat"?e=document.documentElement.clientWidth:e=document.body.clientWidth),e<=750){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*75*Math.min(r,2)+"px"}else if(e>750&&e<=1200){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*85*Math.min(r,2)+"px"}else{const r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(r,2)+"px"}}_watch(){let e=this;e._addHandler(window,"resize",function(){e._correct()})}init(){let e=this;e._getSystem()&&(e._correct(),e._watch())}}function S(){}Object.assign(S.prototype,{addEventListener(t,e,n,r=!1){this._listeners===void 0&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;const a=this._mutex,s=this._listeners;return s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&(r&&(a[t]=e),s[t].push(e)),this},hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),r!==void 0){const a=r.map(s=>s.toString()).indexOf(e.toString());a!==-1&&r.splice(a,1)}},dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);if(this._mutex[t.type]){r.find(s=>s===this._mutex[t.type]).call(this._context||this,t);return}for(let a=0,s=r.length;a<s;a++)r[a].call(this._context||this,t)}},removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}),Object.assign(Map.prototype,{isEmpty(){return this.size===0},_values(){return Array.from(Map.prototype.values.call(this))},_keys(){return Array.from(Map.prototype.keys.call(this))},_entries(){return Array.from(Map.prototype.entries.call(this))}});function T(){return new Map}T.fromEntries=function(t=[]){const e=new T;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class D extends S{constructor(e="ws://127.0.0.1:10088"){super(),this.maxCheckTimes=10,this.url=e,this.checkTimes=0,this.connectStatus=!1,this.connect(),this.connCheckStatus(this.maxCheckTimes),D.instance=this}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const e=this;this.client.onopen=function(n){e.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:n})},this.client.onmessage=function(n){e.connectStatus=!0,e.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:n})},this.client.onclose=function(n){e.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:n})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(n){e.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:n})})}}catch(e){console.error("创建ws连接失败"+this.url+":"+e)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(e){this.checkTimes>e||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(e)},2e3)}send(e){return this.client&&this.client.readyState===1?(this.client.send(e),!0):(console.error(this.url+"消息发送失败:"+e),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}static getInstance(){return D.instance?D.instance:Object.freeze(new D)}static get _instance(){return this.getInstance()}}class nt{constructor(e=1){A(this,"cacheType");A(this,"storage");if(this.cacheType=e,e===1)this.storage=window.localStorage;else if(e===2)this.storage=window.sessionStorage;else throw new Error(p.PARAMETER_ERROR)}setItem(e,n,r){const a={key:e,value:n};if(this.cacheType===1){const s=Date.now();r&&(a.expired=s+r*1e3)}return this.storage[e]=JSON.stringify(a),a}getItem(e){const n=this.storage.getItem(e);if(n===null)return null;const r=JSON.parse(n)||{};if(this.cacheType===1){const a=r.expired?new Date(r.expired).getTime():Date.now();if(Date.now()>a)return this.remove(e),null}return r.value}remove(e){e&&(e.indexOf(",")>-1?e.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(e))}clear(){this.storage.clear()}}l.AnimateUtils=z,l.ArrayUtils=j,l.AssertUtils=X,l.AudioPlayer=Z,l.BrowserUtils=q,l.CanvasDrawer=tt,l.Cookie=Y,l.CoordsUtils=H,l.DateUtils=K,l.DevicePixelRatio=et,l.DomUtils=J,l.ErrorType=p,l.EventDispatcher=S,l.EventType=m,l.FileUtils=V,l.GeoUtils=k,l.GraphicType=G,l.HashMap=T,l.LayerType=$,l.MathUtils=y,l.OptimizeUtils=Q,l.StringUtils=N,l.Utils=M,l.WebSocketClient=D,l.WebStorage=nt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["gis-common"]={}))})(this,function(l){"use strict";var ot=Object.defineProperty;var ct=(l,m,p)=>m in l?ot(l,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[m]=p;var A=(l,m,p)=>ct(l,typeof m!="symbol"?m+"":m,p);const m={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},p={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},$={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},G={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},z={animate(t,e,n,r="swing",a=5){for(var s in e)e[s]={target:s==="opacity"?parseInt(e[s]*100):e[s],iNow:parseInt(s==="opacity"?getComputedStyle(t)[s]*100:getComputedStyle(t)[s])};r==="liner"&&(a=e[s].iNow<e[s].target?Math.abs(a):-Math.abs(a)),clearInterval(t.timer),t.timer=setInterval(function(){for(var i in e){var o=e[i].target,c=e[i].iNow;if(r==="swing"&&(a=(o-c)/20,a=a>0?Math.ceil(a):Math.floor(a)),Math.abs(o-c)<=Math.abs(a)){i==="opacity"?t.style[i]=o/100:t.style[i]=o+"px",delete e[i];for(var h in e)return!1;clearInterval(t.timer),typeof n=="function"&&n()}else e[i].iNow+=a,i==="opacity"?t.style[i]=e[i].iNow/100:t.style[i]=e[i].iNow+"px"}},30)}},M={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},json2Query(t){var e=[];for(var n in t){var r=n,a=t[n];e.push(r+"="+a)}var s=e.join("&");return s},generateGuid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const a=n[r];t[0]===a&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,a,s;for(r=0,a=e.length;r<a;r++){s=e[r];for(n in s)t[n]=s[n]}return t},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},convertToTree2(t,e="id",n="parentId",r="children"){const a=[];function s(i){const o=i[e],c=t.filter(h=>h.hasOwnProperty(n)&&h[n]===o);c.length>0&&(c.forEach(s),i[r]=c)}for(const i of t)t.findIndex(o=>o[e]===i[n])===-1&&(s(i),a.push(i));return a},asyncLoadScript(t){return new Promise((e,n)=>{try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(a){n(a)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,function(r,a){var s=e[a];if(s===void 0)throw new Error(p.JSON_VALUE_ERROR+r);return typeof s=="function"&&(s=s(e)),s})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(){let t=arguments.length,e=arguments[0];this.getDataType(e)!=="Object"&&(e={});for(let n=1;n<t;n++){let r=arguments[n];if(this.getDataType(r)==="Object")for(let a in r)a==="__proto__"||e===r[a]||(this.getDataType(r[a])==="Object"?e[a]=this.deepAssign(e[a],r[a]):e[a]=r[a])}return e},handleCopyValue(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,r)=>{document.execCommand("copy")?n():r(new Error("copy failed")),e.remove()})}}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const a=t(r);!n[a]&&(n[a]=e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.clear=function(){return this.length=0,this};const j={asArray(t){return M.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},q={getUrlParams(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:a}=new URL(t),s=[r,a];let i={};for(let o=0;o<s.length;o++){const c=s[o];if(c){const u=c.replace(/#|\//g,"").split("?");if(u.length>1)for(let d=1;d<u.length;d++){let f;for(;f=n.exec(u[d]);)i[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return i},getExplorer(){var t=window.navigator.userAgent;if(t.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window)return"IE";if(t.indexOf("Firefox")>=0)return"Firefox";if(t.indexOf("Chrome")>=0)return"Chrome";if(t.indexOf("Opera")>=0)return"Opera";if(t.indexOf("Safari")>=0)return"Safari"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,a=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":a&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/e,a=16/9;let s=t/1920;r>a&&(s=e/1080),n.transformOrigin="left top",n.transform=`scale(${s}) translateX(-49.99%)`,n.width=`${t/s}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e.style.fontSize=t/192+"px"}},Y={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},H={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let a=this.transformLat(e-105,t-35),s=this.transformLon(e-105,t-35);const i=t/180*this.PI;let o=Math.sin(i);o=1-r*o*o;const c=Math.sqrt(o);return a=a*180/(6378245*(1-r)/(o*c)*this.PI),s=s*180/(6378245/c*Math.cos(i)*this.PI),{lat:a,lng:s}},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let a=.01,s=.01,i=t-a,o=e-s,c=t+a,h=e+s,u=0,d=0,f=0;for(;;){u=(i+c)/2,d=(o+h)/2;const g=this.gcjEncrypt(u,d);if(a=g.lat-t,s=g.lng-e,Math.abs(a)<1e-9&&Math.abs(s)<1e-9||(a>0?c=u:i=u,s>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(t,e){const n=e,r=t,a=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s)+.0065;return{lat:a*Math.sin(s)+.006,lng:i}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,a=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),s=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),i=a*Math.cos(s);return{lat:a*Math.sin(s),lng:i}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},distance(t,e,n,r){const s=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180),i=Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);let o=s+i;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},randomCoordinate(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length===1?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};const K={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),a=new Date(e).getTime()-n.getTime(),s=Math.floor(a/(24*3600*1e3)),i=a%(24*3600*1e3),o=Math.floor(i/(3600*1e3)),c=i%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return s>0&&(f+=s+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),s===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(t){const e=function(o){return(o>10?"":"0")+(o||0)},n=e(Math.floor(t/3600)),r=t%3600,a=e(Math.floor(r/60)),s=r%60,i=e(Math.round(s));return`${n}:${a}:${i}`},sleep(t){}};function L(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function U(t){return L(t).split(/\s+/)}const J={getStyle(t,e){let n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||n==="auto")&&document.defaultView){const r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return n==="auto"?null:n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal},hasClass(t,e){if(t.classList!==void 0)return t.classList.contains(e);const n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass(t,e){if(t.classList!==void 0){const n=U(e);for(let r=0,a=n.length;r<a;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?U(e).forEach(r=>t.classList.remove(r)):this.setClass(t,L((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},N={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return!isNaN(t)&&!isNaN(e)&&+e>-90&&+e<90&&+t>-180&&+t<180},formatLnglat(t,e){let n="";function r(a){const s=parseFloat(a),i=parseInt(s);let o=parseInt((s-i)*60),c=(s-i)*3600-o*60;return i+"°"+o+"′"+c.toFixed(2)+"″"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat(t,e){function n(r){for(var a=/[sw]/i.test(r),s=a?-1:1,i=r.match(/[\d.]+/g),o=0,c=0,h=i.length;c<h;c++)o+=i[c]/s,s*=60;return o}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,a=!1,s=0,i=e.length,o=i-1;s<i;o=s,s++){var c=e[s].x,h=e[s].y,u=e[o].x,d=e[o].y;if(c===n&&h===r||u===n&&d===r)return"on";if(h<r&&d>=r||h>=r&&d<r){var f=c+(r-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(a=!a)}}return a?"in":"out"},wgs84PointsDistance(t,e){var n=Math.PI;function r(it){return it*n/180}if(arguments.length!=2)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var a=6378137,s=63567523142e-4,i=1/298.257223563,o=r(lon2-lon1),c=Math.atan((1-i)*Math.tan(r(lat1))),h=Math.atan((1-i)*Math.tan(r(lat2))),u=Math.sin(c),d=Math.cos(c),f=Math.sin(h),g=Math.cos(h),O=o,F,B=100;do{var I=Math.sin(O),C=Math.cos(O),R=Math.sqrt(g*I*(g*I)+(d*f-u*g*C)*(d*f-u*g*C));if(R==0)return 0;var v=u*f+d*g*C,W=Math.atan2(R,v),_=d*g*I/R,b=1-_*_,E=v-2*u*f/b;isNaN(E)&&(E=0);var x=i/16*b*(4+i*(4-3*b));F=O,O=o+(1-x)*i*_*(W+x*R*(E+x*v*(-1+2*E*E)))}while(Math.abs(O-F)>1e-12&&--B>0);if(B==0)return NaN;var w=b*(a*a-s*s)/(s*s),rt=1+w/16384*(4096+w*(-768+w*(320-175*w))),P=w/1024*(256+w*(-128+w*(74-47*w))),st=P*R*(E+P/4*(v*(-1+2*E*E)-P/6*E*(-3+4*R*R)*(-3+4*E*E))),at=s*rt*(W-st);return at},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,a=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:a}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:a,y:s}=e,i=a-n,o=s-r,c=Math.sqrt(i*i+o*o);return{angle:(Math.atan2(o,i)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),a=parseFloat(e.lat),s=parseFloat(e.lng),i=Math.sin((s-r)*this.toRadian)*Math.cos(a*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(a*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.cos((s-r)*this.toRadian),c=Math.atan2(i,o)*(180/Math.PI),h=(a-n)*this.toRadian,u=(s-r)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),g=this.R*f;return{angle:c,distance:g}},calcPointByBearAndDis(t,e,n){const r=y.toRadians(parseFloat(t.lat)),a=y.toRadians(parseFloat(t.lng));e=parseFloat(e),n=parseFloat(n);const s=n/this.R;e=y.toRadians(e);const i=Math.asin(Math.sin(r)*Math.cos(s)+Math.cos(r)*Math.sin(s)*Math.cos(e)),o=a+Math.atan2(Math.sin(e)*Math.sin(s)*Math.cos(r),Math.cos(s)-Math.sin(r)*Math.sin(i));return{lat:y.toDegrees(i),lng:y.toDegrees(o)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const a=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:a}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var a=e*Math.PI/180;const s=n/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)));return{x:r,y:s}}},V={convertBase64ToBlob(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),a=new Uint8Array(r),s=0;s<n.length;s++)a[s]=n.charCodeAt(s);var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return i?(i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder),i.append(r),i.getBlob(e)):(i=new Blob([r],{type:e}),i)},convertUrlToBase64(t,e,n){return new Promise(function(r,a){var s=new Image;s.crossOrigin="Anonymous",s.src=t,s.onload=function(){var i=document.createElement("canvas");i.width=e||s.width,i.height=n||s.height;var o=i.getContext("2d");o.drawImage(s,0,0,s.width,s.height);var c=s.src.substring(s.src.lastIndexOf(".")+1).toLowerCase(),h=i.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};r(u)}})},convertBase64ToFile(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],a=atob(n[1]),s=a.length,i=new Uint8Array(s);s--;)i[s]=a.charCodeAt(s);return new File([i],e,{type:r})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),a=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(a)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},Q={debounce(t,e,n=!0){let r,a,s,i,o;const c=function(){const h=+new Date-i;h<e&&h>0?r=setTimeout(c,e-h):(r=null,n||(o=t.apply(s,a),r||(s=a=null)))};return function(...h){s=this,i=+new Date;const u=n&&!r;return r||(r=setTimeout(c,e)),u&&(o=t.apply(s,h),s=h=null),o}},throttle(t,e,n){if(n===1)var r=0;else if(n===2)var a;return function(){let s=this,i=arguments;if(n===1){let o=Date.now();o-r>e&&(t.apply(s,i),r=o)}else n===2&&(a||(a=setTimeout(()=>{a=null,t.apply(s,i)},e)))}},recurve(t,e=500,n=5e3){let r=0;setTimeout(function a(){r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(a,e))})}},k={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(M.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,a)=>`${n}${e[a-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var a=Math.floor(n/2),s=a;s<t.length;s++){let i=t.substring(e,s);if(i.replace(r,"mm").length>=n)return i}return t},asString(t){if(M.isEmpty(t))return"";switch(M.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},X={notNull(t){if(M.isEmpty(t))throw Error("不能为空:>>>"+t)},legalLnglat(t,e){if(!N.isLnglat(t,e))throw Error(p.COORDINATE_ERROR)},contain(t,...e){let n=!1;const r=e.length||0;for(let a=0,s=r;a<s;a++)n=t.indexOf(e[a])>=0;if(n)throw Error(p.STRING_CHECK_LOSS)},verify:{array(t){if(M.getDataType(t)!=="Array")throw Error(p.PARAMETER_ERROR_ARRAY+":>>>"+t)},function(t){if(M.getDataType(t)!=="Function")throw Error(p.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object(t){if(M.getDataType(t)!=="Object")throw Error(p.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON(t){try{JSON.parse(t)}catch{throw Error(p.JSON_PARSE_ERROR+":>>>"+t)}},legalData(t,e){const n=k.checkStr(t,e);let r="";switch(e){case"phone":r="电话";break;case"tel":r="座机";break;case"card":r="身份证";break;case"pwd":r="密码";break;case"postal":r="邮政编码";break;case"QQ":r="QQ";break;case"email":r="邮箱";break;case"money":r="金额";break;case"URL":r="网址";break;case"IP":r="IP";break;case"date":r="日期时间";break;case"number":r="数字";break;case"english":r="英文";break;case"chinese":r="中文";break;case"lower":r="小写";break;case"upper":r="大写";break;case"HTML":r="HTML标记";break}if(!n)throw Error(p.PARAMETER_ERROR+":>>>不是"+r)}};class Z{constructor(e){A(this,"audio");this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}class tt{constructor(e){M.getDataType(e)==="String"&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}drawLine(e,n,r,a,s={}){this.cxt.beginPath();const i=s.width||1,o=s.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(e,n),this.cxt.lineTo(r,a),this.cxt.closePath(),this.cxt.fill()}drawArc(e,n,r,a,s,i,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,y.degreesToRadians(a),y.degreesToRadians(s),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,y.degreesToRadians(a),y.degreesToRadians(s),i),this.cxt.stroke())}}class et{constructor(e=1){this.magnification=e}_getSystem(){var e=navigator.userAgent.toLowerCase();if(e.indexOf("windows")>=0)return!0}_addHandler(e,n,r){e.addEventListener?e.addEventListener(n,r,!1):e.attachEvent?e.attachEvent("on"+n,r):e["on"+n]=r}_correct(){let e=window.innerWidth;if(typeof e!="number"&&(document.compatMode=="CSS1Compat"?e=document.documentElement.clientWidth:e=document.body.clientWidth),e<=750){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*75*Math.min(r,2)+"px"}else if(e>750&&e<=1200){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*85*Math.min(r,2)+"px"}else{const r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(r,2)+"px"}}_watch(){let e=this;e._addHandler(window,"resize",function(){e._correct()})}init(){let e=this;e._getSystem()&&(e._correct(),e._watch())}}function S(){}Object.assign(S.prototype,{addEventListener(t,e,n,r=!1){this._listeners===void 0&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;const a=this._mutex,s=this._listeners;return s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&(r&&(a[t]=e),s[t].push(e)),this},hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),r!==void 0){const a=r.map(s=>s.toString()).indexOf(e.toString());a!==-1&&r.splice(a,1)}},dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);if(this._mutex[t.type]){r.find(s=>s===this._mutex[t.type]).call(this._context||this,t);return}for(let a=0,s=r.length;a<s;a++)r[a].call(this._context||this,t)}},removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}),Object.assign(Map.prototype,{isEmpty(){return this.size===0},_values(){return Array.from(Map.prototype.values.call(this))},_keys(){return Array.from(Map.prototype.keys.call(this))},_entries(){return Array.from(Map.prototype.entries.call(this))}});function T(){return new Map}T.fromEntries=function(t=[]){const e=new T;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class D extends S{constructor(e="ws://127.0.0.1:10088"){super(),this.maxCheckTimes=10,this.url=e,this.checkTimes=0,this.connectStatus=!1,this.connect(),this.connCheckStatus(this.maxCheckTimes),D.instance=this}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const e=this;this.client.onopen=function(n){e.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:n})},this.client.onmessage=function(n){e.connectStatus=!0,e.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:n})},this.client.onclose=function(n){e.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:n})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(n){e.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:n})})}}catch(e){console.error("创建ws连接失败"+this.url+":"+e)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(e){this.checkTimes>e||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(e)},2e3)}send(e){return this.client&&this.client.readyState===1?(this.client.send(e),!0):(console.error(this.url+"消息发送失败:"+e),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}static getInstance(){return D.instance?D.instance:Object.freeze(new D)}static get _instance(){return this.getInstance()}}class nt{constructor(e=1){A(this,"cacheType");A(this,"storage");if(this.cacheType=e,e===1)this.storage=window.localStorage;else if(e===2)this.storage=window.sessionStorage;else throw new Error(p.PARAMETER_ERROR)}setItem(e,n,r){const a={key:e,value:n};if(this.cacheType===1){const s=Date.now();r&&(a.expired=s+r*1e3)}return this.storage[e]=JSON.stringify(a),a}getItem(e){const n=this.storage.getItem(e);if(n===null)return null;const r=JSON.parse(n)||{};if(this.cacheType===1){const a=r.expired?new Date(r.expired).getTime():Date.now();if(Date.now()>a)return this.remove(e),null}return r.value}remove(e){e&&(e.indexOf(",")>-1?e.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(e))}clear(){this.storage.clear()}}l.AnimateUtils=z,l.ArrayUtils=j,l.AssertUtils=X,l.AudioPlayer=Z,l.BrowserUtils=q,l.CanvasDrawer=tt,l.Cookie=Y,l.CoordsUtils=H,l.DateUtils=K,l.DevicePixelRatio=et,l.DomUtils=J,l.ErrorType=p,l.EventDispatcher=S,l.EventType=m,l.FileUtils=V,l.GeoUtils=N,l.GraphicType=G,l.HashMap=T,l.LayerType=$,l.MathUtils=y,l.OptimizeUtils=Q,l.StringUtils=k,l.Utils=M,l.WebSocketClient=D,l.WebStorage=nt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|