/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):(t="undefined"!=typeof globalThis?globalThis:t||self,o(t.exontrol||{}))}(this,function(t){"use strict";function o(){return Math.max.apply(0,arguments)}function i(){return Math.min.apply(null,arguments)}function e(t){return t instanceof n.Pivot}function r(t,o){var i=new n.Lay.Container(t,o);return i.local=!0,i}var n=n||window.exontrol,s=n.G;n.Mrg(n,function(){function t(t,o){this.init(t,o)}return Object.addPrototypeOf(t.prototype,n.Tree.prototype),t.version="3.0",t.type="Pivot",t.Def={filter:"filter",excludeFilter:"exclude"},t.PivotBarVisibleEnum={exPivotBarHidden:0,exPivotBarVisible:1,exPivotBarSizable:2,exPivotBarFloat:4,exPivotBarAutoFit:8,exPivotBarShowTotals:16,exPivotBarAutoHide:32,exPivotBarAllowValues:64,exPivotBarAllowFormatAppearance:128,exPivotBarAllowFormatConditionalAppearance:16777216,exPivotBarAllowFormatContent:256,exPivotBarAutoUpdate:512,exPivotBarAllowUndoRedo:1024,exPivotBarAllowResizeColumns:2048,exPivotBarHideAddNew:4096,exPivotBarContextSortAscending:65536,exPivotBarContextSortReverse:1048576,exPivotBarReadOnly:268435456},t.prototype.init=function(o){return function(i,e){o.call(this,i,e),this.oCW.SetCanvas=function(o){return function(){var i=[this],e=arguments;this.oT instanceof t&&(i=this.oT.all().map(function(t){return t.oCW})),i.forEach(function(t){o.apply(t,e)})}}(this.oCW.SetCanvas),this.Aggregates=n.Tree.CellF.Total.Agg,this.oFC=new t.FormatContents(this),this.oFA=new t.FormatAppearances(this),this.oFCA=new t.FormatConditionalAppearances(this),this.oLF=null,this.addR(i,e),this.oR&&this.showP()}}(t.prototype.init),t.prototype.iLts=function(t){return function(){t.apply(this,arguments),this.oLts.add("ondolayout")}}(t.prototype.iLts),t.prototype.initCW=function(t){function o(){return n.Tree.TV.rurColEF()}return function(){var i=t.apply(this,arguments),e=this.oTV,r=this.oCW,s=(r.W("control")||r).Add("pivotbar",{Dock:1,Control:this.oPB=new n.Tree.TV.PivotBar(e)});return s.GetVisible=e.showPB.bind(e),s.GetResizable=e.sizePB.bind(e),this.aSizeW(s),this.aHideW(s),function(){this.oCW.onHovI=function(t){return function(){t.apply(this,arguments),this.oT.visP().oPB.onmIO(!1)}}(this.oCW.onHovI),this.oCW.onHovO=function(t){return function(){t.apply(this,arguments),this.oT.visP().oPB.onmIO(!0)}}(this.oCW.onHovO)}.call(this),this.addCFB("pivotfloatbar",this.oPCFB=new n.Tree.TV.PivotFloatBar(e),"showPCFB",{Dock:4}),function(){this.oCW.rurEv=function(t){return function(){return t.apply(this,arguments)||o()}}(this.oCW.rurEv);var t=this.CC();t.rurEv==n.CC.prototype.rurEv&&(t.rurEv=function(t){return function(){return t.apply(this,arguments)||o()}}(t.rurEv))}.call(this),i}}(t.prototype.initCW),t.prototype.defAA=function(t){return function(){return t.apply(this,arguments)+",format(RButton)"}}(t.prototype.defAA),t.prototype.srur=function(t){return function(){t.apply(this,arguments);var o=this.oCW.W("pivotfloatbar");o&&(o.bR2d=!0)}}(t.prototype.srur),t.prototype.resLCV=function(t){return function(){this.oPB.resHVO(),this.oPCFB.resHVO(),t.apply(this,arguments)}}(t.prototype.resLCV),t.prototype.onSCR=function(t){return function(){t.apply(this,arguments),this.alignCFBN("pivotfloatbar")}}(t.prototype.onSCR),t.prototype.ondrop=function(t){return function(){var o=this.src();o.showP(),t.apply(o,arguments)}}(t.prototype.ondrop),t.prototype.onmFI=function(t){return function(){if(this.oI.rgFI){var o=this.oI.mFI,i=new Map;this.oI.rgFI.forEach(function(t){(!o||o.has(t))&&i.set(t,1)},this),this.oI.mFI=i}return t.apply(this,arguments)}}(t.prototype.onmFI),t.prototype.fU=function(t){return function(){t.apply(this,arguments),!this.oR&&this.vF(!0)&&this.oC.GetCount()&&this.format()}}(t.prototype.fU),t.prototype.onLoad=function(t){return function(){this.oPB.onPL(),t.apply(this,arguments)}}(t.prototype.onLoad),t.prototype.onlayout=function(t){return function(o){var i=o.IsSave();i||(this.oLts.lock(),this.lES++,this.bU()),t.apply(this.visP(),arguments),o.local||(i?(o.Add("pr",this.GetPivotRows()),o.Add("pc",this.GetPivotColumns()),o.Add("pt",this.GetPivotTotals())):(this.SetPivotRows(o.GetValue("pr")),this.SetPivotColumns(o.GetValue("pc")),this.SetPivotTotals(o.GetValue("pt")))),i||(this.eU(),--this.lES,this.oLts.unlock())}}(t.prototype.onlayout),t.prototype.BeginUpdate=function(){this.oPB.bU(),this.all().forEach(function(t){n.Tree.prototype.bU.call(t)})},t.prototype.bU=t.prototype.cwbU=t.prototype.BeginUpdate,t.prototype.EndUpdate=function(){this.all().forEach(function(t){n.Tree.prototype.eU.call(t)}),this.oPB.eU()},t.prototype.eU=t.prototype.cweU=t.prototype.EndUpdate,t.prototype.Update=function(t,o){this.bU(),t&&t.call(o||this),this.eU()},t.lR=0,t.prototype.addR=function(o,i){if(!t.lR++){this.oR=new t(o,i),this.oR.opR=this,this.oR.oLts=this.oR.oTV.oLts=this.oLts,["Add","Remove","RemoveOf","Clear","Lock","Unlock"].forEach(function(t){this.oCW.oSts.oT=this,this.oCW.oSts[t]=function(t){return function(){t.apply(this,arguments),t.apply(this.oT.oR.oCW.oSts,arguments)}}(this.oCW.oSts[t])},this),this.oCW.SetSBs=function(t){return function(){t.apply(this,arguments),t.apply(this.oT.oR.oCW,arguments)}}(this.oCW.SetSBs),Object.defineProperty(this,"ScrollBars",{set:this.SetScrollBars=this.oCW.SetSBs.bind(this.oCW)}),this.oR.Aggregates=this.Aggregates,["onRL","resLCV","oCW.onUI"].forEach(function(t){function o(t,o){for(var i=o.split("."),e=0,r=i.length;e1?t.apply(this,arguments):null}}(this.oR.oC.getTC)}t.lR--},t.prototype.onCol=function(){this.all().forEach(function(t){t.oPB.onPL(),t.oPCFB.resHVO()})},t.prototype.GetCanvas=function(){return this.oCW.GetCanvas()},t.prototype.CC=function(){return n.CC.c2CC(this.GetCanvas())},t.prototype.showP=function(t){var o=(t=t||this).oCW,i=this.CC(),e=i&&!(1==i.rgC.len()&&i.rgC.first()==o)&&i.rgC||null;if(e){var s,a=o.CWs(),l=[],h=new n.Arr;if(e.forEach(function(t){t!=o&&l.push(t),t.CWs().forEach(function(t){h.push(t.ctx),n.EShow(t.canvas,a.has(t)),t._ctx=t.ctx,t.ctx=null})}),h.forEach(function(t){t.gAO()&&t.gAO().clear()}),e.removeRange(l),e.add(o),s=l[0],a.forEach(function(t){n.EShow(t.canvas,!0),t.CWs().forEach(function(t){t.ctx=t._ctx||t.ctx,t._ctx=void 0})}),s&&(!function(t,o){var i=t.Column(0),e=o.Column(0);i&&e&&e.SetWidth(i.getWidth()),o.oPB.npW=t.oPB.npW,o.oPB.resHVO()}(s.oT,t),o.oPtr=s.oPtr),i.resize(),s){o.lHovWC();var c=r(null,"*hscroll *vscroll");c.bSv=!0,s.onlayout(c),c.bSv=!1,o.onlayout(c),o.uHovWC(!0)}}},t.prototype.isVisP=function(){var t=this.CC();return t&&t.rgC.has(this.oCW)||!1},t.prototype.visP=function(){var t=this.CC();return(t&&t.rgC.first()||this.oCW).oT||this},t.prototype.src=function(){return this.opR||this},t.prototype.run=function(){return this.oR||this},t.prototype.all=function(){return[this.src(),this.run()]},t.prototype.showD=function(t){var o=this.src(),i=this.run(),e=this.visP(),r=t?o:i;e._scr=e.GetScrollPos(),r.bU(),o.oI.rgFI=t,o.onFilter(),o.showP(r),r.SetScrollPos(r._scr),r.eU()},t.prototype.showS=function(){return this.showD(null)},t.prototype.ISOf=function(t,o){var i=t&&t.rgIS;if(i&&o){var e=[],r=o.length;i.forEach(function(t){(function(t){for(var i,e=!0,n=0;e&&n("+a+")"),a},t.prototype.addPT=function(t,o,i,e){var r=(t?this.oI:this.LIOf(o)).Add({parent:t,value:this.capPC({t:i}),sortable:!1,selectable:!1});r.oAgg=i;for(var n,s=this.oC.GetCount(),a=1;a=0&&function(){return a.GetCount()=0){var s=(i=i||new Map).get(n);!s&&i.set(n,s={}),s[t]=o}}},this)},this),i&&a.forEach(function(t){var e=i.get(t.getLevel());e&&(o.call(this,t,e,!1),o.call(this,t,e,!0))},this)}}.call(this))}this.format(!0),function(t){t.bSv=!1,this.onlayout(t)}.call(this,n),this.eU(),this.oLts.unlock()},t.prototype.format=function(t){var o="content",i=this.src().aggDefFmt(),e=this.GetConditionalFormats(),r=this.getL(),s=this.oC.GetCount();this.bU(),e.Clear(),!t&&function(){(function(){this.oC.forEach(function(t){t.oAgg&&t.SetFormat(i)})}).call(this),function(){[this.oI,this.oIT,this.oIB].forEach(function(t){t.forEach(function(t){t.GetShape()&&t.SetShape(null);for(var o,i=0;i=0){var r=t.substr(e+1).trim().toLowerCase();i="a"==r?1:"d"==r?2:0,t=t.substr(0,e)}return(o=a.Item(t))&&{c:o,s:i||0}}function s(){i&&i.r&&(this.r=function(t){var o=null;return t&&a.GetCount()&&t.splitP(",").forEach(function(t){if(t=t.trim()){var i=n.B.split(t)[0]||{},e=r(i.caption);e&&(e.s=e.s||1,e.o=i.flags,(o=o||new n.Pivot.CAr).add(e))}},this),o&&(o.t="row"),o}.call(this,i.r),this.c=this.r&&function(t){var o=null,i=this.oS.oPB.allowV();return t&&a.GetCount()&&t.splitP(",").forEach(function(t){if(t=t.trim()){var s,a=t.splitP("/"),l=n.B.split(a[0])[0]||{},h=r(l.subText),c=l.caption.trim();if(e.call(this,c)&&h){if(h.a=c,h.o=l.flags,h.s=0,s={a:h,v:new n.Pivot.CAr},i)for(var u=1,p=a.length;u=0&&c=0},Object.addPrototypeOf(i.prototype,n.Arr.prototype),i.prototype.add=function(t){return function(o){var i=null;return!this.lA&&o instanceof n.Pivot.Layout&&(this.removeAt(this.iQ+1,this.len()-this.iQ),i=t.call(this,o.encPL()),this.iQ=this.len()-1),i}}(i.prototype.add),i.prototype.doQ=function(t){var o=this.at(this.iQ);return o&&(this.lA++,t.oPB.bL(),t.cwbU(),t.SetPivotRows(o.r),t.SetPivotColumns(o.c),t.SetPivotTotals(o.t),t.cweU(),t.oPB.eL(!1),this.lA--),null!=o},i.prototype.canUndo=function(){return this.len()&&this.iQ>0},i.prototype.undo=function(t){this.canUndo()&&(--this.iQ,this.doQ(t))},i.prototype.canRedo=function(){return this.iQ+1 0"}]},Object.addPrototypeOf(l.prototype,e.prototype),l.prototype.isValid=function(t){return function(o){return t.apply(this,arguments)&&n.Tree.CellF.Create(n.ToS(o.expression)).IsValid()}}(l.prototype.isValid),l.prototype.def=function(){return[{key:"numeric",expression:"int(value) = value ? (value or `0`) : (value format ``)"},{key:"currency",expression:"currency(value)"},{key:"date",expression:"date(value)"}]},h.prototype.encPL=function(){function t(t){return n.ToS(t,"")}function o(t){return n.B.quoteF(t)}function i(i,e,r){var n="";return n+=t(i),n+=function(t){var o="";return t&&(1==t?o=":A":2==t&&(o=":D")),o}(e),n+=o(r)}var e={r:function(t){var o="";return t&&t.forEach(function(t){o&&(o+=","),o+=i(t.c.GetIndex(),2==t.s&&t.s||null,t.o)}),o}.call(this,this.r),c:function(e){var r="";return e&&e.forEach(function(e){e.a&&(r&&(r+=","),r+=e.a.a,r+="(",r+=t(e.a.c.GetIndex()),r+=")",r+=o(e.a.o),e.v.isEmpty()||(r&&(r+="/"),e.v.forEach(function(t,o){o&&(r+=";"),r+=i(t.c.GetIndex(),t.s,t.o)})))}),r}.call(this,this.c),t:function(t){function i(t){var i="";return t&&t.forEach(function(t,e){var r=e&&"("+e.GetIndex()+")"||"";t.forEach(function(t){i&&(i+=","),i+=t.a,i+=r,i+=o(t.o)})}),i}var e="";return t&&(e+=i(t.d),t.u&&(e+="/",e+=i(t.u))),e}.call(this,this.t)};return e.r||(e.c=""),e.c||(e.t=""),e},h.prototype.isEmpty=function(){return!this.r},h.prototype.cmpPO=function(t){function o(t,o){(a=t&&o&&t.c==o.c&&t.s==o.s&&n.ToS(t.a)==n.ToS(o.a)&&function(t,o){return(t&&t.get(r)||"")==(o&&o.get(r)||"")&&(t&&t.has(s)?1:0)==(o&&o.has(s)?1:0)}(t.o,o.o))&&l.set(o,t)}function i(t,i){if((a=!!t==!!i)&&t&&(a=t.len()==i.len()))for(var e=0,r=t.len();a&&e↻"}},t.apply(this,arguments)}}(e.prototype.init),e.prototype.isClkAble=function(){return this.oTV.isClkAble()},e.prototype.setTimeout=function(){return n.setTimeout.apply(this,arguments)},e.prototype.onsize=function(t){return function(){var o=this.resHVO;this.resHVO=function(){},t.apply(this,arguments),this.resHVO=o}}(e.prototype.onsize),e.prototype.onmIO=function(t){this.autoAddNew()&&(this.hmIO&&clearTimeout(this.hmIO),this.hmIO=this.setTimeout(function(){this.invHVO()},t?512:256))},e.prototype.isHov=function(){return this.oW==this.oW.oCW.oHovW},e.prototype.ondown=function(t){return function(o){if(o.altKey&&o.ctrlKey){var i=this.oTV.oT;return i.showP(i.oR||i.opR),!0}return t.apply(this,arguments)}}(e.prototype.ondown),e.prototype.showGlyphs=function(t){return function(){var o=t.apply(this,arguments);return o.e=!1,o}}(e.prototype.showGlyphs),e.prototype.onAObj=(e.prototype.onAObj,function(t,o){var i;o.t&&function(o){var e=this.toShapes(this.getType("total"));e&&(!n.EyO(e.hover)&&t.set({owner:this,id:o.idAOH||(o.idAOH={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2T([t,e])},duration:this.getSmooth()}),!n.EyO(e.click)&&t.set({owner:this,id:o.idAOC||(o.idAOC={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2T([t,e])},actOn:i==o?1:4,duration:this.getSmooth()}))}.call(this,o),o.n&&function(o){var e=this.toShapes(this.getType("addNew"));e&&(!n.EyO(e.hover)&&t.set({owner:this,id:o.idAOH||(o.idAOH={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2N([t,e])},duration:this.getSmooth()}),!n.EyO(e.click)&&t.set({owner:this,id:o.idAOC||(o.idAOC={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2N([t,e])},actOn:i==o?1:4,duration:this.getSmooth()}))}.call(this,o)}),e.prototype.alignBR=function(t,o){if(t&&t.length){o=o||this.dclient;var i=this.getPad(),e=i[0],r=i[1],s=n.ROf(o)-e,a=n.BOf(o)-r;t.forEach(function(t){t&&(s=(t[0]=s-t[2])-e,t[1]=a-t[3])})}},e.prototype.drawH=function(t){return function(o,i){function e(t){var o=r.get(t);o&&s.push(o)}var r=this.getHVO().lock,n=this.src().oPB,s=[];e(n.btnR),e(n.btnT),this.dclient=i,this.alignBR(s),t.apply(this,arguments),this.drawTGL(o,r.rgTL)}}(e.prototype.drawH),e.prototype.drawCH=function(t){return function(o,i,e,r){function a(e){var s=e.c;if(s){var a=s.isSort,l=s.getCaption,h=s.hasFilter;s.getCaption=function(){var t=this.oC.oT.src(),o=t.capPC(e),i=t.capFO(e,!0);return o+(i?" "+i:"")},s.isSort=function(){return e.s},s.hasFilter=function(){return e.o&&e.o.has(n.Pivot.Def.filter)},t.call(this,o,i,e,r),s.isSort=a,s.hasFilter=h,s.getCaption=l}return s}(function(t){return t.t&&(this.drawT(o,i,t,r)||t.t)||null}).call(this,e)||function(t){var i=null;if(t.a&&(i=t.c)){var e=i.gCnt,n=this.showGlyphs,s=this.hasAG(t);s&&(i.gCnt=function(t,o){return(t=t.slice())[2]-=s.rtG[2],e.call(this,t,o)}),this.showGlyphs=function(){},a.call(this,t),s&&this.drawAG(o,s.rtG,s,r),this.showGlyphs=n,i.gCnt=e}return i}.call(this,e)||a.call(this,e)||function(t){var e=null;return t.tc&&(e=t.tc.c)&&o.drawHTMLText(this.oTV.oT.capPC(t),n.PRt(i.slice(),this.getPad(),-1),e.getFormatText()),e}.call(this,e)||function(t){return null!=t.id&&(this.drawID(o,i,t,r)||t)||null}.call(this,e)||function(t){return t.n&&(this.drawN(o,i,t,r)||t.n)||null}.call(this,e)||function(t){var e,r=n.ToS(t);if(e=r.sWith("h")){var a="h"==r,l=s.R2C(i,36);this.drawGL(o,s.R2C(i,33),l,a),a&&this.drawGL(o,l,[s.X(s.R2C(this.dclient,36)),s.Y(l)])}return e}.call(this,e)||function(t){var e,r=n.ToS(t);if(e=r.sWith("v")){var a="v"==r,l=s.R2C(i,18);this.drawGL(o,l,[s.X(l),s.Y(s.R2C(this.dclient,66))],a)}return e}.call(this,e)||o.drawFrameRect(n.IRt(i.slice(),2,2))}}(e.prototype.drawCH),e.prototype.drawGL=function(t,o,i,e){t.save(),t.beginPath(),this.oTV.pGL(t),e&&(t.strokeStyle="#000000",t.strokeStyle="rgba(0,0,0,0.5)",t.setLineDash([]),t.lineWidth+=.5),t.moveTo(s.X(o),s.Y(o)),t.lineTo(s.X(i),s.Y(i)),t.stroke(),t.restore()},e.prototype.drawTGL=function(t,o){function e(t,i){for(var e,r=i,n=o.len();i=t;i++)r=i;return r}var r=1;if(o.len()>1)for(var n,a,l=this.oTV.getIndent(),h=0,c=o.len();h0){var u=o.at(h),p=o.at(a),f=s.R2C(u.rtL,33),v=s.R2C(p.rtL,33),d=i(s.X(f)+l*u.d,s.X(v)+l*p.d)-l/2,g=s.Y(f),y=s.Y(v);this.drawGL(t,[d,g],[d,y],!0),this.drawGL(t,[d,g],[d+l/3,g],!0),this.drawGL(t,[d,y],[d+l/3,y],!0)}r++}},e.prototype.drawT=function(t,o,i,e){if(i&&i.t){var r,s=this.t2Inf(i),a=this.getPad(),l=this.toShapes(s.s)||{},h=l.normal||l,c=s.e,u=this.oTV.oT.src(),p=u.capPC(i),f=u.capFO(i,!0);c?e&&(n.EyO(l.hover)||(r=e.get(this,i.idAOH))&&(h=n.R.Shape(r.state,r.range,{from:h,to:l.hover})),n.EyO(l.click)||(r=e.get(this,i.idAOC))&&(h=n.R.Shape(r.state,r.range,{from:h,to:l.click}))):n.EyO(l.disabled)||(h=n.Inh(l.disabled,h)),function(o,i,r){t.drawShape(o,h,{text:i,formatText:s.b?5:this.oTV.getFormatText(),padText:[-a[0],-a[1]],clientText:r?"[,,width-"+r.rtG[2]+a[1]+"]":null}),r&&this.drawAG(t,r.rtG,r,e)}.call(this,o,p+(f?" "+f:""),this.hasAG(i))}},e.prototype.drawN=function(t,o,i,e){function r(o){function i(t,o,i,e){var r=n.IRt(i.slice(),.2*-i[2],.2*-i[2]),s=t.lineWidth,a=function(t){if(t){var o=n.C.Convert(t);t=n.C.C2S(255-o.r,255-o.g,255-o.b,o.a)}return t}(this.fillColor)||"black";t.lineWidth=2,t.drawHLine([r[0],r[1]+r[3]/2],r[2],a),t.drawVLine([r[0]+r[2]/2,r[1]],r[3],a),t.lineWidth=s}var e=!l.text&&!l.draw;e&&(l.draw=i),t.drawShape(o,l),e&&(l.draw=null)}if(i&&i.n){var s,a=this.toShapes(this.getType("addNew"))||{},l=a.normal||a;this.isEnabled()?e&&(n.EyO(a.hover)||(s=e.get(this,i.idAOH))&&(l=n.R.Shape(s.state,s.range,{from:l,to:a.hover})),n.EyO(a.click)||(s=e.get(this,i.idAOC))&&(l=n.R.Shape(s.state,s.range,{from:l,to:a.click}))):n.EyO(a.disabled)||(l=n.Inh(a.disabled,l)),r.call(this,o)}},e.prototype.drawAG=function(t,o,i,e){if(o){var r=this.toShape(this.getType("aggregate"),!i.e)||{};t.drawShape(o,r,{text:n.ToS(r.text,"Σ")})}},e.prototype.drawID=function(t,o,i,e){if(o){var r=this.toShape(this.getType("idem"))||{};t.drawShape(o,r,{text:n.ToS(r.text,"”")})}},e.prototype.getCursor=function(t){return function(o){var i=t.apply(this,arguments);if(this.isClkAble()&&!i){var e,r=this.getCursors();(e=this.p2N(o))?i=n.GP.Get(this.getType("addNew"),r):((e=this.p2AG(o))&&e.e&&(i=n.GP.Get(this.getType("aggregate"),r)),!i&&(e=this.p2T(o))&&(i=n.GP.Get((this.t2Inf(e)||{}).s,r)))}return i||null}}(e.prototype.getCursor),e.prototype.p2CR=function(t){return this.isClkAble()&&this.allowCR()&&function(t){var o=this.p2Vl(t);return o&&{c:{o:this,i:~~o.substr(1),c:this.i2C(~~o.substr(1))instanceof n.Tree.Column,getWidth:function(){var t=this.o.gpWidth(this.i);if(!this.c)for(var o=1;o=l&&r<(l=n.ROf(o))&&(h=c);return h},e.prototype.rtPCxOf=function(t,i){var e,r=this.getL(),s=this.getHVO().lock,a=s.get("v"+(t||""));if(a){var l,h,c=this.oTV,u=this.getPad(),p=u[0],f=u[1],v=this.gpWidth(t),d=c.getIndent(),g=c.getHeaderHeight(),y=[n.ROf(a)-v+p,f,v-2*p,g];switch(i){case"all":(e=y.slice())[3]=o(0,this.rtCA(this.GetClientRect())[3]-2*f);break;case"new":t?(l=r.c&&r.c.item(t-1))?(e=s.get(l.a),(h=s.get(l.v.last()))&&((e=n.ORt(h.slice(),d,g+f))[2]-=d)):e=n.ORt(y.slice(),0,(g+f)*(r.l.uC-1)):(h=r.r&&s.get(r.r.last()))?(e=n.ORt(h.slice(),d,g+f))[2]-=d:e=y.slice();break;case"agg":t&&(e=(l=r.c&&r.c.item(t-1))?s.get(l.a):n.ORt(y.slice(),0,(g+f)*(r.l.uC-1)))}}return e},e.prototype.p2PLx=function(t,o){var i=-1;if(o)for(var e,r=this.ptCA(t),a=this.GetScroll(),l=s.Y(r)-a.y,h=this.getHVO().lock,c=0,u=o.len();c=n.TOf(e=h.get(o.item(c)));c++)i=c,l>n.BOf(e)&&i++;return i},e.prototype.p2TL=function(t,e){function r(t,e){function r(t){var o=s.at(t);return o&&o.o.t&&o}var n,s=this.getHVO().lock.rgTL,a=s.len(),l=s.at(t),h=l&&l.d||0;if(a&&null!=e&&t>=0&&(!l||l.o.t)){if(t>=a-1)n={m:0,M:s.at(i(t,a)-1).d};else{var c=r(i(t,a)-1),u=r(i(t,a)+1),p=c||u,f=c&&u;p&&(n={m:i(f?c.d:h,f?u.d:p.d),M:o(f?c.d:h,f?u.d:p.d)})}n&&(h=o(i(o(0,~~e),n.M),n.m))}return h}var a=this.oTV.getIndent(),l=a&&null!=e?~~(this.scaled(e-this.GetClientRect()[0])/a):void 0,h=this.getL().t?function(t){var o=this.ptCA(t),i=this.GetScroll(),e=s.Y(o)-i.y,r=-1;return this.getTL().forEachU(function(t){if(e>=n.TOf(t.rtL))return r=t.l,e>=n.BOf(t.rtL)&&r++,e=n.LOf(t)-r&&a=0:!(i.tlx==v.tlx&&i.d==v.d))&&(a={a:p?"pivot-addtot":"pivot-postot",h:h,o:s,tlx:v.tlx,d:v.d,rtD:l.h2V(this,r(v.rtD))})}}else if(u)a={a:"pivot-delcol",h:h,o:i.o};else if(i.o&&i.o.a&&e.pcx>0&&i.pcx>0)i.pcx!=e.pcx&&(a={a:"pivot-pcxcol",h:h,o:i.o,pcx:i.pcx,tcx:e.pcx,rtD:l.h2V(this,r(this.rtPCxOf(e.pcx,"agg")))});else{var d=this.getL(),g=d.r,y=d.c;if(g){var C=e.pcx,T=1+(y&&y.len()||0);if(C<0||C==T)a={a:"pivot-aggcol",h:h,c:i.c,rtD:l.h2V(this,r(this.rtPCxOf(T,"new")))};else{var P,m,w=C?y.item(C-1).v:g;((m=!w.has(i))||w.oHas(e.o)&&i.c!=e.c)&&(a={a:m?"pivot-addcol":"pivot-poscol",h:h,c:i.c,car:w,p:P=o(0,this.p2PLx(this.gPtr(t),w)),rtD:l.h2V(this,r(P=0)&&(p=i.car.item(u),i.car.setPos(p,i.p));break;case"pivot-addcol":var p=i.car.add({c:i.c});(e=!!p)&&i.car.setPos(p,i.p);break;case"pivot-delcol":l.oHas(s)&&(e=l.remove(s))||h&&h.forEachU(function(t){return e=t.a==s&&h.remove(t)||t.v.oHas(s)&&t.v.remove(s)});break;case"pivot-pcxcol":(e=!!h)&&(h.item(i.tcx-1)?h.setPos(h.item(i.pcx-1),i.tcx-1):h.add(n.Cpy(h.item(i.pcx-1))));break;case"pivot-deltot":var f=i.o.t,v=a.t2O(f);e=!(!v||!v.o.remove(f));break;case"pivot-addtot":case"pivot-postot":var f=i.o.t,d=(a.t2O(f)||{}).o,g=a.tlx2O(this.getTL(),i.tlx,i.d);(e=!!g)&&(g.o!=d&&(d&&d.remove(f),g.o.add(f)),g.o.setPos(f,g.p))}this.eL(e)}},e.prototype.onRurScrollD=function(t){t.dx=0,t.dy=0},e.prototype.defSts=function(t){return function(o){t.apply(this,arguments),this.oTV.isDef()&&(o.Add("CTRL + Z",this.undo,this,"undoes the last action within the pivot rows, columns or totals"),o.Add("CTRL + Y",this.redo,this,"redoes the last undo action within the pivot rows, columns or totals"))}}(e.prototype.defSts),e.prototype.c2Vrt=function(t){var o=this.GetCanvas(),i=this.GetClientRect(),e=n.EArtC(o),r=n.CSSzom(o);return[e[0]+i[0]+t[0]/r,e[1]+i[1]+t[1]/r,t[2]/r,t[3]/r]},e.prototype.onlayout=function(t){if(!t.local){var o,i;t.IsSave()?(o=this.aSize())&&(t.Add("aw",o.width),t.Add("ah",o.height)):(null!=(i=t.GetValue("aw"))&&((o=o||{}).width=i),null!=(i=t.GetValue("ah"))&&((o=o||{}).height=i),o&&this.aSize(o))}},{PivotFloatBar:t,PivotBar:e}}()),n.Tree.TV.prototype.init=function(t){return function(){t.apply(this,arguments),this.oPB=this.oT.oPB,this.oPCFB=this.oT.oPCFB}}(n.Tree.TV.prototype.init),n.Tree.TV.prototype.defShp=function(t){return function(){return t.apply(this,arguments)+",Button(pivotBar-total,pivotBar-refresh,pivotBar-addNew,pivotBar-aggregate),Border(itemTot,itemSub)"}}(n.Tree.TV.prototype.defShp),n.Tree.TV.prototype.defCrs=function(t){return function(){return t.apply(this,arguments)+",pointer(pivotBar-total,pivotBar-refresh,pivotBar-addNew,pivotBar-aggregate)"}}(n.Tree.TV.prototype.defCrs),n.Tree.TV.prototype.SetReadOnly=function(t){return function(){return e(this.oT)&&this.oT.all().forEach(function(t){t.oPB.resHVO()}),t.apply(this,arguments)}}(n.Tree.TV.prototype.SetReadOnly),n.Tree.TV.prototype.wCH=function(t){return function(){return this._wCH||(this._wCH=function(){var o=t.apply(this,arguments);return o.push(this.oPB),o.push(this.oPCFB),o}.apply(this,arguments))}}(n.Tree.TV.prototype.wCH),n.Tree.TV.prototype.e2V=function(t){return function(o){return t.call(e(this.oT)?this.oT.visP().oTV:this,o)}}(n.Tree.TV.prototype.e2V),n.Tree.TV.prototype.wAO=function(t){return function(){return this._wAO||(this._wAO=function(){var o=t.apply(this,arguments);return o.push(this.oPB),o.push(this.oPCFB),o}.apply(this,arguments))}}(n.Tree.TV.prototype.wAO),n.Tree.TV.prototype.e2CH=function(t){return function(o){var i,e,r,s=t.apply(this,arguments);return s&&(i=s.h)instanceof n.Tree.TV.PivotBar&&(e=i.gPtr(o),s.o=i.p2O(e),s.pcx=i.p2PCx(e),r=i.p2TL(e),s.tlx=r.tlx,s.d=r.d),s}}(n.Tree.TV.prototype.e2CH),n.Tree.TV.prototype.rurColDraw=function(t){return function(o,i,e){o&&o.h instanceof n.Tree.TV.PivotBar?o.h.drawCH(i,e,o.o):t.apply(this,arguments)}}(n.Tree.TV.prototype.rurColDraw),n.Tree.TV.prototype.rurCol=function(t){return function(o){var i,e=t.apply(this,arguments);return!e&&o&&(i=o.h)instanceof n.Tree.TV.PivotBar&&o.o&&o.o.t&&(o.rtC=this.h2V(i,i.getHVO().lock.get(o.o)),e=!0),e}}(n.Tree.TV.prototype.rurCol),n.Tree.TV.prototype.defSts=function(t){return function(o){t.apply(this,arguments),this.isDef()&&o.Add("Escape",this.oT.showS,this.oT,"shows the source-pivot")}}(n.Tree.TV.prototype.defSts),n.Tree.TV.prototype.onDblClk=function(t){return function(o){var i,r=this.oT;if(e(r))if(!this.getShowDataOnDblClick()||r==r.src()&&!r.oI.rgFI)i=t.apply(this,arguments);else{var n=this.e2IC(o);r.showD(r.ISOf(n&&n.oI||this.e2I(o),n&&n.oC.oAgg&&n.oC.oAgg.v)),i=!0}return i}}(n.Tree.TV.prototype.onDblClk),n.Tree.TV.prototype.e2IEC=function(t){return function(){return this.oI.rgFI?null:t.apply(this,arguments)}}(n.Tree.TV.prototype.e2IEC),n.Tree.TV.prototype.onChange=function(t){return function(o,i){var e=this.oT;return"change-cell"==o&&e==e.src()&&!e.getL().isEmpty()&&this.setTimeout(function(){var t=e.run(),o=t.showP;t.showP=function(){},e.oPB.onPL(),t.showP=o}),t.apply(this,arguments)}}(n.Tree.TV.prototype.onChange),n.Tree.TV.prototype.drawI=function(t){return function(o,i,e,r,s){var a;e.oAgg&&(a=n.Tree.bSCTX(o,function(t){return this.toShape(t.oAgg.c?"itemSub":"itemTot",!t.isEnabled())}.call(this,e),i)),t.apply(this,arguments),a&&n.Tree.eSCTX(o,a)}}(n.Tree.TV.prototype.drawI),n.Tree.TV.prototype.getL=function(){return this.oPB.getL()},n.Tree.Options.pivotColumnsFloatBarVisible=null,n.Tree.TV.prototype.GetPivotColumnsFloatBarVisible=function(){return this.oO.pivotColumnsFloatBarVisible},n.Tree.TV.prototype.SetPivotColumnsFloatBarVisible=function(t){this.cwbU(),this.oO.pivotColumnsFloatBarVisible=t;var o=256&this.showPCFB()?0:4,i=this.oT.run();e(this.oT)&&this.oT.all().forEach(function(t){if(t){var e=t.oCW,r=e.W("control"),n=e.W("pivotfloatbar");n&&(o||t==i)&&e.Dock(n,r,o,n.oCW.w2R(n)),t.oPCFB.resHVO()}},this),this.cweU()},n.Tree.TV.prototype.showPCFB=function(){return this.opt("pivotColumnsFloatBarVisible",n.Tree.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisible)},n.Tree.Options.pivotBarVisible=null,n.Tree.TV.prototype.GetPivotBarVisible=function(){return this.oO.pivotBarVisible},n.Tree.TV.prototype.SetPivotBarVisible=function(t){var o=n.Pivot.PivotBarVisibleEnum,i=this.showPB();this.cwbU(),this.oO.pivotBarVisible=t;var r=this.showPB(),s=this.oT.run(),a=r&o.exPivotBarFloat?0:1;e(this.oT)&&this.oT.all().forEach(function(t){if(t){var o=t.oCW,i=o.W("control"),e=o.W("pivotbar");e&&(a||t==s)&&o.Dock(e,i,a,e.oCW.w2R(e)),t.oPB.resHVO(),o.onUI()}},this),(16777616&i)!=(16777616&r)&&this.oPB.onPL(),this.cweU()},n.Tree.TV.prototype.showPB=function(){return function(t,o,i){return null==t?~~i:n.s2F(t,o)}(this.opt("pivotBarVisible"),n.Pivot.PivotBarVisibleEnum,n.Pivot.PivotBarVisibleEnum.exPivotBarVisible|n.Pivot.PivotBarVisibleEnum.exPivotBarSizable|n.Pivot.PivotBarVisibleEnum.exPivotBarAutoFit|n.Pivot.PivotBarVisibleEnum.exPivotBarShowTotals|n.Pivot.PivotBarVisibleEnum.exPivotBarAllowValues|n.Pivot.PivotBarVisibleEnum.exPivotBarAllowFormatAppearance|n.Pivot.PivotBarVisibleEnum.exPivotBarAllowFormatConditionalAppearance|n.Pivot.PivotBarVisibleEnum.exPivotBarAllowFormatContent|n.Pivot.PivotBarVisibleEnum.exPivotBarAutoUpdate|n.Pivot.PivotBarVisibleEnum.exPivotBarAllowUndoRedo|n.Pivot.PivotBarVisibleEnum.exPivotBarAllowResizeColumns)},n.Tree.TV.prototype.sizePB=function(){return this.showPB()&n.Pivot.PivotBarVisibleEnum.exPivotBarSizable},n.Tree.Options.pivotRows=null,n.Tree.TV.prototype.GetPivotRows=function(){return this.oO.pivotRows},n.Tree.TV.prototype.SetPivotRows=function(t){this.cwbU(),this.oO.pivotRows=t,!n.ToS(t).trim()&&this.SetPivotColumns(""),this.oPB.onPL(),this.cweU()},n.Tree.Options.pivotColumns=null,n.Tree.TV.prototype.GetPivotColumns=function(){return this.oO.pivotColumns},n.Tree.TV.prototype.SetPivotColumns=function(t){this.cwbU(),this.oO.pivotColumns=t,!n.ToS(t).trim()&&this.SetPivotTotals(""),this.oPB.onPL(),this.cweU()},n.Tree.Options.pivotTotals=null,n.Tree.TV.prototype.GetPivotTotals=function(){return this.oO.pivotTotals},n.Tree.TV.prototype.SetPivotTotals=function(t){this.cwbU(),this.oO.pivotTotals=t,this.oPB.onPL(),this.cweU()},n.Tree.TV.prototype.gpLayout=function(){return{r:n.ToS(this.GetPivotRows()).trim(),c:n.ToS(this.GetPivotColumns()).trim(),t:n.ToS(this.GetPivotTotals()).trim()}},n.Tree.TV.prototype.isClkAble=function(){return this.isSelectable()&&(!this.oPB||!this.oPB.isReadOnly())},n.Tree.TV.prototype.rurActionClick=function(t){return function(o,i){var e,r=this.e2V(i);if(this.isClkAble()&&r instanceof n.Tree.TV.PivotBar){var s=r.gPtr(i);!e&&(e=r.p2N(s))&&this.onClickN(e,i),!e&&(e=r.p2AG(s))&&this.onClickAG(e,i),!e&&(e=r.p2R(s))&&this.onClickR(e,i),!e&&(e=r.p2PO(s))&&(this.onClickPO(e,i)||(e=null)),!e&&(e=r.hasAG(r.p2O(s)))&&this.onClickAG(e,i)}!e&&t.apply(this,arguments)}}(n.Tree.TV.prototype.rurActionClick),n.Tree.TV.prototype.norurAction=function(t){return function(o,i){var r=t.apply(this,arguments);return r||(r=e(this.oT)&&this.onClickPO(this.p2PO(this.gPtr(o)),o)),r}}(n.Tree.TV.prototype.norurAction),n.Tree.TV.prototype.onClickCF=function(t){return function(o,i,e){var r=!0,s=n.Pivot.Def,a=s.filter,l=s.excludeFilter,h=o.o;if(h instanceof n.Tree.TV.PivotBar){var c=h.p2O(this.gPtr(i));(r=this.isClkAble()&&c&&c.c)&&((e=e||{}).f=c.o&&c.o.get(a)||null,e.e=c.o&&c.o.has(l)||!1,e.s=c.s||1,e.cbkF=function(t,o){void 0===t&&void 0===o||(h.bL(),c.o=c.o||new Map,t?c.o.set(l,null):c.o.delete(l),void 0!==o&&(null!=o?c.o.set(a,o):c.o.delete(a)),c.o.size||(c.o=null),h.eL())})}r&&t.call(this,o,i,e)}}(n.Tree.TV.prototype.onClickCF),n.Tree.TV.prototype.onClickC=function(t){return function(o,i){var e=this.e2V(i);if(e instanceof n.Tree.TV.PivotBar){if(this.isClkAble()){var r=e.p2O(e.gPtr(i));if(r&&r.c&&!r.a){e.bL();var s=e.getL().r.has(r);r.s=s?1+((r.s-1||0)+1)%2:((r.s||0)+1)%3,e.eL()}}}else t.apply(this,arguments)}}(n.Tree.TV.prototype.onClickC),n.Tree.TV.prototype.rurColDrop=function(t){return function(o,i,e){var r=n.Tree.TV.PivotBar,s=e&&e.h instanceof r||i.h instanceof r,a=this.Smooth;s&&(this.Smooth=this.Smoothless),t.call(this,o,i,e),s&&(this.Smooth=a)}}(n.Tree.TV.prototype.rurColDrop),n.Tree.TV.prototype.onA=function(t){return function(o){t.apply(this,arguments),e(this.oT)&&n.H.VisitA((this.oT.opR||this.oT.oR).oTV,o)}}(n.Tree.TV.prototype.onA),n.Tree.TV.prototype.getCMA=function(t,o){var i=n.Tree.TV.cbkEsc(),e=this.oT.src().Aggregates,r="";for(var s in e)r&&(r+=","),r+=i(s)+"[id="+s+"][rad"+(t==s?"=1":"")+"][show=-1][grp=agg]",o&&(r+="[close=-1]");return r},n.Tree.TV.prototype.getCMC=function(t,o){var i,e,r=n.Tree.TV.cbkEsc(),s=t instanceof n.Arr,a=this.oPCFB.cols(),l="",h=this.oPB.reqSort();return o&&(e=this.oPCFB.cols(function(t){return 1==(15&t.getSortType())})).length&&(a=e),h&&(i=n.Cmp.S,2==h&&(i=n.Cmp.R(i)),a.sort(function(t,o){return i(t.pc(),o.pc())})),a.forEach(function(o){l&&(l+=","),l+=r(o.GetCaption())+"[id="+o.GetIndex()+"][grp=col]",s?l+="[show=-1][chk="+(t.has(o)?1:0)+"]":o==t&&(l+="[shapes=shitem.checked(item)]")}),l},n.Tree.TV.prototype.runAG=function(t,o,i){var e,r=this,s=r.oPB,a=n.IRt(n.ORt(t.rtG.slice(),this.getPad()[0],0),0,(this.getHeaderHeight()-t.rtG[3])/2),l=0!=this.oPCFB.cols(function(t){return 1==(15&t.getSortType())}).length,h=s.c2Vrt(a);this.runCM({items:function(){var o,i="",e=t.a.a,r=this.getCMA(e,t.t);return!t.t&&(o=t.a.c)&&(i&&(i+=","),i+="Column[id=c-s](",i+=this.getCMC(o,this.oT.aggNumCol(e)),i+=")"),r&&(i&&(i+=",[sep],"),i+=r),i}.call(this),x:n.ROf(h),y:n.BOf(h),alignContextMenu:0,cbkS:function(o){if(l){var i=this.Item("c-s");i&&o.flags&&o.flags.has("rad")&&i.set(r.getCMC(t.a.c,r.oT.aggNumCol(o.id)))}e=o},cbkM:function(t){if(!t&&!this.esc){var r=this.forEachU(function(t){return t.getState()&&t.flags&&"agg"==t.flags.get("grp")&&t.caption||""}),n=e&&e.flags&&"col"==e.flags.get("grp")&&this.oR.oT.src().Column(e.id);o&&o.call(i||this,r,n)}}})},n.Tree.TV.prototype.onClickAG=function(t,o){return this.runAG(t,function(o,i){var e,r=this.oPB,n=r.src().oPB.btnT==t.t;!n&&r.bL(),e=t.a.a!=o,t.a.a=o,i&&(e|=t.a.c!=i,t.a.c=i),!n&&r.eL(e),n&&e&&r.invAO()},this)},n.Tree.TV.prototype.onClickN=function(t,o){function i(t){var o=function(t){var o=new n.Arr;return t instanceof n.Pivot.CAr&&t.forEach(function(t){o.ann(t.c)}),o}.call(this,t),i={items:this.getCMC(o)};return i.cbkM=function(t){if(!t&&!this.esc){var o=!1,i=this.oR.n,e=this.oR.oT,r=this.oR.oT.oPB,s=e.src(),a=function(){var t=[];return this.forEachU(function(o){o.flags&&"col"==o.flags.get("grp")&&o.getState()&&t.push(o.id)}),t}.call(this);if(r.bL(),i instanceof n.Pivot.CAr)if(a.length||"row"!=i.t){var l=function(t,o){var i;return o.forEach(function(o){t.indexOf({c:s.Column(o)})<0&&(i=i||[]).push(o)}),i}.call(this,i,a),h=function(t,o){var i,e;return t.forEach(function(t){o.indexOf(i=t.c.GetIndex())<0&&(e=e||[]).push(i)}),e}.call(this,i,a);(o=!(!l&&!h))&&(l&&l.forEach(function(t){i.add({c:s.Column(t)})}),h&&h.forEach(function(t){i.remove({c:s.Column(t)})}))}else s.SetPivotRows("");else"row"==i.t&&s.SetPivotRows(a.join(","));r.eL(o)}},i}var e=this.oPB,r=t.n,s=this.oPB.getHVO().lock.get(t),a=e.c2Vrt(s);r&&("value"==r.t?this.runAG({a:{a:e.btnT.t.a,c:"new"},rtG:s},function(t,o){if(o){var i=this.oPB,e=this.oT.src(),r=e.GetPivotColumns()||"";r&&(r+=","),r+=t+"("+o.GetIndex()+")",i.bL(),e.SetPivotColumns(r),i.eL(!1)}},this):this.runCM(n.Mrg({n:r,x:n.ROf(a),y:n.BOf(a),alignContextMenu:0},i.call(this,r))))},n.Tree.TV.prototype.onClickR=function(t,o){this.oT.src().oPB.doL()},n.Tree.TV.prototype.p2PO=function(t){return this.HTl(t,function(){function o(t){var o;if(t.oAgg)o=t.oAgg;else{var i,e=this.getL();e.r&&(i=e.r.at(t.getLevel()))&&(o=i)}return o}function i(t){return t&&t.o&&t.o.size}var e,r=this.p2ICHT(t),n=r&&r.c;if(n){var s=n.oC;if(s.oAgg){if(e=s.oAgg.a,!i(e)){var a=o.call(this,n.oI);i(a)&&(e=a)}}else s.GetIndex()||(e=o.call(this,n.oI))}return e})},n.Tree.TV.prototype.onClickPO=function(t,o){function i(o){return t.o&&t.o.get(o)}function e(o,i){return t.o&&t.o.set(o,i)}function r(o){var i,e=o.mvF||o.mF;return t.o&&t.o.forEach(function(t,o){e.has(o)&&(i=i||new n.Arr).add(o)}),i}function a(o){var r=i(d),s=function(o){return t.o&&t.o.has(o)}(g);!p.oLF&&(p.oLF=p.getL()),c.oPB.bL(),t.o=new Map,n.ToS(o).split(T).forEach(function(t){if(t=t.trim()){var o=t.indexOf(P),i=(o<0?t:t.substr(0,o)).trim(),r=(o<0?"":t.substr(o+1)).trim()||null;i&&e(i,r)}}),r&&e(d,r),s&&e(g,null),t.o.size||(t.o=null),c.oPB.eL()}function l(){var e=this.c2V(this.gPtr(o)),l=this.runCM({items:function(){var o="",e="";return f.allowFC()&&(e=u.oFC.getCM({group:y,sel:i(y)}))&&(o+=(o?",":"")+y,o+="(",o+=e,o+=")"),f.allowFA()&&(e=u.oFA.getCM({sel:r.call(this,u.oFA)}))&&(o+=o?",[sep],":"",o+=e),t.a&&!c.oPB.getL().t2O(t)&&f.allowFCA()&&(e=u.oFCA.getCM({sel:r.call(this,u.oFCA)}))&&(o+=(o?",[sep],":"")+C,o+="(",o+=e,o+=")"),o}.call(this),x:s.X(e),y:s.Y(e),alignContextMenu:0,cbkS:function(i){if(t){a(function(t){function o(t,o){(t=n.ToS(t).trim())&&(i+=(i?T:"")+t,null!=o&&(i+=P+o))}var i="";return t.forEachU(function(t){t.flags&&(t.flags.get("chk")&&o(t.caption),t.caption&&t.flags.get("rad")&&o(t.flags.get("grp"),t.caption))}),i}(this)),t=null;var e=c.e2V(o);e&&e.p2PO&&(t=e.p2PO(e.gPtr(o)))}},cbkM:function(t){!t&&h&&(this.drawItem=h)}}),h=l&&l.drawItem;h&&(l.drawItem=function(t,o,i,e){var r,s,a=e.get("item");if(a){l.getCriFlat()&&((a=a.slice())[2]=l.getFlatWidth(),a=n.IRt(a,-1,-1));var p,f,v=i.oP&&i.oP.caption;v==C&&(p=u.oFCA.mvF||u.oFCA.mF),v||i.rgCI.length||i.flags&&i.flags.has("sep")||(p=u.oFA.mvF||u.oFA.mF),p&&(f=p.get(i.caption))&&f.shape&&(s=c.toShapes(f.shape))}s&&(r=n.Tree.bSCTX(o,s,a)),h.apply(this,arguments),r&&n.Tree.eSCTX(o,r)},l.Refresh())}var h=!1,c=this,u=this.oT.src(),p=this.oT.run(),f=u.oPB,v=n.Pivot.Def,d=v.filter,g=v.excludeFilter,y="content",C="conditional",T=",",P="=",m=o.drag&&(o.drag.long?1:2==o.drag.click?2:0)||0;return(h=t&&this.gAA().CanDo(o,m,"format"))&&(n.Menu?l:function(){var o,i=u.capFO(t);(o=n.ToS(prompt("format",i),i))!=i&&a(o)}).call(this),h},n.Tree.Options.showDataOnDblClick=null,n.Tree.TV.prototype.GetShowDataOnDblClick=function(){return this.oO.showDataOnDblClick},n.Tree.TV.prototype.SetShowDataOnDblClick=function(t){this.cwbU(),this.oO.showDataOnDblClick=t,this.cweU()},n.Tree.TV.prototype.getShowDataOnDblClick=function(){return this.opt("showDataOnDblClick",!0)},n.Tree.Options.displayPivotFields=null,n.Tree.TV.prototype.GetDisplayPivotFields=function(){return this.oO.displayPivotFields},n.Tree.TV.prototype.SetDisplayPivotFields=function(t){this.cwbU(),this.oO.displayPivotFields=t,this.oPB.onPL(),this.cweU()},n.Tree.TV.prototype.getDisplayPivotFields=function(){return this.opt("displayPivotFields",256)},n.Tree.Options.displayPivotRows=null,n.Tree.TV.prototype.GetDisplayPivotRows=function(){return this.oO.displayPivotRows},n.Tree.TV.prototype.SetDisplayPivotRows=function(t){this.cwbU(),this.oO.displayPivotRows=t,this.oPB.onPL(),this.cweU()},n.Tree.TV.prototype.getDisplayPivotRows=function(){return this.opt("displayPivotRows",16384)},n.Tree.Options.formatPivotHeader=null,n.Tree.TV.prototype.GetFormatPivotHeader=function(){return this.oO.formatPivotHeader},n.Tree.TV.prototype.SetFormatPivotHeader=function(t){this.cwbU(),this.oExPF=void 0,this.oO.formatPivotHeader=t,this.cweU()},n.Tree.TV.prototype.getFormatPivotHeader=function(){return this.opt("formatPivotHeader","ilevel >= 0 ? (aggregate = `sum` ? (ilevel > 1 ? `Subtotal` : `Total`) : proper(aggregate)) : (aggregate and caption ? (proper(aggregate) + ' of ' + caption) : proper(aggregate) or caption)")},n.Tree.Cell.prototype.i=n.Tree.Cell.prototype.getImage=function(t){return function(){var o,i=this.oC;return this.oC.oCS&&(i=this.oC.oCS,this.oC.oCS.length&&(i=this.oC.oCS[this.oI.getLevel()])),(o=i.getFormatImage())?o.Evaluate(this):t.apply(this)}}(n.Tree.Cell.prototype.getImage),n.Shapes.Pivot=n.Shapes.Tree,t.Pivot=n.Pivot});