diff --git a/package.json b/package.json index 0ca78120..4eefc2db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "1.0.90", + "version": "1.0.91", "keywords": [ "Remote Device Management", "Remote Device Monitoring", @@ -37,27 +37,19 @@ "sample-config-advanced.json" ], "dependencies": { - "@yetzt/nedb": "^1.8.0", "archiver": "^5.3.1", "body-parser": "^1.19.0", "cbor": "~5.2.0", "compression": "^1.7.4", "cookie-session": "^1.4.0", - "discord.js": "^14.6.0", "express": "^4.17.0", "express-handlebars": "^5.3.5", "express-ws": "^4.0.0", - "input": "^1.0.1", "ipcheck": "^0.1.0", - "loadavg-windows": "^1.1.1", "minimist": "^1.2.5", "multiparty": "^4.2.1", - "mysql": "^2.18.1", + "@yetzt/nedb": "^1.8.0", "node-forge": "^1.0.0", - "node-windows": "^0.1.4", - "otplib": "^10.2.3", - "ssh2": "^1.11.0", - "telegram": "^2.13.6", "ws": "^5.2.3", "yauzl": "^2.10.0" }, diff --git a/public/scripts/agent-desktop-0.0.2-min.js b/public/scripts/agent-desktop-0.0.2-min.js index baf22455..86fcbd29 100644 --- a/public/scripts/agent-desktop-0.0.2-min.js +++ b/public/scripts/agent-desktop-0.0.2-min.js @@ -1 +1 @@ -Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(e,t){return new Uint8Array(Array.prototype.slice.call(this,e,t))}});var CreateAgentRemoteDesktop=function(e,t){var p={},S=("string"==typeof(p.CanvasId=e)&&(p.CanvasId=Q(e)),p.Canvas=p.CanvasId.getContext("2d"),p.scrolldiv=t,p.State=0,p.PendingOperations=[],p.tilesReceived=0,p.TilesDrawn=0,p.KillDraw=0,p.ipad=!1,p.tabletKeyboardVisible=!1,p.LastX=0,p.LastY=0,p.touchenabled=0,p.submenuoffset=0,p.touchtimer=null,p.TouchArray={},p.connectmode=0,p.connectioncount=0,p.rotation=0,p.protocol=2,p.debugmode=0,p.firstUpKeys=[],p.stopInput=!1,p.localKeyMap=!0,p.remoteKeyMap=!1,p.pressedKeys=[],p.sessionid=0,p.username,p.oldie=!1,p.ImageType=1,p.CompressionLevel=50,p.ScalingLevel=1024,p.FrameRateTimer=100,p.SwapMouse=!1,p.UseExtendedKeyFlag=!0,p.FirstDraw=!1,p.onRemoteInputLockChanged=null,p.RemoteInputLock=null,p.onKeyboardStateChanged=null,p.KeyboardState=0,p.ScreenWidth=960,p.ScreenHeight=701,p.width=960,p.height=960,p.displays=null,p.selectedDisplay=null,p.onScreenSizeChange=null,p.onMessage=null,p.onConnectCountChanged=null,p.onDebugMessage=null,p.onTouchEnabledChanged=null,p.onDisplayinfo=null,!(p.accumulator=null)),v="default",C=(p.mouseCursorActive=function(e){S!=e&&(S=e,p.CanvasId.style.cursor=1==e?v:"default")},["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none","not-allowed","col-resize","row-resize","copy","zoom-in","zoom-out"]),a=(p.Start=function(){p.State=0,p.accumulator=null},p.Stop=function(){p.setRotation(0),p.UnGrabKeyInput(),p.UnGrabMouseInput(),p.touchenabled=0,null!=p.onScreenSizeChange&&p.onScreenSizeChange(p,p.ScreenWidth,p.ScreenHeight,p.CanvasId),p.Canvas.clearRect(0,0,p.CanvasId.width,p.CanvasId.height)},p.xxStateChange=function(e){p.State!=e&&(p.State=e,p.CanvasId.style.cursor="default",0===e&&p.Stop())},p.send=function(e){2
=d.script.length&&(d.state=0,d.stop()),d.onStep&&d.onStep(d),d}},d.xxStepDialogOk=function(e){d.variables.DialogSelect=e,d.state=1,d.dialog=!1,d.onStep&&d.onStep(d)},d.xxWsmanReturnFix=function(e){e&&null!=e&&(e.Header&&(e.Header=e.Header,delete e.Header),e.Body&&(e.Body=e.Body,delete e.Body),e.Responses&&(e.Responses=e.Responses,delete e.Responses),e.Response&&(e.Response=e.Response,delete e.Response),e.ReturnValueStr)&&(e.ReturnValueStr=e.ReturnValueStr,delete e.ReturnValueStr)},d.xxWsmanReturn=function(e,t,r,n){if(r)for(var a in d.xxWsmanReturnFix(r),r)for(var s in d.xxWsmanReturnFix(r[a]),r[a])d.xxWsmanReturnFix(r[a][s]);d.setVar(t,r),d.setVar("wsman_result",n),d.setVar("wsman_result_str",httpErrorTable[n]||"Error #"+n),d.state=1,d.onStep&&d.onStep(d)},d.xxSignWithDummyCaReturn=function(e){d.setVar("signed_cert",btoa(_arrayBufferToString(e))),d.state=1,d.onStep&&d.onStep(d)},d.toString=function(e){return"object"==typeof e?JSON.stringify(e):e},d.reset(),d)}function script_compile(e,t){var r,n="",a=e.split("\n"),s={},o=[],i=[];for(r in a){var l=a[r];if(l.startsWith("##SWAP ")&&3==(c=l.split(" ")).length&&(i[c[1]]=c[2]),"#"!=l[0]&&0!=l.length){for(var c in i)l=l.split(c).join(i[c]);var u=l.match(/"[^"]*"|[^\s"]+/g);if(0!=u.length)if(":"==l[0])s[u[0].toUpperCase()]=n.length;else{var p=script_functionTable1.indexOf(u[0].toLowerCase());if(-1==p&&0<=(p=script_functionTable2.indexOf(u[0].toLowerCase()))&&(p+=1e4),-1==p&&0<=(p=script_functionTable3.indexOf(u[0].toLowerCase()))&&(p+=2e4),-1==p)return t&&t("Unabled to compile, unknown command: "+u[0]),"";var d,h,b=ShortToStr(u.length-1);for(d in u)0!=d&&(":"==u[d][0]?(o.push([u[d],n.length+b.length+7]),b+=ShortToStr(5)+String.fromCharCode(3)+IntToStr(4294967295)):(h=parseInt(u[d]))==u[d]?b+=ShortToStr(5)+String.fromCharCode(2)+IntToStr(h):'"'==u[d][0]&&'"'==u[d][u[d].length-1]?b+=ShortToStr(u[d].length-1)+String.fromCharCode(1)+u[d].substring(1,u[d].length-1):b+=ShortToStr(u[d].length+1)+String.fromCharCode(0)+u[d]);n+=b=ShortToStr(p)+ShortToStr(b.length+4)+b}}}for(r in o){var f=o[r][0].toUpperCase(),g=o[r][1],S=s[f];if(null==S)return t&&t("Unabled to compile, unknown label: "+f),"";n=n.substr(0,g)+IntToStr(S)+n.substr(g+4)}return IntToStr(612182341)+ShortToStr(1)+n}function script_decompile(e,t){var r="",n=6,a={};if(0<=t)n=t;else{if(e.length<6)return"# Invalid script length";var s=ReadInt(e,0),o=ReadShort(e,4);if(612182341!=s)return"# Invalid binary script: "+s;if(1!=o)return"# Invalid script version"}for(;n >=-p,p+=i;0 >3,n=this.ea;this.type=7&i,t(r,e,this),this.ea===n&&this.mq(i)}return e},yp:function(){var t=o(this.lc,this.ea,!0,23,4);return this.ea+=4,t},up:function(){var t=o(this.lc,this.ea,!0,52,8);return this.ea+=8,t},Ka:function(t){var e=this.lc,o=e[this.ea++],i=127&o;if(o<128)return i;if(i|=(127&(o=e[this.ea++]))<<7,o<128)return i;if(i|=(127&(o=e[this.ea++]))<<14,o<128)return i;if(i|=(127&(o=e[this.ea++]))<<21,o<128)return i;var o=i|(15&e[this.ea])<<28,i=t,e=this,t=e.lc,r=t[e.ea++],n=(112&r)>>4;if(r<128)return s(o,n,i);if(n|=(127&(r=t[e.ea++]))<<3,r<128)return s(o,n,i);if(n|=(127&(r=t[e.ea++]))<<10,r<128)return s(o,n,i);if(n|=(127&(r=t[e.ea++]))<<17,r<128)return s(o,n,i);if(n|=(127&(r=t[e.ea++]))<<24,r<128)return s(o,n,i);if((r=t[e.ea++])<128)return s(o,n|(1&r)<<31,i);throw Error("Expected varint not more than 10 bytes")},Kp:function(){return this.Ka(!0)},ce:function(){var t=this.Ka();return 1==t%2?(t+1)/-2:t/2},sp:function(){return!!this.Ka()},Gg:function(){for(var t=this.Ka()+this.ea,e=this.lc,o="",i=this.ea;i OpenStreetMap >=-p,p+=i;0 >3,n=this.ea;this.type=7&i,t(r,e,this),this.ea===n&&this.mq(i)}return e},yp:function(){var t=Uy(this.lc,this.ea,!0,23,4);return this.ea+=4,t},up:function(){var t=Uy(this.lc,this.ea,!0,52,8);return this.ea+=8,t},Ka:function(t){var e=this.lc,o=e[this.ea++],i=127&o;if(o<128)return i;if(i|=(127&(o=e[this.ea++]))<<7,o<128)return i;if(i|=(127&(o=e[this.ea++]))<<14,o<128)return i;if(i|=(127&(o=e[this.ea++]))<<21,o<128)return i;var o=i|(15&e[this.ea])<<28,i=t,e=this,t=e.lc,r=t[e.ea++],n=(112&r)>>4;if(r<128)return $y(o,n,i);if(n|=(127&(r=t[e.ea++]))<<3,r<128)return $y(o,n,i);if(n|=(127&(r=t[e.ea++]))<<10,r<128)return $y(o,n,i);if(n|=(127&(r=t[e.ea++]))<<17,r<128)return $y(o,n,i);if(n|=(127&(r=t[e.ea++]))<<24,r<128)return $y(o,n,i);if((r=t[e.ea++])<128)return $y(o,n|(1&r)<<31,i);throw Error("Expected varint not more than 10 bytes")},Kp:function(){return this.Ka(!0)},ce:function(){var t=this.Ka();return 1==t%2?(t+1)/-2:t/2},sp:function(){return!!this.Ka()},Gg:function(){for(var t=this.Ka()+this.ea,e=this.lc,o="",i=this.ea;i OpenStreetMapl[1]&&(m.recordLineTobackBuffer(0),x(1),T=l[1]),m.lineFeed="\r",S=0;break;case"\r":S=0;break;default:S>=m.width&&(S=0,C&&T++,T>=m.height-1&&(x(1),T=m.height-1)),o(e),S++}}}function o(e){y[T][S]=e,p[T][S]=(u<<6)+(w<<12)+g}function L(){for(var e=(u<<6)+(w<<12)+g,r=S;rl[1]&&(m.recordLineTobackBuffer(0),x(1),T=l[1]),m.lineFeed="\r",S=0;break;case"\r":S=0;break;default:S>=m.width&&(S=0,C&&T++,T>=m.height-1)&&(x(1),T=m.height-1),o(e),S++}}}function o(e){y[T][S]=e,p[T][S]=(u<<6)+(w<<12)+g}function L(){for(var e=(u<<6)+(w<<12)+g,r=S;r"+s[r][n].toString()+""+s[r][n].toString()+"'),t.data),n=t.datasets,i=t.labels;if(n.length)for(var a=0;ae&&(e=t.length)}),e},c.color=i?function(t){return t instanceof CanvasGradient&&(t=a.global.defaultColor),i(t)}:function(t){return console.error("Color.js not found!"),t},c.getHoverColor=function(t){return t instanceof CanvasPattern?t:c.color(t).saturate(.5).darken(.1).rgbString()}}},{2:2,25:25,45:45}],28:[function(t,e,n){"use strict";var i=t(45);function r(t,e){return t.native?{x:t.x,y:t.y}:i.getRelativePosition(t,e)}function s(t,e){for(var n,i,a,o=0,r=t.data.datasets.length;o'),t.data),n=t.datasets,i=t.labels;if(n.length)for(var a=0;ae&&(e=t.length)}),e},c.color=i?function(t){return t instanceof CanvasGradient&&(t=a.global.defaultColor),i(t)}:function(t){return console.error("Color.js not found!"),t},c.getHoverColor=function(t){return t instanceof CanvasPattern?t:c.color(t).saturate(.5).darken(.1).rgbString()}}},{2:2,25:25,45:45}],28:[function(t,e,n){"use strict";var i=t(45);function r(t,e){return t.native?{x:t.x,y:t.y}:i.getRelativePosition(t,e)}function s(t,e){for(var n,i,a,o=0,r=t.data.datasets.length;ot[2]&&(t[2]=e[2]),e[1]t.a)&&(e=this.g,o=this.u,i=t.constrainResolution(i,0,this.j-1),un(t,i,e,o)),!1)}function ps(t){return 2<=this.o.length&&(t=t.map,this.g=null,this.a=void 0,this.j=1,this.D||nn(t.Z(),1,1),!0)}function hs(t){t=t||{};var e=new ho,o=new sn(-.005,.05,100);return void 0!==t.altShiftDragRotate&&!t.altShiftDragRotate||e.push(new Ln),void 0!==t.doubleClickZoom&&!t.doubleClickZoom||e.push(new cn({delta:t.zoomDelta,duration:t.zoomDuration})),void 0!==t.dragPan&&!t.dragPan||e.push(new En({kinetic:o})),void 0!==t.pinchRotate&&!t.pinchRotate||e.push(new es),void 0!==t.pinchZoom&&!t.pinchZoom||e.push(new ns({constrainResolution:t.constrainResolution,duration:t.zoomDuration})),void 0!==t.keyboard&&!t.keyboard||(e.push(new Yn),e.push(new qn({delta:t.zoomDelta,duration:t.zoomDuration}))),void 0!==t.mouseWheelZoom&&!t.mouseWheelZoom||e.push(new _n({constrainResolution:t.constrainResolution,duration:t.zoomDuration})),void 0!==t.shiftDragZoom&&!t.shiftDragZoom||e.push(new zn({duration:t.zoomDuration})),e}function ls(t){ro.call(this);var e=Xt({},t);e.opacity=void 0!==t.opacity?t.opacity:1,e.visible=void 0===t.visible||t.visible,e.zIndex=void 0!==t.zIndex?t.zIndex:0,e.maxResolution=void 0!==t.maxResolution?t.maxResolution:1/0,e.minResolution=void 0!==t.minResolution?t.minResolution:0,this.H(e),this.a={layer:this,Je:!0}}function us(t){return t.a.opacity=Q(t.hc(),0,1),t.a.yj=t.$f(),t.a.visible=t.Mb(),t.a.extent=t.G(),t.a.zIndex=t.Ba(),t.a.maxResolution=t.fc(),t.a.minResolution=Math.max(t.gc(),0),t.a}function cs(t){var e=t||{};delete(t=Xt({},e)).layers,e=e.layers,ls.call(this,t),this.f=[],this.c={},d(this,so(fs),this.Hl,this),e?Array.isArray(e)?e=new ho(e.slice(),{unique:!0}):O(e instanceof ho,43):e=new ho(void 0,{unique:!0}),this.xi(e)}e(es,Mn),es.prototype.Xc=fr,e(ns,Mn),ns.prototype.Xc=fr,e(ls,ro),(r=ls.prototype).G=function(){return this.get("extent")},r.fc=function(){return this.get("maxResolution")},r.gc=function(){return this.get("minResolution")},r.hc=function(){return this.get("opacity")},r.Mb=function(){return this.get("visible")},r.Ba=function(){return this.get("zIndex")},r.vc=function(t){this.set("extent",t)},r.Ac=function(t){this.set("maxResolution",t)},r.Bc=function(t){this.set("minResolution",t)},r.wc=function(t){this.set("opacity",t)},r.xc=function(t){this.set("visible",t)},r.Vb=function(t){this.set("zIndex",t)},e(cs,ls),(r=cs.prototype).Fd=function(){},r.Fe=function(){this.Mb()&&this.s()},r.Hl=function(){this.f.forEach(qe),this.f.length=0;var t=this.qd();for(e in this.f.push(d(t,"add",this.Gl,this),d(t,"remove",this.Il,this)),this.c)this.c[e].forEach(qe);Vt(this.c);for(var e=0,o=(t=t.a).length;e=this.me.length)throw Error("feature index out of bounds");return this.Cc.ea=this.me[t],t=this.Cc.Ka()+this.Cc.ea,new _y(this.Cc,t,this.extent,this.ne,this.pe)},fi=Uy,ti.default={Bf:qy,Wj:_y,Xj:fi},ti.Bf=qy,ti.Wj=_y,ti.Xj=fi,(r=og.prototype).get=function(t){return this.c[t]},r.Bb=function(){return this.f},r.G=function(){return this.a||(this.a="Point"===this.i?wt(this.b):xt(this.b,0,this.b.length,2)),this.a},r.Wn=function(){return this.g},r.ec=function(){return this.b},r.ga=og.prototype.ec,r.V=function(){return this},r.Xn=function(){return this.c},r.Vd=og.prototype.V,r.qa=function(){return 2},r.Lc=Y,r.U=function(){return this.i},e(ig,wl),(r=ig.prototype).U=function(){return"arraybuffer"},r.Oa=function(t,e){var o,i=this.c,r=(t=new mp.Dd(t),t=new mp.xf.Bf(t),[]),n=this.b;for(o in t.layers)if(!i||-1!=i.indexOf(o))for(var s,a,p,h,l,u,c,f,y,g=t.layers[o],d=0,v=g.length;d>1):r>>1;for(t=0,i=o.length;t=e[0]||t[1]<=e[1]&&t[3]>=e[1]||Et(t,this.sb,this))},r.ob=function(t){var e,o=this.a,i=t.slice();for(i[o]=i[0]+(this.A[o]-this.A[0]),e=1;ethis.c&&(this.c=o.lineWidth,this.f=null)):(o.strokeStyle=void 0,o.lineCap=void 0,o.lineDash=null,o.lineDashOffset=void 0,o.lineJoin=void 0,o.lineWidth=void 0,o.miterLimit=void 0)},e(Y0,F0),Y0.prototype.yc=function(t,e,o,i,r,n){var s,a;""!==this.Ia&&this.g&&(this.i||this.f)&&(this.i&&(r=this.i,(s=this.S)&&s.fillStyle==r.fillStyle||(a=[9,r.fillStyle],this.a.push(a),this.b.push(a),s?s.fillStyle=r.fillStyle:this.S={fillStyle:r.fillStyle})),this.f&&(r=this.f,(s=this.D)&&s.lineCap==r.lineCap&&s.lineDash==r.lineDash&&s.lineDashOffset==r.lineDashOffset&&s.lineJoin==r.lineJoin&&s.lineWidth==r.lineWidth&&s.miterLimit==r.miterLimit&&s.strokeStyle==r.strokeStyle||(a=[10,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset,!1,1],this.a.push(a),this.b.push(a),s?(s.lineCap=r.lineCap,s.lineDash=r.lineDash,s.lineDashOffset=r.lineDashOffset,s.lineJoin=r.lineJoin,s.lineWidth=r.lineWidth,s.miterLimit=r.miterLimit,s.strokeStyle=r.strokeStyle):this.D={lineCap:r.lineCap,lineDash:r.lineDash,lineDashOffset:r.lineDashOffset,lineJoin:r.lineJoin,lineWidth:r.lineWidth,miterLimit:r.miterLimit,strokeStyle:r.strokeStyle})),r=this.g,(s=this.C)&&s.font==r.font&&s.textAlign==r.textAlign&&s.textBaseline==r.textBaseline||(a=[11,r.font,r.textAlign,r.textBaseline],this.a.push(a),this.b.push(a),s?(s.font=r.font,s.textAlign=r.textAlign,s.textBaseline=r.textBaseline):this.C={font:r.font,textAlign:r.textAlign,textBaseline:r.textBaseline}),D0(this,n),t=[5,r=this.coordinates.length,t=k0(this,t,e,o,i,!1,!1),this.Ia,this.j,this.o,this.v,this.u,!!this.i,!!this.f,this.l],this.a.push(t),this.b.push(t),G0(this,n))},Y0.prototype.Cb=function(t){var e,o,i,r,n,s,a,p,h;t?((o=t.Fa())?(o=Mo((o=o.b)||Os),this.i?this.i.fillStyle=o:this.i={fillStyle:o}):this.i=null,(s=t.Ga())?(o=s.a,i=s.f,r=s.i,a=s.g,p=s.j,n=s.c,s=s.o,i=void 0!==i?i:"round",r=r?r.slice():Us,a=void 0!==a?a:0,p=void 0!==p?p:"round",n=void 0!==n?n:1,s=void 0!==s?s:10,o=Mo(o||Gs),this.f?((h=this.f).lineCap=i,h.lineDash=r,h.lineDashOffset=a,h.lineJoin=p,h.lineWidth=n,h.miterLimit=s,h.strokeStyle=o):this.f={lineCap:i,lineDash:r,lineDashOffset:a,lineJoin:p,lineWidth:n,miterLimit:s,strokeStyle:o}):this.f=null,e=t.a,o=t.i,i=t.c,r=t.o,n=t.f,s=t.b,a=t.Na(),p=t.g,h=t.j,t=void 0!==e?e:"10px sans-serif",p=void 0!==p?p:"center",h=void 0!==h?h:"middle",this.g?((e=this.g).font=t,e.textAlign=p,e.textBaseline=h):this.g={font:t,textAlign:p,textBaseline:h},this.Ia=void 0!==a?a:"",this.j=void 0!==o?o:0,this.o=void 0!==i?i:0,this.l=void 0!==r&&r,this.v=void 0!==n?n:0,this.u=void 0!==s?s:1):this.Ia=""},e(H0,$s);var q0={0:[[!0]]};function J0(t,e,o){var i,r=Math.floor(t.length/2);if(r<=e)for(i=r;i=t.va&&(t.u?i.pop():o=!0),i.push(e.slice()),t.Za(i,r)):t.g===Yv&&((i=t.a[0]).length>=t.va&&(t.u?i.pop():o=!0),i.push(e.slice()),o&&(t.l=i[0]),t.Za(t.a,r)),Zv(t),o&&t.Pd()}function Wv(t){t.l=null;var e=t.j;return e&&(t.j=null,t.B=null,t.C=null,t.pa.ha().clear(!0)),e}function Zv(t){var e=[];t.j&&e.push(t.j),t.C&&e.push(t.C),t.B&&e.push(t.B),(t=t.pa.ha()).clear(!0),t.cd(e)}e(Tv,ro),(r=Tv.prototype).Ea=Y,r.ya=function(){return this.j},r.xa=function(){return this.D},r.za=function(){return this.c},r.getState=function(){return this.na},r.sa=function(){this.s()},r.ua=function(t){this.j=jv(t),this.s()},e(a,Tv),(r=a.prototype).yb=function(t){var e,o=U(t).toString();Rv(this,o,t)&&(Lv(this,o,t),(e=t.V())?(o=e.G(),this.a&&this.a.Ca(o,t)):this.g[o]=t,this.b(new Fv("addfeature",t))),this.s()},r.cd=function(t){Iv(this,t),this.s()},r.clear=function(t){if(t){for(var e in this.v)this.v[e].forEach(qe);this.f||(this.v={},this.o={},this.l={})}else if(this.a)for(var o in this.a.forEach(this.Ig,this),this.g)this.Ig(this.g[o]);this.f&&this.f.clear(),this.a&&this.a.clear(),this.R.clear(),this.g={},this.b(new Fv("clear")),this.s()},r.sh=function(t,e){return this.a?this.a.forEach(t,e):this.f?this.f.forEach(t,e):void 0},r.$b=function(t,e,o){return this.a?Up(this.a,t,e,o):this.f?this.f.forEach(e,o):void 0},r.th=function(e,o,i){return this.$b(e,function(t){if(t.V().Xa(e)&&(t=o.call(i,t)))return t})},r.Ah=function(){return this.f},r.Xe=function(){var t;return this.f?t=this.f.a:this.a&&(t=Dp(this.a),Zt(this.g)||X(t,Wt(this.g))),t},r.zh=function(t){var e,o,i=[];return e=t,o=function(t){i.push(t)},this.$b([e[0],e[1],e[0],e[1]],function(t){if(t.V().sb(e))return o.call(void 0,t)}),i},r.Uf=function(t){return Op(this.a,t)},r.vh=function(t,e){var i=t[0],r=t[1],n=null,s=[NaN,NaN],a=1/0,p=[-1/0,-1/0,1/0,1/0],h=e||cr;return Up(this.a,p,function(t){var e,o;h(t)&&(e=t.V(),o=a,(a=e.Kb(i,r,s,a))>=1}return o.join("")}(e))}})),i.imageryProviders&&(p=we(v("EPSG:4326"),this.c),(t=i.imageryProviders.map(function(t){var e=t.attribution,n={};return t.coverageAreas.forEach(function(t){var e,o=t.zoomMin,i=Math.min(t.zoomMax,s);for(t=Bt([(t=t.bbox)[1],t[0],t[3],t[2]],p),e=o;e<=i;++e){var r=e.toString(),o=Ie(a,t,e);r in n?n[r].push(o):n[r]=[o]}}),new Be({html:e,tileRanges:n})})).push(Fm),this.ua(t)),this.D=e,Cv(this,"ready"))},e(km,T),e(C,km),(r=C.prototype).Kk=function(){return this.f},r.tq=function(t){Xt(this.f,t),Dm(this)},r.Xp=function(t){this.f=t||{},Dm(this)},r.Dl=function(t,e){if(!(e=e.target).status||200<=e.status&&e.status<300){try{var o=JSON.parse(e.responseText)}catch(t){return void Cv(this,"error")}Om(this,o),this.l[t]=o,Cv(this,"ready")}else Cv(this,"error")},r.Cl=function(){Cv(this,"error")},e(L,a),(r=L.prototype).$n=function(){return this.distance},r.ao=function(){return this.source},r.Yd=function(t,e,o){this.source.Yd(t,e,o),e!==this.resolution&&(this.clear(),this.resolution=e,Um(this),this.cd(this.features))},r.Yp=function(t){this.distance=t,this.sa()},r.sa=function(){this.clear(),Um(this),this.cd(this.features),a.prototype.sa.call(this)},e(Bm,qb),(r=Bm.prototype).co=function(){return this.v},r.Jc=function(t,e,o,i){if(void 0===this.f)return null;e=Jb(this,e),o=this.T?o:1;var r=this.M;if(r&&this.I==this.i&&r.resolution==e&&r.a==o&&yt(r.G(),t))return r;Xt(r={F:"image",FORMAT:"PNG32",TRANSPARENT:!0},this.v);var n=((t=t.slice())[0]+t[2])/2,s=(t[1]+t[3])/2,a=(1!=this.B&&(a=this.B*Dt(t)/2,p=this.B*It(t)/2,t[0]=n-a,t[1]=s-p,t[2]=n+a,t[3]=s+p),e/o),p=Math.ceil(Dt(t)/a),h=Math.ceil(It(t)/a);return t[0]=n-a*p/2,t[2]=n+a*p/2,t[1]=s-a*h/2,t[3]=s+a*h/2,this.l[0]=p,this.l[1]=h,n=t,s=this.l,a=o,i=i.mb.split(":").pop(),r.SIZE=s[0]+","+s[1],r.BBOX=n.join(","),r.BBOXSR=i,r.IMAGESR=i,r.DPI=Math.round(90*a),(n=(i=this.f).replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"))==i&&O(!1,50),r=Gm(n,r),this.M=new g0(t,e,o,this.j,r,this.R,this.g),this.I=this.i,d(this.M,"change",this.o,this),this.M},r.bo=function(){return this.g},r.eo=function(){return this.f},r.fo=function(t){this.M=null,this.g=t,this.s()},r.ho=function(t){t!=this.f&&(this.f=t,this.M=null,this.s())},r.io=function(t){Xt(this.v,t),this.M=null,this.s()},e(Xm,qb),(r=Xm.prototype).ko=function(){return this.g},r.Jc=function(t,e,o){e=Jb(this,e),o=this.T?o:1;var i,r,n,s,a,p,h,l,u=this.M;return u&&this.B==this.i&&u.resolution==e&&u.a==o&&yt(u.G(),t)||(1!=this.v&&Gt(t=t.slice(),this.v),l=[Dt(t)/e*o,It(t)/e*o],void 0!==this.I?(u=this.I,i=Lt(t),r=this.pa,n=Dt(t),s=It(t),a=l[0],p=l[1],h=.0254/this.l,l={OPERATION:this.va?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol.source.ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.l,SETDISPLAYWIDTH:Math.round(l[0]),SETDISPLAYHEIGHT:Math.round(l[1]),SETVIEWSCALE:a*st[2]&&(t[2]=e[2]),e[1]t.a)&&(e=this.g,o=this.u,i=t.constrainResolution(i,0,this.j-1),un(t,i,e,o)),1))}function ps(t){return 2<=this.o.length&&(t=t.map,this.g=null,this.a=void 0,this.j=1,this.D||nn(t.Z(),1,1),!0)}function hs(t){t=t||{};var e=new ho,o=new sn(-.005,.05,100);return void 0!==t.altShiftDragRotate&&!t.altShiftDragRotate||e.push(new Ln),void 0!==t.doubleClickZoom&&!t.doubleClickZoom||e.push(new cn({delta:t.zoomDelta,duration:t.zoomDuration})),void 0!==t.dragPan&&!t.dragPan||e.push(new En({kinetic:o})),void 0!==t.pinchRotate&&!t.pinchRotate||e.push(new es),void 0!==t.pinchZoom&&!t.pinchZoom||e.push(new ns({constrainResolution:t.constrainResolution,duration:t.zoomDuration})),void 0!==t.keyboard&&!t.keyboard||(e.push(new Yn),e.push(new qn({delta:t.zoomDelta,duration:t.zoomDuration}))),void 0!==t.mouseWheelZoom&&!t.mouseWheelZoom||e.push(new _n({constrainResolution:t.constrainResolution,duration:t.zoomDuration})),void 0!==t.shiftDragZoom&&!t.shiftDragZoom||e.push(new zn({duration:t.zoomDuration})),e}function ls(t){ro.call(this);var e=Xt({},t);e.opacity=void 0!==t.opacity?t.opacity:1,e.visible=void 0===t.visible||t.visible,e.zIndex=void 0!==t.zIndex?t.zIndex:0,e.maxResolution=void 0!==t.maxResolution?t.maxResolution:1/0,e.minResolution=void 0!==t.minResolution?t.minResolution:0,this.H(e),this.a={layer:this,Je:!0}}function us(t){return t.a.opacity=Q(t.hc(),0,1),t.a.yj=t.$f(),t.a.visible=t.Mb(),t.a.extent=t.G(),t.a.zIndex=t.Ba(),t.a.maxResolution=t.fc(),t.a.minResolution=Math.max(t.gc(),0),t.a}function cs(t){var e=t||{};delete(t=Xt({},e)).layers,e=e.layers,ls.call(this,t),this.f=[],this.c={},d(this,so(fs),this.Hl,this),e?Array.isArray(e)?e=new ho(e.slice(),{unique:!0}):O(e instanceof ho,43):e=new ho(void 0,{unique:!0}),this.xi(e)}e(es,Mn),es.prototype.Xc=fr,e(ns,Mn),ns.prototype.Xc=fr,e(ls,ro),(r=ls.prototype).G=function(){return this.get("extent")},r.fc=function(){return this.get("maxResolution")},r.gc=function(){return this.get("minResolution")},r.hc=function(){return this.get("opacity")},r.Mb=function(){return this.get("visible")},r.Ba=function(){return this.get("zIndex")},r.vc=function(t){this.set("extent",t)},r.Ac=function(t){this.set("maxResolution",t)},r.Bc=function(t){this.set("minResolution",t)},r.wc=function(t){this.set("opacity",t)},r.xc=function(t){this.set("visible",t)},r.Vb=function(t){this.set("zIndex",t)},e(cs,ls),(r=cs.prototype).Fd=function(){},r.Fe=function(){this.Mb()&&this.s()},r.Hl=function(){this.f.forEach(qe),this.f.length=0;var t=this.qd();for(e in this.f.push(d(t,"add",this.Gl,this),d(t,"remove",this.Il,this)),this.c)this.c[e].forEach(qe);Vt(this.c);for(var e=0,o=(t=t.a).length;e=this.me.length)throw Error("feature index out of bounds");return this.Cc.ea=this.me[t],t=this.Cc.Ka()+this.Cc.ea,new eg(this.Cc,t,this.extent,this.ne,this.pe)},By=Gy,fi.default={Bf:Qy,Wj:eg,Xj:By},fi.Bf=Qy,fi.Wj=eg,fi.Xj=By,(r=sg.prototype).get=function(t){return this.c[t]},r.Bb=function(){return this.f},r.G=function(){return this.a||(this.a="Point"===this.i?wt(this.b):xt(this.b,0,this.b.length,2)),this.a},r.Wn=function(){return this.g},r.ec=function(){return this.b},r.ga=sg.prototype.ec,r.V=function(){return this},r.Xn=function(){return this.c},r.Vd=sg.prototype.V,r.qa=function(){return 2},r.Lc=Y,r.U=function(){return this.i},e(ag,wl),(r=ag.prototype).U=function(){return"arraybuffer"},r.Oa=function(t,e){var o,i=this.c,r=(t=new mp.Dd(t),t=new mp.xf.Bf(t),[]),n=this.b;for(o in t.layers)if(!i||-1!=i.indexOf(o))for(var s,a,p,h,l,u,c,f,y,g=t.layers[o],d=0,v=g.length;d>1):r>>1;for(t=0,i=o.length;t=e[0]||t[1]<=e[1]&&t[3]>=e[1]||Et(t,this.sb,this))},r.ob=function(t){var e,o=this.a,i=t.slice();for(i[o]=i[0]+(this.A[o]-this.A[0]),e=1;ethis.c&&(this.c=o.lineWidth,this.f=null)):(o.strokeStyle=void 0,o.lineCap=void 0,o.lineDash=null,o.lineDashOffset=void 0,o.lineJoin=void 0,o.lineWidth=void 0,o.miterLimit=void 0)},e(J0,O0),J0.prototype.yc=function(t,e,o,i,r,n){var s,a;""!==this.Ia&&this.g&&(this.i||this.f)&&(this.i&&(r=this.i,(s=this.S)&&s.fillStyle==r.fillStyle||(a=[9,r.fillStyle],this.a.push(a),this.b.push(a),s?s.fillStyle=r.fillStyle:this.S={fillStyle:r.fillStyle})),this.f&&(r=this.f,(s=this.D)&&s.lineCap==r.lineCap&&s.lineDash==r.lineDash&&s.lineDashOffset==r.lineDashOffset&&s.lineJoin==r.lineJoin&&s.lineWidth==r.lineWidth&&s.miterLimit==r.miterLimit&&s.strokeStyle==r.strokeStyle||(a=[10,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset,!1,1],this.a.push(a),this.b.push(a),s?(s.lineCap=r.lineCap,s.lineDash=r.lineDash,s.lineDashOffset=r.lineDashOffset,s.lineJoin=r.lineJoin,s.lineWidth=r.lineWidth,s.miterLimit=r.miterLimit,s.strokeStyle=r.strokeStyle):this.D={lineCap:r.lineCap,lineDash:r.lineDash,lineDashOffset:r.lineDashOffset,lineJoin:r.lineJoin,lineWidth:r.lineWidth,miterLimit:r.miterLimit,strokeStyle:r.strokeStyle})),r=this.g,(s=this.C)&&s.font==r.font&&s.textAlign==r.textAlign&&s.textBaseline==r.textBaseline||(a=[11,r.font,r.textAlign,r.textBaseline],this.a.push(a),this.b.push(a),s?(s.font=r.font,s.textAlign=r.textAlign,s.textBaseline=r.textBaseline):this.C={font:r.font,textAlign:r.textAlign,textBaseline:r.textBaseline}),G0(this,n),t=[5,r=this.coordinates.length,t=U0(this,t,e,o,i,!1,!1),this.Ia,this.j,this.o,this.v,this.u,!!this.i,!!this.f,this.l],this.a.push(t),this.b.push(t),V0(this,n))},J0.prototype.Cb=function(t){var e,o,i,r,n,s,a,p,h;t?((o=t.Fa())?(o=Mo((o=o.b)||Os),this.i?this.i.fillStyle=o:this.i={fillStyle:o}):this.i=null,(s=t.Ga())?(o=s.a,i=s.f,r=s.i,a=s.g,p=s.j,n=s.c,s=s.o,i=void 0!==i?i:"round",r=r?r.slice():Us,a=void 0!==a?a:0,p=void 0!==p?p:"round",n=void 0!==n?n:1,s=void 0!==s?s:10,o=Mo(o||Gs),this.f?((h=this.f).lineCap=i,h.lineDash=r,h.lineDashOffset=a,h.lineJoin=p,h.lineWidth=n,h.miterLimit=s,h.strokeStyle=o):this.f={lineCap:i,lineDash:r,lineDashOffset:a,lineJoin:p,lineWidth:n,miterLimit:s,strokeStyle:o}):this.f=null,e=t.a,o=t.i,i=t.c,r=t.o,n=t.f,s=t.b,a=t.Na(),p=t.g,h=t.j,t=void 0!==e?e:"10px sans-serif",p=void 0!==p?p:"center",h=void 0!==h?h:"middle",this.g?((e=this.g).font=t,e.textAlign=p,e.textBaseline=h):this.g={font:t,textAlign:p,textBaseline:h},this.Ia=void 0!==a?a:"",this.j=void 0!==o?o:0,this.o=void 0!==i?i:0,this.l=void 0!==r&&r,this.v=void 0!==n?n:0,this.u=void 0!==s?s:1):this.Ia=""},e(_0,$s);var $0={0:[[!0]]};function Q0(t,e,o){var i,r=Math.floor(t.length/2);if(r<=e)for(i=r;i=t.va&&(t.u?i.pop():o=!0),i.push(e.slice()),t.Za(i,r)):t.g===Jv&&((i=t.a[0]).length>=t.va&&(t.u?i.pop():o=!0),i.push(e.slice()),o&&(t.l=i[0]),t.Za(t.a,r)),Yv(t),o&&t.Pd()}function zv(t){t.l=null;var e=t.j;return e&&(t.j=null,t.B=null,t.C=null,t.pa.ha().clear(!0)),e}function Yv(t){var e=[];t.j&&e.push(t.j),t.C&&e.push(t.C),t.B&&e.push(t.B),(t=t.pa.ha()).clear(!0),t.cd(e)}e(Lv,ro),(r=Lv.prototype).Ea=Y,r.ya=function(){return this.j},r.xa=function(){return this.D},r.za=function(){return this.c},r.getState=function(){return this.na},r.sa=function(){this.s()},r.ua=function(t){this.j=Rv(t),this.s()},e(a,Lv),(r=a.prototype).yb=function(t){var e,o=U(t).toString();Fv(this,o,t)&&(Nv(this,o,t),(e=t.V())?(o=e.G(),this.a&&this.a.Ca(o,t)):this.g[o]=t,this.b(new Ov("addfeature",t))),this.s()},r.cd=function(t){kv(this,t),this.s()},r.clear=function(t){if(t){for(var e in this.v)this.v[e].forEach(qe);this.f||(this.v={},this.o={},this.l={})}else if(this.a)for(var o in this.a.forEach(this.Ig,this),this.g)this.Ig(this.g[o]);this.f&&this.f.clear(),this.a&&this.a.clear(),this.R.clear(),this.g={},this.b(new Ov("clear")),this.s()},r.sh=function(t,e){return this.a?this.a.forEach(t,e):this.f?this.f.forEach(t,e):void 0},r.$b=function(t,e,o){return this.a?Up(this.a,t,e,o):this.f?this.f.forEach(e,o):void 0},r.th=function(e,o,i){return this.$b(e,function(t){if(t.V().Xa(e)&&(t=o.call(i,t)))return t})},r.Ah=function(){return this.f},r.Xe=function(){var t;return this.f?t=this.f.a:this.a&&(t=Dp(this.a),Zt(this.g)||X(t,Wt(this.g))),t},r.zh=function(t){var e,o,i=[];return e=t,o=function(t){i.push(t)},this.$b([e[0],e[1],e[0],e[1]],function(t){if(t.V().sb(e))return o.call(void 0,t)}),i},r.Uf=function(t){return Op(this.a,t)},r.vh=function(t,e){var i=t[0],r=t[1],n=null,s=[NaN,NaN],a=1/0,p=[-1/0,-1/0,1/0,1/0],h=e||cr;return Up(this.a,p,function(t){var e,o;h(t)&&(e=t.V(),o=a,(a=e.Kb(i,r,s,a))>=1}return o.join("")}(e))}})),i.imageryProviders&&(p=we(v("EPSG:4326"),this.c),(t=i.imageryProviders.map(function(t){var e=t.attribution,n={};return t.coverageAreas.forEach(function(t){var e,o=t.zoomMin,i=Math.min(t.zoomMax,s);for(t=Bt([(t=t.bbox)[1],t[0],t[3],t[2]],p),e=o;e<=i;++e){var r=e.toString(),o=Ie(a,t,e);r in n?n[r].push(o):n[r]=[o]}}),new Be({html:e,tileRanges:n})})).push(Om),this.ua(t)),this.D=e,Iv(this,"ready"))},e(Um,T),e(C,Um),(r=C.prototype).Kk=function(){return this.f},r.tq=function(t){Xt(this.f,t),Gm(this)},r.Xp=function(t){this.f=t||{},Gm(this)},r.Dl=function(t,e){if(!(e=e.target).status||200<=e.status&&e.status<300){try{var o=JSON.parse(e.responseText)}catch(t){return void Iv(this,"error")}Bm(this,o),this.l[t]=o,Iv(this,"ready")}else Iv(this,"error")},r.Cl=function(){Iv(this,"error")},e(L,a),(r=L.prototype).$n=function(){return this.distance},r.ao=function(){return this.source},r.Yd=function(t,e,o){this.source.Yd(t,e,o),e!==this.resolution&&(this.clear(),this.resolution=e,Xm(this),this.cd(this.features))},r.Yp=function(t){this.distance=t,this.sa()},r.sa=function(){this.clear(),Xm(this),this.cd(this.features),a.prototype.sa.call(this)},e(Wm,$b),(r=Wm.prototype).co=function(){return this.v},r.Jc=function(t,e,o,i){if(void 0===this.f)return null;e=Qb(this,e),o=this.T?o:1;var r=this.M;if(r&&this.I==this.i&&r.resolution==e&&r.a==o&&yt(r.G(),t))return r;Xt(r={F:"image",FORMAT:"PNG32",TRANSPARENT:!0},this.v);var n=((t=t.slice())[0]+t[2])/2,s=(t[1]+t[3])/2,a=(1!=this.B&&(a=this.B*Dt(t)/2,p=this.B*It(t)/2,t[0]=n-a,t[1]=s-p,t[2]=n+a,t[3]=s+p),e/o),p=Math.ceil(Dt(t)/a),h=Math.ceil(It(t)/a);return t[0]=n-a*p/2,t[2]=n+a*p/2,t[1]=s-a*h/2,t[3]=s+a*h/2,this.l[0]=p,this.l[1]=h,n=t,s=this.l,a=o,i=i.mb.split(":").pop(),r.SIZE=s[0]+","+s[1],r.BBOX=n.join(","),r.BBOXSR=i,r.IMAGESR=i,r.DPI=Math.round(90*a),(n=(i=this.f).replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"))==i&&O(!1,50),r=Vm(n,r),this.M=new b0(t,e,o,this.j,r,this.R,this.g),this.I=this.i,d(this.M,"change",this.o,this),this.M},r.bo=function(){return this.g},r.eo=function(){return this.f},r.fo=function(t){this.M=null,this.g=t,this.s()},r.ho=function(t){t!=this.f&&(this.f=t,this.M=null,this.s())},r.io=function(t){Xt(this.v,t),this.M=null,this.s()},e(Zm,$b),(r=Zm.prototype).ko=function(){return this.g},r.Jc=function(t,e,o){e=Qb(this,e),o=this.T?o:1;var i,r,n,s,a,p,h,l,u=this.M;return u&&this.B==this.i&&u.resolution==e&&u.a==o&&yt(u.G(),t)||(1!=this.v&&Gt(t=t.slice(),this.v),l=[Dt(t)/e*o,It(t)/e*o],void 0!==this.I?(u=this.I,i=Lt(t),r=this.pa,n=Dt(t),s=It(t),a=l[0],p=l[1],h=.0254/this.l,l={OPERATION:this.va?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol.source.ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.l,SETDISPLAYWIDTH:Math.round(l[0]),SETDISPLAYHEIGHT:Math.round(l[1]),SETVIEWSCALE:a*s