var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,a,h){c instanceof String&&(c=String(c));for(var d=c.length,g=0;g<d;g++){var k=c[g];if(a.call(h,k,g,c))return{i:g,v:k}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,a,h){if(c==Array.prototype||c==Object.prototype)return c;c[a]=h.value;return c};$jscomp.getGlobal=function(c){c=["object"==typeof globalThis&&globalThis,c,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var a=0;a<c.length;++a){var h=c[a];if(h&&h.Math==Math)return h}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(c,a){var h=$jscomp.propertyToPolyfillSymbol[a];if(null==h)return c[a];h=c[h];return void 0!==h?h:c[a]};
$jscomp.polyfill=function(c,a,h,d){a&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(c,a,h,d):$jscomp.polyfillUnisolated(c,a,h,d))};$jscomp.polyfillUnisolated=function(c,a,h,d){h=$jscomp.global;c=c.split(".");for(d=0;d<c.length-1;d++){var g=c[d];if(!(g in h))return;h=h[g]}c=c[c.length-1];d=h[c];a=a(d);a!=d&&null!=a&&$jscomp.defineProperty(h,c,{configurable:!0,writable:!0,value:a})};
$jscomp.polyfillIsolated=function(c,a,h,d){var g=c.split(".");c=1===g.length;d=g[0];d=!c&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var k=0;k<g.length-1;k++){var f=g[k];if(!(f in d))return;d=d[f]}g=g[g.length-1];h=$jscomp.IS_SYMBOL_NATIVE&&"es6"===h?d[g]:null;a=a(h);null!=a&&(c?$jscomp.defineProperty($jscomp.polyfills,g,{configurable:!0,writable:!0,value:a}):a!==h&&(void 0===$jscomp.propertyToPolyfillSymbol[g]&&(h=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[g]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(g):$jscomp.POLYFILL_PREFIX+h+"$"+g),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[g],{configurable:!0,writable:!0,value:a})))};$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(a,h){return $jscomp.findInternal(this,a,h).v}},"es6","es3");
function KTColumn(c,a){var h=this,d=c,g=a?a:"col"+ ++KTColumn.iFlowId,k=72,f,n,l=!1,t;this.setKey=function(u){g=u};this.getKey=function(){return g};this.setWidth=function(u){if(k!=u){var G=k;k=u;d(this,KTColumn.WIDTH,k,G)}};this.getWidth=function(){return k};this.$innerDestroy=function(){this.setStyle(null);this.setBorder(null);d=null};this.setStyle=function(u){u!=f&&(null!=f&&f.removeChangeListener(E),f=u,null!=f&&f.addChangeListener(E))};this.getStyle=function(){return f};this.setBorder=function(u){u!=
n&&(null!=n&&n.removeChangeListener(E),n=u,null!=n&&n.addChangeListener(E))};this.getBorder=function(){return n};var E=function(u,G,x,y){d(h,G,x,y)};this.setHide=function(u){l!=u&&(l=u,d(h,KTColumn.HIDE,l,!l))};this.isHide=function(){return l};this.setUserObject=function(u){t=u};this.getUserObject=function(){return t}}KTColumn.WIDTH="width";KTColumn.HIDE="columnHide";KTColumn.iFlowId=100;
function KTRow(c,a){var h=this,d=a,g="row"+ ++KTRow.iFlowId,k=20,f=[],n,l,t=!1,E,u=!1;this.getKey=function(){return g};this.setHeight=function(y){k!=y&&(k=y,d(this,KTRow.HEIGHT,k,y))};this.getHeight=function(){return k};this.getCell=function(y,D){var H=f[y];D||H||(H=new KTCell(G),f[y]=H);return H};this.getCellForDraw=function(y){return f[y]};this.setStyle=function(y){y!=n&&(null!=n&&n.removeChangeListener(x),n=y,null!=n&&n.addChangeListener(x))};this.getStyle=function(){return n};this.setBorder=function(y){y!=
l&&(null!=l&&l.removeChangeListener(x),l=y,null!=l&&l.addChangeListener(x))};this.getBorder=function(){return l};this.$innerDestroy=function(){this.setStyle(null);this.setBorder(null);d=null;for(var y=0;y<f.length;y++){var D=f[y];D&&D.$innerDestroy()}f=null};this.$innerInsertCell=function(y){f.splice(y,0,null)};this.$innerRemoveCell=function(y){var D=f[y];D&&D.$innerDestroy();f.splice(y,1)};var G=function(y,D,H,K){var P;for(P=0;P<f.length&&f[P]!=y;P++);y=new KTCell.Path(h,P,y);d(y,D,H,K)},x=function(y,
D,H,K){d(h,D,H,K)};this.setHide=function(y){t!=y&&(t=y,d(h,KTRow.HIDE,t,!t))};this.isHide=function(){return t};this.setUserObject=function(y){E=y};this.getUserObject=function(){return E};this.clearAsSkeleton=function(){for(var y=0;y<f.length;y++){var D=f[y];D&&D.$innerDestroy()}f=[];u=!0};this.isSkeleton=function(){return u};this.rescueSkeleton=function(){u=!1}}KTRow.HEIGHT="height";KTRow.HIDE="rowHide";KTRow.iFlowId=0;
function KTCell(c){var a=this,h=c,d,g,k,f,n;this.setValue=function(E){if(d!=E){var u=d;d=E;"undefined"!=typeof u&&h(this,KTCell.VALUE,d,u)}};this.getValue=function(){return d};this.setUserObject=function(E){n=E};this.getUserObject=function(){return n};this.$innerDestroy=function(){this.setStyle(null);this.setBorder(null);h=null};this.setStyle=function(E){E!=g&&(null!=g&&g.removeChangeListener(l),g=E,null!=g&&g.addChangeListener(l))};this.getStyle=function(){return g};this.setBorder=function(E){E!=
k&&(null!=k&&k.removeChangeListener(l),k=E,null!=k&&k.addChangeListener(l))};this.getBorder=function(){return k};var l=function(E,u,G,x){h(a,u,G,x)};this.setTreeModel=function(E){f&&f.$innerBindChangeListener(null);if(f=E)f.$innerBindChangeListener(t),h(a,KTCell.TREE_EXPANDING)};this.getTreeModel=function(){return f};var t=function(E){E==KTCellTreeModel.EXPANDED&&h(a,KTCell.TREE_EXPANDING)}}KTCell.VALUE="value";KTCell.TREE_EXPANDING="treeExpanding";
KTCell.Path=function(c,a,h){var d,g;this.$innerSetInfo=function(k,f){d=k;g=f};this.getRowIndex=function(){return d};this.getColIndex=function(){return a};this.getRow=function(){return c};this.getCol=function(){return g};this.getCell=function(){return h}};
function KTAbstractStyle(){var c=null,a=[],h=!0;this.setChangeListenerSilence=function(g){h=g};this.$innerDirty=function(g,k,f,n){c=null;if(!h)for(var l=0;l<a.length;l++)a[l](g,k,f,n)};this.addChangeListener=function(g){h||0>d(g)&&a.push(g)};this.removeChangeListener=function(g){g=d(g);0<=g&&a.splice(g,1)};var d=function(g){for(var k=0;k<a.length;k++)if(a[k]==g)return k;return-1};this.copy=function(){throw Error("Override me.");};this.toCssString=function(){null==c&&(c=this.protectedCreateCssString());
return c};this.protectedCreateCssString=function(){throw Error("Override me.");};KTAbstractStyle.createCssItem=function(g,k,f){var n=typeof k;return"undefined"==n||null==k?"":"string"==n&&0<k.indexOf(" ")?g+':"'+k+'";':g+":"+k+(f?f:"")+";"};this.toString=function(){return this.toCssString()}}
function KTStyle(){KTAbstractStyle.call(this);var c=this,a,h,d,g,k,f,n,l,t,E,u,G,x,y,D,H,K,P=function(v){c.$innerDirty(c,v?v:KTStyle.STYLE_COMMON)};this.setFontName=function(v){a=v;P()};this.getFontName=function(){return a};this.setFontSize=function(v){h=v;P()};this.getFontSize=function(){return h};this.setBold=function(v){d=v;P()};this.isBold=function(){return d};this.setItalic=function(v){g=v;P()};this.getItalic=function(){return g};this.setUnderLine=function(v){k=v;P()};this.isUnderLine=function(){return k};
this.setLineThrough=function(v){f=v;P()};this.isLineThrough=function(){return f};this.setColor=function(v){n=v;P()};this.getColor=function(){return n};this.setBackgroundColor=function(v){l=v;P()};this.getBackgroundColor=function(){return l};this.setTextAlign=function(v){t=v;P()};this.getTextAlign=function(){return t};this.setVerticalAlign=function(v){E=v;P(KTStyle.STYLE_TEXT_SPECIAL)};this.getVerticalAlign=function(){return E};this.setWrapText=function(v){u=v;P(KTStyle.STYLE_TEXT_SPECIAL)};this.isWrapText=
function(){return u};this.setShrinkText=function(v){D=v;P(KTStyle.STYLE_TEXT_SPECIAL)};this.isShrinkText=function(){return D};this.setVerticalText=function(v){y=v;P(KTStyle.STYLE_TEXT_SPECIAL)};this.isVerticalText=function(){return y};this.setIndent=function(v){G=v;P()};this.getIndent=function(){return G};this.setRotation=function(v){x=v;P()};this.getRotation=function(){return x};this.setCursor=function(v){H=v};this.getCursor=function(){return H};this.setFontUnit=function(v){K=v};this.getFontUnit=
function(){return K};this.getFontSizeWithUnit=function(){return h||0==h?h+(K?K:KTStyle.DEFAULT_FONT_UNIT):h};this.copy=function(){var v=new KTStyle;v.setFontName(a);v.setFontSize(h);v.setBold(d);v.setItalic(g);v.setUnderLine(k);v.setLineThrough(f);v.setColor(n);v.setBackgroundColor(l);v.setTextAlign(t);v.setVerticalAlign(E);v.setWrapText(u);v.setVerticalText(y);v.setCursor(H);v.setFontUnit(K);return v};this.protectedCreateCssString=function(){var v=""+KTAbstractStyle.createCssItem("font-family",a);
v+=KTAbstractStyle.createCssItem("font-size",h,K?K:KTStyle.DEFAULT_FONT_UNIT);1==d?v+=KTAbstractStyle.createCssItem("font-weight","bold"):0==d&&(v+=KTAbstractStyle.createCssItem("font-weight","normal"));1==g?v+=KTAbstractStyle.createCssItem("font-style","italic"):0==g&&(v+=KTAbstractStyle.createCssItem("font-style","normal"));f&&k?v+=KTAbstractStyle.createCssItem("text-decoration","underline line-through"):k?v+=KTAbstractStyle.createCssItem("text-decoration","underline"):f&&(v+=KTAbstractStyle.createCssItem("text-decoration",
"line-through"));v+=KTAbstractStyle.createCssItem("color",n);v+=KTAbstractStyle.createCssItem("background-color",l);v+=KTAbstractStyle.createCssItem("text-align",t);v+=KTAbstractStyle.createCssItem("vertical-align",E);!0===u?(v+=KTAbstractStyle.createCssItem("white-space","pre-wrap"),v+=KTAbstractStyle.createCssItem("word-break","break-word"),v+=KTAbstractStyle.createCssItem("*white-space","pre"),v+=KTAbstractStyle.createCssItem("*word-wrap","break-word")):!1===u&&(v+=KTAbstractStyle.createCssItem("white-space",
"nowrap"));return v}}KTStyle.CSS_ID_PREFIXE="style";KTStyle.STYLE_COMMON="styleCommon";KTStyle.STYLE_TEXT_SPECIAL="styleTextSpecial";KTStyle.DEFAULT_FONT_UNIT="pt";
function KTBorderStyle(){KTAbstractStyle.call(this);var c=this,a=Array(4),h=Array(4),d=Array(4),g=function(k){c.$innerDirty(c,k?k:KTBorderStyle.BORDER_COMMON)};this.setTopBorderPen=function(k){a[0]=k;g()};this.getTopBorderPen=function(){return a[0]};this.setRightBorderPen=function(k){a[1]=k;g()};this.getRightBorderPen=function(){return a[1]};this.setBottomBorderPen=function(k){a[2]=k;g()};this.getBottomBorderPen=function(){return a[2]};this.setLeftBorderPen=function(k){a[3]=k;g()};this.getLeftBorderPen=
function(){return a[3]};this.setBorderPen=function(k){for(var f=0;4>f;f++)a[f]=k;g()};this.getBorderPen=function(){return a[0]==a[1]&&a[0]==a[2]&&a[0]==a[3]?a[0]:null};this.setTopBorderWidth=function(k){h[0]=k;g(KTBorderStyle.BORDER_WIDTH)};this.getTopBorderWidth=function(){return h[0]};this.setRightBorderWidth=function(k){h[1]=k;g(KTBorderStyle.BORDER_WIDTH)};this.getRightBorderWidth=function(){return h[1]};this.setBottomBorderWidth=function(k){h[2]=k;g(KTBorderStyle.BORDER_WIDTH)};this.getBottomBorderWidth=
function(){return h[2]};this.setLeftBorderWidth=function(k){h[3]=k;g(KTBorderStyle.BORDER_WIDTH)};this.getLeftBorderWidth=function(){return h[3]};this.setBorderWidth=function(k){for(var f=0;4>f;f++)h[f]=k;g(KTBorderStyle.BORDER_WIDTH)};this.getBorderWidth=function(){return h[0]==h[1]&&h[0]==h[2]&&h[0]==h[3]?h[0]:null};this.setTopBorderColor=function(k){d[0]=k;g()};this.getTopBorderColor=function(){return d[0]};this.setRightBorderColor=function(k){d[1]=k;g()};this.getRightBorderColor=function(){return d[1]};
this.setBottomBorderColor=function(k){d[2]=k;g()};this.getBottomBorderColor=function(){return d[2]};this.setLeftBorderColor=function(k){d[3]=k;g()};this.getLeftBorderColor=function(){return d[3]};this.setBorderColor=function(k){for(var f=0;4>f;f++)d[f]=k;g()};this.getBorderColor=function(){return d[0]==d[1]&&d[0]==d[2]&&d[0]==d[3]?d[0]:null};this.copy=function(){var k=new KTBorderStyle;k.setTopBorderPen(this.getTopBorderPen());k.setRightBorderPen(this.getRightBorderPen());k.setBottomBorderPen(this.getBottomBorderPen());
k.setLeftBorderPen(this.getLeftBorderPen());k.setTopBorderWidth(this.getTopBorderWidth());k.setRightBorderWidth(this.getRightBorderWidth());k.setBottomBorderWidth(this.getBottomBorderWidth());k.setLeftBorderWidth(this.getLeftBorderWidth());k.setTopBorderColor(this.getTopBorderColor());k.setRightBorderColor(this.getRightBorderColor());k.setBottomBorderColor(this.getBottomBorderColor());k.setLeftBorderColor(this.getLeftBorderColor());return k};this.protectedCreateCssString=function(){var k="",f=this.getBorderPen();
null==f?(k+=KTAbstractStyle.createCssItem("border-top-style",this.getTopBorderPen()),k+=KTAbstractStyle.createCssItem("border-right-style",this.getRightBorderPen()),k+=KTAbstractStyle.createCssItem("border-bottom-style",this.getBottomBorderPen()),k+=KTAbstractStyle.createCssItem("border-left-style",this.getLeftBorderPen())):k+=KTAbstractStyle.createCssItem("border-style",f);f=this.getBorderWidth();null==f?(k+=KTAbstractStyle.createCssItem("border-top-width",this.getTopBorderWidth(),"px"),k+=KTAbstractStyle.createCssItem("border-right-width",
this.getRightBorderWidth(),"px"),k+=KTAbstractStyle.createCssItem("border-bottom-width",this.getBottomBorderWidth(),"px"),k+=KTAbstractStyle.createCssItem("border-left-width",this.getLeftBorderWidth(),"px")):k+=KTAbstractStyle.createCssItem("border-width",f,"px");f=this.getBorderColor();null==f?(k+=KTAbstractStyle.createCssItem("border-top-color",this.getTopBorderColor()),k+=KTAbstractStyle.createCssItem("border-right-color",this.getRightBorderColor()),k+=KTAbstractStyle.createCssItem("border-bottom-color",
this.getBottomBorderColor()),k+=KTAbstractStyle.createCssItem("border-left-color",this.getLeftBorderColor())):k+=KTAbstractStyle.createCssItem("border-color",f);return k}}KTBorderStyle.CSS_ID_PREFIXE="border";KTBorderStyle.BORDER_COMMON="borderCommon";KTBorderStyle.BORDER_WIDTH="borderWidth";
function KTStyleManager(){var c=new KTStyleManager.MultiMaps,a=function(h,d){d=c.getMap(d);var g=d[h];if(!g){if(h instanceof KTStyle)g=KTStyle.CSS_ID_PREFIXE;else if(h instanceof KTBorderStyle)g=KTBorderStyle.CSS_ID_PREFIXE;else throw Error("New type, modify here.");g+=++KTStyleManager.iStyleFlowId;g=[h,g];d[h]=g}return g};this.getShareStyle=function(h,d){return a(h,d)[0]};this.getShareStyleId=function(h,d){return a(h,d)[1]}}KTStyleManager.iStyleFlowId=0;KTStyleManager.PRIORITY_TABLE=0;
KTStyleManager.PRIORITY_ROW=1;KTStyleManager.PRIORITY_COLUMN=2;KTStyleManager.PRIORITY_CELL=3;KTStyleManager.MultiMaps=function(){var c=[];this.getMap=function(a){var h=c[a];h||(h={},c[a]=h);return h}};
function KTSelectionModel(c){var a=this,h=KTSelectionModel.MODE_NONE,d=KTSelectionModel.POLICY_CELL,g=[],k=new KTListenerProxy;this.setMode=function(f){h=f};this.getMode=function(){return h};this.setPolicy=function(f){d=f};this.getPolicy=function(){return d};this.isPolicySetting=function(f){return(d&f)==f};this.addChangeListener=function(f){k.addListener(KTSelectionModel.CHANGE_ADD,f);k.addListener(KTSelectionModel.CHANGE_REMOVE,f)};this.removeChangeListener=function(f){k.removeListener(KTSelectionModel.CHANGE_ADD,
f);k.removeListener(KTSelectionModel.CHANGE_REMOVE,f)};this.addSelected=function(f){if(!(f instanceof KTSelectionModel.Target))throw Error("Illegal argument.");g.push(f);k.fireListener(KTSelectionModel.CHANGE_ADD,[f])};this.appendSelected=function(f){if(!(f instanceof KTSelectionModel.Target))throw Error("Illegal argument.");if(this.hasSelected()){var n=this.getSelected(),l=a.parseBlockRange(f),t=a.parseBlockRange(n),E=Math.min(Math.min(Math.min(l[0],l[2]),t[0]),t[2]),u=Math.min(Math.min(Math.min(l[1],
l[3]),t[1]),t[3]),G=Math.max(Math.max(Math.max(l[0],l[2]),t[0]),t[2]);l=Math.max(Math.max(Math.max(l[1],l[3]),t[1]),t[3]);if(f.isSingleRow())u=E==G?a.createRowTarget(E):new KTSelectionModel.Target(Math.min(E,G),-1,Math.max(E,G));else if(f.isSingleColumn())u=u==l?a.createColumnTarget(u):new KTSelectionModel.Target(-1,Math.min(u,l),null,Math.max(u,l));else if(a.isPolicySetting(KTSelectionModel.POLICY_BLOCK))u=a.createBlockTarget(E,u,G,l);else{for(n=E;n<=G;n++)for(f=u;f<=l;f++)E=a.createCellTarget(n,
f),a.isContains(E)||a.addSelected(E);return}a.removeSelected(n);a.addSelected(u)}else a.addSelected(f)};this.removeSelected=function(f){for(var n=g.length-1;0<=n;n--){var l=g[n];if(l.equals(f))return g.splice(n,1),k.fireListener(KTSelectionModel.CHANGE_REMOVE,[l]),!0}return!1};this.removeAllSelecteds=function(){var f=g.slice(0);g=[];k.fireListener(KTSelectionModel.CHANGE_REMOVE,f)};this.setSelected=function(f){this.hasSelected()&&this.removeAllSelecteds();this.addSelected(f)};this.getSelecteds=function(){return g.concat()};
this.getSelected=function(){return this.hasSelected()?g[g.length-1]:null};this.hasSelected=function(){return 0<g.length};this.isSingleSelected=function(){return 1==g.length};this.isContains=function(f){for(var n=0;n<g.length;n++)if(g[n].equals(f))return!0;return!1};this.createCellTarget=function(f,n){var l=c.searchMergeBlock(f,n);return l?new KTSelectionModel.Target(l.getRowIdxFrom(),l.getColIdxFrom(),l.getRowIdxTo(),l.getColIdxTo()):new KTSelectionModel.Target(f,n)};this.createRowTarget=function(f){return KTSelectionModel.Target.createRow(f,
-1)};this.createColumnTarget=function(f){return KTSelectionModel.Target.createColumn(-1,f)};this.createBlockTarget=function(f,n,l,t){return f==l&&n==t?a.createCellTarget(f,n):new KTSelectionModel.Target(Math.min(f,l),Math.min(n,t),Math.max(f,l),Math.max(n,t))};this.parseBlockRange=function(f){var n=f.getRowIdx(),l=f.getColIdx(),t=f.getEndRowIdx(),E=f.getEndColIdx();if(f.isSingleCell())t=n,E=l;else if(f.isSingleRow()||f.isRows())f.isSingleRow()&&(t=n),l=0,E=c.getColumnsCount()-1;else if(f.isSingleColumn()||
f.isColumns())f.isSingleColumn()&&(E=l),n=0,t=c.getRowsCount()-1;return[n,l,t,E]}}KTSelectionModel.MODE_NONE="selection_mode_none";KTSelectionModel.MODE_SINGLE="selection_mode_single";KTSelectionModel.MODE_MULTI="selection_mode_multi";KTSelectionModel.POLICY_CELL=1;KTSelectionModel.POLICY_BLOCK=2;KTSelectionModel.POLICY_ROW=4;KTSelectionModel.POLICY_COLUMN=8;KTSelectionModel.CHANGE_ADD="selectionChange-add";KTSelectionModel.CHANGE_REMOVE="selectionChange-remove";
KTSelectionModel.Target=function(c,a,h,d){var g=h||0==h?h:null,k=d||0==d?d:null;this.getRowIdx=function(){return c};this.getColIdx=function(){return a};this.getEndRowIdx=function(){return g};this.getEndColIdx=function(){return k};this.equals=function(f){return this.getRowIdx()==f.getRowIdx()&&this.getColIdx()==f.getColIdx()&&this.getEndRowIdx()==f.getEndRowIdx()&&this.getEndColIdx()==f.getEndColIdx()};this.toString=function(){return c+","+a+"~"+g+","+k};this.isSingleCell=function(){return null==g&&
null==k&&-1!=c&&-1!=a};this.isSingleRow=function(){return null==g&&-1==a};this.isSingleColumn=function(){return-1==c&&null==k};this.isBlock=function(){return null!=g&&-1!=c&&null!=k&&-1!=a};this.isRows=function(){return null!=g&&g!=c&&-1==a};this.isColumns=function(){return-1==c&&null!=k&&k!=a}};KTSelectionModel.Target.createRow=function(c){return new KTSelectionModel.Target(c,-1)};KTSelectionModel.Target.createColumn=function(c){return new KTSelectionModel.Target(-1,c)};
function KTMergeBlock(c,a,h,d){var g=c,k=a,f=h,n=d;this.setRowIdxFrom=function(l){g=l};this.getRowIdxFrom=function(){return g};this.setRowIdxTo=function(l){k=l};this.getRowIdxTo=function(){return k};this.setColIdxFrom=function(l){f=l};this.getColIdxFrom=function(){return f};this.setColIdxTo=function(l){n=l};this.getColIdxTo=function(){return n};this.isInvalid=function(){return g>a||h>d||g==a&&f==d};this.equals=function(l){return l instanceof KTMergeBlock?l.getRowIdxFrom()==g&&l.getRowIdxTo()==k&&
l.getColIdxFrom()==f&&l.getColIdxTo()==n:!1};this.isContainCell=function(l,t){return l>=g&&l<=k&&t>=f&&t<=n}}
function KTMergeBlockSet(){function c(){var l=[],t=[],E=[],u=[];this.getStartFromMe=function(){return l};this.getAcrossFromHorizontal=function(){return t};this.getAcrossFromVertical=function(){return E};this.getAcrossFromBoth=function(){return u}}var a=[],h=null,d;this.clear=function(){a=[];h=null};this.remove=function(l){for(var t=0;t<a.length;t++)if(l.equals(a[t]))return a.splice(t,1),h=null,!0;return!1};this.append=function(l){var t=f(a,l.getRowIdxFrom(),l.getColIdxFrom());return l.equals(t)?!1:
(a.push(l),h=null,!0)};this.appendArray=function(l){a=a.concat(l);h=null};this.requestBucketing=function(){h=null};this.bucketing=function(l,t,E,u){if(null==h)for(h={},d=1E6<l?1E4:1E4<l?1E3:100,l=0;l<a.length;l++){t=a[l];for(var G=g(t.getRowIdxFrom(),E),x=g(t.getRowIdxTo(),E),y=G;y<=x;y+=d){var D=h[y];D||(D={},h[y]=D);for(var H=k(t.getColIdxFrom(),u),K=k(t.getColIdxTo(),u),P=H;P<=K;P+=100){var v=D[P];v||(v=new c,D[P]=v);(y==G?P==H?v.getStartFromMe():v.getAcrossFromHorizontal():P==H?v.getAcrossFromVertical():
v.getAcrossFromBoth()).push(t)}}}};var g=function(l,t){l<t?t=0:(l=parseInt((l-t)/d),t+=l*d);return t},k=function(l,t){l<t?t=0:(l=parseInt((l-t)/100),t+=100*l);return t};this.search=function(l,t,E,u){var G=null;if(0<a.length)if(h){if(E=g(l,E),E=h[E])if(u=k(t,u),u=E[u])G=f(u.getStartFromMe(),l,t),!G&&(G=f(u.getAcrossFromVertical(),l,t)),!G&&(G=f(u.getAcrossFromHorizontal(),l,t)),!G&&(G=f(u.getAcrossFromBoth(),l,t))}else G=f(a,l,t);return G};var f=function(l,t,E){for(var u=0;u<l.length;u++){var G=l[u];
if(G.isContainCell(t,E))return G}return null};this.visit=function(l,t,E,u,G,x,y){if(0!=a.length)if(h){var D=[t,E,u,G];t=g(t,x);E=g(E,x);for(x=t;x<=E;x+=d){var H=h[x];if(H)for(var K=k(u,y),P=k(G,y),v=K;v<=P;v+=100){var V=H[v];if(V){if(x==t&&v==K){if(n(l,D,V.getAcrossFromBoth())||n(l,D,V.getAcrossFromVertical())||n(l,D,V.getAcrossFromHorizontal()))return}else if(x==t){if(n(l,D,V.getAcrossFromVertical()))return}else if(v==K&&n(l,D,V.getAcrossFromHorizontal()))return;if(n(l,D,V.getStartFromMe()))return}}}}else for(y=
0;y<a.length&&(D=a[y],D.getRowIdxTo()<t||E<D.getRowIdxFrom()||D.getColIdxTo()<u||G<D.getColIdxFrom()||!l(D));y++);};this.visitAll=function(l){for(var t=0;t<a.length&&!l(a[t]);t++);};var n=function(l,t,E){var u=t[0],G=t[1],x=t[2];t=t[3];for(var y=0;y<E.length;y++){var D=E[y];if(!(D.getRowIdxTo()<u||G<D.getRowIdxFrom()||D.getColIdxTo()<x||t<D.getColIdxFrom())&&l(D))return!0}return!1};this.syncMergeBlocks=function(l,t,E){if(l){l="setRowIdxFrom";var u="getRowIdxFrom";var G="setRowIdxTo";var x="getRowIdxTo"}else l=
"setColIdxFrom",u="getColIdxFrom",G="setColIdxTo",x="getColIdxTo";for(var y=a.length-1;0<=y;y--){var D=a[y];if(E)t<=D[u]()?(D[l](D[u]()+1),D[G](D[x]()+1),h=null):t<=D[x]()&&(D[G](D[x]()+1),h=null);else{var H=!1;t<D[u]()?(D[l](D[u]()-1),D[G](D[x]()-1),H=!0,h=null):t<=D[x]()&&(D[G](D[x]()-1),H=!0,h=null);H&&D.isInvalid()&&a.splice(y,1)}}}}
function KTListenerProxy(){var c={};this.addListener=function(a,h){var d=c[a];d||(d=[],c[a]=d);for(a=0;a<d.length;a++)if(d[a]==h)return;d.push(h)};this.removeListener=function(a,h){if(a=c[a])for(var d=a.length-1;0<=d;d--)if(a[d]==h){a.splice(d,1);break}};this.fireListener=function(a,h){var d=c[a];if(d)for(var g=d.length-1;0<=g;g--)d[g](a,h)}}
function KTEmbedObject(c,a,h,d,g){var k=this,f,n=c,l=a,t=h,E=d,u=g,G,x,y,D,H,K,P=!1;this.$innerBindChangeListener=function(v){f=v};this.setId=function(v){n=v};this.getId=function(){return n};this.setX=function(v){l!=v&&(l=v,f&&f(k,KTEmbedObject.BOUND,void 0,void 0))};this.getX=function(){return l};this.setY=function(v){t!=v&&(t=v,f&&f(k,KTEmbedObject.BOUND,void 0,void 0))};this.getY=function(){return t};this.setWidth=function(v){E!=v&&(E=v,f&&f(k,KTEmbedObject.BOUND,void 0,void 0))};this.getWidth=
function(){return E};this.setHeight=function(v){u!=v&&(u=v,f&&f(k,KTEmbedObject.BOUND,void 0,void 0))};this.getHeight=function(){return u};this.setType=function(v){G=v};this.getType=function(){return G};this.setUserObject=function(v){var V=x;x=v;f&&f(k,KTEmbedObject.DATA,x,V)};this.getUserObject=function(){return x};this.setRowFrom=function(v){y=v};this.getRowFrom=function(){return y};this.setColFrom=function(v){D=v};this.getColFrom=function(){return D};this.setEndRowFrom=function(v){H=v};this.getEndRowFrom=
function(){return H};this.setEndColFrom=function(v){K=v};this.getEndColFrom=function(){return K};this.setFrozenFixed=function(v){P=v};this.isFrozenFixed=function(){return P}}KTEmbedObject.BOUND="embedObjectXYWH";KTEmbedObject.DATA="embedObjectData";
function KTCellTreeModel(c,a){var h,d=a?!0:!1,g=-1,k=!1,f=!0,n;g=-1;this.$innerBindChangeListener=function(l){h=l};this.isHorizontal=function(){return d};this.getLevel=function(){return c};this.setHaveHandlerAlways=function(l){k=l};this.isHaveHandlerAlways=function(){return k};this.setExpanded=function(l){f!=l&&(f=l,h&&h(KTCellTreeModel.EXPANDED))};this.isExpanded=function(){return f};this.setLazyLoaded=function(l){n=l};this.isLazyLoaded=function(){return n};this.setLastChildLevel=function(l){g=l};
this.getLastChildLevel=function(){return g}}KTCellTreeModel.EXPANDED="expanded";
function KTDiagonalModel(){var c=KTDiagonalModel.BASE_LEFT_UP,a=1,h=1,d=[],g=[],k=[];this.setBasePoint=function(n){c=n};this.getBasePoint=function(){return c};this.setCrossRows=function(n){a=n};this.getCrossRows=function(){return a};this.setCrossColumns=function(n){h=n};this.getCrossColumns=function(){return h};this.setLinkToRows=function(n){d=n};this.getLinkToRows=function(){return d};this.setLinkToColumns=function(n){g=n};this.getLinkToColumns=function(){return g};this.getTriangleSize=function(){return d.length+
g.length+2};var f=function(n){var l=k[n];l||(l={text:"",lean:!0},k[n]=l);return l};this.setText=function(n,l){f(l).text=n};this.getText=function(n){return f(n).text};this.setLean=function(n,l){f(l).lean=n};this.isLean=function(n){return f(n).lean};this.setStyle=function(n,l){f(l).style=n};this.getStyle=function(n){return f(n).style};this.setSlashBorder=function(n,l){f(l).slashStyle=n};this.getSlashBorder=function(n){return f(n).slashStyle}}KTDiagonalModel.BASE_LEFT_UP="left-up";
KTDiagonalModel.BASE_RIGHT_UP="right-up";KTDiagonalModel.BASE_LEFT_DOWN="left-down";KTDiagonalModel.BASE_RIGHT_DOWN="right-down";function KTableUI(c){function a(){this.fireEvent=function(e,r){P.fireListener(e,r)};this.isScrollDynamicRepaint=function(){return h.isScrollDynamicRepaint()};this.isDynamicRepaintWithCache=function(){return h.isDynamicRepaintWithCache()};this.isDynamicUpdateModel=function(){return H?!0:!1};this.getDynamicUpdateModelAliveDeltaRows=function(){return K};this.fireDynamicUpdateModelEvent=function(e,r,I){pa(e,r,I)};this.buildStyle=function(e,r,I){return Y(e,r,I)};this.buildBorder=function(e,r,I){var N=
"";I&&(N+=aa(I.getBorder(),KTStyleManager.PRIORITY_CELL));N+=aa(r.getBorder(),KTStyleManager.PRIORITY_COLUMN);N+=aa(e.getBorder(),KTStyleManager.PRIORITY_ROW);return N+=aa(d.getBorder(),KTStyleManager.PRIORITY_TABLE)};this.searchRowIdx=function(e){e=!v||1>=v.length?-1:C(v,e);return e};this.searchCell=function(e,r){return z(e,r)};this.getRowY=function(e){return ma(e)};this.getColX=function(e){return V[e]}}KTableUI.INSERT_COL="insertColumn";KTableUI.REMOVE_COL="removeColumn";KTableUI.INSERT_ROW="insertRow";
KTableUI.REMOVE_ROW="removeRow";KTableUI.ADD_MERGEBLOCK="addMergeBlock";KTableUI.REMOVE_MERGEBLOCK="removeMergeBlock";KTableUI.FROZEN_ROW="frozenRow";KTableUI.FROZEN_COL="frozenCol";var h=this,d=c,g=$("<div>"),k,f,n,l,t=[],E=new KTableUIDraggableAdjustingHandler,u,G,x=!0,y=!1,D=!0,H,K,P=new KTListenerProxy,v=[],V=[],ha=!1;this.getHtmlElement=function(){if(!(0<g.children().length)){g.css("overflow","hidden");g.css("white-space","nowrap");var e=W().getUI();e.attr("id",d.getId()+W().getName());R(e);
e.css("position","absolute");e.css("left",0);e.css("top",0);e.width("100%");e.height("100%");e.css("z-index",0);e.appendTo(g);B()}return g[0]};this.setScrollerVisible=function(e,r,I){var N=W().getUI();N.css("overflow-x",e?e:"hidden");N.css("overflow-y",r?r:"auto");I&&I(N)};var W=function(){k||(k=new KTableUIMainView(d,new a),h.addListener("scroll",ka),h.addListener("scroll",b),h.addListener("mousedown",b),h.addListener("mousedown",J),h.addListener("mousemove",J),h.addListener("mouseup",J),h.addListener("mousemove",
Z),g.on("mouseleave",qa),h.addListener("mousedown",E.mouseEventHandler),h.addListener("mousemove",E.mouseEventHandler),E.setContext(d,g,{getRowY:ma,getColX:na,getScrollLeft:fa,getScrollTop:ba}));return k};this.setSyncUIWhenModelChanged=function(e){x=e};this.isSyncUIWhenModelChanged=function(){return x};this.setScrollDynamicRepaint=function(e,r){y=e?!0:!1;D=r||"undefined"==typeof r?!0:!1;0<g.children().length&&h.updateUI()};this.isScrollDynamicRepaint=function(){return y};this.isDynamicRepaintWithCache=
function(){return D};this.setScrollDynamicUpdateModelListener=function(e,r){K=e;H=r};var pa=function(e,r,I){H&&!ha&&H(e,r,function(){I();n&&n.repaint();F()})};this.updateUI=function(e,r){d.getCellRender().reset();d.bucketingMergeBlocks();if(d.isColumnFitVisibleWidth()){for(var I=0,N=0,S=d.getColumnsCount();N<S;N++){var U=d.getColumn(N);U.isHide()||(I+=U.getWidth())}var ca=g.prop("clientWidth")-1,ia=d.isSyncUIWhenModelChanged();d.setSyncUIWhenModelChanged(!1);I=ca/I;N=0;for(S=d.getColumnsCount();N<
S;N++)if(U=d.getColumn(N),!U.isHide()){var ta=parseInt(U.getWidth()*I);U.setWidth(ta);ca-=ta}if(0<ca)for(N=d.getColumnsCount()-1;0<=N;N--)if(U=d.getColumn(N),!U.isHide()){U.setWidth(U.getWidth()+ca);break}d.setSyncUIWhenModelChanged(ia)}w(-1);la(-1);var oa;e&&(oa=r?r:h.keepScrollStatus());ha=!0;W().updateUI();ea();f&&f.updateUI();n&&n.updateUI();l&&l.updateUI();if(0<t.length)for(r=0;r<t.length;r++)t[r]&&t[r].updateUI();A();F();ha=!1;e&&h.restoreScrollStatus(oa)};this.keepScrollStatus=function(){var e=
W().getUI().prop("scrollTop"),r=W().getUI().prop("scrollLeft");return{v:e,h:r}};this.restoreScrollStatus=function(e){var r=e.v;e=e.h;W().getUI().prop("scrollTop",r);W().getUI().prop("scrollLeft",e)};this.scrollCellVisible=function(e,r,I){r=V[r];e=v[e];I?W().getUI().animate({scrollTop:e,scrollLeft:r}):W().getUI().prop({scrollTop:e,scrollLeft:r})};this.showPromptForLazyAppendData=function(e){e?(G||(G=$('<div style="position:absolute; left:0; right:0; top:0; bottom:0">'),G.css("z-index",128),e=$('<div style="position:absolute; left:0; right:0; top:0; bottom:0">'),
e.css("background-color","#CCCCCC"),e.css("opacity",.5),e.appendTo(G),e=$("<div>"),e.css("position","absolute"),e.width(120),e.height(20),e.css("padding",10),e.css("background-color","#D0E3F6"),e.css("border","1px solid #97B3CB"),e.text("\u6570\u636e\u52a0\u8f7d\u4e2d..."),e.appendTo(G)),G.appendTo(g),e=G.find(":last-child"),e.css("left",(g.width()-e.width())/2),e.css("top",(g.height()-e.height())/2)):G&&G.remove()};this.repaintAfterLazyAppendData=function(e){d.getCellRender().reset();la(e);W().reset();
W().repaint();W().adjustFootPlaceholder();n&&(n.reset(),n.repaint(),n.adjustFootPlaceholder());F()};this.searchCell=function(e,r){w(-1);la(-1);return z(e,r)};var la=function(e){var r=d.getRowsCount();v.length>r+1&&(v.length=r+1);for(var I=0<=e?v[e]:0,N=e=0<=e?e:0;N<r;N++){v[N]=I;var S=d.getRow(N);S.isHide()||(S=S.getHeight(),I+=S)}v[r]=I;r=e;if(c.isAutoAdjustRowHeight())for(e=0,r=0<=r?r:0,I=v.length-1;r<I;r++){S=d.getRow(r);if(!S.isHide()){for(var U=N=0,ca=d.getColumnsCount();U<=ca;U++){var ia=S.getCellForDraw(U);
if(ia){var ta=d.getColumn(U);if(d.getStyleValue(ia,ta,S,"getStyle","isWrapText",!1)){var oa=r;var ua=U,va=S,wa=ia;ia=d.searchMergeBlock(oa,ua);if(!ia||oa==ia.getRowIdxFrom()&&ua==ia.getColIdxFrom()){var xa=(ia?V[ia.getColIdxTo()+1]-V[ia.getColIdxFrom()]:ta.getWidth())-4;if(0>xa)oa=0;else{var za=Y(va,ta,wa),ya=d.getCellRender();ya.setContext(va,ta,wa,oa,ua,NaN,NaN,xa,NaN);oa=ya.calculateCellHeight(za);ia&&(oa-=v[ia.getRowIdxTo()+1]-v[ia.getRowIdxFrom()+1],oa=0>oa?0:oa);oa+=4}}else oa=0;N=oa>N?oa:N}}}S=
S.getHeight();N>S&&(e+=N-S)}v[r+1]+=e}},w=function(e){var r=d.getColumnsCount();V.length>r+1&&(V.length=r+1);var I=0<=e?V[e]:0;for(e=0<=e?e:0;e<r;e++){V[e]=I;var N=d.getColumn(e);N.isHide()||(N=N.getWidth(),I+=N)}V[r]=I},z=function(e,r){if(!V||1>=V.length||!v||1>=v.length||e>=V[V.length-1]||r>=v[v.length-1])return null;e=C(V,e,!0);return[C(v,r,!0),e]},C=function(e,r,I){for(var N,S=[0,e.length-2];S;){var U=S[0],ca=S[1];if(U==ca){N=U;break}var ia=U+ca>>1;if(e[ia]==r){N=ia;break}else if(e[ia]<r)S[0]=
ia+1,S[1]=ca;else if(e[ia]>r){if(ia-1<U){N=ia;break}S[0]=U;S[1]=ia-1}else throw Error("Prevent endless loop.");}if(I){for(;e[N]>r&&0<N;)--N;for(;e[N+1]<=r&&N<e.length-2;)N+=1}return N};this.modelChangeHandler=function(e,r){if(x&&0<g.children().length){var I=W().modelChangeHandler(e,r);f&&(I=I||f.modelChangeHandler(e,r));n&&(I=I||n.modelChangeHandler(e,r));l&&(I=I||l.modelChangeHandler(e,r));if(0<t.length)for(var N=0;N<t.length;N++)t[N]&&(I=I||t[N].modelChangeHandler(e,r));I&&h.updateUI(!0)}};this.propertyChangeHandler=
function(e,r,I,N){if(x&&0<g.children().length)switch(r){case KTColumn.WIDTH:w(d.getColumnIndex(e));L(e,r,I,N);ea();ra();break;case KTRow.HEIGHT:la(d.getRowIndex(e));L(e,r,I,N);sa();break;case KTableUI.FROZEN_ROW:case KTableUI.FROZEN_COL:B();h.updateUI();break;case KTRow.HIDE:var S=d.getRowIndex(e);la(S);L(e,r,I,N);ea();ra();sa();break;case KTColumn.HIDE:S=d.getColumnIndex(e);w(S);L(e,r,I,N);ea();ra();sa();break;case KTEmbedObject.DATA:W().propertyChangeHandler(e,r,I,N);break;default:L(e,r,I,N)}};
var L=function(e,r,I,N){var S=W().propertyChangeHandler(e,r,I,N);f&&(S=S||f.propertyChangeHandler(e,r,I,N));n&&(S=S||n.propertyChangeHandler(e,r,I,N));l&&(S=S||l.propertyChangeHandler(e,r,I,N));if(0<t.length)for(var U=0;U<t.length;U++)t[U]&&(S=S||t[U].propertyChangeHandler(e,r,I,N));S&&h.updateUI(!0)};this.addListener=function(e,r){P.addListener(e,r)};this.removeListener=function(e,r){P.removeListener(e,r)};var B=function(){var e=d.getFrozenRows(),r=d.getFrozenColumns();e=0<e;r=0<r;var I=e&&r;e&&
!f?(f=new KTableUITopFrozenView(d,new a),T(f,1)):!e&&f&&(da(f),f=null);r&&!n?(n=new KTableUILeftFrozenView(d,new a),T(n,1)):!r&&n&&(da(n),n=null);I&&!l?(l=new KTableUICornerFrozenView(d,new a),T(l,2)):!I&&l&&(da(l),l=null)},R=function(e){var r=d.getUICustomStyleMap();r=r?r["background-color"]:null;e.css("background-color",r?r:"#fff")},T=function(e,r){e=e.getUI();e.appendTo(g);e.css("z-index",r);e.css("top",0);e.css("left",0);R(e)},da=function(e){e.getUI().remove();e.destroy()};this.relayoutViews=
function(){W().repaint();ea();ra();sa();A();F()};var ea=function(){if(f){var e=W().getUI().prop("clientWidth");f.getUI().width(e)}n&&(e=W().getUI().prop("clientHeight"),n.getUI().height(e))},ka=function(e,r){r.isHorizontalScroll()&&(ra(),A(),f&&q("left",fa()-r.getLastScrollLeft()));r.isVerticalScroll()&&(sa(),F(),n&&q("top",ba()-r.getLastScrollTop()))},ra=function(){if(f){var e=fa();f.getUI().prop("scrollLeft",e)}},sa=function(){if(n){var e=ba();n.getUI().prop("scrollTop",e);h.isScrollDynamicRepaint()&&
(n.setBlankFirstImmediately(k.isBlankFirstImmediately()),n.repaint(),n.setBlankFirstImmediately(!1))}},q=function(e,r){if(!(0==t.length||f&&n))for(var I=0;I<t.length;I++)if(t[I]){var N=parseInt(t[I].getUI().css(e));t[I].getUI().css(e,N-r+"px")}},A=function(){if(d.isMergeBlockTextVisibleAlways()&&1<V.length){var e=fa(),r=e+W().getUI().prop("clientWidth");e+=n?n.getUI().prop("offsetWidth"):0;var I=C(V,e,!0),N=C(V,r,!0);(f?f:W()).adjustHorizontalFrontierCell(e,r,I,N)}},F=function(){if(d.isMergeBlockTextVisibleAlways()&&
1<v.length){var e=ba(),r=e+W().getUI().prop("clientHeight");e+=f?f.getUI().prop("offsetHeight"):0;var I=C(v,e,!0),N=C(v,r,!0);(n?n:W()).adjustVerticalFrontierCell(e,r,I,N)}};this.popupMenu=function(e,r,I,N,S){b();if(I&&0!=I.length){if(S){var U=S["background-color"];var ca=S["border-color"];var ia=S["font-size"];var ta=S["selection-color"]}U=U?U:"#D0E3F6";ca=ca?ca:"#97B3CB";ia=ia?ia:12;ta=ta?ta:"#FFE358";u=$("<div>");u.css("z-index",64);u.css("position","absolute");u.css("cursor","pointer");u.css("border",
"1px solid");u.css("border-color",ca);u.css("background-color",U);u.css("font-size",ia);for(S=0;S<I.length;S++)U=I[S],ca=$("<div>"),ca.text(U.getText()),ca.css("padding",2),ca.css("max-width",300),ca.css("text-overflow","ellipsis"),ca.css("overflow","hidden"),ca.click(M(N,U)),ca.mouseover(function(oa){$(oa.target).css("background-color",ta)}),ca.mouseout(function(oa){$(oa.target).css("background-color","")}),u.append(ca);g.append(u);e+u.width()>g.width()&&(u.width(u.width()+2),e=g.width()-u.width()-
5,e=0>e?0:e);r+u.height()>g.height()&&(r=g.height()-u.height()-5,r=0>r?0:r);u.css("left",e);u.css("top",r)}};var M=function(e,r){return function(I){b();e&&e(r)}},b=function(){u&&u.remove()},m=!1,p=!1,O=null,J=function(e,r){r.isStopped()||d.getSelectionModel().getMode()==KTSelectionModel.MODE_NONE||null===d.getSelectionRender()||("mousedown"==e?r.isLeftButton()&&(e=r.getMouseTargetModel(),e instanceof KTCell.Path&&(m=!0,O=d.getSelectionModel().createCellTarget(e.getRowIndex(),e.getColIndex()))):"mouseup"==
e?(p&&(Q(null),e=r.getMouseTargetModel(),e instanceof KTCell.Path&&(e=d.getSelectionModel().createCellTarget(e.getRowIndex(),e.getColIndex()),e.equals(O)||d.getSelectionModel().appendSelected(e))),m=p=!1,O=null):"mousemove"==e&&d.getSelectionModel().isPolicySetting(KTSelectionModel.POLICY_BLOCK)&&(m&&!p&&(p=!0),p&&(e=r.getMouseTargetModel(),Q(e))))},Q=function(e){var r=null;if(e instanceof KTCell.Path){r=d.getSelectionModel();e=r.createCellTarget(e.getRowIndex(),e.getColIndex());e=r.parseBlockRange(e);
var I=r.parseBlockRange(O);r=r.createBlockTarget(Math.min(Math.min(Math.min(e[0],e[2]),I[0]),I[2]),Math.min(Math.min(Math.min(e[1],e[3]),I[1]),I[3]),Math.max(Math.max(Math.max(e[0],e[2]),I[0]),I[2]),Math.max(Math.max(Math.max(e[1],e[3]),I[1]),I[3]))}k.showDragingMarkBundle(r);l&&l.showDragingMarkBundle(r);n&&n.showDragingMarkBundle(r);f&&f.showDragingMarkBundle(r)},X=function(e,r){e==KTSelectionModel.CHANGE_ADD&&(e=d.getSelectionModel().parseBlockRange(r[0]),P.fireListener("new-select",[V[e[1]],v[e[0]],
V[e[3]+1],v[e[2]+1]]))},Y=function(e,r,I){var N="";I&&(N+=aa(I.getStyle(),KTStyleManager.PRIORITY_CELL));N+=aa(r.getStyle(),KTStyleManager.PRIORITY_COLUMN);N+=aa(e.getStyle(),KTStyleManager.PRIORITY_ROW);return N+=aa(d.getStyle(),KTStyleManager.PRIORITY_TABLE)},aa=function(e,r){if(!e)return"";var I=d.getStyleManager().getShareStyleId(e,r),N=KTableUI.oMapsCssName.getMap(r);if(!N[I]){N[I]=!0;N="."+I;e=e.toCssString();r=KTableUI.sStyleNodeIdPrefix+r;for(var S,U=document.styleSheets.length-1;0<=U;U--){var ca=
document.styleSheets[U];if((ca.id||""==ca.id?ca.id:ca.ownerNode.id)==r){S=ca;break}}S.addRule?S.addRule(N,e):S.insertRule(N+"{"+e+"}",S.cssRules.length)}return" "+I};this.selectByPoint=function(e,r){r=z(e,r);if(!r)return!1;e=d.getSelectionModel();r=e.isPolicySetting(KTSelectionModel.POLICY_ROW)?e.createRowTarget(r[0]):e.isPolicySetting(KTSelectionModel.POLICY_COLUMN)?e.createColumnTarget(r[1]):e.createCellTarget(r[0],r[1]);e.removeAllSelecteds();e.addSelected(r);return!0};var Z=function(e,r){if(e=
d.getCellAcrossListener())if(r.isCellPointed()){var I=r.getMouseTargetModel(),N=d.getSelectionModel().createCellTarget(I.getRowIndex(),I.getColIndex());I=N.getRowIdx();N=N.getColIdx();r=$(r.getOriginalEvent().currentTarget);var S=KTableUIAbstractView.createCellId(d.getRow(I),d.getColumn(N));r=r.find("#"+S);e(r,I,N,ja)}else e(null,-1,-1,ja)},qa=function(e){(e=d.getCellAcrossListener())&&e(null,-1,-1,ja)},ja=function(e,r){if(void 0===r){var I="*[id*='"+KTableUIAbstractView.createCellId(d.getRow(e))+
"']";return g.find(I)}I="#"+KTableUIAbstractView.createCellId(d.getRow(e),d.getColumn(r));e=function(N){return(N=N?N.getCellsContainer().find(I):null)&&0<N.length?N:null};return e(l)||e(n)||e(f)||e(k)},fa=function(){return W().getUI().prop("scrollLeft")},ba=function(){return W().getUI().prop("scrollTop")},ma=function(e){return e>=v.length?v[v.length-1]:v[e]},na=function(e){return V[e]};(function(){if(!KTableUI.sStyleNodeIdPrefix){KTableUI.sStyleNodeIdPrefix="_ktable_style_";var e=$("head"),r=KTableUI.sStyleNodeIdPrefix+
KTStyleManager.PRIORITY_TABLE;e.append($('<style type="text/css" id="'+r+'">'));r=KTableUI.sStyleNodeIdPrefix+KTStyleManager.PRIORITY_ROW;e.append($('<style type="text/css" id="'+r+'">'));r=KTableUI.sStyleNodeIdPrefix+KTStyleManager.PRIORITY_COLUMN;e.append($('<style type="text/css" id="'+r+'">'));r=KTableUI.sStyleNodeIdPrefix+KTStyleManager.PRIORITY_CELL;e.append($('<style type="text/css" id="'+r+'">'))}d.getSelectionModel().addChangeListener(X)})()}KTableUI.sStyleNodeIdPrefix=null;
KTableUI.oMapsCssName=new KTStyleManager.MultiMaps;
function KTableUIAbstractView(c,a){function h(q,A,F,M,b,m,p,O){KTAbstractMouseEvent.call(this,q,A,F,M,b);var J;this.getOriginalEvent=function(){return q};this.isCellPointed=function(){return m instanceof KTCell.Path};this.getMouseTargetModel=function(){return m};this.isPointTreeHandler=function(){return p};this.isPointScrollBar=function(){return O};this.setXYCellAtTable=function(Q,X){J=[Q,X]};this.getXYCellAtTable=function(){return J}}function d(){KTableSelectionRender.call(this);var q=$("<div>"),
A=$("<div>"),F=$("<div>"),M=$("<div>");this.show=function(p,O,J,Q,X){--O;--J;--Q;--X;var Y=Q-O,aa=X-J;b(q,O,J,Y,0);b(F,O,X,Y,0);b(M,O,J,0,aa);b(A,Q,J,0,aa);p.append(q);p.append(A);p.append(F);p.append(M)};this.remove=function(){q.remove();A.remove();F.remove();M.remove()};this.current=function(){m(q);m(F);m(M);m(A)};var b=function(p,O,J,Q,X){p.attr("ktableUiMark","selectionBundle");p.css("z-index",64);p.css("position","absolute");p.css("left",O);p.css("top",J);p.width(Q);p.height(X);p.css("overflow",
"hidden");p.css("border-width","1px");p.css("border-style","solid");m(p)};this.letOthersOld=function(p){p.children("div[ktableUiMark='selectionBundle']").css("border-color","#ffcc33")};var m=function(p){p.css("border-color","#aa6600")}}var g=this,k=$("<div>"),f,n={};this.getName=function(){throw Error("Override me.");};this.getViewTag=function(){throw Error("Override me.");};this.destroy=function(){};this.getUI=function(){return k};this.getCellsContainer=function(){f||(f=$("<div>"),f.attr("ktableUiMark",
"allCellLayer"),f.css("z-index",1),f.css("position","absolute"),f.css("left",0),f.css("top",0),k.append(f));return f};this.updateUI=function(){g.protectedBeforeUpdateUI();k.children(":not([ktableUiMark='allCellLayer'])").remove();g.getCellsContainer().empty();g.repaint();g.adjustFootPlaceholder();g.adjustRightPlaceholder()};this.protectedBeforeUpdateUI=function(){};this.adjustFootPlaceholder=function(){var q=a.getRowY(c.getRowsCount())+1;g.getCellsContainer().css("height",q)};this.adjustRightPlaceholder=
function(){var q=c.getDraggableAdjusting(),A=0;q&&(A=(A=q?q[2]:null)?A.getTailBlankForDragging():60);q=a.getColX(c.getColumnsCount())+1;q+=A;g.getCellsContainer().css("width",q)};this.protectedBeforeRepaint=function(q){throw Error("Override me.");};this.protectedIsNeedCreatingRow=function(q,A,F,M){return!0};this.protectedAfterRepaint=function(q,A,F){};this.protectedGetPaintRect=function(){throw Error("Override me.");};this.repaint=function(){l();x()};this.adjustVerticalFrontierCell=function(q,A,F,
M){var b=g.protectedBeforeRepaint();c.visitMergeBlocks(F,M,b[2],b[3],function(m){if(m.getRowIdxFrom()!=m.getRowIdxTo()){var p=C(m);if(p.length){var O=p[p.length-1];p=$(O);var J=a.getRowY(m.getRowIdxFrom()),Q=a.getRowY(m.getRowIdxTo()+1),X=Math.max(q,J),Y=Math.min(A,Q)-X-(Q-J);Q=p.width();Y=p.height()+Y;if(!(20>Y)||F<m.getRowIdxFrom()&&m.getRowIdxTo()<M)if(J=X-J,a.isDynamicUpdateModel())$(O).children().css({top:J,height:Y,"line-height":Y+"px"});else{X=m.getRowIdxFrom();var aa=m.getColIdxFrom(),Z=c.getRow(X),
qa=c.getColumn(aa),ja=Z.getCell(aa);0==X&&0==aa&&ja&&ja.getValue()instanceof KTDiagonalModel||(p.empty(),K(O,X,aa,Z,qa,ja,m,0,J,Q,Y))}}}})};this.adjustHorizontalFrontierCell=function(q,A,F,M){var b=g.protectedBeforeRepaint();c.visitMergeBlocks(b[0],b[1],F,M,function(m){if(m.getColIdxFrom()!=m.getColIdxTo()){var p=C(m);if(p.length){var O=p[p.length-1];p=$(O);var J=a.getColX(m.getColIdxFrom()),Q=a.getColX(m.getColIdxTo()+1),X=Math.max(q,J),Y=Math.min(A,Q)-X-(Q-J);Q=m.getRowIdxFrom();var aa=m.getColIdxFrom(),
Z=c.getRow(Q),qa=c.getColumn(aa),ja=Z.getCell(aa);if(!(0==Q&&0==aa&&ja&&ja.getValue()instanceof KTDiagonalModel)){Y=p.width()+Y;var fa=p.height();J=X-J;p.empty();K(O,Q,aa,Z,qa,ja,m,J,0,Y,fa)}}}})};this.createVisibleRect=function(){var q=g.getUI().prop("clientWidth");!q&&(q=window.screen.width);var A=g.getUI().prop("clientHeight");!A&&(A=window.screen.height);var F=g.getUI().prop("scrollLeft");return[F,iY1,F+q,iY1+A]};var l=function(q){g.protectedBeforeRepaint(function(A,F,M,b,m){q?g.getCellsContainer().empty():
a.isScrollDynamicRepaint()?(g.getUI().find("*[isProxyFirstCell='true']").remove(),a.isDynamicUpdateModel()&&g.getUI().find("*[isBlankFirst=true]").remove()):g.getCellsContainer().empty();if(!(-1==A&&-1==F||-1==M&&-1==b)){for(var p=A,O=[],J=!0,Q=document.createDocumentFragment(),X=A;X<=F;X++){var Y=c.getRow(X);J&&(Y.isHide()?p++:J=!1);if(!Y.isHide()&&g.protectedIsNeedCreatingRow(X,p,w,m))for(var aa=a.getRowY(X),Z=M;Z<=b;Z++){var qa=c.getColumn(Z);if(!qa.isHide()){var ja=Y.getCellForDraw(Z),fa=a.getColX(Z);
a:{var ba=X;var ma=Z,na=Y,e=fa,r=aa,I=O;fa=v(ba,ma,p);var N=na,S=!1;if(!1===fa){var U=a.getColX(ma+1)-a.getColX(ma);var ca=a.getRowY(ba+1)-a.getRowY(ba);fa=null}else if(fa){fa instanceof Array&&(S=fa[1],fa=fa[0]);if(fa.getRowIdxFrom()!=ba||fa.getColIdxFrom()!=ma)ba=fa.getRowIdxFrom(),na=c.getRow(ba),ma=fa.getColIdxFrom(),qa=c.getColumn(ma),a.isDynamicUpdateModel()&&ja?(U=ja.getValue(),ja=na.getCell(ma),ja.setValue(U)):ja=na.getCellForDraw(ma),r=a.getRowY(ba),e=a.getColX(ma);U=fa.getColIdxTo()+1;ca=
fa.getRowIdxTo()+1;U=U>c.getColumnsCount()?c.getColumnsCount():U;ca=ca>c.getRowsCount()?c.getRowsCount():ca;U=a.getColX(U)-a.getColX(fa.getColIdxFrom());ca=a.getRowY(ca)-a.getRowY(fa.getRowIdxFrom())}else{ba=null;break a}pa(U,ca,ja,qa,na,I);var ia=I[0],ta=I[1],oa=I[2];I=I[3];N=w(N,qa);e=P("div",e+ia,r+ta,oa,I);e.id=N;e.style.zIndex=ja&&ja.getValue()?2:1;fa&&$(e).attr("mergeBlock",z(fa));r=a.buildStyle(na,qa,ja);r+=a.buildBorder(na,qa,ja);e.className=r;S&&$(e).attr("isProxyFirstCell","true");if(ja&&
ja.getValue()instanceof KTDiagonalModel){if(ba=c.getDiagonalRender().create(c,ja.getValue(),ba,ma,U,ca))e.appendChild(ba),ba.style.position="absolute",ba.style.left=ia+"px",ba.style.top=ta+"px",ba.style.width=U+"px",ba.style.height=ca+"px"}else K(e,ba,ma,na,qa,ja,fa,0,0,oa,I);ba=e}ba&&(m&&$(ba).attr("isBlankFirst",!0),ma=ba.id,ma=$(g.getCellsContainer()[0]).find("#"+ma),0<ma.length&&ma.remove(),Q.appendChild(ba))}}}g.getCellsContainer()[0].appendChild(Q);m||g.protectedAfterRepaint(A,F,w)}})},t={},
E={},u={},G={},x=function(){var q=c.getEmbedObjects(),A=g.protectedGetPaintRect(),F=A[0],M=A[1],b=A[2];A=A[3];for(var m=0;m<q.length;m++){var p=q[m];if(!(p.getY()+p.getHeight()<F||p.getY()>M||p.getX()+p.getWidth()<b||p.getX()>A)){var O=la(p);if(0===k.find("#"+O).length){var J=p.getUserObject();if(!p.getColFrom()||!p.getRowFrom())if(0===J.anchorMode){var Q=J.positionCellLT&&J.positionCellLT.split("_");var X=J.positionCellRB&&J.positionCellRB.split("_");Q&&X||(Q=a.searchCell(p.getX(),p.getY()),X=a.searchCell(p.getX()+
p.getWidth(),p.getY()+p.getHeight()));Q&&X&&(p.setColFrom(Q[1]),p.setRowFrom(Q[0]),p.setEndColFrom(Number(X[1])+1),p.setEndRowFrom(Number(X[0])+1))}else if(Q=1===J.anchorMode?J.positionCellLT&&J.positionCellLT.split("_"):a.searchCell(p.getX(),p.getY()))p.setColFrom(Q[1]),p.setRowFrom(Q[0]);if(void 0!==p.getColFrom()&&void 0!==p.getRowFrom())if(0===J.anchorMode){J=y(p.getColFrom());Q=y(p.getEndColFrom());X=D(p.getRowFrom());var Y=D(p.getEndRowFrom());void 0===t[p.getId()]&&(t[p.getId()]=p.getX()-J-
1,u[p.getId()]=Q-p.getX()-p.getWidth(),E[p.getId()]=p.getY()-X-1,G[p.getId()]=Y-p.getY()-p.getHeight());p.setX(J+1+t[p.getId()]);p.setY(X+1+E[p.getId()]);p.setWidth(Q-u[p.getId()]-p.getX());p.setHeight(Y-G[p.getId()]-p.getY())}else 1===J.anchorMode&&(J=y(p.getColFrom()),X=D(p.getRowFrom()),void 0===t[p.getId()]&&(t[p.getId()]=p.getX()-J-1,E[p.getId()]=p.getY()-X-1),p.setX(J+1+t[p.getId()]),p.setY(X+1+E[p.getId()]));J=P("div",p.getX(),p.getY(),p.getWidth(),p.getHeight());J.id=O;J.style.zIndex=128;
O=$(J);O.appendTo(k);J=c.getEmbedObjectRender();J.setViewTag(g.getViewTag());J.paintEmbedObject(p,O)}}}},y=function(q){for(var A=0,F=0;F<q;F++){var M=c.getColumn(F);M&&(A+=M.getWidth())}return A},D=function(q){for(var A=0,F=0;F<q;F++){var M=c.getRow(F);M&&(A+=M.getHeight())}return A},H=function(){for(var q=c.getEmbedObjects(),A=0,F=q.length;A<F;A++)$(c.getUI()).find("div[id$='"+q[A].getId()+"']").remove()},K=function(q,A,F,M,b,m,p,O,J,Q,X){var Y=Q,aa=X;if(m&&m.getTreeModel()){var Z=c.getTreeHandlerRender();
Z.setUiDependence(a);Z.setMergeBlock(p);O=Z.create(m.getTreeModel(),A,F,O,J,Q,X);if(J=O[0])J.ktableUiMark="treeHandler",J.style.zIndex=2,q.appendChild(J);(J=O[2])&&q.appendChild(J);if(Z=O[1])Z.ktableUiMark="textSpan",Z.style.zIndex=1,q.appendChild(Z),Y=parseInt(Z.style.width),aa=parseInt(Z.style.height);J=O=0}if(m&&m.getValue()instanceof KTDiagonalModel){if(q=(new KTDiagonalRender).createCanvas(c,m.getValue(),A,F,iCellWidth,iCellHeight))htmlDiv.appendChild(q),q.style.position="absolute",q.style.left=
O+"px",q.style.top=J+"px"}else p=c.getCellRender(),p.setContext(M,b,m,A,F,Q,X,Y,aa),p.setTextOffset(O,J),p.paintCellUI(q,Z)},P=function(q,A,F,M,b){q=document.createElement(q);q.style.overflow="hidden";q.style.position="absolute";q.style.left=A+"px";q.style.top=F+"px";q.style.width=M+"px";q.style.height=b+"px";return q},v=function(q,A,F){var M=c.searchMergeBlock(q,A);if(M){if(q==M.getRowIdxFrom()&&A==M.getColIdxFrom())return M;if(q==F&&M.getRowIdxFrom()<F&&A==M.getColIdxFrom())return[M,!0];F=M.getRowIdxFrom()-
1;for(var b=null;F<q&&(null==b||b.isHide());)b=c.getRow(++F);if(F==q){q=M.getColIdxFrom()-1;for(F=null;q<A&&(null==F||F.isHide());)F=c.getColumn(++q);if(q==A)return[M,!1]}return null}return!1},V=function(q,A,F,M){M.removeClass(function(){return W($(this),KTStyle.CSS_ID_PREFIXE)});M.addClass(a.buildStyle(q,A,F))},ha=function(q,A,F,M){M.removeClass(function(){return W($(this),KTBorderStyle.CSS_ID_PREFIXE)});M.addClass(a.buildBorder(q,A,F,M))},W=function(q,A){if(q=q.attr("class")){var F=q.split(" ");
q="";for(var M=0;M<F.length;M++)0==F[M].indexOf(A)&&(0<q.length&&(q+=" "),q+=F[M])}return q},pa=function(q,A,F,M,b,m){var p=c.getStyleValue(F,M,b,"getBorder","getRightBorderWidth",0),O=c.getStyleValue(F,M,b,"getBorder","getLeftBorderWidth",0),J=c.getStyleValue(F,M,b,"getBorder","getTopBorderWidth",0);M=c.getStyleValue(F,M,b,"getBorder","getBottomBorderWidth",0);F=O>>1;q=q-(O-F)-(p>>1);p=J>>1;A=A-(J-p)-(M>>1);m[0]=-F;m[1]=-p;m[2]=0>q?0:q;m[3]=0>A?0:A},la=function(q){return c.getId()+g.getName()+"_Embed_"+
q.getId()},w=function(q,A){return KTableUIAbstractView.createCellId(q,A)},z=function(q){return[q.getRowIdxFrom(),q.getRowIdxTo(),q.getColIdxFrom(),q.getColIdxTo()].join()},C=function(q){return g.getUI().find("[mergeBlock='"+z(q)+"']")};this.propertyChangeHandler=function(q,A,F,M){switch(A){case KTColumn.WIDTH:return this.protectedUpdateColumnWidth(),!0;case KTRow.HEIGHT:return this.protectedUpdateRowHeight(),!0;case KTCell.VALUE:B(q);break;case KTStyle.STYLE_COMMON:case KTStyle.STYLE_TEXT_SPECIAL:case KTBorderStyle.BORDER_COMMON:case KTBorderStyle.BORDER_WIDTH:if(q instanceof
KTable)return!0;if(q instanceof KTCell.Path)F=A==KTBorderStyle.BORDER_WIDTH?a.getColX(q.getColIndex()):0,M=A==KTBorderStyle.BORDER_WIDTH?a.getRowY(q.getRowIndex()):0,L(q.getRow(),q.getCol(),q.getCell(),A,F,M),B(q);else if(q instanceof KTRow){var b=c.getRowIndex(q);M=A==KTBorderStyle.BORDER_WIDTH?a.getRowY(c.getRowIndex(q)):0;for(var m=0,p=c.getColumnsCount();m<p;m++){var O=c.getColumn(m),J=q.getCellForDraw(m);F=a.getColX(Q);L(q,O,J,A,F,M);J=new KTCell.Path(q,m,J);J.$innerSetInfo(b,O);B(J)}}else if(q instanceof
KTColumn){F=A==KTBorderStyle.BORDER_WIDTH?a.getColX(c.getColumnIndex(q)):0;b=c.getColumnIndex(q);var Q=0;for(m=c.getRowsCount();Q<m;Q++)p=c.getRow(Q),J=p.getCellForDraw(b),M=a.getRowY(Q),L(p,q,J,A,F,M),J=new KTCell.Path(p,b,J),J.$innerSetInfo(Q,q),B(J)}break;case KTRow.HIDE:this.protectedUpdateByRowHide();break;case KTColumn.HIDE:this.protectedUpdateByColumnHide();break;case KTEmbedObject.DATA:A=la(q),A=k.find("#"+A),0<A.length&&(Q=c.getEmbedObjectRender(),Q.setViewTag(g.getViewTag()),Q.paintEmbedObject(q,
A))}return!1};this.modelChangeHandler=function(q,A){switch(A){case KTableUI.INSERT_COL:case KTableUI.REMOVE_COL:return!0;case KTableUI.INSERT_ROW:case KTableUI.REMOVE_ROW:return!0;case KTableUI.ADD_MERGEBLOCK:case KTableUI.REMOVE_MERGEBLOCK:return!0}return!1};this.protectedUpdateColumnWidth=function(){l(!0);g.adjustRightPlaceholder();H();x()};this.protectedUpdateRowHeight=function(){l(!0);g.adjustFootPlaceholder();H();x()};this.protectedUpdateByRowHide=function(){l();g.adjustFootPlaceholder()};this.protectedUpdateByColumnHide=
function(){l();g.adjustRightPlaceholder()};var L=function(q,A,F,M,b,m){var p=w(q,A);p=k.find("#"+p);if(0!=p.length)if(M==KTStyle.STYLE_COMMON||M==KTStyle.STYLE_TEXT_SPECIAL)V(q,A,F,p);else if(M==KTBorderStyle.BORDER_COMMON)ha(q,A,F,p);else if(M==KTBorderStyle.BORDER_WIDTH){ha(q,A,F,p);M=[];var O=c.getRowIndex(q);O=a.getRowY(O+1)-a.getRowY(O);var J=c.getColumnIndex(A);J=a.getColX(J+1)-a.getColX(J);pa(J,O,F,A,q,M);p.css("left",b+M[0]);p.css("top",m+M[1]);p.width(M[2]);p.height(M[3])}},B=function(q){var A=
w(q.getRow(),q.getCol());A=k.find("#"+A);if(0!=A.length){for(var F=null,M=A.width(),b=A.height(),m=A.find("span"),p=0;p<m.length;p++)if("textSpan"==m[p].ktableUiMark){F=m[p];b=$(F);M=b.width();b=b.height();break}m=c.getCellRender();m.setContext(q.getRow(),q.getCol(),q.getCell(),q.getRowIndex(),q.getColIndex(),A.width(),A.height(),M,b);m.paintCellUI(A[0],F)}},R=[-65535,-65535],T=0,da=function(q){var A=q.type;"click"!=A&&("mouseup"==A?5>Math.abs(R[0]-q.screenX)&&5>Math.abs(R[1]-q.screenY)&&ea(q,"click"):
"mousedown"==A&&(300>(new Date).getTime()-T&&(ea(q,"dblclick"),T=0),T=(new Date).getTime(),R=[q.screenX,q.screenY]),ea(q,A))},ea=function(q,A){var F=k[0],M=0,b=0,m=q.target;m==F&&(M=F.scrollLeft,b=F.scrollTop);for(var p=c.getId()+g.getName()+"_Embed_";m!=F;){if(!m||m.id&&"string"==typeof m.id&&0==m.id.indexOf(p))return;m=m.parentNode}for(m=q.target;m&&m!=F;)M+=m.offsetLeft,b+=m.offsetTop,m=m.parentNode;p=M+(void 0==q.offsetX?q.originalEvent.layerX:q.offsetX);var O=b+(void 0==q.offsetY?q.originalEvent.layerY:
q.offsetY),J=p-F.scrollLeft,Q=O-F.scrollTop,X=!1;if(J>=F.clientWidth||Q>=F.clientHeight)if("mousemove"==A)X=!0;else return;m=q.target;for(var Y,aa=!1;m&&m!=F&&(!aa||!(Y=KTableUIAbstractView.searchCellModelById(c,m.id)));)aa||"treeHandler"!=m.ktableUiMark||(aa=!0),m=m.parentNode;if(!Y)if(m=a.searchCell(p,O),null==m)Y=null;else{F=m[0];Y=m[1];var Z=c.getRow(F);m=c.getColumn(Y);var qa=Z.getCellForDraw(Y);Y=new KTCell.Path(Z,Y,qa);Y.$innerSetInfo(F,m)}q=new h(q,p,O,J,Q,Y,aa,X);q.setXYCellAtTable(M,b);
a.fireEvent(A,q)},ka=function(q,A,F,M){A=a.getColX(A);q=a.getRowY(q);M=a.getColX(M+1);F=a.getRowY(F+1);return[A,q,M,F]},ra=function(){var q=c.getSelectionRender();q=q?q:d;q=new q;q.setTable(c);return q},sa=null;this.showDragingMarkBundle=function(q){sa&&(sa.remove(),sa=null);if(q){var A=c.getSelectionModel().getSelected(),F=n[A];F&&F.remove();q=c.getSelectionModel().parseBlockRange(q);q=ka(q[0],q[1],q[2],q[3]);sa=ra();sa.show(k,q[0],q[1],q[2],q[3])}else if(A=c.getSelectionModel().getSelected(),F=
n[A])q=c.getSelectionModel().parseBlockRange(A),q=ka(q[0],q[1],q[2],q[3]),F.show(k,q[0],q[1],q[2],q[3])};this.getMaxFrozenRowIdx=function(){return Math.min(c.getFrozenRows()-1,c.getRowsCount()-1)};this.getMaxFrozenColumnIdx=function(){return Math.min(c.getFrozenColumns()-1,c.getColumnsCount()-1)};k.css("position","absolute");k.mouseup(da);k.mousedown(da);k.mousemove(da);k.dblclick(da);c.getSelectionModel().addChangeListener(function(q,A){if(null!==c.getSelectionRender())for(var F=0;F<A.length;F++){var M=
A[F];if(q==KTSelectionModel.CHANGE_ADD){var b=c.getSelectionModel().parseBlockRange(M);b=ka(b[0],b[1],b[2],b[3]);var m=ra();n[M]=m;m.letOthersOld(k);m.show(k,b[0],b[1],b[2],b[3])}else q==KTSelectionModel.CHANGE_REMOVE&&n[M]&&(n[M].remove(),delete n[M],M=c.getSelectionModel().getSelected(),(M=n[M])&&M.current())}})}KTableUIAbstractView.createCellId=function(c,a){var h="cell_I_";c&&(h+=c.getKey()+"_I_",a&&(h+=a.getKey()));return h};
KTableUIAbstractView.searchCellModelById=function(c,a){if(!a||0!=a.indexOf("cell_I_"))return null;a=a.split("_I_");if(3!=a.length)return null;var h=a[1],d=a[2];a=-1;for(var g=0,k=c.getRowsCount();g<k;g++){var f=c.getRow(g);if(f.getKey()==h){a=g;break}}if(-1==a)return null;h=c.getColumn(d);c=c.getColumnIndex(h);d=f.getCellForDraw(c);f=new KTCell.Path(f,c,d);f.$innerSetInfo(a,h);return f};
function KTableSelectionRender(){var c;this.setTable=function(a){c=a};this.getTable=function(){return c};this.show=function(a,h,d,g,k){};this.remove=function(){};this.current=function(){};this.letOthersOld=function(a){}}
function KTableUIManyRowsView(c,a){KTableUIAbstractView.call(this,c,a);var h=this,d,g,k,f,n=!1;this.setBlankFirstImmediately=function(x){n=x?!0:!1};this.isBlankFirstImmediately=function(){return n};this.reset=function(){d=[]};var l=function(){var x=h.getUI().prop("clientHeight");x||(x=window.screen.height);return x};this.getScrollRepaintDelta=function(){return k};this.protectedBeforeUpdateUI=function(){d=[];var x=l();a.isDynamicUpdateModel()?(k=0,f=.5*x):(k=.5*x,f=1*x)};this.createPaintSection=function(){if(a.isScrollDynamicRepaint()){var x=
h.getUI().prop("scrollTop");var y=l();var D=x-f;x=x+y+f}else D=0,x=2147483647;return[D,x]};this.createRowsRange=function(){if(a.isScrollDynamicRepaint()){var x=this.createPaintSection();var y=x[1];x=a.searchRowIdx(x[0]);y=a.searchRowIdx(y)}else x=0,y=c.getRowsCount()-1;return[x,y]};this.protectedIsNeedCreatingRow=function(x,y,D,H){if(a.isScrollDynamicRepaint()){var K=d[x];if(K)if(x==y)!0===K&&(K=t(x,D)),K.remove();else return!0!==K&&h.getCellsContainer().append(K),!1;H||(d[x]=!0)}return!0};this.protectedAfterRepaint=
function(x,y,D){a.isScrollDynamicRepaint()&&setTimeout(function(){for(var H=g?g[0]:-1,K=g?g[1]:-2,P=a.isDynamicRepaintWithCache();H<=K;H++)if(H<x||H>y){var v=d[H];v&&(!0===v&&(v=t(H,D),P?d[H]=v:delete d[H]),v.remove())}g=[x,y]},10)};var t=function(x,y){x=c.getRow(x);return h.getUI().find("*[id*='"+y(x)+"']")},E=this.protectedUpdateByRowHide;this.protectedUpdateByRowHide=function(){a.isScrollDynamicRepaint()&&(d=[]);E()};var u=this.protectedUpdateByColumnHide;this.protectedUpdateByColumnHide=function(){a.isScrollDynamicRepaint()&&
(d=[]);u()};var G=this.protectedUpdateColumnWidth;this.protectedUpdateColumnWidth=function(){a.isScrollDynamicRepaint()&&(d=[]);G()}}
function KTableUIMainView(c,a){function h(u){this.isHorizontalScroll=function(){var G=d.getUI().prop("scrollLeft");return k!=G};this.isVerticalScroll=function(){var G=d.getUI().prop("scrollTop");return g!=G};this.isScrollToBottom=function(){var G=d.getUI().prop("scrollTop"),x=d.getUI().prop("clientHeight"),y=d.getUI().prop("scrollHeight");return G+x>=y-2};this.getLastScrollLeft=function(){return k};this.getLastScrollTop=function(){return g}}KTableUIManyRowsView.call(this,c,a);var d=this,g=0,k=0,f,
n=0;this.getName=function(){return"MainView"};this.getViewTag=function(){return KTableViewTag.MAIN};var l=this.protectedBeforeUpdateUI;this.protectedBeforeUpdateUI=function(){l();k=g=n=0};this.protectedBeforeRepaint=function(u){var G=this.createRowsRange(),x=G[0],y=G[1],D=0,H=c.getColumnsCount()-1;c.getCrossFrozenRenderMode()==KTCrossFrozenRenderMode.STUPID_LIGHT&&(x=Math.max(d.getMaxFrozenRowIdx()+1,x),D=d.getMaxFrozenColumnIdx()+1);if(u)(new Date).getTime(),d.setBlankFirstImmediately(!1),t(x,y,
function(K){d.setBlankFirstImmediately(K);u(x,y,D,H,K)});else return[x,y,D,H]};var t=function(u,G,x){if(a.isDynamicUpdateModel()){for(var y=u,D=G,H=!1;u<=G;u++)if(c.getRow(u).isSkeleton())H||(H=!0,y=u),D=u;else if(H)break;H?(x(!0),G=c.getFrozenRows(),a.fireDynamicUpdateModelEvent(y-G,D-G,x)):x()}else x()};this.protectedGetPaintRect=function(){var u=this.createPaintSection(),G=u[0];u=u[1];var x=a.getColX(d.getMaxFrozenColumnIdx()+1);return[G,u,x,2147483647]};var E=this.protectedAfterRepaint;this.protectedAfterRepaint=
function(u,G,x){E(u,G,x);if(a.isScrollDynamicRepaint()&&a.isDynamicUpdateModel()){u-=.5*a.getDynamicUpdateModelAliveDeltaRows();G+=a.getDynamicUpdateModelAliveDeltaRows();x=c.getFrozenRows();for(var y=c.getRowsCount();x<y;x++)x>u&&x<G||c.getRow(x).clearAsSkeleton()}};d.getUI().css("overflow","auto");d.getUI().scroll(function(u){a.isScrollDynamicRepaint()?(clearTimeout(f),f=setTimeout(function(){var G=d.getUI().prop("scrollTop");d.getUI().prop("clientHeight");if(G<n-d.getScrollRepaintDelta()||G>n+
d.getScrollRepaintDelta())d.repaint(),n=G;a.fireEvent("scroll",new h(u));g=d.getUI().prop("scrollTop");k=d.getUI().prop("scrollLeft")},50)):(a.fireEvent("scroll",new h(u)),g=d.getUI().prop("scrollTop"),k=d.getUI().prop("scrollLeft"))})}
function KTableUILeftFrozenView(c,a){KTableUIManyRowsView.call(this,c,a);var h=this;this.getName=function(){return"LeftView"};this.getViewTag=function(){return KTableViewTag.LEFT};var d=this.protectedBeforeUpdateUI;this.protectedBeforeUpdateUI=function(){d();k()};this.protectedBeforeRepaint=function(f){var n=this.createRowsRange(),l=n[0];n=n[1];var t=h.getMaxFrozenColumnIdx();c.getCrossFrozenRenderMode()==KTCrossFrozenRenderMode.STUPID_LIGHT&&(l=Math.max(h.getMaxFrozenRowIdx()+1,l));if(f)f(l,n,0,
t,h.isBlankFirstImmediately());else return[l,n,0,t]};this.protectedGetPaintRect=function(){var f=this.createPaintSection(),n=f[0];f=f[1];var l=h.getUI().width();return[n,f,0,l]};var g=this.protectedUpdateColumnWidth;this.protectedUpdateColumnWidth=function(){k();g()};var k=function(){var f=h.getMaxFrozenColumnIdx();f=a.getColX(f+1);h.getUI().width(f+1)};h.getUI().css("overflow","hidden")}
function KTableUITopFrozenView(c,a){KTableUIAbstractView.call(this,c,a);var h=this;this.getName=function(){return"TopView"};this.getViewTag=function(){return KTableViewTag.TOP};this.protectedBeforeUpdateUI=function(){var d=h.getMaxFrozenRowIdx();d=a.getRowY(d+1);h.getUI().height(d+1)};this.protectedBeforeRepaint=function(d){var g=h.getMaxFrozenRowIdx(),k=0,f=c.getColumnsCount()-1;c.getCrossFrozenRenderMode()==KTCrossFrozenRenderMode.STUPID_LIGHT&&(k=h.getMaxFrozenColumnIdx()+1);if(d)d(0,g,k,f);else return[0,
g,k,f]};this.protectedGetPaintRect=function(){var d=h.getUI().height(),g=a.getColX(h.getMaxFrozenColumnIdx()+1);return[0,d,g,2147483647]};h.getUI().css("overflow","hidden")}
function KTableUICornerFrozenView(c,a){KTableUIAbstractView.call(this,c,a);var h=this;this.getName=function(){return"CornerView"};this.getViewTag=function(){return KTableViewTag.LEFT&KTableViewTag.TOP};this.protectedBeforeUpdateUI=function(){var k=h.getMaxFrozenRowIdx();k=a.getRowY(k+1);h.getUI().height(k+1);g()};this.protectedBeforeRepaint=function(k){var f=h.getMaxFrozenRowIdx(),n=h.getMaxFrozenColumnIdx();if(k)k(0,f,0,n);else return[0,f,0,n]};this.protectedGetPaintRect=function(){return[0,h.getUI().height(),
0,h.getUI().width()]};var d=this.protectedUpdateColumnWidth;this.protectedUpdateColumnWidth=function(){g();d()};var g=function(){var k=h.getMaxFrozenColumnIdx();k=a.getColX(k+1);h.getUI().width(k+1)};h.getUI().css("overflow","hidden")}
function KTableUIEmbedFrozenView(c,a,h){KTableUIAbstractView.call(this,c,a);var d=this;this.getName=function(){return"EmbedView"};this.getViewTag=function(){return KTableViewTag.EMBED};this.protectedBeforeUpdateUI=function(){d.getUI().height(h.getHeight());d.getUI().width(h.getWidth())};this.protectedBeforeRepaint=function(){return[0,0,0,0]};this.protectedGetPaintRect=function(){var k=[h.getX(),h.getHeight(),h.getY(),h.getWidth()];h.setX(0);h.setY(0);return k};var g=this.protectedUpdateColumnWidth;
this.protectedUpdateColumnWidth=function(){d.getUI().width(h.getWidth());g()};d.getUI().css("overflow","hidden")}
function KTDefaultCellRender(c){var a=this,h,d,g,k,f,n,l,t,E,u,G,x,y,D=!0,H=2,K=1;this.setOutsideVisible=function(w){D=w};this.setPaddingHV=function(w,z){H=w;K=z};this.reset=function(){x=null};this.setContext=function(w,z,C,L,B,R,T,da,ea){h=w;d=z;g=C;k=L;f=B;n=R;l=T;t=da;E=ea;G=u=0};this.setTextOffset=function(w,z){u=w;G=z};this.calculateCellHeight=function(w){if(!g||!g.getValue())return 0;var z=pa();z.className=w;return la(z)};this.paintCellUI=function(w,z){if(g&&void 0!=g.getValue()){var C=pa(w),
L=a.getStyleValue("isWrapText"),B=a.getStyleValue("getVerticalAlign");"middle"==B?L?(B=la(C,w),C.style.left=u+"px",C.style.top=G+(E-B>>1)+"px",C.style.height=B+"px"):(B=E-2*K,B=(0>B?0:B)+"px",C.style.lineHeight=B,C.style.height=B,C.style.top=G+K+"px"):"bottom"==B?C.style.bottom=parseInt(w.style.height)-G-E+K+"px":C.style.top=G+K+"px";if(!0===a.getStyleValue("isVerticalText")){var R=a.getStyleValue("getTextAlign");"right"===R?(C.style.lineHeight="unset",C.style.top="unset",C.style.textAlign="center",
C.style.width="unset",C.style.left="unset",C.style.right=0):"left"===R?(C.style.lineHeight="unset",C.style.top="unset",C.style.textAlign="center"):(B=t-2*K,C.style.lineHeight=(0>B?0:B)+"px")}B=z?z:w;(R=B.firstChild)&&B.removeChild(R);B.appendChild(C);R=a.getStyleValue("isLineThrough");var T=a.getStyleValue("isUnderLine");R&&T?C.style.textDecoration="line-through underline":R?C.style.textDecoration="line-through":T&&(C.style.textDecoration="underline");if(D&&(x&&x[0]==k||(x=[k,W(k)]),T=x[1],!L&&!T[f])){R=
a.getStyleValue("getTextAlign");var da=L=-1;if("left"==R||"center"==R||null==R){L=0;for(var ea=c.getColumnsCount(),ka=f+1;ka<ea;ka++){var ra=T[ka]?T[ka]:h.getCellForDraw(ka);if(ra&&void 0!==ra.getValue())break;c.getColumn(ka).isHide()||(L+=c.getColumn(ka).getWidth())}}if("right"==R||"center"==R)if(da=0,!g.getTreeModel()||g.getTreeModel().isHorizontal())for(ka=f-1;0<=ka&&(!(ra=T[ka]?T[ka]:h.getCellForDraw(ka))||void 0===ra.getValue());ka--)c.getColumn(ka).isHide()||(da+=c.getColumn(ka).getWidth());
T=t;0<=L&&(T+=L,ea=T-y-H,C.style.width=(0>ea?0:ea)+"px");0<=da&&(ea=document.createElement("span"),ea.style.overflow="hidden",ea.style.position="absolute",ea.style.left=-da+"px",ea.style.width=T+da+"px",0>E&&(E=0),ea.style.height=E+"px",C.style.width="","center"==R?(C.style.whiteSpace="nowrap",R=la(C,w,"offsetWidth"),C.style.left=(t-R>>1)+da+"px"):(C.style.right=0,C.style.left=""),ea.appendChild(C),B.appendChild(ea));da=0<L||0<da}w.style.overflow=da?"visible":"hidden";z&&(z.style.overflow=da?"visible":
"hidden");g.getStyle()&&g.getStyle().getCursor()&&"auto"!=g.getStyle().getCursor()&&(w=document.createElement("div"),w.style.position="absolute",w.style.height=B.style.height,w.style.width=B.style.width,w.style.cursor=g.getStyle().getCursor(),w.style.backgroundImage="url(data:;base64,AAABAYA=)",B.appendChild(w));if(a.getStyleValue("isShrinkText")){z=a.getStyleValue("getFontSize");w=g.getValue();B=n-2*H-2;L=document.createElement("canvas").getContext("2d");L.font=z+"px Arial Blod";R=L.measureText(w);
for(R=R.width;R>B;)z-=.05,L.font=z+"px Arial Blod",R=L.measureText(w),R=R.width;C.style.fontSize=z+"px";C.style.transformOrigin="0";C.style.width="unset"}w=a.getStyleValue("getRotation");0<w&&(B=a.getStyleValue("getFontSize"),z=g.getValue(),L=document.createElement("canvas").getContext("2d"),L.font=B+"px Arial Blod",z=L.measureText(z).width-H,C.style.width=t+"px",w=w*Math.PI/180,L=a.getStyleValue("getTextAlign"),"right"===L?(C.style.left="unset",B/=2,L=a.getStyleValue("getVerticalAlign"),"top"===
L?v(w,B,C,z,!0):"middle"===L?(z=Math.sin(w)*(t/2-z/2),w=ha(w,B),C.style.top=-z+"px",C.style.right=w+"px"):P(w,B,C,!1)):"left"===L?(B/=2,L=a.getStyleValue("getVerticalAlign"),"top"===L?P(w,B,C,!0):"middle"===L?(z=(t/2-z/2)*Math.sin(w),w=ha(w,B),C.style.top=z+"px",C.style.left=w+"px"):v(w,B,C,z,!1)):(w=V(w,B,z)+K,z=a.getStyleValue("getVerticalAlign"),"top"===z?C.style.top=w+"px":"bottom"===z&&(C.style.bottom=w+"px"),C.style.left="0px"))}};var P=function(w,z,C,L){var B=V(w,2*z,t);w=ha(w,z);L?(C.style.top=
B+"px",C.style.left=w+"px"):(C.style.bottom=B+"px",C.style.right=w+"px")},v=function(w,z,C,L,B){if(L>t/2){var R=Math.atan(z/(L/2));L=K+z-L/2/Math.cos(R)*Math.cos(90*Math.PI/180-(w+R))}else L=Math.atan(z/(t/2-L+2*H)),L=z/Math.sin(L)*Math.sin(w-L)-K;w=ha(w,z);B?(C.style.top=-L+"px",C.style.right=w+"px"):(C.style.bottom=-L+"px",C.style.left=w+"px")},V=function(w,z,C){var L=Math.atan(z/2/(C/2));return C/2/Math.cos(L)*Math.sin(w-L)-z/2-K+z*Math.sin(90*Math.PI/180-w)},ha=function(w,z){z=Math.atan(z/2/(t/
2));return t/2/Math.cos(z)*Math.cos(w-z)-t/2},W=function(w){var z=[];c.visitMergeBlocks(w,w,-1,-1,function(C){for(var L=c.getRow(C.getRowIdxFrom()).getCellForDraw(C.getColIdxFrom()),B=C.getColIdxFrom();B<=C.getColIdxTo();B++)z[B]=L});return z},pa=function(w){y=H;var z=a.getStyleValue("getIndent"),C=a.getStyleValue("getRotation");if(0<z){var L=a.getStyleValue("getTextAlign");if("left"==L||null==L)L=document.createElement("span"),"undefined"!=typeof L.textContent?L.textContent="A":L.innerText="A",w=
la(L,w,"offsetWidth"),y+=w*z}L=document.createElement("span");L.style.paddingLeft=y+"px";L.style.paddingRight=H+"px";L.style.overflow="hidden";L.style.position="absolute";L.style.transform="rotate("+C+"deg)";L.style.left=u+"px";z=t-y-H;L.style.width=(0>z?0:z)+"px";"undefined"!=typeof L.textContent?L.textContent=g.getValue():L.innerText=g.getValue();a.getStyleValue("isVerticalText")&&(L.style.writingMode="vertical-lr",L.style.textOrientation="upright");return L},la=function(w,z,C){var L=w.style.left,
B=w.style.top;w.style.left="-32768px";w.style.top="-32768px";if(z){if(z=z.className){var R=z.split(" ");z="";for(var T=0;T<R.length;T++)0!=R[T].indexOf(KTBorderStyle.CSS_ID_PREFIXE)&&(0<z.length&&(z+=" "),z+=R[T])}else z="";w.className=z}document.body.appendChild(w);C=w[C?C:"offsetHeight"];document.body.removeChild(w);w.className="";w.style.left=L;w.style.top=B;return C};this.getStyleValue=function(w){return c.getStyleValue(g,d,h,"getStyle",w,null)};this.getCurrentRow=function(){return h};this.getCurrentCol=
function(){return d};this.getCell=function(){return g};this.getCurrentRowIdx=function(){return k};this.getCurrentColIdx=function(){return f};this.getCellWidth=function(){return n};this.getCellHeight=function(){return l};this.getTextAreaWidth=function(){return t};this.getTextAreaHeight=function(){return E};this.protectedMethod=new function(){this.setTextAreaHeight=function(w){E=w}}}
function KTDefaultEmbedObjectRender(){var c;this.setViewTag=function(a){c=a};this.getViewTag=function(){return c};this.paintEmbedObject=function(a,h){}}
function KTDefaultTreeHandlerRender(c){var a=9,h,d;this.setHandlerSize=function(n){a=n};this.setUiDependence=function(n){h=n};this.setMergeBlock=function(n){d=n};this.create=function(n,l,t,E,u,G,x){if(n.isHorizontal()){var y=E;var D=11*n.getLevel();var H=G;var K=2+a+2+1;var P=E;var v=D+K}else y=17*n.getLevel(),D=u,H=2+a+2+3,K=x,P=y+H,v=u;if(n.isHorizontal()){var V=G-a-2>>1;var ha=2}else{V=2;var W=c.getRow(l);ha=c.getColumn(t);var pa=W.getCell(t);"top"==c.getStyleValue(pa,ha,W,"getStyle","getVerticalAlign",
"top")?(W=c.getStyleValue(pa,ha,W,"getStyle","getFontSize",20),ha=Math.max(2,W-a-2>>1)):ha=x-a-2>>1}t=(W=k(n,l,t))||n.isHaveHandlerAlways();l=null;t&&(l=f("div",y,D,H,K),l.style.cursor="pointer",y=f("div",V,ha,a,a),y.style.border="1px solid #8A9EBF","undefined"!=typeof y.style.borderRadius&&(y.style.borderRadius="3px"),y.style.backgroundColor="#FFFFFF",l.appendChild(y),n.isExpanded()?(D=a-2,D=f("div",1,1,D,D>>1),D.style.borderBottom="1px solid black",y.appendChild(D)):(H=a-2>>1,D=f("div",1,1,H,H),
D.style.borderBottom="1px solid black",D.style.borderRight="1px solid black",H=f("div",1+H,1+H,H,H),H.style.borderTop="1px solid black",H.style.borderLeft="1px solid black",y.appendChild(D),y.appendChild(H)));y=null;if(c.isMultiTreeSupported()){t=!t;V=E+V+(a>>1);y=u+ha+(a>>1);ha=document.createDocumentFragment();D=n.isHorizontal();H=n.getLevel();K=n.getLastChildLevel();n=W&&n.isExpanded();W=0<=K?n?0:H-K:0;var la=H-W;if(D){H=E;K=y;pa=G;var w=0}else H=V,K=u,pa=0,w=x;for(var z=0;z<la;z++)g(ha,D,H,K,
pa,w),H+=D?0:17,K+=D?11:0;for(z=0;z<W;z++){la=ha;var C=D,L=pa,B=w;L+=C?-4:a>>1;B+=C?a>>1:-4;L=f("div",H,K,L,B);la.appendChild(L);C?(L.style.borderTop="1px dotted #8A9EBF",L.style.borderRight="1px dotted #8A9EBF"):(L.style.borderLeft="1px dotted #8A9EBF",L.style.borderBottom="1px dotted #8A9EBF");H+=D?0:17;K+=D?11:0}H=D?V:H;K=D?K:y;n&&g(ha,D,H,K,pa,w);t&&(n=f("div",H,K,0,0),ha.appendChild(n),n.style.border="1px solid #8A9EBF");y=ha}n=[l,P,v,y];P=n[0];v=n[1];l=n[2];n=n[3];E=f("span",v,l,E+G-v,u+x-l);
return[P,E,n]};var g=function(n,l,t,E,u,G){t=f("div",t,E,u,G);n.appendChild(t);l?t.style.borderTop="1px dotted #8A9EBF":t.style.borderLeft="1px dotted #8A9EBF"},k=function(n,l,t){if(n.isHorizontal())for(var E=c.getColumnsCount()-1;t<E&&(t++,d&&d.isContainCell(l,t)););else for(E=c.getRowsCount()-1;l<E&&(l++,d&&d.isContainCell(l,t)););return(l=c.getRow(l).getCellForDraw(t))&&l.getTreeModel()&&l.getTreeModel().getLevel()>n.getLevel()},f=function(n,l,t,E,u){n=document.createElement(n);n.style.overflow=
"hidden";n.style.position="absolute";n.style.left=l+"px";n.style.top=t+"px";n.style.width=(0>E?0:E)+"px";n.style.height=(0>u?0:u)+"px";return n};this.protectedMethod={getTable:function(){return c},getUiDependence:function(){return h},isTreeNodeHasChildren:k,createAbsoluteHtmlElement:f}}
function KTableUIDraggableAdjustingHandler(){var c,a,h,d=-1,g=-1,k=-1,f=-1,n=-1,l=-1,t=!0,E=!0,u,G=-1,x=-1,y=!1,D,H,K;this.setContext=function(w,z,C){c=w;h=z;a=C;h.on("mouseenter",v);h.on("mouseleave",pa)};this.mouseEventHandler=function(w,z){if(c.getDraggableAdjusting())if("mousemove"==w)a:{x=G=-1;var C=z.getXAtTable(),L=z.getYAtTable(),B=C>n-6;w=L>l-6;var R=B||w,T=z.isCellPointed()&&!z.isPointTreeHandler();if((T||R)&&!z.isPointScrollBar()&&C<n&&L<l&&(C<d||L<g)){z=z.getMouseTargetModel();if(E&&(T||
B)){B=z?z.getColIndex():-1;R=-1;if(-1==B)R=c.getColumnsCount();else if(C>a.getColX(B+1)-3)R=B+1;else for(;0<B&&C<a.getColX(B)+3&&(R=B,B--,c.getColumn(B).isHide()););if(0<R&&u.isColumnDraggable(c,R-1)){x=R;h.css("cursor","col-resize");break a}}if(t&&(T||w)){z=z?z.getRowIndex():-1;C=-1;if(-1==z)C=c.getRowsCount();else if(L>a.getRowY(z+1)-3)C=z+1;else for(;0<z&&L<a.getRowY(z)+3&&(C=z,z--,c.getRow(z).isHide()););if(0<C&&u.isRowDraggable(c,C-1)){G=C;h.css("cursor","row-resize");break a}}}h.css("cursor",
"")}else if("mousedown"==w){T=z||window.event;B=$(".chart-change-menu");w=T.getOriginalEvent().clientX;T=T.getOriginalEvent().clientY;if(0<B.length){B=B[0].getBoundingClientRect();R=B.x+B.width;var da=B.y+B.height;w=w>B.x&&w<R&&T>B.y&&T<da}else w=void 0;!w&&($(".chart-change-menu")&&$(".chart-change-menu").remove(),$(".chart-selected")&&$(".chart-selected").removeClass("chart-selected"),w=0<x,T=0<G,w||T)&&(z.stop(),y=!0,B=$("<div>"),B.css("z-index",65535),B.css("position","absolute"),B.css("top",
0),B.css("left",0),B.css("width","100%"),B.css("height","100%"),B.css("background-color","rgba(255, 255, 255, 0.1)"),K=B,K.on("mousemove",V),K.on("mouseup",ha),K.appendTo(h),B=$("<div>"),B.css("z-index",65534),B.css("position","absolute"),B.css("top",0),B.css("left",0),B.css("width",0),B.css("height",0),B.css("border-style","dashed"),B.css("border-width","0"),B.css("border-color","#000"),B.css("background-color","rgba(0, 0, 0, 0.2)"),H=B,H.appendTo(h),w?(L=a.getColX(x-1),C=L-(L<k?0:a.getScrollLeft()),
D=c.getColumn(x-1).getWidth(),B=a.getRowY(c.getRowsCount())-a.getScrollTop(),L=z.getOriginalEvent().screenX,H.css("border-right-width","1px"),H.css("left",C),H.css("width",D),H.css("height",B),z=x-1,C=-Math.max(0,c.getColumn(z).getWidth()-u.getMinColumnWidthLimited(c,z))):T&&(L=a.getRowY(G-1),C=L-(L<f?0:a.getScrollTop()),D=c.getRow(G-1).getHeight(),B=a.getColX(c.getColumnsCount())-a.getScrollLeft(),L=z.getOriginalEvent().screenY,H.css("border-bottom-width","1px"),H.css("top",C),H.css("height",D),
H.css("width",B),z=G-1,C=-Math.max(0,c.getRow(z).getHeight()-u.getMinRowHeightLimited(c,z))),w||T)&&(H.data("kt_startMouse",L),H.data("kt_minDelta",C))}};var P=function(){var w=c.getDraggableAdjusting(),z=w[0],C=w[1];u=(u=w[2])?u:new KTableUIDraggableAdjustingHandler.CustomExpendor;t=0!==C;E=0!==z;z=z?0<z?z:c.getRowsCount():0===z?0:c.getFrozenRows();C=C?0<C?C:c.getColumnsCount():0===C?0:c.getFrozenColumns();g=a.getRowY(z)+3;d=a.getColX(C)+3;f=a.getRowY(c.getFrozenRows());k=a.getColX(c.getFrozenColumns());
l=a.getRowY(c.getRowsCount())+3;n=a.getColX(c.getColumnsCount())+3},v=function(w){c.getDraggableAdjusting()&&P()},V=function(w){y=!0;w=W(w);w=D+w;0<x?H.css("width",w):H.css("height",w)},ha=function(w){y&&(w=W(w),0<x?u.columnDraggedAction(c,x-1,w):u.rowDraggedAction(c,G-1,w));la();P()},W=function(w){w=(0<x?w.screenX:w.screenY)-H.data("kt_startMouse");var z=H.data("kt_minDelta");w<z&&(w=z);return w},pa=function(w){la()},la=function(){y=!1;x=-1;H&&H.remove();K&&K.remove()}}
KTableUIDraggableAdjustingHandler.CustomExpendor=function(){this.isRowDraggable=function(c,a){return!0};this.isColumnDraggable=function(c,a){return!0};this.getMinRowHeightLimited=function(c,a){return 3};this.getMinColumnWidthLimited=function(c,a){return 4};this.rowDraggedAction=function(c,a,h){var d=c.isSyncUIWhenModelChanged();c.setSyncUIWhenModelChanged(!0);a=c.getRow(a);a.setHeight(a.getHeight()+h);c.setSyncUIWhenModelChanged(d)};this.columnDraggedAction=function(c,a,h){var d=c.isSyncUIWhenModelChanged();
c.setSyncUIWhenModelChanged(!0);a=c.getColumn(a);a.setWidth(a.getWidth()+h);c.setSyncUIWhenModelChanged(d)};this.getTailBlankForDragging=function(){return 60}};function KTDiagonalRender(){this.create=function(d,g,k,f,n,l){try{var t=document.createElement("canvas");t.width=n;t.height=l;var E=k,u=g.getLinkToRows(),G=0,x=Array(u.length+2);x[0]=G;for(var y=0;y<u.length;y++){for(var D=0;D<u[y];D++)G+=d.getRow(E++).getHeight();x[y+1]=G}x[u.length+1]=l;l=f;var H=g.getLinkToColumns();E=0;var K=Array(H.length+2);K[0]=E;for(u=0;u<H.length;u++){for(G=0;G<H[u];G++)E+=d.getColumn(l++).getWidth();K[u+1]=E}K[H.length+1]=n;var P=t.getContext("2d"),v=d.getRow(k),V=d.getColumn(f),
ha=v.getCell(f),W=d.getStyleValue(ha,V,v,"getBorder","getRightBorderColor","#aaaaaa");P.save();P.strokeStyle=W;P.lineWidth=.8;var pa=K[K.length-1],la=x[x.length-1];for(n=1;n<x.length;n++)P.moveTo(0,0),P.lineTo(pa,x[n]);for(n=1;n<K.length;n++)P.moveTo(0,0),P.lineTo(K[n],la);P.stroke();P.restore();var w=d.getRow(k),z=d.getColumn(f),C=w.getCell(f),L=d.getStyleValue(C,z,w,"getStyle","getFontSizeWithUnit"),B=d.getStyleValue(C,z,w,"getStyle","getFontName");L&&B&&(P.font=L+" "+B);d=[];var R=K[K.length-1],
T=x[x.length-1];k=[0,0];for(f=0;f<x.length-1;f++){var da=[R,x[f]],ea=[R,x[f+1]];d.push([k,da,ea])}for(f=K.length-1;0<f;f--)da=[K[f],T],ea=[K[f-1],T],d.push([k,da,ea]);for(x=0;x<d.length;x++){var ka=d[x];var ra=[Math.floor((ka[0][0]+ka[1][0]+ka[2][0])/3+.5),Math.floor((ka[0][1]+ka[1][1]+ka[2][1])/3+.5)];K=[0,0];var sa=ra[0]-K[0];var q=0==sa?PI/2:Math.atan((ra[1]-K[1])/sa);var A=g.getText(x);P.save();if(g.isLean(x)){K=P;R=A;ea=ra;T=q;k=!0;for(da=0;da<R.length;da++)if(127<R.charCodeAt(da)){k=!1;break}K.translate(ea[0],
ea[1]);K.rotate(T);var F=h(K,R,!0,T);K.translate(F[0],F[1]);if(k)K.fillText(R,0,0);else for(da=ea=0;da<R.length;da++){var M=R.charAt(da);K.translate(ea,0);K.rotate(-T);K.fillText(M,0,0);K.rotate(T);ea=K.measureText(M).width}}else{K=P;R=A;T=ra;var b=h(K,R,!1,q);K.fillText(R,T[0]+b[0],T[1]+b[1])}P.restore()}return t}catch(m){return null}};var c=[[Math.PI/18,.1],[Math.PI/12,.2],[Math.PI/9,.3],[Math.PI/6,.4],[Math.PI/2,.5]],a=[[Math.PI/9,.2],[Math.PI/6,.3],[Math.PI/5,.4],[Math.PI/4,.6],[Math.PI/2,.7]],
h=function(d,g,k,f){k=k?a:c;var n=Math.abs(f);f=.5;for(var l=0;l<k.length;l++)if(n<=k[l][0]){f=k[l][1];break}g=d.measureText(g);k=-g.width*f;g=d.measureText("\u58f9");return[k,.5*g.width]}};function KTable(){var c=this,a="table"+ ++KTable.iFlowId,h=new KTListenerProxy,d=[],g=[],k=new KTMergeBlockSet,f,n,l=[],t=new KTStyleManager,E=new KTSelectionModel(this),u,G,x,y,D,H,K=0,P=0,v=KTCrossFrozenRenderMode.STUPID_HEAVY,V,ha=!0,W=!1,pa=!1,la=!0,w,z,C,L=!1;this.getId=function(){return a};var B=function(){u||(u=new KTableUI(c),u.addListener("scroll",ra),u.addListener("mousedown",A),u.addListener("click",A),u.addListener("click",ka));return u};this.setUICustomStyleMap=function(b){G=b};this.getUICustomStyleMap=
function(){return G};this.getUI=function(){return B().getHtmlElement()};this.addColumn=function(b){return this.insertColumn(d.length,b)};this.addColumns=function(b){for(var m=0;m<b;m++)this.addColumn()};this.insertColumn=function(b,m){if(0>b||b>d.length)throw Error("Illegal argument.");m=new KTColumn(sa,m);d.splice(b,0,m);for(var p=0;p<g.length;p++)g[p].$innerInsertCell(b);la&&k.syncMergeBlocks(!1,b,!0);q(m,KTableUI.INSERT_COL);return m};this.removeColumn=function(b){if(0>b||b>d.length)throw Error("Illegal argument.");
var m=d[b];m.$innerDestroy();d.splice(b,1);for(var p=0;p<g.length;p++)g[p].$innerRemoveCell(b);la&&k.syncMergeBlocks(!1,b,!1);q(m,KTableUI.REMOVE_COL)};this.removeAllColumns=function(){for(var b=d.length-1;0<=b;b--)d[b].$innerDestroy();d.length=0;k.clear();q(null,KTableUI.REMOVE_COL)};this.getColumnsCount=function(){return d.length};this.getColumn=function(b){var m=typeof b;if("number"==m){if(0>b||b>d.length)throw Error("Illegal argument.");return d[b]}if("string"==m){for(m=0;m<d.length;m++)if(d[m].getKey()==
b)return d[m];return null}throw Error("Unknown argument.");};this.getColumnIndex=function(b){var m=!1;if(b instanceof KTColumn)m=!0;else if("string"!=typeof b)throw Error("Unknown argument.");for(var p=0;p<d.length;p++)if(m){if(d[p]==b)return p}else if(d[p].getKey()==b)return p;return-1};this.addRow=function(){return this.insertRow(g.length)};this.addRows=function(b){for(var m=0;m<b;m++)this.addRow()};this.insertRow=function(b){if(0>b||b>g.length)throw Error("Illegal argument.");var m=new KTRow(this.getColumnsCount(),
sa);g.splice(b,0,m);la&&k.syncMergeBlocks(!0,b,!0);q(m,KTableUI.INSERT_ROW);return m};this.removeRow=function(b){if(0>b||b>g.length)throw Error("Illegal argument.");var m=g[b];m.$innerDestroy();g.splice(b,1);la&&k.syncMergeBlocks(!0,b,!1);q(m,KTableUI.REMOVE_ROW)};this.removeAllRows=function(){for(var b=g.length-1;0<=b;b--)g[b].$innerDestroy();g.length=0;k.clear();q(null,KTableUI.REMOVE_ROW)};this.getRowsCount=function(){return g.length};this.getRow=function(b){return g[b]};this.getRowIndex=function(b){for(var m=
0;m<g.length;m++)if(g[m]==b)return m;return-1};this.updateUI=function(b,m){B().updateUI(b,m)};var R,T;this.lazyAppendData=function(b){b?(T=c.getRowsCount(),R=c.isSyncUIWhenModelChanged(),c.setSyncUIWhenModelChanged(!1)):(B().repaintAfterLazyAppendData(T),c.setSyncUIWhenModelChanged(R))};this.lazyAppendDataByTree=function(b,m){b?(R=c.isSyncUIWhenModelChanged(),c.setSyncUIWhenModelChanged(!1),B().showPromptForLazyAppendData(!0)):(B().showPromptForLazyAppendData(!1),m.setExpanded(!1),c.setSyncUIWhenModelChanged(!0),
m.setExpanded(!0),c.setSyncUIWhenModelChanged(R))};this.setLargeDataMode=function(b,m){B().setScrollDynamicRepaint(b,m)};this.isLargeDataMode=function(){return B().isScrollDynamicRepaint()};this.setHugeModelUpdateListener=function(b,m){B().setScrollDynamicUpdateModelListener(b,m)};this.setSyncUIWhenModelChanged=function(b){B().setSyncUIWhenModelChanged(b)};this.isSyncUIWhenModelChanged=function(){return B().isSyncUIWhenModelChanged()};this.setSyncMergeBlockWhenModelChanged=function(b){la=b};this.isSyncMergeBlockWhenModelChanged=
function(){return la};this.setCellRender=function(b){x=b};this.getCellRender=function(){x||(x=new KTDefaultCellRender(this));return x};this.setDiagonalRender=function(b){y=b};this.getDiagonalRender=function(){y||(y=new KTDiagonalRender);return y};this.setEmbedObjectRender=function(b){D=b};this.getEmbedObjectRender=function(){D||(D=new KTDefaultEmbedObjectRender);return D};this.setTreeHandlerRender=function(b){H=b};this.getTreeHandlerRender=function(){H||(H=new KTDefaultTreeHandlerRender(this));return H};
this.getStyleManager=function(){return t};this.addMergeBlock=function(b){k.append(b)&&q(b,KTableUI.ADD_MERGEBLOCK)};this.addMergeBlocks=function(b){k.appendArray(b)};this.removeMergeBlock=function(b){k.remove(b)&&q(b,KTableUI.REMOVE_MERGEBLOCK)};this.clearMergeBlocks=function(){k.clear();q(null,KTableUI.REMOVE_MERGEBLOCK)};this.bucketingMergeBlocks=function(b){b&&k.requestBucketing();k.bucketing(c.getRowsCount(),c.getColumnsCount(),K,P)};this.searchMergeBlock=function(b,m){return k.search(b,m,K,P)};
this.visitMergeBlocks=function(b,m,p,O,J){b=0>b?0:b;m=0>m?c.getRowsCount()-1:m;p=0>p?0:p;O=0>O?c.getColumnsCount()-1:O;k.visit(J,b,m,p,O,K,P)};this.visitAllMergeBlocks=function(b){k.visitAll(b)};this.setMergeBlockTextVisibleAlways=function(b){L=b};this.isMergeBlockTextVisibleAlways=function(){return L};this.setStyle=function(b){f=b};this.getStyle=function(){return f};this.setBorder=function(b){n=b};this.getBorder=function(){return n};this.getStyleValue=function(b,m,p,O,J,Q){if(b&&(b=b[O]())&&((b=
b[J]())||0===b||!1===b))return b;if(b=m[O]())if((b=b[J]())||0===b||!1===b)return b;if(b=p[O]())if((b=b[J]())||0===b||!1===b)return b;if(b=c[O]())if((b=b[J]())||0===b||!1===b)return b;return Q};this.addEmbedObject=function(b){if(0<=da(b))throw Error("EmbedObjcet ID already exist.");b.$innerBindChangeListener(ea);l.push(b)};this.removeEmbedObject=function(b){var m=da(b);0<=m&&(b=l[m],b.$innerBindChangeListener(null),l.splice(m,1))};this.getEmbedObject=function(b){b=da(new KTEmbedObject(b));return 0<=
b?l[b]:null};var da=function(b){for(var m=0;m<l.length;m++)if(b.getId()==l[m].getId())return m;return-1};this.getEmbedObjects=function(){return l};var ea=function(b,m,p,O){sa(b,m,p,O)};this.addCellClickListener=function(b){h.addListener("cell-click",b)};this.removeCellClickListener=function(b){h.removeListener("cell-click",b)};this.addTreeExpandListener=function(b){h.addListener("tree-expand",b)};this.removeTreeExpandListener=function(b){h.removeListener("tree-expand",b)};var ka=function(b,m){if(m.isCellPointed()){b=
m.getMouseTargetModel();var p=b.getCell();if(m.isPointTreeHandler()&&m.isLeftButton()){m=c.isSyncUIWhenModelChanged();c.setSyncUIWhenModelChanged(!0);var O=p.getTreeModel();O.setExpanded(!O.isExpanded());c.setSyncUIWhenModelChanged(m);b=new KTTreeExpandEvent(p,b.getRowIndex(),b.getColIndex());h.fireListener("tree-expand",b)}else{O=m.getOriginalEvent();a:{var J=b.getRowIndex();var Q=b.getColIndex();if(J=c.searchMergeBlock(J,Q))for(Q=J.getRowIdxFrom();Q<=J.getRowIdxTo();Q++)for(var X=c.getRow(Q),Y=
J.getColIdxFrom();Y<=J.getColIdxTo();Y++){var aa=X.getCell(Y,!0);if(aa){J=aa;break a}}J=null}b=new KTCellClickEvent(O,J?J:p,b,m);h.fireListener("cell-click",b)}}};this.addScrollToBottomListener=function(b){h.addListener("scroll-to-bottom",b)};this.removeScrollToBottomListener=function(b){h.removeListener("scroll-to-bottom",b)};var ra=function(b,m){m.isVerticalScroll()&&m.isScrollToBottom()&&h.fireListener("scroll-to-bottom",m)};this.addUIListener=function(b,m){B().addListener(b,m)};this.removeUIListener=
function(b,m){B().removeListener(b,m)};var sa=function(b,m,p,O){if(u&&u.isSyncUIWhenModelChanged()){if(b instanceof KTCell.Path){var J=c.getColumn(b.getColIndex()),Q=c.getRowIndex(b.getRow());b.$innerSetInfo(Q,J);if(m==KTCell.TREE_EXPANDING){m=new KTTreeStateChangedEvent(c,b);h.fireListener("tree-state-changed",m);if(!m.isPreventDefault()){if(u){var X=u.isSyncUIWhenModelChanged();u.setSyncUIWhenModelChanged(!1)}J=0;var Y=b.getCell().getTreeModel();m=Y.isHorizontal();p=Y.isExpanded();O=b.getRowIndex();
b=b.getColIndex();for(var aa=m?O:b,Z=Q=m?M(O,b):F(O,b),qa=m?c.getColumnsCount():c.getRowsCount(),ja=[],fa=32767;Z<qa;){var ba=m?aa:Z,ma=m?Z:aa,na=Z;Z=m?M(aa,Z):F(Z,aa);var e=Z-1;ba=c.getRow(ba).getCell(ma,!0);if(!ba||!ba.getTreeModel())break;ma=ba.getTreeModel();var r=ma.getLevel();if(r<=Y.getLevel()||m!=ma.isHorizontal())break;if(p)for(ba=!1,r<=fa&&(fa=ma.isExpanded()?32767:r,ba=!0);na<=e;na++)ja.push(ba),ba&&J++;else for(;na<=e;na++)ba=m?c.getColumn(na):c.getRow(na),ba.isHide()||J++,ba.setHide(!0)}if(p){if(C)for(Y=
m?Math.min(C[0],c.getRowsCount()):Math.min(C[1],c.getColumnsCount()),na=aa+1;na<Y;na++)for(aa=ja,Z=Q,qa=na,fa=m,e=Z,ba=Z+aa.length,ma=32767;e<ba;){var I=fa?qa:e,N=fa?e:qa,S=e;e=fa?M(qa,e):F(e,qa);r=e-1;if((I=c.getRow(I).getCell(N,!0))&&I.getTreeModel()&&(I=I.getTreeModel(),fa==I.isHorizontal()))if(N=I.getLevel(),N<=ma)ma=I.isExpanded()?32767:N;else for(;S<=r;S++)aa[S-Z]=!1}for(na=0;na<ja.length;na++)Z=na+Q,(m?c.getColumn(Z):c.getRow(Z)).setHide(!ja[na])}Q=J;if(!(0>=l.length))for(J=m?b:O,O=m?c.getColumn(b).getWidth():
c.getRow(O).getHeight(),O=(p?O:-O)*Q,p=0;p<l.length;p++)b=l[p],m&&b.getColFrom()>J?b.setX(b.getX()+O):b.getRowFrom()>J&&b.setY(b.getY()+O);u&&(u.setSyncUIWhenModelChanged(X),u.updateUI(!0))}return}}u.propertyChangeHandler(b,m,p,O)}},q=function(b,m){u&&u.isSyncUIWhenModelChanged()&&u.modelChangeHandler(b,m)};this.getSelectionModel=function(){return E};this.setSelectionRender=function(b){V=b};this.getSelectionRender=function(){return V};this.setMouseDownSelectingMode=function(b){ha=b};this.isMouseDownSelectingMode=
function(){return ha};var A=function(b,m){if(!(ha&&"mousedown"!=b||!ha&&"mousedown"==b||m.isStopped())&&m.isCellPointed()&&(b=c.getSelectionModel(),b.getMode()!=KTSelectionModel.MODE_NONE)){var p=m.getMouseTargetModel();if(p instanceof KTCell.Path){if(b.isPolicySetting(KTSelectionModel.POLICY_ROW)){if(p.getRowIndex()<c.getFrozenRows())return;p=b.createRowTarget(p.getRowIndex())}else if(b.isPolicySetting(KTSelectionModel.POLICY_COLUMN)){if(p.getColIndex()<c.getFrozenColumns())return;p=b.createColumnTarget(p.getColIndex())}else p=
b.createCellTarget(p.getRowIndex(),p.getColIndex());m.isCtrlDown()&&b.getMode()==KTSelectionModel.MODE_MULTI?b.isContains(p)?b.removeSelected(p):b.addSelected(p):m.isShiftDown()&&b.getMode()==KTSelectionModel.MODE_MULTI?(b.isContains(p)&&b.removeSelected(p),b.appendSelected(p)):b.hasSelected()?b.isSingleSelected()&&b.isContains(p)||(b.removeAllSelecteds(),b.addSelected(p)):b.addSelected(p)}}};this.setFrozenRows=function(b){if(K!=b){var m=K;K=b;k.requestBucketing();sa(this,KTableUI.FROZEN_ROW,K,m)}};
this.getFrozenRows=function(){return K};this.setFrozenColumns=function(b){if(P!=b){var m=P;P=b;k.requestBucketing();sa(this,KTableUI.FROZEN_COL,P,m)}};this.getFrozenColumns=function(){return P};this.setCrossFrozenRenderMode=function(b){v=b};this.getCrossFrozenRenderMode=function(){return v};this.popupMenu=function(b,m,p,O,J){B().popupMenu(b,m,p,O,J)};this.setMultiTreeSupported=function(b,m,p){C=b?[m,p]:null};this.isMultiTreeSupported=function(){return C?!0:!1};var F=function(b,m){return(m=c.searchMergeBlock(b,
m))?m.getRowIdxTo()+1:b+1},M=function(b,m){return(b=c.searchMergeBlock(b,m))?b.getColIdxTo()+1:m+1};this.isColumnFitVisibleWidth=function(){return W};this.setColumnFitVisibleWidth=function(b){W=b};this.isAutoAdjustRowHeight=function(){return pa};this.setAutoAdjustRowHeight=function(b){pa=b};this.selectByPoint=function(b,m){return B().selectByPoint(b,m)};this.setScrollerVisible=function(b,m,p){B().setScrollerVisible(b,m,p)};this.keepScrollStatus=function(){return B().keepScrollStatus()};this.restoreScrollStatus=
function(b){B().restoreScrollStatus(b)};this.scrollCellVisible=function(b,m,p){B().scrollCellVisible(b,m,p)};this.setDraggableAdjusting=function(b,m,p,O){w=b?[m,p,O]:null};this.getDraggableAdjusting=function(){return w};this.relayoutViews=function(){B().relayoutViews()};this.addTreeStateChangedListener=function(b){h.addListener("tree-state-changed",b)};this.removeTreeStateChangedListener=function(b){h.removeListener("tree-state-changed",b)};this.setCellAcrossListener=function(b){z=b};this.getCellAcrossListener=
function(){return z}}KTable.iFlowId=0;var KTableViewTag=new function(){this.MAIN=0;this.LEFT=4096;this.TOP=256;this.EMBED=16},KTCrossFrozenRenderMode=new function(){this.STUPID_HEAVY=0;this.STUPID_LIGHT=1};function KTPopupMenuItem(c){var a=c,h;this.setText=function(d){a=d};this.getText=function(){return a};this.setUserObject=function(d){h=d};this.getUserObject=function(){return h}}
function KTAbstractMouseEvent(c,a,h,d,g){var k=!1;this.stop=function(){k=!0};this.isStopped=function(){return k};this.getX=function(){return d};this.getY=function(){return g};this.getXAtTable=function(){return a};this.getYAtTable=function(){return h};this.isCtrlDown=function(){return c.ctrlKey};this.isShiftDown=function(){return c.shiftKey};this.isLeftButton=function(){return 1==c.which};this.isRightButton=function(){return 3==c.which}}
function KTCellClickEvent(c,a,h,d){KTAbstractMouseEvent.call(this,c,d.getXAtTable(),d.getYAtTable(),d.getX(),d.getY());this.getCell=function(){return a};this.getCol=function(){return h.getCol()};this.getRow=function(){return h.getRow()};this.getColIdx=function(){return h.getColIndex()};this.getRowIdx=function(){return h.getRowIndex()};this.getXCellAtTable=function(){return d.getXYCellAtTable()[0]};this.getYCellAtTable=function(){return d.getXYCellAtTable()[1]}}
function KTTreeExpandEvent(c,a,h){this.isExpanded=function(){return c.getTreeModel().isExpanded()};this.getCell=function(){return c};this.getRowIdx=function(){return a};this.getColIdx=function(){return h}}
function KTTreeStateChangedEvent(c,a){var h=!1;this.preventDefault=function(){h=!0};this.isPreventDefault=function(){return h};this.getTable=function(){return c};this.getRowIndex=function(){return a.getRowIndex()};this.getColIndex=function(){return a.getColIndex()};this.getRow=function(){return a.getRow()};this.getCol=function(){return a.getCol()};this.getCell=function(){return a.getCell()};this.createCellId=function(d,g){d=d||a.getRow();g=g||a.getCol();return KTableUIAbstractView.createCellId(d,
g)}};
//qingVersionTag: 20250415