/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.exontrol||{}))}(this,function(t){"use strict";function e(t){return null!=t}function o(t){return null==t}function i(t,e,i){return o(t)?~~i:r.s2F(t,e)}function n(t){var e={};for(var o in t){var i=this[r.getM(o)];i&&(e[o]=i.call(this))}return e}function s(t){if(l(t))for(var e in t){var o=this[r.setM(e)];o&&o.call(this,t[e])}}var r=r||window.exontrol,a=r.G,h=Math.max,u=Math.min,l=r.IsO,p=r.IsS,f=r.ToS;r.Mrg(r,function(){function t(t,e){r.host.call(this,arguments)}function c(t){this.set(t)}function y(t){this.set(t)}function g(t){this.set(t)}function d(t){this.set(t)}function L(t){this.set(t)}function v(t){this.set(t)}function O(t){this.init(t)}function b(t,e){this.init(t,e)}function R(){this.nFlags=3}function V(t){this.oLayer=t,this.nVO=0,this.oOffsetXValid=new g,this.oOffsetYValid=new g,this.oValueToOffsetX=new c,this.oValueToOffsetY=new c,this.oOffsetToValue=new d,this.reset()}function C(t){this.oLayer=t,this.oRotateAngleValid=new D,this.oRotateCenterX=new L,this.oRotateCenterY=new L,this.oRotateAngleToValue=new c,this.oValueToRotateAngle=new c,this.nRotamoveOffset=0,this.reset()}function S(e){this.oLayer=e,this.oViewableLObj=new R,this.value=null,this.onDrag=t.OnDragLayerEnum.exDoNothing,this.oLeft=new y,this.oTop=new y,this.oWidth=new y,this.oHeight=new y,this.oLO=new V(this.oLayer),this.oLR=new C(this.oLayer)}function w(t){this.oLayer=t,this.type=null,this.p=null,this.value=null,this.oOffsetX=new v,this.oOffsetY=new v,this.oLeft=new v,this.oTop=new v,this.oWidth=new v,this.oHeight=new v,this.oRoundX=new v,this.oRoundY=new v,this.oRadiusX=new v,this.oRadiusY=new v,this.oCenterX=new v,this.oCenterY=new v,this.oStartAngle=new v,this.oSweepAngle=new v}function A(t){this.oLayer=t,this.oRed=new c,this.oGreen=new c,this.oBlue=new c}function U(t){this.oT=t,this.rgVO=new r.M1,this.oSize=this.doL()}function T(t,e){this.oLayer=t,this.bDebug=t.isDebug(),this.oSize={width:~~e.width,height:~~e.height},this.iCanvas(this.oSize)}function G(){this.rgLV=new Map}var m={key:null,position:null,visible:null,selectable:null,back:null,fore:null,foreOpt:null,onDrag:null,value:null,idem:null,left:null,top:null,width:null,height:null,defaultOffsetX:null,defaultOffsetY:null,offsetX:null,offsetY:null,offsetXValid:null,offsetYValid:null,valueToOffsetX:null,valueToOffsetY:null,offsetToValue:null,defaultRotateAngle:null,rotateAngle:null,rotateAngleValid:null,rotateCenterX:null,rotateCenterY:null,rotateCenterLayer:null,rotateAngleToValue:null,valueToRotateAngle:null,rotamoveCenterX:null,rotamoveCenterY:null,rotamoveOffsetX:null,rotamoveOffsetY:null,rotateClip:null,transparency:null,grayscale:null,brightness:null,contrast:null,clip:null},x={red:null,green:null,blue:null},E={type:null,value:null,offsetX:null,offsetY:null,left:null,top:null,width:null,height:null,roundRadiusX:null,roundRadiusY:null,radiusX:null,radiusY:null,centerX:null,centerY:null,startAngle:null,sweepAngle:null};t.version="5.5",t.type="Gauge",t.states="DefaultOffsetX,OffsetX,DefaultOffsetY,OffsetY,DefaultRotateAngle,RotateAngle,Value",t.vAlpha=128,t.OnDragLayerEnum={exDoNothing:0,exDoMove:1,exDoRotate:2,exDoRotamove:3},t.Options={tfi:null,formatText:null,locked:null,readOnly:null,wheelChange:null,smooth:null,cursors:null,layers:null,layerAutoSize:null,layerOfValue:null,value:null,debug:null,showLayers:null,layerDragAny:null},t.prototype.init=function(e,o){this.lI=0,this.oLys=new O(this),this.sSA="smth-"+r.Rand(),this.iLts(),this.oO=r.Cpy(t.Options),this.SetClientRect(e),r.CC.GetCanvas(e)&&this.SetCanvas(e);var i=o||this.defOpt();void 0===i.layers&&(i.layers=this.getLayers()),this.SetOptions(i,!0),r.DPR.Reg(this),this.Refresh()},t.prototype.defOpt=function(){return r[this.constructor.type].Options},r.SB.addProto(t.prototype),t.prototype.setTimeout=function(){return r.setTimeout.apply(this,arguments)},t.prototype.GetOptions=function(){return this.oO},t.prototype.SetOptions=function(t,o){var i=!1;if(e(t)){var n=[],s=this.GetOptions();if(e(s)){for(var a in s){var h=t[a];void 0!==h&&(n.push(a),s[a]!==h&&(s[a]=r.CpV(h)))}if(o)for(var a in t)a in s||(s[a]=r.CpV(t[a]));(i=0!=n.length)&&(this.bU(),n.forEach(function(t){var e=r.setM(t);e in this&&this[e].call(this,s[t])},this),this.eU())}}return i},t.prototype.opt=function(t,e){var i=this.oO[t];return o(i)&&o(i=this.defOpt()[t])&&(i=e),i},t.prototype.GetCanvas=function(){return this.canvas},t.prototype.SetCanvas=function(t,e){function o(t,e){if(t){var o=function(t){return t.exontrol=t.exontrol||{}}(t);o.l1x=(o.l1x||0)+(e?1:-1)}}o(this.gCtx(),!1),this.udefSts(this.oSts),this.oSts=null,this.resAO(),t=r.CC.GetCanvas(t),r.HP.off("change",this,"onimg"),t&&r.HP.on("change",this,"onimg"),!e&&r.CC.SetCanvas(this,t),this.canvas=t,r.CC.GetCanvas(this.canvas)&&(this.Shortcuts=this.oSts=new r.Sts,this.defSts(this.oSts),o(this.gCtx(),!0))},r.ComboBox&&(t.prototype.dCBl=function(t,e,o){o.oO.label=this.GetValue()},t.prototype.sCB=function(t){return t&&this.SetValue(0),this.GetValue()},t.prototype.SetCanvas=function(t,e){return r.ComboBox.implExHost(t,"onchange")}(t.prototype.SetCanvas)),t.prototype.SetClientRect=function(t){var e=r.CC.GetCanvas(t);e&&(t=[0,0,e.width,e.height]),this.client=r.C2R(t),!this.visAO()&&this.resAO(),this.onRL()},t.prototype.GetClientRect=function(){return this.client.slice()},t.prototype.GetLayersClientRect=function(){return this.GetClientRect()},t.prototype.GetCanvasRect=function(){var t=this.GetClientRect(),o=this.GetCanvas();return e(o)&&(t=[0,0,o.width,o.height]),t},t.prototype.GetVisibleRect=function(){return r.NRt(this.GetClientRect(),this.GetCanvasRect())},t.prototype.GetViewRect=function(){return r.EArtC(this.GetCanvas())},t.prototype.c2V=function(t,e){return r.CW.prototype.c2V.apply(this,arguments)},t.prototype.v2C=function(t,e){return r.CW.prototype.v2C.apply(this,arguments)},t.prototype.c2Vrt=function(t){var e=this.c2V(t);return[e.x,e.y,t[2],t[3]]},t.prototype.v2Crt=function(t){var e=this.v2C(t);return[e.x,e.y,t[2],t[3]]},t.prototype.bCTX=function(t){return r.TFI.bCTX(t,this.getTfi())},t.prototype.eCTX=function(t,e){r.TFI.eCTX(t,e)},t.prototype.getCompatCanvas=function(t,e){var o=r.doc.createElement("canvas"),i=o.getContext("2d");return o.width=t,o.height=e,r.iCTX(i),this.bCTX(i),o},t.prototype.onmousemove=function(t){var e,o=this.gPtr(t),i=this.getCursor(o);return(e=this.GetCanvas())&&(e.style.cursor=i||"auto"),this.onHover(o),i},t.prototype.onmouseout=function(t){this.onHover(null)},t.prototype.onRURStart=function(t){},t.prototype.onRUREnd=function(t){},t.prototype.onHover=function(t){var e=this.p2L(t);e!=this.oHov&&(this.oHov&&this.onLayerOut(this.oHov),this.oHov=e,this.oHov&&this.onLayerIn(this.oHov))},t.prototype.onLayerIn=function(t){this.onlayerin(t)},t.prototype.onlayerin=function(t){this.oLts.onlayerin.do(t)},t.prototype.onLayerOut=function(t){this.onlayerout(t)},t.prototype.onlayerout=function(t){this.oLts.onlayerout.do(t)},t.prototype.onwheel=function(t){if(this.isSelectable()){var o=this.gPtr(t);if(e(o)&&r.PInR(o.x,o.y,this.GetClientRect()))return this.dowheel(t)}return!1},t.prototype.dowheel=function(t){var e=r.WhelInc(t);if(e){var o=this.getWheelChange();if(o){var i=this.getWheelValue(),n=this.getWheelValue(o*e),s=n-i;return s&&(Math.abs(s)<4||0==this.GetSmooth()?this.SetValue(n):this.Smooth(function(){this.SetValue(n)},this)),!0}}return!1},t.prototype.getWheelValue=function(t){var o=this,i=this.oLys,n=e(this.wheelValue)?this.wheelValue:this.GetValue(),s=n;if(this.wheelTimeout&&clearTimeout(this.wheelTimeout),this.wheelTimeout=null,e(o.wheelValue)&&(this.wheelTimeout=setTimeout(function(){o.wheelValue=null},500)),t){n-=t,this.lock();var r=j.Save(i),a=-Math.sign(t);if(n=this.SetValue(n),Math.sign(n-s)!=a){for(var l=s,p=s-t,f=s,c=l,y=p;Math.abs(c-y)>.005;){var g=(c+y)/2;n=this.SetValue(g),Math.sign(n-s)!=a?y=g:(c=g,f=n)}(nh(l,p))&&(n=f)}j.Restore(i,r),this.unlock(),this.wheelValue=n}return n},t.prototype.ondown=function(t){var e=this.hitTest(this.gPtr(t));if(e)return e.callback&&e.callback.call(e.thisArg,t,e),!0},t.prototype.onkeydown=function(t){this.onkey(t,-1)},t.prototype.onkeyup=function(t){this.onkey(t,0)},t.prototype.onkeypress=function(t){this.onkey(t,1)},t.prototype.onkey=function(t,e){this.oSts&&this.oSts.onkey(t,e)},t.prototype.udefSts=function(t){t&&t.RemoveOf(this)},t.prototype.defSts=function(t){},t.prototype.iLts=function(){this.Listeners=this.oLts=new r.Lts,this.oLts.Add("onchange"),this.oLts.Add("onclick"),this.oLts.Add("onanchorclick"),this.oLts.Add("ondragstart"),this.oLts.Add("ondrag"),this.oLts.Add("ondragend"),this.oLts.Add("onlayerin"),this.oLts.Add("onlayerout")},r.Lts.Onf(t.prototype),t.prototype.onChange=function(t){this.onchange(t)},t.prototype.onchange=function(t){this.oLts.onchange.do(t)},t.prototype.onA=function(t,e){t&&(this.oLys.forEach(null,function(o){o.onA(t,e)}),this.Refresh(),this.onanchorclick(t))},t.prototype.onanchorclick=function(t){this.oLts.onanchorclick.do(t)},t.toClick=function(t){return{uiEvent:t,dblClick:t.drag&&(t.drag.long||1!=t.drag.click)||!1,button:r.e2B(t),modifiers:r.ModK(t)}},t.prototype.toClick=function(t,e){e.layer=this.e2HT(t)},t.prototype.onClick=function(e){var o=this.gPtr(e),i=t.toClick(e);return this.toClick(e,i),this.onA(this.p2A(o),i),this.onclick(i),i},t.prototype.onclick=function(t){this.oLts.onclick.do(t)},t.prototype.onDragStart=function(t){this.ondragstart(t)},t.prototype.ondragstart=function(t){this.oLts.ondragstart.do(t)},t.prototype.onDrag=function(t){this.ondrag(t)},t.prototype.ondrag=function(t){this.oLts.ondrag.do(t)},t.prototype.onDragEnd=function(t){this.ondragend(t)},t.prototype.ondragend=function(t){this.oLts.ondragend.do(t)},t.prototype.hitTest=function(t){var e;if(t&&this.isSelectable()&&(e=this.p2HT(t)))return{code:e,callback:function(t,e){this.onHTDown(e.code,t)},thisArg:this}},t.prototype.onHTDown=function(t,e){if(t&&t.isSable()){var o=t.oLObj,i=null;r.RUR.Do(e,function(e){switch(e.drag.status){case 1:this.onRURStart(e),t.isDable()&&(i={value:o.getDValue(),cumulativeRotateAngle:null,drag:null});var n={layer:t,cancel:!1,event:e};this.onDragStart(n),n.cancel&&r.RUR.Cancel();break;case 2:i&&(i.drag=e.drag,o.setDValue(i)&&t.refresh());var s={layer:t,event:e};this.onDrag(s);break;case 4:case 5:this.onClick(e);break;case 7:var a={layer:t,event:e};this.onDragEnd(a),this.onRUREnd(e);break;case 6:this.swipe(t,e.drag.swipe)}},this)}},t.prototype.onSwipe=function(t,e,o,i){},t.prototype.swipe=function(t,e){if(t&&e&&(e.dx||e.dy)){var o=[];switch(t.GetOnDrag()){case 1:e.dx&&o.push({f:t.GetOffsetX(),d:1.5*e.dx,c:t.SetOffsetX}),e.dy&&o.push({f:t.GetOffsetY(),d:1.5*e.dy,c:t.SetOffsetY});break;case 2:case 3:o.push({f:t.GetRotateAngle(),d:a.Angle(t.oLObj.oLR.getRotateCenter(!0),e,[e.x+1.5*e.dx,e.y+1.5*e.dy]),c:t.SetRotateAngle})}this.onSwipe(t,e,1.5,o),o.length&&(r.A.Cancel("gswipe"),r.A.Progress(function(e){this.bU(),o.forEach(function(o){o.c.call(t,o.f+e*o.d)}),this.eU()},{name:"gswipe",thisArg:this,duration:h(250,1.5*e.time),onXDoL:!1,transition:"swipe"}))}},t.prototype.onSetAO=function(t){},t.prototype.onimg=function(){this.Refresh()},t.prototype.onRL=function(){this.oLyt=null,this.resetLV()},t.prototype.BeginUpdate=function(){this.lI++},t.prototype.bU=t.prototype.BeginUpdate,t.prototype.EndUpdate=function(){--this.lI||this.rfhAO()},t.prototype.eU=t.prototype.EndUpdate,t.prototype.Update=function(t,e){this.bU(),t instanceof Function&&t.call(e||this),this.eU()},t.prototype.lock=function(){this.lI++,this.bU(),this.oLts.lock()},t.prototype.unlock=function(){this.eU(),this.oLts.unlock(),this.lI--},t.prototype.Refresh=function(){this.bU(),this.onRL(),this.eU()},t.prototype.Smooth=function(t,o){if(t instanceof Function){var i=this.getSmooth();if(i){var n=this.oLys,s=null,a=null;this.lock(),s=j.Save(n),t.call(o||this),a=j.Diff(j.Save(n),s),j.Restore(n,s),this.unlock(),e(a)&&(r.A.Cancel(this.sSA),r.A.Progress(function(t){this.bU(),a.forEach(function(o,i){var n=s.get(i);if(e(n))for(var r in o)i["Set"+r].call(i,n[r]+t*(o[r]-n[r]))}),this.eU()},{name:this.sSA,thisArg:this,duration:i,onXDoL:!1,transition:"ease"}))}else t.call(o)}},t.prototype.getRLV=function(){return o(this.oRLV)&&(this.oRLV=new G),this.oRLV},t.prototype.resetLV=function(t){o(t)?(this.oLys.onResetLV(),this.oRLV=null):e(this.oRLV)&&this.oRLV.reset(t)},t.prototype.Lyt=function(){if(o(this.oLyt)){var t=this.gCtx(),e=null;t&&(e=this.bCTX(t)),this.oLyt=new U(this),t&&this.eCTX(t,e)}return this.oLyt},t.prototype.getVO=function(){return this.Lyt().rgVO},t.prototype.draw=function(t,e){t.selClip(e),this.getVO().forEach(function(e,o){o.draw(t,e)}),t.resClip()},t.prototype.p2LV=function(t){var o;if(t){var i=a.X(t),n=a.Y(t);r.PInR(i,n,this.GetClientRect())&&this.getVO().rforEachU(function(t,s){if(r.PInR(i,n,t)&&s.oLayer.isSable()&&e(s.getImage())&&s.isVisible(i-t[0],n-t[1]))return!!(o={oLayerView:s,rtView:t})},this)}return o},t.prototype.p2A=function(t){var e=this.p2AL(t);return e&&e.a},t.prototype.p2AL=function(t){return this.getVO().rforEachU(function(e,o){var i=o.oLayer,n=i.p2A(t,e);return n&&{a:n,l:i}})},t.prototype.p2L=function(t){var o,i,n=this.p2AL(t),s=n&&n.l;return s||this.isSelectable()&&(o=a.X(t),i=a.Y(t),r.PInR(o,i,this.GetClientRect())&&this.getVO().rforEachU(function(t,n){if(r.PInR(o,i,t)&&n.oLayer.isSable()&&e(n.getImage())&&n.isVisible(o-t[0],i-t[1]))return!!(s=n.oLayer)},this)),s&&(s.isDable()||(s=this.oLys.getLayerDragAny()||s)),s},t.prototype.p2HT=function(t){var e=this.p2L(t);return e&&e.isSable()&&e||null},t.prototype.e2HT=function(t){return this.p2HT(this.gPtr(t))},t.prototype.GetTfi=function(){return this.oO.tfi},t.prototype.SetTfi=function(t){this.bU(),this.oO.tfi=t||null,this.onRL(),this.eU()},t.prototype.getTfi=function(){return this.opt("tfi")},t.prototype.GetFormatText=function(){return this.oO.formatText},t.prototype.SetFormatText=function(t){this.bU(),this.nFT=null,this.oO.formatText=t,this.onRL(),this.eU()},t.prototype.getFormatText=function(){return o(this.nFT)&&(this.nFT=i(this.opt("formatText"),r.DrawTextFormatEnum,r.DrawTextFormatEnum.exTextAlignCenter|r.DrawTextFormatEnum.exTextAlignVCenter)),this.nFT},t.prototype.GetLocked=function(){return this.oO.locked},t.prototype.SetLocked=function(t){this.bU(),this.oO.locked=t,this.onRL(),this.eU()},t.prototype.getLocked=function(){return this.opt("locked",!1)||this.isReadOnly()},t.prototype.GetReadOnly=function(){return this.oO.readOnly},t.prototype.SetReadOnly=function(t){this.bU(),this.oO.readOnly=t,this.onRL(),this.eU()},t.prototype.isReadOnly=function(){return this.opt("readOnly",!1)},t.prototype.GetWheelChange=function(){return this.oO.wheelChange},t.prototype.SetWheelChange=function(t){this.bU(),this.oO.wheelChange=t,this.onRL(),this.eU()},t.prototype.getWheelChange=function(){return this.opt("wheelChange",1)},t.prototype.GetCursors=function(){return this.oO.cursors},t.prototype.SetCursors=function(t){this.bU(),this.sCrs=null,this.oO.cursors=t,this.onRL(),this.eU()},t.prototype.getCursors=function(){return o(this.sCrs)&&(this.sCrs=f(this.opt("cursors"),"pointer(dable,anchor)")),this.sCrs},t.prototype.getCursor=function(t){var e,i,n;return this.isSelectable()&&(i=this.getCursors(),!r.H.lA&&this.p2A(t)?e=r.GP.Get("anchor",i):(n=this.p2L(t))&&(n.isDable()&&(e=r.GP.Get("dable",i)),o(e)&&n.isSable()&&(e=r.GP.Get("sable",i)))),e||null},t.prototype.GetLayers=function(){return this.oLys},t.prototype.SetLayers=function(t){if(this.bU(),this.oO.layers=t,this.oLys.Clear(),p(t))this.oLys.Load(this.getLayers());else if(e(t))if(l(t))for(var i in t){var n=t[i];n&&o(n.key)&&(n.key=i),this.oLys.Add(n)}else(t.forEach&&t||[t]).forEach(function(t){this.oLys.Add(t)},this);return this.eU(),this.GetLayers()},t.prototype.defLayers=function(){return""},t.prototype.getLayers=function(){return this.opt("layers",this.defLayers())},t.prototype.GetLayerAutoSize=function(){return this.oO.layerAutoSize},t.prototype.SetLayerAutoSize=function(t){this.bU(),this.oO.layerAutoSize=t,this.Refresh(),this.eU()},t.prototype.getLayerAutoSize=function(){return this.opt("layerAutoSize",0)},t.prototype.GetLayerOfValue=function(){return this.oO.layerOfValue},t.prototype.SetLayerOfValue=function(t){this.bU(),this.oLys.oLVal=void 0,this.oO.layerOfValue=t,this.eU()},t.prototype.getLayerOfValue=function(){return this.opt("layerOfValue",-1)},t.prototype.GetValue=function(){return this.oLys.GetValue()},t.prototype.SetValue=function(t){return this.GetValue()!=t&&(this.bU(),this.oLys.SetValue(t),this.eU()),this.GetValue()},t.prototype.GetSmooth=function(){return this.oO.smooth},t.prototype.SetSmooth=function(t){this.oO.smooth=t},t.prototype.getSmooth=function(){return h(0,r.ToN(this.opt("smooth",125)))},t.prototype.Unshuffle=function(){this.Shuffle(0)},t.prototype.Shuffle=function(t){var i=this.getVO();if(e(i)){o(i.original)&&(i.original=i.copy());var n=i.original;(t=e(t)?t:.5)&&(n=i.copy().shuffle(t)),i.morph(n,{inv:this.rfhAO,thisArg:this,duration:this.getSmooth(),name:"shuffle",transition:"ease"})}},t.prototype.GetDebug=function(){return this.oO.debug},t.prototype.SetDebug=function(t){this.bU(),this.bDebug=null,this.oO.debug=t,this.onRL(),this.eU()},t.prototype.isDebug=function(){return o(this.bDebug)&&(this.bDebug=this.opt("debug",!1)),this.bDebug},t.prototype.GetShowLayers=function(){return this.oO.showLayers},t.prototype.SetShowLayers=function(t){this.bU(),this.oLys.rgSL=void 0,this.oO.showLayers=t,this.onRL(),this.eU()},t.prototype.GetLayerDragAny=function(){return this.oO.layerDragAny},t.prototype.SetLayerDragAny=function(t){this.bU(),this.oLys.oLAny=void 0,this.oO.layerDragAny=t,this.eU()},t.prototype.getLayerDragAny=function(){return this.opt("layerDragAny",-1)},t.prototype.Layer=function(t){return this.oLys.Item(t)},c.prototype.set=function(t){return this.oExpr=r.E.Create(t,"value")},c.prototype.get=function(){return this.oExpr.GetExpr()},c.prototype.isValid=function(){return this.oExpr.IsValid()},c.prototype.eval=function(t,e){var o=e||0;return this.isValid()&&(o=r.ToN(this.oExpr.Evaluate(function(e){return t}))),o},c.prototype.evalA=function(t,e){var o=e||"";return this.isValid()&&(o=this.oExpr.Evaluate(function(e){return t})),o},y.prototype.set=function(t){return this.oExpr=r.E.Create(t,"width,height")},y.prototype.get=function(){return this.oExpr.GetExpr()},y.prototype.isValid=function(){return this.oExpr.IsValid()},y.prototype.eval=function(t,e){var o=e||0;return this.isValid()&&(o=r.ToN(this.oExpr.Evaluate(function(e){return t[-e-1]}))),o},g.prototype.set=function(t){return this.oExpr=r.E.Create(t,"value,x,y,lwidth,lheight,width,height")},g.prototype.get=function(){return this.oExpr.GetExpr()},g.prototype.isValid=function(){return this.oExpr.IsValid()},g.prototype.eval=function(t,e){var o=e||0;return this.isValid()&&(o=r.ToN(this.oExpr.Evaluate(function(e){return t[-e-1]}))),o};var D=c;d.prototype.set=function(t){return this.oExpr=r.E.Create(t,"value,x,offsetx,y,offsety")},d.prototype.get=function(){return this.oExpr.GetExpr()},d.prototype.isValid=function(){return this.oExpr.IsValid()},d.prototype.eval=function(t,e){var o=e||0;return this.isValid()&&(o=r.ToN(this.oExpr.Evaluate(function(e){return t[-e-1<3?0:1]}))),o},L.prototype.set=function(t){return this.oExpr=r.E.Create(t,"lwidth,lheight,width,height")},L.prototype.get=function(){return this.oExpr.GetExpr()},L.prototype.isValid=function(){return this.oExpr.IsValid()},L.prototype.eval=function(t,e){var o=e||0;return this.isValid()&&(o=r.ToN(this.oExpr.Evaluate(function(e){return t[-e-1]}))),o},v.prototype.set=function(t){return this.oExpr=r.E.Create(t,"value,lwidth,width,lheight,height")},v.prototype.get=function(){return this.oExpr.GetExpr()},v.prototype.isValid=function(){return this.oExpr.IsValid()},v.prototype.eval=function(t,e,o){var i=o||0;return this.isValid()&&(i=r.ToN(this.oExpr.Evaluate(function(o){switch(o){case-1:return e;case-2:case-3:return t.width;case-4:case-5:return t.height}}))),i},O.prototype.init=function(t){this.oT=t,this.rgL=new r.Arr,this.lC=0},O.prototype.bU=function(){this.oT.bU()},O.prototype.eU=function(t){(o(t)||t)&&this.oT.onRL(),this.oT.eU()},O.prototype.onResetLV=function(){this.forEach(null,function(t){t.oRmC=null})},O.prototype.getKeys=function(){if(o(this.rgK)){var t=new Map;this.forEach(-1,function(e){var o=e.getKey();o&&void 0===t.get(o)&&t.set(o,e)}),this.rgK=t}return this.rgK},O.prototype.item=function(t){if(t||0==t){var e=this.getKeys().get(t);if(e)return e;if(r.IsI(t))return this.rgL.at(t);if(this.rgL.has(t))return t}return null},O.prototype.setKey=function(t,e){e&&null==this.item(e)&&(this.oLVal=void 0,this.oLAny=void 0,this.rgK=null,this.rgSL=void 0,t.key=e,this.onChangeLayers())},O.prototype.getPos=function(t){return this.rgL.getPos(t)},O.prototype.setPos=function(t,e){-1!=this.rgL.setPos(t,e)&&(this.bU(),this.eU())},O.prototype.onChange=function(t){var e=this.oT;this.forEach(1,function(t){t.isValued()&&e.resetLV(t)},this),e.onChange(t)},O.prototype.getIndex=function(t){return this.rgL.indexOf(t)},O.prototype.forEach=function(t,e,i){if(function(t){return t instanceof Function}(t))this.rgL.forEach(t,e);else if(t&&0!=t)if(-1==t)this.rgL.forEachI(e,i);else{var n=this.getShowLayers();o(n)?this.rgL.forEach(function(o){t==(t&o.oLObj.oViewableLObj.nFlags)&&e.call(i,o)},this):(t&=-2,this.rgL.forEach(function(o){t==(t&o.oLObj.oViewableLObj.nFlags)&&n.has(o)&&e.call(i,o)},this))}else this.rgL.forEach(e,i)},O.prototype.getVisibleLayers=function(){return this.oT.GetShowLayers()},O.prototype.getShowLayers=function(){if(void 0===this.rgSL){var t=null,o=this.getVisibleLayers();e(o)&&"all"!=(o=o.toString())&&(t=new r.Arr,o.split(",").forEach(function(e){var o=this.Item(e);o&&t.push(o)},this)),this.rgSL=t}return this.rgSL},O.prototype.getLayersClientRect=function(){return this.getLayersClientOffset(this.oT.GetLayersClientRect())},O.prototype.getLayerAutoSize=function(){return this.Item(this.oT.getLayerAutoSize())},O.prototype.getLayersClientOffset=function(t){var i=this.getLayerAutoSize(),n=null;if(e(i))n=i.getAutoSize();else if(this.forEach(1,function(t){o(i)&&(i=t)}),e(i)){var s=i.getBackSize();e(s)&&(n=r.HP.Scale(s,t[2],t[3]))}return e(n)&&(t[0]+=(t[2]-n.width)/2,t[2]=n.width,t[1]+=(t[3]-n.height)/2,t[3]=n.height),t},O.prototype.getLayerOfValue=function(){return void 0===this.oLVal&&(this.oLVal=this.Item(this.oT.getLayerOfValue())||null,o(this.oLVal)&&this.rgL.rforEachU(function(t){if(t.GetVisible()&&t.oLObj.hasValue())return!!(this.oLVal=t)},this)),this.oLVal},O.prototype.getLayerDragAny=function(){return void 0===this.oLAny&&(this.oLAny=this.Item(this.oT.getLayerDragAny())||null),this.oLAny},O.prototype.onIdem=function(t){this.rgId=null},O.prototype.getIdem=function(t){var i=this.rgId,n=this;if(o(i)){var s=new Map,a=new Map;if(this.forEach(-1,function(t){var i=function(t){var e=null,o=t.GetIdem();if(o)if(r.IsS(o))e=[],o.split(",").forEach(function(o){var i=n.item(o);i&&i!=t&&e.push(i)},this),0==e.length&&(e=null);else{var i=n.item(o);i&&i!=t&&(e=[i])}return e}(t);if(e(i)){var s=a.get(t);o(s)&&a.set(t,s=new r.Arr),s.push(i)}},this),a.size){var h=new r.Arr;for(a.forEach(function(t,e){h.push(e,t)});!h.isEmpty();){for(var u=new r.Arr(h.first()),l=!0;l;)l=!1,a.forEach(function(t,e){var o=u.len();(u.has(e)||u.include(t).length||t.include(u).length)&&u.push(e,t),l||(l=o!=u.len())});u.len()>1&&u.forEach(function(t){var e=[];u.forEach(function(o){t!=o&&e.push(o)}),s.set(t,e)}),h.removeRange(u)}}this.rgId=i=s}return i.get(t)||null},O.prototype.GetCount=function(){return this.rgL.len()},O.prototype.SetCount=function(t){if(0==(t=h(0,~~t)))this.Clear();else{this.bU();for(var e=0;(e=this.GetCount())>t;)this.Remove(e-1);for(e=this.GetCount();e=0)for(var n=t.split("."),s=n.length,r=!0,a=0;r&&a180&&(r>0?r-=360:r=360+r),s=t.cumulativeRotateAngle=this.oLR.oRotateAngleValid.eval(a.D236(t.cumulativeRotateAngle)+r,s)}e=this.setRotateAngle(s)}return e},w.prototype.bU=function(){this.oLayer.bU()},w.prototype.eU=function(t){this.oLayer.eU(t)},w.prototype.isEmpty=function(){return!this.p},w.prototype.select=function(t,e){if(!this.isEmpty()){var o={width:e[2],height:e[3]};t.selClip(this.getClipRect(o),this.p,this.pArg(o))}},w.prototype.restore=function(t){this.isEmpty()||t.resClip()},w.prototype.getOffset=function(t){var e=[0,0],o=this.getValue();return e[0]=this.oOffsetX.eval(t,o,0),e[1]=this.oOffsetY.eval(t,o,0),e},w.prototype.getClipRect=function(t){var e=this.getValue(),o=this.oLeft.eval(t,e,0),i=this.oTop.eval(t,e,0),n=this.oWidth.eval(t,e,t.width),s=this.oHeight.eval(t,e,t.height);switch(this.p){case"Ellipse":case"Pie":this.oRadiusX.isValid()&&(n=2*this.oRadiusX.eval(t,e,n/2),o=(t.width-n)/2),this.oCenterX.isValid()&&(o=this.oCenterX.eval(t,e,n/2)-n/2),this.oRadiusY.isValid()&&(s=2*this.oRadiusY.eval(t,e,s/2),i=(t.height-s)/2),this.oCenterY.isValid()&&(i=this.oCenterY.eval(t,e,s/2)-s/2)}var a=[o,i,n,s],h=this.getOffset(t);return r.ORt(a,h[0],h[1]),a},w.prototype.pArg=function(t){var e=null,o=this.getValue();switch(this.p){case"Pie":e={startAngle:a.D2R(this.oStartAngle.eval(t,o,0)),sweepAngle:a.D2R(this.oSweepAngle.eval(t,o,0))};break;case"RoundRect":e={x:this.oRoundX.eval(t,o,0),y:this.oRoundY.eval(t,o,0)}}return e},w.Types=r.BiM.Split("rect(Rect),roundrect(RoundRect),ellipse(Ellipse),pie(Pie)"),w.prototype.GetType=function(){return this.type},w.prototype.SetType=function(t){this.bU(),this.type=t,this.p=t?w.Types.get(t.toString().toLowerCase()):null,this.eU()},w.prototype.GetValue=function(){return this.value},w.prototype.SetValue=function(t){this.bU(),this.value=t,this.eU()},w.prototype.getValue=function(){var t=this.value;return o(t)&&(t=this.oLayer.oLys.GetValue()),t},w.prototype.GetOffsetX=function(){return this.oOffsetX.get()},w.prototype.SetOffsetX=function(t){this.bU(),this.oOffsetX.set(t),this.eU()},w.prototype.GetOffsetY=function(){return this.oOffsetY.get()},w.prototype.SetOffsetY=function(t){this.bU(),this.oOffsetY.set(t),this.eU()},w.prototype.GetLeft=function(){return this.oLeft.get()},w.prototype.SetLeft=function(t){this.bU(),this.oLeft.set(t),this.eU()},w.prototype.GetTop=function(){return this.oTop.get()},w.prototype.SetTop=function(t){this.bU(),this.oTop.set(t),this.eU()},w.prototype.GetWidth=function(){return this.oWidth.get()},w.prototype.SetWidth=function(t){this.bU(),this.oWidth.set(t),this.eU()},w.prototype.GetHeight=function(){return this.oHeight.get()},w.prototype.SetHeight=function(t){this.bU(),this.oHeight.set(t),this.eU()},w.prototype.GetRoundRadiusX=function(){return this.oRoundX.get()},w.prototype.SetRoundRadiusX=function(t){this.bU(),this.oRoundX.set(t),this.eU()},w.prototype.GetRoundRadiusY=function(){return this.oRoundY.get()},w.prototype.SetRoundRadiusY=function(t){this.bU(),this.oRoundY.set(t),this.eU()},w.prototype.GetRadiusX=function(){return this.oRadiusX.get()},w.prototype.SetRadiusX=function(t){this.bU(),this.oRadiusX.set(t),this.eU()},w.prototype.GetRadiusY=function(){return this.oRadiusY.get()},w.prototype.SetRadiusY=function(t){this.bU(),this.oRadiusY.set(t),this.eU()},w.prototype.GetCenterX=function(){return this.oCenterX.get()},w.prototype.SetCenterX=function(t){this.bU(),this.oCenterX.set(t),this.eU()},w.prototype.GetCenterY=function(){return this.oCenterY.get()},w.prototype.SetCenterY=function(t){this.bU(),this.oCenterY.set(t),this.eU()},w.prototype.GetStartAngle=function(){return this.oStartAngle.get()},w.prototype.SetStartAngle=function(t){this.bU(),this.oStartAngle.set(t),this.eU()},w.prototype.GetSweepAngle=function(){return this.oSweepAngle.get()},w.prototype.SetSweepAngle=function(t){this.bU(),this.oSweepAngle.set(t),this.eU()},w.prototype.GetOptions=function(){return n.call(this,E)},w.prototype.SetOptions=function(t){this.bU(),s.call(this,t),this.eU()},A.prototype.bU=function(){this.oLayer.bU()},A.prototype.eU=function(t){this.oLayer.eU(t)},A.prototype.hasValid=function(){return this.oRed.isValid()||this.oGreen.isValid()||this.oBlue.isValid()},A.prototype.getValue=function(){return this.oLayer.oLys.GetValue()},A.prototype.byO=function(){var t=[.5,.5,.5];return this.oRed.isValid()&&(t[0]=this.oRed.eval(this.getValue(),100)/100),this.oGreen.isValid()&&(t[1]=this.oGreen.eval(this.getValue(),100)/100),this.oBlue.isValid()&&(t[2]=this.oBlue.eval(this.getValue(),100)/100),t},A.prototype.GetRed=function(){return this.oRed.get()},A.prototype.SetRed=function(t){this.bU(),this.oRed.set(t),this.eU()},A.prototype.GetGreen=function(){return this.oGreen.get()},A.prototype.SetGreen=function(t){this.bU(),this.oGreen.set(t),this.eU()},A.prototype.GetBlue=function(){return this.oBlue.get()},A.prototype.SetBlue=function(t){this.bU(),this.oBlue.set(t),this.eU()},A.prototype.GetOptions=function(){return n.call(this,x)},A.prototype.SetOptions=function(t){this.bU(),s.call(this,t),this.eU()},U.prototype.doL=function(){var t=this.oT.oLys,o=t.getLayersClientRect(),i=this.oT.getRLV();t.forEach(1,function(t){if(!t.isEmpty()){var e=t.getLayerRect(o),n={width:e[2],height:e[3]};n.width>0&&n.height>0&&this.rgVO.push(i.get(t,n),e)}},this);var n=this.rgVO.union();if(this.oT.isDebug()&&e(n)){var s=this.rgVO.len();if(s>1){var r=this.oT.GetClientRect()[3]/2-8,a=u(r/4,r/(s-1)),h=a*s-u(r,a*(s-1))/2;this.rgVO.forEach(function(t){t[1]+=h-=a}),n=this.rgVO.union()}}return{width:n?n[2]:0,height:n?n[3]:0}},T.prototype.iCanvas=function(t){this.bReset=!0,this.oImage=null,this.oCanvas=this.oLayer.oLys.oT.getCompatCanvas(t.width,t.height),this.ctx=this.oCanvas.getContext("2d")},T.prototype.reset=function(){this.bReset=!0,this.oImage=null},T.prototype.getCanvas=function(){return this.bReset&&(this.bReset=!1,this.build()),this.oCanvas},T.prototype.build=function(){var t=this.ctx,e=this.oLayer,o=[0,0,this.oSize.width,this.oSize.height],i=e.oLObj,n=i.oLR,s=i.isRotamove(),h=s?0:a.D2R(n.doRotate());if(t.save(),t.clearRect.apply(t,o),this.bDebug){var u=a.R2C(o);t.setTransform(1,Math.sin(Math.PI/4/4),-Math.sin(Math.PI/2),1,u[0],u[1]),t.translate(-u[0],-u[1]),t.scale(.5,.5),t.translate(u[0],u[1]),t.drawHTMLText(""+e.getKey(),r.IRt(o.slice(),-16,0),r.DrawTextFormatEnum.exTextAlignRight|r.DrawTextFormatEnum.exTextNoClip);var l=t.getLineDash();t.setLineDash([3,3]),t.drawFrameRect(o,"rgba(128,128,128,0.40)"),t.setLineDash(l)}var p=e.getClip();if(p&&!e.bRc&&p.select(t,o),s){var f=n.getRotamoveOffset();t.translate(f[0],f[1])}else if(h){var c=n.getRotateCenter(),y=c[0],g=c[1];t.translate(y,g),t.rotate(h),t.translate(-y,-g)}p&&e.bRc&&p.select(t,o),this.drawLayer(e,t,o),p&&p.restore(t),t.restore()},T.prototype.drawLayer=function(t,e,o){t.draw(e,o)},T.prototype.getImage=function(){if(this.getCanvas(),o(this.oImage)&&this.oSize.width&&this.oSize.height)try{this.oImage=this.ctx.getImageData(0,0,this.oSize.width,this.oSize.height)}catch(t){console.log(t)}return this.oImage},T.prototype.getPixel=function(t,e){return~~t+this.oSize.width*~~e<<2},T.prototype.isVisible=function(e,o,i){return(i=i||this.getImage().data)[this.getPixel(e,o)+3]>t.vAlpha},T.prototype.ToRect=function(){var t=this.oSize.width,o=this.oSize.height,i=[0,0,t,o],n=this.getImage();if(e(n)){for(var s=n.data,r=!1,a=0,h=0;!r&&a=0;a--)for(h=0;!r&&h=0;h--)for(a=0;!r&&a