gis-common 5.1.9 → 5.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.
- package/dist/core/Color.d.ts +1 -1
- package/dist/gis-common.es.js +14008 -20
- package/dist/gis-common.umd.js +1 -1
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
package/dist/gis-common.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mqtt-browser")):"function"==typeof define&&define.amd?define(["exports","mqtt-browser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={},t.mqttBrowser)}(this,(function(t,e){"use strict";var n,r=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),i=(t=>(t.MAP_RENDER="mapRender",t.MAP_READY="mapReady",t.MOUSE_CLICK="click",t.MOUSE_DOUBLE_CLICK="dblclick",t.MOUSE_MOVE="mousemove",t.MOUSE_IN="mousein",t.MOUSE_OUT="mouseout",t.MOUSE_RIGHT_CLICK="mouseRightClick",t.KEY_DOWN="keyDown",t.KEY_UP="keyUp",t.DRAW_ACTIVE="drawActive",t.DRAW_MOVE="drawMove",t.DRAW_COMPLETE="drawComplete",t.MQTT_CONNECT="mqttConnect",t.MQTT_ERROR="mqttError",t.MQTT_MESSAGE="mqttMessage",t.MQTT_CLOSE="mqttClose",t.WEB_SOCKET_CONNECT="webSocketConnect",t.WEB_SOCKET_ERROR="webSocketError",t.WEB_SOCKET_MESSAGE="webSocketMessage",t.WEB_SOCKET_CLOSE="webSocketClose",t))(i||{}),o=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="任务处理失败",t.PROCESS_TIMEOUT="任务处理超时",t.AUTH_VERIFY_ERROR="权限验证失败",t.INSTANCE_DUPLICATE="实例为单例模式,不允许重复构建",t.STRING_CHECK_LOSS="字符串缺少关键字",t.PARAMETER_ERROR="验证参数类型失败",t.PARAMETER_ERROR_ARRAY="验证参数类型失败,必须是数组",t.PARAMETER_ERROR_STRING="验证参数类型失败,必须是字符",t.PARAMETER_ERROR_FUNCTION="验证参数类型失败,必须是函数",t.PARAMETER_ERROR_OBJECT="验证参数类型失败,必须是对象",t.PARAMETER_ERROR_INTEGER="验证参数类型失败,必须是整型",t.PARAMETER_ERROR_NUMBER="验证参数类型失败,必须是数值",t.PARAMETER_ERROR_LACK="验证参数类型失败,必须非空",t.PARAMETER_ERROR_ENUM="验证参数类型失败,必须是指定的值",t.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_JSON="JSON解析失败,格式有误",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t.REQUEST_ERROR="请求资源失败",t.REQUEST_ERROR_CROSS="不允许跨站点访问资源",t.REQUEST_ERROR_TIMEOUT="请求超时,请检查网络",t.REQUEST_ERROR_NOT_FOUND="请求资源不存在",t.REQUEST_ERROR_FORBIDDEN="请求资源禁止访问",t.REQUEST_ERROR_EMPTY="请求数据记录为空",t))(o||{}),a=(t=>(t[t.SUPER_MAP_IMAGES=0]="SUPER_MAP_IMAGES",t[t.SUPER_MAP_DATA=1]="SUPER_MAP_DATA",t[t.ARC_GIS_MAP_IMAGES=2]="ARC_GIS_MAP_IMAGES",t[t.ARC_GIS_MAP_DATA=3]="ARC_GIS_MAP_DATA",t[t.OSGB_LAYER=4]="OSGB_LAYER",t[t.S3M_GROUP=5]="S3M_GROUP",t[t.TERRAIN_LAYER=6]="TERRAIN_LAYER",t))(a||{}),l=(t=>(t[t.ADD=0]="ADD",t[t.MODIFY=1]="MODIFY",t[t.DETAIL=2]="DETAIL",t))(l||{}),c=(t=>(t[t.REVERSE_CASE=0]="REVERSE_CASE",t[t.UPPER_CAMEL_CASE=1]="UPPER_CAMEL_CASE",t[t.LOWER_CAMEL_CASE=2]="LOWER_CAMEL_CASE",t[t.UPPER_CASE=3]="UPPER_CASE",t[t.LOWER_CASE=4]="LOWER_CASE",t))(c||{}),h=(t=>(t.POINT="Point",t.POLYLINE="Polyline",t.POLYGON="Polygon",t.RECTANGLE="Rectangle",t.BILLBOARD="Billboard",t.CYLINDER="Cylinder",t.ELLIPSOID="Ellipsoid",t.LABEL="Label",t.MODEL="Model",t.WALL="Wall",t.CIRCLE="Circle",t))(h||{}),u=(t=>(t[t.SOLID=0]="SOLID",t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(u||{}),d=(t=>(t[t.DISTANCE=0]="DISTANCE",t[t.AREA=1]="AREA",t[t.HEIGHT=2]="HEIGHT",t[t.ANGLE=3]="ANGLE",t))(d||{});const g={getException(t,e){const n=function(){Error.call(this,e),this.name=t,this.message=e,this.stack=(new Error).stack};return Error&&(n.__proto__=Error),(n.prototype=Object.create(Error&&Error.prototype)).constructor=n,n},throwException(t){throw new(this.getException("Exception",t))(t)},throwColorException(t){throw new(this.getException("ColorException",o.DATA_ERROR_COLOR+" -> "+(t||"")))(t)},throwCoordinateException(t){throw new(this.getException("CoordinateException",o.DATA_ERROR_COORDINATE+" -> "+(t||"")))(t)},throwGeoJsonException(t){throw new(this.getException("GeoJsonException",o.DATA_ERROR_GEOJSON+" -> "+(t||"")))(t)},throwEmptyException(t){throw new(this.getException("EmptyException",o.PARAMETER_ERROR_LACK+" -> "+(t||"")))(t)},throwIntegerException(t){throw new(this.getException("IntegerException",o.PARAMETER_ERROR_INTEGER+" -> "+(t||"")))(t)},throwNumberException(t){throw new(this.getException("NumberException",o.PARAMETER_ERROR_NUMBER+" -> "+(t||"")))(t)},throwArrayException(t){throw new(this.getException("ArrayException",o.PARAMETER_ERROR_ARRAY+" -> "+(t||"")))(t)},throwFunctionException(t){throw new(this.getException("FunctionException",o.PARAMETER_ERROR_FUNCTION+" -> "+(t||"")))(t)},throwProcessException(t){throw new(this.getException("ProcessException",o.PROCESS_FAIL+" -> "+(t||"")))(t)},throwNetworkException(t){throw new(this.getException("NetworkException",o.REQUEST_ERROR_TIMEOUT+" -> "+(t||"")))(t)}},p={getDataType:t=>Object.prototype.toString.call(t).slice(8,-1),asArray(t){return this.isEmpty(t)?[]:Array.isArray(t)?t:[t]},asNumber:t=>Number.isNaN(Number(t))?0:Number(t),asString(t){if(this.isEmpty(t))return"";switch(this.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},isEmpty(t){if(null==t)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}},json2form(t){const e=new FormData;return this.isEmpty(t)||Object.keys(t).forEach((n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])})),e},guid(){const t=function(){return(65536*(1+Math.random())|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+=2){const s=n[r];t[0]===s&&(e=n[r+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},asyncLoadScript:t=>new Promise(((e,n)=>{try{const r=document.querySelector(`script[src="${t}"]`);r&&r.remove();const s=document.createElement("script");s.type="text/javascript",s.src=t,"readyState"in s?s.onreadystatechange=function(){"complete"!==s.readyState&&"loaded"!==s.readyState||e(s)}:(s.onload=function(){e(s)},s.onerror=function(){n(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(s)}catch(r){n(r)}})),loadStyle(t){t.forEach((t=>{const e=document.querySelector(`link[href="${t}"]`);e&&e.remove();const n=document.createElement("link");n.href=t,n.rel="stylesheet",n.type="text/css",n.onerror=function(){g.throwException(`Style loading failed for URL: ${t}`)},document.head.appendChild(n)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,n)=>{const r=e[n];if(void 0!==r)return"function"==typeof r?r(e):r;g.throwException(`${o.DATA_ERROR_JSON}: ${t}`)})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[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(((t,n)=>{try{document.execCommand("copy"),t()}catch(r){n(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>"object"==typeof t&&null!==t,isNil:t=>void 0===t||"undefined"===t||null===t||"null"===t,isNumber:t=>"number"==typeof t&&!isNaN(t)||"string"==typeof t&&Number.isFinite(+t),isInteger:t=>parseInt(t)===t,isFunction(t){return!this.isNil(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)},isElement:t=>"object"==typeof t&&1===t.nodeType,checheVersion:(t,e)=>t.replace(/[^0-9]/gi,"")<e.replace(/[^0-9]/gi,"")},f={assign(t,...e){let n,r,s,i;for(p.isEmpty(t)&&(t={}),r=0,s=e.length;r<s;r++)for(n in i=e[r],i)i.hasOwnProperty(n)&&(t[n]=i[n]);return t},deepAssign(t,...e){const n=new WeakMap,r=(t,e)=>{if("object"!=typeof e||null===e)return e;if(n.has(e))return n.get(e);let s;s=Array.isArray(e)?Array.isArray(t)?t:[]:"object"!=typeof t||null===t||Array.isArray(t)?{}:t,n.set(e,s);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=r(s[n],e[n]));return s};let s=Object(t);for(const i of e)"object"==typeof i&&null!==i&&(s=r(s,i));return s},clone:t=>JSON.parse(JSON.stringify(t)),deepClone(t,e){return this.assign(t,e),Object.setPrototypeOf(t.__proto__,e.__proto__),t},isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse(t){if(p.isEmpty(t))return{};if(p.isObject(t))return t;try{return JSON.parse(t)}catch{g.throwException(o.DATA_ERROR_JSON+" -> "+t)}}},m={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",createCircle(t,e={}){const n=e.lineWidth||1,r=F.createCanvas(2*t,2*t),s=r.getContext("2d");return s.beginPath(),s.fillStyle=e.fillColor||"#f00",s.strokeStyle=e.color||"#f00",s.lineWidth=n,s.arc(t,t,t,0,2*Math.PI),s.stroke(),s.fill(),r.toDataURL("image/png")},createRectangle(t,e,n={}){const r=n.lineWidth||1,s=F.createCanvas(t,e),i=s.getContext("2d");return i.fillStyle=n.fillColor||"#f00",i.strokeStyle=n.color||"#f00",i.lineWidth=r,i.beginPath(),i.stroke(),i.fillRect(0,0,t,e),s.toDataURL("image/png")},getBase64(t){let e,n;if(t instanceof HTMLCanvasElement)n=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const r=e.getContext("2d");t instanceof ImageData?r.putImageData(t,0,0):t instanceof Image&&r.drawImage(t,0,0,t.width,t.height),n=e}return n.width>2048||n.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")},getBase64FromUrl(t){return new Promise(((e,n)=>{let r=new Image;r.setAttribute("crossOrigin","Anonymous"),r.src=t,r.onload=()=>{let t=this.getBase64(r);e(t)},r.onerror=n}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);if(e&&e.groups)return{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data};g.throwException("parseBase64: Invalid base64 string")},async copyImage(t){try{const e=await this.getBase64FromUrl(t),n=this.parseBase64(e);if(!n)throw new Error("Failed to parse base64 data.");let r=n.type,s=atob(n.data),i=new ArrayBuffer(s.length),o=new Uint8Array(i);for(let t=0;t<s.length;t++)o[t]=s.charCodeAt(t);let a=new Blob([i],{type:r});await navigator.clipboard.write([new ClipboardItem({[r]:a})])}catch(e){g.throwException("Failed to copy image to clipboard:")}}},E={jsonp(t,e){const n="_jsonp_"+p.guid(),r=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+n:t+="?callback="+n;let s=document.createElement("script");s.type="text/javascript",s.src=t,window[n]=function(t){e(null,t),r.removeChild(s),s=null,delete window[n]},r.appendChild(s)},get(t,e={},n){if(p.isFunction(e)){const t=n;n=e,e=t}const r=this._getClient(n);if(r.open("GET",t,!0),e){for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);r.withCredentials="include"===e.credentials,e.responseType&&(r.responseType=e.responseType)}return r.send(null),r},post(t,e={},n){let r;if("string"!=typeof t?(n=e.cb,r=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(n=e,e={}),r=e.postData),!n)throw new Error("Callback function is required");const s=this._getClient(n);return s.open("POST",t,!0),e.headers=e.headers||{},e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.keys(e.headers).forEach((t=>{s.setRequestHeader(t,e.headers[t])})),"string"!=typeof r&&(r=JSON.stringify(r)),s.send(r),s},_wrapCallback:(t,e)=>function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e({},new Error("http status 200 returned without content.")):e({data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")},null)}else e(t.responseText,null);else e({},new Error(t.statusText+","+t.status))},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch(n){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,n){if(p.isFunction(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,n)},getImage(t,e,n){return this.getArrayBuffer(e,n,((e,n)=>{if(e)t.onerror&&t.onerror(e);else if(n){const e=window.URL||window.webkitURL,r=t.onload;t.onload=()=>{r&&r(),e.revokeObjectURL(t.src)};const s=new Blob([new Uint8Array(n.data)],{type:n.contentType});t.cacheControl=n.cacheControl,t.expires=n.expires,t.src=n.data.byteLength?e.createObjectURL(s):m.emptyImageUrl}}))},getJSON(t,e={},n){if(p.isFunction(e)){const t=n;n=e,e=t}const r=function(t,e){const r=t?f.parse(t):null;n&&n(r,e)};return e&&e.jsonp?this.jsonp(t,r):this.get(t,e,r)}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:(t,e)=>t+Math.floor(Math.random()*(e-t+1)),randFloat:(t,e)=>t+Math.random()*(e-t),deg2Rad(t){return t*this.DEG2RAD},rad2Deg(t){return t*this.RAD2DEG},round:(t,e=2)=>p.isNumber(t)?Math.round(Number(t)*Math.pow(10,e))/Math.pow(10,e):0,clamp:(t,e,n)=>Math.max(e,Math.min(n,t)),formatLength(t,e={decimal:1}){const{decimal:n}=e;if(t>=1e3){const e=t/1e3;return e%1==0?`${e.toFixed(0)}km`:`${e.toFixed(n).replace(/\.?0+$/,"")}km`}return t%1==0?`${t.toFixed(0)}m`:`${t.toFixed(n).replace(/\.?0+$/,"")}m`},formatArea(t,e={decimal:1}){const{decimal:n}=e;if(t>=1e6){return t/1e6%1==0?`${t.toFixed(0)}km²`:`${t.toFixed(n).replace(/\.?0+$/,"")}km²`}return t%1==0?`${t.toFixed(0)}m²`:`${t.toFixed(n).replace(/\.?0+$/,"")}m²`}};class w{static isLnglat(t,e){return p.isNumber(t)&&p.isNumber(e)&&!!(+e>=-90&&+e<=90&&+t>=-180&&+t<=180)}static distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}static distanceByPoints(t,e){const{lng:n,lat:r}=t,{lng:s,lat:i}=e;let o=Math.cos(r*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.cos((n-s)*Math.PI/180)+Math.sin(r*Math.PI/180)*Math.sin(i*Math.PI/180);o>1&&(o=1),o<-1&&(o=-1);return 6371e3*Math.acos(o)}static formatLnglat(t,e){let n="";function r(t){const e=Math.floor(t),n=Math.floor(60*(t-e));return`${e}°${n}′${(3600*(t-e)-60*n).toFixed(2)}″`}return this.isLnglat(t,e)?n=r(t)+","+r(e):isNaN(t)?isNaN(e)||(n=r(e)):n=r(t),n}static transformLnglat(t,e){function n(t){let e=/[sw]/i.test(t)?-1:1;const n=t.match(/[\d.]+/g)||[];let r=0;for(let s=0;s<n.length;s++)r+=parseFloat(n[s])/e,e*=60;return r}if(t&&e)return{lng:n(t),lat:n(e)}}static rayCasting(t,e){for(var n=t.x,r=t.y,s=!1,i=0,o=e.length,a=o-1;i<o;a=i,i++){var l=e[i].x,c=e[i].y,h=e[a].x,u=e[a].y;if(l===n&&c===r||h===n&&u===r)return"on";if(c<r&&u>=r||c>=r&&u<r){var d=l+(r-c)*(h-l)/(u-c);if(d===n)return"on";d>n&&(s=!s)}}return s?"in":"out"}static rotatePoint(t,e,n){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}}static calcBearAndDis(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,o=s-n,a=i-r,l=Math.sqrt(o*o+a*a);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360)%360,distance:l}}static calcBearAndDisByPoints(t,e){var n=1*t.lat,r=1*t.lng,s=1*e.lat,i=1*e.lng,o=Math.sin((i-r)*this.toRadian)*Math.cos(s*this.toRadian),a=Math.cos(n*this.toRadian)*Math.sin(s*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.cos((i-r)*this.toRadian),l=Math.atan2(o,a)*(180/Math.PI),c=(s-n)*this.toRadian,h=(i-r)*this.toRadian,u=Math.sin(c/2)*Math.sin(c/2)+Math.cos(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.sin(h/2)*Math.sin(h/2),d=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return{angle:l,distance:this.R*d}}static distanceToSegment(t,e,n){const r=t.x,s=t.y,i=e.x,o=e.y,a=n.x,l=n.y,c=(a-i)*(r-i)+(l-o)*(s-o);if(c<=0)return Math.sqrt((r-i)*(r-i)+(s-o)*(s-o));const h=(a-i)*(a-i)+(l-o)*(l-o);if(c>=h)return Math.sqrt((r-a)*(r-a)+(s-l)*(s-l));const u=c/h,d=i+(a-i)*u,g=o+(l-o)*u;return Math.sqrt((r-d)*(r-d)+(s-g)*(s-g))}static calcPointByBearAndDis(t,e,n){const r=y.deg2Rad(1*t.lat),s=y.deg2Rad(1*t.lng),i=n/this.R;e=y.deg2Rad(e);const o=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),a=s+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(o));return{lat:y.rad2Deg(o),lng:y.rad2Deg(a)}}static mercatorTolonlat(t,e){const n=this.R_EQU;return{lng:t/n*(180/Math.PI),lat:Math.atan(Math.exp(e/n))*(180/Math.PI)*2-90}}static lonlatToMercator(t,e){var n=this.R_EQU;const r=t*Math.PI/180*n;var s=e*Math.PI/180;return{x:r,y:n/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))}}static interpolate({x:t,y:e,z:n=0},{x:r,y:s,z:i=0},o){return{x:t+(r-t)*o,y:e+(s-e)*o,z:n+(i-n)*o}}static getTraingleArea(t,e,n){let r=0;const s=[];if(s[0]=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow((t.z||0)-(e.z||0),2)),s[1]=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)+Math.pow((t.z||0)-(n.z||0),2)),s[2]=Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2)+Math.pow((n.z||0)-(e.z||0),2)),s[0]+s[1]<=s[2]||s[0]+s[2]<=s[1]||s[1]+s[2]<=s[0])return r;const i=(s[0]+s[1]+s[2])/2;return r=Math.sqrt(i*(i-s[0])*(i-s[1])*(i-s[2])),r}static getPolygonCentroid(t){let e=0,n=0;const r=t.length;for(let s=0,i=t.length;s<i;s++){const r=t[s];"x"in r&&"y"in r?(e+=r.x,n+=r.y):"lng"in r&&"lat"in r&&(e+=r.lng,n+=r.lat)}return{x:e/r,y:n/r}}}s(w,"toRadian",Math.PI/180),s(w,"R",6371393),s(w,"R_EQU",6378137);const R={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class M{constructor(t,e,n,r){s(this,"_r"),s(this,"_g"),s(this,"_b"),s(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this._alpha=y.clamp(r||1,0,1)}_validateColorChannel(t){(t<0||t>255)&&g.throwException("Color channel must be between 0 and 255.")}toString(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}toArray(){return[this._r,this._g,this._b,this._alpha]}toJson(){return{r:this._r,g:this._g,b:this._b,a:this._alpha}}get rgba(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}get hex(){return M.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=y.clamp(t,0,1),this}setRgb(t,e,n){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(n),this._r=t,this._g=e,this._b=n,this}static fromRgba(t){const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);if(!e)throw new Error("Invalid RGBA color value");const n=parseInt(e[1],10),r=parseInt(e[2],10),s=parseInt(e[3],10),i=e[5]?parseFloat(e[5]):1;return new M(n,r,s,i)}static fromHex(t,e=1){const n=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,n,r)=>e+e+n+n+r+r)),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);if(!r)throw new Error("Invalid HEX color value");const s=parseInt(r[1],16),i=parseInt(r[2],16),o=parseInt(r[3],16);return new M(s,i,o,e)}static fromHsl(t){const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)throw new Error("Invalid HSL color value");const n=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100,i=e[4]?parseFloat(e[4]):1;function o(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}let a,l,c;if(0===r)a=l=c=s;else{const t=s<.5?s*(1+r):s+r-s*r,e=2*s-t;a=o(e,t,n+1/3),l=o(e,t,n),c=o(e,t,n-1/3)}return new M(Math.round(255*a),Math.round(255*l),Math.round(255*c),i)}static fromName(t){const e=R[t];return e||g.throwException(`Invalid color name: ${t}`),new M(e[0],e[1],e[2],e.length>3?e[3]:1)}static from(t){return this.isRgb(t)?this.fromRgba(t):this.isHex(t)?this.fromHex(t):this.isHsl(t)?this.fromHsl(t):Object.keys(R).map((t=>t.toString())).includes(t)?this.fromName(t):g.throwException("Invalid color value")}static rgb2hex(t,e,n,r){var s="#"+((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1);if(void 0!==r){return s+Math.round(255*r).toString(16).padStart(2,"0")}return s}static isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static isRgb(t){return/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(t)}static isHsl(t){return/^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(t)}static isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)}static random(){let t=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),n=Math.floor(256*Math.random()),r=Math.random();return new M(t,e,n,r)}}const A=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],S={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let n=0,r=A.length;n<r;n++)if(A[n]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[4]&&e!==A[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[2]&&e!==A[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==A[0]&&e!==A[1])},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates:t=>t.geometry?t.geometry.coordinates:[],getGeoJsonCenter(t,e){const n=this.getGeoJsonType(t);if(!n||!t.geometry)return null;const r=t.geometry.coordinates;if(!r)return null;let s=0,i=0,o=0;switch(n){case"Point":s=r[0],i=r[1],o++;break;case"MultiPoint":case"LineString":for(let t=0,e=r.length;t<e;t++)s+=r[t][0],i+=r[t][1],o++;break;case"MultiLineString":case"Polygon":for(let t=0,e=r.length;t<e;t++)for(let n=0,a=r[t].length;n<a;n++)s+=r[t][n][0],i+=r[t][n][1],o++;break;case"MultiPolygon":for(let t=0,e=r.length;t<e;t++)for(let n=0,a=r[t].length;n<a;n++)for(let e=0,l=r[t][n].length;e<l;e++)s+=r[t][n][e][0],i+=r[t][n][e][1],o++}const a=s/o,l=i/o;return e?(e.x=a,e.y=l,e):{x:a,y:l}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},s=n.coordinates;if(!s)return null;const i=[];let o;switch(e){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}if(o)for(let a=0,l=s.length;a<l;a++)i.push({type:"Feature",geometry:{type:o,coordinates:s[a]},properties:r});else i.push(t);return i},getGeoJsonByCoordinates(t,e){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let n;if(2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])n="Point";else if(Array.isArray(t[0])&&2===t[0].length)n="LineString";else{if(!Array.isArray(t[0])||!Array.isArray(t[0][0]))throw Error("coordinates 参数格式错误");{const e=t[0];if(e[0].join(",")===e[e.length-1].join(","))n="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");n="MultiPolygon"}}}return{type:"Feature",geometry:{type:n,coordinates:t},properties:e||{}}}},_={assertEmpty(...t){t.forEach((t=>{p.isEmpty(t)&&g.throwEmptyException(t)}))},assertInteger(...t){t.forEach((t=>{p.isInteger(t)||g.throwIntegerException(t)}))},assertNumber(...t){t.forEach((t=>{p.isNumber(t)||g.throwNumberException(t)}))},assertArray(...t){t.forEach((t=>{p.isArray(t)||g.throwArrayException(t)}))},assertFunction(...t){t.forEach((t=>{p.isFunction(t)||g.throwFunctionException(t)}))},assertColor(...t){t.forEach((t=>{M.isColor(t)||g.throwColorException(t)}))},assertLnglat(...t){t.forEach((t=>{w.isLnglat(t.lng,t.lat)||g.throwCoordinateException(JSON.stringify(t))}))},assertGeoJson(...t){t.forEach((t=>{S.isGeoJson(t)||g.throwGeoJsonException(t)}))},assertContain(t,...e){let n=!1;for(let r=0,s=e.length||0;r<s;r++)n=t.indexOf(e[r])>=0;if(n)throw Error(o.STRING_CHECK_LOSS+" -> "+t)},assertStartWith(t,e){if(!t.startsWith(e))throw Error("字符串"+t+"开头不是 -> "+e)},assertEndWith(t,e){if(!t.endsWith(e))throw Error("字符串"+t+"结尾不是 -> "+e)}},x=Object.create(Array);x.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((t=>e[t]))},x.prototype.distinct=function(t=t=>t){const e=[],n={};return this.forEach((r=>{const s=t(r),i=String(s);n[i]||(n[i]=!0,e.push(r))})),e},x.prototype.max=function(){return Math.max.apply({},this)},x.prototype.min=function(){return Math.min.apply({},this)},x.prototype.sum=function(t=t=>t){return 1===this.length?t(this[0]):this.length>1?this.reduce(((e=0,n=0)=>t(e)+t(n))):0},x.prototype.avg=function(){return this.length?this.sum()/this.length:0},x.prototype.desc=function(t=t=>t){return this.sort(((e,n)=>t(n)-t(e)))},x.prototype.asc=function(t=t=>t){return this.sort(((e,n)=>t(e)-t(n)))},x.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},x.prototype.remove=function(t){const e=this.indexOf(t);return e>-1&&this.splice(e,1),this};const b={create:t=>[...new Array(t).keys()],union(...t){let e=[];return t.forEach((t=>{Array.isArray(t)&&(e=e.concat(t.filter((t=>!e.includes(t)))))})),e},intersection(...t){let e=t[0]||[];return t.forEach((t=>{Array.isArray(t)&&(e=e.filter((e=>t.includes(e))))})),e},unionAll:(...t)=>[...t].flat().filter((t=>!!t)),difference(...t){return 0===t.length?[]:this.union(...t).filter((e=>!this.intersection(...t).includes(e)))},zhSort:(t,e=t=>t,n)=>(t.sort((function(t,r){return n?e(t).localeCompare(e(r),"zh"):e(r).localeCompare(e(t),"zh")})),t)};class C{static getSystem(){var t,e,n,r,s,i,o,a,l;const c=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let h="",u="";if(c.includes("Android")||c.includes("Adr"))h="Android",u=(null==(e=c.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(c.includes("CrOS"))h="Chromium OS",u=(null==(n=c.match(/MSIE ([\d.]+)/))?void 0:n[1])||(null==(r=c.match(/rv:([\d.]+)/))?void 0:r[1])||"";else if(c.includes("Linux")||c.includes("X11"))h="Linux",u=(null==(s=c.match(/Linux ([\d.]+)/))?void 0:s[1])||"";else if(c.includes("Ubuntu"))h="Ubuntu",u=(null==(i=c.match(/Ubuntu ([\d.]+)/))?void 0:i[1])||"";else if(c.includes("Windows")){let t=(null==(o=c.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:o[1])||"",e={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};h="Windows",u=t in e?e[t]:t}else c.includes("like Mac OS X")?(h="IOS",u=(null==(a=c.match(/OS ([\d_]+) like/))?void 0:a[1].replace(/_/g,"."))||""):c.includes("Macintosh")&&(h="macOS",u=(null==(l=c.match(/Mac OS X -?([\d_]+)/))?void 0:l[1].replace(/_/g,"."))||"");return{type:h,version:u}}static getExplorer(){var t;const e=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let n="",r="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(n="IE",r=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(n="Edge",r=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(n="Chrome",r=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(n="Firefox",r=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(n="Safari",r=t[1])}return{type:n,version:r}}static isSupportWebGL(){if(!(null==this?void 0:this.document))return!1;const t=this.document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");return e&&e instanceof WebGLRenderingContext}static getGPU(){let t="unknown",e="unknown";if(null==this?void 0:this.document){let n=this.document.createElement("canvas"),r=n.getContext("webgl")||n.getContext("experimental-webgl");if(r instanceof WebGLRenderingContext){let n=r.getExtension("WEBGL_debug_renderer_info");if(n){let s=r.getParameter(n.UNMASKED_RENDERER_WEBGL);t=(s.match(/ANGLE \((.+?),/)||[])[1]||"",e=(s.match(/, (.+?) (\(|vs_)/)||[])[1]||""}return{type:t,model:e,spec:{maxTextureSize:r.getParameter(r.MAX_TEXTURE_SIZE),maxRenderBufferSize:r.getParameter(r.MAX_RENDERBUFFER_SIZE),maxTextureUnits:r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)}}}}return{type:t,model:e}}static getLanguage(){var t,e;let n=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof n)return"";let r=n.split("-");return r[1]&&(r[1]=r[1].toUpperCase()),r.join("_")}static getTimeZone(){var t,e;return null==(e=null==(t=null==Intl?void 0:Intl.DateTimeFormat())?void 0:t.resolvedOptions())?void 0:e.timeZone}static async getScreenFPS(){return new Promise((function(t){let e=0,n=1,r=[],s=function(i){if(e>0)if(n<12)r.push(i-e),e=i,n++,requestAnimationFrame(s);else{r.sort(),r=r.slice(1,11);let e=r.reduce(((t,e)=>t+e));const n=10*Math.round(1e4/e/10);t(n)}else e=i,requestAnimationFrame(s)};requestAnimationFrame(s)}))}static async getIPAddress(){const t=/\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/,e=/\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i;let n=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const r=new Set,s=n=>{var s;const i=null==(s=null==n?void 0:n.candidate)?void 0:s.candidate;if(i)for(const o of[t,e]){const t=i.match(o);t&&r.add(t[0])}};return new Promise((function(t,e){const i=new n({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});i.addEventListener("icecandidate",s),i.createDataChannel(""),i.createOffer().then((t=>i.setLocalDescription(t)),e);let o,a=20,l=function(){try{i.removeEventListener("icecandidate",s),i.close()}catch{}o&&clearInterval(o)};o=window.setInterval((function(){let e=[...r];e.length?(l(),t(e[0])):a?a--:(l(),t(""))}),100)}))}static async getNetwork(){var t,e;let n="unknown",r=null==(t=this.navigator)?void 0:t.connection;return r&&(n=r.type||r.effectiveType,"2"!=n&&"unknown"!=n||(n="wifi")),{network:n,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}s(C,"document",null==window?void 0:window.document),s(C,"navigator",null==window?void 0:window.navigator),s(C,"userAgent",null==(n=null==window?void 0:window.navigator)?void 0:n.userAgent),s(C,"screen",null==window?void 0:window.screen);class v{static delta(t,e){const n=6378245,r=.006693421622965943;let s=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35);const o=t/180*this.PI;let a=Math.sin(o);a=1-r*a*a;const l=Math.sqrt(a);return s=180*s/(n*(1-r)/(a*l)*this.PI),i=180*i/(n/l*Math.cos(o)*this.PI),{lat:s,lng:i}}static outOfChina(t,e){return t<72.004||t>137.8347||(e<.8293||e>55.8271)}static 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}}static 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}}static gcjDecryptExact(t,e){let n=.01,r=.01,s=t-n,i=e-r,o=t+n,a=e+r,l=0,c=0,h=0;for(;;){l=(s+o)/2,c=(i+a)/2;const u=this.gcjEncrypt(l,c);if(n=u.lat-t,r=u.lng-e,Math.abs(n)<1e-9&&Math.abs(r)<1e-9)break;if(n>0?o=l:s=l,r>0?a=c:i=c,++h>1e4)break}return{lat:l,lng:c}}static bdEncrypt(t,e){const n=e,r=t,s=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i)+.0065;return{lat:s*Math.sin(i)+.006,lng:o}}static bdDecrypt(t,e){const n=e-.0065,r=t-.006,s=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),o=s*Math.cos(i);return{lat:s*Math.sin(i),lng:o}}static mercatorEncrypt(t,e){const n=20037508.34*e/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=20037508.34*r/180,{lat:r,lng:n}}static mercatorDecrypt(t,e){const n=e/20037508.34*180;let r=t/20037508.34*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}}static transformLat(t,e){let n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3,n}static transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,n}static random({x:t,y:e},{x:n,y:r}){return{x:Math.random()*(n-t)+t,y:Math.random()*(r-e)+e}}static deCompose(t,e,n){const r=[];if(t instanceof Array&&!(t[0]instanceof Array))e(t);else if(t instanceof Array&&t[0]instanceof Array)for(let s=0;s<t.length;s++){const i=t[s];if(!p.isNil(i))if(i[0]instanceof Array){const t=n?this.deCompose(i,(t=>e(t)),n):this.deCompose(i,(t=>e(t)));r.push(t)}else{const t=n?e.call(n,i):e(i);r.push(t)}}return r}}function T(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}s(v,"PI",3.141592653589793),s(v,"XPI",52.35987755982988);const O={getStyle(t,e){var n;let r=t.style[e];if(!r||"auto"===r){const s=null==(n=document.defaultView)?void 0:n.getComputedStyle(t,null);r=s?s[e]:null,"auto"===r&&(r=null)}return r},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=>((null==t?void 0:t.host)||t).className.toString(),hasClass(t,e){var n;if(null==(n=t.classList)?void 0:n.contains(e))return!0;const r=this.getClass(t);return r.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(r)},addClass(t,e){if(void 0!==t.classList){const n=T(e);for(let e=0,r=n.length;e<r;e++)t.classList.add(n[e])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){if(void 0!==t.classList){T(e).forEach((e=>t.classList.remove(e)))}else this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach((e=>t.classList.add(e))))},parseFromString:t=>(new DOMParser).parseFromString(t,"text/xml").children[0]},I={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],n=atob(t.split(",")[1]),r=new Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);const s=new Uint8Array(r);return new Blob([s],{type:e})},convertBase64ToFile(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/png",i=atob(n[1]),o=new Uint8Array(i.length);for(let a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return new File([o],e,{type:s})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),n=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(n)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)},readFile:(t,e="arrayBuffer")=>new Promise(((n,r)=>{const s=new FileReader;"arrayBuffer"===e?s.readAsArrayBuffer(t):s.readAsText(t),s.onload=function(t){var e;n(null==(e=t.target)?void 0:e.result)},s.onerror=function(t){r(t)}})),readFileFromUrl:(t,e,n="arrayBuffer")=>new Promise(((r,s)=>{const i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="blob";const o=e.split(".");try{i.onload=function(){if(this.status>=200&&this.status<300){const t=i.response,a=URL.createObjectURL(t),l=new File([t],e,{type:o[1],lastModified:(new Date).getTime()}),c=new FileReader;"arrayBuffer"===n?c.readAsArrayBuffer(l):c.readAsText(l),c.onload=function(t){var e;URL.revokeObjectURL(a),r(null==(e=t.target)?void 0:e.result)},c.onerror=function(t){s(t)}}},i.onerror=function(t){s(t)}}catch(a){s(a)}i.send()}))};class P{static resetWarned(){this.warned={}}static changeVoice(){this.isMute=!!Number(!this.isMute),localStorage.setItem("mute",Number(this.isMute).toString())}static _call(t,e,n){this.warned[e]||(t(e,n),this.warned[e]=!0)}static msg(t,e,n={}){if(this.isMute)return;const r=p.decodeDict(t,"success","恭喜","error","发生错误","warning","警告","info","友情提示")+":";this.speechSynthesisUtterance.text=r+e,this.speechSynthesisUtterance.lang=n.lang||"zh-CN",this.speechSynthesisUtterance.volume=n.volume||1,this.speechSynthesisUtterance.rate=n.rate||1,this.speechSynthesisUtterance.pitch=n.pitch||1,this.speechSynthesis.speak(this.speechSynthesisUtterance)}static stop(t){this.speechSynthesisUtterance.text=t,this.speechSynthesis.cancel()}static warning(t,e={}){console.warn(`Warning: %c${t}`,"color:#E6A23C;font-weight: bold;"),this.msg("warning",t,e)}static warningOnce(t,e={}){this._call(this.warning.bind(this),t,e)}static info(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.info(`Info: %c${t}`,"color:#909399;font-weight: bold;"),this.msg("info",t,e)}static infoOnce(t,e={}){this._call(this.info.bind(this),t,e)}static error(t,e={}){console.error(`Error: %c${t}`,"color:#F56C6C;font-weight: bold;"),this.msg("error",t,e)}static errorOnce(t,e={}){this._call(this.error.bind(this),t,e)}static success(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.log(`Success: %c${t}`,"color:#67C23A;font-weight: bold;"),this.msg("success",t,e)}static successOnce(t,e={}){this._call(this.success.bind(this),t,e)}}s(P,"warned",{}),s(P,"isMute",!!Number(localStorage.getItem("mute"))||!1),s(P,"speechSynthesis",window.speechSynthesis),s(P,"speechSynthesisUtterance",new SpeechSynthesisUtterance);const L={debounce(t,e,n=!0){let r,s,i=null;const o=()=>{const a=Date.now()-r;a<e&&a>0?i=setTimeout(o,e-a):(i=null,n||(s=t.apply(this,undefined)))};return(...a)=>{r=Date.now();const l=n&&!i;return i||(i=setTimeout(o,e)),l&&(s=t.apply(this,a),i||(a=null)),s}},throttle(t,e,n=1){let r=0,s=null;return(...i)=>{if(1===n){const n=Date.now();n-r>=e&&(t.apply(this,i),r=n)}else 2===n&&(s||(s=setTimeout((()=>{s=null,t.apply(this,i)}),e)))}},memoize(t){const e=new Map;return(...n)=>{const r=JSON.stringify(n);if(e.has(r))return e.get(r);{const s=t.apply(this,n);return e.set(r,s),s}}},recurve(t,e=500,n=5e3){let r=0;setTimeout((()=>{r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,n),e))}),e)},once(t){let e=!1;return function(...n){if(!e)return e=!0,t(...n)}}},D={changeCase(t,e){switch(e=e||c.LOWER_CASE){case c.REVERSE_CASE:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case c.UPPER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case c.LOWER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case c.UPPER_CASE:return t.toUpperCase();case c.LOWER_CASE:return t.toLowerCase();default:return t}},getByteLength:t=>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 s=Math.floor(n/2);s<t.length;s++){let i=t.substring(e,s);if(i.replace(r,"mm").length>=n)return i}return t},string2Bytes(t){const e=[];let n;const r=t.length;for(let s=0;s<r;s++)n=t.charCodeAt(s),n>=65536&&n<=1114111?(e.push(n>>18&7|240),e.push(n>>12&63|128),e.push(n>>6&63|128),e.push(63&n|128)):n>=2048&&n<=65535?(e.push(n>>12&15|224),e.push(n>>6&63|128),e.push(63&n|128)):n>=128&&n<=2047?(e.push(n>>6&31|192),e.push(63&n|128)):e.push(255&n);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const n=t;for(let r=0;r<n.length;r++){const t=n[r].toString(2),s=t.match(/^1+?(?=0)/);if(s&&8==t.length){const t=s[0].length;let i=n[r].toString(2).slice(7-t);for(let e=1;e<t;e++)i+=n[e+r].toString(2).slice(2);e+=String.fromCharCode(parseInt(i,2)),r+=t-1}else e+=String.fromCharCode(n[r])}return e}},k={buildTree(t,e="id",n="pid"){const r=[];function s(r){const i=r[e],o=t.filter((t=>t.hasOwnProperty(n)&&t[n]===i));o.length>0&&(o.forEach(s),r.children=o)}for(const i of t)i.hasOwnProperty(n)&&i[n]&&null!==i[n]||(s(i),r.push(i));return r},flatTree(t){let e=[];return t.forEach((t=>{e.push(t),t.children&&t.children.length>0&&(e=e.concat(this.flatTree(t.children)))})),e}},U={json2Query(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var r=n,s=t[n];e.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}return e.join("&")},query2Json(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:s}=new URL(t),i=[r,s];let o={};for(let a=0;a<i.length;a++){const t=i[a];if(t){const r=t.replace(/#|\//g,"").split("?");if(r.length>1)for(let t=1;t<r.length;t++){let s;for(;s=n.exec(r[t]);)o[s[1]]=e?decodeURIComponent(s[2]):s[2]}}}return o}},N={isUrl:t=>/^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(t),isExternal:t=>/^(https?:|mailto:|tel:)/.test(t),isPhone:t=>/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t),isTel:t=>/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t),isStrongPwd:t=>/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/.test(t),isEmail:t=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t),isIP:t=>/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(t),isEnglish:t=>/^[a-zA-Z]+$/.test(t),isChinese:t=>/^[\u4E00-\u9FA5]+$/.test(t),isHTML:t=>/<("[^"]*"|'[^']*'|[^'">])*>/.test(t),isXML:t=>/^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$/.test(t),isIDCard:t=>/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t)};class F{constructor(t){if(s(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");this.ctx=e.getContext("2d")}}drawLine({x:t,y:e},{x:n,y:r},s={}){this.ctx.beginPath();const i=s.width||1,o=s.color||"#000";this.ctx.lineWidth=i,this.ctx.strokeStyle=o,this.ctx.moveTo(t,e),this.ctx.lineTo(n,r),this.ctx.stroke()}drawArc({x:t,y:e},n,r,s,i,o,a){o?(this.ctx.fillStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,n,y.deg2Rad(r),y.deg2Rad(s),i),this.ctx.fill()):(this.ctx.strokeStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,n,y.deg2Rad(r),y.deg2Rad(s),i),this.ctx.stroke())}drawImage({x:t,y:e},n){const r=new Image;r.src=n,r.onload=()=>{const n=r.width,s=r.height;if(!this.ctx)throw new Error("Canvas context is null");this.ctx.drawImage(r,t,e,-n/2,-s/2)}}drawText({x:t,y:e},n,r){this.ctx.font=r.font||"10px sans-serif",this.ctx.strokeStyle=r.color||"#000",this.ctx.lineWidth=2,this.ctx.strokeText(n,t,e)}static createCanvas(t=1,e=1){const n=document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n}}class G extends Date{constructor(...t){super(t.length>1?t:1===t.length?t[0]:new Date)}format(t="yyyy-MM-dd hh:mm:ss"){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"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){const r=new RegExp("("+n+")","g");r.test(t)&&(t=t.replace(r,(t=>(1===t.length?e[n]:("00"+e[n]).substr((""+e[n]).length)).toString())))}return t}addDate(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":default: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)}return n}static lastMonth(){return new G((new Date).getFullYear(),(new Date).getMonth(),1)}static thisMonth(){return new G((new Date).getFullYear(),(new Date).getMonth()+1,1)}static nextMonth(){return new G((new Date).getFullYear(),(new Date).getMonth()+2,1)}static lastWeek(){return new G((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay())}static thisWeek(){return new G((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay())}static nextWeek(){return new G((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay())}static lastDay(){return new G((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1)}static thisDay(){return new G((new Date).setHours(0,0,0,0))}static nextDay(){return new G((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1)}static parseDate(t){if("string"==typeof t){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.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.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}static formatDateInterval(t,e){const n=new Date(t),r=new Date(e).getTime()-n.getTime(),s=Math.floor(r/864e5),i=r%864e5,o=Math.floor(i/36e5),a=i%36e5,l=Math.floor(a/6e4),c=a%6e4,h=Math.round(c/1e3);let u="";return s>0&&(u+=s+"天"),o>0&&(u+=o+"时"),l>0&&(u+=l+"分"),h>0&&(u+=h+"秒"),0===s&&0===o&&0===l&&0===h&&(u="少于1秒"),u}static formatterCounter(t){const e=function(t){return(t>=10?"":"0")+(t||0)},n=t%3600,r=n%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(n/60))}:${e(Math.round(r))}`}static sleep(t){}}class ${constructor(){s(this,"_listeners",{}),s(this,"_mutex",{}),s(this,"_context")}addEventListener(t,e,n,r){this._context=n;const s=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(r&&(s[t]=e),i[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){const t=n.map((t=>t.toString())).indexOf(e.toString());-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);if(void 0!==this._mutex[t.type]){const e=n.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,r=n.length;e<r;e++){const r=n[e];"function"==typeof r&&r.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}on(t,e,n,r){return this.addEventListener.call(this,t,e,n,r)}off(t,e){return this.removeEventListener.call(this,t,e)}}const B=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],q=(()=>{if("undefined"==typeof document)return!1;const t=B[0],e={};for(const n of B){if((null==n?void 0:n[1])in document){for(const[r,s]of n.entries())e[t[r]]=s;return e}}return!1})(),j={change:q.fullscreenchange,error:q.fullscreenerror};let W={request:(t=document.documentElement,e)=>new Promise(((n,r)=>{const s=()=>{W.off("change",s),n()};W.on("change",s);const i=t[q.requestFullscreen](e);i instanceof Promise&&i.then(s).catch(r)})),exit:()=>new Promise(((t,e)=>{if(!W.isFullscreen)return void t();const n=()=>{W.off("change",n),t()};W.on("change",n);const r=document[q.exitFullscreen]();r instanceof Promise&&r.then(n).catch(e)})),toggle:(t,e)=>W.isFullscreen?W.exit():W.request(t,e),onchange(t){W.on("change",t)},onerror(t){W.on("error",t)},on(t,e){const n=j[t];n&&document.addEventListener(n,e,!1)},off(t,e){const n=j[t];n&&document.removeEventListener(n,e,!1)},raw:q};Object.defineProperties(W,{isFullscreen:{get:()=>Boolean(document[q.fullscreenElement])},element:{enumerable:!0,get:()=>document[q.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[q.fullscreenEnabled])}}),q||(W={isEnabled:!1});const J=W;class H extends Map{isEmpty(){return 0===this.size}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}static fromEntries(t=[]){const e=new H;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=f.parse(t);return new H(Object.entries(e))}}const z=class t extends ${constructor(n=`ws://${window.document.domain}:20007/mqtt`,r={}){super(),s(this,"state"),s(this,"url"),s(this,"context"),s(this,"options"),s(this,"client"),s(this,"topics"),s(this,"_timer"),this.context=f.assign(t.defaultContext,r),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:p.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0,rejectUnauthorized:this.context.REJECT_UNAUTHORIZED},this.url=n,this.client=e.connect(this.url,this.options);let o=0;this._timer=setInterval((()=>{o++,this.client.connected||(this.state=3,this.dispatchEvent({type:i.MQTT_ERROR,message:this}),this.client.end()),o>this.context.MQTT_MAX_RETRY&&(clearInterval(this._timer),this._onError())}),this.context.MQTT_TIMEOUTM),this._onConnect(),this._onMessage(),this.state=1,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=2,clearInterval(this._timer),console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:i.MQTT_CONNECT,message:this})})),this.client.on("error",this._onError)}_onError(){g.throwException("链接mqtt失败==>"+this.url),this.state=0,this.client.end()}_onMessage(){this.client.on("message",((t,e)=>{let n=e,r="";e instanceof Uint8Array&&(n=e.toString());try{r=f.parse(n)}catch(s){throw new Error(o.DATA_ERROR_JSON)}this.dispatchEvent({type:i.MQTT_MESSAGE,message:{topic:t,data:r}})}))}sendMsg(t,e){if(this.client.connected)return this.client.publish(t,e,{qos:1,retain:!0}),this;console.error("客户端未连接")}subscribe(t){return 2===this.state?this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=b.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(i.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=b.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,n)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=b.difference(this.topics,t),console.log(`取消订阅成功==>${t}`))})),this}unsubscribeAll(){return this.unsubscribe(this.topics),this}unconnect(){this.client.end(),this.client=null,this.dispatchEvent({type:i.MQTT_CLOSE,message:{}}),console.log("断开mqtt成功==>"+this.url)}};s(z,"defaultContext",{MQTT_TIMEOUTM:2e3,MQTT_MAX_RETRY:3,REJECT_UNAUTHORIZED:!0});let Y=z;const K=class t{static setLocal(t,e=null,n={}){var r=this._getPrefixedKey(t,n);try{const{expires:t}=n,s={data:e};t&&(s.expires=t),window.localStorage.setItem(r,JSON.stringify(s))}catch(s){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static setSession(t,e=null,n={}){var r=this._getPrefixedKey(t,n);try{const{expires:t}=n,s={data:e};t&&(s.expires=t),window.sessionStorage.setItem(r,JSON.stringify(s))}catch(s){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static getLocal(t,e,n){var r,s=this._getPrefixedKey(t,n);try{r=JSON.parse(window.localStorage.getItem(s)||"")}catch(i){r=window.localStorage[s]?{data:window.localStorage.getItem(s)}:null}if(!r)return e;if("object"==typeof r&&void 0!==r.data){const t=r.expires;return t&&Date.now()>t?e:r.data}}static getSession(t,e,n){var r,s=this._getPrefixedKey(t,n);try{r=JSON.parse(window.sessionStorage.getItem(s)||"")}catch(i){r=window.sessionStorage[s]?{data:window.sessionStorage.getItem(s)}:null}if(!r)return e;if("object"==typeof r&&void 0!==r.data){const t=r.expires;return t&&Date.now()>t?e:r.data}}static localkeys(){const e=[];var n=Object.keys(window.localStorage);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static sessionkeys(){const e=[];var n=Object.keys(window.sessionStorage);return 0===t.prefix.length?n:(n.forEach((function(n){-1!==n.indexOf(t.prefix)&&e.push(n.replace(t.prefix,""))})),e)}static getAllLocal(e){var n=t.localkeys();if(e){const r=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.getLocal(n,null,null),r.push(e)}})),r}return n.map((e=>t.getLocal(e,null,null)))}static getAllSession(e){var n=t.sessionkeys();if(e){const r=[];return n.forEach((n=>{if(e.includes(n)){const e={};e[n]=t.getSession(n,null,null),r.push(e)}})),r}return n.map((e=>t.getSession(e,null,null)))}static remove(t,e){var n=this._getPrefixedKey(t,e);window.sessionStorage.removeItem(n),window.localStorage.removeItem(n)}static clearLocal(e){t.prefix.length?this.localkeys().forEach((t=>{window.localStorage.removeItem(this._getPrefixedKey(t,e))})):window.localStorage.clear()}static clearSession(e){t.prefix.length?this.sessionkeys().forEach((t=>{window.sessionStorage.removeItem(this._getPrefixedKey(t,e))})):window.sessionStorage.clear()}};s(K,"prefix",""),s(K,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:K.prefix+t}));let Q=K;t.AjaxUtil=E,t.ArrayUtil=b,t.AssertUtil=_,t.AudioPlayer=class{constructor(t){s(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}},t.BrowserUtil=C,t.CanvasDrawer=F,t.CaseType=c,t.Color=M,t.Cookie=class{static set(t,e,n){"string"==typeof t&&"string"==typeof e||g.throwException("Invalid arguments");let r=`${t}=${encodeURIComponent(e)}`;if(null!=n){const t=new Date;t.setTime(t.getTime()+24*n*60*60*1e3),r+=`;expires=${t.toUTCString()}`}document.cookie=r}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=v,t.DateTime=G,t.DomUtil=O,t.ErrorType=o,t.EventDispatcher=$,t.EventType=i,t.ExceptionUtil=g,t.FileUtil=I,t.FormType=l,t.FullScreen=J,t.GeoJsonUtil=S,t.GeoUtil=w,t.GraphicType=h,t.HashMap=H,t.ImageUtil=m,t.LayerType=a,t.LineSymbol=u,t.MathUtil=y,t.MeasureMode=d,t.MessageUtil=P,t.MqttClient=Y,t.ObjectUtil=f,t.OptimizeUtil=L,t.Storage=Q,t.StringUtil=D,t.TreeUtil=k,t.UrlUtil=U,t.Util=p,t.ValidateUtil=N,t.WebGL=class{constructor(t){if(s(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");if(this.ctx=e.getContext("webgl"),!this.ctx)throw new Error("WebGL cannot be initialized. Your browser may not support WebGL")}}initShaders(t,e,n){var r=this.createProgram(t,e,n);return r?(t.useProgram(r),!0):(console.log("Failed to create program"),!1)}createProgram(t,e,n){var r=this.loadShader(t,t.VERTEX_SHADER,e),s=this.loadShader(t,t.FRAGMENT_SHADER,n);if(!r||!s)return null;var i=t.createProgram();if(!i)return null;if(t.attachShader(i,r),t.attachShader(i,s),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)){var o=t.getProgramInfoLog(i);return console.log("Failed to link program: "+o),t.deleteProgram(i),t.deleteShader(s),t.deleteShader(r),null}return i}loadShader(t,e,n){var r=t.createShader(e);if(null==r)return console.log("unable to create shader"),null;if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var s=t.getShaderInfoLog(r);return g.throwException("Failed to compile shader: "+s),t.deleteShader(r),null}return r}},t.WebSocketClient=class extends ${constructor(t="ws://127.0.0.1:10088"){super(),s(this,"maxCheckTimes",10),s(this,"url"),s(this,"checkTimes",0),s(this,"connectStatus",!1),s(this,"client",null),this.maxCheckTimes=10,this.url=t,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{const t=this;console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client&&(this.client.onopen=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:i.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:i.WEB_SOCKET_ERROR,message:e})}))}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}connCheckStatus(t){this.checkTimes>t||setTimeout((()=>{this.checkTimes++,this.state!==WebSocket.CONNECTING&&this.state!==WebSocket.OPEN&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&this.state===WebSocket.OPEN?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),this)}heartbeat(){setTimeout((()=>{this.state===WebSocket.OPEN&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}get state(){var t;return null==(t=this.client)?void 0:t.readyState}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["gis-common"]={})}(this,(function(t){"use strict";var e,r=Object.defineProperty,n=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),i=(t=>(t.MAP_RENDER="mapRender",t.MAP_READY="mapReady",t.MOUSE_CLICK="click",t.MOUSE_DOUBLE_CLICK="dblclick",t.MOUSE_MOVE="mousemove",t.MOUSE_IN="mousein",t.MOUSE_OUT="mouseout",t.MOUSE_RIGHT_CLICK="mouseRightClick",t.KEY_DOWN="keyDown",t.KEY_UP="keyUp",t.DRAW_ACTIVE="drawActive",t.DRAW_MOVE="drawMove",t.DRAW_COMPLETE="drawComplete",t.MQTT_CONNECT="mqttConnect",t.MQTT_ERROR="mqttError",t.MQTT_MESSAGE="mqttMessage",t.MQTT_CLOSE="mqttClose",t.WEB_SOCKET_CONNECT="webSocketConnect",t.WEB_SOCKET_ERROR="webSocketError",t.WEB_SOCKET_MESSAGE="webSocketMessage",t.WEB_SOCKET_CLOSE="webSocketClose",t))(i||{}),s=(t=>(t.LOGIN_EXPIRED="登录信息过期,请重新登录",t.INTERNAL_ERROR="内部错误",t.NETWORK_ERROR="请求失败,请检查网络是否已连接",t.PROCESS_FAIL="任务处理失败",t.PROCESS_TIMEOUT="任务处理超时",t.AUTH_VERIFY_ERROR="权限验证失败",t.INSTANCE_DUPLICATE="实例为单例模式,不允许重复构建",t.STRING_CHECK_LOSS="字符串缺少关键字",t.PARAMETER_ERROR="验证参数类型失败",t.PARAMETER_ERROR_ARRAY="验证参数类型失败,必须是数组",t.PARAMETER_ERROR_STRING="验证参数类型失败,必须是字符",t.PARAMETER_ERROR_FUNCTION="验证参数类型失败,必须是函数",t.PARAMETER_ERROR_OBJECT="验证参数类型失败,必须是对象",t.PARAMETER_ERROR_INTEGER="验证参数类型失败,必须是整型",t.PARAMETER_ERROR_NUMBER="验证参数类型失败,必须是数值",t.PARAMETER_ERROR_LACK="验证参数类型失败,必须非空",t.PARAMETER_ERROR_ENUM="验证参数类型失败,必须是指定的值",t.DATA_ERROR="格式类型验证失败",t.DATA_ERROR_COORDINATE="格式类型验证失败,必须是坐标",t.DATA_ERROR_COLOR="格式类型验证失败,必须是颜色代码",t.DATA_ERROR_JSON="JSON解析失败,格式有误",t.DATA_ERROR_GEOJSON="格式类型验证失败,必须是GeoJSON",t.REQUEST_ERROR="请求资源失败",t.REQUEST_ERROR_CROSS="不允许跨站点访问资源",t.REQUEST_ERROR_TIMEOUT="请求超时,请检查网络",t.REQUEST_ERROR_NOT_FOUND="请求资源不存在",t.REQUEST_ERROR_FORBIDDEN="请求资源禁止访问",t.REQUEST_ERROR_EMPTY="请求数据记录为空",t))(s||{}),o=(t=>(t[t.SUPER_MAP_IMAGES=0]="SUPER_MAP_IMAGES",t[t.SUPER_MAP_DATA=1]="SUPER_MAP_DATA",t[t.ARC_GIS_MAP_IMAGES=2]="ARC_GIS_MAP_IMAGES",t[t.ARC_GIS_MAP_DATA=3]="ARC_GIS_MAP_DATA",t[t.OSGB_LAYER=4]="OSGB_LAYER",t[t.S3M_GROUP=5]="S3M_GROUP",t[t.TERRAIN_LAYER=6]="TERRAIN_LAYER",t))(o||{}),a=(t=>(t[t.ADD=0]="ADD",t[t.MODIFY=1]="MODIFY",t[t.DETAIL=2]="DETAIL",t))(a||{}),h=(t=>(t[t.REVERSE_CASE=0]="REVERSE_CASE",t[t.UPPER_CAMEL_CASE=1]="UPPER_CAMEL_CASE",t[t.LOWER_CAMEL_CASE=2]="LOWER_CAMEL_CASE",t[t.UPPER_CASE=3]="UPPER_CASE",t[t.LOWER_CASE=4]="LOWER_CASE",t))(h||{}),c=(t=>(t.POINT="Point",t.POLYLINE="Polyline",t.POLYGON="Polygon",t.RECTANGLE="Rectangle",t.BILLBOARD="Billboard",t.CYLINDER="Cylinder",t.ELLIPSOID="Ellipsoid",t.LABEL="Label",t.MODEL="Model",t.WALL="Wall",t.CIRCLE="Circle",t))(c||{}),l=(t=>(t[t.SOLID=0]="SOLID",t.DASH="10,5",t.DOT="3",t.DASHDOT="10,3,3,3",t.DASHDOTDOT="10,3,3,3,3,3",t))(l||{}),u=(t=>(t[t.DISTANCE=0]="DISTANCE",t[t.AREA=1]="AREA",t[t.HEIGHT=2]="HEIGHT",t[t.ANGLE=3]="ANGLE",t))(u||{});const f={getException(t,e){const r=function(){Error.call(this,e),this.name=t,this.message=e,this.stack=(new Error).stack};return Error&&(r.__proto__=Error),(r.prototype=Object.create(Error&&Error.prototype)).constructor=r,r},throwException(t){throw new(this.getException("Exception",t))(t)},throwColorException(t){throw new(this.getException("ColorException",s.DATA_ERROR_COLOR+" -> "+(t||"")))(t)},throwCoordinateException(t){throw new(this.getException("CoordinateException",s.DATA_ERROR_COORDINATE+" -> "+(t||"")))(t)},throwGeoJsonException(t){throw new(this.getException("GeoJsonException",s.DATA_ERROR_GEOJSON+" -> "+(t||"")))(t)},throwEmptyException(t){throw new(this.getException("EmptyException",s.PARAMETER_ERROR_LACK+" -> "+(t||"")))(t)},throwIntegerException(t){throw new(this.getException("IntegerException",s.PARAMETER_ERROR_INTEGER+" -> "+(t||"")))(t)},throwNumberException(t){throw new(this.getException("NumberException",s.PARAMETER_ERROR_NUMBER+" -> "+(t||"")))(t)},throwArrayException(t){throw new(this.getException("ArrayException",s.PARAMETER_ERROR_ARRAY+" -> "+(t||"")))(t)},throwFunctionException(t){throw new(this.getException("FunctionException",s.PARAMETER_ERROR_FUNCTION+" -> "+(t||"")))(t)},throwProcessException(t){throw new(this.getException("ProcessException",s.PROCESS_FAIL+" -> "+(t||"")))(t)},throwNetworkException(t){throw new(this.getException("NetworkException",s.REQUEST_ERROR_TIMEOUT+" -> "+(t||"")))(t)}},p={getDataType:t=>Object.prototype.toString.call(t).slice(8,-1),asArray(t){return this.isEmpty(t)?[]:Array.isArray(t)?t:[t]},asNumber:t=>Number.isNaN(Number(t))?0:Number(t),asString(t){if(this.isEmpty(t))return"";switch(this.getDataType(t)){case"Object":case"Array":return JSON.stringify(t);default:return t}},isEmpty(t){if(null==t)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}},json2form(t){const e=new FormData;return this.isEmpty(t)||Object.keys(t).forEach((r=>{e.append(r,t[r]instanceof Object?JSON.stringify(t[r]):t[r])})),e},guid(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const r=t.slice(1,t.length%2==0?t.length-1:t.length);for(let n=0;n<r.length;n+=2){const i=r[n];t[0]===i&&(e=r[n+1])}e||t.length%2!=0||(e=t[t.length-1])}else e=t[0];return e},asyncLoadScript:t=>new Promise(((e,r)=>{try{const n=document.querySelector(`script[src="${t}"]`);n&&n.remove();const i=document.createElement("script");i.type="text/javascript",i.src=t,"readyState"in i?i.onreadystatechange=function(){"complete"!==i.readyState&&"loaded"!==i.readyState||e(i)}:(i.onload=function(){e(i)},i.onerror=function(){r(new Error("Script failed to load for URL: "+t))}),document.body.appendChild(i)}catch(n){r(n)}})),loadStyle(t){t.forEach((t=>{const e=document.querySelector(`link[href="${t}"]`);e&&e.remove();const r=document.createElement("link");r.href=t,r.rel="stylesheet",r.type="text/css",r.onerror=function(){f.throwException(`Style loading failed for URL: ${t}`)},document.head.appendChild(r)}))},template:(t,e)=>t.replace(/\{ *([\w_-]+) *\}/g,((t,r)=>{const n=e[r];if(void 0!==n)return"function"==typeof n?n(e):n;f.throwException(`${s.DATA_ERROR_JSON}: ${t}`)})),deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter((e=>!this.isEmpty(t[e]))).map((e=>[e,t[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(((t,r)=>{try{document.execCommand("copy"),t()}catch(n){r(new Error("copy failed"))}finally{e.remove()}}))}},isArray:t=>Array.isArray(t),isObject:t=>"object"==typeof t&&null!==t,isNil:t=>void 0===t||"undefined"===t||null===t||"null"===t,isNumber:t=>"number"==typeof t&&!isNaN(t)||"string"==typeof t&&Number.isFinite(+t),isInteger:t=>parseInt(t)===t,isFunction(t){return!this.isNil(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)},isElement:t=>"object"==typeof t&&1===t.nodeType,checheVersion:(t,e)=>t.replace(/[^0-9]/gi,"")<e.replace(/[^0-9]/gi,"")},d={assign(t,...e){let r,n,i,s;for(p.isEmpty(t)&&(t={}),n=0,i=e.length;n<i;n++)for(r in s=e[n],s)s.hasOwnProperty(r)&&(t[r]=s[r]);return t},deepAssign(t,...e){const r=new WeakMap,n=(t,e)=>{if("object"!=typeof e||null===e)return e;if(r.has(e))return r.get(e);let i;i=Array.isArray(e)?Array.isArray(t)?t:[]:"object"!=typeof t||null===t||Array.isArray(t)?{}:t,r.set(e,i);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=n(i[r],e[r]));return i};let i=Object(t);for(const s of e)"object"==typeof s&&null!==s&&(i=n(i,s));return i},clone:t=>JSON.parse(JSON.stringify(t)),deepClone(t,e){return this.assign(t,e),Object.setPrototypeOf(t.__proto__,e.__proto__),t},isEqual:(t,e)=>JSON.stringify(t)===JSON.stringify(e),parse(t){if(p.isEmpty(t))return{};if(p.isObject(t))return t;try{return JSON.parse(t)}catch{f.throwException(s.DATA_ERROR_JSON+" -> "+t)}}},g={emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",createCircle(t,e={}){const r=e.lineWidth||1,n=N.createCanvas(2*t,2*t),i=n.getContext("2d");return i.beginPath(),i.fillStyle=e.fillColor||"#f00",i.strokeStyle=e.color||"#f00",i.lineWidth=r,i.arc(t,t,t,0,2*Math.PI),i.stroke(),i.fill(),n.toDataURL("image/png")},createRectangle(t,e,r={}){const n=r.lineWidth||1,i=N.createCanvas(t,e),s=i.getContext("2d");return s.fillStyle=r.fillColor||"#f00",s.strokeStyle=r.color||"#f00",s.lineWidth=n,s.beginPath(),s.stroke(),s.fillRect(0,0,t,e),i.toDataURL("image/png")},getBase64(t){let e,r;if(t instanceof HTMLCanvasElement)r=t;else{void 0===e&&(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),e.width=t.width,e.height=t.height;const n=e.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):t instanceof Image&&n.drawImage(t,0,0,t.width,t.height),r=e}return r.width>2048||r.height>2048?(console.warn("ImageUtil.getDataURL: Image converted to jpg for performance reasons",t),r.toDataURL("image/jpeg",.6)):r.toDataURL("image/png")},getBase64FromUrl(t){return new Promise(((e,r)=>{let n=new Image;n.setAttribute("crossOrigin","Anonymous"),n.src=t,n.onload=()=>{let t=this.getBase64(n);e(t)},n.onerror=r}))},parseBase64(t){let e=new RegExp("data:(?<type>.*?);base64,(?<data>.*)").exec(t);if(e&&e.groups)return{type:e.groups.type,ext:e.groups.type.split("/").slice(-1)[0],data:e.groups.data};f.throwException("parseBase64: Invalid base64 string")},async copyImage(t){try{const e=await this.getBase64FromUrl(t),r=this.parseBase64(e);if(!r)throw new Error("Failed to parse base64 data.");let n=r.type,i=atob(r.data),s=new ArrayBuffer(i.length),o=new Uint8Array(s);for(let t=0;t<i.length;t++)o[t]=i.charCodeAt(t);let a=new Blob([s],{type:n});await navigator.clipboard.write([new ClipboardItem({[n]:a})])}catch(e){f.throwException("Failed to copy image to clipboard:")}}},m={jsonp(t,e){const r="_jsonp_"+p.guid(),n=document.getElementsByTagName("head")[0];t.includes("?")?t+="&callback="+r:t+="?callback="+r;let i=document.createElement("script");i.type="text/javascript",i.src=t,window[r]=function(t){e(null,t),n.removeChild(i),i=null,delete window[r]},n.appendChild(i)},get(t,e={},r){if(p.isFunction(e)){const t=r;r=e,e=t}const n=this._getClient(r);if(n.open("GET",t,!0),e){for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);n.withCredentials="include"===e.credentials,e.responseType&&(n.responseType=e.responseType)}return n.send(null),n},post(t,e={},r){let n;if("string"!=typeof t?(r=e.cb,n=e.postData,delete(e={...e}).cb,delete e.postData,t=e.url):("function"==typeof e&&(r=e,e={}),n=e.postData),!r)throw new Error("Callback function is required");const i=this._getClient(r);return i.open("POST",t,!0),e.headers=e.headers||{},e.headers["Content-Type"]||(e.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.keys(e.headers).forEach((t=>{i.setRequestHeader(t,e.headers[t])})),"string"!=typeof n&&(n=JSON.stringify(n)),i.send(n),i},_wrapCallback:(t,e)=>function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e({},new Error("http status 200 returned without content.")):e({data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")},null)}else e(t.responseText,null);else e({},new Error(t.statusText+","+t.status))},_getClient(t){let e=null;try{e=new XMLHttpRequest}catch(r){throw new Error("XMLHttpRequest not supported.")}return e&&(e.onreadystatechange=this._wrapCallback(e,t)),e},getArrayBuffer(t,e,r){if(p.isFunction(e)){const t=r;r=e,e=t}return e||(e={}),e.responseType="arraybuffer",this.get(t,e,r)},getImage(t,e,r){return this.getArrayBuffer(e,r,((e,r)=>{if(e)t.onerror&&t.onerror(e);else if(r){const e=window.URL||window.webkitURL,n=t.onload;t.onload=()=>{n&&n(),e.revokeObjectURL(t.src)};const i=new Blob([new Uint8Array(r.data)],{type:r.contentType});t.cacheControl=r.cacheControl,t.expires=r.expires,t.src=r.data.byteLength?e.createObjectURL(i):g.emptyImageUrl}}))},getJSON(t,e={},r){if(p.isFunction(e)){const t=r;r=e,e=t}const n=function(t,e){const n=t?d.parse(t):null;r&&r(n,e)};return e&&e.jsonp?this.jsonp(t,n):this.get(t,e,n)}},y={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:(t,e)=>t+Math.floor(Math.random()*(e-t+1)),randFloat:(t,e)=>t+Math.random()*(e-t),deg2Rad(t){return t*this.DEG2RAD},rad2Deg(t){return t*this.RAD2DEG},round:(t,e=2)=>p.isNumber(t)?Math.round(Number(t)*Math.pow(10,e))/Math.pow(10,e):0,clamp:(t,e,r)=>Math.max(e,Math.min(r,t)),formatLength(t,e={decimal:1}){const{decimal:r}=e;if(t>=1e3){const e=t/1e3;return e%1==0?`${e.toFixed(0)}km`:`${e.toFixed(r).replace(/\.?0+$/,"")}km`}return t%1==0?`${t.toFixed(0)}m`:`${t.toFixed(r).replace(/\.?0+$/,"")}m`},formatArea(t,e={decimal:1}){const{decimal:r}=e;if(t>=1e6){return t/1e6%1==0?`${t.toFixed(0)}km²`:`${t.toFixed(r).replace(/\.?0+$/,"")}km²`}return t%1==0?`${t.toFixed(0)}m²`:`${t.toFixed(r).replace(/\.?0+$/,"")}m²`}};class b{static isLnglat(t,e){return p.isNumber(t)&&p.isNumber(e)&&!!(+e>=-90&&+e<=90&&+t>=-180&&+t<=180)}static distance(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}static distanceByPoints(t,e){const{lng:r,lat:n}=t,{lng:i,lat:s}=e;let o=Math.cos(n*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.cos((r-i)*Math.PI/180)+Math.sin(n*Math.PI/180)*Math.sin(s*Math.PI/180);o>1&&(o=1),o<-1&&(o=-1);return 6371e3*Math.acos(o)}static formatLnglat(t,e){let r="";function n(t){const e=Math.floor(t),r=Math.floor(60*(t-e));return`${e}°${r}′${(3600*(t-e)-60*r).toFixed(2)}″`}return this.isLnglat(t,e)?r=n(t)+","+n(e):isNaN(t)?isNaN(e)||(r=n(e)):r=n(t),r}static transformLnglat(t,e){function r(t){let e=/[sw]/i.test(t)?-1:1;const r=t.match(/[\d.]+/g)||[];let n=0;for(let i=0;i<r.length;i++)n+=parseFloat(r[i])/e,e*=60;return n}if(t&&e)return{lng:r(t),lat:r(e)}}static rayCasting(t,e){for(var r=t.x,n=t.y,i=!1,s=0,o=e.length,a=o-1;s<o;a=s,s++){var h=e[s].x,c=e[s].y,l=e[a].x,u=e[a].y;if(h===r&&c===n||l===r&&u===n)return"on";if(c<n&&u>=n||c>=n&&u<n){var f=h+(n-c)*(l-h)/(u-c);if(f===r)return"on";f>r&&(i=!i)}}return i?"in":"out"}static rotatePoint(t,e,r){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-r)-(t.y-e.y)*Math.sin(Math.PI/180*-r)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-r)+(t.y-e.y)*Math.cos(Math.PI/180*-r)+e.y}}static calcBearAndDis(t,e){const{x:r,y:n}=t,{x:i,y:s}=e,o=i-r,a=s-n,h=Math.sqrt(o*o+a*a);return{angle:(Math.atan2(o,a)*(180/Math.PI)+360)%360,distance:h}}static calcBearAndDisByPoints(t,e){var r=1*t.lat,n=1*t.lng,i=1*e.lat,s=1*e.lng,o=Math.sin((s-n)*this.toRadian)*Math.cos(i*this.toRadian),a=Math.cos(r*this.toRadian)*Math.sin(i*this.toRadian)-Math.sin(r*this.toRadian)*Math.cos(i*this.toRadian)*Math.cos((s-n)*this.toRadian),h=Math.atan2(o,a)*(180/Math.PI),c=(i-r)*this.toRadian,l=(s-n)*this.toRadian,u=Math.sin(c/2)*Math.sin(c/2)+Math.cos(r*this.toRadian)*Math.cos(i*this.toRadian)*Math.sin(l/2)*Math.sin(l/2),f=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return{angle:h,distance:this.R*f}}static distanceToSegment(t,e,r){const n=t.x,i=t.y,s=e.x,o=e.y,a=r.x,h=r.y,c=(a-s)*(n-s)+(h-o)*(i-o);if(c<=0)return Math.sqrt((n-s)*(n-s)+(i-o)*(i-o));const l=(a-s)*(a-s)+(h-o)*(h-o);if(c>=l)return Math.sqrt((n-a)*(n-a)+(i-h)*(i-h));const u=c/l,f=s+(a-s)*u,p=o+(h-o)*u;return Math.sqrt((n-f)*(n-f)+(i-p)*(i-p))}static calcPointByBearAndDis(t,e,r){const n=y.deg2Rad(1*t.lat),i=y.deg2Rad(1*t.lng),s=r/this.R;e=y.deg2Rad(e);const o=Math.asin(Math.sin(n)*Math.cos(s)+Math.cos(n)*Math.sin(s)*Math.cos(e)),a=i+Math.atan2(Math.sin(e)*Math.sin(s)*Math.cos(n),Math.cos(s)-Math.sin(n)*Math.sin(o));return{lat:y.rad2Deg(o),lng:y.rad2Deg(a)}}static mercatorTolonlat(t,e){const r=this.R_EQU;return{lng:t/r*(180/Math.PI),lat:Math.atan(Math.exp(e/r))*(180/Math.PI)*2-90}}static lonlatToMercator(t,e){var r=this.R_EQU;const n=t*Math.PI/180*r;var i=e*Math.PI/180;return{x:n,y:r/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)))}}static interpolate({x:t,y:e,z:r=0},{x:n,y:i,z:s=0},o){return{x:t+(n-t)*o,y:e+(i-e)*o,z:r+(s-r)*o}}static getTraingleArea(t,e,r){let n=0;const i=[];if(i[0]=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow((t.z||0)-(e.z||0),2)),i[1]=Math.sqrt(Math.pow(t.x-r.x,2)+Math.pow(t.y-r.y,2)+Math.pow((t.z||0)-(r.z||0),2)),i[2]=Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2)+Math.pow((r.z||0)-(e.z||0),2)),i[0]+i[1]<=i[2]||i[0]+i[2]<=i[1]||i[1]+i[2]<=i[0])return n;const s=(i[0]+i[1]+i[2])/2;return n=Math.sqrt(s*(s-i[0])*(s-i[1])*(s-i[2])),n}static getPolygonCentroid(t){let e=0,r=0;const n=t.length;for(let i=0,s=t.length;i<s;i++){const n=t[i];"x"in n&&"y"in n?(e+=n.x,r+=n.y):"lng"in n&&"lat"in n&&(e+=n.lng,r+=n.lat)}return{x:e/n,y:r/n}}}n(b,"toRadian",Math.PI/180),n(b,"R",6371393),n(b,"R_EQU",6378137);const w={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class _{constructor(t,e,r,i){n(this,"_r"),n(this,"_g"),n(this,"_b"),n(this,"_alpha"),this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(r),this._r=t,this._g=e,this._b=r,this._alpha=y.clamp(i||1,0,1)}_validateColorChannel(t){(t<0||t>255)&&f.throwException("Color channel must be between 0 and 255.")}toArray(){return[this._r,this._g,this._b,this._alpha]}toString(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}toJson(){return{r:this._r,g:this._g,b:this._b,a:this._alpha}}get rgba(){return`rgba(${this._r}, ${this._g}, ${this._b}, ${this._alpha})`}get hex(){return _.rgb2hex(this._r,this._g,this._b,this._alpha)}setAlpha(t){return this._alpha=y.clamp(t,0,1),this}setRgb(t,e,r){return this._validateColorChannel(t),this._validateColorChannel(e),this._validateColorChannel(r),this._r=t,this._g=e,this._b=r,this}static fromRgba(t){const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+))?\s*\)$/);if(!e)throw new Error("Invalid RGBA color value");const r=parseInt(e[1],10),n=parseInt(e[2],10),i=parseInt(e[3],10),s=e[5]?parseFloat(e[5]):1;return new _(r,n,i,s)}static fromHex(t,e=1){const r=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,r,n)=>e+e+r+r+n+n)),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);if(!n)throw new Error("Invalid HEX color value");const i=parseInt(n[1],16),s=parseInt(n[2],16),o=parseInt(n[3],16);return new _(i,s,o,e)}static fromHsl(t){const e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t);if(!e)throw new Error("Invalid HSL color value");const r=parseInt(e[1],10)/360,n=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100,s=e[4]?parseFloat(e[4]):1;function o(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}let a,h,c;if(0===n)a=h=c=i;else{const t=i<.5?i*(1+n):i+n-i*n,e=2*i-t;a=o(e,t,r+1/3),h=o(e,t,r),c=o(e,t,r-1/3)}return new _(Math.round(255*a),Math.round(255*h),Math.round(255*c),s)}static fromName(t){const e=w[t];return e||f.throwException(`Invalid color name: ${t}`),new _(e[0],e[1],e[2],e.length>3?e[3]:1)}static from(t){return this.isRgb(t)?this.fromRgba(t):this.isHex(t)?this.fromHex(t):this.isHsl(t)?this.fromHsl(t):Object.keys(w).map((t=>t.toString())).includes(t)?this.fromName(t):f.throwException("Invalid color value")}static rgb2hex(t,e,r,n){var i="#"+((1<<24)+(t<<16)+(e<<8)+r).toString(16).slice(1);if(void 0!==n){return i+Math.round(255*n).toString(16).padStart(2,"0")}return i}static isHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static isRgb(t){return/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+)?\s*\)$/.test(t)}static isHsl(t){return/^(hsl|hsla)\(\d+,\s*[\d.]+%,\s*[\d.]+%(,\s*[\d.]+)?\)$/.test(t)}static isColor(t){return this.isHex(t)||this.isRgb(t)||this.isHsl(t)}static random(){let t=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),r=Math.floor(256*Math.random()),n=Math.random();return new _(t,e,r,n)}}const v=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],E={getGeoJsonType:t=>t.geometry?t.geometry.type:null,isGeoJson(t){const e=this.getGeoJsonType(t);if(e)for(let r=0,n=v.length;r<n;r++)if(v[r]===e)return!0;return!1},isGeoJsonPolygon(t){const e=this.getGeoJsonType(t);return!(!e||e!==v[4]&&e!==v[5])},isGeoJsonLine(t){const e=this.getGeoJsonType(t);return!(!e||e!==v[2]&&e!==v[3])},isGeoJsonPoint(t){const e=this.getGeoJsonType(t);return!(!e||e!==v[0]&&e!==v[1])},isGeoJsonMulti(t){const e=this.getGeoJsonType(t);return!!(e&&e.indexOf("Multi")>-1)},getGeoJsonCoordinates:t=>t.geometry?t.geometry.coordinates:[],getGeoJsonCenter(t,e){const r=this.getGeoJsonType(t);if(!r||!t.geometry)return null;const n=t.geometry.coordinates;if(!n)return null;let i=0,s=0,o=0;switch(r){case"Point":i=n[0],s=n[1],o++;break;case"MultiPoint":case"LineString":for(let t=0,e=n.length;t<e;t++)i+=n[t][0],s+=n[t][1],o++;break;case"MultiLineString":case"Polygon":for(let t=0,e=n.length;t<e;t++)for(let r=0,a=n[t].length;r<a;r++)i+=n[t][r][0],s+=n[t][r][1],o++;break;case"MultiPolygon":for(let t=0,e=n.length;t<e;t++)for(let r=0,a=n[t].length;r<a;r++)for(let e=0,h=n[t][r].length;e<h;e++)i+=n[t][r][e][0],s+=n[t][r][e][1],o++}const a=i/o,h=s/o;return e?(e.x=a,e.y=h,e):{x:a,y:h}},spliteGeoJsonMulti(t){const e=this.getGeoJsonType(t);if(!e||!t.geometry)return null;const r=t.geometry,n=t.properties||{},i=r.coordinates;if(!i)return null;const s=[];let o;switch(e){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}if(o)for(let a=0,h=i.length;a<h;a++)s.push({type:"Feature",geometry:{type:o,coordinates:i[a]},properties:n});else s.push(t);return s},getGeoJsonByCoordinates(t,e){if(!Array.isArray(t))throw Error("coordinates 参数格式错误");let r;if(2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])r="Point";else if(Array.isArray(t[0])&&2===t[0].length)r="LineString";else{if(!Array.isArray(t[0])||!Array.isArray(t[0][0]))throw Error("coordinates 参数格式错误");{const e=t[0];if(e[0].join(",")===e[e.length-1].join(","))r="Polygon";else{if(!(t.length>1))throw Error("coordinates 参数格式错误");r="MultiPolygon"}}}return{type:"Feature",geometry:{type:r,coordinates:t},properties:e||{}}}},S={assertEmpty(...t){t.forEach((t=>{p.isEmpty(t)&&f.throwEmptyException(t)}))},assertInteger(...t){t.forEach((t=>{p.isInteger(t)||f.throwIntegerException(t)}))},assertNumber(...t){t.forEach((t=>{p.isNumber(t)||f.throwNumberException(t)}))},assertArray(...t){t.forEach((t=>{p.isArray(t)||f.throwArrayException(t)}))},assertFunction(...t){t.forEach((t=>{p.isFunction(t)||f.throwFunctionException(t)}))},assertColor(...t){t.forEach((t=>{_.isColor(t)||f.throwColorException(t)}))},assertLnglat(...t){t.forEach((t=>{b.isLnglat(t.lng,t.lat)||f.throwCoordinateException(JSON.stringify(t))}))},assertGeoJson(...t){t.forEach((t=>{E.isGeoJson(t)||f.throwGeoJsonException(t)}))},assertContain(t,...e){let r=!1;for(let n=0,i=e.length||0;n<i;n++)r=t.indexOf(e[n])>=0;if(r)throw Error(s.STRING_CHECK_LOSS+" -> "+t)},assertStartWith(t,e){if(!t.startsWith(e))throw Error("字符串"+t+"开头不是 -> "+e)},assertEndWith(t,e){if(!t.endsWith(e))throw Error("字符串"+t+"结尾不是 -> "+e)}},A=Object.create(Array);A.prototype.groupBy=function(t=t=>t){var e={};return this.forEach((function(r){var n=JSON.stringify(t(r));e[n]=e[n]||[],e[n].push(r)})),Object.keys(e).map((t=>e[t]))},A.prototype.distinct=function(t=t=>t){const e=[],r={};return this.forEach((n=>{const i=t(n),s=String(i);r[s]||(r[s]=!0,e.push(n))})),e},A.prototype.max=function(t=t=>t){return this.desc(t)[0]},A.prototype.min=function(t=t=>t){return this.asc(t)[0]},A.prototype.sum=function(t=t=>t){return 1===this.length?t(this[0]):this.length>1?this.reduce(((e=0,r=0)=>t(e)+t(r))):0},A.prototype.avg=function(t=t=>t){return this.length?this.sum(t)/this.length:0},A.prototype.desc=function(t=t=>t){return this.sort(((e,r)=>t(r)-t(e)))},A.prototype.asc=function(t=t=>t){return this.sort(((e,r)=>t(e)-t(r)))},A.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},A.prototype.remove=function(t=t=>t){const e=this.findIndex(t);return e>-1&&(this.splice(e,1),this.remove(t)),this};const C={create:t=>[...new Array(t).keys()],union(...t){let e=[];return t.forEach((t=>{Array.isArray(t)&&(e=e.concat(t.filter((t=>!e.includes(t)))))})),e},intersection(...t){let e=t[0]||[];return t.forEach((t=>{Array.isArray(t)&&(e=e.filter((e=>t.includes(e))))})),e},unionAll:(...t)=>[...t].flat().filter((t=>!!t)),difference(...t){return 0===t.length?[]:this.union(...t).filter((e=>!this.intersection(...t).includes(e)))},zhSort:(t,e=t=>t,r)=>(t.sort((function(t,n){return r?e(t).localeCompare(e(n),"zh"):e(n).localeCompare(e(t),"zh")})),t)};class k{static getSystem(){var t,e,r,n,i,s,o,a,h;const c=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let l="",u="";if(c.includes("Android")||c.includes("Adr"))l="Android",u=(null==(e=c.match(/Android ([\d.]+);/))?void 0:e[1])||"";else if(c.includes("CrOS"))l="Chromium OS",u=(null==(r=c.match(/MSIE ([\d.]+)/))?void 0:r[1])||(null==(n=c.match(/rv:([\d.]+)/))?void 0:n[1])||"";else if(c.includes("Linux")||c.includes("X11"))l="Linux",u=(null==(i=c.match(/Linux ([\d.]+)/))?void 0:i[1])||"";else if(c.includes("Ubuntu"))l="Ubuntu",u=(null==(s=c.match(/Ubuntu ([\d.]+)/))?void 0:s[1])||"";else if(c.includes("Windows")){let t=(null==(o=c.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))?void 0:o[1])||"",e={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};l="Windows",u=t in e?e[t]:t}else c.includes("like Mac OS X")?(l="IOS",u=(null==(a=c.match(/OS ([\d_]+) like/))?void 0:a[1].replace(/_/g,"."))||""):c.includes("Macintosh")&&(l="macOS",u=(null==(h=c.match(/Mac OS X -?([\d_]+)/))?void 0:h[1].replace(/_/g,"."))||"");return{type:l,version:u}}static getExplorer(){var t;const e=this.userAgent||(null==(t=this.navigator)?void 0:t.userAgent);let r="",n="";if(/MSIE|Trident/.test(e)){let t=/MSIE\s(\d+\.\d+)/.exec(e)||/rv:(\d+\.\d+)/.exec(e);t&&(r="IE",n=t[1])}else if(/Edge/.test(e)){let t=/Edge\/(\d+\.\d+)/.exec(e);t&&(r="Edge",n=t[1])}else if(/Chrome/.test(e)&&/Google Inc/.test(this.navigator.vendor)){let t=/Chrome\/(\d+\.\d+)/.exec(e);t&&(r="Chrome",n=t[1])}else if(/Firefox/.test(e)){let t=/Firefox\/(\d+\.\d+)/.exec(e);t&&(r="Firefox",n=t[1])}else if(/Safari/.test(e)&&/Apple Computer/.test(this.navigator.vendor)){let t=/Version\/(\d+\.\d+)([^S]*)(Safari)/.exec(e);t&&(r="Safari",n=t[1])}return{type:r,version:n}}static isSupportWebGL(){if(!(null==this?void 0:this.document))return!1;const t=this.document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");return e&&e instanceof WebGLRenderingContext}static getGPU(){let t="unknown",e="unknown";if(null==this?void 0:this.document){let r=this.document.createElement("canvas"),n=r.getContext("webgl")||r.getContext("experimental-webgl");if(n instanceof WebGLRenderingContext){let r=n.getExtension("WEBGL_debug_renderer_info");if(r){let i=n.getParameter(r.UNMASKED_RENDERER_WEBGL);t=(i.match(/ANGLE \((.+?),/)||[])[1]||"",e=(i.match(/, (.+?) (\(|vs_)/)||[])[1]||""}return{type:t,model:e,spec:{maxTextureSize:n.getParameter(n.MAX_TEXTURE_SIZE),maxRenderBufferSize:n.getParameter(n.MAX_RENDERBUFFER_SIZE),maxTextureUnits:n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)}}}}return{type:t,model:e}}static getLanguage(){var t,e;let r=(null==(t=this.navigator)?void 0:t.language)||(null==(e=this.navigator)?void 0:e.userLanguage);if("string"!=typeof r)return"";let n=r.split("-");return n[1]&&(n[1]=n[1].toUpperCase()),n.join("_")}static getTimeZone(){var t,e;return null==(e=null==(t=null==Intl?void 0:Intl.DateTimeFormat())?void 0:t.resolvedOptions())?void 0:e.timeZone}static async getScreenFPS(){return new Promise((function(t){let e=0,r=1,n=[],i=function(s){if(e>0)if(r<12)n.push(s-e),e=s,r++,requestAnimationFrame(i);else{n.sort(),n=n.slice(1,11);let e=n.reduce(((t,e)=>t+e));const r=10*Math.round(1e4/e/10);t(r)}else e=s,requestAnimationFrame(i)};requestAnimationFrame(i)}))}static async getIPAddress(){const t=/\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/,e=/\b(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}\b/i;let r=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;const n=new Set,i=r=>{var i;const s=null==(i=null==r?void 0:r.candidate)?void 0:i.candidate;if(s)for(const o of[t,e]){const t=s.match(o);t&&n.add(t[0])}};return new Promise((function(t,e){const s=new r({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.services.mozilla.com"}]});s.addEventListener("icecandidate",i),s.createDataChannel(""),s.createOffer().then((t=>s.setLocalDescription(t)),e);let o,a=20,h=function(){try{s.removeEventListener("icecandidate",i),s.close()}catch{}o&&clearInterval(o)};o=window.setInterval((function(){let e=[...n];e.length?(h(),t(e[0])):a?a--:(h(),t(""))}),100)}))}static async getNetwork(){var t,e;let r="unknown",n=null==(t=this.navigator)?void 0:t.connection;return n&&(r=n.type||n.effectiveType,"2"!=r&&"unknown"!=r||(r="wifi")),{network:r,isOnline:(null==(e=this.navigator)?void 0:e.onLine)||!1,ip:await this.getIPAddress()}}}n(k,"document",null==window?void 0:window.document),n(k,"navigator",null==window?void 0:window.navigator),n(k,"userAgent",null==(e=null==window?void 0:window.navigator)?void 0:e.userAgent),n(k,"screen",null==window?void 0:window.screen);class I{static delta(t,e){const r=6378245,n=.006693421622965943;let i=this.transformLat(e-105,t-35),s=this.transformLon(e-105,t-35);const o=t/180*this.PI;let a=Math.sin(o);a=1-n*a*a;const h=Math.sqrt(a);return i=180*i/(r*(1-n)/(a*h)*this.PI),s=180*s/(r/h*Math.cos(o)*this.PI),{lat:i,lng:s}}static outOfChina(t,e){return t<72.004||t>137.8347||(e<.8293||e>55.8271)}static gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const r=this.delta(t,e);return{lat:t+r.lat,lng:e+r.lng}}static gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const r=this.delta(t,e);return{lat:t-r.lat,lng:e-r.lng}}static gcjDecryptExact(t,e){let r=.01,n=.01,i=t-r,s=e-n,o=t+r,a=e+n,h=0,c=0,l=0;for(;;){h=(i+o)/2,c=(s+a)/2;const u=this.gcjEncrypt(h,c);if(r=u.lat-t,n=u.lng-e,Math.abs(r)<1e-9&&Math.abs(n)<1e-9)break;if(r>0?o=h:i=h,n>0?a=c:s=c,++l>1e4)break}return{lat:h,lng:c}}static bdEncrypt(t,e){const r=e,n=t,i=Math.sqrt(r*r+n*n)+2e-5*Math.sin(n*this.XPI),s=Math.atan2(n,r)+3e-6*Math.cos(r*this.XPI),o=i*Math.cos(s)+.0065;return{lat:i*Math.sin(s)+.006,lng:o}}static bdDecrypt(t,e){const r=e-.0065,n=t-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.XPI),s=Math.atan2(n,r)-3e-6*Math.cos(r*this.XPI),o=i*Math.cos(s);return{lat:i*Math.sin(s),lng:o}}static mercatorEncrypt(t,e){const r=20037508.34*e/180;let n=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return n=20037508.34*n/180,{lat:n,lng:r}}static mercatorDecrypt(t,e){const r=e/20037508.34*180;let n=t/20037508.34*180;return n=180/this.PI*(2*Math.atan(Math.exp(n*this.PI/180))-this.PI/2),{lat:n,lng:r}}static transformLat(t,e){let r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3,r}static transformLon(t,e){let r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3,r}static random({x:t,y:e},{x:r,y:n}){return{x:Math.random()*(r-t)+t,y:Math.random()*(n-e)+e}}static deCompose(t,e,r){const n=[];if(t instanceof Array&&!(t[0]instanceof Array))e(t);else if(t instanceof Array&&t[0]instanceof Array)for(let i=0;i<t.length;i++){const s=t[i];if(!p.isNil(s))if(s[0]instanceof Array){const t=r?this.deCompose(s,(t=>e(t)),r):this.deCompose(s,(t=>e(t)));n.push(t)}else{const t=r?e.call(r,s):e(s);n.push(t)}}return n}}function R(t){return function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).split(/\s+/)}n(I,"PI",3.141592653589793),n(I,"XPI",52.35987755982988);const x={getStyle(t,e){var r;let n=t.style[e];if(!n||"auto"===n){const i=null==(r=document.defaultView)?void 0:r.getComputedStyle(t,null);n=i?i[e]:null,"auto"===n&&(n=null)}return n},create(t,e,r){const n=document.createElement(t);return n.className=e||"",r&&r.appendChild(n),n},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=>((null==t?void 0:t.host)||t).className.toString(),hasClass(t,e){var r;if(null==(r=t.classList)?void 0:r.contains(e))return!0;const n=this.getClass(t);return n.length>0&&new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)},addClass(t,e){if(void 0!==t.classList){const r=R(e);for(let e=0,n=r.length;e<n;e++)t.classList.add(r[e])}else if(!this.hasClass(t,e)){const r=this.getClass(t);this.setClass(t,(r?r+" ":"")+e)}},removeClass(t,e){if(void 0!==t.classList){R(e).forEach((e=>t.classList.remove(e)))}else this.setClass(t,(" "+this.getClass(t)+" ").replace(" "+e+" "," ").trim())},setClass(t,e){"classList"in t&&(t.classList.value="",e.split(" ").forEach((e=>t.classList.add(e))))},parseFromString:t=>(new DOMParser).parseFromString(t,"text/xml").children[0]},T={convertBase64ToBlob(t){const e=t.split(",")[0].split(":")[1].split(";")[0],r=atob(t.split(",")[1]),n=new Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);const i=new Uint8Array(n);return new Blob([i],{type:e})},convertBase64ToFile(t,e){const r=t.split(","),n=r[0].match(/:(.*?);/),i=n?n[1]:"image/png",s=atob(r[1]),o=new Uint8Array(s.length);for(let a=0;a<s.length;a++)o[a]=s.charCodeAt(a);return new File([o],e,{type:i})},downloadFromFile(t,e){if("object"==typeof t)if(t instanceof Blob)t=URL.createObjectURL(t);else{const e=JSON.stringify(t),r=new Blob([e],{type:"text/json"});t=window.URL.createObjectURL(r)}else if("string"==typeof t&&-1===t.indexOf("http")){const e=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(e)}var r=document.createElement("a");r.href=t,r.download=e||"",r.click(),window.URL.revokeObjectURL(r.href)},readFile:(t,e="arrayBuffer")=>new Promise(((r,n)=>{const i=new FileReader;"arrayBuffer"===e?i.readAsArrayBuffer(t):i.readAsText(t),i.onload=function(t){var e;r(null==(e=t.target)?void 0:e.result)},i.onerror=function(t){n(t)}})),readFileFromUrl:(t,e,r="arrayBuffer")=>new Promise(((n,i)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="blob";const o=e.split(".");try{s.onload=function(){if(this.status>=200&&this.status<300){const t=s.response,a=URL.createObjectURL(t),h=new File([t],e,{type:o[1],lastModified:(new Date).getTime()}),c=new FileReader;"arrayBuffer"===r?c.readAsArrayBuffer(h):c.readAsText(h),c.onload=function(t){var e;URL.revokeObjectURL(a),n(null==(e=t.target)?void 0:e.result)},c.onerror=function(t){i(t)}}},s.onerror=function(t){i(t)}}catch(a){i(a)}s.send()}))};class M{static resetWarned(){this.warned={}}static changeVoice(){this.isMute=!!Number(!this.isMute),localStorage.setItem("mute",Number(this.isMute).toString())}static _call(t,e,r){this.warned[e]||(t(e,r),this.warned[e]=!0)}static msg(t,e,r={}){if(this.isMute)return;const n=p.decodeDict(t,"success","恭喜","error","发生错误","warning","警告","info","友情提示")+":";this.speechSynthesisUtterance.text=n+e,this.speechSynthesisUtterance.lang=r.lang||"zh-CN",this.speechSynthesisUtterance.volume=r.volume||1,this.speechSynthesisUtterance.rate=r.rate||1,this.speechSynthesisUtterance.pitch=r.pitch||1,this.speechSynthesis.speak(this.speechSynthesisUtterance)}static stop(t){this.speechSynthesisUtterance.text=t,this.speechSynthesis.cancel()}static warning(t,e={}){console.warn(`Warning: %c${t}`,"color:#E6A23C;font-weight: bold;"),this.msg("warning",t,e)}static warningOnce(t,e={}){this._call(this.warning.bind(this),t,e)}static info(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.info(`Info: %c${t}`,"color:#909399;font-weight: bold;"),this.msg("info",t,e)}static infoOnce(t,e={}){this._call(this.info.bind(this),t,e)}static error(t,e={}){console.error(`Error: %c${t}`,"color:#F56C6C;font-weight: bold;"),this.msg("error",t,e)}static errorOnce(t,e={}){this._call(this.error.bind(this),t,e)}static success(t,e={}){"development"===process.env.NODE_ENV&&void 0!==console&&console.log(`Success: %c${t}`,"color:#67C23A;font-weight: bold;"),this.msg("success",t,e)}static successOnce(t,e={}){this._call(this.success.bind(this),t,e)}}n(M,"warned",{}),n(M,"isMute",!!Number(localStorage.getItem("mute"))||!1),n(M,"speechSynthesis",window.speechSynthesis),n(M,"speechSynthesisUtterance",new SpeechSynthesisUtterance);const P={debounce(t,e,r=!0){let n,i,s=null;const o=()=>{const a=Date.now()-n;a<e&&a>0?s=setTimeout(o,e-a):(s=null,r||(i=t.apply(this,undefined)))};return(...a)=>{n=Date.now();const h=r&&!s;return s||(s=setTimeout(o,e)),h&&(i=t.apply(this,a),s||(a=null)),i}},throttle(t,e,r=1){let n=0,i=null;return(...s)=>{if(1===r){const r=Date.now();r-n>=e&&(t.apply(this,s),n=r)}else 2===r&&(i||(i=setTimeout((()=>{i=null,t.apply(this,s)}),e)))}},memoize(t){const e=new Map;return(...r)=>{const n=JSON.stringify(r);if(e.has(n))return e.get(n);{const i=t.apply(this,r);return e.set(n,i),i}}},recurve(t,e=500,r=5e3){let n=0;setTimeout((()=>{n++,n<Math.floor(r/e)&&(t.call(this),setTimeout(this.recurve.bind(this,t,e,r),e))}),e)},once(t){let e=!1;return function(...r){if(!e)return e=!0,t(...r)}}},O={changeCase(t,e){switch(e=e||h.LOWER_CASE){case h.REVERSE_CASE:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case h.UPPER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case h.LOWER_CAMEL_CASE:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case h.UPPER_CASE:return t.toUpperCase();case h.LOWER_CASE:return t.toLowerCase();default:return t}},getByteLength:t=>t.replace(/[\u0391-\uFFE5]/g,"aa").length,subStringByte(t,e,r){var n=/[^\x00-\xff]/g;if(t.replace(n,"mm").length<=r)return t;for(var i=Math.floor(r/2);i<t.length;i++){let s=t.substring(e,i);if(s.replace(n,"mm").length>=r)return s}return t},string2Bytes(t){const e=[];let r;const n=t.length;for(let i=0;i<n;i++)r=t.charCodeAt(i),r>=65536&&r<=1114111?(e.push(r>>18&7|240),e.push(r>>12&63|128),e.push(r>>6&63|128),e.push(63&r|128)):r>=2048&&r<=65535?(e.push(r>>12&15|224),e.push(r>>6&63|128),e.push(63&r|128)):r>=128&&r<=2047?(e.push(r>>6&31|192),e.push(63&r|128)):e.push(255&r);return new Uint8Array(e)},bytes2String(t){if("string"==typeof t)return t;let e="";const r=t;for(let n=0;n<r.length;n++){const t=r[n].toString(2),i=t.match(/^1+?(?=0)/);if(i&&8==t.length){const t=i[0].length;let s=r[n].toString(2).slice(7-t);for(let e=1;e<t;e++)s+=r[e+n].toString(2).slice(2);e+=String.fromCharCode(parseInt(s,2)),n+=t-1}else e+=String.fromCharCode(r[n])}return e}},B={buildTree(t,e="id",r="pid"){const n=[];function i(n){const s=n[e],o=t.filter((t=>t.hasOwnProperty(r)&&t[r]===s));o.length>0&&(o.forEach(i),n.children=o)}for(const s of t)s.hasOwnProperty(r)&&s[r]&&null!==s[r]||(i(s),n.push(s));return n},flatTree(t){let e=[];return t.forEach((t=>{e.push(t),t.children&&t.children.length>0&&(e=e.concat(this.flatTree(t.children)))})),e}},L={json2Query(t){var e=[];for(var r in t)if(t.hasOwnProperty(r)){var n=r,i=t[r];e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return e.join("&")},query2Json(t=window.location.href,e=!0){const r=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:n,hash:i}=new URL(t),s=[n,i];let o={};for(let a=0;a<s.length;a++){const t=s[a];if(t){const n=t.replace(/#|\//g,"").split("?");if(n.length>1)for(let t=1;t<n.length;t++){let i;for(;i=r.exec(n[t]);)o[i[1]]=e?decodeURIComponent(i[2]):i[2]}}}return o}},U={isUrl:t=>/^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(t),isExternal:t=>/^(https?:|mailto:|tel:)/.test(t),isPhone:t=>/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t),isTel:t=>/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t),isStrongPwd:t=>/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/.test(t),isEmail:t=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t),isIP:t=>/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(t),isEnglish:t=>/^[a-zA-Z]+$/.test(t),isChinese:t=>/^[\u4E00-\u9FA5]+$/.test(t),isHTML:t=>/<("[^"]*"|'[^']*'|[^'">])*>/.test(t),isXML:t=>/^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$/.test(t),isIDCard:t=>/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t)};class N{constructor(t){if(n(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");this.ctx=e.getContext("2d")}}drawLine({x:t,y:e},{x:r,y:n},i={}){this.ctx.beginPath();const s=i.width||1,o=i.color||"#000";this.ctx.lineWidth=s,this.ctx.strokeStyle=o,this.ctx.moveTo(t,e),this.ctx.lineTo(r,n),this.ctx.stroke()}drawArc({x:t,y:e},r,n,i,s,o,a){o?(this.ctx.fillStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,r,y.deg2Rad(n),y.deg2Rad(i),s),this.ctx.fill()):(this.ctx.strokeStyle=a,this.ctx.beginPath(),this.ctx.arc(t,e,r,y.deg2Rad(n),y.deg2Rad(i),s),this.ctx.stroke())}drawImage({x:t,y:e},r){const n=new Image;n.src=r,n.onload=()=>{const r=n.width,i=n.height;if(!this.ctx)throw new Error("Canvas context is null");this.ctx.drawImage(n,t,e,-r/2,-i/2)}}drawText({x:t,y:e},r,n){this.ctx.font=n.font||"10px sans-serif",this.ctx.strokeStyle=n.color||"#000",this.ctx.lineWidth=2,this.ctx.strokeText(r,t,e)}static createCanvas(t=1,e=1){const r=document.createElement("canvas");return t&&(r.width=t),e&&(r.height=e),r}}class j extends Date{constructor(...t){super(t.length>1?t:1===t.length?t[0]:new Date)}format(t="yyyy-MM-dd hh:mm:ss"){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"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 r in e){const n=new RegExp("("+r+")","g");n.test(t)&&(t=t.replace(n,(t=>(1===t.length?e[r]:("00"+e[r]).substr((""+e[r]).length)).toString())))}return t}addDate(t,e){const r=new Date(this);switch(t){case"y":r.setFullYear(this.getFullYear()+e);break;case"q":r.setMonth(this.getMonth()+3*e);break;case"M":r.setMonth(this.getMonth()+e);break;case"w":r.setDate(this.getDate()+7*e);break;case"d":default:r.setDate(this.getDate()+e);break;case"h":r.setHours(this.getHours()+e);break;case"m":r.setMinutes(this.getMinutes()+e);break;case"s":r.setSeconds(this.getSeconds()+e)}return r}static lastMonth(){return new j((new Date).getFullYear(),(new Date).getMonth(),1)}static thisMonth(){return new j((new Date).getFullYear(),(new Date).getMonth()+1,1)}static nextMonth(){return new j((new Date).getFullYear(),(new Date).getMonth()+2,1)}static lastWeek(){return new j((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay())}static thisWeek(){return new j((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay())}static nextWeek(){return new j((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay())}static lastDay(){return new j((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1)}static thisDay(){return new j((new Date).setHours(0,0,0,0))}static nextDay(){return new j((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1)}static parseDate(t){if("string"==typeof t){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.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.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}static formatDateInterval(t,e){const r=new Date(t),n=new Date(e).getTime()-r.getTime(),i=Math.floor(n/864e5),s=n%864e5,o=Math.floor(s/36e5),a=s%36e5,h=Math.floor(a/6e4),c=a%6e4,l=Math.round(c/1e3);let u="";return i>0&&(u+=i+"天"),o>0&&(u+=o+"时"),h>0&&(u+=h+"分"),l>0&&(u+=l+"秒"),0===i&&0===o&&0===h&&0===l&&(u="少于1秒"),u}static formatterCounter(t){const e=function(t){return(t>=10?"":"0")+(t||0)},r=t%3600,n=r%60;return`${e(Math.floor(t/3600))}:${e(Math.floor(r/60))}:${e(Math.round(n))}`}static sleep(t){}}class D{constructor(){n(this,"_listeners",{}),n(this,"_mutex",{}),n(this,"_context")}addEventListener(t,e,r,n){this._context=r;const i=this._mutex,s=this._listeners;return void 0===s[t]&&(s[t]=[]),-1===s[t].indexOf(e)&&(n&&(i[t]=e),s[t].push(e)),this}hasEventListener(t,e){if(null===this._listeners||void 0===this._listeners)return!1;const r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const r=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==r){const t=r.map((t=>t.toString())).indexOf(e.toString());-1!==t&&r.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const r=e.slice(0);if(void 0!==this._mutex[t.type]){const e=r.find((e=>e===this._mutex[t.type]));if(e)return void e.call(this._context||this,t)}for(let e=0,n=r.length;e<n;e++){const n=r[e];"function"==typeof n&&n.call(this._context||this,t)}}}removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}on(t,e,r,n){return this.addEventListener.call(this,t,e,r,n)}off(t,e){return this.removeEventListener.call(this,t,e)}}const F=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],q=(()=>{if("undefined"==typeof document)return!1;const t=F[0],e={};for(const r of F){if((null==r?void 0:r[1])in document){for(const[n,i]of r.entries())e[t[n]]=i;return e}}return!1})(),W={change:q.fullscreenchange,error:q.fullscreenerror};let H={request:(t=document.documentElement,e)=>new Promise(((r,n)=>{const i=()=>{H.off("change",i),r()};H.on("change",i);const s=t[q.requestFullscreen](e);s instanceof Promise&&s.then(i).catch(n)})),exit:()=>new Promise(((t,e)=>{if(!H.isFullscreen)return void t();const r=()=>{H.off("change",r),t()};H.on("change",r);const n=document[q.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)})),toggle:(t,e)=>H.isFullscreen?H.exit():H.request(t,e),onchange(t){H.on("change",t)},onerror(t){H.on("error",t)},on(t,e){const r=W[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=W[t];r&&document.removeEventListener(r,e,!1)},raw:q};Object.defineProperties(H,{isFullscreen:{get:()=>Boolean(document[q.fullscreenElement])},element:{enumerable:!0,get:()=>document[q.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[q.fullscreenEnabled])}}),q||(H={isEnabled:!1});const V=H;class K extends Map{isEmpty(){return 0===this.size}_values(){return Array.from(this.values())}_keys(){return Array.from(this.keys())}_entries(){return Array.from(this.entries())}static fromEntries(t=[]){const e=new K;return t.forEach((t=>{Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e}static fromJson(t){const e=d.parse(t);return new K(Object.entries(e))}}var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function G(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var z={exports:{}};z.exports=function(){function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){if(!a&&G)return G(o);if(s)return s(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var c=r[o]={exports:{}};e[o][0].call(c.exports,(function(t){return i(e[o][1][t]||t)}),c,c.exports,t,e,r,n)}return r[o].exports}for(var s=G,o=0;o<n.length;o++)i(n[o]);return i}return t}()({1:[function(t,e,r){r.byteLength=l,r.toByteArray=f,r.fromByteArray=g;for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,h=o.length;a<h;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n}function u(t,e,r){return 3*(e+r)/4-r}function f(t){var e,r,n=c(t),o=n[0],a=n[1],h=new s(u(t,o,a)),l=0,f=a>0?o-4:o;for(r=0;r<f;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],h[l++]=e>>16&255,h[l++]=e>>8&255,h[l++]=255&e;return 2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,h[l++]=255&e),1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,h[l++]=e>>8&255,h[l++]=255&e),h}function p(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function d(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),i.push(p(n));return i.join("")}function g(t){for(var e,r=t.length,i=r%3,s=[],o=16383,a=0,h=r-i;a<h;a+=o)s.push(d(t,a,a+o>h?h:a+o));return 1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,r){},{}],3:[function(t,e,r){(function(e){(function(){var e=t("base64-js"),n=t("ieee754");r.Buffer=a,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var i=2147483647;function s(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return f(t,e);if(ArrayBuffer.isView(t))return p(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Q(t,ArrayBuffer)||t&&Q(t.buffer,ArrayBuffer))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var i=g(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t,e,r){return c(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function u(t){return c(t),o(t<0?0:0|m(t))}function f(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|b(t,e),n=o(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function p(t){for(var e=t.length<0?0:0|m(t.length),r=o(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return(n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r)).__proto__=a.prototype,n}function g(t){if(a.isBuffer(t)){var e=0|m(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?o(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}function m(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),a.alloc(+t)}function b(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return n?-1:K(t).length;e=(""+e).toLowerCase(),i=!0}}function w(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return L(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function _(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){var s,o=1,a=t.length,h=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,h/=2,r/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var l=-1;for(s=r;s<a;s++)if(c(t,s)===c(e,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===h)return l*o}else-1!==l&&(s-=s-l),l=-1}else for(r+h>a&&(r=a-h),s=r;s>=0;s--){for(var u=!0,f=0;f<h;f++)if(c(t,s+f)!==c(e,f)){u=!1;break}if(u)return s}return-1}function S(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o<n;++o){var a=parseInt(e.substr(2*o,2),16);if(J(a))return o;t[r+o]=a}return o}function A(t,e,r,n){return Y(K(e,t.length-r),t,r,n)}function C(t,e,r,n){return Y($(e),t,r,n)}function k(t,e,r,n){return C(t,e,r,n)}function I(t,e,r,n){return Y(z(e),t,r,n)}function R(t,e,r,n){return Y(G(e,t.length-r),t,r,n)}function x(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var s,o,a,h,c=t[i],l=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u<=r)switch(u){case 1:c<128&&(l=c);break;case 2:128==(192&(s=t[i+1]))&&(h=(31&c)<<6|63&s)>127&&(l=h);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(h=(15&c)<<12|(63&s)<<6|63&o)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(h=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&h<1114112&&(l=h)}null===l?(l=65533,u=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=u}return P(n)}r.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(t,e,r){return h(t,e,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(t,e,r){return l(t,e,r)},a.allocUnsafe=function(t){return u(t)},a.allocUnsafeSlow=function(t){return u(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(Q(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),Q(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(Q(s,Uint8Array)&&(s=a.from(s)),!a.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},a.byteLength=b,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)_(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)_(this,e,e+3),_(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)_(this,e,e+7),_(this,e+1,e+6),_(this,e+2,e+5),_(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?T(this,0,t):w.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},a.prototype.compare=function(t,e,r,n,i){if(Q(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),h=Math.min(s,o),c=this.slice(n,i),l=t.slice(e,r),u=0;u<h;++u)if(c[u]!==l[u]){s=c[u],o=l[u];break}return s<o?-1:o<s?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return S(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return C(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return I(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function P(t){var e=t.length;if(e<=M)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=M));return r}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function B(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function L(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=e;s<r;++s)i+=V(t[s]);return i}function U(t,e,r){for(var n=t.slice(e,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function N(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,r,n,i,s){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function D(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,e,r,4),n.write(t,e,r,i,23,4),r+4}function q(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,e,r,8),n.write(t,e,r,i,52,8),r+8}a.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=a.prototype,n},a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t],i=1,s=0;++s<e&&(i*=256);)n+=this[t+s]*i;return n},a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=this[t],i=1,s=0;++s<e&&(i*=256);)n+=this[t+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},a.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||N(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||j(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s<r&&(i*=256);)this[e+s]=t/i&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||j(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);j(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s<r&&(o*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);j(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return F(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return F(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return q(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return q(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var s=i-1;s>=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var s;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s<r;++s)this[s]=t;else{var o=a.isBuffer(t)?t:a.from(t,n),h=o.length;if(0===h)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<r-e;++s)this[s+e]=o[s%h]}return this};var W=/[^+/0-9A-Za-z-_]/g;function H(t){if((t=(t=t.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function K(t,e){var r;e=e||1/0;for(var n=t.length,i=null,s=[],o=0;o<n;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function $(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function G(t,e){for(var r,n,i,s=[],o=0;o<t.length&&!((e-=2)<0);++o)n=(r=t.charCodeAt(o))>>8,i=r%256,s.push(i),s.push(n);return s}function z(t){return e.toByteArray(H(t))}function Y(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:5}],4:[function(t,e,r){var n,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};function o(t){console&&console.warn&&console.warn(t)}n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function h(){h.init.call(this)}e.exports=h,e.exports.once=_,h.EventEmitter=h,h.prototype._events=void 0,h.prototype._eventsCount=0,h.prototype._maxListeners=void 0;var c=10;function l(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?h.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var i,s,a;if(l(r),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]),void 0===a)a=s[e]=r,++t._eventsCount;else if("function"==typeof a?a=s[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=u(t))>0&&a.length>i&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,o(h)}return t}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=p.bind(n);return i.listener=r,n.wrapFn=i,i}function g(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?w(i):y(i,i.length)}function m(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function b(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function w(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function _(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,s),n(r)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}E(t,e,s,{once:!0}),"error"!==e&&v(t,i,{once:!0})}))}function v(t,e,r){"function"==typeof t.on&&E(t,"error",e,r)}function E(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(s){n.once&&t.removeEventListener(e,i),r(s)}))}}Object.defineProperty(h,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),h.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},h.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},h.prototype.getMaxListeners=function(){return u(this)},h.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=i[t];if(void 0===h)return!1;if("function"==typeof h)s(h,this,e);else{var c=h.length,l=y(h,c);for(r=0;r<c;++r)s(l[r],this,e)}return!0},h.prototype.addListener=function(t,e){return f(this,t,e,!1)},h.prototype.on=h.prototype.addListener,h.prototype.prependListener=function(t,e){return f(this,t,e,!0)},h.prototype.once=function(t,e){return l(e),this.on(t,d(this,t,e)),this},h.prototype.prependOnceListener=function(t,e){return l(e),this.prependListener(t,d(this,t,e)),this},h.prototype.removeListener=function(t,e){var r,n,i,s,o;if(l(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===e||r[s].listener===e){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():b(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,o||e)}return this},h.prototype.off=h.prototype.removeListener,h.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},h.prototype.listeners=function(t){return g(this,t,!0)},h.prototype.rawListeners=function(t){return g(this,t,!1)},h.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},h.prototype.listenerCount=m,h.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],5:[function(t,e,r){r.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,h=(1<<a)-1,c=h>>1,l=-7,u=r?i-1:0,f=r?-1:1,p=t[e+u];for(u+=f,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+t[e+u],u+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=256*o+t[e+u],u+=f,l-=8);if(0===s)s=1-c;else{if(s===h)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=c}return(p?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,h,c=8*s-i-1,l=(1<<c)-1,u=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+u>=1?f/h:f*Math.pow(2,1-u))*h>=2&&(o++,h/=2),o+u>=l?(a=0,o=l):o+u>=1?(a=(e*h-1)*Math.pow(2,i),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g}},{}],6:[function(t,e,r){(function(r,n){(function(){const i=t("events").EventEmitter,s=t("./store"),o=t("./topic-alias-recv"),a=t("./topic-alias-send"),h=t("mqtt-packet"),c=t("./default-message-id-provider"),l=t("readable-stream").Writable,u=t("inherits"),f=t("reinterval"),p=t("rfdc/default"),d=t("./validations"),g=t("xtend"),m=t("debug")("mqttjs:client"),y=r?r.nextTick:function(t){setTimeout(t,0)},b=n.setImmediate||function(t){y(t)},w={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},_=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],v={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function E(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function S(t,e){if(5===t.options.protocolVersion&&"publish"===e.cmd){let r;e.properties&&(r=e.properties.topicAlias);const n=e.topic.toString();if(t.topicAliasSend)if(r){if(0!==n.length&&(m("applyTopicAlias :: register topic: %s - alias: %d",n,r),!t.topicAliasSend.put(n,r)))return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}else 0!==n.length&&(t.options.autoAssignTopicAlias?(r=t.topicAliasSend.getAliasByTopic(n),r?(e.topic="",e.properties={...e.properties,topicAlias:r},m("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",n,r)):(r=t.topicAliasSend.getLruAlias(),t.topicAliasSend.put(n,r),e.properties={...e.properties,topicAlias:r},m("applyTopicAlias :: auto assign topic: %s - alias: %d",n,r))):t.options.autoUseTopicAlias&&(r=t.topicAliasSend.getAliasByTopic(n),r&&(e.topic="",e.properties={...e.properties,topicAlias:r},m("applyTopicAlias :: auto use topic: %s - alias: %d",n,r))));else if(r)return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}}function A(t,e){let r;e.properties&&(r=e.properties.topicAlias);let n=e.topic.toString();if(0===n.length){if(void 0===r)return new Error("Unregistered Topic Alias");if(n=t.topicAliasSend.getTopicByAlias(r),void 0===n)return new Error("Unregistered Topic Alias");e.topic=n}r&&delete e.properties.topicAlias}function C(t,e,r){m("sendPacket :: packet: %O",e),m("sendPacket :: emitting `packetsend`"),t.emit("packetsend",e),m("sendPacket :: writing to stream");const n=h.writeToStream(e,t.stream,t.options);m("sendPacket :: writeToStream result %s",n),!n&&r&&r!==x?(m("sendPacket :: handle events on `drain` once through callback."),t.stream.once("drain",r)):r&&(m("sendPacket :: invoking cb"),r())}function k(t){t&&(m("flush: queue exists? %b",!!t),Object.keys(t).forEach((function(e){"function"==typeof t[e].cb&&(t[e].cb(new Error("Connection closed")),delete t[e])})))}function I(t){t&&(m("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach((function(e){t[e].volatile&&"function"==typeof t[e].cb&&(t[e].cb(new Error("Connection closed")),delete t[e])})))}function R(t,e,r,n){m("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let i,s=e;if("publish"===s.cmd&&(s=p(e),i=A(t,s),i))return r&&r(i);t.outgoingStore.put(s,(function(i){if(i)return r&&r(i);n(),C(t,e,r)}))}function x(t){m("nop ::",t)}function T(t,e){let r;const n=this;if(!(this instanceof T))return new T(t,e);for(r in this.options=e||{},w)void 0===this.options[r]?this.options[r]=w[r]:this.options[r]=e[r];m("MqttClient :: options.protocol",e.protocol),m("MqttClient :: options.protocolVersion",e.protocolVersion),m("MqttClient :: options.username",e.username),m("MqttClient :: options.keepalive",e.keepalive),m("MqttClient :: options.reconnectPeriod",e.reconnectPeriod),m("MqttClient :: options.rejectUnauthorized",e.rejectUnauthorized),m("MqttClient :: options.topicAliasMaximum",e.topicAliasMaximum),this.options.clientId="string"==typeof e.clientId?e.clientId:E(),m("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===e.protocolVersion&&e.customHandleAcks?e.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=t,this.messageIdProvider=void 0===this.options.messageIdProvider?new c:this.options.messageIdProvider,this.outgoingStore=e.outgoingStore||new s,this.incomingStore=e.incomingStore||new s,this.queueQoSZero=void 0===e.queueQoSZero||e.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,e.topicAliasMaximum>0&&(e.topicAliasMaximum>65535?m("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new o(e.topicAliasMaximum)),this.on("connect",(function(){const t=this.queue;function e(){const r=t.shift();m("deliver :: entry %o",r);let i=null;if(!r)return void n._resubscribe();i=r.packet,m("deliver :: call _sendPacket for %o",i);let s=!0;i.messageId&&0!==i.messageId&&(n.messageIdProvider.register(i.messageId)||(s=!1)),s?n._sendPacket(i,(function(t){r.cb&&r.cb(t),e()})):(m("messageId: %d has already used. The message is skipped and removed.",i.messageId),e())}m("connect :: sending queued packets"),e()})),this.on("close",(function(){m("close :: connected set to `false`"),this.connected=!1,m("close :: clearing connackTimer"),clearTimeout(this.connackTimer),m("close :: clearing ping timer"),null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),m("close :: calling _setupReconnect"),this._setupReconnect()})),i.call(this),m("MqttClient :: setting up stream"),this._setupStream()}u(T,i),T.prototype._setupStream=function(){const t=this,e=new l,r=h.parser(this.options);let n=null;const i=[];function s(){if(i.length)y(o);else{const t=n;n=null,t()}}function o(){m("work :: getting next packet in queue");const e=i.shift();if(e)m("work :: packet pulled from queue"),t._handlePacket(e,s);else{m("work :: no packets in queue");const t=n;n=null,m("work :: done flag is %s",!!t),t&&t()}}function a(e){m("streamErrorHandler :: error",e.message),_.includes(e.code)?(m("streamErrorHandler :: emitting error"),t.emit("error",e)):x(e)}m("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),m("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",(function(t){m("parser :: on packet push to packets array."),i.push(t)})),e._write=function(t,e,i){n=i,m("writable stream :: parsing buffer"),r.parse(t),o()},m("_setupStream :: pipe stream to writable stream"),this.stream.pipe(e),this.stream.on("error",a),this.stream.on("close",(function(){m("(%s)stream :: on close",t.options.clientId),I(t.outgoing),m("stream: emit close to MqttClient"),t.emit("close")})),m("_setupStream: sending packet `connect`");const c=Object.create(this.options);if(c.cmd="connect",this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),C(this,c),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return t.end((()=>this.emit("error",new Error("Packet has no Authentication Method")))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket&&C(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){m("!!connectTimeout hit!! Calling _cleanUp with force `true`"),t._cleanUp(!0)}),this.options.connectTimeout)},T.prototype._handlePacket=function(t,e){const r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<t.length)return this.emit("error",new Error("exceeding packets size "+t.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(m("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",t),t.cmd){case"publish":this._handlePublish(t,e);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(t),e();break;case"pubrel":this._handlePubrel(t,e);break;case"connack":this._handleConnack(t),e();break;case"auth":this._handleAuth(t),e();break;case"pingresp":this._handlePingresp(t),e();break;case"disconnect":this._handleDisconnect(t),e()}},T.prototype._checkDisconnecting=function(t){return this.disconnecting&&(t&&t!==x?t(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},T.prototype.publish=function(t,e,r,n){m("publish :: message `%s` to topic `%s`",e,t);const i=this.options;if("function"==typeof r&&(n=r,r=null),r=g({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;const s=this,o=function(){let o=0;if((1===r.qos||2===r.qos)&&(o=s._nextId(),null===o))return m("No messageId left"),!1;const a={cmd:"publish",topic:t,payload:e,qos:r.qos,retain:r.retain,messageId:o,dup:r.dup};switch(5===i.protocolVersion&&(a.properties=r.properties),m("publish :: qos",r.qos),r.qos){case 1:case 2:s.outgoing[a.messageId]={volatile:!1,cb:n||x},m("MqttClient:publish: packet cmd: %s",a.cmd),s._sendPacket(a,void 0,r.cbStorePut);break;default:m("MqttClient:publish: packet cmd: %s",a.cmd),s._sendPacket(a,n,r.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,cbStorePut:r.cbStorePut,callback:n}),this},T.prototype.subscribe=function(){const t=this,e=new Array(arguments.length);for(let u=0;u<arguments.length;u++)e[u]=arguments[u];const r=[];let n=e.shift();const i=n.resubscribe;let s=e.pop()||x,o=e.pop();const a=this.options.protocolVersion;delete n.resubscribe,"string"==typeof n&&(n=[n]),"function"!=typeof s&&(o=s,s=x);const h=d.validateTopics(n);if(null!==h)return b(s,new Error("Invalid topic "+h)),this;if(this._checkDisconnecting(s))return m("subscribe: discconecting true"),this;const c={qos:0};if(5===a&&(c.nl=!1,c.rap=!1,c.rh=0),o=g(c,o),Array.isArray(n)?n.forEach((function(e){if(m("subscribe: array topic %s",e),!Object.prototype.hasOwnProperty.call(t._resubscribeTopics,e)||t._resubscribeTopics[e].qos<o.qos||i){const t={topic:e,qos:o.qos};5===a&&(t.nl=o.nl,t.rap=o.rap,t.rh=o.rh,t.properties=o.properties),m("subscribe: pushing topic `%s` and qos `%s` to subs list",t.topic,t.qos),r.push(t)}})):Object.keys(n).forEach((function(e){if(m("subscribe: object topic %s",e),!Object.prototype.hasOwnProperty.call(t._resubscribeTopics,e)||t._resubscribeTopics[e].qos<n[e].qos||i){const t={topic:e,qos:n[e].qos};5===a&&(t.nl=n[e].nl,t.rap=n[e].rap,t.rh=n[e].rh,t.properties=o.properties),m("subscribe: pushing `%s` to subs list",t),r.push(t)}})),!r.length)return s(null,[]),this;const l=function(){const e=t._nextId();if(null===e)return m("No messageId left"),!1;const n={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:e};if(o.properties&&(n.properties=o.properties),t.options.resubscribe){m("subscribe :: resubscribe true");const e=[];r.forEach((function(r){if(t.options.reconnectPeriod>0){const n={qos:r.qos};5===a&&(n.nl=r.nl||!1,n.rap=r.rap||!1,n.rh=r.rh||0,n.properties=r.properties),t._resubscribeTopics[r.topic]=n,e.push(r.topic)}})),t.messageIdToTopic[n.messageId]=e}return t.outgoing[n.messageId]={volatile:!0,cb:function(t,e){if(!t){const t=e.granted;for(let e=0;e<t.length;e+=1)r[e].qos=t[e]}s(t,r)}},m("subscribe :: call _sendPacket"),t._sendPacket(n),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!l())&&this._storeProcessingQueue.push({invoke:l,callback:s}),this},T.prototype.unsubscribe=function(){const t=this,e=new Array(arguments.length);for(let a=0;a<arguments.length;a++)e[a]=arguments[a];let r=e.shift(),n=e.pop()||x,i=e.pop();"string"==typeof r&&(r=[r]),"function"!=typeof n&&(i=n,n=x);const s=d.validateTopics(r);if(null!==s)return b(n,new Error("Invalid topic "+s)),this;if(t._checkDisconnecting(n))return this;const o=function(){const e=t._nextId();if(null===e)return m("No messageId left"),!1;const s={cmd:"unsubscribe",qos:1,messageId:e};return"string"==typeof r?s.unsubscriptions=[r]:Array.isArray(r)&&(s.unsubscriptions=r),t.options.resubscribe&&s.unsubscriptions.forEach((function(e){delete t._resubscribeTopics[e]})),"object"==typeof i&&i.properties&&(s.properties=i.properties),t.outgoing[s.messageId]={volatile:!0,cb:n},m("unsubscribe: call _sendPacket"),t._sendPacket(s),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:n}),this},T.prototype.end=function(t,e,r){const n=this;function i(){m("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close((function(t){n.outgoingStore.close((function(e){if(m("end :: closeStores: emitting end"),n.emit("end"),r){const n=t||e;m("end :: closeStores: invoking callback with args"),r(n)}}))})),n._deferredReconnect&&n._deferredReconnect()}function s(){m("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,t),n._cleanUp(t,(()=>{m("end :: finish :: calling process.nextTick on closeStores"),y(i.bind(n))}),e)}return m("end :: (%s)",this.options.clientId),null!=t&&"boolean"==typeof t||(r=e||x,e=t,t=!1,"object"!=typeof e&&(r=e,e=null,"function"!=typeof r&&(r=x))),"object"!=typeof e&&(r=e,e=null),m("end :: cb? %s",!!r),r=r||x,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!t&&Object.keys(this.outgoing).length>0?(m("end :: (%s) :: calling finish in 10ms once outgoing is empty",n.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,s,10))):(m("end :: (%s) :: immediately calling finish",n.options.clientId),s()),this)},T.prototype.removeOutgoingMessage=function(t){const e=this.outgoing[t]?this.outgoing[t].cb:null;return delete this.outgoing[t],this.outgoingStore.del({messageId:t},(function(){e(new Error("Message removed"))})),this},T.prototype.reconnect=function(t){m("client reconnect");const e=this,r=function(){t?(e.options.incomingStore=t.incomingStore,e.options.outgoingStore=t.outgoingStore):(e.options.incomingStore=null,e.options.outgoingStore=null),e.incomingStore=e.options.incomingStore||new s,e.outgoingStore=e.options.outgoingStore||new s,e.disconnecting=!1,e.disconnected=!1,e._deferredReconnect=null,e._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},T.prototype._reconnect=function(){m("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((()=>{this._setupStream()})),m("client already connected. disconnecting first.")):(m("_reconnect: calling _setupStream"),this._setupStream())},T.prototype._setupReconnect=function(){const t=this;!t.disconnecting&&!t.reconnectTimer&&t.options.reconnectPeriod>0?(this.reconnecting||(m("_setupReconnect :: emit `offline` state"),this.emit("offline"),m("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),m("_setupReconnect :: setting reconnectTimer for %d ms",t.options.reconnectPeriod),t.reconnectTimer=setInterval((function(){m("reconnectTimer :: reconnect triggered!"),t._reconnect()}),t.options.reconnectPeriod)):m("_setupReconnect :: doing nothing...")},T.prototype._clearReconnect=function(){m("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},T.prototype._cleanUp=function(t,e){const r=arguments[2];if(e&&(m("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",e)),m("_cleanUp :: forced? %s",t),t)0===this.options.reconnectPeriod&&this.options.clean&&k(this.outgoing),m("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const t=g({cmd:"disconnect"},r);m("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(t,b.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(m("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(m("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),e&&!this.connected&&(m("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",e),e())},T.prototype._sendPacket=function(t,e,r){m("_sendPacket :: (%s) :: start",this.options.clientId),r=r||x,e=e||x;const n=S(this,t);if(n)e(n);else{if(!this.connected)return"auth"===t.cmd?(this._shiftPingInterval(),void C(this,t,e)):(m("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(t,e,r));switch(this._shiftPingInterval(),t.cmd){case"publish":break;case"pubrel":return void R(this,t,e,r);default:return void C(this,t,e)}switch(t.qos){case 2:case 1:R(this,t,e,r);break;default:C(this,t,e)}m("_sendPacket :: (%s) :: end",this.options.clientId)}},T.prototype._storePacket=function(t,e,r){m("_storePacket :: packet: %o",t),m("_storePacket :: cb? %s",!!e),r=r||x;let n=t;if("publish"===n.cmd){n=p(t);const r=A(this,n);if(r)return e&&e(r)}0===(n.qos||0)&&this.queueQoSZero||"publish"!==n.cmd?this.queue.push({packet:n,cb:e}):n.qos>0?(e=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,(function(t){if(t)return e&&e(t);r()}))):e&&e(new Error("No connection to broker"))},T.prototype._setupPingTimer=function(){m("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const t=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=f((function(){t._checkPing()}),1e3*this.options.keepalive))},T.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},T.prototype._checkPing=function(){m("_checkPing :: checking ping..."),this.pingResp?(m("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(m("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},T.prototype._handlePingresp=function(){this.pingResp=!0},T.prototype._handleConnack=function(t){m("_handleConnack");const e=this.options,r=5===e.protocolVersion?t.reasonCode:t.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,t.properties){if(t.properties.topicAliasMaximum){if(t.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));t.properties.topicAliasMaximum>0&&(this.topicAliasSend=new a(t.properties.topicAliasMaximum))}t.properties.serverKeepAlive&&e.keepalive&&(e.keepalive=t.properties.serverKeepAlive,this._shiftPingInterval()),t.properties.maximumPacketSize&&(e.properties||(e.properties={}),e.properties.maximumPacketSize=t.properties.maximumPacketSize)}if(0===r)this.reconnecting=!1,this._onConnect(t);else if(r>0){const t=new Error("Connection refused: "+v[r]);t.code=r,this.emit("error",t)}},T.prototype._handleAuth=function(t){const e=this.options.protocolVersion,r=5===e?t.reasonCode:t.returnCode;if(5!==e){const t=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+e);return t.code=r,void this.emit("error",t)}const n=this;this.handleAuth(t,(function(t,e){if(t)n.emit("error",t);else if(24===r)n.reconnecting=!1,n._sendPacket(e);else{const e=new Error("Connection refused: "+v[r]);t.code=r,n.emit("error",e)}}))},T.prototype.handleAuth=function(t,e){e()},T.prototype._handlePublish=function(t,e){m("_handlePublish: packet %o",t),e=void 0!==e?e:x;let r=t.topic.toString();const n=t.payload,i=t.qos,s=t.messageId,o=this,a=this.options,h=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let e;if(t.properties&&(e=t.properties.topicAlias),void 0!==e)if(0===r.length){if(!(e>0&&e<=65535))return m("_handlePublish :: topic alias out of range. alias: %d",e),void this.emit("error",new Error("Received Topic Alias is out of range"));{const t=this.topicAliasRecv.getTopicByAlias(e);if(!t)return m("_handlePublish :: unregistered topic alias. alias: %d",e),void this.emit("error",new Error("Received unregistered Topic Alias"));r=t,m("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",r,e)}}else{if(!this.topicAliasRecv.put(r,e))return m("_handlePublish :: topic alias out of range. alias: %d",e),void this.emit("error",new Error("Received Topic Alias is out of range"));m("_handlePublish :: registered topic: %s - alias: %d",r,e)}}switch(m("_handlePublish: qos %d",i),i){case 2:a.customHandleAcks(r,n,t,(function(r,n){return r instanceof Error||(n=r,r=null),r?o.emit("error",r):-1===h.indexOf(n)?o.emit("error",new Error("Wrong reason code for pubrec")):void(n?o._sendPacket({cmd:"pubrec",messageId:s,reasonCode:n},e):o.incomingStore.put(t,(function(){o._sendPacket({cmd:"pubrec",messageId:s},e)})))}));break;case 1:a.customHandleAcks(r,n,t,(function(i,a){return i instanceof Error||(a=i,i=null),i?o.emit("error",i):-1===h.indexOf(a)?o.emit("error",new Error("Wrong reason code for puback")):(a||o.emit("message",r,n,t),void o.handleMessage(t,(function(t){if(t)return e&&e(t);o._sendPacket({cmd:"puback",messageId:s,reasonCode:a},e)})))}));break;case 0:this.emit("message",r,n,t),this.handleMessage(t,e);break;default:m("_handlePublish: unknown QoS. Doing nothing.")}},T.prototype.handleMessage=function(t,e){e()},T.prototype._handleAck=function(t){const e=t.messageId,r=t.cmd;let n=null;const i=this.outgoing[e]?this.outgoing[e].cb:null,s=this;let o;if(i){switch(m("_handleAck :: packet type",r),r){case"pubcomp":case"puback":{const r=t.reasonCode;r&&r>0&&16!==r&&(o=new Error("Publish error: "+v[r]),o.code=r,i(o,t)),delete this.outgoing[e],this.outgoingStore.del(t,i),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue();break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:e};const r=t.reasonCode;r&&r>0&&16!==r?(o=new Error("Publish error: "+v[r]),o.code=r,i(o,t)):this._sendPacket(n);break}case"suback":delete this.outgoing[e],this.messageIdProvider.deallocate(e);for(let r=0;r<t.granted.length;r++)if(128&t.granted[r]){const t=this.messageIdToTopic[e];t&&t.forEach((function(t){delete s._resubscribeTopics[t]}))}this._invokeStoreProcessingQueue(),i(null,t);break;case"unsuback":delete this.outgoing[e],this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue(),i(null);break;default:s.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else m("_handleAck :: Server sent an ack in error. Ignoring.")},T.prototype._handlePubrel=function(t,e){m("handling pubrel packet"),e=void 0!==e?e:x;const r=t.messageId,n=this,i={cmd:"pubcomp",messageId:r};n.incomingStore.get(t,(function(t,r){t?n._sendPacket(i,e):(n.emit("message",r.topic,r.payload,r),n.handleMessage(r,(function(t){if(t)return e(t);n.incomingStore.del(r,x),n._sendPacket(i,e)})))}))},T.prototype._handleDisconnect=function(t){this.emit("disconnect",t)},T.prototype._nextId=function(){return this.messageIdProvider.allocate()},T.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},T.prototype._resubscribe=function(){m("_resubscribe");const t=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&t.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){m("_resubscribe: protocolVersion 5");for(let e=0;e<t.length;e++){const r={};r[t[e]]=this._resubscribeTopics[t[e]],r.resubscribe=!0,this.subscribe(r,{properties:r[t[e]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},T.prototype._onConnect=function(t){if(this.disconnected)return void this.emit("connect",t);const e=this;function r(){let n=e.outgoingStore.createStream();function i(){e._storeProcessing=!1,e._packetIdsDuringStoreProcessing={}}function s(){n.destroy(),n=null,e._flushStoreProcessingQueue(),i()}function o(){if(!n)return;e._storeProcessing=!0;const t=n.read(1);let r;t?e._packetIdsDuringStoreProcessing[t.messageId]?o():e.disconnecting||e.reconnectTimer?n.destroy&&n.destroy():(r=e.outgoing[t.messageId]?e.outgoing[t.messageId].cb:null,e.outgoing[t.messageId]={volatile:!1,cb:function(t,e){r&&r(t,e),o()}},e._packetIdsDuringStoreProcessing[t.messageId]=!0,e.messageIdProvider.register(t.messageId)?e._sendPacket(t):m("messageId: %d has already used.",t.messageId)):n.once("readable",o)}e.once("close",s),n.on("error",(function(t){i(),e._flushStoreProcessingQueue(),e.removeListener("close",s),e.emit("error",t)})),n.on("end",(function(){let n=!0;for(const t in e._packetIdsDuringStoreProcessing)if(!e._packetIdsDuringStoreProcessing[t]){n=!1;break}n?(i(),e.removeListener("close",s),e._invokeAllStoreProcessingQueue(),e.emit("connect",t)):r()})),o()}this.connackPacket=t,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,r()},T.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const t=this._storeProcessingQueue[0];if(t&&t.invoke())return this._storeProcessingQueue.shift(),!0}return!1},T.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},T.prototype._flushStoreProcessingQueue=function(){for(const t of this._storeProcessingQueue)t.cbStorePut&&t.cbStorePut(new Error("Connection closed")),t.callback&&t.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},e.exports=T}).call(this)}).call(this,t("_process"),void 0!==$?$:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-message-id-provider":12,"./store":13,"./topic-alias-recv":14,"./topic-alias-send":15,"./validations":16,_process:85,debug:20,events:4,inherits:24,"mqtt-packet":48,"readable-stream":72,reinterval:73,"rfdc/default":74,xtend:82}],7:[function(t,e,r){const{Buffer:n}=t("buffer"),i=t("readable-stream").Transform,s=t("duplexify");let o,a,h,c=!1;function l(){const t=new i;return t._write=function(t,e,r){o.sendSocketMessage({data:t.buffer,success:function(){r()},fail:function(){r(new Error)}})},t._flush=function(t){o.closeSocket({success:function(){t()}})},t}function u(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function f(t,e){const r="alis"===t.protocol?"wss":"ws";let n=r+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(n=r+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(n=t.transformWsUrl(n,t,e)),n}function p(){c||(c=!0,o.onSocketOpen((function(){h.setReadable(a),h.setWritable(a),h.emit("connect")})),o.onSocketMessage((function(t){if("string"==typeof t.data){const e=n.from(t.data,"base64");a.push(e)}else{const e=new FileReader;e.addEventListener("load",(function(){let t=e.result;t=t instanceof ArrayBuffer?n.from(t):n.from(t,"utf8"),a.push(t)})),e.readAsArrayBuffer(t.data)}})),o.onSocketClose((function(){h.end(),h.destroy()})),o.onSocketError((function(t){h.destroy(t)})))}function d(t,e){if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";u(e);const n=f(e,t);return o=e.my,o.connectSocket({url:n,protocols:r}),a=l(),h=s.obj(),p(),h}e.exports=d},{buffer:3,duplexify:22,"readable-stream":72}],8:[function(t,e,r){const n=t("net"),i=t("debug")("mqttjs:tcp");function s(t,e){e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost";const r=e.port,s=e.hostname;return i("port %d and host %s",r,s),n.createConnection(r,s)}e.exports=s},{debug:20,net:2}],9:[function(t,e,r){const n=t("tls"),i=t("net"),s=t("debug")("mqttjs:tls");function o(t,e){e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",0===i.isIP(e.host)&&(e.servername=e.host),e.rejectUnauthorized=!1!==e.rejectUnauthorized,delete e.path,s("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);const r=n.connect(e);function o(n){e.rejectUnauthorized&&t.emit("error",n),r.end()}return r.on("secureConnect",(function(){e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",o)})),r.on("error",o),r}e.exports=o},{debug:20,net:2,tls:2}],10:[function(t,e,r){(function(r){(function(){const{Buffer:n}=t("buffer"),i=t("ws"),s=t("debug")("mqttjs:ws"),o=t("duplexify"),a=t("readable-stream").Transform,h=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],c=void 0!==r&&"browser"===r.title||"function"==typeof __webpack_require__;function l(t,e){let r=t.protocol+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(r=t.transformWsUrl(r,t,e)),r}function u(t){const e=t;return t.hostname||(e.hostname="localhost"),t.port||("wss"===t.protocol?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),c||"wss"!==t.protocol||h.forEach((function(r){Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])})),e}function f(t){const e=u(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const t=new URL(document.URL);e.hostname=t.hostname,e.port||(e.port=t.port)}return void 0===e.objectMode&&(e.objectMode=!(!0===e.binary||void 0===e.binary)),e}function p(t,e,r){s("createWebSocket"),s("protocol: "+r.protocolId+" "+r.protocolVersion);const n="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return s("creating new Websocket for url: "+e+" and protocol: "+n),new i(e,[n],r.wsOptions)}function d(t,e){const r="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt",n=l(e,t),i=new WebSocket(n,[r]);return i.binaryType="arraybuffer",i}function g(t,e){s("streamBuilder");const r=u(e),n=l(r,t),o=p(t,n,r),a=i.createWebSocketStream(o,r.wsOptions);return a.url=n,o.on("close",(()=>{a.destroy()})),a}function m(t,e){let r;s("browserStreamBuilder");const i=f(e).browserBufferSize||524288,h=e.browserBufferTimeout||1e3,c=!e.objectMode,l=d(t,e),u=g(e,v,E);e.objectMode||(u._writev=_),u.on("close",(()=>{l.close()}));const p=void 0!==l.addEventListener;function g(t,e,r){const n=new a({objectModeMode:t.objectMode});return n._write=e,n._flush=r,n}function m(){r.setReadable(u),r.setWritable(u),r.emit("connect")}function y(){r.end(),r.destroy()}function b(t){r.destroy(t)}function w(t){let e=t.data;e=e instanceof ArrayBuffer?n.from(e):n.from(e,"utf8"),u.push(e)}function _(t,e){const r=new Array(t.length);for(let i=0;i<t.length;i++)"string"==typeof t[i].chunk?r[i]=n.from(t[i],"utf8"):r[i]=t[i].chunk;this._write(n.concat(r),"binary",e)}function v(t,e,r){l.bufferedAmount>i&&setTimeout(v,h,t,e,r),c&&"string"==typeof t&&(t=n.from(t,"utf8"));try{l.send(t)}catch(s){return r(s)}r()}function E(t){l.close(),t()}return l.readyState===l.OPEN?r=u:(r=r=o(void 0,void 0,e),e.objectMode||(r._writev=_),p?l.addEventListener("open",m):l.onopen=m),r.socket=l,p?(l.addEventListener("close",y),l.addEventListener("error",b),l.addEventListener("message",w)):(l.onclose=y,l.onerror=b,l.onmessage=w),r}e.exports=c?m:g}).call(this)}).call(this,t("_process"))},{_process:85,buffer:3,debug:20,duplexify:22,"readable-stream":72,ws:81}],11:[function(t,e,r){const{Buffer:n}=t("buffer"),i=t("readable-stream").Transform,s=t("duplexify");let o,a,h;function c(){const t=new i;return t._write=function(t,e,r){o.send({data:t.buffer,success:function(){r()},fail:function(t){r(new Error(t))}})},t._flush=function(t){o.close({success:function(){t()}})},t}function l(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function u(t,e){const r="wxs"===t.protocol?"wss":"ws";let n=r+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(n=r+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(n=t.transformWsUrl(n,t,e)),n}function f(){o.onOpen((function(){h.setReadable(a),h.setWritable(a),h.emit("connect")})),o.onMessage((function(t){let e=t.data;e=e instanceof ArrayBuffer?n.from(e):n.from(e,"utf8"),a.push(e)})),o.onClose((function(){h.end(),h.destroy()})),o.onError((function(t){h.destroy(new Error(t.errMsg))}))}function p(t,e){if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===e.protocolId&&3===e.protocolVersion?"mqttv3.1":"mqtt";l(e);const n=u(e,t);o=wx.connectSocket({url:n,protocols:[r]}),a=c(),h=s.obj(),h._destroy=function(t,e){o.close({success:function(){e&&e(t)}})};const i=h.destroy;return h.destroy=function(){h.destroy=i;const t=this;setTimeout((function(){o.close({fail:function(){t._destroy(new Error)}})}),0)}.bind(h),f(),h}e.exports=p},{buffer:3,duplexify:22,"readable-stream":72}],12:[function(t,e,r){function n(){if(!(this instanceof n))return new n;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}n.prototype.allocate=function(){const t=this.nextId++;return 65536===this.nextId&&(this.nextId=1),t},n.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},n.prototype.register=function(t){return!0},n.prototype.deallocate=function(t){},n.prototype.clear=function(){},e.exports=n},{}],13:[function(t,e,r){const n=t("xtend"),i=t("readable-stream").Readable,s={objectMode:!0},o={clean:!0};function a(t){if(!(this instanceof a))return new a(t);this.options=t||{},this.options=n(o,t),this._inflights=new Map}a.prototype.put=function(t,e){return this._inflights.set(t.messageId,t),e&&e(),this},a.prototype.createStream=function(){const t=new i(s),e=[];let r=!1,n=0;return this._inflights.forEach((function(t,r){e.push(t)})),t._read=function(){!r&&n<e.length?this.push(e[n++]):this.push(null)},t.destroy=function(){if(r)return;const t=this;r=!0,setTimeout((function(){t.emit("close")}),0)},t},a.prototype.del=function(t,e){return(t=this._inflights.get(t.messageId))?(this._inflights.delete(t.messageId),e(null,t)):e&&e(new Error("missing packet")),this},a.prototype.get=function(t,e){return(t=this._inflights.get(t.messageId))?e(null,t):e&&e(new Error("missing packet")),this},a.prototype.close=function(t){this.options.clean&&(this._inflights=null),t&&t()},e.exports=a},{"readable-stream":72,xtend:82}],14:[function(t,e,r){function n(t){if(!(this instanceof n))return new n(t);this.aliasToTopic={},this.max=t}n.prototype.put=function(t,e){return!(0===e||e>this.max||(this.aliasToTopic[e]=t,this.length=Object.keys(this.aliasToTopic).length,0))},n.prototype.getTopicByAlias=function(t){return this.aliasToTopic[t]},n.prototype.clear=function(){this.aliasToTopic={}},e.exports=n},{}],15:[function(t,e,r){const n=t("lru-cache"),i=t("number-allocator").NumberAllocator;function s(t){if(!(this instanceof s))return new s(t);t>0&&(this.aliasToTopic=new n({max:t}),this.topicToAlias={},this.numberAllocator=new i(1,t),this.max=t,this.length=0)}s.prototype.put=function(t,e){if(0===e||e>this.max)return!1;const r=this.aliasToTopic.get(e);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(e,t),this.topicToAlias[t]=e,this.numberAllocator.use(e),this.length=this.aliasToTopic.length,!0},s.prototype.getTopicByAlias=function(t){return this.aliasToTopic.get(t)},s.prototype.getAliasByTopic=function(t){const e=this.topicToAlias[t];return void 0!==e&&this.aliasToTopic.get(e),e},s.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},s.prototype.getLruAlias=function(){const t=this.numberAllocator.firstVacant();return t||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},e.exports=s},{"lru-cache":45,"number-allocator":54}],16:[function(t,e,r){function n(t){const e=t.split("/");for(let r=0;r<e.length;r++)if("+"!==e[r]){if("#"===e[r])return r===e.length-1;if(-1!==e[r].indexOf("+")||-1!==e[r].indexOf("#"))return!1}return!0}function i(t){if(0===t.length)return"empty_topic_list";for(let e=0;e<t.length;e++)if(!n(t[e]))return t[e];return null}e.exports={validateTopics:i}},{}],17:[function(t,e,r){(function(r){(function(){const n=t("../client"),i=t("../store"),s=t("url"),o=t("xtend"),a=t("debug")("mqttjs"),h={};function c(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function l(t,e){if(a("connecting to an MQTT broker..."),"object"!=typeof t||e||(e=t,t=null),e=e||{},t){const r=s.parse(t,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(e=o(r,e)).protocol)throw new Error("Missing protocol");e.protocol=e.protocol.replace(/:$/,"")}if(c(e),e.query&&"string"==typeof e.query.clientId&&(e.clientId=e.query.clientId),e.cert&&e.key){if(!e.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(e.protocol))switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+e.protocol+'"!')}}if(!h[e.protocol]){const t=-1!==["mqtts","wss"].indexOf(e.protocol);e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(e,r){return(!t||r%2!=0)&&"function"==typeof h[e]}))[0]}if(!1===e.clean&&!e.clientId)throw new Error("Missing clientId for unclean clients");function r(t){return e.servers&&(t._reconnectCount&&t._reconnectCount!==e.servers.length||(t._reconnectCount=0),e.host=e.servers[t._reconnectCount].host,e.port=e.servers[t._reconnectCount].port,e.protocol=e.servers[t._reconnectCount].protocol?e.servers[t._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,t._reconnectCount++),a("calling streambuilder for",e.protocol),h[e.protocol](t,e)}e.protocol&&(e.defaultProtocol=e.protocol);const i=new n(r,e);return i.on("error",(function(){})),i}void 0!==r&&"browser"!==r.title||"function"!=typeof __webpack_require__?(h.mqtt=t("./tcp"),h.tcp=t("./tcp"),h.ssl=t("./tls"),h.tls=t("./tls"),h.mqtts=t("./tls")):(h.wx=t("./wx"),h.wxs=t("./wx"),h.ali=t("./ali"),h.alis=t("./ali")),h.ws=t("./ws"),h.wss=t("./ws"),e.exports=l,e.exports.connect=l,e.exports.MqttClient=n,e.exports.Store=i}).call(this)}).call(this,t("_process"))},{"../client":6,"../store":13,"./ali":7,"./tcp":8,"./tls":9,"./ws":10,"./wx":11,_process:85,debug:20,url:90,xtend:82}],18:[function(t,e,r){const{Buffer:n}=t("buffer"),i=Symbol.for("BufferList");function s(t){if(!(this instanceof s))return new s(t);s._init.call(this,t)}s._init=function(t){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},s.prototype._new=function(t){return new s(t)},s.prototype._offset=function(t){if(0===t)return[0,0];let e=0;for(let r=0;r<this._bufs.length;r++){const n=e+this._bufs[r].length;if(t<n||r===this._bufs.length-1)return[r,t-e];e=n}},s.prototype._reverseOffset=function(t){const e=t[0];let r=t[1];for(let n=0;n<e;n++)r+=this._bufs[n].length;return r},s.prototype.get=function(t){if(t>this.length||t<0)return;const e=this._offset(t);return this._bufs[e[0]][e[1]]},s.prototype.slice=function(t,e){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof e&&e<0&&(e+=this.length),this.copy(null,0,t,e)},s.prototype.copy=function(t,e,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return t||n.alloc(0);if(i<=0)return t||n.alloc(0);const s=!!t,o=this._offset(r),a=i-r;let h=a,c=s&&e||0,l=o[1];if(0===r&&i===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let e=0;e<this._bufs.length;e++)this._bufs[e].copy(t,c),c+=this._bufs[e].length;return t}if(h<=this._bufs[o[0]].length-l)return s?this._bufs[o[0]].copy(t,e,l,l+h):this._bufs[o[0]].slice(l,l+h);s||(t=n.allocUnsafe(a));for(let n=o[0];n<this._bufs.length;n++){const e=this._bufs[n].length-l;if(!(h>e)){this._bufs[n].copy(t,c,l,l+h),c+=e;break}this._bufs[n].copy(t,c,l),c+=e,h-=e,l&&(l=0)}return t.length>c?t.slice(0,c):t},s.prototype.shallowSlice=function(t,e){if(t=t||0,e="number"!=typeof e?this.length:e,t<0&&(t+=this.length),e<0&&(e+=this.length),t===e)return this._new();const r=this._offset(t),n=this._offset(e),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},s.prototype.toString=function(t,e,r){return this.slice(e,r).toString(t)},s.prototype.consume=function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const t=this._new();for(let e=0;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},s.prototype.append=function(t){if(null==t)return this;if(t.buffer)this._appendBuffer(n.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let e=0;e<t.length;e++)this.append(t[e]);else if(this._isBufferList(t))for(let e=0;e<t._bufs.length;e++)this.append(t._bufs[e]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(n.from(t));return this},s.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length},s.prototype.indexOf=function(t,e,r){if(void 0===r&&"string"==typeof e&&(r=e,e=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=n.from([t]):"string"==typeof t?t=n.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=n.from(t.buffer,t.byteOffset,t.byteLength):n.isBuffer(t)||(t=n.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),0===t.length)return e>this.length?this.length:e;const i=this._offset(e);let s=i[0],o=i[1];for(;s<this._bufs.length;s++){const e=this._bufs[s];for(;o<e.length;)if(e.length-o>=t.length){const r=e.indexOf(t,o);if(-1!==r)return this._reverseOffset([s,r]);o=e.length-t.length+1}else{const e=this._reverseOffset([s,o]);if(this._match(e,t))return e;o++}o=0}return-1},s.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0},function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const e in t)!function(e){null===t[e]?s.prototype[e]=function(t,r){return this.slice(t,t+r)[e](0,r)}:s.prototype[e]=function(r=0){return this.slice(r,r+t[e])[e](0)}}(e)}(),s.prototype._isBufferList=function(t){return t instanceof s||s.isBufferList(t)},s.isBufferList=function(t){return null!=t&&t[i]},e.exports=s},{buffer:3}],19:[function(t,e,r){const n=t("readable-stream").Duplex,i=t("inherits"),s=t("./BufferList");function o(t){if(!(this instanceof o))return new o(t);if("function"==typeof t){this._callback=t;const e=function(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",(function(t){t.on("error",e)})),this.on("unpipe",(function(t){t.removeListener("error",e)})),t=null}s._init.call(this,t),n.call(this)}i(o,n),Object.assign(o.prototype,s.prototype),o.prototype._new=function(t){return new o(t)},o.prototype._write=function(t,e,r){this._appendBuffer(t),"function"==typeof r&&r()},o.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},o.prototype.end=function(t){n.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(t,e){this._bufs.length=0,this.length=0,e(t)},o.prototype._isBufferList=function(t){return t instanceof o||t instanceof s||o.isBufferList(t)},o.isBufferList=s.isBufferList,e.exports=o,e.exports.BufferListStream=o,e.exports.BufferList=s},{"./BufferList":18,inherits:24,"readable-stream":72}],20:[function(t,e,r){(function(n){(function(){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(n++,"%c"===t&&(i=n))})),t.splice(i,0,r)}function o(t){try{t?r.storage.setItem("debug",t):r.storage.removeItem("debug")}catch(e){}}function a(){let t;try{t=r.storage.getItem("debug")}catch(e){}return!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG),t}function h(){try{return localStorage}catch(t){}}r.formatArgs=s,r.save=o,r.load=a,r.useColors=i,r.storage=h(),r.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),e.exports=t("./common")(r);const{formatters:c}=e.exports;c.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,t("_process"))},{"./common":21,_process:85}],21:[function(t,e,r){function n(e){function r(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return n.colors[Math.abs(e)%n.colors.length]}function n(t){let e,r,s,o=null;function a(...t){if(!a.enabled)return;const r=a,i=Number(new Date),s=i-(e||i);r.diff=s,r.prev=e,r.curr=i,e=i,t[0]=n.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((e,i)=>{if("%%"===e)return"%";o++;const s=n.formatters[i];if("function"==typeof s){const n=t[o];e=s.call(r,n),t.splice(o,1),o--}return e})),n.formatArgs.call(r,t),(r.log||n.log).apply(r,t)}return a.namespace=t,a.useColors=n.useColors(),a.color=n.selectColor(t),a.extend=i,a.destroy=n.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==n.namespaces&&(r=n.namespaces,s=n.enabled(t)),s),set:t=>{o=t}}),"function"==typeof n.init&&n.init(a),a}function i(t,e){const r=n(this.namespace+(void 0===e?":":e)+t);return r.log=this.log,r}function s(t){let e;n.save(t),n.namespaces=t,n.names=[],n.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),i=r.length;for(e=0;e<i;e++)r[e]&&("-"===(t=r[e].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+t.slice(1)+"$")):n.names.push(new RegExp("^"+t+"$")))}function o(){const t=[...n.names.map(h),...n.skips.map(h).map((t=>"-"+t))].join(",");return n.enable(""),t}function a(t){if("*"===t[t.length-1])return!0;let e,r;for(e=0,r=n.skips.length;e<r;e++)if(n.skips[e].test(t))return!1;for(e=0,r=n.names.length;e<r;e++)if(n.names[e].test(t))return!0;return!1}function h(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}function c(t){return t instanceof Error?t.stack||t.message:t}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=s,n.enabled=a,n.humanize=t("ms"),n.destroy=l,Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=r,n.enable(n.load()),n}e.exports=n},{ms:53}],22:[function(t,e,r){(function(r,n){(function(){var i=t("readable-stream"),s=t("end-of-stream"),o=t("inherits"),a=t("stream-shift"),h=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),c=function(t,e){t._corked?t.once("uncork",e):e()},l=function(t,e){t._autoDestroy&&t.destroy(e)},u=function(t,e){return function(r){r?l(t,"premature close"===r.message?null:r):e&&!t._ended&&t.end()}},f=function(t,e){return t?t._writableState&&t._writableState.finished?e():t._writableState?t.end(e):(t.end(),void e()):e()},p=function(){},d=function(t){return new i.Readable({objectMode:!0,highWaterMark:16}).wrap(t)},g=function(t,e,r){if(!(this instanceof g))return new g(t,e,r);i.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),e&&this.setReadable(e)};o(g,i.Duplex),g.obj=function(t,e,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new g(t,e,r)},g.prototype.cork=function(){1==++this._corked&&this.emit("cork")},g.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},g.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var e=this,n=s(t,{writable:!0,readable:!1},u(this,this._forwardEnd)),i=function(){var t=e._ondrain;e._ondrain=null,t&&t()},o=function(){e._writable.removeListener("drain",i),n()};this._unwrite&&r.nextTick(i),this._writable=t,this._writable.on("drain",i),this._unwrite=o,this.uncork()}else this.end()},g.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var e=this,r=s(t,{writable:!1,readable:!0},u(this)),n=function(){e._forward()},i=function(){e.push(null)},o=function(){e._readable2.removeListener("readable",n),e._readable2.removeListener("end",i),r()};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:d(t),this._readable2.on("readable",n),this._readable2.on("end",i),this._unread=o,this._forward()}},g.prototype._read=function(){this._drained=!0,this._forward()},g.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=a(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},g.prototype.destroy=function(t,e){if(e||(e=p),this.destroyed)return e(null);this.destroyed=!0;var n=this;r.nextTick((function(){n._destroy(t),e(null)}))},g.prototype._destroy=function(t){if(t){var e=this._ondrain;this._ondrain=null,e?e(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},g.prototype._write=function(t,e,r){if(!this.destroyed)return this._corked?c(this,this._write.bind(this,t,e,r)):t===h?this._finish(r):this._writable?void(!1===this._writable.write(t)?this._ondrain=r:this.destroyed||r()):r()},g.prototype._finish=function(t){var e=this;this.emit("preend"),c(this,(function(){f(e._forwardEnd&&e._writable,(function(){!1===e._writableState.prefinished&&(e._writableState.prefinished=!0),e.emit("prefinish"),c(e,t)}))}))},g.prototype.end=function(t,e,r){return"function"==typeof t?this.end(null,null,t):"function"==typeof e?this.end(t,null,e):(this._ended=!0,t&&this.write(t),this._writableState.ending||this._writableState.destroyed||this.write(h),i.Writable.prototype.end.call(this,r))},e.exports=g}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:85,buffer:3,"end-of-stream":23,inherits:24,"readable-stream":72,"stream-shift":77}],23:[function(t,e,r){(function(r){(function(){var n=t("once"),i=function(){},s=function(t){return t.setHeader&&"function"==typeof t.abort},o=function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length},a=function(t,e,h){if("function"==typeof e)return a(t,null,e);e||(e={}),h=n(h||i);var c=t._writableState,l=t._readableState,u=e.readable||!1!==e.readable&&t.readable,f=e.writable||!1!==e.writable&&t.writable,p=!1,d=function(){t.writable||g()},g=function(){f=!1,u||h.call(t)},m=function(){u=!1,f||h.call(t)},y=function(e){h.call(t,e?new Error("exited with error code: "+e):null)},b=function(e){h.call(t,e)},w=function(){r.nextTick(_)},_=function(){if(!p)return(!u||l&&l.ended&&!l.destroyed)&&(!f||c&&c.ended&&!c.destroyed)?void 0:h.call(t,new Error("premature close"))},v=function(){t.req.on("finish",g)};return s(t)?(t.on("complete",g),t.on("abort",w),t.req?v():t.on("request",v)):f&&!c&&(t.on("end",d),t.on("close",d)),o(t)&&t.on("exit",y),t.on("end",m),t.on("finish",g),!1!==e.error&&t.on("error",b),t.on("close",w),function(){p=!0,t.removeListener("complete",g),t.removeListener("abort",w),t.removeListener("request",v),t.req&&t.req.removeListener("finish",g),t.removeListener("end",d),t.removeListener("close",d),t.removeListener("finish",g),t.removeListener("exit",y),t.removeListener("end",m),t.removeListener("error",b),t.removeListener("close",w)}};e.exports=a}).call(this)}).call(this,t("_process"))},{_process:85,once:56}],24:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],25:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.ContainerIterator=r.Container=r.Base=void 0;class n{constructor(t=0){this.iteratorType=t}equals(t){return this.o===t.o}}r.ContainerIterator=n;class i{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return 0===this.i}}r.Base=i;class s extends i{}r.Container=s},{}],26:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.HashContainerIterator=r.HashContainer=void 0;var n=t("../../ContainerBase"),i=o(t("../../../utils/checkObject")),s=t("../../../utils/throwError");function o(t){return t&&t.t?t:{default:t}}class a extends n.ContainerIterator{constructor(t,e,r){super(r),this.o=t,this.h=e,0===this.iteratorType?(this.pre=function(){return this.o.L===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this})}}r.HashContainerIterator=a;class h extends n.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(t){const{L:e,B:r}=t;e.B=r,r.L=e,t===this.p&&(this.p=r),t===this._&&(this._=e),this.i-=1}M(t,e,r){let n;if(void 0===r&&(r=(0,i.default)(t)),r){const r=t[this.HASH_TAG];if(void 0!==r)return this.H[r].l=e,this.i;Object.defineProperty(t,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:t,l:e,L:this._,B:this.h},this.H.push(n)}else{const r=this.g[t];if(r)return r.l=e,this.i;n={u:t,l:e,L:this._,B:this.h},this.g[t]=n}return 0===this.i?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(t,e){if(void 0===e&&(e=(0,i.default)(t)),e){const e=t[this.HASH_TAG];return void 0===e?this.h:this.H[e]}return this.g[t]||this.h}clear(){const t=this.HASH_TAG;this.H.forEach((function(e){delete e.u[t]})),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(t,e){let r;if(void 0===e&&(e=(0,i.default)(t)),e){const e=t[this.HASH_TAG];if(void 0===e)return!1;delete t[this.HASH_TAG],r=this.H[e],delete this.H[e]}else{if(r=this.g[t],void 0===r)return!1;delete this.g[t]}return this.V(r),!0}eraseElementByIterator(t){const e=t.o;return e===this.h&&(0,s.throwIteratorAccessError)(),this.V(e),t.next()}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let e=this.p;for(;t--;)e=e.B;return this.V(e),this.i}}r.HashContainer=h},{"../../../utils/checkObject":43,"../../../utils/throwError":44,"../../ContainerBase":25}],27:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("./Base"),i=o(t("../../utils/checkObject")),s=t("../../utils/throwError");function o(t){return t&&t.t?t:{default:t}}class a extends n.HashContainerIterator{constructor(t,e,r,n){super(t,e,n),this.container=r}get pointer(){this.o===this.h&&(0,s.throwIteratorAccessError)();const t=this;return new Proxy([],{get:(e,r)=>"0"===r?t.o.u:"1"===r?t.o.l:void 0,set(e,r,n){if("1"!==r)throw new TypeError("props must be 1");return t.o.l=n,!0}})}copy(){return new a(this.o,this.h,this.container,this.iteratorType)}}class h extends n.HashContainer{constructor(t=[]){super();const e=this;t.forEach((function(t){e.setElement(t[0],t[1])}))}begin(){return new a(this.p,this.h,this)}end(){return new a(this.h,this.h,this)}rBegin(){return new a(this._,this.h,this,1)}rEnd(){return new a(this.h,this.h,this,1)}front(){if(0!==this.i)return[this.p.u,this.p.l]}back(){if(0!==this.i)return[this._.u,this._.l]}setElement(t,e,r){return this.M(t,e,r)}getElementByKey(t,e){if(void 0===e&&(e=(0,i.default)(t)),e){const e=t[this.HASH_TAG];return void 0!==e?this.H[e].l:void 0}const r=this.g[t];return r?r.l:void 0}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let e=this.p;for(;t--;)e=e.B;return[e.u,e.l]}find(t,e){const r=this.I(t,e);return new a(r,this.h,this)}forEach(t){let e=0,r=this.p;for(;r!==this.h;)t([r.u,r.l],e++,this),r=r.B}[Symbol.iterator](){return function*(){let t=this.p;for(;t!==this.h;)yield[t.u,t.l],t=t.B}.bind(this)()}}var c=h;r.default=c},{"../../utils/checkObject":43,"../../utils/throwError":44,"./Base":26}],28:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("./Base"),i=t("../../utils/throwError");class s extends n.HashContainerIterator{constructor(t,e,r,n){super(t,e,n),this.container=r}get pointer(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o.u}copy(){return new s(this.o,this.h,this.container,this.iteratorType)}}class o extends n.HashContainer{constructor(t=[]){super();const e=this;t.forEach((function(t){e.insert(t)}))}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(t,e){return this.M(t,void 0,e)}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let e=this.p;for(;t--;)e=e.B;return e.u}find(t,e){const r=this.I(t,e);return new s(r,this.h,this)}forEach(t){let e=0,r=this.p;for(;r!==this.h;)t(r.u,e++,this),r=r.B}[Symbol.iterator](){return function*(){let t=this.p;for(;t!==this.h;)yield t.u,t=t.B}.bind(this)()}}var a=o;r.default=a},{"../../utils/throwError":44,"./Base":26}],29:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("../ContainerBase");class i extends n.Base{constructor(t=[],e=function(t,e){return t>e?-1:t<e?1:0},r=!0){if(super(),this.v=e,Array.isArray(t))this.C=r?[...t]:t;else{this.C=[];const e=this;t.forEach((function(t){e.C.push(t)}))}this.i=this.C.length;const n=this.i>>1;for(let i=this.i-1>>1;i>=0;--i)this.k(i,n)}m(t){const e=this.C[t];for(;t>0;){const r=t-1>>1,n=this.C[r];if(this.v(n,e)<=0)break;this.C[t]=n,t=r}this.C[t]=e}k(t,e){const r=this.C[t];for(;t<e;){let e=t<<1|1;const n=e+1;let i=this.C[e];if(n<this.i&&this.v(i,this.C[n])>0&&(e=n,i=this.C[n]),this.v(i,r)>=0)break;this.C[t]=i,t=e}this.C[t]=r}clear(){this.i=0,this.C.length=0}push(t){this.C.push(t),this.m(this.i),this.i+=1}pop(){if(0===this.i)return;const t=this.C[0],e=this.C.pop();return this.i-=1,this.i&&(this.C[0]=e,this.k(0,this.i>>1)),t}top(){return this.C[0]}find(t){return this.C.indexOf(t)>=0}remove(t){const e=this.C.indexOf(t);return!(e<0||(0===e?this.pop():e===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(e,1,this.C.pop()),this.i-=1,this.m(e),this.k(e,this.i>>1)),0))}updateItem(t){const e=this.C.indexOf(t);return!(e<0||(this.m(e),this.k(e,this.i>>1),0))}toArray(){return[...this.C]}}var s=i;r.default=s},{"../ContainerBase":25}],30:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("../ContainerBase");class i extends n.Base{constructor(t=[]){super(),this.j=0,this.q=[];const e=this;t.forEach((function(t){e.push(t)}))}clear(){this.q=[],this.i=this.j=0}push(t){const e=this.q.length;if(this.j/e>.5&&this.j+this.i>=e&&e>4096){const e=this.i;for(let t=0;t<e;++t)this.q[t]=this.q[this.j+t];this.j=0,this.q[this.i]=t}else this.q[this.j+this.i]=t;return++this.i}pop(){if(0===this.i)return;const t=this.q[this.j++];return this.i-=1,t}front(){if(0!==this.i)return this.q[this.j]}}var s=i;r.default=s},{"../ContainerBase":25}],31:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("../ContainerBase");class i extends n.Base{constructor(t=[]){super(),this.S=[];const e=this;t.forEach((function(t){e.push(t)}))}clear(){this.i=0,this.S=[]}push(t){return this.S.push(t),this.i+=1,this.i}pop(){if(0!==this.i)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}}var s=i;r.default=s},{"../ContainerBase":25}],32:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.RandomIterator=void 0;var n=t("../../ContainerBase"),i=t("../../../utils/throwError");class s extends n.ContainerIterator{constructor(t,e){super(e),this.o=t,0===this.iteratorType?(this.pre=function(){return 0===this.o&&(0,i.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,i.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,i.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return-1===this.o&&(0,i.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(t){this.container.setElementByPos(this.o,t)}}r.RandomIterator=s},{"../../../utils/throwError":44,"../../ContainerBase":25}],33:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("../../ContainerBase");class i extends n.Container{}var s=i;r.default=s},{"../../ContainerBase":25}],34:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=s(t("./Base")),i=t("./Base/RandomIterator");function s(t){return t&&t.t?t:{default:t}}class o extends i.RandomIterator{constructor(t,e,r){super(t,r),this.container=e}copy(){return new o(this.o,this.container,this.iteratorType)}}class a extends n.default{constructor(t=[],e=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];const r=(()=>{if("number"==typeof t.length)return t.length;if("number"==typeof t.size)return t.size;if("function"==typeof t.size)return t.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=e,this.P=Math.max(Math.ceil(r/this.F),1);for(let s=0;s<this.P;++s)this.A.push(new Array(this.F));const n=Math.ceil(r/this.F);this.j=this.R=(this.P>>1)-(n>>1),this.D=this.N=this.F-r%this.F>>1;const i=this;t.forEach((function(t){i.pushBack(t)}))}T(){const t=[],e=Math.max(this.P>>1,1);for(let r=0;r<e;++r)t[r]=new Array(this.F);for(let r=this.j;r<this.P;++r)t[t.length]=this.A[r];for(let r=0;r<this.R;++r)t[t.length]=this.A[r];t[t.length]=[...this.A[this.R]],this.j=e,this.R=t.length-1;for(let r=0;r<e;++r)t[t.length]=new Array(this.F);this.A=t,this.P=t.length}O(t){const e=this.D+t+1,r=e%this.F;let n=r-1,i=this.j+(e-r)/this.F;return 0===r&&(i-=1),i%=this.P,n<0&&(n+=this.F),{curNodeBucketIndex:i,curNodePointerIndex:n}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new o(0,this)}end(){return new o(this.i,this)}rBegin(){return new o(this.i-1,this,1)}rEnd(){return new o(-1,this,1)}front(){if(0!==this.i)return this.A[this.j][this.D]}back(){if(0!==this.i)return this.A[this.R][this.N]}pushBack(t){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=t,this.i}popBack(){if(0===this.i)return;const t=this.A[this.R][this.N];return 1!==this.i&&(this.N>0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,t}pushFront(t){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=t,this.i}popFront(){if(0===this.i)return;const t=this.A[this.j][this.D];return 1!==this.i&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,t}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;const{curNodeBucketIndex:e,curNodePointerIndex:r}=this.O(t);return this.A[e][r]}setElementByPos(t,e){if(t<0||t>this.i-1)throw new RangeError;const{curNodeBucketIndex:r,curNodePointerIndex:n}=this.O(t);this.A[r][n]=e}insert(t,e,r=1){if(t<0||t>this.i)throw new RangeError;if(0===t)for(;r--;)this.pushFront(e);else if(t===this.i)for(;r--;)this.pushBack(e);else{const n=[];for(let e=t;e<this.i;++e)n.push(this.getElementByPos(e));this.cut(t-1);for(let t=0;t<r;++t)this.pushBack(e);for(let t=0;t<n.length;++t)this.pushBack(n[t])}return this.i}cut(t){if(t<0)return this.clear(),0;const{curNodeBucketIndex:e,curNodePointerIndex:r}=this.O(t);return this.R=e,this.N=r,this.i=t+1,this.i}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;if(0===t)this.popFront();else if(t===this.i-1)this.popBack();else{const e=[];for(let n=t+1;n<this.i;++n)e.push(this.getElementByPos(n));this.cut(t),this.popBack();const r=this;e.forEach((function(t){r.pushBack(t)}))}return this.i}eraseElementByValue(t){if(0===this.i)return 0;const e=[];for(let n=0;n<this.i;++n){const r=this.getElementByPos(n);r!==t&&e.push(r)}const r=e.length;for(let n=0;n<r;++n)this.setElementByPos(n,e[n]);return this.cut(r-1)}eraseElementByIterator(t){const e=t.o;return this.eraseElementByPos(e),t=t.next()}find(t){for(let e=0;e<this.i;++e)if(this.getElementByPos(e)===t)return new o(e,this);return this.end()}reverse(){let t=0,e=this.i-1;for(;t<e;){const r=this.getElementByPos(t);this.setElementByPos(t,this.getElementByPos(e)),this.setElementByPos(e,r),t+=1,e-=1}}unique(){if(this.i<=1)return this.i;let t=1,e=this.getElementByPos(0);for(let r=1;r<this.i;++r){const n=this.getElementByPos(r);n!==e&&(e=n,this.setElementByPos(t++,n))}for(;this.i>t;)this.popBack();return this.i}sort(t){const e=[];for(let r=0;r<this.i;++r)e.push(this.getElementByPos(r));e.sort(t);for(let r=0;r<this.i;++r)this.setElementByPos(r,e[r])}shrinkToFit(){if(0===this.i)return;const t=[];this.forEach((function(e){t.push(e)})),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let e=0;e<this.P;++e)this.A.push(new Array(this.F));for(let e=0;e<t.length;++e)this.pushBack(t[e])}forEach(t){for(let e=0;e<this.i;++e)t(this.getElementByPos(e),e,this)}[Symbol.iterator](){return function*(){for(let t=0;t<this.i;++t)yield this.getElementByPos(t)}.bind(this)()}}var h=a;r.default=h},{"./Base":33,"./Base/RandomIterator":32}],35:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=o(t("./Base")),i=t("../ContainerBase"),s=t("../../utils/throwError");function o(t){return t&&t.t?t:{default:t}}class a extends i.ContainerIterator{constructor(t,e,r,n){super(n),this.o=t,this.h=e,this.container=r,0===this.iteratorType?(this.pre=function(){return this.o.L===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o.l}set pointer(t){this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o.l=t}copy(){return new a(this.o,this.h,this.container,this.iteratorType)}}class h extends n.default{constructor(t=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;const e=this;t.forEach((function(t){e.pushBack(t)}))}V(t){const{L:e,B:r}=t;e.B=r,r.L=e,t===this.p&&(this.p=r),t===this._&&(this._=e),this.i-=1}G(t,e){const r=e.B,n={l:t,L:e,B:r};e.B=n,r.L=n,e===this.h&&(this.p=n),r===this.h&&(this._=n),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new a(this.p,this.h,this)}end(){return new a(this.h,this.h,this)}rBegin(){return new a(this._,this.h,this,1)}rEnd(){return new a(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let e=this.p;for(;t--;)e=e.B;return e.l}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let e=this.p;for(;t--;)e=e.B;return this.V(e),this.i}eraseElementByValue(t){let e=this.p;for(;e!==this.h;)e.l===t&&this.V(e),e=e.B;return this.i}eraseElementByIterator(t){const e=t.o;return e===this.h&&(0,s.throwIteratorAccessError)(),t=t.next(),this.V(e),t}pushBack(t){return this.G(t,this._),this.i}popBack(){if(0===this.i)return;const t=this._.l;return this.V(this._),t}pushFront(t){return this.G(t,this.h),this.i}popFront(){if(0===this.i)return;const t=this.p.l;return this.V(this.p),t}setElementByPos(t,e){if(t<0||t>this.i-1)throw new RangeError;let r=this.p;for(;t--;)r=r.B;r.l=e}insert(t,e,r=1){if(t<0||t>this.i)throw new RangeError;if(r<=0)return this.i;if(0===t)for(;r--;)this.pushFront(e);else if(t===this.i)for(;r--;)this.pushBack(e);else{let n=this.p;for(let e=1;e<t;++e)n=n.B;const i=n.B;for(this.i+=r;r--;)n.B={l:e,L:n},n.B.L=n,n=n.B;n.B=i,i.L=n}return this.i}find(t){let e=this.p;for(;e!==this.h;){if(e.l===t)return new a(e,this.h,this);e=e.B}return this.end()}reverse(){if(this.i<=1)return;let t=this.p,e=this._,r=0;for(;r<<1<this.i;){const n=t.l;t.l=e.l,e.l=n,t=t.B,e=e.L,r+=1}}unique(){if(this.i<=1)return this.i;let t=this.p;for(;t!==this.h;){let e=t;for(;e.B!==this.h&&e.l===e.B.l;)e=e.B,this.i-=1;t.B=e.B,t.B.L=t,t=t.B}return this.i}sort(t){if(this.i<=1)return;const e=[];this.forEach((function(t){e.push(t)})),e.sort(t);let r=this.p;e.forEach((function(t){r.l=t,r=r.B}))}merge(t){const e=this;if(0===this.i)t.forEach((function(t){e.pushBack(t)}));else{let r=this.p;t.forEach((function(t){for(;r!==e.h&&r.l<=t;)r=r.B;e.G(t,r.L)}))}return this.i}forEach(t){let e=this.p,r=0;for(;e!==this.h;)t(e.l,r++,this),e=e.B}[Symbol.iterator](){return function*(){if(0===this.i)return;let t=this.p;for(;t!==this.h;)yield t.l,t=t.B}.bind(this)()}}var c=h;r.default=c},{"../../utils/throwError":44,"../ContainerBase":25,"./Base":33}],36:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=s(t("./Base")),i=t("./Base/RandomIterator");function s(t){return t&&t.t?t:{default:t}}class o extends i.RandomIterator{constructor(t,e,r){super(t,r),this.container=e}copy(){return new o(this.o,this.container,this.iteratorType)}}class a extends n.default{constructor(t=[],e=!0){if(super(),Array.isArray(t))this.J=e?[...t]:t,this.i=t.length;else{this.J=[];const e=this;t.forEach((function(t){e.pushBack(t)}))}}clear(){this.i=0,this.J.length=0}begin(){return new o(0,this)}end(){return new o(this.i,this)}rBegin(){return new o(this.i-1,this,1)}rEnd(){return new o(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;return this.J[t]}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;return this.J.splice(t,1),this.i-=1,this.i}eraseElementByValue(t){let e=0;for(let r=0;r<this.i;++r)this.J[r]!==t&&(this.J[e++]=this.J[r]);return this.i=this.J.length=e,this.i}eraseElementByIterator(t){const e=t.o;return t=t.next(),this.eraseElementByPos(e),t}pushBack(t){return this.J.push(t),this.i+=1,this.i}popBack(){if(0!==this.i)return this.i-=1,this.J.pop()}setElementByPos(t,e){if(t<0||t>this.i-1)throw new RangeError;this.J[t]=e}insert(t,e,r=1){if(t<0||t>this.i)throw new RangeError;return this.J.splice(t,0,...new Array(r).fill(e)),this.i+=r,this.i}find(t){for(let e=0;e<this.i;++e)if(this.J[e]===t)return new o(e,this);return this.end()}reverse(){this.J.reverse()}unique(){let t=1;for(let e=1;e<this.i;++e)this.J[e]!==this.J[e-1]&&(this.J[t++]=this.J[e]);return this.i=this.J.length=t,this.i}sort(t){this.J.sort(t)}forEach(t){for(let e=0;e<this.i;++e)t(this.J[e],e,this)}[Symbol.iterator](){return function*(){yield*this.J}.bind(this)()}}var h=a;r.default=h},{"./Base":33,"./Base/RandomIterator":32}],37:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("../../ContainerBase"),i=t("../../../utils/throwError");class s extends n.ContainerIterator{constructor(t,e,r){super(r),this.o=t,this.h=e,0===this.iteratorType?(this.pre=function(){return this.o===this.h.U&&(0,i.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,i.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,i.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let t=this.o;const e=this.h.tt;if(t===this.h)return e?e.rt-1:0;let r=0;for(t.U&&(r+=t.U.rt);t!==e;){const e=t.tt;t===e.W&&(r+=1,e.U&&(r+=e.U.rt)),t=e}return r}}var o=s;r.default=o},{"../../../utils/throwError":44,"../../ContainerBase":25}],38:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.TreeNodeEnableIndex=r.TreeNode=void 0;class n{constructor(t,e){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=t,this.l=e}L(){let t=this;if(1===t.ee&&t.tt.tt===t)t=t.W;else if(t.U)for(t=t.U;t.W;)t=t.W;else{let e=t.tt;for(;e.U===t;)t=e,e=t.tt;t=e}return t}B(){let t=this;if(t.W){for(t=t.W;t.U;)t=t.U;return t}{let e=t.tt;for(;e.W===t;)t=e,e=t.tt;return t.W!==e?e:t}}te(){const t=this.tt,e=this.W,r=e.U;return t.tt===this?t.tt=e:t.U===this?t.U=e:t.W=e,e.tt=t,e.U=this,this.tt=e,this.W=r,r&&(r.tt=this),e}se(){const t=this.tt,e=this.U,r=e.W;return t.tt===this?t.tt=e:t.U===this?t.U=e:t.W=e,e.tt=t,e.W=this,this.tt=e,this.U=r,r&&(r.tt=this),e}}r.TreeNode=n;class i extends n{constructor(){super(...arguments),this.rt=1}te(){const t=super.te();return this.ie(),t.ie(),t}se(){const t=super.se();return this.ie(),t.ie(),t}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}}r.TreeNodeEnableIndex=i},{}],39:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=t("./TreeNode"),i=t("../../ContainerBase"),s=t("../../../utils/throwError");class o extends i.Container{constructor(t=function(t,e){return t<e?-1:t>e?1:0},e=!1){super(),this.Y=void 0,this.v=t,e?(this.re=n.TreeNodeEnableIndex,this.M=function(t,e,r){const n=this.ne(t,e,r);if(n){let t=n.tt;for(;t!==this.h;)t.rt+=1,t=t.tt;const e=this.he(n);if(e){const{parentNode:t,grandParent:r,curNode:n}=e;t.ie(),r.ie(),n.ie()}}return this.i},this.V=function(t){let e=this.fe(t);for(;e!==this.h;)e.rt-=1,e=e.tt}):(this.re=n.TreeNode,this.M=function(t,e,r){const n=this.ne(t,e,r);return n&&this.he(n),this.i},this.V=this.fe),this.h=new this.re}X(t,e){let r=this.h;for(;t;){const n=this.v(t.u,e);if(n<0)t=t.W;else{if(!(n>0))return t;r=t,t=t.U}}return r}Z(t,e){let r=this.h;for(;t;)this.v(t.u,e)<=0?t=t.W:(r=t,t=t.U);return r}$(t,e){let r=this.h;for(;t;){const n=this.v(t.u,e);if(n<0)r=t,t=t.W;else{if(!(n>0))return t;t=t.U}}return r}rr(t,e){let r=this.h;for(;t;)this.v(t.u,e)<0?(r=t,t=t.W):t=t.U;return r}ue(t){for(;;){const e=t.tt;if(e===this.h)return;if(1===t.ee)return void(t.ee=0);if(t===e.U){const r=e.W;if(1===r.ee)r.ee=0,e.ee=1,e===this.Y?this.Y=e.te():e.te();else{if(r.W&&1===r.W.ee)return r.ee=e.ee,e.ee=0,r.W.ee=0,void(e===this.Y?this.Y=e.te():e.te());r.U&&1===r.U.ee?(r.ee=1,r.U.ee=0,r.se()):(r.ee=1,t=e)}}else{const r=e.U;if(1===r.ee)r.ee=0,e.ee=1,e===this.Y?this.Y=e.se():e.se();else{if(r.U&&1===r.U.ee)return r.ee=e.ee,e.ee=0,r.U.ee=0,void(e===this.Y?this.Y=e.se():e.se());r.W&&1===r.W.ee?(r.ee=1,r.W.ee=0,r.te()):(r.ee=1,t=e)}}}}fe(t){if(1===this.i)return this.clear(),this.h;let e=t;for(;e.U||e.W;){if(e.W)for(e=e.W;e.U;)e=e.U;else e=e.U;[t.u,e.u]=[e.u,t.u],[t.l,e.l]=[e.l,t.l],t=e}this.h.U===e?this.h.U=e.tt:this.h.W===e&&(this.h.W=e.tt),this.ue(e);const r=e.tt;return e===r.U?r.U=void 0:r.W=void 0,this.i-=1,this.Y.ee=0,r}oe(t,e){return void 0!==t&&(!!this.oe(t.U,e)||!!e(t)||this.oe(t.W,e))}he(t){for(;;){const e=t.tt;if(0===e.ee)return;const r=e.tt;if(e===r.U){const n=r.W;if(n&&1===n.ee){if(n.ee=e.ee=0,r===this.Y)return;r.ee=1,t=r;continue}if(t===e.W){if(t.ee=0,t.U&&(t.U.tt=e),t.W&&(t.W.tt=r),e.W=t.U,r.U=t.W,t.U=e,t.W=r,r===this.Y)this.Y=t,this.h.tt=t;else{const e=r.tt;e.U===r?e.U=t:e.W=t}return t.tt=r.tt,e.tt=t,r.tt=t,r.ee=1,{parentNode:e,grandParent:r,curNode:t}}e.ee=0,r===this.Y?this.Y=r.se():r.se(),r.ee=1}else{const n=r.U;if(n&&1===n.ee){if(n.ee=e.ee=0,r===this.Y)return;r.ee=1,t=r;continue}if(t===e.U){if(t.ee=0,t.U&&(t.U.tt=r),t.W&&(t.W.tt=e),r.W=t.U,e.U=t.W,t.U=r,t.W=e,r===this.Y)this.Y=t,this.h.tt=t;else{const e=r.tt;e.U===r?e.U=t:e.W=t}return t.tt=r.tt,e.tt=t,r.tt=t,r.ee=1,{parentNode:e,grandParent:r,curNode:t}}e.ee=0,r===this.Y?this.Y=r.te():r.te(),r.ee=1}return}}ne(t,e,r){if(void 0===this.Y)return this.i+=1,this.Y=new this.re(t,e),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,void(this.h.W=this.Y);let n;const i=this.h.U,s=this.v(i.u,t);if(0!==s){if(s>0)i.U=new this.re(t,e),i.U.tt=i,n=i.U,this.h.U=n;else{const i=this.h.W,s=this.v(i.u,t);if(0===s)return void(i.l=e);if(s<0)i.W=new this.re(t,e),i.W.tt=i,n=i.W,this.h.W=n;else{if(void 0!==r){const i=r.o;if(i!==this.h){const r=this.v(i.u,t);if(0===r)return void(i.l=e);if(r>0){const r=i.L(),s=this.v(r.u,t);if(0===s)return void(r.l=e);s<0&&(n=new this.re(t,e),void 0===r.W?(r.W=n,n.tt=r):(i.U=n,n.tt=i))}}}if(void 0===n)for(n=this.Y;;){const r=this.v(n.u,t);if(r>0){if(void 0===n.U){n.U=new this.re(t,e),n.U.tt=n,n=n.U;break}n=n.U}else{if(!(r<0))return void(n.l=e);if(void 0===n.W){n.W=new this.re(t,e),n.W.tt=n,n=n.W;break}n=n.W}}}}return this.i+=1,n}i.l=e}I(t,e){for(;t;){const r=this.v(t.u,e);if(r<0)t=t.W;else{if(!(r>0))return t;t=t.U}}return t||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(t,e){const r=t.o;if(r===this.h&&(0,s.throwIteratorAccessError)(),1===this.i)return r.u=e,!0;if(r===this.h.U)return this.v(r.B().u,e)>0&&(r.u=e,!0);if(r===this.h.W)return this.v(r.L().u,e)<0&&(r.u=e,!0);const n=r.L().u;if(this.v(n,e)>=0)return!1;const i=r.B().u;return!(this.v(i,e)<=0||(r.u=e,0))}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let e=0;const r=this;return this.oe(this.Y,(function(n){return t===e?(r.V(n),!0):(e+=1,!1)})),this.i}eraseElementByKey(t){if(0===this.i)return!1;const e=this.I(this.Y,t);return e!==this.h&&(this.V(e),!0)}eraseElementByIterator(t){const e=t.o;e===this.h&&(0,s.throwIteratorAccessError)();const r=void 0===e.W;return 0===t.iteratorType?r&&t.next():r&&void 0!==e.U||t.next(),this.V(e),t}forEach(t){let e=0;for(const r of this)t(r,e++,this)}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let e,r=0;for(const n of this){if(r===t){e=n;break}r+=1}return e}getHeight(){if(0===this.i)return 0;const t=function(e){return e?Math.max(t(e.U),t(e.W))+1:0};return t(this.Y)}}var a=o;r.default=a},{"../../../utils/throwError":44,"../../ContainerBase":25,"./TreeNode":38}],40:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=o(t("./Base")),i=o(t("./Base/TreeIterator")),s=t("../../utils/throwError");function o(t){return t&&t.t?t:{default:t}}class a extends i.default{constructor(t,e,r,n){super(t,e,n),this.container=r}get pointer(){this.o===this.h&&(0,s.throwIteratorAccessError)();const t=this;return new Proxy([],{get:(e,r)=>"0"===r?t.o.u:"1"===r?t.o.l:void 0,set(e,r,n){if("1"!==r)throw new TypeError("props must be 1");return t.o.l=n,!0}})}copy(){return new a(this.o,this.h,this.container,this.iteratorType)}}class h extends n.default{constructor(t=[],e,r){super(e,r);const n=this;t.forEach((function(t){n.setElement(t[0],t[1])}))}*K(t){void 0!==t&&(yield*this.K(t.U),yield[t.u,t.l],yield*this.K(t.W))}begin(){return new a(this.h.U||this.h,this.h,this)}end(){return new a(this.h,this.h,this)}rBegin(){return new a(this.h.W||this.h,this.h,this,1)}rEnd(){return new a(this.h,this.h,this,1)}front(){if(0===this.i)return;const t=this.h.U;return[t.u,t.l]}back(){if(0===this.i)return;const t=this.h.W;return[t.u,t.l]}lowerBound(t){const e=this.X(this.Y,t);return new a(e,this.h,this)}upperBound(t){const e=this.Z(this.Y,t);return new a(e,this.h,this)}reverseLowerBound(t){const e=this.$(this.Y,t);return new a(e,this.h,this)}reverseUpperBound(t){const e=this.rr(this.Y,t);return new a(e,this.h,this)}setElement(t,e,r){return this.M(t,e,r)}find(t){const e=this.I(this.Y,t);return new a(e,this.h,this)}getElementByKey(t){return this.I(this.Y,t).l}union(t){const e=this;return t.forEach((function(t){e.setElement(t[0],t[1])})),this.i}[Symbol.iterator](){return this.K(this.Y)}}var c=h;r.default=c},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],41:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),r.default=void 0;var n=o(t("./Base")),i=o(t("./Base/TreeIterator")),s=t("../../utils/throwError");function o(t){return t&&t.t?t:{default:t}}class a extends i.default{constructor(t,e,r,n){super(t,e,n),this.container=r}get pointer(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o.u}copy(){return new a(this.o,this.h,this.container,this.iteratorType)}}class h extends n.default{constructor(t=[],e,r){super(e,r);const n=this;t.forEach((function(t){n.insert(t)}))}*K(t){void 0!==t&&(yield*this.K(t.U),yield t.u,yield*this.K(t.W))}begin(){return new a(this.h.U||this.h,this.h,this)}end(){return new a(this.h,this.h,this)}rBegin(){return new a(this.h.W||this.h,this.h,this,1)}rEnd(){return new a(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(t,e){return this.M(t,void 0,e)}find(t){const e=this.I(this.Y,t);return new a(e,this.h,this)}lowerBound(t){const e=this.X(this.Y,t);return new a(e,this.h,this)}upperBound(t){const e=this.Z(this.Y,t);return new a(e,this.h,this)}reverseLowerBound(t){const e=this.$(this.Y,t);return new a(e,this.h,this)}reverseUpperBound(t){const e=this.rr(this.Y,t);return new a(e,this.h,this)}union(t){const e=this;return t.forEach((function(t){e.insert(t)})),this.i}[Symbol.iterator](){return this.K(this.Y)}}var c=h;r.default=c},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],42:[function(t,e,r){Object.defineProperty(r,"t",{value:!0}),Object.defineProperty(r,"Deque",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(r,"HashMap",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(r,"HashSet",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"LinkList",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"OrderedMap",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"OrderedSet",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"PriorityQueue",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"Queue",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"Stack",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"Vector",{enumerable:!0,get:function(){return o.default}});var n=p(t("./container/OtherContainer/Stack")),i=p(t("./container/OtherContainer/Queue")),s=p(t("./container/OtherContainer/PriorityQueue")),o=p(t("./container/SequentialContainer/Vector")),a=p(t("./container/SequentialContainer/LinkList")),h=p(t("./container/SequentialContainer/Deque")),c=p(t("./container/TreeContainer/OrderedSet")),l=p(t("./container/TreeContainer/OrderedMap")),u=p(t("./container/HashContainer/HashSet")),f=p(t("./container/HashContainer/HashMap"));function p(t){return t&&t.t?t:{default:t}}},{"./container/HashContainer/HashMap":27,"./container/HashContainer/HashSet":28,"./container/OtherContainer/PriorityQueue":29,"./container/OtherContainer/Queue":30,"./container/OtherContainer/Stack":31,"./container/SequentialContainer/Deque":34,"./container/SequentialContainer/LinkList":35,"./container/SequentialContainer/Vector":36,"./container/TreeContainer/OrderedMap":40,"./container/TreeContainer/OrderedSet":41}],43:[function(t,e,r){function n(t){const e=typeof t;return"object"===e&&null!==t||"function"===e}Object.defineProperty(r,"t",{value:!0}),r.default=n},{}],44:[function(t,e,r){function n(){throw new RangeError("Iterator access denied!")}Object.defineProperty(r,"t",{value:!0}),r.throwIteratorAccessError=n},{}],45:[function(t,e,r){const n=t("yallist"),i=Symbol("max"),s=Symbol("length"),o=Symbol("lengthCalculator"),a=Symbol("allowStale"),h=Symbol("maxAge"),c=Symbol("dispose"),l=Symbol("noDisposeOnSet"),u=Symbol("lruList"),f=Symbol("cache"),p=Symbol("updateAgeOnGet"),d=()=>1;class g{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[i]=t.max||1/0;const e=t.length||d;if(this[o]="function"!=typeof e?d:e,this[a]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[h]=t.maxAge||0,this[c]=t.dispose,this[l]=t.noDisposeOnSet||!1,this[p]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[i]=t||1/0,b(this)}get max(){return this[i]}set allowStale(t){this[a]=!!t}get allowStale(){return this[a]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[h]=t,b(this)}get maxAge(){return this[h]}set lengthCalculator(t){"function"!=typeof t&&(t=d),t!==this[o]&&(this[o]=t,this[s]=0,this[u].forEach((t=>{t.length=this[o](t.value,t.key),this[s]+=t.length}))),b(this)}get lengthCalculator(){return this[o]}get length(){return this[s]}get itemCount(){return this[u].length}rforEach(t,e){e=e||this;for(let r=this[u].tail;null!==r;){const n=r.prev;v(this,t,r,e),r=n}}forEach(t,e){e=e||this;for(let r=this[u].head;null!==r;){const n=r.next;v(this,t,r,e),r=n}}keys(){return this[u].toArray().map((t=>t.key))}values(){return this[u].toArray().map((t=>t.value))}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach((t=>this[c](t.key,t.value))),this[f]=new Map,this[u]=new n,this[s]=0}dump(){return this[u].map((t=>!y(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[u]}set(t,e,r){if((r=r||this[h])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[o](e,t);if(this[f].has(t)){if(a>this[i])return w(this,this[f].get(t)),!1;const o=this[f].get(t).value;return this[c]&&(this[l]||this[c](t,o.value)),o.now=n,o.maxAge=r,o.value=e,this[s]+=a-o.length,o.length=a,this.get(t),b(this),!0}const p=new _(t,e,a,n,r);return p.length>this[i]?(this[c]&&this[c](t,e),!1):(this[s]+=p.length,this[u].unshift(p),this[f].set(t,this[u].head),b(this),!0)}has(t){if(!this[f].has(t))return!1;const e=this[f].get(t).value;return!y(this,e)}get(t){return m(this,t,!0)}peek(t){return m(this,t,!1)}pop(){const t=this[u].tail;return t?(w(this,t),t.value):null}del(t){w(this,this[f].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const n=t[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const t=i-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[f].forEach(((t,e)=>m(this,e,!1)))}}const m=(t,e,r)=>{const n=t[f].get(e);if(n){const e=n.value;if(y(t,e)){if(w(t,n),!t[a])return}else r&&(t[p]&&(n.value.now=Date.now()),t[u].unshiftNode(n));return e.value}},y=(t,e)=>{if(!e||!e.maxAge&&!t[h])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[h]&&r>t[h]},b=t=>{if(t[s]>t[i])for(let e=t[u].tail;t[s]>t[i]&&null!==e;){const r=e.prev;w(t,e),e=r}},w=(t,e)=>{if(e){const r=e.value;t[c]&&t[c](r.key,r.value),t[s]-=r.length,t[f].delete(r.key),t[u].removeNode(e)}};class _{constructor(t,e,r,n,i){this.key=t,this.value=e,this.length=r,this.now=n,this.maxAge=i||0}}const v=(t,e,r,n)=>{let i=r.value;y(t,i)&&(w(t,r),t[a]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};e.exports=g},{yallist:84}],46:[function(t,e,r){(function(t){(function(){const r=e.exports;r.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},r.codes={};for(const t in r.types){const e=r.types[t];r.codes[e]=t}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=t.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=t.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=t.from([r.codes.connect<<r.CMD_SHIFT]),r.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},r.propertiesCodes={};for(const t in r.properties){const e=r.properties[t];r.propertiesCodes[e]=t}function n(e){return[0,1,2].map((n=>[0,1].map((i=>[0,1].map((s=>{const o=t.alloc(1);return o.writeUInt8(r.codes[e]<<r.CMD_SHIFT|(i?r.DUP_MASK:0)|n<<r.QOS_SHIFT|s,0,!0),o}))))))}r.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},r.PUBLISH_HEADER=n("publish"),r.SUBSCRIBE_HEADER=n("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=n("unsubscribe"),r.ACKS={unsuback:n("unsuback"),puback:n("puback"),pubcomp:n("pubcomp"),pubrel:n("pubrel"),pubrec:n("pubrec")},r.SUBACK_HEADER=t.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=t.from([3]),r.VERSION4=t.from([4]),r.VERSION5=t.from([5]),r.VERSION131=t.from([131]),r.VERSION132=t.from([132]),r.QOS=[0,1,2].map((e=>t.from([e]))),r.EMPTY={pingreq:t.from([r.codes.pingreq<<4,0]),pingresp:t.from([r.codes.pingresp<<4,0]),disconnect:t.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:3}],47:[function(t,e,r){(function(r){(function(){const n=t("./writeToStream"),i=t("events");function s(t,e){const r=new o;return n(t,r,e),r.concat()}class o extends i{constructor(){super(),this._array=new Array(20),this._i=0}write(t){return this._array[this._i++]=t,!0}concat(){let t=0;const e=new Array(this._array.length),n=this._array;let i,s=0;for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?e[i]=n[i].length:e[i]=r.byteLength(n[i]),t+=e[i];const o=r.allocUnsafe(t);for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?(n[i].copy(o,s),s+=e[i]):(o.write(n[i],s),s+=e[i]);return o}}e.exports=s}).call(this)}).call(this,t("buffer").Buffer)},{"./writeToStream":52,buffer:3,events:4}],48:[function(t,e,r){r.parser=t("./parser").parser,r.generate=t("./generate"),r.writeToStream=t("./writeToStream")},{"./generate":47,"./parser":51,"./writeToStream":52}],49:[function(t,e,r){(function(t){(function(){const r=65536,n={},i=t.isBuffer(t.from([1,2]).subarray(0,1));function s(e){const r=t.allocUnsafe(2);return r.writeUInt8(e>>8,0),r.writeUInt8(255&e,1),r}function o(){for(let t=0;t<r;t++)n[t]=s(t)}function a(e){const r=4;let n=0,s=0;const o=t.allocUnsafe(r);do{n=e%128|0,(e=e/128|0)>0&&(n|=128),o.writeUInt8(n,s++)}while(e>0&&s<r);return e>0&&(s=0),i?o.subarray(0,s):o.slice(0,s)}function h(e){const r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),r}e.exports={cache:n,generateCache:o,generateNumber:s,genBufVariableByteInt:a,generate4ByteBuffer:h}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:3}],50:[function(t,e,r){class n{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}e.exports=n},{}],51:[function(t,e,r){const n=t("bl"),i=t("events"),s=t("./packet"),o=t("./constants"),a=t("debug")("mqtt-packet:parser");class h extends i{constructor(){super(),this.parser=this.constructor.parser}static parser(t){return this instanceof h?(this.settings=t||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new h).parser(t)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new s,this.error=null,this._list=n(),this._stateCounter=0}parse(t){for(this.error&&this._resetState(),this._list.append(t),a("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const t=this._list.readUInt8(0);return this.packet.cmd=o.types[t>>o.CMD_SHIFT],this.packet.retain=!!(t&o.RETAIN_MASK),this.packet.qos=t>>o.QOS_SHIFT&o.QOS_MASK,this.packet.dup=!!(t&o.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const t=this._parseVarByteNum(!0);return t&&(this.packet.length=t.value,this._list.consume(t.bytes)),a("_parseLength %d",t.value),!!t}_parsePayload(){a("_parsePayload: payload %O",this._list);let t=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}t=!0}return a("_parsePayload complete result: %s",t),t}_parseConnect(){let t,e,r,n;a("_parseConnect");const i={},s=this.packet,h=this._parseString();if(null===h)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==h&&"MQIsdp"!==h)return this._emitError(new Error("Invalid protocolId"));if(s.protocolId=h,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),3!==s.protocolVersion&&4!==s.protocolVersion&&5!==s.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(i.username=this._list.readUInt8(this._pos)&o.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&o.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&o.WILL_FLAG_MASK,i.will&&(s.will={},s.will.retain=!!(this._list.readUInt8(this._pos)&o.WILL_RETAIN_MASK),s.will.qos=(this._list.readUInt8(this._pos)&o.WILL_QOS_MASK)>>o.WILL_QOS_SHIFT),s.clean=!!(this._list.readUInt8(this._pos)&o.CLEAN_SESSION_MASK),this._pos++,s.keepalive=this._parseNum(),-1===s.keepalive)return this._emitError(new Error("Packet too short"));if(5===s.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(s.properties=t)}const c=this._parseString();if(null===c)return this._emitError(new Error("Packet too short"));if(s.clientId=c,a("_parseConnect: packet.clientId: %s",s.clientId),i.will){if(5===s.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(s.will.properties=t)}if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse will topic"));if(s.will.topic=t,a("_parseConnect: packet.will.topic: %s",s.will.topic),e=this._parseBuffer(),null===e)return this._emitError(new Error("Cannot parse will payload"));s.will.payload=e,a("_parseConnect: packet.will.paylaod: %s",s.will.payload)}if(i.username){if(n=this._parseString(),null===n)return this._emitError(new Error("Cannot parse username"));s.username=n,a("_parseConnect: packet.username: %s",s.username)}if(i.password){if(r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse password"));s.password=r}return this.settings=s,a("_parseConnect: complete"),s}_parseConnack(){a("_parseConnack");const t=this.packet;if(this._list.length<1)return null;if(t.sessionPresent=!!(this._list.readUInt8(this._pos++)&o.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?t.reasonCode=this._list.readUInt8(this._pos++):t.reasonCode=0;else{if(this._list.length<2)return null;t.returnCode=this._list.readUInt8(this._pos++)}if(-1===t.returnCode||-1===t.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}a("_parseConnack: complete")}_parsePublish(){a("_parsePublish");const t=this.packet;if(t.topic=this._parseString(),null===t.topic)return this._emitError(new Error("Cannot parse topic"));if(!(t.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}t.payload=this._list.slice(this._pos,t.length),a("_parsePublish: payload from buffer list: %o",t.payload)}}_parseSubscribe(){a("_parseSubscribe");const t=this.packet;let e,r,n,i,s,h,c;if(1!==t.qos)return this._emitError(new Error("Wrong subscribe header"));if(t.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<t.length;){if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=t.length)return this._emitError(new Error("Malformed Subscribe Payload"));r=this._parseByte(),n=r&o.SUBSCRIBE_OPTIONS_QOS_MASK,h=!!(r>>o.SUBSCRIBE_OPTIONS_NL_SHIFT&o.SUBSCRIBE_OPTIONS_NL_MASK),s=!!(r>>o.SUBSCRIBE_OPTIONS_RAP_SHIFT&o.SUBSCRIBE_OPTIONS_RAP_MASK),i=r>>o.SUBSCRIBE_OPTIONS_RH_SHIFT&o.SUBSCRIBE_OPTIONS_RH_MASK,c={topic:e,qos:n},5===this.settings.protocolVersion?(c.nl=h,c.rap=s,c.rh=i):this.settings.bridgeMode&&(c.rh=0,c.rap=!0,c.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",c),t.subscriptions.push(c)}}}_parseSuback(){a("_parseSuback");const t=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){a("_parseUnsubscribe");const t=this.packet;if(t.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}for(;this._pos<t.length;){const e=this._parseString();if(null===e)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",e),t.unsubscriptions.push(e)}}}_parseUnsuback(){a("_parseUnsuback");const t=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const e=this._parseProperties();for(Object.getOwnPropertyNames(e).length&&(t.properties=e),t.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const t=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(t.length>2?(t.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",t.reasonCode)):t.reasonCode=0,t.length>3)){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}return!0}_parseDisconnect(){const t=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?t.reasonCode=this._parseByte():t.reasonCode=0;const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(t.properties=e)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_parseAuth");const t=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));t.reasonCode=this._parseByte();const e=this._parseProperties();return Object.getOwnPropertyNames(e).length&&(t.properties=e),a("_parseAuth: result: true"),!0}_parseMessageId(){const t=this.packet;return t.messageId=this._parseNum(),null===t.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",t.messageId),!0)}_parseString(t){const e=this._parseNum(),r=e+this._pos;if(-1===e||r>this._list.length||r>this.packet.length)return null;const n=this._list.toString("utf8",this._pos,r);return this._pos+=e,a("_parseString: result: %s",n),n}_parseStringPair(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const t=this._parseNum(),e=t+this._pos;if(-1===t||e>this._list.length||e>this.packet.length)return null;const r=this._list.slice(this._pos,e);return this._pos+=t,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const t=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",t),t}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const t=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",t),t}_parseVarByteNum(t){a("_parseVarByteNum");const e=4;let r,n=0,i=1,s=0,h=!1;const c=this._pos?this._pos:0;for(;n<e&&c+n<this._list.length;){if(r=this._list.readUInt8(c+n++),s+=i*(r&o.VARBYTEINT_MASK),i*=128,!(r&o.VARBYTEINT_FIN_MASK)){h=!0;break}if(this._list.length<=n)break}return!h&&n===e&&this._list.length>=n&&this._emitError(new Error("Invalid variable byte integer")),c&&(this._pos+=n),h=!!h&&(t?{bytes:n,value:s}:s),a("_parseVarByteNum: result: %o",h),h}_parseByte(){let t;return this._pos<this._list.length&&(t=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",t),t}_parseByType(t){switch(a("_parseByType: type: %s",t),t){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){a("_parseProperties");const t=this._parseVarByteNum(),e=this._pos+t,r={};for(;this._pos<e;){const t=this._parseByte();if(!t)return this._emitError(new Error("Cannot parse property code type")),!1;const e=o.propertiesCodes[t];if(!e)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==e)r[e]?(Array.isArray(r[e])||(r[e]=[r[e]]),r[e].push(this._parseByType(o.propertiesTypes[e]))):r[e]=this._parseByType(o.propertiesTypes[e]);else{r[e]||(r[e]=Object.create(null));const t=this._parseByType(o.propertiesTypes[e]);if(r[e][t.name])if(Array.isArray(r[e][t.name]))r[e][t.name].push(t.value);else{const n=r[e][t.name];r[e][t.name]=[n],r[e][t.name].push(t.value)}else r[e][t.name]=t.value}}return r}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),a("_newPacket: new packet"),this.packet=new s,this._pos=0,!0}_emitError(t){a("_emitError"),this.error=t,this.emit("error",t)}}e.exports=h},{"./constants":46,"./packet":50,bl:19,debug:20,events:4}],52:[function(t,e,r){(function(r){(function(){const n=t("./constants"),i=r.allocUnsafe(0),s=r.from([0]),o=t("./numbers"),a=t("process-nextick-args").nextTick,h=t("debug")("mqtt-packet:writeToStream"),c=o.cache,l=o.generateNumber,u=o.generateCache,f=o.genBufVariableByteInt,p=o.generate4ByteBuffer;let d=O,g=!0;function m(t,e,r){switch(h("generate called"),e.cork&&(e.cork(),a(y,e)),g&&(g=!1,u()),h("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return b(t,e);case"connack":return w(t,e,r);case"publish":return _(t,e,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return v(t,e,r);case"subscribe":return E(t,e,r);case"suback":return S(t,e,r);case"unsubscribe":return A(t,e,r);case"unsuback":return C(t,e,r);case"pingreq":case"pingresp":return k(t,e);case"disconnect":return I(t,e,r);case"auth":return R(t,e,r);default:return e.emit("error",new Error("Unknown command")),!1}}function y(t){t.uncork()}function b(t,e,i){const s=t||{},o=s.protocolId||"MQTT";let a=s.protocolVersion||4;const h=s.will;let c=s.clean;const l=s.keepalive||0,u=s.clientId||"",f=s.username,p=s.password,g=s.properties;void 0===c&&(c=!0);let m=0;if(!o||"string"!=typeof o&&!r.isBuffer(o))return e.emit("error",new Error("Invalid protocolId")),!1;if(m+=o.length+2,3!==a&&4!==a&&5!==a)return e.emit("error",new Error("Invalid protocol version")),!1;if(m+=1,("string"==typeof u||r.isBuffer(u))&&(u||a>=4)&&(u||c))m+=r.byteLength(u)+2;else{if(a<4)return e.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*c==0)return e.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof l||l<0||l>65535||l%1!=0)return e.emit("error",new Error("Invalid keepalive")),!1;if(m+=2,m+=1,5===a){var y=N(e,g);if(!y)return!1;m+=y.length}if(h){if("object"!=typeof h)return e.emit("error",new Error("Invalid will")),!1;if(!h.topic||"string"!=typeof h.topic)return e.emit("error",new Error("Invalid will topic")),!1;if(m+=r.byteLength(h.topic)+2,m+=2,h.payload){if(!(h.payload.length>=0))return e.emit("error",new Error("Invalid will payload")),!1;"string"==typeof h.payload?m+=r.byteLength(h.payload):m+=h.payload.length}var b={};if(5===a){if(!(b=N(e,h.properties)))return!1;m+=b.length}}let w=!1;if(null!=f){if(!W(f))return e.emit("error",new Error("Invalid username")),!1;w=!0,m+=r.byteLength(f)+2}if(null!=p){if(!w)return e.emit("error",new Error("Username is required to use password")),!1;if(!W(p))return e.emit("error",new Error("Invalid password")),!1;m+=q(p)+2}e.write(n.CONNECT_HEADER),T(e,m),U(e,o),s.bridgeMode&&(a+=128),e.write(131===a?n.VERSION131:132===a?n.VERSION132:4===a?n.VERSION4:5===a?n.VERSION5:n.VERSION3);let _=0;return _|=null!=f?n.USERNAME_MASK:0,_|=null!=p?n.PASSWORD_MASK:0,_|=h&&h.retain?n.WILL_RETAIN_MASK:0,_|=h&&h.qos?h.qos<<n.WILL_QOS_SHIFT:0,_|=h?n.WILL_FLAG_MASK:0,_|=c?n.CLEAN_SESSION_MASK:0,e.write(r.from([_])),d(e,l),5===a&&y.write(),U(e,u),h&&(5===a&&b.write(),M(e,h.topic),U(e,h.payload)),null!=f&&U(e,f),null!=p&&U(e,p),!0}function w(t,e,i){const o=i?i.protocolVersion:4,a=t||{},h=5===o?a.reasonCode:a.returnCode,c=a.properties;let l=2;if("number"!=typeof h)return e.emit("error",new Error("Invalid return code")),!1;let u=null;if(5===o){if(u=N(e,c),!u)return!1;l+=u.length}return e.write(n.CONNACK_HEADER),T(e,l),e.write(a.sessionPresent?n.SESSIONPRESENT_HEADER:s),e.write(r.from([h])),null!=u&&u.write(),!0}function _(t,e,s){h("publish: packet: %o",t);const o=s?s.protocolVersion:4,a=t||{},c=a.qos||0,l=a.retain?n.RETAIN_MASK:0,u=a.topic,f=a.payload||i,p=a.messageId,g=a.properties;let m=0;if("string"==typeof u)m+=r.byteLength(u)+2;else{if(!r.isBuffer(u))return e.emit("error",new Error("Invalid topic")),!1;m+=u.length+2}if(r.isBuffer(f)?m+=f.length:m+=r.byteLength(f),c&&"number"!=typeof p)return e.emit("error",new Error("Invalid messageId")),!1;c&&(m+=2);let y=null;if(5===o){if(y=N(e,g),!y)return!1;m+=y.length}return e.write(n.PUBLISH_HEADER[c][a.dup?1:0][l?1:0]),T(e,m),d(e,q(u)),e.write(u),c>0&&d(e,p),null!=y&&y.write(),h("publish: payload: %o",f),e.write(f)}function v(t,e,i){const s=i?i.protocolVersion:4,o=t||{},a=o.cmd||"puback",h=o.messageId,c=o.dup&&"pubrel"===a?n.DUP_MASK:0;let l=0;const u=o.reasonCode,f=o.properties;let p=5===s?3:2;if("pubrel"===a&&(l=1),"number"!=typeof h)return e.emit("error",new Error("Invalid messageId")),!1;let g=null;if(5===s&&"object"==typeof f){if(g=j(e,f,i,p),!g)return!1;p+=g.length}return e.write(n.ACKS[a][l][c][0]),T(e,p),d(e,h),5===s&&e.write(r.from([u])),null!==g&&g.write(),!0}function E(t,e,i){h("subscribe: packet: ");const s=i?i.protocolVersion:4,o=t||{},a=o.dup?n.DUP_MASK:0,c=o.messageId,l=o.subscriptions,u=o.properties;let f=0;if("number"!=typeof c)return e.emit("error",new Error("Invalid messageId")),!1;f+=2;let p=null;if(5===s){if(p=N(e,u),!p)return!1;f+=p.length}if("object"!=typeof l||!l.length)return e.emit("error",new Error("Invalid subscriptions")),!1;for(let n=0;n<l.length;n+=1){const t=l[n].topic,i=l[n].qos;if("string"!=typeof t)return e.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof i)return e.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===s){if("boolean"!=typeof(l[n].nl||!1))return e.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(l[n].rap||!1))return e.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const t=l[n].rh||0;if("number"!=typeof t||t>2)return e.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=r.byteLength(t)+2+1}h("subscribe: writing to stream: %o",n.SUBSCRIBE_HEADER),e.write(n.SUBSCRIBE_HEADER[1][a?1:0][0]),T(e,f),d(e,c),null!==p&&p.write();let g=!0;for(const h of l){const t=h.topic,i=h.qos,o=+h.nl,a=+h.rap,c=h.rh;let l;M(e,t),l=n.SUBSCRIBE_OPTIONS_QOS[i],5===s&&(l|=o?n.SUBSCRIBE_OPTIONS_NL:0,l|=a?n.SUBSCRIBE_OPTIONS_RAP:0,l|=c?n.SUBSCRIBE_OPTIONS_RH[c]:0),g=e.write(r.from([l]))}return g}function S(t,e,i){const s=i?i.protocolVersion:4,o=t||{},a=o.messageId,h=o.granted,c=o.properties;let l=0;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;if(l+=2,"object"!=typeof h||!h.length)return e.emit("error",new Error("Invalid qos vector")),!1;for(let r=0;r<h.length;r+=1){if("number"!=typeof h[r])return e.emit("error",new Error("Invalid qos vector")),!1;l+=1}let u=null;if(5===s){if(u=j(e,c,i,l),!u)return!1;l+=u.length}return e.write(n.SUBACK_HEADER),T(e,l),d(e,a),null!==u&&u.write(),e.write(r.from(h))}function A(t,e,i){const s=i?i.protocolVersion:4,o=t||{},a=o.messageId,h=o.dup?n.DUP_MASK:0,c=o.unsubscriptions,l=o.properties;let u=0;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;if(u+=2,"object"!=typeof c||!c.length)return e.emit("error",new Error("Invalid unsubscriptions")),!1;for(let n=0;n<c.length;n+=1){if("string"!=typeof c[n])return e.emit("error",new Error("Invalid unsubscriptions")),!1;u+=r.byteLength(c[n])+2}let f=null;if(5===s){if(f=N(e,l),!f)return!1;u+=f.length}e.write(n.UNSUBSCRIBE_HEADER[1][h?1:0][0]),T(e,u),d(e,a),null!==f&&f.write();let p=!0;for(let r=0;r<c.length;r++)p=M(e,c[r]);return p}function C(t,e,i){const s=i?i.protocolVersion:4,o=t||{},a=o.messageId,h=o.dup?n.DUP_MASK:0,c=o.granted,l=o.properties,u=o.cmd,f=0;let p=2;if("number"!=typeof a)return e.emit("error",new Error("Invalid messageId")),!1;if(5===s){if("object"!=typeof c||!c.length)return e.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<c.length;t+=1){if("number"!=typeof c[t])return e.emit("error",new Error("Invalid qos vector")),!1;p+=1}}let g=null;if(5===s){if(g=j(e,l,i,p),!g)return!1;p+=g.length}return e.write(n.ACKS[u][f][h][0]),T(e,p),d(e,a),null!==g&&g.write(),5===s&&e.write(r.from(c)),!0}function k(t,e,r){return e.write(n.EMPTY[t.cmd])}function I(t,e,i){const s=i?i.protocolVersion:4,o=t||{},a=o.reasonCode,h=o.properties;let c=5===s?1:0,l=null;if(5===s){if(l=j(e,h,i,c),!l)return!1;c+=l.length}return e.write(r.from([n.codes.disconnect<<4])),T(e,c),5===s&&e.write(r.from([a])),null!==l&&l.write(),!0}function R(t,e,i){const s=i?i.protocolVersion:4,o=t||{},a=o.reasonCode,h=o.properties;let c=5===s?1:0;5!==s&&e.emit("error",new Error("Invalid mqtt version for auth packet"));const l=j(e,h,i,c);return!!l&&(c+=l.length,e.write(r.from([n.codes.auth<<4])),T(e,c),e.write(r.from([a])),null!==l&&l.write(),!0)}Object.defineProperty(m,"cacheNumbers",{get:()=>d===O,set(t){t?(c&&0!==Object.keys(c).length||(g=!0),d=O):(g=!1,d=B)}});const x={};function T(t,e){if(e>n.VARBYTEINT_MAX)return t.emit("error",new Error(`Invalid variable byte integer: ${e}`)),!1;let r=x[e];return r||(r=f(e),e<16384&&(x[e]=r)),h("writeVarByteInt: writing to stream: %o",r),t.write(r)}function M(t,e){const n=r.byteLength(e);return d(t,n),h("writeString: %s",e),t.write(e,"utf8")}function P(t,e,r){M(t,e),M(t,r)}function O(t,e){return h("writeNumberCached: number: %d",e),h("writeNumberCached: %o",c[e]),t.write(c[e])}function B(t,e){const r=l(e);return h("writeNumberGenerated: %o",r),t.write(r)}function L(t,e){const r=p(e);return h("write4ByteNumber: %o",r),t.write(r)}function U(t,e){"string"==typeof e?M(t,e):e?(d(t,e.length),t.write(e)):d(t,0)}function N(t,e){if("object"!=typeof e||null!=e.length)return{length:1,write(){F(t,{},0)}};let i=0;function s(e,i){let s=0;switch(n.propertiesTypes[e]){case"byte":if("boolean"!=typeof i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=2;break;case"int8":if("number"!=typeof i||i<0||i>255)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=2;break;case"binary":if(i&&null===i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=1+r.byteLength(i)+2;break;case"int16":if("number"!=typeof i||i<0||i>65535)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=3;break;case"int32":if("number"!=typeof i||i<0||i>4294967295)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=5;break;case"var":if("number"!=typeof i||i<0||i>268435455)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=1+r.byteLength(f(i));break;case"string":if("string"!=typeof i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=3+r.byteLength(i.toString());break;case"pair":if("object"!=typeof i)return t.emit("error",new Error(`Invalid ${e}: ${i}`)),!1;s+=Object.getOwnPropertyNames(i).reduce(((t,e)=>{const n=i[e];return Array.isArray(n)?t+=n.reduce(((t,n)=>t+=3+r.byteLength(e.toString())+2+r.byteLength(n.toString())),0):t+=3+r.byteLength(e.toString())+2+r.byteLength(i[e].toString()),t}),0);break;default:return t.emit("error",new Error(`Invalid property ${e}: ${i}`)),!1}return s}if(e)for(const r in e){let t=0,n=0;const o=e[r];if(Array.isArray(o))for(let e=0;e<o.length;e++){if(n=s(r,o[e]),!n)return!1;t+=n}else{if(n=s(r,o),!n)return!1;t=n}if(!t)return!1;i+=t}return{length:r.byteLength(f(i))+i,write(){F(t,e,i)}}}function j(t,e,r,n){const i=["reasonString","userProperties"],s=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let o=N(t,e);if(s)for(;n+o.length>s;){const r=i.shift();if(!r||!e[r])return!1;delete e[r],o=N(t,e)}return o}function D(t,e,i){switch(n.propertiesTypes[e]){case"byte":t.write(r.from([n.properties[e]])),t.write(r.from([+i]));break;case"int8":t.write(r.from([n.properties[e]])),t.write(r.from([i]));break;case"binary":t.write(r.from([n.properties[e]])),U(t,i);break;case"int16":t.write(r.from([n.properties[e]])),d(t,i);break;case"int32":t.write(r.from([n.properties[e]])),L(t,i);break;case"var":t.write(r.from([n.properties[e]])),T(t,i);break;case"string":t.write(r.from([n.properties[e]])),M(t,i);break;case"pair":Object.getOwnPropertyNames(i).forEach((s=>{const o=i[s];Array.isArray(o)?o.forEach((i=>{t.write(r.from([n.properties[e]])),P(t,s.toString(),i.toString())})):(t.write(r.from([n.properties[e]])),P(t,s.toString(),o.toString()))}));break;default:return t.emit("error",new Error(`Invalid property ${e} value: ${i}`)),!1}}function F(t,e,r){T(t,r);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&null!==e[n]){const r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;e++)D(t,n,r[e]);else D(t,n,r)}}function q(t){return t?t instanceof r?t.length:r.byteLength(t):0}function W(t){return"string"==typeof t||t instanceof r}e.exports=m}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":46,"./numbers":49,buffer:3,debug:20,"process-nextick-args":57}],53:[function(t,e,r){var n=1e3,i=60*n,s=60*i,o=24*s,a=7*o,h=365.25*o;function c(t){if(!((t=String(t)).length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*h;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*s;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function l(t){var e=Math.abs(t);return e>=o?Math.round(t/o)+"d":e>=s?Math.round(t/s)+"h":e>=i?Math.round(t/i)+"m":e>=n?Math.round(t/n)+"s":t+"ms"}function u(t){var e=Math.abs(t);return e>=o?f(t,e,o,"day"):e>=s?f(t,e,s,"hour"):e>=i?f(t,e,i,"minute"):e>=n?f(t,e,n,"second"):t+" ms"}function f(t,e,r,n){var i=e>=1.5*r;return Math.round(t/r)+" "+n+(i?"s":"")}e.exports=function(t,e){e=e||{};var r=typeof t;if("string"===r&&t.length>0)return c(t);if("number"===r&&isFinite(t))return e.long?u(t):l(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},{}],54:[function(t,e,r){const n=t("./lib/number-allocator.js");e.exports.NumberAllocator=n},{"./lib/number-allocator.js":55}],55:[function(t,e,r){const n=t("js-sdsl").OrderedSet,i=t("debug")("number-allocator:trace"),s=t("debug")("number-allocator:error");function o(t,e){this.low=t,this.high=e}function a(t,e){if(!(this instanceof a))return new a(t,e);this.min=t,this.max=e,this.ss=new n([],((t,e)=>t.compare(e))),i("Create"),this.clear()}o.prototype.equals=function(t){return this.low===t.low&&this.high===t.high},o.prototype.compare=function(t){return this.low<t.low&&this.high<t.low?-1:t.low<this.low&&t.high<this.low?1:0},a.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},a.prototype.alloc=function(){if(0===this.ss.size())return i("alloc():empty"),null;const t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,n=e;return n+1<=r?this.ss.updateKeyByIterator(t,new o(e+1,r)):this.ss.eraseElementByPos(0),i("alloc():"+n),n},a.prototype.use=function(t){const e=new o(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){const n=r.pointer.low,s=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),i("use():"+t),!0):!(n>t||(n===t?(this.ss.updateKeyByIterator(r,new o(n+1,s)),i("use():"+t),0):s===t?(this.ss.updateKeyByIterator(r,new o(n,s-1)),i("use():"+t),0):(this.ss.updateKeyByIterator(r,new o(t+1,s)),this.ss.insert(new o(n,t-1)),i("use():"+t),0)))}return i("use():failed"),!1},a.prototype.free=function(t){if(t<this.min||t>this.max)return void s("free():"+t+" is out of range");const e=new o(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin()))return void this.ss.insert(e);r.pre();const n=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new o(n,t)):this.ss.insert(e)}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){const e=r.pointer.high;this.ss.updateKeyByIterator(r,new o(t,e))}else this.ss.insert(e);else{const n=r.pointer.low,i=r.pointer.high;r.pre();const s=r.pointer.low;r.pointer.high+1===t?t+1===n?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new o(s,i))):this.ss.updateKeyByIterator(r,new o(s,t)):t+1===n?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new o(t,i))):this.ss.insert(e)}i("free():"+t)},a.prototype.clear=function(){i("clear()"),this.ss.clear(),this.ss.insert(new o(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.size()},a.prototype.dump=function(){console.log("length:"+this.ss.size());for(const t of this.ss)console.log(t)},e.exports=a},{debug:20,"js-sdsl":42}],56:[function(t,e,r){var n=t("wrappy");function i(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function s(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}e.exports=n(i),e.exports.strict=n(s),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})}))},{wrappy:80}],57:[function(t,e,r){(function(t){(function(){function r(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,n)}));case 4:return t.nextTick((function(){e.call(null,r,n,i)}));default:for(s=new Array(a-1),o=0;o<s.length;)s[o++]=arguments[o];return t.nextTick((function(){e.apply(null,s)}))}}void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:r}:e.exports=t}).call(this)}).call(this,t("_process"))},{_process:85}],58:[function(t,e,r){function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var i={};function s(t,e,r){function s(t,r,n){return"string"==typeof e?e:e(t,r,n)}r||(r=Error);var o=function(t){function e(e,r,n){return t.call(this,s(e,r,n))||this}return n(e,t),e}(r);o.prototype.name=r.name,o.prototype.code=t,i[t]=o}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}function a(t,e,r){return t.substr(0,e.length)===e}function h(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function c(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}s("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),s("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i;if("string"==typeof e&&a(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be",h(t," argument"))i="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var s=c(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(o(e,"type"))}return i+=". Received type ".concat(typeof r)}),TypeError),s("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),s("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),s("ERR_STREAM_PREMATURE_CLOSE","Premature close"),s("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),s("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),s("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),s("ERR_STREAM_WRITE_AFTER_END","write after end"),s("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),s("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),s("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},{}],59:[function(t,e,r){(function(r){(function(){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=c;var i=t("./_stream_readable"),s=t("./_stream_writable");t("inherits")(c,i);for(var o=n(s.prototype),a=0;a<o.length;a++){var h=o[a];c.prototype[h]||(c.prototype[h]=s.prototype[h])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),s.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||r.nextTick(u,this)}function u(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this)}).call(this,t("_process"))},{"./_stream_readable":61,"./_stream_writable":63,_process:85,inherits:24}],60:[function(t,e,r){e.exports=i;var n=t("./_stream_transform");function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}t("inherits")(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},{"./_stream_transform":62,inherits:24}],61:[function(t,e,r){(function(r,n){(function(){var i;e.exports=R,R.ReadableState=I,t("events").EventEmitter;var s=function(t,e){return t.listeners(e).length},o=t("./internal/streams/stream"),a=t("buffer").Buffer,h=n.Uint8Array||function(){};function c(t){return a.from(t)}function l(t){return a.isBuffer(t)||t instanceof h}var u,f=t("util");u=f&&f.debuglog?f.debuglog("stream"):function(){};var p,d,g,m=t("./internal/streams/buffer_list"),y=t("./internal/streams/destroy"),b=t("./internal/streams/state").getHighWaterMark,w=t("../errors").codes,_=w.ERR_INVALID_ARG_TYPE,v=w.ERR_STREAM_PUSH_AFTER_EOF,E=w.ERR_METHOD_NOT_IMPLEMENTED,S=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t("inherits")(R,o);var A=y.errorOrDestroy,C=["error","close","destroy","pause","resume"];function k(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}function I(e,r,n){i=i||t("./_stream_duplex"),e=e||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=b(this,e,"readableHighWaterMark",n),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=t("string_decoder/").StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function R(e){if(i=i||t("./_stream_duplex"),!(this instanceof R))return new R(e);var r=this instanceof i;this._readableState=new I(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function x(t,e,r,n,i){u("readableAddChunk",e);var s,o=t._readableState;if(null===e)o.reading=!1,L(t,o);else if(i||(s=M(o,e)),s)A(t,s);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=c(e)),n)o.endEmitted?A(t,new S):T(t,o,e,!0);else if(o.ended)A(t,new v);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?T(t,o,e,!1):j(t,o)):T(t,o,e,!1)}else n||(o.reading=!1,j(t,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function T(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&U(t)),j(t,e)}function M(t,e){var r;return l(e)||"string"==typeof e||void 0===e||t.objectMode||(r=new _("chunk",["string","Buffer","Uint8Array"],e)),r}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),R.prototype.destroy=y.destroy,R.prototype._undestroy=y.undestroy,R.prototype._destroy=function(t,e){e(t)},R.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=a.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},R.prototype.unshift=function(t){return x(this,t,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(e){p||(p=t("string_decoder/").StringDecoder);var r=new p(e);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var P=1073741824;function O(t){return t>=P?t=P:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function B(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=O(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function L(t,e){if(u("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?U(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,N(t)))}}function U(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(N,t))}function N(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,K(t)}function j(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(D,t,e))}function D(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(u("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function F(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,K(t))}}function q(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function W(t){u("readable nexttick read 0"),t.read(0)}function H(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(V,t,e))}function V(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),K(t),e.flowing&&!e.reading&&t.read(0)}function K(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function $(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function G(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(z,e,t))}function z(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function Y(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}R.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?G(this):U(this),null;if(0===(t=B(t,e))&&e.ended)return 0===e.length&&G(this),null;var n,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",i=!0),e.ended||e.reading?u("reading or ended",i=!1):i&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=B(r,e))),null===(n=t>0?$(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&G(this)),null!==n&&this.emit("data",n),n},R.prototype._read=function(t){A(this,new E("_read()"))},R.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var o=e&&!1===e.end||t===r.stdout||t===r.stderr?y:h;function a(t,e){u("onunpipe"),t===n&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,f())}function h(){u("onend"),t.end()}i.endEmitted?r.nextTick(o):n.once("end",o),t.on("unpipe",a);var c=F(n);t.on("drain",c);var l=!1;function f(){u("cleanup"),t.removeListener("close",g),t.removeListener("finish",m),t.removeListener("drain",c),t.removeListener("error",d),t.removeListener("unpipe",a),n.removeListener("end",h),n.removeListener("end",y),n.removeListener("data",p),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||c()}function p(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==Y(i.pipes,t))&&!l&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(e){u("onerror",e),y(),t.removeListener("error",d),0===s(t,"error")&&A(t,e)}function g(){t.removeListener("finish",m),y()}function m(){u("onfinish"),t.removeListener("close",g),y()}function y(){u("unpipe"),n.unpipe(t)}return n.on("data",p),k(t,"error",d),t.once("close",g),t.once("finish",m),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},R.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=Y(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},R.prototype.on=function(t,e){var n=o.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?U(this):i.reading||r.nextTick(W,this))),n},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(t,e){var n=o.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(q,this),n},R.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(q,this),e},R.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,H(this,t)),t.paused=!1,this},R.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s<C.length;s++)t.on(C[s],this.emit.bind(this,C[s]));return this._read=function(e){u("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(R.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=t("./internal/streams/async_iterator")),d(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),R._fromList=$,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(R.from=function(e,r){return void 0===g&&(g=t("./internal/streams/from")),g(R,e,r)})}).call(this)}).call(this,t("_process"),void 0!==$?$:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":58,"./_stream_duplex":59,"./internal/streams/async_iterator":64,"./internal/streams/buffer_list":65,"./internal/streams/destroy":66,"./internal/streams/from":68,"./internal/streams/state":70,"./internal/streams/stream":71,_process:85,buffer:3,events:4,inherits:24,"string_decoder/":78,util:2}],62:[function(t,e,r){e.exports=l;var n=t("../errors").codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,s=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,h=t("./_stream_duplex");function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new s);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(t){if(!(this instanceof l))return new l(t);h.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",u)}function u(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(e,r){f(t,e,r)}))}function f(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new a;if(t._transformState.transforming)throw new o;return t.push(null)}t("inherits")(l,h),l.prototype.push=function(t,e){return this._transformState.needTransform=!1,h.prototype.push.call(this,t,e)},l.prototype._transform=function(t,e,r){r(new i("_transform()"))},l.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},l.prototype._destroy=function(t,e){h.prototype._destroy.call(this,t,(function(t){e(t)}))}},{"../errors":58,"./_stream_duplex":59,inherits:24}],63:[function(t,e,r){(function(r,n){(function(){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){V(e,t)}}var s;e.exports=I,I.WritableState=k;var o={deprecate:t("util-deprecate")},a=t("./internal/streams/stream"),h=t("buffer").Buffer,c=n.Uint8Array||function(){};function l(t){return h.from(t)}function u(t){return h.isBuffer(t)||t instanceof c}var f,p=t("./internal/streams/destroy"),d=t("./internal/streams/state").getHighWaterMark,g=t("../errors").codes,m=g.ERR_INVALID_ARG_TYPE,y=g.ERR_METHOD_NOT_IMPLEMENTED,b=g.ERR_MULTIPLE_CALLBACK,w=g.ERR_STREAM_CANNOT_PIPE,_=g.ERR_STREAM_DESTROYED,v=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,S=g.ERR_UNKNOWN_ENCODING,A=p.errorOrDestroy;function C(){}function k(e,r,n){s=s||t("./_stream_duplex"),e=e||{},"boolean"!=typeof n&&(n=r instanceof s),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=d(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){L(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function I(e){var r=this instanceof(s=s||t("./_stream_duplex"));if(!r&&!f.call(I,this))return new I(e);this._writableState=new k(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function R(t,e){var n=new E;A(t,n),r.nextTick(e,n)}function x(t,e,n,i){var s;return null===n?s=new v:"string"==typeof n||e.objectMode||(s=new m("chunk",["string","Buffer"],n)),!s||(A(t,s),r.nextTick(i,s),!1)}function T(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r)),e}function M(t,e,r,n,i,s){if(!r){var o=T(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var h=e.length<e.highWaterMark;if(h||(e.needDrain=!0),e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else P(t,e,!1,a,n,i,s);return h}function P(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new _("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function O(t,e,n,i,s){--e.pendingcb,n?(r.nextTick(s,i),r.nextTick(W,t,e),t._writableState.errorEmitted=!0,A(t,i)):(s(i),t._writableState.errorEmitted=!0,A(t,i),W(t,e))}function B(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function L(t,e){var n=t._writableState,i=n.sync,s=n.writecb;if("function"!=typeof s)throw new b;if(B(n),e)O(t,n,i,e,s);else{var o=D(n)||t.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||j(t,n),i?r.nextTick(U,t,n,o,s):U(t,n,o,s)}}function U(t,e,r,n){r||N(t,e),e.pendingcb--,n(),W(t,e)}function N(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function j(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,s=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,h=!0;r;)s[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;s.allBuffers=h,P(t,e,!0,e.length,s,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,u=r.callback;if(P(t,e,!1,e.objectMode?1:c.length,c,l,u),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function D(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function F(t,e){t._final((function(r){e.pendingcb--,r&&A(t,r),e.prefinished=!0,t.emit("prefinish"),W(t,e)}))}function q(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(F,t,e)))}function W(t,e){var r=D(e);if(r&&(q(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}function H(t,e,n){e.ending=!0,W(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}function V(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}t("inherits")(I,a),k.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(k.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function(t){return!!f.call(this,t)||this===I&&t&&t._writableState instanceof k}})):f=function(t){return t instanceof this},I.prototype.pipe=function(){A(this,new w)},I.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&u(t);return s&&!h.isBuffer(t)&&(t=l(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=C),n.ending?R(this,r):(s||x(this,n,t,r))&&(n.pendingcb++,i=M(this,n,s,t,e,r)),i},I.prototype.cork=function(){this._writableState.corked++},I.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||j(this,t))},I.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new S(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function(t,e,r){r(new y("_write()"))},I.prototype._writev=null,I.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||H(this,n,r),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=p.destroy,I.prototype._undestroy=p.undestroy,I.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,t("_process"),void 0!==$?$:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":58,"./_stream_duplex":59,"./internal/streams/destroy":66,"./internal/streams/state":70,"./internal/streams/stream":71,_process:85,buffer:3,inherits:24,"util-deprecate":79}],64:[function(t,e,r){(function(r){(function(){var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=t("./end-of-stream"),o=Symbol("lastResolve"),a=Symbol("lastReject"),h=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),u=Symbol("handlePromise"),f=Symbol("stream");function p(t,e){return{value:t,done:e}}function d(t){var e=t[o];if(null!==e){var r=t[f].read();null!==r&&(t[l]=null,t[o]=null,t[a]=null,e(p(r,!1)))}}function g(t){r.nextTick(d,t)}function m(t,e){return function(r,n){t.then((function(){e[c]?r(p(void 0,!0)):e[u](r,n)}),n)}}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((i(n={get stream(){return this[f]},next:function(){var t=this,e=this[h];if(null!==e)return Promise.reject(e);if(this[c])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise((function(e,n){r.nextTick((function(){t[h]?n(t[h]):e(p(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(m(i,this));else{var s=this[f].read();if(null!==s)return Promise.resolve(p(s,!1));n=new Promise(this[u])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[f].destroy(null,(function(t){t?r(t):e(p(void 0,!0))}))}))})),n),y),w=function(t){var e,r=Object.create(b,(i(e={},f,{value:t,writable:!0}),i(e,o,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,h,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,u,{value:function(t,e){var n=r[f].read();n?(r[l]=null,r[o]=null,r[a]=null,t(p(n,!1))):(r[o]=t,r[a]=e)},writable:!0}),e));return r[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[a];return null!==e&&(r[l]=null,r[o]=null,r[a]=null,e(t)),void(r[h]=t)}var n=r[o];null!==n&&(r[l]=null,r[o]=null,r[a]=null,n(p(void 0,!0))),r[c]=!0})),t.on("readable",g.bind(null,r)),r};e.exports=w}).call(this)}).call(this,t("_process"))},{"./end-of-stream":67,_process:85}],65:[function(t,e,r){function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,e,r){return e&&a(t.prototype,e),t}var c=t("buffer").Buffer,l=t("util").inspect,u=l&&l.custom||"inspect";function f(t,e,r){c.prototype.copy.call(t,e,r)}e.exports=function(){function t(){o(this,t),this.head=null,this.tail=null,this.length=0}return h(t,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return c.alloc(0);for(var e=c.allocUnsafe(t>>>0),r=this.head,n=0;r;)f(r.data,e,n),n+=r.data.length,r=r.next;return e}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,s=t>i.length?i.length:t;if(s===i.length?n+=i:n+=i.slice(0,t),0==(t-=s)){s===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(s));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=c.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,s),0==(t-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return l(this,i({},e,{depth:0,customInspect:!1}))}}]),t}()},{buffer:3,util:2}],66:[function(t,e,r){(function(t){(function(){function r(e,r){var s=this,a=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return a||h?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(o,this,e)):t.nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?s._writableState?s._writableState.errorEmitted?t.nextTick(i,s):(s._writableState.errorEmitted=!0,t.nextTick(n,s,e)):t.nextTick(n,s,e):r?(t.nextTick(i,s),r(e)):t.nextTick(i,s)})),this)}function n(t,e){o(t,e),i(t)}function i(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(t,e){t.emit("error",e)}function a(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}e.exports={destroy:r,undestroy:s,errorOrDestroy:a}}).call(this)}).call(this,t("_process"))},{_process:85}],67:[function(t,e,r){var n=t("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function i(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}function s(){}function o(t){return t.setHeader&&"function"==typeof t.abort}function a(t,e,r){if("function"==typeof e)return a(t,null,e);e||(e={}),r=i(r||s);var h=e.readable||!1!==e.readable&&t.readable,c=e.writable||!1!==e.writable&&t.writable,l=function(){t.writable||f()},u=t._writableState&&t._writableState.finished,f=function(){c=!1,u=!0,h||r.call(t)},p=t._readableState&&t._readableState.endEmitted,d=function(){h=!1,p=!0,c||r.call(t)},g=function(e){r.call(t,e)},m=function(){var e;return h&&!p?(t._readableState&&t._readableState.ended||(e=new n),r.call(t,e)):c&&!u?(t._writableState&&t._writableState.ended||(e=new n),r.call(t,e)):void 0},y=function(){t.req.on("finish",f)};return o(t)?(t.on("complete",f),t.on("abort",m),t.req?y():t.on("request",y)):c&&!t._writableState&&(t.on("end",l),t.on("close",l)),t.on("end",d),t.on("finish",f),!1!==e.error&&t.on("error",g),t.on("close",m),function(){t.removeListener("complete",f),t.removeListener("abort",m),t.removeListener("request",y),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",d),t.removeListener("error",g),t.removeListener("close",m)}}e.exports=a},{"../../../errors":58}],68:[function(t,e,r){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],69:[function(t,e,r){var n;function i(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var s=t("../../../errors").codes,o=s.ERR_MISSING_ARGS,a=s.ERR_STREAM_DESTROYED;function h(t){if(t)throw t}function c(t){return t.setHeader&&"function"==typeof t.abort}function l(e,r,s,o){o=i(o);var h=!1;e.on("close",(function(){h=!0})),void 0===n&&(n=t("./end-of-stream")),n(e,{readable:r,writable:s},(function(t){if(t)return o(t);h=!0,o()}));var l=!1;return function(t){if(!h&&!l)return l=!0,c(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}function u(t){t()}function f(t,e){return t.pipe(e)}function p(t){return t.length?"function"!=typeof t[t.length-1]?h:t.pop():h}function d(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=p(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,r){var o=r<e.length-1;return l(t,o,r>0,(function(t){n||(n=t),t&&s.forEach(u),o||(s.forEach(u),i(n))}))}));return e.reduce(f)}e.exports=d},{"../../../errors":58,"./end-of-stream":67}],70:[function(t,e,r){var n=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;function i(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}function s(t,e,r,s){var o=i(e,s,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(s?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}e.exports={getHighWaterMark:s}},{"../../../errors":58}],71:[function(t,e,r){e.exports=t("events").EventEmitter},{events:4}],72:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js"),r.finished=t("./lib/internal/streams/end-of-stream.js"),r.pipeline=t("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":59,"./lib/_stream_passthrough.js":60,"./lib/_stream_readable.js":61,"./lib/_stream_transform.js":62,"./lib/_stream_writable.js":63,"./lib/internal/streams/end-of-stream.js":67,"./lib/internal/streams/pipeline.js":69}],73:[function(t,e,r){function n(t,e,r){var n=this;this._callback=t,this._args=r,this._interval=setInterval(t,e,this._args),this.reschedule=function(t){t||(t=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,t,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}function i(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e<t.length;e++)t[e]=arguments[e+2]}return new n(arguments[0],arguments[1],t)}e.exports=i},{}],74:[function(t,e,r){e.exports=t("./index.js")()},{"./index.js":75}],75:[function(t,e,r){(function(t){(function(){function r(e){return e instanceof t?t.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function n(t){return(t=t||{}).circles?i(t):t.proto?s:n;function e(t,e){for(var n=Object.keys(t),i=new Array(n.length),s=0;s<n.length;s++){var o=n[s],a=t[o];"object"!=typeof a||null===a?i[o]=a:a instanceof Date?i[o]=new Date(a):ArrayBuffer.isView(a)?i[o]=r(a):i[o]=e(a)}return i}function n(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return e(t,n);if(t instanceof Map)return new Map(e(Array.from(t),n));if(t instanceof Set)return new Set(e(Array.from(t),n));var i={};for(var s in t)if(!1!==Object.hasOwnProperty.call(t,s)){var o=t[s];"object"!=typeof o||null===o?i[s]=o:o instanceof Date?i[s]=new Date(o):o instanceof Map?i[s]=new Map(e(Array.from(o),n)):o instanceof Set?i[s]=new Set(e(Array.from(o),n)):ArrayBuffer.isView(o)?i[s]=r(o):i[s]=n(o)}return i}function s(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return e(t,s);if(t instanceof Map)return new Map(e(Array.from(t),s));if(t instanceof Set)return new Set(e(Array.from(t),s));var n={};for(var i in t){var o=t[i];"object"!=typeof o||null===o?n[i]=o:o instanceof Date?n[i]=new Date(o):o instanceof Map?n[i]=new Map(e(Array.from(o),s)):o instanceof Set?n[i]=new Set(e(Array.from(o),s)):ArrayBuffer.isView(o)?n[i]=r(o):n[i]=s(o)}return n}}function i(t){var e=[],n=[];return t.proto?o:s;function i(t,i){for(var s=Object.keys(t),o=new Array(s.length),a=0;a<s.length;a++){var h=s[a],c=t[h];if("object"!=typeof c||null===c)o[h]=c;else if(c instanceof Date)o[h]=new Date(c);else if(ArrayBuffer.isView(c))o[h]=r(c);else{var l=e.indexOf(c);o[h]=-1!==l?n[l]:i(c)}}return o}function s(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,s);if(t instanceof Map)return new Map(i(Array.from(t),s));if(t instanceof Set)return new Set(i(Array.from(t),s));var o={};for(var a in e.push(t),n.push(o),t)if(!1!==Object.hasOwnProperty.call(t,a)){var h=t[a];if("object"!=typeof h||null===h)o[a]=h;else if(h instanceof Date)o[a]=new Date(h);else if(h instanceof Map)o[a]=new Map(i(Array.from(h),s));else if(h instanceof Set)o[a]=new Set(i(Array.from(h),s));else if(ArrayBuffer.isView(h))o[a]=r(h);else{var c=e.indexOf(h);o[a]=-1!==c?n[c]:s(h)}}return e.pop(),n.pop(),o}function o(t){if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,o);if(t instanceof Map)return new Map(i(Array.from(t),o));if(t instanceof Set)return new Set(i(Array.from(t),o));var s={};for(var a in e.push(t),n.push(s),t){var h=t[a];if("object"!=typeof h||null===h)s[a]=h;else if(h instanceof Date)s[a]=new Date(h);else if(h instanceof Map)s[a]=new Map(i(Array.from(h),o));else if(h instanceof Set)s[a]=new Set(i(Array.from(h),o));else if(ArrayBuffer.isView(h))s[a]=r(h);else{var c=e.indexOf(h);s[a]=-1!==c?n[c]:o(h)}}return e.pop(),n.pop(),s}}e.exports=n}).call(this)}).call(this,t("buffer").Buffer)},{buffer:3}],76:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:3}],77:[function(t,e,r){function n(t){var e=t._readableState;return e?e.objectMode||"number"==typeof t._duplexState?t.read():t.read(i(e)):null}function i(t){return t.buffer.length?t.buffer.head?t.buffer.head.data.length:t.buffer[0].length:t.length}e.exports=n},{}],78:[function(t,e,r){var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function o(t){var e=s(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}function a(t){var e;switch(this.encoding=o(t),this.encoding){case"utf16le":this.text=d,this.end=g,e=4;break;case"utf8":this.fillLast=u,e=4;break;case"base64":this.text=m,this.end=y,e=3;break;default:return this.write=b,void(this.end=w)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function h(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function c(t,e,r){var n=e.length-1;if(n<r)return 0;var i=h(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||-2===i?0:(i=h(e[n]))>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||-2===i?0:(i=h(e[n]))>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}function l(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}function u(t){var e=this.lastTotal-this.lastNeed,r=l(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function f(t,e){var r=c(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function p(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function d(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function g(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function m(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function y(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function b(t){return t.toString(this.encoding)}function w(t){return t&&t.length?this.write(t):""}r.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},a.prototype.end=p,a.prototype.text=f,a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":76}],79:[function(t,e,r){(function(t){(function(){function r(t,e){if(n("noDeprecation"))return t;var r=!1;function i(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return i}function n(e){try{if(!t.localStorage)return!1}catch(n){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=r}).call(this)}).call(this,void 0!==$?$:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],80:[function(t,e,r){function n(t,e){if(t&&e)return n(t)(e);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){r[e]=t[e]})),r;function r(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var n=t.apply(this,e),i=e[e.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach((function(t){n[t]=i[t]})),n}}e.exports=n},{}],81:[function(t,e,r){e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],82:[function(t,e,r){e.exports=i;var n=Object.prototype.hasOwnProperty;function i(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var i in r)n.call(r,i)&&(t[i]=r[i])}return t}},{}],83:[function(t,e,r){e.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},{}],84:[function(t,e,r){function n(t){var e=this;if(e instanceof n||(e=new n),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)e.push(arguments[r]);return e}function i(t,e,r){var n=e===t.head?new a(r,null,e,t):new a(r,e,e.next,t);return null===n.next&&(t.tail=n),null===n.prev&&(t.head=n),t.length++,n}function s(t,e){t.tail=new a(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function o(t,e){t.head=new a(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function a(t,e,r,n){if(!(this instanceof a))return new a(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=n,n.Node=a,n.create=n,n.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},n.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},n.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},n.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)s(this,arguments[t]);return this.length},n.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)o(this,arguments[t]);return this.length},n.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},n.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},n.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;null!==r;n++)t.call(e,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;null!==r;n--)t.call(e,r.value,n,this),r=r.prev},n.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},n.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},n.prototype.map=function(t,e){e=e||this;for(var r=new n,i=this.head;null!==i;)r.push(t.call(e,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(t,e){e=e||this;for(var r=new n,i=this.tail;null!==i;)r.push(t.call(e,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=t(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=t(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},n.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},n.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=0,s=this.head;null!==s&&i<t;i++)s=s.next;for(;null!==s&&i<e;i++,s=s.next)r.push(s.value);return r},n.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=this.length,s=this.tail;null!==s&&i>e;i--)s=s.prev;for(;null!==s&&i>t;i--,s=s.prev)r.push(s.value);return r},n.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,s=this.head;null!==s&&n<t;n++)s=s.next;var o=[];for(n=0;s&&n<e;n++)o.push(s.value),s=this.removeNode(s);for(null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev),n=0;n<r.length;n++)s=i(this,s,r[n]);return o},n.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};try{t("./iterator.js")(n)}catch(h){}},{"./iterator.js":83}],85:[function(t,e,r){var n,i,s=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function h(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(r){return n.call(this,t,0)}}}function c(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(e){try{return i.call(null,t)}catch(r){return i.call(this,t)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var l,u=[],f=!1,p=-1;function d(){f&&l&&(f=!1,l.length?u=l.concat(u):p=-1,u.length&&g())}function g(){if(!f){var t=h(d);f=!0;for(var e=u.length;e;){for(l=u,u=[];++p<e;)l&&l[p].run();p=-1,e=u.length}l=null,f=!1,c(t)}}function m(t,e){this.fun=t,this.array=e}function y(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new m(t,e)),1!==u.length||f||h(g)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=y,s.addListener=y,s.once=y,s.off=y,s.removeListener=y,s.removeAllListeners=y,s.emit=y,s.prependListener=y,s.prependOnceListener=y,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],86:[function(t,e,r){(function(t){(function(){!function(n){var i="object"==typeof r&&r&&!r.nodeType&&r,s="object"==typeof e&&e&&!e.nodeType&&e,o="object"==typeof t&&t;o.global!==o&&o.window!==o&&o.self!==o||(n=o);var a,h,c=2147483647,l=36,u=1,f=26,p=38,d=700,g=72,m=128,y="-",b=/^xn--/,w=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=l-u,S=Math.floor,A=String.fromCharCode;function C(t){throw new RangeError(v[t])}function k(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function I(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+k((t=t.replace(_,".")).split("."),e).join(".")}function R(t){for(var e,r,n=[],i=0,s=t.length;i<s;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<s?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function x(t){return k(t,(function(t){var e="";return t>65535&&(e+=A((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=A(t)})).join("")}function T(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:l}function M(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function P(t,e,r){var n=0;for(t=r?S(t/d):t>>1,t+=S(t/e);t>E*f>>1;n+=l)t=S(t/E);return S(n+(E+1)*t/(t+p))}function O(t){var e,r,n,i,s,o,a,h,p,d,b=[],w=t.length,_=0,v=m,E=g;for((r=t.lastIndexOf(y))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&C("not-basic"),b.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<w;){for(s=_,o=1,a=l;i>=w&&C("invalid-input"),((h=T(t.charCodeAt(i++)))>=l||h>S((c-_)/o))&&C("overflow"),_+=h*o,!(h<(p=a<=E?u:a>=E+f?f:a-E));a+=l)o>S(c/(d=l-p))&&C("overflow"),o*=d;E=P(_-s,e=b.length+1,0==s),S(_/e)>c-v&&C("overflow"),v+=S(_/e),_%=e,b.splice(_++,0,v)}return x(b)}function B(t){var e,r,n,i,s,o,a,h,p,d,b,w,_,v,E,k=[];for(w=(t=R(t)).length,e=m,r=0,s=g,o=0;o<w;++o)(b=t[o])<128&&k.push(A(b));for(n=i=k.length,i&&k.push(y);n<w;){for(a=c,o=0;o<w;++o)(b=t[o])>=e&&b<a&&(a=b);for(a-e>S((c-r)/(_=n+1))&&C("overflow"),r+=(a-e)*_,e=a,o=0;o<w;++o)if((b=t[o])<e&&++r>c&&C("overflow"),b==e){for(h=r,p=l;!(h<(d=p<=s?u:p>=s+f?f:p-s));p+=l)E=h-d,v=l-d,k.push(A(M(d+E%v,0))),h=S(E/v);k.push(A(M(h,0))),s=P(r,_,n==i),r=0,++n}++r,++e}return k.join("")}function L(t){return I(t,(function(t){return b.test(t)?O(t.slice(4).toLowerCase()):t}))}function U(t){return I(t,(function(t){return w.test(t)?"xn--"+B(t):t}))}if(a={version:"1.4.1",ucs2:{decode:R,encode:x},decode:O,encode:B,toASCII:U,toUnicode:L},i&&s)if(e.exports==i)s.exports=a;else for(h in a)a.hasOwnProperty(h)&&(i[h]=a[h]);else n.punycode=a}(this)}).call(this)}).call(this,void 0!==$?$:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],87:[function(t,e,r){function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,s){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var h=1e3;s&&"number"==typeof s.maxKeys&&(h=s.maxKeys);var c=t.length;h>0&&c>h&&(c=h);for(var l=0;l<c;++l){var u,f,p,d,g=t[l].replace(a,"%20"),m=g.indexOf(r);m>=0?(u=g.substr(0,m),f=g.substr(m+1)):(u=g,f=""),p=decodeURIComponent(u),d=decodeURIComponent(f),n(o,p)?i(o[p])?o[p].push(d):o[p]=[o[p],d]:o[p]=d}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],88:[function(t,e,r){var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?s(o(t),(function(o){var a=encodeURIComponent(n(o))+r;return i(t[o])?s(t[o],(function(t){return a+encodeURIComponent(n(t))})).join(e):a+encodeURIComponent(n(t[o]))})).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function s(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var o=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],89:[function(t,e,r){r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":87,"./encode":88}],90:[function(t,e,r){var n=t("punycode"),i=t("./util");function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=_,r.resolve=E,r.resolveObject=S,r.format=v,r.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),u=["%","/","?",";","#"].concat(l),f=["/","?","#"],p=255,d=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=t("querystring");function _(t,e,r){if(t&&i.isObject(t)&&t instanceof s)return t;var n=new s;return n.parse(t,e,r),n}function v(t){return i.isString(t)&&(t=_(t)),t instanceof s?t.format():s.prototype.format.call(t)}function E(t,e){return _(t,!1,!0).resolve(e)}function S(t,e){return t?_(t,!1,!0).resolveObject(e):e}s.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),a=-1!==s&&s<t.indexOf("#")?"?":"#",c=t.split(a),_=/\\/g;c[0]=c[0].replace(_,"/");var v=t=c.join(a);if(v=v.trim(),!r&&1===t.split("#").length){var E=h.exec(v);if(E)return this.path=v,this.href=v,this.pathname=E[1],E[2]?(this.search=E[2],this.query=e?w.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var S=o.exec(v);if(S){var A=(S=S[0]).toLowerCase();this.protocol=A,v=v.substr(S.length)}if(r||S||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var C="//"===v.substr(0,2);!C||S&&y[S]||(v=v.substr(2),this.slashes=!0)}if(!y[S]&&(C||S&&!b[S])){for(var k,I,R=-1,x=0;x<f.length;x++)-1!==(T=v.indexOf(f[x]))&&(-1===R||T<R)&&(R=T);for(-1!==(I=-1===R?v.lastIndexOf("@"):v.lastIndexOf("@",R))&&(k=v.slice(0,I),v=v.slice(I+1),this.auth=decodeURIComponent(k)),R=-1,x=0;x<u.length;x++){var T;-1!==(T=v.indexOf(u[x]))&&(-1===R||T<R)&&(R=T)}-1===R&&(R=v.length),this.host=v.slice(0,R),v=v.slice(R),this.parseHost(),this.hostname=this.hostname||"";var M="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!M)for(var P=this.hostname.split(/\./),O=(x=0,P.length);x<O;x++){var B=P[x];if(B&&!B.match(d)){for(var L="",U=0,N=B.length;U<N;U++)B.charCodeAt(U)>127?L+="x":L+=B[U];if(!L.match(d)){var j=P.slice(0,x),D=P.slice(x+1),F=B.match(g);F&&(j.push(F[1]),D.unshift(F[2])),D.length&&(v="/"+D.join(".")+v),this.hostname=j.join(".");break}}}this.hostname.length>p?this.hostname="":this.hostname=this.hostname.toLowerCase(),M||(this.hostname=n.toASCII(this.hostname));var q=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+q,this.href+=this.host,M&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!m[A])for(x=0,O=l.length;x<O;x++){var H=l[x];if(-1!==v.indexOf(H)){var V=encodeURIComponent(H);V===H&&(V=escape(H)),v=v.split(H).join(V)}}var K=v.indexOf("#");-1!==K&&(this.hash=v.substr(K),v=v.slice(0,K));var $=v.indexOf("?");if(-1!==$?(this.search=v.substr($),this.query=v.substr($+1),e&&(this.query=w.parse(this.query)),v=v.slice(0,$)):e&&(this.search="",this.query={}),v&&(this.pathname=v),b[A]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){q=this.pathname||"";var G=this.search||"";this.path=q+G}return this.href=this.format(),this},s.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",s=!1,o="";this.host?s=t+this.host:this.hostname&&(s=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(o=w.stringify(this.query));var a=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||b[e])&&!1!==s?(s="//"+(s||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):s||(s=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),e+s+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+n},s.prototype.resolve=function(t){return this.resolveObject(_(t,!1,!0)).format()},s.prototype.resolveObject=function(t){if(i.isString(t)){var e=new s;e.parse(t,!1,!0),t=e}for(var r=new s,n=Object.keys(this),o=0;o<n.length;o++){var a=n[o];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var h=Object.keys(t),c=0;c<h.length;c++){var l=h[c];"protocol"!==l&&(r[l]=t[l])}return b[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!b[t.protocol]){for(var u=Object.keys(t),f=0;f<u.length;f++){var p=u[f];r[p]=t[p]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||y[t.protocol])r.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var g=r.pathname||"",m=r.search||"";r.path=g+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var w=r.pathname&&"/"===r.pathname.charAt(0),_=t.host||t.pathname&&"/"===t.pathname.charAt(0),v=_||w||r.host&&t.pathname,E=v,S=r.pathname&&r.pathname.split("/")||[],A=(d=t.pathname&&t.pathname.split("/")||[],r.protocol&&!b[r.protocol]);if(A&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),v=v&&(""===d[0]||""===S[0])),_)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=d;else if(d.length)S||(S=[]),S.pop(),S=S.concat(d),r.search=t.search,r.query=t.query;else if(!i.isNullOrUndefined(t.search))return A&&(r.hostname=r.host=S.shift(),(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift())),r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var C=S.slice(-1)[0],k=(r.host||t.host||S.length>1)&&("."===C||".."===C)||""===C,I=0,R=S.length;R>=0;R--)"."===(C=S[R])?S.splice(R,1):".."===C?(S.splice(R,1),I++):I&&(S.splice(R,1),I--);if(!v&&!E)for(;I--;I)S.unshift("..");!v||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),k&&"/"!==S.join("/").substr(-1)&&S.push("");var x,T=""===S[0]||S[0]&&"/"===S[0].charAt(0);return A&&(r.hostname=r.host=T?"":S.length?S.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift())),(v=v||r.host&&S.length)&&!T&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":91,punycode:86,querystring:89}],91:[function(t,e,r){e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}]},{},[17])(17);var Y=z.exports;const Q=class t extends D{constructor(e=`ws://${window.document.domain}:20007/mqtt`,r={}){super(),n(this,"state"),n(this,"url"),n(this,"context"),n(this,"options"),n(this,"client"),n(this,"topics"),n(this,"_timer"),this.context=d.assign(t.defaultContext,r),this.options={connectTimeout:this.context.MQTT_TIMEOUTM,clientId:p.guid(),username:this.context.MQTT_USERNAME,password:this.context.MQTT_PASSWORD,clean:!0,rejectUnauthorized:this.context.REJECT_UNAUTHORIZED},this.url=e,this.client=Y.connect(this.url,this.options);let s=0;this._timer=setInterval((()=>{s++,this.client.connected||(this.state=3,this.dispatchEvent({type:i.MQTT_ERROR,message:this}),this.client.end()),s>this.context.MQTT_MAX_RETRY&&(clearInterval(this._timer),this._onError())}),this.context.MQTT_TIMEOUTM),this._onConnect(),this._onMessage(),this.state=1,this.topics=[]}_onConnect(){this.client.on("connect",(()=>{this.state=2,clearInterval(this._timer),console.log("链接mqtt成功==>"+this.url),this.dispatchEvent({type:i.MQTT_CONNECT,message:this})})),this.client.on("error",this._onError)}_onError(){f.throwException("链接mqtt失败==>"+this.url),this.state=0,this.client.end()}_onMessage(){this.client.on("message",((t,e)=>{let r=e,n="";e instanceof Uint8Array&&(r=e.toString());try{n=d.parse(r)}catch(o){throw new Error(s.DATA_ERROR_JSON)}this.dispatchEvent({type:i.MQTT_MESSAGE,message:{topic:t,data:n}})}))}sendMsg(t,e){if(this.client.connected)return this.client.publish(t,e,{qos:1,retain:!0}),this;console.error("客户端未连接")}subscribe(t){return 2===this.state?this.client.subscribe(t,{qos:1},((e,r)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=C.union(this.topics,t),console.log("订阅成功==>"+t))})):this.addEventListener(i.MQTT_CONNECT,(e=>{this.client.subscribe(t,{qos:1},((e,r)=>{e instanceof Error?console.error("订阅失败==>"+t,e):(this.topics=C.union(this.topics,t),console.log("订阅成功==>"+t))}))})),this}unsubscribe(t){return this.client.unsubscribe(t,{qos:1},((e,r)=>{e instanceof Error?console.error(`取消订阅失败==>${t}`,e):(this.topics=C.difference(this.topics,t),console.log(`取消订阅成功==>${t}`))})),this}unsubscribeAll(){return this.unsubscribe(this.topics),this}unconnect(){this.client.end(),this.client=null,this.dispatchEvent({type:i.MQTT_CLOSE,message:{}}),console.log("断开mqtt成功==>"+this.url)}};n(Q,"defaultContext",{MQTT_TIMEOUTM:2e3,MQTT_MAX_RETRY:3,REJECT_UNAUTHORIZED:!0});let J=Q;const X=class t{static setLocal(t,e=null,r={}){var n=this._getPrefixedKey(t,r);try{const{expires:t}=r,i={data:e};t&&(i.expires=t),window.localStorage.setItem(n,JSON.stringify(i))}catch(i){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static setSession(t,e=null,r={}){var n=this._getPrefixedKey(t,r);try{const{expires:t}=r,i={data:e};t&&(i.expires=t),window.sessionStorage.setItem(n,JSON.stringify(i))}catch(i){console&&console.warn(`Storage didn't successfully save the '{"${t}": "${e}"}' pair, because the Storage is full.`)}}static getLocal(t,e,r){var n,i=this._getPrefixedKey(t,r);try{n=JSON.parse(window.localStorage.getItem(i)||"")}catch(s){n=window.localStorage[i]?{data:window.localStorage.getItem(i)}:null}if(!n)return e;if("object"==typeof n&&void 0!==n.data){const t=n.expires;return t&&Date.now()>t?e:n.data}}static getSession(t,e,r){var n,i=this._getPrefixedKey(t,r);try{n=JSON.parse(window.sessionStorage.getItem(i)||"")}catch(s){n=window.sessionStorage[i]?{data:window.sessionStorage.getItem(i)}:null}if(!n)return e;if("object"==typeof n&&void 0!==n.data){const t=n.expires;return t&&Date.now()>t?e:n.data}}static localkeys(){const e=[];var r=Object.keys(window.localStorage);return 0===t.prefix.length?r:(r.forEach((function(r){-1!==r.indexOf(t.prefix)&&e.push(r.replace(t.prefix,""))})),e)}static sessionkeys(){const e=[];var r=Object.keys(window.sessionStorage);return 0===t.prefix.length?r:(r.forEach((function(r){-1!==r.indexOf(t.prefix)&&e.push(r.replace(t.prefix,""))})),e)}static getAllLocal(e){var r=t.localkeys();if(e){const n=[];return r.forEach((r=>{if(e.includes(r)){const e={};e[r]=t.getLocal(r,null,null),n.push(e)}})),n}return r.map((e=>t.getLocal(e,null,null)))}static getAllSession(e){var r=t.sessionkeys();if(e){const n=[];return r.forEach((r=>{if(e.includes(r)){const e={};e[r]=t.getSession(r,null,null),n.push(e)}})),n}return r.map((e=>t.getSession(e,null,null)))}static remove(t,e){var r=this._getPrefixedKey(t,e);window.sessionStorage.removeItem(r),window.localStorage.removeItem(r)}static clearLocal(e){t.prefix.length?this.localkeys().forEach((t=>{window.localStorage.removeItem(this._getPrefixedKey(t,e))})):window.localStorage.clear()}static clearSession(e){t.prefix.length?this.sessionkeys().forEach((t=>{window.sessionStorage.removeItem(this._getPrefixedKey(t,e))})):window.sessionStorage.clear()}};n(X,"prefix",""),n(X,"_getPrefixedKey",(function(t,e){return(e=e||{}).noPrefix?t:X.prefix+t}));let Z=X;t.AjaxUtil=m,t.ArrayUtil=C,t.AssertUtil=S,t.AudioPlayer=class{constructor(t){n(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}},t.BrowserUtil=k,t.CanvasDrawer=N,t.CaseType=h,t.Color=_,t.Cookie=class{static set(t,e,r){"string"==typeof t&&"string"==typeof e||f.throwException("Invalid arguments");let n=`${t}=${encodeURIComponent(e)}`;if(null!=r){const t=new Date;t.setTime(t.getTime()+24*r*60*60*1e3),n+=`;expires=${t.toUTCString()}`}document.cookie=n}static remove(t){var e=new Date;e.setTime(e.getTime()-1);var r=this.get(t);null!=r&&(document.cookie=t+"="+r+";expires="+e.toUTCString())}static get(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},t.CoordsUtil=I,t.DateTime=j,t.DomUtil=x,t.ErrorType=s,t.EventDispatcher=D,t.EventType=i,t.ExceptionUtil=f,t.FileUtil=T,t.FormType=a,t.FullScreen=V,t.GeoJsonUtil=E,t.GeoUtil=b,t.GraphicType=c,t.HashMap=K,t.ImageUtil=g,t.LayerType=o,t.LineSymbol=l,t.MathUtil=y,t.MeasureMode=u,t.MessageUtil=M,t.MqttClient=J,t.ObjectUtil=d,t.OptimizeUtil=P,t.Storage=Z,t.StringUtil=O,t.TreeUtil=B,t.UrlUtil=L,t.Util=p,t.ValidateUtil=U,t.WebGL=class{constructor(t){if(n(this,"ctx"),"string"==typeof t&&!(t=document.querySelector("#"+t)))throw new Error("Element not found");if(!(t instanceof HTMLElement))throw new Error("Element is not an HTMLElement");{const e=t;if(!e.getContext)throw new Error("getContext is not available on this element");if(this.ctx=e.getContext("webgl"),!this.ctx)throw new Error("WebGL cannot be initialized. Your browser may not support WebGL")}}initShaders(t,e,r){var n=this.createProgram(t,e,r);return n?(t.useProgram(n),!0):(console.log("Failed to create program"),!1)}createProgram(t,e,r){var n=this.loadShader(t,t.VERTEX_SHADER,e),i=this.loadShader(t,t.FRAGMENT_SHADER,r);if(!n||!i)return null;var s=t.createProgram();if(!s)return null;if(t.attachShader(s,n),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS)){var o=t.getProgramInfoLog(s);return console.log("Failed to link program: "+o),t.deleteProgram(s),t.deleteShader(i),t.deleteShader(n),null}return s}loadShader(t,e,r){var n=t.createShader(e);if(null==n)return console.log("unable to create shader"),null;if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);return f.throwException("Failed to compile shader: "+i),t.deleteShader(n),null}return n}},t.WebSocketClient=class extends D{constructor(t="ws://127.0.0.1:10088"){super(),n(this,"maxCheckTimes",10),n(this,"url"),n(this,"checkTimes",0),n(this,"connectStatus",!1),n(this,"client",null),this.maxCheckTimes=10,this.url=t,this.checkTimes=0,this.connect(),this.connCheckStatus(this.maxCheckTimes)}connect(){if(this.disconnect(),this.url)try{const t=this;console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client&&(this.client.onopen=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:i.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:i.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:i.WEB_SOCKET_ERROR,message:e})}))}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}disconnect(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}connCheckStatus(t){this.checkTimes>t||setTimeout((()=>{this.checkTimes++,this.state!==WebSocket.CONNECTING&&this.state!==WebSocket.OPEN&&this.connect(),this.connCheckStatus(t)}),2e3)}send(t){return this.client&&this.state===WebSocket.OPEN?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),this)}heartbeat(){setTimeout((()=>{this.state===WebSocket.OPEN&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)}),1e3)}get state(){var t;return null==(t=this.client)?void 0:t.readyState}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|