/* @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(){}function o(t){return t instanceof Array}function i(t){return t instanceof c.Arr}function n(t){return t instanceof Function}function s(t){return t instanceof g.Element}function r(t){return t instanceof g.Pool}function h(t){return t instanceof g.PoolHeader}function a(t){return t instanceof g.PoolSplitter}function l(){return Math.max.apply(0,arguments)}function p(t){return null!=t}function u(t){return null==t}var c=c||window.exontrol,f=c.G,g=c.Surface,d=g.prototype,S=g.SV,C=c.UR,P=c.Def.UR.Surface;c.Swimlane=g,c.Mrg(P,{AddPool:"AddPool",RemovePool:"RemovePool",MovePool:"MovePool",UpdatePool:"UpdatePool"}),g.Options.spools=null,d.exports=function(t){return function(){t.apply(this,arguments);var e=this.oSV;p(e)&&["GetPools"].forEach(function(t){t in this||(this[t]=e[t].bind(e))},this)}}(d.exports),d.GetStatistics=function(t){function e(t,e){return c.Format(t,e||0)}return function(){var o=t.apply(this,arguments),i=this.oSV,n=o.indexOf("\nElement:");return o.slice(0,n)+"\nPool: "+e(i.Lyt().lPools())+"/"+e(i.oSP.GetCount())+o.slice(n)}}(d.GetStatistics),c.expO({statistics:null},d,null,!0),d.defAA=function(){return"fit(Shift+MButton,Ctrl+MButton,Alt+MButton),zoom(MButton),select(Shift,Ctrl),link(Alt)[toggle],create[pool](Ctrl+Alt),create[element](Alt),move,resize-header,resize-lane,resize-phase,scroll"},d.roAA=function(){return"scroll,zoom,fit,select"},Object.defineProperty(d,"Pools",{get:function(){return this.GetPools()}}),d.Pool=function(t){return this.oSV.oSP.Item(t)},d.Lane=function(t,e){var o=this.oSV.oSP.Item(t);return o&&o.Lane(e)},d.Phase=function(t,e){var o=this.oSV.oSP.Item(t);return o&&o.Phase(e)},S.prototype.iObj=function(t){return function(){t.apply(this,arguments),this.oSP=new g.Pools(this)}}(S.prototype.iObj),S.prototype.onRurClick=function(t){return function(e){!r(e)&&t.apply(this,arguments)}}(S.prototype.onRurClick),S.prototype.onAddPool=function(t){this.onRL()},S.prototype.onDelPool=function(t){this.onRL()},S.prototype.onMovePool=function(t,e){},S.prototype.defShp=function(t){return function(){return"Border(pool,lane,phase),Button(header),"+t.apply(this,arguments)}}(S.prototype.defShp),S.prototype.defCrs=function(t){return function(){return t.apply(this,arguments)}}(S.prototype.defCrs),S.prototype.drawS=function(t){return function(e,o){if(0==o){var i=this.Lyt().lPools();this.drawO(e,0,i),this.drawL(e),this.drawO(e,i),this.drawLCP(e)}else t.call(this,e,o)}}(S.prototype.drawS),S.prototype.allowResizeCursor=function(t){return function(e){return h(e)?this.gAA().Has("resize-header",e):a(e)&&"lanes"in e?this.gAA().Has("resize-lane",e):a(e)&&"phases"in e?this.gAA().Has("resize-phase",e):t.call(this,e)}}(S.prototype.allowResizeCursor),S.prototype.rurActionExtra=function(t){return function(e,o){function i(t,e){var o;e?o=n:n||(o=n=!n),o&&this.onRURPool(t,e)}t.call(this,e,o);var n,s=this.p2HT(this.gPtr(e)),r=this.isC();if(s)switch(o.rurName){case"resize-header":if(h(s.o)){var l=s.o,u=this.getShape("frameDrag"),g=l.ht(),y=l.getClient(),d=l.size,S=new c.M1;if(l.pool.getMoveObj().forEach(function(t){S.set(t,t.getClient())}),o.rurAllowUpdateScrollRange=!0,u){O=null;c.EyO(u)&&(u=null);function C(t,e,o,i){O=O||i;var n=[this.scaled(o[0]),this.scaled(o[1]),this.scaled(o[2]),this.scaled(o[3])];this.ctxScale(e,[0,0,0,0],function(){u?e.drawShape(n,u.normal||u):l?l.drawH(e,n):e.drawFrameRect(n)},this)}o.rurEFPaint=C,o.rurEFOpts=function(t,e){e.visible=!1},o.rurDrag=function(t){p(O)&&O.SetVisible(t.from!=t.to);var e=t.to.x-t.from.x,i=t.to.y-t.from.y;t.frame=this.htR(g,e,r?-i:i,y,[0,0]),r&&(t.frame[1]+=i),null==o.rurEFPaint&&C.call(this,t,this.gCtx(),this.rtCA(t.frame,!1))},o.rurDrop=function(t){i.call(this,l.pool,0);var e=t.to.x-t.from.x,o=t.to.y-t.from.y,n=this.htR(g,e,r?-o:o,y,[0,0]);this.Smooth(function(){this.bU(),l.setClient(n,d,S),this.eU()},this),i.call(this,l.pool,1)}}else o.rurDrag=function(t){i.call(this,l.pool,0);var e=t.to.x-t.from.x,o=t.to.y-t.from.y,n=this.htR(g,e,r?-o:o,y,[0,0]);this.bU(),l.setClient(n,d,S),this.eU()},o.rurDrop=function(t){i.call(this,l.pool,1)},o.rurCancel=function(t){this.bU(),l.setClient(y,d,S),this.eU(),i.call(this,l.pool,2)};this.rurDrag(e,o)}break;case"resize-lane":if(a(s.o)&&"lanes"in s.o){var P=s.o,g=s.ht,v=P.pool,u=this.getShape("frameDrag"),R=v.getClient(),b=v.getLanesRect(R),y=P.lanes.getClient(P.index,b);if(o.rurAllowUpdateScrollRange=!0,u){O=null;c.EyO(u)&&(u=null);function C(t,e,o,i){O=O||i;var n=[this.scaled(o[0]),this.scaled(o[1]),this.scaled(o[2]),this.scaled(o[3])];this.ctxScale(e,[0,0,0,0],function(){u?e.drawShape(n,u.normal||u):e.drawFrameRect(n)},this)}o.rurEFPaint=C,o.rurEFOpts=function(t,e){e.visible=!1},o.rurDrag=function(t){p(O)&&O.SetVisible(t.from!=t.to);var e=t.to.x-t.from.x,i=t.to.y-t.from.y;t.frame=this.htR(g,e,r?-i:i,y,[0,0]),r&&(t.frame[1]+=i),null==o.rurEFPaint&&C.call(this,t,this.gCtx(),this.rtCA(t.frame,!1))},o.rurDrop=function(t){if(i.call(this,v,0),this.bU(),(t.to.xc.ROf(R))&&!v.oLanes.isCreateHT(t.from.x,t.from.y,v.getLanesRect(R)))P.lanes.remove(P.index);else{var e=t.to.x-t.from.x,o=t.to.y-t.from.y,n=this.htR(g,e,r?-o:o,y,[0,0]);P.lanes.setClient(P.index,b,n)}this.eU(),i.call(this,v,1)}}else o.rurDrag=function(t){i.call(this,v,0);var e=t.to.x-t.from.x,o=t.to.y-t.from.y,n=this.htR(g,e,r?-o:o,y,[0,0]);this.bU(),P.lanes.setClient(P.index,v.getLanesRect(v.getClient()),n),this.eU()},o.rurDrop=function(t){var o=this.ptCA(this.gPtr(e),!0);v.oLanes.isCreateHT(f.X(o),f.Y(o),v.getLanesRect(v.getClient()))||(t.to.xc.ROf(R))&&(this.bU(),P.lanes.remove(P.index),this.eU()),i.call(this,v,1)},o.rurCancel=function(t){this.bU(),P.lanes.setClient(P.index,v.getLanesRect(v.getClient()),y),this.eU(),i.call(this,v,2)};this.rurDrag(e,o)}break;case"resize-phase":if(a(s.o)&&"phases"in s.o){var m=s.o,g=s.ht,v=m.pool,u=this.getShape("frameDrag"),R=v.getClient(),E=v.getPhasesRect(R),y=m.phases.getClient(m.index,E);if(o.rurAllowUpdateScrollRange=!0,u){var O=null;c.EyO(u)&&(u=null);function C(t,e,o,i){O=O||i;var n=[this.scaled(o[0]),this.scaled(o[1]),this.scaled(o[2]),this.scaled(o[3])];this.ctxScale(e,[0,0,0,0],function(){u?e.drawShape(n,u.normal||u):e.drawFrameRect(n)},this)}o.rurEFPaint=C,o.rurEFOpts=function(t,e){e.visible=!1},o.rurDrag=function(t){p(O)&&O.SetVisible(t.from!=t.to),t.frame=this.htR(g,t.to.x-t.from.x,t.to.y-t.from.y,y,[0,0]),null==o.rurEFPaint&&C.call(this,t,this.gCtx(),this.rtCA(t.frame,!1))},o.rurDrop=function(t){if(i.call(this,v,0),this.bU(),(t.to.yc.BOf(R))&&!v.oPhases.isCreateHT(t.from.x,t.from.y,v.getPhasesRect(R)))m.phases.remove(m.index,E,n);else{var e=t.to.x-t.from.x,o=t.to.y-t.from.y,n=this.htR(g,e,o,y,[0,0]);m.phases.setClient(m.index,E,n)}this.eU(),i.call(this,v,1)}}else o.rurDrag=function(t){i.call(this,v,0);var e=t.to.x-t.from.x,o=t.to.y-t.from.y,n=this.htR(g,e,o,y,[0,0]);this.bU(),m.phases.setClient(m.index,v.getPhasesRect(v.getClient()),n),this.eU()},o.rurDrop=function(t){var o=this.ptCA(this.gPtr(e),!0);v.oPhases.isCreateHT(f.X(o),f.Y(o),v.getPhasesRect(v.getClient()))||(t.to.yc.BOf(R))&&(this.bU(),m.phases.remove(m.index),this.eU()),i.call(this,v,1)},o.rurCancel=function(t){this.bU(),m.phases.setClient(m.index,v.getPhasesRect(v.getClient()),y),this.eU(),i.call(this,v,2)};this.rurDrag(e,o)}}}}(S.prototype.rurActionExtra),S.prototype.onRURApplyClient=function(t){return function(e,o,i){return t.call(this,e,o,i||r(e))}}(S.prototype.onRURApplyClient),S.prototype.onRURResize=function(t){return function(e,o,i){if(t.apply(this,arguments),r(e)&&o instanceof c.M1){var n=e,s=o.get(n),h=n.getClient(),a=this.getExpandGlyphSize();if(s&&h){var l=this.Lyt(),u=s[2]?h[2]/s[2]:null,f=s[3]?h[3]/s[3]:null;o.forEach(function(t,e){if(e!=n){var o,r=t.slice();p(u)&&(r[0]=h[0]+u*(t[0]-s[0])),p(f)&&(r[1]=h[1]+f*(t[1]-s[1])),i?(r=l.r2C(r),i.set(e,r),a>0&&i.get(o=e.getExpandGlyph())&&i.set(o,S.Layout.expandGlyphRect(r,a))):e.SetClient(r)}},this)}}}}(S.prototype.onRURResize),S.prototype.onRURChange=function(t){return function(e,o){t.apply(this,arguments),o?o.forEach(function(t,e){r(e)&&(c.EqR(e.getClient(),t)||this.onMovePool(e,t))},this):r(e)&&this.onAddPool(e)}}(S.prototype.onRURChange),S.prototype.onRURDragStart=function(t){return function(e,o){if(t.call(this,e,o),!this.orurDC)switch(e){case"resize-header":case"resize-lane":case"resize-phase":var i=this.p2HT(this.gPtr(o));i&&(this.orurDC=i.o.pool)}}}(S.prototype.onRURDragStart),S.prototype.onRURCreate=function(t){return function(o,i){if(i&&void 0!==i.get("pool")){var n,s=this.onAddPool;return this.onAddPool=e,n=this.oSP.Create(o),this.onAddPool=s,n}if(!i||void 0!==i.get("element"))return t.call(this,o,i)}}(S.prototype.onRURCreate),S.prototype.onRURPool=function(t,e){},S.prototype.rurAllowMove=(S.prototype.rurAllowMove,function(t,e){var o=s(t),i=r(t);return!(!o&&!i)&&(!e||void 0!==e.get("pool")&&i||void 0!==e.get("element")&&o)}),S.prototype.p2E=function(t){var e=this.ptCA(t,!0),o=f.X(e),i=f.Y(e);return this.Lyt().rgVO.rforEachU(function(t,e){return s(e)&&c.PInR(o,i,t)&&e||null})},S.prototype.p2P=function(t){var e=this.ptCA(t,!0),o=f.X(e),i=f.Y(e);return this.Lyt().rgVO.rforEachU(function(t,e){return r(e)&&c.PInR(o,i,t)&&e||null})},S.prototype.p2LP=function(t){var e=this.p2P(t);return e&&e.p2LP(this.ptCA(t,!0))},S.prototype.toClick=function(t){return function(e,o){t.apply(this,arguments);var i=this.gPtr(e),n=this.p2LP(i);o.pool=this.p2P(i),o.lane=n&&n.l||null,o.phase=n&&n.p||null}}(S.prototype.toClick),S.prototype.getChange=function(t){return function(e,o){var i=t.call(this,e,o);return i.element=s(o)?o:null,i.pool=r(o)?o:null,i}}(S.prototype.getChange),S.prototype.getMoveObj=function(t){return function(e,o){var i=t.call(this,e,o);return r(e)&&(i=e.getMoveObj()),i}}(S.prototype.getMoveObj),S.prototype.Clear=function(t){return function(){this.bU(),t.apply(this,arguments),this.oSP.Clear(),this.eU()}}(S.prototype.Clear),S.prototype.toObjs=function(t){var e=null;if(p(t))if(t==this.oSE)e=this.oSE.rgE.rgE;else if(t==this.oSP)e=this.oSP.rgP.rgE;else{e=new c.Arr;var n=this.oSE.Item(t)||this.oSP.Item(t);p(n)?e.add(n):(o(t)||i(t))&&t.forEach(function(t){(t=this.oSE.Item(t)||this.oSP.Item(t))&&e.add(t)},this),e=e.byO()}return e},S.prototype.GetPools=function(){return this.oSP},S.prototype.GetSpools=function(){return this.oSP.Save()},S.prototype.SetSpools=function(t){this.oSP.Load(t)},S.prototype.nAA=function(t){return function(){var e=t.apply(this,arguments);return e.Has=function(t){return function(e,o){var i=t.call(this,e,o);if(i&&o&&n(o.getType)){i=!1;for(var s=o.getType(),r=0,h=this.rgA.length;!i&&r1&&t!=e-1&&this.SetPosition(e-1),t},e.prototype.BringForward=function(){var t=this.GetPosition(),e=this.oSP.GetCount();return e>1&&t+11&&t>0&&this.SetPosition(0),t},e.prototype.SendBackward=function(){var t=this.GetPosition();return this.oSP.GetCount()>1&&t>0&&this.SetPosition(t-1),t},e.prototype.GetKey=function(){return this.oO.key},e.prototype.SetKey=function(t){this.bU(),this.oSP.resK2I(),this.oO.key=t,this.eU()},e.prototype.getKey=function(){return c.ToS(this.GetKey(),"")},e.prototype.GetVisible=function(){return this.oO.visible},e.prototype.SetVisible=function(t){this.bU(),this.oO.visible=t,this.eU(!0)},e.prototype.getVisible=function(){return u(this.GetVisible())||this.GetVisible()},e.prototype.isVisible=function(){return!!this.getVisible()&&(!p(this.oP)||this.oP.isVisible())},e.prototype.isVisible=function(){return this.GetVisible()||u(this.GetVisible())},e.prototype.GetEnabled=function(){return this.oO.enabled},e.prototype.SetEnabled=function(t){this.bU(),this.oO.enabled=t,this.eU()},e.prototype.getEnabled=function(){return u(this.GetEnabled())||this.GetEnabled()},e.prototype.isEnabled=function(){return!!this.getEnabled()&&(!p(this.oP)||this.oP.isEnabled())},e.prototype.p2HT=function(t){var e=this.getClient(),o=this.oLanes.p2HT(t,this.getLanesRect(e));if(!o&&!(o=this.oPhases.p2HT(t,this.getPhasesRect(e))))for(var i=this.rgHeaders.length,n=i-1;!o&&n>=0;n--)o=this.rgHeaders[n].p2HT(t,e);return o},e.prototype.LP=function(t,e,o){o=o||this;var i,n=this.getClient(),s=e&&this.oPhases.forEach(this.getPhasesRect(n),function(t,i){return e.call(o,t,i)}),r=t&&this.oLanes.forEach(this.getLanesRect(n),function(e,i){return t.call(o,e,i)});return r&&((i=i||{}).l=r),s&&((i=i||{}).p=s),i},e.prototype.toLP=function(t,e){function o(t,e){var o=-1;return u(t)?o=-1:c.IsS(t)||c.IsS(t.c)?(t=t.caption||t,e.forEach(function(e){e.caption==t&&(o=e.index)})):o=c.ToI(t.index,~~t),o}var i=this.oLanes.getSplitters(),n=this.oPhases.getSplitters(),s=o(t,i),r=o(e,n);return this.LP(function(t,e){return e.index==s&&(e.client=t)&&e},function(t,e){return e.index==r&&(e.client=t)&&e})},e.prototype.p2LP=function(t){var e=f.X(t),o=f.Y(t);return this.LP(function(t,e){return o>=t[1]&&o=t[0]&&ee&&t.push(n.getMoveObj()))},this),t.byO()},e.prototype.GetHeaders=function(){var t=[];return this.rgHeaders.forEach(function(e){t.push(e.save())}),c.B.quoteS(t)},e.prototype.SetHeaders=function(t){this.bU(),this.oO.headers=t,this.rgHeaders=[],u(t)&&(t="left,right,top,bottom");var e=new c.Arr;c.B.split(t).forEach(function(t){var o=g.PoolHeader.isValid(t.caption);if(o&&!e.has(o)){e.add(o);var i=new g.PoolHeader(this,o);i.load(t.flags),this.rgHeaders.push(i)}},this),this.eU(!0)},e.prototype.GetExcludeHeaders=function(){return this.oO.excludeHeaders},e.prototype.SetExcludeHeaders=function(t){this.bU(),this.oO.excludeHeaders=t,this.eU(!0)},e.prototype.getExcludeHeaders=function(){return u(this.GetExcludeHeaders())||this.GetExcludeHeaders()},e.prototype.GetLanes=function(){return this.oLanes.save()},e.prototype.SetLanes=function(t){this.bU(),this.oLanes.load(this.oO.lanes=t),this.eU(!0)},e.prototype.GetPhases=function(){return this.oPhases.save()},e.prototype.SetPhases=function(t){this.bU(),this.oPhases.load(this.oO.phases=t),this.eU(!0)},e.prototype.yA2C=function(t,e){return this.getView().isC()&&(t=2*(e=this.getClient())[1]+e[3]-t),t},e.prototype.Lane=function(t){return this.toLP(t).l},e.prototype.Phase=function(t){return this.toLP(null,t).p},e.prototype.genID=function(){var t=this.GetKey();return u(t)&&this.SetKey(t=function(){var t=this.oSP,e=this.getKey();return e&&t.Item(e)==this||(e=t.nextID()),e}.call(this)),t},e.prototype.coO=function(){var t=c.Cpy(this.oO);return t.headers=this.GetHeaders(),t.lanes=this.GetLanes(),t.phases=this.GetPhases(),t},C&&(e.prototype.scUR=function(t){t.o=this.oSP,t.i=this.genID()},e.prototype.arUR=function(t){this.scUR(t),t.d=this.coO(),t.Do=function(t){(this.del?!t:t)?this.o.Remove(this.i):this.o.Add(this.d).EnsureVisible()}},e.prototype.mvUR=function(t,e){e&&(this.scUR(t,!0),t.d={from:c.C2R(e),to:this.getClient()},t.Do=function(t){var e=this.o.Item(this.i);e&&(e.SetClient(t?this.d.from:this.d.to),e.EnsureVisible())})},e.prototype.uUR=function(t,e,o){this.scUR(t,!0),(t.d=C.diff(e,o))&&(t.Do=function(t){var e=this.o.Item(this.i);e&&(e.SetOptions(t?this.d.from:this.d.to),e.EnsureVisible())})},e.prototype.StartUpdatePool=function(){if(this.getView().gUR()){var t=[];return this.getMoveObj().forEach(function(e){t.push(function(t){return{o:t,coO:t==this?t.coO():t.suo()}}.call(this,e))},this),t}},e.prototype.suo=e.prototype.StartUpdatePool,e.prototype.EndUpdatePool=function(t){t&&(o(t)?t.forEach(function(t){t.o.euo(t.coO)}):this.getView().nUR(P.UpdatePool,function(e){this.uUR(e,t,this.coO())},this))},e.prototype.euo=e.prototype.EndUpdatePool,e.prototype.UpdatePool=function(t,e){if(n(t)){var o=this.StartUpdatePool();t.call(e||this),this.EndUpdatePool(o)}}),h.prototype.isVisible=function(){return this.size>0},h.prototype.getClient=function(t){var e=!t&&this.pool.getView().isC(),o=(t=t||this.pool.getClient()).slice(),i=this.size,n=this.type;switch(e&&("top"==n?n="bottom":"bottom"==n&&(n="top")),n){case"left":o[2]=i;break;case"right":o[0]=c.ROf(o)-(o[2]=i);break;case"top":o[3]=i;break;case"bottom":o[1]=c.BOf(o)-(o[3]=i)}return o},h.prototype.setClient=function(t,e,o){function i(){this.size=t[2]}function n(){this.size=t[3],this.pool.getView().isC()&&(s[1]-=h,h=-h)}var s,r=0,h=0;switch(u(e)&&(e=this.size),o&&(s=o.get(this.pool))&&(s=s.slice()),this.type){case"left":r=t[2]-e,s&&(s[2]=l(0,s[2]+r)),i.call(this);break;case"right":r=e-t[2],s&&(s[0]+=r,s[2]=l(0,s[2]-r)),i.call(this);break;case"top":h=t[3]-e,s&&(s[3]=l(0,s[3]+h)),n.call(this);break;case"bottom":h=e-t[3],s&&(s[1]+=h,s[3]=l(0,s[3]-h)),n.call(this)}o&&o.forEach(function(t,e){e.SetClient(e==this.pool?s:c.ORt(t.slice(),r,h))},this)},h.prototype.inflateHT=function(){return 24},h.prototype.getHTClient=function(t){var e=(t=t||this.pool.getClient()).slice(),o=this.size,i=this.inflateHT();switch(this.type){case"left":e[0]+=o,e[2]=0,c.IRt(e,0,i);break;case"right":e[0]=c.ROf(e)-o,e[2]=0,c.IRt(e,0,i);break;case"top":e[1]+=o,e[3]=0,c.IRt(e,i,0);break;case"bottom":e[1]=c.BOf(e)-o,e[3]=0,c.IRt(e,i,0)}return e},h.prototype.getType=function(){return this.type},h.isValid=function(t){var e=null;if(t)switch(t=t.toString().trim().toLowerCase()){case"left":case"right":case"top":case"bottom":e=t}return e},h.prototype.getShapeType=function(){return"header"},h.prototype.allowResize=function(){return this.pool.getView().gAA().Has("resize-header",this)},h.prototype.getResizeHT=function(t){t=t||this.pool.getClient();var e=this.getHTClient(t),o=this.inflateHT(),i=null,n=null;switch(this.type){case"left":case"right":(i=e.slice())[3]=o,(n=e.slice())[1]=c.BOf(n)-(n[3]=o);break;case"top":case"bottom":(i=e.slice())[2]=o,(n=e.slice())[0]=c.ROf(n)-(n[2]=o)}return i&&n?[i,n]:[]},h.prototype.ht=function(){var t=0;switch(this.type){case"left":t=36;break;case"right":t=33;break;case"top":t=66;break;case"bottom":t=18}return t},h.prototype.p2HT=function(t,e){var o=null;if(this.allowResize()){for(var i=!1,n=f.X(t),s=this.pool.yA2C(f.Y(t),e),r=this.getResizeHT(e),h=r.length-1;!i&&h>=0;h--)i=c.PInfR(n,s,r[h]);i||this.isVisible()&&(i=c.PInfR(n,s,this.getHTClient(e))),i&&(o={o:this,ht:this.ht()})}return o},h.prototype.inflateRect=function(t){if(this.isVisible())switch(this.type){case"left":t[0]-=this.size,t[2]+=this.size;break;case"right":t[2]+=this.size;break;case"top":t[1]-=this.size,t[3]+=this.size;break;case"bottom":t[3]+=this.size}return t},h.drawResizeHT=function(t,e,o,i){t.save(),t.setLineDash([2,2]),t.drawLine(e,o,i||"rgba(0,0,0,0.25)"),t.restore()},h.prototype.drawResizeHT=function(t,e){this.getResizeHT(e).forEach(function(e){h.drawResizeHT(t,f.R2C(e,17),f.R2C(e,68))})},h.prototype.getCreateLPHT=function(t,e){var o=null;if(t&&this.isVisible()){var i=c.Def.HT.inflate[0],n=c.Def.HT.inflate[1];switch(this.type){case"left":this.pool.oLanes.allowCreate()&&(o=[c.LOf(t)+4,c.BOf(t)-n,l(0,this.size-8),e?2*n:0]);break;case"right":this.pool.oLanes.allowCreate()&&(o=[c.ROf(t)-(this.size-4),c.BOf(t)-n,l(0,this.size-8),e?2*n:0]);break;case"top":this.pool.oPhases.allowCreate()&&(o=[c.ROf(t)-i,c.TOf(t)+4,e?2*i:0,l(0,this.size-8)]);break;case"bottom":this.pool.oPhases.allowCreate()&&(o=[c.ROf(t)-i,c.BOf(t)-(this.size-4),e?2*i:0,l(0,this.size-8)])}}return o},h.prototype.drawCreateLPHT=function(t,e){var o=this.pool.getView().getVO().get(this.pool);if(o){switch(this.type){case"left":case"right":e=c.NRt(e,this.pool.getLanesRect(o));break;case"top":case"bottom":e=c.NRt(e,this.pool.getPhasesRect(o))}var i=this.getCreateLPHT(e);i&&h.drawResizeHT(t,f.R2C(i,17),f.R2C(i,68),"rgba(0,0,0,0.5)")}},h.prototype.draw=function(t,e){var o=this.getClient(e),i=this.allowResize();this.isVisible(),this.isVisible()&&(this.drawH(t,o),i&&this.drawCreateLPHT(t,o)),i&&this.drawResizeHT(t,e)},h.prototype.GetShape=function(){return this.shape},h.prototype.getShape=function(){return this.pool.getView().getShape(this)},h.prototype.drawH=function(t,e){var o=this.getShape();o&&t.drawShape(e,o.normal||o),this.drawHC(t,e)},h.prototype.drawHC=function(t,e){var o,i,n,s,r,h=this.pool.getView();switch(this.type){case"left":case"right":i=h.getShape("lane"),o=this.pool.oLanes,n=this.pool.getLanesRect(e);break;case"top":case"bottom":i=h.getShape("phase"),o=this.pool.oPhases,n=this.pool.getPhasesRect(e)}o&&(s=o.gCnt(n))&&s.rgSplitters.forEach(function(e){if(r=s.rgSize[e.index]){o.init(n,r);var a=c.DrawTextFormatEnum.exTextAlignCenter|c.DrawTextFormatEnum.exTextAlignVCenter|c.DrawTextFormatEnum.exTextWordEllipsis,l=h.getShape(e.shape)||i;p(l)&&(l=l.normal||l)&&p(l.formatText)&&(a=l.formatText),e.drawH(t,n,a),o.next(n,r)}},this)},h.prototype.save=function(){var t=new Map;return this.isVisible()&&t.set("size",this.size),c.IsS(this.shape)&&t.set("shape",this.shape),c.B.quoteC(this.type)+c.B.quoteF(t)},h.prototype.load=function(t){if(t instanceof Map){var e=t.get("size");this.size=p(e)?c.ToN(e):0,e=t.get("shape"),this.shape=p(e)?c.ToS(e):null}},a.prototype.GetIndex=function(){return this.index},a.prototype.GetCaption=function(){return this.caption},a.prototype.SetCaption=function(t){this.caption=t;var e=this.phases||this.lanes;e&&e.save(e.oContent,!1)},a.prototype.GetSize=function(){var t=this.getClient();return t&&t[this.phases?2:3]},a.prototype.SetSize=function(t){var e,o=this.phases||this.lanes;this.pool&&o&&(e=this.getClient())&&(e[this.phases?2:3]=l(0,t),o.setClient(this.index,this.pool[this.phases?"getPhasesRect":"getLanesRect"].call(this.pool,this.pool.getClient()),e),o.save(o.oContent,!1))},a.prototype.getClient=function(){return(this.phases||this.lanes).forEach(this.pool[this.phases?"getPhasesRect":"getLanesRect"].call(this.pool,this.pool.getClient()),function(t,e){return e==this&&t},this)},a.prototype.GetShape=function(){return this.shape},a.prototype.SetShape=function(t){this.shape=t;var e=this.phases||this.lanes;e&&e.save(e.oContent,!1)},a.prototype.drawH=function(t,e,o){t.drawHTMLText(this.caption,e,o)},a.prototype.getView=function(){return this.pool.getView()},a.prototype.isLane=function(){return p(this.lanes)},c.expO({Index:null,Caption:null,Size:null,Shape:null},a.prototype),d.prototype.getType=function(){return this.h?"phases":"lanes"},d.prototype.allowResize=function(){return this.pool.getView().gAA().Has(this.h?"resize-phase":"resize-lane",this)},d.prototype.allowCreate=function(){return this.allowResize()},d.prototype.genCaption=function(t){return t=t||0,this.h?String.fromCharCode(t+"A".charCodeAt(0)):(t+1).toString()},d.prototype.genSplitterOpts=function(t,e,o,i){var n={pool:this.pool,caption:t,size:e,shape:o,index:i};return n[this.getType()]=this,n},d.prototype.onCreate=function(t){t=t||0;var e=this.genSplitterOpts(this.genCaption(t),t?0:null,null,t),o=this.pool.oSP,i=o[this.h?"OnCreatePhase":"OnCreateLane"];return n(i)&&i.call(o,e)&&(e=null),e},d.prototype.getSplitters=function(){function t(t,o,i){var n=new a(this.genSplitterOpts(t,o,i,e.length));return e.push(n),n}var e=[],o=null;if(c.B.split(this.content||this.genCaption(0)).forEach(function(e){var i=e.flags?e.flags.get("size"):null,n=e.flags?e.flags.get("shape"):null;o=t.call(this,e.caption,p(i)?l(0,c.ToN(i)):null,n)},this),this.allowCreate()&&(!o||0!==o.size)){var i=this.onCreate(e.length);i&&t.call(this,i.caption,e.length?0:null,i.shape)}return e},d.prototype.getSize=function(t){return t[this.h?c.w:c.h]},d.prototype.gCnt=function(t){if(!this.oContent||this.oContent.size!=this.getSize(t)){var e=this.getSize(t),o=0,i=0,n=0,s=0,r=this.getSplitters(),h=[];if(o=r.length)if(r.forEach(function(t){u(t.size)?i++:n+=t.size}),i||n){var a=100,s=0;(!i||n>100)&&(a=n),n<100&&(s=(100-n)*e/100/i),r.forEach(function(t){h.push(u(t.size)?s:t.size*e/a)})}else for(var l=0;l=0;s--)i=c.PInR(t,e,this.pool.rgHeaders[s].getCreateLPHT(o,!0));return i},d.prototype.p2HT=function(t,e,o){var i=null,n=f.X(t),s=this.pool.yA2C(f.Y(t),e),r=this.isCreateHT(n,s,e);if(r||c.PInR(n,s,e)){var h=o?34:this.h?4:64,a=o?0:this.h?c.Def.HT.inflate[0]:0,l=o?0:this.h?0:c.Def.HT.inflate[1],u=null;if(this.forEach(e,function(t,e){var o=c.P2HT(n,s,c.IRt(t.slice(),a,l),2*a,2*l);if(o&&(h==(o&h)||c.EyR(t)))return u=t,i={o:e,ht:h}},this),!o&&i&&u){var g=null,y=i.o.index+1,d=this.oContent.rgSize.length;for(!r&&this.allowCreate()&&d--;y=0&&!this.oContent.rgSize[o];o--);o>=0&&(e=o)}}return e},d.prototype.remove=function(t){if(this.oContent&&t>=0){var e=this.oContent.rgSplitters.length;if(t2&&t+1==e-1);if(o&&!i){var n=this.avalN0Sized(t);p(n)&&(this.oContent.rgSize[n]+=o)}if(this.oContent.rgSize.splice(t,1),this.oContent.rgSplitters.splice(t,1),this.save(this.oContent,!0),i){var s=this.pool.getClient();this.init(s,l(0,this.getSize(s)-o)),this.pool.SetClient(s)}}}},c.expO({Count:null},t.prototype),c.expO(c.Mrg({Options:null,Index:null,Position:null},g.PoolOptions),e.prototype),{Pools:t,Pool:e,PoolHeader:h,PoolSplitters:d,PoolSplitter:a}}()),S.Layout.prototype.doL=function(t){return function(){return this.oSV.oSP.forEach(function(t){t.isVisible()&&this.rgVO.set(t,this.r2C(t.getClient()))},this),S.Layout.toR(this.rgVO),t.apply(this,arguments)}}(S.Layout.prototype.doL),S.Layout.prototype.p2HT=function(t){return function(e){var o=t.call(this,e);if(!o||r(o.o)){for(var i=null,n=null,s=this.rgVO.toA(),l=this.lPools()-1;!i&&l>=0;l--)r(n=s[l])&&(i=n.p2HT(e));i&&(!o||34==o.ht||a(i.o)||h(i.o)&&i.o.size)&&(!a(i.o)||o&&n==o.o)&&(o=i)}return o}}(S.Layout.prototype.p2HT),S.Layout.prototype.lPools=function(){var t=0,e=!1;return this.rgVO.forEachU(function(o,i){return(e=r(i))&&t++,!e}),t};var v={pool:null,lane:null,phase:null};c.Mrg(g.ElementOptions,v),g.Element.prototype.GetPool=function(){var t=this.getClient(),e=this.oSE.oSV.oSP;return e&&e.rgP.rforEachU(function(e){return c.NRt(t,e.getClient())&&e})||null},g.Element.prototype.SetPool=function(t){this.Center(t,null,null)},g.Element.prototype.GetLane=function(){var t=this.GetPool(),e=t&&t.p2LP(f.R2C(this.getClient()));return e&&e.l||null},g.Element.prototype.SetLane=function(t){this.Center(null,t,null)},g.Element.prototype.GetPhase=function(){var t=this.GetPool(),e=t&&t.p2LP(f.R2C(this.getClient()));return e&&e.p||null},g.Element.prototype.SetPhase=function(t){this.Center(null,null,t)},g.Element.prototype.Center=function(t,e,o){var i,n=this.oSE.oSV.oSP,s=n&&(n.Item(t)||this.GetPool());s&&(i=this.getClient(),this.SetClient(f.C2R(f.R2C(s.clientLP(p(e)?e:this.GetLane(),p(o)?o:this.GetPhase())),i[2],i[3])))},c.expO(v,g.Element.prototype),c.Shapes.Swimlane=c.Shapes.Surface,t.Swimlane=g});