gis-common 3.1.10 → 3.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +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)}},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"})});
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 ft=Object.defineProperty;var mt=(l,m,p)=>m in l?ft(l,m,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[m]=p;var g=(l,m,p)=>mt(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:"字符缺少关键字"},z={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"},j={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},H={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},q={ADD:"add",REMOVE:"remove",INIT:"init"},Y={animate(e,t,n,s="swing",i=5){for(var r in t)t[r]={target:r==="opacity"?parseInt(t[r]*100):t[r],iNow:parseInt(r==="opacity"?getComputedStyle(e)[r]*100:getComputedStyle(e)[r])};s==="liner"&&(i=t[r].iNow<t[r].target?Math.abs(i):-Math.abs(i)),clearInterval(e.timer),e.timer=setInterval(function(){for(var a in t){var o=t[a].target,c=t[a].iNow;if(s==="swing"&&(i=(o-c)/20,i=i>0?Math.ceil(i):Math.floor(i)),Math.abs(o-c)<=Math.abs(i)){a==="opacity"?e.style[a]=o/100:e.style[a]=o+"px",delete t[a];for(var h in t)return!1;clearInterval(e.timer),typeof n=="function"&&n()}else t[a].iNow+=i,a==="opacity"?e.style[a]=t[a].iNow/100:e.style[a]=t[a].iNow+"px"}},30)}},M={getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)},isEmpty(e){if(e==null)return!0;switch(this.getDataType(e)){case"String":return e.trim()==="";case"Array":return!e.length;case"Object":return!Object.keys(e).length;case"Boolean":return!e;default:return!1}},isNotEmpty(e){return!this.isEmpty(e)},json2form(e){const t=new FormData;return Object.keys(e).forEach(n=>{t.append(n,e[n]instanceof Object?JSON.stringify(e[n]):e[n])}),t},json2Query(e){var t=[];for(var n in e){var s=n,i=e[n];t.push(s+"="+i)}var r=t.join("&");return r},generateGuid(){const e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()+e()+e()},decodeDict(...e){let t="";if(e.length>1){const n=e.slice(1,e.length%2===0?e.length-1:e.length);for(let s=0;s<n.length;s=s+2){const i=n[s];e[0]===i&&(t=n[s+1])}!t&&e.length%2===0&&(t=e[e.length-1])}else t=e[0];return t},extend(e,...t){let n,s,i,r;for(s=0,i=t.length;s<i;s++){r=t[s];for(n in r)e[n]=r[n]}return e},rgb2hex(e){var t="#"+(16777216+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1);return t},convertToTree2(e,t="id",n="parentId",s="children"){const i=[];function r(a){const o=e.filter(c=>c[n]===a[t]).map(c=>(i.some(h=>h[t]===c[t])||r(c),c));o.length>0&&(a[s]=o)}return e.forEach(a=>{e.some(o=>o[n]===a[t])||(r(a),i.push(a))}),i},asyncLoadScript(e){return new Promise((t,n)=>{try{const s=document.createElement("script");s.type="text/javascript",s.src=e,"readyState"in s?s.onreadystatechange=function(){(s.readyState==="complete"||s.readyState==="loaded")&&t(s)}:(s.onload=function(){t(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+e))}),document.body.appendChild(s)}catch(s){n(s)}})},loadStyle(e){e.forEach(t=>{const n=document.createElement("link");n.href=t,n.rel="stylesheet",n.type="text/css",n.onerror=function(){console.error(`Style loading failed for URL: ${t}`)},document.head.appendChild(n)})},template(e,t){const n=/\{ *([\w_-]+) *\}/g;return e.replace(n,(s,i)=>{const r=t[i];if(r===void 0)throw new Error(`${p.JSON_VALUE_ERROR}: ${s}`);return typeof r=="function"?r(t):r})},deleteEmptyProperty(e){return Object.fromEntries(Object.keys(e).filter(t=>!this.isEmpty(e[t])).map(t=>[t,e[t]]))},deepAssign(e,...t){(typeof e!="object"||e===null)&&(e={});for(const n of t)if(typeof n=="object"&&n!==null)for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(typeof n[s]=="object"&&n[s]!==null?(e[s]||(e[s]=Array.isArray(n[s])?[]:{}),this.deepAssign(e[s],n[s])):e[s]=n[s]);return e},handleCopyValue(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e);{const t=document.createElement("textarea");return t.style.position="fixed",t.style.top=t.style.left="-100vh",t.style.opacity="0",t.value=e,document.body.appendChild(t),t.focus(),t.select(),new Promise((n,s)=>{try{document.execCommand("copy"),n()}catch{s(new Error("copy failed"))}finally{t.remove()}})}}};Array.prototype.groupBy=function(e){var t={};return this.forEach(function(n){var s=JSON.stringify(e(n));t[s]=t[s]||[],t[s].push(n)}),Object.keys(t).map(n=>t[n])},Array.prototype.distinct=function(e=t=>t){const t=[],n={};return this.forEach(s=>{const i=e(s);!n[i]&&(n[i]=t.push(s))}),t},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((e=0,t=0)=>e+t):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(e=t=>t){return this.sort((t,n)=>e(n)-e(t))},Array.prototype.asc=function(e=t=>t){return this.sort((t,n)=>e(t)-e(n))},Array.prototype.clear=function(){return this.length=0,this};const K={asArray(e){return M.isEmpty(e)?[]:Array.isArray(e)?e:[e]},generateArray(e){return[...new Array(e).keys()]},union(...e){let t=[];return e.forEach(n=>{Array.isArray(n)&&(t=t.concat(n.filter(s=>!t.includes(s))))}),t},intersection(...e){let t=e[0]||[];return e.forEach(n=>{Array.isArray(n)&&(t=t.filter(s=>n.includes(s)))}),t},unionAll(...e){return[...e].flat().filter(t=>!!t)},difference(...e){return this.union(...e).filter(t=>!this.intersection(...e).includes(t))}},J={getUrlParams(e=window.location.href,t=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:s,hash:i}=new URL(e),r=[s,i];let a={};for(let o=0;o<r.length;o++){const c=r[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]);)a[f[1]]=t?decodeURIComponent(f[2]):f[2]}}}return a},getExplorer(){var e=window.navigator.userAgent;if(e.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window)return"IE";if(e.indexOf("Firefox")>=0)return"Firefox";if(e.indexOf("Chrome")>=0)return"Chrome";if(e.indexOf("Opera")>=0)return"Opera";if(e.indexOf("Safari")>=0)return"Safari"},detectOS(){let e="";const t=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,s=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,i=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return t?e="MS Windows":n?e="Apple mac":s?e="Linux":i&&(e="Unix"),e},switchFullScreen(e){if(e){const t=document.documentElement;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale(){const e=document.documentElement.clientWidth,t=document.documentElement.clientHeight,n=document.getElementById("app").style,s=e/t,i=16/9;let r=e/1920;s>i&&(r=t/1080),n.transformOrigin="left top",n.transform=`scale(${r}) translateX(-49.99%)`,n.width=`${e/r}px`},getHtmlFontSize(){const e=document.documentElement.clientWidth||document.body.clientWidth,t=document.querySelector("html");t.style.fontSize=e/192+"px"}},Q={set:function(e,t,n=30){var s=new Date;s.setTime(s.getTime()+n*24*60*60*1e3),document.cookie=e+"="+escape(t)+";expires="+s.toUTCString()},remove:function(e){var t=new Date;t.setTime(t.getTime()-1);var n=this.get(e);n!=null&&(document.cookie=e+"="+n+";expires="+t.toUTCString())},get:function(e){var t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]*)(;|$)"));return t!=null?t[2]:""}},X={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(e,t){const s=.006693421622965943;let i=this.transformLat(t-105,e-35),r=this.transformLon(t-105,e-35);const a=e/180*this.PI;let o=Math.sin(a);o=1-s*o*o;const c=Math.sqrt(o);return i=i*180/(6378245*(1-s)/(o*c)*this.PI),r=r*180/(6378245/c*Math.cos(a)*this.PI),{lat:i,lng:r}},gcjEncrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e+n.lat,lng:t+n.lng}},gcjDecrypt(e,t){if(this.outOfChina(e,t))return{lat:e,lng:t};const n=this.delta(e,t);return{lat:e-n.lat,lng:t-n.lng}},gcjDecryptExact(e,t){let i=.01,r=.01,a=e-i,o=t-r,c=e+i,h=t+r,u=0,d=0,f=0;for(;;){u=(a+c)/2,d=(o+h)/2;const w=this.gcjEncrypt(u,d);if(i=w.lat-e,r=w.lng-t,Math.abs(i)<1e-9&&Math.abs(r)<1e-9||(i>0?c=u:a=u,r>0?h=d:o=d,++f>1e4))break}return{lat:u,lng:d}},bdEncrypt(e,t){const n=t,s=e,i=Math.sqrt(n*n+s*s)+2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)+3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r)+.0065;return{lat:i*Math.sin(r)+.006,lng:a}},bdDecrypt(e,t){const n=t-.0065,s=e-.006,i=Math.sqrt(n*n+s*s)-2e-5*Math.sin(s*this.XPI),r=Math.atan2(s,n)-3e-6*Math.cos(n*this.XPI),a=i*Math.cos(r);return{lat:i*Math.sin(r),lng:a}},mercatorEncrypt(e,t){const n=t*2003750834e-2/180;let s=Math.log(Math.tan((90+e)*this.PI/360))/(this.PI/180);return s=s*2003750834e-2/180,{lat:s,lng:n}},mercatorDecrypt(e,t){const n=t/2003750834e-2*180;let s=e/2003750834e-2*180;return s=180/this.PI*(2*Math.atan(Math.exp(s*this.PI/180))-this.PI/2),{lat:s,lng:n}},distance(e,t,n,s){const r=Math.cos(e*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((t-s)*this.PI/180),a=Math.sin(e*this.PI/180)*Math.sin(n*this.PI/180);let o=r+a;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(e,t){return t<72.004||t>137.8347||e<.8293||e>55.8271},transformLat(e,t){let n=-100+2*e+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(160*Math.sin(t/12*this.PI)+320*Math.sin(t*this.PI/30))*2/3,n},transformLon(e,t){let n=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return n+=(20*Math.sin(6*e*this.PI)+20*Math.sin(2*e*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(150*Math.sin(e/12*this.PI)+300*Math.sin(e/30*this.PI))*2/3,n},randomCoordinate(e,t,n,s){return{lat:Math.random()*(s-t)+t,lng:Math.random()*(n-e)+e}}};Date.prototype.format=function(e){const t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in t)if(new RegExp("("+n+")").test(e)){const s=n.length===1?1:Number(n.slice(1));e=e.replace(RegExp.$1,("00"+t[n]).substr((""+t[n]).length+s-(t[n]+"").length))}return e},Date.prototype.addDate=function(e,t){const n=new Date(this);switch(e){case"y":n.setFullYear(this.getFullYear()+t);break;case"q":n.setMonth(this.getMonth()+t*3);break;case"M":n.setMonth(this.getMonth()+t);break;case"w":n.setDate(this.getDate()+t*7);break;case"d":n.setDate(this.getDate()+t);break;case"h":n.setHours(this.getHours()+t);break;case"m":n.setMinutes(this.getMinutes()+t);break;case"s":n.setSeconds(this.getSeconds()+t);break;default:n.setDate(this.getDate()+t);break}return n};const V={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(e){if(typeof e=="string"){var t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(t&&t.length>3)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),t&&t.length>6)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]));if(t=e.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),t&&t.length>7)return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(t[4]),parseInt(t[5]),parseInt(t[6]),parseInt(t[7]))}return null},formatDateInterval(e,t){const n=new Date(e),i=new Date(t).getTime()-n.getTime(),r=Math.floor(i/(24*3600*1e3)),a=i%(24*3600*1e3),o=Math.floor(a/(3600*1e3)),c=a%(3600*1e3),h=Math.floor(c/(60*1e3)),u=c%(60*1e3),d=Math.round(u/1e3);let f="";return r>0&&(f+=r+"天"),o>0&&(f+=o+"时"),h>0&&(f+=h+"分"),d>0&&(f+=d+"秒"),r===0&&o===0&&h===0&&d===0&&(f="少于1秒"),f},formatterCounter(e){const t=function(o){return(o>10?"":"0")+(o||0)},n=t(Math.floor(e/3600)),s=e%3600,i=t(Math.floor(s/60)),r=s%60,a=t(Math.round(r));return`${n}:${i}:${a}`},sleep(e){}};function Z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function N(e){return Z(e).split(/\s+/)}const tt={getStyle(e,t){var s;let n=e.style[t];if(!n||n==="auto"){const i=(s=document.defaultView)==null?void 0:s.getComputedStyle(e,null);n=i?i[t]:null,n==="auto"&&(n=null)}return n},create(e,t,n){const s=document.createElement(e);return s.className=t||"",n&&n.appendChild(s),s},remove(e){const t=e.parentNode;t&&t.removeChild(e)},empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)},toFront(e){const t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)},toBack(e){const t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)},getClass(e){return((e==null?void 0:e.host)||e).className.toString()},hasClass(e,t){var s;if((s=e.classList)!=null&&s.contains(t))return!0;const n=this.getClass(e);return n.length>0&&new RegExp(`(^|\\s)${t}(\\s|$)`).test(n)},addClass(e,t){if(e.classList!==void 0){const n=N(t);for(let s=0,i=n.length;s<i;s++)e.classList.add(n[s])}else if(!this.hasClass(e,t)){const n=this.getClass(e);this.setClass(e,(n?n+" ":"")+t)}},removeClass(e,t){e.classList!==void 0?N(t).forEach(s=>e.classList.remove(s)):this.setClass(e,(" "+this.getClass(e)+" ").replace(" "+t+" "," ").trim())},setClass(e,t){"classList"in e&&(e.classList.value="",t.split(" ").forEach(n=>e.classList.add(n)))},parseFromString(e){return new DOMParser().parseFromString(e,"text/xml").children[0]}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat(e,t){return e+Math.random()*(t-e)},degreesToRadians(e){return e*this.DEG2RAD},toRadians(e){return e*this.DEG2RAD},radiansToDegrees(e){return e*this.RAD2DEG},toDegrees(e){return e*this.RAD2DEG},formatFloat(e,t=2){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}},k={toRadian:Math.PI/180,R:6371393,isLnglat(e,t){return!isNaN(e)&&!isNaN(t)&&+t>-90&&+t<90&&+e>-180&&+e<180},formatLnglat(e,t){let n="";function s(i){const r=Math.floor(i),a=Math.floor((i-r)*60),o=(i-r)*3600-a*60;return`${r}°${a}′${o.toFixed(2)}″`}return this.isLnglat(e,t)?n=s(e)+","+s(t):isNaN(e)?isNaN(t)||(n=s(t)):n=s(e),n},transformLnglat(e,t){function n(s){let r=/[sw]/i.test(s)?-1:1;const a=s.match(/[\d.]+/g)||[];let o=0;for(let c=0;c<a.length;c++)o+=parseFloat(a[c])/r,r*=60;return o}if(e&&t)return{lng:n(e),lat:n(t)}},rayCasting(e,t){for(var n=e.x,s=e.y,i=!1,r=0,a=t.length,o=a-1;r<a;o=r,r++){var c=t[r].x,h=t[r].y,u=t[o].x,d=t[o].y;if(c===n&&h===s||u===n&&d===s)return"on";if(h<s&&d>=s||h>=s&&d<s){var f=c+(s-h)*(u-c)/(d-h);if(f===n)return"on";f>n&&(i=!i)}}return i?"in":"out"},wgs84PointsDistance(e,t){var n=Math.PI;function s(dt){return dt*n/180}if(arguments.length!=2)return 0;const i=e.x,r=e.y,a=t.x,o=t.y;var c=6378137,h=63567523142e-4,u=1/298.257223563,d=s(a-i),f=Math.atan((1-u)*Math.tan(s(r))),w=Math.atan((1-u)*Math.tan(s(o))),A=Math.sin(f),S=Math.cos(f),b=Math.sin(w),v=Math.cos(w),O=d,B,W=100;do{var _=Math.sin(O),x=Math.cos(O),D=Math.sqrt(v*_*(v*_)+(S*b-A*v*x)*(S*b-A*v*x));if(D==0)return 0;var T=A*b+S*v*x,G=Math.atan2(D,T),P=S*v*_/D,I=1-P*P,E=T-2*A*b/I;isNaN(E)&&(E=0);var L=u/16*I*(4+u*(4-3*I));B=O,O=d+(1-L)*u*P*(G+L*D*(E+L*T*(-1+2*E*E)))}while(Math.abs(O-B)>1e-12&&--W>0);if(W==0)return NaN;var R=I*(c*c-h*h)/(h*h),lt=1+R/16384*(4096+R*(-768+R*(320-175*R))),U=R/1024*(256+R*(-128+R*(74-47*R))),ht=U*D*(E+U/4*(T*(-1+2*E*E)-U/6*E*(-3+4*D*D)*(-3+4*E*E))),ut=h*lt*(G-ht);return ut},rotatePoint(e,t,n){const s=(e.x-t.x)*Math.cos(Math.PI/180*-n)-(e.y-t.y)*Math.sin(Math.PI/180*-n)+t.x,i=(e.x-t.x)*Math.sin(Math.PI/180*-n)+(e.y-t.y)*Math.cos(Math.PI/180*-n)+t.y;return{x:s,y:i}},calcBearAndDis(e,t){const{x:n,y:s}=e,{x:i,y:r}=t,a=i-n,o=r-s,c=Math.sqrt(a*a+o*o);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(e,t){var n=e.lat*1,s=e.lng*1,i=t.lat*1,r=t.lng*1,a=Math.sin((r-s)*this.toRadian)*Math.cos(i*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(i*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.cos((r-s)*this.toRadian),c=Math.atan2(a,o)*(180/Math.PI),h=(i-n)*this.toRadian,u=(r-s)*this.toRadian,d=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n*this.toRadian)*Math.cos(i*this.toRadian)*Math.sin(u/2)*Math.sin(u/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),w=this.R*f;return{angle:c,distance:w}},calcPointByBearAndDis(e,t,n){const s=y.toRadians(e.lat*1),i=y.toRadians(e.lng*1),r=n/this.R;t=y.toRadians(t);const a=Math.asin(Math.sin(s)*Math.cos(r)+Math.cos(s)*Math.sin(r)*Math.cos(t)),o=i+Math.atan2(Math.sin(t)*Math.sin(r)*Math.cos(s),Math.cos(r)-Math.sin(s)*Math.sin(a));return{lat:y.toDegrees(a),lng:y.toDegrees(o)}},mercatorTolonlat(e,t){const n=e/2003750834e-2*180;var s=t/2003750834e-2*180;const i=180/Math.PI*(2*Math.atan(Math.exp(s*Math.PI/180))-Math.PI/2);return{lng:n,lat:i}},lonlatToMercator(e,t){var n=6378137;const s=e*Math.PI/180*n;var i=t*Math.PI/180;const r=n/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)));return{x:s,y:r}}},et={convertBase64ToBlob(e){const t=e.split(",")[0].split(":")[1].split(";")[0],n=atob(e.split(",")[1]),s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=n.charCodeAt(a);const i=new Uint8Array(s);return new Blob([i],{type:t})},convertUrlToBase64(e,t,n){return new Promise((s,i)=>{var r=new Image;r.crossOrigin="Anonymous",r.src=e,r.onload=function(){var a=document.createElement("canvas");a.width=t||r.width,a.height=n||r.height;var o=a.getContext("2d");if(!o){i(new Error("Failed to get canvas context"));return}o.drawImage(r,0,0,r.width,r.height);var c=r.src.substring(r.src.lastIndexOf(".")+1).toLowerCase(),h=a.toDataURL("image/"+c),u={dataURL:h,type:"image/"+c,ext:c};s(u)},r.onerror=i})},convertBase64ToFile(e,t){const n=e.split(","),s=n[0].match(/:(.*?);/),i=s?s[1]:"image/png",r=atob(n[1]),a=new Uint8Array(r.length);for(let c=0;c<r.length;c++)a[c]=r.charCodeAt(c);return new File([a],t,{type:i})},downloadFromFile(e,t){if(typeof e=="object")if(e instanceof Blob)e=URL.createObjectURL(e);else{const s=JSON.stringify(e),i=new Blob([s],{type:"text/json"});e=window.URL.createObjectURL(i)}else if(typeof e=="string"&&e.indexOf("http")===-1){const s=new Blob([e],{type:"text/json"});e=window.URL.createObjectURL(s)}var n=document.createElement("a");n.href=e,n.download=t||"",n.click(),window.URL.revokeObjectURL(n.href)}},nt={debounce(e,t,n=!0){let s=null,i,r,a,o;const c=function(){const h=Date.now()-a;h<t&&h>0?s=setTimeout(c,t-h):(s=null,n||(o=e.apply(r,i)))};return function(...h){r=this,a=Date.now();const u=n&&!s;return s||(s=setTimeout(c,t)),u&&(o=e.apply(r,h),s||(r=h=null)),o}},throttle(e,t,n){let s=0,i=null;return function(...r){const a=this;if(n===1){const o=Date.now();o-s>t&&(e.apply(a,r),s=o)}else n===2&&(i||(i=setTimeout(()=>{i=null,e.apply(a,r)},t)))}},recurve(e,t=500,n=5e3){let s=0;setTimeout(()=>{s++,s<Math.floor(n/t)&&(e.call(this),setTimeout(this.recurve.bind(this,e,t,n),t))},t)}},F={checkStr(e,t){switch(t){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(e);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(e);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(e);case"postal":return/[1-9]\d{5}(?!\d)/.test(e);case"QQ":return/^[1-9][0-9]{4,9}$/.test(e);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(e);case"money":return/^\d*(?:\.\d{0,2})?$/.test(e);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);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(e);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(e)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(e);case"number":return/^[0-9]$/.test(e);case"english":return/^[a-zA-Z]+$/.test(e);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(e);case"lower":return/^[a-z]+$/.test(e);case"upper":return/^[A-Z]+$/.test(e);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(e);default:return!0}},changeCase(e,t){switch(t=t||4,t){case 1:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return e.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return e.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return e.toUpperCase();case 5:return e.toLowerCase();default:return e}},tag(e,...t){return t=t.map(n=>{switch(M.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),e.reduce((n,s,i)=>`${n}${t[i-1]}${s}`)},getByteLength(e){return e.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(e,t,n){var s=/[^\x00-\xff]/g;if(e.replace(s,"mm").length<=n)return e;for(var i=Math.floor(n/2),r=i;r<e.length;r++){let a=e.substring(t,r);if(a.replace(s,"mm").length>=n)return a}return e},asString(e){if(M.isEmpty(e))return"";switch(M.getDataType(e)){case"Object":case"Array":return JSON.stringify(e);default:return e}}},st={notNull(e){if(M.isEmpty(e))throw Error("不能为空:>>>"+e)},legalLnglat(e,t){if(!k.isLnglat(e,t))throw Error(p.COORDINATE_ERROR)},contain(e,...t){let n=!1;const s=t.length||0;for(let i=0,r=s;i<r;i++)n=e.indexOf(t[i])>=0;if(n)throw Error(p.STRING_CHECK_LOSS)},verify:{array(e){if(M.getDataType(e)!=="Array")throw Error(p.PARAMETER_ERROR_ARRAY+":>>>"+e)},function(e){if(M.getDataType(e)!=="Function")throw Error(p.PARAMETER_ERROR_FUNCTION+":>>>"+e)},object(e){if(M.getDataType(e)!=="Object")throw Error(p.PARAMETER_ERROR_OBJECT+":>>>"+e)}},legalJSON(e){try{JSON.parse(e)}catch{throw Error(p.JSON_PARSE_ERROR+":>>>"+e)}},legalData(e,t){const n=F.checkStr(e,t);let s="";switch(t){case"phone":s="电话";break;case"tel":s="座机";break;case"card":s="身份证";break;case"pwd":s="密码";break;case"postal":s="邮政编码";break;case"QQ":s="QQ";break;case"email":s="邮箱";break;case"money":s="金额";break;case"URL":s="网址";break;case"IP":s="IP";break;case"date":s="日期时间";break;case"number":s="数字";break;case"english":s="英文";break;case"chinese":s="中文";break;case"lower":s="小写";break;case"upper":s="大写";break;case"HTML":s="HTML标记";break}if(!n)throw Error(p.PARAMETER_ERROR+":>>>不是"+s)}};class rt{constructor(t){g(this,"audio");this.audio=new Audio,this.audio.src=t}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(t){this.audio.muted=t}}class it{constructor(t){M.getDataType(t)==="String"&&(t=document.querySelector("#"+t)),this.ctx=t.getContext("2d")}drawLine(t,n,s,i,r={}){this.cxt.beginPath();const a=r.width||1,o=r.color||"#000";this.cxt.lineWidth=a,this.cxt.fillStyle=o,this.cxt.moveTo(t,n),this.cxt.lineTo(s,i),this.cxt.closePath(),this.cxt.fill()}drawArc(t,n,s,i,r,a,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(t,n,s,y.degreesToRadians(i),y.degreesToRadians(r),a),this.cxt.stroke())}}class at{constructor(t=1){this.magnification=t}_getSystem(){var t=navigator.userAgent.toLowerCase();if(t.indexOf("windows")>=0)return!0}_addHandler(t,n,s){t.addEventListener?t.addEventListener(n,s,!1):t.attachEvent?t.attachEvent("on"+n,s):t["on"+n]=s}_correct(){let t=window.innerWidth;if(typeof t!="number"&&(document.compatMode=="CSS1Compat"?t=document.documentElement.clientWidth:t=document.body.clientWidth),t<=750){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*75*Math.min(s,2)+"px"}else if(t>750&&t<=1200){const s=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=this.magnification*85*Math.min(s,2)+"px"}else{const s=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(s,2)+"px"}}_watch(){let t=this;t._addHandler(window,"resize",function(){t._correct()})}init(){let t=this;t._getSystem()&&(t._correct(),t._watch())}}class ${constructor(){g(this,"_listeners");g(this,"_mutex",{});g(this,"_context")}addEventListener(t,n,s,i=!1){this._listeners===void 0&&(this._listeners={}),this._context=s;const r=this._mutex,a=this._listeners;return a[t]===void 0&&(a[t]=[]),a[t].indexOf(n)===-1&&(i&&(r[t]=n),a[t].push(n)),this}hasEventListener(t,n){if(this._listeners===null||this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(n)!==-1}removeEventListener(t,n){if(this._listeners===void 0)return;const i=this._listeners[t];if(this._mutex[t]===n&&(this._mutex[t]=null),i!==void 0){const r=i.map(a=>a.toString()).indexOf(n.toString());r!==-1&&i.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const s=this._listeners[t.type];if(s!==void 0){t.target=this;const i=s.slice(0);if(this._mutex[t.type]!==void 0){const r=i.find(a=>a===this._mutex[t.type]);if(r){r.call(this._context||this,t);return}}for(let r=0,a=i.length;r<a;r++){const o=i[r];typeof o=="function"&&o.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}class C extends Map{isEmpty(){return this.size===0}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}fromEntries(){}}C.prototype.fromEntries=function(e=[]){const t=new C;return e.forEach(n=>{Array.isArray(n)&&n.length===2&&t.set(n[0],n[1])}),t};class ot extends ${constructor(n="ws://127.0.0.1:10088"){super();g(this,"maxCheckTimes",10);g(this,"url");g(this,"checkTimes",0);g(this,"connectStatus",!1);g(this,"client",null);this.maxCheckTimes=10,this.url=n,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){const n=this;this.client.onopen=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CONNECT,message:s})},this.client.onmessage=function(s){n.connectStatus=!0,n.dispatchEvent({type:m.WEB_SOCKET_MESSAGE,message:s})},this.client.onclose=function(s){n.dispatchEvent({type:m.WEB_SOCKET_CLOSE,message:s})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(s){n.dispatchEvent({type:m.WEB_SOCKET_ERROR,message:s})})}}catch(n){console.error("创建ws连接失败"+this.url+":"+n)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(n){this.checkTimes>n||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(n)},2e3)}send(n){return this.client&&this.client.readyState===1?(this.client.send(n),!0):(console.error(this.url+"消息发送失败:"+n),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}}class ct{constructor(t=1){g(this,"cacheType");g(this,"storage");if(this.cacheType=t,t===1)this.storage=window.localStorage;else if(t===2)this.storage=window.sessionStorage;else throw new Error(p.PARAMETER_ERROR)}setItem(t,n,s){const i={key:t,value:n};if(this.cacheType===1){const r=Date.now();s&&(i.expired=r+s*1e3)}return this.storage[t]=JSON.stringify(i),i}getItem(t){const n=this.storage.getItem(t);if(n===null)return null;const s=JSON.parse(n)||{};if(this.cacheType===1){const i=s.expired?new Date(s.expired).getTime():Date.now();if(Date.now()>i)return this.remove(t),null}return s.value}remove(t){t&&(t.indexOf(",")>-1?t.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(t))}clear(){this.storage.clear()}}l.AnimateUtils=Y,l.ArrayUtils=K,l.AssertUtils=st,l.AudioPlayer=rt,l.BrowserUtils=J,l.CanvasDrawer=it,l.Cookie=Q,l.CoordsUtils=X,l.DateUtils=V,l.DevicePixelRatio=at,l.DomUtils=tt,l.ErrorType=p,l.EventDispatcher=$,l.EventType=m,l.FileUtils=et,l.GeoUtils=k,l.GraphicType=j,l.HashMap=C,l.LayerType=z,l.MathUtils=y,l.MeasureMode=H,l.ObjectState=q,l.OptimizeUtils=nt,l.StringUtils=F,l.Utils=M,l.WebSocketClient=ot,l.WebStorage=ct,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ErrorType, EventType, GraphicType, LayerType } from './constant/index';
2
1
  import { AnimateUtils, ArrayUtils, AssertUtils, BrowserUtils, Utils, Cookie, CoordsUtils, DateUtils, DomUtils, FileUtils, GeoUtils, MathUtils, OptimizeUtils, StringUtils } from './utils/index';
3
2
  import { AudioPlayer, CanvasDrawer, DevicePixelRatio, EventDispatcher, HashMap, WebSocketClient, WebStorage } from './core/index';
4
- export { ErrorType, EventType, GraphicType, LayerType, AnimateUtils, ArrayUtils, AssertUtils, BrowserUtils, Utils, Cookie, CoordsUtils, DateUtils, DomUtils, FileUtils, GeoUtils, MathUtils, OptimizeUtils, StringUtils, AudioPlayer, CanvasDrawer, DevicePixelRatio, EventDispatcher, HashMap, WebSocketClient, WebStorage, };
3
+ export * from './constant';
4
+ export { AnimateUtils, ArrayUtils, AssertUtils, BrowserUtils, Utils, Cookie, CoordsUtils, DateUtils, DomUtils, FileUtils, GeoUtils, MathUtils, OptimizeUtils, StringUtils, AudioPlayer, CanvasDrawer, DevicePixelRatio, EventDispatcher, HashMap, WebSocketClient, WebStorage, };
@@ -0,0 +1,109 @@
1
+ declare const _default: {
2
+ /**
3
+ * 获取数据类型
4
+ *
5
+ * @param data 待判断的数据
6
+ * @returns 返回数据类型字符串
7
+ */
8
+ getDataType(data: any): any;
9
+ isEmpty(value: any): boolean;
10
+ isNotEmpty(val: any): boolean;
11
+ json2form(json: {
12
+ [x: string]: string | Blob;
13
+ }): FormData;
14
+ /**
15
+ * 将json对象转换为查询字符串
16
+ *
17
+ * @param json 待转换的json对象
18
+ * @returns 转换后的查询字符串
19
+ */
20
+ json2Query(json: {
21
+ [x: string]: any;
22
+ }): string;
23
+ /**
24
+ * 生成GUID
25
+ *
26
+ * @returns 返回一个由8个16进制数组成的GUID字符串
27
+ */
28
+ generateGuid(): string;
29
+ /**
30
+ * 将参数进行解码并返回解码后的字符串
31
+ *
32
+ * @param args 参数
33
+ * @returns 解码后的字符串
34
+ */
35
+ decodeDict(...args: string[]): string;
36
+ /**
37
+ * 将一个或多个对象的所有可枚举属性复制到目标对象。
38
+ *
39
+ * @param dest 目标对象,用于接收复制的属性。
40
+ * @param args 一个或多个源对象,用于提供要复制的属性。
41
+ * @returns 返回目标对象,包含所有复制的属性。
42
+ */
43
+ extend(dest: {
44
+ [x: string]: any;
45
+ }, ...args: any[]): {
46
+ [x: string]: any;
47
+ };
48
+ /**
49
+ * 将RGB颜色值转换为十六进制颜色值
50
+ *
51
+ * @param rgb RGB颜色值数组,包含三个0-255之间的整数
52
+ * @returns 转换后的十六进制颜色值,以#开头
53
+ */
54
+ rgb2hex(rgb: number[]): string;
55
+ /**
56
+ * 将扁平化数组转换为树形结构数组
57
+ *
58
+ * @param data 扁平化数组
59
+ * @param idPropertyName 数据中标识id的字段名,默认为'id'
60
+ * @param parentIdPropertyName 数据中标识父节点id的字段名,默认为'parentId'
61
+ * @param childrenPropertyName 树形结构中标识子节点的字段名,默认为'children'
62
+ * @returns 转换后的树形结构数组
63
+ */
64
+ convertToTree2(data: any[], idPropertyName?: string, parentIdPropertyName?: string, childrenPropertyName?: string): any[];
65
+ /**
66
+ * 异步加载script
67
+ *
68
+ * @param {*} url
69
+ */
70
+ asyncLoadScript(url: string): Promise<HTMLScriptElement>;
71
+ /**
72
+ * 加载样式文件
73
+ *
74
+ * @param urls 样式文件URL数组
75
+ * @returns 无返回值
76
+ */
77
+ loadStyle(urls: string[]): void;
78
+ /**
79
+ * 将模板字符串中的占位符替换为给定对象中的值
80
+ *
81
+ * @param str 模板字符串
82
+ * @param data 包含替换值的对象
83
+ * @returns 替换后的字符串
84
+ * @throws 当对象中没有找到与占位符对应的值时,抛出错误
85
+ */
86
+ template(str: string, data: {
87
+ [x: string]: any;
88
+ }): string;
89
+ /**
90
+ * 删除对象中所有值为空的属性
91
+ *
92
+ * @param data 待处理的对象
93
+ * @returns 返回处理后的对象
94
+ */
95
+ deleteEmptyProperty(data: {
96
+ [x: string]: any;
97
+ }): {
98
+ [k: string]: any;
99
+ };
100
+ deepAssign(target: any, ...sources: any[]): any;
101
+ /**
102
+ * 复制文本到剪贴板
103
+ *
104
+ * @param text 要复制的文本
105
+ * @returns 返回一个Promise,表示复制操作的结果
106
+ */
107
+ handleCopyValue(text: string): Promise<void>;
108
+ };
109
+ export default _default;
@@ -0,0 +1,23 @@
1
+ declare const _default: {
2
+ lastMonthDate: Date;
3
+ thisMonthDate: Date;
4
+ nextMonthDate: Date;
5
+ lastWeekDate: Date;
6
+ thisWeekDate: Date;
7
+ nextWeekDate: Date;
8
+ lastDayDate: Date;
9
+ thisDayDate: Date;
10
+ nextDayDate: Date;
11
+ parseDate(str: string): Date;
12
+ /**
13
+ * 将时间间隔转换成中国话
14
+ *
15
+ * @param {*} startTime
16
+ * @param {*} endTime
17
+ * @returns {*}
18
+ */
19
+ formatDateInterval(startTime: string | number | Date, endTime: string | number | Date): string;
20
+ formatterCounter(times: number): string;
21
+ sleep(d: number): void;
22
+ };
23
+ export default _default;
@@ -0,0 +1,90 @@
1
+ declare const _default: {
2
+ /**
3
+ * 获取元素的样式值
4
+ *
5
+ * @param el 元素对象
6
+ * @param style 样式属性名称
7
+ * @returns 元素的样式值,如果获取不到则返回 null
8
+ */
9
+ getStyle(el: HTMLElement, style: keyof CSSStyleDeclaration): any;
10
+ /**
11
+ * 创建一个HTML元素
12
+ *
13
+ * @param tagName 元素标签名
14
+ * @param className 元素类名
15
+ * @param container 父容器,若传入,则新创建的元素会被添加到该容器中
16
+ * @returns 返回新创建的HTML元素
17
+ */
18
+ create(tagName: any, className: string, container: HTMLElement): any;
19
+ /**
20
+ * 从父节点中移除指定元素。
21
+ *
22
+ * @param el 要移除的元素对象,必须包含parentNode属性。
23
+ */
24
+ remove(el: HTMLElement): void;
25
+ /**
26
+ * 清空给定元素的子节点
27
+ *
28
+ * @param el 要清空子节点的元素,包含firstChild和removeChild属性
29
+ */
30
+ empty(el: HTMLElement): void;
31
+ /**
32
+ * 将元素移到父节点的最前面
33
+ *
34
+ * @param el 要移动的元素,需要包含 parentNode 属性
35
+ */
36
+ toFront(el: HTMLElement): void;
37
+ /**
38
+ * 将元素移动到其父节点的最前面
39
+ *
40
+ * @param el 要移动的元素,需要包含parentNode属性
41
+ */
42
+ toBack(el: HTMLElement): void;
43
+ /**
44
+ * 获取元素的类名
45
+ *
46
+ * @param el 包含对应元素和类名的对象
47
+ * @param el.correspondingElement 对应的元素
48
+ * @param el.className 类名对象
49
+ * @param el.className.baseVal 类名字符串
50
+ * @returns 返回元素的类名字符串
51
+ */
52
+ getClass(el: HTMLElement): string;
53
+ /**
54
+ * 判断元素是否包含指定类名
55
+ *
56
+ * @param el 元素对象,包含classList属性,classList属性包含contains方法
57
+ * @param name 要判断的类名
58
+ * @returns 返回一个布尔值,表示元素是否包含指定类名
59
+ */
60
+ hasClass(el: HTMLElement, name: string): boolean;
61
+ /**
62
+ * 给指定的 HTML 元素添加类名
63
+ *
64
+ * @param el 要添加类名的 HTML 元素
65
+ * @param name 要添加的类名,多个类名之间用空格分隔
66
+ */
67
+ addClass(el: HTMLElement, name: string): void;
68
+ /**
69
+ * 从元素中移除指定类名
70
+ *
71
+ * @param el 要移除类名的元素
72
+ * @param name 要移除的类名,多个类名用空格分隔
73
+ */
74
+ removeClass(el: HTMLElement, name: string): void;
75
+ /**
76
+ * 设置元素的 CSS 类名
77
+ *
78
+ * @param el HTML 或 SVG 元素
79
+ * @param name 要设置的类名,多个类名之间用空格分隔
80
+ */
81
+ setClass(el: HTMLElement | SVGElement, name: string): void;
82
+ /**
83
+ * 从字符串中解析XML文档,并返回根节点
84
+ *
85
+ * @param str 要解析的XML字符串
86
+ * @returns 解析后的XML文档的根节点
87
+ */
88
+ parseFromString(str: string): Element;
89
+ };
90
+ export default _default;
@@ -0,0 +1,38 @@
1
+ declare const _default: {
2
+ /**
3
+ * 将Base64编码的字符串转换为Blob对象
4
+ *
5
+ * @param data Base64编码的字符串
6
+ * @returns 转换后的Blob对象
7
+ */
8
+ convertBase64ToBlob(data: string): Blob;
9
+ /**
10
+ * 将图片的URL转换为Base64编码
11
+ *
12
+ * @param url 图片的URL地址
13
+ * @param width 图片的宽度,默认为图片原始宽度
14
+ * @param height 图片的高度,默认为图片原始高度
15
+ * @returns 返回Promise对象,解析后得到包含Base64编码数据的对象
16
+ */
17
+ convertUrlToBase64(url: string, width: number, height: number): Promise<{
18
+ dataURL: string;
19
+ type: string;
20
+ ext: string;
21
+ }>;
22
+ /**
23
+ * 将base64字符串转换为文件对象
24
+ *
25
+ * @param dataurl 包含base64字符串的数据URL
26
+ * @param filename 文件的名称
27
+ * @returns 返回文件对象
28
+ */
29
+ convertBase64ToFile(dataurl: string, filename: string): File;
30
+ /**
31
+ * 直接下载文件,支持blob类型和url类型
32
+ *
33
+ * @param {*} data
34
+ * @param {*} saveName
35
+ */
36
+ downloadFromFile(data: string[] | BlobPart | MediaSource, saveName: string): void;
37
+ };
38
+ export default _default;
@@ -0,0 +1,115 @@
1
+ type Coordinate = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ type LngLat = {
6
+ lng: number;
7
+ lat: number;
8
+ };
9
+ declare const _default: {
10
+ toRadian: number;
11
+ R: number;
12
+ /**
13
+ * 判断给定的经纬度是否合法
14
+ *
15
+ * @param lng 经度值
16
+ * @param lat 纬度值
17
+ * @returns 如果经纬度合法,返回true;否则返回false
18
+ */
19
+ isLnglat(lng: number, lat: number): boolean;
20
+ /**
21
+ * 格式化经纬度为度分秒格式
22
+ *
23
+ * @param lng 经度
24
+ * @param lat 纬度
25
+ * @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
26
+ */
27
+ formatLnglat(lng: any, lat: any): string;
28
+ /**
29
+ * 将经纬度字符串转换为度
30
+ *
31
+ * @param lng 经度字符串
32
+ * @param lat 纬度字符串
33
+ * @returns 转换后的经纬度对象
34
+ */
35
+ transformLnglat(lng: any, lat: any): any;
36
+ /**
37
+ * 射线法判断点是否在多边形内
38
+ *
39
+ * @param p 点对象,包含x和y属性
40
+ * @param poly 多边形顶点数组,可以是字符串数组或对象数组
41
+ * @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
42
+ */
43
+ rayCasting(p: {
44
+ x: any;
45
+ y: any;
46
+ }, poly: string | any[]): "on" | "in" | "out";
47
+ /**
48
+ * 计算两个WGS-84坐标点之间的距离
49
+ *
50
+ * @param fromPoint 起始点坐标
51
+ * @param toPoint 目标点坐标
52
+ * @returns 返回两个坐标点之间的距离,单位为米
53
+ */
54
+ wgs84PointsDistance(fromPoint: Coordinate, toPoint: Coordinate): number;
55
+ /**
56
+ * 旋转点
57
+ *
58
+ * @param p1 旋转前点坐标
59
+ * @param p2 旋转中心坐标
60
+ * @param θ 旋转角度(顺时针旋转为正)
61
+ * @returns 旋转后点坐标
62
+ */
63
+ rotatePoint(p1: Coordinate, p2: Coordinate, θ: number): {
64
+ x: number;
65
+ y: number;
66
+ };
67
+ /**
68
+ * 根据两个平面坐标点计算方位角和距离
69
+ *
70
+ * @param p1 第一个点的坐标对象
71
+ * @param p2 第二个点的坐标对象
72
+ * @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
73
+ */
74
+ calcBearAndDis(p1: Coordinate, p2: Coordinate): {
75
+ angle: number;
76
+ distance: number;
77
+ };
78
+ /**
79
+ * 根据两个经纬度点计算方位角和距离
80
+ *
81
+ * @param latlng1 第一个经纬度点
82
+ * @param latlng2 第二个经纬度点
83
+ * @returns 包含方位角和距离的对象
84
+ */
85
+ calcBearAndDisByPoints(latlng1: LngLat, latlng2: LngLat): {
86
+ angle: number;
87
+ distance: number;
88
+ };
89
+ /**
90
+ * 根据给定的经纬度、角度和距离计算新的经纬度点
91
+ *
92
+ * @param latlng 给定的经纬度点,类型为LngLat
93
+ * @param angle 角度值,单位为度,表示从当前点出发的方向
94
+ * @param distance 距离值,单位为米,表示从当前点出发的距离
95
+ * @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
96
+ */
97
+ calcPointByBearAndDis(latlng: LngLat, angle: number, distance: number): LngLat;
98
+ /**
99
+ * 将墨卡托坐标转换为经纬度坐标
100
+ *
101
+ * @param x 墨卡托坐标的x值
102
+ * @param y 墨卡托坐标的y值
103
+ * @returns 返回包含转换后的经度lng和纬度lat的对象
104
+ */
105
+ mercatorTolonlat(x: number, y: number): LngLat;
106
+ /**
107
+ * 将经纬度坐标转换为墨卡托坐标
108
+ *
109
+ * @param lng 经度值
110
+ * @param lat 纬度值
111
+ * @returns 墨卡托坐标对象,包含x和y属性
112
+ */
113
+ lonlatToMercator(lng: number, lat: number): Coordinate;
114
+ };
115
+ export default _default;
@@ -0,0 +1,21 @@
1
+ declare const _default: {
2
+ /**
3
+ * 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。
4
+ *
5
+ * @param func 需要防抖的函数。
6
+ * @param wait 等待时间,单位毫秒。
7
+ * @param immediate 是否立即执行函数,默认为true。
8
+ * @returns 返回防抖后的函数。
9
+ */
10
+ debounce(func: Function, wait: number, immediate?: boolean): Function;
11
+ throttle(func: Function, wait: number, type: number): (...args: any[]) => void;
12
+ /**
13
+ * 递归调用函数,以一定的频率和持续时间执行。
14
+ *
15
+ * @param fun 要递归调用的函数。
16
+ * @param frequency 每次调用函数之间的时间间隔,单位为毫秒,默认为500毫秒。
17
+ * @param duration 函数递归调用的总时长,单位为毫秒,默认为5000毫秒。
18
+ */
19
+ recurve(fun: Function, frequency?: number, duration?: number): void;
20
+ };
21
+ export default _default;
@@ -0,0 +1,86 @@
1
+ declare const _default: {
2
+ /**
3
+ * 校验字符串是否符合指定类型
4
+ *
5
+ * @param str 待校验字符串
6
+ * @param type 校验类型,可选值包括:
7
+ * - 'phone': 手机号码
8
+ * - 'tel': 座机
9
+ * - 'card': 身份证
10
+ * - 'pwd': 密码(以字母开头,长度在6~18之间,只能包含字母、数字和下划线)
11
+ * - 'postal': 邮政编码
12
+ * - 'QQ': QQ号
13
+ * - 'email': 邮箱
14
+ * - 'money': 金额(小数点2位)
15
+ * - 'URL': 网址
16
+ * - 'IP': IP地址
17
+ * - 'date': 日期时间
18
+ * - 'number': 数字
19
+ * - 'english': 英文
20
+ * - 'chinese': 中文
21
+ * - 'lower': 小写字母
22
+ * - 'upper': 大写字母
23
+ * - 'HTML': HTML标记
24
+ * @returns 校验结果,符合返回true,否则返回false
25
+ */
26
+ checkStr(str: string, type: any): boolean;
27
+ /**
28
+ * 转换字符串大小写
29
+ *
30
+ * @param str 待转换的字符串
31
+ * @param type 转换类型,可选值为 1-5,默认为 4
32
+ * 1:首字母大写,其余小写
33
+ * 2:首字母小写,其余大写
34
+ * 3:字母大小写反转
35
+ * 4:全部大写
36
+ * 5:全部小写
37
+ * @returns 转换后的字符串
38
+ */
39
+ changeCase(str: string, type: number): string;
40
+ /**
41
+ * 根据字符串数组和参数生成新的字符串
42
+ *
43
+ * @param strArray 字符串数组
44
+ * @param args 可变参数列表,支持 Object、Array 类型和任意其他类型,若为 null 或 undefined,则按类型默认转换为 '{}'、'[]' 或 ''
45
+ * @returns 返回生成的新字符串
46
+ */
47
+ tag(strArray: any[], ...args: any[]): any;
48
+ /**
49
+ * 计算字符串的字节长度
50
+ *
51
+ * @param str 需要计算字节长度的字符串
52
+ * @returns 返回字符串的字节长度
53
+ */
54
+ getByteLength(str: {
55
+ replace: (arg0: RegExp, arg1: string) => {
56
+ (): any;
57
+ new (): any;
58
+ length: any;
59
+ };
60
+ }): any;
61
+ /**
62
+ * 截取字符串中指定字节长度的子串
63
+ *
64
+ * @param str 字符串对象,包含replace、length和substring方法
65
+ * @param start 截取起始位置
66
+ * @param n 截取字节长度
67
+ * @returns 返回截取后的子串
68
+ */
69
+ subStringByte(str: {
70
+ replace: (arg0: RegExp, arg1: string) => {
71
+ (): any;
72
+ new (): any;
73
+ length: number;
74
+ };
75
+ length: number;
76
+ substring: (arg0: any, arg1: number) => any;
77
+ }, start: any, n: number): any;
78
+ /**
79
+ * 将值转换为字符串
80
+ *
81
+ * @param value 要转换的值
82
+ * @returns 转换后的字符串,如果值为空,则返回空字符串
83
+ */
84
+ asString(value: any): any;
85
+ };
86
+ export default _default;