/* * * SpreadJS Library 9.40.20161.0 * * Copyright(c) GrapeCity, Inc. All rights reserved. * * Licensed under the SpreadJS Commercial License. * spread.sales@grapecity.com * http://spread.grapecity.com/Pages/Spread-JS-License/ * * **/ var __extends,GcSpread;(function(n){(function(n){function t(n,t){var i,r;for(typeof n=="string"?i=(t||document).querySelectorAll(n):n&&(i=n instanceof Array||n instanceof HTMLCollection?n:[n]),this.elements=[],r=0;i&&r<i.length;r++)this.elements.push(i[r])}n.GC$=function(n,i){return new t(n,i)};n.GC$.prototype={elements:[],getElement:function(n){return this.elements[n]},getAllElements:function(){return this.elements},length:function(){return this.elements.length},bind:function(t,i,r){var u=this;return typeof r==typeof undefined&&(r=i,i=undefined),u.elements.forEach(function(u,f){var e=n.GC$._data(u,"events"),s,h;e||(e={},n.GC$._data(u,"events",e));var l=t.split("."),c=l[0],a=l[1]||"_nonamespace",o=e[a];o||(o=e[a]={});s=function(n){typeof i!=typeof undefined&&(n.data=i);var t=r.apply(u,arguments);n.result=t;t===!1&&(n.preventDefault?(n.preventDefault(),n.stopPropagation()):(n.cancelBubble=!1,n.returnValue=!1))};s.original=r;h=o[c];h||(h=o[c]=[]);h.push(s);u.addEventListener(c,s)}),u},unbind:function(t,i){var r=this;return r.elements.forEach(function(r,u){var a=t.split("."),o=a[0],v=a[1]||"_nonamespace",c=n.GC$._data(r,"events"),s=c&&c[v],l,f,e,h;if(i){if(s&&o&&(f=s[o],f))for(e=0,h=f.length;e<h;e++)if(f[e].original===i){r.removeEventListener(o,f[e]);f.splice(e,1);break}}else if(s)if(o){if(f=s[o],f)for(e=0,h=f.length;e<h;e++)r.removeEventListener(o,f[e]);s[o]=undefined}else{for(l in s)if(f=s[l],f)for(e=0,h=f.length;e<h;e++)r.removeEventListener(l,f[e]);c[v]=undefined}}),r},trigger:function(t,i){var r=this;return r.elements.forEach(function(r,u){var o=n.GC$._data(r,"events"),l,s,f,e,a;if(o){var h=t.split("."),c=h[0],v=h[1]||"_nonamespace";for(l in o)if(s=o[l],f=s&&s[c],f)for(e=0,a=f.length;e<a;e++)f[e].apply(r,[{type:c},i])}}),r},css:function(t,i){var u=this,o=u.elements,f,r,e;if(arguments.length===1)if(typeof t=="object")o.forEach(function(i,r){for(var u in t)i.style[u]=n.GC$._fixCssValue(u,t[u])});else return f=u.getElement(0),r=n.GC$.cssHooks[t],r&&"get"in r?r.get(f):(e=getComputedStyle(f),e&&e[t]);else arguments.length===2&&(i=n.GC$._fixCssValue(t,i),o.forEach(function(n,r){n.style[t]=i}));return u},width:function(n){var t=this,r=t.css("box-sizing")==="border-box",i;return arguments.length===0?(i=Math.round(parseFloat(t.css("width")))||0,r&&(i-=parseFloat(t.css("padding-left"))+parseFloat(t.css("padding-right"))+parseFloat(t.css("border-left-width"))+parseFloat(t.css("border-right-width"))),i):(t.css("width",n),t)},height:function(n){var t=this,r=t.css("box-sizing")==="border-box",i;return arguments.length===0?(i=Math.round(parseFloat(t.css("height")))||0,r&&(i-=parseFloat(t.css("padding-top"))+parseFloat(t.css("padding-bottom"))+parseFloat(t.css("border-top-width"))+parseFloat(t.css("border-bottom-width"))),i):(t.css("height",n),t)},innerWidth:function(){return this.width()+parseFloat(this.css("padding-left"))+parseFloat(this.css("padding-right"))},innerHeight:function(){return this.height()+parseFloat(this.css("padding-top"))+parseFloat(this.css("padding-bottom"))},outerWidth:function(n){var t=this.innerWidth();return t+=parseFloat(this.css("border-left-width"))+parseFloat(this.css("border-right-width")),n&&(t+=parseFloat(this.css("margin-left"))+parseFloat(this.css("margin-right"))),t},outerHeight:function(n){var t=this.innerHeight();return t+=parseFloat(this.css("border-top-width"))+parseFloat(this.css("border-bottom-width")),n&&(t+=parseFloat(this.css("margin-top"))+parseFloat(this.css("margin-bottom"))),t},append:function(t){var r=[t],i,u;return t instanceof n.GC$&&(r=t.getAllElements()),i=this,u=i.getElement(0),r.forEach(function(n,t){n&&u.appendChild(n)}),i},appendTo:function(t){var r=t,i;return t instanceof n.GC$&&(r=t.getElement(0)),i=this,i.elements.forEach(function(n,t){r.appendChild(n)}),i},prepend:function(n){var t=this,i=t.getElement(0);return i.insertBefore(n,i.firstChild),t},insertBefore:function(n){var t=this,i=n.parentElement;return t.elements.forEach(function(t,r){i.insertBefore(t,n)}),t},addClass:function(t){for(var i,r,u,o,f=0,s=this.elements.length,h=/\S+/g,c=/[\t\r\n]/g,e=(t||"").match(h)||[];f<s;f++)if(i=this.elements[f],r=i.nodeType===1&&(i.className?(" "+i.className+" ").replace(c," "):" "),r){for(o=0;u=e[o++];)r.indexOf(" "+u+" ")<0&&(r+=u+" ");i.className=n.GC$.trim(r)}return this},removeClass:function(t){for(var r,i,u,o,f=0,s=this.elements.length,h=/\S+/g,c=/[\t\r\n]/g,e=(t||"").match(h)||[];f<s;f++)if(r=this.elements[f],i=r.nodeType===1&&(r.className?(" "+r.className+" ").replace(c," "):""),i){for(o=0;u=e[o++];)while(i.indexOf(" "+u+" ")>=0)i=i.replace(" "+u+" "," ");r.className=t?n.GC$.trim(i):""}return this},hasClass:function(n){for(var n=" "+n+" ",t=0,r=this.elements.length,u=/[\t\r\n]/g,i;t<r;t++)if(i=this.elements[t],i.nodeType===1&&(" "+i.className+" ").replace(u," ").indexOf(n)>=0)return!0;return!1},toggle:function(){var n=this,t=n.getElement(0);return t.style.display==="none"?n.show():n.hide(),n},show:function(n){return this.elements.forEach(function(t,i){t.style.display="block";n&&n.apply(t)}),this},hide:function(){return this.elements.forEach(function(n,t){n.style.display="none"}),this},attr:function(n,t){var i=this,r=i.elements;if(arguments.length===1)if(typeof n=="object")r.forEach(function(t,i){for(var r in n)t.setAttribute(r,n[r])});else return i.getElement(0).getAttribute(n);else arguments.length===2&&r.forEach(function(i,r){i.setAttribute(n,t)});return i},removeAttr:function(n){return this.elements.forEach(function(t,i){t.removeAttribute(n)}),this},prop:function(t,i){var r=this,u=r.elements;if(arguments.length===1)if(typeof t=="object")u.forEach(function(i,r){for(var u in t)n.GC$.internalProp(i,u,t[u])});else return n.GC$.internalProp(r.getElement(0),t);else arguments.length===2&&u.forEach(function(r,u){n.GC$.internalProp(r,t,i)});return r},removeProp:function(t){t=n.GC$.propFix[t]||t;var i=this,r=i.elements;return r.forEach(function(n,i){try{n[t]=undefined;delete n[t]}catch(r){}}),i},text:function(n){var t=this,i=t.elements;return arguments.length===0?t.getElement(0).textContent:(i.forEach(function(t,i){t.textContent=n}),t)},val:function(t){var f=this,i,u,r,e;return arguments.length?(e=n.GC$.isFunction(t),f.elements.forEach(function(r,u){var f;r.nodeType===1&&(f=e?t.call(r,u,n.GC$(r).val()):t,f==null?f="":typeof f=="number"?f+="":n.GC$.isArray(f)&&(f=n.GC$.map(f,function(n){return n==null?"":n+""})),i=n.GC$.valHooks[r.type]||n.GC$.valHooks[r.nodeName.toLowerCase()],i&&"set"in i&&i.set(r,f,"value")!==undefined||(r.value=f))}),f):(u=f.getElement(0),u)?(i=n.GC$.valHooks[u.type]||n.GC$.valHooks[u.nodeName.toLowerCase()],i&&"get"in i&&(r=i.get(u,"value"))!==undefined)?r:(r=u.value,typeof r=="string"?r.replace(/\r/g,""):r==null?"":r):void 0},position:function(){var r=this.getElement(0),u,t,f,i;if(r)return t={top:0,left:0},n.GC$(r).css("position")==="fixed"?u=r.getBoundingClientRect():(f=this.offsetParent(),u=this.offset(),i=f.getElement(0),n.GC$.nodeName(i,"html")||(t=f.offset(),t.left-=i.scrollLeft,t.top-=i.scrollTop),t.top+=parseFloat(n.GC$(i).css("borderTopWidth")),t.left+=parseFloat(n.GC$(i).css("borderLeftWidth"))),{top:u.top-t.top-parseFloat(n.GC$(r).css("marginTop")),left:u.left-t.left-parseFloat(n.GC$(r).css("marginLeft"))}},offsetParent:function(){var t=n.GC$.map(this.elements,function(t,i){for(var r=t.offsetParent||document.documentElement;r&&!n.GC$.nodeName(r,"html")&&n.GC$(r).css("position")==="static";)r=r.offsetParent;return r||document.documentElement});return n.GC$(t)},offset:function(){var t,r,u={top:0,left:0},i=this.getElement(0),f=i&&i.ownerDocument;if(f)return t=f.documentElement,typeof i.getBoundingClientRect!=typeof undefined&&(u=i.getBoundingClientRect()),r=n.GC$.getWindow(f),{top:u.top+(r.pageYOffset||t.scrollTop)-(t.clientTop||0),left:u.left+(r.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}},scrollLeft:function(t){var u=this,r=u.getElement(0),i=n.GC$.getWindow(r);return t===undefined?i?"pageXOffset"in i?i.pageXOffset:i.document.documentElement.scrollLeft:r.scrollLeft:(i?i.scrollTo(t,n.GC$(i).scrollTop()):r.scrollLeft=t,u)},scrollTop:function(t){var u=this,r=u.getElement(0),i=n.GC$.getWindow(r);return t===undefined?i?"pageYOffset"in i?i.pageYOffset:i.document.documentElement.scrollTop:r.scrollTop:(i?i.scrollTo(n.GC$(i).scrollLeft(),t):r.scrollTop=t,u)},html:function(n){var t=this,i=t.elements;return arguments.length===0?t.getElement(0).innerHTML:(i.forEach(function(t,i){t.innerHTML=n}),t)},remove:function(){var t=this.elements;t.forEach(function(t,i){var r=t.parentElement;r&&(r.removeChild(t),n.GC$.cleanData([t]))})},empty:function(){return this.elements.forEach(function(t,i){n.GC$(t.children).remove()}),this},find:function(t){var i=[];return typeof t=="string"&&this.elements.forEach(function(r,u){var f=r.querySelectorAll(t);n.GC$.merge(i,f)}),n.GC$(i)},parent:function(){var t=[];return this.elements.forEach(function(n,i){n.parentElement&&t.push(n.parentElement)}),n.GC$(t)},index:function(t){var i=this.getElement(0);return t?typeof t=="string"?n.GC$.inArray(i,n.GC$(t).getAllElements()):n.GC$.inArray(t,this.elements):i&&i.parentElement?n.GC$.inArray(i,i.parentElement.children):-1},focus:function(){var t=this,n=t.getElement(0);return n!==document.activeElement&&n.focus&&n.focus(),t},isVisible:function(){var n=0;return this.elements.forEach(function(t,i){var r=getComputedStyle(t);r.visibility!=="hidden"&&r.display!=="none"&&n++}),n>0},data:function(t,i){var r=this;return n.GC$.each(this.elements,function(u,f){var e=n.GC$.internalData(f,t,i);if(typeof i==typeof undefined)return r=e,!1}),r},removeData:function(t){return n.GC$.each(this.elements,function(i,r){n.GC$.internalRemoveData(r,t)}),this}};n.GC$.each=function(t,i){var u,o=n.GC$.isArraylike(t),r,e,f;if(o){for(r=0,e=t.length;r<e;r++)if(u=i.call(t[r],r,t[r]),u===!1)break}else for(f in t)if(u=i.call(t[f],f,t[f]),u===!1)break;return t};n.GC$.isEmptyObject=function(n){for(var t in n)return!1;return!0};n.GC$.isFunction=function(t){return n.GC$.getType(t)==="function"};n.GC$.isArray=function(t){return Array.isArray?Array.isArray(t):n.GC$.getType(t)==="array"};n.GC$.isNumeric=function(n){return!isNaN(parseFloat(n))&&isFinite(n)};n.GC$.getType=function(n){var t,i;return n==null?String(n):(t={},"Boolean Number String Function Array Date RegExp Object Error".split(" ").forEach(function(n,i){t["[object "+n+"]"]=n.toLowerCase()}),i=t.toString,typeof n=="object"||typeof n=="function"?t[i.call(n)]||"object":typeof n)};n.GC$.inArray=function(n,t,i){var r,u;if(t){if(u=[].indexOf,u)return u.call(t,n,i);for(r=t.length,i=i?i<0?Math.max(0,r+i):i:0;i<r;i++)if(i in t&&t[i]===n)return i}return-1};n.GC$.trim=function(n){if(n.trim)return n.trim();else{var t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;return n==null?"":(n+"").replace(t,"")}};n.GC$.merge=function(n,t){var u=t.length,r=n.length,i=0;if(typeof u=="number")for(;i<u;i++)n[r++]=t[i];else while(t[i]!==undefined)n[r++]=t[i++];return n.length=r,n};n.GC$.map=function(t,i,r){var f,u=0,s=t.length,h=n.GC$.isArraylike(t),e=[],o;if(h)for(;u<s;u++)f=i(t[u],u,r),f!=null&&(e[e.length]=f);else for(u in t)f=i(t[u],u,r),f!=null&&(e[e.length]=f);return o=[].concat,o.apply([],e)};n.GC$.extend=function(){for(var a=[],e=0;e<arguments.length-0;e++)a[e]=arguments[e+0];var r,o,i,f,s,h,t=arguments[0]||{},u=1,l=arguments.length,c=!1;for(typeof t=="boolean"&&(c=t,t=arguments[1]||{},u=2),typeof t=="object"||n.GC$.isFunction(t)||(t={}),l===u&&(t=this,--u);u<l;u++)if((s=arguments[u])!=null)for(f in s)(r=t[f],i=s[f],t!==i)&&(c&&i&&(n.GC$.isPlainObject(i)||(o=n.GC$.isArray(i)))?(o?(o=!1,h=r&&n.GC$.isArray(r)?r:[]):h=r&&n.GC$.isPlainObject(r)?r:{},t[f]=n.GC$.extend(c,h,i)):i!==undefined&&(t[f]=i));return t};n.GC$.isPlainObject=function(t){var i,r;if(!t||n.GC$.getType(t)!=="object"||t.nodeType||n.GC$.isWindow(t))return!1;i={}.hasOwnProperty;try{if(t.constructor&&!i.call(t,"constructor")&&!i.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(u){return!1}for(r in t);return r===undefined||i.call(t,r)};n.GC$.isArraylike=function(t){var i=t.length,r=n.GC$.getType(t);return n.GC$.isWindow(t)?!1:t.nodeType===1&&i?!0:r==="array"||r!=="function"&&(i===0||typeof i=="number"&&i>0&&i-1 in t)};n.GC$.isWindow=function(n){return n!=null&&n==n.window};n.GC$.getWindow=function(t){return n.GC$.isWindow(t)?t:t.nodeType===9?t.defaultView||t.parentWindow:!1};n.GC$.nodeName=function(n,t){return n.nodeName&&n.nodeName.toLowerCase()===t.toLowerCase()};n.GC$.makeArray=function(t,i){var r=i||[];return t!=null&&(n.GC$.isArraylike(Object(t))?n.GC$.merge(r,typeof t=="string"?[t]:t):[].push.call(r,t)),r};n.GC$._fixCssValue=function(n,t){return"top left right bottom width height border-radius border-width border-left-width border-right-width border-top-width border-bottom-width line-height padding padding-left padding-right padding-top padding-bottom margin margin-left margin-right margin-top margin-bottom".split(" ").indexOf(n)>=0&&isFinite(t)?("width height".split(" ").indexOf(n)>=0&&t<0&&(t=0),t+"px"):t};n.GC$.cssHooks={};["height","width"].forEach(function(t,i){n.GC$.cssHooks[t]={get:function(n){var e=getComputedStyle(n),i=n.style,s={position:"absolute",visibility:"hidden",display:"block"},h={position:i.position,visibility:i.visibility,display:i.display},c=n.offsetWidth===0&&/^(none|table(?!-c[ea]).+)/.test(e.display),f,r,u,o;if(c)for(r in s)i[r]=s[r];if(f=e&&e[t],c)for(r in h)i[r]=h[r];if(f===""){for(u=n.parentElement,o=document.body;u&&u!==o;)u=u.parentElement;u!==o&&(f=i[t])}return f}}});n.GC$.propFix={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"};n.GC$.propHooks={tabIndex:{get:function(n){var t=n.getAttributeNode("tabindex"),i=/^(?:input|select|textarea|button|object)$/i,r=/^(?:a|area)$/i;return t&&t.specified?parseInt(t.value,10):i.test(n.nodeName)||r.test(n.nodeName)&&n.href?0:undefined}}};n.GC$.internalProp=function(t,i,r){var f,u,o,e=t.nodeType;if(t&&e!==3&&e!==8&&e!==2)return o=e!==1,o&&(i=n.GC$.propFix[i]||i,u=n.GC$.propHooks[i]),r!==undefined?u&&"set"in u&&(f=u.set(t,r,i))!==undefined?f:t[i]=r:u&&"get"in u&&(f=u.get(t,i))!==null?f:t[i]};n.GC$.valHooks={option:{get:function(n){var t=n.attributes.value;return!t||t.specified?n.value:n.text}},select:{get:function(t){for(var e,i,o=t.options,r=t.selectedIndex,u=t.type==="select-one"||r<0,s=u?null:[],h=u?r+1:o.length,f=r<0?h:u?r:0;f<h;f++)if(i=o[f],(i.selected||f===r)&&!i.disabled&&(!i.parentNode.disabled||!n.GC$.nodeName(i.parentNode,"optgroup"))){if(e=n.GC$(i).val(),u)return e;s.push(e)}return s},set:function(t,i){var r=n.GC$.makeArray(i),u=n.GC$(t).find("option").getAllElements();return u.forEach(function(t,i){t.selected=n.GC$.inArray(n.GC$(t).val(),r)>=0}),r.length||(t.selectedIndex=-1),r}}};n.GC$.cache={};n.GC$.expando="GC$"+(""+Math.random()).replace(/\D/g,"");n.GC$.guid=1;n.GC$.noData={embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0};n.GC$.acceptData=function(t){if(t.nodeType&&t.nodeType!==1&&t.nodeType!==9)return!1;var i=t.nodeName&&n.GC$.noData[t.nodeName.toLowerCase()];return!i||i!==!0&&t.getAttribute("classid")===i};n.GC$.noop=function(){};n.GC$.camelCase=function(n){return n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(n,t){return t.toUpperCase()})};n.GC$.internalData=function(t,i,r,u){if(n.GC$.acceptData(t)){var o,s,h=n.GC$.expando,l=typeof i=="string",c=t.nodeType,e=c?n.GC$.cache:t,f=c?t[h]:t[h]&&h;if(f&&e[f]&&(u||e[f].data)||!l||r!==undefined)return f||(c?t[h]=f=n.GC$.guid++:f=h),e[f]||(e[f]={},c||(e[f].toJSON=n.GC$.noop)),(typeof i=="object"||typeof i=="function")&&(u?e[f]=n.GC$.extend(e[f],i):e[f].data=n.GC$.extend(e[f].data,i)),o=e[f],u||(o.data||(o.data={}),o=o.data),r!==undefined&&(o[n.GC$.camelCase(i)]=r),l?(s=o[i],s==null&&(s=o[n.GC$.camelCase(i)])):s=o,s}};n.GC$.internalRemoveData=function(t,i,r){if(n.GC$.acceptData(t)){var h=function(t){for(var i in t)if((i!=="data"||!n.GC$.isEmptyObject(t[i]))&&i!=="toJSON")return!1;return!0},o,c,e,s=t.nodeType,u=s?n.GC$.cache:t,f=s?t[n.GC$.expando]:n.GC$.expando;if(u[f]){if(i&&(e=r?u[f]:u[f].data,e)){for(n.GC$.isArray(i)?i=i.concat(n.GC$.map(i,n.GC$.camelCase)):(i in e)?i=[i]:(i=n.GC$.camelCase(i),i=i in e?[i]:i.split(" ")),o=0,c=i.length;o<c;o++)delete e[i[o]];if(!(r?h:n.GC$.isEmptyObject)(e))return}(r||(delete u[f].data,h(u[f])))&&(s?n.GC$.cleanData([t],!0):u!=u.window?delete u[f]:u[f]=null)}}};n.GC$.cleanData=function(t,i){for(var r,w,u,h,a=0,v=n.GC$.expando,c=n.GC$.cache,f,l,e,y,o,s,p;(r=t[a])!=null;a++)if((i||n.GC$.acceptData(r))&&(u=r[v],h=u&&c[u],h)){if(f=h.events,f)for(l in f)if(e=f[l],e)for(y in e)if(o=e[y],o)for(s=0,p=o.length;s<p;s++)r.removeEventListener(l,o[s]);c[u]&&(delete c[u],delete r[v])}};n.GC$._data=function(t,i,r){return n.GC$.internalData(t,i,r,!0)};n.GC$._removeData=function(t,i){return n.GC$.internalRemoveData(t,i,!0)};t.prototype=n.GC$.prototype})(n.Sheets||(n.Sheets={}));var t=n.Sheets})(GcSpread||(GcSpread={})),function(n){(function(n){function r(n,t){if(i.ensure(n),t&&t.length>0&&!i.check(t)){var r=window.console;r&&r.error&&r.error("["+n+"]: One or more dependency in ["+t+"] are not found!")}}var t=null,i=function(){function i(n,t,i){this.prop=n;this.getter=t;this.setter=i}return i.parse=function(r){var f,u,o,e;if(r!==undefined&&r!==t&&r.length>0){f=r.split(".");u=t;do o=f.shift(),e=new i(o,function(){var t=this;return t.base?t.base.getter()[t.prop]:n.features[t.prop]},function(i){var r=this,u;r.base?(u=r.base.getter(),(u===t||u===undefined)&&r.base.setter(u={}),u[r.prop]=i):n.features[r.prop]=i}),u&&(e.base=u),u=e;while(f.length>0);return u}return t},i.ensure=function(n){var t=i.parse(n);t&&t.setter(!0)},i.check=function(t){var r=!0;return n.GC$.each(t,function(n,t){var u=i.parse(t);return u&&!u.getter()?r=!1:!0}),r},i}();n.feature=r;n.features=function(n){return n?n:{core:{stringResource:!1,common:!1,imageLoader:!1,theme:!1,globalize:!1,spreadpanelex:!1,basecelltype:!1,sheet_model:!1,sheet_action:!1,sheet_event:!1,sheet_border:!1,sheet_render:!1,sheet_ui:!1,sheet:!1,spread:!1,spread_ui:!1,cultureInfo:!1},calc:{common:!1,functions:!1,functions_db:!1,functions_eng:!1,functions_fin:!1,functions_lookup:!1,functions_stat:!1},filter:!1,filter_ui:!1,sparkline:!1,table:!1,binding:!1,group:!1,celltype:!1,conditionalFormat:!1,dataValidator:!1,fill:!1,fill_ui:!1,formatter:!1,search:!1,touch:!1,floatingObject:!1,comment:!1,sparklineEx:!1,formulatextbox:!1,formulatextbox_resource:!1,basedialog:!1,slicer:!1,tableSlicer:!1,print:!1}}(n.features)})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){t.feature("core.stringResource");var i=function(){function t(){}return t.getHelpFuncs=function(){var t=n.Sheets.FormulaTextBoxResource_EN;return t?t.Functions:null},t.getHelpTableFuncs=function(){var t=n.Sheets.FormulaTextBoxResource_EN;return t?t.Table_Functions:null},t.Exp_InvalidArgument="Invalid argument",t.Exp_InvalidCast="InvalidCastException",t.Exp_NotSupport="NotSupportException",t.Exp_FormulaInvalid="The formula you typed contains an invalid char: '{0}' at index on {1}.",t.Exp_InvalidTokenAt="invalid token at {0}.",t.Exp_InvalidArrayAt="Invalid array at {0}.",t.Exp_InvalidCellReference="Invalid cell reference or name at {0}.",t.Exp_InvalidFunctionName="Invalid function name",t.Exp_InvalidOverrideFunction="Cannot override built-in function",t.Exp_OverrideNotAllowed="Attempt to override function while override is not allowed",t.Exp_NoSyntax="no syntax '{0}' to match the syntax '{1}'.",t.Exp_IsValid="'{0}' is invalid.",t.Exp_InvalidArray="Invalid array",t.Exp_InvalidParameters="Invalid function parameters at {0}.",t.Exp_InvalidArrayColumns="The length of array columns are unequal at {0}.",t.Exp_ExprIsNull="The argument 'expr' is null",t.Exp_RuleIsNull="The argument 'rule' is null",t.CopyCells="Copy Cells",t.FillSeries="Fill Series",t.FillFormattingOnly="Fill Formatting Only",t.FillWithoutFormatting="Fill Without Formatting",t.Exp_NumberOnly="Only works for Numbers",t.Exp_RangeContainsMergedCell="Range should not have merged cell.",t.Exp_ChangeMergedCell="Cannot change part of merged cell.",t.Exp_TargetContainsMergedCells="Target range should not have merged cells.",t.Exp_MergedCellsIdentical="This operation requires the merged cells to be identically sized.",t.SortAscending="Sort Ascending",t.SortDescending="Sort Descending",t.OK="OK",t.Cancel="Cancel",t.Search="Search",t.CheckAll="Check all",t.UncheckAll="Uncheck all",t.Blanks="(Blanks)",t.ls=["","506f776572656420627920477261706543697479205370726561642e53686565747320547269616c2056657273696f6e0d0a4e6f74204c6963656e73656420666f7220446973747269627574696f6e"],t.Exp_FilterItemIsNull="FilterItem is null.",t.Exp_InvalidColumnIndex="Invalid column index.",t.Exp_TokenIsNull="token is null",t.Exp_InvalidBackslash="the '\\' cannot be evaluated",t.Exp_FormatIllegal="format is illegal.",t.Exp_ValueIsNull="value is null",t.Exp_PartIsNull="part is null",t.Exp_DuplicatedDescriptor="The type of descriptor was added.",t.Exp_TokenIllegal="token is illegal.",t.Exp_ValueIllegal="value is illegal.",t.Exp_StringIllegal="string is illegal.",t.Exp_InvalidNull="InvalidNullException",t.Exp_InvalidOperation="InvalidOperationException",t.Exp_ArgumentNull="ArgumentNullException",t.Exp_CriteriaIsNull="criteria is null",t.Exp_InvalidString="Invalid string",t.Exp_InvalidDateFormat="Invalid date format pattern",t.Exp_InvalidExponentFormat="invalid exponent format",t.Exp_InvalidSemicolons="invalid format: too many semicolons",t.Exp_InvalidNumberGroupSize="NumberGroupSize must be between 1 and 9.",t.Exp_BadFormatSpecifier="Bad Format Specifier",t.Exp_InvalidNumberFormat="Invalid number format pattern",t.Exp_InvalidIndex="Invalid index",t.Exp_InvalidCount="Invalid count",t.Exp_InvalidLevel="Invalid level",t.Exp_GroupInfoIsNull="groupInfo is null",t.Exp_SheetIsNull="sheet is null.",t.Exp_DestSheetIsNull="destSheet is null",t.Exp_PasteExtentIsNull="pasteExtent is null",t.Exp_InvalidPastedArea="The pasted area should have the same size as the copy or cut area.",t.Exp_ChangePartOfArray="Cannot change part of an array.",t.Exp_ColumnReadOnly="The column you are trying to change is protected and therefore read-only.",t.Exp_RowReadOnly="The row you are trying to change is protected and therefore read-only.",t.Exp_CellReadOnly="The cell you are trying to change is protected and therefore read-only.",t.Exp_FillRangeContainsMergedCell="Cannot fill range that contains a merged cell.",t.Exp_FillCellsReadOnly="The cells you are trying to fill is protected and therefore read-only.",t.Exp_OverlappingSpans="This operation will cause overlapping spans.",t.Exp_InvalidAndSpace="Invalid {0}: {1} (must be between {2} and {3}).",t.Exp_SrcIsNull="The argument 'src' is null",t.Exp_DestIsNull="The argument 'dest' is null",t.Exp_InvalidCustomFunction="invalid custom function",t.Exp_InvalidCustomName="invalid custom name",t.Exp_IndexOutOfRange="Index is out of range!",t.Exp_InvalidRange="Invalid range",t.Exp_RangeIsNull="range is null",t.Exp_NotAFunction="{0}is not a function",t.Exp_Format="Format",t.Exp_BraceMismatch="format: brace mis-match",t.Exp_InvalidFormat="invalid format",t.Exp_ArgumentOutOfRange="ArgumentOutOfRange",t.Exp_DragDropShiftTableCell="This operation is not allowed. The operation is attempting to shift cells in a table on your worksheet.",t.Exp_DragDropChangePartOfTable="Cannot complete operation: You are attempting to change a portion of a table row or column in a way that is not allowed.",t.Exp_TableEmptyNameError="The table name cannot be empty.",t.Exp_TableInvalidRow="Invalid row index or row count.",t.Exp_TableInvalidColumn="Invalid column index or column count.",t.Exp_TableIntersectError="The tables cannot be intersected.",t.Exp_TableHasSameNameError="The current worksheet already exists in a table with the same name.",t.Exp_TableDataSourceNullError="Table datasource cannot be null.",t.Exp_TableStyleAddCustomStyleError="The style with the same name already exists in the styles.",t.Exp_TableMoveOutOfRange="The table cannot be moved out of the sheet.",t.Exp_TableResizeOutOfRange="The invalid row count, column count and table cannot be resize out of the sheet.",t.Exp_PasteSourceCellsLocked="Source sheet's cells are locked.",t.Exp_InvalidCopyPasteSize="The copy and paste areas are not the same size.",t.Exp_PasteDestinationCellsLocked="The cell you are trying to change is protected and therefore read-only.",t.Exp_PasteChangeMergeCell="Cannot change part of a merged cell.",t.Tip_Row="Row: ",t.Tip_Column="Column: ",t.Tip_Height="Height: {0} pixels",t.Tip_Width="Width: {0} pixels",t.NewTab="New...",t.Exp_EmptyNamedStyle="The name of named style cannot be empty or null",t.Exp_FloatingObjectHasSameNameError="The current worksheet already has a floating object with the same name.",t.Exp_FloatingObjectNameEmptyError="Floating object must have name",t.ToolStrip_PasteText="Paste",t.ToolStrip_CutText="Cut",t.ToolStrip_CopyText="Copy",t.ToolStrip_AutoFillText="AutoFill",t.Exp_ArrayFromulaPart="You cannot change part of an array.",t.Exp_ArrayFromulaSpan="Array formulas are not valid in merged cells.",t.Exp_ArrayFormulaTable="multi-cell array formulas are not allowed in tables.",t.Fbx_Summary="Summary",t.Fbx_TableName_Description="Table name for ",t.Fbx_CustomName_Description="Custom name for ",t.Exp_TableResizeInvalidRange="The headers must remain in the same row, and the resulting table range must overlap the original table range.",t.Blank="(blank)",t.Exp_Separator="numberDecimalSeparator, listSeparator and arrayListSeparator should be different in cluture info.",t.Exp_SheetNameInvalid="The sheet name can not be blank or contains these characters : *, :, [, ], ?, \\, /",t.Exp_SlicerNameInvalid="The slicer name is not valid.",t.Exp_SlicerNameExist="The slicer name is already in use,please enter an unique name.",t}();t._ENStringResource=i;t.SR=i})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){function ui(n){var e=!1,t=window,f,r,u;if(typeof n=="string"){for(f=n.split("."),r=0,u=f.length;r<u;r++){if(!t)break;t=t[f[r]]}t&&r===u&&u>0&&(e=!0)}return e?t:i}function fi(n){return t.GC$(n).data("spread")}function st(n){if(s.browser.safari)return n.font;var t="",i="normal",r="400";return n.fontStyle!==i&&(t=n.fontStyle),n.fontVariant!==i&&(t+=(t?" ":"")+n.fontVariant),n.fontWeight!==i&&n.fontWeight!==r&&(t+=(t?" ":"")+n.fontWeight),t+=(t?" ":"")+n.fontSize,n.lineHeight!==i&&(t+="/"+n.lineHeight),t+(" "+n.fontFamily)}function du(n){var i=document.createElement("span");return t.GC$(i).css("visibility","hidden").css("top","-10000px").css("left","-10000px").css("position","absolute").css("lineHeight","normal").attr("className","gcFontDetectSpanStyle").attr("gcUIElement","gcFontDetectSpan"),document.body.insertBefore(i,r),{span:i,dispose:function(){document.body.removeChild(i);delete this.span}}}var g,s,h,l,nt,a,ei,tt,it,rt,ut,ft,oi,si,hi,ci,li,ai,vi,yi,pi,et,wi,b,bi,ki,di,gi,nr,tr,ir,rr,ur,fr,er,or,sr,hr,cr,lr,ar,vr,yr,pr,wr,br,kr,dr,gr,nu,tu,iu,ru,uu,fu,eu,ou,su,hu,cu,lu,au,vu,yu,pu,wu,bu,ku,c,ot,ht,gu,nf,tf,ct,p,lt,at,vt,yt,k,pt,wt,bt,kt,rf,uf,dt,w,u,gt,d,ff;t.feature("core.common",["core.stringResource"]);var ni="boolean",ti="date",e="undefined",i=undefined,r=null,ii=Math.abs,v=Math.floor,y=Math.ceil,o=Math.min,f=Math.max,ri=function(){function n(){}return n.productVersion="9.40.20161.0",n}();t.productInfo=ri;t.DefaultFontSize="11pt";g=function(){function n(){}return n.ResizeCol="col-Resize",n.ResizeRow="row-resize",n.ResizeHiddenCol="w-resize",n.ResizeHiddenRow="n-resize",n}();t.CursorResource=g;t.getTypeFromString=ui;t.findControl=fi;s=function(){function n(){}return n.createEventHandler=function(n,t){return function(){return t.apply(n,arguments)}},n.cancelDefault=function(n){return n.preventDefault?(n.preventDefault(),n.stopPropagation()):(n.cancelBubble=!1,n.returnValue=!1),!1},n.preventDefault=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1},n._isStandardCanvas=function(){return typeof n.canvasApiFound===e&&(n.canvasApiFound=typeof document.createElement("canvas").getContext!==e),n.canvasApiFound},n._isSilverlightCanvas=function(){return n._isStandardCanvas()?!0:(typeof n.slCanvasApiFound===e&&(n.slCanvasApiFound=typeof window.slcanvas!==e),n.slCanvasApiFound)},n._useDoubleBuffer=function(){var t=n;return t._isStandardCanvas()||t._isSilverlightCanvas()},n.getHAlignByValueType=function(n,i,r){if(n===3){var u=t.GC$.getType(i);n=r&&r==="@"?0:u==="boolean"?1:u==="number"||u==="date"?2:0}return n},n.inArray=function(n,t,i){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,n,i);var r=t.length;for(i=i?i<0?f(0,r+i):i:0;i<r;i++)if(i in t&&t[i]===n)return i}return-1},n.parseColorString=function(i){var h=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,c=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,l=/^rgb\(([\s\d]*),([\s\d]*),([\s\d]*)\)$/i,v=/^rgba\(([\s\d]*),([\s\d]*),([\s\d]*),([\s\d]*)\)$/i,y=function(n){var r,i;return n?function(n){if(!i){var t=window.document.createElement("canvas");t&&t.getContext&&(i=t.getContext("2d"))}return i?(i.fillStyle=n,i.fillStyle):n}:function(n){return typeof r===e&&(r=t.GC$(document.createElement("span"))),r.css("color",n),r.css("color")}}(n._isStandardCanvas()),p=function(n){return parseInt(n,16)},w=function(n){return parseInt(n+n,16)},s=function(n){return n.indexOf("%")>0?parseFloat(n)*2.55:n|0},f=y(i),u=RegExp,o;if(h.test(f))return a.map([u.$1,u.$2,u.$3],p);else if(v.test(f))return o=a.map([u.$1,u.$2,u.$3],s),o.splice(0,0,parseFloat(u.$4)*255),o;else if(l.test(f))return a.map([u.$1,u.$2,u.$3],s);else if(c.test(f))return a.map([u.$1,u.$2,u.$3],w);return r},n.hasCalc=function(){return t.features.calc&&t.features.calc.common},n.toString=function(n){return n===r||n===i?"":t.GC$.getType(n)===ni?n.toString().toUpperCase():t.GC$.getType(n)===ti?n.getHours()===0&&n.getMinutes()===0&&n.getSeconds()===0&&n.getMilliseconds()===0?new t._DateTimeHelper(n).format("M/d/yyyy"):new t._DateTimeHelper(n).format("M/d/yyyy h:mm:ss"):n.toString()},n._applyBackgroundImageLayout=function(n,i,r,u,f,e){var h=t.GC$(n),o=i,s=r,c="background-position",l="background-size",a,v;switch(e){case 0:h.css(c,"0% 0%").css(l,"100% 100%");break;case 1:a="50%";v="50%";u>o&&(a="0%");f>s&&(v="0%");h.css(c,a+" "+v).css(l,"auto auto");break;case 2:var y=0,p=0,w=o,b=s;s>0&&f>0&&o/s>u/f?(w=u/f*s,y=y+o/2-w/2):o>0&&u>0&&s/o>f/u&&(b=f/u*o,p=p+s/2-b/2);h.css(c,y+"px "+p+"px").css(l,w+"px "+b+"px");break;case 3:h.css(c,"0% 0%").css(l,"auto auto");break;default:break}},n.device=function(){var i=navigator.userAgent,t=i.match(/iPad/i),n,u,r,f;return t&&(n=t[0],n&&(u=n.toLowerCase()==="ipad")),t=i.match(/iPhone/i),t&&(n=t[0],n&&(r=n.toLowerCase()==="iphone")),t=i.match(/android/i),t&&(n=t[0],n&&(r=n.toLowerCase()==="android")),{ipad:u,iphone:r,android:f}},n.isMacOS=function(){var n=navigator.platform;return n&&n.indexOf("Mac")>-1},n.initPaint=function(u){var h=n._isStandardCanvas(),o,f,e,s;h||(o=document.getElementById(u),f=t.GC$(o).data("spread"),f)&&(f._initPaintTimeout!==i&&f._initPaintTimeout!==r&&window.clearTimeout(f._initPaintTimeout),e=f.canvas.firstChild,e&&e.loaded?(s=e.Content.SpreadsheetObject,f.attachSpreadsheetObject(s)):f._initPaintTimeout=window.setTimeout(function(){n.initPaint(u)},10))},n.isType=function(n,t){var u,f;if(n===i||n===r)return t==="null";if(!t)return!1;if(typeof n===t||t==="function"&&/^\s*\bfunction\b/.test(""+n)||Object.prototype.toString.call(n).slice(8,-1).toLowerCase()===t.toLowerCase())return!0;if(n&&n._classNames){for(u=0;u<n._classNames.length;u++)if(f=n._classNames[u],f===t)return!0;return!1}else{if(n===i||n===r)return!1;if(t==="DateTime"||t==="TimeSpan")return n instanceof Date}return typeof t=="string"&&"undefined number boolean string".indexOf(t)>-1?!1:n instanceof t},n.isCustomType=function(n,t){var u,f;if(n===i||n===r)return t==="null";if(!t)return!1;if(n&&n._classNames){for(u=0;u<n._classNames.length;u++)if(f=n._classNames[u],f===t)return!0;return!1}else if(t==="DateTime"||t==="TimeSpan")return n instanceof Date;return t==="function"&&/^\s*\bfunction\b/.test(""+n)?!0:Object.prototype.toString.call(n).slice(8,-1).toLowerCase()===t.toLowerCase()?!0:n instanceof t},n.asCustomType=function(t,i){var u,f;if(t&&t._classNames){for(u=0;u<t._classNames.length;u++)if(f=t._classNames[u],f===i)return t;return r}return n.isType(t,i)?t:r},n.isStringNumber=function(n){if(n===i||n===r)return!1;var t=n.toString();return!isNaN(Number(t.trim()===""?NaN:t))||/^[1-9]\d{0,2}(?:(,\d{3})*|\d*)(?:\.\d*)?$/.test(t)},n.parseText2Value=function(n,u,f,e){var o=r,s,h,c;if(n&&(n.formatter?(o=n.formatter,typeof o=="string"&&(o=new t.GeneralFormatter(o))):o=n._autoFormatter),!o||o instanceof t.AutoFormatter){if(f){h={};c=r;try{c=(new t.GeneralFormatter).GetPreferredDisplayFormatter(u,h)}catch(l){}return e&&(e.value=c),h.hasOwnProperty("value")&&h.value!==i&&h.value!==r?h.value:u}}else{s=r;try{if(s=o.Parse(u),typeof s=="number")return s}catch(l){}return s===i||s===r?u:s}return u},n.getPreferredZIndex=function(n){for(var i=n,r,u;i&&i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return r=1e3,i&&i.parentElement===document.body&&(u=parseInt(t.GC$(i).css("z-index")),isNaN(u)||(r+=u)),r},n.getLinearGradientColors=function(n){var s,r,h,t,c;if(!n)return[];var y=n.indexOf("("),p=n.lastIndexOf(")"),i=n.substring(y+1,p);if(!i)return[];for(var e=[],o=0,l="",s=0,r=0;r<i.length;)s=i.indexOf("rgb",o),r=i.indexOf("rgb",o+1),r===-1&&(r=i.length),l=i.substring(s,r),e.push(l),o=s=r;for(h=[],t=0,c=e.length;t<c;t++){var f=e[t],a=f.indexOf(")"),v=f.substring(0,a+1),u=parseFloat(f.substring(a+1,f.length));(isNaN(u)&&(t===c-1?u=100:t<=1&&(u=0)),v||t!==0)&&(u=u/100,h.push({color:v,point:u}))}return h},n.getColumnAutoFitValue=function(t,i,r,u){var ft=this,b=i._render,c=0,l=[r],a,e,k,p,h,nt,tt;for(u==1&&(r==3?l.push(1):r==2&&l.push(0)),a=0;a<l.length;a++)for(var f=0,r=l[a],it=i.getRowCount(r);f>=0&&f<it;){if(e=i._getSpanModel(r).find(f,t),e&&(e.col<t||e.colCount>1||e.row<f)){f=e.row+e.rowCount;continue}if(i.getRowHeight(f,r)>0){var s=i.getActualStyle(f,t,r),v=0,w=s.cellType||i.getDefaultCellType(r);if(w){k=s.font||b._getDefaultFont(r);s.font=b._getZoomFont(k);p=!!(i.rowFilter()&&i.rowFilter().isFilterHeader(f,t,r));p||r!==3||(h=i.findTable(f,t),h&&h.showHeader()&&h.headerIndex()===f&&h.rowFilter()&&h.filterButtonVisible(t-h.range().col)&&(p=!0));var rt=s.formatter?s.formatter:s._autoFormatter,d={sheet:i,row:f,col:t,sheetArea:r},g=i.getValue(f,t,r),ut=w.format(g,rt,d);v=w.getAutoFitWidth(g,ut,s,i._zoomFactor,d);p&&(nt=o(i._zoomFactor,1),tt=parseInt((i.defaults.rowHeight*nt).toString(),10),v+=tt)}v>c&&(c=v)}r===3?f=n._nextAutoFitRow(f,t,i,r):f++}return c===0?c=i.defaults.colWidth:c+=y(3/i._zoomFactor),c},n._nextAutoFitRow=function(n,t,i,r){for(var o,e,f=-1,s=i.getRowCount(r),u=n+1;u<s;u++){if(o=i.getText(u,t,r),o){f=u;break}if(e=i.getActualStyle(u,t,r),e&&e.cellType){f=u;break}}return f},n.getRowAutoFitValue=function(t,i,r,u){var g=this,v=i._render,o=0,s=[r],h,f,p,nt,e,c,w,l,a;for(u==1&&(r==3?s.push(2):r==1&&s.push(0)),h=0;h<s.length;h++)for(r=s[h],f=0,p=i.getColumnCount(r);f>=0&&f<p;){if(e=i._getSpanModel(r).find(t,f),e&&(e.row<t||e.rowCount>1||e.col<f)){f=e.col+e.colCount;continue}if(i.getColumnWidth(f,r)>0){if(c=i.getActualStyle(t,f,r),w=c.font||v._getDefaultFont(r),c.font=v._getZoomFont(w),l=0,a=i.getCellType(t,f,r),a){var b=i.getText(t,f,r),k=i.getValue(t,f,r),d={sheet:i,row:t,col:f,sheetArea:r};l=a.getAutoFitHeight(k,b,c,i._zoomFactor,d)}l>o&&(o=l)}r===3?f=n._nextAutoFitColumn(t,f,i,r):f++}return o===0?o=i.defaults.rowHeight:o+=y(3/i._zoomFactor),o},n._nextAutoFitColumn=function(n,t,i,r){for(var s,h=r===1,f=i._nextNonNullColumn(n,t,h),u=-1,c=i.getColumnCount(r),e=t+1;e<c;e++)if(s=i.getActualStyle(n,e,r),s&&s.cellType){u=e;break}return f>=0&&u>=0?o(f,u):f>=0?f:u>=0?u:-1},n.formatValue2Text=function(u,f,e){var a,l,s;if(e){var h=e._activeRowIndex,c=e._activeColIndex,o=u.formatter?u.formatter:u._autoFormatter;if(t.features.formatter&&f!==r&&f!==i)if(o instanceof t.AutoFormatter&&o._innerFormatter instanceof t.GeneralFormatter)f=o._innerFormatter.GetPreferredEditingFormatter(f).Format(f);else if(typeof o=="string"&&(o=new t.GeneralFormatter(o)),o)try{l=o.GetFormatType(f);l===2?(s=t.Calc.Convert.DT(f),s&&(f=s),o=f.getHours()===0&&f.getMinutes()===0&&f.getSeconds()===0&&f.getMilliseconds()===0?new t.GeneralFormatter(t.DefaultTokens.DateTimeFormatInfo().shortDatePattern):new t.GeneralFormatter(t.DefaultTokens.DateTimeFormatInfo().shortDatePattern+" "+t.DefaultTokens.DateTimeFormatInfo().longTimePattern),e._editingTimeValue=!0,f=o.Format(f)):typeof f=="number"&&(f=t._NumberHelper.replaceNormalToCultureSymble(f.toString(),o.NumberFormatInfo()))}catch(v){f=e.getText(h,c)}else f=e.getText(h,c)}return f!==r&&f!==i&&(f=n.toString(f)),f},n.browser=function(){var e=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}},i=e(navigator.userAgent),n={},r,u,t,f;return i.browser&&(n[i.browser]=!0,n.version=i.version),n.chrome?n.webkit=!0:n.webkit&&(n.safari=!0),r=navigator.userAgent.toLowerCase(),u=r.indexOf("compatible")<0&&/(trident)(?:.*? rv ([\w.]+)|)/.exec(r)!==null,u&&n&&(n.mozilla=undefined,n.msie=!0),t=/Edge\/\d+/.exec(navigator.userAgent),t!==null&&t.length>0&&n&&(n.webkit=undefined,n.chrome=undefined,n.msie=!0,n.version=t[0].substr(t[0].indexOf("/")+1)),f=function(){var t=null,n=null;try{new ActiveXObject("")}catch(i){t=i.name}try{n=!!new ActiveXObject("htmlfile")}catch(i){n=!1}return n=t!="ReferenceError"&&n==!1?!1:!0,!n},n.msie&&f()&&(n.metroMode=!0),n}(),n}();t.util=s;h=function(){function n(){}return n.showSelection=function(t){n._showSelectionImp(t)},n.hideSelection=function(t){n._hideSelectionImp(t)},n.isActiveElement=function(t){return n.getActiveElement()===t},n.getActiveElement=function(){return window.gcGlobal.activeElement},n.setActiveElement=function(t,i){var r=n.getActiveElement();n._setActiveElementImp(t);t===r||i||(r&&(r.endEdit(),n._hideSelectionImp(r)),n._showSelectionImp(t))},n._setActiveElementImp=function(n){window.gcGlobal.activeElement=n},n._showSelectionImp=function(n){n&&n._render.repaintSelection()},n._hideSelectionImp=function(t){var u,l,f,e;if(t&&!n.isActiveElement(t)&&t.parent&&t.parent.hideSelection()){var o=t._getSheetLayout(),r=t._render,s=r._getCtx(),h=t.getSelections(),c,i;for(u=0,l=h.length;u<l;u++)c=h[u],i=t._getRangeRect2(c),i.width>=0&&i.height>=0&&(i.x-=9,i.y-=9,i.width+=18,i.height+=30,r.copyDoubleBufferRect(i));for(i=o.headerCornerRect(),t._dirty=!0,r.paintBody(s,i),f=0;f<=2;f++)(i=o.rowHeaderRect(f),i&&i.width!==0&&i.height!==0)&&(t._dirty=!0,r.paintBody(s,i));for(e=0;e<=2;e++)(i=o.colHeaderRect(e),i&&i.width!==0&&i.height!==0)&&(t._dirty=!0,r.paintBody(s,i))}},n}();t.FocusHelper=h;l=function(){function n(){this._eventSuspended=0;typeof window.gcGlobal==e&&this._init()}return n.prototype._isIELessThan9=function(n){return s.browser.msie&&(typeof n===e||n<9)},n.prototype._createDummyObjects=function(){var t=n.prototype;t.getDummyHeader();t.getDummyContent();t.getDummyHover();t.getDummyHighlight()},n.prototype.createSpan=function(n,t){var i=document.createElement("span");return i.className=n,t&&(i.id=t),i.style.display="none",document.body.insertBefore(i,r),i},n.prototype.getDummyHeader=function(){var i=n.prototype,u="gc-theme-version ui-widget-header ui-state-default wijmoThemeHelper btn-default",f="span."+u.split(" ").join(".");return i._dummyHeader?t.GC$(document).find(f).length()<=0&&document.body.insertBefore(i._dummyHeader,r):i._dummyHeader=i.createSpan(u),i._dummyHeader},n.prototype.getDummyContent=function(){var i=n.prototype,u="gc-theme-version ui-widget-content wijmoThemeHelper btn-default",f="span."+u.split(" ").join(".");return i._dummyContent?t.GC$(document).find(f).length()<=0&&document.body.insertBefore(i._dummyContent,r):i._dummyContent=i.createSpan(u),i._dummyContent},n.prototype.getDummyHover=function(){var i=n.prototype,u="gc-theme-version ui-state-hover wijmoThemeHelper btn-primary",f="span."+u.split(" ").join(".");return i._dummyHover?t.GC$(document).find(f).length()<=0&&document.body.insertBefore(i._dummyHover,r):i._dummyHover=i.createSpan(u),i._dummyHover},n.prototype.getDummyHighlight=function(){var i=n.prototype,u="gc-theme-version ui-state-highlight wijmoThemeHelper btn-warning",f="span."+u.split(" ").join(".");return i._dummyHighlight?t.GC$(document).find(f).length()<=0&&document.body.insertBefore(i._dummyHighlight,r):i._dummyHighlight=i.createSpan(u),i._dummyHighlight},n.prototype.getDummyElement=function(){var i=n.prototype,f="gc-theme-version",u="gcDummyElement";return i._dummyElement?t.GC$(document).find("#"+u).length()<=0&&document.body.insertBefore(i._dummyElement,r):i._dummyElement=i.createSpan(f,u),i._dummyElement},n.prototype._init=function(){window.gcGlobal=this;this._eventSuspended=0;var i=n.prototype;window.addEventListener&&(window.addEventListener("keydown",i.keyDown,!0),window.addEventListener("keyup",i.keyUp,!0),window.addEventListener("compositionstart",i.compositionStart,!0),document.addEventListener("selectstart",i.docSelectStart,!0));"mousedown touchstart MSPointerDown pointerdown".split(" ").forEach(function(n,u){t.GC$(document).bind(n,function(n){var t=h.getActiveElement(),u,c,f,l,o,e;t&&(u=i.getUIElement(n.target),c=u&&u.getAttribute("gcUIElement")==="gcAttachedFormulaTextBox",u||!t.endEdit||c||(f=d.formulatextboxAcrossSheetInstance,f&&f.dom&&(l=f.sheet,t._formulaTextBox&&(t._formulaTextBox.destroy(),t._formulaTextBox=r,f.clear())),t.endEdit(),o=s.device(),(o.ipad||o.iphone)&&(e=t._eventHandler,e&&e.setFocusToReadonlyFocusElem&&e.setFocusToReadonlyFocusElem())),!u&&t._disposeValidationUI&&t._disposeValidationUI(),u||h.setActiveElement(r))})});t.GC$(document).bind("DOMContentLoaded",function(){n.prototype._createDummyObjects()})},n.prototype.keyDown=function(n){var f=window.gcGlobal,i,r,u;f._eventSuspended>0||(i=h.getActiveElement(),r=i&&i._validationSelect,r&&(u=t.GC$(r),u.isVisible()))||i&&i.doKeyDown&&(i.doKeyDown(n),i.isEditing()||((n.keyCode===90||n.keyCode===89)&&n.ctrlKey&&!n.altKey?s.cancelDefault(n):n.keyCode===86&&n.ctrlKey&&!n.altKey&&n.stopPropagation&&n.stopPropagation()))},n.prototype.keyUp=function(n){var i=window.gcGlobal,t;i._eventSuspended>0||(t=h.getActiveElement(),t&&t.doKeyUp&&t.doKeyUp(n))},n.prototype.compositionStart=function(n){var i=window.gcGlobal,t;i._eventSuspended>0||(t=h.getActiveElement(),t&&t.doCompositionStart&&t.doCompositionStart(n))},n.prototype.docSelectStart=function(n){return document.all===i&&h.getActiveElement()&&s.cancelDefault(n),!1},n.prototype.getUIElement=function(n){for(var t=n,i;t&&t.tagName!=="BODY";){if(typeof t.getAttribute!="function")break;if(i=t.getAttribute("gcUIElement"),i||(i=t.gcUIElement),i)return t;t=t.parentNode}return r},n.prototype.getExternalThemeStyle=function(r,u){var s=n.prototype,o=s.getDummyHeader(),h,f,c,e;return r===1||r===2?o=s.getDummyHighlight():r===4&&(o=s.getDummyHover()),h=o.className,t.GC$(o).removeClass(h).addClass(u),f=o.currentStyle,document.defaultView&&document.defaultView.getComputedStyle&&(f=document.defaultView.getComputedStyle(o,"")),c={backgroundColor:f.backgroundColor,backgroundImage:f.backgroundImage},t.GC$(o).addClass(h),document.defaultView&&document.defaultView.getComputedStyle&&(f=document.defaultView.getComputedStyle(o,"")),e={backgroundColor:f.backgroundColor,backgroundImage:f.backgroundImage,color:f.color,zIndex:f.zIndex},e.borderLeftColor=f.borderLeftColor,e.borderRightColor=f.borderRightColor,e.borderBottomColor=f.borderBottomColor,e.borderBottomWidth=f.borderBottomWidth,e.borderTopColor=f.borderTopColor,e.borderRightWidth=f.borderRightWidth,e.backgroundImage===c.backgroundImage&&e.backgroundColor!==c.backgroundColor&&(e.backgroundImage=i),t.GC$(o).removeClass(u),e},n.prototype.getStyleByCssClass=function(i){var f=n.prototype,r=f.getDummyElement(),u=r.currentStyle;return t.GC$(r).removeClass(r.className).addClass("gc-theme-version "+i),document.defaultView&&document.defaultView.getComputedStyle&&(u=document.defaultView.getComputedStyle(r,"")),t.GC$.extend({},u)},n.prototype.getThemeContentStyle=function(i){var r=n.prototype.getDummyContent(),u=r.currentStyle;return t.GC$(r).removeClass(r.className).addClass("gc-theme-version ui-widget-content wijmoThemeHelper btn-default "+i),document.defaultView&&document.defaultView.getComputedStyle&&(u=document.defaultView.getComputedStyle(r,"")),t.GC$.extend({},u)},n.prototype.suspendEvent=function(){var n=window.gcGlobal;n._eventSuspended++},n.prototype.resumeEvent=function(){var n=window.gcGlobal;n._eventSuspended--;n._eventSuspended<0&&(n._eventSuspended=0)},n}();t.Global=l;window.gcGlobal=new l;nt=function(){function n(){}return n.getVisualStateThemeStyle=function(t,i){var r=et[t]+i,u=n.styleCache;return u[r]||(u[r]=l.prototype.getExternalThemeStyle(t,i)),u[r]},n.getCssClassThemeStyle=function(t){var i=t,r=n.styleCache;return r[i]||(r[i]=l.prototype.getStyleByCssClass(t)),r[i]},n.getContentThemeStyle=function(t){var i="content"+t,r=n.styleCache;return r[i]||(r[i]=l.prototype.getThemeContentStyle(t)),r[i]},n.clearCache=function(){n.styleCache={}},n.styleCache={},n}();t.ThemeStyleHelper=nt;a=function(){function n(){}return n.insert=function(n,t,i){n.splice(t,0,i)},n.add=function(n,t){n[n.length]=t},n.contains=function(n,t){for(var i=0;i<n.length;i++)if(n[i]===t)return!0;return!1},n.remove=function(n,t){for(var i=0;i<n.length;i++)if(n[i]===t){n.splice(i,1);return}},n.removeByIndex=function(n,t){return n.slice(0,t).concat(n.slice(t+1))},n.indexOf=function(n,t,i){if(typeof t===e)return-1;i=i||0;for(var r=i;r<n.length;r++)if(n[r]===t)return r;return-1},n.map=function(n,i,r){var s,e,u,f,o,h,c;if(!Array.prototype.map){if(f=window.Object(n),o=f.length>>>0,typeof i!="function")throw new TypeError(t._StringHelper.format(t.SR.Exp_NotAFunction,[i]));for(r&&(s=r),e=new Array(o),u=0;u<o;)u in f&&(h=f[u],c=i.call(s,h,u,f),e[u]=c),u++;return e}return n.map(i,r)},n.clear=function(n,t,i){var f,u;if(!(t<0))for(f=0,u=0;f<i&&u<n.length;u++)n[t+u]=r,f++},n.nextNonEmptyIndex=function(n,t){var f,u;for(t<0&&(t=-1),f=t+1,u=f;u<n.length;u++)if(n[u]!==i&&n[u]!==r)return u;return-1},n.isEquals=function(n,t){var u,i,r;if(n==null&&t==null)return!0;if(n==null&&t!=null||n!=null&&t==null||n!=null&&t!=null&&(!(n instanceof Array)||!(t instanceof Array))||n.length!==t.length)return!1;for(u=[],i=0,r=n.length;i<r;i++)u[n[i]]=!0;for(i=0,r=t.length;i<r;i++)if(!u[t[i]])return!1;return!0},n}();t.ArrayHelper=a,function(n){n[n.left=37]="left";n[n.right=39]="right";n[n.up=38]="up";n[n.down=40]="down";n[n.tab=9]="tab";n[n.enter=13]="enter";n[n.shift=16]="shift";n[n.ctrl=17]="ctrl";n[n.space=32]="space";n[n.altkey=18]="altkey";n[n.home=36]="home";n[n.end=35]="end";n[n.pup=33]="pup";n[n.pdn=34]="pdn";n[n.backspace=8]="backspace";n[n.del=46]="del";n[n.esc=27]="esc";n[n.a=65]="a";n[n.c=67]="c";n[n.v=86]="v";n[n.x=88]="x";n[n.z=90]="z";n[n.y=89]="y"}(t.Key||(t.Key={}));ei=t.Key;tt=function(){function n(n,t,i,r,u,f){var e=this;e.key=n;e.ctrl=t;e.shift=i;e.alt=r;e.meta=f&&u||!1;e.action=f||u}return n}();t.KeyMap=tt;it=function(){function n(n,t){this.x=n;this.y=t}return n.prototype.clone=function(){return new n(this.x,this.y)},n}();t.Point=it;rt=function(){function n(n,t,i,r){var u=this;u.x=n;u.y=t;u.width=i;u.height=r}return n.prototype.intersect=function(n,t,i,r){var u=this;return n<u.x+u.width&&u.x<n+i&&t<u.y+u.height&&u.y<t+r},n.prototype.intersectRect=function(n){var t=this;return n.x<t.x+t.width&&t.x<n.x+n.width&&n.y<t.y+t.height&&t.y<n.y+n.height},n.prototype.contains=function(n,t){var i=this;return n<i.x+i.width&&i.x<n&&t<i.y+i.height&&i.y<t},n.prototype.containsRect=function(n){var t=this;return t.x<n.x&&n.x+n.width<t.x+t.width&&t.y<n.y&&n.y+n.height<t.y+t.height},n.prototype.getIntersectRect=function(n){return this.getIntersect(n.x,n.y,n.width,n.height)},n.prototype.getIntersect=function(t,i,u,e){var s=this,v=s.x,y=s.y,p=s.x+s.width,w=s.y+s.height,b=t,k=i,d=t+u,g=i+e,h=f(v,b),c=f(y,k),nt=o(p,d),tt=o(w,g),it=h,rt=c,l=nt-h,a=tt-c;return l>0&&a>0?new n(it,rt,l,a):r},n.prototype.round=function(){var n=this;n.x=v(n.x);n.y=v(n.y);n.width=y(n.width);n.height=y(n.height)},n.empty=function(){return new n(0,0,0,0)},n}();t.Rect=rt;ut=function(){function n(n,t,i,r){var u=this;u.row=n;u.rowCount=i;u.col=t;u.colCount=r}return n.prototype.intersect=function(n,t,i,r){var u=this;return(n===-1||u.row===-1||u.row<n+i&&n<u.row+u.rowCount)&&(t===-1||u.col===-1||u.col<t+r&&t<u.col+u.colCount)},n.prototype.getIntersect=function(t,i,u){var e;if(t==r||(e=this,!e.intersect(t.row,t.col,t.rowCount,t.colCount)))return r;var c=e.col==-1?u:e.col+e.colCount-1,l=t.col==-1?u:t.col+t.colCount-1,a=e.row==-1?i:e.row+e.rowCount-1,v=t.row==-1?i:t.row+t.rowCount-1,s=f(e.col,t.col),y=o(c,l),h=f(e.row,t.row),p=o(a,v),w=h==-1?-1:p-h+1,b=s==-1?-1:y-s+1;return new n(h,s,w,b)},n.prototype.contains=function(t,i,r,u){var f=this;if(arguments.length===2)return(f.row===-1||f.row<=t&&t<f.row+f.rowCount)&&(f.col===-1||f.col<=i&&i<f.col+f.colCount);else if(arguments.length===4)return f.containsRange(new n(t,i,r,u));return!1},n.prototype.containsRange=function(n){var t=this;return(t.row===-1||t.row<=n.row&&n.row+n.rowCount<=t.row+t.rowCount)&&(t.col===-1||t.col<=n.col&&n.col+n.colCount<=t.col+t.colCount)},n.prototype.offset=function(t,i){var r=this,u=r.col,f=r.row;return r.col!==-1&&(u+=t),r.row!==-1&&(f+=i),new n(f,u,r.rowCount,r.colCount)},n.prototype.union=function(t){var i=this,r=o(i.row,t.row),u=o(i.col,t.col),e=f(i.row+i.rowCount-1,t.row+t.rowCount-1),s=f(i.col+i.colCount-1,t.col+t.colCount-1);return new n(r,u,e-r+1,s-u+1)},n.prototype.equals=function(t){var i=this;return t instanceof n?i.row===t.row&&i.col===t.col&&i.rowCount===t.rowCount&&i.colCount===t.colCount:!1},n}();t.Range=ut;ft=function(){function n(n,t){this.row=n;this.col=t}return n}();t.CellPosition=ft,function(n){n[n.DragDrop=0]="DragDrop";n[n.DragFill=1]="DragFill";n[n.Clear=2]="Clear";n[n.Paste=3]="Paste";n[n.Sort=4]="Sort";n[n.SetArrayFormula=5]="SetArrayFormula";n[n.EvaluateFormula=6]="EvaluateFormula"}(t.RangeChangedAction||(t.RangeChangedAction={}));oi=t.RangeChangedAction,function(n){n[n.up=1]="up";n[n.down=2]="down";n[n.left=3]="left";n[n.right=4]="right";n[n.first=5]="first";n[n.last=6]="last"}(t.Direction||(t.Direction={}));si=t.Direction,function(n){n[n.left=0]="left";n[n.center=1]="center";n[n.right=2]="right";n[n.general=3]="general"}(t.HorizontalAlign||(t.HorizontalAlign={}));hi=t.HorizontalAlign,function(n){n[n.top=0]="top";n[n.center=1]="center";n[n.bottom=2]="bottom"}(t.VerticalAlign||(t.VerticalAlign={}));ci=t.VerticalAlign,function(n){n[n.left=0]="left";n[n.center=1]="center";n[n.right=2]="right";n[n.nearest=3]="nearest"}(t.HorizontalPosition||(t.HorizontalPosition={}));li=t.HorizontalPosition,function(n){n[n.top=0]="top";n[n.center=1]="center";n[n.bottom=2]="bottom";n[n.nearest=3]="nearest"}(t.VerticalPosition||(t.VerticalPosition={}));ai=t.VerticalPosition,function(n){n[n.blank=0]="blank";n[n.numbers=1]="numbers";n[n.letters=2]="letters"}(t.HeaderAutoText||(t.HeaderAutoText={}));vi=t.HeaderAutoText,function(n){n[n.All=0]="All";n[n.Values=1]="Values";n[n.Formatting=2]="Formatting";n[n.Formulas=3]="Formulas"}(t.ClipboardPasteOptions||(t.ClipboardPasteOptions={}));yi=t.ClipboardPasteOptions,function(n){n[n.None=0]="None";n[n.IncludeRowHeader=1]="IncludeRowHeader";n[n.IncludeColumnHeader=2]="IncludeColumnHeader";n[n.UnFormatted=8]="UnFormatted";n[n.ImportFormula=16]="ImportFormula"}(t.TextFileOpenFlags||(t.TextFileOpenFlags={}));pi=t.TextFileOpenFlags,function(n){n[n.Normal=0]="Normal";n[n.Highlight=1]="Highlight";n[n.Selected=2]="Selected";n[n.Active=3]="Active";n[n.Hover=4]="Hover"}(t.VisualState||(t.VisualState={}));et=t.VisualState,function(n){n[n.A1=0]="A1";n[n.R1C1=1]="R1C1"}(t.ReferenceStyle||(t.ReferenceStyle={}));wi=t.ReferenceStyle,function(n){n[n.empty=0]="empty";n[n.thin=1]="thin";n[n.medium=2]="medium";n[n.dashed=3]="dashed";n[n.dotted=4]="dotted";n[n.thick=5]="thick";n[n.double=6]="double";n[n.hair=7]="hair";n[n.mediumDashed=8]="mediumDashed";n[n.dashDot=9]="dashDot";n[n.mediumDashDot=10]="mediumDashDot";n[n.dashDotDot=11]="dashDotDot";n[n.mediumDashDotDot=12]="mediumDashDotDot";n[n.slantedDashDot=13]="slantedDashDot"}(t.LineStyle||(t.LineStyle={}));b=t.LineStyle,function(n){n[n.corner=0]="corner";n[n.colHeader=1]="colHeader";n[n.rowHeader=2]="rowHeader";n[n.viewport=3]="viewport"}(t.SheetArea||(t.SheetArea={}));bi=t.SheetArea,function(n){n[n.Value=1]="Value";n[n.Formula=2]="Formula";n[n.Comment=4]="Comment";n[n.RangeGroup=8]="RangeGroup";n[n.Sparkline=16]="Sparkline";n[n.Span=32]="Span";n[n.Style=64]="Style";n[n.Tag=128]="Tag";n[n.BindingPath=256]="BindingPath";n[n.ConditionalFormat=512]="ConditionalFormat";n[n.All=1023]="All"}(t.CopyToOption||(t.CopyToOption={}));ki=t.CopyToOption,function(n){n[n.Single=0]="Single";n[n.Range=1]="Range";n[n.MultiRange=2]="MultiRange"}(t.SelectionPolicy||(t.SelectionPolicy={}));di=t.SelectionPolicy,function(n){n[n.Cell=0]="Cell";n[n.Row=1]="Row";n[n.Column=2]="Column"}(t.SelectionUnit||(t.SelectionUnit={}));gi=t.SelectionUnit,function(n){n[n.CopyCells=0]="CopyCells";n[n.FillSeries=1]="FillSeries";n[n.FillFormattingOnly=2]="FillFormattingOnly";n[n.FillWithoutFormatting=3]="FillWithoutFormatting";n[n.ClearValues=4]="ClearValues";n[n.Auto=5]="Auto"}(t.AutoFillType||(t.AutoFillType={}));nr=t.AutoFillType,function(n){n[n.Left=0]="Left";n[n.Right=1]="Right";n[n.Up=2]="Up";n[n.Down=3]="Down"}(t.FillDirection||(t.FillDirection={}));tr=t.FillDirection,function(n){n[n.Column=0]="Column";n[n.Row=1]="Row"}(t.FillSeries||(t.FillSeries={}));ir=t.FillSeries,function(n){n[n.Data=1]="Data";n[n.Style=2]="Style";n[n.Comment=4]="Comment";n[n.Tag=8]="Tag";n[n.Sparkline=16]="Sparkline";n[n.Axis=32]="Axis";n[n.BindingPath=64]="BindingPath"}(t.StorageType||(t.StorageType={}));rr=t.StorageType,function(n){n[n.Left=0]="Left";n[n.Right=1]="Right";n[n.Up=2]="Up";n[n.Down=3]="Down";n[n.LeftClear=4]="LeftClear";n[n.UpClear=5]="UpClear"}(t.DragFillDirection||(t.DragFillDirection={}));ur=t.DragFillDirection,function(n){n[n.Ready=0]="Ready";n[n.Enter=1]="Enter";n[n.Edit=2]="Edit"}(t.EditorStatus||(t.EditorStatus={}));fr=t.EditorStatus,function(n){n[n.AnyValue=0]="AnyValue";n[n.WholeNumber=1]="WholeNumber";n[n.DecimalValues=2]="DecimalValues";n[n.List=3]="List";n[n.Date=4]="Date";n[n.Time=5]="Time";n[n.TextLength=6]="TextLength";n[n.Custom=7]="Custom"}(t.CriteriaType||(t.CriteriaType={}));er=t.CriteriaType,function(n){n[n.ForceApply=0]="ForceApply";n[n.Discard=1]="Discard";n[n.Retry=2]="Retry"}(t.DataValidationResult||(t.DataValidationResult={}));or=t.DataValidationResult,function(n){n[n.Stop=0]="Stop";n[n.Warning=1]="Warning";n[n.Information=2]="Information"}(t.ErrorStyle||(t.ErrorStyle={}));sr=t.ErrorStyle,function(n){n[n.EqualsTo=0]="EqualsTo";n[n.NotEqualsTo=1]="NotEqualsTo";n[n.GreaterThan=2]="GreaterThan";n[n.GreaterThanOrEqualsTo=3]="GreaterThanOrEqualsTo";n[n.LessThan=4]="LessThan";n[n.LessThanOrEqualsTo=5]="LessThanOrEqualsTo"}(t.GeneralCompareType||(t.GeneralCompareType={}));hr=t.GeneralCompareType,function(n){n[n.Or=0]="Or";n[n.And=1]="And"}(t.RelationCompareType||(t.RelationCompareType={}));cr=t.RelationCompareType,function(n){n[n.EqualsTo=0]="EqualsTo";n[n.NotEqualsTo=1]="NotEqualsTo";n[n.GreaterThan=2]="GreaterThan";n[n.GreaterThanOrEqualsTo=3]="GreaterThanOrEqualsTo";n[n.LessThan=4]="LessThan";n[n.LessThanOrEqualsTo=5]="LessThanOrEqualsTo";n[n.Between=6]="Between";n[n.NotBetween=7]="NotBetween"}(t.ComparisonOperator||(t.ComparisonOperator={}));lr=t.ComparisonOperator,function(n){n[n.Contains=0]="Contains";n[n.DoesNotContain=1]="DoesNotContain";n[n.BeginsWith=2]="BeginsWith";n[n.EndsWith=3]="EndsWith"}(t.TextComparisonOperator||(t.TextComparisonOperator={}));ar=t.TextComparisonOperator,function(n){n[n.EqualsTo=0]="EqualsTo";n[n.NotEqualsTo=1]="NotEqualsTo";n[n.BeginsWith=2]="BeginsWith";n[n.DoesNotBeginWith=3]="DoesNotBeginWith";n[n.EndsWith=4]="EndsWith";n[n.DoesNotEndWith=5]="DoesNotEndWith";n[n.Contains=6]="Contains";n[n.DoesNotContain=7]="DoesNotContain"}(t.TextCompareType||(t.TextCompareType={}));vr=t.TextCompareType,function(n){n[n.BackgroundColor=0]="BackgroundColor";n[n.ForegroundColor=1]="ForegroundColor"}(t.ColorCompareType||(t.ColorCompareType={}));yr=t.ColorCompareType,function(n){n[n.Empty=0]="Empty";n[n.NonEmpty=1]="NonEmpty";n[n.Error=2]="Error";n[n.NonError=3]="NonError";n[n.Formula=4]="Formula"}(t.CustomValueType||(t.CustomValueType={}));pr=t.CustomValueType,function(n){n[n.EqualsTo=0]="EqualsTo";n[n.NotEqualsTo=1]="NotEqualsTo";n[n.Before=2]="Before";n[n.BeforeEqualsTo=3]="BeforeEqualsTo";n[n.After=4]="After";n[n.AfterEqualsTo=5]="AfterEqualsTo"}(t.DateCompareType||(t.DateCompareType={}));wr=t.DateCompareType,function(n){n[n.Top=0]="Top";n[n.Bottom=1]="Bottom"}(t.Top10ConditionType||(t.Top10ConditionType={}));br=t.Top10ConditionType,function(n){n[n.Today=0]="Today";n[n.Yesterday=1]="Yesterday";n[n.Tomorrow=2]="Tomorrow";n[n.Last7Days=3]="Last7Days";n[n.ThisMonth=4]="ThisMonth";n[n.LastMonth=5]="LastMonth";n[n.NextMonth=6]="NextMonth";n[n.ThisWeek=7]="ThisWeek";n[n.LastWeek=8]="LastWeek";n[n.NextWeek=9]="NextWeek"}(t.DateOccurringType||(t.DateOccurringType={}));kr=t.DateOccurringType,function(n){n[n.Quarter1=0]="Quarter1";n[n.Quarter2=1]="Quarter2";n[n.Quarter3=2]="Quarter3";n[n.Quarter4=3]="Quarter4"}(t.QuarterType||(t.QuarterType={}));dr=t.QuarterType,function(n){n[n.None=0]="None";n[n.Ascending=1]="Ascending";n[n.Descending=2]="Descending"}(t.SortState||(t.SortState={}));gr=t.SortState,function(n){n[n.Above=0]="Above";n[n.Below=1]="Below";n[n.EqualOrAbove=2]="EqualOrAbove";n[n.EqualOrBelow=3]="EqualOrBelow";n[n.Above1StdDev=4]="Above1StdDev";n[n.Below1StdDev=5]="Below1StdDev";n[n.Above2StdDev=6]="Above2StdDev";n[n.Below2StdDev=7]="Below2StdDev";n[n.Above3StdDev=8]="Above3StdDev";n[n.Below3StdDev=9]="Below3StdDev"}(t.AverageConditionType||(t.AverageConditionType={}));nu=t.AverageConditionType,function(n){n[n.Number=0]="Number";n[n.LowestValue=1]="LowestValue";n[n.HighestValue=2]="HighestValue";n[n.Percent=3]="Percent";n[n.Percentile=4]="Percentile";n[n.Automin=5]="Automin";n[n.Formula=6]="Formula";n[n.Automax=7]="Automax"}(t.ScaleValueType||(t.ScaleValueType={}));tu=t.ScaleValueType,function(n){n[n.LeftToRight=0]="LeftToRight";n[n.RightToLeft=1]="RightToLeft"}(t.BarDirection||(t.BarDirection={}));iu=t.BarDirection,function(n){n[n.Automatic=0]="Automatic";n[n.CellMidPoint=1]="CellMidPoint";n[n.None=2]="None"}(t.DataBarAxisPosition||(t.DataBarAxisPosition={}));ru=t.DataBarAxisPosition,function(n){n[n.ThreeArrowsColored=0]="ThreeArrowsColored";n[n.ThreeArrowsGray=1]="ThreeArrowsGray";n[n.ThreeTriangles=2]="ThreeTriangles";n[n.ThreeStars=3]="ThreeStars";n[n.ThreeFlags=4]="ThreeFlags";n[n.ThreeTrafficLightsUnrimmed=5]="ThreeTrafficLightsUnrimmed";n[n.ThreeTrafficLightsRimmed=6]="ThreeTrafficLightsRimmed";n[n.ThreeSigns=7]="ThreeSigns";n[n.ThreeSymbolsCircled=8]="ThreeSymbolsCircled";n[n.ThreeSymbolsUncircled=9]="ThreeSymbolsUncircled";n[n.FourArrowsColored=10]="FourArrowsColored";n[n.FourArrowsGray=11]="FourArrowsGray";n[n.FourRedToBlack=12]="FourRedToBlack";n[n.FourRatings=13]="FourRatings";n[n.FourTrafficLights=14]="FourTrafficLights";n[n.FiveArrowsColored=15]="FiveArrowsColored";n[n.FiveArrowsGray=16]="FiveArrowsGray";n[n.FiveRatings=17]="FiveRatings";n[n.FiveQuarters=18]="FiveQuarters";n[n.FiveBoxes=19]="FiveBoxes"}(t.IconSetType||(t.IconSetType={}));uu=t.IconSetType,function(n){n[n.Number=1]="Number";n[n.Percent=4]="Percent";n[n.Formula=7]="Formula";n[n.Percentile=5]="Percentile"}(t.IconValueType||(t.IconValueType={}));fu=t.IconValueType,function(n){n[n.Backward=0]="Backward";n[n.Forward=1]="Forward"}(t.RangeGroupDirection||(t.RangeGroupDirection={}));eu=t.RangeGroupDirection,function(n){n[n.None=0]="None";n[n.Column=1]="Column";n[n.Row=2]="Row";n[n.Both=3]="Both"}(t.ShowResizeTip||(t.ShowResizeTip={}));ou=t.ShowResizeTip,function(n){n[n.None=0]="None";n[n.Horizontal=1]="Horizontal";n[n.Vertical=2]="Vertical";n[n.Both=3]="Both"}(t.ShowScrollTip||(t.ShowScrollTip={}));su=t.ShowScrollTip,function(n){n[n.Cell=0]="Cell";n[n.CellWithHeader=1]="CellWithHeader"}(t.AutoFitType||(t.AutoFitType={}));hu=t.AutoFitType,function(n){n[n.Stretch=0]="Stretch";n[n.Center=1]="Center";n[n.Zoom=2]="Zoom";n[n.None=3]="None"}(t.ImageLayout||(t.ImageLayout={}));cu=t.ImageLayout,function(n){n[n.SetFormula=0]="SetFormula";n[n.CopyPaste=1]="CopyPaste";n[n.DragFill=2]="DragFill";n[n.DragDrop=3]="DragDrop";n[n.ChangePartOfArrayFormula=4]="ChangePartOfArrayFormula";n[n.ChangeSheetName=5]="ChangeSheetName"}(t.InvalidOperationType||(t.InvalidOperationType={}));lu=t.InvalidOperationType,function(n){n[n.CurrentCulture=0]="CurrentCulture";n[n.CurrentCultureIgnoreCase=1]="CurrentCultureIgnoreCase";n[n.InvariantCulture=2]="InvariantCulture";n[n.InvariantCultureIgnoreCase=3]="InvariantCultureIgnoreCase";n[n.Ordinal=4]="Ordinal";n[n.OrdinalIgnoreCase=5]="OrdinalIgnoreCase"}(t.StringComparison||(t.StringComparison={}));au=t.StringComparison,function(n){n[n.Underline=1]="Underline";n[n.LineThrough=2]="LineThrough";n[n.Overline=4]="Overline";n[n.None=0]="None"}(t.TextDecorationType||(t.TextDecorationType={}));vu=t.TextDecorationType,function(n){n[n.Filter=0]="Filter";n[n.Unfilter=1]="Unfilter"}(t.FilterActionType||(t.FilterActionType={}));yu=t.FilterActionType,function(n){n[n.Auto=1]="Auto";n[n.Active=2]="Active";n[n.Inactive=4]="Inactive";n[n.Disabled=0]="Disabled"}(t.ImeMode||(t.ImeMode={}));pu=t.ImeMode,function(n){n[n.Active=1]="Active";n[n.Edit=2]="Edit";n[n.Normal=3]="Normal"}(t.CommentState||(t.CommentState={}));wu=t.CommentState,function(n){n[n.DataModified=0]="DataModified";n[n.DataAdded=1]="DataAdded";n[n.DataRemoved=2]="DataRemoved"}(t.SlicerDataChangeReason||(t.SlicerDataChangeReason={}));bu=t.SlicerDataChangeReason,function(n){n[n.Default=0]="Default";n[n.Enhanced=1]="Enhanced"}(t.ResizeZeroIndicator||(t.ResizeZeroIndicator={}));ku=t.ResizeZeroIndicator;c=function(){function n(n,t){this.color=n||"black";this.style=t||0}return n.prototype.width=function(n){var t=b;if(n&&n.style)switch(n.style){case 9:case 1:case 3:case 4:case 7:case 11:return 1;case 2:case 10:case 12:case 8:case 13:return 2;case 5:case 6:return 3}return 0},n.getLineWeight=function(t){var i=n._styleWeightCache,r;return i||(i=[],n._styleWeightCache=i,r=b,i[9]=100,i[3]=100,i[4]=100,i[11]=100,i[7]=100,i[1]=101,i[13]=198,i[8]=198,i[10]=198,i[12]=198,i[2]=199,i[5]=300,i[6]=90,i[0]=0),i[t]},n.prototype.toJSON=function(){var n={};return(this.color!=="black"&&(n.color=this.color),this.style!==0&&(n.style=this.style),t.GC$.isEmptyObject(n))?i:n},n.prototype.fromJSON=function(n,t){n&&(n.color!==i&&(this.color=n.color),n.style!==i&&(this.style=n.style))},n}();t.LineBorder=c;ot=function(){var n={};return n["font-style"]=function(n,i){n&&t.GC$(i).css("fontStyle",n)},n["font-variant"]=function(n,i){n&&t.GC$(i).css("fontVariant",n)},n["font-weight"]=function(n,i){n&&t.GC$(i).css("fontWeight",n)},n["font-size"]=function(n,i){n&&t.GC$(i).css("fontSize",n)},n["line-height"]=function(n,i){n&&t.GC$(i).css("lineHeight",n)},n["font-family"]=function(n,i){n&&t.GC$(i).css("fontFamily",n)},n}();ht=function(){function n(n){this._sheet=n}return n.prototype.buildFont=function(n,i){var e="",u,f;if(n){u=du(this._sheet);try{i&&t.GC$(u.span).css("font",i);t.GC$.each(ot,function(t,i){i(n.hasOwnProperty(t)?n[t]:r,u.span)})}finally{f=u.span.currentStyle;document.defaultView&&document.defaultView.getComputedStyle&&(f=document.defaultView.getComputedStyle(u.span,""));e=st(f);u.dispose()}}return e},n}();t.FontFactory=ht,function(n){n[n.BaseCellType=0]="BaseCellType";n[n.TextCellType=1]="TextCellType";n[n.ColumnHeaderCellType=2]="ColumnHeaderCellType";n[n.RowHeaderCellType=3]="RowHeaderCellType";n[n.CornerCellType=4]="CornerCellType";n[n.CheckBoxCellType=5]="CheckBoxCellType";n[n.ButtonCellType=6]="ButtonCellType";n[n.ComboBoxCellType=7]="ComboBoxCellType";n[n.HyperLinkCellType=8]="HyperLinkCellType"}(t.CellTypeKind||(t.CellTypeKind={}));gu=t.CellTypeKind,function(n){n[n.Never=0]="Never";n[n.Always=1]="Always";n[n.Auto=2]="Auto"}(t.FocusPolicy||(t.FocusPolicy={}));nf=t.FocusPolicy,function(n){n[n.Excel2007=2007]="Excel2007";n[n.Excel2013=2013]="Excel2013";n[n.Excel2016=2016]="Excel2016"}(t.ThemeVersion||(t.ThemeVersion={}));tf=t.ThemeVersion;ct=function(){function u(n,t,r,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut){if(this._id=u._styleId++,arguments.length!==0){var ft=this;ft.backgroundImage=b;ft.backgroundImageLayout=d;ft.backColor=n;ft.foreColor=t;ft.hAlign=r;ft.vAlign=f;ft.font=e;ft.themeFont=o;ft.formatter=s;ft.borderLeft=h;ft.borderTop=c;ft.borderRight=l;ft.borderBottom=a;ft.locked=v;ft.textIndent=y;ft.wordWrap=p;ft.shrinkToFit=w;ft.validator=i;ft.cellType=k;ft.tabStop=g;ft.textDecoration=nt;ft.imeMode=tt;ft.name=it;ft.parentName=rt;ft.watermark=ut}}return u.prototype._initDefault=function(){var n=this;n.backgroundImage=i;n.backgroundImageLayout=i;n.backColor=i;n.foreColor=i;n.hAlign=i;n.vAlign=i;n.font=i;n.themeFont=i;n.formatter=i;n.validator=i;n.borderLeft=i;n.borderTop=i;n.borderRight=i;n.borderBottom=i;n.locked=i;n.textIndent=i;n.wordWrap=i;n.shrinkToFit=i;n.cellType=i;n.name=i;n.parentName=i;n.tabStop=i;n.textDecoration=i;n.imeMode=i;n.watermark=i},u.prototype.copyFrom=function(n){this.fromJSON(n.toJSON());n._autoFormatter&&(this._autoFormatter=n._autoFormatter)},u.prototype._copyFormat=function(i){var r=i,u,f;return t.features.formatter&&r&&r.constructor===Object&&(u=i.typeName,u?(f=n.Sheets.getTypeFromString(u),f&&(r=new f,r.fromJSON(i))):r=new t.GeneralFormatter(i.formatCached,i.formatModeType,i.customerCultureName)),r},u.prototype._cloneLineBorder=function(n){return n&&n instanceof c?new c(n.color,n.style):n},u.prototype.compose=function(n,t){var r=this,u=r._cloneLineBorder,f,e,o,s;t?(r._autoFormatter=n._autoFormatter,r.backgroundImage=n.backgroundImage,r.backgroundImageLayout=n.backgroundImageLayout,r.backColor=n.backColor,r.foreColor=n.foreColor,r.hAlign=n.hAlign,r.vAlign=n.vAlign,r.font=n.font,r.themeFont=n.themeFont,r.formatter=n.formatter,f=n.borderLeft,r.borderLeft=f&&u(f)||f,e=n.borderTop,r.borderTop=e&&u(e)||e,o=n.borderRight,r.borderRight=o&&u(o)||o,s=n.borderBottom,r.borderBottom=s&&u(s)||s,r.locked=n.locked,r.textIndent=n.textIndent,r.wordWrap=n.wordWrap,r.shrinkToFit=n.shrinkToFit,r.validator=n.validator,r.cellType=n.cellType,r.name=n.name,r.parentName=n.parentName,r.tabStop=n.tabStop,r.textDecoration=n.textDecoration,r.imeMode=n.imeMode,r.watermark=n.watermark):(r.backgroundImage===i&&(r.backgroundImage=n.backgroundImage),r.backgroundImageLayout===i&&(r.backgroundImageLayout=n.backgroundImageLayout),r.backColor===i&&(r.backColor=n.backColor),r.foreColor===i&&(r.foreColor=n.foreColor),r.hAlign===i&&(r.hAlign=n.hAlign),r.vAlign===i&&(r.vAlign=n.vAlign),r.themeFont===i&&r.font===i?(r.themeFont=n.themeFont,r.font=n.font):r.themeFont!==i&&r.font===i&&(r.font=n.font),r.formatter===i&&(r.formatter=n.formatter),r.validator===i&&(r.validator=n.validator),r._autoFormatter===i&&(r._autoFormatter=n._autoFormatter),r.borderLeft===i&&(f=n.borderLeft,r.borderLeft=f&&u(f)||f),r.borderTop===i&&(e=n.borderTop,r.borderTop=e&&u(e)||e),r.borderRight===i&&(o=n.borderRight,r.borderRight=o&&u(o)||o),r.borderBottom===i&&(s=n.borderBottom,r.borderBottom=s&&u(s)||s),r.locked===i&&(r.locked=n.locked),r.textIndent===i&&(r.textIndent=n.textIndent),r.wordWrap===i&&(r.wordWrap=n.wordWrap),r.shrinkToFit===i&&(r.shrinkToFit=n.shrinkToFit),r.cellType===i&&(r.cellType=n.cellType),r.tabStop===i&&(r.tabStop=n.tabStop),r.textDecoration===i&&(r.textDecoration=n.textDecoration),r.imeMode===i&&(r.imeMode=n.imeMode),r.name===i&&(r.name=n.name),r.parentName===i&&(r.parentName=n.parentName),r.watermark===i&&(r.watermark=n.watermark))},u.prototype.clear=function(n){if(arguments.length===0){this._initDefault();return}n==="dataValidator"&&(n="validator");this[n]=i},u.prototype.clone=function(n){var t=this,i=t._cloneLineBorder,r=new u(t.backColor,t.foreColor,t.hAlign,t.vAlign,t.font,t.themeFont,t.formatter,t.borderLeft&&!n&&i(t.borderLeft)||t.borderLeft,t.borderTop&&!n&&i(t.borderTop)||t.borderTop,t.borderRight&&!n&&i(t.borderRight)||t.borderRight,t.borderBottom&&!n&&i(t.borderBottom)||t.borderBottom,t.locked,t.textIndent,t.wordWrap,t.shrinkToFit,t.backgroundImage,t.cellType,t.backgroundImageLayout,t.tabStop,t.textDecoration,t.imeMode,t.name,t.parentName,t.watermark);return r._autoFormatter=t._autoFormatter,t.validator&&t.validator.clone&&(r.validator=t.validator.clone()),r},u.prototype._normalize=function(n){var t=this,i,f,u,e,r;if(n&&n.getColor)for(i=t.foreColor,i&&(i=n.getColor(i),i&&(t.foreColor=i)),i=t.backColor,i&&(i=n.getColor(i),i&&(t.backColor=i)),f=[t.borderLeft,t.borderTop,t.borderRight,t.borderBottom],u=0,e=f.length;u<e;u++)r=f[u],r&&r.color&&(i=n.getColor(r.color),i&&(r.color=i));return n&&n.getFont&&(t.themeFont?t.font=p.composeFont(t.font,n.getFont(t.themeFont)):t.font||(t.font=p.composeFont(t.font,n.bodyFont()))),t},u.prototype._getCellTypeKinds=function(){var i={};return i[0]=n.Sheets.BaseCellType,i[1]=n.Sheets.TextCellType,i[2]=n.Sheets.ColumnHeaderCellType,i[3]=n.Sheets.RowHeaderCellType,i[4]=n.Sheets.CornerCellType,t.features.celltype&&(i[5]=n.Sheets.CheckBoxCellType,i[6]=n.Sheets.ButtonCellType,i[7]=n.Sheets.ComboBoxCellType,i[8]=n.Sheets.HyperLinkCellType),i},u.prototype.toJSON=function(n,r){var u=this,s={backgroundImage:u.backgroundImage,backgroundImageLayout:u.backgroundImageLayout,backColor:u.backColor,foreColor:u.foreColor,hAlign:u.hAlign,vAlign:u.vAlign,font:u.font,themeFont:u.themeFont,formatter:u.formatter,locked:u.locked,textIndent:u.textIndent,wordWrap:u.wordWrap,shrinkToFit:u.shrinkToFit,validator:u.validator?u.validator.toJSON():i,cellType:u.cellType?u.cellType.toJSON():i,name:u.name,parentName:u.parentName,tabStop:u.tabStop,textDecoration:u.textDecoration,imeMode:u.imeMode,borderLeft:u.borderLeft?u.borderLeft.toJSON():i,borderRight:u.borderRight?u.borderRight.toJSON():i,borderTop:u.borderTop?u.borderTop.toJSON():i,borderBottom:u.borderBottom?u.borderBottom.toJSON():i,watermark:u.watermark,autoFormatter:u._autoFormatter?u._autoFormatter.toJSON():i},o={},f,e;for(f in s)e=s[f],e===i||r&&u._isDefaultValue(f,e,n)||(o[f]=e);return t.GC$.isEmptyObject(o)?i:o},u.prototype._isDefaultValue=function(n,t,r){switch(n){case"hAlign":return r===2?t===1:r===1?t===1:t===3;case"vAlign":return r===2?t===1:r===1?t===1:t===0;case"imeMode":return t===1;case"autoFormatter":return t===i}},u.prototype.fromJSON=function(u,f){var e,h,s,a,v,y,p,w;if(u){if(e=this,u.backgroundImage!==i&&(e.backgroundImage=u.backgroundImage),u.backgroundImageLayout!==i&&(e.backgroundImageLayout=u.backgroundImageLayout),u.backColor!==i&&(e.backColor=u.backColor),u.foreColor!==i&&(e.foreColor=u.foreColor),u.hAlign!==i&&(e.hAlign=u.hAlign),u.vAlign!==i&&(e.vAlign=u.vAlign),u.font!==i&&(e.font=u.font),u.themeFont!==i&&(e.themeFont=u.themeFont),u.formatter!==i&&(e.formatter=this._copyFormat(u.formatter)),u.locked!==i&&(e.locked=u.locked),u.textIndent!==i&&(e.textIndent=u.textIndent),u.wordWrap!==i&&(e.wordWrap=u.wordWrap),u.shrinkToFit!==i&&(e.shrinkToFit=u.shrinkToFit),u.validator!==i&&(h=new n.Sheets.DefaultDataValidator,h.fromJSON(u.validator),e.validator=h),s=u.cellType,s!==i){var l,b=e._getCellTypeKinds(),d=s.type,k=s.typeName,o=b[d];o||(o=b[k]);o||(o=n.Sheets.getTypeFromString(k));o&&(l=new o,l.fromJSON(s,f));e.cellType=l}u.name!==i&&(e.name=u.name);u.parentName!==i&&(e.parentName=u.parentName);u.tabStop!==i&&(e.tabStop=u.tabStop);u.textDecoration!==i&&(e.textDecoration=u.textDecoration);u.imeMode!==i&&(e.imeMode=u.imeMode);u.borderLeft!==i&&(a=new c,a.fromJSON(u.borderLeft,f),e.borderLeft=a);u.borderRight!==i&&(v=new c,v.fromJSON(u.borderRight,f),e.borderRight=v);u.borderTop!==i&&(y=new c,y.fromJSON(u.borderTop,f),e.borderTop=y);u.borderBottom!==i&&(p=new c,p.fromJSON(u.borderBottom,f),e.borderBottom=p);u.watermark!==i&&(e.watermark=u.watermark);u.autoFormatter!==i&&(w=new t.AutoFormatter(r),w.fromJSON(u.autoFormatter),e._autoFormatter=w)}},u._styleId=0,u}();t.Style=ct;p=function(){function n(){}return n.composeFont=function(t,i){return i?n.normalizeFont(t,i):t},n.splitFont=function(n){if(!n)return{};var i,t;return i=document.createElement("div"),i.style.font=n,t=i.style,{fontFamily:t.fontFamily,fontSize:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight}},n.normalizeFont=function(i,r){var f,e,o,u,s;if(!i&&!r)return i;if(f=n,f.measureSpan?f._resetMeasureSpan():f._createMeasureSpan(),e=f.measureSpan,i){if(o=r?i+"+"+r:i,u=f._fontStringCatch[o],u)return u;t.GC$(e).css("font",i)}else{if(o=r,u=f._fontStringCatch[o],u)return u;t.GC$(e).css("fontSize",t.DefaultFontSize)}return r&&t.GC$(e).css("fontFamily",r),s=e.currentStyle,document.defaultView&&document.defaultView.getComputedStyle&&(s=document.defaultView.getComputedStyle(e,"")),u=st(s),f._fontStringCatch[o]=u,f._fontStringCatch[u]=u,u},n._scaleFont=function(t,i,r,u){var h=n,y=h.scaleFontInfoCache[i],e,o,p,w,c,s,l,a,b;if(!u)if(y){if(e=y[t],e)return e}else y=h.scaleFontInfoCache[i]={};return h.measureSpan?h._resetMeasureSpan():h._createMeasureSpan(),o=h.measureSpan,o.style.font=t,p=o.currentStyle,w=document.defaultView,w&&w.getComputedStyle&&(p=w.getComputedStyle(o,"")),c=p.fontSize,s="px",c.indexOf(s)!==-1&&(l=f(1,v(parseFloat(c.replace(s,""))*i)),r&&l===1&&(r.value=!0),c=l+s),a=p.lineHeight,a.indexOf(s)!==-1&&(b=f(1,v(parseFloat(a.replace(s,""))*i)),a=b+s),i===1?e={font:t,fontSize:l}:(o.style.fontSize=c,o.style.lineHeight=a,e={font:o.style.font,fontSize:l}),u||(y[t]=e),e},n.composeTextDecoration=function(n){if(n<=0)return"none";var t="";return(n|1)===n&&(t+="underline "),(n|2)===n&&(t+="line-through "),(n|4)===n&&(t+="overline "),t.trim()},n._createMeasureSpan=function(){var t=document.createElement("span"),n=t.style;n.visibility="hidden";n.top="-10000px";n.left="-10000px";n.lineHeight="normal";n.position="absolute";document.body.insertBefore(t,r);this.measureSpan=t;this.measureSpanOriginalStyleText=n.cssText},n._resetMeasureSpan=function(){this.measureSpan.style.cssText=this.measureSpanOriginalStyleText},n._disposeMeasureSpan=function(){var n=this.measureSpan;n&&(t.GC$(n).remove(),this.measureSpan=i,this.measureSpanOriginalStyleText=i)},n.setStringFont=function(t,i){var r,u,f;if(!t)return"";r=n;r.measureSpan?r._resetMeasureSpan():r._createMeasureSpan();u=r.measureSpan;u.style.font=t;for(f in i)i.hasOwnProperty(f)&&(u.style[f]=i[f]);return u.style.font},n._fontStringCatch={},n.scaleFontInfoCache={},n}();t.StyleHelper=p;lt=function(){function n(n,t,i,r){var u=this;u._name=n;u._baseRow=i;u._baseColumn=r;u._expr=t}return n.prototype.getName=function(){return this._name},n.prototype.getRow=function(){return this._baseRow},n.prototype.getColumn=function(){return this._baseColumn},n.prototype.getExpression=function(){return this._expr},n.prototype.setExpression=function(n){this._expr=n},n}();t.NameInfo=lt;at=function(){function n(){}return n.getColor=function(n,t){if(n&&t){var i=n._currentTheme;if(i)return i.getColor(t)}return t},n.getFont=function(n,t){if(n&&t){var i=n._currentTheme;return i?i.getFont(t):t}return r},n}();t._ThemeContext=at;vt=function(){function n(n){var t=this;t.host=n;t.interval=r;t.action=r;t.intervalId=r;t.result=r;t.working=!1;t._needIncrease=!1}return n.prototype.setAction=function(n){typeof n=="function"&&(this.action=n)},n.prototype.setInterval=function(n){var t=this,i;isNaN(n)||n===0?t.stop():(t._needIncrease=n>0?!0:!1,n=ii(n),i=t.interval,t.interval=n,i!==n&&t.start())},n.prototype.start=function(){var n=this;n.clear();isNaN(n.interval)||(n.intervalId=setInterval(function(){n.run()},n.interval))},n.prototype.run=function(){var n=this;n.working=!0;typeof n.action=="function"&&(n.result=n.action.call(n.host,n._needIncrease))},n.prototype.stop=function(){var n=this;n.clear();n.interval=r;n.intervalId=r;n.result=r;n.working=!1},n.prototype.clear=function(){this.intervalId&&clearInterval(this.intervalId)},n.prototype._dispose=function(){this.stop()},n}();t.Timer=vt;yt=function(){function n(){}return n.ValidationError="ValidationError",n.CellClick="CellClick",n.CellDoubleClick="CellDoubleClick",n.EnterCell="EnterCell",n.LeaveCell="LeaveCell",n.ValueChanged="ValueChanged",n.TopRowChanged="TopRowChanged",n.LeftColumnChanged="LeftColumnChanged",n.InvalidOperation="InvalidOperation",n.RangeFiltering="RangeFiltering",n.RangeFiltered="RangeFiltered",n.TableFiltering="TableFiltering",n.TableFiltered="TableFiltered",n.RangeSorting="RangeSorting",n.RangeSorted="RangeSorted",n.ClipboardChanging="ClipboardChanging",n.ClipboardChanged="ClipboardChanged",n.ClipboardPasting="ClipboardPasting",n.ClipboardPasted="ClipboardPasted",n.ColumnWidthChanging="ColumnWidthChanging",n.ColumnWidthChanged="ColumnWidthChanged",n.RowHeightChanging="RowHeightChanging",n.RowHeightChanged="RowHeightChanged",n.DragDropBlock="DragDropBlock",n.DragDropBlockCompleted="DragDropBlockCompleted",n.DragFillBlock="DragFillBlock",n.DragFillBlockCompleted="DragFillBlockCompleted",n.EditStarting="EditStarting",n.EditStarted="EditStarted",n.EditChange="EditChange",n.EditEnding="EditEnding",n.EditEnd="EditEnd",n.EditEnded="EditEnded",n.RangeGroupStateChanging="RangeGroupStateChanging",n.RangeGroupStateChanged="RangeGroupStateChanged",n.SelectionChanging="SelectionChanging",n.SelectionChanged="SelectionChanged",n.SheetTabClick="SheetTabClick",n.SheetTabDoubleClick="SheetTabDoubleClick",n.SheetNameChanging="SheetNameChanging",n.SheetNameChanged="SheetNameChanged",n.UserZooming="UserZooming",n.UserFormulaEntered="UserFormulaEntered",n.CellChanged="CellChanged",n.ColumnChanged="ColumnChanged",n.RowChanged="RowChanged",n.ActiveSheetChanging="ActiveSheetChanging",n.ActiveSheetChanged="ActiveSheetChanged",n.SparklineChanged="SparklineChanged",n.RangeChanged="RangeChanged",n.ButtonClicked="ButtonClicked",n.EditorStatusChanged="EditorStatusChanged",n.CultureChanged="SpreadJSCultureChanged",n.FloatingObjectChanged="FloatingObjectChanged",n.FloatingObjectSelectionChanged="FloatingObjectSelectionChanged",n.PictureChanged="PictureChanged",n.FloatingObjectRemoving="FloatingObjectRemoving",n.FloatingObjectRemoved="FloatingObjectRemoved",n.PictureSelectionChanged="PictureSelectionChanged",n.CustomFloatingObjectLoaded="CustomFloatingObjectLoaded",n.TouchToolStripOpening="TouchToolStripOpening",n.CommentChanged="CommentChanged",n.CommentRemoving="CommentRemoving",n.CommentRemoved="CommentRemoved",n.SlicerChanged="SlicerChanged",n}();t.Events=yt;k=function(){function n(){return Array.apply(this,arguments),[]}return n.prototype.pop=function(){return r},n.prototype.push=function(n){return 0},n.prototype.splice=function(n,t){for(var u=[],i=0;i<arguments.length-2;i++)u[i]=arguments[i+2];return r},n.prototype.slice=function(n,t){return null},n}();t._XArray=k;k.prototype=[];pt=function(){function n(n){this._sheet=n}return n.prototype.getCellOverflowBuilder=function(n,t,i){var u=this._cellOverflowBuilderCache,f=n<<4+t,r;return u?(r=u[f],r||(r=i(),u[f]=r),r):i()},n.prototype.getConditionalFormat=function(n,t){var r=this._conditionalFormatCache,i;return r?(i=r[n],i)?i[t]:null:null},n.prototype.setConditionalFormat=function(n,t,i,r){var f=this._conditionalFormatCache,u;f&&(u=f[n],u||(u={},f[n]=u),u[t]={d:i,i:r})},n.prototype.getValue=function(n,t,i){var e=this._valueCache,r,u,f;return e?(i===undefined&&(i=3),r=e[i],r||(r={},e[i]=r),u=r[n],u||(u={},r[n]=u),f=u[t],f===undefined&&(f=this._sheet.getValue(n,t,i),u[t]=f),f):this._sheet.getValue(n,t,i)},n.prototype.getActualStyle=function(n,t,i){var e=this._styleCache,r,u,f;return e?(i===undefined&&(i=3),r=e[i],r||(r={},e[i]=r),u=r[n],u||(u={},r[n]=u),f=u[t],f||(f=this._sheet.getActualStyle(n,t,i,!1,!0),u[t]=f),f.clone(!0)):this._sheet.getActualStyle(n,t,i,!1,!1)},n.prototype.getZoomRowHeight=function(n){var i=this._rowHeightCache,t;return i?(t=i[n],t===undefined&&(t=i[n]=this._sheet._getZoomRowHeight(n)),t):this._sheet._getZoomRowHeight(n)},n.prototype.getZoomColWidth=function(n){var i=this._colWidthCache,t;return i?(t=i[n],t===undefined&&(t=i[n]=this._sheet._getZoomColumnWidth(n)),t):this._sheet._getZoomColumnWidth(n)},n.prototype.getRowGroups=function(n){var t=this;return t._valueCache?(t._rowGroups||(t._rowGroups=n()),t._rowGroups):n()},n.prototype.getColGroups=function(n){var t=this;return t._valueCache?(t._colGroups||(t._colGroups=n()),t._colGroups):n()},n.prototype.startCacheBeforPan=function(){var n=this;n._isCaching=!0;n._cellOverflowBuilderCache={};n._conditionalFormatCache={};n._valueCache={};n._styleCache={};n._rowHeightCache={};n._colWidthCache={}},n.prototype.endCache=function(){this._isCaching=!1},n.prototype.clearCacheEndPan=function(){var n=this;n._isCaching=!1;n._cellOverflowBuilderCache=null;n._conditionalFormatCache=null;n._valueCache=null;n._styleCache=null;n._colWidthCache=null;n._rowHeightCache=null;n._rowGroups=null;n._colGroups=null},n.prototype.isCaching=function(){return this._isCaching},n}();t._CachePool=pt;wt=function(){function n(){}return n.startCache=function(t,i,r,u,f){var h=n,c,o,s,e;if(h._cached=!0,c=t.getRowCount(),t._hasTable(i,r,u-i+1,f-r+1))for(o=-1,s=h._visibleRowIndexCache=[],e=0;e<=u;e++)t.getRowVisible(e)?(o++,s[e]=o):s[e]=-1},n.clearCache=function(){n._visibleRowIndexCache=null;n._cached=!1},n.getFormatter=function(i){var u=n,r=u._formatterCache[i];return r||(r=new t.GeneralFormatter(i),u._formatterCache[i]=r),r},n.getFormattedText=function(i,u,f){var h=n,l=h._formattedTextCache,e,s,o;if(t.features.formatter){if(e=l[u],e||(e={},l[u]=e),s=e[i],s)return f&&(f.value=s.color),s.text;o=r;o=h._formatterCache[u];o||(o=new t.GeneralFormatter(u),h._formatterCache[u]=o);var y=typeof i=="number",c={},a=o.Format(i,c),v=e[i]={};return v.text=a,v.color=c.value,f&&(f.value=c.value),a}else return i.toString()},n.getFormattedTextByStyle=function(n,t,i,u){var f=t.cellType||n.getDefaultCellType(),e=t.formatter||t._autoFormatter;return f.format(i,e,u,r)},n.clearFormatCache=function(){n._formatterCache={};n._formattedTextCache={}},n._cached=!1,n._formatterCache={},n._formattedTextCache={},n}();t._CacheMgr=wt;bt=function(){function n(){}return n.setStyle=function(t,i,r,u){var e,f;t&&(e=n,e.removeDataValidator(i,r,u),f=t.validator&&t.validator.condition,f&&f.getFormulas&&f.getFormulas().length>0&&e.addDataValidator(t.validator,i,r,u))},n.addDataValidator=function(t,i,r,u){var s=i._id,h=n._cache,e=h[t.id],f,o;e||(e=h[t.id]={validator:t,sheet:i});f=e[s];f||(f=e[s]={});o=r+"_"+u;f[o]||(f[o]=!0)},n.removeDataValidator=function(t,i,r){var e=t._id,o=n._cache,s,u,f,h,c;for(s in o)if(u=o[s],u&&(f=u[e],f||(f=u[e]={}),h=i+"_"+r,f[h])){delete f[h];for(c in f)return;delete u[e];for(c in u)return;delete o[s];return}},n.removeSheet=function(t){var r=n._cache,u,i,f;for(u in r)if(i=r[u],i[t]){delete i[t];for(f in i)return;delete r[u]}},n.getAllValidators=function(){var t=[],i=n._cache;for(var r in i)t.push(i[r]);return t},n.clear=function(){this._cache={}},n._cache={},n}();t._DataValidatorCache=bt;kt=function(){function n(){}return n.addElements=function(n,t,i,r){var f,o,u,e,s;if(n&&0<=i&&i<t){for(f=[],u=i;u<t;u++)typeof n[u]!="undefined"&&f.push(u);for(o=f.length,u=0;u<o;u++)e=f[o-u-1],s=n[e],n[e]=null,n[Math.floor(e)+r]=s}},n.deleteElements=function(n,t,i,r){var f,s,o,u,e,h;if(n&&0<=i&&i<t){for(f=[],o=i+r,u=i;u<t;u++)typeof n[u]!="undefined"&&(i<=u&&u<o?n[u]=null:u>=o&&f.push(u));for(s=f.length,u=0;u<s;u++)e=f[u],h=n[e],n[e]=null,n[Math.floor(e)-r]=h}},n}();t._ModelHelper=kt,function(n){n[n.None=0]="None";n[n.Normal=1]="Normal";n[n.Knockout=2]="Knockout";n[n.DataView=3]="DataView";n[n.CellBinding=4]="CellBinding"}(t._DataSourceType||(t._DataSourceType={}));rf=t._DataSourceType,function(n){n[n.normal=0]="normal";n[n.arrayFormula=1]="arrayFormula";n[n.sharedFormula=2]="sharedFormula"}(t.EndEditType||(t.EndEditType={}));uf=t.EndEditType;dt=function(){function n(){}return n}();t.FormulaInformation=dt;w=function(){function n(){}return n.getReg=function(t){var i=n.regDict[t];return i||(i=n.regDict[t]=new RegExp(t,"g")),i.lastIndex=0,i},n.getRegIgnoreCase=function(t){var i=n.regDictIgnoreCase[t];return i||(i=n.regDictIgnoreCase[t]=new RegExp(t,"gi")),i.lastIndex=0,i},n.getWildcardCriteria=function(t){if(n.wildcardParseRecord[t])return n.wildcardParseResultBuffer[t];if(n.getReg("[~?*]+").test(t)){var i=t,f=n.getReplaceSymbol("asterisk",i),e=n.getReplaceSymbol("question",i),o=n.getReplaceSymbol("tilde",i);return i=u.replace(i,"~~",o),i=u.replace(i,"~*",f),i=u.replace(i,"~?",e),i=i.replace(n.getReg("([.+$^\\[\\](){}|/])"),"\\$1"),i=u.replace(i,"*",".*"),i=u.replace(i,"?","."),i=u.replace(i,f,"\\*"),i=u.replace(i,e,"\\?"),i=u.replace(i,o,"~"),n.wildcardParseResultBuffer[t]=i,n.wildcardParseRecord[t]=!0,i}return r},n.getWildcardCriteriaFullMatch=function(t){var i=n.getWildcardCriteria(t);return i&&(i="^"+i+"$"),i},n.getReplaceSymbol=function(n,t){for(var i="#"+n+"0#",r=1;r<1e4;r++){if(t.indexOf(i)>0){i=u.replace(i,"#"+n+(r-1)+"#","#"+n+r+"#");continue}return i}},n.regDict={},n.regDictIgnoreCase={},n.wildcardParseRecord={},n.wildcardParseResultBuffer={},n}();t.RegUtil=w;u=function(){function n(){}return n.replace=function(n,t,i){return n.split(t).join(i)},n.startsWith=function(n,t){return n.indexOf(t)===0},n.endsWith=function(n,t){var i=n.length-t.length;return i>=0&&n.indexOf(t,i)===i},n.leftBefore=function(n,t){var i=n.indexOf(t);return i<0||i>=n.length?n:n.substr(0,i)},n.contains=function(n,t){return n.indexOf(t)>=0},n.count=function(n,t){for(var r=0,i=n.indexOf(t);i>=0;)r+=1,i=n.indexOf(t,i+1);return r},n.escapeHtml=function(n){var i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},t=w.getReg("(?:&|<|>|\"|'|`)");return t.test(n)?n.replace(t,function(n){return i[n]}):n},n.unescapeHtml=function(n){var i={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},t=w.getReg("(?:&|<|>|"|'|`)");return t.test(n)?n.replace(t,function(n){return i[n]}):n},n}();t.StringUtil=u;gt=function(){function n(){}return n.getDevicePixel=function(){var t=window.devicePixelRatio||window.screen.deviceXDPI&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,n=t*20,i=Math.round(n),r=i-n;return Math.round(n)-n>.82?i/20:Math.round(t*100)/100},n.adjustDevicePixel=function(t,i,r,u){var e=n,a,l,s,o,h,c,f;if(e.setScaleX(t,t.getContext("2d"),1),e.setScaleY(t,t.getContext("2d"),1),a=e.getDevicePixel(),a!==1||e.dpr!==1){if(e.dpr=a,l=i?i:r&&r.parent,l){for(s=e._spreadConvasCaches,f=0;f<s.length;f++)if(l===s[f].spread){o=s[f];break}if(o||(o={spread:l,sheets:[],canvases:[]},s.push(o)),i)o.canvases.push(t);else{for(c=o.sheets,f=0;f<c.length;f++)if(c[f].sheet===r){h=c[f];break}h||(h={sheet:r,canvases:[]},c.push(h));h.canvases.push(t)}}return}},n.getScaleX=function(n){return n?n._gcDPIScaleX||1:1},n.getScaleY=function(n){return n?n._gcDPIScaleY||1:1},n.setScaleX=function(n,t,i){n&&(n._gcDPIScaleX=i,t._gcDPIScaleX=i)},n.setScaleY=function(n,t,i){n&&(n._gcDPIScaleY=i,t._gcDPIScaleY=i)},n.getLogicWidth=function(n){return n._gcLogicWidth},n.getLogicHeight=function(n){return n._gcLogicHeight},n.setLogicWidth=function(n,t){n._gcLogicWidth=t},n.setLogicHeight=function(n,t){n._gcLogicHeight=t},n.setSize=function(t,i,r){var u=n,f=u.dpr,c=u.getScaleX(t),l=u.getScaleY(t),e,o,h;u.setLogicWidth(t,i);u.setLogicHeight(t,r);f===1&&c===1&&l===1?(t.width=i,t.height=r):(e=t.getContext("2d"),e.scale(1/c,1/l),s.browser.mozilla?(t.width=Math.ceil(i*f),t.height=Math.ceil(r*f)):(t.width=Math.round(i*f),t.height=Math.round(r*f)),t.style.width=i+"px",t.style.height=r+"px",o=t.width/i,h=t.height/r,(o!==c||h!==l)&&(u.setScaleX(t,e,o),u.setScaleY(t,e,h)),e.scale(o,h))},n.disposeCanvasForSheet=function(t,i){for(var r,u,s=n._spreadConvasCaches,h=t.parent,f,e,o=0;o<s.length;o++)if(!h||s[o].spread===h)for(f=s[o].sheets,r=0;r<f.length;r++)if(f[r].sheet===t){for(e=f[r].canvases,u=0;u<e.length;u++)if(e[u]===i){e.splice(u,1);break}break}},n.disposeCanvasForSpread=function(t,i){for(var r,e=n._spreadConvasCaches,u,f=0;f<e.length;f++)if(e[f].spread===t)for(u=e[f].canvases,r=0;r<u.length;r++)if(u[r]===i){u.splice(r,1);break}},n.disposeSheet=function(t){for(var i,f=n._spreadConvasCaches,e=t.parent,r,u=0;u<f.length;u++)if(!e||f[u].spread===e){for(r=f[u].sheets,i=0;i<r.length;i++)r[i].sheet===t&&r.splice(i,1);return}},n.disposeSpread=function(t){for(var r=n._spreadConvasCaches,i=0;i<r.length;i++)if(r[i].spread===t){r.splice(i,1);return}},n.updateDPI=function(t,i){var r=n,l=r.getDevicePixel(),c,o,s,u,h,e,f;if(r.dpr!=l)for(c=r._spreadConvasCaches,r.dpr=l,h=0;h<c.length;h++){for(s=c[h],f=0;f<s.canvases.length;f++)u=s.canvases[f],r.setSize(u,r.getLogicWidth(u),r.getLogicHeight(u));for(o=s.sheets,e=0;e<o.length;e++)for(f=0;f<o[e].canvases.length;f++)u=o[e].canvases[f],r.setSize(u,r.getLogicWidth(u),r.getLogicHeight(u))}},n.dpr=1,n._spreadConvasCaches=[],n}();t.DPIHelper=gt;d=function(){function n(){}return n.handleFormulatextboxAcrossSheetBeforeTabChange=function(n,t){},n.handleFormulatextboxAcrossSheetAfterTabChange=function(n,t){},n}();t.IFormulatextboxAcrossSheetSingleton=d,function(n){n[n.Cell=0]="Cell";n[n.ExternalCell=1]="ExternalCell";n[n.Range=2]="Range";n[n.ExternalRange=3]="ExternalRange";n[n.Double=4]="Double";n[n.String=5]="String";n[n.Boolean=6]="Boolean";n[n.Function=7]="Function";n[n.Name=8]="Name";n[n.ExternalName=9]="ExternalName";n[n.BinaryOperator=10]="BinaryOperator";n[n.UnaryOperator=11]="UnaryOperator";n[n.Error=12]="Error";n[n.ExternalError=13]="ExternalError";n[n.Parentheses=14]="Parentheses";n[n.Array=15]="Array";n[n.SheetRange=16]="SheetRange";n[n.StructReference=17]="StructReference";n[n.BangName=18]="BangName";n[n.SheetRangeError=19]="SheetRangeError";n[n.BangError=20]="BangError";n[n.MissingArgument=21]="MissingArgument";n[n.BangCell=22]="BangCell";n[n.BangRange=23]="BangRange";n[n.Expand=24]="Expand";n[n.NameIdentity=25]="NameIdentity";n[n.ExternalNameIdentity=26]="ExternalNameIdentity"}(t.ExpressionType||(t.ExpressionType={}));ff=t.ExpressionType})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){n.feature("core.imageLoader",["core.common"]);var t=function(){function t(n){this._imageCount=0;this._loadedCount=0;this.onLoadedComplete=n}return t.prototype.dispose=function(){this.onLoadedComplete=null},t.prototype.addImage=function(t){var i=this,f=i._imgs,r,u;f||(f=i._imgs={});r=f[t];r||(r={},u=n.GC$(document.createElement("img")),u.bind("load",function(){i.imageLoaded(t)}),u.bind("error",function(){i.imageLoaded(t)}),u.bind("abort",function(){i.imageLoaded(t)}),i._imageCount++,r.state=!1,r.img=u,f[t]=r,u.getElement(0).src=t)},t.prototype.getImage=function(n){return this._imgs[n].img.getElement(0)},t.prototype.getState=function(n){var t=this._imgs,i=t&&t[n];return i?i.state:!1},t.prototype.imageLoaded=function(n){var t=this;t._loadedCount++;t._imgs[n].state=!0;t.isAllImagesLoaded()&&t.onLoadedComplete&&t.onLoadedComplete()},t.prototype.isAllImagesLoaded=function(){return this._loadedCount>=this._imageCount},t}();n._GcImageLoader=t})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var t,i,r,u;n.feature("core.cultureInfo");t=function(){function n(){this.currencyDecimalDigits=2;this.currencyDecimalSeparator=".";this.currencyGroupSeparator=",";this.currencyGroupSizes=[3];this.currencyNegativePattern=0;this.currencyPositivePattern=0;this.currencySymbol="\u00a4";this.digitSubstitution=1;this.isReadOnly=!0;this.nanSymbol="NaN";this.nativeDigits=["0","1","2","3","4","5","6","7","8","9"];this.negativeInfinitySymbol="-Infinity";this.negativeSign="-";this.numberDecimalDigits=2;this.numberDecimalSeparator=".";this.numberGroupSeparator=",";this.numberGroupSizes=[3];this.numberNegativePattern=1;this.percentDecimalDigits=2;this.percentDecimalSeparator=".";this.percentGroupSeparator=",";this.percentGroupSizes=[3];this.percentNegativePattern=0;this.percentPositivePattern=0;this.percentSymbol="%";this.perMilleSymbol="\u2030";this.positiveInfinitySymbol="Infinity";this.positiveSign="+";this.abbreviatedDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];this.abbreviatedMonthGenitiveNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""];this.abbreviatedMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""];this.amDesignator="AM";this.calendarIsReadOnly=!0;this.calendarWeekRule=0;this.dateSeparator="/";this.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];this.firstDayOfWeek=0;this.fullDateTimePattern="dddd, dd MMMM yyyy HH:mm:ss";this.longDatePattern="dddd, dd MMMM yyyy";this.longTimePattern="HH:mm:ss";this.monthDayPattern="MMMM dd";this.monthGenitiveNames=["January","February","March","April","May","June","July","August","September","October","November","December",""];this.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December",""];this.nativeCalendarName="Gregorian Calendar";this.pmDesignator="PM";this.rfc1123Pattern="ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";this.shortDatePattern="MM/dd/yyyy";this.shortestDayNames=["Su","Mo","Tu","We","Th","Fr","Sa"];this.shortTimePattern="HH:mm";this.sortableDateTimePattern="yyyy'-'MM'-'dd'T'HH':'mm':'ss";this.timeSeparator=":";this.universalSortableDateTimePattern="yyyy'-'MM'-'dd HH':'mm':'ss'Z'";this.yearMonthPattern="yyyy MMMM";this.listSeparator=",";this.arrayListSeparator=",";this.arrayGroupSeparator=";"}return n}();n.CultureInfo=t;i=function(n){function t(){n.apply(this,arguments);this.currencySymbol="$";this.isReadOnly=!1;this.fullDateTimePattern="dddd, MMMM dd, yyyy h:mm:ss tt";this.longDatePattern="dddd, MMMM dd, yyyy";this.longTimePattern="h:mm:ss tt";this.shortDatePattern="M/d/yyyy";this.shortTimePattern="h:mm tt";this.yearMonthPattern="MMMM, yyyy";this.calendarIsReadOnly=!1}return __extends(t,n),t}(t);n._ENCultureInfo=i;r=function(n){function t(){n.apply(this,arguments);this.currencyDecimalDigits=0;this.currencyNegativePattern=1;this.currencySymbol="\uffe5";this.isReadOnly=!1;this.nanSymbol="NaN (\u975e\u6570\u5024)";this.negativeInfinitySymbol="-\u221e";this.percentNegativePattern=1;this.percentPositivePattern=1;this.positiveInfinitySymbol="+\u221e";this.abbreviatedDayNames=["\u65e5","\u6708","\u706b","\u6c34","\u6728","\u91d1","\u571f"];this.abbreviatedMonthGenitiveNames=["1","2","3","4","5","6","7","8","9","10","11","12",""];this.abbreviatedMonthNames=["1","2","3","4","5","6","7","8","9","10","11","12",""];this.amDesignator="\u5348\u524d";this.calendarIsReadOnly=!1;this.dayNames=["\u65e5\u66dc\u65e5","\u6708\u66dc\u65e5","\u706b\u66dc\u65e5","\u6c34\u66dc\u65e5","\u6728\u66dc\u65e5","\u91d1\u66dc\u65e5","\u571f\u66dc\u65e5"];this.fullDateTimePattern="yyyy'\u5e74'M'\u6708'd'\u65e5' H:mm:ss";this.longDatePattern="yyyy'\u5e74'M'\u6708'd'\u65e5'";this.longTimePattern="H:mm:ss";this.monthDayPattern="M'\u6708'd'\u65e5'";this.monthGenitiveNames=["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708",""];this.monthNames=["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708",""];this.nativeCalendarName="\u897f\u66a6 (\u65e5\u672c\u8a9e)";this.pmDesignator="\u5348\u5f8c";this.shortDatePattern="yyyy/MM/dd";this.shortestDayNames=["\u65e5","\u6708","\u706b","\u6c34","\u6728","\u91d1","\u571f"];this.shortTimePattern="H:mm";this.yearMonthPattern="yyyy'\u5e74'M'\u6708'"}return __extends(t,n),t}(t);n._JACultureInfo=r;u=function(n){function t(){n.apply(this,arguments);this.currencyNegativePattern=2;this.currencySymbol="\uffe5";this.isReadOnly=!1;this.nanSymbol="\u975e\u6570\u5b57";this.negativeInfinitySymbol="\u8d1f\u65e0\u7a77\u5927";this.percentNegativePattern=1;this.percentPositivePattern=1;this.positiveInfinitySymbol="\u6b63\u65e0\u7a77\u5927";this.abbreviatedDayNames=["\u5468\u65e5","\u5468\u4e00","\u5468\u4e8c","\u5468\u4e09","\u5468\u56db","\u5468\u4e94","\u5468\u516d"];this.abbreviatedMonthGenitiveNames=["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708",""];this.abbreviatedMonthNames=["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708",""];this.amDesignator="\u4e0a\u5348";this.calendarIsReadOnly=!1;this.dayNames=["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"];this.firstDayOfWeek=1;this.fullDateTimePattern="yyyy'\u5e74'M'\u6708'd'\u65e5' H:mm:ss";this.longDatePattern="yyyy'\u5e74'M'\u6708'd'\u65e5'";this.longTimePattern="H:mm:ss";this.monthDayPattern="M'\u6708'd'\u65e5'";this.monthGenitiveNames=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""];this.monthNames=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""];this.nativeCalendarName="\u516c\u5386";this.pmDesignator="\u4e0b\u5348";this.shortDatePattern="yyyy/M/d";this.shortestDayNames=["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"];this.shortTimePattern="H:mm";this.yearMonthPattern="yyyy'\u5e74'M'\u6708'"}return __extends(t,n),t}(t);n._ZHCultureInfo=u;n.cultureInfoDict={"":new t,"en-us":new i,"ja-jp":new r,"zh-cn":new u};n.CR=n.cultureInfoDict["en-us"];n.dateTimeFormats=["MM/dd/yyyy","MM/d/yyyy","M/dd/yyyy","M/d/yyyy","yy/MM/dd","yy/MM/d","yy/M/dd","yy/M/d","yyyy/MM/dd","yyyy/MM/d","yyyy/M/dd","yyyy/M/d","hh:mm:ss","hh:mm:s","hh:m:ss","hh:m:s","h:mm:ss","h:mm:s","h:m:ss","h:m:s","hh:mm:ss tt","hh:mm:s tt","hh:m:ss tt","hh:m:s tt","h:mm:ss tt","h:mm:s tt","h:m:ss tt","h:m:s tt","hh:mm","hh:m","h:mm","h:m","MM/dd/yyyy hh:mm:ss","MM/dd/yyyy hh:mm:s","MM/dd/yyyy hh:m:ss","MM/dd/yyyy hh:m:s","MM/dd/yyyy hh:mm:ss","MM/dd/yyyy h:mm:s","MM/dd/yyyy h:m:ss","MM/dd/yyyy h:m:s","MM/dd/yyyy hh:mm:ss tt","MM/dd/yyyy hh:mm:s tt","MM/dd/yyyy hh:m:ss tt","MM/dd/yyyy hh:m:s tt","MM/dd/yyyy h:mm:ss tt","MM/dd/yyyy h:mm:s tt","MM/dd/yyyy h:m:ss tt","MM/dd/yyyy h:m:s tt","MM/d/yyyy hh:mm:ss","MM/d/yyyy hh:mm:s","MM/d/yyyy hh:m:ss","MM/d/yyyy hh:m:s","MM/d/yyyy hh:mm:ss","MM/d/yyyy h:mm:s","MM/d/yyyy h:m:ss","MM/d/yyyy h:m:s","MM/d/yyyy hh:mm:ss tt","MM/d/yyyy hh:mm:s tt","MM/d/yyyy hh:m:ss tt","MM/d/yyyy hh:m:s tt","MM/d/yyyy h:mm:ss tt","MM/d/yyyy h:mm:s tt","MM/d/yyyy h:m:ss tt","MM/d/yyyy h:m:s tt","M/dd/yyyy hh:mm:ss","M/dd/yyyy hh:mm:s","M/dd/yyyy hh:m:ss","M/dd/yyyy hh:m:s","M/dd/yyyy hh:mm:ss","M/dd/yyyy h:mm:s","M/dd/yyyy h:m:ss","M/dd/yyyy h:m:s","M/dd/yyyy hh:mm:ss tt","M/dd/yyyy hh:mm:s tt","M/dd/yyyy hh:m:ss tt","M/dd/yyyy hh:m:s tt","M/dd/yyyy h:mm:ss tt","M/dd/yyyy h:mm:s tt","M/dd/yyyy h:m:ss tt","M/dd/yyyy h:m:s tt","M/d/yyyy hh:mm:ss","M/d/yyyy hh:mm:s","M/d/yyyy hh:m:ss","M/d/yyyy hh:m:s","M/d/yyyy hh:mm:ss","M/d/yyyy h:mm:s","M/d/yyyy h:m:ss","M/d/yyyy h:m:s","M/d/yyyy hh:mm:ss tt","M/d/yyyy hh:mm:s tt","M/d/yyyy hh:m:ss tt","M/d/yyyy hh:m:s tt","M/d/yyyy h:mm:ss tt","M/d/yyyy h:mm:s tt","M/d/yyyy h:m:ss tt","M/d/yyyy h:m:s tt","yy/MM/dd hh:mm:ss","yy/MM/dd hh:mm:s","yy/MM/dd hh:m:ss","yy/MM/dd hh:m:s","yy/MM/dd h:mm:ss","yy/MM/dd h:mm:s","yy/MM/dd h:m:ss","yy/MM/dd h:m:s","yy/MM/dd hh:mm:ss tt","yy/MM/dd hh:mm:s tt","yy/MM/dd hh:m:ss tt","yy/MM/dd hh:m:s tt","yy/MM/dd h:mm:ss tt","yy/MM/dd h:mm:s tt","yy/MM/dd h:m:ss tt","yy/MM/dd h:m:s tt","yy/MM/d hh:mm:ss","yy/MM/d hh:mm:s","yy/MM/d hh:m:ss","yy/MM/d hh:m:s","yy/MM/d hh:mm:ss","yy/MM/d h:mm:s","yy/MM/d h:m:ss","yy/MM/d h:m:s","yy/MM/d hh:mm:ss tt","yy/MM/d hh:mm:s tt","yy/MM/d hh:m:ss tt","yy/MM/d hh:m:s tt","yy/MM/d h:mm:ss tt","yy/MM/d h:mm:s tt","yy/MM/d h:m:ss tt","yy/MM/d h:m:s tt","yy/M/dd hh:mm:ss","yy/M/dd hh:mm:s","yy/M/dd hh:m:ss","yy/M/dd hh:m:s","yy/M/dd hh:mm:ss","yy/M/dd h:mm:s","yy/M/dd h:m:ss","yy/M/dd h:m:s","yy/M/dd hh:mm:ss tt","yy/M/dd hh:mm:s tt","yy/M/dd hh:m:ss tt","yy/M/dd hh:m:s tt","yy/M/dd h:mm:ss tt","yy/M/dd h:mm:s tt","yy/M/dd h:m:ss tt","yy/M/dd h:m:s tt","yy/M/d hh:mm:ss","yy/M/d hh:mm:s","yy/M/d hh:m:ss","yy/M/d hh:m:s","yy/M/d hh:mm:ss","yy/M/d h:mm:s","yy/M/d h:m:ss","yy/M/d h:m:s","yy/M/d hh:mm:ss tt","yy/M/d hh:mm:s tt","yy/M/d hh:m:ss tt","yy/M/d hh:m:s tt","yy/M/d h:mm:ss tt","yy/M/d h:mm:s tt","yy/M/d h:m:ss tt","yy/M/d h:m:s tt","yyyy/MM/dd hh:mm:ss","yyyy/MM/dd hh:mm:s","yyyy/MM/dd hh:m:ss","yyyy/MM/dd hh:m:s","yyyy/MM/dd hh:mm:ss","yyyy/MM/dd h:mm:s","yyyy/MM/dd h:m:ss","yyyy/MM/dd h:m:s","yyyy/MM/dd hh:mm:ss tt","yyyy/MM/dd hh:mm:s tt","yyyy/MM/dd hh:m:ss tt","yyyy/MM/dd hh:m:s tt","yyyy/MM/dd h:mm:ss tt","yyyy/MM/dd h:mm:s tt","yyyy/MM/dd h:m:ss tt","yyyy/MM/dd h:m:s tt","yyyy/MM/d hh:mm:ss","yyyy/MM/d hh:mm:s","yyyy/MM/d hh:m:ss","yyyy/MM/d hh:m:s","yyyy/MM/d hh:mm:ss","yyyy/MM/d h:mm:s","yyyy/MM/d h:m:ss","yyyy/MM/d h:m:s","yyyy/MM/d hh:mm:ss tt","yyyy/MM/d hh:mm:s tt","yyyy/MM/d hh:m:ss tt","yyyy/MM/d hh:m:s tt","yyyy/MM/d h:mm:ss tt","yyyy/MM/d h:mm:s tt","yyyy/MM/d h:m:ss tt","yyyy/MM/d h:m:s tt","yyyy/M/dd hh:mm:ss","yyyy/M/dd hh:mm:s","yyyy/M/dd hh:m:ss","yyyy/M/dd hh:m:s","yyyy/M/dd hh:mm:ss","yyyy/M/dd h:mm:s","yyyy/M/dd h:m:ss","yyyy/M/dd h:m:s","yyyy/M/dd hh:mm:ss tt","yyyy/M/dd hh:mm:s tt","yyyy/M/dd hh:m:ss tt","yyyy/M/dd hh:m:s tt","yyyy/M/dd h:mm:ss tt","yyyy/M/dd h:mm:s tt","yyyy/M/dd h:m:ss tt","yyyy/M/dd h:m:s tt","yyyy/M/d hh:mm:ss","yyyy/M/d hh:mm:s","yyyy/M/d hh:m:ss","yyyy/M/d hh:m:s","yyyy/M/d hh:mm:ss","yyyy/M/d h:mm:s","yyyy/M/d h:m:ss","yyyy/M/d h:m:s","yyyy/M/d hh:mm:ss tt","yyyy/M/d hh:mm:s tt","yyyy/M/d hh:m:ss tt","yyyy/M/d hh:m:s tt","yyyy/M/d h:mm:ss tt","yyyy/M/d h:mm:s tt","yyyy/M/d h:m:ss tt","yyyy/M/d h:m:s tt","MM-dd-yyyy","MM-d-yyyy","M-dd-yyyy","M-d-yyyy","yy-MM-dd","yy-MM-d","yy-M-dd","yy-M-d","yyyy-MM-dd","yyyy-MM-d","yyyy-M-dd","yyyy-M-d","MM-dd-yyyy hh:mm:s","MM-dd-yyyy hh:m:ss","MM-dd-yyyy hh:m:s","MM-dd-yyyy hh:mm:ss","MM-dd-yyyy h:mm:s","MM-dd-yyyy h:m:ss","MM-dd-yyyy h:m:s","MM-dd-yyyy hh:mm:ss tt","MM-dd-yyyy hh:mm:s tt","MM-dd-yyyy hh:m:ss tt","MM-dd-yyyy hh:m:s tt","MM-dd-yyyy h:mm:ss tt","MM-dd-yyyy h:mm:s tt","MM-dd-yyyy h:m:ss tt","MM-dd-yyyy h:m:s tt","MM-d-yyyy hh:mm:ss","MM-d-yyyy hh:mm:s","MM-d-yyyy hh:m:ss","MM-d-yyyy hh:m:s","MM-d-yyyy hh:mm:ss","MM-d-yyyy h:mm:s","MM-d-yyyy h:m:ss","MM-d-yyyy h:m:s","MM-d-yyyy hh:mm:ss tt","MM-d-yyyy hh:mm:s tt","MM-d-yyyy hh:m:ss tt","MM-d-yyyy hh:m:s tt","MM-d-yyyy h:mm:ss tt","MM-d-yyyy h:mm:s tt","MM-d-yyyy h:m:ss tt","MM-d-yyyy h:m:s tt","M-dd-yyyy hh:mm:ss","M-dd-yyyy hh:mm:s","M-dd-yyyy hh:m:ss","M-dd-yyyy hh:m:s","M-dd-yyyy hh:mm:ss","M-dd-yyyy h:mm:s","M-dd-yyyy h:m:ss","M-dd-yyyy h:m:s","M-dd-yyyy hh:mm:ss tt","M-dd-yyyy hh:mm:s tt","M-dd-yyyy hh:m:ss tt","M-dd-yyyy hh:m:s tt","M-dd-yyyy h:mm:ss tt","M-dd-yyyy h:mm:s tt","M-dd-yyyy h:m:ss tt","M-dd-yyyy h:m:s tt","M-d-yyyy hh:mm:ss","M-d-yyyy hh:mm:s","M-d-yyyy hh:m:ss","M-d-yyyy hh:m:s","M-d-yyyy hh:mm:ss","M-d-yyyy h:mm:s","M-d-yyyy h:m:ss","M-d-yyyy h:m:s","M-d-yyyy hh:mm:ss tt","M-d-yyyy hh:mm:s tt","M-d-yyyy hh:m:ss tt","M-d-yyyy hh:m:s tt","M-d-yyyy h:mm:ss tt","M-d-yyyy h:mm:s tt","M-d-yyyy h:m:ss tt","M-d-yyyy h:m:s tt","yy-MM-dd hh:mm:ss","yy-MM-dd hh:mm:s","yy-MM-dd hh:m:ss","yy-MM-dd hh:m:s","yy-MM-dd h:mm:ss","yy-MM-dd h:mm:s","yy-MM-dd h:m:ss","yy-MM-dd h:m:s","yy-MM-dd hh:mm:ss tt","yy-MM-dd hh:mm:s tt","yy-MM-dd hh:m:ss tt","yy-MM-dd hh:m:s tt","yy-MM-dd h:mm:ss tt","yy-MM-dd h:mm:s tt","yy-MM-dd h:m:ss tt","yy-MM-dd h:m:s tt","yy-MM-d hh:mm:ss","yy-MM-d hh:mm:s","yy-MM-d hh:m:ss","yy-MM-d hh:m:s","yy-MM-d hh:mm:ss","yy-MM-d h:mm:s","yy-MM-d h:m:ss","yy-MM-d h:m:s","yy-MM-d hh:mm:ss tt","yy-MM-d hh:mm:s tt","yy-MM-d hh:m:ss tt","yy-MM-d hh:m:s tt","yy-MM-d h:mm:ss tt","yy-MM-d h:mm:s tt","yy-MM-d h:m:ss tt","yy-MM-d h:m:s tt","yy-M-dd hh:mm:ss","yy-M-dd hh:mm:s","yy-M-dd hh:m:ss","yy-M-dd hh:m:s","yy-M-dd hh:mm:ss","yy-M-dd h:mm:s","yy-M-dd h:m:ss","yy-M-dd h:m:s","yy-M-dd hh:mm:ss tt","yy-M-dd hh:mm:s tt","yy-M-dd hh:m:ss tt","yy-M-dd hh:m:s tt","yy-M-dd h:mm:ss tt","yy-M-dd h:mm:s tt","yy-M-dd h:m:ss tt","yy-M-dd h:m:s tt","yy-M-d hh:mm:ss","yy-M-d hh:mm:s","yy-M-d hh:m:ss","yy-M-d hh:m:s","yy-M-d hh:mm:ss","yy-M-d h:mm:s","yy-M-d h:m:ss","yy-M-d h:m:s","yy-M-d hh:mm:ss tt","yy-M-d hh:mm:s tt","yy-M-d hh:m:ss tt","yy-M-d hh:m:s tt","yy-M-d h:mm:ss tt","yy-M-d h:mm:s tt","yy-M-d h:m:ss tt","yy-M-d h:m:s tt","yyyy-MM-dd hh:mm:ss","yyyy-MM-dd hh:mm:s","yyyy-MM-dd hh:m:ss","yyyy-MM-dd hh:m:s","yyyy-MM-dd hh:mm:ss","yyyy-MM-dd h:mm:s","yyyy-MM-dd h:m:ss","yyyy-MM-dd h:m:s","yyyy-MM-dd hh:mm:ss tt","yyyy-MM-dd hh:mm:s tt","yyyy-MM-dd hh:m:ss tt","yyyy-MM-dd hh:m:s tt","yyyy-MM-dd h:mm:ss tt","yyyy-MM-dd h:mm:s tt","yyyy-MM-dd h:m:ss tt","yyyy-MM-dd h:m:s tt","yyyy-MM-d hh:mm:ss","yyyy-MM-d hh:mm:s","yyyy-MM-d hh:m:ss","yyyy-MM-d hh:m:s","yyyy-MM-d hh:mm:ss","yyyy-MM-d h:mm:s","yyyy-MM-d h:m:ss","yyyy-MM-d h:m:s","yyyy-MM-d hh:mm:ss tt","yyyy-MM-d hh:mm:s tt","yyyy-MM-d hh:m:ss tt","yyyy-MM-d hh:m:s tt","yyyy-MM-d h:mm:ss tt","yyyy-MM-d h:mm:s tt","yyyy-MM-d h:m:ss tt","yyyy-MM-d h:m:s tt","yyyy-M-dd hh:mm:ss","yyyy-M-dd hh:mm:s","yyyy-M-dd hh:m:ss","yyyy-M-dd hh:m:s","yyyy-M-dd hh:mm:ss","yyyy-M-dd h:mm:s","yyyy-M-dd h:m:ss","yyyy-M-dd h:m:s","yyyy-M-dd hh:mm:ss tt","yyyy-M-dd hh:mm:s tt","yyyy-M-dd hh:m:ss tt","yyyy-M-dd hh:m:s tt","yyyy-M-dd h:mm:ss tt","yyyy-M-dd h:mm:s tt","yyyy-M-dd h:m:ss tt","yyyy-M-dd h:m:s tt","yyyy-M-d hh:mm:ss","yyyy-M-d hh:mm:s","yyyy-M-d hh:m:ss","yyyy-M-d hh:m:s","yyyy-M-d hh:mm:ss","yyyy-M-d h:mm:s","yyyy-M-d h:m:ss","yyyy-M-d h:m:s","yyyy-M-d hh:mm:ss tt","yyyy-M-d hh:mm:s tt","yyyy-M-d hh:m:ss tt","yyyy-M-d hh:m:s tt","yyyy-M-d h:mm:ss tt","yyyy-M-d h:mm:s tt","yyyy-M-d h:m:ss tt","yyyy-M-d h:m:s tt"]})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){function a(n){return n.split("\u00a0").join(" ").toUpperCase()}function s(n){for(var i=[],t=0,r=n.length;t<r;t++)i[t]=a(n[t]);return i}function d(t,i,r){var f=a(t),u=n.ArrayHelper.indexOf(i,f);return u===-1&&(u=n.ArrayHelper.indexOf(r,f)),u}function tt(i){if(arguments.length===0)return n._currentCulture;typeof i!==o&&i!==t&&i.toLowerCase()!==n._currentCulture&&(n.switchCulture(i),n._CacheMgr.clearFormatCache(),ct(i))}function ot(t){var i=t.toLowerCase(),u,f;if(n._currentCulture!==i){n._currentCultureResouce=l(i);n.CR=n._currentCultureResouce;switch(i){case"ja-jp":u=n._JAStringResource;u&&(n.SR=u);r.currentCulture("ja-jp");break;case"en-us":n.SR=n._ENStringResource;r.currentCulture("en-us");break;case"zh-cn":f=n._ZHStringResource;f&&(n.SR=f);r.currentCulture("zh-cn");break;default:n.SR=n._ENStringResource;r.currentCulture(i);break}n._currentCulture=i}}function st(t,i){var r=i.numberDecimalSeparator,f=i.arrayGroupSeparator,u=i.arrayListSeparator,e=i.listSeparator;if(r===e||r===u||u===f)throw n.SR.Exp_Separator;n.cultureInfoDict[t.toLowerCase()]=i}function ht(t){var r=l(t),i=new n.CultureInfo;return n.GC$.extend(i,r),i}function l(t){t=t.toLowerCase();var i=n.cultureInfoDict[t];return i||(i=n.cultureInfoDict[""]),i}function ct(t){n.GC$("div[gcUIElement='gcSpread']").trigger(n.Events.CultureChanged,[{CultureInfo:t}])}var y,p,w,b,r,h,g,v,it,rt;n.feature("core.globalize",["core.stringResource","core.cultureInfo"]);var t=null,i=undefined,lt=Math.max,ut=Math.min,ft=Math.ceil,e=Math.floor,u=Math.abs,f=Math.pow,o="undefined",c=function(){function n(n){this._value={};this._len=0;this._init(n)}return n.prototype._init=function(n){this._parts=typeof n!==o&&n!==t&&n!==""?[n.toString()]:[];this._value={};this._len=0},n.prototype._insert=function(n){this._parts.splice(0,0,n)},n.prototype.insert=function(n,r){var u=this,f,e,o;if((r===i||r===t)&&(r=0),r===0){u._insert(n);return}if(f=u.toString(),r>=f.length){u.append(n);return}e=f.substring(0,r);o=f.substr(r);u._init(e+n+o)},n.prototype.append=function(n){this._parts[this._parts.length]=n},n.prototype.appendLine=function(n){this._parts[this._parts.length]=typeof n===o||n===t||n===""?"\r\n":n+"\r\n"},n.prototype.clear=function(){this._init()},n.prototype.isEmpty=function(){return this._parts.length===0?!0:this.toString()===""},n.prototype.toString=function(n){var u=this,i,f,r;if(n=n||"",i=u._parts,u._len!==i.length&&(u._value={},u._len=i.length),f=u._value,typeof f[n]===o){if(n!=="")for(r=0;r<i.length;)typeof i[r]===o||i[r]===""||i[r]===t?i.splice(r,1):r++;f[n]=u._parts.join(n)}return f[n]},n}();n._StringBuilder=c;y=function(){function t(){var t=this,i=n._currentCultureResouce;t.currencyDecimalDigits=i.currencyDecimalDigits;t.currencyDecimalSeparator=i.currencyDecimalSeparator;t.currencyPositivePattern=i.currencyPositivePattern;t.currencyGroupSeparator=i.currencyGroupSeparator;t.currencySymbol=i.currencySymbol;t.currencyGroupSizes=i.currencyGroupSizes;t.currencyNegativePattern=i.currencyNegativePattern;t.digitSubstitution=i.digitSubstitution;t.isReadOnly=i.isReadOnly;t.numberGroupSizes=i.numberGroupSizes;t.nanSymbol=i.nanSymbol;t.nativeDigits=i.nativeDigits;t.numberNegativePattern=i.numberNegativePattern;t.negativeInfinitySymbol=i.negativeInfinitySymbol;t.negativeSign=i.negativeSign;t.numberDecimalDigits=i.numberDecimalDigits;t.numberDecimalSeparator=i.numberDecimalSeparator;t.numberGroupSeparator=i.numberGroupSeparator;t.positiveInfinitySymbol=i.positiveInfinitySymbol;t.positiveSign=i.positiveSign;t.percentDecimalDigits=i.percentDecimalDigits;t.percentDecimalSeparator=i.percentDecimalSeparator;t.percentGroupSeparator=i.percentGroupSeparator;t.percentSymbol=i.percentSymbol;t.perMilleSymbol=i.perMilleSymbol;t.percentPositivePattern=i.percentPositivePattern;t.percentNegativePattern=i.percentNegativePattern;t.percentGroupSizes=i.percentGroupSizes}return t}();n._NumberFormatInfo=y;p=function(){function n(){var n=this;n.MinSupportedDateTime="@-62135568000000@";n.MaxSupportedDateTime="@253402300799999@";n.AlgorithmType=1;n.CalendarType=1;n.Eras=[1];n.TwoDigitYearMax=2029;n.isReadOnly=!0}return n}();n._Calendar=p;w=function(){function t(){var t=this,i=n._currentCultureResouce;t.amDesignator=i.amDesignator;t.abbreviatedMonthNames=i.abbreviatedMonthNames;t.abbreviatedDayNames=i.abbreviatedDayNames;t.abbreviatedMonthGenitiveNames=i.abbreviatedMonthGenitiveNames;t.Calendar=new p;t.calendarWeekRule=i.calendarWeekRule;t.dateSeparator=i.dateSeparator;t.dayNames=i.dayNames;t.firstDayOfWeek=i.firstDayOfWeek;t.fullDateTimePattern=i.fullDateTimePattern;t.isReadOnly=i.isReadOnly;t.longDatePattern=i.longDatePattern;t.longTimePattern=i.longTimePattern;t.monthDayPattern=i.monthDayPattern;t.monthNames=i.monthNames;t.monthGenitiveNames=i.monthGenitiveNames;t.nativeCalendarName=i.nativeCalendarName;t.pmDesignator=i.pmDesignator;t.rfc1123Pattern=i.rfc1123Pattern;t.shortDatePattern=i.shortDatePattern;t.shortTimePattern=i.shortTimePattern;t.sortableDateTimePattern=i.sortableDateTimePattern;t.shortestDayNames=i.shortestDayNames;t.timeSeparator=i.timeSeparator;t.universalSortableDateTimePattern=i.universalSortableDateTimePattern;t.yearMonthPattern=i.yearMonthPattern;t.Calendar.isReadOnly=i.calendarIsReadOnly}return t}();n._DateTimeFormatInfo=w;b=function(){function n(){}return n.isValidEraDate=function(n){return n<this.getEraMin()||n>this.getEraMax()?!1:!0},n.getEraDates=function(){var t=window.spreadJSEras,r,n,u;if(t!=i){for(r=[],n=0;n<t.length;n++)u=new Date(t[n].startDate.replace(/-/g,"/")),r[n]=u;return r}return this.EraDates},n.getEraNames=function(){var r=window.spreadJSEras,t=[],n;if(r!=i){for(n=0;n<r.length;n++)t[n]=r[n].name;return t}for(n=0;n<this.EraCount;n++)t[n]=this.EraNames[n+2*this.EraCount];return t},n.getEraSymbols=function(){var r=window.spreadJSEras,t=[],n;if(r!=i){for(n=0;n<r.length;n++)t[n]=r[n].symbol;return t}for(n=0;n<this.EraCount;n++)t[n]=this.EraNames[n];return t},n.getEraAbbreviations=function(){var r=window.spreadJSEras,t=[],n;if(r!=i){for(n=0;n<r.length;n++)t[n]=r[n].abbreviation;return t}for(n=0;n<this.EraCount;n++)t[n]=this.EraNames[n+this.EraCount];return t},n.getEraShortcuts=function(){var r=window.spreadJSEras,t=[],n;if(r!=i){for(n=0;n<r.length;n++)t[n]=r[n].shortcuts.split(",")[0];return t}for(n=0;n<this.EraCount;n++)t[n]=this.EraKeys[n];return t},n.getEraMax=function(){var n=window.spreadJSEras,t;return n!=i&&n.length>0?(t=new Date(n[n.length-1].startDate.replace(/-/g,"/")),t.setFullYear(t.getFullYear()+99),t):this.EraMax},n.getEraMin=function(){var n=window.spreadJSEras;return n!=i&&n.length>0?new Date(n[0].startDate.replace(/-/g,"/")):this.EraMin},n.getEraCount=function(){var n=window.spreadJSEras;return n!=i?n.length:this.EraCount},n.getEraYears=function(){var t=window.spreadJSEras,r,n,u,f;if(t!=i){for(r=[],n=1;n<t.length;n++)u=new Date(t[n-1].startDate.replace(/-/g,"/")),f=new Date(t[n].startDate.replace(/-/g,"/")),r[n-1]=f.getFullYear()-u.getFullYear()+1;return r[n-1]=99,r}return this.EraYears},n.getEraDate=function(n){var r={},t,i,u;if(r.era=-1,r.eraYear=-1,t=this,!t.isValidEraDate(n))return r;for(i=0;i<t.getEraCount();i++)if(u=i+1!=t.getEraCount()?t.getEraDates()[i+1]:t.addMilliseconds(t.getEraMax(),1),n<u){r.era=i;r.eraYear=n.getFullYear()-t.getEraDates()[i].getFullYear()+1;break}return r},n.addMilliseconds=function(n,t){var i=new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds());return i.setMilliseconds(i.getMilliseconds()+t),new Date(i.valueOf())},n.getYearFromEra=function(t,i){var r=n.getEraDates()[t].getFullYear();return r+i-1},n.parseEraPart=function(t,i){var u,f,e,o,r;i=i.toUpperCase();u=n;switch(t){case"g":for(f=u.getEraSymbols(),r=0;r<f.length;r++)if(f[r]===i)return r;break;case"gg":for(e=u.getEraAbbreviations(),r=0;r<e.length;r++)if(e[r]===i)return r;break;case"ggg":for(o=u.getEraNames(),r=0;r<o.length;r++)if(o[r]===i)return r;break}return-1},n.formatEraPart=function(t,i){var f=n,r=f.getEraDate(i),e,u;switch(t){case"g":if(r.era<0)break;return f.getEraSymbols()[r.era];case"gg":if(r.era<0)break;return f.getEraAbbreviations()[r.era];case"ggg":if(r.era<0)break;return f.getEraNames()[r.era];case"ee":if(r.eraYear<0)break;return u=r.eraYear.toString(),u.length===1&&(u="0"+u),u;case"e":if(r.eraYear<0)break;return r.eraYear.toString()}return""},n.EraDates=[new Date(1868,8,8),new Date(1912,6,30),new Date(1926,11,25),new Date(1989,0,8)],n.EraCount=4,n.EraYears=[45,15,64,99],n.EraMax=new Date(2087,11,31,23,59,59),n.EraMin=new Date(1868,8,8),n.EraKeys=["1","2","3","4","m","t","s","h"],n.EraIndices=[0,1,2,3,0,1,2,3],n.EraNames=["M","T","S","H","\u660e","\u5927","\u662d","\u5e73","\u660e\u6cbb","\u5927\u6b63","\u662d\u548c","\u5e73\u6210"],n.EraYearMax=99,n}();n._EraHelper=b;r=function(){function t(t){var i=this;t=t?t:"";i.name=t;n._currentCultureResouce=l(t);i.numberFormat=new y;i.dateTimeFormat=new w}return t.prototype.Name=function(){return this.name},t.prototype.NumberFormat=function(){return this.numberFormat},t.prototype.DateTimeFormat=function(){return this.dateTimeFormat},t.prototype._getDateTimeFormats=function(){return this._dateTimeFormats||(this._dateTimeFormats=n.dateTimeFormats),this._dateTimeFormats},t.prototype._getMonthIndex=function(n){var t=this;return t._upperMonths||(t._upperMonths=s(t.dateTimeFormat.monthNames),t._upperMonthsGenitive=s(t.dateTimeFormat.monthGenitiveNames)),d(n,t._upperMonths,t._upperMonthsGenitive)},t.prototype._getAbbrMonthIndex=function(n){var t=this;return t._upperAbbrMonths||(t._upperAbbrMonths=s(t.dateTimeFormat.abbreviatedMonthNames),t._upperAbbrMonthsGenitive=s(t.dateTimeFormat.abbreviatedMonthGenitiveNames)),d(n,t._upperAbbrMonths,t._upperAbbrMonthsGenitive)},t.prototype._getDayIndex=function(t){var i=this;return i._upperDays||(i._upperDays=s(i.dateTimeFormat.dayNames)),n.ArrayHelper.indexOf(i._upperDays,a(t))},t.prototype._getAbbrDayIndex=function(t){var i=this;return i._upperAbbrDays||(i._upperAbbrDays=s(i.dateTimeFormat.abbreviatedDayNames)),n.ArrayHelper.indexOf(i._upperAbbrDays,a(t))},t.invariantCulture=function(){var n=t;return n._invariantCulture||(n._invariantCulture=new t("")),n._invariantCulture},t.currentCulture=function(n){if(typeof n=="undefined")return t._currentCulture;var i=t;return i._currentCulture=i.getCulture(n),i._currentCulture},t.enCulture=function(){var n=t;return n._enCulture||(n._enCulture=new t("en-US")),n._enCulture},t.jaCulture=function(){var n=t,i;return n._jaCulture||(i=new t("ja-JP"),i.dateTimeFormat.eras=b,n._jaCulture=i),n._jaCulture},t.zhCulture=function(){var n=t;return n._zhCulture||(n._zhCulture=new t("zh-CN")),n._zhCulture},t.customCulture=function(n){var i=t,r;return i._customCulture&&i._customCulture.Name()===n||(r=new t(n),i._customCulture=r),i._customCulture},t.getCulture=function(i){i=i?i:"";i=i.toLowerCase();n._currentCultureResouce=l(i);switch(i){case"ja-jp":return t.jaCulture();case"en-us":return t.enCulture();case"zh-cn":return t.zhCulture();default:return t.customCulture(i)}},t}();n._CultureInfo=r;h=function(){function i(n){this._str=n}return i.__toFormattedString=function(i,r){for(var c,e,v,f,h="",s=r[0],u=0;;){if(c=s.indexOf("{",u),e=s.indexOf("}",u),c<0&&e<0){h+=s.slice(u);break}if(e>0&&(e<c||c<0)){if(s.charAt(e+1)!=="}")throw new Error(n.SR.Exp_BraceMismatch);h+=s.slice(u,e+1);u=e+2;continue}if(h+=s.slice(u,c),u=c+1,s.charAt(u)==="{"){h+="{";u++;continue}if(e<0)throw new Error(n.SR.Exp_BraceMismatch);var l=s.substring(u,e),a=l.indexOf(":"),y=parseInt(a<0?l:l.substring(0,a),10)+1;if(isNaN(y))throw new Error(n.SR.Exp_InvalidFormat);v=a<0?"":l.substring(a+1);f=r[y];(typeof f===o||f===t)&&(f="");h+=f.toFormattedString?f.toFormattedString(v):i&&f.localeFormat?f.localeFormat(v):f.format?f.format(v):f.toString();u=e+1}return h},i.prototype.startsWith=function(n){return this._str.substr(0,n.length)===n},i.prototype.endsWith=function(n){return this._str.indexOf(n,this._str.length-n.length)!==-1},i.prototype.trim=function(){return this._str.replace(/^\s+|\s+$/g,"")},i.prototype.trimEnd=function(){return this._str.replace(/\s+$/,"")},i.prototype.trimStart=function(){return this._str.replace(/^\s+/,"")},i.format=function(n,t){var u=[],r;for(u.push(n),r=0;r<t.length;r++)u.push(t[r]);return i.__toFormattedString(!1,u)},i}();n._StringHelper=h;g=function(){function n(){}return n.Contains=function(n,t){return t===""||n.indexOf(t)>=0},n.IndexOf=function(n,t,i){if(i)if(i===1){var r=n.toLowerCase(),u=t.toLowerCase();return r.indexOf(u)}else return n.indexOf(t);else return n.indexOf(t)},n.TrimStart=function(n,t){if(!t)return n;for(var i=n;;){if(i.substr(0,t.length)!==t)break;i=i.substr(t.length)}return i},n.TrimEnd=function(n,t){if(!t)return n;for(var i=n;;){if(i.substr(i.length-t.length,t.length)!==t)break;i=i.substr(0,i.length-t.length)}return i},n.Trim=function(t,i){var r=i;return i||(r=" "),t=n.TrimStart(t,r),n.TrimEnd(t,r)},n.Insert=function(n,r,u){if(r<0||r>n.length||u===t||u===i)throw new Error;var f=n.substr(0,r),e=n.substr(r,n.length-r);return f+u+e},n.Remove=function(n,r,u){if((u===i||u===t)&&(u=n.length-r),r<0||u<0||r+u>n.length)throw new Error;var f=n.substr(0,r),e=n.substr(r+u,n.length-r-u);return f+e},n.StartsWith=function(n,t,i){if(!t)throw new Error;if(t==="")return!0;if(t.length>n.length)return!1;var r=n,u=t;return i===1&&(r=r.toLowerCase(),u=u.toLowerCase()),r.search(new RegExp("^"+u))>-1},n.EndsWith=function(n,t,i){var r=n.length-t.length;return r>=0&&n.indexOf(t,r)===r},n.Replace=function(n,t,i){if(!t||t==="")throw new Error;i=(""+i).replace(/\$/g,"$$$$");var r=new RegExp(t,"g");return n.replace(r,i)},n}();n.StringHelper=g;v=function(){function f(n){this._date=n}return f.prototype.Hour=function(){return this._date.getHours()},f.prototype.Minute=function(){return this._date.getMinutes()},f.prototype.Second=function(){return this._date.getSeconds()},f.prototype.Millisecond=function(){return this._date.getMilliseconds()},f.prototype.TotalDays=function(){return e(this.toOADate())},f.prototype.toOADate=function(){return f.___toOADate(this._date)},f.prototype.format=function(n){return this._toFormattedString(n,r._currentCulture)},f.prototype.customCultureFormat=function(n,t){return t||(t=r._currentCulture),this._toFormattedString(n,t)},f.prototype.localeFormat=function(n,t){return t||(t=r._currentCulture),this._toFormattedString(n,t)},f.prototype._toFormattedString=function(i,r){function ft(){return w||rt?w:(w=ut.test(i),rt=!0,w)}function v(n,t){if(l)return l[t];switch(t){case 0:return n.getFullYear();case 1:return n.getMonth();case 2:return n.getDate()}}var o=this,h=r.DateTimeFormat(),k=h.Calendar.convert,a,it,s,c,w,rt,ut,d,g,l,y;if(!i||!i.length||i==="i")return r&&r.Name().length?k?o._toFormattedString(h.fullDateTimePattern,r):o._date.toLocaleString():o._date.toString();a=h.eras;it=i==="s";i=f.__expandFormat(h,i);s="";ut=/([^d]|^)(d|dd)([^d]|$)/g;d=0;g=f.__getTokenRegExp();!it&&k&&(l=k.fromGregorian(o._date));var st=t,b=-2,nt=-2,tt={value:""};for(y=0;;y++){var et=g.lastIndex,p=g.exec(i),ot=i.slice(et,p?p.index:i.length);if(tt.value="",d+=f.__appendPreOrPostMatch(ot,tt),s+=tt.value,!p)break;if(d%2==1){s+=p[0];continue}switch(p[0]){case"dddd":s+=h.dayNames[o._date.getDay()];break;case"ddd":s+=h.abbreviatedDayNames[o._date.getDay()];break;case"dd":w=!0;s+=f.___addLeadingZero(v(o._date,2));break;case"d":w=!0;s+=v(o._date,2);break;case"MMMM":s+=h.monthGenitiveNames&&ft()?h.monthGenitiveNames[v(o._date,1)]:h.monthNames[v(o._date,1)];break;case"MMM":s+=h.abbreviatedMonthGenitiveNames&&ft()?h.abbreviatedMonthGenitiveNames[v(o._date,1)]:h.abbreviatedMonthNames[v(o._date,1)];break;case"MM":s+=f.___addLeadingZero(v(o._date,1)+1);break;case"M":s+=v(o._date,1)+1;break;case"yyyy":case"yyy":s+=b>=0?a.formatEraPart("ee",o._date):f.___padYear(l?l[0]:o._date.getFullYear());break;case"yy":s+=b>=0?a.formatEraPart("ee",o._date):f.___addLeadingZero((l?l[0]:o._date.getFullYear())%100);break;case"y":s+=b>=0?a.formatEraPart("e",o._date):((l?l[0]:o._date.getFullYear())%100).toString();break;case"hh":c=o._date.getHours()%12;c===0&&(c=12);s+=f.___addLeadingZero(c);break;case"h":c=o._date.getHours()%12;c===0&&(c=12);s+=c;break;case"HH":s+=f.___addLeadingZero(o._date.getHours());break;case"H":s+=o._date.getHours().toString();break;case"mm":s+=f.___addLeadingZero(o._date.getMinutes());break;case"m":s+=o._date.getMinutes().toString();break;case"ss":s+=f.___addLeadingZero(o._date.getSeconds());break;case"s":s+=o._date.getSeconds().toString();break;case"tt":s+=o._date.getHours()<12?h.amDesignator:h.pmDesignator;break;case"t":s+=(o._date.getHours()<12?h.amDesignator:h.pmDesignator).charAt(0);break;case"f":s+=f.___addLeadingZeros(o._date.getMilliseconds()).charAt(0);break;case"ff":s+=f.___addLeadingZeros(o._date.getMilliseconds()).substr(0,2);break;case"fff":s+=f.___addLeadingZeros(o._date.getMilliseconds());break;case"z":c=o._date.getTimezoneOffset()/60;s+=(c<=0?"+":"-")+e(u(c));break;case"zz":c=o._date.getTimezoneOffset()/60;s+=(c<=0?"+":"-")+f.___addLeadingZero(e(u(c)));break;case"zzz":c=o._date.getTimezoneOffset()/60;s+=(c<=0?"+":"-")+f.___addLeadingZero(e(u(c)))+":"+f.___addLeadingZero(u(o._date.getTimezoneOffset()%60));break;case"g":case"gg":case"ggg":if(!a)break;if(b===y-1){b=y;break}else s+=a.formatEraPart(p[0],o._date),b=y;break;case"e":case"ee":if(a)if(nt===y-1){nt=y;break}else s+=a.formatEraPart(p[0],o._date),nt=y;else{s+=f.___padYear(l?l[0]:o._date.getFullYear());break}break;case"/":s+=h.dateSeparator;break;case"[h]":s+="[h]";break;case"[hh]":s+="[hh]";break;case"[mm]":s+="[mm]";break;case"[ss]":s+="[ss]";break;default:throw new Error(n.SR.Exp_InvalidDateFormat);}}return s.toString()},f.parseLocale=function(n,t,i){var u;return u=t?[n,t]:[n],i||(i=r._currentCulture),f._parseDate(n,i,u)},f.parseInvariant=function(n,t){return f._parseDate(n,r.invariantCulture(),[n,t])},f.__appendPreOrPostMatch=function(n,t){for(var u,f=0,i=!1,r=0,e=n.length;r<e;r++){u=n.charAt(r);switch(u){case"'":case'"':i?t.value+="'":f++;i=!1;break;case"\\":i&&(t.value+="\\");i=!i;break;default:t.value+=u;i=!1;break}}return f},f.__expandFormat=function(t,i){i||(i="F");var r=i.length;if(r===1)switch(i){case"d":return t.shortDatePattern;case"D":return t.longDatePattern;case"t":return t.shortTimePattern;case"T":return t.longTimePattern;case"f":return t.longDatePattern+" "+t.shortTimePattern;case"F":return t.fullDateTimePattern;case"M":case"m":return t.monthDayPattern;case"s":return t.sortableDateTimePattern;case"Y":case"y":return t.yearMonthPattern;case"g":return t.shortDatePattern+" "+t.shortTimePattern;case"G":return t.shortDatePattern+" "+t.longTimePattern;case"e":return i;case"R":case"r":return t.rfc1123Pattern;case"u":return t.universalSortableDateTimePattern;case"U":return t.fullDateTimePattern;case"o":case"O":return"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffff";default:throw new Error(n.SR.Exp_InvalidString);}else r===2&&i.charAt(0)==="%"&&(i=i.charAt(1));return i},f.__expandYear=function(n,t){var u=new Date,r=n.DateTimeFormat().eras,i;return r&&t<100&&(i=r.getEraDate(u).eraYear,t+=i-i%100,t>n.DateTimeFormat().Calendar.TwoDigitYearMax&&(t-=100)),t},f.__getTokenRegExp=function(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|ggg|gg|g|ee|e|\[h\]|\[hh\]|\[mm\]|\[ss\]/g},f.__getParseRegExp=function(i,r){var e,p,c,l;if(i._parseRegExp){if(i._parseRegExp[r])return i._parseRegExp[r]}else i._parseRegExp={};e=f.__expandFormat(i,r);e=e.replace("%M","M");e=e.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1");for(var u="^",o={value:""},a=[],h=0,v=0,y=f.__getTokenRegExp(),s;(s=y.exec(e))!==t;){if(o.value="",p=e.slice(h,s.index),h=y.lastIndex,v+=f.__appendPreOrPostMatch(p,o),u+=o.value,v%2==1){u+=s[0];continue}switch(s[0]){case"dddd":case"ddd":case"MMMM":case"MMM":case"gggg":case"ggg":case"gg":case"g":u+="(\\D+)";break;case"tt":case"t":u+="(\\D*)";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"eee":case"ee":case"e":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":u+="(\\d\\d?)";break;case"yyy":case"yyyy":u+="(\\d{2}|\\d{4})";break;case"fff":u+="(\\d{3})";break;case"ff":u+="(\\d{2})";break;case"f":u+="(\\d)";break;case"zzz":u+="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":u+="([+-]?\\d\\d?)";break;case"/":u+="(\\"+i.dateSeparator+")";break;default:throw new Error(n.SR.Exp_InvalidDateFormat);}n.ArrayHelper.add(a,s[0])}return o.value="",f.__appendPreOrPostMatch(e.slice(h),o),u+=o.value,u+="$",c=u.toString().replace(/\s+/g,"\\s+"),l={regExp:c,groups:a,exp:new RegExp(c)},i._parseRegExp[r]=l,l},f._parseDateExact=function(i,r,u){var b,vt,e,st,ut,d,ht,ct;i=n.GC$.trim(i);var a=u.DateTimeFormat(),lt=f.__getParseRegExp(a,r),at=lt.exp.exec(i);if(at===t)return t;var ft=lt.groups,et=t,o=t,c=t,v=t,y=t,k=0,p,tt=0,it=0,l=0,rt=t,ot=!1,w=!0;for(b=0,vt=ft.length;b<vt;b++)if(e=at[b+1],e)switch(ft[b]){case"dd":case"d":if(w=!1,v=parseInt(e,10),v<1||v>31)return t;break;case"MMMM":if(w=!1,c=u._getMonthIndex(e),c<0||c>11)return t;break;case"MMM":if(w=!1,c=u._getAbbrMonthIndex(e),c<0||c>11)return t;break;case"M":case"MM":case"%M":if(w=!1,c=parseInt(e,10)-1,c<0||c>11)return t;break;case"e":case"ee":if(w=!1,o=f.__expandYear(u,parseInt(e,10)),o<0||o>9999)return t;break;case"y":case"yy":case"yyy":case"yyyy":if(w=!1,o=parseInt(e,10),o<0||o>9999)return t;break;case"h":case"hh":case"H":case"HH":if(k=parseInt(e,10),k<0)return t;break;case"m":case"mm":if(tt=parseInt(e,10),tt<0||tt>59)return t;break;case"s":case"ss":if(it=parseInt(e,10),it<0||it>59)return t;break;case"tt":case"t":if(st=e.toUpperCase(),ot=st===a.pmDesignator.toUpperCase(),!ot&&st!==a.amDesignator.toUpperCase())return t;break;case"f":if(l=parseInt(e,10)*100,l<0||l>999)return t;break;case"ff":if(l=parseInt(e,10)*10,l<0||l>999)return t;break;case"fff":if(l=parseInt(e,10),l<0||l>999)return t;break;case"dddd":if(w=!1,y=u._getDayIndex(e),y<0||y>6)return t;break;case"ddd":if(w=!1,y=u._getAbbrDayIndex(e),y<0||y>6)return t;break;case"zzz":if((ut=e.split(/:/),ut.length!==2)||(p=parseInt(ut[0],10),p<-12||p>13)||(d=parseInt(ut[1],10),d<0||d>59))return t;rt=p*60+(new h(e).startsWith("-")?-d:d);break;case"z":case"zz":if(p=parseInt(e,10),p<-12||p>13)return t;rt=p*60;break;case"g":case"gg":case"ggg":if((ht=e,!ht||!a.eras)||(et=a.eras.parseEraPart(ft[b],ht),et<0))return t;break}var yt=/^(\d|\d\d):/.test(i),s=yt?new Date(1899,11,30):new Date,g,nt=a.Calendar.convert;if(nt&&(g=nt.fromGregorian(s)),nt||(g=[s.getFullYear(),s.getMonth(),s.getDate()]),o===t?o=g[0]:o<100&&(a.eras?o=a.eras.getYearFromEra(et||0,o):o+=o>=30?1900:2e3),c===t&&(c=g[1]),v===t&&(v=g[2]),nt){if(s=nt.toGregorian(o,c,v),s===t)return t}else if((s.setFullYear(o,c,v),s.getDate()!==v)||y!==t&&s.getDay()!==y)return t;return ot&&k<12&&(k+=12),s.setHours(k,tt,it,l),rt!==t&&(ct=s.getMinutes()-(rt+s.getTimezoneOffset()),s.setHours(s.getHours()+ct/60,ct%60)),s},f.___addLeadingZero=function(n){return n<10?"0"+n:n.toString()},f.___addLeadingZeros=function(n){return n<10?"00"+n:n<100?"0"+n:n.toString()},f.___padYear=function(n){return n<10?"000"+n:n<100?"00"+n:n<1e3?"0"+n:n.toString()},f._parseDate=function(n,i,r){for(var e,s,h,c=!1,u=1,o=r.length;u<o;u++)if(s=r[u],s&&(c=!0,e=f._parseDateExact(n,s,i),e))return e;if(!c)for(h=i._getDateTimeFormats(),u=0,o=h.length;u<o;u++)if(e=f._parseDateExact(n,h[u],i),e)return e;return t},f.___toOADate=function(n){return n===i||n===t?0:(typeof n=="number"&&(n=new Date(n)),(n.getTime()*1440+3181192704e6-n.getTimezoneOffset()*864e5)/124416e6)},f._fromOADate=function(n){var t=n-25569,i=new Date(t*864e5),r=t>=0?1:-1;return new Date((n*124416e6+r-3181192704e6+i.getTimezoneOffset()*864e5)/1440)},f.parseExact=f._parseDateExact,f.fromOADate=f._fromOADate,f}();n._DateTimeHelper=v;var et=function(){function n(n,t,i){this.normal=n;this.negative=t;this.zero=i}return n}(),nt=function(){function n(){var n=this;n.intPart=t;n.decPart=t;n.group=!1;n.scale=0;n.percent=0;n.permile=0;n.exponent=t}return n}(),k=function(){function o(n){this._num=n}return o.prototype.format=function(n){return this._toFormattedString(n,r.invariantCulture())},o.prototype.localeFormat=function(n,t){return t||(t=r._currentCulture),this._toFormattedString(n,t)},o.prototype.customCultureFormat=function(n,t){return t||(t=r._currentCulture),this._toFormattedString(n,t)},o.prototype._toFormattedString=function(n,t){var i=this;return!n||n.length===0||n==="i"?t&&t.Name().length>0?i._num.toLocaleString():i._num.toString():o.__getStandardTokenRegExp().test(n)?i._toStandardFormattedString(n,t.NumberFormat()):i._toCustomFormattedString(n,t.NumberFormat())},o.prototype._toStandardFormattedString=function(t,i){var s=this,f=u(s._num).toString(),r,e,h,a,v,c,y,l;t||(t="D");r=-1;t.length>1&&(r=parseInt(t.slice(1),10));switch(t.charAt(0)){case"d":case"D":e="n";r!==-1&&(f=o.___zeroPad(""+f,r,!0));s._num<0&&(f="-"+f);break;case"c":case"C":e=s._num<0?o.___currencyNegativePattern[i.currencyNegativePattern]:o.___currencyPositivePattern[i.currencyPositivePattern];r===-1&&(r=i.currencyDecimalDigits);f=o.___expandNumber(u(s._num),r,i.currencyGroupSizes,i.currencyGroupSeparator,i.currencyDecimalSeparator,i.negativeSign);break;case"n":case"N":e=s._num<0?o.___numberNegativePattern[i.numberNegativePattern]:"n";r===-1&&(r=i.numberDecimalDigits);f=o.___expandNumber(u(s._num),r,i.numberGroupSizes,i.numberGroupSeparator,i.numberDecimalSeparator,i.negativeSign);break;case"p":case"P":e=s._num<0?o.___percentNegativePattern[i.percentNegativePattern]:o.___percentPositivePattern[i.percentPositivePattern];r===-1&&(r=i.percentDecimalDigits);f=o.___expandNumber(u(s._num)*100,r,i.percentGroupSizes,i.percentGroupSeparator,i.percentDecimalSeparator,i.negativeSign);break;case"F":case"f":h=s._toFixedPoint(f,e,t,r,i);f=h[0];e=h[1];break;case"e":case"E":h=s._toScientificNotation(f,e,t,r,i);f=h[0];e=h[1];break;case"x":case"X":e="n";f=o.___toHexString(s._num,t.charAt(0)==="x",r===-1?0:r);break;case"g":case"G":a=s._num.toString();h=[];h=a.indexOf("e")===-1&&a.indexOf("E")===-1?s._toFixedPoint(f,e,t,r,i):s._toScientificNotation(f,e,t.replace("g","e").replace("G","E"),r,i);f=h[0];e=h[1];break;default:throw new Error(n.SR.Exp_BadFormatSpecifier);}for(v=/n|\$|-|%/g,c="";;){if(y=v.lastIndex,l=v.exec(e),c+=e.slice(y,l?l.index:e.length),!l)break;switch(l[0]){case"n":c+=f;break;case"$":c+=i.currencySymbol;break;case"-":/[1-9]/.test(f)&&(c+=i.negativeSign);break;case"%":c+=i.percentSymbol;break;default:throw new Error(n.SR.Exp_InvalidNumberFormat);}}return c},o.prototype._toScientificNotation=function(n,t,i,r,f){return t="n",n=o.___toScientific(u(this._num),i.charAt(0),r===-1?6:r,f.numberGroupSizes,",",".",f.negativeSign),this._num<0&&(n="-"+n),[n,t]},o.prototype._toFixedPoint=function(n,t,i,r,u){t=this._num<0?o.___numberNegativePattern[u.numberNegativePattern]:"n";r===-1&&(r=2);var f=parseFloat(n),s=e(f),h=f-s;return n=o.___expandNumber(h,r,u.numberGroupSizes,",",".",u.negativeSign),n=""+(s+(+n>=1?1:0))+n.substring(1),[n,t]},o.prototype._toCustomFormattedString=function(n,i){var f=o.___parseCustomNumberFormatter(n),u=t,r;return this._num===0?u=f.zero:this._num<0&&(u=f.negative),u||(u=f.normal),r=o.___formatNumber(this._num,u,i)+"",r.indexOf(i.negativeSign)===1&&r.indexOf(i.currencySymbol)===0&&(r=r[1]+r[0]+r.substring(2)),r},o.parseLocale=function(n){return o.__parseNumber(n,r._currentCulture)},o.parseInvariant=function(n){return o.__parseNumber(n,r.invariantCulture())},o.__getStandardTokenRegExp=function(){return/^(C|c|D|d|E|e|F|f|G|g|N|n|P|p|R|r|X|x)(\d*)$/g},o.___getDigitLength=function(n,t){for(var s=e(u(n)),f={integer:1,decimal:0},l;s>=10;)s=s/10,f.integer++;var r=n.toString(),h=r.search(/e/ig),o=r.indexOf(t),i;if(h!==-1){var a=r.substr(0,h),v=r.substr(h+1),c=0;o!==-1&&(c=a.substr(o+1).length);l=parseFloat(v);i=c-l;i<0&&(i=0);f.decimal=i}else i=0,o!==-1&&(i=r.substr(o+1).length),f.decimal=i;return f},o.___parseExponentFormat=function(t){for(var i={symbol:t.charAt(0),sign:0,exp:0},r="",u=1;u<t.length;u++)if(r=t.charAt(u),r==="+")i.sign=1;else if(r==="-")i.sign=-1;else if(r==="0"){i.exp=t.length-u;break}else throw new Error(n.SR.Exp_InvalidExponentFormat);return i},o.___parseCustomNumberFormatter=function(r){for(var ut,g,tt,c,l=t,a=t,v=t,s=new nt,u="",it=!1,rt=!1,ft=!1,y=!1,p=!1,w=!1,b=!1,k=!1,f=t,h=t,e=[],d=0;d<r.length;d++){if(f=r.charAt(d),it){f!=="'"?u+=f:(e.push(u),u="",it=!1);h=f;continue}else if(rt){f!=='"'?u+=f:(e.push(u),u="",rt=!1);h=f;continue}else if(ft){e.push(u+f);u="";h=f;continue}else if(y){if(h==="E"||h==="e")if(f==="+"||f==="-"||f==="0"){u+=f;continue}else y=!1;else if(h==="+"||h==="-")if(f==="0"){u+=f;continue}else y=!1,e.push(u),u="";else if(h==="0")if(f==="0"){u+=f;continue}else y=!1,b||(b=!0,s.exponent=o.___parseExponentFormat(u)),e.push(u),u=""}else if(f==="0"||f==="#")if(k=!0,h==="0"||h==="#"){u+=f;h=f;continue}else u!==""&&(e.push(u),u="");else(h==="0"||h==="#")&&f!=="0"&&f!=="#"&&(e.push(u),u="");if(f===";"){if(u!==""&&(y&&!b&&(s.exponent=o.___parseExponentFormat(u)),e.push(u),u=""),p?s.decPart=f:s.intPart=e,e=[],l===i||l===t)l=s;else if(a===i||a===t)a=s;else if(v===i||v===t)v=s;else throw new Error(n.SR.Exp_InvalidSemicolons);p=!1;k=!1;w&&(s.group=!0,w=!1);s=new nt}else if(p||f!==".")if(f==="'")it=!0;else if(f==='"')rt=!0;else if(f==="%")s.percent++,u!==""&&(e.push(u),u=""),e.push(f);else if(f===n.CR.perMilleSymbol)s.permile++,e.push(f);else if(f==="0"||f==="#")u+=f;else if(f===",")if(p)u!==""&&(e.push(u),u="");else{if(u!==""&&(e.push(u),u=""),!k)continue;for(ut=!0,g="",tt=d+1;tt<r.length;tt++){if(c=r.charAt(tt),g!==""){(c==="'"||c==='"')&&(g="");continue}if(c==="'"||c==='"')g=c;else if(c==="0"||c==="#"){ut=!1;break}else if(c==="."||c===";")break}ut?s.scale++:w=!0}else f==="E"||f==="e"?(y=!0,u!==""&&e.push(u),u=f):u+=f;else h!=="#"&&h!=="0"&&(e.push(u),u="#"),u!==""&&(e.push(u),u=""),s.intPart=e,e=[],p=!0,k=!1,w&&(s.group=!0,w=!1);h=f}return u!==""&&(y&&!b&&(s.exponent=o.___parseExponentFormat(u)),e.push(u)),w&&(s.group=!0),p?s.decPart=e:s.intPart=e,l===i||l===t?l=s:a===i||a===t?a=s:(v===i||v===t)&&(v=s),new et(l,a,v)},o.___zeroPad=function(n,t,i){for(var r=n.length;r<t;r++)n=i?"0"+n:n+"0";return n},o.__insertGroupSeparator=function(t,i,r,u){for(var f=i[0],s=1,e=t.length-1,h=new c(""),o=0,l=!1;e>=0;){if(f<1||f>9)throw new Error(n.SR.Exp_InvalidNumberGroupSize);/\d/ig.test(t[e])?(l&&(h.insert(r,0),l=!1),o++):o=0;h.insert(t[e],0);o===f&&(l=!0,o=0,s<i.length&&(f=i[s],s++));e--}return h.toString()},o.___expandNumber=function(n,t,i,r,u,f,e){var a=o.round10(n,-t),h,s,c,l;return isFinite(a)||(a=n),n=a,h=n.toString(),l=h.split(/e/i),h=l[0],c=l.length>1?parseInt(l[1],10):0,l=h.split("."),h=l[0],s=l.length>1?l[1]:"",c>0?(s=o.___zeroPad(s,c,!1),h+=s.slice(0,c),s=s.substr(c)):c<0&&(c=-c,h=n<0?f+o.___zeroPad(h.replace(f,""),c+1,!0):o.___zeroPad(h,c+1,!0),s=h.slice(-c,h.length)+s,h=h.slice(0,-c)),t>0?(s=s.length>t?s.slice(0,t):o.___zeroPad(s,t,!1),s=u+s):s="",e===!0?h+s:o.__insertGroupSeparator(h,i,r,f)+s},o.___formatNumber=function(n,i,r){var e=new c(""),l,s,h,v,d,b,g,k,y,it,a,ut,nt,dt,rt,ht,p,at,et,vt,gt,ot,ni,yt,pt,kt,w,lt;if(n=n*f(100,i.percent),n=n*f(1e3,i.permile),n=n/f(10,i.scale*3),l=i.intPart,s=i.decPart,!l&&!s)return"";if(h=t,v=t,l)for(h="",d=0;d<l.length;d++)b=l[d],/^(0|#)+/g.test(b)&&(h+=b);if(s)for(v="",g=0;g<s.length;g++)k=s[g],/^(0|#)+/g.test(k)&&(v+=k);if(h||v)v||(v="");else return(l?l.join(""):"")+(s?s.join(""):"");if(it=0,a=o.___getDigitLength(n,"."),i.exponent)if(ut=u(n),nt=h?h.length:1,ut>=1)a.integer>nt?(a.integer-=nt,a.decimal+=nt,n=n/f(10,a.integer),it=a.integer):it=a.integer<nt?0:0,i.exponent.sign===-1&&(i.exponent.sign=0);else if(ut<1&&ut>0){for(i.exponent.sign=-1,a.integer=nt,a.decimal-=nt,dt=f(10,nt);ut*10<dt;)ut*=10,it++;n*=f(10,it)}var ft=v.lastIndexOf("0"),wt=v.lastIndexOf("#"),st=a.decimal;if(ft>=0&&(st=ft+1),wt>ft&&wt<a.decimal&&(st=wt+1),s||(st=0),rt=o.___expandNumber(n,st,r.numberGroupSizes,",",".",r.negativeSign,!0),rt==="")return(l?l.join(""):"")+(s?s.join(""):"");if(ht=!1,l){p=rt.split(".")[0];at=p.substr(0,1);at===r.negativeSign&&(p=p.substr(1));var tt=0,bt="",ct=h.indexOf("0"),ti=ct===-1?p.length:h.length-ct;for(d=l.length-1;d>=0;d--)if(b=l[d],/^(0|#)+/g.test(b))if(bt=b+bt,bt!==h){for(et=b.length,vt=p.length-tt-1;vt>=0&&et>0;vt--)gt=p.charAt(vt),e._insert(gt),et--,tt++;tt>=p.length&&tt<ti&&et>0&&(e._insert(new Array(et+1).join("0")),tt+=et)}else ot=p.substr(0,p.length-tt),ct>=0&&ct<h.length-tt-ot.length&&(ot=new Array(h.length-tt-ct-ot.length+1).join("0")+ot),e._insert(ot);else i.exponent&&!ht&&/^((E(\+|-)?|e(\+|-)?)\d+)/g.test(b)?(ht=!0,y="",y+=i.exponent.symbol,y+=o.___signs[i.exponent.sign],y+=o.___zeroPad(it.toString(),i.exponent.exp,!0),e._insert(y)):e._insert(b);at===r.negativeSign&&e._insert(at);i.group===!0&&(ni=o.__insertGroupSeparator(e.toString(),r.numberGroupSizes,r.numberGroupSeparator,r.negativeSign),e=new c(ni))}if(s)for(yt="",st>0?(pt=rt.indexOf("."),pt!==-1&&(yt=rt.substring(pt+1),h===""&&e.append(rt.substr(0,pt)),e.append(r.numberDecimalSeparator))):/^(#+)$/ig.test(v)&&s.join("").length===v.length||(ft<=0&&rt.indexOf(".")<0&&h===o.GeneralNumberInt&&v===o.GeneralNumberDec||e.append("."),ft>0&&(yt=new Array(ft+1).join("0"))),kt=0,g=0;g<s.length;g++)k=s[g],/^(0|#)+/g.test(k)?(e.append(yt.substr(kt,k.length)),kt+=k.length):i.exponent&&!ht&&/^((E(\+|-)?|e(\+|-)?)\d+)/g.test(k)?(ht=!0,y="",y+=i.exponent.symbol,y+=o.___signs[i.exponent.sign],y+=o.___zeroPad(it.toString(),i.exponent.exp,!0),e.append(y)):e.append(k);return w=e.toString(),lt=w.indexOf("0."),lt===0&&(lt+2==w.length&&a.decimal===0?w=w.replace("0.","."):lt+2<w.length&&(/[0-9]+/g.test(w.charAt(lt+2))||(w=w.replace("0.",".")))),w},o.__parseNumberNegativePattern=function(n,t,i){var r=t.negativeSign,u=t.positiveSign,f=new h(n);if((i===4||i===2)&&(r=" "+r,u=" "+u),i===4||i===3){if(f.endsWith(r))return["-",n.substr(0,n.length-r.length)];else if(f.endsWith(u))return["+",n.substr(0,n.length-u.length)]}else if(i===2||i===1){if(f.startsWith(r))return["-",n.substr(r.length)];else if(f.startsWith(u))return["+",n.substr(u.length)]}else if(i===0){if(f.startsWith("(")&&f.endsWith(")"))return["-",n.substr(1,n.length-2)]}else throw new Error("");return["",n]},o.__parseNumber=function(n,r){var k,l,a,s,d,g,nt,u,tt,v,y,b;if(n=n!==i&&n!==t?new h(n).trim():"",n.match(/^[+-]?infinity$/i))return parseFloat(n);if(n.match(/^0x[a-f0-9]+$/i))return parseInt(n,10);var e=r.numberFormat,p=o.__parseNumberNegativePattern(n,e,e.numberNegativePattern),w=p[0],f=p[1];return(w===""&&e.numberNegativePattern!==1&&(p=o.__parseNumberNegativePattern(n,e,1),w=p[0],f=p[1]),w===""&&(w="+"),f[0]===e.currencySymbol&&(f=f.substr(1)),a=f.indexOf("e"),a<0&&(a=f.indexOf("E")),a<0?(l=f,k=t):(l=f.substr(0,a),k=f.substr(a+1)),g=l.indexOf("."),g<0?(s=l,d=t):(s=l.substr(0,g),d=l.substr(g+1)),s=s.split(",").join(""),nt=",".replace(/\u00A0/g," "),","!==nt&&(s=s.split(nt).join("")),u=w+s,d!==t&&(u+="."+d),tt=u[u.length-1],tt===e.percentSymbol&&(u=u.substr(0,u.length-1),u=new h(u).trimEnd(),v=u.indexOf("."),v===-1&&(v=u.length),y=new c(""),y.append(u.substr(0,v-2)),y.append("."),y.append(u.substr(v-2,2)),y.append(u.substr(v+1)),u=y.toString()),k!==t&&(b=o.__parseNumberNegativePattern(k,e,1),b[0]===""&&(b[0]="+"),u+="e"+b[0]+b[1]),u.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/))?parseFloat(u):NaN},o.___toHexString=function(r,f,s){if(u(e(r)-r)!==0)throw new Error(n.SR.Exp_BadFormatSpecifier);var h=r>=0?r.toString(16):(o.___maxInt32+r+1).toString(16);return(h=f?h.toLowerCase():h.toUpperCase(),s!==i&&s!==t&&h.length<s)?o.___zeroPad(h,s,!0):h},o.___toScientific=function(n,t,i,r,e,s,h){for(var c=0,l=n>=1||n===0,a,v;c<1e3;){if(a=f(10,c),l&&n/a<10||!l&&n*a>=1)break;c++}return n=l?u(n)/f(10,c):u(n)*f(10,c),v=o.___expandNumber(n,i,r,e,s,h),v+(t+(l?"+":"-")+o.___zeroPad(c.toString(),3,!0))},o.removeCultureSymbolInNum=function(n){if(n===i||n===t)return n;var r=n.toString();return r=r.replace(new RegExp("[,]","g"),""),r.replace(new RegExp("[.]","g"),".")},o.replaceCultureSymbolToNormal=function(t,i){if(typeof t!="string")return t;var r=i?i.numberDecimalSeparator:n.CR.numberDecimalSeparator,u=i?i.numberGroupSeparator:n.CR.numberGroupSeparator;return r!=="."&&(t=t.replace(n.RegUtil.getReg("["+r+"]"),"#dot#")),u!==","&&(t=t.replace(n.RegUtil.getReg("["+u+"]"),"#group#")),r!=="."&&(t=t.replace(n.RegUtil.getReg("#dot#"),".")),u!==","&&(t=t.replace(n.RegUtil.getReg("#group#"),",")),t},o.replaceNormalToCultureSymble=function(t,i){if(typeof t!="string")return t;var r=i?i.numberDecimalSeparator:n.CR.numberDecimalSeparator,u=i?i.numberGroupSeparator:n.CR.numberGroupSeparator;return r!=="."&&(t=t.replace(n.RegUtil.getReg("[.]"),"#dot#")),u!==","&&(t=t.replace(n.RegUtil.getReg("[,]"),"#group#")),r!=="."&&(t=t.replace(n.RegUtil.getReg("#dot#"),r)),u!==","&&(t=t.replace(n.RegUtil.getReg("#group#"),u)),t},o.round10=function(n,t){return typeof t===i||+t==0?Math.round(n):(n=+n,t=+t,isNaN(n)||!(typeof t=="number"&&t%1==0))?NaN:(n=n.toString().split("e"),n=Math.round(+(n[0]+"e"+(n[1]?+n[1]-t:-t))),n=n.toString().split("e"),+(n[0]+"e"+(n[1]?+n[1]+t:t)))},o.GeneralNumberInt="##################0",o.GeneralNumberDec="################",o.___signs={"1":"+","0":"","-1":"-"},o.___maxInt32=4294967295,o.___percentPositivePattern=["n %","n%","%n","% n"],o.___percentNegativePattern=["-n %","-n%","-%n","%-n","%n-","n-%","n%-","-% n","n %-","% n-","% -n","n- %"],o.___numberNegativePattern=["(n)","-n","- n","n-","n -"],o.___currencyPositivePattern=["$n","n$","$ n","n $"],o.___currencyNegativePattern=["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"],o}();n._NumberHelper=k;n._currentCulture="";n._currentCultureResouce;n.Culture=tt;n.switchCulture=ot;tt("en-us");n.addCultureInfo=st;n.getCultureInfo=ht;n.getCultureInfoCore=l;it=function(){function n(){}return n._getCtx=function(){if(!n._ctx){var t=document.createElement("canvas");t.getContext&&(n._ctx=t.getContext("2d"))}return n._ctx},n._getWrapInfo=function(t,i,r){var s=[],u,f,h,c,e,v,l,o,a;if(t.length===0||(u=n._getCtx(),!u))return s;if(u.font=r,i<=0){for(f=-1,h=!0,c=0;c<t.length;c++)e=t.charAt(c),e===" "||h?e!==" "&&h&&(f=u.measureText(e).width,h=!1):f=ut(f,u.measureText(e).width);i=f}for(v=t.split(/\r\n|\r|\n/),l=0;l<v.length;l++)if(o=n._getWrapInfoByWord(v[l],i),o)if(o.length===0)s.push("");else for(a=0;a<o.length;a++)s.push(o[a]);return s},n._getTextWords=function(n){for(var f,e,t=[],r=0,o=" ",u=0;u<n.length;u++)t[r]===i&&(t[r]=""),f=n.charAt(u),e="",u+1<n.length&&(e=n.charAt(u+1)),f===o&&e!==o?(t[r]+=f,r++):t[r]+=f;return t},n._measureText=function(t,i){var r=n._getCtx();return r?(r.font!==i&&(r.font=i),r.measureText(t).width):0},n._measureTextWithoutEndSpaces=function(t,i){var r=n._getCtx(),u;return r?(i&&(r.font=i),u=n._removeEndSpace(t),r.measureText(u).width):0},n._removeEndSpace=function(n){for(var t=n.length-1;n.charAt(t)===" ";)t--;return t!==n.length-1&&(n=n.substring(0,t+1)),n},n._getWrapInfoByCharacter=function(i,r){var u=[],s=n._getCtx(),c,f,e,l,o;if(!s)return u;var a=s.measureText(i).width,v=a/i.length,h=ft(r/v);if(a>r)for(c=!1;;)if(f=i.substring(0,h),e=s.measureText(f).width,e==r||c&&e<r)return u.push(f),u.push(i.substring(f.length)),u;else if(e>r){if(f.length===1)return l=i.substring(f.length),n._measureTextWithoutEndSpaces(l)!==0?(u.push(f),u.push(l)):u.push(i),u;h-=1;c=!0}else o=(r-e)/v,o=o>=1?o:1,h+=o;else i!=t&&i.length>0&&u.push(i);return u},n._getWrapInfoByWord=function(t,i){var f=[],c=n._getTextWords(t),v=n._getCtx(),a,s,p,h;if(!v)return f;for(var w=v.measureText(t).width,b=w/t.length,k=parseInt(i/b+"",10),l=0,e=0,y=0,u=0,r=[],o=!1;u<c.length;){if(o===!1)if(a=c[u],r.push(a),e+=a.length,e<k){u++;continue}else y=e,e=0;s=n._measureTextWithoutEndSpaces(r.join(""));s>i?(p=r.pop(),r.length===0?(h=n._getWrapInfoByCharacter(p,i),r.push(h[0]),h.length===2?c[u]=h[1]:u++,f[l++]=r.join(""),o=!1,r=[]):(o=!0,u--)):s<i&&o===!0||s===i?(o=!1,f[l++]=n._removeEndSpace(r.join("")),r=[],u++):s<i&&(u++,e=y)}return r.length!==0&&(f[l]=n._removeEndSpace(r.join(""))),f},n}();n._WordWrapHelper=it;rt=function(){function r(){}return r.IsNumber=function(t,i){return t&&n.util.isType(t,"string")&&i&&(t=k.replaceCultureSymbolToNormal(t,i)),n.util.isType(t,"number")||n.util.isType(t,"DateTime")||n.util.isType(t,"TimeSpan")||t&&!n.util.isType(t,"boolean")&&!isNaN(t)&&!isNaN(parseFloat(t))&&(t.length>=2&&t[0]==="0"&&t[1]==="x"?!1:!0)},r.ToDouble=function(r){return r===t||r===i||r===""?0:n.util.isType(r,"number")?r:n.util.isType(r,"string")&&!isNaN(r)?k.parseLocale(r):n.util.isType(r,"boolean")?r?1:0:n.util.isType(r,"DateTime")?new v(r).toOADate():n.util.isType(r,"TimeSpan")?new v(r).TotalDays():parseFloat(r)},r.toString=function(n){try{return n===t||n===i?"":typeof n=="boolean"?n?"TRUE":"FALSE":typeof n=="string"?n:n.toString()}catch(r){return""}},r}();n.FormatConverter=rt})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){function o(i){var r;if(i instanceof t)return i;var u=0,f=0,e=0,o=0;return i&&i!==""&&(r=n.util.parseColorString(i),r&&(r.length===3?(u=255,f=r[0],e=r[1],o=r[2]):r.length===4&&(u=r[0],f=r[1],e=r[2],o=r[3]))),new t(u,f,e,o)}var g,f,e,nt;n.feature("core.theme",["core.common"]);var i=null,r=undefined,tt=Math.min,it=Math.max,t=function(){function n(n,t,i,r){var u=this;u.a=n;u.r=t;u.g=i;u.b=r}return n.prototype.toString=function(){var n=this;return n.a===255?"#"+n.getColorUnitString(n.r)+n.getColorUnitString(n.g)+n.getColorUnitString(n.b):"rgba("+n.r+","+n.g+","+n.b+","+n.a+")"},n.prototype.getBrightness=function(){return(this.r*299+this.g*587+this.b*114)/1e3},n.prototype.getColorUnitString=function(n){var t=n.toString(16);return t.length===1&&(t="0"+t),t},n.hueToRGB=function(n,t,i){return(i<0&&(i+=240),i>240&&(i-=240),i<40)?n+((t-n)*i+20)/40:i<120?t:i<160?n+((t-n)*(160-i)+20)/40:n},n.fromHLS=function(t,i,r){var e,o,s,f,u;return r===0?e=o=s=parseInt(i*255/240,10):(u=i<=120?(i*(240+r)+120)/240:i+r-(i*r+120)/240,f=2*i-u,e=parseInt((n.hueToRGB(f,u,t+80)*255+120)/240,10),o=parseInt((n.hueToRGB(f,u,t)*255+120)/240,10),s=parseInt((n.hueToRGB(f,u,t-80)*255+120)/240,10)),new n(255,e,o,s)},n.parse=function(n){return o(n)},n.isTwoColorSimilar=function(n,t){var i=255-Math.abs(n.r-t.r),r=255-Math.abs(n.g-t.g),u=255-Math.abs(n.b-t.b),e=Math.abs(n.a-t.a),f;return(i/=255,r/=255,u/=255,f=(i+r+u)/3,f>=.9&&e<=.05)?!0:!1},n.invertColor=function(t){var i=t.r^255,r=t.g^255,u=t.b^255,f=new n(t.a,i,r,u);return f.toString()},n}();n._Color=t;g=function(){function n(n){var t=this,f=n.r,e=n.g,o=n.b,r=it(it(f,e),o),s=tt(tt(f,e),o),u=r+s,i;if(t.luminosity=parseInt((u*240+255)/510,10),i=r-s,i===0)t.saturation=0,t.hue=160;else{t.saturation=t.luminosity<=120?parseInt((i*240+u/2)/u,10):parseInt((i*240+(510-u)/2)/(510-u),10);var h=((r-f)*40+i/2)/i,c=((r-e)*40+i/2)/i,l=((r-o)*40+i/2)/i;t.hue=f===r?parseInt(l-c,10):e===r?parseInt(80+h-l,10):parseInt(160+c-h,10);t.hue<0&&(t.hue+=240);t.hue>240&&(t.hue-=240)}}return n.prototype.toColor=function(){return t.fromHLS(this.hue,this.luminosity,this.saturation)},n.prototype.getLighterColor=function(n){var i=this,r=i.luminosity,u=i.newLuma(i.luminosity,500,!0);return t.fromHLS(i.hue,r+(u-r)*n,i.saturation)},n.prototype.getDrakerColor=function(n){var i=this,r=i.newLuma(i.luminosity,-333,!0);return t.fromHLS(i.hue,r*(1-n),i.saturation)},n.prototype.newLuma=function(n,t,i){return t===0?n:i?t>0?(n*(1e3-t)+241*t)/1e3:n*(t+1e3)/1e3:(n+=t*240/1e3,n<0&&(n=0),n>240&&(n=240),n)},n}();n.HLSColor=g;var rt=function(n,i){if(i===0)return n;var r=new g(n),u=parseInt(i>0?(240-r.luminosity)*i:r.luminosity*i,10);return t.fromHLS(r.hue,r.luminosity+u,r.saturation)},c=0,l=1,a=2,v=3,y=4,p=5,w=6,b=7,k=8,d=9,s=10,h=11,u=function(){function n(n,t,i,r,u,f,e,s,h,c,l,a,v){this._name=n;this._colorList=[o(r),o(u),o(t),o(i),o(f),o(e),o(s),o(h),o(c),o(l),o(a),o(v)]}return n.prototype.name=function(n){return arguments.length===0?this._name:(this._name=n,this)},n.prototype.background1=function(n){return this._property(c,arguments.length===0,n)},n.prototype.background2=function(n){return this._property(l,arguments.length===0,n)},n.prototype.textColor1=function(n){return this._property(a,arguments.length===0,n)},n.prototype.textColor2=function(n){return this._property(v,arguments.length===0,n)},n.prototype.accent1=function(n){return this._property(y,arguments.length===0,n)},n.prototype.accent2=function(n){return this._property(p,arguments.length===0,n)},n.prototype.accent3=function(n){return this._property(w,arguments.length===0,n)},n.prototype.accent4=function(n){return this._property(b,arguments.length===0,n)},n.prototype.accent5=function(n){return this._property(k,arguments.length===0,n)},n.prototype.accent6=function(n){return this._property(d,arguments.length===0,n)},n.prototype.hyperline=function(n){return this._property(s,arguments.length===0,n)},n.prototype.followedHyperline=function(n){return this._property(h,arguments.length===0,n)},n.prototype._property=function(n,t,i){return t?this._colorList[n]:(this._colorList[n]=o(i),this)},n.prototype.getColor=function(n){var t,i,u,r,f;if(n&&(t=n.split(" "),t)){if(i=-1,u=t.length,u>1){if(!t[0])return n;r=t[0].toLowerCase();r==="background"?i=parseInt(t[1],10)-1:r==="text"?i=parseInt(t[1],10)+1:r==="accent"&&(i=parseInt(t[1],10)+3)}else u===1&&(r=t[0].toLowerCase(),r==="hyperlink"?i=s:r==="followedhyperlink"&&(i=h));if(i>=0&&i<=11)return u>2?(f=parseInt(t[2],10)/100,rt(this._colorList[i],f).toString()):this._colorList[i].toString()}return n},n.prototype.toJSON=function(){var t=this,n=t._colorList;return{name:t._name,background1:n[c],background2:n[l],text1:n[a],text2:n[v],accent1:n[y],accent2:n[p],accent3:n[w],accent4:n[b],accent5:n[k],accent6:n[d],hyperlink:n[s],followedHyperlink:n[h]}},n.prototype.fromJSON=function(n,u){var f,ct,e;if(n)if(f=this,u){if(ct=n.name?n.name:n._name,ct!==r&&ct!==i&&(f._name=ct),e=n.colorList?n.colorList:n._colorList,e!==r&&e!==i){var o=e[c],g=e[l],nt=e[a],tt=e[v],it=e[y],rt=e[p],ut=e[w],ft=e[b],et=e[k],ot=e[d],st=e[s],ht=e[h];o!==r&&o!==i&&(f._colorList[c]=new t(o.a,o.r,o.g,o.b));g!==r&&g!==i&&(f._colorList[l]=new t(g.a,g.r,g.g,g.b));nt!==r&&nt!==i&&(f._colorList[a]=new t(nt.a,nt.r,nt.g,nt.b));tt!==r&&tt!==i&&(f._colorList[v]=new t(tt.a,tt.r,tt.g,tt.b));it!==r&&it!==i&&(f._colorList[y]=new t(it.a,it.r,it.g,it.b));rt!==r&&rt!==i&&(f._colorList[p]=new t(rt.a,rt.r,rt.g,rt.b));ut!==r&&ut!==i&&(f._colorList[w]=new t(ut.a,ut.r,ut.g,ut.b));ft!==r&&ft!==i&&(f._colorList[b]=new t(ft.a,ft.r,ft.g,ft.b));et!==r&&et!==i&&(f._colorList[k]=new t(et.a,et.r,et.g,et.b));ot!==r&&ot!==i&&(f._colorList[d]=new t(ot.a,ot.r,ot.g,ot.b));st!==r&&st!==i&&(f._colorList[s]=new t(st.a,st.r,st.g,st.b));ht!==r&&ht!==i&&(f._colorList[h]=new t(ht.a,ht.r,ht.g,ht.b))}}else{n.name!==r&&n.name!==i&&(f._name=n.name);var o=n.background1,g=n.background2,nt=n.text1,tt=n.text2,it=n.accent1,rt=n.accent2,ut=n.accent3,ft=n.accent4,et=n.accent5,ot=n.accent6,st=n.hyperlink,ht=n.followedHyperlink;o!==r&&o!==i&&(f._colorList[c]=new t(o.a,o.r,o.g,o.b));g!==r&&g!==i&&(f._colorList[l]=new t(g.a,g.r,g.g,g.b));nt!==r&&nt!==i&&(f._colorList[a]=new t(nt.a,nt.r,nt.g,nt.b));tt!==r&&tt!==i&&(f._colorList[v]=new t(tt.a,tt.r,tt.g,tt.b));it!==r&&it!==i&&(f._colorList[y]=new t(it.a,it.r,it.g,it.b));rt!==r&&rt!==i&&(f._colorList[p]=new t(rt.a,rt.r,rt.g,rt.b));ut!==r&&ut!==i&&(f._colorList[w]=new t(ut.a,ut.r,ut.g,ut.b));ft!==r&&ft!==i&&(f._colorList[b]=new t(ft.a,ft.r,ft.g,ft.b));et!==r&&et!==i&&(f._colorList[k]=new t(et.a,et.r,et.g,et.b));ot!==r&&ot!==i&&(f._colorList[d]=new t(ot.a,ot.r,ot.g,ot.b));st!==r&&st!==i&&(f._colorList[s]=new t(st.a,st.r,st.g,st.b));ht!==r&&ht!==i&&(f._colorList[h]=new t(ht.a,ht.r,ht.g,ht.b))}},n}();n.ThemeColor=u;f=function(){function n(){}return n.Default=new u("Default","#000000","#1F497D","#FFFFFF","#EEECE1","#4F81BD","#C0504D","#9BBB59","#8064A2","#4BACC6","#F79646","#0000FF","#800080"),n.Office2007=new u("Office2007","#000000","#1F497D","#FFFFFF","#EEECE1","#4F81BD","#C0504D","#9BBB59","#8064A2","#4BACC6","#F79646","#0000FF","#800080"),n.Office=new u("Office","#000000","#44546A","#FFFFFF","#E7E6E6","#5B9BD5","#ED7D31","#A5A5A5","#FFC000","#4472C4","#70AD47","#0563C1","#954F72"),n.Apex=new u("Apex","#000000","#69676D","#FFFFFF","#C9C2D1","#CEB966","#9CB084","#6BB1C9","#6585CF","#7E6BC9","#A379BB","#410082","#932968"),n.Aspect=new u("Aspect","#000000","#323232","#FFFFFF","#E3DED1","#F07F09","#9F2936","#1B587C","#4E8542","#604878","#C19859","#6B9F25","#B26B02"),n.Concourse=new u("Concourse","#000000","#464646","#FFFFFF","#DEF5FA","#2DA2BF","#DA1F28","#EB641B","#39639D","#474B78","#7D3C4A","#FF8119","#44B9E8"),n.Civic=new u("Civic","#000000","#646B86","#FFFFFF","#C5D1D7","#D16349","#CCB400","#8CADAE","#8C7B70","#8FB08C","#D19049","#00A3D6","#694F07"),n.Oriel=new u("Oriel","#000000","#575F6D","#FFFFFF","#FFF39D","#FE8637","#7598D9","#B32C16","#F5CD2D","#AEBAD5","#777C84","#D2611C","#3B435B"),n.Origin=new u("Origin","#000000","#464653","#FFFFFF","#DDE9EC","#727CA3","#9FB8CD","#D2DA7A","#FADA7A","#B88472","#8E736A","#B292CA","#6B5680"),n.Paper=new u("Paper","#000000","#444D26","#FFFFFF","#FEFAC9","#A5B592","#F3A447","#E7BC29","#D092A7","#9C85C0","#809EC2","#8E58B6","#7F6F6F"),n.Solstice=new u("Solstice","#000000","#4F271C","#FFFFFF","#E7DEC9","#3891A7","#FEB80A","#C32D2E","#84AA33","#964305","#475A8D","#8DC765","#AA8A14"),n.Technic=new u("Technic","#000000","#3B3B3B","#FFFFFF","#D4D2D0","#6EA0B0","#CCAF0A","#8D89A4","#748560","#9E9273","#7E848D","#00C8C3","#A116E0"),n.Trek=new u("Trek","#000000","#4E3B30","#FFFFFF","#FBEEC9","#F0A22E","#A5644E","#B58B80","#C3986D","#A19574","#C17529","#AD1F1F","#FFC42F"),n.Urban=new u("Urban","#000000","#424456","#FFFFFF","#DEDEDE","#53548A","#438086","#A04DA3","#C4652D","#8B5D3D","#5C92B5","#67AFBD","#C2A874"),n.Verve=new u("Verve","#000000","#666666","#FFFFFF","#D2D2D2","#FF388C","#E40059","#9C007F","#68007F","#005BD3","#00349E","#17BBFD","#FF79C2"),n.Equity=new u("Equity","#000000","#696464","#FFFFFF","#E9E5DC","#D34817","#9B2D1F","#A28E6A","#956251","#918485","#855D5D","#CC9900","#96A9A9"),n.Flow=new u("Flow","#000000","#04617B","#FFFFFF","#DBF5F9","#0F6FC6","#009DD9","#0BD0D9","#10CF9B","#7CCA62","#A5C249","#E2D700","#85DFD0"),n.Foundry=new u("Foundry","#000000","#676A55","#FFFFFF","#EAEBDE","#72A376","#B0CCB0","#A8CDD7","#C0BEAF","#CEC597","#E8B7B7","#DB5353","#903638"),n.Median=new u("Median","#000000","#775F55","#FFFFFF","#EBDDC3","#94B6D2","#DD8047","#A5AB81","#D8B25C","#7BA79D","#968C8C","#F7B615","#704404"),n.Metro=new u("Metro","#000000","#4E5B6F","#FFFFFF","#D6ECFF","#7FD13B","#EA157A","#FEB80A","#00ADDC","#738AC8","#1AB39F","#EB8803","#5F7791"),n.Module=new u("Module","#000000","#5A6378","#FFFFFF","#D4D4D6","#F0AD00","#60B5CC","#E66C7D","#6BB76D","#E88651","#C64847","#168BBA","#680000"),n.Opulent=new u("Opulent","#000000","#B13F9A","#FFFFFF","#F4E7ED","#B83D68","#AC66BB","#DE6C36","#F9B639","#CF6DA4","#FA8D3D","#FFDE66","#D490C5"),n}();n.ThemeColors=f;e=function(){function n(n,t,i,r){var f=this;f._name=n;f._themeColor=t?t:new u(n);f._headingFont=i;f._bodyFont=r}return n.prototype.name=function(n){return arguments.length===0?this._name:(this._name=n,this)},n.prototype.colors=function(n){return arguments.length===0?this._themeColor:(this._themeColor=n,this)},n.prototype.headerFont=function(n){return arguments.length===0?this._headingFont:(this._headingFont=n,this)},n.prototype.bodyFont=function(n){return arguments.length===0?this._bodyFont:(this._bodyFont=n,this)},n.prototype.getColor=function(n){return this._themeColor.getColor(n)},n.prototype.getFont=function(n){if(n==="Body")return this.bodyFont();else if(n==="Headings")return this.headerFont();return n},n.prototype.toJSON=function(){var n=this,t=n._name;return nt[t]?t:{name:t,themeColor:n._themeColor?n._themeColor.toJSON():undefined,headingFont:n._headingFont,bodyFont:n._bodyFont}},n}();n.SpreadTheme=e;nt=function(){function n(){}return n.Default=new e("Default",f.Default,"Cambria","Calibri"),n.Office=new e("Office",f.Office,"Calibri Light","Calibri"),n.Office2007=new e("Office2007",f.Office2007,"Cambria","Calibri"),n.Apex=new e("Apex",f.Apex,"Lucida Sans","Book Antiqua"),n.Aspect=new e("Aspect",f.Aspect,"Verdana","Verdana"),n.Concourse=new e("Concourse",f.Concourse,"Lucida Sans Unicode","Lucida Sans Unicode"),n.Civic=new e("Civic",f.Civic,"Georgia","Georgia"),n.Oriel=new e("Oriel",f.Oriel,"Century Schoolbook","Century Schoolbook"),n.Origin=new e("Origin",f.Origin,"Bookman Old Style","Gill Sans MT"),n.Paper=new e("Paper",f.Paper,"Constantia","Constantia"),n.Solstice=new e("Solstice",f.Solstice,"Gill Sans MT","Gill Sans MT"),n.Technic=new e("Technic",f.Technic,"Franklin Gothic Book","Arial"),n.Trek=new e("Trek",f.Trek,"Franklin Gothic Medium","Franklin Gothic Book"),n.Urban=new e("Urban",f.Urban,"Trebuchet MS","Georgia"),n.Verve=new e("Verve",f.Verve,"Century Gothic","Century Gothic"),n.Equity=new e("Equity",f.Equity,"Franklin Gothic Book","Perpetua"),n.Flow=new e("Flow",f.Flow,"Calibri","Constantia"),n.Foundry=new e("Foundry",f.Foundry,"Rockwell","Rockwell"),n.Median=new e("Median",f.Median,"Tw Cen MT","Tw Cen MT"),n.Metro=new e("Metro",f.Metro,"Consolas","Corbel"),n.Module=new e("Module",f.Module,"Corbel","Corbel"),n.Opulent=new e("Opulent",f.Opulent,"Trebuchet MS","Trebuchet MS"),n}();n.SpreadThemes=nt})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){var tt,wt,bt,it,y;t.feature("core.spreadpanelex",["core.common"]);var r=null,o="undefined",rt="scroll-container",ut="scroll-corner-all",g="scroll-arrow",nt="scrollbar-wrapper",ft="scroll-bar",et="scroll-arrowUp",ot="scroll-arrowDown",st="scroll-arrowLeft",ht="scroll-arrowRight",ct="scrollbar-vertical",lt="scrollbar-horizontal",p="no-user-select",s="width",h="height",w="left",at="right",c="top",vt="bottom",yt="margin-left",pt="margin-top",i=".gcScrollbar",l="mousedown"+i,e="mouseup"+i,b="mousemove"+i,k="mouseover"+i,d="mouseout"+i,a="mousewheel",v="DOMMouseScroll",d="mouseout"+i,u="scroll"+i,f={addHandler:function(n,t,i){n.addEventListener&&n.addEventListener(t,i,!1)},removeHandler:function(n,t,i){n.removeEventListener&&n.removeEventListener(t,i,!1)}};(function(n){n[n.pixels=0]="pixels";n[n.continuous=1]="continuous"})(t.ScrollType||(t.ScrollType={}));tt=t.ScrollType,function(n){n[n.horizontalScroll=0]="horizontalScroll";n[n.verticalScroll=1]="verticalScroll"}(t.ScrollOrientation||(t.ScrollOrientation={}));wt=t.ScrollOrientation,function(n){n[n.smallDecrement=0]="smallDecrement";n[n.smallIncrement=1]="smallIncrement";n[n.largeDecrement=2]="largeDecrement";n[n.largeIncrement=3]="largeIncrement";n[n.thumbPosition=4]="thumbPosition";n[n.thumbTrack=5]="thumbTrack";n[n.endScroll=6]="endScroll"}(t.ScrollEventType||(t.ScrollEventType={}));bt=t.ScrollEventType;it=function(){function n(n,t){var i=this;i._showHorizontalScrollbar=!0;i._showVerticalScrollbar=!0;i._hSmallChange=10;i._vSmallChange=10;i._defaultScrollbarSize=18;i._superPanel=n;i._content=t;i.refreshLayout(!0)}return n.prototype.content=function(n){var t=this;return arguments.length===0?t._content:(n instanceof HTMLElement&&t._content!==n&&(t._content=n,t.refreshLayout(!0)),t)},n.prototype.superPanel=function(n){var t=this;return arguments.length===0?t._superPanel:(n instanceof HTMLElement&&t._superPanel!==n&&(t._superPanel=n,t.refreshLayout(!0)),t)},n.prototype.horizontalSmallChange=function(n){var t=this;return arguments.length===0?t._hSmallChange:(typeof n=="number"&&t._hSmallChange!==n&&(t._hSmallChange=n),t)},n.prototype.verticalSmallChange=function(n){var t=this;return arguments.length===0?t._vSmallChange:(typeof n=="number"&&t._vSmallChange!==n&&(t._vSmallChange=n),t)},n.prototype.showHorizontalScrollbar=function(){return this._showHorizontalScrollbar},n.prototype.showVerticalScrollbar=function(){return this._showVerticalScrollbar},n.prototype.refreshLayout=function(n){var i=this,l,b,p,ut,g,o,ft,et,nt,s,ot;if(i._superPanel&&i._content){var w=t.GC$(i._superPanel),tt=t.GC$(i._content),r=i._defaultScrollbarSize,a=tt.width(),v=tt.height(),h=w.width(),c=w.height(),f=h-r,e=c-r,it=!1;i._container||(i._container=document.createElement("div"),t.GC$(i._container).css({position:"relative",left:0,top:0,overflow:"hidden",border:"none",padding:0,margin:0}),it=!0);l=t.GC$(i._container);l.css({width:h,height:c});i._contentWrapper||(i._contentWrapper=document.createElement("div"),t.GC$(i._contentWrapper).css({position:"absolute",left:0,top:0,display:"inline-block",overflow:"hidden",border:"none",padding:0,margin:0}),l.append(i._contentWrapper));b=t.GC$(i._contentWrapper);i._tempContentWrapper||(i._tempContentWrapper=document.createElement("div"),t.GC$(i._tempContentWrapper).css({position:"relative"}),b.append(i._tempContentWrapper));p=t.GC$(i._tempContentWrapper);n&&p.append(i._content).css({top:0,left:0});t.util.browser.chrome&&(a=Math.round(a),v=Math.round(v),h=Math.ceil(h),c=Math.ceil(c));var rt=i._isNeedScrollbars(a,v,h,c),k=rt.isNeedVScroll,d=rt.isNeedHScroll;d?(k||(f+=r),i._hScrollbar||(i._hScrollbar=new y(!0),ut=i._hScrollbar.getScrollbar(),i._hbarContainer=document.createElement("div"),g=t.GC$(i._hbarContainer),g.css({position:"absolute",left:0,bottom:0,border:"none",padding:0,margin:0}),g.append(ut),l.append(i._hbarContainer)),t.GC$(i._hbarContainer).css({width:f,height:r}),o=i._hScrollbar,ft=t.GC$(i._hScrollbar.getScrollbar()),o.width(f),o.height(r),o.minimum(0),o.maximum(a-f),o.pageValue(f),o.smallChange(i.horizontalSmallChange()),o.largeChange(f),o.refreshLayout(),ft.bind(u,function(n,t){p.css("left",0-t.newValue)}),t.GC$(i._hbarContainer).show(),i._showHorizontalScrollbar=!0):(i._hbarContainer&&t.GC$(i._hbarContainer).hide(),i._showHorizontalScrollbar=!1);k?(d||(e+=r),i._vScrollbar||(i._vScrollbar=new y(!1),et=i._vScrollbar.getScrollbar(),i._vbarContainer=document.createElement("div"),nt=t.GC$(i._vbarContainer),nt.css({position:"absolute",right:0,top:0,border:"none",padding:0,margin:0}),nt.append(et),l.append(i._vbarContainer)),t.GC$(i._vbarContainer).css({width:r,height:e}),s=i._vScrollbar,ot=t.GC$(i._vScrollbar.getScrollbar()),s.width(r),s.height(e),s.minimum(0),s.maximum(v-e),s.pageValue(e),s.smallChange(i.verticalSmallChange()),s.largeChange(e),s.refreshLayout(),ot.bind(u,function(n,t){p.css("top",0-t.newValue)}),t.GC$(i._vbarContainer).show(),i._showVerticalScrollbar=!0):(i._vbarContainer&&t.GC$(i._vbarContainer).hide(),i._showVerticalScrollbar=!1);d||k||(f+=r,e+=r);i._pageWidth=f;i._pageHeight=e;b.css({width:f,height:e});it&&(w.append(i._container),i._initEvent())}},n.prototype.scrollChildIntoView=function(n){var t=this,i=t._getScrollOffset(n),u=i.left,f=i.top;u!==r&&t._hScrollbar&&t.hScrollTo(u);f!==r&&t._vScrollbar&&t.vScrollTo(f)},n.prototype.hScrollTo=function(n){var i=this,r,u;i._hScrollbar.value(n);r=i._pageWidth;u=t.GC$(i._content).width();n>=0&&n<=u-r&&t.GC$(i._tempContentWrapper).css(w,0-n)},n.prototype.vScrollTo=function(n){var i=this,r,u;i._vScrollbar.value(n);r=i._pageHeight;u=t.GC$(i._content).height();n>=0&&n<=u-r&&t.GC$(i._tempContentWrapper).css(c,0-n)},n.prototype._isNeedScrollbars=function(n,t,i,r){var f=this._defaultScrollbarSize,e=i-f,o=r-f,u={isNeedHScroll:!1,isNeedVScroll:!1};return n>i&&(u.isNeedHScroll=!0,u.isNeedVScroll=t>o?!0:!1),t>r&&(u.isNeedVScroll=!0,u.isNeedHScroll=n>e?!0:!1),u},n.prototype._getScrollOffset=function(n){var c=t.GC$(n),e=t.GC$(this._contentWrapper),v=t.GC$(this._tempContentWrapper),i,o,u,s,l,h,a,f={left:r,top:r};return n?(i=c.offset(),o=v.offset(),u=e.offset(),i.leftWidth=i.left+c.outerWidth(),i.topHeight=i.top+c.outerHeight(),u.leftWidth=u.left+e.outerWidth(),u.topHeight=u.top+e.outerHeight(),s=i.left-o.left,i.left<u.left?f.left=s:i.leftWidth>u.leftWidth&&(l=i.leftWidth-o.left-e.innerWidth(),f.left=s<l?s:l),h=i.top-o.top,i.top<u.top?f.top=h:i.topHeight>u.topHeight&&(a=i.topHeight-o.top-e.innerHeight(),f.top=h<a?h:a),f):f},n.prototype._initEvent=function(){var n=this;this._tempContentWrapper&&(n._mousewheelHandler=function(t){n._contentContainerMousewheel(t)},f.addHandler(n._tempContentWrapper,a,n._mousewheelHandler),f.addHandler(n._tempContentWrapper,v,n._mousewheelHandler))},n.prototype._contentContainerMousewheel=function(n){var u=this,i;(typeof n.wheelDelta===o||n.wheelDelta===r)&&(typeof n.detail===o||n.detail===r)&&(n.wheelDelta=n.originalEvent.wheelDelta,n.detail=n.originalEvent.detail);var h=n.detail?n.detail:n.wheelDelta/-40,l=h,a=u._vScrollbar,f=parseInt(t.GC$(u._tempContentWrapper).css(c)),e=u._pageHeight,s=t.GC$(u._content).height();s<e&&(s=e);isNaN(f)&&(f=0);i=f-l*u.verticalSmallChange();i>=0&&(i=0);i<0&&0-i>s-e&&(i=0-(s-e));i!==f&&(t.GC$(u._tempContentWrapper).css(c,i),u._showVerticalScrollbar&&a.value(0-i));t.util.cancelDefault(n)},n.prototype.dispose=function(){var n=this;n._container&&(n._hScrollbar&&n._hScrollbar.dispose(),n._vScrollbar&&n._vScrollbar.dispose(),n._tempContentWrapper&&n._mousewheelHandler&&(f.removeHandler(n._tempContentWrapper,a,n._mousewheelHandler),f.removeHandler(n._tempContentWrapper,v,n._mousewheelHandler)),t.GC$(n._container).remove())},n}();t.ScrollablePanel=it;y=function(){function y(n,t,i,u,f,e,o){var s=this;s._pageValue=10;s._maximum=100;s._minimum=0;s._value=0;s._largeChange=10;s._smallChange=1;s._scrollType=1;s._scrollPosition=0;s._isMousedownInScrollbar=!1;s._isMousedownInArrowButton=!1;s._scrollTimeOutArrow=r;s._scrollTimeOutContainer=r;s._initialDelay=300;s._trackClickPepeatFreq=70;s._isHorizontalScroll=n;s._width=typeof t=="number"?t:0;s._height=typeof i=="number"?i:0;s._pageValue=typeof u=="number"?u:0;s._maximum=typeof f=="number"?f:0;s._minimum=typeof e=="number"?e:0;s._scrollType=typeof o=="number"?o:1;s._isMouseCapture=!1;s._scrollPosition=0;s._value=s._minimum;s.refreshLayout()}return y.prototype.getScrollbar=function(){return this._scrollContainerDiv},y.prototype.smallChange=function(n){var t=this;return arguments.length===0?t._smallChange:(typeof n=="number"&&t._smallChange!==n&&(t._smallChange=n),t)},y.prototype.largeChange=function(n){var t=this;return arguments.length===0?t._largeChange:(typeof n=="number"&&t._largeChange!==n&&(t._largeChange=n),t)},y.prototype.pageValue=function(n){var t=this;return arguments.length===0?t._pageValue:(typeof n=="number"&&t._pageValue!==n&&(n<=0&&(n=1),t._pageValue=n),t)},y.prototype.maximum=function(n){var t=this;return arguments.length===0?t._maximum:(typeof n=="number"&&t._maximum!==n&&(n<=0&&(n=0),t._maximum=n),t)},y.prototype.minimum=function(n){var t=this;return arguments.length===0?t._minimum:(typeof n=="number"&&t._minimum!==n&&(n<=0&&(n=0),t._minimum=n),t)},y.prototype.value=function(n){var t=this,i;return arguments.length===0?t._value:(typeof n=="number"&&n<=t._maximum&&n>=t._minimum&&(t._value=n,i=(n-t._minimum)*t._scrollUnit,t.scrollTo(i,!0)),t)},y.prototype.width=function(n){var t=this;return arguments.length===0?t._width:(typeof n=="number"&&t._width!==n&&(t._width=n),t)},y.prototype.height=function(n){var t=this;return arguments.length===0?t._height:(typeof n=="number"&&t._height!==n&&(t._height=n),t)},y.prototype.scrollType=function(n){var t=this;return arguments.length===0?t._scrollType:(typeof tt[n]!==o&&t._scrollType!==n&&(t._scrollType=n),t)},y.prototype.refreshLayout=function(){var n=this,e=n._height,o=n._width,i=e,y=o-2*e,b=i,l=w,it=at,k=0,d=0,wt=!1,r=2,bt=st,kt=ht,dt=lt,gt=yt,ei="ui-widget ui-corner-all",ni="ui-state-default ui-corner-bl btn btn-default",ti="ui-icon ui-icon-triangle-1-w",ii="scroll-handle ui-state-default ui-corner-all ui-draggable btn btn-default",ri="ui-icon ui-icon-grip-solid-vertical",ui="ui-state-default ui-corner-br btn btn-default",fi="ui-icon ui-icon-triangle-1-e",u,a,v,f,tt;n._isHorizontalScroll?n._scrollSize=y:(i=o,y=i,b=e-2*o,l=c,it=vt,n._scrollSize=b,bt=et,kt=ot,dt=ct,gt=pt,ni="ui-state-default ui-corner-tr btn btn-default",ti="ui-icon ui-icon-triangle-1-n",ii="scroll-handle ui-state-default ui-corner-all ui-draggable btn btn-default",ri="ui-icon ui-icon-grip-solid-horizontal",ui="ui-state-default ui-corner-br btn btn-default",fi="ui-icon ui-icon-triangle-1-s");u=n._scrollSize;a=n._maximum-n._minimum;n._scrollbarSize=n._pageValue*u/(a+n._pageValue);n._scrollbarSize>u&&(n._scrollbarSize=u);n._scrollbarSize<10&&(n._scrollbarSize=10);v=n._scrollbarSize;n._scrollUnit=a!==0?(u-v)/a:1;n._isHorizontalScroll?(k=v,d=i):(k=i,d=v);n._scrollContainerDiv||(wt=!0,n._scrollContainerDiv=document.createElement("div"),t.GC$(n._scrollContainerDiv).css({position:"relative",left:0,top:0,overflow:"hidden",outline:"none",border:"none",padding:0,margin:0}).addClass(rt+" "+ut+" "+ei));f=t.GC$(n._scrollContainerDiv);f.css(s,o).css(h,e);n._arrowStartDiv||(n._arrowStartDiv=document.createElement("div"),t.GC$(n._arrowStartDiv).css({position:"absolute",display:"inline-block",borderWidth:"1px",padding:0,margin:0,boxSizing:"content-box"}).addClass(g+" "+ni),n._arrowStartSpan=document.createElement("span"),t.GC$(n._arrowStartSpan).css({display:"block",border:"none",padding:0,margin:0}),t.GC$(n._arrowStartSpan).addClass(bt+" "+ti),t.GC$(n._arrowStartDiv).append(n._arrowStartSpan),f.append(n._arrowStartDiv));t.GC$(n._arrowStartDiv).css(l,0).css(s,i-r).css(h,i-r);t.GC$(n._arrowStartSpan).css({width:"100%",height:"100%"});n._scrollbarWrapperDiv||(n._scrollbarWrapperDiv=document.createElement("div"),t.GC$(n._scrollbarWrapperDiv).css({position:"absolute",display:"inline-block",boxSizing:"content-box",border:"none",padding:0,margin:0}).addClass(nt+" "+nt),f.append(n._scrollbarWrapperDiv));tt=t.GC$(n._scrollbarWrapperDiv);tt.css(l,i).css(s,y).css(h,b);n._scrollbarDiv||(n._scrollbarDiv=document.createElement("div"),t.GC$(n._scrollbarDiv).css({position:"absolute",borderWidth:"1px",padding:0,margin:0,boxSizing:"content-box"}).attr("unselectable","on").addClass(ft+" "+p+" "+ii),n._scrollbarSpan=document.createElement("span"),t.GC$(n._scrollbarSpan).css({display:"block",border:"none",padding:0,margin:0}),t.GC$(n._scrollbarSpan).addClass(dt+" "+ri),t.GC$(n._scrollbarDiv).append(n._scrollbarSpan),tt.append(n._scrollbarDiv));t.GC$(n._scrollbarDiv).css(l,n._scrollPosition).css(s,Math.round(k-r)).css(h,Math.round(d-r));t.GC$(n._scrollbarSpan).css({width:i-r,height:i-r});t.GC$(n._scrollbarSpan).css(gt,Math.floor((n._scrollbarSize-i)/2));n._arrowEndDiv||(n._arrowEndDiv=document.createElement("div"),t.GC$(n._arrowEndDiv).css({position:"absolute",display:"inline-block",borderWidth:"1px",padding:0,margin:0,boxSizing:"content-box"}).addClass(g+" "+ui),n._arrowEndSpan=document.createElement("span"),t.GC$(n._arrowEndSpan).css({display:"block",border:"none",padding:0,margin:0}),t.GC$(n._arrowEndSpan).addClass(kt+" "+fi),t.GC$(n._arrowEndDiv).append(n._arrowEndSpan),f.append(n._arrowEndDiv));t.GC$(n._arrowEndDiv).css(it,0).css(s,i-r).css(h,i-r);t.GC$(n._arrowEndSpan).css({width:"100%",height:"100%"});wt&&n._initEvents()},y.prototype._initEvents=function(){var r=this;t.GC$(r._arrowStartDiv).bind(l,function(n){r._arrowMousedown(n,!0)}).bind(e,function(n){r._arrowMouseup(n,!0)}).bind(k,function(n){r._arrowMouseover(n,!0)}).bind(d,function(n){r._arrowMouseout(n,!0)});t.GC$(r._arrowEndDiv).bind(l,function(n){r._arrowMousedown(n,!1)}).bind(e,function(n){r._arrowMouseup(n,!1)}).bind(k,function(n){r._arrowMouseover(n,!1)}).bind(d,function(n){r._arrowMouseout(n,!1)});t.GC$(r._scrollbarDiv).bind(l,function(n){r._scrollbarMousedown(n)}).bind(b,function(n){r._scrollbarMousemove(n)}).bind(e,function(n){r._scrollbarMouseup(n)}).bind(k,function(n){r._scrollbarMouseover(n)}).bind(d,function(n){r._scrollbarMouseout(n)});t.GC$(r._scrollbarWrapperDiv).bind(l,function(n){var f=t.util.browser&&t.util.browser.mozilla,i,u;f&&(i=(new Date).valueOf(),u=r._lastMouseDownTime,r._lastMouseDownTime=i,u&&i-u<100)||r._scrollbarContainerMousedown(n)}).bind(e,function(n){r._scrollbarContainerMouseup(n)});r._mousewheelHandler=function(n){r._scrollContainerMousewheel(n)};f.addHandler(r._scrollContainerDiv,a,r._mousewheelHandler);f.addHandler(r._scrollContainerDiv,v,r._mousewheelHandler);t.features.touch&&(r._simulateMouseEvents=new n.Sheets._SimulateMouseEvents,r._simulateMouseEvents.bindUnBindTouchEvents(r._scrollContainerDiv,!0,i))},y.prototype.dispose=function(){var n=this,r=n._scrollContainerDiv;n._arrowEndDiv&&t.GC$(n._arrowEndDiv).unbind(i);n._scrollbarDiv&&t.GC$(n._scrollbarDiv).unbind(i);n._arrowStartDiv&&t.GC$(n._arrowStartDiv).unbind(i);n._scrollbarWrapperDiv&&t.GC$(n._scrollbarWrapperDiv).unbind(i);r&&(n._mousewheelHandler&&(f.removeHandler(r,a,n._mousewheelHandler),f.removeHandler(r,v,n._mousewheelHandler)),n._simulateMouseEvents&&n._simulateMouseEvents.bindUnBindTouchEvents(n._scrollContainerDiv,!1,i),t.GC$(r).unbind(i).remove())},y.prototype._handleDocumentMouseMove=function(){var n=this;n._isMouseCapture||(t.GC$(document).bind(b,function(t){n._scrollbarMousemove(t)}).bind(e,function(t){n._scrollbarMouseup(t)}),n._isMouseCapture=!0)},y.prototype._unhandleDocumentMouseMove=function(){this._isMouseCapture&&(this._isMouseCapture=!1,t.GC$(document).unbind(b).unbind(e))},y.prototype._arrowMousedown=function(n,i){var u=0,r=this,e=!0,f;(r._isMousedownInArrowButton=!0,r._scrollTimeOutArrow===null)&&(i?(t.GC$(r._arrowStartDiv).addClass("scrollbar-stateActive ui-state-active"),u=0-r._smallChange,r._scrollEventType=0):(t.GC$(r._arrowEndDiv).addClass("scrollbar-stateActive ui-state-active"),u=r._smallChange,r._scrollEventType=1),f=function(){r.scrollTo(r._scrollPosition+u*r._scrollUnit,!1);r._scrollType===1&&(r._scrollTimeOutArrow=setTimeout(f,e?r._initialDelay:r._trackClickPepeatFreq));e=!1},f(),t.util.preventDefault(n))},y.prototype._arrowMouseup=function(n,i){var r=this,u=t.GC$(r._arrowStartDiv);i||(u=t.GC$(r._arrowEndDiv));u.removeClass("scrollbar-stateActive ui-state-active");r._endArrowScroll();t.util.preventDefault(n)},y.prototype._arrowMouseover=function(n,i){var r=this,u=t.GC$(r._arrowStartDiv);i||(u=t.GC$(r._arrowEndDiv));u.addClass("scroll-arrow-hover ui-state-hover");t.util.preventDefault(n)},y.prototype._arrowMouseout=function(n,i){var r=this,u=t.GC$(r._arrowStartDiv);i||(u=t.GC$(r._arrowEndDiv));u.removeClass("scroll-arrow-hover scrollbar-stateActive ui-state-hover ui-state-active");r._endArrowScroll();t.util.preventDefault(n)},y.prototype._scrollbarMousedown=function(n){var i=this;if(n.button===0){i._isMousedownInScrollbar=!0;i._oldPosition={x:n.pageX,y:n.pageY};i._handleDocumentMouseMove();t.GC$(i._scrollbarDiv).addClass("scrollbar-stateActive ui-state-active");var r=t.GC$(i._scrollbarDiv).offset(),f=t.GC$(i._scrollbarDiv).outerWidth(!0),e=t.GC$(i._scrollbarDiv).outerHeight(!0),u=t.GC$(i._scrollbarWrapperDiv).offset(),o=t.GC$(i._scrollbarWrapperDiv).outerWidth(!0),s=t.GC$(i._scrollbarWrapperDiv).outerHeight(!0);i._edgePosition={isBeyondEdge:!1,startEdgePosition:{x:u.left+n.pageX-r.left,y:u.top+n.pageY-r.top},endEdgePosition:{x:u.left+o-(f-n.pageX+r.left),y:u.top+s-(e-n.pageY+r.top)}}}t.util.preventDefault(n)},y.prototype._scrollbarMousemove=function(n){var i=this;i._isMousedownInScrollbar&&(i._currentPosition={x:n.pageX,y:n.pageY},i._scrollbarDrag(),i._oldPosition=i._currentPosition,t.GC$(document.body).attr("unselectable","on").addClass(p));t.util.preventDefault(n)},y.prototype._scrollbarMouseup=function(n){var i=this,r;i._isMousedownInScrollbar=!1;i._scrollEventType=4;i._edgePosition=null;r={newValue:i._value,oldValue:i._value,scrollOrientation:i._isHorizontalScroll?0:1,scrollEventType:i._scrollEventType};t.GC$(i._scrollContainerDiv).trigger(u,r);var o=i._value,f=(o-i._minimum)*i._scrollUnit,e="left";i._isHorizontalScroll||(e="top");i._scrollPosition=f;t.GC$(i._scrollbarDiv).css(e,f);i._unhandleDocumentMouseMove();t.GC$(document.body).removeClass(p);t.GC$(document.body).attr("unselectable")&&t.GC$(document.body).removeAttr("unselectable");t.GC$(i._scrollbarDiv).removeClass("scrollbar-stateActive ui-state-active");i._scrollEventType=6;r={newValue:i._value,oldValue:i._value,scrollOrientation:i._isHorizontalScroll?0:1,scrollEventType:i._scrollEventType};t.GC$(i._scrollContainerDiv).trigger(u,r);t.util.preventDefault(n)},y.prototype._scrollbarMouseover=function(n){t.GC$(this._scrollbarDiv).addClass("scrollbar-stateHover ui-state-hover");t.util.preventDefault(n)},y.prototype._scrollbarMouseout=function(n){t.GC$(this._scrollbarDiv).removeClass("scrollbar-stateHover ui-state-hover");t.util.preventDefault(n)},y.prototype._scrollContainerMousewheel=function(n){var i=this,e,f,s;(typeof n.wheelDelta===o||n.wheelDelta===r)&&(typeof n.detail===o||n.detail===r)&&(n.wheelDelta=n.originalEvent.wheelDelta,n.detail=n.originalEvent.detail);e=n.detail?n.detail:n.wheelDelta/-40;f=e/3*i._smallChange*i._scrollUnit;i._scrollEventType=f>=0?1:0;i.scrollTo(i._scrollPosition+f,!1);i._scrollEventType=6;s={newValue:i._value,oldValue:i._value,scrollOrientation:i._isHorizontalScroll?0:1,scrollEventType:i._scrollEventType};t.GC$(i._scrollContainerDiv).trigger(u,s);t.util.preventDefault(n)},y.prototype._scrollbarContainerMousedown=function(n){var i=this,f=!0,e=n.pageX,o=n.pageY,r=0,s=t.GC$(i._scrollbarWrapperDiv).offset(),h=i._largeChange,u;i._scrollTimeOutContainer===null&&(r=i._isHorizontalScroll?e-s.left-i._scrollPosition:o-s.top-i._scrollPosition,u=function(){var c=t.GC$(i._scrollbarWrapperDiv).offset(),n=0,s=i._scrollPosition;if(n=i._isHorizontalScroll?e-c.left-s:o-c.top-s,n*r<0||n>=0&&n<i._scrollbarSize){i._endContainerScroll();return}if(r<0)i._scrollEventType=2,i.scrollTo(s-h*i._scrollUnit,!1);else if(r>0)i._scrollEventType=3,i.scrollTo(s+h*i._scrollUnit,!1);else{i._endContainerScroll();return}i._scrollType===1&&(i._scrollTimeOutContainer=setTimeout(u,f?i._initialDelay:i._trackClickPepeatFreq));f=!1},u(),t.util.preventDefault(n))},y.prototype._scrollbarContainerMouseup=function(n){this._endContainerScroll();t.util.preventDefault(n)},y.prototype._endContainerScroll=function(){var n=this,i;n._scrollTimeOutContainer&&clearTimeout(n._scrollTimeOutContainer);n._scrollTimeOutContainer=r;n._scrollEventType=6;i={newValue:n._value,oldValue:n._value,scrollOrientation:n._isHorizontalScroll?0:1,scrollEventType:n._scrollEventType};t.GC$(n._scrollContainerDiv).trigger(u,i)},y.prototype._endArrowScroll=function(){var n=this,i;n._isMousedownInArrowButton&&(n._isMousedownInArrowButton=!1,n._scrollTimeOutArrow&&clearTimeout(n._scrollTimeOutArrow),n._scrollTimeOutArrow=r,n._scrollEventType=6,i={newValue:n._value,oldValue:n._value,scrollOrientation:n._isHorizontalScroll?0:1,scrollEventType:n._scrollEventType},t.GC$(n._scrollContainerDiv).trigger(u,i))},y.prototype._scrollbarDrag=function(){var n=this,r=0,u=n._scrollPosition,i=n._currentPosition,t=n._edgePosition,l,a;if(n._isHorizontalScroll){if(t&&t.isBeyondEdge){var f=t.startEdgePosition.x,e=t.endEdgePosition.x,h=i.x<f,c=i.x>e;if(h||c)return;n._oldPosition.x<f&&(n._oldPosition.x=f);n._oldPosition.x>e&&(n._oldPosition.x=e)}l=i.x-n._oldPosition.x;r=u+l}else{if(t&&t.isBeyondEdge){var o=t.startEdgePosition.y,s=t.endEdgePosition.y,h=i.y<o,c=i.y>s;if(h||c)return}n._oldPosition.y<o&&(n._oldPosition.y=o);n._oldPosition.y>s&&(n._oldPosition.y=s);a=i.y-n._oldPosition.y;r=u+a}r!==u&&(n._scrollEventType=5,n.scrollTo(r,!1))},y.prototype.scrollTo=function(n,i){var r=this,s=c,h=r._scrollSize-r._scrollbarSize,v="",y=r._scrollPosition,p=t.ScrollOrientation,e,f;r._isHorizontalScroll&&(s=w);e=!1;n>h&&(n=h,e=!0);n<0&&(n=0,e=!0);r._edgePosition&&(r._edgePosition.isBeyondEdge=e);var o=Math.round(n/r._scrollUnit)+r._minimum,a=r._value,l=!1;i||(f={newValue:o,oldValue:a,scrollOrientation:r._isHorizontalScroll?0:1,scrollEventType:r._scrollEventType},t.GC$(r._scrollContainerDiv).trigger(u,f),l=f.ignoreUpdatePosition,f.newValue>r._maximum&&(f.newValue=r._maximum),o=f.newValue);r._value=o;r._scrollEventType!==5&&(n=(o-r._minimum)*r._scrollUnit);r._scrollPosition=n;l||t.GC$(r._scrollbarDiv).css(s,n)},y}();t.Scrollbar=y})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){var k,dt,tt,gt,ni,ti;t.feature("core.basecelltype",["core.common","core.globalize","core.theme"]);var it=window.document,ct="position",lt="absolute",at="margin",rt="font",ii="class",u="left",v="right",d="top",vt="alphabetic",y="center",g="gcUIElement",p="none",ri="tabindex",ut="0",hr="#9fa9c5",ui="#f6fafb",h=".gcEditingInput",fi="keydown"+h,ei="keyup"+h,oi="paste"+h,si="mousedown"+h,hi="compositionstart"+h,ci="compositionupdate"+h,li="compositionend"+h,l="width",e="height",yt="padding",ai="padding-left",vi="padding-right",yi="padding-top",pi="padding-bottom",pt="text-align",f="hidden",wi="visibility",c="word-wrap",o="overflow",nt="normal",ft="break-word",wt="overflow-y",bi="resize",ki="border",di="outline",gi="box-shadow",nr="box-sizing",tr="autocomplete",bt="color",ir="border-width",kt="background-color",rr="z-index",ur="text-decoration",et="ime-mode",fr="overline",er="line-through",or="underline",sr=.337,w=16,b="undefined",s=undefined,i=null,ot=Math.floor,a=Math.ceil,st=Math.min,ht=Math.max,r=function(){function n(){}return n.getAutoFitWidth=function(i,r,u,f,e){var o=0,h=e&&e.sheet,a,c,l,s;if(h&&typeof r=="string"&&r!==""){if(u.wordWrap)for(a=0,c=u.textIndent,c>0&&(a=c*8),l=r.split(/\r\n|\r|\n/),s=0;s<l.length;s++)o=ht(o,t._WordWrapHelper._measureTextWithoutEndSpaces(l[s],u.font)/f);else o=h._getStringWidthByCanvas(r,u.font)/f;u.hAlign!==1&&u.textIndent>0&&(o+=u.textIndent*8/f);u.hAlign===0&&n.hasIconSet(h,e.row,e.col,e.sheetArea)&&(o+=w)}return o},n.getAutoFitHeight=function(n,i,r,u,f){var l=0,s=f&&f.sheet,a,v,y,c,w;if(s&&typeof i=="string"&&i!=="")if(a=s._getFontHeight(r.font)/u,r.wordWrap){v=0;y=r.textIndent;y>0&&(v=y*8);var p=f.row,e=f.col,b=f.sheetArea,h=0,o=s._getSpanModel(b).find(p,e);if(o){if(!(o.row<p)&&!(o.rowCount>1)&&!(o.col<e)&&e==o.col&&(h=s.getColumnWidth(e),o.colCount>1))for(c=e+1;c<e+o.colCount;c++)h+=s.getColumnWidth(c)}else h=s.getColumnWidth(e);w=t._WordWrapHelper._getWrapInfo(i,h-3-v,r.font);l=w.length*a}else l=a;return l},n.paintBackground=function(t,i,r,u,f,e,o,s,h){(e||o)&&(t.save(),t.beginPath(),e&&(t.fillStyle!==e&&(t.fillStyle=e),t.fillRect(i,r,u,f)),n.paintBackgroundImage(t,i,r,u,f,o,s,h),t.restore())},n.paintBackgroundImage=function(n,t,i,r,u,f,e,o){if(f&&f!==p&&o)try{if(o.getState(f)){var w=o.getImage(f),s=w.width,h=w.height,d=0,g=0,c=s,l=h,v=r,y=u,b=t,k=i;switch(e){case 0:break;case 1:c=r>=s?s:r;l=u>=h?h:u;b=r>s&&s>0?a(t+r/2-s/2):t;k=u>h&&h>0?a(i+u/2-h/2):i;v=c;y=l;break;case 2:u>0&&h>0&&r/u>s/h?(v=s/h*u,b=t+r/2-v/2):r>0&&s>0&&u/r>h/s&&(y=h/s*r,k=i+u/2-y/2);break;case 3:c=r>=s?s:r;l=u>=h?h:u;v=c;y=l;break;default:break}n.drawImage(w,d,g,c,l,b,k,v,y)}else o.addImage(f)}catch(nt){}},n.paintConditionalFormats=function(n,r,u,f,e,o,s,h){var nt=h.conditionalFormats,b,it,g;if(nt&&!(nt.count()<=0)){var p=h.sheet,v=h.row,y=h.col,c,l,tt=p._cachePool.getConditionalFormat(v,y);if(tt){if(c=tt.i,l=tt.d,!c&&!l)return!1}else{if(b=nt.getRules(v,y),it=b.length,it<=0)return p._cachePool.setConditionalFormat(v,y,l,c),!1;var rt=!1,ut=!1,k=i,d=i,a=i,ft=i;for(b.sort(function(n,t){return n.priority()-t.priority()}),g=0;g<it;g++)if(a=b[g],a&&(!k&&a instanceof t.DataBarRule?k=a:!d&&a instanceof t.IconSetRule&&(d=a),a.stopIfTrue()&&(ft=a.evaluate(p,v,y,r),ft)))break;k&&(l=k.evaluate(p,v,y,r));d&&(c=d.evaluate(p,v,y,r));p._cachePool.setConditionalFormat(v,y,l,c)}return n.save(),n.beginPath(),l&&(t.DataBarRule.paintDataBar(n,l,u,f,e,o),rt=l.showBarOnly),c&&((e<w||o<w)&&(n.rect(u,f,e,o),n.clip(),n.beginPath()),t.IconSetRule.paintIconSet(n,c,u,f,e,o,s,h.imageLoader),ut=c.showIconOnly),n.restore(),rt||ut}},n.paintSparkline=function(n,t,i,r,u,f){f&&f.paintSparkline(n,t,i,r,u)},n.paintSparklineEx=function(n,i,r,u,f,e,o){var s,h;return t.features.sparklineEx&&i instanceof t.SparklineExValue&&(s=o&&o.parent,s&&(h=s.getSparklineEx(i.name),h))?(h._paintSparkline(n,i.value,r,u,f,e,o),!0):!1},n.hasIconSet=function(n,r,u,f){var o,h,e,c;if((f===i||f===s||f===3)&&(o=n._conditionalFormats,o))for(h=o.getRules(r,u),e=0,c=h.length;e<c;e++)if(h[e]instanceof t.IconSetRule)return!0;return!1},n.adjustRectForIconSet=function(t,i,r,u,f,e){t===0&&n.hasIconSet(i,r,u,f)&&(e.x+=w,e.width-=w)},n}();t.CellTypeContext=r;k=function(){function n(){this.allowOverflow=!1;this.typeName="0"}return n.prototype.paintValue=function(n,t,r,u,f,e,o,s){var c={value:i},h;(h=this.format(t,o.formatter||o._autoFormatter,c),h)&&this.paintText(n,t,r,u,f,e,o,s,h,c)},n.prototype.paintText=function(n,i,r,f,e,o,s,h,c,l,a){var k,tt,kt,at,yt,pt,et,fi,ti;n.save();n.beginPath();k=s.foreColor;tt=s.font;l.value&&(k=l.value);typeof a!==b&&(kt=t._Color.parse(k),kt.a=a,k=kt.toString());k&&n.fillStyle!==k&&(n.fillStyle=k);tt&&n.font!==tt&&(n.font=tt);var it=0,ii=s.textIndent,ri=s.wordWrap,d=s.hAlign,dt=s.vAlign,st=s.textDecoration,ht=u,ui=vt,w=2,g=2,gt=0,nt=h.lineHeight,ct=[],lt=0,rt=h.fontInfo.fontSize;ii>0&&(it=ii*8);d===3&&(d=t.util.getHAlignByValueType(d,i,s.formatter));w+=it;d===1?(w=e/2,ht=y):d===2&&(w=e-3,w-=it,ht=v);n.textAlign!==ht&&(n.textAlign=ht);ri&&(ct=t._WordWrapHelper._getWrapInfo(c,e-3-it,tt),lt=ct.length,lt>1&&dt!==0&&(gt=(lt-1)*nt));at=rt>8?ot((rt-8)/5+2):1;yt=nt/2-rt/2+at-1;g+=nt-yt;dt===1?g=(o-gt)/2+nt/2-yt:dt===2&&(g=o-gt-2-yt);n.textBaseline!==ui&&(n.textBaseline=ui);var p={x:r+1,y:f+1,width:e-2,height:o-2},ut=h.cellOverflowLayout,ft=ut&&ut.layout;if(ft&&(p={x:ft.x,y:ft.y,width:ft.width,height:ft.height}),ri)for(n.rect(p.x,p.y,p.width,p.height),n.clip(),n.beginPath(),pt=f+g,et=0;et<lt;et++)n.fillText(ct[et],r+w,pt),st&&(fi=n.measureText(ct[et]).width,this._renderTextDecoration(n,st,r+w,pt,fi,rt,at)),pt+=nt;else{var wt=n.measureText(c).width,ni=p.width,ei=p.height,bt=wt>ni||nt>ei;bt||(d===1?ut&&(ti=wt/2,(ti>ut.backgroundLeftWidth||ti>ut.backgroundRightWidth)&&(bt=!0)):wt+it>ni&&(bt=!0));bt&&(n.rect(p.x,p.y,ni,ei),n.clip(),n.beginPath());n.fillText(c,r+w,f+g);st&&this._renderTextDecoration(n,st,r+w,f+g,wt,rt,at)}n.restore()},n.prototype.paint=function(n,t,i,r,u,f,e,o){},n.prototype.createEditorElement=function(n){return i},n.prototype._getLocator=function(){var n=it.createElement("span");return t.GC$(n).css(ct,lt).css(wi,f).css(kt,"#68E").css(at,ut).css(yt,"2px").css(rt,"normal 12px Arial").css(bt,"white").css(ir,ut).attr(ii,"gc-input-locator").attr(g,"gcEditingLocator"),n},n.prototype.getEditorValue=function(n,t){return i},n.prototype._formatEditorValue=function(n,t,i,r){return i},n.prototype.setEditorValue=function(n,t,i){},n.prototype.getEditingElement=function(){return i},n.prototype.parse=function(n,r,u){var o=typeof r===b||r===i,f=typeof n===b||n===i,e;if(o||f)return f?"":n.toString();else try{return t.features.formatter?(e=typeof r=="string"?new t.GeneralFormatter(r):r,e.Parse(n)):n.toString()}catch(s){return n.toString()}},n.prototype.format=function(n,r,u,f){var o,e;if(n===s||n===i||n==="")return"";if(typeof r=="string"&&typeof n!="object")return t._CacheMgr.getFormattedText(n,r,u);if(r)try{return t.features.formatter?(e=i,e=typeof r=="string"?t._CacheMgr.getFormatter(r):r,e.Format(n,u)):n.toString()}catch(h){return n.toString()}else{if(typeof n=="boolean"||n instanceof Boolean)return n.toString().toUpperCase();else if(n instanceof Date)return o=t._CultureInfo.currentCulture().DateTimeFormat(),new t._DateTimeHelper(n).localeFormat(o.shortDatePattern+" H:mm:ss");return typeof n=="number"&&(n=t._NumberHelper.replaceNormalToCultureSymble(n.toString())),n.toString()}},n.prototype.focus=function(n,t){n&&n.focus&&n.focus()},n.prototype.getThemeStyle=function(n,i){return t.ThemeStyleHelper.getVisualStateThemeStyle(n,i)},n.prototype.activateEditor=function(n,t,i,r){},n.prototype.deactivateEditor=function(n,t){},n.prototype.selectAll=function(n,t){n&&n.select&&n.select()},n.prototype.updateEditor=function(n,t,i,r){},n.prototype.setImeMode=function(n,i,r){this.isImeAware(r)?this.updateImeMode(n,i,r):n&&t.GC$(n).css(et,this._getImeModeString(0))},n.prototype.updateImeMode=function(n,i,r){n&&t.GC$(n).css(et,this._getImeModeString(i))},n.prototype._getImeModeString=function(n){var t="";n===s&&(n=1);switch(n){case 1:t="auto";break;case 2:t="active";break;case 4:t="inactive";break;case 0:t="disabled";break}return t},n.prototype._updateEditorLocator=function(n,i){var r=n&&i&&i.sheet,f,e;r&&r.isEditing()&&r.showEditingLocator&&(f=n._editingLocator,e=t.GC$(n),f&&t.GC$(f).css(d,parseInt(e.css(d),10)-18).css(u,parseInt(e.css(u),10)))},n.prototype.getHitInfo=function(n,t,r,u,f){return i},n.prototype.processMouseDown=function(n){return!1},n.prototype.processMouseMove=function(n){return!1},n.prototype.processMouseUp=function(n){return!1},n.prototype.processMouseEnter=function(n){},n.prototype.processMouseLeave=function(n){},n.prototype.isReservedKey=function(n,t){return!1},n.prototype.isEditingValueChanged=function(n,t,i){return n!==t},n.prototype.processKeyDown=function(n,t){return!1},n.prototype.processKeyUp=function(n,t){return!1},n.prototype.getAutoFitWidth=function(n,t,i,r,u){return 0},n.prototype.getAutoFitHeight=function(n,t,i,r,u){return 0},n.prototype._renderTextDecoration=function(n,t,i,r,u,f,e){n.strokeStyle=n.fillStyle;var o=0,h=0,s=.5,c;c=f<=12?12:f;h=ot((c-12)/21+1);n.lineWidth=h;(h&1)==0&&(s=0);n.textAlign===y?i=i-u/2:n.textAlign===v&&(i=i-u);n.beginPath();(t&4)==4&&(o=a(r+e-f-1)-s,n.moveTo(i,o),n.lineTo(i+u,o));(t&2)==2&&(o=a(r+e-f/2)-s,n.moveTo(i,o),n.lineTo(i+u,o));(t&1)==1&&(o=a(r+e-1)-s,n.moveTo(i,o),n.lineTo(i+u,o));n.stroke()},n.prototype._setEditStatusTextDecoration=function(n,t){var i="";(t&4)==4&&(i=fr);(t&2)==2&&(i+=" "+er);(t&1)==1&&(i+=" "+or);n.css(ur,i)},n.prototype.isImeAware=function(n){return!1},n.prototype.isEditting=function(){return!1},n.prototype.toJSON=function(){return{typeName:this.typeName}},n.prototype.fromJSON=function(n,t){},n}();t.BaseCellType=k;dt=function(w){function b(){w.call(this);this.allowOverflow=!0;this.typeName="1"}return __extends(b,w),b.prototype.paint=function(n,i,u,f,e,o,s,h){var l,a,c;n&&(h&&h.parentBackColor&&h.parentBackColor===s.backColor||r.paintBackground(n,u,f,e,o,s.backColor,s.backgroundImage,s.backgroundImageLayout,h.imageLoader),l=r.paintConditionalFormats(n,i,u,f,e,o,s,h),h.showBarIconOnly=l,r.paintSparkline(n,u,f,e,o,h.sparkline),a=r.paintSparklineEx(n,i,u,f,e,o,h.sheet),h.cellOverflowLayout||l||a||(c=new t.Rect(u,f,e,o),r.adjustRectForIconSet(s.hAlign,h.sheet,h.row,h.col,h.sheetArea,c),this.paintValue(n,i,c.x,c.y,c.width,c.height,s,h)))},b.prototype.getText=function(n,t){return n},b.prototype.paintValue=function(n,t,r,u,f,e,o,s){var l=this,h,c;if(t=this.getText(t,s),h={value:i},c=l.format(t,o.formatter||o._autoFormatter,h),o.watermark&&!c){l.paintText(n,o.watermark,r,u,f,e,o,s,o.watermark,h,sr);return}c&&l.paintText(n,t,r,u,f,e,o,s,c,h)},b.prototype.createEditorElement=function(n){var i=t.GC$(it.createElement("textarea"));i.css(at,ut).css(yt,"1px").css(nr,"content-box").css(rt,"normal 11pt calibri").css(c,"normal").css(o,f).css(bi,p).css(ki,"2px #5292f7 solid").css(di,p).css(gi,"1px 2px 5px rgba(0,0,0,0.4)").css("min-height","0px").attr(ri,-1).attr(tr,"off").attr(g,"gcEditingInput");var r=it.createElement("div"),u=n&&n.sheet&&n.sheet.parent&&n.sheet.parent._host,e=t.util.getPreferredZIndex(u)+1e3;return t.GC$(r).css(ct,lt).css(rr,e).append(i),r},b.prototype.getEditorValue=function(n,t){var u=n&&n.children[0],r;return u&&(r=u.value,r!==s&&r!==i&&r.length>0)?r:i},b.prototype.setEditorValue=function(n,r,u){var f=n&&n.children[0],e;f&&(e=(!t.util.browser.msie||parseFloat(t.util.browser.version)<11)&&(u&&u.sheet&&u.sheet._startEditByKeydown?!0:!1),f.value=r===i||r===s||e?"":r,f.selectionStart=f.selectionEnd=f.value.length)},b.prototype.focus=function(n,t){if(n){var i=n.children[0];this.isImeAware()&&i?(i.focus(),i.selectionStart=i.value.length):n.focus()}},b.prototype._formatEditorValue=function(n,i,r,u){var f=n&&u&&u.sheet;return t.util.formatValue2Text(i,r,f)},b.prototype.activateEditor=function(n,r,f,e){var s=n&&e&&e.sheet,v,l,a,o,c,h;s&&(v=t.GC$(n),l=s.getBounds(),a=e.canvasOffset?e.canvasOffset:s._eventHandler._getCanvasPosition(),v.css(d,a.top+l.y+f.y-2).css(u,a.left+l.x+f.x-2),o=this,c=n.children[0],c&&(h=t.GC$(c),o._editingElement=h.getElement(0),h.bind(fi,function(i){var u=i.keyCode===229||i.keyCode===0;if(u||o._isImeInputing||o._updateEditorImp(n,r,f,i,e,!0),!o._processEditingWrap(i,e)){var h=c.selectionStart===0&&i.keyCode===37&&!i.ctrlKey&&!i.shiftKey&&!i.altKey,l=c.selectionStart===c.value.length&&i.keyCode===39&&!i.ctrlKey&&!i.shiftKey&&!i.altKey,a=c.selectionStart===c.selectionEnd;a&&(h||l)&&s._editorStatus===2&&t.util.cancelDefault(i)}}),h.bind(ei,function(t){(t.keyCode===46||t.keyCode===8||(t.keyCode===90||t.keyCode===89)&&t.ctrlKey&&!t.altKey)&&o._updateEditorImp(n,r,f,t,e);(t.keyCode!==13&&t.keyCode!==9||t.ctrlKey||t.altKey)&&s.triggerEditChange({sheet:s,sheetName:s._name,row:s._activeRowIndex,col:s._activeColIndex,editingText:o.getEditorValue(n,e)})}),h.bind(oi,function(t){o._pasteInputSizingToken=window.setTimeout(function(){o._updateEditorImp(n,r,f,t,e);o._pasteInputSizingToken&&(window.clearTimeout(o._pasteInputSizingToken),delete o._pasteInputSizingToken)},10)}),h.bind(si,function(n){s._editorStatus===1&&(s._editorStatus=2,s.triggerEditorStatusChanged({sheet:s,sheetName:s._name,oldStatus:1,newStatus:2}))}),h.bind(hi,function(n){o._isImeInputing=!0;o._oldValueBeforeImeInputting=h.val()}),h.bind(ci,function(t){o._updateEditorImp(n,r,f,t?t:i,e,!0)}),h.bind(li,function(t){o._updateEditorImp(n,r,f,t?t:i,e);o._isImeInputing=!1})))},b.prototype.deactivateEditor=function(n,r){var u,f,e;n&&(u=n.children[0],u&&t.GC$(u).unbind(h),f=n._editingLocator,f&&(e=r&&r.sheet&&r.sheet._getHost(),e&&e.removeChild(f)));this._editingElement=i},b.prototype.getEditingElement=function(){return this._editingElement},b.prototype.selectAll=function(n,t){var i=n&&n.children[0];i&&i.select&&i.select()},b.prototype._updateEditorImp=function(n,r,h,p,w,b){var tt=w&&w.sheet,si,hi,k,ot,gt,ui,lt,dt,fi,ei,ct,at,oi,bi,et,ni,wi;if(tt&&h&&(si=w.canvasOffset?w.canvasOffset:tt._eventHandler._getCanvasPosition(),hi=tt.getBounds(),t.GC$(n).css(d,si.top+hi.y+h.y-2).css(u,si.left+hi.x+h.x-2)),k=n&&n.children[0],tt=w&&w.sheet,k&&tt){var ti=this,g=t.GC$(k),ii=tt._render;if(tt.isEditing()){var it=i,ci=u,ut=i;if(r&&(it=t.util.getHAlignByValueType(r.hAlign,n._originalValue),it===1?ci=y:it===2&&(ci=v),g.css(pt,ci),r.backColor&&g.css(kt,r.backColor),r.foreColor&&g.css(bt,r.foreColor),ut=r.font||ii._getDefaultFont(),ut&&(tt._zoomFactor>1&&(ut=ii._getZoomFont(ut)),g.css(rt,ut)),r.textDecoration&&ti._setEditStatusTextDecoration(g,r.textDecoration)),h){t.GC$(n).width(h.width).height(h.height);var vt=tt._getSheetLayout(),yt=1,ri=1;yt=yt+parseInt(g.css(ai),10)+parseInt(g.css(vi),10);ri=ri+parseInt(g.css(yi),10)+parseInt(g.css(pi),10);et=h.width;h.x+h.width>vt.width&&(et=vt.width-h.x);g.css(l,et-yt).css(e,h.height-ri);it===s||it===i||it===0?k.maxWidth=vt.width-h.x-yt:it===1?k.maxWidth=ht(0,st(vt.width-h.x-h.width-yt,h.x-vt.rowHeaderWidth-yt))*2+h.width:it===2&&(k.maxWidth=h.x+h.width-vt.rowHeaderWidth-yt);k.maxHeight=vt.height-h.y-ri;k.minWidth=parseInt(k.style.width,10);k.minHeight=parseInt(k.style.height,10)}try{b=b&&p&&p.keyCode&&tt._eventHandler.allowEnterEditing(p)&&k.selectionStart===0&&k.selectionEnd===k.value.length;b=b||(w&&w.sheet&&w.sheet._startEditByKeydown?!0:!1)}catch(gi){}if(ot=b?"":k.value,ut=k.style.font,ut||(ut=ii._getZoomFont(ii._getDefaultFont())),gt=tt._getFontHeight(ut),!b&&p){if(tt._eventHandler.allowEnterEditing(p)){var li=k.selectionStart,ki=ot.substr(0,li),di=ot.substr(li,ot.length-li);ot=ki+String.fromCharCode(p.keyCode)+di}ti._isImeInputing&&(ot=t.util.browser.msie?g.val():ti._oldValueBeforeImeInputting+p.data)}if(ui=[],ui=r&&r.wordWrap?t._WordWrapHelper._getWrapInfo(ot,g.width(),ut):ot.split(/\r\n|\r|\n/),ei=ui.length,k.minWidth=st(k.minWidth,k.maxWidth),k.minHeight=st(k.minHeight,k.maxHeight),r&&r.wordWrap||ei>0){if(ct=ei*gt,r&&r.wordWrap)g.css(c,ft).css(o,f);else{for(at=0,oi=[],lt=0;lt<ei;lt++)bi=ui[lt],dt=tt._getStringWidth(bi,ut),oi.push(dt),at=ht(at,dt);if(at<=k.minWidth)g.css(l,k.minWidth).css(c,nt).css(o,f);else if(at>k.minWidth&&at<=k.maxWidth)g.css(l,at).css(c,nt).css(o,f);else if(at>k.maxWidth)for(g.css(l,k.maxWidth).css(c,ft).css(o,f),ct=0,lt=0;lt<oi.length;lt++)dt=oi[lt],dt<=k.maxWidth?ct+=gt:dt>k.maxWidth&&(fi=a(dt/k.maxWidth),ct+=gt*fi)}ct<=k.minHeight?g.css(e,k.minHeight):ct>k.minHeight&&ct<=k.maxHeight?g.css(e,ct):ct>k.maxHeight&&g.css(e,k.maxHeight).css(wt,"scroll")}else et=tt._getStringWidth(ot,ut),et>k.minWidth&&et<=k.maxWidth?g.css(l,et).css(e,k.minHeight).css(c,nt).css(o,f):et<=k.minWidth?g.css(l,k.minWidth).css(e,k.minHeight).css(c,nt).css(o,f):et>k.maxWidth&&(g.css(l,k.maxWidth).css(c,ft),fi=a(et/k.maxWidth),ni=gt*fi,ni<=k.minHeight?g.css(e,k.minHeight).css(o,f):ni<=k.maxHeight?g.css(e,ni).css(o,f):ni>k.maxHeight&&g.css(e,k.maxHeight).css(wt,"scroll"));it=g.css(pt);wi=g.width()-k.minWidth;it!==s&&it!==i&&it!==u&&(it===y?g.css(u,k.originalLeft-wi/2):it===v&&g.css(u,k.originalLeft-wi));ti._updateEditorLocator(n,w)}}},b.prototype.updateEditor=function(n,r,u,f){if(this._updateEditorImp(n,r,u,i,f),t.util.browser.msie&&n){var e=t.GC$(n.children[0]),o=e.width();e.width(o+1).width(o)}},b.prototype.updateImeMode=function(n,i,r){if(this.isImeAware()){var u=n&&n.children[0];u&&t.GC$(u).css(et,this._getImeModeString(i))}},b.prototype.isReservedKey=function(n,t){var i=n.srcElement||n.target;return i&&t&&t.isEditing&&i.getAttribute(g)==="gcEditingInput"?n.keyCode===13&&(n.ctrlKey&&!n.shiftKey||n.altKey)||n.keyCode===90&&n.ctrlKey&&!n.altKey||n.keyCode===89&&n.ctrlKey&&!n.altKey:!1},b.prototype._processEditingWrap=function(r,u){var f=r.srcElement||r.target,e,c,h;if(f&&f.getAttribute(g)==="gcEditingInput"&&r.keyCode===13&&(r.ctrlKey||r.altKey)){var o=f.selectionStart,s=f.value,l=s.substr(0,o),a=s.substr(o,s.length-o);return f.value=l+"\n"+a,f.selectionStart=o+1,f.selectionEnd=o+1,e=t.FocusHelper.getActiveElement(),c=n.Sheets,e instanceof c.Sheet&&(h=e.getCellType(e._activeRowIndex,e._activeColIndex),h&&h.updateEditor(e._editor,i,i,u)),t.util.cancelDefault(r),!0}return!1},b.prototype.getAutoFitWidth=function(n,t,i,u,f){return r.getAutoFitWidth(n,t,i,u,f)},b.prototype.getAutoFitHeight=function(n,t,i,u,f){return r.getAutoFitHeight(n,t,i,u,f)},b.prototype.isImeAware=function(n){return!0},b}(k);t.TextCellType=dt;tt=function(n){function i(){n.apply(this,arguments)}return __extends(i,n),i.prototype._paint=function(n,i,r,u,f,e,o,h,c,l){var a,v,y;n&&(a=this,v=0,h.visualState!==s&&(v=h.visualState),y=a.getThemeStyle(h.visualState,"gc-"+c+"-"+t.VisualState[v].toLowerCase()),a._paintBackground(n,r,u,f,e,o,h,v,y),a._paintText(n,i,r,u,f,e,o,h,l,y),a._paintGridline(n,r,u,f,e,o,c,y,l))},i.prototype._paintBackground=function(n,i,u,f,e,o,s,h,c){var a,w,l,k,y,nt,d,g,v;if(typeof h!==b){if(n.save(),n.beginPath(),h===0&&o.backColor)a=o.backColor,n.fillStyle!==a&&(n.fillStyle=a),n.fillRect(i+1,u+1,f-1,e-1);else try{if(w=c&&c.backgroundColor,l=c&&c.backgroundImage,l&&l.indexOf("linear-gradient")!==-1){for(k=t.util.getLinearGradientColors(l),a=n.createLinearGradient(i+f/2,u,i+f/2,u+e),y=0,nt=k.length;y<nt;y++)d=k[y],a.addColorStop(d.point,d.color);n.fillStyle=a;n.fillRect(i+1,u+1,f-1,e-1)}else w?(n.fillStyle=w,n.fillRect(i+1,u+1,f-1,e-1)):l&&l!==p&&(g=new Image,v=l,v=v.replace('url("',""),v=v.replace('")',""),g.src=v,n.drawImage(g,i+1,u+1,f-1,e-1))}catch(tt){}r.paintBackgroundImage(n,i,u,f,e,o.backgroundImage,o.backgroundImageLayout,s.imageLoader);n.restore()}},i.prototype._paintText=function(n,i,r,f,e,o,s,h,c,l){var it=this,rt=it.format(i,s.formatter),kt=h.sheet,dt,a,w,at,k,yt,st,ht,nt,ct,tt,ti,bt;if(rt){n.save();n.beginPath();var ii=kt._render,lt=kt.rowFilter(),ri=!!(lt&<.isFilterHeader(h.row,h.col,c)&<.filterButtonVisible(h.col));ri&&(dt=ii._getFilterButtonRect(new t.Rect(r,f,e,o),c).width,e-=dt);a={x:r,y:f,width:e,height:o};w=s.foreColor;w||(w=l.color);w&&n.fillStyle!==w&&(n.fillStyle=w);at=it._getFontByVisualStatus(s.font||n.font,n.fillStyle,h,c,l);n.font=at.font;n.fillStyle=at.fillStyle;k=0;yt=s.textIndent;yt>0&&(k=yt*8);var gt=s.hAlign,pt=s.vAlign,ut=u,p=2;p+=k;gt===1?(p=e/2,ut=y):gt===2&&(p=e-1,p-=k,ut=v);n.textAlign!==ut&&(n.textAlign=ut);var wt=0,ni=vt,b=2,ui=s.wordWrap,d=h.lineHeight,g=h.fontInfo.fontSize,ft=[],et=0;if(ui&&(ft=t._WordWrapHelper._getWrapInfo(rt,e-3-k,n.font),et=ft.length,et>1&&pt!==0&&(wt=(et-1)*d)),st=g>8?ot((g-8)/5+2):1,ht=d/2-g/2+st-1,b+=d-ht,pt===1?b=(o-wt)/2+d/2-ht:pt===2&&(b=o-wt-2-ht),n.textBaseline!==ni&&(n.textBaseline=ni),nt=s.textDecoration,s.wordWrap)for(n.rect(a.x,a.y,a.width,a.height),n.clip(),n.beginPath(),ct=f+b,tt=0;tt<et;tt++)n.fillText(ft[tt],r+p,ct),nt&&(ti=n.measureText(ft[tt]).width,it._renderTextDecoration(n,nt,r+p,ct,ti,g,st)),ct+=h.lineHeight;else bt=n.measureText(rt).width,(bt>a.width||d>a.height)&&(n.rect(a.x,a.y,a.width,a.height),n.clip(),n.beginPath()),n.fillText(rt,r+p,f+b),nt&&it._renderTextDecoration(n,nt,r+p,f+b,bt,g,st);n.restore()}},i.prototype._getFontByVisualStatus=function(n,i,r,u,f){var e={font:n,fillStyle:i},o=r.sheet,s;return r.visualState!==0&&parseInt(f.zIndex)>2007&&o._isSelected(r.row,r.col,u)&&(s=o._isAllSelected(r.row,r.col,u)?this.getThemeStyle(r.visualState,"gc-columnHeader-selected"):this.getThemeStyle(r.visualState,"gc-columnHeader-highlight"),e.fillStyle=s.color,e.font=t.StyleHelper.setStringFont(e.font,{fontWeight:"bold"})),e},i.prototype._paintGridline=function(n,t,i,r,u,f,e,o,s){var h;s===1?(n.beginPath(),h=n.createLinearGradient(t,i+1,t,i+u-2),h.addColorStop(0,o.borderLeftColor),h.addColorStop(1,o.borderRightColor),n.strokeStyle=h,f.borderLeft||(n.moveTo(t+.5,i),n.lineTo(t+.5,i+u)),f.borderRight||(n.moveTo(t+r-.5,i),n.lineTo(t+r-.5,i+u)),n.stroke(),o.borderBottomWidth&&!f.borderBottom&&(n.beginPath(),n.strokeStyle=o.borderBottomColor,n.moveTo(t+1,i+u-.5),n.lineTo(t+r,i+u-.5),n.stroke())):(n.beginPath(),h=n.createLinearGradient(t,i,t+r-2,i),h.addColorStop(0,o.borderTopColor),h.addColorStop(1,o.borderBottomColor),n.strokeStyle=h,f.borderTop||(n.moveTo(t,i+.5),n.lineTo(t+r,i+.5)),f.borderBottom||(n.moveTo(t,i+u-.5),n.lineTo(t+r,i+u-.5)),n.stroke(),o.borderRightWidth&&!f.borderRight&&(n.beginPath(),n.strokeStyle=o.borderRightColor,n.moveTo(t+r-.5,i+1),n.lineTo(t+r-.5,i+u),n.stroke()))},i.prototype.getAutoFitWidth=function(n,t,i,u,f){return r.getAutoFitWidth(n,t,i,u,f)},i.prototype.getAutoFitHeight=function(n,t,i,u,f){return r.getAutoFitHeight(n,t,i,u,f)},i}(k);t.HeaderCellType=tt;gt=function(n){function t(){n.call(this);this.typeName="2"}return __extends(t,n),t.prototype.paint=function(t,i,r,u,f,e,o,s){n.prototype._paint.call(this,t,i,r,u,f,e,o,s,"columnHeader",1)},t}(tt);t.ColumnHeaderCellType=gt;ni=function(n){function t(){n.call(this);this.typeName="3"}return __extends(t,n),t.prototype.paint=function(t,i,r,u,f,e,o,s){n.prototype._paint.call(this,t,i,r,u,f,e,o,s,"rowHeader",2)},t}(tt);t.RowHeaderCellType=ni;ti=function(n){function i(){n.call(this);this.typeName="4"}return __extends(i,n),i.prototype.paint=function(n,i,r,u,f,e,o,h){var y,it,v,rt,d,ot,ut,g,nt,l,tt;if(n){if(n.save(),n.rect(r,u,f,e),n.clip(),n.beginPath(),y=0,h.visualState!==s&&(y=h.visualState),typeof y!==b){try{var k=this.getThemeStyle(h.visualState,"gc-corner-"+t.VisualState[y].toLowerCase()),ft=k&&k.backgroundColor,a=k&&k.backgroundImage;ft?(n.fillStyle=ft,n.fillRect(r,u,f,e)):a&&a!==p&&(it=new Image,v=a,v=v.replace('url("',""),v=v.replace('")',""),it.src=v,n.drawImage(it,r,u,f,e))}catch(st){}var c=this.getThemeStyle(4,"gc-corner-triangle-"+t.VisualState[y].toLowerCase()),a=c&&c.backgroundImage,et=c&&c.backgroundColor,w=n.createLinearGradient(r+f/2,u,r+f/2,u+e);if(a&&a.indexOf("linear-gradient")!==-1){for(rt=t.util.getLinearGradientColors(a),d=0,ot=rt.length;d<ot;d++)ut=rt[d],w.addColorStop(ut.point,ut.color);n.fillStyle=w}else et&&(w.addColorStop(.125,ui),w.addColorStop(1,et),n.fillStyle=w);g=n.createLinearGradient(r+f,u+1,r+f,u+e-2);g.addColorStop(0,c.borderLeftColor);g.addColorStop(1,c.borderRightColor);n.beginPath();n.strokeStyle=g;n.moveTo(r+f-.5,u);n.lineTo(r+f-.5,u+e);n.stroke();nt=n.createLinearGradient(r,u,r+f-2,u);nt.addColorStop(0,c.borderTopColor);nt.addColorStop(1,c.borderBottomColor);n.beginPath();n.strokeStyle=nt;n.moveTo(r,u+e-.5);n.lineTo(r+f,u+e-.5);n.stroke();n.beginPath();l=3;tt=e;f<e&&(tt=f);n.moveTo(r+f-tt+l,u+e-l);n.lineTo(r+f-l,u+e-l);n.lineTo(r+f-l,u+e-tt+l);n.fill()}n.restore()}},i.prototype.getAutoFitWidth=function(n,t,i,u,f){return r.getAutoFitWidth(n,t,i,u,f)},i.prototype.getAutoFitHeight=function(n,t,i,u,f){return r.getAutoFitHeight(n,t,i,u,f)},i}(k);t.CornerCellType=ti})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){n.feature("basedialog",["core.common"]);var t=function(){function t(n,t){var i=this;i.host=n;i._wijpopupClass="wijspread-popup";i._overlayClass="wijspread-overlay";t=t||0;i.defaultOverlayCSS={position:"fixed",width:"100%",height:"100%",margin:0,padding:0,top:0,left:0,border:"none",zIndex:t,backgroundColor:"rgba(0,0,0,0)"};i.defaultContainerCSS={position:"absolute",padding:0,margin:0,height:"auto",zIndex:t+1,outline:"none"};i._init()}return t.prototype._init=function(){var t=this;t._hasTargetContainer(t._name)?t.container=n.GC$("#"+t._name):(t._name=t._generateName(),t.container=n.GC$(document.createElement("div")).addClass(t._wijpopupClass+" ui-widget").attr({id:t._name,tabIndex:-1}).css(t.defaultContainerCSS))},t.prototype._generateName=function(){for(var n=0,t="dialog";this._hasTargetContainer(t+n);)n++;return t+n},t.prototype.getContainer=function(){if(this.container)return this.container},t.prototype.getHost=function(){return this.host?this.host:document.body},t.prototype.show=function(t){var i=this,u=arguments.length,r=i.container;i._hasOverlay()||i._createOverlay();window.gcGlobal.suspendEvent();i._hasTargetContainer(i._name)||(n.GC$(i.getHost()).append(r),i.resetDialogPosition(),r.css("display","none"));r.show(t)},t.prototype.close=function(){var t=this;t._hasTargetContainer(t._name)&&t.container.remove();n.GC$("."+t._wijpopupClass).isVisible()||t.closeOverlay();window.gcGlobal.resumeEvent()},t.prototype.closeOverlay=function(){n.GC$("."+this._overlayClass).remove()},t.prototype.resetDialogPosition=function(){var t=this.container,a=this.getHost();if(t.length()!==0){var u=n.GC$(a).offset(),i=parseInt(t.css("left"))+u.left,r=parseInt(t.css("top"))+u.top,e=t.width(),o=t.height();if(!isNaN(i)&&!isNaN(r)&&!isNaN(e)&&!isNaN(o)){var s=0,h=0,c=document.documentElement.clientWidth,l=document.documentElement.clientHeight,f=t.getElement(0).getBoundingClientRect();f.left+e>c&&(h=f.left+e-c);f.top+o>l&&(s=f.top+o-l);(i<0||r<0||s>0||h>0)&&(i-=h,r-=s,i<0&&(i=0),r<0&&(r=0),t.css({left:i-u.left+"px",top:r-u.top+"px"}))}}},t.prototype._hasTargetContainer=function(t){return n.GC$("#"+t).length()>0?!0:!1},t.prototype._createOverlay=function(){var t=this,u=n.GC$(document.createElement("div")).addClass(t._overlayClass),i,r,f;u.css(t.defaultOverlayCSS);n.GC$(t.host).append(u);i=n.util.browser&&n.util.browser.mozilla;r=n.util.browser&&n.util.browser.qtMode;(i||r)&&(f=(new Date).valueOf());u.bind("mousedown",function(u){if(i||r){var e=(new Date).valueOf();if(e-f<100)return}t.close();(i||r)&&t._delayCloseTimeout&&window.clearTimeout(t._delayCloseTimeout);n.util.cancelDefault(u)});"touchstart MSPointerDown pointerdown".split(" ").forEach(function(f,e){u.bind(f,function(u){i||r?t._delayCloseTimeout=setTimeout(function(){t.close()},100):t.close();n.util.cancelDefault(u)})})},t.prototype._hasOverlay=function(){return n.GC$("."+this._overlayClass).length()>0?!0:!1},t}();n.BaseDialog=t})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var f,o,s,h,c,l,a,r,v,u;n.feature("core.sheet_model",["core.common","core.stringResource"]);var t=null,i=undefined,e=Math.min,p=Math.floor,y=function(){function t(n,t){this._sheet=n;this._dataModel=new r;this._dataModel.name=this._name=t;this._rowHeaderModel=new r(this._dataModel.rowCount,1);this._colHeaderModel=new r(1,this._dataModel.colCount);this._colFooterModel=new r(1,this._dataModel.colCount,this._name+"cf");this._rowInfos=new u;this._colInfos=new u;this._colHeaderRowInfos=new u;this._rowHeaderColInfos=new u;this._spanModel=new f;this._colHeaderSpanModel=new f;this._rowHeaderSpanModel=new f}return t.prototype.name=function(n){if(n)this._name=n,this._dataModel.name=name;else return this._name},t.prototype.dataModel=function(){return this._dataModel},t.prototype.rowHeaderModel=function(){return this._rowHeaderModel},t.prototype.colHeaderModel=function(){return this._colHeaderModel},t.prototype.colFooterModel=function(){return this._colFooterModel},t.prototype.getDataModel=function(t){var r=n.SheetArea;if(t===3||t===i||t===null)return this._dataModel;else if(t===2)return this._rowHeaderModel;else if(t===1)return this._colHeaderModel;return null},t.prototype.getRowInfos=function(n){return n===1||n===0?this._colHeaderRowInfos:this._rowInfos},t.prototype.getColInfos=function(n){return n===2||n===0?this._rowHeaderColInfos:this._colInfos},t.prototype.getSpanModel=function(n){if(n===undefined||n===null||n===3)return this._spanModel;else if(n===1)return this._colHeaderSpanModel;else if(n===2)return this._rowHeaderSpanModel},t}();n.SheetModelManager=y;f=function(r){function u(){r.call(this);this._lastNonNullColumn=-1;this._lastNonNullRow=-1}return __extends(u,r),u.prototype.find=function(n,i){for(var f=this.length,r,u=0;u<f;u++)if(r=this[u],r&&r.contains(n,i))return r;return t},u.prototype.remove=function(n){for(var t=0;t<this.length;t++)if(this[t]===n){this.splice(t,1);return}},u.prototype._setLastNonNullRowAndColumn=function(n){var t=this,i=n.row+n.rowCount-1,r=n.col+n.colCount-1;i>t._lastNonNullRow&&(t._lastNonNullRow=i);r>t._lastNonNullColumn&&(t._lastNonNullColumn=r)},u.prototype.addSpan=function(n){this._setLastNonNullRowAndColumn(n);this.push(n)},u.prototype.removeSpan=function(n,t){this.splice(n,t)},u.prototype.copy=function(t,i,r,u,f,e){var h=this,a=!1,v=h.length,o,l,s,c;if(t===-1){for(c=[],s=0;s<v;s++)o=h[s],i<=o.col&&o.col<i+e?(c.push(new n.Range(o.row,u+o.col-i,o.rowCount,o.colCount)),a=!0):u<=o.col&&o.col<u+e&&(h.splice(s,1),s--,v--,a=!0);for(s=0;s<c.length;s++){if(l=c[s],!h.isValid(h,0,h.length,l))throw new Error(n.SR.Exp_OverlappingSpans);h.addSpan(l)}}else if(i===-1){for(c=[],s=0;s<v;s++)o=h[s],t<=o.row&&o.row<t+f?(c.push(new n.Range(r+o.row-t,o.col,o.rowCount,o.colCount)),a=!0):r<=o.row&&o.row<r+f&&(h.splice(s,1),s--,v--,a=!0);for(s=0;s<c.length;s++){if(l=c[s],!h.isValid(h,0,h.length,l))throw new Error(n.SR.Exp_OverlappingSpans);h.addSpan(l)}}else{for(c=[],s=0;s<v;s++)o=h[s],t<=o.row&&o.row<t+f&&i<=o.col&&o.col<i+e?(c.push(new n.Range(r+o.row-t,u+o.col-i,o.rowCount,o.colCount)),a=!0):r<=o.row&&o.row<r+f&&u<=o.col&&o.col<u+e&&(h.splice(s,1),s--,v--,a=!0);for(s=0;s<c.length;s++){if(l=c[s],!h.isValid(h,0,h.length,l))throw new Error(n.SR.Exp_OverlappingSpans);h.addSpan(l)}}},u.prototype.isValid=function(n,t,i,r){for(var f,u=t;u<i&&u<n.length;u++)if(f=n[u],f.intersect(r.row,r.col,r.rowCount,r.colCount))return!1;return!0},u.prototype.getEnumerator=function(n,t,i,r){return new o(this,n,t,i,r)},u.prototype.getSpans=function(n){var i,t,r;if(!n)return this.slice(0);for(i=[],t=0;t<this.length;t++)r=this[t],(!n||r.intersect(n.row,n.col,n.rowCount,n.colCount))&&i.push(r);return i},u.prototype.hasPartSpans=function(n,t,i,r){for(var u,f=0;f<this.length;f++)if(u=this[f],u.intersect(n,t,i,r)&&(u.row<n||u.row+u.rowCount>n+i||u.col<t||u.col+u.colCount>t+r))return!0;return!1},u.prototype.hasSpans=function(n,t,i,r){var u=this.getEnumerator(n,t,i,r);return u.moveNext()},u.prototype.clear=function(n,t,i,r){for(var f,u=0;u<this.length;u++)f=this[u],(n===-1||n<=f.row&&f.row<n+i)&&(t===-1||t<=f.col&&f.col<t+r)&&this.splice(u--,1)},u.prototype.move=function(t,i,r,f,e,o){var a=this,v=!1,l=new u,y=[],p=a.length,s,h,c;if(t===-1)for(h=0;h<p;h++)s=a[h],i<=s.col&&s.col<i+o?(c=new n.Range(s.row,f+s.col-i,s.rowCount,s.colCount),y.push(c),v=!0):f<s.col&&s.col<f+o?v=!0:l.push(s);else if(i===-1)for(h=0;h<p;h++)s=a[h],t<=s.row&&s.row<t+e?(c=new n.Range(r+s.row-t,s.col,s.rowCount,s.colCount),y.push(c),v=!0):r<=s.row&&s.row<r+e?v=!0:l.push(s);else for(h=0;h<p;h++)s=a[h],t<=s.row&&s.row<t+e&&i<=s.col&&s.col<i+o?(c=new n.Range(r+s.row-t,f+s.col-i,s.rowCount,s.colCount),y.push(c),v=!0):r<=s.row&&s.row<r+e&&f<=s.col&&s.col<f+o?v=!0:l.push(s);if(v){if(y.length>0)for(h=0;h<y.length;h++){if(c=y[h],!a.isValid(l,0,l.length,c))throw new Error(n.SR.Exp_OverlappingSpans);l.push(c)}for(a.length=0,h=0;h<l.length;h++)a.addSpan(l[h])}},u.prototype.isEmpty=function(){return this.length<=0?!0:!1},u.prototype.addRows=function(t,i){for(var r,u=this,e=!1,o=u.length,f=0;f<o;f++)r=u[f],r.row>=t?(u[f]=new n.Range(r.row+i,r.col,r.rowCount,r.colCount),u._setLastNonNullRowAndColumn(u[f]),e=!0):r.row<t&&t<r.row+r.rowCount&&(u[f]=new n.Range(r.row,r.col,r.rowCount+i,r.colCount),u._setLastNonNullRowAndColumn(u[f]),e=!0)},u.prototype.addColumns=function(t,i){for(var r,u=this,e=!1,o=u.length,f=0;f<o;f++)r=u[f],r.col>=t?(u[f]=new n.Range(r.row,r.col+i,r.rowCount,r.colCount),u._setLastNonNullRowAndColumn(u[f]),e=!0):r.col<t&&t<r.col+r.colCount&&(u[f]=new n.Range(r.row,r.col,r.rowCount,r.colCount+i),u._setLastNonNullRowAndColumn(u[f]),e=!0)},u.prototype.removeRows=function(t,i){for(var f=this,s=!1,o=[],c=f.length,r,h,u=0;u<c;u++)r=f[u],r.row>=t?r.row<t+i?(o.push(u),s=!0):(f[u]=new n.Range(r.row-i,r.col,r.rowCount,r.colCount),s=!0):r.row<t&&t<r.row+r.rowCount&&(f[u]=new n.Range(r.row,r.col,r.rowCount-e(r.row+r.rowCount-t,i),r.colCount),f[u].rowCount===1&&f[u].colCount===1&&o.push(u),s=!0);for(u=o.length-1;u>=0;u--)h=o[u],f.splice(h,1)},u.prototype.removeColumns=function(t,i){for(var f=this,s=!1,o=[],c=f.length,r,h,u=0;u<c;u++)r=f[u],r.col>=t?r.col<t+i?(o.push(u),s=!0):(f[u]=new n.Range(r.row,r.col-i,r.rowCount,r.colCount),s=!0):r.col<t&&t<r.col+r.colCount&&(f[u]=new n.Range(r.row,r.col,r.rowCount,r.colCount-e(r.col+r.colCount-t,i)),f[u].rowCount===1&&f[u].colCount===1&&o.push(u),s=!0);for(u=o.length-1;u>=0;u--)h=o[u],f.splice(h,1)},u.prototype.toJSON=function(){for(var n=[],t=0;t<this.length;t++)n.push(this[t]);return n.length===0?i:n},u.prototype.fromJSON=function(t,i){var f,u,r;if(t)for(f=t,u=0;u<f.length;u++)r=f[u],this.addSpan(new n.Range(r.row,r.col,r.rowCount,r.colCount))},u}(n._XArray);n._SpanModel=f;o=function(){function n(n,t,i,r,u){var f=this;f.model=n;f.row=t;f.column=i;f.rowCount=r;f.columnCount=u;f.currentIndex=-1;t===-1&&i===-1&&(f.all=!0)}return n.prototype.current=function(){var n=this;return 0<=n.currentIndex&&n.currentIndex<n.model.length?n.model[n.currentIndex]:t},n.prototype.moveNext=function(){var n=this;if(n.currentIndex++,!n.all)while(n.currentIndex<n.model.length&&!n.model[n.currentIndex].intersect(n.row,n.column,n.rowCount,n.columnCount))n.currentIndex++;return n.currentIndex<n.model.length},n.prototype.reset=function(){this.currentIndex=-1},n}();n._SpanEnumerator=o;s=function(n){function i(){n.call(this);this.headingOverflowlayout=t;this.trailingOverflowLayout=t}return __extends(i,n),i.prototype.find=function(n){var u=this,f=u.length,r,i;if(f>0)for(i=0;i<f;i++)if(r=u[i],r.contains(n))return r;return t},i}(n._XArray);n._CellOverflowLayoutModel=s;h=function(){function n(n,t,i,r,u,f,e,o){var s=this;s.column=n;s.startColumn=t;s.endColumn=i;s.valueWidth=r;s.columnWidth=u;s.backgroundWidth=f;s.backgroundLeftWidth=e;s.backgroundRightWidth=o}return n.prototype.contains=function(n){return n>=this.startColumn&&n<=this.endColumn},n}();n._CellOverflowLayout=h;c=function(r){function u(){r.call(this);this.selectionPolicy=2;this.selectionUnit=0}return __extends(u,r),u.prototype.find=function(n,i){var f=this,e=f.length,u,r;if(e>0)for(r=0;r<e;r++)if(u=f[r],u.contains(n,i))return u;return t},u.prototype.clear=function(){this.splice(0,this.length);this.activeSelectedRangeIndex=-1},u.prototype.add=function(t,i,r,u){var f=this,o;f.selectionPolicy===0?(r=e(r,1),u=e(u,1),f.clear()):f.selectionPolicy===1&&f.clear();f.selectionUnit===1?(i=-1,u=-1):f.selectionUnit===2&&(t=-1,r=-1);o=new n.Range(t,i,r,u);f.push(o);f.activeSelectedRangeIndex=f.length-1},u.prototype.toArray=function(){for(var t=[],n=0;n<this.length;n++)t.push(this[n]);return t},u.prototype.fromArray=function(n){this.splice(0,this.length);for(var t=0;t<n.length;t++)this.push(n[t])},u.prototype._isDefaultValue=function(n,t){var i=this;switch(n){case"selectionPolicy":return t===2;case"selectionUnit":return t===0;case"activeSelectedRangeIndex":return t===0;case"length":return t===1;default:return!1}},u.prototype.toJSON=function(){var t=this,u={};for(var r in t)!t._isDefaultValue(r,t[r])&&t.hasOwnProperty(r)&&(u[r]=t[r]);return n.GC$.isEmptyObject(u)?i:u},u.prototype.fromJSON=function(t,r){var e,u,o;if(t){var f=this,h=t,s=t.length;for(s===i&&(s=1),e=0;e<s;e++)u=h[e],u===i&&(u={row:0,col:0,rowCount:1,colCount:1}),f.push(new n.Range(u.row,u.col,u.rowCount,u.colCount));o=t.activeSelectedRangeIndex;o===i&&(o=0);f.activeSelectedRangeIndex=o;t.selectionPolicy!==i&&(f.selectionPolicy=t.selectionPolicy);t.selectionUnit!==i&&(f.selectionUnit=t.selectionUnit)}},u}(n._XArray);n._SelectionModel=c;l=function(n){function i(){n.call(this)}return __extends(i,n),i.prototype.findCell=function(n,i){var f=this,e=f.length,u,r;if(e>0)for(r=0;r<e;r++)if(u=f[r],u.contains(n,i))return u;return t},i.prototype.findRow=function(n){var u=this,f=u.length,r,i;if(f>0)for(i=0;i<f;i++)if(r=u[i],r.row===n)return r;return t},i.prototype.findCol=function(n){var u=this,f=u.length,r,i;if(f>0)for(i=0;i<f;i++)if(r=u[i],r.col===n)return r;return t},i.prototype.findX=function(n){var u=this,f=u.length,r,i;if(f>0)for(i=0;i<f;i++)if(r=u[i],r.containsX(n))return r;return t},i.prototype.findY=function(n){var u=this,f=u.length,r,i;if(f>0)for(i=0;i<f;i++)if(r=u[i],r.containsY(n))return r;return t},i.prototype.findNearX=function(n){var r=t,i=this,u=i.length;return u>0&&(r=i.findX(n),r||(r=n<i[0].x?i[0]:i[u-1])),r},i.prototype.findNearY=function(n){var r=t,i=this,u=i.length;return u>0&&(r=i.findY(n),r||(r=n<i[0].y?i[0]:i[u-1])),r},i}(n._XArray);n._LayoutModel=l;a=function(){function n(n,t,i,r,u,f,e,o){var s=this;s.rowCount=e;s.colCount=o;s.row=n;s.col=t;s.x=i;s.y=r;s.width=u;s.height=f}return n.prototype.contains=function(n,t){var i=this;return n<i.row+i.rowCount&&i.row<=n&&t<i.col+i.colCount&&i.col<=t},n.prototype.intersect=function(n){var t=this;return(t.x<0||n.x<t.x+t.width&&t.x<n.x+n.width)&&(t.y<0||n.y<t.y+t.height&&t.y<n.y+n.height)},n.prototype.containsX=function(n){return this.x<=n&&n<this.x+this.width},n.prototype.containsY=function(n){return this.y<=n&&n<this.y+this.height},n}();n._Layout=a;r=function(){function r(n,r,u){this._isSuspendDirty=!1;var f=this;f.rowCount=n!==t&&n!==i?n:200;f.colCount=r!==t&&r!==i?r:20;f.name=u;f.dataTable={};f._rowDataArray=[];f._columnDataArray=[];f._defaultDataNode=t;f.dirtyNodes={};f._lastNonNullColumn=-1;f._lastNonNullRow=-1}return r.prototype.getRowCount=function(){return this.rowCount},r.prototype.getColumnCount=function(){return this.colCount},r.prototype.setRowCount=function(n){this.rowCount=n},r.prototype.setColumnCount=function(n){this.colCount=n},r.prototype._updateDirty=function(n,t,r){if(!this._isSuspendDirty&&n>=0&&t>=0){this.dirtyNodes[n]||(this.dirtyNodes[n]={});var u=this.dirtyNodes[n];u.rs!=="n"&&(u.rs="e");r.originalItem!==i&&(u.originalItem=r.originalItem);u[t]||(u[t]={});r.oldValue!==i&&(u[t].oldValue=r.oldValue)}},r.prototype._suspendDirty=function(){this._isSuspendDirty=!0},r.prototype._resumeDirty=function(){this._isSuspendDirty=!1},r.prototype.getValue=function(n,r){var u=this.getNode(n,r);return u&&u.value!==i&&u.value!==t?u.value:t},r.prototype.setValue=function(n,t,i){var r=this.getNode(n,t,!0),u;r.value!==i&&(u=r.value,r.value=i,this._updateDirty(n,t,{oldValue:u}))},r.prototype.getBindingPath=function(n,r){var u=this.getNode(n,r);return u&&u.bindingPath!==i&&u.bindingPath!==t?u.bindingPath:t},r.prototype.setBindingPath=function(n,t,i){var r=this.getNode(n,t,!0);r.bindingPath!==i&&(r.bindingPath=i)},r.prototype.getSparkline=function(n,i){if(n<0||i<0)return t;var r=this.dataTable[n],u=r&&r[i];return u&&u.sparkline||t},r.prototype.setSparkline=function(n,t,i){var r=this.getNode(n,t,!0);r.sparkline!==i&&(r.sparkline=i)},r.prototype.getStyle=function(n,t){var i=this.getNode(n,t);return i&&i.style},r.prototype.setStyle=function(n,t,i){var r=this.getNode(n,t,!0);r&&r.style!==i&&(r.style=i)},r.prototype.getComment=function(n,t){var i=this.getNode(n,t);return i&&i.comment},r.prototype.setComment=function(n,t,i){var r=this.getNode(n,t,!0);r&&r.comment!==i&&(r.comment=i)},r.prototype.setTag=function(n,t,i){var r=this.getNode(n,t,!0);r&&r.tag!=i&&(r.tag=i)},r.prototype.getTag=function(n,r){var u=this.getNode(n,r);return u&&u.tag!==i&&u.tag!==t?u.tag:t},r.prototype.getVisualState=function(n,t){var i=this.getNode(n,t);return i&&i.visualState},r.prototype.setVisualState=function(n,t,i){var r=this.getNode(n,t,!0);r.visualState!==i&&(r.visualState=i)},r.prototype.addRows=function(t,i){var r=this,u;if(!(t<0)&&!(t>r.rowCount)&&!(i<0))for(n._ModelHelper.addElements(r.dataTable,r.rowCount,t,i),n._ModelHelper.addElements(r._rowDataArray,r.rowCount,t,i),n._ModelHelper.addElements(r.dirtyNodes,r.rowCount,t,i),this.rowCount+=i,u=0;u<i;u++)r.dataTable[t+u]={rs:"n"},r.dirtyNodes[t+u]=r.dataTable[t+u]},r.prototype.deleteRows=function(t,i){var u=this,r=u.rowCount;t<0||t>=r||i<=0||(t+i>r&&(i=r-t),n._ModelHelper.deleteElements(u.dataTable,r,t,i),n._ModelHelper.deleteElements(u._rowDataArray,r,t,i),n._ModelHelper.deleteElements(u.dirtyNodes,r,t,i),u.rowCount-=i)},r.prototype.addColumns=function(t,i){var r=this,u,f;if(!(t<0)&&!(t>r.colCount)&&!(i<0)){for(u=0;u<r.rowCount;u++)f=r.dataTable[u],f&&t<r.colCount&&n._ModelHelper.addElements(f,r.colCount,t,i);n._ModelHelper.addElements(this._columnDataArray,this.colCount,t,i);this.colCount+=i}},r.prototype.deleteColumns=function(t,i){var r=this,f=r.colCount,u,e;if(!(t<0)&&!(t>=f)&&!(i<0)){for(u=0;u<r.rowCount;u++)e=this.dataTable[u],e&&t<r.colCount&&n._ModelHelper.deleteElements(e,r.colCount,t,i);n._ModelHelper.deleteElements(this._columnDataArray,this.colCount,t,i);t+i>f&&(i=f-t);r.colCount-=i}},r.prototype.getNode=function(n,i,r){var u=this,f,e;return n>=u.rowCount||i>=u.colCount?t:(f=t,n>=0&&i>=0?(e=u.dataTable[n],r&&!e&&(e=u.dataTable[n]={},n>u._lastNonNullRow&&(u._lastNonNullRow=n)),e&&(f=e[i],r&&!f&&(f=e[i]={},i>u._lastNonNullColumn&&(u._lastNonNullColumn=i)))):n===-1&&i>=0?(f=u._columnDataArray[i],r&&!f&&(f=u._columnDataArray[i]={},i>u._lastNonNullColumn&&(u._lastNonNullColumn=i))):n>=0&&i===-1?(f=u._rowDataArray[n],r&&!f&&(f=u._rowDataArray[n]={},i>u._lastNonNullColumn&&(u._lastNonNullColumn=i))):n===-1&&i===-1&&(f=u._defaultDataNode,r&&!f&&(f=u._defaultDataNode={})),f)},r.prototype._setNode4Swap=function(n,t,i,r,u){var f=this,e;i>=0&&r>=0?(e=f.dataTable[i],e||(e=f.dataTable[i]={}),e[r]=u,u&&u.calc&&delete u.calc):i>=0&&r===-1&&n>=0&&t===-1?f._rowDataArray[i]=u:r>=0&&i===-1&&t>=0&&n===-1&&(f._columnDataArray[r]=u)},r.prototype.swapNode=function(n,i,r,u){var f=this,e=f.getNode(n,i),o=f.getNode(r,u);e?f._setNode4Swap(n,i,r,u,e):o&&f._setNode4Swap(n,i,r,u,t);o?f._setNode4Swap(r,u,n,i,o):e&&f._setNode4Swap(r,u,n,i,t)},r.prototype.getDataRowIndex=function(n){return n},r.prototype.nextNonNullRow=function(n){n++;for(var t=this.rowCount,i=this.dataTable;n>=0&&n<t;){if(i[n])break;n++}return n<t?n:-1},r.prototype.nextNonNullColumn=function(n,i){var r=this,u=t,f=r.colCount;if(n>=0&&n<r.rowCount&&(u=r.dataTable[n]),!u)return-1;for(i++;i>=0&&i<f;){if(u[i])break;i++}return i<f?i:-1},r.prototype.clear=function(i,r,u,f,e,o){var h=this,a=[],s,l,c;if(i>=0&&r>=0){if(i+u>h.rowCount&&(u=h.rowCount-i),u<=0)return;if(r+f>h.colCount&&(f=h.colCount-r),f<=0)return;for(c=i;c<i+u;c++)if(!o||!(n.ArrayHelper.indexOf(o,c)>=0))for(l=r;l<r+f;l++)s=h.getNode(c,l),s&&(a.push(s),(e&1)>0&&s.value&&s.value!==t&&h._updateDirty(c,l,{oldValue:s.value}))}else if(i>=0&&r===-1){if(i+u>h.rowCount&&(u=h.rowCount-i),u<=0)return;for(c=i;c<i+u;c++)s=h.getNode(c,-1),s&&a.push(s)}else if(i===-1&&r>=0){if(r+f>h.colCount&&(f=h.colCount-r),f<=0)return;for(l=r;l<r+f;l++)s=h.getNode(-1,l),s&&a.push(s)}else i===-1&&r===-1&&(s=h._defaultDataNode,s&&a.push(s));h.clearCore(a,e)},r.prototype.clearCore=function(n,i){for(var r=0;r<n.length;r++)n[r]&&((i&8)>0&&(n[r].tag=t),(i&2)>0&&(n[r].style=t),(i&1)>0&&(n[r].value=t),(i&16)>0&&(n[r].sparkline=t),(i&64)>0&&(n[r].bindingPath=t),(i&4)>0&&(n[r].comment=t))},r.prototype.toJSON=function(t){for(var i=this,f={},l={},r=i.nextNonNullRow(-1),e,a,v,o,s,y,h,c,u,p,w;r>=0;){for(e={},u=i.nextNonNullColumn(r,-1);u>=0;)a=i.getNode(r,u),a&&(v=i._toJSONNode(a),n.GC$.isEmptyObject(v)||(e[u]=v)),u=i.nextNonNullColumn(r,u);n.GC$.isEmptyObject(e)||(l[r]=e);r=i.nextNonNullRow(r)}for(n.GC$.isEmptyObject(l)||(f.dataTable=l),o=[],s=i._rowDataArray,r=0;r<i.rowCount;r++)s.hasOwnProperty(r)&&s[r]&&(y=i._toJSONNode(s[r]),n.GC$.isEmptyObject(y)||(o[r]=y));for(o.length>0&&(f.rowDataArray=o),h=[],c=i._columnDataArray,u=0;u<i.colCount;u++)c.hasOwnProperty(u)&&c[u]&&(p=i._toJSONNode(c[u]),n.GC$.isEmptyObject(p)||(h[u]=p));return h.length>0&&(f.columnDataArray=h),w=i._toJSONNode(i._defaultDataNode,t,!0),n.GC$.isEmptyObject(w)||(f.defaultDataNode=w),f},r.prototype.fromJSON=function(n,t){var e,r,h,c,l,v,y,o,u,s,f,a;if(n){if(e=this,r=n,this._suspendDirty(),r.name!==i&&(e.name=r.name),h=r.dataTable,h)for(v=e.rowCount,y=e.colCount,u=0;u<v;u++)if(c=h[u],c)for(f=0;f<y;f++)(l=c[f],l)&&e._copyFromJSONNode(u,f,l,t);if(o=r.rowDataArray?r.rowDataArray:r._rowDataArray,o)for(u=0;u<e.rowCount;u++)o.hasOwnProperty(u)&&o[u]&&e._copyFromJSONNode(u,-1,o[u],t);if(s=r.columnDataArray?r.columnDataArray:r._columnDataArray,s)for(f=0;f<e.colCount;f++)s.hasOwnProperty(f)&&s[f]&&e._copyFromJSONNode(-1,f,s[f],t);a=r.defaultDataNode?r.defaultDataNode:r._defaultDataNode;a&&e._copyFromJSONNode(-1,-1,a,t);this._resumeDirty()}},r.prototype._toJSONNode=function(r,u,f){var e,o,s;return r?(e={},r.value!==i&&r.value!==t&&(e.value=r.value),o=r.style,typeof o=="string"?e.style=o:o&&(s=o.toJSON(u,f),n.GC$.isEmptyObject(s)||(e.style=s,o.font&&(e.style.font=n.StyleHelper.normalizeFont(o.font)),e.style.name=i)),r.bindingPath!==i&&r.bindingPath!==t&&(e.bindingPath=r.bindingPath),r.tag!==t&&r.tag!==i&&(e.tag=r.tag),e):t},r.prototype._copyFromJSONNode=function(r,u,f,e){var c,s,o,l,a;if(f){var v=this,y=r,p=u,h=v.getNode(y,p,!0);f.value!==i&&(f.value!=t&&(f.value._calcError||f.value._error&&f.value._code)&&(c=n.Calc.CalcError._parseCore(f.value._calcError||f.value._error),c!==i&&(f.value=c)),h.value=f.value);f.style!==i&&(s=t,typeof f.style=="string"?s=f.style:f.style&&(s=new n.Style,s.fromJSON(f.style,e),s.name=i),h.style=s);f.visualState!==i&&(h.visualState=f.visualState);f.bindingPath!==i&&(h.bindingPath=f.bindingPath);o=f.tag;o!==i&&(l=o.typeName,typeof l=="string"&&(a=n.getTypeFromString(l),a&&(o=new a,o.fromJSON&&o.fromJSON(f.tag))),h.tag=o)}},r}();n._GcSheetModel=r;v=function(){function n(n,i,r){this.changed=t;var u=this;u._context=n;parseInt(i.toString(),10)<0&&(i=2147483647);u._maxLength=i;u._allowUndo=r;u._undoStack=[];u._redoStack=[]}return n.prototype.context=function(){return this._context},n.prototype.canUndo=function(){return this._undoStack.length>0},n.prototype.canRedo=function(){return this._redoStack.length>0},n.prototype._shrinkUndoStack=function(n){for(var t=0;t<n;t++)this._undoStack.shift()},n.prototype._raiseChanged=function(){var n=this;n.changed&&typeof n.changed=="function"&&n.changed(n)},n.prototype.doAction=function(n){var t,i;if(!n||!n.execute||(t=this,!n.canExecute(t._context)))return!1;i=!0;try{n.execute(t._context)}catch(r){i=!1}return t._allowUndo&&i&&n.canUndo()&&n.undo&&(t._maxLength>0&&t._undoStack.length>=t._maxLength&&t._shrinkUndoStack(t._undoStack.length-t._maxLength+1),t._undoStack.push(n),t._redoStack=[],t._raiseChanged()),i},n.prototype.undo=function(){var n=this,i=!0,t;if(n._allowUndo&&n.canUndo()){t=n._undoStack[n._undoStack.length-1];try{t&&t.canUndo&&t.canUndo()&&t.undo&&(i=t.undo(n._context))}catch(r){i=!1}i&&(n._redoStack.push(n._undoStack.pop()),n._raiseChanged())}return i},n.prototype.redo=function(){var n=this,i=!0,t;if(n._allowUndo&&n.canRedo()){t=n._redoStack[n._redoStack.length-1];try{t&&t.execute&&t.execute(n._context)}catch(r){i=!1}i&&(n._undoStack.push(n._redoStack.pop()),n._raiseChanged())}return i},n.prototype.getUndoList=function(){return this._undoStack.slice(0)},n.prototype.getRedoList=function(){return this._redoStack.slice(0)},n.prototype.clear=function(){this._undoStack=[];this._redoStack=[]},n}();n._UndoManager=v;u=function(){function r(){this._infos=[]}return r.prototype.addItems=function(t,i){t<0||t>this.length||i<0||(n._ModelHelper.addElements(this._infos,this.length,t,i),this.length+=i)},r.prototype.deleteItems=function(t,i){var r=this.length,u;t<0||t>=r||i<=0||(t+i>r&&(i=r-t),u=t,n._ModelHelper.deleteElements(this._infos,r,t,i),this.length-=i)},r.prototype.reset=function(n){this._infos.length>n&&(this._infos[n]=null)},r.prototype._getItems=function(){return this._infos},r.prototype._setItems=function(n){this._infos=n;this.length=n.length},r.prototype._getItem=function(n){return this._infos[n]},r.prototype._setItem=function(n,t){this._infos[n]=t;this.length=this._infos.length},r.prototype.getSize=function(n){var t=this._infos[n];return t?t.visible===!1?0:Math.floor(t.size):null},r.prototype.getActualSize=function(n){var t=this._infos[n];return t?Math.floor(t.size):null},r.prototype.setSize=function(n,t){var i=this._infos[n];i||(this._infos[n]=i={},this.length=this._infos.length);i.size!==t&&(i.size=t)},r.prototype.getVisible=function(n){var u=!0,r=this._infos[n];return r&&r.visible!==i&&r.visible!==t&&(u=r.visible),u},r.prototype.setVisible=function(n,t){var i=this._infos[n];i||(this._infos[n]=i={},this.length=this._infos.length);i.visible!==t&&(i.visible=t)},r.prototype.getResizeable=function(n){var u=!0,r=this._infos[n];return r&&r.resizable!==i&&r.resizable!==t&&(u=r.resizable),u},r.prototype.setResizeable=function(n,t){var i=this._infos[n];i||(this._infos[n]=i={},this.length=this._infos.length);i.resizable!=t&&(i.resizable=t)},r.prototype.getPageBreak=function(n){var u=!1,r=this._infos[n];return r&&r.pageBreak!==i&&r.pageBreak!==t&&(u=r.pageBreak),u},r.prototype.setPageBreak=function(n,t){var i=this._infos[n];i||(this._infos[n]=i={},this.length=this._infos.length);i.pageBreak!=t&&(i.pageBreak=t)},r}();n._AxieModel=u})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){function e(n,t){if(n){if(n._editorStatus===2)return!1;var i=n._formulaTextBox;if(i&&i.canAppendRange())return n._moveFormulaTextBoxCell(t,!1),!0;else i&&(n=f.handleFormulaTextboxAcrossSheet(n));return n.moveActiveCell(t,!1),!0}return!1}function u(n,t,i,r){if(n){if(n._editorStatus===2)return!1;var u=n._formulaTextBox;if(u&&u.canAppendRange())return n._moveFormulaTextBoxCell(t,!1,i,r),!0;else u&&(n=f.handleFormulaTextboxAcrossSheet(n));return n.moveActiveCell(t,!1,i,r),!0}return!1}function r(n,t,i){if(n){if(n._editorStatus===2)return!1;var r=n._formulaTextBox;if(r&&r.canAppendRange())return n._changeFormulaTextBoxActiveRange(t,i),!0;else r&&(n=f.handleFormulaTextboxAcrossSheet(n));return n.endEdit()?(n._changeActiveSelectedRange(t,i),!0):!1}return!1}function s(n){for(var i,r=[],t=0,u=n._floatingObjectArray.length;t<u;t++)i=n._floatingObjectArray[t],i.isSelected()&&r.push(i.name());return r}var i,o,f;t.feature("core.sheet_action",["core.common","core.sheet_model"]);i=null;o=undefined;f=function(){function f(){}return f.navigationLeft=function(){return e(this,3)},f.navigationRight=function(){return e(this,4)},f.navigationUp=function(){return e(this,1)},f.navigationDown=function(){return e(this,2)},f.commitArrayFormula=function(){var n=f.handleFormulaTextboxAcrossSheet(this);return n.commitArrayFormula(),!0},f.commitInputNavigationDown=function(){var n=f.handleFormulaTextboxAcrossSheet(this);return n.moveActiveCell(2,!1),!0},f.commitInputNavigationUp=function(){var n=f.handleFormulaTextboxAcrossSheet(this);return n.moveActiveCell(1,!1),!0},f.handleFormulaTextboxAcrossSheet=function(n){var i=n,r=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance;return t.features.formulatextbox&&r&&r.text&&(i=r.sheet,f.changeSheetForFormulaTextboxAcrossSheet(i)),i},f.changeSheetForFormulaTextboxAcrossSheet=function(n,i){typeof i=="undefined"&&(i=!0);var u=n.parent,r=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance;t.features.formulatextbox&&r&&r.text&&u._changeSheetForFormulaAcrossSheet(n,i)},f.navigationHome=function(){var n=this;return u(n,4,i,n.frozenColCount?n.frozenColCount-1:-1)},f.navigationHome2=function(){var n=this;return u(n,4,i,-1)},f.navigationEnd=function(){var n=this;return u(this,3,i,n.getColumnCount()-n._frozenTrailingColCount)},f.navigationEnd2=function(){var n=this;return u(n,3,i,n.getColumnCount())},f.navigationTop=function(){var n=this;return u(n,2,-1,i)},f.navigationBottom=function(){var n=this;return u(n,1,n.getRowCount(),i)},f.navigationPageUp=function(){var n=this,u,h,r,e,o,s;if(!n||n._editorStatus===2)return!1;if(u=n._getPrevPageTopRow(),u===i||u===n._scrollTopRow)return!0;if(h=n._getRowLayout(1,3),r=n._getNextVisualRow(n._activeRowIndex-h.length),r<u&&(r=u),e=n._formulaTextBox,e&&e.canAppendRange())return o=n._getKeyboardAppendingInfo(),o.anchorRow=r,o.leadingRow=r,s=n._eventHandler.rangeToString(new t.Range(o.anchorRow,o.anchorCol,1,1)),s&&e.appendRange(s,!1,!0),n._setTopRow(u),!0;else e&&(n=f.handleFormulaTextboxAcrossSheet(n));return n.endEdit()?(n.canSelect(r,n.getActiveColumnIndex())&&(n._setActiveCellCore(r,i),n._leadingCellRow=r,n.moveActiveCell()),n._setTopRow(u),!0):!1},f.navigationPageDown=function(){var n=this,u,h,r,e,o,s;if(!n||n._editorStatus===2)return!1;if(u=n._getNextPageTopRow(),u===i||u===n._scrollTopRow)return!0;if(h=n._getRowLayout(1,3),r=n._getPrevVisualRow(n._activeRowIndex+h.length),r<u&&(r=u),e=n._formulaTextBox,e&&e.canAppendRange())return o=n._getKeyboardAppendingInfo(),o.anchorRow=r,o.leadingRow=r,s=n._eventHandler.rangeToString(new t.Range(o.anchorRow,o.anchorCol,1,1)),s&&e.appendRange(s,!1,!0),n._setTopRow(u),!0;else e&&(n=f.handleFormulaTextboxAcrossSheet(n));return n.endEdit()?(n.canSelect(r,n.getActiveColumnIndex())&&(n._setActiveCellCore(r,i),n._leadingCellRow=r,n.moveActiveCell()),n._setTopRow(u),!0):!1},f.navigationNextSheet=function(){var u=this,t=u.parent,f=n.Sheets,r,i;(t||t instanceof f.Spread)&&(r=t.getSheetCount(),i=t.getActiveSheetIndex(),i<r-1&&(i++,t._setActiveSheetIndexImp(i,1),t.repaint()))},f.navigationPreviousSheet=function(){var r=this,t=r.parent,u=n.Sheets,i;(t||t instanceof u.Spread)&&(i=t.getActiveSheetIndex(),i>0&&(i--,t._setActiveSheetIndexImp(i,1),t.repaint()))},f.navigationPrevious=function(){},f.navigationNext=function(){},f.navigationFirst=function(){var n=this,u,e;if(!n||n._editorStatus===2)return!1;var o=n.frozenColCount?n.frozenColCount-1:-1,s=n.frozenRowCount?n.frozenRowCount-1:-1,t=n._formulaTextBox,i=n._activeRowIndex,r=n._activeColIndex;if(t&&t.canAppendRange())return u=n._eventHandler,e=t.isAppending?u._formulaRangeAppendingInfo:u._formulaRangeAppendingInfo={anchorRow:i,anchorCol:r,leadingRow:n._leadingCellRow,leadingCol:n._leadingCellCol},n._moveFormulaTextBoxCell(5,!1,i,r),!0;else t&&(n=f.handleFormulaTextboxAcrossSheet(n));return n.moveActiveCell(5,!1,i,r),!0},f.navigationLast=function(){var n=this,u,e;if(!n||n._editorStatus===2)return!1;var t=n._formulaTextBox,i=n._activeRowIndex,r=n._activeColIndex;if(t&&t.canAppendRange())return u=n._eventHandler,e=t.isAppending?u._formulaRangeAppendingInfo:u._formulaRangeAppendingInfo={anchorRow:i,anchorCol:r,leadingRow:n._leadingCellRow,leadingCol:n._leadingCellCol},n._moveFormulaTextBoxCell(6,!1,i,r),!0;else t&&(n=f.handleFormulaTextboxAcrossSheet(n));return n.moveActiveCell(6,!1,i,r),!0},f.commitInputNavigationTabNext=function(){var n=f.handleFormulaTextboxAcrossSheet(this);n._isTabNavigation=!0;n._isNavigateInSelection?n._moveActiveCellInSelection(4):n.moveActiveCell(4,!0);n._isTabNavigation=!1},f.commitInputNavigationTabPrevious=function(){var n=f.handleFormulaTextboxAcrossSheet(this);n._isTabNavigation=!0;n._isNavigateInSelection?n._moveActiveCellInSelection(3):n.moveActiveCell(3,!0);n._isTabNavigation=!1},f.selectNextControl=function(){var u=this,f,e,n,r;return u.endEdit()?(f=u._eventHandler,f.clearRepeatKeyDownTimeout(),f.resetMetaKeyState(),t.FocusHelper.setActiveElement(i),e=!1,n=u.parent,n&&(r=n.nextControl(),r&&r.focus?(r.focus(),e=!0):n.focusTabFocusElement()),e):!1},f.selectPreviousControl=function(){var u=this,f,e,n,r;if(u.endEdit())return f=u._eventHandler,f.clearRepeatKeyDownTimeout(),f.resetMetaKeyState(),t.FocusHelper.setActiveElement(i),e=!1,n=u.parent,n&&(r=n.previousControl(),r&&r.focus?(r.focus(),e=!0):n.focusTabFocusElement()),e},f.moveToNextCell=function(){return f.commitInputNavigationTabNext.apply(this),!0},f.moveToPreviousCell=function(){return f.commitInputNavigationTabPrevious.apply(this),!0},f.moveToNextCellThenControl=function(){var n=this,i=n._leadingCellRow,t,r;return n._isTabNavigation=!0,t=n._getMoveRightCell(n.getActiveRowIndex(),n.getActiveColumnIndex(),!0,i),n._isTabNavigation=!1,r=t?t.leadingCellRow<i:!0,r?f.selectNextControl.apply(this):f.moveToNextCell.apply(this)},f.moveToPreviousCellThenControl=function(){var n=this,i=n._leadingCellRow,t,r;return n._isTabNavigation=!0,t=n._getMoveLeftCell(n.getActiveRowIndex(),n.getActiveColumnIndex(),!0,i),n._isTabNavigation=!1,r=t?t.leadingCellRow>i:!0,r?f.selectPreviousControl.apply(this):f.moveToPreviousCell.apply(this)},f.cancelInput=function(){var n=this,i=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,h,c,l,r,e,u,a,s;if(t.features.formulatextbox&&i&&i.text&&(n=i.sheet,h=i.rowIndex,c=i.columnIndex,f.changeSheetForFormulaTextboxAcrossSheet(n,!1),n._detachFormulaTextBox(),n._setActiveCellAndSelection(h,c,o,o,1)),n.isEditing())return(l=n.getValue(n._activeRowIndex,n._activeColIndex,3),!n.endEdit(!0))?!1:(n.setValue(n._activeRowIndex,n._activeColIndex,l,3,!0),!0);else if(r=n.parent,r&&r.sheets)for(e=r.sheets,u=0,a=e.length;u<a;u++)s=e[u],s&&s._cutCopyIndicatorManager.cancelIndicator()},f.clear=function(){var n=this,r,i;n.isEditing()||(r=n.getSelections(),i=new t.UndoRedo.ClearValueUndoAction(n,r),i.canExecute(n)&&n._doCommand(i))},f.clearAndEditing=function(){var n=this;return n.isEditing()?!1:t.util.isMacOS()?(f.clear.call(n),!0):(n.startEdit(!0,""),!0)},f.copy=function(){var n=this;n._doCopy()},f.cut=function(){var n=this;n._doCut()},f.paste=function(){var n=this;n._doPaste()},f.selectionLeft=function(){return r(this,37)},f.selectionRight=function(){return r(this,39)},f.selectionUp=function(){return r(this,38)},f.selectionDown=function(){return r(this,40)},f.selectionHome=function(){return r(this,37,!0)},f.selectionEnd=function(){return r(this,39,!0)},f.selectionPageUp=function(){return r(this,33)},f.selectionPageDown=function(){return r(this,34)},f.selectionTop=function(){return r(this,38,!0)},f.selectionBottom=function(){return r(this,40,!0)},f.selectionFirst=function(){return r(this,36,!0)},f.selectionLast=function(){return r(this,35,!0)},f.unSelectAllFloatingObjects=function(){var n=this;n._hasFloatingObjectsSelected()&&(n._suspendInvalidate(),n.unSelectAllFloatingObjects(),n._loadAndSetSheetSelections(),n._resumeInvalidate())},f.selectAllFloatingObjects=function(){var n=this,t,r,i;if(n._hasFloatingObjectsSelected()){for(n._suspendInvalidate(),t=0,r=n._floatingObjectArray.length;t<r;t++)i=n._floatingObjectArray[t],i.isSelected()||i.isSelected(!0);n._resumeInvalidate()}},f.deleteFloatingObject=function(){var n=this,i=s(n),r,u;i.length>0&&(r={names:i},u=new t.UndoRedo.DeleteFloatingObjectUndoAction(n,r),n._doCommand(u))},f.navigationNextFloatingObject=function(){var n=this,i,r,t,u;if(n._hasFloatingObjectsSelected()){for(n._suspendInvalidate(),t=0,i=0,r=n._floatingObjectArray.length;i<r;i++)u=n._floatingObjectArray[i],u.isSelected()&&(t=i);return n.unSelectAllFloatingObjects(),t+=1,t==n._floatingObjectArray.length&&(t=0),n._floatingObjectArray[t].isSelected(!0),n._resumeInvalidate(),!0}return!1},f.navigationPreviousFloatingObject=function(){var n=this,i,r,t,u;if(n._hasFloatingObjectsSelected()){for(n._suspendInvalidate(),t=0,i=0,r=n._floatingObjectArray.length;i<r;i++)u=n._floatingObjectArray[i],u.isSelected()&&(t=i);return n.unSelectAllFloatingObjects(),t-=1,t<0&&(t=n._floatingObjectArray.length-1),n._floatingObjectArray[t].isSelected(!0),n._resumeInvalidate(),!0}return!1},f.clipboardCutFloatingObject=function(){var n=this;n._doFloatingObjectCut()},f.clipboardCopyFloatingObject=function(){var n=this;n._doFloatingObjectCopy()},f.clipboardPasteFloatingObject=function(){var n=this;n._doFloatingObjectPaste()},f.moveFloatingObjectUp=function(){for(var n=this,u=[],o=0,r,e,i=0,f=n._floatingObjectArray.length;i<f;i++)r=n._floatingObjectArray[i],r.isSelected()&&u.push(r.name());e=new t.UndoRedo.MovingFloatingObjectUndoAction(n,{names:u},{offsetX:0,offsetY:-1});n._doCommand(e)},f.moveFloatingObjectDown=function(){for(var n=this,u=[],o=0,r,e,i=0,f=n._floatingObjectArray.length;i<f;i++)r=n._floatingObjectArray[i],r.isSelected()&&u.push(r.name());e=new t.UndoRedo.MovingFloatingObjectUndoAction(n,{names:u},{offsetX:0,offsetY:1});n._doCommand(e)},f.moveFloatingObjectLeft=function(){for(var n=this,u=[],o=0,r,e,i=0,f=n._floatingObjectArray.length;i<f;i++)r=n._floatingObjectArray[i],r.isSelected()&&u.push(r.name());e=new t.UndoRedo.MovingFloatingObjectUndoAction(n,{names:u},{offsetX:-1,offsetY:0});n._doCommand(e)},f.moveFloatingObjectRight=function(){for(var n=this,u=[],o=0,r,e,i=0,f=n._floatingObjectArray.length;i<f;i++)r=n._floatingObjectArray[i],r.isSelected()&&u.push(r.name());e=new t.UndoRedo.MovingFloatingObjectUndoAction(n,{names:u},{offsetX:1,offsetY:0});n._doCommand(e)},f.unfilterSlicer=function(){var n=this,u=n&&n._slicerCollection,f=u&&u.getSelectedSlicers(),i,r,e;f.length===1&&(i=f[0],r=i.getSlicerData(),r)&&(e=r.getFilteredIndexes(i.columnName()),n._doCommand(new t.UndoRedo.SlicerDataUnFilterUndoAction(n,r,i.columnName(),e)))},f.deleteComment=function(){var n=this,i=n._commentManager.getActiveComment(),r;i&&(r=new t.UndoRedo.CommentDeleteUndoAction(n,i),n._doCommand(r))},f.deactivateComment=function(){var n=this;n._commentManager.deactivateComment();n._loadAndSetSheetSelections();n.repaint()},f.moveCommentUp=function(){var i=this,n=i._commentManager.getActiveComment(),r;n&&(r=new t.UndoRedo.CommentPropertyUndoAction(i,n,n.location().clone(),new t.Point(n.location().x,n.location().y-1),"location"),i._doCommand(r))},f.moveCommentDown=function(){var i=this,n=i._commentManager.getActiveComment(),r;n&&(r=new t.UndoRedo.CommentPropertyUndoAction(i,n,n.location().clone(),new t.Point(n.location().x,n.location().y+1),"location"),i._doCommand(r))},f.moveCommentLeft=function(){var i=this,n=i._commentManager.getActiveComment(),r;n&&(r=new t.UndoRedo.CommentPropertyUndoAction(i,n,n.location().clone(),new t.Point(n.location().x-1,n.location().y),"location"),i._doCommand(r))},f.moveCommentRight=function(){var i=this,n=i._commentManager.getActiveComment(),r;n&&(r=new t.UndoRedo.CommentPropertyUndoAction(i,n,n.location().clone(),new t.Point(n.location().x+1,n.location().y),"location"),i._doCommand(r))},f.changeFormulaReference=function(){var n=this,t;if(n&&n._formulaTextBox&&(t=n._eventHandler,t)){n._suspendInvalidate();try{t.changeFormulaReference()}finally{n._resumeInvalidate()}}},f.undo=function(){var t=this,n=t.undoManager();n.canUndo()&&n.undo()},f.redo=function(){var t=this,n=t.undoManager();n.canRedo()&&n.redo()},f}();t.SpreadActions=f})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){(function(i){var r=null,s=undefined,l=Math.min,e=Math.max,ir=Math.ceil,p=Math.floor,c=function(){function n(n,t,i){var r=this;r.row=n;r.column=t;r.value=i}return n}(),h,w,o,v,a,u,f,ft,et,ot,st,ht,ct,lt,at,vt,yt,pt,wt,bt,kt,dt,gt,ni,ti,ii,ri,g,nt,tt,ui,it,fi,ei,rt,oi,si,hi,y,ci,li,ai,vi,yi,b,pi,wi,k,bi,ki,di,d,gi,nr,ut,tr;i.CellData=c;h=function(){function n(n,t,i){var r=this;r.sheet=n;r.range=t;r.dataType=i;r.cellsHasData=[];r.changedCells=[];r.initCellsHasData()}return n.prototype.initCellsHasData=function(){var i=this,a=i.range,t=i.sheet,st,ut,nt,ft,f,u,n,l,e,h,b,et,k,ot,v,tt,y,it;if(t&&a){var o=i.dataType,p=a.row,w=a.col,rt=a.rowCount,d=a.colCount,c=i.cellsHasData,g=!1;if(p===-1&&(g=!0,p=0,rt=t.getRowCount()),w===-1&&(g=!0,w=0,d=t.getColumnCount()),st=t.getDefaultStyle(),nt=[],(o&64)>0)for(n=0;n<d;n++)nt[n]=t.getStyleObject(-1,n)||r;for(f=0;f<rt;f++)for(u=p+f,(o&64)>0&&(ut=t.getStyleObject(u,-1)||r),n=0;n<d;n++){if(e=w+n,(o&2)>0&&(l=t.getFormulaInformation(u,e),l.hasFormula))if(l.isArrayFormula){if(h=l.baseRange,h.row===u&&h.col===e)for(b=h.row,et=h.row+h.rowCount;b<et;b++)for(k=h.col,ot=h.col+h.colCount;k<ot;k++)i.setCellDatas(c,b-p,k-w,l,2)}else i.setCellDatas(c,f,n,l.formula,2);(o&1)>0&&(!l||!l.hasFormula)&&i.setCellDatas(c,f,n,t.getValue(u,e,3),1);(o&16)>0&&(v=t.getSparkline(u,e),tt=r,v&&(tt=v.data()),v&&tt&&i.setCellDatas(c,f,n,v,16));(o&64)>0&&(g?y=t.getActualStyle(u,e,3):(ft=t.getStyleObject(u,e)||r,y=t.getCompositeStyle(u,e,3,ft,ut,nt[n])),it=s,y&&y.toJSON&&(it=JSON.stringify(y.toJSON(3,!0))),i.setCellDatas(c,f,n,it,64));(o&4)>0&&i.setCellDatas(c,f,n,t.getComment(u,e),4);(o&128)>0&&i.setCellDatas(c,f,n,t.getTag(u,e,3),128);(o&256)>0&&i.setCellDatas(c,f,n,t.getBindingPath(u,e,3),256)}}},n.prototype.getCellsHasData=function(){return this.cellsHasData},n.prototype.setCellDatas=function(n,i,u,f,e){f!==s&&f!==r&&n&&(n[i]===s&&(n[i]=[]),n[i][u]===s&&(n[i][u]={}),n[i][u][t.CopyToOption[e]]=f)},n.prototype.mergeCellsHasDiffData=function(n){var e,r,t,h,u,i,c,f,o;if(n)for(e=this,r=e.cellsHasData,t=0,h=n.length;t<h;t++)if(u=n[t],u)for(i=0,c=u.length;i<c;i++)f=u[i],f&&(r[t]||(r[t]=[]),o=r[t][i],o?e.isDataEqual(f,o)&&(r[t][i]=s):r[t][i]=f)},n.prototype.isDataEqual=function(n,i){var u=this.dataType,r=[],f,o,e;for(u&256&&r.push(t.CopyToOption[256]),u&4&&r.push(t.CopyToOption[4]),u&2&&r.push(t.CopyToOption[2]),u&16&&r.push(t.CopyToOption[16]),u&64&&r.push(t.CopyToOption[64]),u&128&&r.push(t.CopyToOption[128]),u&1&&r.push(t.CopyToOption[1]),f=0,o=r.length;f<o;f++)if(e=r[f],n[e]!==i[e])return!1;return!0},n.prototype.getChangedCells=function(){var n=this,o=[],u=n.range.row,f=n.range.col,s=n.cellsHasData,i,h,e,r,c;if(n.changedCells&&n.changedCells.length>0)return n.changedCells;for(u=u===-1?0:u,f=f===-1?0:f,i=0,h=s.length;i<h;i++)if(e=s[i],e)for(r=0,c=e.length;r<c;r++)e[r]&&o.push(new t.CellPosition(i+u,r+f));return n.changedCells=o,o},n}();i.ChangedCells=h;w=function(){function n(){}return n.prototype.saveDefaultStyle=function(n){this._defaultStyle=n;this._defaultStyleSaved=!0},n.prototype.getDefaultStyle=function(){return this._defaultStyle},n.prototype.saveDefaultColumnWidth=function(n){this._defaultColumnWidth=n;this._defaultColumnWidthSaved=!0},n.prototype.getDefaultColumnWidth=function(){return this._defaultColumnWidth},n.prototype.saveDefaultRowHeight=function(n){this._defaultRowHeight=n;this._defaultRowHeightSaved=!0},n.prototype.getDefaultRowHeight=function(){return this._defaultRowHeight},n.prototype.getTag=function(){return this._tag},n.prototype.saveColumnHeaderDefaultStyle=function(n){this._columnHeaderDefaultStyle=n;this._columnHeaderDefaultStyleSaved=!0},n.prototype.getColumnHeaderDefaultStyle=function(){return this._columnHeaderDefaultStyle},n.prototype.saveColumnHeaderDefaultRowHeight=function(n){this._columnHeaderDefaultRowHeight=n;this._columnHeaderDefaultRowHeightSaved=!0},n.prototype.getColumnHeaderDefaultRowHeight=function(){return this._columnHeaderDefaultRowHeight},n.prototype.saveRowHeaderDefaultStyle=function(n){this._rowHeaderDefaultStyle=n;this._rowHeaderDefaultStyleSaved=!0},n.prototype.getRowHeaderDefaultStyle=function(){return this._rowHeaderDefaultStyle},n.prototype.saveRowHeaderDefaultColumnWidth=function(n){this._rowHeaderDefaultColumnWidth=n;this._rowHeaderDefaultColumnWidthSaved=!0},n.prototype.getRowHeaderDefaultColumnWidth=function(){return this._rowHeaderDefaultColumnWidth},n.prototype.saveCommentManager=function(n){this._commentManager=n;this._commentManagerSaved=!0},n.prototype.saveTag=function(n){this._tag=n;this._tagSaved=!0},n.prototype.isDefaultStyleSaved=function(){return this._defaultStyleSaved},n.prototype.isDefaultColumnWidthSaved=function(){return this._defaultColumnWidthSaved},n.prototype.isDefaultRowHeightSaved=function(){return this._defaultRowHeightSaved},n.prototype.isColumnHeaderDefaultStyleSaved=function(){return this._columnHeaderDefaultStyleSaved},n.prototype.isColumnHeaderDefaultRowHeightSaved=function(){return this._columnHeaderDefaultRowHeightSaved},n.prototype.isRowHeaderDefaultStyleSaved=function(){return this._rowHeaderDefaultStyleSaved},n.prototype.isRowHeaderDefaultColumnWidthSaved=function(){return this._rowHeaderDefaultColumnWidthSaved},n.prototype.isCommentManagerSaved=function(){return this._commentManagerSaved},n.prototype.isTagSaved=function(){return this._tagSaved},n}();i.CopyMoveSheetInfo=w;o=function(){function n(n,t){var i=this;i._rowCount=n;i._columnCount=t;i._init()}return n.prototype._init=function(){var n=this;n._values=[];n._formulas=[];n._sparklines=[];n._styles=[];n._comments=[];n._tags=[];n._bindingPaths=[];n._spans=r;n._arrayFormulas=[];n._valueSaved=!1;n._formulaSaved=!1;n._sparklineSaved=!1;n._styleSaved=!1;n._commentSaved=!1;n._tagSaved=!1;n._spanSaved=!1;n._arrayFormulaSaved=!1;n._bindingPathSaved=!1},n.prototype.saveValue=function(n,t,i){i!==s&&i!==r&&this._values.push(new c(n,t,i));this._valueSaved=!0},n.prototype.getValues=function(){return this._values},n.prototype.saveFormula=function(n,t,i){i&&i!==""&&this._formulas.push(new c(n,t,i));this._formulaSaved=!0},n.prototype.getFormulas=function(){return this._formulas},n.prototype.saveArrayFormula=function(n){this._arrayFormulas.push(n);this._arrayFormulaSaved=!0},n.prototype.getArrayFormula=function(){return this._arrayFormulas},n.prototype.saveSparkline=function(n,t,i){i&&this._sparklines.push(new c(n,t,i));this._sparklineSaved=!0},n.prototype.getSparklines=function(){return this._sparklines},n.prototype.saveStyle=function(n,t,i){i&&this._styles.push(new c(n,t,i));this._styleSaved=!0},n.prototype.getStyles=function(){return this._styles},n.prototype.saveComment=function(n,t,i){i&&this._comments.push(new c(n,t,i));this._commentSaved=!0},n.prototype.getComments=function(){return this._comments},n.prototype.saveTag=function(n,t,i){i!==s&&i!==r&&this._tags.push(new c(n,t,i));this._tagSaved=!0},n.prototype.getTags=function(){return this._tags},n.prototype.saveBindingPath=function(n,t,i){i!==s&&i!==r&&this._bindingPaths.push(new c(n,t,i));this._bindingPathSaved=!0},n.prototype.getBindingPaths=function(){return this._bindingPaths},n.prototype.saveSpan=function(n){var t=this;t._spans||(t._spans=[]);t._spans.push(n);t._spanSaved=!0},n.prototype.isValueOrFormulaSaved=function(){return this._valueSaved||this._formulaSaved||this._arrayFormulaSaved},n.prototype.isValueSaved=function(){return this._valueSaved},n.prototype.isFormulaSaved=function(){return this._formulaSaved},n.prototype.isArrayFormulaSaved=function(){return this._arrayFormulaSaved},n.prototype.isSparklineSaved=function(){return this._sparklineSaved},n.prototype.isStyleSaved=function(){return this._styleSaved},n.prototype.isCommentSaved=function(){return this._commentSaved},n.prototype.isTagSaved=function(){return this._tagSaved},n.prototype.isSpanSaved=function(){return this._spanSaved},n.prototype.isBindingPathSaved=function(){return this._bindingPathSaved},n}();i.CopyMoveCellsInfo=o;v=function(){function n(n){this._columnCount=n;this._init()}return n.prototype._init=function(){var n=this;n._widths={};n._visibles={};n._resizables={};n._tags={};n._viewportColumnStyles={};n._headerColumnStyles={};n._levels={};n._collapsed={};n._bindingFields={};n._widthSaved=!1;n._visibleSaved=!1;n._resizableSaved=!1;n._tagSaved=!1;n._viewportColumnStyleSaved=!1;n._headerColumnStyleSaved=!1;n._rangeGroupSaved=!1;n._bindingFieldSaved=!1},n.prototype.saveWidth=function(n,t){var i=this;i._widths[n]!==r?i._widths[n]=t<0?r:t:t>=0&&(i._widths[n]=t);i._widthSaved=!0},n.prototype.getWidth=function(n){return this._widths[n]!==r?this._widths[n]:-1},n.prototype.saveVisible=function(n,t){var i=this;i._visibles[n]!==r?i._visibles[n]=t?r:t:t||(i._visibles[n]=t);i._visibleSaved=!0},n.prototype.getVisible=function(n){return this._visibles[n]!==r?this._visibles[n]:!0},n.prototype.saveResizable=function(n,t){var i=this;i._resizables[n]!==r?i._resizables[n]=t?r:t:t||(i._resizables[n]=t);i._resizableSaved=!0},n.prototype.getResizable=function(n){return this._resizables[n]!==r?this._resizables[n]:!0},n.prototype.saveTag=function(n,t){var i=this;i._tags[n]=t!==s&&t!==r?t:r;i._tagSaved=!0},n.prototype.getTag=function(n){return this._tags[n]},n.prototype.saveViewportColumnStyle=function(n,t){var i=this;i._viewportColumnStyles[n]?i._viewportColumnStyles[n]=t?t:r:t&&(i._viewportColumnStyles[n]=t);i._viewportColumnStyleSaved=!0},n.prototype.getViewportColumnStyle=function(n){return this._viewportColumnStyles[n]?this._viewportColumnStyles[n]:r},n.prototype.saveHeaderColumnStyle=function(n,t){var i=this;i._headerColumnStyles[n]?i._headerColumnStyles[n]=t?t:r:t&&(i._headerColumnStyles[n]=t);i._headerColumnStyleSaved=!0},n.prototype.getHeaderColumnStyle=function(n){return this._headerColumnStyles[n]?this._headerColumnStyles[n]:r},n.prototype.saveRangeGroup=function(n,t,i){var u=this;u._levels[n]!==r?u._levels[n]=t<0?r:t:t>=0&&(u._levels[n]=t);u._collapsed[n]!==r?u._collapsed[n]=i?i:r:i&&(u._collapsed[n]=i);u._rangeGroupSaved=!0},n.prototype.getRangeGroup=function(n,t){var i=this;t.level=-1;t.collapsed=!1;i._levels[n]!==r&&(t.level=i._levels[n]);i._collapsed[n]!==r&&(t.collapsed=i._collapsed[n])},n.prototype.saveBindingField=function(n,t){this._bindingFields[n]=t;this._bindingFieldSaved=!0},n.prototype.getBindingField=function(n,t){return(t.fieldName=r,this._bindingFields[n]!==r)?(t.fieldName=this._bindingFields[n],!0):!1},n.prototype.isWidthSaved=function(){return this._widthSaved},n.prototype.isVisibleSaved=function(){return this._visibleSaved},n.prototype.isResizableSaved=function(){return this._resizableSaved},n.prototype.isTagSaved=function(){return this._tagSaved},n.prototype.isViewportColumnStyleSaved=function(){return this._viewportColumnStyleSaved},n.prototype.isHeaderColumnStyleSaved=function(){return this._headerColumnStyleSaved},n.prototype.isRangeGroupSaved=function(){return this._rangeGroupSaved},n.prototype.isBindingFieldSaved=function(){return this._bindingFieldSaved},n}();i.CopyMoveColumnsInfo=v;a=function(){function n(n){this._rowCount=n;this._init()}return n.prototype._init=function(){var n=this;n._heights={};n._visibles={};n._resizables={};n._tags={};n._viewportRowStyles={};n._headerRowStyles={};n._levels={};n._collapsed={};n._heightSaved=!1;n._visibleSaved=!1;n._resizableSaved=!1;n._tagSaved=!1;n._viewportRowStyleSaved=!1;n._headerRowStyleSaved=!1;n._rangeGroupSaved=!1},n.prototype.saveHeight=function(n,t){var i=this;i._heights[n]!==r?i._heights[n]=t<0?r:t:t>=0&&(i._heights[n]=t);i._heightSaved=!0},n.prototype.getHeight=function(n){return this._heights[n]!==r?this._heights[n]:-1},n.prototype.saveVisible=function(n,t){var i=this;i._visibles[n]!==r?i._visibles[n]=t?r:t:t||(i._visibles[n]=t);i._visibleSaved=!0},n.prototype.getVisible=function(n){return this._visibles[n]!==r?this._visibles[n]:!0},n.prototype.saveResizable=function(n,t){var i=this;i._resizables[n]!==r?i._resizables[n]=t?r:t:t||(i._resizables[n]=t);i._resizableSaved=!0},n.prototype.getResizable=function(n){return this._resizables[n]!==r?this._resizables[n]:!0},n.prototype.saveTag=function(n,t){var i=this;i._tags[n]=t!==s&&t!==r?t:r;i._tagSaved=!0},n.prototype.getTag=function(n){return this._tags[n]},n.prototype.saveViewportRowStyle=function(n,t){var i=this;i._viewportRowStyles[n]?i._viewportRowStyles[n]=t?t:r:t&&(i._viewportRowStyles[n]=t);i._viewportRowStyleSaved=!0},n.prototype.getViewportRowStyle=function(n){return this._viewportRowStyles[n]?this._viewportRowStyles[n]:r},n.prototype.saveHeaderRowStyle=function(n,t){var i=this;i._headerRowStyles[n]?i._headerRowStyles[n]=t?t:r:t&&(i._headerRowStyles[n]=t);i._headerRowStyleSaved=!0},n.prototype.getHeaderRowStyle=function(n){return this._headerRowStyles[n]?this._headerRowStyles[n]:r},n.prototype.saveRangeGroup=function(n,t,i){var u=this;u._levels[n]!==r?u._levels[n]=t<0?r:t:t>=0&&(u._levels[n]=t);u._collapsed[n]!==r?u._collapsed[n]=i?i:r:i&&(u._collapsed[n]=i);u._rangeGroupSaved=!0},n.prototype.getRangeGroup=function(n,t){var i=this;t.level=-1;t.collapsed=!1;i._levels[n]!==r&&(t.level=i._levels[n]);i._collapsed[n]!==r&&(t.collapsed=i._collapsed[n])},n.prototype.isHeightSaved=function(){return this._heightSaved},n.prototype.isVisibleSaved=function(){return this._visibleSaved},n.prototype.isResizableSaved=function(){return this._resizableSaved},n.prototype.isTagSaved=function(){return this._tagSaved},n.prototype.isViewportRowStyleSaved=function(){return this._viewportRowStyleSaved},n.prototype.isHeaderRowStyleSaved=function(){return this._headerRowStyleSaved},n.prototype.isRangeGroupSaved=function(){return this._rangeGroupSaved},n}();i.CopyMoveRowsInfo=a;u=function(){function n(){}return n.getStyleObject=function(n,t,i,r){return n.getStyleObject(t,i,r)},n.setStyleObject=function(n,t,i,r,u){n.setStyleObject(t,i,u,r)},n.getComment=function(n,t,i){return n.getComment(t,i)},n.setComment=function(n,t,i,r){n.setComment(t,i,r)},n.saveSheetInfo=function(n,t,i){(i&64)>0&&(t.saveDefaultStyle(n.getDefaultStyle()),t.saveColumnHeaderDefaultStyle(n.getDefaultStyle(1)),t.saveRowHeaderDefaultStyle(n.getDefaultStyle(2)));(i&128)>0&&t.saveTag(n.tag());t.saveDefaultColumnWidth(n.defaults.colWidth);t.saveDefaultRowHeight(n.defaults.rowHeight);t.saveColumnHeaderDefaultRowHeight(n.defaults.colHeaderRowHeight);t.saveRowHeaderDefaultColumnWidth(n.defaults.rowHeaderColWidth)},n.saveColumnHeaderInfo=function(t,i,r,u,f){for(var l=i._rowCount,s=i._columnCount,e,a,c,h,o=0;o<l;o++)for(e=0;e<s;e++)(f&1)>0&&(a=t._getModel(1).getValue(o,u+e),i.saveValue(o,e,a)),(f&64)>0&&i.saveStyle(o,e,n.getStyleObject(t,o,u+e,1)),(f&128)>0&&i.saveTag(o,e,t.getTag(o,u+e,1));if((f&1)>0)for(e=0;e<s;e++)t.isColumnBound(u+e)&&r.saveBindingField(e,t.getDataColumnName(u+e));if((f&32)>0)for(c=t._getSpanModel(1).getEnumerator(0,u,l,s);c.moveNext();)i.saveSpan(c.current());for(s=r._columnCount,e=0;e<s;e++)r.saveWidth(e,t._getActualColumnWidth(u+e)),r.saveVisible(e,t.getColumnVisible(u+e)),r.saveResizable(e,t.getColumnResizable(u+e));if((f&128)>0)for(e=0;e<s;e++)r.saveTag(e,t.getTag(-1,u+e));if((f&64)>0)for(e=0;e<s;e++)r.saveViewportColumnStyle(e,n.getStyleObject(t,-1,u+e,3)),r.saveHeaderColumnStyle(e,n.getStyleObject(t,-1,u+e,1));if((f&8)>0&&(h=t.colRangeGroup,h&&!h._isEmpty()))for(e=0;e<s;e++)r.saveRangeGroup(e,h.getLevel(u+e),h.getCollapsed(u+e))},n.saveRowHeaderInfo=function(t,i,r,u,f){var s,c,e,o,a,l,h;if(!((f&1023)<=0)){for(s=i._rowCount,c=i._columnCount,e=0;e<s;e++)for(o=0;o<c;o++)(f&1)>0&&(a=t._getModel(2).getValue(u+e,o),i.saveValue(e,o,a)),(f&64)>0&&i.saveStyle(e,o,n.getStyleObject(t,u+e,o,2)),(f&128)>0&&i.saveTag(e,o,t.getTag(u+e,o,2));if((f&32)>0)for(l=t._getSpanModel(2).getEnumerator(u,0,s,c);l.moveNext();)i.saveSpan(l.current());for(s=r._rowCount,e=0;e<s;e++)r.saveHeight(e,t._getActualRowHeight(u+e)),r.saveVisible(e,t.getRowVisible(u+e)),r.saveResizable(e,t.getRowResizable(u+e));if((f&128)>0)for(e=0;e<s;e++)r.saveTag(e,t.getTag(u+e,-1));if((f&64)>0)for(e=0;e<s;e++)r.saveViewportRowStyle(e,n.getStyleObject(t,u+e,-1,3)),r.saveHeaderRowStyle(e,n.getStyleObject(t,u+e,-1,2));if((f&8)>0&&(h=t.rowRangeGroup,h&&!h._isEmpty()))for(e=0;e<s;e++)r.saveRangeGroup(e,h.getLevel(u+e),h.getCollapsed(u+e))}},n.saveViewportInfo=function(t,i,u,f,e){var l,a,o,s,h,v;if(!((e&1023)<=0)){for(l=i._rowCount,a=i._columnCount,o=0;o<l;o++)for(s=0;s<a;s++){if((e&2)>0&&(h=t.getFormulaInformation(u+o,f+s),h.hasFormula?h.isArrayFormula?h.baseRange.row===u+o&&h.baseRange.col===f+s&&i.saveArrayFormula(h):i.saveFormula(o,s,h.formula):i.saveFormula(o,s,r)),(e&1)>0&&(!h||!h.hasFormula)&&i.saveValue(o,s,t.getValue(u+o,f+s,3)),(e&16)>0){var c=t.getSparkline(u+o,f+s),y=r,p=r;c&&(y=c.data(),p=c.dateAxisData());c&&y?i.saveSparkline(o,s,c.clone()):i.saveSparkline(o,s,r)}(e&64)>0&&i.saveStyle(o,s,n.getStyleObject(t,u+o,f+s,3));(e&4)>0&&i.saveComment(o,s,n.getComment(t,u+o,f+s));(e&128)>0&&i.saveTag(o,s,t.getTag(u+o,f+s,3));(e&256)>0&&i.saveBindingPath(o,s,t.getBindingPath(u+o,f+s,3))}if((e&32)>0)for(v=t._getSpanModel().getEnumerator(u,f,l,a);v.moveNext();)i.saveSpan(v.current())}},n.saveTableInfo=function(n,t,i){var f=n.getTables(),r,o,u,e;if(f)for(r=0,o=f.length;r<o;r++)u=f[r],i.containsRange(u.range())&&(e=u.clone(),e.copyDataSource(u),t.push(e))},n.undoCellsInfo=function(t,i,u,f,e){var et=i._rowCount,ot=i._columnCount,o,y,b,k,d,v,c,l,st,g,ht,nt,ct,lt,tt,s,at,it,vt,rt,wt,yt,bt,ut,h,a,w,p,ft,pt;t.suspendCalcService();t.suspendEvent();try{for(c=0;c<et;c++)for(l=0;l<ot;l++)i.isBindingPathSaved()&&t.setBindingPath(u+c,f+l,r,e),i.isFormulaSaved()&&e===3&&t.setFormula(u+c,f+l,r),i.isSparklineSaved()&&e===3&&t.removeSparkline(u+c,f+l),i.isValueSaved()&&t.setValue(u+c,f+l,r,e),i.isStyleSaved()&&n.setStyleObject(t,u+c,f+l,e,r),i.isCommentSaved()&&n.setComment(t,u+c,f+l,r),i.isTagSaved()&&t.setTag(u+c,f+l,r,e);if(i.isBindingPathSaved())for(st=i.getBindingPaths(),o=0;o<st.length;o++)g=st[o],t.setBindingPath(u+g.row,f+g.column,g.value,e);if(i.isValueSaved())for(ht=i.getValues(),o=0;o<ht.length;o++)nt=ht[o],t.setValue(u+nt.row,f+nt.column,nt.value,e);if(i.isFormulaSaved()&&e===3)for(ct=i.getFormulas(),o=0;o<ct.length;o++)k=ct[o],t.setFormula(u+k.row,f+k.column,k.value);if(i.isSparklineSaved()&&e===3)for(lt=i.getSparklines(),tt=0;tt<lt.length;tt++)h=lt[tt],s=h.value,s?s.dateAxisData()?t.setSparkline(u+h.row,f+h.column,s.data(),s.dataOrientation(),s.sparklineType(),s.setting(),s.dateAxisData(),s.dateAxisOrientation()):t.setSparkline(u+h.row,f+h.column,s.data(),s.dataOrientation(),s.sparklineType(),s.setting()):t.removeSparkline(u+h.row,f+h.column);if(i.isStyleSaved())for(at=i.getStyles(),o=0;o<at.length;o++)it=at[o],n.setStyleObject(t,u+it.row,f+it.column,e,it.value);if(i.isCommentSaved())for(vt=i.getComments(),o=0;o<vt.length;o++)rt=vt[o],wt=rt.value,n.setComment(t,u+rt.row,f+rt.column,wt);if(i.isTagSaved())for(yt=i.getTags(),bt=yt.length,ut=0;ut<bt;ut++)h=yt[ut],t.setTag(u+h.row,f+h.column,h.value,e);if(i.isArrayFormulaSaved()&&e===3){if(a=t._getsArrayFormulas(u,f,et,ot),a&&a.length>0)for(d=a.getLength(0),v=0;v<d;v++)b=a[v][0],t.setArrayFormula(b.row,b.col,b.rowCount,b.colCount,r);if(a=i.getArrayFormula(),a&&a.length>0)for(d=a.length,v=0;v<d;v++)w=a[v],t.setArrayFormula(w.baseRange.row,w.baseRange.col,w.baseRange.rowCount,w.baseRange.colCount,w.formula)}}finally{t.resumeCalcService();t.resumeEvent()}if(p=t._getSpanModel(e),p&&p.length>0){for(ft=[],pt=p.getEnumerator(u,f,et,ot);pt.moveNext();)y=pt.current(),y&&ft.push(y);for(o=0;o<ft.length;o++)y=ft[o],p.remove(y)}if(i.isSpanSaved()&&p)for(o=0;o<i._spans.length;o++)y=i._spans[o],p.addSpan(y)},n.undoColumnsInfo=function(t,i,u){var e=i._columnCount,f,h,o,s;if(i.isBindingFieldSaved())for(h={fieldName:r},f=0;f<e;f++)i.getBindingField(f,h)&&t.bindColumn(u+f,h.fieldName);if(i.isWidthSaved())for(f=0;f<e;f++)t.setColumnWidth(u+f,i.getWidth(f),3);if(i.isVisibleSaved())for(f=0;f<e;f++)t.setColumnVisible(u+f,i.getVisible(f),3);if(i.isResizableSaved())for(f=0;f<e;f++)t.setColumnResizable(u+f,i.getResizable(f),3);if(i.isTagSaved())for(f=0;f<e;f++)t.setTag(-1,u+f,i.getTag(f),3);if(i.isViewportColumnStyleSaved())for(f=0;f<e;f++)n.setStyleObject(t,-1,u+f,3,i.getViewportColumnStyle(f));if(i.isHeaderColumnStyleSaved())for(f=0;f<e;f++)n.setStyleObject(t,-1,u+f,1,i.getHeaderColumnStyle(f));if(i.isRangeGroupSaved()&&(o=t.colRangeGroup,o))for(s={level:r,collapsed:r},f=0;f<e;f++)i.getRangeGroup(f,s),o._setLevel(u+f,s.level),o.setCollapsed(u+f,s.collapsed)},n.undoRowsInfo=function(t,i,u){var e=i._rowCount,f,o,s;if(i.isHeightSaved())for(f=0;f<e;f++)t.setRowHeight(u+f,i.getHeight(f),3);if(i.isVisibleSaved())for(f=0;f<e;f++)t.setRowVisible(u+f,i.getVisible(f),3);if(i.isResizableSaved())for(f=0;f<e;f++)t.setRowResizable(u+f,i.getResizable(f),3);if(i.isTagSaved())for(f=0;f<e;f++)t.setTag(u+f,-1,i.getTag(f),3);if(i.isViewportRowStyleSaved())for(f=0;f<e;f++)n.setStyleObject(t,u+f,-1,3,i.getViewportRowStyle(f));if(i.isHeaderRowStyleSaved())for(f=0;f<e;f++)n.setStyleObject(t,u+f,-1,2,i.getHeaderRowStyle(f));if(i.isRangeGroupSaved()&&(o=t.rowRangeGroup,o))for(s={level:r,collapsed:r},f=0;f<e;f++)i.getRangeGroup(f,s),o._setLevel(u+f,s.level),o.setCollapsed(u+f,s.collapsed)},n.undoSheetInfo=function(n,t){t.isDefaultStyleSaved()&&n.setDefaultStyle(t.getDefaultStyle());t.isDefaultColumnWidthSaved()&&(n.defaults.colWidth=t.getDefaultColumnWidth());t.isDefaultRowHeightSaved()&&(n.defaults.rowHeight=t.getDefaultRowHeight());t.isTagSaved()&&n.tag(t.getTag());t.isColumnHeaderDefaultStyleSaved()&&n.setDefaultStyle(t.getColumnHeaderDefaultStyle(),1);t.isColumnHeaderDefaultRowHeightSaved()&&(n.defaults.colHeaderRowHeight=t.getColumnHeaderDefaultRowHeight());t.isRowHeaderDefaultStyleSaved()&&n.setDefaultStyle(t.getRowHeaderDefaultStyle(),2);t.isRowHeaderDefaultColumnWidthSaved()&&(n.defaults.rowHeaderColWidth=t.getRowHeaderDefaultColumnWidth())},n.undoTableInfo=function(n,t,i){var f=t.length,e,r,u;if(f>0)for(r=0;r<f;r++)u=t[r],n._tableManager.add(u);else if(e=n.getTables(),e)for(r=0,f=e.length;r<f;r++)u=e[r],i.containsRange(u.range())&&n._tableManager.remove(u,!1)},n.getValues=function(n,t,i,u,f){var l,e,o,h;for(t<0&&(t=0,u=n.getRowCount()),i<0&&(i=0,f=n.getColumnCount()),l=[],e=0;e<u;e++)for(o=0;o<f;o++)h=n.getValue(t+e,i+o),h!==s&&h!==r&&l.push(new c(e,o,h));return l},n.raiseRangeDataChanged=function(n,t,i,r,u,f,e,o){n&&(t<0&&(t=0,r=n.getRowCount()),i<0&&(i=0,u=n.getColumnCount()),n._raiseRangeDataChanged(t,i,r,u,f,e))},n.convertToKey=function(n,t){var i=0;return i=n,i<<=32,i|t},n.remove=function(n,t,i){var e=r,f=-1,o=n.length,u;if(o>0)for(u=0;u<o;u++)if(n[u].row===t&&n[u].column===i){f=u;break}return f!==-1&&(e=n[f],n.splice(f,1)),e},n.clearFormula=function(n,t,i,r,u){var f=n._getCalcModel();f.clear(t,i,r,u)},n}();i.CopyMoveHelper=u;f=function(){function n(){this.canExecuteChanged=r}return n.prototype.execute=function(n){},n.prototype.canExecute=function(n){return!0},n.prototype.canUndo=function(){return!0},n.prototype.saveState=function(){},n.prototype.undo=function(n){return!0},n.prototype._raiseCanExecuteChanged=function(){var n=this;n.canExecuteChanged&&typeof n.canExecuteChanged=="function"&&n.canExecuteChanged(n)},n.prototype._suspendInvalidate=function(n){n&&n._suspendInvalidate&&n._suspendInvalidate()},n.prototype._resumeInvalidate=function(n){return n&&n._resumeInvalidate?n._resumeInvalidate():!1},n}();i.ActionBase=f;ft=function(n){function t(t,i,r,u){n.call(this);var f=this;f._sheet=t;f._columns=i;f._size=r;f._rowHeader=u;f._oldSizes=[];f._oldVisibles=[]}return __extends(t,n),t.prototype.canExecute=function(n){return!0},t.prototype.execute=function(n){var i=this,t=i._sheet,o=i._columns,b=o&&o.length,k=Number.MAX_VALUE,y,s,d,u,f,e,v,r,nt;if(t&&b>0){if(i._suspendInvalidate(n),y=i._getColumnsReiszed(o),s={sheet:t,sheetName:t._name,colList:y,header:i._rowHeader,cancel:!1},t.triggerColumnWidthChanging(s),s&&s.cancel===!0){i._canUndo=!1;i._resumeInvalidate(n);return}else i._canUndo=!0;i.saveState();d=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendEvent();try{var h=2,c=3,p=i._rowHeader,tt=p?t.getColumnCount(h):t.getColumnCount(c),a=t._scrollLeftCol,w=a;for(u=a-1;u>=t.frozenColCount;u--){if(t.getColumnVisible(u)&&t._getZoomColumnWidth(u)>0)break;t.getColumnResizable(u)&&(w=u)}for(f=k,e=i._size,v=0;v<b;v++){var g=o[v],it=g.firstCol,rt=g.lastCol;for(r=it;r<=rt;r++)0<=r&&r<tt&&(p&&t.getColumnResizable(r,h)&&e!==t._getActualColumnWidth(r,h)?t.setColumnWidth(r,e,h):!p&&t.getColumnResizable(r,c)&&e!==t._getActualColumnWidth(r,c)&&t.setColumnWidth(r,e,c),f=l(r,f))}f!==k&&f<=a&&w!==a&&(t._scrollLeftCol=w)}finally{t.resumeEvent();t.isPaintSuspended(d);nt=i._resumeInvalidate(n);nt||(t.invalidateLayout(),t.repaint())}t.triggerColumnWidthChanged({sheet:t,sheetName:t._name,colList:y,header:i._rowHeader});t._syncHScollbarPosition()}},t.prototype.saveState=function(){var r=this,e=[],o=[],u=r._sheet,s=r._columns,h=s&&s.length,n,t;if(u&&h>0){var c=r._rowHeader,y=c?2:3,w=u.getColumnCount(y),b=c?u.defaults.rowHeaderColWidth:u.defaults.colWidth,l=u._sheetModelManager.getColInfos();for(n=0;n<h;n++){var a=s[n],v=a.firstCol,k=a.lastCol,f,d,i;for(e[n]=[],o[n]=[],t=v;t<=k;t++)f=t-v,0<=t&&t<w?(i=l.getActualSize(t),i=isNaN(i)||i===null?b:p(i),e[n][f]=i,o[n][f]=l.getVisible(t)):(e[n][f]=-1,o[n][f]=!1)}}r._oldSizes=e;r._oldVisibles=o},t.prototype.undo=function(n){var r=this,f=!1,t=r._sheet,h=r._columns,p=h&&h.length,y,c,w,u,i,b;if(t&&p>0){if(r._suspendInvalidate(n),y=r._getColumnsReiszed(h),c={sheet:t,sheetName:t._name,colList:y,header:r._rowHeader,cancel:!1},t.triggerColumnWidthChanging(c),c&&c.cancel===!0)return r._resumeInvalidate(n),!1;w=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendEvent();try{var l=2,e=3,o=r._rowHeader,k=o?t.getColumnCount(2):t.getColumnCount(e),a,s;for(u=0;u<p;u++){var v=h[u],d=v.firstCol,g=v.lastCol;for(i=d;i<=g;i++)a=r._oldSizes[u][i-v.firstCol],s=r._oldVisibles[u][i-v.firstCol],0<=i&&i<k&&a!==-1&&(o&&t.getColumnResizable(i,l)?(t.setColumnWidth(i,a,l),f=!0):!o&&t.getColumnResizable(i,e)&&(t.setColumnWidth(i,a,e),f=!0),o&&t.getColumnVisible(i,l)!==s?(t.setColumnVisible(i,s,l),f=!0):o||t.getColumnVisible(i,e)===s||(t.setColumnVisible(i,s,e),f=!0))}}finally{t.resumeEvent();t.isPaintSuspended(w);b=r._resumeInvalidate(n);b||(t.invalidateLayout(),t.repaint())}t.triggerColumnWidthChanged({sheet:t,sheetName:t._name,colList:y,header:r._rowHeader})}return f},t.prototype._getColumnsReiszed=function(n){for(var t,r=[],i=0,f=n.length;i<f;i++){var u=n[i],e=u.firstCol,o=u.lastCol;for(t=e;t<=o;t++)r.push(t)}return r},t.prototype.canUndo=function(){return this._canUndo},t}(f);i.ColumnResizeUndoAction=ft;et=function(n){function t(t,i,r,u){n.call(this);var f=this;f._sheet=t;f._rows=i;f._size=r;f._columnHeader=u;f._oldSizes=[];f._oldVisibles=[]}return __extends(t,n),t.prototype.canExecute=function(n){return!0},t.prototype.execute=function(n){var i=this,t=i._sheet,o=i._rows,b=o&&o.length,k=Number.MAX_VALUE,y,s,d,u,f,e,v,r,nt;if(t&&b>0){if(i._suspendInvalidate(n),y=i._getRowsReiszed(o),s={sheet:t,sheetName:t._name,rowList:y,header:i._columnHeader,cancel:!1},t.triggerRowHeightChanging(s),s&&s.cancel===!0){i._canUndo=!1;i._resumeInvalidate(n);return}else i._canUndo=!0;i.saveState();d=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendEvent();t.suspendCalcService();try{var h=3,c=1,p=i._columnHeader,tt=p?t.getRowCount(c):t.getRowCount(h),a=t._scrollTopRow,w=a;for(u=a-1;u>=t.frozenRowCount;u--){if(t.getRowVisible(u)&&t._getZoomRowHeight(u)>0)break;t.getRowResizable(u)&&(w=u)}for(f=k,e=i._size,v=0;v<b;v++){var g=o[v],it=g.firstRow,rt=g.lastRow;for(r=it;r<=rt;r++)0<=r&&r<tt&&(p&&t.getRowResizable(r,c)&&e!==t._getActualRowHeight(r,c)?t.setRowHeight(r,e,c):!p&&t.getRowResizable(r,h)&&e!==t._getActualRowHeight(r,h)&&t.setRowHeight(r,e,h),f=l(r,f))}f!==k&&f<=a&&w!==a&&(t._scrollTopRow=w)}finally{t.resumeCalcService(!1);t.resumeEvent();t.isPaintSuspended(d);nt=i._resumeInvalidate(n);nt||(t.invalidateLayout(),t.repaint())}t.triggerRowHeightChanged({sheet:t,sheetName:t._name,rowList:y,header:i._columnHeader});t._syncVScrollbarPosition()}},t.prototype.saveState=function(){var r=this,e=[],o=[],u=r._sheet,s=r._rows,h=s&&s.length,n,t;if(u&&h>0){var c=r._columnHeader,y=c?1:3,w=u.getRowCount(y),b=c?u.defaults.colHeaderRowHeight:u.defaults.rowHeight,l=u._sheetModelManager.getRowInfos();for(n=0;n<h;n++){var a=s[n],v=a.firstRow,k=a.lastRow,f,d,i;for(e[n]=[],o[n]=[],t=v;t<=k;t++)f=t-v,0<=t&&t<w?(i=l.getActualSize(t),i=isNaN(i)||i===null?b:p(i),e[n][f]=i,o[n][f]=l.getVisible(t)):(e[n][f]=-1,o[n][f]=!1)}}r._oldVisibles=o;r._oldSizes=e},t.prototype.undo=function(n){var r=this,f=!1,t=r._sheet,c=r._rows,p=c&&c.length,v,l,w,u,i,k;if(t&&p>0){if(r._suspendInvalidate(n),v=r._getRowsReiszed(c),l={sheet:t,sheetName:t._name,rowList:v,header:r._columnHeader,cancel:!1},t.triggerRowHeightChanging(l),l&&l.cancel===!0)return r._resumeInvalidate(n),!1;w=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendEvent();t.suspendCalcService();try{var e=3,o=1,s=r._columnHeader,d=s?t.getRowCount(o):t.getRowCount(e),g=r._oldSizes,nt=r._oldVisibles,a,h;for(u=0;u<p;u++){var b=c[u],y=b.firstRow,tt=b.lastRow;for(i=y;i<=tt;i++)a=g[u][i-y],h=nt[u][i-y],0<=i&&i<d&&a!==-1&&(s&&t.getRowResizable(i,o)?(t.setRowHeight(i,a,o),f=!0):!s&&t.getRowResizable(i,e)&&(t.setRowHeight(i,a,e),f=!0),s&&t.getRowVisible(i,o)!==h?(t.setRowVisible(i,h,o),f=!0):s||t.getRowVisible(i,e)===h||(t.setRowVisible(i,h,e),f=!0))}}finally{t.resumeCalcService(!1);t.resumeEvent();t.isPaintSuspended(w);k=r._resumeInvalidate(n);k||(t.invalidateLayout(),t.repaint())}t.triggerRowHeightChanged({sheet:t,sheetName:t._name,rowList:v,header:r._columnHeader})}return f},t.prototype._getRowsReiszed=function(n){for(var t,r=[],i=0,f=n.length;i<f;i++){var u=n[i],e=u.firstRow,o=u.lastRow;for(t=e;t<=o;t++)r.push(t)}return r},t.prototype.canUndo=function(){return this._canUndo},t}(f);i.RowResizeUndoAction=et;ot=function(n){function i(t,i,r,u){n.call(this);var f=this;f._sheet=t;f._columns=i;f._sheetArea=r?2:3;arguments.length===3&&(u=t._getAutoFitType());f._autofitType=u;f._oldSizes=[];f._oldVisibles=[]}return __extends(i,n),i.prototype.canExecute=function(n){return this._sheet&&this._columns&&this._columns.length>0},i.prototype.execute=function(n){var r=this,i,e,w,a,u,c,f,b;if(r.canExecute(n)){i=r._sheet;e=r._sheetArea;r._suspendInvalidate(n);var v=r._getColumnsReiszed(r._columns),y=e===2,l={sheet:i,sheetName:i._name,colList:v,header:y,cancel:!1};if(i.triggerColumnWidthChanging(l),l&&l.cancel===!0){r._canUndo=!1;r._resumeInvalidate(n);return}else r._canUndo=!0;r.saveState();var p=i.getColumnCount(e),s=p-1,h=0,o;for(u=0,c=r._columns.length;u<c;u++)o=r._columns[u].col,s=s>o?o:s,h=h<o?o:h;t._CacheMgr.startCache(i,0,s,i.getRowCount()-1,h);w=i.isPaintSuspended();i.isPaintSuspended(!0);i.suspendEvent();try{for(u=0,c=r._columns.length;u<c;u++)f=r._columns[u],0<=f.col&&f.col<p&&i.getColumnResizable(f.col,e)&&(a=r._getColumnAutoFitValue(f.col),a!==i.getColumnWidth(f.col,e)&&i.setColumnWidth(f.col,a,e))}finally{t._CacheMgr.clearCache();i.resumeEvent();i.isPaintSuspended(w);b=r._resumeInvalidate(n);b||(i.invalidateLayout(),i.repaint())}i.triggerColumnWidthChanged({sheet:i,sheetName:i._name,colList:v,header:y})}},i.prototype.saveState=function(){var n=this,u=r,f=r,e=n._sheet,o=n._sheetArea,s,t,h,i;if(e&&n._columns&&n._columns.length>0)for(s=e.getColumnCount(o),u=[n._columns.length],f=[n._columns.length],t=0,h=n._columns.length;t<h;t++)i=n._columns[t],0<=i.col&&i.col<s?(u[t]=e.getColumnWidth(i.col,o),f[t]=e.getColumnVisible(i.col,o)):(u[t]=-1,f[t]=!1);n._oldSizes=u;n._oldVisibles=f},i.prototype.undo=function(n){var i=this,c=!1,u=i._sheetArea,o,t,s,f,l,a,h,v,r,e,y;if(i._sheet&&i._columns&&i._columns.length>0){if(o=u===2,t=i._sheet,i._suspendInvalidate(n),s=i._getColumnsReiszed(i._columns),f={sheet:t,sheetName:t._name,colList:s,header:o,cancel:!1},t.triggerColumnWidthChanging(f),f&&f.cancel===!0)return i._resumeInvalidate(n),!1;l=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendEvent();try{for(a=t.getColumnCount(u),r=0;r<i._columns.length;r++)e=i._columns[r],h=i._oldSizes[r],v=i._oldVisibles[r],0<=r&&r<a&&h!==-1&&t.getColumnResizable(e.col,u)&&(t.setColumnWidth(e.col,h,u),t.setColumnVisible(e.col,v,u),c=!0)}finally{t.resumeEvent();t.isPaintSuspended(l);y=i._resumeInvalidate(n);y||(t.invalidateLayout(),t.repaint())}t.triggerColumnWidthChanged({sheet:t,sheetName:t._name,colList:s,header:o})}return c},i.prototype._getColumnsReiszed=function(n){for(var r,i=[],t=0;t<n.length;t++)r=n[t],i.push(r.col);return i},i.prototype._getColumnAutoFitValue=function(n){return t.util.getColumnAutoFitValue(n,this._sheet,this._sheetArea,this._autofitType)},i.prototype.canUndo=function(){return this._canUndo},i}(f);i.ColumnAutoFitUndoAction=ot;st=function(n){function i(t,i,r,u){n.call(this);var f=this;f._sheet=t;f._rows=i;f._sheetArea=r?1:3;arguments.length===3&&(u=t._getAutoFitType());f._autofitType=u;f._oldSizes=[];f._oldVisibles=[]}return __extends(i,n),i.prototype.canExecute=function(n){return this._sheet&&this._rows&&this._rows.length>0},i.prototype.execute=function(n){var i=this,t,c,l,o,f,a,r,v;if(i.canExecute(n)){t=i._sheet;i._suspendInvalidate(n);var s=i._getRowsResized(i._rows),u=i._sheetArea,h=i._sheetArea===1,e={sheet:t,sheetName:t._name,rowList:s,header:h,cancel:!1};if(t.triggerRowHeightChanging(e),e&&e.cancel===!0){i._canUndo=!1;i._resumeInvalidate(n);return}else i._canUndo=!0;i.saveState();c=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendEvent();t.suspendCalcService();try{for(l=t.getRowCount(u),f=0,a=i._rows.length;f<a;f++)r=i._rows[f],0<=r.row&&r.row<l&&t.getRowResizable(r.row,u)&&(o=i._getRowAutoFitValue(r.row),o!==t.getRowHeight(r.row,u)&&t.setRowHeight(r.row,o,u))}finally{t.resumeCalcService(!1);t.resumeEvent();t.isPaintSuspended(c);v=i._resumeInvalidate(n);v||(t.invalidateLayout(),t.repaint())}t.triggerRowHeightChanged({sheet:t,sheetName:t._name,rowList:s,header:h})}},i.prototype.saveState=function(){var n=this,u=r,f=r,e=n._sheet,o=n._sheetArea,s,t,h,i;if(e&&n._rows&&n._rows.length>0)for(u=[n._rows.length],f=[n._rows.length],s=e.getRowCount(o),t=0,h=n._rows.length;t<h;t++)i=n._rows[t],0<=i.row&&i.row<s?(u[t]=e.getRowHeight(i.row,o),f[t]=e.getRowVisible(i.row,o)):(u[t]=-1,f[t]=!1);n._oldSizes=u;n._oldVisibles=f},i.prototype.undo=function(n){var i=this,h=!1,t=i._sheet,u=i._sheetArea,c=i._sheetArea===1,o,f,l,s,a,v,r,y,e,p;if(t&&i._rows&&i._rows.length>0){if(i._suspendInvalidate(n),o=i._getRowsResized(i._rows),f={sheet:t,sheetName:t._name,rowList:o,header:c,cancel:!1},t.triggerRowHeightChanging(f),f&&f.cancel===!0)return i._resumeInvalidate(n),!1;l=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendEvent();t.suspendCalcService();try{for(v=t.getRowCount(u),r=0,y=i._rows.length;r<y;r++)e=i._rows[r],s=i._oldSizes[r],a=i._oldVisibles[r],0<=r&&r<v&&s!==-1&&t.getRowResizable(e.row,u)&&(t.setRowHeight(e.row,s,u),t.setRowVisible(e.row,a,u),h=!0)}finally{t.resumeCalcService(!1);t.resumeEvent();t.isPaintSuspended(l);p=i._resumeInvalidate(n);p||(t.invalidateLayout(),t.repaint())}t.triggerRowHeightChanged({sheet:t,sheetName:t._name,rowList:o,header:c})}return h},i.prototype._getRowsResized=function(n){for(var r,i=[],t=0,u=n.length;t<u;t++)r=n[t],i.push(r.row);return i},i.prototype._getRowAutoFitValue=function(n){return t.util.getRowAutoFitValue(n,this._sheet,this._sheetArea,this._autofitType)},i.prototype.canUndo=function(){return this._canUndo},i}(f);i.RowAutoFitUndoAction=st;ht=function(){function n(n,t){this.index=n;this.count=t}return n}();i.GroupExtent=ht;ct=function(n){function i(t,i){n.call(this);this._sheet=t;this._columnGroupExtent=i;this._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(n){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,u,f,e;t.features.group&&r&&i._columnGroupExtent&&r.colRangeGroup&&(i._suspendInvalidate(n),u=i._columnGroupExtent.index,f=i._columnGroupExtent.count,r.colRangeGroup.group(u,f),e=i._resumeInvalidate(n),e||(r.invalidateLayout(),r.repaint()),i._canUndo=!0)},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){},i.prototype.undo=function(n){var i=this,u=!1,r=i._sheet,f,e,o;return t.features.group&&r&&i._columnGroupExtent&&r.colRangeGroup&&(i._suspendInvalidate(n),f=i._columnGroupExtent.index,e=i._columnGroupExtent.count,r.colRangeGroup.ungroupRange(f,e),u=!0,o=i._resumeInvalidate(n),o||(r.invalidateLayout(),r.repaint())),u},i}(f);i.ColumnGroupUndoAction=ct;lt=function(n){function i(t,i){n.call(this);this._sheet=t;this._columnUngroupExtent=i;this._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(n){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,u,f,e;t.features.group&&r&&i._columnUngroupExtent&&r.colRangeGroup&&(u=i._columnUngroupExtent.index,f=i._columnUngroupExtent.count,r.colRangeGroup.getLevel(u)>=0||r.colRangeGroup.getLevel(u+f-1)>=0?(i._suspendInvalidate(n),i._canUndo=!0,r.colRangeGroup.ungroupRange(u,f),e=i._resumeInvalidate(n),e||(r.invalidateLayout(),r.repaint())):i._canUndo=!1)},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){},i.prototype.undo=function(n){var i=this,u=!1,r=i._sheet,f,e,o;return t.features.group&&i._canUndo===!0&&r&&i._columnUngroupExtent&&r.colRangeGroup&&(i._suspendInvalidate(n),f=i._columnUngroupExtent.index,e=i._columnUngroupExtent.count,r.colRangeGroup.group(f,e),u=!0,o=i._resumeInvalidate(n),o||(r.invalidateLayout(),r.repaint())),u},i}(f);i.ColumnUngroupUndoAction=lt;at=function(n){function i(t,i){n.call(this);this._sheet=t;this._rowGroupExtent=i;this._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(n){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,u,f,e;t.features.group&&r&&i._rowGroupExtent&&r.rowRangeGroup&&(i._suspendInvalidate(n),u=i._rowGroupExtent.index,f=i._rowGroupExtent.count,r.rowRangeGroup.group(u,f),e=i._resumeInvalidate(n),e||(r.invalidateLayout(),r.repaint()),i._canUndo=!0)},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){},i.prototype.undo=function(n){var i=this,u=!1,r=i._sheet,f,e,o;return t.features.group&&r&&i._rowGroupExtent&&r.rowRangeGroup&&(i._suspendInvalidate(n),f=i._rowGroupExtent.index,e=i._rowGroupExtent.count,r.rowRangeGroup.ungroupRange(f,e),u=!0,o=i._resumeInvalidate(n),o||(r.invalidateLayout(),r.repaint())),u},i}(f);i.RowGroupUndoAction=at;vt=function(n){function i(t,i){n.call(this);this._sheet=t;this._rowUngroupExtent=i;this._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(n){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,u,f,e;t.features.group&&r&&i._rowUngroupExtent&&r.rowRangeGroup&&(u=i._rowUngroupExtent.index,f=i._rowUngroupExtent.count,r.rowRangeGroup.getLevel(u)>=0||r.rowRangeGroup.getLevel(u+f-1)>=0?(i._suspendInvalidate(n),i._canUndo=!0,r.rowRangeGroup.ungroupRange(u,f),e=i._resumeInvalidate(n),e||(r.invalidateLayout(),r.repaint())):i._canUndo=!1)},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){},i.prototype.undo=function(n){var i=this,u=!1,r=i._sheet,f,e,o;return t.features.group&&i._canUndo===!0&&r&&i._rowUngroupExtent&&r.rowRangeGroup&&(i._suspendInvalidate(n),f=i._rowUngroupExtent.index,e=i._rowUngroupExtent.count,r.rowRangeGroup.group(f,e),u=!0,o=i._resumeInvalidate(n),o||(r.invalidateLayout(),r.repaint())),u},i}(f);i.RowUngroupUndoAction=vt;yt=function(){function n(n,t,i){this.index=n;this.level=t;this.collapsed=i}return n}();i.GroupExpandExtent=yt;pt=function(n){function i(t,i){n.call(this);this._sheet=t;this._columnExpandExtent=i;this._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,f,u,e;t.features.group&&r&&i._columnExpandExtent&&r.colRangeGroup&&(i._suspendInvalidate(n),f=i._columnExpandExtent.index,u=i._columnExpandExtent.collapsed,r.colRangeGroup.setCollapsed(f,u),i._showColumnRangeGroup(u),e=i._resumeInvalidate(n),e||(r.invalidateLayout(),r.repaint()),i._canUndo=!0)},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){},i.prototype.undo=function(n){var i=this,f=!1,r=i._sheet,e,u,o;return t.features.group&&r&&i._columnExpandExtent&&r.colRangeGroup&&(i._suspendInvalidate(n),e=i._columnExpandExtent.index,u=i._columnExpandExtent.collapsed,r.colRangeGroup.setCollapsed(e,!u),f=!0,i._showColumnRangeGroup(!u),o=i._resumeInvalidate(n),o||(r.invalidateLayout(),r.repaint())),f},i.prototype._showColumnRangeGroup=function(n){var r=this,t=r._sheet,f=r._columnExpandExtent.index,o,u,e,s,i,h,c,a;if(!(f<0)&&!(f>=t.getColumnCount())){if(t.colRangeGroup.direction===1){if(o=t.colRangeGroup.find(f-1,r._columnExpandExtent.level),!o)return;u=o.start;e=f;s=1;n?u=f:u<t.frozenColCount&&(u=t.frozenColCount);i=t.getViewportLeftColumn(s);u<i&&(i=u);h=t.getViewportWidth(s);c=r._getColsTotalWidth(t,i,e);c>h&&(i=r._getNewLeftColumn(t,i,c-h));t._scrollLeftCol=r._tryGetNextScrollableCol(t,i)}else{if(o=t.colRangeGroup.find(f+1,r._columnExpandExtent.level),!o)return;u=f;e=o.end;s=1;n?e=f:(a=t.getColumnCount(),e>=a&&(e=a-1));i=t.getViewportLeftColumn(s);u<i?t._scrollLeftCol=r._tryGetNextScrollableCol(t,u):(h=t.getViewportWidth(s),c=r._getColsTotalWidth(t,i,e),c>h&&(i=r._getNewLeftColumn(t,i,c-h),t._scrollLeftCol=r._tryGetNextScrollableCol(t,l(u,i))))}t._syncHScollbarPosition()}},i.prototype._getColsTotalWidth=function(n,t,i){for(var u=0,f=n.getColumnCount(),r=t;r<=i&&r<f;r++)u+=n.getColumnWidth(r)*n._zoomFactor;return u},i.prototype._getNewLeftColumn=function(n,t,i){for(var f=0,r=n.getColumnCount(),u=t;u<r&&f<i;u++)t++,f+=n.getColumnWidth(u)*n._zoomFactor;return t>=r?r-1:t},i.prototype._tryGetNextScrollableCol=function(n,t){var u=n.frozenColCount,r=n.getColumnCount()-1,i,f;if(t<u)return u;if(t>r)return r;for(i=t;i<=r;i++)if(f=n.getColumnWidth(i),f>0)return i;return-1},i}(f);i.ColumnGroupExpandUndoAction=pt;wt=function(n){function i(t,i){n.call(this);this._sheet=t;this._rowExpandExtent=i;this._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,f,u,e;t.features.group&&r&&i._rowExpandExtent&&r.rowRangeGroup&&(i._suspendInvalidate(n),f=i._rowExpandExtent.index,u=i._rowExpandExtent.collapsed,r.rowRangeGroup.setCollapsed(f,u),i._showRowRangeGroup(u),e=i._resumeInvalidate(n),e||(r.invalidateLayout(),r.repaint()),i._canUndo=!0)},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){},i.prototype.undo=function(n){var i=this,f=!1,r=i._sheet,e,u,o;return t.features.group&&r&&i._rowExpandExtent&&r.rowRangeGroup&&(i._suspendInvalidate(n),e=i._rowExpandExtent.index,u=i._rowExpandExtent.collapsed,r.rowRangeGroup.setCollapsed(e,!u),f=!0,i._showRowRangeGroup(!u),o=i._resumeInvalidate(n),o||(r.invalidateLayout(),r.repaint())),f},i.prototype._showRowRangeGroup=function(n){var r=this,t=r._sheet,f=r._rowExpandExtent.index,o,u,e,s,i,h,c,a;if(!(f<0)&&!(f>=t.getRowCount())){if(t.rowRangeGroup.direction===1){if(o=t.rowRangeGroup.find(f-1,r._rowExpandExtent.level),!o)return;u=o.start;e=f;s=1;n?u=f:u<t.frozenRowCount&&(u=t.frozenRowCount);i=t.getViewportTopRow(s);u<i&&(i=u);h=t.getViewportHeight(s);c=r._getRowsTotalHeight(t,i,e);c>h&&(i=r._getNewTopRow(t,i,c-h));t._scrollTopRow=r._tryGetNextScrollableRow(t,i)}else{if(o=t.rowRangeGroup.find(f+1,r._rowExpandExtent.level),!o)return;u=f;e=o.end;s=1;n?e=f:(a=t.getRowCount(),e>=a&&(e=a-1));i=t.getViewportTopRow(s);u<i?t._scrollTopRow=r._tryGetNextScrollableRow(t,u):(h=t.getViewportHeight(s),c=r._getRowsTotalHeight(t,i,e),c>h&&(i=r._getNewTopRow(t,i,c-h),t._scrollTopRow=r._tryGetNextScrollableRow(t,l(u,i))))}t._syncVScrollbarPosition()}},i.prototype._getRowsTotalHeight=function(n,t,i){for(var u=0,f=n.getRowCount(),r=t;r<=i&&r<f;r++)u+=n.getRowHeight(r)*n._zoomFactor;return u},i.prototype._getNewTopRow=function(n,t,i){for(var f=0,r=n.getRowCount(),u=t;u<=r&&f<i;u++)t++,f+=n.getRowHeight(u)*n._zoomFactor;return t>=r?r-1:t},i.prototype._tryGetNextScrollableRow=function(n,t){var u=n.frozenRowCount,r=n.getRowCount()-1,i,f;if(t<u)return u;if(t>r)return r;for(i=t;i<=r;i++)if(f=n.getRowHeight(i),f>0)return i;return-1},i}(f);i.RowGroupExpandUndoAction=wt;bt=function(){function n(n){this.level=n}return n}();i.GroupHeaderExpandExtent=bt;kt=function(n){function i(t,i){n.call(this);var r=this;r._sheet=t;r._columnGroupHeaderExpandExtent=i;r._oldStatus={};r._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,f,u,e;if(t.features.group&&r&&i._columnGroupHeaderExpandExtent&&r.colRangeGroup){for(i._suspendInvalidate(n),i.saveState(),f=i._columnGroupHeaderExpandExtent.level,u=0;u<f;u++)r.colRangeGroup.expand(u,!0);r.colRangeGroup.expand(f,!1);e=i._resumeInvalidate(n);e||(r.invalidateLayout(),r.repaint());i._canUndo=!0}},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){var u=this,f=r,t=u._sheet,s,e,n,i,h;if(t&&u._columnGroupHeaderExpandExtent&&t.colRangeGroup)for(s=u._columnGroupHeaderExpandExtent.level,f={},e=0;e<=s;e++)for(var o=0,c=t.getColumnCount(),l=t.colRangeGroup.direction;o<c;){if(n=t.colRangeGroup.find(o,e),n){i=-1;switch(l){case 0:i=n.start-1;break;case 1:i=n.end+1;break;default:break}h=n.getState()===1;f[i]||(f[i]=h);o+=n.end-n.start+1}o++}u._oldStatus=f},i.prototype.undo=function(n){var i=this,f=!1,r=i._sheet,u,e;if(t.features.group&&r&&i._oldStatus&&r.colRangeGroup){i._suspendInvalidate(n);for(u in i._oldStatus)u&&(r.colRangeGroup.setCollapsed(u,i._oldStatus[u]),f=!0);e=i._resumeInvalidate(n);e||(r.invalidateLayout(),r.repaint())}return f},i}(f);i.ColumnGroupHeaderExpandUndoAction=kt;dt=function(n){function i(t,i){n.call(this);var r=this;r._sheet=t;r._rowGroupHeaderExpandExtent=i;r._oldStatus={};r._canUndo=!1}return __extends(i,n),i.prototype.canExecute=function(){return!0},i.prototype.execute=function(n){var i=this,r=i._sheet,f,u,e;if(t.features.group&&r&&i._rowGroupHeaderExpandExtent&&r.rowRangeGroup){for(i._suspendInvalidate(n),i.saveState(),f=i._rowGroupHeaderExpandExtent.level,u=0;u<f;u++)r.rowRangeGroup.expand(u,!0);r.rowRangeGroup.expand(f,!1);e=i._resumeInvalidate(n);e||(r.invalidateLayout(),r.repaint());i._canUndo=!0}},i.prototype.canUndo=function(){return this._canUndo},i.prototype.saveState=function(){var u=this,f=r,t=u._sheet,s,e,n,i,h;if(t&&u._rowGroupHeaderExpandExtent&&t.rowRangeGroup)for(s=u._rowGroupHeaderExpandExtent.level,f={},e=0;e<=s;e++)for(var o=0,c=t.getRowCount(),l=t.rowRangeGroup.direction;o<c;){if(n=t.rowRangeGroup.find(o,e),n){i=-1;switch(l){case 0:i=n.start-1;break;case 1:i=n.end+1;break;default:break}h=n.getState()===1;f[i]||(f[i]=h);o+=n.end-n.start+1}o++}u._oldStatus=f},i.prototype.undo=function(n){var i=this,f=!1,r=i._sheet,u,e;if(t.features.group&&r&&i._oldStatus&&r.rowRangeGroup){i._suspendInvalidate(n);for(u in i._oldStatus)u&&(r.rowRangeGroup.setCollapsed(u,i._oldStatus[u]),f=!0);e=i._resumeInvalidate(n);e||(r.invalidateLayout(),r.repaint())}return f},i}(f);i.RowGroupHeaderExpandUndoAction=dt;gt=function(){function n(n,t,i,r,u,f){var e=this;e.fromRow=n;e.fromColumn=t;e.toRow=i;e.toColumn=r;e.rowCount=u;e.columnCount=f}return n}();i.DragDropExtent=gt;ni=function(n){function i(t,i,r,u,f){n.call(this);var e=this;e._sheet=t;e._dragDropExtent=i;e._copy=r;e._insert=u;e._option=f}return __extends(i,n),i.prototype.canExecute=function(n){var u=this,r=u._sheet,i=u._dragDropExtent;return r._isValidRange(i.fromRow,i.fromColumn,i.rowCount,i.columnCount,u._sheet.getRowCount(),u._sheet.getColumnCount())?!u._insert&&!r._isValidRange(i.toRow,i.toColumn,i.rowCount,i.columnCount,u._sheet.getRowCount(),u._sheet.getColumnCount())?!1:!(r.isProtected&&r._isAnyCellInRangeLocked(new t.Range(i.toRow,i.toColumn,i.rowCount,i.columnCount)))&&r._checkArrayFormula(i.toRow,i.toColumn,i.rowCount,i.columnCount)&&!(r.isProtected&&r._isAnyCellInRangeLocked(new t.Range(i.fromRow,i.fromColumn,i.rowCount,i.columnCount)))&&r._checkArrayFormula(i.fromRow,i.fromColumn,i.rowCount,i.columnCount):!1},i.prototype.execute=function(n){var r=this,i=r._sheet,f,s,o,a,v,rt,ut,k,d,y,tt,it,p;if(r.saveState(),r._insert){if(rt=r._dragDropExtent.fromRow,ut=r._dragDropExtent.fromColumn,ut>=0&&rt<0){f=r._dragDropExtent.fromColumn;s=r._dragDropExtent.toColumn;o=r._dragDropExtent.columnCount;k=r._dragDropExtent.toColumn;r._suspendInvalidate(n);y=i.isPaintSuspended();i.isPaintSuspended(!0);try{r._sheet.addColumns(s,o);r._copy?r._sheet.copyTo(-1,s<=f?f+o:f,-1,s,-1,o,r._option):(r._sheet.moveTo(-1,s<=f?f+o:f,-1,s,-1,o,r._option),r._sheet.deleteColumns(s<=f?f+o:f,o),f<s&&(k=s-o));i&&(a=i.getSelections(),i._clearSelectionImp(),i.addSelection(-1,k,i.getRowCount(),o),v=i.getSelections(),i.triggerSelectionChanging({sheet:i,sheetName:i._name,oldSelections:a,newSelections:v}),i.triggerSelectionChanged({sheet:i,sheetName:i._name}),i._setActiveCellImp(i._getFirstVisualRow(),k,i.activeRowViewportIndex,i.activeColViewportIndex))}finally{i._dragRect={};i.isPaintSuspended(y);p=r._resumeInvalidate(n);p||(i.invalidateLayout(),i.repaint())}}else if(r._dragDropExtent.fromRow>=0&&r._dragDropExtent.fromColumn<0){f=r._dragDropExtent.fromRow;s=r._dragDropExtent.toRow;o=r._dragDropExtent.rowCount;d=r._dragDropExtent.toRow;r._suspendInvalidate(n);y=i.isPaintSuspended();i.isPaintSuspended(!0);try{r._sheet.addRows(s,o);r._copy?r._sheet.copyTo(s<=f?f+o:f,-1,s,-1,o,-1,r._option):(r._sheet.moveTo(s<=f?f+o:f,-1,s,-1,o,-1,r._option),r._sheet.deleteRows(s<=f?f+o:f,o),f<s&&(d=s-o));i&&(a=i.getSelections(),i._clearSelectionImp(),i.addSelection(d,-1,o,i.getColumnCount()),v=i.getSelections(),i.triggerSelectionChanging({sheet:i,sheetName:i._name,oldSelections:a,newSelections:v}),i.triggerSelectionChanged({sheet:i,sheetName:i._name}),i._setActiveCellImp(d,i._getFirstVisualColumn(),i.activeRowViewportIndex,i.activeColViewportIndex))}finally{i._dragRect={};i.isPaintSuspended(y);p=r._resumeInvalidate(n);p||(i.invalidateLayout(),i.repaint())}}}else{var g=r._dragDropExtent.fromRow,nt=r._dragDropExtent.fromColumn,w=r._dragDropExtent.toRow,b=r._dragDropExtent.toColumn,c=r._dragDropExtent.rowCount,l=r._dragDropExtent.columnCount;r._suspendInvalidate(n);y=i.isPaintSuspended();i.isPaintSuspended(!0);try{r._copy?i.copyTo(g,nt,w,b,c,l,r._option):i.moveTo(g,nt,w,b,c,l,r._option);i&&(a=i.getSelections(),i._clearSelectionImp(),i.addSelection(w,b,c,l),v=i.getSelections(),i.triggerSelectionChanging({sheet:i,sheetName:i._name,oldSelections:a,newSelections:v}),i.triggerSelectionChanged({sheet:i,sheetName:i._name}),i._setActiveCellImp(e(i._getFirstVisualRow(),w),e(i._getFirstVisualColumn(),b),i.activeRowViewportIndex,i.activeColViewportIndex),tt=r._savedFromViewportCells,!r._copy&&tt&&tt.isValueOrFormulaSaved()&&(r._savedFromAfterPastedChangedCells=new h(r._sheet,new t.Range(g,nt,c,l),r._option),r._savedFromAfterPastedChangedCells.mergeCellsHasDiffData(r._savedFromBeforePastedChangedCells.getCellsHasData()),u.raiseRangeDataChanged(i,g,nt,c,l,r._savedFromAfterPastedChangedCells.getChangedCells(),0,tt.getValues())),it=r._savedToViewportCells,it&&it.isValueOrFormulaSaved()&&(r._savedToAfterPastedChangedCells=new h(r._sheet,new t.Range(w,b,c,l),r._option),r._savedToAfterPastedChangedCells.mergeCellsHasDiffData(r._savedToBeforePastedChangedCells.getCellsHasData()),u.raiseRangeDataChanged(i,w,b,c,l,r._savedToAfterPastedChangedCells.getChangedCells(),0,it.getValues())))}finally{i._dragRect={};i.isPaintSuspended(y);p=r._resumeInvalidate(n);p||(i.invalidateLayout(),i.repaint())}}},i.prototype.saveState=function(){var n=this,w,b,k,d,g,nt,tt,it,rt,e,s,c;n.initSaveState();var f=n._dragDropExtent.fromRow<0?0:n._dragDropExtent.fromRow,l=n._dragDropExtent.fromColumn<0?0:n._dragDropExtent.fromColumn,y=n._dragDropExtent.toRow<0?0:n._dragDropExtent.toRow,p=n._dragDropExtent.toColumn<0?0:n._dragDropExtent.toColumn,i=n._dragDropExtent.fromRow<0?n._sheet.getRowCount():n._dragDropExtent.rowCount,r=n._dragDropExtent.fromColumn<0?n._sheet.getColumnCount():n._dragDropExtent.columnCount;n._insert?n._dragDropExtent.fromColumn>=0&&n._dragDropExtent.fromRow>=0||n._dragDropExtent.fromColumn>=0||n._dragDropExtent.fromRow>=0&&(n._copy||n._sheet._hasTable(y,-1,1,-1)&&(e=new o(i,n._sheet.getColumnCount(2)),s=new a(i),u.saveRowHeaderInfo(n._sheet,e,s,f,n._option),n._savedFromRowHeaderCells=e,n._savedFromRows=s,c=new o(i,r),u.saveViewportInfo(n._sheet,c,f,l,n._option),n._savedFromViewportCells=c)):(n._dragDropExtent.fromRow<0&&(w=new o(n._sheet.getRowCount(1),r),b=new v(r),u.saveColumnHeaderInfo(n._sheet,w,b,p,n._option),n._savedToColumnHeaderCells=w,n._savedToColumns=b,n._copy||(k=new o(n._sheet.getRowCount(1),r),d=new v(r),u.saveColumnHeaderInfo(n._sheet,k,d,l,n._option),n._savedFromColumnHeaderCells=k,n._savedFromColumns=d)),n._dragDropExtent.fromColumn<0&&(g=new o(i,n._sheet.getColumnCount(2)),nt=new a(i),u.saveRowHeaderInfo(n._sheet,g,nt,y,n._option),n._savedToRowHeaderCells=g,n._savedToRows=nt,n._copy||(e=new o(i,n._sheet.getColumnCount(2)),s=new a(i),u.saveRowHeaderInfo(n._sheet,e,s,f,n._option),n._savedFromRowHeaderCells=e,n._savedFromRows=s)),tt=new o(i,r),u.saveViewportInfo(n._sheet,tt,y,p,n._option),n._savedToViewportCells=tt,it=[],u.saveTableInfo(n._sheet,it,new t.Range(y,p,i,r)),n._savedToTables=it,n._copy||(c=new o(i,r),u.saveViewportInfo(n._sheet,c,f,l,n._option),n._savedFromViewportCells=c,rt=[],u.saveTableInfo(n._sheet,rt,new t.Range(f,l,i,r)),n._savedFromTables=rt,n._savedFromBeforePastedChangedCells=new h(n._sheet,new t.Range(f,l,i,r),n._option)),n._savedToBeforePastedChangedCells=new h(n._sheet,new t.Range(y,p,i,r),n._option));n._savedAcitveRowViewportIndex=n._sheet.activeRowViewportIndex;n._savedAcitveColumnViewportIndex=n._sheet.activeColViewportIndex;n._savedActiveRow=n._sheet._activeRowIndex;n._savedActiveColumn=n._sheet._activeColIndex},i.prototype.initSaveState=function(){var n=this;n._savedFromColumnHeaderCells=r;n._savedFromColumns=r;n._savedFromViewportCells=r;n._savedFromRowHeaderCells=r;n._savedFromRows=r;n._savedToColumnHeaderCells=r;n._savedToColumns=r;n._savedToViewportCells=r;n._savedToRowHeaderCells=r;n._savedToRows=r;n._savedAcitveRowViewportIndex=-2;n._savedAcitveColumnViewportIndex=-2;n._savedActiveRow=-1;n._savedActiveColumn=-1},i.prototype.undo=function(n){var i=this,f=i._sheet,s,p,w,o,c,h,rt,ut,nt,g,b,it;if(!f._isValidRange(i._dragDropExtent.fromRow,i._dragDropExtent.fromColumn,i._dragDropExtent.rowCount,i._dragDropExtent.columnCount,i._sheet.getRowCount(),i._sheet.getColumnCount())||!i._insert&&!f._isValidRange(i._dragDropExtent.toRow,i._dragDropExtent.toColumn,i._dragDropExtent.rowCount,i._dragDropExtent.columnCount,i._sheet.getRowCount(),i._sheet.getColumnCount()))return!1;if(s=!1,i._insert){if(!(i._dragDropExtent.fromColumn>=0&&i._dragDropExtent.fromRow>=0))if(i._dragDropExtent.fromColumn>=0){rt=i._dragDropExtent.fromColumn;o=i._dragDropExtent.columnCount;i._suspendInvalidate(n);b=f.isPaintSuspended();f.isPaintSuspended(!0);try{i._copy?i._sheet.deleteColumns(i._dragDropExtent.toColumn,o):(c=i._dragDropExtent.toColumn,h=i._dragDropExtent.fromColumn,i._dragDropExtent.fromColumn<i._dragDropExtent.toColumn?c=i._dragDropExtent.toColumn-o:h=i._dragDropExtent.fromColumn+o,i._sheet.addColumns(h,o),i._sheet.copyTo(-1,h<=c?c+o:c,-1,h,-1,o,i._option),i._sheet.deleteColumns(h<=c?c+o:c,o),c<h&&(rt=h-o));f&&(p=f.getSelections(),f._clearSelectionImp(),f.addSelection(-1,rt,f.getRowCount(),o),w=f.getSelections(),f.triggerSelectionChanging({sheet:f,sheetName:f._name,oldSelections:p,newSelections:w}),f.triggerSelectionChanged({sheet:f,sheetName:f._name}))}finally{f.isPaintSuspended(b);nt=i._resumeInvalidate(n);nt||(f.invalidateLayout(),f.repaint())}s=!0}else if(i._dragDropExtent.fromRow>=0){o=i._dragDropExtent.rowCount;ut=i._dragDropExtent.fromRow;i._suspendInvalidate(n);b=f.isPaintSuspended();f.isPaintSuspended(!0);try{i._copy?i._sheet.deleteRows(i._dragDropExtent.toRow,o):(c=i._dragDropExtent.toRow,h=i._dragDropExtent.fromRow,i._dragDropExtent.fromRow<i._dragDropExtent.toRow?c=i._dragDropExtent.toRow-o:h=i._dragDropExtent.fromRow+o,i._sheet.addRows(h,o),i._savedFromViewportCells&&(u.undoCellsInfo(i._sheet,i._savedFromViewportCells,h,0,3),s=!0),i._savedFromRowHeaderCells&&(u.undoCellsInfo(i._sheet,i._savedFromRowHeaderCells,h,0,2),s=!0),i._savedFromRows&&(u.undoRowsInfo(i._sheet,i._savedFromRows,h),s=!0),s||i._sheet.copyTo(h<=c?c+o:c,-1,h,-1,o,-1,i._option),i._sheet.deleteRows(h<=c?c+o:c,o),c<h&&(ut=h-o));f&&(p=f.getSelections(),f._clearSelectionImp(),f.addSelection(ut,-1,o,f.getColumnCount()),w=f.getSelections(),f.triggerSelectionChanging({sheet:f,sheetName:f._name,oldSelections:p,newSelections:w}),f.triggerSelectionChanged({sheet:f,sheetName:f._name}))}finally{f.isPaintSuspended(b);nt=i._resumeInvalidate(n);nt||(f.invalidateLayout(),f.repaint())}s=!0}}else{var k=i._dragDropExtent.fromRow<0?0:i._dragDropExtent.fromRow,d=i._dragDropExtent.fromColumn<0?0:i._dragDropExtent.fromColumn,l=i._dragDropExtent.toRow<0?0:i._dragDropExtent.toRow,a=i._dragDropExtent.toColumn<0?0:i._dragDropExtent.toColumn,v=i._dragDropExtent.fromRow<0?i._sheet.getRowCount():i._dragDropExtent.rowCount,y=i._dragDropExtent.fromColumn<0?i._sheet.getColumnCount():i._dragDropExtent.columnCount;u.clearFormula(f,l,a,v,y);var ft=r,et=r,tt=i._savedFromViewportCells;!i._copy&&tt&&tt.isValueOrFormulaSaved()&&(et=u.getValues(i._sheet,k,d,v,y));g=i._savedToViewportCells;g&&g.isValueOrFormulaSaved()&&(ft=u.getValues(i._sheet,l,a,v,y));i._suspendInvalidate(n);b=f.isPaintSuspended();f.isPaintSuspended(!0);try{i._savedToTables&&u.undoTableInfo(i._sheet,i._savedToTables,new t.Range(l,a,v,y));i._savedToColumnHeaderCells&&(u.undoCellsInfo(i._sheet,i._savedToColumnHeaderCells,0,a,1),s=!0);i._savedToColumns&&(u.undoColumnsInfo(i._sheet,i._savedToColumns,a),s=!0);g&&(u.undoCellsInfo(i._sheet,g,l,a,3),s=!0);i._savedToRowHeaderCells&&(u.undoCellsInfo(i._sheet,i._savedToRowHeaderCells,l,0,2),s=!0);i._savedToRows&&(u.undoRowsInfo(i._sheet,i._savedToRows,l),s=!0);i._savedFromTables&&u.undoTableInfo(i._sheet,i._savedFromTables,new t.Range(k,d,v,y));i._savedFromColumnHeaderCells&&(u.undoCellsInfo(i._sheet,i._savedFromColumnHeaderCells,0,d,1),s=!0);i._savedFromColumns&&(u.undoColumnsInfo(i._sheet,i._savedFromColumns,d),s=!0);tt&&(u.undoCellsInfo(i._sheet,tt,k,d,3),s=!0);i._savedFromRowHeaderCells&&(u.undoCellsInfo(i._sheet,i._savedFromRowHeaderCells,k,0,2),s=!0);i._savedFromRows&&(u.undoRowsInfo(i._sheet,i._savedFromRows,k),s=!0);s&&f&&(p=f.getSelections(),f._clearSelectionImp(),f.addSelection(i._dragDropExtent.fromRow,i._dragDropExtent.fromColumn,i._dragDropExtent.rowCount,i._dragDropExtent.columnCount),w=f.getSelections(),f.triggerSelectionChanging({sheet:f,sheetName:f._name,oldSelections:p,newSelections:w}),f.triggerSelectionChanged({sheet:f,sheetName:f._name}),ft&&u.raiseRangeDataChanged(f,l,a,v,y,i._savedToAfterPastedChangedCells.getChangedCells(),0,ft),et&&u.raiseRangeDataChanged(f,k,d,v,y,i._savedFromAfterPastedChangedCells.getChangedCells(),0,et))}finally{f.isPaintSuspended(b);i._resumeInvalidate(n)}}return s&&f&&(i._savedActiveRow!==-1&&i._savedActiveColumn!==-1&&(it=f.getSelections()[0],it.contains(i._savedActiveRow,i._savedActiveColumn)?f._setActiveCellImp(i._savedActiveRow,i._savedActiveColumn):f._setActiveCellImp(e(f._getFirstVisualRow(),it.row),e(f._getFirstVisualColumn(),it.col))),i._savedAcitveRowViewportIndex!==-2&&i._savedAcitveColumnViewportIndex!==-2&&i._savedActiveRow!==-1&&i._savedActiveColumn!==-1&&f.showCell(i._savedActiveRow,i._savedActiveColumn,3,3),f.invalidateLayout(),f.repaint()),s},i}(f);i.DragDropUndoAction=ni;ti=function(i){function u(n,t){var r,u;i.call(this);this._oldValueCatch={};this._oldValueIsFormulaCatch={};this._eventNS=".cellEditaction";this._sheet=n;this._cellEditInfo=t;this._canUndo=!1;t.ranges&&t.endEditType===1&&(r=t.ranges[0],r.row===-1&&(r.row=0,r.rowCount=n.getRowCount()),r.col===-1&&(r.col=0,r.colCount=n.getColumnCount()),r.rowCount===1&&r.colCount===1&&(u=n._getsArrayFormulas(r.row,r.col,1,1),u&&u.ranges&&u.ranges.length>0&&(t.ranges=[u.ranges[0]])))}return __extends(u,i),u.prototype.canExecute=function(n){var i=this,u,r;if(i._cellEditInfo.ranges){for(u=0;u<i._cellEditInfo.ranges.length;u++)if((r=i._cellEditInfo.ranges[u],i._sheet.isProtected&&i._sheet._isAnyCellInRangeLocked(r))||!i._sheet._checkArrayFormula(r.row,r.col,r.rowCount,r.colCount))return!1}else if(!i._sheet._checkArrayFormula(i._cellEditInfo.row,i._cellEditInfo.col,1,1)||i._sheet.isProtected&&i._sheet._isAnyCellInRangeLocked(new t.Range(i._cellEditInfo.row,i._cellEditInfo.col,1,1)))return!1;return!0},u.prototype.saveState=function(){var n=this;n.iteration(function(t,i){var r=n._sheet.getFormulaInformation(t,i),u=n._positionToString(t,i);r.hasFormula?r.isArrayFormula&&(r.baseRange.row!==t||r.baseRange.col!==i)?n._oldValueIsFormulaCatch[u]=!1:(n._oldValueCatch[u]=r.formula,n._oldValueIsFormulaCatch[u]=r):n._oldValueCatch[u]=n._sheet.getValue(n._cellEditInfo.row,n._cellEditInfo.col)})},u.prototype.iteration=function(n){var i=this,r,t,u,f;if(i._cellEditInfo.ranges)for(r=0;r<i._cellEditInfo.ranges.length;r++)for(t=i._cellEditInfo.ranges[r],u=t.row;u<t.row+t.rowCount;u++)for(f=t.col;f<t.col+t.colCount;f++)n(u,f);else n(i._cellEditInfo.row,i._cellEditInfo.col)},u.prototype.saveCellState=function(n,t){},u.prototype.undo=function(n){var u=this,i=u._sheet,s=u._cellEditInfo.row,h=u._cellEditInfo.col,o=i._paintSuspended,f,e;try{i._paintSuspended=!0;i._bind(t.Events.CellChanged+u._eventNS,function(n,t){t.propertyName==="value"&&i._raiseValueChanged(t.row,t.col,t.oldValue,t.newValue)});u.iteration(function(n,t){var e=u._positionToString(n,t),f=u._oldValueIsFormulaCatch[e],o;if(f===!1)return;else f?f.isArrayFormula?i.setArrayFormula(n,t,f.baseRange.rowCount,f.baseRange.colCount,f.formula):i.setFormula(n,t,u._oldValueCatch[e]):(o=i.getFormula(n,t),o===r||o===""||i.setFormula(n,t,r),i.setValue(n,t,u._oldValueCatch[e]))})}catch(c){return!1}finally{i._unbind(t.Events.CellChanged+u._eventNS);i._paintSuspended=o}return f=i._getSheetLayout(),e=new t.Rect(f.frozenX,f.frozenY,f.width-f.frozenX,f.height-f.frozenY),i.repaint(e),!0},u.prototype.execute=function(n){var i=this,r,f,u,e;i.saveState();r=i._sheet;f=r._paintSuspended;try{r._paintSuspended=!0;r._bind(t.Events.CellChanged+i._eventNS,function(n,t){t.propertyName==="value"&&r._raiseValueChanged(t.row,t.col,t.oldValue,t.newValue)});i.applyResult=i._applyEditing(n)}finally{i._sheet._unbind(t.Events.CellChanged+i._eventNS);r._paintSuspended=f}u=r._getSheetLayout();e=new t.Rect(u.frozenX,u.frozenY,u.width-u.frozenX,u.height-u.frozenY);r.repaint(e);i._canUndo=i.applyResult===0},u.prototype._positionToString=function(n,t){return n+"_"+t},u.prototype._stringToPosition=function(n){var t=n.split("_");return{row:parseInt(t[0],10),col:parseInt(t[1],10)}},u.prototype._validateEditingValue=function(){var r=this,o=0,n=r._cellEditInfo.row,t=r._cellEditInfo.col,i=r._sheet,u=r._cellEditInfo.newValue,a=r._cellEditInfo.hasOwnProperty("autoFormat")?r._cellEditInfo.autoFormat:!0,f,e,s,h,c,l;return u&&u.length>0&&u[0]==="="?i.getDataValidator(n,t)&&(f=u.substring(1),f!==""&&f!==i.getFormula(n,t)&&(e=i.getCalcService(),e&&(s=e.parse(i._getSheetSource(),f,n>=0?n:0,t>=0?t:0),s&&(h=e.evaluateParsedFormula(i._getSheetSource(),s,n,t),i.isValid(n,t,h)||(o=i._validationError(n,t,h)))))):(c=r._getValueFromEditing(n,t,u,a),l=i.isValid(n,t,c),l||(o=i._validationError(n,t,u),i._eventHandler._forceCancelSelectiong=!0)),o},u.prototype._applyEditing=function(i){var f=this,u=f._sheet,e=f._cellEditInfo.newValue,l=f._validateEditingValue(),y,k,d,h,c,w,g,a,v,o,b;if(l===1||l===2)return l;if(k=f._cellEditInfo.hasOwnProperty("autoFormat")?f._cellEditInfo.autoFormat:!0,t.util.hasCalc())if(d=u.parent?u.parent.canUserEditFormula():!0,h=f._cellEditInfo.row,h=h>=0?h:0,c=f._cellEditInfo.col,c=c>=0?c:0,w=n.Sheets.Calc.Parser.getParserOption(),g={numberDecimalSeparator:n.Sheets.CR.numberDecimalSeparator,arrayListSeparator:n.Sheets.CR.arrayListSeparator,arrayGroupSeparator:n.Sheets.CR.arrayGroupSeparator,listSeparator:n.Sheets.CR.listSeparator},n.Sheets.Calc.Parser.setParserOption(g),a=u.getCalcService(),d&&a&&e&&e.length>0&&e[0]==="=")try{if(f._cellEditInfo.ranges&&f._cellEditInfo.endEditType===1)return o=f._cellEditInfo.ranges[0],u.setArrayFormula(o.row,o.col,o.rowCount,o.colCount,e.substring(1)),n.Sheets.Calc.Parser.setParserOption(w),l;else v=a.parse(u._getSheetSource(),e.substring(1),h,c)}catch(p){u._raiseInvalidOperation(0,typeof p=="string"?p:p.message);throw p;}else f._cellEditInfo.ranges&&f._cellEditInfo.endEditType===1&&(o=f._cellEditInfo.ranges[0],u.clear(o.row,o.col,o.rowCount,o.colCount,3,1));return v||(b=!1,/^('=)/ig.test(e)&&(e=e.substring(1),b=!0),(y===s||y===r||b)&&(y=f._getValueFromEditing(h,c,e,k))),f.iteration(function(n,t){if(v)try{n==h&&t==c?u.setFormula(n,t,a.unparse(u._getSheetSource(),v,n,t)):u.setFormula(n,t,a.unparseWithoutCulture(u._getSheetSource(),v,n,t));u.triggerUserFormulaEntered({sheet:u,sheetName:u._name,row:n,col:t,formula:e.substring(1).toUpperCase()})}catch(i){u._raiseInvalidOperation(0,typeof i=="string"?i:i.message);throw i;}else{try{u.hasFormula(n,t)&&u.setFormula(n,t,r)}catch(i){u._raiseInvalidOperation(0,typeof i=="string"?i:i.message);throw i;}try{u._setValueInternal(n,t,y)}catch(f){u.setValue(n,t,e)}}}),t.util.hasCalc()&&n.Sheets.Calc.Parser.setParserOption(w),l},u.prototype.canUndo=function(){return this._canUndo},u.prototype._getValueFromEditing=function(n,i,u,f){var o,e,l,a;if(!t.features.formatter)return u;var s=this,v=s._sheet.getActualStyle(n,i),h={},y=t.util.parseText2Value(v,u,f,h),c=h.value;return f&&h.value&&(o=r,f&&c&&(y!==r&&c.FormatString()!=="General"||!v._autoFormatter)&&(o=new t.AutoFormatter(c)),o&&(e=s._sheet.getStyleObject(n,i),l=typeof e=="string",(!e||l)&&(a=new t.Style,l&&(a.parentName=e),e=a),e._autoFormatter=o,s._sheet.setStyle(n,i,e))),y},u}(f);i.CellEditUndoAction=ti;ii=function(n){function t(t,i){n.call(this);this._sheet=t;this._newName=i;this._oldName=r}return __extends(t,n),t.prototype.canUndo=function(){return!!this._oldName},t.prototype.canExecute=function(n){var t=this;return t._sheet&&t._newName&&t._newName!==t._oldName},t.prototype.execute=function(n){var t=this,i=t._sheet;i&&t._newName&&t._newName!==t._oldName&&(t.saveState(),t._suspendInvalidate(n),i.setNameCore(t._newName),t._resumeInvalidate(n),i._refreshTabStrip())},t.prototype.saveState=function(){this._sheet&&(this._oldName=this._sheet._name)},t.prototype.undo=function(n){var t=this,i=t._sheet;return i?(t._suspendInvalidate(n),i.setNameCore(t._oldName),t._resumeInvalidate(n),i._refreshTabStrip(),!0):!1},t}(f);i.SheetRenameUndoAction=ii;ri=function(n){function t(t,i){n.call(this);this._sheet=t;i<.25?i=.25:i>4&&(i=4);this._zoomFactor=i;this._prevZoomFactor=-1}return __extends(t,n),t.prototype.canExecute=function(n){var t=this;return t._sheet&&t._sheet.parent._allowUserZoom&&t._sheet._zoomFactor!==t._zoomFactor},t.prototype.execute=function(n){var i=this,t=i._sheet,r,u;if(i.saveState(),t&&(!t.parent||t.parent._allowUserZoom===!0)&&t._zoomFactor!==i._zoomFactor){if(t.isEditing()===!0&&!t.endEdit())return;i._suspendInvalidate(n);r=t.isPaintSuspended();t.isPaintSuspended(!0);t.zoom(i._zoomFactor);t.isPaintSuspended(r);u=i._resumeInvalidate(n);u||(t.invalidateLayout(),t.repaint())}},t.prototype.canUndo=function(){return this._sheet&&this._prevZoomFactor>0},t.prototype.saveState=function(){this._sheet&&(this._prevZoomFactor=this._sheet._zoomFactor)},t.prototype.undo=function(n){var i=this,t=i._sheet,r,u;return t?(i._suspendInvalidate(n),r=t.isPaintSuspended(),t.isPaintSuspended(!0),t.zoom(i._prevZoomFactor),t.isPaintSuspended(r),u=i._resumeInvalidate(n),u||(t.invalidateLayout(),t.repaint()),!0):!1},t}(f);i.ZoomUndoAction=ri;g=function(){function n(n,t){this.value=n;this.formulaInfo=t}return n}();nt=function(n){function i(t,i){n.call(this);this._cachedFormulaInfos=[];this._eventNS=".clearRangeAction";var u=this;u._sheet=t;u._clearRange=i;u._cachedFilteredColumns=r;u._cachedValues=r;u._cachedTables=r}return __extends(i,n),i.prototype.execute=function(n){var f=this,i,r,e;if(f.saveState(),i=f._sheet,i&&(r=i._getActualRange(f._clearRange),r.colCount>0&&r.rowCount>0))try{i._bind(t.Events.CellChanged+f._eventNS,function(n,t){t.propertyName==="value"&&i._raiseValueChanged(t.row,t.col,t.oldValue,t.newValue)});e=i.isPaintSuspended();i.isPaintSuspended(!0);i.suspendEvent();i.clear(r.row,r.col,r.rowCount,r.colCount,3,1);i.resumeEvent();i.isPaintSuspended(e);u.raiseRangeDataChanged(i,r.row,r.col,r.rowCount,r.colCount,f._changedCells.getChangedCells(),2)}finally{f._sheet._unbind(t.Events.CellChanged+f._eventNS)}},i.prototype.canExecute=function(n){var i=this._sheet,t=this._clearRange;return!(i.isProtected===!0&&i._isAnyCellInRangeLocked(t))&&i._checkArrayFormula(t.row,t.col,t.rowCount,t.colCount)},i.prototype.canUndo=function(){return!!this._cachedValues},i.prototype.saveState=function(){var n=this,e=n._sheet,l,w,t,u,o,v,b,a,i,f,y,c,p;if(e){if(n._cachedTables=[],l=e.getTables(),l&&l.length>0)for(f=0;f<l.length;f++)w=l[f],n._clearRange.containsRange(w.range())&&n._cachedTables.push(w);if(n._cachedFilteredColumns=[],t=e.rowFilter(),t&&t.range&&t.isFiltered()&&(u=t.range.row,v=t.range.rowCount,t.filterButtonVisible&&t.filterButtonVisible()&&(u=t.range.row-1,v=t.range.rowCount+1,u<0&&(u=-1,v=-1)),(n._clearRange.row===-1||n._clearRange.row<=u&&u+v<=n._clearRange.row+n._clearRange.rowCount)&&(n._clearRange.col===-1||n._clearRange.col<=t.range.col&&t.range.col+t.range.colCount<=n._clearRange.col+n._clearRange.colCount)))for(o=t.range.col<0?0:t.range.col,b=t.range.colCount<0?e.getColumnCount():t.range.colCount,a=0;a<b;a++)t.isColumnFiltered(o+a)&&n._cachedFilteredColumns.push(o+a);if(i=e._getActualRange(n._clearRange),i.colCount>0&&i.rowCount>0)for(n._cachedValues=[i.row+i.rowCount],f=0;f<i.rowCount;f++)for(n._cachedValues[i.row+f]=[i.col+i.colCount],n._cachedFormulaInfos[i.row+f]=[],y=0;y<i.colCount;y++)u=i.row+f,o=i.col+y,c=e.getFormulaInformation(u,o),c.hasFormula?n._cachedValues[u][o]=c.isArrayFormula&&(c.baseRange.row!==u||c.baseRange.col!==o)?-1:new g(c.formula,c):(p=e.getValue(u,o),p!==s&&p!==r&&(n._cachedValues[u][o]=new g(p,s)));n._changedCells=new h(e,e._getActualRange(n._clearRange),3)}},i.prototype.undo=function(n){var f=this,i=f._sheet,a,e,y,w,o,b,k,d,v,l,p,g;if(i){if(a=!1,f._cachedTables&&f._cachedTables.length>0)for(y=f._cachedTables,w=y.length,e=0;e<w;e++)i._addTableInternal(y[e]);if(o=i._getActualRange(f._clearRange),f._cachedValues&&o.colCount>0&&o.rowCount>0){b=i.isPaintSuspended();i.isPaintSuspended(!0);i.suspendEvent();try{for(i._bind(t.Events.CellChanged+f._eventNS,function(n,t){t.propertyName==="value"&&i._raiseValueChanged(t.row,t.col,t.oldValue,t.newValue)}),k=o.rowCount,d=o.colCount,e=0;e<k;e++)for(v=0;v<d;v++){var s=o.row+e,h=o.col+v,c=f._cachedValues[s][h];if(c===-1)continue;else c?c.formulaInfo?(l=c.formulaInfo,l&&l.isArrayFormula?i.setArrayFormula(s,h,l.baseRange.rowCount,l.baseRange.colCount,l.formula):i.setFormula(s,h,c.value)):(i.setFormula(s,h,r),i.setValue(s,h,c.value)):(i.setFormula(s,h,r),i.setValue(s,h,r))}a=!0}finally{i._unbind(t.Events.CellChanged+f._eventNS);i.resumeEvent();i.isPaintSuspended(b)}}if(a&&u.raiseRangeDataChanged(i,o.row,o.col,o.rowCount,o.colCount,f._changedCells.getChangedCells(),2),p=i.rowFilter(),p&&f._cachedFilteredColumns&&f._cachedFilteredColumns.length>0)for(e=0;e<f._cachedFilteredColumns.length;e++)g=f._cachedFilteredColumns[e],p.filter(g);if(a)return i.repaint(),!0}return!1},i}(f);i.ClearRangeValueUndoAction=nt;tt=function(n){function t(t,i){var u,f;if(n.call(this),this._cachedActions=[],u=this,u._sheet=t,u._cachedActions=r,i&&i.length>0)for(u._cachedActions=[],f=0;f<i.length;f++)u._cachedActions[f]=new nt(t,i[f])}return __extends(t,n),t.prototype.canExecute=function(n){var t,i;if(this._cachedActions){for(t=0;t<this._cachedActions.length;t++)if(i=this._cachedActions[t],!i.canExecute(n))return!1;return!0}return!1},t.prototype.execute=function(n){var t=this,i,r,u;if(t.saveState(),t._cachedActions){for(t._suspendInvalidate(n),i=0;i<t._cachedActions.length;i++)r=t._cachedActions[i],r.execute(n);u=t._resumeInvalidate(n);u||(t._sheet.invalidateLayout(),t._sheet.repaint())}},t.prototype.canUndo=function(){var n,t;if(this._cachedActions){for(n=0;n<this._cachedActions.length;n++)if(t=this._cachedActions[n],!t.canUndo())return!1;return!0}return!1},t.prototype.saveState=function(){var n,t;if(this._cachedActions)for(n=0;n<this._cachedActions.length;n++)t=this._cachedActions[n],t.saveState()},t.prototype.undo=function(n){var t=this,i,r,u,f;if(t._cachedActions){for(i=t._cachedActions.length-1;i>=0;i--)if(r=t._cachedActions[i],t._suspendInvalidate(n),u=r.undo(n),f=t._resumeInvalidate(n),u)f||(t._sheet.invalidateLayout(),t._sheet.repaint());else return!1;return!0}return!1},t}(f);i.ClearValueUndoAction=tt;ui=function(){function n(n,t,i,r){this.startRange=n;this.fillRange=t;this.autoFillType=i;this.fillDirection=r}return n}();i.DragFillExtent=ui;it=function(n){function i(t,i){n.call(this);var r=this;r._workSheet=t;r._dragFillExtent=i;r._dragFillExtent.autoFillType===4?r._clearValueUndoAction=new tt(t,[r._dragFillExtent.fillRange]):r.initWholeFilledRange();r._fillSeries=r._dragFillExtent.fillDirection===0||r._dragFillExtent.fillDirection===1?1:0}return __extends(i,n),i.prototype.canExecute=function(n){var r=this,i=r._workSheet,t=r._dragFillExtent;return i.isProtected&&i._isAnyCellInRangeLocked(t.fillRange)?!1:i._checkArrayFormula(t.fillRange.row,t.fillRange.col,t.fillRange.rowCount,t.fillRange.colCount)?this._dragFillExtent.autoFillType===4?this.canExecuteDragClear():this.canExecuteDragFill():!1},i.prototype.canExecuteDragClear=function(){return!0},i.prototype.canExecuteDragFill=function(){var n=this._dragFillExtent.startRange,t=this._dragFillExtent.fillRange;return!t.intersect(n.row,n.col,n.rowCount,n.colCount)},i.prototype.execute=function(n){var i=this,e,r,o;if(i.canExecute(n)){var t=i._workSheet,s=t.getSelections(),f=!1;try{i._suspendInvalidate(t);t.suspendCalcService();t.suspendEvent();i.saveState();e=t.isPaintSuspended();t.isPaintSuspended(!0);i._dragFillExtent.autoFillType===4?i.executeDragFillClear(t):i.executeDragFill(t)}finally{t.isPaintSuspended(e);t.resumeCalcService();t.resumeEvent();r=i._dragFillExtent.fillRange;i._savedAfterFilledChangedCells=new h(i._workSheet,r,1023);i._savedAfterFilledChangedCells.mergeCellsHasDiffData(i._savedBeforeFillChangedCells.getCellsHasData());u.raiseRangeDataChanged(t,r.row,r.col,r.rowCount,r.colCount,i._savedAfterFilledChangedCells.getChangedCells(),1,i._savedFilledViewportCells.getValues());o=t.getSelections();t._raiseSelectionChanging(s,o)&&t._raiseSelectionChanged();f=i._resumeInvalidate(t)}f||(t.invalidateLayout(),t.repaint())}},i.prototype.executeDragFillClear=function(n){var u=this,r,f,i;u._clearValueUndoAction.execute(n);r=u._dragFillExtent.startRange;f=u._dragFillExtent.fillRange;r.equals(f)||(u._fillSeries===0?(i=new t.Range(r.row,r.col,e(1,r.rowCount-f.rowCount),r.colCount),n._setActiveCellImp(e(n._getFirstVisualRow(),i.row),e(n._getFirstVisualColumn(),i.col),n.activeRowViewportIndex,n.activeColViewportIndex),n._clearSelectionImp(),n.addSelection(i.row,i.col,i.rowCount,i.colCount)):(i=new t.Range(r.row,r.col,r.rowCount,e(1,r.colCount-f.colCount)),n._setActiveCellImp(e(n._getFirstVisualRow(),i.row),e(n._getFirstVisualColumn(),i.col),n.activeRowViewportIndex,n.activeColViewportIndex),n._clearSelectionImp(),n.addSelection(i.row,i.col,i.rowCount,i.colCount)))},i.prototype.executeDragFill=function(n){var i=this,c=i._workSheet,f=i._dragFillExtent.startRange,l=i._dragFillExtent.fillRange,s,h,v,y,p,o,a;if(i._dragFillExtent.autoFillType===1)c.fillAuto(f,i._wholeFillRange,i._fillSeries);else if(i._dragFillExtent.autoFillType===0)v=1019,i.copyCells(f,l,v);else if(i._dragFillExtent.autoFillType===2)i.copyCells(f,l,64);else if(i._dragFillExtent.autoFillType===3)if(y=f.rowCount===1&&f.colCount===1&&!(f.row===-1&&f.col!==-1)&&!(f.col===-1&&f.row!==-1),y)p=187,i.copyCells(f,l,p);else{for(o=i.adjustRange(i._wholeFillRange),a=new t._GcSheetModel(o.rowCount,o.colCount,r),s=0;s<o.rowCount;s++)for(h=0;h<o.colCount;h++)a.setStyle(s,h,u.getStyleObject(i._workSheet,o.row+s,o.col+h,3));for(c.fillAuto(f,i._wholeFillRange,i._fillSeries),s=0;s<o.rowCount;s++)for(h=0;h<o.colCount;h++)u.setStyleObject(i._workSheet,o.row+s,o.col+h,3,a.getStyle(s,h))}c._setActiveCellImp(e(n._getFirstVisualRow(),i._wholeFillRange.row),e(n._getFirstVisualColumn(),i._wholeFillRange.col),n.activeRowViewportIndex,n.activeColViewportIndex);n._selectionModel&&n._clearSelectionImp();c.addSelection(i._wholeFillRange.row,i._wholeFillRange.col,i._wholeFillRange.rowCount,i._wholeFillRange.colCount)},i.prototype.clearData=function(n,t){var i=1;this._workSheet.clearCore(n.row,n.col,n.rowCount,n.colCount,3,i,t)},i.prototype.adjustRange=function(n){var i=n.row!==-1?n.row:0,r=n.col!==-1?n.col:0,u=n.rowCount!==-1?n.rowCount:this._workSheet.getRowCount(),f=n.colCount!==-1?n.colCount:this._workSheet.getColumnCount();return new t.Range(i,r,u,f)},i.prototype.copyCells=function(n,t,i){var f=this,w=f._workSheet,r=f.adjustRange(n),u=f.adjustRange(t),e,h,c,o,s,b,l,a,v,k,g,y,nt,d,tt,it;if(f._fillSeries===0){for(v=p(u.rowCount/r.rowCount),e=0;e<v;e++)h=r.row,c=r.col,f._dragFillExtent.fillDirection===3?o=u.row+e*r.rowCount:(b=u.row+u.rowCount,o=b-(e+1)*r.rowCount),s=u.col,l=r.rowCount,a=r.colCount,w.copyToCore(h,c,o,s,l,a,i,!0);k=u.rowCount%r.rowCount;k!==0&&(f._dragFillExtent.fillDirection===3?h=r.row:(g=r.rowCount-(u.rowCount-r.rowCount*v),h=r.row+g),c=r.col,f._dragFillExtent.fillDirection===3?o=u.row+r.rowCount*v:(b=u.row+u.rowCount,o=b-v*r.rowCount-k),s=u.col,l=k,a=r.colCount,w.copyToCore(h,c,o,s,l,a,i,!0))}else{for(y=p(u.colCount/r.colCount),e=0;e<y;e++)h=r.row,c=r.col,o=u.row,f._dragFillExtent.fillDirection===1?s=u.col+e*r.colCount:(nt=u.col+u.colCount,s=nt-(e+1)*r.colCount),l=r.rowCount,a=r.colCount,w.copyToCore(h,c,o,s,l,a,i,!0);d=u.colCount%r.colCount;d!==0&&(h=r.row,f._dragFillExtent.fillDirection===1?c=r.col:(tt=r.colCount-(u.colCount-r.colCount*y),c=r.col+tt),o=u.row,f._dragFillExtent.fillDirection===1?s=u.col+r.colCount*y:(it=u.col+u.colCount,s=it-y*r.colCount-d),l=r.rowCount,a=d,w.copyToCore(h,c,o,s,l,a,i,!0))}},i.prototype.saveState=function(){var n=this;n._dragFillExtent.autoFillType===4?n.saveDragClearState():n.saveDragFillState();n._savedBeforeFillChangedCells=new h(n._workSheet,n._dragFillExtent.fillRange,1023);n._savedFilledViewportCells=n.saveRangeStates(n._dragFillExtent.fillRange)},i.prototype.saveDragClearState=function(){this._clearValueUndoAction.saveState()},i.prototype.saveDragFillState=function(){this._savedStartViewportCells=this.saveRangeStates(this._dragFillExtent.startRange)},i.prototype.saveRangeStates=function(n){var t=this.adjustRange(n),i=new o(t.rowCount,t.colCount);return u.saveViewportInfo(this._workSheet,i,t.row,t.col,1023),i},i.prototype.undo=function(n){var i=this,t=i._workSheet,r=!1,u=!1,f;try{i._suspendInvalidate(t);t.suspendCalcService();f=t.isPaintSuspended();t.isPaintSuspended(!0);r=i._undo(t)}finally{t.isPaintSuspended(f);t.resumeCalcService();u=i._resumeInvalidate(t)}return u||(t.invalidateLayout(),t.repaint()),r},i.prototype._undo=function(n){var i=this,r,e=n.getSelections(),t=i._dragFillExtent.fillRange,o=u.getValues(i._workSheet,t.row,t.col,t.rowCount,t.colCount),f;return r=i._dragFillExtent.autoFillType===4?i.undoDragClear(n):i.undoDragFill(n),n._skipCloseDragFillSmartTag!==!0&&n._closeDragFillPopup(),u.raiseRangeDataChanged(n,t.row,t.col,t.rowCount,t.colCount,i._savedAfterFilledChangedCells.getChangedCells(),1,o),f=n.getSelections(),n._raiseSelectionChanging(e,f)&&n._raiseSelectionChanged(),r},i.prototype.undoDragClear=function(n){var t=this,i=t._clearValueUndoAction.undo(n);return n._setActiveCellImp(e(n._getFirstVisualRow(),t._dragFillExtent.startRange.row),e(n._getFirstVisualColumn(),t._dragFillExtent.startRange.col),n.activeRowViewportIndex,n.activeColViewportIndex),n._clearSelectionImp(),n.addSelection(t._dragFillExtent.startRange.row,t._dragFillExtent.startRange.col,t._dragFillExtent.startRange.rowCount,t._dragFillExtent.startRange.colCount),i},i.prototype.undoDragFill=function(n){var t=this;t._suspendInvalidate(n);n.suspendCalcService();try{t.undoRangeStates(t._savedFilledViewportCells,t._dragFillExtent.fillRange);t.undoRangeStates(t._savedStartViewportCells,t._dragFillExtent.startRange);n._setActiveCellImp(e(n._getFirstVisualRow(),t._dragFillExtent.startRange.row),e(n._getFirstVisualColumn(),t._dragFillExtent.startRange.col),n.activeRowViewportIndex,n.activeColViewportIndex);n._clearSelectionImp();n.addSelection(t._dragFillExtent.startRange.row,t._dragFillExtent.startRange.col,t._dragFillExtent.startRange.rowCount,t._dragFillExtent.startRange.colCount)}finally{n.resumeCalcService(!1);t._resumeInvalidate(n)}return n.invalidateLayout(),!0},i.prototype.undoRangeStates=function(n,t){var i=this.adjustRange(t);u.undoCellsInfo(this._workSheet,n,i.row,i.col,3)},i.prototype.initWholeFilledRange=function(){var i=this,f=0,e=0,o=0,s=0,r=i._dragFillExtent.fillDirection,n=i._dragFillExtent.startRange,u=i._dragFillExtent.fillRange;r===0||r===1?(f=n.row,e=n.rowCount,o=r===0?u.col:n.col,s=n.colCount+u.colCount):(f=r===2?u.row:n.row,e=n.rowCount+u.rowCount,o=n.col,s=n.colCount);i._wholeFillRange=new t.Range(f,o,e,s)},i}(f);i.DragFillUndoAction=it;fi=function(n){function f(t,i,r){n.call(this);this._sheet=t;this._fillRange=r;this._fillType=i}return __extends(f,n),f.prototype.execute=function(n){var t=this,i=t._sheet,l,f,s,r,a;t._suspendInvalidate(i);t.saveState();l=i.isPaintSuspended();i.isPaintSuspended(!0);try{f=t.adjustRange(t._fillRange);s=new o(f.rowCount,f.colCount);u.saveViewportInfo(t._sheet,s,f.row,f.col,1023);t._savedFilledViewportCells=s;var c=i._eventHandler,e={sheet:i,sheetName:i._name,fillRange:t._fillRange,autoFillType:t._fillType,fillDirection:c.getCurrentFillDirection()},v=i._raiseDragFillBlock(e);c._currentDragFillType=e.autoFillType;c._isCancelDragFill=v;t.executeDragFillAction(n,e);i._raiseDragFillBlockCompleted(e)}finally{i.isPaintSuspended(l);r=t._fillRange;t._savedAfterFilledChangedCells=new h(i,r,1023);t._savedAfterFilledChangedCells.mergeCellsHasDiffData(t._savedBeforeFillChangedCells.getCellsHasData());u.raiseRangeDataChanged(i,r.row,r.col,r.rowCount,r.colCount,t._savedAfterFilledChangedCells.getChangedCells(),1,t._savedFilledViewportCells.getValues())}a=t._resumeInvalidate(i);a||t.refreshUI(n)},f.prototype.executeDragFillAction=function(n,t){var r=this._sheet,u=r._eventHandler,e=this._fillRange,o=this._fillType,f;if(u._currentDragFillType=o,f=r._getActualRange(e),u._preFillCellsInfo=new i.CopyMoveCellsInfo(f.rowCount,f.colCount),i.CopyMoveHelper.saveViewportInfo(r,u._preFillCellsInfo,f.row,f.col,1023),!u._isCancelDragFill){var h=t.autoFillType===5?o:t.autoFillType,c={startRange:u._dragFillStartRange,fillRange:e,autoFillType:h,fillDirection:u.getCurrentFillDirection()},s=new it(r,c);r.suspendEvent();s.execute(n);r.resumeEvent();this._dragFillUndoAction=s}},f.prototype.canExecute=function(n){return!0},f.prototype.canUndo=function(){return!0},f.prototype.refreshUI=function(n){var t=this._sheet;t&&(t.invalidateLayout(),t.repaint())},f.prototype.adjustRange=function(n){var i=n.row!==-1?n.row:0,r=n.col!==-1?n.col:0,u=n.rowCount!==-1?n.rowCount:this._sheet.getRowCount(),f=n.colCount!==-1?n.colCount:this._sheet.getColumnCount();return new t.Range(i,r,u,f)},f.prototype.saveState=function(){var n=this;n._savedBeforeFillChangedCells=new h(n._sheet,n._fillRange,1023)},f.prototype.undo=function(n){var t=this,f=t._sheet,o=!0,s,e,i,c;t._suspendInvalidate(f);f.suspendEvent();t.saveState();s=f.isPaintSuspended();f.isPaintSuspended(!0);e=r;try{i=t._fillRange;e=u.getValues(t._sheet,i.row,i.col,i.rowCount,i.colCount);o=t._dragFillUndoAction.undo(n)}finally{f.isPaintSuspended(s);f.resumeEvent();t._savedAfterFilledChangedCells=new h(f,i,1023);t._savedAfterFilledChangedCells.mergeCellsHasDiffData(t._savedBeforeFillChangedCells.getCellsHasData());u.raiseRangeDataChanged(f,i.row,i.col,i.rowCount,i.colCount,t._savedAfterFilledChangedCells.getChangedCells(),1,e);c=t._resumeInvalidate(f);c||t.refreshUI(n)}return o},f}(f);i.FillUndoAction=fi;ei=function(){function n(n,t,i,r){this.sourceRange=n;this.targetRange=t;this.isCutting=i;this.clipboardText=r}return n}();i.PasteRangeExtent=ei;rt=function(n){function i(t,i,r,u,f){n.call(this);var e=this;e._sheet=t;e._fromSheet=i;e._toSheet=r;e._pasteExtent=u;e._pasteOption=f}return __extends(i,n),i.prototype.canUndo=function(){return!0},i.prototype.canExecute=function(n){var t=this._sheet,i=this._pasteExtent.targetRange,r=this._pasteExtent.sourceRange;return!(t.isProtected&&t._isAnyCellInRangeLocked(i))&&t._checkArrayFormula(i.row,i.col,i.rowCount,i.colCount)&&(!this._pasteExtent.isCutting||!(t.isProtected&&t._isAnyCellInRangeLocked(r))&&t._checkArrayFormula(r.row,r.col,r.rowCount,r.colCount))},i.prototype.saveState=function(){var n=this,k,d,g,nt,tt,it,rt,et,ot,st,ht,ct,lt,at;n.initSaveState();var vt=n._pasteExtent.isCutting,e=i.convertPasteOption(n._pasteOption),r=n._pasteExtent.sourceRange,f=n._pasteExtent.targetRange;if(n._fromSheet&&r&&vt){var p=r.row<0?0:r.row,b=r.col<0?0:r.col,s=r.row<0?n._fromSheet.getRowCount():r.rowCount,c=r.col<0?n._fromSheet.getColumnCount():r.colCount;r.row<0&&r.col<0&&f.row<0&&f.col<0&&n._fromSheet._name!==n._toSheet._name&&(k=new w,u.saveSheetInfo(n._fromSheet,k,e),n._savedFromSheetInfo=k);r.row<0&&(d=new o(n._fromSheet.getRowCount(1),c),g=new v(c),u.saveColumnHeaderInfo(n._fromSheet,d,g,b,e),n._savedFromColumnHeaderCells=d,n._savedFromColumns=g);r.col<0&&(nt=new o(s,n._fromSheet.getColumnCount(2)),tt=new a(s),u.saveRowHeaderInfo(n._fromSheet,nt,tt,p,e),n._savedFromRowHeaderCells=nt,n._savedFromRows=tt);it=new o(s,c);u.saveViewportInfo(n._fromSheet,it,p,b,e);n._savedFromViewportCells=it;rt=[];u.saveTableInfo(n._sheet,rt,new t.Range(p,b,s,c));n._savedFromTables=rt;n._savedFromBeforePastedChangedCells=new h(n._fromSheet,r,e)}var ut=f.row<0?0:f.row,ft=f.col<0?0:f.col,l=f.row<0?n._toSheet.getRowCount():f.rowCount,y=f.col<0?n._toSheet.getColumnCount():f.colCount;n._fromSheet&&r&&(r.row<0&&r.col<0&&f.row<0&&f.col<0&&n._fromSheet._name!==n._toSheet._name&&(et=new w,u.saveSheetInfo(n._toSheet,et,e),n._savedToSheetInfo=et),r.row<0&&(ot=new o(n._toSheet.getRowCount(1),y),st=new v(y),u.saveColumnHeaderInfo(n._toSheet,ot,st,ft,e),n._savedToColumnHeaderCells=ot,n._savedToColumns=st),r.col<0&&(ht=new o(l,n._toSheet.getColumnCount(2)),ct=new a(l),u.saveRowHeaderInfo(n._toSheet,ht,ct,ut,e),n._savedToRowHeaderCells=ht,n._savedToRows=ct));lt=new o(l,y);u.saveViewportInfo(n._toSheet,lt,ut,ft,e);n._savedToViewportCells=lt;at=[];u.saveTableInfo(n._sheet,at,new t.Range(ut,ft,l,y));n._savedToTables=at;n._savedToBeforePastedChangedCells=new h(n._toSheet,f,e)},i.prototype.initSaveState=function(){var n=this;n._savedFromSheetInfo=r;n._savedFromColumnHeaderCells=r;n._savedFromColumns=r;n._savedFromViewportCells=r;n._savedFromRowHeaderCells=r;n._savedFromRows=r;n._savedToSheetInfo=r;n._savedToColumnHeaderCells=r;n._savedToColumns=r;n._savedToViewportCells=r;n._savedToRowHeaderCells=r;n._savedToRows=r},i.prototype.pasteOption=function(){return this._pasteOption},i.prototype.pasteRange=function(){return this._pasteExtent.targetRange},i.prototype.execute=function(n){var r=this,e=r._fromSheet,o=r._toSheet,f=r._pasteExtent.sourceRange,s=r._pasteExtent.targetRange,v,c,a,l;if((!e||!f||e._isValidRange(f.row,f.col,f.rowCount,f.colCount,e.getRowCount(),e.getColumnCount()))&&o&&s&&o._isValidRange(s.row,s.col,s.rowCount,s.colCount,o.getRowCount(),o.getColumnCount())){r.saveState();r._suspendInvalidate(n);o.suspendEvent();e&&e.suspendEvent();try{f&&t._CacheMgr.startCache(e,f.row,f.col,f.row+f.rowCount-1,f.col+f.colCount-1);o._clipboardPaste(e,f,o,s,r._pasteExtent.isCutting,r._pasteExtent.clipboardText,r._pasteOption)}finally{o.resumeEvent();e&&e.resumeEvent();r._resumeInvalidate(n);v=r._sheet;v&&(c=r._savedFromViewportCells,r._pasteExtent.isCutting&&c&&e&&c.isValueOrFormulaSaved()&&(l=i.convertPasteOption(r._pasteOption),r._savedFromAfterPastedChangedCells=new h(e,f,l),r._savedFromAfterPastedChangedCells.mergeCellsHasDiffData(r._savedFromBeforePastedChangedCells.getCellsHasData()),u.raiseRangeDataChanged(e,f.row,f.col,f.rowCount,f.colCount,r._savedFromAfterPastedChangedCells.getChangedCells(),3,c.getValues())),a=r._savedToViewportCells,a&&o&&a.isValueOrFormulaSaved()&&(l=i.convertPasteOption(r._pasteOption),r._savedToAfterPastedChangedCells=new h(o,s,l),r._savedToAfterPastedChangedCells.mergeCellsHasDiffData(r._savedToBeforePastedChangedCells.getCellsHasData()),u.raiseRangeDataChanged(o,s.row,s.col,s.rowCount,s.colCount,r._savedToAfterPastedChangedCells.getChangedCells(),3,a.getValues())));f&&t._CacheMgr.clearCache()}}},i.prototype.undo=function(n){var i=this,f=i._pasteExtent.sourceRange,o=i._pasteExtent.targetRange,e,a,v,g;if(!i._toSheet||!o||!i._toSheet._isValidRange(o.row,o.col,o.rowCount,o.colCount,i._toSheet.getRowCount(),i._toSheet.getColumnCount())||i._fromSheet&&f&&(!i._fromSheet._isValidRange(f.row,f.col,f.rowCount,f.colCount,i._fromSheet.getRowCount(),i._fromSheet.getColumnCount())||i._fromSheet&&i._fromSheet._name===i._toSheet._name&&i._toSheet.parent&&!t.ArrayHelper.contains(i._toSheet.parent.sheets,i._fromSheet)))return!1;i._suspendInvalidate(n);e=!1;try{var k=r,d=r,s=o.row<0?0:o.row,h=o.col<0?0:o.col,y=o.row<0?i._toSheet.getRowCount():o.rowCount,p=o.col<0?i._toSheet.getColumnCount():o.colCount;u.clearFormula(i._toSheet,s,h,y,p);i._savedToTables&&u.undoTableInfo(i._sheet,i._savedToTables,new t.Range(s,h,y,p));i._savedToSheetInfo&&(u.undoSheetInfo(i._toSheet,i._savedToSheetInfo),e=!0);a=i._savedToViewportCells;a&&a.isValueOrFormulaSaved()&&(k=u.getValues(i._toSheet,s,h,y,p));i._savedToColumnHeaderCells&&(u.undoCellsInfo(i._toSheet,i._savedToColumnHeaderCells,0,h,1),e=!0);i._savedToColumns&&(u.undoColumnsInfo(i._toSheet,i._savedToColumns,h),e=!0);a&&(u.undoCellsInfo(i._toSheet,a,s,h,3),e=!0);i._savedToRowHeaderCells&&(u.undoCellsInfo(i._toSheet,i._savedToRowHeaderCells,s,0,2),e=!0);i._savedToRows&&(u.undoRowsInfo(i._toSheet,i._savedToRows,s),e=!0);var c=0,l=0,w=0,b=0;i._fromSheet&&f&&(c=f.row<0?0:f.row,l=f.col<0?0:f.col,w=f.row<0?i._fromSheet.getRowCount():f.rowCount,b=f.col<0?i._fromSheet.getColumnCount():f.colCount,i._savedFromTables&&u.undoTableInfo(i._sheet,i._savedFromTables,new t.Range(c,l,w,b)),v=i._savedFromViewportCells,v&&v.isValueOrFormulaSaved()&&(d=u.getValues(i._fromSheet,c,l,w,b)),i._savedFromColumnHeaderCells&&(u.undoCellsInfo(i._fromSheet,i._savedFromColumnHeaderCells,0,l,1),e=!0),i._savedFromColumns&&(u.undoColumnsInfo(i._fromSheet,i._savedFromColumns,l),e=!0),v&&(u.undoCellsInfo(i._fromSheet,v,c,l,3),e=!0),i._savedFromRowHeaderCells&&(u.undoCellsInfo(i._fromSheet,i._savedFromRowHeaderCells,c,0,2),e=!0),i._savedFromRows&&(u.undoRowsInfo(i._fromSheet,i._savedFromRows,c),e=!0));g=n;e&&g&&(k&&i._toSheet&&u.raiseRangeDataChanged(i._toSheet,s,h,y,p,i._savedToAfterPastedChangedCells.getChangedCells(),3,k),d&&i._fromSheet&&u.raiseRangeDataChanged(i._fromSheet,c,l,w,b,i._savedFromAfterPastedChangedCells.getChangedCells(),3,d))}finally{i._resumeInvalidate(n)}return e},i.convertPasteOption=function(n){var t=0;return(n===0||n===1)&&(t|=1),(n===0||n===2)&&(t|=64,t|=32),(n===0||n===3)&&(t|=2),n===0&&(t|=32,t|=16,t|=256,t|=4,t|=512,t|=128),t},i}(f);i.ClipboardPasteRangeUndoAction=rt;oi=function(){function n(n,t,i,r){this.fromRange=n;this.pastedRanges=t;this.isCutting=i;this.clipboardText=r}return n}();i.PasteExtent=oi;si=function(n){function i(i,r,u,f,e){var o,s;if(n.call(this),this._sheet=i,!u)throw new Error(t.SR.Exp_DestSheetIsNull);if(!f)throw new Error(t.SR.Exp_PasteExtentIsNull);if(f.pastedRanges&&f.pastedRanges.length>0)for(this._cachedActions=[],o=0;o<f.pastedRanges.length;o++)s={sourceRange:f.fromRange,targetRange:f.pastedRanges[o],isCutting:f.isCutting,clipboardText:f.clipboardText},this._cachedActions[o]=new rt(i,r,u,s,e)}return __extends(i,n),i.prototype.execute=function(n){var i=this,t,f,u,r,e,o;if(i._cachedActions){t=i._sheet;i._suspendInvalidate(t);f=t.isPaintSuspended();t.isPaintSuspended(!0);try{for(u=0;u<i._cachedActions.length;u++)r=i._cachedActions[u],t?(e=t._raiseClipboardPasting(r.pasteRange(),r.pasteOption()),e||(r.execute(n),t._raiseClipboardPasted(r.pasteRange(),r.pasteOption()))):r.execute(n);i.refreshSelection(n)}finally{t.isPaintSuspended(f);o=i._resumeInvalidate(t);o||i.refreshUI(n)}}},i.prototype.refreshSelection=function(n){var r=this,t=r._sheet,o,f,s,u,i;if(t&&r._cachedActions){if(o=t.getSelections(),t._clearSelectionImp(),r._cachedActions.length>1)for(f=0;f<r._cachedActions.length;f++)s=r._cachedActions[f],u=s.pasteRange(),t.addSelection(u.row,u.col,u.rowCount,u.colCount);else r._cachedActions.length>0&&(i=r._cachedActions[0].pasteRange(),t.addSelection(i.row,i.col,i.rowCount,i.colCount),i.contains(t._activeRowIndex,t._activeColIndex)||t._setActiveCellImp(e(t._getFirstVisualRow(),i.row),e(t._getFirstVisualColumn(),i.col),t.activeRowViewportIndex,t.activeColViewportIndex));t._raiseSelectionChanging(o,t.getSelections())&&t._raiseSelectionChanged()}},i.prototype.refreshUI=function(n){var t=this._sheet;t&&(t.invalidateLayout(),t.repaint())},i.prototype.canExecute=function(n){var t,i;if(this._cachedActions){for(t=0;t<this._cachedActions.length;t++)if(i=this._cachedActions[t],!i.canExecute(n))return!1;return!0}return!1},i.prototype.canUndo=function(){var n,t;if(this._cachedActions){for(n=0;n<this._cachedActions.length;n++)if(t=this._cachedActions[n],!t.canUndo())return!1;return!0}return!1},i.prototype.saveState=function(){var n,t;if(this._cachedActions)for(n=0;n<this._cachedActions.length;n++)t=this._cachedActions[n],t.saveState()},i.prototype.undo=function(n){var t=this,i,r,f,u,e,o;if(t._cachedActions){i=t._sheet;r=!0;t._suspendInvalidate(i);f=i.isPaintSuspended();i.isPaintSuspended(!0);try{for(u=0;u<t._cachedActions.length;u++)e=t._cachedActions[u],r=r&&e.undo(n)}finally{i.isPaintSuspended(f);o=t._resumeInvalidate(i);o||t.refreshUI(n)}return r}return!1},i}(f);i.ClipboardPasteUndoAction=si;hi=function(){function n(n){this.names=n}return n}();i.FloatingObjectExtent=hi;y=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.init=function(n,t){this._sheet=n;this._floatingObjectExtent=t;this._savedFloatingObjects=[]},t.prototype.refreshUI=function(n){var t=this._sheet;t&&(t.invalidateLayout(),t.repaint())},t.prototype.canExecute=function(n){return this._sheet._hasFloatingObjectsSelected()?!0:!1},t.prototype.canUndo=function(){return this._savedFloatingObjects&&this._savedFloatingObjects.length>0?!0:!1},t.prototype.saveState=function(){var n=this,t,r,i;if(n._floatingObjectExtent&&n._floatingObjectExtent.names instanceof Array)for(t=0,r=n._floatingObjectExtent.names.length;t<r;t++)i=n._sheet._findFloatingObjectInternal(n._floatingObjectExtent.names[t]),i&&n._savedFloatingObjects.push(i)},t}(f);i.FloatingObjectUndoActionBase=y;ci=function(n){function i(t,i){n.call(this);this.init(t,i)}return __extends(i,n),i.prototype.init=function(t,i){n.prototype.init.call(this,t,i);this._savedFloatingObjectPositions={}},i.prototype.execute=function(n){var i=this,r,o,u,h,f,e,c,l;if(t.features.floatingObject&&i._floatingObjectExtent&&i._floatingObjectExtent.names instanceof Array){for(i.saveState(),r=i._sheet,i._suspendInvalidate(n),o=r.isPaintSuspended(),r.isPaintSuspended(!0),u=0,h=i._floatingObjectExtent.names.length;u<h;u++)f=r._findFloatingObjectInternal(i._floatingObjectExtent.names[u]),f&&(e=r._slicerCollection,i._isSlicer(f)&&e&&e.removeSlicer(f),c=r._removeFloatingObjectInternal(i._floatingObjectExtent.names[u]),c||(i._savedFloatingObjects[u]=s),f.isSelected(!1));r._loadAndSetSheetSelections();r.isPaintSuspended(o);l=i._resumeInvalidate(n);l||i.refreshUI(n)}},i.prototype.undo=function(n){var i=this,u,o,f,s,r,e,h;if(t.features.floatingObject&&i._savedFloatingObjects&&i._savedFloatingObjects.length>0){for(u=i._sheet,i._suspendInvalidate(n),o=u.isPaintSuspended(),u.isPaintSuspended(!0),f=0,s=i._savedFloatingObjects.length;f<s;f++)r=i._savedFloatingObjects[f],r&&(r.isSelected(!0),u._addFloatingOjectInternal(r),e=u._slicerCollection,i._isSlicer(r)&&e&&e.addSlicer(r),r.position(i._savedFloatingObjectPositions[r.name()]));return u._saveAndClearSheetSelections(),i._savedFloatingObjects.length=0,u.isPaintSuspended(o),h=i._resumeInvalidate(n),h||i.refreshUI(n),!0}return!1},i.prototype._isSlicer=function(n){return n&&n.typeName==="Slicer"},i.prototype.saveState=function(){var r,f,t;n.prototype.saveState.call(this);var u=this,e=u._sheet,i=u._floatingObjectExtent;if(i&&i.names instanceof Array)for(r=0,f=i.names.length;r<f;r++)t=e._findFloatingObjectInternal(i.names[r]),t&&t.position()&&(u._savedFloatingObjectPositions[t.name()]=t.position())},i}(y);i.DeleteFloatingObjectUndoAction=ci;li=function(){function n(n,t){this.offsetX=n;this.offsetY=t}return n}();i.MovingFloatingObjectExtent=li;ai=function(n){function i(t,i,r){n.call(this);this.init(t,i);this._movingSettings=r}return __extends(i,n),i.prototype.execute=function(n){var i=this,r,o,u,s,f,e,h;if(t.features.floatingObject&&i._floatingObjectExtent&&i._floatingObjectExtent.names instanceof Array){for(i.saveState(),r=i._sheet,i._suspendInvalidate(n),o=r.isPaintSuspended(),r.isPaintSuspended(!0),u=0,s=i._floatingObjectExtent.names.length;u<s;u++)f=r._findFloatingObjectInternal(i._floatingObjectExtent.names[u]),e=f.position(),f.position(new t.Point(e.x+i._movingSettings.offsetX,e.y+i._movingSettings.offsetY));r.isPaintSuspended(o);h=i._resumeInvalidate(n);h||i.refreshUI(n)}},i.prototype.undo=function(n){var i=this,r,o,u,s,f,e,h;if(t.features.floatingObject&&i._savedFloatingObjects&&i._savedFloatingObjects.length>0){for(r=i._sheet,i._suspendInvalidate(n),o=r.isPaintSuspended(),r.isPaintSuspended(!0),u=0,s=i._savedFloatingObjects.length;u<s;u++)f=i._savedFloatingObjects[u],e=f.position(),f.position(new t.Point(e.x-i._movingSettings.offsetX,e.y-i._movingSettings.offsetY));return i._savedFloatingObjects.length=0,r.isPaintSuspended(o),h=i._resumeInvalidate(n),h||i.refreshUI(n),!0}return!1},i}(y);i.MovingFloatingObjectUndoAction=ai;vi=function(){function n(n,t,i,r){this.offsetX=n;this.offsetY=t;this.offsetWidth=i;this.offsetHeight=r}return n}();i.ReszingFloatingObjectExtent=vi;yi=function(n){function i(t,i,r){n.call(this);this.init(t,i);this._resizingSettings=r}return __extends(i,n),i.prototype.execute=function(n){var i=this,u,o,f,s,r,e,h;if(t.features.floatingObject&&i._floatingObjectExtent&&i._floatingObjectExtent.names instanceof Array){for(i.saveState(),u=i._sheet,i._suspendInvalidate(n),o=u.isPaintSuspended(),u.isPaintSuspended(!0),f=0,s=i._floatingObjectExtent.names.length;f<s;f++)r=u._findFloatingObjectInternal(i._floatingObjectExtent.names[f]),e=r.position(),r.width(r.width()+i._resizingSettings.offsetWidth),r.height(r.height()+i._resizingSettings.offsetHeight),r.position(new t.Point(e.x+i._resizingSettings.offsetX,e.y+i._resizingSettings.offsetY));u.isPaintSuspended(o);h=i._resumeInvalidate(n);h||i.refreshUI(n)}},i.prototype.undo=function(n){var i=this,u,o,f,s,r,e,h;if(t.features.floatingObject&&i._savedFloatingObjects&&i._savedFloatingObjects.length>0){for(u=i._sheet,i._suspendInvalidate(n),o=u.isPaintSuspended(),u.isPaintSuspended(!0),f=0,s=i._savedFloatingObjects.length;f<s;f++)r=i._savedFloatingObjects[f],e=r.position(),r.position(new t.Point(e.x-i._resizingSettings.offsetX,e.y-i._resizingSettings.offsetY)),r.width(r.width()-i._resizingSettings.offsetWidth),r.height(r.height()-i._resizingSettings.offsetHeight);return i._savedFloatingObjects.length=0,u.isPaintSuspended(o),h=i._resumeInvalidate(n),h||i.refreshUI(n),!0}return!1},i}(y);i.ResizingFloatingObjectUndoAction=yi;b=function(n){function t(){n.call(this);this._sheet=r;this._floatingObjectExtent=r;this._savedObjects=r}return __extends(t,n),t.prototype.refreshUI=function(n){var t=this._sheet;t&&(t.invalidateLayout(),t.repaint())},t.prototype.canExecute=function(n){var i=this,t=i._floatingObjectExtent;return t&&t.names&&t.names.length>0&&i._canEditObjects(t.names)?!0:!1},t.prototype.canUndo=function(){return this._savedObjects&&this._savedObjects.length>0?!0:!1},t.prototype._canEditObjects=function(n){for(var i,u=this,r=u._sheet,t=0,f=n.length;t<f;t++)if(i=r._findFloatingObjectInternal(n[t]),i&&!r.canEditFloatingObject(i))return!1;return!0},t.prototype._generateFloatingObjectName=function(){for(var i="FloatingObject",n=this._sheet._floatingObjectArray.length+1,t=i+n;this._sheet._findFloatingObjectInternal(t)!==r;)n++,t=i+n;return t},t.prototype._isSlicer=function(n){return n&&n.typeName==="Slicer"},t}(f);i.FloatingObjectCopyPasteUndoAction=b;pi=function(n){function i(t,i,u){n.call(this);this._sheet=r;this._fromSheet=r;this._floatingObjectExtent=r;this._savedObjects=r;this.OFFSET=15;var f=this;f._sheet=t;f._fromSheet=u;f._floatingObjectExtent=i;f._savedObjects=[];f._activeRowIndex=f._sheet.getActiveRowIndex();f._activeColumnIndex=f._sheet.getActiveColumnIndex()}return __extends(i,n),i.prototype.execute=function(n){var r=this,ft,nt,a,v,c,o,w,b,tt,it,st,f,rt,ut,ht;if(t.features.floatingObject&&r._floatingObjectExtent&&r._floatingObjectExtent.names&&r._floatingObjectExtent.names.length>0){var u=r._sheet,ct=r._fromSheet,k=r._fromSheet._eventHandler;r._suspendInvalidate(n);ft=u.isPaintSuspended();u.isPaintSuspended(!0);for(var s=r._floatingObjectExtent.names,et=[],h=Number.MAX_VALUE,d=h,g=h,i=0,e=s.length;i<e;i++)o=k._getClipboardFloatingObjectData().findByPropertyName(s[i]).position(),d=l(d,o.x),g=l(g,o.y);for(nt=[],i=0,e=s.length;i<e;i++)o=k._getClipboardFloatingObjectData().findByPropertyName(s[i]).position(),nt.push(new t.Point(o.x-d,o.y-g));if(a=0,v=0,u._hasFloatingObjectsSelected()){var y=h,p=h,ot=u._floatingObjectArray;for(i=0,e=ot.length;i<e;i++)c=ot[i],c&&c.isSelected()&&(o=c.position(),y=l(y,o.x),p=l(p,o.y),c.isSelected(!1));a=y<h?y+r.OFFSET:0;v=p<h?p+r.OFFSET:0}else{for(w=0;w<r._activeRowIndex;w++)v+=u._getActualRowHeight(w,3);for(b=0;b<r._activeColumnIndex;b++)a+=u._getActualColumnWidth(b,3)}for(i=0,e=s.length;i<e;i++)tt=nt[i],et.push(new t.Point(a+tt.x,v+tt.y));for(it=u._getFloatingObjectClipboardHelper(),st=it&&it.isCutting,i=0,e=s.length;i<e;i++)ut=k._getClipboardFloatingObjectData().findByPropertyName(s[i]),st&&!ct._findFloatingObjectInternal(s[i])?(f=ut,f.owner(u)):(f=ut.clone(u),rt=r._isSlicer(f)?u._slicerCollection.getAutoSlicerName(f.name()):r._generateFloatingObjectName()),f.isVisible(!0),f.position(et[i]),f.isSelected(!0),rt&&f.name(rt),r._isSlicer(f)&&u._slicerCollection.addSlicer(f),u._addFloatingOjectInternal(f),r._savedObjects.push(f);u.isPaintSuspended(ft);ht=r._resumeInvalidate(n);ht||r.refreshUI(n)}},i.prototype.undo=function(n){var i=this,r,o,u,s,f,e,h;if(t.features.floatingObject&&i._savedObjects&&i._savedObjects.length>0){for(r=i._sheet,i._suspendInvalidate(n),o=r.isPaintSuspended(),r.isPaintSuspended(!0),u=0,s=i._savedObjects.length;u<s;u++)f=i._savedObjects[u],e=r._slicerCollection,i._isSlicer(f)&&e&&e.removeSlicer(e.getSlicer(f.name())),r._removeFloatingObjectInternal(f.name());return i._savedObjects.length=0,r.isPaintSuspended(o),h=i._resumeInvalidate(n),h||i.refreshUI(n),!0}return!1},i}(b);i.ClipboardPasteFloatingObjectUndoAction=pi;wi=function(n){function i(t,i,u){n.call(this);this._sheet=r;this._floatingObjectExtent=r;this._savedObjects=r;this._movingInfo=r;var f=this;f._sheet=t;f._floatingObjectExtent=i;f._savedObjects=[];f._movingInfo=u}return __extends(i,n),i.prototype.execute=function(n){var i=this,r,h,e,c,f,u,s,o,l,a;if(t.features.floatingObject&&i._floatingObjectExtent&&i._floatingObjectExtent.names&&i._floatingObjectExtent.names.length>0&&i._movingInfo){for(r=i._sheet,i._suspendInvalidate(n),h=r.isPaintSuspended(),r.isPaintSuspended(!0),e=0,c=i._floatingObjectExtent.names.length;e<c;e++)f=r._findFloatingObjectInternal(i._floatingObjectExtent.names[e]),f&&(u=f.clone(r),s=f.position(),u.position(new t.Point(s.x+i._movingInfo.offsetX,s.y+i._movingInfo.offsetY)),u.name(i._generateFloatingObjectName()),u.isSelected(!0),f.isSelected(!1),i._isSlicer(u)&&r._slicerCollection&&(o=u,l=r._slicerCollection.getAutoSlicerName(o.columnName()),o.name(l),r._slicerCollection.addSlicer(o)),r._addFloatingOjectInternal(u),i._savedObjects.push(u));r.isPaintSuspended(h);a=i._resumeInvalidate(n);a||i.refreshUI(n)}},i.prototype.undo=function(n){var i=this,r,f,u,e,c;if(t.features.floatingObject&&i._savedObjects&&i._savedObjects.length>0){for(r=i._sheet,i._suspendInvalidate(n),f=r.isPaintSuspended(),r.isPaintSuspended(!0),u=0,e=i._savedObjects.length;u<e;u++){var o=i._savedObjects[u].name(),s=r._slicerCollection,h=r._findFloatingObjectInternal(o);i._isSlicer(h)&&s&&s.removeSlicer(h);r._removeFloatingObjectInternal(o)}return i._savedObjects.length=0,r.isPaintSuspended(f),c=i._resumeInvalidate(n),c||i.refreshUI(n),!0}return!1},i}(b);i.DragCopyFloatingObjectUndoAction=wi;k=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.init=function(n,t){this._sheet=n;this._comment=t},t.prototype.refreshUI=function(n){var t=this._sheet;t&&(t.invalidateLayout(),t.repaint())},t.prototype.canExecute=function(n){return!0},t.prototype.canUndo=function(){return this._savedComment?!0:!1},t.prototype.saveState=function(){this._savedComment=this._comment},t.prototype.clearState=function(){this._savedComment=s},t}(f);i.CommentUndoActionBase=k;bi=function(n){function t(t,i){n.call(this);this.init(t,i)}return __extends(t,n),t.prototype.execute=function(n){var i=this,t,e,o;i.saveState();t=i._sheet;i._suspendInvalidate(n);e=t.isPaintSuspended();t.isPaintSuspended(!0);var u=i._comment,s=t._commentManager,f={sheet:t,sheetName:t.getName(),comment:u,cancel:!1};t.triggerCommentRemoving(f);f&&f.cancel===!0?i.clearState():(t.setComment(u._rowIndex,u._colIndex,r),s._activeComment=r,t._loadAndSetSheetSelections(),t.triggerCommentRemoved({sheet:t,sheetName:t.getName(),comment:u}));t.isPaintSuspended(e);o=i._resumeInvalidate(n);o||i.refreshUI(n)},t.prototype.undo=function(n){var t=this,i,r,u;return t._savedComment?(i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),i.setComment(t._savedComment._rowIndex,t._savedComment._colIndex,t._savedComment),i._saveAndClearSheetSelections(),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n),!0):!1},t}(k);i.CommentDeleteUndoAction=bi;ki=function(n){function t(t,i,r,u,f){n.call(this);var e=this;e.init(t,i);e._oldValue=r;e._newValue=u;e._propertyName=f}return __extends(t,n),t.prototype.execute=function(n){var t=this,i,r,u;t._comment&&(t.saveState(),i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._comment._changeProperty(t._propertyName,t._newValue),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n))},t.prototype.undo=function(n){var t=this,i,r,u;return t._savedComment?(i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._comment._changeProperty(t._propertyName,t._oldValue),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n),!0):!1},t}(k);i.CommentPropertyUndoAction=ki;di=function(n){function t(){n.call(this);this._commentUndoTransaction=[]}return __extends(t,n),t.prototype.execute=function(n){var t=this,i,r;if(t._commentUndoTransaction&&t._commentUndoTransaction.length>0)for(i=0;i<t._commentUndoTransaction.length;i++)r=t._commentUndoTransaction[i],r&&r.execute(n)},t.prototype.undo=function(n){var t=this,i,r;if(t._commentUndoTransaction&&t._commentUndoTransaction.length>0){for(i=0;i<t._commentUndoTransaction.length;i++)r=t._commentUndoTransaction[i],r&&r.undo(n);return!0}return!1},t.prototype.add=function(n){this._commentUndoTransaction.push(n)},t}(f);i.CommentUndoTransaction=di;d=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.init=function(n,t){this._sheet=n;this._slicerData=t},t.prototype.refreshUI=function(n){var t=this._sheet;t&&(t.invalidateLayout(),t.repaint())},t.prototype.canExecute=function(n){return!0},t.prototype.canUndo=function(){return this._slicerData?!0:!1},t.prototype.saveState=function(){this._savedSlicerData=this._slicerData},t}(f);i.SlicerDataUndoActionBase=d;gi=function(n){function t(t,i,r,u,f){n.call(this);var e=this;e.init(t,i);e._columnName=r;e._oldValue=u;e._newValue=f}return __extends(t,n),t.prototype.execute=function(n){var t=this,i,r,u;t._slicerData&&(t.saveState(),i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._slicerData.doFilter(t._columnName,{exclusiveRowIndexes:t._newValue}),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n))},t.prototype.undo=function(n){var t=this,i,r,u;return t._slicerData?(i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._slicerData.doFilter(t._columnName,{exclusiveRowIndexes:t._oldValue}),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n),!0):!1},t}(d);i.SlicerDataFilterUndoAction=gi;nr=function(n){function t(t,i,r,u){n.call(this);var f=this;f.init(t,i);f._columnName=r;f._value=u}return __extends(t,n),t.prototype.execute=function(n){var t=this,i,r,u;t._slicerData&&(t.saveState(),i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._slicerData.doUnfilter(t._columnName),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n))},t.prototype.undo=function(n){var t=this,i,r,u;return t._slicerData?(i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._slicerData.doFilter(t._columnName,{exclusiveRowIndexes:t._value}),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n),!0):!1},t}(d);i.SlicerDataUnFilterUndoAction=nr;ut=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.init=function(n,t){this._sheet=n;this._slicer=t},t.prototype.refreshUI=function(n){var t=this._sheet;t&&(t.invalidateLayout(),t.repaint())},t.prototype.canExecute=function(n){return!0},t.prototype.canUndo=function(){return this._slicer?!0:!1},t.prototype.saveState=function(){this._savedSlicer=this._slicer},t}(f);i.SlicerUndoActionBase=ut;tr=function(n){function t(t,i,r,u,f){n.call(this);var e=this;e.init(t,i);e._oldValue=u;e._newValue=f;e._propertyName=r}return __extends(t,n),t.prototype.execute=function(n){var t=this,i,r,u;t._slicer&&(t.saveState(),i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._slicer[t._propertyName](t._newValue),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n))},t.prototype.undo=function(n){var t=this,i,r,u;return t._savedSlicer?(i=t._sheet,t._suspendInvalidate(n),r=i.isPaintSuspended(),i.isPaintSuspended(!0),t._slicer[t._propertyName](t._oldValue),i.isPaintSuspended(r),u=t._resumeInvalidate(n),u||t.refreshUI(n),!0):!1},t}(ut);i.SlicerPropertyUndoAction=tr})(t.UndoRedo||(t.UndoRedo={}));var i=t.UndoRedo})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){var pt;t.feature("core.sheet_event",["core.common","core.sheet_action","core.stringResource"]);var i=null,f=undefined,e=Math.max,r=Math.min,o=Math.abs,ht=Math.ceil,k="undefined",s="position",h="absolute",y="border",wt="border-radius",ut="padding",ft="box-shadow",d="font",g="background-color",p="overflow",c="top",l="left",nt="z-index",ct="outline",tt="width",it="height",lt="resize",b="hidden",at="visible",w="auto",et="white",a="none",ot="tabindex",vt="size",v="gcUIElement",rt=t.util.device(),st=rt.iphone||rt.ipad||rt.android,u=window.document,yt=function(){function rt(n){this.RESIZETOOLTIP_TOP=30;this.DRAGDROPTOOLTIP_OFFSET=5;this.DRAGFILLTOOLTIP_OFFSET=3;this.VSCROLLTOOLTIP_LEFT=100;this.HSCROLLTOOLTIP_LEFT=30;this.HSCROLLTOOLTIP_TOP=40;this._clipboardFloatingObjectData=i;this._repeatKeyDownTimeoutID=0;this.waittime=100;this.newLeft=0;this.newTop=0;this._focusReleased=!1;this._init(n)}return rt.prototype._init=function(n){this._sheet=n;this._elem=i;this._eventSuspended=0},rt.prototype._getElem=function(){return this._elem||(this._elem=u.createElement("input")),this._elem},rt.prototype._dispose=function(){var n=this;n._hScrollTimer&&n._hScrollTimer._dispose();n._vScrollTimer&&n._vScrollTimer._dispose();n.mousePosition=i},rt.prototype._getHScrollTimer=function(){var n=this;return n._hScrollTimer||(n._hScrollTimer=new t.Timer(n)),n._hScrollTimer},rt.prototype._getVScrollTimer=function(){var n=this;return n._vScrollTimer||(n._vScrollTimer=new t.Timer(n)),n._vScrollTimer},rt.prototype.doResize=function(){var s=this._sheet,n=s._getCanvas(),f,o,y,p,i,r,l;if(n&&n.parentNode){var v=getComputedStyle(n.parentNode),h=v.width,c=v.height,u=h.indexOf("px");(u>0&&(h=h.substring(0,u)),u=c.indexOf("px"),u>0&&(c=c.substring(0,u)),f=parseInt(h),o=parseInt(c),isNaN(f)&&(f=t.GC$(n.parentNode).width()),isNaN(o)&&(o=t.GC$(n.parentNode).height()),f!==0&&o!==0)&&(y=0,p=0,n.style.display=a,i=e(f-y,0),r=e(o-p,0),n.style.display="",n.width=i,n.height=r,n.style.width=i+"px",n.style.height=r+"px",i=n.clientWidth||n.width,r=n.clientHeight||n.height,l=s.getBounds(),s.setBounds(new t.Rect(l.x,l.y,i,r)),t.DPIHelper.setSize(n,i,r),s.invalidateLayout())}},rt.prototype._getCanvasOffset=function(){var i=this._sheet,n=t.GC$(i._getCanvas()).offset();return n?(isNaN(u.body.clientTop)||(n.top+=u.body.clientTop),isNaN(u.body.clientLeft)||(n.left+=u.body.clientLeft)):n={top:0,left:0},window.gcGlobal.canvasOffset&&(n=window.gcGlobal.canvasOffset),n},rt.prototype._getCanvasPosition=function(){var i=this._sheet,n=t.GC$(i._getCanvas()).position();return n||(n={top:0,left:0}),n},rt.prototype.doMouseDown=function(n){var t,i,r,u;return n.button===2?!0:(t=this,i=t._sheet,t.handleDocumentMouseMove(),r=t._getCanvasOffset(),u=t.doMouseDownImp(n,n.pageX-r.left,n.pageY-r.top),i.isEditing()||u||t.setFocus(),i._isMouseDownInSheet=!0,!1)},rt.prototype.handleDocumentMouseMove=function(){var n=this;n._isMouseCapture||(t.GC$(u).bind("mousemove.gcSheet",function(t){n.doMouseMove(t)}).bind("mouseup.gcSheet",function(t){n.doMouseUp(t)}),n._isMouseCapture=!0)},rt.prototype.unhandleDocumentMouseMove=function(){this._isMouseCapture&&(this._isMouseCapture=!1,t.GC$(u).unbind("mousemove.gcSheet").unbind("mouseup.gcSheet"))},rt.prototype.doMouseDownImp=function(n,r,u){var s=this,e=s._sheet,o=e.hitTest(r,u),h=o.row,c=o.col,rt=o.groupHitInfo,v=o.dragInfo,y=o.filterButtonHitInfo,a=o.formulaRangeHitInfo,l=o.cellTypeHitInfo,g,nt,w,b,k,ut,d,et,tt,it;if(typeof e.unSelectAllFloatingObjects=="function"&&e.unSelectAllFloatingObjects(),g=e._commentManager,g&&g.deactivateComment(),rt)e.isEditing()||s._doClickRangeGroup(rt);else if(e._currentTarget=o,s.isMouseDown=!0,o.resizeInfo){if(!e.endEdit())return;s.startResizing(o)}else if(v&&v.side&&v.side!=="corner"){if(!e.endEdit())return;s.startDragDropping(o)}else if(v&&v.side==="corner"){if(!e.endEdit())return;s.startDragFill(o)}else if(y){if(!e.endEdit())return;if(!y||!y.rowFilter)return;y.rowFilter.openFilterDialog(y)}else if(a)a.inBorder?s.startFormulaRangeMoving(o):(a.inTopLeft||a.inTopRight||a.inBottomLeft||a.inBottomRight)&&s.startFormulaRangeResizing(o);else if(e.canSelect(o.rowViewportIndex<0?-1:h,o.colViewportIndex<0?-1:c)){if(nt=e._formulaTextBox,nt&&nt.canAppendRange()){s.startFormulaRangeAppending(o);return}else if(s._clearFormulaTextbox(e))return;if(w=e.getActiveRowIndex(),b=e.getActiveColumnIndex(),l){if(k=l.sheetArea,(k===i||k===f||k===3)&&(h!==w||c!==b)){ut=e.isPaintSuspended();e.isPaintSuspended(!0);try{if(!e.endEdit())return;if(d={sheet:e,sheetName:e._name,row:w,col:b,cancel:!1},e.triggerLeaveCell(d),d&&d.cancel===!0)return;var ot=e._selectionModel.toArray(),ft=null,p=e._getSpanModel().find(h,c);ft=p?[new t.Range(p.row,p.col,p.rowCount,p.colCount)]:[new t.Range(h,c,1,1)];e.triggerSelectionChanging({sheet:e,sheetName:e._name,oldSelections:ot,newSelections:ft});e._setActiveCellAndSelection(h,c,f,f,1);e.triggerEnterCell({sheet:e,sheetName:e._name,row:h,col:c});e.triggerSelectionChanged({sheet:e,sheetName:e._name});s._updateValidationUI(h,c)}finally{e.isPaintSuspended(ut)}}et=e.getCellType(h,c,o.hitTestType);l.sheet||(l.sheet=e);et.processMouseDown(l)}if(l&&l.isReservedLocation)return!0;else{s.setMetaKeyState(n);try{if(s._hitTestResult=o,e.isEditing()&&w===e.getActiveRowIndex()&&b===e.getActiveColumnIndex()&&!e.endEdit())return}finally{s._hitTestResult=i}if(h===f||h===i||c===f||c===i)return;o.hitTestType===3&&s._updateValidationUI(h,c);tt=e._selectionModel.toArray();s.startSelecting(o);it=e._selectionModel.toArray();s._notEqualSelecions(tt,it)&&e.triggerSelectionChanging({sheet:e,sheetName:e._name,oldSelections:tt,newSelections:it})}}},rt.prototype._clearFormulaTextbox=function(n){var e=!1,r=t.features.formulatextbox&&t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,u,f;if(r&&r.dom)if(u=r.sheet,f=n._formulaTextBox,f&&u.setFormula(r.rowIndex,r.columnIndex,f.text()),u!==n){if(t.SpreadActions.changeSheetForFormulaTextboxAcrossSheet(u),!u.endEdit())return;e=!0}else f&&(f.destroy(),n._formulaTextBox=i),r.clear();return e},rt.prototype._doClickRangeGroup=function(n){var i=this._sheet,r,e,u,o,f,s,h,c;i&&n&&t.features.group&&(r=n.info,n.what==="rgh"?i&&!i.isEditing()&&(e=r.index,u={sheet:i,sheetName:i._name,isRowGroup:!0,index:-1,level:e,cancel:!1},i.triggerRangeGroupStateChanging(u),u&&u.cancel===!1&&(o=new t.UndoRedo.RowGroupHeaderExpandUndoAction(i,{level:e}),i._doCommand(o),i.triggerRangeGroupStateChanged({sheet:i,sheetName:i._name,isRowGroup:!0,index:-1,level:e}))):n.what==="cgh"?i.isEditing()||(e=r.index,u={sheet:i,sheetName:i._name,isRowGroup:!1,index:-1,level:e,cancel:!1},i.triggerRangeGroupStateChanging(u),u&&u.cancel===!1&&(o=new t.UndoRedo.ColumnGroupHeaderExpandUndoAction(i,{level:e}),i._doCommand(o),i.triggerRangeGroupStateChanged({sheet:i,sheetName:i._name,isRowGroup:!1,index:-1,level:e}))):n.what==="rg"?i.rowRangeGroup&&(f=r.index,s=r.isExpanded,r.lineDirection===1?f--:f++,u={sheet:i,sheetName:i._name,isRowGroup:!0,index:f,level:r.level,cancel:!1},i.triggerRangeGroupStateChanging(u),u&&u.cancel===!1&&(h=new t.UndoRedo.RowGroupExpandUndoAction(i,{index:r.index,level:r.level,collapsed:s}),i._doCommand(h),i.triggerRangeGroupStateChanged({sheet:i,sheetName:i._name,isRowGroup:!0,index:f,level:r.level}))):n.what==="cg"&&i.colRangeGroup&&(f=r.index,s=r.isExpanded,r.lineDirection===1?f--:f++,u={sheet:i,sheetName:i._name,isRowGroup:!1,index:f,level:r.level,cancel:!1},i.triggerRangeGroupStateChanging(u),u&&u.cancel===!1&&(c=new t.UndoRedo.ColumnGroupExpandUndoAction(i,{index:r.index,level:r.level,collapsed:s}),i._doCommand(c),i.triggerRangeGroupStateChanged({sheet:i,sheetName:i._name,isRowGroup:!1,index:f,level:r.level}))))},rt.prototype._isInvalidRect=function(n){var r=this._sheet,t;return r?(t=r._getSheetLayout(),n.x===i||n.x===f||n.y===i||n.y===f||n.width===i||n.width===f||n.height===i||n.height===f||n.x+n.width>t.viewportX+t.viewportWidth+t.frozenTrailingWidth||n.y+n.height>t.viewportY+t.viewportHeight+t.frozenTrailingHeight):!0},rt.prototype._commitSelectValue=function(n,r,u,e){for(var v,c,l,y,p,o=this._sheet,s,h=0,a=n.options,w=a.length;h<w;h++)if(v=a[h],v.selected){s=e[h].value;break}c=!1;o.isProtected&&(l=o.getActualStyle(r,u),l&&(c=l.locked));s===i||s===f||c||(y={row:r,col:u,newValue:s,autoFormat:!0},p=new t.UndoRedo.CellEditUndoAction(o,y),o._doCommand(p));t.GC$(n).hide()},rt.prototype._updateValidationUI=function(n,o){var st=this,p=st._sheet,ni=p&&p.parent,ai,ti,k,it,b,wt,ii,yt,tt,dt,pt,fi,oi,ht,gt,si,hi,ci,li,pi,lt;if(ni&&t.features.dataValidator&&(ai=p._disposeValidationUI(),ai)&&(ti=ni.getActiveSheet(),ti&&p.getName()===ti.getName())&&(k=p.getDataValidator(n,o),k)&&(it=st._getCanvasOffset(),b=p.getCellRect(n,o),!st._isInvalidRect(b))&&(wt=t.util.getPreferredZIndex(ni.getHost()),k&&k.showInputMessage&&k.inputMessage&&(ii=u.createElement("span"),t.GC$(ii).css(s,h).css(y,"1px #C0C0C0 solid").css(ut,"3px 8px 3px 8px").css(g,"#FFFFFF").css(ft,"1px 2px 5px rgba(0,0,0,0.4)").css(d,"normal normal normal 12px/normal Arial").width(w).height(w).css(c,b.y+b.height+it.top+5).css(l,b.x+b.width/2+it.left).css(nt,wt).html("<b>"+k.inputTitle+"<\/b><br/>"+k.inputMessage).attr(v,"gcValidationInputMessage").appendTo(u.body),p._validationInputMessage=ii),k&&k.type===3&&k.inCellDropdown)){var at=k.condition.getValidListImp(p,n,o),bt=at.length,ot=u.createElement("select"),wi=p.getText(n,o),kt=-1,vi=u.createDocumentFragment();for(yt=0;yt<bt;yt++)(tt=at[yt].text,tt===i||tt===f||t.util.hasCalc()&&tt instanceof t.Calc.CalcError)||(kt<0&&tt===wi&&(kt=yt),tt instanceof Date&&(tt=new t._DateTimeHelper(tt).localeFormat("M/d/yyyy h:mm:ss")),dt=u.createElement("option"),dt.value=tt,dt.text=tt,vi.appendChild(dt));ot.appendChild(vi);ot.selectedIndex=kt>0?kt:0;var ri=p.getActualStyle(n,o),yi=p._render,ui=ri&&ri.font?ri.font:yi._getDefaultFont();p._zoomFactor>1&&(ui=yi._getZoomFont(ui));pt=p.getSpans(new t.Range(n,o,1,1));fi=1;pt&&pt.length>0&&pt[0]&&(fi=pt[0].colCount);var ei=o+fi-1==p.getColumnCount()-1,rt=p.getRowHeight(n)*p._zoomFactor,bi=p.parent&&p.parent.useTouchLayout();rt=bi?r(50,rt):r(15,rt);oi=t.util.device();ht=t.util.browser.safari&&(oi.ipad||oi.iphone);ht?(gt=b.width+3,si=b.height+3,hi=b.y+it.top-1.5,ci=b.x+it.left-1.5,li=et):(gt=e(b.width+(ei?0:rt),p.defaults.colWidth),si=bt>8?140:w,hi=b.y+b.height+it.top,ci=b.x+b.width+it.left+(ei?0:rt)-gt,li="");pi=t.GC$(ot).css(ct,a).css(s,h).css(d,ui).css(nt,wt).css(g,li).width(gt).height(si).css(c,hi).css(l,ci).attr(v,"gcValidationSelect").appendTo(u.body).attr(vt,bt>2?bt:2).hide().bind("click",function(){st._commitSelectValue(ot,n,o,at);ht&&t.GC$(p._validationButton).show()}).bind("keydown",function(i){i.keyCode!==13||i.ctrlKey||i.shiftKey||i.altKey?i.keyCode!==27||i.ctrlKey||i.shiftKey||i.altKey||t.GC$(ot).hide():st._commitSelectValue(ot,n,o,at);ht&&t.GC$(p._validationButton).show()});ht&&pi.bind("blur",function(i){st._commitSelectValue(ot,n,o,at);t.GC$(p._validationButton).show()});p._validationSelect=ot;lt=u.createElement("input");lt.type="image";lt.src=t.DefaultDataValidator.getImageSrc();lt.alt="v";t.GC$(lt).css(s,h).width(rt).height(rt).css(c,b.y+b.height+it.top-(rt+3)).css(l,b.x+b.width+it.left-(ei?rt:0)).css(nt,wt).css(g,et).css(y,"1px solid gray").attr(v,"gcValidationButton").appendTo(u.body).bind("click",function(){(!p.isEditing()||p.endEdit())&&(t.GC$(p._validationSelect).toggle().focus(),ht&&t.GC$(p._validationButton).toggle())});p._validationButton=lt}},rt.prototype.startScroll=function(){var n=this,t;n.startHitInfo&&(t=n.startHitInfo.hitTestType,(t===3||t===2)&&n._getVScrollTimer().setAction(n.processVSScrolled),(t===3||t===1)&&n._getHScrollTimer().setAction(n.processHSScrolled))},rt.prototype.processVSScrolled=function(n){var t=this,s=t.adjustScrollRowViewport(),r,e,o;if(!s){var h=t.startHitInfo,i=t._sheet,f=h.scrollRowViewportIndex,u=i.getViewportTopRow(f),c=i.getViewportBottomRow(f);n?c<i.getRowCount()-i._frozenTrailingRowCount-1?i._setTopRow(i._getNextVisualRow(u)):(r=i._getRowLayout(f),r&&r.length>0&&(e=i._getSheetLayout(),o=r[r.length-1],o.y+o.height>=e.viewportY+e.viewportHeight&&i._setTopRow(i._getNextVisualRow(u)))):u>i.frozenRowCount&&i._setTopRow(i._getPrevVisualRow(u))}t.isSelecting&&t.continueSelecting();t.isDragDropping&&t.continueDragDropping();t.isDraggingFill&&t.continueDragFill();t.isFormulaRangeAppending&&t.continueFormulaRangeAppending();t.isFormulaRangeMoving&&t.continueFormulaRangeMoving();t.isFormulaRangeResizing&&t.continueFormulaRangeResizing()},rt.prototype.processHSScrolled=function(n){var t=this,s=t.adjustScrollColViewport(),r,e,o;if(!s){var i=t._sheet,h=t.startHitInfo,f=h.scrollColViewportIndex,u=i.getViewportLeftColumn(f),c=i.getViewportRightColumn(f);n?c<i.getColumnCount()-i._frozenTrailingColCount-1?i._setLeftColumn(i._getNextVisualColumn(u)):(r=i._getColumnLayout(f),r&&r.length>0&&(e=i._getSheetLayout(),o=r[r.length-1],o.x+o.width>=e.viewportX+e.viewportWidth&&i._setLeftColumn(i._getNextVisualColumn(u)))):u>i.frozenColCount&&i._setLeftColumn(i._getPrevVisualColumn(u))}t.isSelecting&&t.continueSelecting();t.isDragDropping&&t.continueDragDropping();t.isDraggingFill&&t.continueDragFill();t.isFormulaRangeAppending&&t.continueFormulaRangeAppending();t.isFormulaRangeMoving&&t.continueFormulaRangeMoving();t.isFormulaRangeResizing&&t.continueFormulaRangeResizing()},rt.prototype.adjustScrollRowViewport=function(){var n=this._sheet,u=n._getSheetLayout(),o=this.mousePosition,f=this.startHitInfo,h=f.scrollRowViewportIndex,t,i,e;if(h===0){if(o.y>u.viewportY)return n._setTopRow(n._getFirstPageTopRow()),f.scrollRowViewportIndex=1,!0}else if(h===1){if(t=n._getRowLayout(1),t&&t.length>0){if(i=t[0],n.frozenRowCount>0&&o.y<u.viewportY&&i.row<=n._getFirstPageTopRow())return f.scrollRowViewportIndex=0,!0;if(i=t[t.length-1],n._frozenTrailingRowCount>0&&o.y>u.frozenTrailingY&&i.row>=n._getLastVisualRow()&&i.y+i.height<=u.frozenTrailingY)return f.scrollRowViewportIndex=2,!0}}else if(h===2&&(t=n._getRowLayout(1),t&&t.length>0&&o.y<u.frozenTrailingY)){if(i=t[t.length-1],i.y+i.height>u.frozenTrailingY){var l=u.viewportHeight,s=n.getRowCount()-n._frozenTrailingRowCount-1,c=0;for(e=s;e>=n.frozenRowCount;e--)if(c+=n._getZoomRowHeight(e),c>l){s=r(e+1,s);break}n._setTopRow(n._getNextVisualRow(s-1))}return f.scrollRowViewportIndex=1,!0}return!1},rt.prototype.adjustScrollColViewport=function(){var n=this._sheet,u=n._getSheetLayout(),o=this.mousePosition,f=this.startHitInfo,h=f.scrollColViewportIndex,t,i,e;if(h===0){if(o.x>u.viewportX)return n._setLeftColumn(n._getFirstPageLeftColumn()),f.scrollColViewportIndex=1,!0}else if(h===1){if(t=n._getColumnLayout(1),t&&t.length>0){if(i=t[0],n.frozenColCount>0&&o.x<u.viewportX&&i.col<=n._getFirstPageLeftColumn())return f.scrollColViewportIndex=0,!0;if(i=t[t.length-1],n._frozenTrailingColCount>0&&o.x>u.frozenTrailingX&&i.col>=n._getLastVisualColumn()&&i.x+i.width<=u.frozenTrailingX)return f.scrollColViewportIndex=2,!0}}else if(h===2&&(t=n._getColumnLayout(1),t&&t.length>0&&o.x<u.frozenTrailingX)){if(i=t[t.length-1],i.x+i.width>u.frozenTrailingX){var l=u.viewportWidth,s=n.getColumnCount()-n._frozenTrailingColCount-1,c=0;for(e=s;e>=n.frozenColCount;e--)if(c+=n._getZoomColumnWidth(e),c>l){s=r(e+1,s);break}n._setLeftColumn(n._getNextVisualColumn(s-1))}return f.scrollColViewportIndex=1,!0}return!1},rt.prototype.continueScroll=function(){var t=this,e,o;if(t.isWorking||t.isFloatingObjectWorking||t.isCommentWorking){var c=t._sheet,s=c._getSheetLayout(),h=t.startHitInfo,u=h.scrollRowViewportIndex,f=h.scrollColViewportIndex,r=t.mousePosition,n=i;u>=0&&f>=0?n=s.viewportRect(u,f):u>=0?n=s.rowHeaderRect(u):f>=0&&(n=s.colHeaderRect(f));n&&(e=0,o=0,r.x<=n.x?e=r.x-n.x:r.x>=n.x+n.width&&(e=r.x-(n.x+n.width)),r.y<=n.y?o=r.y-n.y:r.y>=n.y+n.height&&(o=r.y-(n.y+n.height)),t._getHScrollTimer().setInterval(t.getIntervalFromDistance(e)),t._getVScrollTimer().setInterval(t.getIntervalFromDistance(o)))}},rt.prototype.stopScroll=function(){this._getHScrollTimer().stop();this._getVScrollTimer().stop()},rt.prototype.startResizing=function(n){var i=this,r=i._sheet,a=r._getSheetLayout(),t=n.resizeInfo,s,f,h,e,o;t.action==="sizeRow"||t.action==="sizeHiddenRow"?(s=r._getAllRowLayout(t.sheetArea),r.getRowVisible(t.index)||(t.index=i._getPreVisualRow(t.index,t.sheetArea)),f=s.findRow(t.index),f||(f=s.findRow(n.row)),t.startY=f.y):(h=r._getAllColumnLayout(t.sheetArea),r.getColumnVisible(t.index)||(t.index=i._getPreVisualCol(t.index,t.sheetArea)),e=h.findCol(t.index),e||(e=h.findCol(n.col)),t.startX=e.x);var c=r.parent,l=n.x,u=n.y;c&&(o=c.showResizeTip(),(o===1&&(t.action==="sizeCol"||t.action==="sizeHiddenCol")||o===2&&(t.action==="sizeRow"||t.action==="sizeHiddenRow")||o===3)&&(u=u-i.RESIZETOOLTIP_TOP<0?u+i.RESIZETOOLTIP_TOP/2:u-i.RESIZETOOLTIP_TOP,i._showTooltip(i._getMouseDownResizeTooltipContent(),l,u)));i.isResizing=!0;i.isWorking=!0},rt.prototype.continueResizing=function(){var i=this,u=i._sheet,o=u._currentTarget,n=o.resizeInfo,h=i.mousePosition,c=h.x,l=h.y,t=u._getSheetLayout(),r,v,f,a,s,e;n&&i.isWorking&&i.isResizing&&(o.x!==c||o.y!==l)&&(n.action==="sizeRow"||n.action==="sizeHiddenRow"?(n.movingY=l,n.movingY<n.startY&&(n.movingY=n.startY),r=t.y+t.height,n.movingY>r&&(n.movingY=r)):(n.movingX=c,n.movingX<n.startX&&(n.movingX=n.startX),r=t.x+t.width,n.movingX>r&&(n.movingX=r)),f=u._render,a=f._getCtx(),f.copyDoubleBuffer(t.x,t.y,t.width,t.height),f.paintAdornment(a),s=u.parent,s&&(e=s.showResizeTip(),(e===1&&(n.action==="sizeCol"||n.action==="sizeHiddenCol")||e===2&&(n.action==="sizeRow"||n.action==="sizeHiddenRow")||e===3)&&i._refreshTooltip(i._getMouseMoveResizeTooltipContent(n))))},rt.prototype.stopResizing=function(){var s=this,l,p,a,w,y;s.isResizing=!1;s.isWorking=!1;var v=!0,r=s._sheet,b=r._currentTarget,n=b.resizeInfo,h,o,u,c;if(n){if(s._removeTooltip(),n.action==="sizeRow"||n.action==="sizeHiddenRow")if(n.movingY!==f&&n.movingY!==i){if(h=e(0,(n.movingY-n.startY)/r._zoomFactor),l=[],r._isRowSelected(n.index))for(o=0;o<r._selectionModel.length;o++)u=r._selectionModel[o],u.col===-1&&(u=r._getActualRange(u),l.push({firstRow:u.row,lastRow:u.row+u.rowCount-1}));else l.push({firstRow:n.index,lastRow:n.index});p=n.sheetArea===1;c=new t.UndoRedo.RowResizeUndoAction(r,l,h,p);r._doCommand(c)}else v=!1;else if(n.movingX!==f&&n.movingX!==i){if(h=e(0,(n.movingX-n.startX)/r._zoomFactor),a=[],r._isColumnSelected(n.index))for(o=0;o<r._selectionModel.length;o++)u=r._selectionModel[o],u.row===-1&&(u=r._getActualRange(u),a.push({firstCol:u.col,lastCol:u.col+u.colCount-1}));else a.push({firstCol:n.index,lastCol:n.index});w=n.sheetArea===2;c=new t.UndoRedo.ColumnResizeUndoAction(r,a,h,w);r._doCommand(c)}else v=!1;y=r.hitTest(s.mousePosition.x,s.mousePosition.y);y&&s.updateCanvasCursor(y);v||r.repaint()}},rt.prototype._startSelectingCore=function(n,t){var v=0,y=0,p=0,w=0,u=this,i=u._sheet,s,f,e,l,a,b,h,c;if(u._lastSelections=i._selectionModel.toArray(),u.ctrl||u.shift||i._clearSelectionImp(),n.hitTestType===0){if(!u.shift){if(s=i.frozenRowCount?i._getFirstVisualRow():i._scrollTopRow,a=i.frozenColCount?i._getFirstVisualColumn():i._scrollLeftCol,f={sheet:i,sheetName:i._name,row:i._activeRowIndex,col:i._activeColIndex,cancel:!1},i.triggerLeaveCell(f),f&&f.cancel===!0)return;i._setActiveCellImp(s,a,1,1,t);i.triggerEnterCell({sheet:i,sheetName:i._name,row:s,col:a});u._updateValidationUI(s,a)}u.ctrl||i._clearSelectionImp();i._setSelectedRange(-1,-1,i.getRowCount(),i.getColumnCount(),!0)}else if(n.hitTestType===1){if(!u.shift){if(s=i.frozenRowCount?i._getFirstVisualRow():i._scrollTopRow,e=i._getAvailableActiveCell(s,n.col,!1),f={sheet:i,sheetName:i._name,row:i._activeRowIndex,col:i._activeColIndex,cancel:!1},i.triggerLeaveCell(f),f&&f.cancel===!0)return;i._setActiveCellImp(e.row,e.col,1,n.colViewportIndex,t);i.triggerEnterCell({sheet:i,sheetName:i._name,row:e.row,col:e.col});u._updateValidationUI(e.row,e.col)}u.shift?(v=r(i._activeColIndex,n.col),w=o(i._activeColIndex-n.col)+1,i._replaceActiveSelectedRange(-1,v,i.getRowCount(),w,!0)):i._setSelectedRange(-1,i._activeColIndex,i.getRowCount(),1,!0)}else if(n.hitTestType===2){if(!u.shift){if(b=i.frozenColCount?i._getFirstVisualColumn():i._scrollLeftCol,e=i._getAvailableActiveCell(n.row,b,!0),f={sheet:i,sheetName:i._name,row:i._activeRowIndex,col:i._activeColIndex,cancel:!1},i.triggerLeaveCell(f),f&&f.cancel===!0)return;l=i._activeRowIndex!==e.row;i._setActiveCellImp(e.row,e.col,n.rowViewportIndex,1,t);l&&i.doDataItemChanged();i.triggerEnterCell({sheet:i,sheetName:i._name,row:e.row,col:e.col});u._updateValidationUI(e.row,e.col)}u.shift?(y=r(i._activeRowIndex,n.row),p=o(i._activeRowIndex-n.row)+1,i._replaceActiveSelectedRange(y,-1,p,i.getColumnCount(),!0)):i._setSelectedRange(i._activeRowIndex,-1,1,i.getColumnCount(),!0)}else if(n.hitTestType===3)if(isNaN(n.row)||isNaN(n.col))i.isEditing()&&(c=i.getCellRect(i._activeRowIndex,i._activeColIndex,i.activeRowViewportIndex,i.activeColViewportIndex),i._render.update(c.x,c.y,c.width,c.height));else{if(!u.shift&&(i._activeRowIndex!==n.row||i._activeColIndex!==n.col)){if(f={sheet:i,sheetName:i._name,row:i._activeRowIndex,col:i._activeColIndex,cancel:!1},i.triggerLeaveCell(f),f&&f.cancel===!0)return;l=i._activeRowIndex!==n.row;i._setActiveCellImp(n.row,n.col,n.rowViewportIndex,n.colViewportIndex,t);l&&i.doDataItemChanged();i.triggerEnterCell({sheet:i,sheetName:i._name,row:n.row,col:n.col});u._updateValidationUI(n.row,n.col)}u.shift?i._extendSelectedRange(n.row,n.col,!0):(h=i._getSpanModel().find(n.row,n.col),h?i._setSelectedRange(h.row,h.col,h.rowCount,h.colCount,!0):i._setSelectedRange(n.row,n.col,1,1,!0))}},rt.prototype._startSelectingScroll=function(n){if(n&&(n.hitTestType!==3||!(isNaN(n.row)||isNaN(n.col)))){var t=this;t.isWorking=!0;t.isSelecting=!0;t.startHitInfo={scrollRowViewportIndex:n.rowViewportIndex,scrollColViewportIndex:n.colViewportIndex,hitTestType:n.hitTestType};t.startScroll()}},rt.prototype.startSelecting=function(n){this._startSelectingCore(n);this._startSelectingScroll(n)},rt.prototype.continueSelecting=function(){var n=this,t;n.startHitInfo&&n.isWorking&&n._forceCancelSelectiong!==!0&&(t=n.startHitInfo.hitTestType,t===3?n.continueCellSelecting():t===2?n.continueRowSelecting():t===1&&n.continueColumnSelecting())},rt.prototype.continueCellSelecting=function(){var t=this,n=t._sheet,i=t.getHitRowIndex(),r=t.getHitColumnIndex(),u,f;i>=0&&r>=0&&n.canSelect(i,r)&&(u=n._selectionModel.toArray(),n._extendSelectedRange(i,r,!0),f=n._selectionModel.toArray(),t._notEqualSelecions(u,f)&&n.triggerSelectionChanging({sheet:n,sheetName:n._name,oldSelections:u,newSelections:f}),t.continueScroll())},rt.prototype.continueRowSelecting=function(){var t=this,n=t._sheet,i=t.getHitRowIndex(),h,f,o;if(i>=0&&n.canSelect(i,-1)){var u=r(n._activeRowIndex,i),s=e(n._activeRowIndex,i)-u+1,c=-1,l=n.getColumnCount(),a=n.selectionPolicy();if(a===0)return;h=n.selectionUnit();h===2&&(u=-1,s=-1);f=n._selectionModel.toArray();n._replaceActiveSelectedRange(u,c,s,l,!0);o=n._selectionModel.toArray();t._notEqualSelecions(f,o)&&n.triggerSelectionChanging({sheet:n,sheetName:n._name,oldSelections:f,newSelections:o})}t.continueScroll()},rt.prototype.continueColumnSelecting=function(){var t=this,n=t._sheet,i=t.getHitColumnIndex(),h,f,o;if(i>=0&&n.canSelect(-1,i)){var u=r(n._activeColIndex,i),s=e(n._activeColIndex,i)-u+1,c=-1,l=n.getRowCount(),a=n.selectionPolicy();if(a===0)return;h=n.selectionUnit();h===1&&(u=-1,s=-1);f=n._selectionModel.toArray();n._replaceActiveSelectedRange(c,u,l,s,!0);o=n._selectionModel.toArray();t._notEqualSelecions(f,o)&&n.triggerSelectionChanging({sheet:n,sheetName:n._name,oldSelections:f,newSelections:o})}t.continueScroll()},rt.prototype.stopSelecting=function(){var n=this,t,r,u;n.startHitInfo=i;n.stopScroll();n._forceCancelSelectiong=i;n.isWorking=!1;n.isSelecting=!1;t=n._sheet;r=!n._lastSelections;r||(u=t._selectionModel.toArray(),r=n._notEqualSelecions(n._lastSelections,u));r&&t.triggerSelectionChanged({sheet:n._sheet,sheetName:n._sheet._name});n._lastSelections=t._selectionModel.toArray()},rt.prototype.startDragDropping=function(n){var o=this,f,e,l,c,u;if(!o.isDragDropping&&(f=o._sheet,e=i,f._selectionModel.length===1?e=f._selectionModel[0]:f._selectionModel.length<1&&(l=f._getSpanModel().find(f._activeRowIndex,f._activeColIndex),e=l?l:new t.Range(f._activeRowIndex,f._activeColIndex,1,1)),e)){o.isDragDropping=!0;o.isWorking=!0;o._dragDropFromRange=e;c=f._getRangeRect(n.rowViewportIndex,n.colViewportIndex,e);u=f._dragRect;u.x=c.x;u.y=c.y;u.width=c.width-1;u.height=c.height-1;u.row=e.row;u.col=e.col;u.rowCount=e.rowCount;u.colCount=e.colCount;var r=f._fixRange(e),s=n.row,h=n.col;s<r.row&&(s=r.row);s>=r.row+r.rowCount&&(s=r.row+r.rowCount-1);h<r.col&&(h=r.col);h>=r.col+r.colCount&&(h=r.col+r.colCount-1);u.hitRow=s;u.hitCol=h;u.rowOffset=s-r.row;u.colOffset=h-r.col;o.startHitInfo={scrollRowViewportIndex:n.rowViewportIndex,scrollColViewportIndex:n.colViewportIndex,hitTestType:n.hitTestType};o.startScroll()}},rt.prototype.continueDragDropping=function(){var n=this,t,i;if(n.startHitInfo&&n.isWorking&&n.isDragDropping&&n._dragDropFromRange){var r=n.mousePosition,u=n._sheet,f=u._dragRect;f.hitTarget={x:r.x,y:r.y};t=n.getHitRowIndex();i=n.getHitColumnIndex();t>=0&&i>=0&&n.updateDragDropRect(t,i);n.continueScroll()}},rt.prototype.updateDragDropRect=function(n,t){var o=this,f,s,c,l,a;if(o.isDragDropping&&o._dragDropFromRange){var u=o._sheet,i=u._dragRect,h=u._getActiveSelectedRange();(h.row===-1&&h.col!==-1?(i.row=-1,i.col=e(0,r(u.getColumnCount()-i.colCount,t-i.colOffset))):h.row!==-1&&h.col===-1?(i.row=e(0,r(u.getRowCount()-i.rowCount,n-i.rowOffset)),i.col=-1):(i.row=i.row<0?-1:e(0,r(u.getRowCount()-i.rowCount,n-i.rowOffset)),i.col=i.col<0?-1:e(0,r(u.getColumnCount()-i.colCount,t-i.colOffset))),i.hitRow=n,i.hitCol=t,f=u._fixRange(i),s=u._oldDragRange,s&&f.row===s.row&&f.col===s.col&&f.rowCount===s.rowCount&&f.colCount===s.colCount&&f.row>u._getFirstVisualRow()&&f.col>u._getFirstVisualColumn()&&f.row+f.rowCount-1<u._getLastVisualRow()&&f.col+f.colCount-1<u._getLastVisualColumn())||(u._actualDragRange=f,u._render.refreshDragDropIndicator(),u._oldDragRange=f,c=u.parent,c&&c.showDragDropTip()&&(l=i.x+i.width+o.DRAGDROPTOOLTIP_OFFSET,a=i.y+i.height+o.DRAGDROPTOOLTIP_OFFSET,o._showTooltip(o._getDragDropRectString(f),l,a)))}},rt.prototype._getDragDropRectString=function(n){if(n&&t.util.hasCalc()){var o=this._sheet,i=o._getActiveSelectedRange(),r=o.getActiveRowIndex(),u=o.getActiveColumnIndex(),e;return r=r<0?0:r,u=u<0?0:u,i.rowCount===1&&i.colCount===1?e=new t.Calc.Expressions.CellExpression(n.row-r,n.col-u,!0,!0):(e=new t.Calc.Expressions.RangeExpression,i.row===-1&&i.col>=0?e.initBand(n.col-u,n.col-u+i.colCount-1,!0,!0,!1):i.col===-1&&i.row>=0?e.initBand(n.row-r,n.row-r+i.rowCount-1,!0,!0,!0):i.row>=0&&i.col>=0&&e.init(n.row-r,n.col-u,n.row-r+i.rowCount-1,n.col-u+i.colCount-1,!0,!0,!0,!0)),o.getCalcService().unparse(o._getSheetSource(),e,r,u)}else return f},rt.prototype.stopDragDrop=function(){var u=this,f=!1,s="",b=!1,r=u._sheet,w=i,v;if(u.startHitInfo=i,u.stopScroll(),v=r._getActiveSelectedRange(),w=v&&(v.rowCount>0||v.colCount>0)?{r:v.row,c:v.col,rc:v.rowCount,cc:v.colCount}:{r:r._activeRowIndex,c:r._activeColIndex,rc:1,cc:1},u.isDragDropping===!0&&u.isWorking===!0){var e=w.r,o=w.c,h=w.rc,c=w.cc,a=r._dragRect.row,l=r._dragRect.col,y,p,n;u._isDragInsert&&(e===-1||o===-1)?o>=0&&e<0?(u._isDragCopy&&(l<=o||l>=o+c)||!u._isDragCopy&&(l<o||l>o+c))&&((r._hasPartSpans(-1,o,-1,c)||r._hasPartSpans(-1,l,-1,0))&&(f=!0,s=t.SR.Exp_ChangeMergedCell),f||(r._hasPartArrayFormulas(-1,o,-1,c)||r._hasPartArrayFormulas(-1,l,-1,0))&&(f=!0,s=t.SR.Exp_ChangePartOfArray),!f&&r.isProtected&&(f=!0,s=t.SR.Exp_ColumnReadOnly),!f&&r._hasPartTable(-1,l,-1,1)&&(f=!0,s=t.SR.Exp_DragDropShiftTableCell),f||u._isDragCopy||!r._hasPartTable(-1,o,-1,c)||(f=!0,s=t.SR.Exp_DragDropChangePartOfTable),f||(n=new t.UndoRedo.DragDropExtent(-1,o,-1,l,-1,c),p=r._raiseDragDropBlock(n.fromRow,n.fromColumn,n.toRow,n.toColumn,n.rowCount,n.columnCount,u._isDragCopy,!0,1023),p||(y=new t.UndoRedo.DragDropUndoAction(r,n,u._isDragCopy,!0,1023),b=r._doCommand(y),r._raiseDragDropBlockCompleted(n.fromRow,n.fromColumn,n.toRow,n.toColumn,n.rowCount,n.columnCount,u._isDragCopy,!0,1023)))):e>=0&&o<0&&(u._isDragCopy&&(a<=e||a>=e+h)||!u._isDragCopy&&(a<e||a>e+h))&&((r._hasPartSpans(e,-1,h,-1)||r._hasPartSpans(a,-1,0,-1))&&(f=!0,s=t.SR.Exp_ChangeMergedCell),f||(r._hasPartArrayFormulas(e,-1,h,-1)||r._hasPartArrayFormulas(a,-1,0,-1))&&(f=!0,s=t.SR.Exp_ChangePartOfArray),!f&&r.isProtected&&(f=!0,s=t.SR.Exp_RowReadOnly),f||u._isDragCopy||!r._hasPartTable(e,-1,h,-1)||(f=!0,s=t.SR.Exp_DragDropChangePartOfTable),f||(n=new t.UndoRedo.DragDropExtent(e,-1,a,-1,h,-1),p=r._raiseDragDropBlock(n.fromRow,n.fromColumn,n.toRow,n.toColumn,n.rowCount,n.columnCount,u._isDragCopy,!0,1023),p||(y=new t.UndoRedo.DragDropUndoAction(r,n,u._isDragCopy,!0,1023),b=r._doCommand(y),r._raiseDragDropBlockCompleted(n.fromRow,n.fromColumn,n.toRow,n.toColumn,n.rowCount,n.columnCount,u._isDragCopy,!0,1023)))):(a!==e||l!==o)&&((r._hasPartSpans(e,o,h,c)||r._hasPartSpans(a,l,h,c))&&(f=!0,s=t.SR.Exp_ChangeMergedCell),f||(r._hasPartArrayFormulas(e,o,h,c)||r._hasPartArrayFormulas(a,l,h,c))&&(f=!0,s=t.SR.Exp_ChangePartOfArray),!f&&r.isProtected&&(!u._isDragCopy&&r._isAnyCellInRangeLocked(new t.Range(e,o,h,c))||r._isAnyCellInRangeLocked(new t.Range(a,l,h,c)))&&(f=!0,s=t.SR.Exp_CellReadOnly),f||(n=new t.UndoRedo.DragDropExtent(e,o,a,l,h,c),p=r._raiseDragDropBlock(n.fromRow,n.fromColumn,n.toRow,n.toColumn,n.rowCount,n.columnCount,u._isDragCopy,!1,1023),p||(y=new t.UndoRedo.DragDropUndoAction(r,n,u._isDragCopy,!1,1023),b=r._doCommand(y),r._raiseDragDropBlockCompleted(n.fromRow,n.fromColumn,n.toRow,n.toColumn,n.rowCount,n.columnCount,u._isDragCopy,!1,1023))))}u.isWorking=!1;u.isDragDropping=!1;u._dragDropFromRange=i;u._isDragInsert=!1;u._isDragCopy=!1;u._removeTooltip();b===!1&&(r._dragRect={},r.repaint());f&&r._raiseInvalidOperation(3,s)},rt.prototype.startFormulaRangeAppending=function(n){var r=this,u=r._sheet,f=u._formulaTextBox,w;if(f){w=f.isAppending();w&&r._formulaRangeAppendingInfo||(r._formulaRangeAppendingInfo={anchorRow:-1,anchorCol:-1,leadingRow:-1,leadingCol:-1});var b=u.getRowCount(),k=u.getColumnCount(),a=n.hitTestType,e=n.row,o=n.col,l=r.shift,v=r.ctrl,s=r._formulaRangeAppendingInfo,y=s.anchorRow,p=s.anchorCol,h=-1,c=-1,i;a===0?(h=u.frozenRowCount?u._getFirstVisualRow():u._scrollTopRow,c=u.frozenColCount?u._getFirstVisualColumn():u._scrollLeftCol,i=new t.Range(-1,-1,-1,-1),v?f.appendRange(r.rangeToString(i),!1,!1):l?f.appendRange(r.rangeToString(i),!0,!1):f.appendRange(r.rangeToString(i),!1,!0),r.isWorking=!0):a===1?(h=u.frozenRowCount?u._getFirstVisualRow():u._scrollTopRow,c=o,i=u._getExtendedRange(0,o,b-1,o),i=new t.Range(-1,i.col,-1,i.colCount),v?f.appendRange(r.rangeToString(i),!1,!1):l?(p>=0&&(i=u._getExtendedRange(0,o,b-1,p),i=new t.Range(-1,i.col,-1,i.colCount)),f.appendRange(r.rangeToString(i),!0,!1)):f.appendRange(r.rangeToString(i),!1,!0),r.isWorking=!0):a===2?(h=e,c=u.frozenColCount?u._getFirstVisualColumn():u._scrollLeftCol,i=u._getExtendedRange(e,0,e,k-1),i=new t.Range(i.row,-1,i.rowCount,-1),v?f.appendRange(r.rangeToString(i),!1,!1):l?(y>=0&&(i=u._getExtendedRange(e,0,y,k-1),i=new t.Range(i.row,-1,i.rowCount,-1)),f.appendRange(r.rangeToString(i),!0,!1)):f.appendRange(r.rangeToString(i),!1,!0),r.isWorking=!0):a===3&&(h=e,c=o,i=u._getExtendedRange(e,o,e,o),i=new t.Range(i.row,i.col,1,1),v?f.appendRange(r.rangeToString(i),!1,!1):l?(y>=0&&p>=0&&(i=u._getExtendedRange(e,o,y,p)),f.appendRange(r.rangeToString(i),!0,!1)):f.appendRange(r.rangeToString(i),!1,!0),r.isWorking=!0);r.isFormulaRangeAppending=r.isWorking;l&&w||(s.anchorRow=h,s.anchorCol=c,s.leadingRow=h,s.leadingCol=c);r.startHitInfo={scrollRowViewportIndex:n.rowViewportIndex,scrollColViewportIndex:n.colViewportIndex,hitTestType:n.hitTestType};r.startScroll()}},rt.prototype.continueFormulaRangeAppending=function(){var n=this,i=n.startHitInfo,t;i&&n.isWorking&&(t=i.hitTestType,t===3?n.continueFormulaRangeCellAppending():t===2?n.continueFormulaRangeRowAppending():t===1&&n.continueFormulaRangeColumnAppending())},rt.prototype.continueFormulaRangeCellAppending=function(){var n=this,t=n._formulaRangeAppendingInfo,i=t.anchorRow,r=t.anchorCol,u=n.getHitRowIndex(),f=n.getHitColumnIndex(),s;if(i>=0&&r>=0&&u>=0&&f>=0){var e=n._sheet,h=e._getExtendedRange(u,f,i,r),o=n.rangeToString(h);o&&(s=e._formulaTextBox,s.appendRange(o,!0,!1))}n.continueScroll()},rt.prototype.continueFormulaRangeRowAppending=function(){var n=this,f=n._formulaRangeAppendingInfo.anchorRow,e=n.getHitRowIndex(),r,i,u,o;f>=0&&e>=0&&(r=n._sheet,i=r._getExtendedRange(e,0,f,r.getColumnCount()-1),i=new t.Range(i.row,-1,i.rowCount,-1),u=n.rangeToString(i),u&&(o=r._formulaTextBox,o.appendRange(u,!0,!1)));n.continueScroll()},rt.prototype.continueFormulaRangeColumnAppending=function(){var n=this,f=n._formulaRangeAppendingInfo.anchorCol,e=n.getHitColumnIndex(),r,i,u,o;f>=0&&e>=0&&(r=n._sheet,i=r._getExtendedRange(0,e,r.getRowCount()-1,f),i=new t.Range(-1,i.col,-1,i.colCount),u=n.rangeToString(i),u&&(o=r._formulaTextBox,o.appendRange(u,!0,!1)));n.continueScroll()},rt.prototype.stopFormulaRangeAppending=function(){var n=this;n.stopScroll();n.startHitInfo=i;n.isWorking=!1;n.isFormulaRangeAppending=!1},rt.prototype.startFormulaRangeMoving=function(n){var i=this,c=i._sheet,f=c._formulaTextBox,s=n.formulaRangeHitInfo,e,h,o,l,a;if(s&&s.inBorder&&f&&(f.isAppending()&&f.stopAppending(),f.close(),e=s.paramRange,h=e&&e.text,h)&&(o=i.stringToRange(h),o)){var t=c._fixRange(o),r=n.row,u=n.col;r<t.row&&(r=t.row);r>=t.row+t.rowCount&&(r=t.row+t.rowCount-1);u<t.col&&(u=t.col);u>=t.col+t.colCount&&(u=t.col+t.colCount-1);l=r-t.row;a=u-t.col;i.isWorking=!0;i.isFormulaRangeMoving=!0;i._formulaRangeMovingInfo={paramRange:e,fromRange:o,rowOffset:l,colOffset:a};i.startHitInfo={scrollRowViewportIndex:n.rowViewportIndex,scrollColViewportIndex:n.colViewportIndex,hitTestType:n.hitTestType};i.startScroll()}},rt.prototype.continueFormulaRangeMoving=function(){var n=this,u,f,y;if(n.isWorking&&n.isFormulaRangeMoving){if(u=n.getHitRowIndex(),f=n.getHitColumnIndex(),u>=0&&f>=0){var i=n._formulaRangeMovingInfo,o=i.fromRange,p=i.rowOffset,w=i.colOffset,b=i.toRow,k=i.toCol,h=u,c=f;if(h!==b||c!==k){i.toRow=h;i.toCol=c;var s=n._sheet,d=s.getRowCount(),g=s.getColumnCount(),nt=o.row,tt=o.col,l=o.rowCount,a=o.colCount,it=nt<0?-1:e(0,r(d-l,u-p)),rt=tt<0?-1:e(0,r(g-a,f-w)),v=n.rangeToString(new t.Range(it,rt,l,a));v&&(y=s._formulaTextBox,y.repalceRange(i.paramRange.index,v))}}n.continueScroll()}},rt.prototype.stopFormulaRangeMoving=function(){var n=this;n.stopScroll();n.isWorking=!1;n.isFormulaRangeMoving=!1;n._formulaRangeMovingInfo=i},rt.prototype.startFormulaRangeResizing=function(n){var i=this,p=i._sheet,v=p._formulaTextBox,r=n.formulaRangeHitInfo,u,y,t;if(r&&v&&(v.isAppending()&&v.stopAppending(),u=r.paramRange,y=u&&u.text,u&&y)&&(t=i.stringToRange(y),t)){var h=t.row,c=t.row<0?-1:t.row+t.rowCount-1,l=t.col,a=t.col<0?-1:t.col+t.colCount-1,f,e,o,s;if(r.inTopLeft)f=c,e=a,o=h,s=l;else if(r.inTopRight)f=c,e=l,o=h,s=a;else if(r.inBottomLeft)f=h,e=a,o=c,s=l;else if(r.inBottomRight)f=h,e=l,o=c,s=a;else return;i.isWorking=!0;i.isFormulaRangeResizing=!0;i._formulaRangeResizingInfo={paramRange:u,anchorRow:f,anchorCol:e,toRow:o,toCol:s};i.startHitInfo={scrollRowViewportIndex:n.rowViewportIndex,scrollColViewportIndex:n.colViewportIndex,hitTestType:n.hitTestType};i.startScroll()}},rt.prototype.continueFormulaRangeResizing=function(){var n=this,h,c,y,nt;if(n.isWorking&&n.isFormulaRangeResizing){if(h=n.getHitRowIndex(),c=n.getHitColumnIndex(),h>=0&&c>=0){var i=n._formulaRangeResizingInfo,p=i.anchorRow,w=i.anchorCol,tt=i.toRow,it=i.toCol,u=h,f=c;if(u!==tt||f!==it){i.toRow=u;i.toCol=f;var l=n._sheet,b=l.getRowCount(),k=l.getColumnCount(),d=p<0?b-1:p,g=w<0?k-1:w,o=r(d,u),s=r(g,f),a=e(d,u)-o+1,v=e(g,f)-s+1;o===0&&a===b&&(o=-1,a=-1);s===0&&v===k&&(s=-1,v=-1);y=n.rangeToString(new t.Range(o,s,a,v));y&&(nt=l._formulaTextBox,nt.repalceRange(i.paramRange.index,y))}}n.continueScroll()}},rt.prototype.stopFormulaRangeResizing=function(){var n=this;n.stopScroll();n.isWorking=!1;n.isFormulaRangeResizing=!1;n._formulaRangeResizingInfo=i},rt.prototype.getFormulaRangeHitInfo=function(n,r,u){var k=this._sheet,d=k._formulaTextBox,a=d&&d.getRanges(),y,p,e,w,o,v,b;if(!a||a.length===0||(y=n.rowViewportIndex,p=n.colViewportIndex,this.inGrayArea(y,p,r,u)))return i;for(v=a.length-1;v>=0;v--)if((e=a[v],e.allowDrag!==!1)&&(b=t.features.formulatextbox&&t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,!b||!b.text)&&(w=this.stringToRange(e.text),w)){o=k._getRangeRect(y,p,w);var f=5,s=o.x-2,h=o.x+o.width+1-f,c=o.y-2,l=o.y+o.height+1-f;if(s+f<=r&&r<h&&(c+1<=u&&u<=c+3||l+1<=u&&u<=l+3))return{paramRange:e,inBorder:!0};if(c+f<=u&&u<l&&(s+1<=r&&r<=s+3||h+1<=r&&r<=h+3))return{paramRange:e,inBorder:!0};if(h<=r&&r<h+f&&l<=u&&u<l+f)return{paramRange:e,inBottomRight:!0};if(s<=r&&r<s+f&&l<=u&&u<l+f)return{paramRange:e,inBottomLeft:!0};if(h<=r&&r<h+f&&c<=u&&u<c+f)return{paramRange:e,inTopRight:!0};if(s<=r&&r<s+f&&c<=u&&u<c+f)return{paramRange:e,inTopLeft:!0}}return i},rt.prototype.changeFormulaReference=function(){var s=this,l=s._sheet,f=l._formulaTextBox,v,a,w,b,y;if(f){var d=n.Sheets,p=t.Calc,h=l._activeRowIndex,c=l._activeColIndex,k=l.referenceStyle()===1,e=new p.ParserContext(l._getSheetSource(),k,h,c),o=new p.Parser,u,r;if(f.isAppending())for(v=f.getAppendingRanges(),a=0;a<v.length;a++){u=v[a];try{r=o.parse(u.text,e)}catch(g){r=i}r&&(r.t===2?(s.changeRangeExpressionReference(r,h,c,!0,!0),f.repalceRange(u.index,o.unparse(r,e))):r.t===0&&(s.changeCellExpressionReference(r,h,c),f.repalceRange(u.index,o.unparse(r,e))))}else{if(u=f.getActiveRange(),!u)return;try{r=o.parse(u.text,e)}catch(g){r=i}if(!r)return;r.t===2?(w=u.textOffset+u.text.lastIndexOf(":"),b=f.caret()<=w,b?(s.changeRangeExpressionReference(r,h,c,!0,!1),y=o.unparse(r,e),f.repalceRange(u.index,y),f.caret(u.textOffset+y.lastIndexOf(":"))):(s.changeRangeExpressionReference(r,h,c,!1,!0),f.repalceRange(u.index,o.unparse(r,e)))):r.t===0&&(s.changeCellExpressionReference(r,h,c),f.repalceRange(u.index,o.unparse(r,e)))}}},rt.prototype.changeRangeExpressionReference=function(n,t,i,r,u){var o=n.startRowRelative,s=n.startColumnRelative,f,e;r&&(o&&s?(n.startRowRelative=!1,n.startColumnRelative=!1,n.startRow+=t,n.startColumn+=i):o?(n.startColumnRelative=!0,n.startColumn-=i):s?(n.startRowRelative=!0,n.startColumnRelative=!1,n.startRow-=t,n.startColumn+=i):(n.startColumnRelative=!0,n.startColumn-=i));f=n.endRowRelative;e=n.endColumnRelative;u&&(f&&e?(n.endRowRelative=!1,n.endColumnRelative=!1,n.endRow+=t,n.endColumn+=i):f?(n.endColumnRelative=!0,n.endColumn-=i):e?(n.endRowRelative=!0,n.endColumnRelative=!1,n.endRow-=t,n.endColumn+=i):(n.endColumnRelative=!0,n.endColumn-=i))},rt.prototype.changeCellExpressionReference=function(n,t,i){var r=n.rowRelative,u=n.columnRelative;r&&u?(n.rowRelative=!1,n.columnRelative=!1,n.row+=t,n.column+=i):r?(n.columnRelative=!0,n.column-=i):u?(n.rowRelative=!0,n.columnRelative=!1,n.row-=t,n.column+=i):(n.columnRelative=!0,n.column-=i)},rt.prototype.rangeToString=function(r){var c,f,o,e;if(!r)return i;var v=n.Sheets,l=t.Calc,u=this._sheet,s=u._activeRowIndex,h=u._activeColIndex,a=u.referenceStyle()===1;return r.row<0&&r.col<0&&(r=new v.Range(0,-1,u.getRowCount(),-1)),c=u.findTable(r.row,r.col),f=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,this.isStructReference(c,r)?(t.features.formulatextbox&&f&&f.text&&f.sheet!==u&&(s=h=-1),l.rangeToFormulaWithStructReference(u,r,s,h,15,a,c)):(o=l.rangeToFormula(r,s,h,15,a),t.features.formulatextbox&&f&&f.text&&(e=u.getName(),(/^\d+$/.test(e)||t.StringUtil.contains(e," "))&&(e="'"+e+"'"),o=e+"!"+o),o)},rt.prototype.isStructReference=function(n,t){if(!n)return!1;var i=!1,r=!1;if(t.rowCount===1){if(n.hasHeadersRow()&&t.row===n.startRow()||n.hasTotalsRow()&&t.row===n.endRow())return!0}else n.hasHeadersRow()&&t.row===n.startRow()&&(t.rowCount===n.dataRange().rowCount+1&&(i=!0),n.hasTotalsRow()&&t.rowCount===n.dataRange().rowCount+1+1&&(i=!0)),t.row===n.dataRange().row&&(t.rowCount===n.dataRange().rowCount&&(i=!0),n.hasTotalsRow()&&t.rowCount===n.dataRange().rowCount+1&&(i=!0));return t.col+t.colCount<=n.startColumn()+n.dataRange().colCount&&(r=!0),i&&r},rt.prototype.stringToRange=function(r){if(!r)return i;var s=n.Sheets,f=t.Calc,u=this._sheet,e=u._activeRowIndex,o=u._activeColIndex;try{return f.formulaToRange(u,r,e,o)}catch(h){}return i},rt.prototype.startDragFill=function(n){var t=this;t.isDraggingFill!==!0&&t.isWorking!==!0&&(t.updateDragFillStartRange(),t._dragFillStartRange)&&(t.isWorking=!0,t.isDraggingFill=!0,t._isDragAroundIndicator=!0,t._dragStartRowViewport=n.rowViewportIndex,t._dragStartColumnViewport=n.colViewportIndex,t._dragToRowViewport=n.rowViewportIndex,t._dragToColumnViewport=n.colViewportIndex,t.updateDragStartRangeViewports(),t.startHitInfo={scrollRowViewportIndex:n.rowViewportIndex,scrollColViewportIndex:n.colViewportIndex,hitTestType:n.hitTestType},t.startScroll())},rt.prototype.updateDragStartRangeViewports=function(){var n=this,i=n.dragFillStartTopRow(),t;i>=0&&i<n._sheet.frozenRowCount?n._dragFillStartTopRowViewport=0:i>=n._sheet.frozenRowCount&&i<=n._sheet.getRowCount()&&(n._dragFillStartTopRowViewport=1);n._dragFillStartBottomRowViewport=n.isDragFillWholeColumns()?1:n._dragStartRowViewport;t=n.dragFillStartLeftColumn();t>=0&&t<n._sheet.frozenColCount?n._dragFillStartLeftColumnViewport=0:t>=n._sheet.frozenColCount&&t<=n._sheet.getColumnCount()&&(n._dragFillStartLeftColumnViewport=1);n._dragFillStartRightColumnViewport=n.isDragFillWholeRows()?1:n._dragStartColumnViewport},rt.prototype.continueDragFill=function(){var n=this;if(n.startHitInfo&&n.isDraggingFill&&n.isWorking&&n._dragFillStartRange){if(n._dragToRowViewport=n.getHitRowViewportIndex(),n._dragToColumnViewport=n.getHitColumnViewportIndex(),n._dragToRow=n.getHitRowIndex(),n._dragToColumn=n.getHitColumnIndex(),n._dragToRow>=0&&n._dragToColumn>=0){n.updateCurrentFillSettings();n.updateCurrentFillRange();var t=n._sheet.parent,i=!1,r=n.getDragFillFrameRange();r&&(i=n.validateFillRange(n._currentFillRange,!0));t&&t.showDragFillTip()&&i&&n._showDragFillTooltip();n.refreshDragFill()}n.continueScroll()}},rt.prototype._getDragFillTooltipContent=function(){var y,e,w,s,b,r,k;if(!t.features.fill)return i;var n=this,u=n._sheet,h=n._dragFillStartRange,c=n._currentFillRange,l=u.defaultDragFillType(),a=n.getDragAutoFillType(l===3?5:l),f=n.getCurrentFillDirection(),d=n.getDragFillFrameRange(),v;if(a===1){v=f===0||f===1?1:0;y=new t.FillImp(u);e=i;e=y.fillAuto(d,v,!0);var r=n._getAvailableRange(f,c,h),o=u.getActualStyle(r.row,r.col),g=o.cellType||u.getDefaultCellType(),p=o.formatter?o.formatter:o._autoFormatter;return e instanceof Date&&t.features.formatter&&(p=new t.GeneralFormatter(t.DefaultTokens.DateTimeFormatInfo().shortDatePattern+" hh:mm:ss AM/PM;@",0)),w=n.startHitInfo,s=3,w&&(s=n.startHitInfo.hitTestType),b={sheet:u,row:r.row,col:r.col,sheetArea:s},g.format(e,p,b)}else return a===0?(r=n._getAvailableRange(f,c,h),k=u.getFormula(r.row,r.col),k)?i:u.getText(r.row,r.col):i},rt.prototype._getAvailableRange=function(n,i,r){var f=new t.Range(r.row,r.col,1,1),u;return n===3?(u=i.rowCount%r.rowCount,u=u===0?r.row+r.rowCount-1:r.row+u-1,f.row=u,f.col=r.col):n===1?(u=i.colCount%r.colCount,u=u===0?r.col+r.colCount-1:r.col+u-1,f.row=r.row,f.col=u):n===0?(u=i.colCount%r.colCount,u=u===0?r.col:r.col+r.colCount-u,f.row=r.row,f.col=u):n===2&&(u=i.rowCount%r.rowCount,u=u===0?r.row:r.row+r.rowCount-u,f.row=u,f.col=r.col),f},rt.prototype._showDragFillTooltip=function(){var n=this,o=n.getDragAutoFillType();if(o===4||n.isDragFillWholeRows()||n.isDragFillWholeColumns())return n._removeTooltip(),i;else{var r,u,e,s=n._sheet,f=n.getCurrentFillDirection(),h=n.getDragFillFrameRange(),t=s._getRangeRect2(h);e=n._getDragFillTooltipContent();f===3?(r=t.x+t.width+n.DRAGFILLTOOLTIP_OFFSET,u=t.y+t.height+n.DRAGFILLTOOLTIP_OFFSET):f===1?(r=t.x+t.width+n.DRAGFILLTOOLTIP_OFFSET,u=t.y+t.height+n.DRAGFILLTOOLTIP_OFFSET):f===0?(r=t.x+n.DRAGFILLTOOLTIP_OFFSET,u=t.y+t.height+n.DRAGFILLTOOLTIP_OFFSET):f===2&&(r=t.x+t.width+n.DRAGFILLTOOLTIP_OFFSET,u=t.y+n.DRAGFILLTOOLTIP_OFFSET);n._showTooltip(e,r,u)}},rt.prototype.refreshDragFill=function(){var n=this;n.clearDragFill();n.refreshSelectionBorder();n.paintDragFill();n._oldDragFillFrameRange=n.getDragFillFrameRange()},rt.prototype.clearDragFill=function(){var t=this._sheet,n;this._oldDragFillFrameRange&&(n=t._getRangeRect2(this._oldDragFillFrameRange),n.x-=2,n.y-=2,n.width+=4,n.height+=4,t._render.copyDoubleBufferRect(n))},rt.prototype.refreshSelectionBorder=function(n){var t=this._sheet;t._render.repaintSelection(this._dragFillStartRange,i,n)},rt.prototype.paintDragFill=function(){var t=this._sheet,i=t._render,r=this.getDragFillFrameRange(),n,u;r&&(n=i._getCtx(),u=t._getRangeRect2(r),n.save(),n.beginPath(),i.paintDragRectangle(n,u),n.restore())},rt.prototype.updateCurrentFillRange=function(){this._currentFillRange=this.getCurrentFillRange()},rt.prototype.isDragFillWholeRows=function(){return this._dragFillStartRange.col===-1&&this._dragFillStartRange.row!==-1},rt.prototype.isDragFillWholeColumns=function(){return this._dragFillStartRange.row===-1&&this._dragFillStartRange.col!==-1},rt.prototype.isDragClear=function(){return this._currentFillDirection===4||this._currentFillDirection===5},rt.prototype.getCurrentFillRange=function(){var n=this,i=-1,r=-1,u=-1,f=-1;switch(n._currentFillDirection){case 0:n.isDragFillWholeColumns()?(i=-1,u=-1):(i=n.dragFillStartTopRow(),u=n._dragFillStartRange.rowCount);r=n._dragToColumn;f=n.dragFillStartLeftColumn()-r;break;case 1:n.isDragFillWholeColumns()?(i=-1,u=-1):(i=n.dragFillStartTopRow(),u=n._dragFillStartRange.rowCount);r=n.dragFillStartRightColumn()+1;f=n._dragToColumn-r+1;break;case 2:i=n._dragToRow;u=n.dragFillStartTopRow()-i;n.isDragFillWholeRows()?(r=-1,f=-1):(r=n.dragFillStartLeftColumn(),f=n._dragFillStartRange.colCount);break;case 3:i=n.dragFillStartBottomRow()+1;u=n._dragToRow-i+1;n.isDragFillWholeRows()?(r=-1,f=-1):(r=n.dragFillStartLeftColumn(),f=n._dragFillStartRange.colCount);break;case 5:i=n._dragToRow;u=n.dragFillStartBottomRow()-i+1;n.isDragFillWholeRows()?(r=-1,f=-1):(r=n.dragFillStartLeftColumn(),f=n._dragFillStartRange.colCount);break;case 4:n.isDragFillWholeColumns()?(i=-1,u=-1):(i=n._dragFillStartRange.row,u=n._dragFillStartRange.rowCount);r=n._dragToColumn;f=n.dragFillStartRightColumn()-r+1;break;default:break}return new t.Range(i,r,u,f)},rt.prototype.dragFillStartBottomRowLayout=function(){var n=this.dragFillStartBottomRow();return n!==-1?this._sheet._getRowLayout(this._dragFillStartBottomRowViewport).findRow(n):i},rt.prototype.dragFillToViewportBottomRowLayout=function(){return this._sheet._getRowLayout(this._dragToRowViewport).findRow(this.dragFillToViewportBottomRow())},rt.prototype.dragFillToViewportBottomRow=function(){return this._sheet.getViewportBottomRow(this._dragToRowViewport)},rt.prototype.dragFillStartRightColumnLayout=function(){var n=this.dragFillStartRightColumn();return n!==-1?this._sheet._getColumnLayout(this._dragFillStartRightColumnViewport).findCol(n):i},rt.prototype.dragFillToViewportRightColumnLayout=function(){return this._sheet._getColumnLayout(this._dragToColumnViewport).findCol(this.dragFillToViewportRightColumn())},rt.prototype.dragFillToViewportRightColumn=function(){return this._sheet.getViewportRightColumn(this._dragToColumnViewport)},rt.prototype.updateCurrentFillSettings=function(){var n=this,l=n.isDragFillWholeRows(),a=n.isDragFillWholeColumns(),y=t.GC$(n._sheet._getCanvas()).offset(),p=n.mousePosition.e,ft=n.mousePosition.x,w=n.mousePosition.y,h=p.pageX-y.left,c=p.pageY-y.top,b=!1,i,u,f,s,k,d,e;if(l||a?a?n._dragToColumn>=n.dragFillStartLeftColumn()&&n._dragToColumn<=n.dragFillStartRightColumn()?n._currentFillDirection=4:n._dragToColumn<n.dragFillStartLeftColumn()?n._currentFillDirection=0:n._dragToColumn>n.dragFillStartRightColumn()&&(n._currentFillDirection=1):l&&(n._dragToRow>=n.dragFillStartTopRow()&&n._dragToRow<=n.dragFillStartBottomRow()?n._currentFillDirection=5:n._dragToRow<n.dragFillStartTopRow()?n._currentFillDirection=2:n._dragToRow>n.dragFillStartBottomRow()&&(n._currentFillDirection=3)):n._dragToRow>=n.dragFillStartTopRow()&&n._dragToRow<=n.dragFillStartBottomRow()?n._dragToColumn>=n.dragFillStartLeftColumn()&&n._dragToColumn<=n.dragFillStartRightColumn()?(i=o(n._dragToColumn-n.dragFillStartRightColumn()),u=o(n._dragToRow-n.dragFillStartBottomRow()),u>i?n._currentFillDirection=5:u<i?n._currentFillDirection=4:(f=n.dragFillStartBottomRowLayout(),f||(f=n.dragFillToViewportBottomRowLayout()),w>f.y+f.height?n._currentFillDirection=3:(s=n.dragFillStartRightColumnLayout(),s||(s=n.dragFillToViewportRightColumnLayout()),k=s.x+s.width-ft,d=f.y+f.height-w,h>=s.x&&h<=s.x+s.width&&c>=f.y&&c<=f.y+f.height?n._currentFillDirection=k>=d?4:5:b=!0))):n._dragToColumn<n.dragFillStartLeftColumn()?n._currentFillDirection=0:n._dragToColumn>n.dragFillStartRightColumn()&&(n._currentFillDirection=1):n._dragToRow<n.dragFillStartTopRow()?n._dragToColumn>=n.dragFillStartLeftColumn()&&n._dragToColumn<=n.dragFillStartRightColumn()?n._currentFillDirection=2:n._dragToColumn<n.dragFillStartLeftColumn()?(i=o(n._dragToColumn-n.dragFillStartLeftColumn()),u=o(n._dragToRow-n.dragFillStartTopRow()),n._currentFillDirection=u>=i?2:0):n._dragToColumn>n.dragFillStartRightColumn()&&(i=o(n._dragToColumn-n.dragFillStartRightColumn()),u=o(n._dragToRow-n.dragFillStartTopRow()),n._currentFillDirection=u>=i?2:1):n._dragToRow>n.dragFillStartBottomRow()&&(n._dragToColumn>=n.dragFillStartLeftColumn()&&n._dragToColumn<=n.dragFillStartRightColumn()?n._currentFillDirection=3:n._dragToColumn<n.dragFillStartLeftColumn()?(i=o(n._dragToColumn-n.dragFillStartLeftColumn()),u=o(n._dragToRow-n.dragFillStartBottomRow()),n._currentFillDirection=u>=i?3:0):n._dragToColumn>n.dragFillStartRightColumn()&&(i=o(n._dragToColumn-n.dragFillStartRightColumn()),u=o(n._dragToRow-n.dragFillStartBottomRow()),n._currentFillDirection=u>=i?3:1)),e=n._sheet._dragFillIndicatorRect,e){var g=n.dragFillStartBottomRow(),nt=n.dragFillStartRightColumn(),et=g+1,ot=nt+1,st=n._sheet.getRowHeight(g,3),ht=n._sheet.getColumnWidth(nt,3),ct=n._sheet.getRowHeight(et,3),lt=n._sheet.getColumnWidth(ot,3),tt=e.x+e.width/2-r(10,ht/2),it=e.x+e.width/2+r(10,lt/2),rt=e.y+e.height/2-r(10,st/2),ut=e.y+e.height/2+r(10,ct/2),v=!1;l||a?a?v=tt<=h&&h<=it:l&&(v=rt<=c&&c<=ut):v=tt<=h&&h<=it&&rt<=c&&c<=ut;v||b?(n._isDragAroundIndicator=!0,n._currentFillDirection=4):n._isDragAroundIndicator=!1}},rt.prototype.dragFillStartTopRow=function(){return this._dragFillStartRange?this._dragFillStartRange.row===-1?0:this._dragFillStartRange.row:-1},rt.prototype.dragFillStartBottomRow=function(){var n=this;return n._dragFillStartRange?n._dragFillStartRange.row===-1?n._sheet.getRowCount()-1:n._dragFillStartRange.row+n._dragFillStartRange.rowCount-1:-1},rt.prototype.dragFillStartLeftColumn=function(){return this._dragFillStartRange?this._dragFillStartRange.col===-1?0:this._dragFillStartRange.col:-1},rt.prototype.dragFillStartRightColumn=function(){var n=this;return n._dragFillStartRange?n._dragFillStartRange.col===-1?n._sheet.getColumnCount()-1:n._dragFillStartRange.col+n._dragFillStartRange.colCount-1:-1},rt.prototype.endDragFill=function(){var n=this,u=n._sheet,r,f,e,o,s;if(n.startHitInfo=i,n.stopScroll(),n._removeTooltip(),!n.isDraggingFill||!n.isWorking){n.resetDragFill();return}(n.isDraggingFill=!1,n.isWorking=!1,r=n.getDragFillFrameRange(),r)&&(f=n.validateFillRange(n._currentFillRange),!f||n._isDragAroundIndicator?(n.resetDragFill(),n.refreshSelection(r)):(e=n.getDragAutoFillType(),o=new t.UndoRedo.FillUndoAction(u,e,n._currentFillRange),u._doCommand(o),s=n._isCancelDragFill,!s&&n.isDragFill()&&u.showDragFillSmartTag()&&n._currentDragFillType!==4?n.showDragFillSmartTag(n._currentDragFillType):n.refreshSelection(r),n.resetDragFill()))},rt.prototype.showDragFillSmartTag=function(n){if(t.features.fill_ui){var i=this._sheet,r=i._dragFillIndicatorRect,u={x:r.x+r.width,y:r.y+r.height,fillType:n};i._smartTag=new t._GcFillDialog(i.parent._getContainerDiv(),i,u);i._smartTag.open()}},rt.prototype.updateDragFillStartRange=function(){var n=this._sheet;n._selectionModel.length===1?this._dragFillStartRange=n._selectionModel[0]:n._activeRowIndex>=0&&n._activeColIndex>=0&&(this._dragFillStartRange=new t.Range(n._activeRowIndex,n._activeColIndex,1,1))},rt.prototype.resetDragFill=function(){this.isWorking=!1;this.isDraggingFill=!1},rt.prototype.refreshSelection=function(n){this._sheet._render.repaintSelection(n)},rt.prototype.getDragAutoFillType=function(n){var t=this,u=t._sheet,i=n!==f?n:u.defaultDragFillType(),r;return t.isDragClear()?4:i!==5?i:(r=t._dragFillStartRange.rowCount===1&&t._dragFillStartRange.colCount===1&&!t.isDragFillWholeColumns()&&!t.isDragFillWholeRows(),r?t.isControlPressed?1:0:t.isControlPressed?0:1)},rt.prototype.getDragFillFrameRange=function(){var n=this;if(!n._dragFillStartRange)return i;if(n.isDragClear())return n._dragFillStartRange;if(!n._currentFillRange)return i;var r=0,u=0,f=0,e=0;return n.isVerticalDragFill()?(r=n._currentFillDirection===2?n._currentFillRange.row:n._dragFillStartRange.row,u=n._dragFillStartRange.rowCount+n._currentFillRange.rowCount,f=n._dragFillStartRange.col,e=n._dragFillStartRange.colCount):(r=n._dragFillStartRange.row,u=n._dragFillStartRange.rowCount,f=n._currentFillDirection===0?n._currentFillRange.col:n._dragFillStartRange.col,e=n._dragFillStartRange.colCount+n._currentFillRange.colCount),new t.Range(r,f,u,e)},rt.prototype.validateFillRange=function(n,i){var u=this._sheet,r=!0,f="";return u._hasSpans(n.row,n.col,n.rowCount,n.colCount)&&(r=!1,f=t.SR.Exp_FillRangeContainsMergedCell),r&&u.isProtected&&u._isAnyCellInRangeLocked(n)&&(r=!1,f=t.SR.Exp_FillCellsReadOnly),r||i||u._raiseInvalidOperation(2,f),r},rt.prototype.isDragFill=function(){return this.isIncreaseFill()||this.isDecreaseFill()},rt.prototype.isIncreaseFill=function(){return this._currentFillDirection===3||this._currentFillDirection===1},rt.prototype.isDecreaseFill=function(){return this._currentFillDirection===0||this._currentFillDirection===2},rt.prototype.isVerticalDragFill=function(){return this._currentFillDirection===2||this._currentFillDirection===3||this._currentFillDirection===5},rt.prototype.isDragToRowInView=function(){return this.isRowInViewport(this._dragToRowViewport,this._dragToRow)},rt.prototype.isRowInViewport=function(n,t){var i=this._sheet.getViewportTopRow(n),r=this._sheet.getViewportBottomRow(n);return t>=i&&t<=r?!0:!1},rt.prototype.getCurrentDragToRowLayout=function(){return this._sheet._getRowLayout(this._dragToRowViewport).findRow(this._dragToRow)},rt.prototype.isDragFillStartBottomRowInView=function(){return this.isRowInViewport(this._dragFillStartBottomRowViewport,this.dragFillStartBottomRow())},rt.prototype.dragFillStartViewportBottomRowLayout=function(){return this._sheet._getRowLayout(this._dragStartRowViewport).findRow(this.dragFillStartViewportBottomRow())},rt.prototype.dragFillStartViewportBottomRow=function(){return this._sheet.getViewportBottomRow(this._dragStartRowViewport)},rt.prototype.getValidVerDragToRowLayout=function(){var n=this;return n.isIncreaseFill()?n.isDragToRowInView()?n.getCurrentDragToRowLayout():n.dragFillToViewportBottomRowLayout():n.isDragFillStartBottomRowInView?n.dragFillStartBottomRowLayout():n.dragFillStartViewportBottomRowLayout()},rt.prototype.isDragToColumnInView=function(){return this.isColumnInViewport(this._dragToColumnViewport,this._dragToColumn)},rt.prototype.isColumnInViewport=function(n,t){var i=this._sheet.getViewportLeftColumn(n),r=this._sheet.getViewportRightColumn(n);return t>=i&&t<=r?!0:!1},rt.prototype.getCurrentDragToColumnLayout=function(){return this._sheet._getColumnLayout(this._dragToColumnViewport).findCol(this._dragToColumn)},rt.prototype.isDragFillStartRightColumnInView=function(){return this.isColumnInViewport(this._dragFillStartRightColumnViewport,this.dragFillStartRightColumn())},rt.prototype.dragFillStartViewportRightColumnLayout=function(){return this._sheet._getColumnLayout(this._dragStartColumnViewport).findCol(this.dragFillStartViewportRightColumn())},rt.prototype.dragFillStartViewportRightColumn=function(){return this._sheet.getViewportRightColumn(this._dragStartColumnViewport)},rt.prototype.getValidHorDragToColumnLayout=function(){var n=this;return n.isIncreaseFill()?n.isDragToColumnInView()?n.getCurrentDragToColumnLayout():n.dragFillToViewportRightColumnLayout():n.isDragFillStartRightColumnInView()?n.dragFillStartRightColumnLayout():n.dragFillStartViewportRightColumnLayout()},rt.prototype.dragFillToViewportTopRowLayout=function(){return this._sheet._getRowLayout(this._dragToRowViewport).findRow(this.dragFillToViewportTopRow())},rt.prototype.dragFillToViewportTopRow=function(){return this._sheet.getViewportTopRow(this._dragToRowViewport)},rt.prototype.dragFillToViewportLeftColumnLayout=function(){return this._sheet._getColumnLayout(this._dragToColumnViewport).findCol(this.dragFillToViewportLeftColumn())},rt.prototype.dragFillToViewportLeftColumn=function(){return this._sheet.getViewportLeftColumn(this._dragToColumnViewport)},rt.prototype.getCurrentFillDirection=function(){switch(this._currentFillDirection){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 0;case 5:return 2;default:break}return 3},rt.prototype.getHitRowViewportIndex=function(){var i=this._sheet,n=i._getRowViewportIndexNearY(this.mousePosition.y),r=this.startHitInfo.scrollRowViewportIndex,t=i._getRowLayout(1);return n===0&&r>0&&t.length>0&&t[0].row>i._getFirstPageTopRow()?n=1:n===2&&r<2&&t.length>0&&t[t.length-1].row<i._getLastVisualRow()&&(n=1),n},rt.prototype.getHitColumnViewportIndex=function(){var i=this._sheet,n=i._getColumnViewportIndexNearX(this.mousePosition.x),r=this.startHitInfo.scrollColViewportIndex,t=i._getColumnLayout(1);return n===0&&r>0&&t.length>0&&t[0].col>i._getFirstPageLeftColumn()?n=1:n===2&&r<2&&t.length>0&&t[t.length-1].col<i._getLastVisualColumn()&&(n=1),n},rt.prototype.getHitRowIndex=function(){var t=this._sheet,i=this.mousePosition.y,r=this.getHitRowViewportIndex(),f=t._getViewportRowLayoutNearY(r,i),u,n;return f?(u=t._getSheetLayout(),n=f.row,r===1&&i<u.viewportY&&n>t._getFirstPageTopRow())?t._getNextVisualRow(n-1)||n:r===1&&i>u.frozenTrailingY&&n>t._getLastFullyVisibleRow()?t._getPrevVisualRow(n)||n:n:-1},rt.prototype.getHitColumnIndex=function(){var t=this._sheet,i=this.mousePosition.x,r=this.getHitColumnViewportIndex(),f=t._getViewportColumnLayoutNearX(r,i),u,n;return f?(u=t._getSheetLayout(),n=f.col,r===1&&i<u.viewportX&&n>t._getFirstPageLeftColumn())?t._getNextVisualColumn(n-1)||n:r===1&&i>u.frozenTrailingX&&n>t._getLastFullyVisibleColumn()?t._getPrevVisualColumn(n)||n:n:-1},rt.prototype.getIntervalFromDistance=function(n){var t=0,i;return isNaN(n)||n===0||(i=n<0,n=o(n),t=ht(500/n),t=e(20,t*10),t>200&&(t=200),i&&(t=-t)),t},rt.prototype.updateRange=function(n,t,i,r){if(i!==0&&r!==0){var a=this,e=a._sheet,y=3,o=e._getRowLayout(0,y),s=e._getColumnLayout(0,y),h=e._getRowLayout(1,y),c=e._getColumnLayout(1,y),p=0;s&&s.length>0&&(p=s[s.length-1].col);c&&c.length>0&&(p=c[c.length-1].col);var l=a.getYForRow(n,t,i,r,!0,p,o,h),w=a.getYForRow(n,t,i,r,!1,p,o,h),b=0;o&&o.length>0&&(b=o[o.length-1].row);h&&h.length>0&&(b=h[h.length-1].row);var f=a.getXForCol(n,t,i,r,!0,b,s,c),v=a.getXForCol(n,t,i,r,!1,b,s,c),u=e._getSheetLayout(),k=e._render;v>f&&w>l&&k.update(f-u.headerX-2,l-u.headerY-2,v-f+2*u.headerX+2,w-l+2*u.headerY+2);w>l&&k.update(u.headerX,l,u.rowHeaderWidth,w-l);v>f&&(k.update(f,u.headerY,v-f,u.colHeaderHeight),k.update(f,u.footerY,v-f,u.colHeaderHeight))}},rt.prototype.getYForRow=function(n,t,i,r,u,f,o,s){var v=this._sheet,c=n,l,a,h;if(u||(c=n+i-1),c<v.frozenRowCount){if(o.length<1)return-1}else{if(s.length<1)return-1;u?c<s[0].row&&(c=s[0].row):c>s[s.length-1].row&&(c=s[s.length-1].row)}for(l=0,u&&(l=9e4),a=e(v._scrollLeftCol,t);a<t+r&&a<=f;a++)h=v.getCellRect(c,a),h&&(u?h.y<l&&(l=h.y):l<h.y+h.height&&(l=h.y+h.height));return l},rt.prototype.getXForCol=function(n,t,i,r,u,f,o,s){var v=this._sheet,c=t,l,a,h;if(u||(c=t+r-1),c<v.frozenColCount){if(o.length<1)return}else{if(s.length<1)return;u?c<s[0].col&&(c=s[0].col):c>s[s.length-1].col&&(c=s[s.length-1].col)}for(l=0,u&&(l=9e4),a=e(v._scrollTopRow,n);a<n+i&&a<=f;a++)h=v.getCellRect(a,c),h&&(u?h.x<l&&(l=h.x):l<h.x+h.width&&(l=h.x+h.width));return l},rt.prototype._getPreVisualRow=function(n,t){var u=this._sheet,r=u._getPrevVisualRow(n,t);return r!==i?r:n},rt.prototype._getPreVisualCol=function(n,t){var u=this._sheet,r=u._getPrevVisualColumn(n,t);return r!==i?r:n},rt.prototype._getPreVisibleRow=function(n,t,i){for(var r=this._sheet;n>t;)if(n--,r.getRowVisible(n,i))return n;return n},rt.prototype._getPreVisibleCol=function(n,t,i){for(var r=this._sheet;n>t;)if(n--,r.getColumnVisible(n,i))return n;return n},rt.prototype._getResizeRowInfo=function(n,r,u,f,o){var h=i,l,c,s,a,w,y,v,p;return n.canDoResizeRows()?(l=this,c=n._getRowLayout(r.rowViewportIndex,f),!c||isNaN(r.row)||isNaN(r.col)||(n.getRowVisible(r.row,f)||(r.row=this._getPreVisualRow(r.row,f)),s=c.findRow(r.row),s&&(s.y+s.height-u<=o&&o<=s.y+s.height+u?(h={action:"sizeRow",index:r.row,sheetArea:f},a=c[c.length-1].row,a>=0&&(w=n._getLastVisualRow(f),h.index===w&&h.index!==a&&s.y+s.height-u/2<=o&&(h={action:l.getResizeRowAction(n,a,f),index:a,sheetArea:f}))):s.y-u<=o&&o<=s.y+u&&t.ArrayHelper.indexOf(c,s)>0&&(y=l._getPreVisibleRow(r.row,0,f),h={action:l.getResizeRowAction(n,y,f),index:y,sheetArea:f})),!h&&r.rowViewportIndex===1&&c.length>0&&(s=c[0],e(0,s.y-u)<=o&&o<=s.y+u&&(v=r.row-1,p=n._getRowLayout(r.rowViewportIndex-1,f),v>=0&&p&&!p.findRow(v)&&(h={action:l.getResizeRowAction(n,v,f),index:v,sheetArea:f})))),h&&!n.getRowResizable(h.index,f)&&(h=i),h):h},rt.prototype.getResizeRowAction=function(n,t,i){var r=n.parent;return r&&r.resizeZeroIndicator()===1&&n.getRowVisible(t)&&n._getActualRowHeight(t,i)===0?"sizeHiddenRow":"sizeRow"},rt.prototype._getResizeColInfo=function(n,r,u,f,o){var h=i,l,c,s,a,w,y,v,p;return n.canDoResizeColumns()?(l=this,c=n._getColumnLayout(r.colViewportIndex,f),!c||isNaN(r.col)||isNaN(r.row)||(n.getColumnVisible(r.col,f)||(r.col=this._getPreVisualCol(r.col,f)),s=c.findCol(r.col),s&&(s.x+s.width-u<=o&&o<=s.x+s.width+u?(h={action:"sizeCol",index:r.col,sheetArea:f},a=c[c.length-1].col,a>=0&&(w=n._getLastVisualColumn(f),h.index===w&&h.index!==a&&s.x+s.width-u/2<=o&&(h={action:l.getResizeColAction(n,a,f),index:a,sheetArea:f}))):s.x-u<=o&&o<=s.x+u&&t.ArrayHelper.indexOf(c,s)>0&&(y=l._getPreVisibleCol(r.col,0,f),h={action:l.getResizeColAction(n,y,f),index:y,sheetArea:f})),!h&&r.colViewportIndex===1&&c.length>0&&(s=c[0],e(0,s.x-u)<=o&&o<=s.x+u&&(v=r.col-1,p=n._getColumnLayout(r.colViewportIndex-1,f),v>=0&&p&&!p.findCol(v)&&(h={action:l.getResizeColAction(n,v,f),index:v,sheetArea:f})))),h&&!n.getColumnResizable(h.index,f)&&(h=i),h):h},rt.prototype.getResizeColAction=function(n,t,i){var r=n.parent;return r&&r.resizeZeroIndicator()===1&&n.getColumnVisible(t)&&n._getActualColumnWidth(t,i)===0?"sizeHiddenCol":"sizeCol"},rt.prototype.getResizingRowCol=function(n,t,r,u){var c=this,f=c._sheet,y=f.parent,e=i,s,h,l,a,v;return(!y||y._allowUserResize)&&(l=f._getSheetLayout(),n.rowViewportIndex<0&&n.colViewportIndex>=0&&f.colHeaderVisible?(e=c._getResizeColInfo(f,n,u,1,t),e||(e=c._getResizeRowInfo(f,n,u,1,r))):n.rowViewportIndex>=0&&n.colViewportIndex<0&&f.rowHeaderVisible?(e=c._getResizeRowInfo(f,n,u,2,r),e||(e=c._getResizeColInfo(f,n,u,2,t))):n.rowViewportIndex<0&&n.colViewportIndex<0?f._getLastVisualRow(2)===i&&o(r-l.colHeaderHeight)<=u?(a=f._getRowLayout(1),a&&a.length>0&&(s=a[a.length-1].row),s>=0&&f.getRowResizable(s,2)&&(e={action:c.getResizeRowAction(f,s,2),index:s,sheetArea:2})):f._getLastVisualColumn(1)===i&&o(t-l.rowHeaderWidth)<=u&&(v=f._getColumnLayout(1),v&&v.length>0&&(h=v[v.length-1].col),h>=0&&f.getColumnResizable(h,1)&&(e={action:c.getResizeColAction(f,h,1),index:h,sheetArea:1})):n.rowViewportIndex>=0&&n.colViewportIndex>=0&&(l.colHeaderHeight===0&&r<=u&&f.colHeaderVisible?(s=f.getRowCount(1)-1,s>=0&&(e={action:"sizeHiddenRow",index:s,sheetArea:1})):l.rowHeaderWidth===0&&t<=u&&f.rowHeaderVisible&&(h=f.getColumnCount(2)-1,h>=0&&(e={action:"sizeHiddenCol",index:h,sheetArea:2})))),e},rt.prototype.getDragInfo=function(n,t,r){var o=this,f=i,s=n.rowViewportIndex,h=n.colViewportIndex,c,l,u,e;if(typeof s===k||s===i||typeof h===k||h===i||(c=o._sheet,l=c._getActiveSelectedRange(),l.row===-1&&l.col===-1))return f;if(s>=0&&h>=0&&c._selectionModel.length===1){if(o.inGrayArea(s,h,t,r))return f;u=c._getRangeRect(s,h,l);u.x-4<t&&t<u.x+4&&u.y<=r&&r<u.y+u.height&&(f={action:"drag",side:"left"});f||(e=o._sheet._dragFillIndicatorRect,e&&e.x<=t&&t<=e.x+e.width&&e.y<=r&&r<=e.y+e.height&&(f={action:"drag",side:"corner"}));f||u.x+u.width-4<t&&t<u.x+u.width+4&&u.y<=r&&r<u.y+u.height&&(f={action:"drag",side:"right"});f||u.y-4<r&&r<u.y+4&&u.x<=t&&t<u.x+u.width&&(f={action:"drag",side:"top"});f||u.y+u.height-4<r&&r<u.y+u.height+4&&u.x<=t&&t<u.x+u.width&&(f={action:"drag",side:"bottom"});f&&(t<u.x||t>u.x+u.width||r<u.y||r>u.y+u.height)&&(f.outside=!0)}return o._sheet.canUserDragDrop()||f&&f.side!=="corner"&&(f.side=i),o._sheet.canUserDragFill()||f&&f.side==="corner"&&(f.side=i),f},rt.prototype.inGrayArea=function(n,t,i,r){var o=this._sheet,c=o._getSheetLayout(),u=c.viewportRect(1,1),f,s,e,h;if(t===1)if(f=o._getColumnLayout(t),f&&f.length>0){if(s=f[f.length-1],s.x+s.width<=i&&i<u.x+u.width)return!0}else if(u.contains(i,r))return!0;if(n===1)if(e=o._getRowLayout(n),e&&e.length>0){if(h=e[e.length-1],h.y+h.height<=r&&r<u.y+u.height)return!0}else if(u.contains(i,r))return!0;return!1},rt.prototype.doMouseMove=function(n){var t=this._getCanvasOffset();this.doMouseMoveImp(n,n.pageX-t.left,n.pageY-t.top)},rt.prototype.doMouseOut=function(n){var r=this._sheet,t=r._currentTarget,u;if(t&&t.cellTypeHitInfo){var f=t.row,e=t.col,o=r.getCellType(f,e,t.hitTestType);o.processMouseLeave(t.cellTypeHitInfo)}this.isWorking||(u={x:-1e4,y:-1e4,rowViewportIndex:i,colViewportIndex:i,row:-1,col:-1,resizeInfo:i,hitTestType:i},r._setHoverCell(u))},rt.prototype._hoverShowComment=function(n){var t=this._sheet,i=-1,r=-1,u;if(n&&n.rowViewportIndex>=0&&n.colViewportIndex>=0&&(i=n.row,r=n.col),t.parent){if(i<0||r<0)return;u=t.getComment(i,r);t._commentManager&&t._commentManager.hoverShowComment(u)}},rt.prototype.doMouseMoveImp=function(n,i,r){var u=this,f,e;if(u.mousePosition={e:n,x:i,y:r},f=u._sheet,u.isMouseDown&&(t.FocusHelper.isActiveElement(f)||t.FocusHelper.setActiveElement(f)),u.isMouseDown&&u.isWorking){u.isResizing?u.continueResizing():u.isDragDropping?u.continueDragDropping():u.isDraggingFill?u.continueDragFill():u.isFormulaRangeAppending?u.continueFormulaRangeAppending():u.isFormulaRangeMoving?u.continueFormulaRangeMoving():u.isFormulaRangeResizing?u.continueFormulaRangeResizing():u.isSelecting&&u.continueSelecting();return}(e=f.hitTest(i,r),e)&&(t.features.comment&&u._hoverShowComment(e),u.updateCanvasCursor(e),f._setHoverCell(e))},rt.prototype.updateCanvasCursor=function(t){var f=this,o=f._sheet,u=o._getCanvas(),r,c;if(u){if(r=o._currentTarget,c=!r||t.row!==r.row||t.col!==r.col||t.hitTestType!==r.hitTestType||t.resizeInfo&&!r.resizeInfo||!t.resizeInfo&&r.resizeInfo||t.resizeInfo&&t.resizeInfo.action!==r.resizeInfo.action||t.dragInfo&&!r.dragInfo||!t.dragInfo&&r.dragInfo||t.dragInfo&&t.dragInfo.action!==r.dragInfo.action,r&&c&&r.cellTypeHitInfo){var w=r.row,b=r.col,a=o.getCellType(w,b,r.hitTestType);a.processMouseLeave(r.cellTypeHitInfo)}var h=t.resizeInfo,l=t.dragInfo,e=t.formulaRangeHitInfo,s=t.cellTypeHitInfo,v=o._render;if(h)u.style.cursor=h.action==="sizeCol"?n.Sheets.CursorResource.ResizeCol:h.action==="sizeRow"?n.Sheets.CursorResource.ResizeRow:h.action==="sizeHiddenCol"?n.Sheets.CursorResource.ResizeHiddenCol:h.action==="sizeHiddenRow"?n.Sheets.CursorResource.ResizeHiddenRow:"default";else if(l&&l.action==="drag")l.side==="corner"?u.style.cursor="crosshair":l.side&&(u.style.cursor="move");else if(e){e.inBorder?u.style.cursor="move":e.inTopLeft?u.style.cursor="nw-resize":e.inTopRight?u.style.cursor="ne-resize":e.inBottomLeft?u.style.cursor="sw-resize":e.inBottomRight&&(u.style.cursor="se-resize");var k=f.isFormulaRangeHoving,y=f._formulRangeHovingInfo,d=y&&y.paramRange,p=e.paramRange;f.isFormulaRangeHoving=!0;f._formulRangeHovingInfo={paramRange:p};k&&p.index===d.index||v.paintFormulaTextBox()}else{if(s){var g=t.row,nt=t.col,a=o.getCellType(g,nt,t.hitTestType);s.sheet=o;c&&a.processMouseEnter(s);a.processMouseMove(s)}!c&&s&&s.isReservedLocation||(u.style.cursor="default");f.isFormulaRangeHoving&&(f.isFormulaRangeHoving=!1,f._formulRangeHovingInfo=i,v.paintFormulaTextBox())}}},rt.prototype.doMouseUp=function(n){var t=this,r=t._sheet,i;if(t.unhandleDocumentMouseMove(),i=t._getCanvasOffset(),r._isMouseDownInSheet)r._isMouseDownInSheet=!1;else return!0;return t.doMouseUpImp(n,n.pageX-i.left,n.pageY-i.top),!1},rt.prototype.doMouseUpImp=function(n,i,r){var u=this,e=u._sheet,o=t.FocusHelper.getActiveElement(),f;if(u.isMouseDown=!1,o&&o!==e&&o.endEdit&&(o.endEdit(),o.repaint()),t.FocusHelper.setActiveElement(e),u.isResizing)u.stopResizing();else if(u.isDragDropping)u.stopDragDrop();else if(u.isDraggingFill)u.endDragFill();else if(u.isFormulaRangeAppending)u.stopFormulaRangeAppending();else if(u.isFormulaRangeMoving)u.stopFormulaRangeMoving();else if(u.isFormulaRangeResizing)u.stopFormulaRangeResizing();else if(e._currentTarget){if(f=e._currentTarget,f.cellTypeHitInfo){var s=f.row,h=f.col,c=e.getCellType(s,h,f.hitTestType);f.cellTypeHitInfo.sheet||(f.cellTypeHitInfo.sheet=e);c.processMouseUp(f.cellTypeHitInfo)}f.cellTypeHitInfo&&f.cellTypeHitInfo.isReservedLocation||e.triggerCellClick({sheet:e,sheetName:e._name,sheetArea:f.hitTestType,row:f.row,col:f.col})}u.stopSelecting();u.setMetaKeyState(n)},rt.prototype.startEdit=function(n){var t=this._sheet,r=t._getCanvas(),i=this._getCanvasOffset();n.shiftKey||n.ctrlKey||t._doStartEdit(r,n.pageX-i.left,n.pageY-i.top)},rt.prototype.doKeyDown=function(n){var r=this,i=r._sheet,o,s,h,c;if(i){var u=i.getActiveRowIndex(),f=i.getActiveColumnIndex(),e=i.getCellType(u,f),l={isEditing:i.isEditing(),sheet:i,row:u,col:f,sheetArea:3},a={sheet:i,row:u,col:f,sheetArea:3};if(e&&e.isReservedKey(n,l)){i.isEditing()||e.processKeyDown(n,a);return}if(o=i._formulaTextBox,o&&o.isReservedKey(n))return;if(s=i.parent&&i.parent._attachedFormulaTextBox,s&&s.isReservedKey(n))return}if(h=!i.isEditing()&&!n.ctrlKey&&!n.metaKey&&(n.keyCode===34||n.keyCode===33||n.keyCode===37||n.keyCode===39||n.keyCode===9||n.keyCode===13||n.keyCode===38||n.keyCode===40),i._isTouchMode&&(i._isTouchMode=!1,i._render.refreshTouchSelectionIndicator()),c=r._keyDownImp(n),h&&c&&t.FocusHelper.isActiveElement(i)){if(r._keyPressed){r._keyPressedCount<25&&r._keyPressedCount++;t.util.cancelDefault(n);return}r._keyPressed=!0;r._keyPressedCount=1;r._repeatKeyDown(n,!0)}},rt.prototype._getMouseDownResizeTooltipContent=function(){var i=this._sheet,f=i._currentTarget,n=f.resizeInfo,e,r,o,u;return n.action==="sizeRow"||n.action==="sizeHiddenRow"?(e=i._getAllRowLayout(n.sheetArea),i.getRowVisible(n)||(n.index=this._getPreVisualRow(n.index,n.sheetArea)),r=e.findRow(n.index),r||(r=e.findRow(f.row)),t._StringHelper.format(t.SR.Tip_Height,[r.height.toFixed(0)])):(o=i._getAllColumnLayout(n.sheetArea),i.getColumnVisible(n.index)||(n.index=this._getPreVisualCol(n.index,n.sheetArea)),u=o.findCol(n.index),u||(u=o.findCol(f.col)),t._StringHelper.format(t.SR.Tip_Width,[u.width.toFixed(0)]))},rt.prototype._getMouseMoveResizeTooltipContent=function(n){return n.action==="sizeRow"||n.action==="sizeHiddenRow"?t._StringHelper.format(t.SR.Tip_Height,[(n.movingY-n.startY).toFixed(0)]):t._StringHelper.format(t.SR.Tip_Width,[(n.movingX-n.startX).toFixed(0)])},rt.prototype._repeatKeyDown=function(n,t){var i=this;i._keyPressed&&(t||i._keyDownImp(n),i._keyPressed&&(i._repeatKeyDownTimeoutID=window.setTimeout(function(){i._repeatKeyDown(n)},500/i._keyPressedCount)))},rt.prototype._startEditByKeyboard=function(n){var t=this._sheet,u=t._getCanvas(),f,r;if(u){t._startEditByKeydown=!0;try{f=t.isEditing();t._startEditImp(u,t._activeRowIndex,t._activeColIndex,i,i,!0);!f&&t.isEditing()&&(r=t.getCellType(t._activeRowIndex,t._activeColIndex),!r._triggerButtonClicked||n.keyCode!==32||n.ctrlKey||n.shiftKey||n.altKey||r._triggerButtonClicked(t,t._activeRowIndex,t._activeColIndex,3),r._cancelDefaultKeydown&&r._cancelDefaultKeydown(n))}finally{t._startEditByKeydown=!1}}},rt.prototype._keyDownImp=function(n){var u=this,r=u._sheet,o,f,s,e,h;return(u.setMetaKeyState(n),r.isEditing()||n.keyCode!==27||n.altKey||n.ctrlKey||n.shiftKey||!r._validationInputMessage||(t.GC$(r._validationInputMessage).remove(),r._validationInputMessage=i),r.isEditing()||n.keyCode!==34&&n.keyCode!==33&&n.keyCode!==35&&n.keyCode!==36&&n.keyCode!==38&&n.keyCode!==40||t.util.cancelDefault(n),r.isEditing()||n.keyCode!==37&&n.keyCode!==39||t.util.cancelDefault(n),t.features.tableSlicer&&r._processSlicerKeyMap(n))?!1:t.features.floatingObject&&r._processFloatingObjectsKeyMap(n)?!1:t.features.comment&&r._processCommentKeyMap(n)?!1:r._processKeyMap(n)?!0:(o=n.keyCode===229||n.keyCode===0,u.allowEnterEditing(n)&&!o&&(f=r._formulaTextBox,f&&f.isAppending()&&f.stopAppending(),s=r.isEditing(),s||(e=t.Global.prototype.getUIElement(n.target),h=e&&e.getAttribute(v)==="gcAttachedFormulaTextBox",h||u._startEditByKeyboard(n))),!1)},rt.prototype.clearRepeatKeyDownTimeout=function(){var n=this;n._keyPressed=!1;n._repeatKeyDownTimeoutID>0&&(window.clearTimeout(n._repeatKeyDownTimeoutID),n._repeatKeyDownTimeoutID=0)},rt.prototype.doKeyUp=function(n){var i=this,t,e,o;if(i.clearRepeatKeyDownTimeout(),t=i._sheet,t){var r=t.getActiveRowIndex(),u=t.getActiveColumnIndex(),f=t.getCellType(r,u),s={isEditing:t.isEditing(),sheet:t,row:r,col:u,sheetArea:3},h={sheet:t,row:r,col:u,sheetArea:3};if(f&&f.isReservedKey(n,s)){t.isEditing()||f.processKeyUp(n,h);return}if(e=t._formulaTextBox,e&&e.isReservedKey(n))return;if(o=t.parent&&t.parent._attachedFormulaTextBox,o&&o.isReservedKey(n))return}i.setMetaKeyState(n)},rt.prototype.doCompositionStart=function(n){this._startEditByKeyboard(n)},rt.prototype.allowEnterEditing=function(n){if(n.ctrlKey||n.altKey||n.metaKey)return!1;if(n.keyCode>=65&&n.keyCode<=90)return!0;else if(n.keyCode>=48&&n.keyCode<=57||n.keyCode>=96&&n.keyCode<=105)return!0;else if(n.keyCode>=186&&n.keyCode<=192)return!0;else if(n.keyCode>=220&&n.keyCode<=222||n.keyCode===219)return!0;else if(n.keyCode>=106&&n.keyCode<=111)return!0;else if(n.keyCode===32)return!0;else if(n.keyCode===61)return!0;else if(n.keyCode===173)return!0;else if(n.keyCode===229||n.keyCode===0)return!0;else if(n.keyCode===8)return!0;return!1},rt.prototype.setMetaKeyState=function(n){var i=this,r=i._sheet,o=t.util.isMacOS(),f=o?n.metaKey:n.ctrlKey,u;if(i.ctrl=f&&!n.shiftKey,i.shift=n.shiftKey&&!f,r._isNavigateInSelection=!1,n.keyCode===9&&(r._selectionModel.length>1?r._isNavigateInSelection=!0:(u=r._getActiveSelectedRange(),u&&r._selectionModel.length>0&&(r._isNavigateInSelection=!(r._activeRowIndex===u.row&&r._activeColIndex===u.col&&r._activeRowCount===u.rowCount&&r._activeColCount===u.colCount)))),i.isDragDropping===!0){var e=r._getActiveSelectedRange(),s=i._isDragInsert,h=i._isDragCopy;i._isDragInsert=e.row===-1||e.col===-1?n.shiftKey:!1;i._isDragCopy=n.ctrlKey;(s!==i._isDragInsert||h!==i._isDragCopy)&&r._render.refreshDragDropIndicator()}i.isShiftPressed=n.shiftKey;i.isControlPressed=n.ctrlKey},rt.prototype.resetMetaKeyState=function(){var n=this;n.shift=!1;n.ctrl=!1;n._sheet._isNavigateInSelection=!1;n.isDragDropping=!1;n._isDragInsert=!1;n._isDragCopy=!1;n.isShiftPressed=!1;n.isControlPressed=!1},rt.prototype.doMouseWheel=function(n,i,r){var u=this._sheet,v=!1,y=!1,p=u._slicerCollection,b,h,k,c,f,l,s,e,a;if(p&&p.mouseWheelSelectedSlicer(n))return!0;if(n.ctrlKey)if(!u.parent||u.parent._allowUserZoom){var w=u._zoomFactor,o=u._zoomFactor-.05*i,d=new t.UndoRedo.ZoomUndoAction(u,o);u._doCommand(d);o=u._zoomFactor;w!==o&&u.triggerUserZooming({sheet:u,sheetName:u._name,oldZoomFactor:w,newZoomFactor:o})}else return!0;else b=u._scrollTopRow,h=this._getNewTopRow(i),b!==h?(this.vScrollTo(h),u._syncVScrollbarPosition(),f=u.parent,f&&!f._scrollbarShowMax&&u._syncVScrollbarSize()):v=!0,k=u._scrollLeftCol,c=this._getNewLeftCol(r),k!==c?(this.hScrollTo(c),u._syncHScollbarPosition(),f=u.parent,f&&!f._scrollbarShowMax&&u._syncHScrollbarSize()):y=!0;return l=this._getCanvasOffset(),s=u.hitTest(n.pageX-l.left,n.pageY-l.top),t.features.comment&&this._hoverShowComment(s),e=u._currentTarget,a=e&&e.cellTypeHitInfo,a&&(a.cellRect=u.getCellRect(e.row,e.col)),this.updateCanvasCursor(s),u._setHoverCell(s),v&&y},rt.prototype._getNewTopRow=function(n){var r=this._sheet,t=r._scrollTopRow,u,f,e;return r.frozenRowCount>0&&(r._scrollTopRow===0&&n>0?t=r.frozenRowCount:n<0&&r._scrollTopRow===r.frozenRowCount-n&&(t=0)),n<0?(u=r._getScrollableRow(t+n,!0),t=u!==-1?u:t+n):n>0&&(u=r._getScrollableRow(t+n),t=u!==-1?u:t+n),f=r._getFirstPageTopRow(),e=r._getLastVisualScrollRow(),r.getRowCount()-r.frozenRowCount-r._frozenTrailingRowCount<=0||f===null?t=r._scrollTopRow:(t<f?t=f:t>e&&(t=e),t===i&&(t=-1)),t},rt.prototype._getNewLeftCol=function(n){var r=this._sheet,t=r._scrollLeftCol,u,f,e;return r.frozenColCount>0&&(r._scrollLeftCol===0&&n>0?t=r.frozenColCount:n<0&&r._scrollLeftCol===r.frozenColCount-n&&(t=0)),n<0?(u=r._getScrollableColumn(t+n,!0),t=u!==-1?u:t+n):n>0&&(u=r._getScrollableColumn(t+n),t=u!==-1?u:t+n),f=r._getFirstPageLeftColumn(),e=r._getLastVisualScrollColumn(),r.getColumnCount()-r.frozenColCount-r._frozenTrailingColCount<=0||f===null?t=r._scrollLeftCol:(t<f?t=f:t>e&&(t=e),t===i&&(t=-1)),t},rt.prototype.updateEditingEditor=function(n){var i,f,h,c,s;if(n&&n.sheet?(i=n.sheet,f=n.editor,h=n.canvasOffset):(i=this._sheet,f=i._editor),i.isEditing()){var e=i._activeRowIndex,o=i._activeColIndex,l=i.getCellType(e,o),u=i._getSheetLayout(),a=i.getActualStyle(e,o),r=i.getCellRect(e,o);r&&r.width>0&&r.height>0&&r.x>=u.frozenX&&r.y>=u.frozenY&&r.x+r.width<=u.frozenTrailingX+u.frozenTrailingWidth&&r.y+r.height<=u.frozenTrailingY+u.frozenTrailingHeight?(c={sheet:i,row:e,col:o,sheetArea:3,canvasOffset:h},l.updateEditor(f,a,r,c)):t.GC$(f).css({top:-1e4,left:-1e4});s=i._formulaTextBox;s&&s.position()}},rt.prototype.doVScroll=function(n){var t=this,i=t._sheet;t.scrolling=!0;t.newTop=n;t.newLeft=i._scrollLeftCol;t.scrollTimer||(t.scrollTimer=window.setInterval(function(){t._scrollView()},t.waittime))},rt.prototype.doHScroll=function(n){var t=this,i=t._sheet;t.scrolling=!0;t.newLeft=n;t.newTop=i._scrollTopRow;t.scrollTimer||(t.scrollTimer=window.setInterval(function(){t._scrollView()},t.waittime))},rt.prototype._scrollView=function(){var n=this;if(!n.scrolling){n.scrollTimer&&(window.clearInterval(n.scrollTimer),n.scrollTimer=i);return}n.scrolling=!1;n._updateView()},rt.prototype._showScrollTooltip=function(n,t){var i=this,r,u;n?(r=t.pageY,u=t.pageX-i.VSCROLLTOOLTIP_LEFT):(r=t.pageY-i.HSCROLLTOOLTIP_TOP,u=t.pageX-i.HSCROLLTOOLTIP_LEFT);i._showTooltip(i._getScrollTooltipContent(n),u,r,!0)},rt.prototype._getScrollTooltipContent=function(n){var i=this._sheet;return n?t.SR.Tip_Row+(i._scrollTopRow+1):i.colHeaderAutoText===1?t.SR.Tip_Column+(i._scrollLeftCol+1):t.SR.Tip_Column+i._indexToLetters(i._scrollLeftCol+1)},rt.prototype._dataContextLoaded=function(n,t){var r=n.data,u,f,i;if(r&&r.length>0){if(u=this._sheet,f=u.getDataSource(),f&&this.lastLoadedRowIndex===n.start)for(i=0;i<r.length;i++)f[n.start+i]=r[i];u.recalcAll();u.repaint()}},rt.prototype.getElementById=function(n,t){var r,u;if(!n)return i;for(r=n.firstChild;r;){if(r.id===t||r.name===t)return r;if(u=this.getElementById(r,t),u)return u;r=r.nextSibling}return i},rt.prototype._updateView=function(){var n=this,i=n._sheet,r,t;n.painting||(n.painting=!0,r=i.parent,t=0,r&&(t=r.showScrollTip()),n.newTop!==i._scrollTopRow?(n.vScrollTo(n.newTop),(t===2||t===3)&&n._refreshTooltip(n._getScrollTooltipContent(!0))):n.newLeft!==i._scrollLeftCol&&(n.hScrollTo(n.newLeft),(t===1||t===3)&&n._refreshTooltip(n._getScrollTooltipContent(!1))),n.painting=!1)},rt.prototype.vScrollTo=function(n){var i=this._sheet,p=i._scrollTopRow,tt,w,d,h,c,l,f,g,nt;if(n!==p&&(i._scrollTopRow=n,i.triggerTopRowChanged({sheet:i,sheetName:i._name,oldTopRow:p,newTopRow:n}),!i._paintSuspended&&!(i._layoutSuspended>0))){if(t.features.comment&&(tt=i._commentManager,tt.updateCommentsLayoutWhenSheetScroll()),w=!1,t.util._useDoubleBuffer()){var b=i.getBounds(),a=i._getSheetLayout(),v=a.viewportY,o=a.viewportHeight,r,y,e,s,u=i._render,k=u._getCtx();if(n>p){if(c=i._getRowLayout(1),c&&c.length>0&&(d=c.findRow(n)),d){for(f=c.length-1,h=c[f];h.y+h.height>v+o;)f=f-1,h=c[f];h.row>n&&(w=!0,g=2,r=b?b.x:a.x,y=d.y,e=a.width,s=h.y+h.height-d.y-g,u.copyScreen(r,y,e,s,r,v),i.invalidateLayout(),u.paintBody(k,new t.Rect(r,v+s,e,o-s)),u.paintAdornment(k,new t.Rect(r,v,e,o)),i.parent&&i.parent._themeVersion>2007&&i.frozenRowCount===0&&u.repaintSelection())}}else{for(l=0,f=n;f<p&&l<o;f++)l+=i._getZoomRowHeight(f);l<o&&(w=!0,g=2,r=b?b.x:a.x,y=v,e=a.width,s=o-l,i.getFrozenTrailingRowCount()>0&&(s-=1),u.copyScreen(r,y,e,s,r,y+l),i.invalidateLayout(),u.paintBody(k,new t.Rect(r,y,e,l+g)),u.paintAdornment(k,new t.Rect(r,v,e,o)),i.parent&&i.parent._themeVersion>2007&&(nt=i._selectionModel,(i.frozenRowCount===0||nt.length===1&&nt[0].row+nt[0].rowCount===i.frozenRowCount&&i._scrollTopRow===i.frozenRowCount)&&u.repaintSelection()))}}w||(i.invalidateLayout(),i.repaint());this.updateEditingEditor()}},rt.prototype.hScrollTo=function(n){var i=this._sheet,p=i._scrollLeftCol,tt,w,d,h,c,l,f,g,nt;if(n!==p&&(i._scrollLeftCol=n,i.triggerLeftColumnChanged({sheet:i,sheetName:i._name,oldLeftCol:p,newLeftCol:n}),!i._paintSuspended&&!(i._layoutSuspended>0))){if(t.features.comment&&(tt=i._commentManager,tt.updateCommentsLayoutWhenSheetScroll()),w=!1,t.util._useDoubleBuffer()){var b=i.getBounds(),a=i._getSheetLayout(),v=a.viewportX,o=a.viewportWidth,y,r,s,e,u=i._render,k=u._getCtx();if(n>p){if(c=i._getColumnLayout(1),c&&c.length>0&&(d=c.findCol(n)),d){for(f=c.length-1,h=c[f];h.x+h.width>v+o;)f=f-1,h=c[f];h.col>n&&(w=!0,g=2,y=d.x,r=b?b.y:a.y,s=h.x+h.width-d.x-g,e=a.height,u.copyScreen(y,r,s,e,v,r),i.invalidateLayout(),u.paintBody(k,new t.Rect(v+s,r,o-s,e)),u.paintAdornment(k,new t.Rect(v,r,o,e)),i.parent&&i.parent._themeVersion>2007&&i.frozenColCount===0&&u.repaintSelection())}}else{for(l=0,f=n;f<p&&l<o;f++)l+=i._getZoomColumnWidth(f);l<o&&(w=!0,g=2,y=v,r=b?b.y:a.y,s=o-l,e=a.height,i.getFrozenTrailingColumnCount()>0&&(s-=1),u.copyScreen(y,r,s,e,y+l,r),i.invalidateLayout(),u.paintBody(k,new t.Rect(y,r,l+g,e)),u.paintAdornment(k,new t.Rect(v,r,o,e)),i.parent&&i.parent._themeVersion>2007&&(nt=i._selectionModel,(i.frozenColCount===0||nt.length===1&&nt[0].col+nt[0].colCount===i.frozenColCount&&i._scrollLeftCol===i.frozenColCount)&&u.repaintSelection()))}}w||(i.invalidateLayout(),i.repaint());this.updateEditingEditor()}},rt.prototype._notEqualSelecions=function(n,t){var f=!0,i,r,u;if(n.length===t.length)for(i=0;i<n.length;i++)if(r=n[i],u=t[i],r.row!==u.row||r.col!==u.col||r.rowCount!==u.rowCount||r.colCount!==u.colCount){f=!0;break}else f=!1;return f},rt.prototype._createFocusHolder=function(n,r,f,e){var o=this,d=o._sheet,nt={sheet:d,row:r,col:f,sheetArea:3},rt=d._getHost(),et=n.isImeAware(nt),w,ht=st?h:"fixed",ut,g,ft;return e&&o._destroyFocusHolder(),et&&!o._cellTypeFocusHolder&&(w=n.createEditorElement(nt),o._focusHolderOldCss||(o._focusHolderOldCss={overflow:at,border:a,position:h}),o._focusHolderOldCss.overflow=w.style.overflow,o._focusHolderOldCss.border=w.style.border,o._focusHolderOldCss.position=w.style.position,t.GC$(w).css(s,ht).css(p,b).css(c,"0px").css(l,"0px").css(tt,"0px").css(it,"0px").css(y,a),d=o._sheet,d._setEditorValue(n,w,r,f,d.getActualStyle(r,f)),ut=n.getEditorValue(w,nt),t.util.browser.safari&&(ut===""||ut===i||typeof ut===k)&&n.setEditorValue(w," ",nt),rt&&rt.insertBefore(w,i),o._cellTypeFocusHolder=w),o._originalFocusHolder||(w=u.createElement("div"),t.GC$(w).css(s,ht).css(p,b).css(c,"0px").css(l,"0px").css(tt,"0px").css(it,"0px"),o._originalFocusHolder=w,g=u.createElement("textarea"),t.GC$(g).attr(v,"gcSheetFocusInput").attr(ot,-1).css(s,h).css(p,b).css(y,a).css(lt,a),g.value=" ",w.insertBefore(g,i),o._focusElem=g,ft=u.createElement("div"),t.GC$(ft).css(s,h).css(p,b).attr(v,"gcSheetFocusInput").attr(ot,-1),w.insertBefore(ft,i),o._readonlyFocusElem=ft,rt&&rt.insertBefore(w,i)),st&&(o._cellTypeFocusHolder&&o._setVisibleLocation(d,o._cellTypeFocusHolder),o._setVisibleLocation(d,o._originalFocusHolder)),et?o._cellTypeFocusHolder:o._focusElem},rt.prototype._resetFocusHolder=function(){var n=this;n._cellTypeFocusHolder&&n._focusHolderOldCss&&t.GC$(n._cellTypeFocusHolder).css(p,n._focusHolderOldCss.overflow).css(y,n._focusHolderOldCss.border).css(s,n._focusHolderOldCss.position)},rt.prototype._destroyFocusHolder=function(){var n=this;n._cellTypeFocusHolder&&(n._cellTypeFocusHolder.parentElement&&n._cellTypeFocusHolder.parentElement.removeChild(n._cellTypeFocusHolder),n._cellTypeFocusHolder=i)},rt.prototype.setFocus=function(){t.FocusHelper.isActiveElement(this._sheet)||this._setFocusCore(!0,!0)},rt.prototype.setFocusToReadonlyFocusElem=function(){var n=this._readonlyFocusElem;n&&n.focus()},rt.prototype.changeFocusHolder=function(){this._setFocusCore(!0,!0)},rt.prototype._clearTouchSetFocusTimeout=function(){this._touchSetFocusTimeout&&(clearTimeout(this._touchSetFocusTimeout),this._touchSetFocusTimeout=i)},rt.prototype._setFocusCore=function(n,i){var f,r,s,h,e,o,c,a,l;(!t.util._isSilverlightCanvas()||t.util._isStandardCanvas())&&(arguments.length===0&&(n=!0),f=this,f._focusReleased=!1,f._clearTouchSetFocusTimeout(),r=f._sheet,s=r.getActiveRowIndex(),h=r.getActiveColumnIndex(),e=r.getCellType(s,h),f._createFocusHolder(e,s,h,i),o={sheet:r,row:s,col:h,sheetArea:3},c=e.isImeAware(o)?f._cellTypeFocusHolder:f._focusElem,i&&!t.util.browser.msie&&e.setImeMode(c,r.getActualStyle(s,h).imeMode,o),u.body.focus(),a=function(){var n=function(){try{e.isImeAware(o)?(e.focus(c,o),e.selectAll(c,o)):(c.focus(),c.select())}catch(n){}};n();i&&t.util.browser.msie&&(e.setImeMode(c,r.getActualStyle(s,h).imeMode,o),n())},(r._isTouchMode||t.util.device().ipad)&&(n||!e.isImeAware(o))?(l=t.util.device(),!r.isEditing()&&(t.util.browser.metroMode||l.ipad||l.iphone||l.android)?i&&e.setImeMode(f._cellTypeFocusHolder,r.getActualStyle(s,h).imeMode,o):f._touchSetFocusTimeout=setTimeout(function(){(f._clearTouchSetFocusTimeout(),r.isEditing())||r._enhanceIme!==!1&&a()},200)):r._enhanceIme!==!1&&a(),t.FocusHelper.isActiveElement(r)||t.FocusHelper.setActiveElement(r),f._updateValidationUI(r._activeRowIndex,r._activeColIndex))},rt.prototype._setVisibleLocation=function(n,i){var b=n.getActiveRowIndex(),k=n.getActiveColumnIndex(),d=n.activeRowViewportIndex,g=n.activeColViewportIndex,s=n.getCellRect(b,k,d,g),r,u,f=this,v=f._getCanvasOffset(),e=f._getCanvasPosition(),y=f._cellTypeFocusHolder,nt=0,rt=0,p=0,w=0;if(y){var o=t.GC$(y),nt=parseInt(o.css(c),10),rt=parseInt(o.css(l),10);p=parseInt(o.css(it),10);w=parseInt(o.css(tt),10)}f._isInvalidRect(s)?(r=nt,u=rt):(r=s.y+e.top-2,u=s.x+e.left-2);var h=window.pageYOffset-v.top+e.top,ut=window.innerHeight+h-p,a=window.pageXOffset-v.left+e.left,ft=window.innerWidth+a-w;(isNaN(r)||r<h||r>ut)&&(r=h);(isNaN(u)||u<a||u>ft)&&(u=a);t.GC$(i).css(c,r).css(l,u)},rt.prototype.releaseFocus=function(n){var t=this,i,r,f,e,o,s;(t._clearTouchSetFocusTimeout(),t._sheet.isEditing()||t._focusReleased&&u.activeElement===t._readonlyFocusElem)||(i=t._sheet,n?(r=n.row,f=n.col,e=n.rowViewportIndex,o=n.colViewportIndex):(r=i._activeRowIndex,f=i._activeColIndex,e=i.activeRowViewportIndex,o=i.activeColViewportIndex),s=i.getCellType(r,f),t._createFocusHolder(s,r,f,!1),t._readonlyFocusElem.focus(),t._focusReleased=!0)},rt.prototype.resumeFocus=function(n){var t=this;arguments.length===0&&(n=!0);t._focusReleased&&(t._focusReleased=!1,t._setFocusCore(n))},rt.prototype._switchFocusForClipboard=function(n){var t=this;t._focusElem&&(t._focusElem.value=n,t._focusElem.focus(),t._focusElem.select(),t._clipboardFloatingObjectData=i)},rt.prototype._switchBackFocusAfterClipboard=function(){var n=this;n._focusElem&&(n._focusElem.value=" ");this._setFocusCore(!0,!1)},rt.prototype._setClipboardFloatingObjectData=function(n){this._clipboardFloatingObjectData=n},rt.prototype._getClipboardFloatingObjectData=function(){return this._clipboardFloatingObjectData},rt.prototype._getClipboardData=function(){var n=this._focusElem?this._focusElem.value:"";return this._formatClipboardData(n)},rt.prototype._formatClipboardData=function(n){var t=[],f,i,r,u;if(n){for(f='"',i=!1,r=0;r<n.length;r++)u=n[r],u===f?(i=!i,t.push(f)):i||u!=="\n"?t.push(u):t.push("\r\n");return t.join("")}return""},rt.prototype._disposeFocusHolders=function(){var n=this,r;n._clearTouchSetFocusTimeout();r=n._cellTypeFocusHolder;r&&(t.GC$(r).remove(),n._cellTypeFocusHolder=f);r=n._originalFocusHolder;r&&(t.GC$(r).remove(),n._focusElem=f,n._originalFocusHolder=i,n._readonlyFocusElem=i)},rt.prototype.bind=function(n,i,r){t.GC$(this._getElem()).bind(n,i,r)},rt.prototype.unbind=function(n,i){t.GC$(this._getElem()).unbind(n,i)},rt.prototype.trigger=function(n,i){this._eventSuspended===0&&t.GC$(this._getElem()).trigger(n,i)},rt.prototype._showTooltip=function(n,i,r,f){var c=this._sheet,o=c.parent,e;o&&!o._tooltip&&(e=u.createElement("div"),t.GC$(e).addClass("spread-toolTip ui-state-default ui-widget-content btn-default"),t.GC$(e).css(s,h).css(ut,"0px 3px 0px 3px").css(d,"normal normal normal 11pt calibri").css(ft,"1px 2px 5px rgba(0,0,0,0.4)").width(w).height(w).appendTo(u.body),o._tooltip=e);this._refreshTooltip(n,i,r,f)},rt.prototype._refreshTooltip=function(n,u,e,o){var y=this._sheet,p=y.parent,v,s,h,a;p&&(v=p._tooltip,v&&(s=t.GC$(v),n===f||n===i||n===""?s.hide():(s.html(n),s.show()),h=this._getCanvasOffset(),o&&(e-=h.top,u-=h.left),a=y.getBounds(),e=r(e,a.y+a.height-s.outerHeight()),u=r(u,a.x+a.width-s.outerWidth()),e!==i&&e!==f&&s.css(c,e+h.top),u!==i&&u!==f&&s.css(l,u+h.left)))},rt.prototype._removeTooltip=function(){var r=this._sheet,n=r.parent;n&&n._tooltip&&(t.GC$(n._tooltip).remove(),n._tooltip=i)},rt}();t._SheetEventHandler=yt;pt=function(){function n(){var n=this;n.top=!1;n.bottom=!1;n.left=!1;n.right=!1;n.distanceX=0;n.distanceY=0;n.nearMouseX=0;n.nearMouseY=0}return n}()})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){var o,r,h,c,k,p;t.feature("core.sheet_border",["core.common"]);var s=undefined,i=null,w=Math.sqrt,l=Math.pow,b=Math.min,f={first:1,second:2},e=function(){function n(){}return n.prototype.adjust=function(n){var t=this;n.orientation===0?(n.offsetEnd&&(t._x2+=n.offsetEnd),n.offsetStart&&(t._x1+=n.offsetStart)):(n.offsetEnd&&(t._y2+=n.offsetEnd),n.offsetStart&&(t._y1+=n.offsetStart))},n.prototype.paint=function(n){var t=this._color||"#9eb6ce",i=this._lineWidth,r=n.lineWidth,u=n.strokeStyle;n.beginPath();(r!==i||u!==t)&&(r!==i&&(n.lineWidth=i),u!==t&&(n.strokeStyle=t));this.paintLine(n);n.stroke()},n.prototype.paintLine=function(n){var t=this;n.moveTo(t._x1,t._y1);n.lineTo(t._x2,t._y2)},n.Create=function(n,t,u,f,e,l){(l===s||l===i)&&(l=1);switch(l){case 1:return new o(n,t,u,f,e,1);case 2:return new o(n,t,u,f,e,2);case 5:return new o(n,t,u,f,e,3);case 3:return new r(n,t,u,f,e,1,[3,1]);case 9:return new r(n,t,u,f,e,1,[8,2,2,2]);case 4:return new r(n,t,u,f,e,1,[2,2]);case 11:return new r(n,t,u,f,e,1,[9,3,3,3,3,3]);case 13:return new h(n,t,u,f,e,n!==u,[11,1,5,1],[10,2,4,2]);case 10:return new r(n,t,u,f,e,2,[9,3,3,3]);case 12:return new r(n,t,u,f,e,2,[9,3,3,3,3,3]);case 8:return new r(n,t,u,f,e,2,[9,3]);case 7:return new r(n,t,u,f,e,1,[1]);case 6:return new c(n,t,u,f,e,n!==u)}return i},n}();t.Line=e;o=function(n){function t(t,i,r,u,f,e){var s,o;n.call(this);s=e%2;s||(t!==r?(i-=.5,u-=.5):(t-=.5,r-=.5));o=this;o._x1=t;o._y1=i;o._x2=r;o._y2=u;o._color=f;o._lineWidth=e}return __extends(t,n),t}(e);t.SolidLine=o;r=function(n){function t(t,i,r,u,f,e,o){var h,s;n.call(this);h=e%2;h||(t!==r?(i-=.5,u-=.5):(t-=.5,r-=.5));s=this;s._x1=t;s._y1=i;s._x2=r;s._y2=u;s._color=f;s._lineWidth=e;s._pattern=o}return __extends(t,n),t.prototype.paintLine=function(n){var i=this;t.render(n,i._x1,i._y1,i._x2,i._y2,i._pattern)},t.render=function(n,t,i,r,u,f){var e=w(l(r-t,2)+l(u-i,2)),c={x:(r-t)/e,y:(u-i)/e},s=0,a=0,o,h;for(f=f&&f.length?f:[4,4];s<e;)o=b(f[a++%f.length],e-s),h=a%2,s+=o,h&&n.moveTo(t,i),t+=o*c.x,i+=o*c.y,h&&n.lineTo(t,i)},t}(e);t.DashedLine=r;h=function(n){function t(t,i,r,u,f,e,o,s){n.call(this);e?(t-=1,r-=1):(i-=1,u-=1);var h=this;h._x1=t;h._y1=i;h._x2=r;h._y2=u;h._color=f;h._horizental=e;h._lineWidth=1;h._pattern1=o;h._pattern2=s}return __extends(t,n),t.prototype.paintLine=function(n){var t=this,i=t._horizental?0:1,u=t._horizental?1:0;r.render(n,t._x1-i,t._y1-u,t._x2-i,t._y2-u,t._pattern1);r.render(n,t._x1,t._y1,t._x2,t._y2,t._pattern2)},t}(e);t.SlantedLine=h;c=function(n){function t(t,i,r,u,f,e){n.call(this);var h=e?0:1,c=e?1:0,s=this;s._line1=new o(t-h,i-c,r-h,u-c,f,1);s._line2=new o(t+h,i+c,r+h,u+c,f,1);s._color=f;s._horizental=e;s._lineWidth=1}return __extends(t,n),t.prototype.paintLine=function(n){this._line1.paintLine(n);this._line2.paintLine(n)},t.prototype.adjust=function(n){var t=this;n.lineSide?n.lineSide===f.first?t._line1.adjust(n):n.lineSide===f.second&&t._line2.adjust(n):(t._line1.adjust(n),t._line2.adjust(n))},t}(e);t.DoubleLine=c,function(n){n[n.previous=-1]="previous";n[n.next=1]="next"}(t._LineType||(t._LineType={}));k=t._LineType,function(n){n[n.horizontal=0]="horizontal";n[n.vertical=1]="vertical"}(t._LineOrientation||(t._LineOrientation={}));var g=t._LineOrientation,u=function(){function n(){}return n.compareColor=function(n,t){return 0},n.compareLineStyle=function(t,i){if(t){if(!i)return 1}else return i?-1:0;var r=n._styleWeightCache;return r[t.style]-r[i.style]},n.getDrawingThickness=function(n){if(n){if(n.isGridLine)return 1;if(n.style)return t.LineBorder.prototype.width(n.style)}return 0},n.isDoubleLine=function(n){return n&&n.style===6},n.isSlantedLine=function(n){return n&&n.style===13},n.getMaxLine=function(t,i){if(t){if(!i)return t}else return i;return n.compareLineStyle(t.style,i.style)>=0?t:i},n.adjustLine=function(n,t){n&&n.line&&n.line.adjust(t)},n.compareLine=function(t,i){if(t===i)return 0;if(!t)return-1;if(!i)return 1;if(t.isGridLine)return i.isGridLine?0:-1;else if(i.isGridLine)return 1;return n.compareLineStyle(t.style,i.style)},n.isDoubleLineItem=function(n){return n&&n.style&&n.style.style===6},n.isAllowExtend=function(n,t,i,r){if(n.style&&n.style.style===6)return!0;var u=0;return u+=t&&t.style&&t.style.style===6?1:0,u+=i&&i.style&&i.style.style===6?1:0,u+=r&&r.style&&r.style.style===6?1:0,u<2},n.layout4CrossRoad=function(n,t,i,r,u,e){var o={orientation:e?1:0,offsetStart:0,offsetEnd:0},s=this.compareLine(n,i),h=this.compareLine(n,r);s>=0&&h>=0?s===0&&h===0?u!==-1&&u===1&&(o.offsetEnd-=u):u===-1?o.offsetStart-=u:u===1&&(o.offsetEnd-=2*u):h>=0?(o.lineSide=f.second,o.offsetStart+=u):s>=0&&(o.lineSide=f.first,o.offsetStart+=u);this.adjustLine(n,o)},n.layout4TurnRoad=function(t,i,r,u,e,o,s,h,c){var a={orientation:h?1:0,lineSide:c?f.second:f.first,offsetStart:0,offsetEnd:0},l={orientation:h?1:0,lineSide:c?f.first:f.second,offsetStart:0,offsetEnd:0},k=o===1?u:e,v=s===1?r:i,it=this.isDoubleLineItem(v),d,g,nt,tt,w;it?(d=this.compareLine(t,k),d===0?(g=this.compareLine(t,v),g===0?s===1&&(l.offsetEnd-=s):g>0&&(s===-1?l.offsetStart-=2*s:s===1&&(l.offsetEnd-=2*s))):d>0?(nt=this.compareLine(t,v),nt===0?s===1&&(l.offsetEnd-=s):nt>0&&(s===-1?l.offsetStart-=2*s:s===1&&(l.offsetEnd-=2*s))):(tt=this.compareLine(t,v),tt===0?s===-1?a.offsetStart+=2*s:s===1&&(a.offsetEnd+=2*s):tt>0&&(s===-1?a.offsetStart-=3*s:s===1&&(a.offsetEnd-=3*s)))):this.compareLine(t,k)>=0?s===-1?l.offsetStart-=2*s:s===1&&(l.offsetEnd-=2*s):s===-1?a.offsetStart+=2*s:s===1&&(a.offsetEnd+=2*s);var rt=o===1?2:1,p=rt===1?u:e,b=!1,y=0;!b&&this.isDoubleLineItem(p)&&this.compareLine(p,t)>0&&(b=!0,w=n.getDrawingThickness(p),this.compareLine(p,k)>0?w>0&&(y=s===1&&this.isDoubleLineItem(r)?w>=2?2:1:s===-1&&this.isDoubleLineItem(i)?w>=3?2:1:w===3?3:2):y=w===3?3:2);b||this.isDoubleLineItem(v)||(!v||v.isGridLine)&&(!p||p.isGridLine)||(b=!0,y=s===-1?2:1);b&&(s===-1?(a.offsetStart+=s*y,l.offsetStart+=s*y):s===1&&(a.offsetEnd+=s*y,l.offsetEnd+=s*y));(a.offsetStart||a.offsetEnd)&&this.adjustLine(t,a);(l.offsetStart||l.offsetEnd)&&this.adjustLine(t,l)},n.layout4TRoad=function(n,t,i,r,u,f){if(this.compareLine(n,i)>=0&&this.compareLine(n,r)>=0){var e={orientation:f?1:0,offsetStart:0,offsetEnd:0};u===-1?(e.offsetStart-=2*u,this.isDoubleLineItem(n)&&this.compareLine(t,n)>0&&(e.offsetStart-=1)):u===1&&(e.offsetEnd-=2*u,this.isDoubleLineItem(n)&&this.compareLine(t,n)>0&&(e.offsetEnd+=1));this.adjustLine(n,e)}},n.layout4Connected=function(t,i,r,u,f,e){var s,h,o;this.isDoubleLineItem(t)&&(s=this.getMaxLine(r,u),s&&!s.isGridLine&&(h=n.getDrawingThickness(s),h>0&&(o={orientation:e?1:0,offsetStart:0,offsetEnd:0},f===-1?o.offsetStart+=h*f:o.offsetEnd+=h*f,(o.offsetStart||o.offsetEnd)&&this.adjustLine(t,o))))},n.calcLayoutHorizontal=function(t,i,r,u,f,e,o){var h,c,s=n,l,a;(i||r||u)&&(l=s.getMaxLine(r,u),s.isAllowExtend(t,i,r,u)?(c=s.compareLine(l,t))>0?(h=s.getDrawingThickness(l),s.isDoubleLineItem(t)&&(s.isDoubleLineItem(r)||s.isDoubleLineItem(u)||s.isDoubleLineItem(i))||h===3&&s.adjustLine(t,{orientation:0,offsetStart:1})):l&&c<0?(c=s.compareLine(t,i))>0?(h=s.getDrawingThickness(l),h===3||h===2?s.adjustLine(t,{orientation:0,offsetStart:-2}):h===1&&s.adjustLine(t,{orientation:0,offsetStart:-1})):c!==0&&s.compareLine(i,l)>0&&(h=s.getDrawingThickness(l),h===3&&s.adjustLine(t,{orientation:0,offsetStart:1})):c===0&&(!i||s.compareLine(t,i)>0)&&(h=s.getDrawingThickness(l),h===3||h===2?s.adjustLine(t,{orientation:0,offsetStart:-2}):h===1&&s.adjustLine(t,{orientation:0,offsetStart:-1})):s.adjustLine(t,{orientation:0,offsetStart:1}));(f||e||o)&&(a=s.getMaxLine(e,o),s.isAllowExtend(t,f,e,o)?(c=s.compareLine(a,t))>0?(h=s.getDrawingThickness(a),s.isDoubleLineItem(t)&&(s.isDoubleLineItem(e)||s.isDoubleLineItem(o)||s.isDoubleLineItem(f))||(h===3?s.adjustLine(t,{orientation:0,offsetEnd:-2}):(h===2||h===1)&&s.adjustLine(t,{orientation:0,offsetEnd:-1}))):c<0?(c=s.compareLine(t,f))>0?(h=s.getDrawingThickness(a),h===3&&s.adjustLine(t,{orientation:0,offsetEnd:1})):c!==0&&s.adjustLine(t,{orientation:0,offsetEnd:-1}):c===0&&((c=s.compareLine(t,f))>0?(h=s.getDrawingThickness(a),h===3&&s.adjustLine(t,{orientation:0,offsetEnd:1})):c!==0&&s.adjustLine(t,{orientation:0,offsetEnd:-1})):s.adjustLine(t,{orientation:0,offsetEnd:-2}))},n.calcLayoutVertical=function(t,r,u,f,e,o,s){var c,l,h=n,a,v;(r||u||f)&&(a=h.getMaxLine(u,f),h.isAllowExtend(t,r,u,f)?(l=h.compareLine(a,t))>0?(c=h.getDrawingThickness(a),h.isDoubleLineItem(t)&&(h.isDoubleLineItem(u)||h.isDoubleLineItem(f)||h.isDoubleLineItem(r))||c===3&&h.adjustLine(t,{orientation:1,offsetStart:1})):l<0?(l=h.compareLine(t,r))>0?(c=h.getDrawingThickness(a),c===3||c===2?h.adjustLine(t,{orientation:1,offsetStart:-2}):c===1&&h.adjustLine(t,{orientation:1,offsetStart:-1})):l!==0&&h.compareLine(r,a)>0&&(c=h.getDrawingThickness(a),c===3&&h.adjustLine(t,{orientation:1,offsetStart:1})):l===0&&h.compareLine(t,r)>0&&(c=h.getDrawingThickness(a),c===3||c===2?h.adjustLine(t,{orientation:1,offsetStart:-2}):c===1&&h.adjustLine(t,{orientation:1,offsetStart:-1})):h.adjustLine(t,{orientation:1,offsetStart:1}));(e||o||s)&&(v=h.getMaxLine(o,s),h.isAllowExtend(t,e,o,s)?(l=h.compareLine(t,v))<0?(c=h.getDrawingThickness(v),h.isDoubleLineItem(t)&&(h.isDoubleLineItem(o)||h.isDoubleLineItem(s)||h.isDoubleLineItem(e))||(c===3||c===2?h.adjustLine(t,{orientation:1,offsetEnd:-2}):c===1&&h.adjustLine(t,{orientation:1,offsetEnd:-1}))):v!==i&&l>0?(l=h.compareLine(t,e))>0?(c=h.getDrawingThickness(v),c===3&&h.adjustLine(t,{orientation:1,offsetEnd:1})):l!==0&&h.adjustLine(t,{orientation:1,offsetEnd:-1}):l===0&&((l=h.compareLine(t,e))>0?(c=h.getDrawingThickness(v),c===3&&h.adjustLine(t,{orientation:1,offsetEnd:1})):l!==0&&h.adjustLine(t,{orientation:1,offsetEnd:-1})):h.adjustLine(t,{orientation:1,offsetEnd:-2}))},n.calcDoubleLayout=function(t,i,r,u,f,e,o,s){var h=n,a;s?this.calcLayoutVertical(t,i,r,u,f,e,o):this.calcLayoutHorizontal(t,i,r,u,f,e,o);var c=h.isDoubleLineItem(r),l=h.isDoubleLineItem(u),v=h.isDoubleLineItem(i);c&&l&&v?h.layout4CrossRoad(t,i,r,u,-1,s):c&&!l?h.layout4TurnRoad(t,i,f,r,u,1,-1,s,!0):!c&&l?h.layout4TurnRoad(t,i,f,r,u,2,-1,s,!1):c&&l&&!v?h.layout4TRoad(t,i,r,u,-1,s):v&&h.layout4Connected(t,i,r,u,-1,s);c=h.isDoubleLineItem(e);l=h.isDoubleLineItem(o);a=h.isDoubleLineItem(f);c&&l&&a?h.layout4CrossRoad(t,f,e,o,1,s):c&&!l?h.layout4TurnRoad(t,i,f,e,o,1,1,s,!0):!c&&l?h.layout4TurnRoad(t,i,f,e,o,2,1,s,!1):c&&l&&!a?h.layout4TRoad(t,f,e,o,1,s):a&&h.layout4Connected(t,f,e,o,1,s)},n._styleWeightCache=[0,101,199,100,100,300,90,100,198,100,198,100,198,198],n}(),a={layoutHorizontal:function(n,t,i,r,f,e,o){u.calcLayoutHorizontal(n,t,i,r,f,e,o)},layoutVertical:function(n,t,i,r,f,e,o){u.calcLayoutVertical(n,t,i,r,f,e,o)}},v={layoutHorizontal:function(n,t,i,r,f,e,o){u.calcDoubleLayout(n,t,i,r,f,e,o,!1)},layoutVertical:function(n,t,i,r,f,e,o){u.calcDoubleLayout(n,t,i,r,f,e,o,!0)}},y={layoutHorizontal:function(n,t,i,r,u,f,e){},layoutVertical:function(n,t,i,r,u,f,e){}},d=function(){function n(n,t,i,r,u){this._row=n;this._column=t;this._horPoints=[];this._verPoints=[];this._lines={}}return n.prototype._addLine=function(n,t,i,r,u){var l,f,e,c,o;if(r!==0&&u!==0)throw"invalid argument.";if(l=this._lines[n],l||(l=this._lines[n]={hori:[],vert:[]}),r===0)var a=t,s=i,h=i+u,v=l.hori;else a=i,s=t,h=t+r,v=l.vert;if(f=v[a],f)for(e=f.length-1;e>=0;e--)if(c=f[e],s>c.e){f.splice(e+1,0,{s:s,e:h});return}else if(h<c.s){if(e===0){f.unshift({s:s,e:h});return}continue}else if(s>=c.s){f.splice(e,1,{s:c.s,e:Math.max(c.e,h)});return}else for(o=e-1;o>=0;o++)if(f[o].e<s){f.splice(o+1,e-o,{s:s,e:Math.max(c.e,h)});return}else if(f[o].s>s){if(o===0){f.splice(0,e,{s:s,e:Math.max(c.e,h)});return}continue}else{f.splice(o,e-o+1,{s:f[o].s,e:Math.max(c.e,h)});return}else f=v[a]=[{s:s,e:h}]},n.prototype._getStyle=function(t){return t.style===0?null:n._lineStyleCache[t.style]+t.color},n.prototype.addCellLines=function(n,t,i,r,u,f,e,o){var v,y,p,w;if(e){var s=this,h=1,c=1,l=s._horPoints,a=s._verPoints;if(o){if(n!==o.row||t!==o.col)return;n=o.row;t=o.col;h=o.rowCount;c=o.colCount;l[n]=o.y;l[n+h]=o.y+o.height;a[t]=o.x;a[t+c]=o.x+o.width}else l[n]=r,l[n+1]=r+f,a[t]=i,a[t+1]=i+u;v=e.borderLeft;v&&v.style&&s._addLine(s._getStyle(v),n,t,h,0);y=e.borderRight;y&&y.style&&s._addLine(s._getStyle(y),n,t+c,h,0);p=e.borderTop;p&&p.style&&s._addLine(s._getStyle(p),n,t,0,c);w=e.borderBottom;w&&w.style&&s._addLine(s._getStyle(w),n+h,t,0,c)}},n.prototype.addCellOverlfowLayout=function(n,t){for(var i=t.startColumn;i<=t.endColumn;i++)this._removeAllVertLine(n,i)},n.prototype._removeAllVertLine=function(n,t){for(var i in this._lines)this._removeLine(this._lines[i].vert,t,n,1)},n.prototype._removeLine=function(n,t,i,r){var s=i+r,e=n[t],f,u,o,h;if(e)for(f=e.length-1;f>=0;f--)u=e[f],u.e>i&&u.s<s&&(o=[],u.s<i&&o.push({s:u.s,e:i}),u.e>=s&&o.push({s:s,e:u.e}),h=[f,1].concat(o),Array.prototype.splice.apply(e,h))},n.prototype.paint=function(n,t){for(var e=Object.getOwnPropertyNames(this._lines),r,s,u,h,f,e=e.sort(),i=0;i<e.length;i++){var o=this._lines[e[i]],c=e[i].split("-"),l=parseInt(c[0]);for(n.beginPath(),n.strokeStyle=c[1],n.lineWidth=l,i=0;i<o.hori.length;i++)if(r=o.hori[i],r){if(s=this._horPoints[i],typeof s!="number")continue;for(u=0;u<r.length;u++)f=r[u],n.moveTo(this._verPoints[f.s],s-.5),n.lineTo(this._verPoints[f.e],s-.5)}for(i=0;i<o.vert.length;i++)if(r=o.vert[i],r){if(h=this._verPoints[i],typeof h!="number")continue;for(u=0;u<r.length;u++)f=r[u],n.moveTo(h-.5,this._horPoints[f.s]),n.lineTo(h-.5,this._horPoints[f.e])}n.stroke()}},n._lineStyleCache=["","1-","2-","1-","1-","3-","3-","1-","2-","1-","2-","1-","2-","2-"],n}();t._FastBorders=d;p=function(){function t(n,t,i,r){this._isInitialized=!1;this._isMerged=!1;var u=this;u._sheet=n;u._sheetArea=r;u._rowViewportIndex=t;u._colViewportIndex=i}return t.prototype._initialize=function(){var n=this,t,l,o,f,i,a,s,e;n._spanCells=[];n._rowIndecies=[];n._colIndecies=[];n._overflowedCells=[];n._adjustingRanges=[];n._hGridLine={};n._vGridLine={};n._hBorders={};n._vBorders={};var h=n._sheet,c=n._sheetArea,v=n._colViewportIndex,y=n._rowViewportIndex,r=h._getRowLayout(y,c),u=h._getColumnLayout(v,c);if(r&&r.length>0&&u&&u.length>0){for(t=n._rowIndecies,l=r.length,f=0;f<l;f++)o=r[f],o.height>0&&t.push(o.row);for(t.push(t[t.length-1]+1),i=n._colIndecies,a=u.length,e=0;e<a;e++)s=u[e],s.width>0&&i.push(s.col);i.push(i[i.length-1]+1)}n._isInitialized=!0},t.prototype.addCellOverlfowLayout=function(n,t){if(t){var i={row:n,startCol:t.startColumn,endCol:t.endColumn};this._overflowedCells.push(i)}},t.prototype.addCellLines=function(n,t,i,r,u,f,e,o){var s=this,h,c,l,a,v;s._isInitialized||s._initialize();o?s._spanCells.push(o):(e&&(h=e.borderLeft,c=e.borderTop,l=e.borderRight,a=e.borderBottom,v=e.backColor),!v||h||l||c||a||s._adjustingRanges.push({r:n,c:t,rc:1,cc:1}),s._addCellLineImp(n,t,i,r,u,f,h,c,l,a,v))},t.prototype._addCellLineImp=function(n,t,i,r,u,f,e,o,h,c,l,a,v){var y=this,k=!1,d=!1,g=!1,nt=!1,p,w,b;o&&(k=y._addCellLineSide(n,t,i,r-.5,i+u,r-.5,o,y._hBorders));e&&(d=y._addCellLineSide(n,t,i-.5,r,i-.5,r+f,e,y._vBorders));c&&(g=y._addCellLineSide(n+1,t,i,r+f-.5,i+u,r+f-.5,c,y._hBorders));h&&(nt=y._addCellLineSide(n,t+1,i+u-.5,r,i+u-.5,r+f,h,y._vBorders));p=y._sheet;l&&p._cachePool.getZoomRowHeight(n)!==0&&p._cachePool.getZoomColWidth(t)!==0||(w=!g&&!a,b=!nt&&!v,(w||b)&&y._addGridLine(n,t,i,r,u,f,w,b));(k||l!==s)&&y._removeLineItem(n-1,t,y._hGridLine);(d||l!==s)&&y._removeLineItem(n,t-1,y._vGridLine);!l||e||h||o||c||(y._adjustLineItem(n-1,t-1,y._vGridLine,!1),y._adjustLineItem(n-1,t-1,y._hGridLine,!0))},t.prototype._addCellLineSide=function(n,t,r,f,o,s,h,c){if(h){var l=this._queryLineItem(n,t,c,!0);return l?l.style.style!==6&&(h.style===6||u.compareLineStyle(h,l.style)>0)&&(l.line=e.Create(r,f,o,s,h.color,h.style),l.style=h):(l=this._queryLineItem(n,t,c),l.line=e.Create(r,f,o,s,h.color,h.style),l.style=h),l.line!==i}return!1},t.prototype._addGridLine=function(t,i,r,u,f,e,o,s){var h=this,w=n.Sheets,l=h._sheetArea===3,c=h._sheet.gridline,p=w.Line,a,v,y;l&&c&&(a=c.color,o&&(c.showHorizontalGridline||!l)&&(v=h._queryLineItem(t,i,h._hGridLine),v.isGridLine=!0,v.line=p.Create(r,u+e-.5,r+f,u+e-.5,a)),s&&(c.showVerticalGridline||!l)&&(y=h._queryLineItem(t,i,h._vGridLine),y.isGridLine=!0,y.line=p.Create(r+f-.5,u,r+f-.5,u+e,a)))},t.prototype._adjustLineItem=function(n,t,i,r){var f=this._queryLineItem(n,t,i,!0),u;f&&(u=f,u&&u.line&&u.line.adjust({orientation:r?0:1,offsetEnd:-1}))},t.prototype._removeLineItem=function(n,t,i){var r,u;n>=0&&t>=0&&(r=i[n],r&&(u=r[t],u&&delete r[t]))},t.prototype._queryLineItem=function(n,t,i,r){var u,f;if(n===-1||t===-1)return null;if(u=i[n],!u){if(r)return null;i[n]=u={}}if(f=u[t],!f){if(r)return null;u[t]=f={}}return f},t.prototype._processOverflowCells=function(){for(var t,n=this,e=n._overflowedCells,h=e.length,o=n._vBorders,s=n._vGridLine,u=0;u<h;u++){var f=e[u],i=f.row,c=f.startCol,l=f.endCol,r;for(t=c;t<l;t++)r=n._queryLineItem(i,t+1,o,!0),r?n._removeLineItem(i,t+1,o):(r=n._queryLineItem(i,t,s,!0),r&&n._removeLineItem(i,t,s))}},t.prototype._processSpans=function(){var t=this._spanCells,i=t.length,r,n;if(i>0)for(n=0;n<i;n++)r=t[n],this._processSpanCell(r)},t.prototype._processSpanCell=function(n){var t=this,d=n.row,g=n.col,it=n.x,ut=n.y,a,v,y,p,rt=t._sheet.getActualStyle(d,g,t._sheetArea),l=rt?rt.backColor:i,o,r,u,f,e,w,nt,b,tt,s,h=it,c=ut,k;if(n.rowCount===1)for(r=d,f=t._sheet._getZoomRowHeight(r,t._sheetArea),o=0;o<n.colCount;o++)w=o===0,b=o===n.colCount-1,u=g+o,e=t._sheet._getZoomColumnWidth(u,t._sheetArea),s=t._sheet.getActualStyle(r,u,t._sheetArea),s?(a=s.borderLeft,v=s.borderTop,y=s.borderRight,p=s.borderBottom):a=v=y=p=i,w?t._addCellLineImp(r,u,h,c,e,f,a,v,i,p,l,!1,!0):b?t._addCellLineImp(r,u,h,c,e,f,i,v,y,p,l):t._addCellLineImp(r,u,h,c,e,f,i,v,i,p,l,!1,!0),h+=e;else if(n.colCount===1)for(u=g,e=t._sheet._getZoomColumnWidth(u,t._sheetArea),o=0;o<n.rowCount;o++)nt=o===0,tt=o===n.rowCount-1,r=d+o,f=t._sheet._getZoomRowHeight(r,t._sheetArea),s=t._sheet.getActualStyle(r,u,t._sheetArea),s?(a=s.borderLeft,v=s.borderTop,y=s.borderRight,p=s.borderBottom):a=v=y=p=i,nt?t._addCellLineImp(r,u,h,c,e,f,a,v,y,i,l,!0,!1):tt?t._addCellLineImp(r,u,h,c,e,f,a,i,y,p,l):t._addCellLineImp(r,u,h,c,e,f,a,i,y,i,l,!0,!1),c+=f;else for(o=0;o<n.rowCount;o++){for(r=d+o,nt=o===0,tt=o===n.rowCount-1,f=t._sheet._getZoomRowHeight(r,t._sheetArea),k=0;k<n.colCount;k++)u=g+k,w=k===0,b=k===n.colCount-1,e=t._sheet._getZoomColumnWidth(u,t._sheetArea),s=t._sheet.getActualStyle(r,u,t._sheetArea),s?(a=s.borderLeft,v=s.borderTop,y=s.borderRight,p=s.borderBottom):a=v=y=p=i,nt?w?t._addCellLineImp(r,u,h,c,e,f,a,v,i,i,l,!0,!0):b?t._addCellLineImp(r,u,h,c,e,f,i,v,y,i,l,!0,!1):t._addCellLineImp(r,u,h,c,e,f,i,v,i,i,l,!0,!0):tt?w?t._addCellLineImp(r,u,h,c,e,f,a,i,i,p,l,!1,!0):b?t._addCellLineImp(r,u,h,c,e,f,i,i,y,p,l):t._addCellLineImp(r,u,h,c,e,f,i,i,i,p,l,!1,!0):w?t._addCellLineImp(r,u,h,c,e,f,a,i,i,i,l,!0,!0):b&&t._addCellLineImp(r,u,h,c,e,f,i,i,y,i,l,!0,!1),h+=e;h=it;c+=f}!l||a||y||v||p||t._adjustingRanges.push({r:d,c:g,rc:n.rowCount,cc:n.colCount})},t.prototype._adjust=function(){var n=this,t=!1,i=!1,r,u;for(r in n._vBorders){t=!0;break}for(u in n._hBorders){i=!0;break}(t||i)&&n._adjustBorders();n._adjustingRanges.length>0&&n._adjustGridlines()},t.prototype._adjustGridlines=function(){for(var f,e,o,n,i=this,s=i._adjustingRanges,a=s.length,h=0;h<a;h++){var t=s[h],r=t.r,u=t.c,c=r,v=r-1,y=u-1,l=u;for(t.rc>1&&(c+=t.rc-1),t.cc>1&&(l+=t.cc-1),f=!1,e=!1,o=0;o<a;o++){if(n=s[o],n.c===l+1&&n.r===r&&(e=!0),n.r===c+1&&n.c===u&&(f=!0),f&&e)break;if(n.r>r+1&&n.c>u+1)break}f||i._adjustLineItem(c,y,i._hGridLine,!0);e||i._adjustLineItem(v,l,i._vGridLine,!1)}},t.prototype._adjustBorders=function(){for(var n=this,w=n._rowIndecies,b=n._colIndecies,ot=w.length,st=b.length,r,f,e,ft={},et={},o,s,k,d,g,nt,tt,it,rt,ut,l,p,h,c,t=0;t<ot;t++)for(f=w[t],r=0;r<st;r++)(e=b[r],l=0,p=0,h=n._queryLineItem(f,e,n._vBorders,!0),h?l++:h=n._queryLineItem(f,e-1,n._vGridLine,!0),c=n._queryLineItem(f,e,n._hBorders,!0),c?p++:c=n._queryLineItem(f-1,e,n._hGridLine,!0),h||c)&&(o=t===0?i:n._getLineItem(w[t-1],e,!0,et),o&&o.line&&!o.isGridLine&&(l++,p++),s=r===0?i:n._getLineItem(f,b[r-1],!1,ft),s&&s.line&&!s.isGridLine&&(l++,p++),h&&(k=n._getLineItem(f,e,!1,ft),k&&k.line&&!k.isGridLine&&l++,t!==ot-1&&(g=n._getLineItem(w[t+1],e,!0,et),g&&g.line&&!g.isGridLine&&l++),r!==0&&t!==ot-1&&(nt=n._getLineItem(w[t+1],b[r-1],!1,ft),nt&&nt.line&&!nt.isGridLine&&l++),t!==ot-1&&(tt=n._getLineItem(w[t+1],e,!1,ft),tt&&tt.line&&!tt.isGridLine&&l++),l>0&&(u.isDoubleLine(h.style)?v.layoutVertical(h,o,s,k,g,nt,tt):u.isSlantedLine(h.style)?y.layoutVertical(h,o,s,k,g,nt,tt):a.layoutVertical(h,o,s,k,g,nt,tt))),c&&(d=n._getLineItem(f,e,!0,et),d&&d.line&&!d.isGridLine&&p++,r!==st-1&&(it=n._getLineItem(f,b[r+1],!1,ft),it&&it.line&&!it.isGridLine&&p++),t!==0&&r!=st-1&&(rt=n._getLineItem(w[t-1],b[r+1],!0,et),rt&&rt.line&&!rt.isGridLine&&p++),r!=st-1&&(ut=n._getLineItem(f,b[r+1],!0,et),ut&&ut.line&&!ut.isGridLine&&p++),p>0&&(u.isDoubleLine(c.style)?v.layoutHorizontal(c,s,o,d,it,rt,ut):u.isSlantedLine(c.style)?y.layoutHorizontal(c,s,o,d,it,rt,ut):a.layoutHorizontal(c,s,o,d,it,rt,ut))))},t.prototype._prevCol=function(n){return n<0?-1:this._colIndecies[n-1]},t.prototype._nextCol=function(n){return this._colIndecies[n+1]},t.prototype._prevRow=function(n){return n<0?-1:this._rowIndecies[n-1]},t.prototype._nextRow=function(n){return this._rowIndecies[n+1]},t.prototype._getLineItem=function(n,t,i,r){var u=r[n],f;return u||(u=r[n]={}),f=u[t],f===s&&(f=u[t]=this._getLineItemImp(n,t,i)),f},t.prototype._getLineItemImp=function(n,t,r){if(n===s||n<0||t===s||t<0)return i;var u=this,e=r?u._vBorders:u._hBorders,f=u._queryLineItem(n,t,e,!0);if(f)return f;if(e=r?u._vGridLine:u._hGridLine,r){if(--t<0)return i}else if(--n<0)return i;return(f=u._queryLineItem(n,t,e,!0),f)?f:i},t.prototype.paint=function(n,t){var i=this;i._isInitialized&&(i._isMerged||(i._processSpans(),i._processOverflowCells(),i._adjust(),i._isMerged=!0),n.save(),n.beginPath(),i._paint(n,t),n.closePath(),n.stroke(),n.restore())},t.prototype._paint=function(n,t){this._paintGridLine(n);this._paintBorderLines(n)},t.prototype._paintGridLine=function(n){var t=this;t._paintLines(n,t._hGridLine);t._paintLines(n,t._vGridLine)},t.prototype._paintBorderLines=function(n){var t=this;t._paintLines(n,t._hBorders);t._paintLines(n,t._vBorders)},t.prototype._paintLines=function(n,t){var i,r,u,f,e;if(t)for(f in t)if(i=t[f],i)for(e in i)r=i[e],u=r&&r.line,u&&u.paint(n)},t}();t._GcBorders=p})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){var e,o;n.feature("core.sheet_render",["core.common","core.sheet_border","core.sheet_action","core.sheet_model","core.imageLoader"]);var t=null,u=Math.min,i=Math.max,f=Math.abs,s=Math.PI,r="undefined",h=window.document,c=function(){function o(n){this.ctx=t;this.buffer=t;this.bufferCtx=t;this._rowGroups=t;this._columnGroups=t;this._floatingObjectRenderManager=t;this._defaultFont=t;this._existTouchDragFillIndicator=!1;this._showTouchSelectionIndicator=!0;this._init(n)}return o.prototype._init=function(n){this._sheet=n},o.prototype._getCtx=function(){var i=this,u,r;if(i.ctx=t,u=i._sheet,r=u._getCanvas(),r){if(!r.getContext&&n.util._isSilverlightCanvas()&&!r.getContext)return;r.getContext&&(i.ctx=r.getContext("2d"))}return i.ctx&&(i.ctx.name="userContext"),i.ctx},o.prototype._getBufferCtx=function(){var t=this,r=t._sheet,u=r.getBounds(),f=r._canvas.width,e=r._canvas.height,i=t.buffer;if(!i||i.width!==f||i.height!==e)if(i&&n.DPIHelper.disposeCanvasForSheet(r,i),t.buffer=i=h.createElement("canvas"),i.getContext)t.bufferCtx=i.getContext("2d"),n.DPIHelper.adjustDevicePixel(t.buffer,null,t._sheet,t.bufferCtx),n.DPIHelper.setSize(i,u.width,u.height);else if(i.width=u.width,i.height=u.height,n.util._isSilverlightCanvas())if(i.getContext)t.bufferCtx=i.getContext("2d");else return;return t.bufferCtx&&(t.bufferCtx.beginPath(),t.bufferCtx.font=t._getZoomFont(t._getDefaultFont()),t.bufferCtx.name="bufferContext"),t.bufferCtx},o.prototype._getDefaultFont=function(t){return this._defaultFont||(this._defaultFont=n.DefaultFontSize+" "+this._sheet.currentTheme().bodyFont()),this._defaultFont},o.prototype._resetDefaultFont=function(){this._defaultFont=t},o.prototype._getDefaultBackground=function(){return"white"},o.prototype._getSpreadBackColor=function(){var r=this._sheet,i=r.parent,e=i?i._backColor:this._getDefaultBackground(),u=n._ThemeContext.getColor(r,e),f=i?i._backgroundImage:t;return f&&f!==""&&(u="transparent"),u},o.prototype._getGrayAreaBackColor=function(i){var e=this._sheet,r=e.parent,o=r?r.grayAreaBackColor():"gray",u=n._ThemeContext.getColor(e,o),f;return i?(f=r?r._backgroundImage:t,f&&f!==""&&(u="transparent"),u):u},o.prototype._getZoomFont=function(t){var r=this._sheet,i=r._zoomFactor;return i===1?t:n.StyleHelper._scaleFont(t,i).font},o.prototype.copyDoubleBuffer=function(t,i,r,u,f){var s,c,e,o,v,y,p,w,h,l,a;r<=0||u<=0||(s=this.buffer,c=this._getCtx(),s&&c)&&(f||(f=this._sheet.getBounds()),e=n.DPIHelper.getScaleX(s),o=n.DPIHelper.getScaleY(s),e!==1&&(t*=e,i*=o,r*=e,u*=o,f=new n.Rect(f.x*e,f.y*o,f.width*e,f.height*o)),h=f.getIntersect(t,i,r,u),h)&&(h.round(),t=h.x,i=h.y,r=h.width,u=h.height,l=s.width,l&&t+r>l&&(t=l-r,t<0&&(r+=t,t=0)),a=s.height,a&&i+u>a&&(i=a-u,i<0&&(u+=i,i=0)),n.util.browser.qtMode&&(t>0&&r--,i>0&&u--),e===1?(v=t,y=i,p=r,w=u):(v=t/e,y=i/o,p=r/e,w=u/o),c.scale(1/e,1/o),c.clearRect(t,i,r,u),c.drawImage(s,t,i,r,u,t,i,r,u),c.scale(e,o))},o.prototype.copyDoubleBufferRect=function(n,t){n&&this.copyDoubleBuffer(n.x,n.y,n.width,n.height,t)},o.prototype.copyScreen=function(t,i,r,u,f,e){var v,y;if(!(r<=0)&&!(u<=0))try{var p=this,g=p._sheet,w=p._getCtx(),k=g._getCanvas(),b=p._getBufferCtx(),d=p.buffer,nt=r,tt=u,o=f,s=e,h=nt,c=tt,l=n.DPIHelper.getScaleX(k),a=n.DPIHelper.getScaleY(k);t=Math.floor(t*l);i=Math.floor(i*a);r=Math.ceil(r*l);u=Math.ceil(u*a);o=Math.floor(o*l);s=Math.floor(s*a);h=Math.ceil(h*l);c=Math.ceil(c*a);v=d.width;y=d.height;v&&t+r>v&&(t=v-r,t<0&&(r+=t,t=0));y&&i+u>y&&(i=y-u,i<0&&(u+=i,i=0));v&&o+h>v&&(o=v-h,o<0&&(h+=o,o=0));y&&s+c>y&&(s=y-c,s<0&&(c+=s,s=0));w.scale(1/l,1/a);b.scale(1/l,1/a);w.clearRect(o,s,h,c);w.drawImage(d,t,i,r,u,o,s,h,c);b.clearRect(o,s,h,c);b.drawImage(k,o,s,h,c,o,s,h,c);w.scale(l,a);b.scale(l,a)}catch(it){}},o.prototype.repaintSelection=function(t,r,f,e){var a=this,v,y,h,s,nt,tt,l;f||(f=a._getCtx());var it=!1,c=a._sheet,o=new n.Range(-1,-1,-1,-1),p=c._isNavigateInSelection;if(t&&(o=c._allowCellOverflow?new n.Range(t.row,0,t.rowCount,c.getColumnCount()):new n.Range(t.row,t.col,t.rowCount,t.colCount),!p)){if(o.col>=0){var w=o.col,d=o.col+o.colCount-1,rt=c.getRowCount(1),b=c._getSpanModel(1);for(v=0;v<rt;v++)h=b.find(v,o.col),h&&(w=u(h.col,w)),h=b.find(v,o.col+o.colCount-1),h&&(d=i(h.col+h.colCount-1,d));o.col=w;o.colCount=d-w+1}if(o.row>=0){var k=o.row,g=o.row+o.rowCount-1,ut=c.getColumnCount(2),b=c._getSpanModel(2);for(y=0;y<ut;y++)h=b.find(o.row,y),h&&(k=u(h.row,k)),h=b.find(o.row+o.rowCount-1,y),h&&(g=i(h.row+h.rowCount-1,g));o.row=k;o.rowCount=g-k+1}}if(s=c._getRangeRect2(o),s.width>=0||s.height>=0){if(nt=s.width,tt=s.height,s.x-=9,s.y-=9,s.width+=18,s.height+=30,r&&(s=s.getIntersectRect(r),!s))return;l=c._getSheetLayout();tt>0&&!p&&(c._dirty=!0,a.paint(f,new n.Rect(l.x,i(l.frozenY,s.y),l.rowHeaderWidth,s.height),e));nt>0&&!p&&(c._dirty=!0,a.paint(f,new n.Rect(i(l.frozenX,s.x),l.y,s.width,l.colHeaderHeight),e));o.row!==-1||o.col!==-1||p||(c._dirty=!0,a.paint(f,l.headerCornerRect(),e));nt>0&&tt>0&&a.paint(f,s);it=!0}return it},o.prototype.update=function(t,i,r,u,f){var o=this._sheet,e;o._layoutSuspended>0||(e=this._getCtx(),e&&(f||(o._dirty=!0),this.paint(e,new n.Rect(t,i,r,u))))},o.prototype.repaint=function(n){var i=this._sheet,t;i._layoutSuspended>0||(t=this._getCtx(),t&&(i._dirty=!0,this.paint(t,n)))},o.prototype.paint=function(n,t,i){var r=this._sheet,u=this;!n||r._layoutSuspended>0||(i||this.paintBody(n,t),this.paintAdornment(n,t))},o.prototype.paintBody=function(t,i,r){var f=this,o=f._sheet;if(t&&!(o._layoutSuspended>0)){var h=n.util._useDoubleBuffer(),u=h?f._getBufferCtx():null,s=u?u:t,e=o.getBounds();i||(i=e);i&&i.round();r&&r.round();o._dirty&&(o._dirty=!1,u&&(u.clearRect(i.x,i.y,i.width,i.height),r&&u.clearRect(r.x,r.y,r.width,r.height),u.translate(-e.x,-e.y)),f.paintSheet(s,i),r&&f.paintSheet(s,r),u&&u.translate(e.x,e.y));u&&(f.copyDoubleBufferRect(i),r&&f.copyDoubleBufferRect(r))}},o.prototype.paintAdornment=function(n,t){var f=this,o=f._sheet,h=o._isTouchMode,e,i,s,r,u,c;if(n&&!o._paintSuspended&&!(o._layoutSuspended>0)){if(t&&t.round(),e=o._getSheetLayout(),!o._hoverCell){if(h){for(i=e.headerCornerRect(),f.copyDoubleBufferRect(i),r=0;r<=2;r++)(i=e.rowHeaderRect(r),i&&i.width!==0&&i.height!==0)&&f.copyDoubleBufferRect(i);for(u=0;u<=2;u++)(i=e.colHeaderRect(u),i&&i.width!==0&&i.height!==0)&&f.copyDoubleBufferRect(i)}for(r=0;r<=2;r++)for(u=0;u<=2;u++)(i=e.viewportRect(r,u),i&&i.width!==0&&i.height!==0)&&(s=t,h&&(r!==1||u!==1)&&(f.copyDoubleBufferRect(i),s=i),(!s||i.intersectRect(s))&&f.paintSelection(n,r,u,s));if(f.paintResizeLine(n),c=o._formulaTextBox,c)for(r=0;r<=2;r++)for(u=0;u<=2;u++)(i=e.viewportRect(r,u),i&&i.width!==0&&i.height!==0)&&f.paintFormulaTextBoxRange(n,r,u,t)}h&&(f.paintTouchResizeIndicator(n),f._existTouchDragFillIndicator?f.paintTouchDragFillIndicator(n):f.paintTouchSelectionIndicator(n));this.pri(n,t,e)}},o.prototype.pri=function(n,t,i){this._pri(n,t,i)},o.prototype._pri=function(i,r,u){var w="11pt calibri",b=this,o,p=0,e="",c="",k,v=!0,s=n.SR.ls,y,h,l,a,f;if(u=u||b._sheet._getSheetLayout(),s)if(typeof s=="string")s=s.trim(),s&&(o=[s]);else if(Array.isArray(s)){for(y=!0,o=[],f=0;f<s.length;f++)c=s[f].trim(),o.push(c),y&&c&&(y=!1);y&&(o=t)}for(o||(v=!1,o=["Pwrdb rpCt pedSet ra eso\rNtLcne o itiuin","oee yGaeiySra.hesTilVrin\no iesdfrDsrbto"]),f=0;f<o.length;f++)p=Math.max(p,o[f].length);for(f=0;f<p;f++){for(v&&(c=""),h=0;h<o.length;h++)v?c+=f>=o[h].length?"00":o[h].charAt(f)+o[h].charAt(f+1):f<o[h].length&&(e+=o[h].charAt(f));v&&(k=parseInt(c,16),e+=String.fromCharCode(k),f++)}for(l=[],a=0,f=0;f<e.length;f++)(e[f]==="\r"||e[f]==="\n")&&(l.push(e.substring(a,f)),e[f]==="\r"&&f<e.length-1&&e[f+1]==="\n"&&f++,a=f+1);for(a<e.length&&l.push(e.substring(a,e.length)),f=0;f<l.length;f++){e=l[f];var d=b._sheet._getStringWidthByCanvas(e,w),g=10,nt=20,tt=u.width-d-g,it=u.height-g-nt*(l.length-f-1);(!r||r.intersect(tt,it,d,nt))&&(i.save(),i.fillStyle="rgba(0, 0, 0, 0.5)",i.font=w,r&&(i.rect(r.x,r.y,r.width,r.height),i.clip(),i.beginPath()),i.fillText(e,tt,it),i.restore())}},o.prototype.paintTouchResizeIndicator=function(t){var i=this._sheet,w=i.getRowCount(),b=i.getColumnCount(),v=i._getSheetLayout(),o,u=16,r,e,f,p=i.getSelections(),l,a,y;if(i._isTouchMode&&p.length>0){var s=p[p.length-1],k=s.row,h=s.row+s.rowCount-1,d=s.col,c=s.col+s.colCount-1;(!i.parent||i.parent._allowUserResize)&&(k!==-1&&d===-1&&i.getRowResizable(h)?(h<i.frozenRowCount?l=0:h<w-i._frozenTrailingRowCount?l=1:h<w&&(l=2),o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABaSURBVDhPY/z//z8DLsDIyAiWBKphBAtgAUxQGgPANIMAMhsdYDUAmwZchtDOC8SCgTcA5DfcgUAEoNwFo7GAPQxwJVtsYYHVBdgU4gpInF5A1oBLMwMDAwMApuAtD6Z7YxQAAAAASUVORK5CYII=",r=i.getCellRect(h,i.getColumnCount(2)-1,l,-1),f=v.rowHeaderRect(l),f.y<=r.y&&r.y+r.height<=f.y+f.height&&(e=new n.Rect(v.frozenX-u,r.y+r.height-u/2,u,u))):k===-1&&d!==-1&&i.getColumnResizable(c)&&(c<i.frozenColCount?a=0:c<b-i._frozenTrailingColCount?a=1:c<b&&(a=2),o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAE1JREFUOE/ljtEKACAIA/v/nzZ9mFhsJPRocLEuGS4zk/iJyyP/D6gE0wrYoCqoLoUafPl8fEBln3ulSscfErk65TMjMFRBhUowosDWBoHpba8+C7w0AAAAAElFTkSuQmCC",r=i.getCellRect(i.getRowCount(1)-1,c,-1,a),f=v.colHeaderRect(a),f.x<=r.x&&r.x+r.width<=f.x+f.width&&(e=new n.Rect(r.x+r.width-u/2,v.frozenY-u,u,u))),o&&e&&(y=i._getImageLoader(),y.getState(o)?t.drawImage(y.getImage(o),e.x,e.y,e.width,e.height):y.addImage(o)))}},o.prototype._getFloatingObjectRender=function(i,r){var u=this,f,e;return n.features.floatingObject?(u._floatingObjectRenderManager||(u._floatingObjectRenderManager=[]),f=u._floatingObjectRenderManager[i],f||(u._floatingObjectRenderManager[i]=[]),e=u._floatingObjectRenderManager[i][r],e||(u._floatingObjectRenderManager[i][r]=new n._FloatingObjectRenderManager(u._sheet)),u._floatingObjectRenderManager[i][r]):t},o.prototype._getFloatingObjectRenderCount=function(){var e=this,r=e._floatingObjectRenderManager,f=0,n,t,i,u;if(!r||r.length===0)return 0;for(n=0;n<=2;n++)if(t=r[n],t&&t.length>0)for(i=0;i<=2;i++)u=t[i],u&&(f+=u.getFloatingObjectRenderCount());return f},o.prototype._paintFloatingObject=function(i,u){var f=this._sheet,h,c,e,o,s;if(!f._hoverCell&&n.features.floatingObject&&f._floatingObjectArray&&(f._floatingObjectArray.length>0||this._getFloatingObjectRenderCount()>0))for(h=f._getSheetLayout(),(u===t||typeof u===r)&&(u=f._zoomFactor),e=0;e<=2;e++)for(o=0;o<=2;o++)(c=h.viewportRect(e,o),c)&&(s=this._getFloatingObjectRender(e,o),s&&!f._eventHandler.isFloatingObjectWorking&&s._render(e,o,u))},o.prototype._paintBackground=function(n,t){n.save();n.fillStyle=this._getSpreadBackColor();n.fillRect(t.x,t.y,t.width,t.height);n.restore()},o.prototype._paintHeadersAndViewport=function(n,t,i){for(var f=this,a=f._sheet,o=a._getSheetLayout(),e,s,h,c,l,u,r=0;r<=2;r++)s=o.colHeaderRect(r),s&&(t?(u=s.getIntersectRect(t),u&&f.paintColHeader(n,r,u,i)):f.paintColHeader(n,r,s,i));for(e=0;e<=2;e++)for(h=o.rowHeaderRect(e),h&&(t?(u=h.getIntersectRect(t),u&&f.paintRowHeader(n,e,u,i)):f.paintRowHeader(n,e,h,i)),r=0;r<=2;r++)c=o.viewportRect(e,r),c&&(t?(u=c.getIntersectRect(t),u&&f.paintViewport(n,e,r,u,i)):f.paintViewport(n,e,r,c,i));l=o.headerCornerRect();l&&(t?(u=l.getIntersectRect(t),u&&f.paintColHeaderCorner(n,u,i)):f.paintColHeaderCorner(n,l,i))},o.prototype._paintGrayArea=function(n){var u=this,o=u._sheet,t=o._getSheetLayout(),e=o._getRowLayout(1),i,f,r;e.length>0?(i=e[e.length-1],i.y+i.height<t.frozenTrailingY&&(n.fillStyle=u._getGrayAreaBackColor(!1),n.fillRect(t.headerX,i.y+i.height,t.width,t.frozenTrailingY-(i.y+i.height)))):e.length===0&&(n.fillStyle=u._getGrayAreaBackColor(!1),n.fillRect(t.headerX,t.viewportY,t.width,t.frozenTrailingY-t.viewportY));f=o._getColumnLayout(1);f.length>0?(r=f[f.length-1],r.x+r.width<t.frozenTrailingX&&(n.fillStyle=u._getGrayAreaBackColor(!1),n.fillRect(r.x+r.width,t.headerY,t.frozenTrailingX-(r.x+r.width),t.height))):f.length===0&&(n.fillStyle=u._getGrayAreaBackColor(!1),n.fillRect(t.viewportX,t.headerY,t.frozenTrailingX-t.viewportX,t.height))},o.prototype._paintSheetBorder=function(n,t){var u=this,r=u._sheet;r.borderWidth>0&&(n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.strokeRect(t.x+n.lineWidth/2,t.y+n.lineWidth/2,i(0,t.width-n.lineWidth),i(0,t.height-n.lineWidth)))},o.prototype.paintSheet=function(t,i){var r=this,f=r._sheet,u;!t||f._layoutSuspended>0||(n._CacheMgr.startCache(f,0,0,f.getRowCount()-1,f.getColumnCount()-1),u=f.getBounds(),t.save(),i?t.rect(i.x,i.y,i.width,i.height):t.rect(u.x,u.y,u.width,u.height),t.clip(),t.beginPath(),r._paintBackground(t,u),n.features.group&&r.paintGroup(t,i),n.features.floatingObject&&r._paintFloatingObject(i),n.features.comment&&f._commentManager.hasComment()&&(r._paintCommentFloatLayoutPanel(3),r._paintComment(i)),r._paintHeadersAndViewport(t,i,!1),r._paintGrayArea(t),r.paintFrozenLine(t),r._paintSheetBorder(t,u),n._CacheMgr.clearCache(),t.beginPath(),t.restore())},o.prototype.paintSheetForPrint=function(t,i){var f=this,u=f._sheet,r;t&&(n._CacheMgr.startCache(u,0,0,u.getRowCount()-1,u.getColumnCount()-1),r=u.getBounds(),t.save(),i?t.rect(i.x,i.y,i.width,i.height):t.rect(r.x,r.y,r.width,r.height),t.clip(),t.beginPath(),f._paintBackground(t,r),f._paintHeadersAndViewport(t,i,!0),n._CacheMgr.clearCache(),t.beginPath(),t.restore())},o.prototype.refreshDragDropIndicator=function(){var o=this,i=o._sheet,h=i._currentTarget,s,v;if(h&&h.dragInfo){var c=o._getCtx(),f=i._getSheetLayout(),e=i._actualDragRange,r=i._dragRect,t=i._getRangeRect2(e),l=i._frozenTrailingColCount,a=i._frozenTrailingRowCount,y=i.getColumnCount()-l,p=i.getRowCount()-a,u=f.viewportRect(1,1);l>0&&e.col+e.colCount<=y&&t.x+t.width>u.x+u.width&&t.intersectRect(u)&&(t=t.getIntersectRect(u));a>0&&e.row+e.rowCount<=p&&t.y+t.height>u.y+u.height&&t.intersectRect(u)&&(t=t.getIntersectRect(u));s=new n.Rect(f.frozenX,f.frozenY,f.frozenTrailingX+f.frozenTrailingWidth,f.frozenTrailingY+f.frozenTrailingHeight);t.width>0&&t.height>0?(r.x=t.x,r.y=t.y,r.width=t.width-1,r.height=t.height-1,o.paintDragDropIndicator(c,s)):(t.width===0||t.height===0)&&(r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height,o.paintDragDropIndicator(c,s));v=i._eventHandler._isDragInsert;i._dragOldRect=v===!0?i._insertDragRect:new n.Rect(r.x,r.y,r.width,r.height)}},o.prototype.paintDragDropIndicator=function(t,i){var e=this,f=e._sheet,r=f._dragRect,p=f._eventHandler._isDragInsert,a=r.hitTarget,u,h,o,c,v,s,l,y;f&&r&&a&&(t.save(),p===!0&&(r.row===-1||r.col===-1)?r.row===-1&&r.col!==-1?(o=f._getColumnLayout(0).findCol(r.hitCol),o||(o=f._getColumnLayout(1).findCol(r.hitCol)),o||(o=f._getColumnLayout(2).findCol(r.hitCol)),o&&(c=o.x,v=o.width,r.col=r.hitCol,a.x>c+v/2&&(r.col<f._getLastFullyVisibleColumn()||r.col===f._getLastVisualColumn())&&(c=o.x+o.width,r.col++),u=f._dragOldRect,u&&u.width===0||(u=f._dragRect),u&&(h=new n.Rect(u.x-2,u.y-2,u.width+4,u.height+4),e.copyDoubleBufferRect(h,i),e.repaintSelection(f._getActiveSelectedRange(),i)),f._insertDragRect=new n.Rect(c,r.y,0,r.height),t.rect(i.x,i.y,i.width,i.height),t.clip(),t.beginPath(),e.paintDragLine(t,c,r.y,c,r.y+r.height))):r.row!==-1&&r.col===-1&&(s=f._getRowLayout(0).findRow(r.hitRow),s||(s=f._getRowLayout(1).findRow(r.hitRow)),s||(s=f._getRowLayout(2).findRow(r.hitRow)),s&&(l=s.y,y=s.height,r.row=r.hitRow,a.y>l+y/2&&(r.row<f._getLastFullyVisibleRow()||r.row===f._getLastVisualRow())&&(l=s.y+s.height,r.row++),u=f._dragOldRect,u&&u.height===0||(u=f._dragRect),u&&(h=new n.Rect(u.x-2,u.y-2,u.width+4,u.height+4),e.copyDoubleBufferRect(h,i),e.repaintSelection(f._getActiveSelectedRange(),i)),f._insertDragRect=new n.Rect(r.x,l,r.width,0),t.rect(i.x,i.y,i.width,i.height),t.clip(),t.beginPath(),e.paintDragLine(t,r.x,l,r.x+r.width,l))):(u=f._dragOldRect,u&&(h=new n.Rect(u.x-2,u.y-2,u.width+4,u.height+4),e.copyDoubleBufferRect(h,i),e.repaintSelection(f._getActiveSelectedRange(),i)),t.rect(i.x,i.y,i.width,i.height),t.clip(),t.beginPath(),e.paintDragRectangle(t,r)),t.beginPath(),t.restore())},o.prototype.paintDragRectangle=function(n,i){var r=this;r.paintDragLine(n,i.x,i.y,i.x+i.width,i.y);r.paintDragLine(n,i.x,i.y+i.height,i.x+i.width,i.y+i.height);r.paintDragLine(n,i.x,i.y,i.x,i.y+i.height);r.paintDragLine(n,i.x+i.width,i.y,i.x+i.width,i.y+i.height);r.pri(n,t,t)},o.prototype.paintDragLine=function(t,i,r,u,e){t.save();var o,s,h;i===u?(t.rect(i-2,r,7,f(e-r)),t.clip(),t.beginPath(),r<e?(r-=3,e+=3):(r+=3,e-=3),o=n.Line.Create(i-1,r-1,u-1,e+1,"black",7),s=n.Line.Create(i,r,u,e,"black",7),h=n.Line.Create(i+1,r-1,u+1,e+1,"black",7)):r===e&&(t.rect(i,r-2,f(u-i),7),t.clip(),t.beginPath(),i<u?(i-=3,u+=3):(i+=3,u-=3),o=n.Line.Create(i-1,r-1,u+1,e-1,"black",7),s=n.Line.Create(i,r,u,e,"black",7),h=n.Line.Create(i-1,r+1,u+1,e+1,"black",7));o.paintLine(t);s.paintLine(t);h.paintLine(t);t.stroke();t.beginPath();t.restore()},o.prototype.paintResizeLine=function(n){var t,r,e,o,l,a,s=this._sheet,h,u,f,c;if(s._eventHandler.isResizing&&(h=s._currentTarget,h)&&(u=h.resizeInfo,u)){if(f=s._getSheetLayout(),c="#000000",n.save(),n.strokeStyle!==c&&(n.strokeStyle=c),n.lineWidth!==1&&(n.lineWidth=1),n.beginPath(),u.action==="sizeRow"||u.action==="sizeHiddenRow")for(r=i(0,u.startY-.5),o=u.movingY-.5,l=f.x+f.width,t=f.x;t<l;t+=2)n.moveTo(t,r),n.lineTo(t+1,r),n.moveTo(t,o),n.lineTo(t+1,o);else for(t=i(0,u.startX-.5),e=u.movingX-.5,a=f.y+f.height,r=f.y;r<a;r+=2)n.moveTo(t,r),n.lineTo(t,r+1),n.moveTo(e,r),n.lineTo(e,r+1);n.stroke();n.beginPath();n.restore()}},o.prototype.paintColHeaderCorner=function(i,r,u){var e=this._sheet,f,s,o;i.beginPath();f=e._getSheetLayout().headerCornerRect();s=e.getActualStyle(-1,-1,0);this.paintCells(i,[{data:t,row:-1,col:-1,x:f.x,y:f.y,width:f.width,height:f.height,style:s.clone()}],0,u);o=new n._GcBorders(e,0,0,0);o.addCellLines(0,0,f.x,f.y,f.width,f.height);o.paint(i,r)},o.prototype.paintFrozenLine=function(t){var r=this._sheet,i;(r.frozenRowCount||r.frozenColCount||r._frozenTrailingRowCount||r._frozenTrailingColCount)&&(i=r._getSheetLayout(),t.save(),t.strokeStyle=n._ThemeContext.getColor(r,r._frozenlineColor),t.lineWidth=1,t.beginPath(),r.frozenColCount&&(t.moveTo(i.viewportX-.5,i.y),t.lineTo(i.viewportX-.5,i.y+i.height)),r.frozenRowCount&&(t.moveTo(i.x,i.viewportY-.5),t.lineTo(i.x+i.width,i.viewportY-.5)),r._frozenTrailingColCount&&(t.moveTo(i.frozenTrailingX-.5,i.y),t.lineTo(i.frozenTrailingX-.5,i.y+i.height)),r._frozenTrailingRowCount&&(t.moveTo(i.x,i.frozenTrailingY-.5),t.lineTo(i.x+i.width,i.frozenTrailingY-.5)),t.stroke(),t.restore())},o.prototype.paintColHeader=function(n,t,i,r){this.paintViewportImp(n,-1,t,1,i,r)},o.prototype.paintRowHeader=function(n,t,i,r){this.paintViewportImp(n,t,-1,2,i,r)},o.prototype.paintViewport=function(n,t,i,r,u){this.paintViewportImp(n,t,i,3,r,u);var f=this._sheet._cutCopyIndicatorManager;f&&f.paintCutCopyIndicator(n,r,t,i)},o.prototype.getTouchDragFillIndicatorRect=function(){var r=this._sheet,u=t,f=r.getSelections(),e=f.length;if(r._isTouchMode&&e>0){var s=f[e-1],i=r._getRangeRect2(s),o=17,h=20;u=new n.Rect(i.x+i.width-o,i.y+i.height,o,h)}return u},o.prototype.getCurrentViewportRange=function(t,i){var r=this._sheet,c=r.getRowCount(),l=r.getColumnCount(),o=1,u;0<=t&&t<r.frozenRowCount?o=0:c>t&&t>=c-r._frozenTrailingRowCount&&(o=2);u=1;0<=i&&i<r.frozenColCount?u=0:l>i&&i>=l-r._frozenTrailingColCount&&(u=2);var f=r._getViewportRowLayout(o),e=r._getViewportColumnLayout(u),s=0,a=0,h=0,v=0;return f.length>0&&(s=f[0].row,a=f[f.length-1].row),e.length>0&&(h=e[0].col,v=e[e.length-1].col),new n.Range(s,h,a-s+1,v-h+1)},o.prototype.isContainedByCurrentViewport=function(n,t){var i=this._sheet,s=i.getRowCount(),h=i.getColumnCount(),f=1,u;0<=n&&n<i.frozenRowCount?f=0:s>n&&n>=s-i._frozenTrailingRowCount&&(f=2);u=1;0<=t&&t<i.frozenColCount?u=0:h>t&&t>=h-i._frozenTrailingColCount&&(u=2);var y=i._getSheetLayout(),r=y.viewportRect(f,u),c=!1,l=i._getViewportColumnLayout(u),e=t===-1?l[0]:l.findCol(t);e&&(c=r.x<=e.x&&e.x+e.width<=r.x+r.width);var a=!1,v=i._getViewportRowLayout(f),o=n===-1?v[0]:v.findRow(n);return o&&(a=r.y<=o.y&&o.y+o.height<=r.y+r.height),c&&a},o.prototype.getSelectionIndicatorRects=function(){var l=this,i=l._sheet,it=i.getSelections(),f=[],lt,g,vt,nt,tt,y;if(i._isTouchMode&&it.length>0){var u=it[it.length-1],r=i._getRangeRect2(u),t=8,p=i._getSheetLayout(),a=u.row,e=u.row+u.rowCount-1,v=u.col,o=u.col+u.colCount-1,ot=l.getCurrentViewportRange(a,v),w=l.getCurrentViewportRange(e,o),b=ot.row,s=w.row+w.rowCount-1,k=ot.col,h=w.col+w.colCount-1,c,d,st=e===s&&l.isContainedByCurrentViewport(s,-1),ht=o===h&&l.isContainedByCurrentViewport(-1,h);if(u.row!==-1&&u.col!==-1)k<=v&&v<=h&&b<=a&&a<=s&&(f[0]=new n.Rect(r.x-t,r.y-t,t*2,t*2)),(k<=o&&o<h||ht)&&(b<=e&&e<s||st)&&(f[1]=new n.Rect(r.x+r.width-t,r.y+r.height-t,t*2,t*2));else if(u.row!==-1){c=p.viewportRect(1,0);d=p.viewportRect(1,1);var rt=c.x+(c.width+d.width)/2-t,yt=i.getColumnCount()-1-i.getFrozenTrailingColumnCount(),ct=i._getViewportColumnLayout(1),ut=ct.findCol(yt);ut&&(lt=i._getViewportColumnLayout(0),g=lt[0]||ct[0],g&&(rt=g.x+(ut.x+ut.width-g.x)/2-t));b<=a&&a<=s&&(f[0]=new n.Rect(rt,r.y-t,t*2,t*2));(b<=e&&e<s||st)&&(f[1]=new n.Rect(rt,r.y+r.height-t,t*2,t*2))}else if(u.col!==-1){c=p.viewportRect(0,1);d=p.viewportRect(1,1);var ft=c.y+(c.height+d.height)/2-t,pt=i.getRowCount()-1-i.getFrozenTrailingRowCount(),at=i._getViewportRowLayout(1),et=at.findRow(pt);et&&(vt=i._getViewportRowLayout(0),nt=vt[0]||at[0],nt&&(ft=nt.y+(et.y+et.height-nt.y)/2-t));k<=v&&v<=h&&(f[0]=new n.Rect(r.x-t,ft,t*2,t*2));(k<=o&&o<h||ht)&&(f[1]=new n.Rect(r.x+r.width-t,ft,t*2,t*2))}for(y=f.length-1;y>=0;y--)tt=f[y],(!tt||tt.x<0||tt.y<0)&&f.splice(y,1)}return f},o.prototype.paintTouchSelectionIndicator=function(t){var r=this._sheet,f,e,i,u;if(n.FocusHelper.isActiveElement(r)||r.parent&&!r.parent.hideSelection()){if(r.isEditing()||!this._showTouchSelectionIndicator)return;if(f=this.getSelectionIndicatorRects(),e=f.length,e>0){for(t.save(),t.fillStyle="white",t.strokeStyle=r.selectionBorderColor(),u=0;u<e;u++)i=f[u],t.beginPath(),t.arc(i.x+i.width/2,i.y+i.height/2,i.width/2,0,s*2,!1),t.fill(),t.stroke();t.restore()}}},o.prototype.refreshTouchSelectionIndicator=function(){var t=this._sheet,n=t.getSelections();!t._paintSuspended&&n.length>0&&this.repaintSelection(n[n.length-1],undefined,undefined,!0)},o.prototype.paintTouchDragFillIndicator=function(n){var u=this._sheet,f=17,e=20,r=this.getTouchDragFillIndicatorRect(),t,i;r&&(t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAATCAIAAAD5x3GmAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwwAADsMBx2 + oZAAAAGhJREFUOE / djkEOwCAIBHk6P98u1lKo1diEU + dggOyAAkC + YPl / Onx3WDmiytm4aulQoKba + 4uiO77YhHDH5SqnRa0If / Nhq0fnjPob2h5oVXJI0rJA3h1ya1kgU4f4nQfVzozk7APgAIEqATZbalz1AAAAAElFTkSuQmCC",i=u._getImageLoader(),i.getState(t)?n.drawImage(i.getImage(t),r.x,r.y,f,e):i.addImage(t))},o.prototype.paintSelection=function(t,i,r,u){var a=this,f=a._sheet,w,v,y,b,e,k,d,h,c,s,o,tt,l;if(n.FocusHelper.isActiveElement(f)||f.parent&&!f.parent.hideSelection()){var p=f._eventHandler,g=f._selectionModel,nt=g.length;if(u=a._getClipRect(i,r,u),!u)return;if(w=n.ThemeStyleHelper.getCssClassThemeStyle("gc-selection"),v=parseInt(w.zIndex),v>2007&&a.paintHeaderSelection(t,i,r,u),y=a._getPaintingRects(i,r,g,u),b=y.length,b<=0)return;for(k=!1,s=0;s<b;s++)if(e=y[s],!u.containsRect(e)){k=!0;break}if(t.save(),k&&(t.rect(u.x,u.y,u.width,u.height),t.clip()),t.beginPath(),b>0)for(d=n._ThemeContext.getColor(f,f.selectionBackColor()),t.fillStyle!==d&&(t.fillStyle=d),h=0,c=0,v>2007&&(h=1,c=-3),s=0;s<y.length;s++)e=y[s],t.fillRect(e.x+h,e.y+h,e.width+c,e.height+c);o=f.getCellRect(f._activeRowIndex,f._activeColIndex,i,r);o&&o.intersectRect(u)&&(h=1,c=-2,v>2007&&(h=0,c=0),a.copyDoubleBuffer(o.x+h,o.y+h,o.width+c,o.height+c),nt>1&&(t.strokeStyle="black",t.lineWidth=1,t.strokeRect(o.x+1.5,o.y+1.5,o.width-4,o.height-4)));t.restore();t.save();k&&(a.adjustClipRect(u,f,i,r,v),t.rect(u.x,u.y,u.width,u.height),t.clip());t.beginPath();nt===1&&(p.isDraggingFill&&p.isDragClear()&&!p._isDragAroundIndicator&&(tt=p.getCurrentFillRange(),l=f._getRangeRect(i,r,tt),l&&l.width>0&&l.height>0&&(t.fillStyle=w&&w.color,t.fillRect(l.x,l.y,l.width,l.height))),e&&e.width>=0&&e.height>=0&&a.paintSelectionBorder(t,i,r,e,u));t.beginPath();t.restore()}},o.prototype.adjustClipRect=function(n,t,i,r,u){var g=0,nt=0,tt=0,it=0,v=t.getSelections(),o=t._getSheetLayout(),y=t.getRowCount()-t._frozenTrailingRowCount-1,p=t.getColumnCount()-t._frozenTrailingColCount-1,k=t._getColumnLayout(1,3),d=t._getRowLayout(1,3);if(v.length===1&&u>2007){var s=v[0],f=s.row,e=s.col,h=s.rowCount,c=s.colCount;t.frozenRowCount>0&&(f===t.frozenRowCount?(n.y-=2,n.height+=2):f+h===t.frozenRowCount&&t.frozenRowCount===t._scrollTopRow&&(n.height+=2));t.frozenColCount>0&&(e===t.frozenColCount?(n.x-=2,n.width+=2):e+c===t.frozenColCount&&t.frozenColCount===t._scrollLeftCol&&(n.width+=2));f===0&&e===0&&(n.x-=2,n.y-=2,n.width+=2,n.height+=2);f===-1&&(f=0,h=t.getRowCount());e===-1&&(e=0,c=t.getColumnCount());var w=!1,b=!1,l=d.findRow(y),a=k.findCol(p);l&&l.y+l.height<o.viewportY+o.viewportHeight&&(w=!0);a&&a.x+a.width<o.viewportX+o.viewportWidth&&(b=!0);w&&f+h-1===y&&(n.height+=2);b&&e+c-1===p&&(n.width+=2)}},o.prototype.paintHeaderSelection=function(n,t,i,r){var y=this,u=y._sheet,it=u._selectionModel,o=u._getSheetLayout(),l=it.length,ot,st,b,g,s,v;if(!(l<=0)){var a=it[0],h=a.row,p=a.rowCount,c=a.col,w=a.colCount;if(h===-1&&(h=0),c===-1&&(c=0),p===-1&&(p=u.getRowCount()),w===-1&&(w=u.getColumnCount()),n.save(),n.beginPath(),n.lineWidth=2,n.strokeStyle=u.selectionBorderColor(),ot=!0,st=!0,l!==1||u.frozenRowCount!==0||!(u._scrollTopRow>h)||!(u._scrollTopRow<h+p))for(b=y._getColumnHeaderSelectionRects(i),s=0,v=b.length;s<v;s++){var f=b[s],k=0,d=0,rt=f.x,ut=f.x+f.width;f.x<r.x+r.width&&r.x<f.x+f.width&&(l===1&&(u.frozenRowCount===0&&u._scrollTopRow===h||u.frozenRowCount>0&&h===0)&&(k=-1,d=1),f.x<r.x&&(k=0,rt=r.x),f.x+f.width>r.x+r.width&&(d=0,ut=r.x+r.width),n.moveTo(rt+k-1,o.headerY+o.colHeaderHeight-1),n.lineTo(ut+d,o.headerY+o.colHeaderHeight-1),n.stroke())}if(l!==1||u.frozenColCount!==0||!(u._scrollLeftCol>c)||!(u._scrollLeftCol<c+w))for(g=y._getRowHeaderSelectionRects(t),s=0,v=g.length;s<v;s++){var e=g[s],nt=0,tt=0,ft=e.y,et=e.y+e.height;e.y<r.y+r.height&&r.y<e.y+e.height&&(l===1&&(u.frozenColCount===0&&u._scrollLeftCol===c||u.frozenColCount>0&&c===0)&&(nt=-1,tt=1),e.y<r.y&&(nt=0,ft=r.y),e.y+e.height>r.y+r.height&&(tt=0,et=r.y+r.height),n.moveTo(o.headerX+o.rowHeaderWidth-1,ft+nt-1),n.lineTo(o.headerX+o.rowHeaderWidth-1,et+tt),n.stroke())}n.beginPath();n.restore()}},o.prototype._getColumnHeaderSelectionRects=function(t){for(var a,v,y,l,h,u=this._sheet,w=u._selectionModel,b=w.length,r=u._getColumnLayout(t),c=[],k=u._getSheetLayout(),p=0;p<b;p++)if(a=w[p],a)if(v=a.col,v===-1){var f=u._getColumnLayout(0,3),e=u._getColumnLayout(1,3),o=u._getColumnLayout(2,3),i=-1,s=-1;f.length>0&&(i=f[0].x,s=f[f.length-1].x+f[f.length-1].width-i,c.push(new n.Rect(i,-1,s,-1)));e.length>0&&(i=e[0].x,s=e[e.length-1].x+e[e.length-1].width-i,c.push(new n.Rect(i,-1,s,-1)));o.length>0&&(i=o[0].x,s=o[o.length-1].x+o[o.length-1].width-i,c.push(new n.Rect(i,-1,s,-1)))}else r&&(y=r.findCol(v),l=r.findCol(v+a.colCount-1),(y||l)&&(h=new n.Rect(-1,-1,-1,-1),h.x=y?y.x:r[0].x,h.width=l?l.x+l.width-h.x:r[r.length-1].x+r[r.length-1].width-h.x,c.push(h)));return c},o.prototype._getRowHeaderSelectionRects=function(t){for(var a,v,y,l,h,u=this._sheet,w=u._selectionModel,b=w.length,r=u._getRowLayout(t),c=[],k=u._getSheetLayout(),p=0;p<b;p++)if(a=w[p],a)if(v=a.row,v===-1){var f=u._getRowLayout(0,3),e=u._getRowLayout(1,3),o=u._getRowLayout(2,3),i=-1,s=-1;f.length>0&&(i=f[0].y,s=f[f.length-1].y+f[f.length-1].height-i,c.push(new n.Rect(-1,i,-1,s)));e.length>0&&(i=e[0].y,s=e[e.length-1].y+e[e.length-1].height-i,c.push(new n.Rect(-1,i,-1,s)));o.length>0&&(i=o[0].y,s=o[o.length-1].y+o[o.length-1].height-i,c.push(new n.Rect(-1,i,-1,s)))}else r&&(y=r.findRow(v),l=r.findRow(v+a.rowCount-1),(y||l)&&(h=new n.Rect(-1,-1,-1,-1),h.y=y?y.y:r[0].y,h.height=l?l.y+l.height-h.y:r[r.length-1].y+r[r.length-1].height-h.y,c.push(h)));return c},o.prototype.paintSelectionBorder=function(t,i,r,u,f){var e=this._sheet,o=e._eventHandler,s;if(u.width>=0&&u.height>=0&&(!f||u.intersect(f.x-1,f.y-1,f.width+2,f.height+2))){if(t.save(),f&&!f.containsRect(u)&&(t.rect(f.x,f.y,f.width,f.height),t.clip()),t.beginPath(),t.strokeStyle=n._ThemeContext.getColor(e,e.selectionBorderColor()),t.lineWidth=2,u.width>0&&u.height>0){if(o.isDraggingFill)switch(o._currentFillDirection){case 2:t.moveTo(u.x+.5,u.y-.5);t.lineTo(u.x+u.width-1,u.y-.5);break;case 3:t.moveTo(u.x+.5,u.y+u.height-.5);t.lineTo(u.x+u.width-1,u.y+u.height-.5);break;case 0:t.moveTo(u.x-.5,u.y+.5);t.lineTo(u.x-.5,u.y+u.height-1);break;case 1:t.moveTo(u.x+u.width-.5,u.y+.5);t.lineTo(u.x+u.width-.5,u.y+u.height-1);break;case 5:case 4:break;default:break}else s=e.parent&&e.parent._themeVersion,s>2007?t.rect(u.x-1,u.y-1,u.width+1,u.height+1):t.rect(u.x-.5,u.y-.5,u.width,u.height);t.stroke();e.canUserDragFill()&&this.paintDragFillIndicator(t,i,r,u,f)}else(u.width===0||u.height===0)&&t.strokeRect(u.x-1,u.y-1,u.width+1,u.height+1);t.beginPath();t.restore()}},o.prototype._getClipRect=function(n,i,r){var c=this._sheet,l=c._getSheetLayout(),f=l.viewportRect(n,i),e,o,s,h;return i===1&&(e=c._getColumnLayout(i),o=e.length>0?e[e.length-1]:t,o&&(f.width=u(f.width,o.x+o.width-l.viewportX))),n===1&&(s=c._getRowLayout(n),h=s.length>0?s[s.length-1]:t,h&&(f.height=u(f.height,h.y+h.height-l.viewportY))),r?r.getIntersect(f.x,f.y,f.width,f.height):f},o.prototype._getPaintingRects=function(n,t,i,r){for(var s=this._sheet,c=s._getSpanModel(),e,l=i.length,f,h=[],u,o=0;o<l;o++)f=i[o],f&&(e=c.find(f.row,f.col),e&&e.containsRange(f)&&(f=e),u=s._getRangeRect(n,t,f),u&&u.x<=r.x+r.width&&u.y<=r.y+r.height&&r.x<=u.x+u.width&&r.y<=u.y+u.height&&h.push(u));return h},o.prototype.paintFormulaTextBox=function(){var t=this,i=t._sheet,n,r;i._paintSuspended||i._layoutSuspended>0||(n=i._getSheetLayout(),r=t._getCtx(),t.copyDoubleBuffer(n.x,n.y,n.width,n.height),t.paintAdornment(r))},o.prototype.paintFormulaTextBoxRange=function(t,i,r,u){var k=this,l=k._sheet,a=l._eventHandler,b=l._formulaTextBox,g=b&&b.getRanges(),et=g&&g.length,dt=l.getName(),v,it,d,f,ht,e,w;if(!(et<=0)&&(v=k._getClipRect(i,r,u),v)){t.save();t.rect(v.x,v.y,v.width,v.height);t.clip();t.beginPath();var y=[],ot=a.isFormulaRangeHoving,st=a._formulRangeHovingInfo,yt=a.isFormulaRangeMoving,pt=a._formulaRangeMovingInfo,wt=a.isFormulaRangeResizing,bt=a._formulaRangeResizingInfo,h,p,nt,tt,s;for(e=0;e<et;e++)if(h=g[e],p=h.text,nt=h.ranges&&h.ranges.length>0?h.ranges:[a.stringToRange(p)],nt){if(w=n.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,n.features.formulatextbox&&w&&w.sheet)if(n.StringUtil.contains(p,"!")){if(it=n.StringUtil.leftBefore(p,"!"),l.getName()!==it&&"'"+l.getName()+"'"!==it)continue}else if(!l.getCustomName(n.StringUtil.leftBefore(p,"["))&&!l.findTableByName(n.StringUtil.leftBefore(p,"[")))continue;for(tt=k._getPaintingRects(i,r,nt,v),d=0;d<tt.length;d++)if(f=tt[d],f&&f.width>0&&f.height>0){if(s=b.getRangeColor(e),b.isAppendingRange(h)?(ot&&st.paramRange.index===e&&(t.beginPath(),t.lineWidth=2,t.strokeStyle=s,t.rect(f.x+1,f.y+1,f.width-3,f.height-3),t.stroke()),k.paintDashRect(t,f,s)):ot&&st.paramRange.index===e||yt&&pt.paramRange.index===e||wt&&bt.paramRange.index===e?(t.beginPath(),t.lineWidth=2,t.strokeStyle=s,t.rect(f.x+1,f.y+1,f.width-3,f.height-3),t.stroke()):(t.beginPath(),t.lineWidth=2,t.strokeStyle=s,t.rect(f.x,f.y,f.width-1,f.height-1),t.stroke()),b.isActiveRange(h)){var kt=.1,rt=0,ut=0,ft=0,c=n.util.parseColorString(s);c.length===3?(rt=c[0],ut=c[1],ft=c[2]):c.length===4&&(rt=c[1],ut=c[2],ft=c[3]);t.beginPath();t.fillStyle="rgba("+rt+","+ut+","+ft+","+kt+")";t.fillRect(f.x+1,f.y+1,f.width-3,f.height-3)}y.push({rect:f,color:s,allowDrag:h.allowDrag})}}if(y.length>0)for(ht=y.length,e=0;e<ht;e++){f=y[e].rect;s=y[e].color;var o=5,ct=f.x-2,lt=f.x+f.width+1-o,at=f.y-2,vt=f.y+f.height+1-o;y[e].allowDrag!==!1&&((w=n.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,n.features.formulatextbox&&w&&w.text)||(t.beginPath(),t.fillStyle=s,t.fillRect(ct,at,o,o),t.fillRect(lt,at,o,o),t.fillRect(ct,vt,o,o),t.fillRect(lt,vt,o,o)))}t.beginPath();t.restore()}},o.prototype.paintDashRect=function(t,i,r){var l,s,c,e,u,o,h;if(t.save(),l=[6,6],t.setLineDash&&!n.util.browser.qtMode)t.beginPath(),t.lineWidth=2,t.strokeStyle=r,t.setLineDash(l),t.rect(i.x,i.y,i.width-1,i.height-1),t.stroke();else{for(t.beginPath(),t.lineWidth=2,t.strokeStyle=r,s=l[0],c=l[1],e=i.x,u=i.y,o=i.width;o>0;)if(o>=s+c)t.moveTo(e,u),t.lineTo(e+s,u),e=e+s+c,o=o-s-c;else if(o>=s){t.moveTo(e,u);t.lineTo(e+s,u);o=o-s-c;break}else if(o>0){t.moveTo(e,u);t.lineTo(e+o,u);o=o-s-c;break}for(e=i.x+i.width-1,u=i.y+1,h=i.height-1,o<0&&(o=f(o),o>c&&(t.moveTo(e,u-2),t.lineTo(e,u+(o-c))),u+=o,h-=o);h>0;)h>=s+c?(t.moveTo(e,u),t.lineTo(e,u+s),u=u+s+c,h=h-s-c):h>=s?(t.moveTo(e,u),t.lineTo(e,u+s),h=h-s-c):h>0&&(t.moveTo(e,u),t.lineTo(e,u+h),h=h-s-c);for(e=i.x+i.width-2,u=i.y+i.height-1,o=i.width-1,h<0&&(h=f(h),h>c&&(t.moveTo(e+2,u),t.lineTo(e-(h-c),u)),e-=h,o-=h);o>0;)if(o>=s+c)t.moveTo(e,u),t.lineTo(e-s,u),e=e-s-c,o=o-s-c;else if(o>=s){t.moveTo(e,u);t.lineTo(e-s,u);o=o-s-c;break}else if(o>0){t.moveTo(e,u);t.lineTo(e-o,u);o=o-s-c;break}for(e=i.x,u=i.y+i.height-2,h=i.height-1,o<0&&(o=f(o),o>c&&(t.moveTo(e,u+2),t.lineTo(e,u-(o-c))),u-=o,h-=o);h>0;)h>=s+c?(t.moveTo(e,u),t.lineTo(e,u-s),u=u-s-c,h=h-s-c):h>=s?(t.moveTo(e,u),u-s===i.y?t.lineTo(e,u-s-1):t.lineTo(e,u-s),h=h-s-c):h>0&&(u>i.y&&(t.moveTo(e,u),t.lineTo(e,u-h)),h=h-s-c);t.stroke()}t.beginPath();t.restore()},o.prototype.getDragFillIndicatorRect=function(t,i){var e=this._sheet,o=e._getActiveSelectedRange(),s=e._getSheetLayout(),f=4,u=-2-.5,r;return i>2007&&(f=5,u=-3),r=new n.Rect(-4,-4,f,f),o.col===-1?(r.x=s.frozenX,r.y=t.y+t.height+u):o.row===-1?(r.x=t.x+t.width+u,r.y=s.frozenY):(r.x=t.x+t.width+u,r.y=t.y+t.height+u),r},o.prototype.paintDragFillIndicator=function(t,r,u,f,e){var s=this._sheet,v=s._getSheetLayout(),a=s.parent&&s.parent._themeVersion,o=this.getDragFillIndicatorRect(f,a),l=v.viewportRect(r,u),c,h;(!e||o.intersectRect(e))&&o.intersectRect(l)&&(c=-1.5,a>2007&&(c=-1),h=new n.Rect(o.x+c,o.y+c,o.width+2,o.height+2),h.x=i(h.x,l.x),h.y=i(h.y,l.y),this.copyDoubleBufferRect(h),t.save(),e&&!e.containsRect(o)&&(t.rect(e.x,e.y,e.width,e.height),t.clip()),t.beginPath(),t.fillStyle=n._ThemeContext.getColor(s,s.selectionBorderColor()),t.fillRect(o.x,o.y,o.width,o.height),s._dragFillIndicatorRect=new n.Rect(o.x,o.y,4,4),t.beginPath(),t.restore())},o.prototype._paintCommentFloatLayoutPanel=function(n){var i=this,t;n===3&&(t=i._sheet._commentRender,t&&t.renderCommentFloatPanel(i._sheet))},o.prototype._paintCommentCellAdorner=function(n,t,i){var u=this,r=u._sheet._commentRender;r&&r.renderCommentCellAdorner(n,t,i)},o.prototype._paintComment=function(n){var e=this,u=e._sheet,o=u._commentRender,s,t,i,r,f;if(!u._hoverCell)for(s=e._sheet._getSheetLayout(),i=0;i<=2;i++)for(r=0;r<=2;r++)(t=s.viewportRect(i,r),t&&t.width!==0&&t.height!==0)&&(!n||t.intersectRect(n))&&(f=u._commentManager,o&&f&&o.renderComment(f))},o.prototype.paintViewportImp=function(i,u,f,o,s,h){var g=this,et,ot,at,vt,ni,fi,tt,ti;(typeof o===r||o===t)&&(o=3);var c=g._sheet,ft=c.parent,k=c._getRowLayout(u,o),d=c._getColumnLayout(f,o);if(ft&&ft.resizeZeroIndicator()===1&&(u===-1&&d.length>0&&d[0].col>=1&&c._getActualColumnWidth(d[0].col-1)===0&&d.unshift(new n._Layout(-1,d[0].col-1,c._getSheetLayout().viewportX,-1,0,-1)),f===-1&&k.length>0&&k[0].row>=1&&c._getActualRowHeight(k[0].row-1)===0&&k.unshift(new n._Layout(k[0].row-1,-1,-1,c._getSheetLayout().viewportY,-1,0))),et=k.length,ot=d.length,!(et<0)&&!(ot<0)){var kt=c._getCellLayout(u,f,o),ii=kt.length>0,it=t,rt=t,l=t,st=c._cachePool,a,v,y=0,p=0,w=0,b=0,ht,ut,yt=st.isCaching()&&c.parent&&!c.parent.touchScrollOnRails()?new n._FastBorders(k[0].row,d[0].col,et,ot,s):new n._GcBorders(c,u,f,o),dt=[],ct=[],ri=o===3&&c._allowCellOverflow,nt=t,gt=c._getFilterButtonModel(),pt=[],ui=!h&&o===3&&c.parent&&c.parent.highlightInvalidData();i.save();s&&(i.rect(s.x,s.y,s.width,s.height),i.clip());i.beginPath();var lt=[],wt=-1,bt=-1;for(at=0;at<et;at++)for(it=k[at],vt=0;vt<ot;vt++)(rt=d[vt],l=ii&&kt.findCell(it.row,rt.col),l?(a=l.row,v=l.col,y=l.x,p=l.y,w=l.width,b=l.height):(a=it.row,v=rt.col,y=rt.x,p=it.y,w=rt.width,b=it.height),ft&&ft.resizeZeroIndicator()===1&&(u===-1&&c.getColumnVisible(v)&&c._getActualColumnWidth(v)===0&&((bt<0||bt!==v-1)&<.push({x1:y,y1:p,x2:y,y2:p+b,horizontal:!1}),bt=v),f===-1&&c.getRowVisible(a)&&c._getActualRowHeight(a)===0&&((wt<0||wt!==a-1)&<.push({x1:y,y1:p,x2:y+w,y2:p,horizontal:!0}),wt=a)),s&&(y+w<=s.x||y>=s.x+s.width||p+b<=s.y||p>=s.y+s.height))||w!==0&&b!==0&&(l&&n.ArrayHelper.contains(dt,l)||(ht=st.getValue(a,v,o),ut=st.getActualStyle(a,v,o),ni={value:undefined},ut&&(fi=n._CacheMgr.getFormattedTextByStyle(c,ut,ht,ni)),gt&&w>0&&b>0&&(tt=gt.find(a,v,o),tt&&(nt||(nt=new n._FilterButtonInfoModel),nt.push(new n._FilterButtonInfo(tt.rowFilter,tt.row,tt.col,tt.sheetArea,y,p,w,b)))),ui&&!c.isValid(a,v,ht)&&pt.push({x:y,y:p,width:w,height:b}),yt.addCellLines(a,v,y,p,w,b,ut,l),ct.push({data:ht,row:a,col:v,x:y,y:p,width:w,height:b,style:ut}),l&&dt.push(l)));ct.length>0&&(ri&&(ti=st.getCellOverflowBuilder(u,f,function(){return new e(c,u,f)}),g.buildCellOverflowValueLayout(ti,ct,yt)),g.paintCells(i,ct,o,h));nt&&nt.length>0&&g._paintFilterButtons(i,nt);yt.paint(i,s);lt.length>0&&g._paintDoubleGridLines(i,lt,1,3);pt.length>0&&g._paintValidationUI(i,pt);i.restore()}},o.prototype._paintDoubleGridLines=function(n,t,i,r){var h,y;if(t.length!==0)for(h=0,y=t.length;h<y;h++){var s=t[h],u=s.x1,f=s.y1,e=s.x2,o=s.y2,c=s.horizontal;if(n.beginPath(),n.save(),n.lineWidth=i,n.strokeStyle=this._getHeaderGridLineColor(n,c,u,f,e,o),n.fillStyle=this._getHeaderBackColor(n,c,u,f,e,o),c){var l=-3,p=1,w=-1,b=-2;n.fillRect(u,f+l,e-u-1,r+2*i);n.translate(.5,.5);n.moveTo(u+w,f+l);n.lineTo(e+b,o+l);n.moveTo(u+w,f+p);n.lineTo(e+b,o+p)}else{var a=-3,k=1,v=0,d=-1;n.fillRect(u+a,f+v,r+2*i,o-f-1);n.translate(.5,.5);n.moveTo(u+a,f+v);n.lineTo(e+a,o+d);n.moveTo(u+k,f+v);n.lineTo(e+k,o+d)}n.stroke();n.restore()}},o.prototype._getHeaderBackColor=function(t,i,r,u,f,e){var o,p=i?"rowHeader":"columnHeader",s=n.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-"+p+"-normal"),v=s&&s.backgroundColor,c=s&&s.backgroundImage,l,h,y,a;if(!i&&c&&c.indexOf("linear-gradient")!==-1)for(l=n.util.getLinearGradientColors(c),o=t.createLinearGradient(r,u,f,e),h=0,y=l.length;h<y;h++)a=l[h],o.addColorStop(a.point,a.color);else v&&(o=v);return o},o.prototype._getHeaderGridLineColor=function(t,i,r,u,f,e){var o=t.createLinearGradient(r,u,f,e),h=i?"rowHeader":"columnHeader",s=n.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-"+h+"-normal");return i?(o.addColorStop(0,s.borderTopColor),o.addColorStop(1,s.borderBottomColor)):(o.addColorStop(0,s.borderLeftColor),o.addColorStop(1,s.borderRightColor)),o},o.prototype._getFilterButtonRect=function(n,t){var i=this._sheet,e=i._zoomFactor,h=e>1?1:e,o=t===3||typeof t===r?i.defaults.rowHeight:i.defaults.colHeaderRowHeight,f=parseInt((u(20,o)*h).toString(),10);i.parent&&i.parent.useTouchLayout()&&(f=parseInt((o*e).toString(),10));var s=f,c=n.x+n.width-f,l=n.y+n.height-s;return{x:c,y:l,width:f,height:s}},o.prototype._paintFilterButtons=function(t,i){var a=this._sheet,v,u;for(t.save(),t.beginPath(),t.lineWidth=1,t.fillStyle="#FFFFFF",t.strokeStyle="#CCCCCC",v=this._getCtx(),u=0;u<i.length;u++){var r=i[u],f=this._getFilterButtonRect(new n.Rect(r.x,r.y,r.width,r.height),r.sheetArea),e=f.width,o=f.height,s=f.x,h=f.y;t.save();t.rect(r.x,r.y,r.width,r.height);t.clip();t.beginPath();t.fillRect(s+1,h+1,e-3,o-3);t.strokeRect(s+1-.5,h+2-.5,e-3,o-4);var y=r.getState(),c=n._GcFilterDialog.getImageSrc(y),l=a._getImageLoader();try{l.getState(c)?t.drawImage(l.getImage(c),s,h+1,e-3,o-3):l.addImage(c)}catch(p){}t.beginPath();t.restore()}t.restore()},o.prototype._paintValidationUI=function(n,t){var y,e;if(t)for(y=t.length,e=0;e<y;e++){var o=t[e],r=o.x-4,f=o.y-4,c=o.width+8,l=o.height+8,p=.5522848,s=c/2*p,h=l/2*p,a=r+c,v=f+l,u=r+c/2,i=f+l/2;n.save();n.lineWidth=2;n.strokeStyle="red";n.beginPath();n.moveTo(r,i);n.bezierCurveTo(r,i-h,u-s,f,u,f);n.bezierCurveTo(u+s,f,a,i-h,a,i);n.bezierCurveTo(a,i+h,u+s,v,u,v);n.bezierCurveTo(u-s,v,r,i+h,r,i);n.closePath();n.stroke();n.restore()}},o.prototype.paintCells=function(r,u,f,e){var ut=this,o=ut._sheet,yt=f===3,ot=n.StyleHelper._scaleFont,pt=o._zoomFactor,wt=ot(ut._getDefaultFont(f),pt),bt=o.getDefaultStyle(f),ni=o.getDefaultCellType(f),ti=o._conditionalFormats,tt=o.parent&&o.parent.backColor()||"#FFFFFF",kt,ct,it,lt,at,vt,rt,y;tt=tt==="white"?"#FFFFFF":tt;kt=o._getImageLoader();r.save();r.beginPath();r.fillStyle=bt&&bt.foreColor||"#000000";r.font=wt.font;r.textAlign=yt?"right":"center";var ft=u.length,c,w,b,k,d,g,nt,a,p,s,et,dt,v,st,gt,ii=n.features.sparkline,ri=o._getModel(f),ht=[],l,h={sheet:o,row:-1,col:-1,fontInfo:t,lineHeight:-1,imageLoader:kt,conditionalFormats:ti,sheetArea:f,parentBackColor:tt};for(y=0;y<ft;y++){if(c=u[y],b=c.data,k=c.row,d=c.col,g=c.x,nt=c.y,a=c.width,p=c.height,s=c.style,et=c.cellOverflowLayout,v=s.font?ot(s.font,pt):wt,ct=!s.wordWrap&&s.shrinkToFit,ct&&(it=o.getText(k,d,f),s.watermark&&!it&&(it=s.watermark),it))for(lt={value:!1},at=0;at<3&<.value===!1;at++)if(vt=o._getStringWidthByCanvas(it,v.font),rt=i(0,a-4),s.hAlign!==1&&s.textIndent&&(rt=i(0,rt-s.textIndent*8)),rt<vt)v=ot(v.font,rt/vt,lt,!0);else break;s.font=v.font;a>0&&p>0&&(w=s.cellType||ni,g--,nt--,a++,p++,yt?(gt=ii&&ri.getSparkline(k,d),h.sparkline=gt):(dt=e?0:ut.getVisualState(k,d,f),h.visualState=dt),st=o._getFontHeight(v.font,ct),h.lineHeight=st,h.row=k,h.col=d,h.fontInfo=v,h.cellOverflowLayout=et,w.paint(r,b,g,nt,a,p,s,h),et&&!h.showBarIconOnly&&ht.push({cellType:w,data:b,x:g,y:nt,width:a,height:p,style:s,options:{sheet:o,row:k,col:d,fontInfo:v,lineHeight:st,cellOverflowLayout:et,parentBackColor:tt}}));!e&&n.features.comment&&o._commentManager.hasComment()&&ut._paintCommentCellAdorner(r,f,c)}if(ft=ht.length,ft>0){var ui=o.isEditing(),fi=o._activeRowIndex,ei=o._activeColIndex,oi=n.features.sparklineEx;for(y=0;y<ft;y++)(l=ht[y],w=l.cellType,b=l.data,g=l.x,nt=l.y,a=l.width,p=l.height,s=l.style,h=l.options,ui&&h.row===fi&&h.col===ei)||oi&&b instanceof n.SparklineExValue||w.paintValue&&w.paintValue(r,b,g,nt,a,p,s,h)}r.restore()},o.prototype.getVisualState=function(i,u,f){var e=this._sheet,o=0;return(n.FocusHelper.isActiveElement(e)||e.parent&&!e.parent.hideSelection())&&(f===3||typeof f===r||f===t?!e.isEditing()&&e._isActiveCell(i,u)?o=3:e._isSelected(i,u,f)&&(o=2):(e._isSelected(i,u,f)&&(o=1,e._isAllSelected(i,u,f)&&(o=2)),e._isHover(i,u,f)&&(o=4))),o},o.prototype.paintLine=function(n,t,i,r,u,f){n.lineWidth=t.width();n.strokeStyle=t.color;n.moveTo(i,r);n.lineTo(u,f)},o.prototype.paintGroup=function(t,i){var r=this._sheet,u=r._getGroupLayout(),h,e,c,o,l,s,f;if(u.width!==0||u.height!==0){if(t.save(),t.beginPath(),h=r._getSheetLayout(),u.width>0&&(!i||i.intersect(u.x,u.y,u.width,h.height)))for(e=u.rowMaxLevel,c=new n._RangeGroupHeaderPresenter(r,!0,e),c.paintGroupHeader(t),s=r._cachePool.getRowGroups(function(){for(var i=[new n._RangeGroupPresenter(r,!0,0,e),new n._RangeGroupPresenter(r,!0,1,e),new n._RangeGroupPresenter(r,!0,2,e)],t=0;t<=2;t++)i[t].createGroupInfo();return i}),f=0;f<=2;f++)s[f].paintGroups(t);if(u.height>0&&(!i||i.intersect(u.x,u.y,h.width,u.height)))for(o=u.colMaxLevel,l=new n._RangeGroupHeaderPresenter(r,!1,o),l.paintGroupHeader(t),s=r._cachePool.getColGroups(function(){for(var i=[new n._RangeGroupPresenter(r,!1,0,o),new n._RangeGroupPresenter(r,!1,1,o),new n._RangeGroupPresenter(r,!1,2,o)],t=0;t<=2;t++)i[t].createGroupInfo();return i}),f=0;f<=2;f++)s[f].paintGroups(t);t.beginPath();t.restore()}},o.prototype.groupHitTest=function(i,r){var e,u,a,l,s,o,f,h,p,v,c,w,y;if(!n.features.group||(e=this._sheet,u=e._getGroupLayout(),u.width===0&&u.height===0)||(a=e._getSheetLayout(),l=new n.Rect(u.x,u.y,u.width,a.height),!l.contains(i,r)&&(l=new n.Rect(u.x,u.y,a.width,u.height),!l.contains(i,r))))return t;if(s={what:"empty",info:t},u.width>0&&(h=u.rowMaxLevel,p=new n._RangeGroupHeaderPresenter(e,!0,h),f=p.getGroupButton(i,r),f&&(s={what:"rgh",info:f}),s.what==="empty"))for(v=[new n._RangeGroupPresenter(e,!0,0,h),new n._RangeGroupPresenter(e,!0,1,h),new n._RangeGroupPresenter(e,!0,2,h)],o=0;o<=2;o++)if(v[o].createGroupInfo(),f=v[o].getRowGroupButton(i,r),f){s={what:"rg",info:f};break}if(u.height>0&&(c=u.colMaxLevel,s.what==="empty"&&(w=new n._RangeGroupHeaderPresenter(e,!1,c),f=w.getGroupButton(i,r),f&&(s={what:"cgh",info:f})),s.what==="empty"))for(y=[new n._RangeGroupPresenter(e,!1,0,c),new n._RangeGroupPresenter(e,!1,1,c),new n._RangeGroupPresenter(e,!1,2,c)],o=0;o<=2;o++)if(y[o].createGroupInfo(),f=y[o].getColGroupButton(i,r),f){s={what:"cg",info:f};break}return s},o.prototype.buildCellOverflowValueLayout=function(t,i,r){for(var tt,ft,v,b,ht,ct,et,y=this._sheet,ot=y._cachePool,at=i.length,l,k,d,f,e,it,p,c,w,h,a,lt,g,nt,o,s,u,st={},rt=[],ut=0;ut<at;ut++){if(l=i[ut],f=l.row,e=l.col,it=l.x,p=l.y,w=l.height,nt=t.getCellOverflowLayoutModel(f),o=nt.headingOverflowlayout,s=nt.trailingOverflowLayout,!st[f]){for(tt={},ft=0;ft<nt.length;ft++)tt[nt[ft].column]=!1;o&&(tt[o.column]=!1);s&&(tt[s.column]=!1);st[f]=tt}v=st[f];u=nt.find(e);u?(u.column===e?(c=l.width,h=u.backgroundWidth,a=u.backgroundLeftWidth<0?it:u.backgroundRightWidth<0?it+c-h:it+c/2-u.backgroundLeftWidth,l.cellOverflowLayout=u,v[u.column]&&rt.push(ut)):v[u.column]||(e=u.column,d=ot.getActualStyle(f,e),k=y.getValue(f,e),c=u.columnWidth,h=u.backgroundWidth,b=y.getCellRect(f,u.column),a=u.backgroundLeftWidth<0?b.x:u.backgroundRightWidth<0?b.x+b.width-h:b.x+b.width/2-u.backgroundLeftWidth,g={data:k,row:f,col:e,x:b.x,y:p,width:c,height:w,style:d,cellOverflowLayout:u},i.push(g)),u.layout=new n.Rect(a,p,h,w),r.addCellOverlfowLayout(f,u),v[u.column]=!0):o&&!v[o.column]&&o.contains(e)?(e=o.column,d=ot.getActualStyle(f,e),k=y.getValue(f,e),c=o.columnWidth,h=o.backgroundWidth,ht=y.getCellRect(f,o.endColumn),a=ht.x+ht.width-h,g={data:k,row:f,col:e,x:a,y:p,width:c,height:w,style:d,cellOverflowLayout:o},i.push(g),o.layout=new n.Rect(a,p,h,w),r.addCellOverlfowLayout(f,o),v[o.column]=!0):s&&!v[s.column]&&s.contains(e)&&(e=s.column,d=ot.getActualStyle(f,e),k=y.getValue(f,e),c=s.columnWidth,h=s.backgroundWidth,ct=y.getCellRect(f,s.startColumn),a=ct.x,lt=ct.x+h-c,g={data:k,row:f,col:e,x:lt,y:p,width:c,height:w,style:d,cellOverflowLayout:s},i.push(g),s.layout=new n.Rect(a,p,h,w),r.addCellOverlfowLayout(f,s),v[s.column]=!0)}if(rt.length>0)for(et=rt.length-1;et>=0;et--)i.splice(rt[et],1)},o}();n._SheetRender=c;e=function(){function i(t,i,r){this.TEXT_WIDTH_OFFSET=2;var u=this;u._sheet=t;u._rowViewportIndex=i;u._colViewportIndex=r;u._colLayoutModel=t._getColumnLayout(r);u._cellLayoutModel=t._getCellLayout(i,r);u.maxCellOverflowDistance=t.maxCellOverflowDistance;u.scaleFont=n.StyleHelper._scaleFont;u.zoomFactor=t._zoomFactor;u.defaultFont=u.scaleFont(t._render._getDefaultFont(),u.zoomFactor).font;u.defaultCellType=t.getDefaultCellType();u.cachedCellOverflowModels={}}return i.prototype.getCellOverflowLayoutModel=function(i){var f=this,b=f.cachedCellOverflowModels[i],y;if(b)return b;var k=f._sheet,p=k._cachePool,l=f._colLayoutModel,d=l.length,g=l[0].col,nt=l[d-1].col,w,s,u,o,a,h,v,c=new n._CellOverflowLayoutModel,e;for(c.headingOverflowlayout=f._buildHeadingCellOverflowLayout(i),y=0;y<d;y++)(w=l[y],w.width<=0)||(s=w.col,o=p.getValue(i,s),u=p.getActualStyle(i,s),o!==t&&typeof o!==r||u.watermark)&&(u.shrinkToFit||u.wordWrap||(a=p.getZoomColWidth(s),v=n._CacheMgr.getFormattedTextByStyle(k,u,o),h=u.hAlign,h===3&&(h=n.util.getHAlignByValueType(h,o,u.formatter)),h===0?(e=f._buildCellOverflowLayoutModelForLeft({data:o,style:u,width:a,text:v},i,s,nt),e&&c.push(e)):h===2?(e=f._buildCellOverflowLayoutModelForRight({data:o,style:u,width:a,text:v},i,s,g),e&&c.push(e)):h===1&&(e=f._buildCellOverflowLayoutModelForCenter({data:o,style:u,width:a,text:v},i,s,g,nt),e&&c.push(e))));return c.trailingOverflowLayout=f._buildTrailingCellOverflowLayout(i),f.cachedCellOverflowModels[i]=c,c},i.prototype._buildCellOverflowLayoutModelForLeft=function(i,u,f,e){var s=this,tt=s._sheet,p=tt._cachePool,k=s._cellLayoutModel,it=i.width,c=i.width,w=i.data,h=i.style,o,a=i.text,v,d,g,l,b,nt,y;if(k.findCell(u,f)!==t||(g=h.cellType||s.defaultCellType,!g.allowOverflow)||!a&&!h.watermark||(!a&&h.watermark&&(a=h.watermark),l=h.font,b=h.textIndent,l=l?s.scaleFont(l,s.zoomFactor).font:s.defaultFont,v=n._WordWrapHelper._measureText(a,l)+(b?b*8:0)+s.TEXT_WIDTH_OFFSET,v<=c))return t;for(nt=f,y=f,o=f+1;o<=e;o++){if(k.findCell(u,o)!==t)break;if(w=p.getValue(u,o),w!==t&&typeof w!==r)break;if(d=p.getActualStyle(u,o),d.watermark)break;if(y=o,c+=p.getZoomColWidth(o),v<=c)break}return y==f?t:new n._CellOverflowLayout(f,nt,y,v,it,c,-1,c)},i.prototype._buildCellOverflowLayoutModelForRight=function(i,u,f,e){var s=this,tt=s._sheet,p=tt._cachePool,k=s._cellLayoutModel,it=i.width,c=i.width,w=i.data,h=i.style,rt,o,a=i.text,v,d,g,l,b,y,nt;if(k.findCell(u,f)!==t||(g=h.cellType||s.defaultCellType,!g.allowOverflow)||!a&&!h.watermark||(!a&&h.watermark&&(a=h.watermark),l=h.font,b=h.textIndent,l=l?s.scaleFont(l,s.zoomFactor).font:s.defaultFont,v=n._WordWrapHelper._measureText(a,l)+(b?b*8:0)+s.TEXT_WIDTH_OFFSET,v<=c))return t;for(y=f,nt=f,o=f-1;o>=e;o--){if(k.findCell(u,o)!==t)break;if(w=p.getValue(u,o),w!==t&&typeof w!==r)break;if(d=p.getActualStyle(u,o),d.watermark)break;if(y=o,c+=p.getZoomColWidth(o),v<=c)break}return y==f?t:new n._CellOverflowLayout(f,y,nt,v,it,c,c,-1)},i.prototype._buildCellOverflowLayoutModelForCenter=function(i,u,f,e,o){var h=this,ut=h._sheet,a=ut._cachePool,g=h._cellLayoutModel,ft=i.width,nt=i.width,c=i.data,l=i.style,s,b=i.text,v,it,rt,y,tt,k,p,d,w;if(g.findCell(u,f)!==t||(rt=l.cellType||h.defaultCellType,!rt.allowOverflow)||!b&&!l.watermark||(!b&&l.watermark&&(b=l.watermark),y=l.font,tt=l.textIndent,y=y?h.scaleFont(y,h.zoomFactor).font:h.defaultFont,v=n._WordWrapHelper._measureText(b,y)+(tt?tt*8:0)+h.TEXT_WIDTH_OFFSET,v<=nt))return t;for(k=f,p=nt/2,s=f-1;s>=e;s--){if(g.findCell(u,s)!==t)break;if(c=a.getValue(u,s),c!==t&&typeof c!==r)break;if(it=a.getActualStyle(u,s),it.watermark)break;if(k=s,p+=a.getZoomColWidth(s),v/2<=p)break}for(d=f,w=nt/2,s=f+1;s<=o;s++){if(g.findCell(u,s)!==t)break;if(c=a.getValue(u,s),c!==t&&typeof c!==r)break;if(d=s,w+=a.getZoomColWidth(s),v/2<=w)break}return k===d?t:new n._CellOverflowLayout(f,k,d,v,ft,p+w,p,w)},i.prototype._buildHeadingCellOverflowLayout=function(i){for(var w,h=this,a=h._sheet,v=a._cachePool,y=h._colLayoutModel,c=y[0].col,b=y[y.length-1].col,k=a._getSpanModel(),s,e,l,o,d=h.maxCellOverflowDistance,g=c,u,f,p=1;p<d;p++){if((u=g-p,u<0)||k.find(i,u))return t;if(e=v.getValue(i,u),l=v.getZoomColWidth(u),l>0&&e!==t&&typeof e!==r){if(s=v.getActualStyle(i,u),o=s.hAlign,o===3&&(o=n.util.getHAlignByValueType(o,e)),(o===0||o===1)&&s&&(w=n._CacheMgr.getFormattedTextByStyle(a,s,e)),o===0){if(f=h._buildCellOverflowLayoutModelForLeft({data:e,style:s,width:l,text:w},i,u,b),f&&f.endColumn>=c)return f}else if(1&&(f=h._buildCellOverflowLayoutModelForCenter({data:e,style:s,width:l,text:w},i,u,c,b),f&&f.endColumn>=c))return f;return t}}},i.prototype._buildTrailingCellOverflowLayout=function(i){for(var w,h=this,c=h._sheet,v=c._cachePool,y=h._colLayoutModel,b=y[0].col,l=y[y.length-1].col,k=c._getSpanModel(),s,e,a,o,d=h.maxCellOverflowDistance,g=c.getColumnCount(),nt=l,u,f,p=1;p<d;p++){if((u=nt+p,u>=g)||k.find(i,u))return t;if(e=v.getValue(i,u),a=v.getZoomColWidth(u),a>0&&e!==t&&typeof e!==r){if(s=v.getActualStyle(i,u),o=s.hAlign,o===3&&(o=n.util.getHAlignByValueType(o,e)),(o===2||o===1)&&s&&(w=n._CacheMgr.getFormattedTextByStyle(c,s,e)),o===2){if(f=h._buildCellOverflowLayoutModelForRight({data:e,style:s,width:a,text:w},i,u,b),f&&f.startColumn<=l)return f}else if(1&&(f=h._buildCellOverflowLayoutModelForCenter({data:e,style:s,width:a,text:w},i,u,b,l),f&&f.startColumn<=l))return f;return t}}},i}();n._CellOverflowLayoutBuilder=e;o=function(){function i(n){this._needPaintIndicator=!1;this._eventNS=".cutCopyIndicator";this._isPastedInternal=!1;this._ch=t;this._sheet=n;this._bindEvents()}return i.prototype.isPastedInternal=function(n){var t=this;if(arguments.length===0)return t._isPastedInternal;typeof n=="boolean"&&(t._isPastedInternal=n)},i.prototype.needPaintIndicator=function(n){var t=this,i;if(arguments.length===0)return t._needPaintIndicator;if(typeof n=="boolean"){if(t._needPaintIndicator===n&&n===!1)return t;t._needPaintIndicator=n;i=t._sheet;i&&i.invalidate()}return t},i.prototype.getClipboardHelper=function(){var n=this,t=n._sheet;return t&&!n._ch&&(n._ch=t._getClipboardHelper()),n._ch},i.prototype._bindEvents=function(){var t=this,i=t._sheet,r=!1;i&&(i._bind(n.Events.ClipboardChanged+t._eventNS,function(n,i){t.needPaintIndicator(!0)}),i._bind(n.Events.ValueChanged+t._eventNS,function(n,i){t.needPaintIndicator(!1)}),i._eventHandler.bind(n.Events.CellChanged+t._eventNS,function(n,i){t.needPaintIndicator(!1)}),i._bind(n.Events.ColumnChanged+t._eventNS,function(n,i){i.propertyName!=="resizable"&&i.propertyName!=="width"&&i.propertyName!=="isVisible"&&t.needPaintIndicator(!1)}),i._bind(n.Events.RowChanged+t._eventNS,function(n,i){i.propertyName!=="resizable"&&i.propertyName!=="height"&&i.propertyName!=="isVisible"&&t.needPaintIndicator(!1)}),i._bind(n.Events.RangeChanged+t._eventNS,function(n,i){t.needPaintIndicator(!1)}),i._bind(n.Events.ClipboardPasting+t._eventNS,function(n,i){r=t.needPaintIndicator()}),i._bind(n.Events.ClipboardPasted+t._eventNS,function(n,i){var u=i.cellRange,e=i.sheet,f=t.getClipboardHelper();u&&f&&f.range&&f.fromSheet&&e&&(f.range.intersect(u.row,u.col,u.rowCount,u.colCount)||!t.isPastedInternal()?t.needPaintIndicator(!1):t.needPaintIndicator(r))}))},i.prototype.paintCutCopyIndicator=function(t,i,r,u){var l,a;if(this._needPaintIndicator){var e=this._sheet,c=e._render,s=this.getClipboardHelper(),f=e.parent,v=f&&f.cutCopyIndicatorVisible?f.cutCopyIndicatorVisible():!0;if(v&&s&&s.fromSheet===e&&s.range){var y=e._getSheetLayout(),o=y.viewportRect(r,u),h=c._getPaintingRects(r,u,[s.range],i)[0];h&&o&&(t.save(),t.rect(o.x,o.y,o.width,o.height),t.clip(),h&&(l=f&&f.cutCopyIndicatorBorderColor?f.cutCopyIndicatorBorderColor():"blue",a=n._ThemeContext.getColor(e,l),c.paintDashRect(t,h,a)),t.beginPath(),t.restore())}}},i.prototype.addRows=function(){this._needPaintIndicator&&this.needPaintIndicator(!1)},i.prototype.deleteRows=function(){this._needPaintIndicator&&this.needPaintIndicator(!1)},i.prototype.addColumns=function(){this._needPaintIndicator&&this.needPaintIndicator(!1)},i.prototype.deleteColumns=function(){this._needPaintIndicator&&this.needPaintIndicator(!1)},i.prototype.cancelIndicator=function(){this._needPaintIndicator&&this.needPaintIndicator(!1)},i.prototype._dispose=function(){var t=this._sheet,i=this._eventNS;t._eventHandler.unbind(n.Events.CellChanged+i);t._unbind(n.Events.ClipboardChanged+i);t._unbind(n.Events.ValueChanged+i);t._unbind(n.Events.CellChanged+i);t._unbind(n.Events.ColumnChanged+i);t._unbind(n.Events.RowChanged+i);t._unbind(n.Events.RangeChanged+i);t._unbind(n.Events.ClipboardPasting+i);t._unbind(n.Events.ClipboardPasted+i)},i}();n.CutCopyIndicatorManager=o})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){var ut,ft;n.feature("core.sheet_ui",["core.common"]);var rt=undefined,t="backColor",i="foreColor",r="hAlign",u="vAlign",f="themeFont",e="font",o="formatter",s="borderLeft",h="borderTop",c="borderRight",l="borderBottom",a="locked",v="textIndent",y="wordWrap",p="shrinkToFit",w="backgroundImage",b="backgroundImageLayout",k="validator",d="cellType",ot="bindingPath",g="tabStop",nt="textDecoration",tt="imeMode",it="watermark",et=function(){function ut(n,t,i,r){var u=this;u.sheet=n;u.row=t;u.row2=t;u.col=i;u.col2=i;(r===rt||r===null)&&(r=3);u.sheetArea=r}return ut.prototype.value=function(n){var t=this,i,r;if(arguments.length===0)return t.sheet.getValue(t.row,t.col,t.sheetArea);else{for(i=t.row;i<=t.row2;i++)for(r=t.col;r<=t.col2;r++)t._isValidIndex(i,r)&&t.sheet.setValue(i,r,n,t.sheetArea);return t}},ut.prototype.text=function(n){var t=this,i,r;if(arguments.length===0)return t.sheet.getText(t.row,t.col,t.sheetArea);else{for(i=t.row;i<=t.row2;i++)for(r=t.col;r<=t.col2;r++)t._isValidIndex(i,r)&&t.sheet.setText(i,r,n,t.sheetArea);return t}},ut.prototype.formula=function(n){var t=this,i,r;if(arguments.length===0)return t.sheet.getFormula(t.row,t.col,t.sheetArea);else{for(i=t.row;i<=t.row2;i++)for(r=t.col;r<=t.col2;r++)t._isValidIndex(i,r)&&t.sheet.setFormula(i,r,n,t.sheetArea);return t}},ut.prototype.bindingPath=function(n){var t=this,i,r;if(arguments.length===0)return t.sheet.getBindingPath(t.row,t.col,t.sheetArea);else{for(i=t.row;i<=t.row2;i++)for(r=t.col;r<=t.col2;r++)t._isValidIndex(i,r)&&t.sheet.setBindingPath(i,r,n,t.sheetArea);return t}},ut.prototype.comment=function(n){var t=this,i,r;if(arguments.length===0)return t.sheet.getComment(t.row,t.col);else{for(i=t.row;i<=t.row2;i++)for(r=t.col;r<=t.col2;r++)t._isValidIndex(i,r)&&t.sheet.setComment(i,r,n);return t}},ut.prototype.tag=function(n){var t=this,i,r;if(arguments.length===0)return t.sheet.getTag(t.row,t.col,t.sheetArea);else{for(i=t.row;i<=t.row2;i++)for(r=t.col;r<=t.col2;r++)t._isValidIndex(i,r)&&t.sheet.setTag(i,r,n,t.sheetArea);return t}},ut.prototype.dataValidator=function(n){return arguments.length==0?this._getStyleProperty(k):this._setStyleProperty(k,n)},ut.prototype.cellType=function(n){return arguments.length==0?this._getStyleProperty(d):this._setStyleProperty(d,n)},ut.prototype.backgroundImage=function(n){return arguments.length==0?this._getStyleProperty(w):this._setStyleProperty(w,n)},ut.prototype.backgroundImageLayout=function(n){return arguments.length==0?this._getStyleProperty(b):this._setStyleProperty(b,n)},ut.prototype.backColor=function(n){return arguments.length===0?this._getStyleProperty(t):this._setStyleProperty(t,n)},ut.prototype.foreColor=function(n){return arguments.length===0?this._getStyleProperty(i):this._setStyleProperty(i,n)},ut.prototype.hAlign=function(n){return arguments.length===0?this._getStyleProperty(r):this._setStyleProperty(r,n)},ut.prototype.vAlign=function(n){return arguments.length===0?this._getStyleProperty(u):this._setStyleProperty(u,n)},ut.prototype.themeFont=function(n){return arguments.length===0?this._getStyleProperty(f):this._setStyleProperty(f,n)},ut.prototype.font=function(n){return arguments.length===0?this._getStyleProperty(e):this._setStyleProperty(e,n)},ut.prototype.formatter=function(n){return arguments.length===0?this._getStyleProperty(o):this._setStyleProperty(o,n)},ut.prototype.borderLeft=function(n){return arguments.length===0?this._getStyleProperty(s):this._setStyleProperty(s,n)},ut.prototype.borderTop=function(n){return arguments.length===0?this._getStyleProperty(h):this._setStyleProperty(h,n)},ut.prototype.borderRight=function(n){return arguments.length===0?this._getStyleProperty(c):this._setStyleProperty(c,n)},ut.prototype.borderBottom=function(n){return arguments.length===0?this._getStyleProperty(l):this._setStyleProperty(l,n)},ut.prototype.locked=function(n){return arguments.length===0?this._getStyleProperty(a):this._setStyleProperty(a,n)},ut.prototype.textIndent=function(n){return arguments.length===0?this._getStyleProperty(v):this._setStyleProperty(v,n)},ut.prototype.wordWrap=function(n){return arguments.length===0?this._getStyleProperty(y):this._setStyleProperty(y,n)},ut.prototype.shrinkToFit=function(n){return arguments.length===0?this._getStyleProperty(p):this._setStyleProperty(p,n)},ut.prototype.tabStop=function(n){return arguments.length===0?this._getStyleProperty(g):this._setStyleProperty(g,n)},ut.prototype.textDecoration=function(n){return arguments.length===0?this._getStyleProperty(nt):this._setStyleProperty(nt,n)},ut.prototype.watermark=function(n){return arguments.length===0?this._getStyleProperty(it):this._setStyleProperty(it,n)},ut.prototype.imeMode=function(n){return arguments.length===0?this._getStyleProperty(tt):this._setStyleProperty(tt,n)},ut.prototype.clearStyleProperty=function(n){for(var i,u,t=this,r=t.row;r<=t.row2;r++)for(i=t.col;i<=t.col2;i++)t._isValidIndex(r,i)&&(u=t.sheet.getStyleImp(r,i,t.sheetArea),u&&u.clear(n))},ut.prototype._getStyleProperty=function(n){var t=this;return t.sheet.getStyleProperty(t.row,t.col,n,t.sheetArea)},ut.prototype._setStyleProperty=function(t,i){for(var u,e,r=this,f=r.row;f<=r.row2;f++)for(u=r.col;u<=r.col2;u++)r._isValidIndex(f,u)&&(e=r.sheet.getStyleImp(f,u,r.sheetArea),e||(e=new n.Style),e[t]=i,r.sheet.setStyle(f,u,e,r.sheetArea));return r},ut.prototype._isValidIndex=function(n,t){var r=this,i=r.sheet,u=r.sheetArea,f,e;return i&&(f=i.getRowCount(u),e=i.getColumnCount(u),0<=n&&n<f&&0<=t&&t<e)?!0:!1},ut}();n.Cell=et;ut=function(){function ut(n,t,i){var r=this;r.sheet=n;r.index=t;r.index2=t;(i===rt||i===null)&&(i=3);r.sheetArea=i}return ut.prototype.height=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getRowHeight(t.index,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setRowHeight(i,n,t.sheetArea);return t}},ut.prototype.visible=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getRowVisible(t.index,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setRowVisible(i,n,t.sheetArea);return t}},ut.prototype.resizable=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getRowResizable(t.index,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setRowResizable(i,n,t.sheetArea);return t}},ut.prototype.dataValidator=function(n){return arguments.length==0?this._getStyleProperty(k):this._setStyleProperty(k,n)},ut.prototype.cellType=function(n){return arguments.length==0?this._getStyleProperty(d):this._setStyleProperty(d,n)},ut.prototype.backgroundImage=function(n){return arguments.length==0?this._getStyleProperty(w):this._setStyleProperty(w,n)},ut.prototype.backgroundImageLayout=function(n){return arguments.length==0?this._getStyleProperty(b):this._setStyleProperty(b,n)},ut.prototype.backColor=function(n){return arguments.length===0?this._getStyleProperty(t):this._setStyleProperty(t,n)},ut.prototype.foreColor=function(n){return arguments.length===0?this._getStyleProperty(i):this._setStyleProperty(i,n)},ut.prototype.hAlign=function(n){return arguments.length===0?this._getStyleProperty(r):this._setStyleProperty(r,n)},ut.prototype.vAlign=function(n){return arguments.length===0?this._getStyleProperty(u):this._setStyleProperty(u,n)},ut.prototype.themeFont=function(n){return arguments.length===0?this._getStyleProperty(f):this._setStyleProperty(f,n)},ut.prototype.font=function(n){return arguments.length===0?this._getStyleProperty(e):this._setStyleProperty(e,n)},ut.prototype.formatter=function(n){return arguments.length===0?this._getStyleProperty(o):this._setStyleProperty(o,n)},ut.prototype.borderLeft=function(n){return arguments.length===0?this._getStyleProperty(s):this._setStyleProperty(s,n)},ut.prototype.borderTop=function(n){return arguments.length===0?this._getStyleProperty(h):this._setStyleProperty(h,n)},ut.prototype.borderRight=function(n){return arguments.length===0?this._getStyleProperty(c):this._setStyleProperty(c,n)},ut.prototype.borderBottom=function(n){return arguments.length===0?this._getStyleProperty(l):this._setStyleProperty(l,n)},ut.prototype.locked=function(n){return arguments.length===0?this._getStyleProperty(a):this._setStyleProperty(a,n)},ut.prototype.textIndent=function(n){return arguments.length===0?this._getStyleProperty(v):this._setStyleProperty(v,n)},ut.prototype.wordWrap=function(n){return arguments.length===0?this._getStyleProperty(y):this._setStyleProperty(y,n)},ut.prototype.shrinkToFit=function(n){return arguments.length===0?this._getStyleProperty(p):this._setStyleProperty(p,n)},ut.prototype.tabStop=function(n){return arguments.length===0?this._getStyleProperty(g):this._setStyleProperty(g,n)},ut.prototype.textDecoration=function(n){return arguments.length===0?this._getStyleProperty(nt):this._setStyleProperty(nt,n)},ut.prototype.imeMode=function(n){return arguments.length===0?this._getStyleProperty(tt):this._setStyleProperty(tt,n)},ut.prototype.watermark=function(n){return arguments.length===0?this._getStyleProperty(it):this._setStyleProperty(it,n)},ut.prototype.clearStyleProperty=function(n){for(var u,f,t=this,r=t.sheet,i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&(u=r.getStyleImp(i,-1,t.sheetArea),u&&(f=u[n],u.clear(n),r.triggerRowChanged({sheet:r,sheetName:r._name,row:i,sheetArea:t.sheetArea,propertyName:n,oldValue:f})))},ut.prototype.tag=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getTag(t.index,-1,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setTag(i,-1,n,t.sheetArea);return t}},ut.prototype._getStyleProperty=function(n){var t=this.sheet.getStyleImp(this.index,-1,this.sheetArea);return t?t[n]:rt},ut.prototype._setStyleProperty=function(t,i){for(var f,r=this,u=r.index;u<=r.index2;u++)r._isValidIndex(u)&&(f=r.sheet.getStyleImp(u,-1,r.sheetArea),f||(f=new n.Style),f[t]=i,r.sheet.setStyle(u,-1,f,r.sheetArea));return r},ut.prototype._isValidIndex=function(n){if(this.sheet){var t=this.sheet.getRowCount(this.sheetArea);if(0<=n&&n<t)return!0}return!1},ut}();n.Row=ut;ft=function(){function ut(n,t,i){var r=this;r.sheet=n;r.index=t;r.index2=t;(i===rt||i===null)&&(i=3);r.sheetArea=i}return ut.prototype.width=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getColumnWidth(t.index,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setColumnWidth(i,n,t.sheetArea);return t}},ut.prototype.visible=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getColumnVisible(t.index,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setColumnVisible(i,n,t.sheetArea);return t}},ut.prototype.resizable=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getColumnResizable(t.index,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setColumnResizable(i,n,t.sheetArea);return t}},ut.prototype.dataValidator=function(n){return arguments.length==0?this._getStyleProperty(k):this._setStyleProperty(k,n)},ut.prototype.cellType=function(n){return arguments.length==0?this._getStyleProperty(d):this._setStyleProperty(d,n)},ut.prototype.backgroundImage=function(n){return arguments.length==0?this._getStyleProperty(w):this._setStyleProperty(w,n)},ut.prototype.backgroundImageLayout=function(n){return arguments.length==0?this._getStyleProperty(b):this._setStyleProperty(b,n)},ut.prototype.backColor=function(n){return arguments.length===0?this._getStyleProperty(t):this._setStyleProperty(t,n)},ut.prototype.foreColor=function(n){return arguments.length===0?this._getStyleProperty(i):this._setStyleProperty(i,n)},ut.prototype.hAlign=function(n){return arguments.length===0?this._getStyleProperty(r):this._setStyleProperty(r,n)},ut.prototype.vAlign=function(n){return arguments.length===0?this._getStyleProperty(u):this._setStyleProperty(u,n)},ut.prototype.themeFont=function(n){return arguments.length===0?this._getStyleProperty(f):this._setStyleProperty(f,n)},ut.prototype.font=function(n){return arguments.length===0?this._getStyleProperty(e):this._setStyleProperty(e,n)},ut.prototype.formatter=function(n){return arguments.length===0?this._getStyleProperty(o):this._setStyleProperty(o,n)},ut.prototype.borderLeft=function(n){return arguments.length===0?this._getStyleProperty(s):this._setStyleProperty(s,n)},ut.prototype.borderTop=function(n){return arguments.length===0?this._getStyleProperty(h):this._setStyleProperty(h,n)},ut.prototype.borderRight=function(n){return arguments.length===0?this._getStyleProperty(c):this._setStyleProperty(c,n)},ut.prototype.borderBottom=function(n){return arguments.length===0?this._getStyleProperty(l):this._setStyleProperty(l,n)},ut.prototype.locked=function(n){return arguments.length===0?this._getStyleProperty(a):this._setStyleProperty(a,n)},ut.prototype.textIndent=function(n){return arguments.length===0?this._getStyleProperty(v):this._setStyleProperty(v,n)},ut.prototype.wordWrap=function(n){return arguments.length===0?this._getStyleProperty(y):this._setStyleProperty(y,n)},ut.prototype.shrinkToFit=function(n){return arguments.length===0?this._getStyleProperty(p):this._setStyleProperty(p,n)},ut.prototype.tabStop=function(n){return arguments.length===0?this._getStyleProperty(g):this._setStyleProperty(g,n)},ut.prototype.textDecoration=function(n){return arguments.length===0?this._getStyleProperty(nt):this._setStyleProperty(nt,n)},ut.prototype.imeMode=function(n){return arguments.length===0?this._getStyleProperty(tt):this._setStyleProperty(tt,n)},ut.prototype.watermark=function(n){return arguments.length===0?this._getStyleProperty(it):this._setStyleProperty(it,n)},ut.prototype.clearStyleProperty=function(n){for(var u,f,t=this,r=t.sheet,i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&(u=r.getStyleImp(-1,i,t.sheetArea),u&&(f=u[n],u.clear(n),r.triggerColumnChanged({sheet:r,sheetName:r._name,col:i,sheetArea:t.sheetArea,propertyName:n,oldValue:f})))},ut.prototype.tag=function(n){var t=this,i;if(arguments.length===0)return t.sheet.getTag(-1,t.index,t.sheetArea);else{for(i=t.index;i<=t.index2;i++)t._isValidIndex(i)&&t.sheet.setTag(-1,i,n,t.sheetArea);return t}},ut.prototype._getStyleProperty=function(n){var t=this.sheet.getStyleImp(-1,this.index,this.sheetArea);return t?t[n]:rt},ut.prototype._setStyleProperty=function(t,i){for(var f,r=this,u=r.index;u<=r.index2;u++)r._isValidIndex(u)&&(f=r.sheet.getStyleImp(-1,u,r.sheetArea),f||(f=new n.Style),f[t]=i,r.sheet.setStyle(-1,u,f,r.sheetArea));return r},ut.prototype._isValidIndex=function(n){if(this.sheet){var t=this.sheet.getColumnCount(this.sheetArea);if(0<=n&&n<t)return!0}return!1},ut}();n.Column=ft})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){function l(n,i,r,u){throw new Error(t._StringHelper.format(t.SR.Exp_InvalidAndSpace,[n,i,r,u]));}function at(n,t,i){for(var r in b)b[r]&&(n=n.replace(b[r],b[r].source));return t===!0?(n=n.replace(/~\?/g,ct.source),n=n.replace(/~\*/g,lt.source),n=n.replace(/\?/g,"."),n=i?n.replace(/\*/g,"((.|\\n)+)"):n.replace(/\*/g,"((.|\\n)*)"),n=n.replace(ct,"\\?"),n=n.replace(lt,"\\*")):(n=n.replace(/\?/g,"\\?"),n=n.replace(/\*/g,"\\*")),n}var ht;t.feature("core.sheet",["core.common","core.stringResource","core.sheet_event","core.sheet_render","core.basecelltype","core.sheet_ui","core.sheet_model","core.sheet_action","core.sheet_border"]);var i=null,r=undefined,f=Math.min,e=Math.max,s=Math.floor,p=Math.abs,et=Math.round,ot=Math.ceil,u="undefined",v="function",h="number",c="string",y="boolean",w=window.document,st=window.ko,gt=function(){function l(n,r){this.disposed=!1;this._styleComposeCache=[{},{},{},{}];this._isDisposingValidationUI=!1;var u=this;u._name="";u._id=l.sheetId++;u._visible=!0;u.defaults=i;u.gridline=i;u.borderColor="black";u.borderWidth=0;u._zoomFactor=1;u.frozenRowCount=0;u.frozenColCount=0;u.rowHeaderVisible=!0;u.colHeaderVisible=!0;u.rowHeaderAutoText=1;u.colHeaderAutoText=2;u.rowHeaderAutoTextIndex=-1;u.colHeaderAutoTextIndex=-1;u.rowRangeGroup=i;u.colRangeGroup=i;u._activeRowIndex=0;u._activeColIndex=0;u.activeRowViewportIndex=0;u.activeColViewportIndex=0;u._allowCellOverflow=!1;u.maxCellOverflowDistance=100;u.showEditingLocator=!0;u.keyMap=i;u.isProtected=!1;u._allowUndo=!0;u._paintSuspended=!1;u._layoutSuspended=0;u.checkingChanges=!1;u.autoGenerateColumns=!0;u._allowEditorReservedLocations=!0;u._sheetTabColor=i;u._frozenlineColor="black";u._frozenTrailingRowCount=0;u._frozenTrailingColCount=0;u._rowLayoutCache=i;u._colLayoutCache=i;u._dragRect=i;u._scrollTopRow=0;u._scrollLeftCol=0;u.floatingObjectKeyMap=i;u._slicerKeyMap=i;u._commentKeyMap=i;u._cachePool=new t._CachePool(this);u._composedDefaultStyle={};u._defaultRowCount=200;u._defaultColCount=20;u._defaultRowHeaderColumnCount=1;u._defaultColHeaderRowCount=1;u._defaultRowHeight=20;u._defaultColWidth=62;u._defaultRowHeaderColWidth=40;u._defaultColHeaderRowHeight=20;u._defaultShowVerticalGridline=!0;u._defaultShowHorizontalGridline=!0;u.fontHeightCache=i;u._enableFormulaTextbox=!0;u._tag=null;r||u._init(n);u._initializeActiveCell()}return l.prototype._addFloatingOjectInternal=function(n){var i=this,r=i._floatingObjectArray,u;if(r&&t.features.floatingObject)try{u=i.isPaintSuspended();i.isPaintSuspended(!0);r.add(n)}finally{i.isPaintSuspended(u)}},l.prototype._findFloatingObjectInternal=function(n){var r=this._floatingObjectArray;return t.features.floatingObject&&r&&r.length>0?r.find(n):i},l.prototype._removeFloatingObjectInternal=function(n){var r=this._floatingObjectArray,i,u;return t.features.floatingObject&&r&&r.length&&(i=r.find(n),i&&(u={sheet:this,sheetName:this._name,floatingObject:i,cancel:!1},this.triggerFloatingObjectRemoving(u),u&&u.cancel===!1))?(r.remove(i),this.triggerFloatingObjectRemoved({sheet:this,sheetName:this._name,floatingObject:i}),!0):!1},l.prototype._saveAndClearSheetSelections=function(){var u=this,r=u._selectionModel,n,i,f;if(r&&r.length>0){for(n=new t._SelectionModel,u._selectionModelCache=n,n.selectionPolicy=r.selectionPolicy,n.selectionUnit=r.selectionUnit,n.activeSelectedRangeIndex=r.activeSelectedRangeIndex,i=0,f=r.length;i<f;i++)n.push(r[i]);for(u._clearSelectionImp(),i=0,f=n.length;i<f;i++)u._render.repaintSelection(n[i])}},l.prototype._loadAndSetSheetSelections=function(){var n=this._selectionModelCache,i,r,u;if(n)for(i=new t._SelectionModel,this._selectionModel=i,i.selectionPolicy=n.selectionPolicy,i.selectionUnit=n.selectionUnit,i.activeSelectedRangeIndex=n.activeSelectedRangeIndex,r=0,u=n.length;r<u;r++)i.push(n[r])},l.prototype.unSelectAllFloatingObjects=function(){var n=this._floatingObjectArray,i;if(t.features.floatingObject&&n&&n.length>0)for(i=0;i<n.length;i++)n[i].isSelected(!1)},l.prototype.refreshObjectsAboveSheet=function(){var i=this,n=i._floatingObjectArray;t.features.floatingObject&&n&&(n.isNeedToUpdateLayout=!0)},l.prototype.unSelectAllComments=function(){var n=this;n._commentManager&&n._commentManager.deactivateComment()},l.prototype.addFloatingObject=function(n){this._floatingObjectArray&&t.features.floatingObject&&n instanceof t.CustomFloatingObject&&this._addFloatingOjectInternal(n)},l.prototype.findFloatingObject=function(n){if(!t.features.floatingObject)return i;var r=this._findFloatingObjectInternal(n);return r instanceof t.CustomFloatingObject?r:i},l.prototype.removeFloatingObject=function(n){var i,u,r;if(t.features.floatingObject){i=this;try{u=i.isPaintSuspended();i.isPaintSuspended(!0);r=i._findFloatingObjectInternal(n);r instanceof t.CustomFloatingObject&&i._floatingObjectArray.remove(r)}finally{i.isPaintSuspended(u)}}},l.prototype.getFloatingObjects=function(){var i=[],r,n,f,u;if(!t.features.floatingObject)return i;for(r=this._floatingObjectArray,n=0,f=r.length;n<f;n++)u=r[n],u instanceof t.CustomFloatingObject&&i.push(u);return i},l.prototype.addPicture=function(n,r,f,e,o,s,h,c,l,a){var y=this,p=y._floatingObjectArray,w,v;if(!p||!t.features.floatingObject)return i;try{return w=y.isPaintSuspended(),y.isPaintSuspended(!0),v=new t.Picture(n),v.owner(y),v.src(r),v.startRow(f),v.startColumn(e),v.endRow(o),v.endColumn(s),(typeof o===u||typeof s===u)&&(v._isTakeOriginalSize=!0),typeof h=="number"&&v.startRowOffset(h),typeof c=="number"&&v.startColumnOffset(c),typeof l=="number"&&v.endRowOffset(l),typeof a=="number"&&v.endColumnOffset(a),p.add(v),v}finally{y.isPaintSuspended(w)}},l.prototype.findPicture=function(n){if(!t.features.floatingObject)return i;var r=this._findFloatingObjectInternal(n);return r instanceof t.Picture?r:i},l.prototype.removePicture=function(n){var i,u,r;if(t.features.floatingObject){i=this;try{u=i.isPaintSuspended();i.isPaintSuspended(!0);r=i._findFloatingObjectInternal(n);r instanceof t.Picture&&i._floatingObjectArray.remove(r)}finally{i.isPaintSuspended(u)}}},l.prototype.getPictures=function(){var i=[],r,n,f,u;if(!t.features.floatingObject)return i;for(r=this._floatingObjectArray,n=0,f=r.length;n<f;n++)u=r[n],u instanceof t.Picture&&i.push(u);return i},l.prototype.setFloatingObjectZIndex=function(n,i){var o,r,u,f,h,c,e,s;if(!isNaN(i)&&t.features.floatingObject&&(o=this._render,r=o&&o._floatingObjectRenderManager,r))for(u=0,h=r.length;u<h;u++)if(e=r[u],e)for(f=0,c=e.length;f<c;f++)s=e[f],s&&s.setFloatingObjectZIndex(n,i)},l.prototype.getFloatingObjectZIndex=function(n){var o=this._render,f=o&&o._floatingObjectRenderManager,i,r,s,h,u,e;if(t.features.floatingObject&&f)for(i=0,s=f.length;i<s;i++)if(u=f[i],u)for(r=0,h=u.length;r<h;r++)if(e=u[r],e)return e.getFloatingObjectZIndex(n);return-1},l.prototype.getDataSource=function(){var n=this._bindingManager;return n?n.getSource():i},l.prototype.getBindingPath=function(n,t){var r=this._sheetModelManager.getDataModel(3);return r?r.getBindingPath(n,t):i},l.prototype.setBindingPath=function(n,t,i){var r=this;return r._bindToAutoRefresh(function(n,t,i){var u=r._getModel(3);return u&&u.setBindingPath(n,t,i),r})(n,t,i)},l.prototype.setDataSource=function(n,i){var r=this,u=r._bindingManager;u&&u.getSource()!==n&&r._bindToAutoRefresh(function(n,i){var f,h,o,l,c,a,s,e,v;if(i&&(r.resetImp(),r._initializeActiveCell()),u=r._bindingManager,n){if(u.bind(n),t._BindingManager.isCellBindingSource(n)){if(f=r._tableManager,f){for(f.resetTablesBindingManager(),h=f.getTables(),r.suspendCalcService(),o=0,l=h.length;o<l;o++)c=h[o],c&&c._applyBindingPath();r.resumeCalcService()}r.clearPendingChanges();return}if(r._setRowCountInternal(u.getRowCount()),r.autoGenerateColumns&&(r.setColumnCount(u.getColumnCount()),a=r._sheetModelManager.getColInfos(),s=u.getFields(),s))for(e=0,v=s.length;e<v;e++)a._setItem(e,{name:s[e]});r.getCalcService()&&!r.getCalcService().IsSuspended()&&r.recalcAll()}else t._BindingManager.isCellBindingSource(u.getSource())&&(f=r._tableManager,f&&f.resetTablesBindingManager()),r._bindingManager=new t._BindingManager(r),r.getCalcService()&&!r.getCalcService().IsSuspended()&&r.recalcAll();r.clearPendingChanges()})(n,i)},l.prototype.bindColumn=function(n,t){var i=this,r=i.isPaintSuspended();i.isPaintSuspended(!0);try{typeof t===c&&(t={name:t});this._sheetModelManager.getColInfos()._setItem(n,t);t&&t.formatter&&i.setFormatter(-1,n,t.formatter);t&&t.cellType&&i.setCellType(-1,n,t.cellType)}finally{i.isPaintSuspended(r)}},l.prototype.bindColumns=function(n){var i=this,f=i.isPaintSuspended(),u,r,t;i.isPaintSuspended(!0);try{if(n)for(u=i._sheetModelManager.getColInfos(),isNaN(n.length)||i.setColumnCount(n.length),r=0;r<n.length;r++)t=n[r],typeof t===c&&(t={name:t}),u._setItem(r,t),t&&t.formatter&&i.setFormatter(-1,r,t.formatter),t&&t.cellType&&i.setCellType(-1,r,t.cellType)}finally{i.isPaintSuspended(f)}},l.prototype.getDataItem=function(n){var f=this,o=f._bindingManager,h=f._sheetModelManager.getColInfos(),t,r,u;if(!o||o.getRowCount()===0)return i;var c=f.getColumnCount(),s={},e=o.getDataItem(n);if(e)for(t in e)e.hasOwnProperty(t)&&typeof t!==v&&(s[t]=e[t]);for(r=0;r<c;r++)u=h._getItem(r),u&&u.name&&u.name.length>0&&(s[u.name]=f.getValue(n,r));return s},l.prototype.getDirtyRows=function(){var t=this,u=[],i=t._sheetModelManager.dataModel().dirtyNodes,f,e,n,r;if(i){f=t._bindingManager;e=t.getDataSource();for(n in i)r=i[n],i.hasOwnProperty(n)&&r&&r.rs==="e"&&u.push({row:+n,item:t.getDataItem(n),originalItem:r.originalItem})}return u},l.prototype.getInsertRows=function(){var i=[],t=this._sheetModelManager.dataModel().dirtyNodes,n;if(t)for(n in t)t.hasOwnProperty(n)&&t[n]&&t[n].rs==="n"&&i.push({row:+n,item:this.getDataItem(n)});return i},l.prototype.getDirtyCells=function(n,u,f,e){var a=this,l,o,s,h,v,b,c,y,p,w,k,d;if((n===r||n===i)&&(n=-1),(u===r||u===i)&&(u=-1),(f===r||f<=0)&&(f=1),(e===r||e<=0)&&(e=1),l=[],o=a._sheetModelManager.dataModel().dirtyNodes,!t.GC$.isEmptyObject(o))if(n>=0&&u>=0){for(h=n;h<n+f;h++)if(o[h]&&o[h].rs==="e")for(s=o[h],c=u;c<u+e;c++)s[c]&&l.push(a._getDirtyValue(h,c,s[c].oldValue))}else if(n>=0&&u<0){for(h=n;h<n+f;h++)if(o[h]&&o[h].rs==="e"){s=o[h];for(v in s)b=parseInt(v),!isNaN(b)&&s.hasOwnProperty(v)&&s[v]&&l.push(a._getDirtyValue(h,b,s[v].oldValue))}}else if(n<0&&u>=0)for(c=u;c<u+e;c++)for(y in o)o[y]&&o[y].rs==="e"&&(s=o[y],s[c]&&l.push(a._getDirtyValue(parseInt(y),c,s[c].oldValue)));else for(p in o)if(o[p]&&o[p].rs==="e"){s=o[p];for(w in s)k=parseInt(w),d=parseInt(p),!isNaN(k)&&s.hasOwnProperty(w)&&s[w]&&l.push(a._getDirtyValue(d,k,s[w].oldValue))}return l},l.prototype._getDirtyValue=function(n,t,i){return{row:n,col:t,newValue:this.getValue(n,t),oldValue:i}},l.prototype.getDeleteRows=function(){var n=[];return this.deletedRows&&t.GC$.each(this.deletedRows,function(t,i){typeof i!==v&&i&&n.push({row:i.row,originalItem:i.data})}),n},l.prototype.hasPendingChanges=function(){var i=this,n;return this.deletedRows&&this.deletedRows.length>0?!0:(n=this._sheetModelManager.dataModel().dirtyNodes,!t.GC$.isEmptyObject(n))?!0:!1},l.prototype.clearPendingChanges=function(){var t=this._sheetModelManager.dataModel().dirtyNodes,i,n;for(i in t)n=t[i],n&&n.rs&&delete n.rs;this._sheetModelManager.dataModel().dirtyNodes={};this.deletedRows=[]},l.prototype._getProperties=function(n){var i=[],t;if(n)for(t in n)typeof n[t]!==v?i.push(t):typeof st!==u&&st.isObservable(n[t])&&i.push(t);return i},l.prototype.referenceStyle=function(n){var r=t.ReferenceStyle,i=this.getCalcService();return arguments.length===0?i&&i.useR1C1?1:0:(i&&(i.useR1C1=n===1),this)},l.prototype.recalcAll=function(){var n=this.getCalcService(),t;n&&(t=this.isPaintSuspended(),this.isPaintSuspended(!0),n.recalculateAll(!0),this.isPaintSuspended(t))},l.prototype.recalcRange=function(n,t,i,r){var u=this.getCalcService();u&&u.recalcRange(this._getSheetSource(),n,t,i,r)},l.prototype.recalcRows=function(n){var t=this.getCalcService(),i;if(t&&!t.ignoreDirty()){for(t.suspend(),i=0;i<n.length;i++)t.recalculate(this._vpSheetSource,n[i],-1);t.resume(!1)}},l.prototype._recalcCell=function(n,t,i){var r=this.getCalcService();r&&!r.ignoreDirty()&&r.recalculate(this._vpSheetSource,t,i)},l.prototype.getCalcService=function(){return!this.calcService&&t.util.hasCalc()&&(this.calcService=new t.Calc.CalcService,this._getSheetSource().setCalcService(this.calcService),this.calcService.initParserContext(this._getSheetSource())),this.calcService},l.prototype._getCalcContexts=function(){var n=this,t=[],i=n._getModel();return t.push({name:n._name,target:n,refModel:i}),t},l.prototype.suspendCalcService=function(n){this.getCalcService()&&this.getCalcService().suspend(n)},l.prototype.resumeCalcService=function(n){this.getCalcService()&&this.getCalcService().resume(n)},l.prototype._getSheetSource=function(n){return n===r||n===i||n===3?this._vpSheetSource:i},l.prototype.getCustomFunction=function(n){return this._functions&&n&&n!==""?this._functions[n.toUpperCase()]:i},l.prototype.addCustomFunction=function(n){this._addCustomFunctionCore(n);this.recalcAll()},l.prototype._addCustomFunctionCore=function(n){if(t.util.hasCalc()){if(!n||!(n instanceof t.Calc.Functions.Function))throw new Error(t.SR.Exp_InvalidCustomFunction);var i=this,r=n.name.toUpperCase();i._functions||(i._functions={});i._functions[r]=n}},l.prototype.removeCustomFunction=function(n){var t=this;t._functions&&n&&n!==""&&(n=n.toUpperCase(),t._functions.hasOwnProperty(n)&&(delete t._functions[n],t.recalcAll()))},l.prototype.clearCustomFunctions=function(){this._functions&&(delete this._functions,this.recalcAll())},l.prototype._findCustomFunction=function(n){if(!n||n==="")return i;var u=this,t=u.parent,r=u.getCustomFunction(n);return!r&&t&&t.getCustomFunction&&(r=t.getCustomFunction(n)),r},l.prototype.addCustomFunctionDescription=function(n){if(n&&n.name&&!this.getCustomFunctionDescription(n.name)){var t=this._functionDescriptions;t||(t=this._functionDescriptions=[]);t.push(n)}},l.prototype.getCustomFunctionDescription=function(n){var u=this._functionDescriptions,f,t,r;if(u&&n)for(n=n.toUpperCase(),f=u.length,r=0;r<f;r++)if(t=u[r],t.name&&t.name.toUpperCase()===n)return t;return i},l.prototype.removeCustomFunctionDescription=function(n){var i=this._functionDescriptions,u,r,t;if(i&&n)for(n=n.toUpperCase(),u=i.length,t=0;t<u;t++)if(r=i[t],r.name&&r.name.toUpperCase()===n){i.splice(t,1);break}},l.prototype.clearCustomFunctionDescriptions=function(){this._functionDescriptions&&(this._functionDescriptions=i)},l.prototype.getCustomName=function(n){var t=this._names;return t?t[n.toUpperCase()]:i},l.prototype.getCustomNames=function(){var n=[],i=this._names;return i&&t.GC$.each(i,function(t,i){n.push(i)}),n},l.prototype.addCustomName=function(n,t,i,r){this._addCustomNameCore(n,t,i,r,!1)},l.prototype._addCustomNameCore=function(n,i,r,u,f){var e,c,l,o;if(!n||n===""||!i||i==="")throw new Error(t.SR.Exp_InvalidCustomName);e=this;e._names||(e._names={});var s=e.getCalcService(),h=e._getSheetSource(),a=e._getCalcModel();if(s&&h){if(f)try{c=s.parse(h,i,r,u,!1,!0)}catch(v){}else c=s.parse(h,i,r,u);l=n.toUpperCase();e._names[l]=new t.NameInfo(n,c,r,u);o=a._getNameCalc(l,!0);o&&(o.updateListening(!0,!0),o.addToDirty());e.recalcAll()}},l.prototype.removeCustomName=function(n){var t=this,i,u,r;t._names&&n&&n!==""&&(i=n.toUpperCase(),t._names[i]&&(delete t._names[i],u=t._getCalcModel(),u&&(r=u._getNameCalc(i),r&&(r.updateListening(!0,!1),r.addToDirty())),t.recalcAll()))},l.prototype.clearCustomNames=function(){var n=this,r,i,u,t;if(n._names){if(r=n._names,delete n._names,i=n._getCalcModel(),i)for(u in r)t=i._getNameCalc(u),t&&(t.updateListening(!0,!1),t.addToDirty());n.recalcAll()}},l.prototype._findCustomName=function(n){if(!n||n==="")return i;var u=this,t=u.parent,r=u.getCustomName(n);return!r&&t&&t.getCustomName&&(r=t.getCustomName(n)),r},l.prototype.setFormula=function(n,t,i){this._setFormulaCore(n,t,i,!1)},l.prototype._setFormulaCore=function(n,u,f,e,o){var s=this,y,l,h,c,a,v;if(o!==1&&o!==2){if((o===r||o===i)&&(o=3),y=t.Events,n<0||n>=s.getRowCount()||u<0||u>=s.getColumnCount()){s._raiseInvalidOperation(0,t.SR.Exp_IndexOutOfRange);return}if(l=s._tableManager,o===3&&n>=0&&u>=0&&l&&(h=l.find(n,u),h)){if(h.showHeader()&&n===h.headerIndex()&&f)return;h.showFooter()&&n===h.footerIndex()&&h._setFooterFormula(u,f)}c=s._getCalcModel();a=s._conditionalFormats;c&&(v=c.getFormula(n,u),c.setFormula(n,u,f,e),a&&a._clearCache(),s._eventHandler._eventSuspended<1&&s._raiseCellChanged("formula",n,u,v,f,o));s._paintSuspended||(s.invalidateLayout(),s.repaint())}},l.prototype.setArrayFormula=function(n,t,i,r,u){this._setArrayFormulaCore(n,t,i,r,u,!1)},l.prototype._setArrayFormulaCore=function(n,u,f,e,o,s,h){var c=this;c._bindToAutoRefresh(function(n,u,f,e,o,h){var k,y,l,p,w,b,a,v;if(h!==1&&h!==2){if((h===r||h===i)&&(h=3),k=t.Events,n<0||n+f>c.getRowCount()||u<0||u+e>c.getColumnCount()){c._raiseInvalidOperation(0,t.SR.Exp_IndexOutOfRange);return}if(c._hasSpans(n,u,f,e)){c._raiseInvalidOperation(0,t.SR.Exp_ArrayFromulaSpan);return}if(y=c._tableManager,h===3&&n>=0&&u>=0&&y&&(l=y.find(n,u),l)){if(f>1||e>1){c._raiseInvalidOperation(0,t.SR.Exp_ArrayFormulaTable);return}if(l.showHeader()&&n===l.headerIndex()&&o)return;l.showFooter()&&n===l.footerIndex()&&l._setFooterFormula(u,o)}if(p=c._getCalcModel(),w=c._conditionalFormats,p&&(c.suspendEvent(),p.setArrayFormula(n,u,f,e,o,s),c.resumeEvent(),w&&w._clearCache(),c._eventHandler._eventSuspended<1)){for(b=[],a=n;a<n+f;a++)for(v=u;v<u+e;v++)b.push(new t.CellPosition(a,v));c._raiseRangeDataChanged(n,u,f,e,b,5)}}})(n,u,f,e,o,h)},l.prototype.getFormula=function(n,t){var r=this._getCalcModel();return r?r.getFormula(n,t):i},l.prototype.getFormulaInformation=function(n,i){var u=new t.FormulaInformation,f=this._getCalcModel(3),e,r;return f&&(e=f.getExpr(n,i),e&&(r=f.getArray(n,i),u.hasFormula=!0,r&&(u.baseRange=new t.Range(r.row,r.col,r.rowCount,r.colCount)),u.isArrayFormula=!!r,n=r?r.row:n,i=r?r.col:i,u.formula=this.calcService.unparse(this._vpSheetSource,e,n,i),u.hasFormula=!!u.formula)),u},l.prototype.hasFormula=function(n,t){var i=this._getCalcModel();return i?i.hasFormula(n,t):!1},l.prototype._findFormulas=function(n,t,i,r){},l.prototype._rebuildCalcNodes=function(){var n=this._getCalcModel(),t,i;if(n)for(var r=0,u=n.rC(),f=n.cC();r<u;){for(t=0;t<f;)i=n._getCellCalc(r,t),i&&(i.stopListening(),i.startListening()),t++;r++}},l.prototype._setValueToDataTable=function(n,t,i,r){var u=n[t],f;u||(u=n[t]={});f=u[i];f||(f=u[i]={});f.value=r},l.prototype._serializeSheetDataSource=function(n){var t=this,u,f,e;if(!t.getDataSource())return r;var o=t.getRowCount(),s=t.getColumnCount(),h=t._bindingManager;for(u=0;u<o;u++)for(f=0;f<s;f++)e=h.getValue(u,f).value,e!==i&&e!==r&&t._setValueToDataTable(n,u,f,e)},l.prototype._serializeColumnHeaderNames=function(n){var t=this,i,u,f,o;if(!t.getDataSource())return r;var s=t.getRowCount(1),h=t.getColumnCount(1),c=t._sheetModelManager.getColInfos()._getItems(),e=t.colHeaderAutoTextIndex;for(i=0;i<s;i++)if(e>=0&&i===e||e===-1&&i===s-1)for(u=0;u<h;u++)f=c[u],f&&(o=f.displayName||f.name,o&&t._setValueToDataTable(n,i,u,o))},l.prototype._serializeTablesDataSource=function(n){for(var t,u,e,h=this,c=h.getTables(),o=0,v=c.length;o<v;o++){var s=c[o],y=s.getSource(),f=s.dataRange(),l=f.row,a=f.col,p=l+f.rowCount-1,w=a+f.colCount-1;if(y)for(t=l;t<=p;t++)for(u=a;u<=w;u++)e=s._getValue(t,u).value,e!==i&&e!==r&&h._setValueToDataTable(n,t,u,e)}},l.prototype.toJSON=function(n){var u=this,h=u._sheetModelManager,g=u._sparklineGroupManager,nt=u._commentManager,tt=u._conditionalFormats,it=u._tableManager,rt=u._floatingObjectArray,ut=u.rowRangeGroup,ft=u.colRangeGroup,et=u._rowFilter,ot=u._printInfo,st=u._slicerCollection,f={defaults:u.defaults,columns:u._toArray(h.getColInfos()._getItems(),u.getColumnCount()),rows:u._toArray(h.getRowInfos()._getItems(),u.getRowCount()),autoGenerateColumns:u.autoGenerateColumns,frozenRowCount:u.frozenRowCount,frozenColCount:u.frozenColCount,frozenTrailingRowCount:u._frozenTrailingRowCount,frozenTrailingColCount:u._frozenTrailingColCount,rowCount:u.getRowCount(),columnCount:u.getColumnCount(),sparklineGroups:g?g.toJSON():i,comments:nt?nt.toJSON():i,spans:u._getSpanModel().toJSON(),selectionBackColor:u._selectionBackColor,selectionBorderColor:u._selectionBorderColor,activeRow:u._activeRowIndex,activeCol:u._activeColIndex,gridline:u.gridline,allowCellOverflow:u._allowCellOverflow,referenceStyle:u.referenceStyle(),zoomFactor:u._zoomFactor,theme:u.currentTheme(),showRowRangeGroup:u._showRowRangeGroup,showColumnRangeGroup:u._showColumnRangeGroup,conditionalFormats:tt?tt.toJSON():i,sheetTabColor:u._sheetTabColor,frozenlineColor:u._frozenlineColor,rowHeaderAutoText:u.rowHeaderAutoText,colHeaderAutoText:u.colHeaderAutoText,rowHeaderAutoTextIndex:u.rowHeaderAutoTextIndex,colHeaderAutoTextIndex:u.colHeaderAutoTextIndex,rowHeaderVisible:u.rowHeaderVisible,colHeaderVisible:u.colHeaderVisible,rowHeaderColCount:u.getColumnCount(2),colHeaderRowCount:u.getRowCount(1),rowHeaderSpan:u._getSpanModel(2).toJSON(),colHeaderSpan:u._getSpanModel(1).toJSON(),rowHeaderColInfos:u._toArray(h.getColInfos(2)._getItems(),u.getColumnCount(2)),colHeaderRowInfos:u._toArray(h.getRowInfos(1)._getItems(),u.getRowCount(1)),clipBoardOptions:u._clipBoardOptions,isProtected:u.isProtected,protectionOption:u._protectionOption,borderColor:u.borderColor,borderWidth:u.borderWidth,allowUndo:u._allowUndo,allowEditorReservedLocations:u._allowEditorReservedLocations,tables:it?it.toJSON():i,floatingObjects:rt?rt.toJSON():i,visible:u._visible,rowHeaderData:u._getModel(2).toJSON(2),colHeaderData:u._getModel(1).toJSON(1),data:u._getModel().toJSON(),rowRangeGroup:ut?ut.toJSON():r,colRangeGroup:ft?ft.toJSON():r,tag:u._tag,customFunctions:u._functions,printInfo:ot?ot.toJSON():r,slicers:st?st.toJSON():i},s,c,e,w,l,a,o,b,v,y,k,d;n&&n.includeBindingSource&&(s=f.data.dataTable||{},u._serializeSheetDataSource(s),u._serializeTablesDataSource(s),t.GC$.isEmptyObject(s)||(f.data.dataTable=s),c=f.colHeaderData.dataTable||{},u._serializeColumnHeaderNames(c),t.GC$.isEmptyObject(c)||(f.colHeaderData.dataTable=c));e={name:u._name,selections:u._selectionModel.toJSON(),rowFilter:et?et.toJSON():r};for(o in f)w=f[o],u._isDefaultValue(o,w)||(e[o]=w);if(l=[],a=u._namedStyles,a)for(o in a)b=a[o],b&&l.push(b.toJSON());if(l.length>0&&(e.namedStyles=l),v=[],y=u._names,y&&u.getCalcService())for(k in y)if(u._names.hasOwnProperty(k)){var p=y[k],lt=p.getName(),ht=p.getRow(),ct=p.getColumn(),at=p.getExpression(),vt=u.getCalcService().unparseWithoutCulture(u._getSheetSource(),at,ht,ct,!0);v.push({name:lt,formula:vt,row:ht,col:ct})}return v.length>0&&(e.names=v),d=u._vpCalcSheetModel,d&&d.toJSON(e),e},l.prototype._isDefaultValue=function(n,r){var u=this;switch(n){case"defaults":return r.rowHeight===u._defaultRowHeight&&r.colWidth===u._defaultColWidth&&r.rowHeaderColWidth===u._defaultRowHeaderColWidth&&r.colHeaderRowHeight===u._defaultColHeaderRowHeight;case"columns":return!r||r.length===0;case"rows":return!r||r.length===0;case"autoGenerateColumns":return r===!0;case"sparklineGroups":return r===i;case"comments":return r===i;case"frozenRowCount":return r===0;case"frozenColCount":return r===0;case"frozenTrailingRowCount":return r===0;case"frozenTrailingColCount":return r===0;case"gridline":return r.color===t.ThemeStyleHelper.getCssClassThemeStyle("gc-gridlineColor").borderTopColor&&r.showHorizontalGridline===u._defaultShowHorizontalGridline&&r.showVerticalGridline===u._defaultShowVerticalGridline;case"allowCellOverflow":return r===!1;case"referenceStyle":return r===0;case"zoomFactor":return r===1;case"showRowRangeGroup":return r===!0;case"showColumnRangeGroup":return r===!0;case"conditionalFormats":return r===i;case"sheetTabColor":return r===i;case"frozenlineColor":return r==="black";case"rowHeaderAutoText":return r===1;case"colHeaderAutoText":return r===2;case"rowHeaderAutoTextIndex":return r===-1;case"colHeaderAutoTextIndex":return r===-1;case"rowHeaderVisible":return r===!0;case"colHeaderVisible":return r===!0;case"rowHeaderColCount":return r===1;case"colHeaderRowCount":return r===1;case"rowHeaderColInfos":return!r||r.length===0;case"colHeaderRowInfos":return!r||r.length===0;case"clipBoardOptions":return r===0;case"isProtected":return r===!1;case"protectionOption":return t.GC$.isEmptyObject(r);case"borderColor":return r==="black";case"borderWidth":return r===0;case"allowUndo":return r===!0;case"allowEditorReservedLocations":return r===!0;case"tables":return r===i;case"floatingObjects":return r===i;case"visible":return r===!0;case"data":return t.GC$.isEmptyObject(r);case"rowHeaderData":return t.GC$.isEmptyObject(r);case"colHeaderData":return t.GC$.isEmptyObject(r);case"tag":return r===i;case"printInfo":return t.GC$.isEmptyObject(r);case"slicers":return r===i;default:return!1}},l.prototype.fromJSON=function(r,f,e){var o,h,ci,li,k,d,y,vt,yt,w,ai,l,vi,pt,wt,rt,yi,bt,kt,dt,ut,g,nt,b,tt,it,ft,gt,et,ni,pi,ti,ot,st,ii,s,bi,ct,p,ri,ui,a,lt,at,fi,ei,oi,si,hi;if(r){o=this;t.features.binding&&(o._bindingManager=new t._BindingManager(o));typeof f===u&&(f=!0);h=o._sheetModelManager;ci=o.isPaintSuspended();o.isPaintSuspended(!0);li=n.Sheets.Culture();n.Sheets.switchCulture("");k=r.rowCount;d=r.columnCount;try{if(o._name=r.name,o._names={},r.defaults&&(o.defaults=r.defaults),typeof k===u&&(k=o._defaultRowCount),o.setRowCount(k),typeof d===u&&(d=o._defaultColCount),o._setColumnCountCore(d),typeof r.activeRow!==u&&(o._activeRowIndex=r.activeRow),typeof r.activeCol!==u&&(o._activeColIndex=r.activeCol),typeof r.frozenRowCount!==u&&o.setFrozenRowCount(r.frozenRowCount),typeof r.frozenColCount!==u&&o.setFrozenColumnCount(r.frozenColCount),typeof r.frozenTrailingRowCount!==u&&o.setFrozenTrailingRowCount(r.frozenTrailingRowCount),typeof r.frozenTrailingColCount!==u&&o.setFrozenTrailingColumnCount(r.frozenTrailingColCount),typeof r.gridline!==u&&(o.gridline=r.gridline),typeof r.allowCellOverflow!==u&&(o._allowCellOverflow=r.allowCellOverflow),typeof r.autoGenerateColumns!==u&&(o.autoGenerateColumns=r.autoGenerateColumns),y=r.tag,typeof y!==u&&(vt=y.typeName,typeof vt===c&&(yt=t.getTypeFromString(vt),yt&&(y=new yt,y.fromJSON&&y.fromJSON(r.tag))),o.tag(y)),e&&(r.dataSource&&(w=o._bindingManager,w&&w.bind(r.dataSource)),r.dataBinding&&(w=o._bindingManager,w&&w.fromJSON(r.dataBinding,e))),r.rows&&(h.getRowInfos()._setItems(r.rows),h.getRowInfos().length=k),r.columns&&(h.getColInfos()._setItems(r.columns),h.getColInfos().length=d),r.colStyles)for(l in r.colStyles)isNaN(l)||(ai=parseInt(l,10),o.setStyle(-1,ai,r.colStyles[l],3));if(r.rowStyles)for(l in r.rowStyles)isNaN(l)||(vi=parseInt(l,10),o.setStyle(vi,-1,r.rowStyles[l],3));if(typeof r.rowHeaderAutoText!==u&&(o.rowHeaderAutoText=r.rowHeaderAutoText),typeof r.colHeaderAutoText!==u&&(o.colHeaderAutoText=r.colHeaderAutoText),typeof r.rowHeaderAutoTextIndex!==u&&(o.rowHeaderAutoTextIndex=r.rowHeaderAutoTextIndex),typeof r.colHeaderAutoTextIndex!==u&&(o.colHeaderAutoTextIndex=r.colHeaderAutoTextIndex),typeof r.rowHeaderVisible!==u&&(o.rowHeaderVisible=r.rowHeaderVisible),typeof r.colHeaderVisible!==u&&(o.colHeaderVisible=r.colHeaderVisible),pt=r.rowHeaderColCount,wt=r.colHeaderRowCount,typeof r.rowHeaderColCount===u&&(pt=this._defaultRowHeaderColumnCount),typeof r.colHeaderRowCount===u&&(wt=this._defaultColHeaderRowCount),o.setColumnCount(pt,2),o.setRowCount(wt,1),r.rowHeaderData&&h.rowHeaderModel().fromJSON(r.rowHeaderData,e),r.colHeaderData&&h.colHeaderModel().fromJSON(r.colHeaderData,e),r.rowHeaderSpan&&o._getSpanModel(2).fromJSON(r.rowHeaderSpan,e),r.colHeaderSpan&&o._getSpanModel(1).fromJSON(r.colHeaderSpan,e),r.rowHeaderColInfos&&h.getColInfos(2)._setItems(r.rowHeaderColInfos),r.colHeaderRowInfos&&h.getRowInfos(1)._setItems(r.colHeaderRowInfos),(typeof r._zoomFactor!==u||typeof r.zoomFactor!==u)&&(o._zoomFactor=typeof r.zoomFactor===u?r._zoomFactor:r.zoomFactor),r.spans&&o._getSpanModel().fromJSON(r.spans,e),r.selections&&(o._clearSelectionImp(),o._selectionModel.fromJSON(r.selections,e)),typeof r.referenceStyle!==u&&o.referenceStyle(r.referenceStyle),o.clearCustomFunctions(),rt=r.customFunctions,rt)for(yi in rt)bt=rt[yi],kt=t.getTypeFromString(bt.typeName),kt&&(dt=new kt,dt.fromJSON(bt,e),o._addCustomFunctionCore(dt));if(f&&r.names){for(ut=0;ut<r.names.length;ut++)g=r.names[ut],o._addCustomNameCore(g.name,g.formula,g.row,g.col,!0);o._rebuildCalcNodes()}if(r.data&&(h.dataModel().fromJSON(r.data,e),nt=r.data.dataTable,f&&nt))for(b in nt)if(typeof b!==v)for(tt in nt[b])typeof tt!==v&&(it=nt[b][tt],ft=it.formula,ft&&(it.arrayInfo?o._setArrayFormulaCore(parseInt(b,10),parseInt(tt,10),parseInt(it.arrayInfo.rowCount,10),parseInt(it.arrayInfo.colCount,10),ft,!0):o._setFormulaCore(parseInt(b,10),parseInt(tt,10),ft,!0)));if(gt=e?r.sparklineGroupManager?r.sparklineGroupManager.groups:i:r.sparklineGroups,f&>&&(et=o._sparklineGroupManager,et))for(et.fromJSON(gt,e),ni=et.groups(),pi=h.getDataModel(),a=0;a<ni.length;a++)for(ti=ni[a]._innerList,st=0;st<ti.length;st++)ot=ti[st],pi.setSparkline(ot.row,ot.column,ot);if(ii=e?r.commentManager:r.comments,ii&&o._commentManager.fromJSON(ii,e),r.theme)if(s=r.theme,typeof s=="string"||typeof s===u)o.currentTheme(s);else{var ht=s.themeColor?s.themeColor:s._themeColor,ki=ht.name?ht.name:ht._name,wi=new t.ThemeColor(ki);wi.fromJSON(ht,e);bi=new t.SpreadTheme(s.name?s.name:s._name,wi,s.headingFont?s.headingFont:s._headingFont,s.bodyFont?s.bodyFont:s._bodyFont);o.currentTheme(bi)}if(typeof r.showRowRangeGroup!==u&&(o._showRowRangeGroup=r.showRowRangeGroup),typeof r.showColumnRangeGroup!==u&&(o._showColumnRangeGroup=r.showColumnRangeGroup),r.rowRangeGroup&&o.rowRangeGroup&&o.rowRangeGroup.fromJSON(r.rowRangeGroup,e),r.colRangeGroup&&o.colRangeGroup&&o.colRangeGroup.fromJSON(r.colRangeGroup,e),ct=r.rowFilter,ct&&t.features.filter&&(ri=ct.typeName,ri?(ui=t.getTypeFromString(ri),ui&&(p=new ui)):p=new t.HideRowFilter,p&&(o._rowFilter=p,p.sheet=o,p.fromJSON(ct,e),p.reFilter())),r.conditionalFormats&&t.features.conditionalFormat&&o.getConditionalFormats().fromJSON(r.conditionalFormats,e),r.sheetTabColor&&o.sheetTabColor(r.sheetTabColor),r.frozenlineColor&&o.frozenlineColor(r.frozenlineColor),typeof r.clipBoardOptions!==u&&(o._clipBoardOptions=r.clipBoardOptions),typeof r.isProtected!==u&&(o.isProtected=r.isProtected),o._protectionOption=typeof r.protectionOption!==u?r.protectionOption:{},r.borderColor&&(o.borderColor=r.borderColor),typeof r.borderWidth!==u&&(o.borderWidth=r.borderWidth),typeof r.allowUndo!==u&&o.allowUndo(r.allowUndo),typeof r.allowEditorReservedLocations!==u&&o.allowEditorReservedLocations(r.allowEditorReservedLocations),o._namedStyles={},r.namedStyles)for(a=0;a<r.namedStyles.length;a++)lt=r.namedStyles[a],at=new t.Style,at.fromJSON(lt,e),typeof lt.validator!==u&&(t.features.dataValidator&&(fi=new n.Sheets.DefaultDataValidator,fi.fromJSON(lt.validator,e)),at.validator=fi),o._addNamedStyleImp(at,!1);r.selectionBackColor&&o.selectionBackColor(r.selectionBackColor);r.selectionBorderColor&&o.selectionBorderColor(r.selectionBorderColor);ei=e?r.tableManager?r.tableManager.tables:i:r.tables;typeof ei!==u&&o._tableManager&&o._tableManager.fromJSON(ei,e);oi=e?r.floatingObjectArray?r.floatingObjectArray.floatingObjects:i:r.floatingObjects;typeof oi!==u&&o._floatingObjectArray&&o._floatingObjectArray.fromJSON(oi,e);si=r.slicers;typeof si!==u&&o._slicerCollection&&o._slicerCollection.fromJSON(si);typeof r.visible!==u&&(o._visible=r.visible);hi=this.printInfo();hi&&typeof r.printInfo!==u&&hi.fromJSON(r.printInfo);this.clearPendingChanges()}finally{n.Sheets.switchCulture(li);o.isPaintSuspended(ci)}}},l.prototype.formulaFromJSON=function(n,t){var r,s,h,o,p,w,b,u,nt,tt,f,e,c,k,l,d,it,g,a,v,y;if(n){if(r=this,s=n.names,s)for(h=0;h<s.length;h++)o=s[h],r._addCustomNameCore(o.name,o.formula,o.row,o.col,!0);if(p=n.data,p&&(w=p.dataTable,w))for(nt=r.getRowCount(),tt=r.getColumnCount(),f=0;f<nt;f++)if(b=w[f],b)for(e=0;e<tt;e++)u=b[e],c=u&&u.formula,c&&(u.arrayInfo?r._setArrayFormulaCore(f,e,parseInt(u.arrayInfo.rowCount,10),parseInt(u.arrayInfo.colCount,10),c,!0):r._setFormulaCore(f,e,c,!0));if(k=t?n.sparklineGroupManager?n.sparklineGroupManager.groups:i:n.sparklineGroups,k&&(l=r._sparklineGroupManager,l))for(l.fromJSON(k,t),d=l.groups(),it=r._sheetModelManager.getDataModel(),v=0;v<d.length;v++)for(g=d[v]._innerList,y=0;y<g.length;y++)a=g[y],it.setSparkline(a.row,a.column,a)}},l.prototype._toArray=function(n,t){var f,u;if(!n)return i;for(f=[],u=0;u<t;u++)n[u]!==r&&(f[u]=n[u]);return f},l.prototype.isPaintSuspended=function(n){var t=this;return arguments.length===0?t._paintSuspended:(t._paintSuspended!==n&&(t._paintSuspended=n,!n&&t._layoutSuspended<=0&&(!t.parent||t.parent.getActiveSheet&&t.parent.getActiveSheet()===t)&&(t.invalidateLayout(),t.repaint())),t)},l.prototype.getName=function(){return this._name},l.prototype.setName=function(n){var r=this,i=r.parent;if(!r._isValidSheetName(n))throw t.SR.Exp_NotSupport;this.setNameCore(n);i&&i._doTabHSResize&&i._doTabHSResize()},l.prototype.setNameCore=function(n){var t=o.getDataValidatorsBeforeSetSheetName(this);this._name=n;o.adjustModelFormulasAfterSetSheetName(this);o.adjustValidatorsAfterSetSheetName(this,t)},l.prototype.visible=function(n){var u=this,r,i;if(arguments.length==0)return u._visible;if(u._visible=n,r=u.parent,r){var f=r.sheets,o=f.length,e=t.util.inArray(u,f),s=r.getActiveSheetIndex();if(n)s<0?r._setActiveSheetIndexImp(e,1):r._doTabHSResize();else if(e===s){for(i=e+1;i<o&&!f[i]._visible;)i++;if(i>=o)for(i=e-1;i>=0&&!f[i]._visible;)i--;i<0?(u._dispose(!1),r._activeSheetIndex=i,r._doResize()):(i<r._tab._firstTab&&(r._tab._firstTab=i),r._setActiveSheetIndexImp(i,1))}else r._doTabHSResize();return u}},l.prototype.allowCellOverflow=function(n){var t=this;return arguments.length===0?t._allowCellOverflow:t._bindToAutoRefresh(function(n){return t._allowCellOverflow=n,t})(n)},l.prototype.allowUndo=function(n){var t=this,i;return arguments.length===0?t._allowUndo:(t._allowUndo=n,i=t.undoManager(),i&&(i._allowUndo=n),t)},l.prototype.allowEditorReservedLocations=function(n){return arguments.length===0?this._allowEditorReservedLocations:(this._allowEditorReservedLocations=n,this)},l.prototype.sheetTabColor=function(n){var t=this,i=t.parent;return arguments.length===0?t._sheetTabColor:(t._sheetTabColor=n,i&&i._doTabHSResize&&i._doTabHSResize(),t)},l.prototype.frozenlineColor=function(n){var t=this;return arguments.length===0?t._frozenlineColor:t._bindToAutoRefresh(function(n){return n&&(t._frozenlineColor=n),t})(n)},l.prototype.enableFormulaTextbox=function(n){var t=this;return arguments.length===0?t._enableFormulaTextbox:(t._enableFormulaTextbox=n,t)},l.prototype.addRows=function(n,i){var d,u,g,nt,c,l,a,tt,s,v,y,p,w,b,h,k;if(!(i<=0)){var r=this,f=r.getRowCount(),e=r.getDataSource();if(e&&t._BindingManager.isDataViewSource(e)){if(!e.canAdd||!e.canAdd())return;n=f}d=r.isPaintSuspended();r.isPaintSuspended(!0);try{if((n<0||n>f)&&(n=f),u=r._getCalcModel(),u){if(!r._checkArrayFormula(n,0,0,r.getColumnCount()))return;u.getCalcService().getOperatorAdjustor().onBeforeAddRemoveRows(u,n)}if(g=this._sheetModelManager.getRowInfos(),g.addItems(n,i),nt=this._sheetModelManager.getDataModel(),nt.addRows(n,i),c=r._cutCopyIndicatorManager,c&&c.addRows(),l=r._bindingManager,l&&l.addItems(n,i),o.adjustCustomNameOnInsertRemove(r,n,i,!0,!0),a=r._getCalcModel(),a&&a.addRows(n,i),tt=r._getModel(2),tt.addRows(n,i),s=r._getSpanModel(2),s.addRows(n,i),s=r._getSpanModel(),s.addRows(n,i),v=r._rowFilter,v&&v._addRows(n,i),y=r.rowRangeGroup,y&&y._add(n,i),p=r._sparklineGroupManager,p&&p._addRows(n,i),w=r._conditionalFormats,w&&w._addRows(n,i),b=r._tableManager,b&&b.addRows(n,i),u)u.getCalcService().getOperatorAdjustor().onAfterAddRemoveRows(u,n,i,!0);h=r._floatingObjectArray;h&&h.length>0&&h.addRows(n,i);k=r._commentManager;k&&k.addRows(n,i);r._needSyncVScrollbarSize=!0;r.triggerRowChanged({sheet:r,sheetName:r._name,row:n,oldValue:f,count:i,sheetArea:3,propertyName:"addRows"})}finally{r.isPaintSuspended(d)}}},l.prototype.deleteRows=function(n,r){var u=this,w=u.getRowCount(),a,ot,e,h,c,st,f,b,k,d,ht,g,ct,y,nt,tt,it,rt,ut,v,s,l,p,ft,et;if(!(0>n)&&!(n>=w)&&!(r<=0)&&(a=u.getDataSource(),!a||!t._BindingManager.isDataViewSource(a)||a.canRemove&&a.canRemove())){ot=u.isPaintSuspended();u.isPaintSuspended(!0);try{if(e=u._getCalcModel(),e){if(!u._checkArrayFormula(n,0,r,u.getColumnCount()))return;e.getCalcService().getOperatorAdjustor().onBeforeAddRemoveRows(e,n)}if(h=u._getModel(),u.deletedRows||(u.deletedRows=[]),c=u._bindingManager,c)for(st=c.getRowCount(),f=0;f<r&&n+f<h.getRowCount();f++)b=null,n+f<st&&(b=c.getDataItem(n+f)),k=i,h.dataTable&&h.dataTable[n+f]&&(k=h.dataTable[n+f].key),u.deletedRows.push({row:n+f,data:b,key:k});if(o.adjustCustomNameOnInsertRemove(u,n,r,!1,!0),d=u._getCalcModel(),d&&d.deleteRows(n,r),ht=this._sheetModelManager.getRowInfos(),ht.deleteItems(n,r),h.deleteRows(n,r),c&&c.removeItems(n,r),g=u._cutCopyIndicatorManager,g&&g.deleteRows(),ct=u._getModel(2),ct.deleteRows(n,r),y=u._getSpanModel(2),y.removeRows(n,r),y=u._getSpanModel(),y.removeRows(n,r),nt=u._rowFilter,nt&&nt._removeRows(n,r),tt=u.rowRangeGroup,tt&&tt._remove(n,r),it=u._sparklineGroupManager,it&&it._removeRows(n,r),rt=u._conditionalFormats,rt&&rt._removeRows(n,r),ut=u._tableManager,ut&&ut.removeRows(n,r),v=u._scrollTopRow,v>=0){for(s=-1,l=v;l>=u.frozenRowCount;l--)if(u.getRowVisible(l)&&u._getZoomRowHeight(l)>0){s=l;break}s===-1&&(s=0);v!==s&&(u._scrollTopRow=s,u._syncVScrollbarPosition(),u.triggerTopRowChanged({sheet:u,sheetName:u._name,oldTopRow:v,newTopRow:s}))}if(e)e.getCalcService().getOperatorAdjustor().onAfterAddRemoveRows(e,n,r,!1);p=u._floatingObjectArray;p&&p.length>0&&p.removeRows(n,r);ft=u._commentManager;ft&&ft.removeRows(n,r);et=w;u.getActiveRowIndex()>=et&&u.setActiveCell(et-1,u.getActiveColumnIndex());u._needSyncVScrollbarSize=!0;u.triggerRowChanged({sheet:u,sheetName:u._name,row:n,oldValue:w,count:r,sheetArea:3,propertyName:"deleteRows"})}finally{u.isPaintSuspended(ot)}}},l.prototype.addColumns=function(n,t){if(!(t<=0)){var i=this,r=i.getColumnCount();i._bindToAutoRefresh(function(n,t){var u,w,b,s,h,k,f,c,l,a,v,y,e,p;if((n<0||n>r)&&(n=r),!i.parent||!i.parent.gcSpreadsheet){if(u=i._getCalcModel(),u){if(!i._checkArrayFormula(0,n,i.getRowCount(),0))return;u.getCalcService().getOperatorAdjustor().onBeforeAddRemoveColumns(u,n)}if(w=i._sheetModelManager.getColInfos(),w.addItems(n,t),b=i._getModel(),b.addColumns(n,t),s=i._cutCopyIndicatorManager,s&&s.addColumns(),o.adjustCustomNameOnInsertRemove(i,n,t,!0,!1),h=i._getCalcModel(),h&&h.addColumns(n,t),k=i._getModel(1),k.addColumns(n,t),f=i._getSpanModel(1),f.addColumns(n,t),f=i._getSpanModel(),f.addColumns(n,t),c=i._rowFilter,c&&c._addColumns(n,t),l=i.colRangeGroup,l&&l._add(n,t),a=i._sparklineGroupManager,a&&a._addColumns(n,t),v=i._conditionalFormats,v&&v._addColumns(n,t),y=i._tableManager,y&&y.addColumns(n,t),u)u.getCalcService().getOperatorAdjustor().onAfterAddRemoveColumns(u,n,t,!0);e=i._floatingObjectArray;e&&e.length>0&&e.addColumns(n,t);p=i._commentManager;p&&p.addColumns(n,t);i._needSyncHScrollbarSize=!0;i.triggerColumnChanged({sheet:i,sheetName:i._name,col:n,oldValue:r,count:t,sheetArea:3,propertyName:"addColumns"})}})(n,t)}},l.prototype.deleteColumns=function(n,t){var i=this,r=i.getColumnCount();0>n||n>=r||t<=0||i.parent&&i.parent.gcSpreadsheet||i._bindToAutoRefresh(function(n,t){var f=i._getCalcModel(),l,g,nt,a,tt,h,v,y,p,w,b,s,u,e,c,k,d;if(f){if(!i._checkArrayFormula(0,n,i.getRowCount(),t))return;f.getCalcService().getOperatorAdjustor().onBeforeAddRemoveColumns(f,n)}if(o.adjustCustomNameOnInsertRemove(i,n,t,!1,!1),l=i._getCalcModel(),l&&l.deleteColumns(n,t),g=i._sheetModelManager.getColInfos(),g.deleteItems(n,t),nt=i._getModel(),nt.deleteColumns(n,t),a=i._cutCopyIndicatorManager,a&&a.deleteColumns(),tt=i._getModel(1),tt.deleteColumns(n,t),h=i._getSpanModel(1),h.removeColumns(n,t),h=i._getSpanModel(3),h.removeColumns(n,t),v=i._rowFilter,v&&v._removeColumns(n,t),y=i.colRangeGroup,y&&y._remove(n,t),p=i._sparklineGroupManager,p&&p._removeColumns(n,t),w=i._conditionalFormats,w&&w._removeColumns(n,t),b=i._tableManager,b&&b.removeColumns(n,t),s=i._scrollLeftCol,s>=0){for(u=-1,e=s;e>=i.frozenColCount;e--)if(i.getColumnVisible(e)&&i._getZoomColumnWidth(e)>0){u=e;break}u===-1&&(u=0);s!==u&&(i._scrollLeftCol=u,i._syncHScollbarPosition(),i.triggerLeftColumnChanged({sheet:i,sheetName:i._name,oldLeftCol:s,newLeftCol:u}))}if(f)f.getCalcService().getOperatorAdjustor().onAfterAddRemoveColumns(f,n,t,!1);c=i._floatingObjectArray;c&&c.length>0&&c.removeColumns(n,t);k=i._commentManager;k&&k.removeColumns(n,t);d=r;i.getActiveColumnIndex()>=d&&i.setActiveCell(i.getActiveRowIndex(),d-1);i._needSyncHScrollbarSize=!0;i.triggerColumnChanged({sheet:i,sheetName:i._name,col:n,oldValue:r,count:t,sheetArea:3,propertyName:"deleteColumns"})})(n,t)},l.prototype.setFrozenCount=function(n,t){(typeof n===u||n===i||n<0||isNaN(n))&&(n=0);(typeof t===u||t===i||t<0||isNaN(t))&&(t=0);var r=this;(r.frozenRowCount!==n||r.frozenColCount!==t)&&r._bindToAutoRefresh(function(n,t){var i=!1;r.frozenRowCount!==n&&(r._scrollTopRow+=n-r.frozenRowCount,r.frozenRowCount=n,i=!0);r.frozenColCount!==t&&(r._scrollLeftCol+=t-r.frozenColCount,r.frozenColCount=t,i=!0);i&&(r._needSyncVScrollbarSize=!0,r._needSyncHScrollbarSize=!0)})(n,t)},l.prototype.setFrozenColumnCount=function(n){(typeof n===u||n===i||n<0||isNaN(n))&&(n=0);var t=this;t.frozenColCount!==n&&t._bindToAutoRefresh(function(n){t._scrollLeftCol+=n-t.frozenColCount;t.frozenColCount=n;t._needSyncHScrollbarSize=!0})(n)},l.prototype.setFrozenRowCount=function(n){(typeof n===u||n===i||n<0||isNaN(n))&&(n=0);var t=this;t.frozenRowCount!==n&&t._bindToAutoRefresh(function(n){t._scrollTopRow+=n-t.frozenRowCount;t.frozenRowCount=n;t._needSyncVScrollbarSize=!0})(n)},l.prototype.setFrozenTrailingRowCount=function(n){(typeof n===u||n===i||n<0||isNaN(n))&&(n=0);var t=this;t._frozenTrailingRowCount!==n&&t._bindToAutoRefresh(function(n){t._frozenTrailingRowCount=n;t._needSyncVScrollbarSize=!0})(n)},l.prototype.setFrozenTrailingColumnCount=function(n){(n===r||n===i||n<0||isNaN(n))&&(n=0);var t=this;t._frozenTrailingColCount!==n&&t._bindToAutoRefresh(function(n){t._frozenTrailingColCount=n;t._needSyncHScrollbarSize=!0})(n)},l.prototype.getRowCount=function(n){var t=this._sheetModelManager.getDataModel(n);return t&&t.getRowCount()||0},l.prototype.getColumnCount=function(n){var t=this._sheetModelManager.getDataModel(n);return t&&t.getColumnCount()||0},l.prototype.setRowCount=function(n,u){(u===r||u===i)&&(u=3);var f=this.getDataSource();(!f||t._BindingManager.isCellBindingSource(f)||u!==3&&u!==2)&&this._setRowCountInternal(n,u)},l.prototype._setRowCountInternal=function(n,t){if(n=parseInt(n,10),!isNaN(n)){var u=this;n<0||n===u.getRowCount(t)||u._bindToAutoRefresh(function(n,t){var f,e,o;(t===r||t===i)&&(t=3);f=u._sheetModelManager;t===3||t===2?(f.dataModel().getRowCount()>n&&u.deleteRows(n,f.dataModel().getRowCount()-n),f.dataModel().setRowCount(n),f.rowHeaderModel().setRowCount(n),u.frozenRowCount>n&&u.setFrozenRowCount(n),u.rowRangeGroup&&u.rowRangeGroup._setCount(n)):t===1&&(e=f.colHeaderModel(),e.getRowCount()>n&&(o=f.getRowInfos(t),o.deleteItems(n,e.getRowCount()-n)),e.setRowCount(n));u._conditionalFormats&&u._conditionalFormats._resetCache();u._needSyncVScrollbarSize=!0;u._activeRowIndex>=n&&(t===3||t===2)&&u.setActiveCell(n-1,u.getActiveColumnIndex());u.clearPendingChanges()})(n,t)}},l.prototype.setColumnCount=function(n,t){if(n=parseInt(n,10),!isNaN(n)){var u=this;n<0||n===u.getColumnCount(t)||u._bindToAutoRefresh(function(n,t){var f,e,o;(t===r||t===i)&&(t=3);f=u._sheetModelManager;t===3||t===1?(f.dataModel().getColumnCount()>n&&u.deleteColumns(n,f.dataModel().getColumnCount()-n),u._setColumnCountCore(n)):t===2&&(e=f.rowHeaderModel(),e.getColumnCount()>n&&(o=f.getColInfos(t),o.deleteItems(n,e.getColumnCount()-n)),e.setColumnCount(n));u._conditionalFormats&&u._conditionalFormats._resetCache();u._needSyncHScrollbarSize=!0;u._activeColIndex>=n&&(t===3||t===1)&&u.setActiveCell(u.getActiveRowIndex(),n-1);u.clearPendingChanges()})(n,t)}},l.prototype._setColumnCountCore=function(n){var t=this,i=t._sheetModelManager;i.dataModel().setColumnCount(n);i.colHeaderModel().setColumnCount(n);t.frozenColCount>n&&t.setFrozenColumnCount(n);t.colRangeGroup&&t.colRangeGroup._setCount(n)},l.prototype.getText=function(n,t,r){var s;(typeof r===u||r===i)&&(r=3);var e=this,f=e.getValue(n,t,r),h=e.getCellType(n,t,r),o=e.getStyleProperty(n,t,"formatter",r);return o||(o=e.getStyleProperty(n,t,"_autoFormatter",r)),s={sheet:e,row:n,col:t,sheetArea:r},f=h.format(f,o,s),f&&typeof f=="string"&&f!==""&&(f=f.replace(/\r\n?/g,"\n")),f},l.prototype.setText=function(n,u,f,e){var o=this;o._bindToAutoRefresh(function(n,u,f,e){var c,l,h,y;(e===r||e===i)&&(e=3);c=f;l=t.util.isStringNumber(t._NumberHelper.replaceCultureSymbolToNormal(f));t.features.formatter&&l&&(h={},(new t.GeneralFormatter).GetPreferredDisplayFormatter(c,h),typeof h.value=="number"&&(f=h.value));var s=f,a=o.getCellType(n,u,e),v=o.getCell(n,u,e).formatter();a&&v&&(y={sheet:o,row:n,col:u,sheetArea:e},s=a.parse(c,v,y),s=s===i||s===r?f:s);o._setValueInternal(n,u,s,e)})(n,u,f,e)},l.prototype.getValue=function(n,f,e){var s,c,o,h,l,y,a,v,p,w;return((typeof e===u||e===i)&&(e=3),s=this,c=s._getModel(e),!c)?i:(o=s._getValueImp(c,n,f,e),e===1?(o===r||o===i)&&(l=s.getDataSource(),l&&(y=window.ko,(t._BindingManager.isDataViewSource(l)||l.length>0||y&&y.isObservable(l))&&(a=s._sheetModelManager.getColInfos()._getItem(f),v=s.colHeaderAutoTextIndex,a&&(v>=0&&n===v||v===-1&&n===c.getRowCount()-1)&&(o=a.displayName||a.name))),(o===r||o===i)&&(h=s.colHeaderAutoTextIndex,(h<0||h>=c.getRowCount())&&(h=c.getRowCount()-1),n===h&&(p=s.colHeaderAutoText,p===2?o=s._indexToLetters(f+1):p===1&&(o=f+1)))):e===2&&(o===r||o===i)&&(h=this.rowHeaderAutoTextIndex,(h<0||h>=c.getColumnCount())&&(h=c.getColumnCount()-1),f===h&&(w=s.rowHeaderAutoText,w===2?o=s._indexToLetters(n+1):w===1&&(o=n+1))),o)},l.prototype._getCurrentValue=function(n,t){var i=this;return i._isValidatingCell&&i._validatingRow===n&&i._validatingColumn===t?i._validatingValue:i.getValue(n,t)},l.prototype._getValuesForCalc=function(n,t,i,r,u,f){var e=this,l=e._getModel(),s,h;if(l){var v=e.getRowCount(),y=e.getColumnCount(),p,w,c,o,a=e._isValidatingCell;for(s=0;s<r;s++)for(f||(c=[],n.push(c)),h=0;h<u;h++)a&&e._validatingRow===s+t&&e._validatingColumn===h+i?(o=e._validatingValue,a=!1):o=e._getValueImp(l,t,i,3),f?n.push(o):c.push(o)}},l.prototype.setValue=function(n,t,i,r,u){this._setValueInternal(n,t,i,r,u);this.invalidate()},l.prototype._setValueInternal=function(n,f,e,s,h){var l,a,tt,it,v,rt,y,w,ut,b,g,nt,ft;if(((typeof s===u||s===i)&&(s=3),l=this,a=l._getModel(s),a)&&(tt=a.getRowCount(),it=a.getColumnCount(),!(n<0)&&!(n>=tt)&&!(f<0)&&!(f>=it))){v=s===3;e=o.tryConvertDateToOADate(e);var k=l._getValueImp(a,n,f,s),p=!1,d=l._tableManager,c;if(v&&d&&d._tableList.length>0&&(c=d.find(n,f),c))if(c.showHeader()&&n===c.headerIndex()){if(c._hasColumnName(e))return;rt=e!==r&&e!==i&&typeof e!="string"?e.toString():e;c._setHeaderName(f,rt)}else c.showFooter()&&n===c.footerIndex()?c._setFooterValue(f,e):p=c._setValue(n,f,e);v?(y=l._bindingManager,!p&&y&&y._dataSource&&(w=y.getValue(n,f),w.hasBinding&&e!==w.value&&(ut=t.GC$.extend({},l.getDataItem(n)),a._updateDirty(n,f,{originalItem:ut,oldValue:k}),y.setValue(n,f,e)),p=w.hasBinding),(!p||l.checkingChanges)&&a.setValue(n,f,e)):a.setValue(n,f,e);v&&!h&&l._recalcCell(a,n,f);v&&c&&c.hasSlicerData()&&(b=c.dataRange(),b.contains(n,f)&&(g=c.getSlicerData(),g&&g.onDataChanged(n-b.row,f-b.col,{value:l.getValue(n,f),text:l.getText(n,f)})));nt=l._conditionalFormats;nt&&nt._clearCache();ft=l._eventHandler._eventSuspended>0;ft||k===e||l._raiseCellChanged(vt,n,f,k,e,s)}},l.prototype.sortRange=function(n,i,u,f,e,o){var s=this,h=t.util.hasCalc()&&t.Calc.CalcOperatorAdjustor;return s._bindToAutoRefresh(function(n,i,u,f,e,o){var vt,ht,tt,d,g,it,rt,at;if(s._checkArrayFormula(n,0,u,s.getColumnCount(),!1)){vt=s.isPaintSuspended();s.isPaintSuspended(!0);s.suspendEvent();s.suspendCalcService();try{if(ht=s.getSpans(new t.Range(n,i,u,f)),ht&&ht.length>0)return!1;var ct=s.getRowCount(),lt=s.getColumnCount(),k,b,c,l,v,y,ut,ft,et,ot,st,wt=[];if(n===-1&&(n=0),u===-1&&(u=ct),i===-1&&(i=0),f===-1&&(f=lt),n<0||n>=ct||i<0||i>=lt||u<0||n+u>ct||f<0||i+f>lt||!o)return!1;if(tt=[],ut=s._quickSort(n,i,u,f,e,o),ut){var yt=s._getModel(),a=s._getCalcModel(),pt=s._getSheetSource(),nt,p,w;if(e){for(b=n;b<n+u;b++)if(nt=s._getSwapIndex(ut,n,b),wt[nt]=b,b!==nt)for(c=b,v=nt,k=i;k<i+f;k++)l=k,ft=s.getValue(c,l),et=s.getValue(v,l),ot=s.getComment(c,l),st=s.getComment(v,l),a&&pt&&(d=a._getCellCalc(c,l,!1),d&&d.hasListeners()&&d.addListenersToAdjust(),g=a._getCellCalc(v,l,!1),g&&g.hasListeners()&&g.addListenersToAdjust(),a._swapNode(c,l,v,l),p=h._copyExpression(a._getExpr(c,l),c,l,0,0),a._setExpr(c,l,p),w=a._getCellCalc(c,l,!!p),w&&w.startListening(),p=h._copyExpression(a._getExpr(v,l),v,l,0,0),a._setExpr(v,l,p),w=a._getCellCalc(v,l,!!p),w&&w.startListening()),yt.swapNode(c,l,v,l),s.setComment(c,l,st),s.setComment(v,l,ot),s.setValue(c,l,et),s.setValue(v,l,ft),tt.push(new t.CellPosition(c,l)),tt.push(new t.CellPosition(v,l))}else for(k=i;k<i+f;k++)if(nt=s._getSwapIndex(ut,i,k),k!==nt)for(l=k,y=nt,b=n;b<n+u;b++)c=b,ft=s.getValue(c,l),et=s.getValue(c,y),ot=s.getComment(c,l),st=s.getComment(c,y),a&&pt&&(d=a._getCellCalc(c,l,!1),d&&d.hasListeners()&&d.addListenersToAdjust(),g=a._getCellCalc(c,y,!1),g&&g.hasListeners()&&g.addListenersToAdjust(),a._swapNode(c,l,c,y),p=h._copyExpression(a._getExpr(c,l),c,l,0,0),a._setExpr(c,l,p),w=a._getCellCalc(c,l,!!p),w&&w.startListening(),p=h._copyExpression(a._getExpr(c,y),c,y,0,0),a._setExpr(c,y,p),w=a._getCellCalc(c,y,!!p),w&&w.startListening()),yt.swapNode(c,l,c,y),s.setComment(c,l,st),s.setComment(c,y,ot),s.setValue(c,l,et),s.setValue(c,y,ft),tt.push(new t.CellPosition(c,l)),tt.push(new t.CellPosition(c,y));for(it=n;it<n+u;it++)for(rt=i;rt<i+f;rt++)at=a.getExpression(it,rt),at&&a.setExpression(it,rt,at,r);return!0}return!1}finally{s.resumeCalcService(!1);s.resumeEvent();s.isPaintSuspended(vt);s._raiseRangeDataChanged(n,i,u,f,tt,4)}}})(n,i,u,f,e,o)},l.prototype.canDoSort=function(){return!this.isProtected||this._protectionOption.allowSort},l.prototype.clearStyleCache=function(){this._styleComposeCache=[{},{},{},{}]},l.prototype.getActualStyle=function(n,f,e,o,s){var it,g,rt,ut,ft;if((typeof e===u||e===i)&&(e=3),n===-1&&f===-1)return this.getDefaultStyle(e);var l=this,h,c,a,v,y,at=l._styleComposeCache,k,d,p,et,nt,ot,st,ht,tt=this._sheetModelManager.getDataModel(e);if(!tt)return new t.Style;if(a=tt.getStyle(n,f),v=tt.getStyle(n,-1),y=tt.getStyle(-1,f),a=a?a:i,v=v?v:i,y=y?y:i,ot=a?a.charAt?a:"__spreadJSDefault"+a._id:"__undefined",st=v?v.charAt?v:"__spreadJSDefault"+v._id:"__undefined",ht=y?y.charAt?y:"__spreadJSDefault"+y._id:"__undefined",et=at[e],k=et[ot],it=l._tableManager,it&&it.getCount()>0&&e===3&&(nt=it.find(n,f)),nt||(k||(k=et[ot]={}),d=k[st],d?p=d[ht]:d=k[st]={}),p||(c=l.getCompositeStyle(n,f,e,a,v,y,nt)),e===3&&!o&&(p||(g=c.formatter,g&&g.HasFormatedColor&&g.HasFormatedColor()&&(rt={value:i},g.Format(l.getValue(n,f),rt),rt.value&&(h=new t.Style,h.foreColor=rt.value))),ut=l._conditionalFormats,ut&&ut.count()>0)){var ct=ut.getRules(n,f),lt=ct.length,w,b=i;if(lt>0)for(ct.sort(function(n,t){return n.priority()-t.priority()}),ft=0;ft<lt;ft++)if((w=ct[ft],w)&&(w.isScaleRule()?(w instanceof t.TwoScaleRule||w instanceof t.ThreeScaleRule)&&(b=w.evaluate(l,n,f,l.getValue(n,f,e)),b&&(h||(h=new t.Style),h.backColor===r&&(h.backColor=b))):(b=w.evaluate(l,n,f,l.getValue(n,f,e)),b&&(h||(h=new t.Style),h.compose(b))),w.stopIfTrue()&&b))break}if(h)h.compose(p?p:c),c=h;else if(p)return s?p:p.clone();return(typeof c.locked===u||c.locked===i)&&(c.locked=!0),c=c._normalize(l._currentTheme),h||nt||(d[ht]=c.clone()),c},l.prototype.getStyleProperty=function(n,f,e,o){var h,s,d,p,w,c,l,b,k,g,nt,tt,y,it,ut;if((typeof o===u||o===i)&&(o=3),h=this,w=h._getModel(o),!w)return r;if(l=!1,o===3&&(e==="foreColor"&&(k=h.getStyleProperty(n,f,"formatter",o),k&&k.HasFormatedColor&&k.HasFormatedColor()&&(g={value:i},k.Format(h.getValue(n,f),g),g.value&&(c=g.value,l=!0))),nt=h._conditionalFormats,nt&&nt.count()>0)){var rt=nt.getRules(n,f),ft=rt.length,a,v=i;if(ft>0)for(rt.sort(function(n,t){return n.priority()-t.priority()}),tt=0;tt<ft;tt++)if(a=rt[tt],a){if(a.isScaleRule()){if(e==="backColor"&&(a instanceof t.TwoScaleRule||a instanceof t.ThreeScaleRule)&&(v=a.evaluate(h,n,f,h.getValue(n,f,o)),v)){c=v;l=!0;break}}else if(v=a.evaluate(h,n,f,h.getValue(n,f,o)),v&&v[e]!==r){c=v[e];l=!0;break}if(a.stopIfTrue()&&v)break}}for(y=0;!l&&y<=4;)if(y===0?s=w.getStyle(n,f):y===1?(it=h._tableManager,it&&it.getCount()>0&&o===3&&(ut=it.find(n,f),ut&&t.TableStyle[e]&&(s=new t.Style,ut._compose(n,f,s)))):s=y===2?w.getStyle(n,-1):y===3?w.getStyle(-1,f):h.getDefaultStyle(),y++,s){if(s.charAt&&typeof s=="string"&&(s=h._name2Style(s)),e==="font"&&s.themeFont&&!b&&(b=s.themeFont),s[e]!==r){c=s[e];l=!0;break}for(d=s.parentName;d;){if(p=h._name2Style(d),!p)break;if(p[e]!==r){c=p[e];l=!0;break}d=p.parentName}}if(e==="locked")return c===r||c===i?!0:c;else if(l||b)return(e==="foreColor"||e==="backColor"||e==="font"||e==="borderLeft"||e==="borderTop"||e==="borderRight"||e==="borderBottom")&&(s=new t.Style,s[e]=c,e==="font"&&b&&(s.themeFont=b),s._normalize(h._currentTheme),c=s[e]),c;return r},l.prototype.getStyle=function(n,t,i){return this.getStyleImp(n,t,i,!0)},l.prototype.getStyleImp=function(n,u,f,e){var s,o,h,c;if((f===r||f===i)&&(f=3),s=this._sheetModelManager.getDataModel(f),s)if(o=s.getStyle(n,u),o instanceof t.Style)return e&&this.clearStyleCache(),o;else if(typeof o=="string"&&(h=this._name2Style(o),h!==i))return c=new t.Style,c.compose(h),e&&this.clearStyleCache(),c;return i},l.prototype.addNamedStyle=function(n){this._addNamedStyleImp(n,!0)},l.prototype._addNamedStyleImp=function(n,u){var f,e;if(n!==i&&n!==r){if(n.name===i||n.name===r||n.name==="")throw new Error(t.SR.Exp_EmptyNamedStyle);u?(f=this,this._bindToAutoRefresh(function(n){var t=n.name.toUpperCase();f._namedStyles[t]=n})(n)):(e=n.name.toUpperCase(),this._namedStyles[e]=n)}},l.prototype.getNamedStyle=function(n){return this.getNamedStyleImp(n,!0)},l.prototype.getNamedStyleImp=function(n,t){var u=this._namedStyles,r;return u&&n?(n=n.toUpperCase(),r=u[n]||i,r&&t&&this.clearStyleCache(),r):i},l.prototype.getNamedStyles=function(){var n=[],i=this._namedStyles;return i&&t.GC$.each(i,function(t,i){n.push(i)}),this.clearStyleCache(),n},l.prototype.removeNamedStyle=function(n){var t=this;t._namedStyles&&n!==r&&n!=i&&n!==""&&(n=n.toUpperCase(),t._namedStyles.hasOwnProperty(n)&&(delete t._namedStyles[n],t.invalidate()))},l.prototype.setStyle=function(n,r,f,e){(typeof e===u||e===i)&&(e=3);this.setStyleObject(n,r,f,e);n===-1&&r===-1&&(this._composedDefaultStyle[e]=i);(n===-1||r===-1)&&f&&f.validator&&f.validator.condition instanceof t.FormulaCondition&&f.validator.condition.getExpected(this,n<0?0:n,r<0?0:r);this.clearStyleCache();this.invalidate()},l.prototype.setStyleWithoutLocked=function(n,i,u,f){var o=this,s,e;o.isProtected?(s=o.getStyle(n,i,f),u?(e=s?s.locked:r,u.locked!==e&&(u.locked=e),o.setStyle(n,i,u,f)):s&&(e=s.locked,e!==r&&(u=new t.Style,u.locked=e),o.setStyle(n,i,u,f))):o.setStyle(n,i,u,f)},l.prototype.getStyleName=function(n,i,r){var u=this.getStyleObject(n,i,r);return u instanceof t.Style?u.name:u},l.prototype.setStyleName=function(n,t,i,r){typeof i=="string"&&(this.setStyleObject(n,t,i,r),this.invalidate())},l.prototype.getStyleObject=function(n,t,u){(u===r||u===i)&&(u=3);var f=i,e=this._getModel(u);return e&&(f=e.getStyle(n,t),f!==r&&f!==i)?f:i},l.prototype.setStyleObject=function(n,r,f,e){var y,p,c,w,b,l,a;(typeof e===u||e===i)&&(e=3);var o=this,s=o.getStyleObject(n,r,e),k=s&&s.formatter,h=o._getModel(e);if(h){if(y=h.getRowCount(),p=h.getColumnCount(),n<-1||n>=y||r<-1||r>=p)return;c=h.getStyle(n,r);h.setStyle(n,r,f);t._DataValidatorCache.setStyle(f,o,n,r);w=s&&s.cellType&&s.cellType.typeName||i;b=f&&f.cellType&&f.cellType.typeName||i;n===o._activeRowIndex&&r===o._activeColIndex&&w!==b&&t.FocusHelper.isActiveElement(o)&&o._eventHandler.changeFocusHolder();f&&f.formatter&&t.features.formatter&&(l=f.formatter,l&&typeof l.Init===v&&l.Init());a="[styleinfo]";n!==-1&&r!==-1?o._raiseCellChanged(a,n,r,c,f,e):n!==-1&&r===-1?o.triggerRowChanged({sheet:o,sheetName:o._name,row:n,sheetArea:e,propertyName:a,oldValue:c}):n===-1&&r!==-1&&o.triggerColumnChanged({sheet:o,sheetName:o._name,col:r,sheetArea:e,propertyName:a,oldValue:c})}},l.prototype.getDefaultStyle=function(n){var f,s,e,r,h,o;return((typeof n===u||n===i)&&(n=3),f=this._composedDefaultStyle,s=f[n],s)?s:(e=this._sheetModelManager.getDataModel(n),e)?(r=e.getStyle(-1,-1),typeof r=="string"&&(r=this._name2Style(r)),r||(r=new t.Style,e.setStyle(-1,-1,r)),h=n===1||n===2,typeof r.hAlign===u&&(r.hAlign=h?1:3),typeof r.vAlign===u&&(r.vAlign=h?1:0),typeof r.imeMode===u&&(r.imeMode=1),r.font||typeof r.themeFont!==u||(r.themeFont="Body"),f[n]=r,r):(o=new t.Style,o.locked=!0,f[n]=o,o)},l.prototype.setDefaultStyle=function(n,r){(typeof r===u||r===i)&&(r=3);var f=this._sheetModelManager.getDataModel(r);f&&(f.setStyle(-1,-1,n),t._DataValidatorCache.setStyle(n,this,-1,-1));this._composedDefaultStyle[r]=i;this.clearStyleCache()},l.prototype._name2Style=function(n){var r=this.getNamedStyleImp(n,!1),t;return r?r:(t=this.parent,t&&t.getNamedStyleImp)?t.getNamedStyleImp(n,!1):i},l.prototype.getCompositeStyle=function(n,r,f,e,o,s,h){var d,g,c,k,p;(typeof f===u||f===i)&&(f=3);var v=this,y=new t.Style,l,a,w=!1,b=v._sheetModelManager.getDataModel(f);if(b){if(d=b.getRowCount(),g=b.getColumnCount(),0<=n&&n<d&&0<=r&&r<g&&(c=e!==undefined?e:b.getStyle(n,r),c&&c.charAt&&(c=v._name2Style(c)),c))for(y.compose(c,!0),w=!0,a=c.parentName;a;){if(l=v._name2Style(a),!l)break;y.compose(l);a=l.parentName}if(h===undefined&&(k=v._tableManager,k&&k.getCount()>0&&f===3&&(h=k.find(n,r))),h&&(h._compose(n,r,y),w=!0),0<=n&&n<d&&(c=o!==undefined?o:b.getStyle(n,-1),c&&c.charAt&&(c=v._name2Style(c)),c))for(y.compose(c,!w),w=!0,a=c.parentName;a;){if(l=v._name2Style(a),!l)break;y.compose(l);a=l.parentName}if(0<=r&&r<g&&(c=s!==undefined?s:b.getStyle(-1,r),c&&c.charAt&&(c=v._name2Style(c)),c))for(y.compose(c,!w),w=!0,a=c.parentName;a;){if(l=v._name2Style(a),!l)break;y.compose(l);a=l.parentName}}if(p=v.getDefaultStyle(f),p&&p.charAt&&(p=v._name2Style(p)),p)for(y.compose(p,!w),a=p.parentName;a;){if(l=v._name2Style(a),!l)break;y.compose(l);a=l.parentName}return y},l.prototype.getCellType=function(n,t,i){return this.getStyleProperty(n,t,"cellType",i)||this.getDefaultCellType(i)},l.prototype.getDefaultCellType=function(n){(typeof n===u||n===i)&&(n=3);var r=this._defaultCellType;return r||(r=this._defaultCellType=new t.TextCellType),n===3?r:n===1?new t.ColumnHeaderCellType:n===2?new t.RowHeaderCellType:n===0?new t.CornerCellType:r},l.prototype.setCellType=function(n,i,r,u){var f=this.getStyleImp(n,i,u);f||(f=new t.Style);f.cellType=r;this.setStyle(n,i,f,u)},l.prototype.getFormatter=function(n,t,i){return this.getStyleProperty(n,t,"formatter",i)},l.prototype.setFormatter=function(n,i,r,u){var f=this.getStyleImp(n,i,u);f||(f=new t.Style);f.formatter=r;this.setStyle(n,i,f,u)},l.prototype._changeFormatterAfterCultureChanged=function(n,r){var u=n,e,o,f;u&&u._autoFormatter&&u._autoFormatter._innerFormatter&&r!==i&&(e=u._autoFormatter._innerFormatter,o=e.GetPreferredEditingFormatter(r),u._autoFormatter._innerFormatter=o);u.formatter&&typeof u.formatter!="string"&&(f=u.formatter,t.GeneralFormatter._needChangeDefaultFormat(f)&&(f.cultureName=t._CultureInfo._currentCulture.Name(),f.isConstructed=!1))},l.prototype.getDataValidator=function(n,t,i){return this.getStyleProperty(n,t,"validator",i)},l.prototype.setDataValidator=function(n,u,f,e){var o,h,c,s,a,l;(e===r||e===i)&&(e=3);o=this;h=o.getStyleImp(n,u,e);h||(h=new t.Style);c=h.validator;h.validator=f;o.suspendEvent();o.setStyle(n,u,h,e);o.resumeEvent();t.features.conditionalFormat&&f&&f.condition instanceof t.FormulaCondition&&(s=f.condition,(s._baseRow===r||s._baseRow===i)&&(s._baseRow=n!==-1?n:0),(s._baseCol===r||s._baseCol===i)&&(s._baseCol=u!==-1?u:0));a=t.Events;l="validator";o._raiseCellChanged(l,n,u,c,f,e);n!==-1&&u===-1?o.triggerRowChanged({sheet:o,sheetName:o._name,row:n,sheetArea:e,propertyName:l,oldValue:c}):n===-1&&u!==-1&&o.triggerColumnChanged({sheet:o,sheetName:o._name,col:u,sheetArea:e,propertyName:l,oldValue:c})},l.prototype.isValid=function(n,t,r){var u,f;try{if(u=this,u._validatingRow=n,u._validatingColumn=t,u._validatingValue=r,u._isValidatingCell=!0,f=u.getDataValidator(n,t),f)return f.isValid(u,n,t,r)}finally{u._validatingRow=-1;u._validatingColumn=-1;u._validatingValue=i;u._isValidatingCell=!1}return!0},l.prototype.addSelection=function(n,i,r,u){var f=this;f._bindToAutoRefresh(function(n,i,r,u){var s=n,h=i,c=r,l=u,o,e;s!==-1&&h!==-1&&(o=f._getSpanModel().getSpans(),o&&o.length>0&&(e=f._cellRangeInflate(o,new t.Range(n,i,r,u)),s=e.row,h=e.col,c=e.rowCount,l=e.colCount));f._selectionModel.add(s,h,c,l)})(n,i,r,u)},l.prototype.setSelection=function(n,t,i,r){this._setSelectionImp(n,t,i,r,2)},l.prototype._setSelectionImp=function(n,i,r,u,f){var e=this,a=e.getRowCount(),v=e.getColumnCount(),o,s,h,c,l;n>=a&&(n=a-1);o=n;o<0&&(o=0);s=i;i>=v&&(i=v-1);s<0&&(s=0);e._clearSelectionImp();h=!0;switch(f){case 1:h=!0;break;case 0:h=!1;break;case 2:h=t.FocusHelper.isActiveElement(e);break}c=1;o<e.frozenRowCount?c=0:o>=a-e._frozenTrailingRowCount&&(c=2);l=1;s<e.frozenColCount?l=0:s>=v-e._frozenTrailingColCount&&(l=2);e._setActiveCellImp(o,s,c,l,!h);e.addSelection(n,i,r,u)},l.prototype.getSelections=function(){return this._selectionModel.toArray()},l.prototype.canSelect=function(n,t,i){var f=this,e=f._protectionOption.allowSelectLockedCells!==!1,l=f._protectionOption.allowSelectUnlockedCells!==!1,s,a,c,o,r,u;if(!f.isProtected||e&&l)return!0;if(!e&&!l)return!1;if(s=i?i.locked:f.getStyleProperty(n,t,"locked"),e===s&&(n<0||t<0)){var p=t<0,w=n<0,b=n<0?f.getRowCount():1;n=n<0?0:n;a=t<0?f.getColumnCount():1;t=t<0?0:t;var h=f._getModel(),k=h.dataTable,v=n+b-1,y=t+a-1;for(r=n;r<=v;r++)if(c=k[r],c)for(u=t;u<=y;u++)if(o=c[u],o&&o.style&&e!==o.style.locked)return!1;if(w)for(r=n;r<=v;r++)if(i=h.getStyle(r,-1),i&&e!==i.locked)return!1;if(p)for(u=t;u<=y;u++)if(i=h.getStyle(-1,u),i&&e!==i.locked)return!1}return e===s},l.prototype.canSelectFloatingObject=function(n){return!this.isProtected||!n.isLocked()||this._protectionOption.allowEditObjects},l.prototype.canEditComment=function(n){return!this.isProtected||this._protectionOption.allowEditObjects||n&&!n.locked()},l.prototype.canEditFloatingObject=function(n){return!this.isProtected||!n.isLocked()||this._protectionOption.allowEditObjects},l.prototype.canDoResizeRows=function(){return!this.isProtected||this._protectionOption.allowResizeRows},l.prototype.canDoResizeColumns=function(){return!this.isProtected||this._protectionOption.allowResizeColumns},l.prototype._addSpanImp=function(n,u,f,e,o){var s=this;s._bindToAutoRefresh(function(n,u,f,e,o){var l,a,v,h,c;if((o===r||o===i)&&(o=3),l=s._getSpanModel(o),l.clear(n,u,f,e),a=new t.Range(n,u,f,e),v=s._getActualRange(a,o),l.addSpan(v),o===3){for(h=s.getSelections(),c=0;c<h.length;c++)h[c].intersect(n,u,f,e)&&(h[c]=h[c].union(a));s._selectionModel.fromArray(h)}})(n,u,f,e,o)},l.prototype.addSpan=function(n,i,r,u,f){var e=this,o,s;if((r!==1||u!==1)&&f!==0&&(o=!0,(f===3||f===undefined)&&(o=e._checkArrayFormula(n,i,r,u,!1)),o)){if(s=e._getSpanModel(f),s.hasPartSpans(n,i,r,u))throw new Error(t.SR.Exp_InvalidRange);e._addSpanImp(n,i,r,u,f);e._updateCommentsInSpanChangedArea(!0,n,i,r,u)}},l.prototype.removeSpan=function(n,t,u){var f=this;this._bindToAutoRefresh(function(n,t,u){var o,e,s;for((u===r||u===i)&&(u=3),o=f._getSpanModel(u),e=0;e<o.length;e++)if(s=o[e],s.row===n&&s.col===t){o.removeSpan(e,1);return}})(n,t,u);f._updateCommentsInSpanChangedArea(!1,n,t)},l.prototype._updateCommentsInSpanChangedArea=function(n,t,r,u,f){var e=this,l,s,o,a;if(n&&e._commentManager)for(l=e._commentManager.getCommentList(),s=0;s<l.length;s++){var o=l[s],h=o._rowIndex,c=o._colIndex;(h!==t||c!==r)&&h>=t&&h<t+u&&c>=r&&c<r+f&&e.setComment(h,c,i)}o=e.getComment(t,r);o&&(a=e._commentManager.getCommentView(o),a&&a.updateLayoutWhenCellSpanChanged())},l.prototype.repaint=function(n){this._paintSuspended||this._render.repaint(n)},l.prototype.startEdit=function(n,t){var r=this;r._startEditImp(r._getCanvas(),r._activeRowIndex,r._activeColIndex,i,i,n,t)},l.prototype.editorStatus=function(){return this._editorStatus?this._editorStatus:0},l.prototype.isEditing=function(){return this._editorStatus===1||this._editorStatus===2},l.prototype.doKeyDown=function(n){this._eventHandler.doKeyDown(n)},l.prototype.doKeyUp=function(n){this._eventHandler.doKeyUp(n)},l.prototype.doCompositionStart=function(n){this._eventHandler.doCompositionStart(n)},l.prototype.removeKeyMap=function(n,t,i,r,u){this.removeKeyMapInternal(n,t,i,r,u,this.keyMap)},l.prototype.removeKeyMapInternal=function(n,t,i,r,u,f){var o,e;if(f)for(u=typeof u=="function"?!1:u,o=0;o<f.length;o++)if(e=f[o],e&&e.key===n&&e.ctrl===t&&e.shift===i&&e.alt===r&&e.meta===u){f.splice(o,1);break}},l.prototype.removeFloatingObjectKeyMap=function(n,t,i,r,u){this.removeKeyMapInternal(n,t,i,r,u,this.floatingObjectKeyMap)},l.prototype.removeSlicerKeyMap=function(n,t,i,r,u){this.removeKeyMapInternal(n,t,i,r,u,this._slicerKeyMap)},l.prototype.removeCommentKeyMap=function(n,t,i,r,u){this.removeKeyMapInternal(n,t,i,r,u,this._commentKeyMap)},l.prototype.addKeyMap=function(n,t,i,r,u,f){this.keyMap||(this.keyMap=[]);this.addKeyMapInternal(n,t,i,r,u,f,this.keyMap)},l.prototype.addKeyMapInternal=function(n,i,r,u,f,e,o){var h=this;o||(o=[]);var c=e&&f||!1,l=e||f,f=c,e=l,s=h._getKeyActionInternal(n,i,r,u,f,o);s?s.action=e:o.push(new t.KeyMap(n,i,r,u,f,e))},l.prototype.addFloatingObjectKeyMap=function(n,t,i,r,u,f){this.floatingObjectKeyMap||(this.floatingObjectKeyMap=[]);this.addKeyMapInternal(n,t,i,r,u,f,this.floatingObjectKeyMap)},l.prototype.addSlicerKeyMap=function(n,t,i,r,u,f){this._slicerKeyMap||(this._slicerKeyMap=[]);this.addKeyMapInternal(n,t,i,r,u,f,this._slicerKeyMap)},l.prototype.addCommentKeyMap=function(n,t,i,r,u,f){this._commentKeyMap||(this._commentKeyMap=[]);this.addKeyMapInternal(n,t,i,r,u,f,this._commentKeyMap)},l.prototype._moveFormulaTextBoxCell=function(n,r,f,e){var o=this,a=o._formulaTextBox,w,c,l,b,k,s,v;if(a&&a.canAppendRange()&&(!o.parent||o.parent.canUserEditFormula())&&o._enableFormulaTextbox){var h=o._getKeyboardAppendingInfo(),d=h.anchorRow,g=h.anchorCol,y=h.leadingRow,p=h.leadingCol;(typeof f===u||f===i)&&(f=d);(typeof e===u||e===i)&&(e=g);w=o._eventHandler;switch(n){case 3:s=o._getMoveLeftCell(f,e,r,y);break;case 4:s=o._getMoveRightCell(f,e,r,y);break;case 1:s=o._getMoveUpCell(f,e,r,p);break;case 2:s=o._getMoveDownCell(f,e,r,p);break;case 5:s=o._getMoveFirstCell();break;case 6:s=o._getMoveLastCell();break;default:break}s&&(c=s.row,l=s.col,b=s.leadingCellRow?s.leadingCellRow:c,k=s.leadingCellCol?s.leadingCellCol:l,o._canMoveCurrentTo(c,l))&&(h.anchorRow=c,h.anchorCol=l,h.leadingRow=b,h.leadingCol=k,v=w.rangeToString(new t.Range(c,l,1,1)),v&&a.appendRange(v,!1,!0),c>=0&&l>=0&&o._scrollByMoveCell(c,l))}},l.prototype._changeFormulaTextBoxActiveRange=function(n,i){var r=this,u=r._formulaTextBox,l,a,e;if(u&&u.canAppendRange()&&(!r.parent||r.parent.canUserEditFormula())&&r._enableFormulaTextbox){var o=r._eventHandler,s=r._getKeyboardAppendingInfo(),h=s.anchorRow,c=s.anchorCol,f;u.isAppending()?(l=u.getActiveRange(),f=o.stringToRange(l.text)):f=new t.Range(h,c,1,1);f&&(a=r._getKeyboardSelectedRange(f,n,i,h,c),e=o.rangeToString(a),e&&u.appendRange(e,!0,!1))}},l.prototype._getKeyboardAppendingInfo=function(){var n=this,i=n._formulaTextBox,t=n._eventHandler;return i.isAppending()?t._formulaRangeAppendingInfo:t._formulaRangeAppendingInfo={anchorRow:n._activeRowIndex,anchorCol:n._activeColIndex,leadingRow:n._leadingCellRow,leadingCol:n._leadingCellCol}},l.prototype.moveActiveCell=function(n,u,f,e){var o=this,s={sheet:o,sheetName:o._name,row:o._activeRowIndex,col:o._activeColIndex,cancel:!1},h,c,l;(o.triggerLeaveCell(s),s&&s.cancel===!0)||o.endEdit()&&(h=o._activeRowIndex,c=o._activeColIndex,(f===r||f===i)&&(f=o._activeRowIndex),(e===r||e===i)&&(e=o._activeColIndex),l=t.Direction,n===3?o._moveActiveCellLeft(f,e,u):n===4?o._moveActiveCellRight(f,e,u):n===1?o._moveActiveCellUp(f,e,u):n===2?o._moveActiveCellDown(f,e,u):n===5?o._moveActiveCellFirst():n===6&&o._moveActiveCellLast(),o.moveActiveCellEnd(n,h,c))},l.prototype._moveActiveCellInSelection=function(n){var t=this,i={sheet:t,sheetName:t._name,row:t._activeRowIndex,col:t._activeColIndex,cancel:!1},r,u;(t.triggerLeaveCell(i),i&&i.cancel===!0)||t.endEdit()&&(r=t._activeRowIndex,u=t._activeColIndex,n===3?t._moveActiveCellLeftInSelection(t._activeRowIndex,t._activeColIndex):n===4&&t._moveActiveCellRightInSelection(t._activeRowIndex,t._activeColIndex),t.moveActiveCellEnd(n,r,u))},l.prototype.doDataItemChanged=function(){var n=this._bindingManager;n&&n.doDataItemChanged()},l.prototype.moveActiveCellEnd=function(n,i,r){var u=this,k=u._eventHandler,d=u._selectionModel.toArray(),g=!1,v,p,ut,ft,o,w,b,a;u._isNavigateInSelection||(v=u._fixRange(u._getActiveSelectedRange()),(u._selectionModel.length>1||v.rowCount>1||v.colCount>1)&&(g=!0),u._clearSelectionImp());var e=u._activeRowIndex,s=u._activeColIndex,y=u._getSpanModel().find(e,s);if(y?(u._activeRowCount=y.rowCount,u._activeColCount=y.colCount):(u._activeRowCount=1,u._activeColCount=1),!u._isNavigateInSelection){var f=u._getExtendedRange(e,s),nt=u.selectionPolicy(),tt=u.selectionUnit();nt===0?u._selectionModel.clear():nt===1&&u._selectionModel.clear();tt===1?(f.col=-1,f.colCount=-1):tt===2&&(f.row=-1,f.rowCount=-1);u._replaceActiveSelectedRange(f.row,f.col,f.rowCount,f.colCount,!1);p=u._selectionModel.toArray();k._notEqualSelecions(d,p)&&(ut=t.Events,u.triggerSelectionChanging({sheet:u,sheetName:u._name,oldSelections:d,newSelections:p}),u.triggerSelectionChanged({sheet:u,sheetName:u._name}))}if(ft=u._scrollTopRow,u._scrollByMoveCell(e,s),i!=e&&u.doDataItemChanged(),o=u._render,g){var h=u._getSheetLayout(),c=h.headerX,l=h.headerY,it=h.width-c,rt=h.height-l;o.copyDoubleBuffer(c,l,it,rt);o.repaint(new t.Rect(c,l,it,h.colHeaderHeight));o.repaint(new t.Rect(c,l,h.rowHeaderWidth,rt));o.paintAdornment(o._getCtx())}else a=u._getSpanModel().find(i,r),a?(w=a.rowCount,b=a.colCount):(w=1,b=1),o.repaintSelection(new t.Range(e,s,u._activeRowCount,u._activeColCount).union(new t.Range(i,r,w,b)));u.triggerEnterCell({sheet:u,sheetName:u._name,row:e,col:s});k._updateValidationUI(e,s)},l.prototype._scrollByMoveCell=function(n,t){var i=this,a=i.frozenColCount?i._getNextVisualColumn(i.frozenColCount-1):i._getFirstVisualColumn(),v=i.frozenRowCount?i._getNextVisualRow(i.frozenRowCount-1):i._getFirstVisualRow(),s,c,l;if(t<i._scrollLeftCol&&t>=a&&i._setLeftColumn(i._getPrevVisualColumn(t+1)),t>i._getLastFullyVisibleColumn()&&t<=i._getLastVisualColumn()){var o=0,r=t,y=i._getSheetLayout(),f=i._getSpanModel().find(n,r);for(f&&(r=f.col+f.colCount-1);r>i._scrollLeftCol;){if(o+=i._getZoomColumnWidth(r),o>y.viewportWidth)break;r--}s=i._getNextVisualColumn(r);i._setLeftColumn(s)}if(n<i._scrollTopRow&&n>=v&&i._setTopRow(i._getPrevVisualRow(n+1)),n>i._getLastFullyVisibleRow()&&n<=i._getLastVisualRow()){var h=0,u=n,e=i._getSpanModel().find(u,t);for(e&&(u=e.row+e.rowCount-1),c=i._getSheetLayout();u>i._scrollTopRow;){if(h+=i._getZoomRowHeight(u),h>c.viewportHeight)break;u--}l=i._getNextVisualRow(u);i._setTopRow(l)}n===i._getLastVisualRow()&&i._setTopRow(i._getLastPageTopRow());t===i._getLastVisualColumn()&&i._setLeftColumn(i._getLastPageLeftColumn())},l.prototype.commitArrayFormula=function(){this._endEditImp(!1,1)},l.prototype._endEditImp=function(n,t){var i=this,r,u;if(!i.isEditing())return!0;r=i.isPaintSuspended();i.isPaintSuspended(!0);try{u=i._endEditCore(n,t)}finally{return u?i.isPaintSuspended(r):i._paintSuspended=r,u}},l.prototype._endEditCore=function(n,r){var u=this,c=u._eventHandler,f=u._editor,l,e=u.getCellType(u._activeRowIndex,u._activeColIndex),o={sheet:u,row:u._activeRowIndex,col:u._activeColIndex,sheetArea:3},a,s,y,p,k,v,d,g,b,h,nt;if(!e.isImeAware(o)&&c&&c.changeFocusHolder(),f&&f.parentNode){if(a=e.getEditorValue(f,o),s={sheet:u,sheetName:u._name,row:u._activeRowIndex,col:u._activeColIndex,editor:f,editingText:a,cancel:!1},u.triggerEditEnd(s),s&&s.cancel===!0)return;if(u.triggerEditEnding(s),s&&s.cancel===!0)return;if(u._detachFormulaTextBox(),y=this.parent&&this.parent._attachedFormulaTextBox,w.activeElement===(y&&y._host)&&c.changeFocusHolder(),u._activeRowIndex>=0&&u._activeColIndex>=0&&(p=f._oldValue,e.isEditingValueChanged(p,a,o)||r===1))if(n)e.setEditorValue(f,p,o),e.selectAll(f,o);else if(k=e.hasOwnProperty("_autoFormatValue")?e._autoFormatValue:!0,v={row:u._activeRowIndex,col:u._activeColIndex,newValue:a,autoFormat:k},r===1&&(d=[u._getActiveSelectedRange()],v.ranges=d,v.endEditType=r),l=new t.UndoRedo.CellEditUndoAction(u,v),u._doCommand(l),g=l.applyResult===2,g===!0)return e.focus(f,o),u._attachFormulaTextBox(e.getEditingElement()),!1;if(u._dirty=!0,e.deactivateEditor(f,o),e.isImeAware(o))t.util.browser.msie&&parseFloat(t.util.browser.version)===9&&c?c.changeFocusHolder():(t.GC$(f).css("width","0"),t.GC$(f).css("height","0"),t.GC$(f).css("overflow","hidden"));else for(b=u._getHost(),h=f;h;)h.parentNode===b?b.removeChild(h):h=h.parentNode}return(u._editingTimeValue=!1,u.triggerEditEnded({sheet:u,sheetName:u._name,row:u._activeRowIndex,col:u._activeColIndex,editingText:a}),u._editorStatus!==0&&(nt=u._editorStatus,u._editorStatus=0,u.triggerEditorStatusChanged({sheet:u,sheetName:u._name,oldStatus:nt,newStatus:0})),u._editor=i,l&&l.applyResult===1)?!1:!0},l.prototype.endEdit=function(n){return this._endEditImp(n)},l.prototype.hitTest=function(n,t,u){var e=this,f,l,o,s,h,c,a,v,y,p,w,b;return e._getSheetLayout(),f={x:n,y:t,rowViewportIndex:i,colViewportIndex:i,row:-1,col:-1,resizeInfo:i,hitTestType:i,groupHitInfo:i,filterButtonHitInfo:i,dragInfo:i,cellTypeHitInfo:i,floatingObjectHitInfo:i,formulaRangeHitInfo:i,commentHitInfo:i},l=e._render.groupHitTest(n,t),l?f.groupHitInfo=l:(o=e._getRowViewportIndexFromY(t),s=e._getColumnViewportIndexFromX(n),f.rowViewportIndex=o,f.colViewportIndex=s,f.row=e._getRowIndexFromY(t,o),f.col=e._getColumnIndexFromX(n,s),o>=0&&o<=2&&s>=0&&(h=e._getCellLayoutByCell(o,s,r,f.row,f.col),h&&u!==!0&&(f.row=h.row,f.col=h.col)),f.hitTestType=e._getSheetArea(o,s),c=e._eventHandler,(y=c.getDragInfo(f,n,t))?f.dragInfo=y:(a=c.getResizingRowCol(f,n,t,5))?f.resizeInfo=a:(w=c.getFormulaRangeHitInfo(f,n,t))?f.formulaRangeHitInfo=w:(b=this._getCommentHitInfo(n,t))?f.commentHitInfo=b:(v=this._getFloatingObjectHitInfo(n,t))?f.floatingObjectHitInfo=v:(p=e._getFilterButtonHitInfo(f,n,t))?f.filterButtonHitInfo=p:f.cellTypeHitInfo=e._getCellTypeHitInfo(f,n,t)),f},l.prototype.getCellRect=function(n,r,f,e){var s=3,o,h;if(f===-1?s=1:e===-1&&(s=2),o=this,h=o._getSheetLayout(),f===-1&&e===-1)return new t.Rect(h.headerX,h.headerY,h.rowHeaderWidth,h.colHeaderHeight);var l=o.getBounds(),y=o.getRowCount(),p=o.getColumnCount();(typeof f===u||f===i)&&(n<o.frozenRowCount?f=0:n<y-o._frozenTrailingRowCount?f=1:n<y&&(f=2));(typeof e===u||e===i)&&(r<o.frozenColCount?e=0:r<p-o._frozenTrailingColCount?e=1:r<p&&(e=2));var a=o._getRowLayout(f,s).findRow(n),v=o._getColumnLayout(e,s).findCol(r),c=o._getCellLayout(f,e,s).findCell(n,r);return c?new t.Rect(c.x-l.x,c.y-l.y,c.width,c.height):a&&v?new t.Rect(v.x-l.x,a.y-l.y,v.width,a.height):new t.Rect},l.prototype._setActiveCellCore=function(n,t,u){var f=this,o=f._eventHandler,e=!1;n!==i&&n!==r&&(f._activeRowIndex=n,e=!0);t!==i&&t!==r&&(f._activeColIndex=t,e=!0);!u&&o&&e&&o.changeFocusHolder()},l.prototype._setActiveCellImp=function(n,i,r,u,f){var e=this,h=e._activeRowIndex,c=e._activeColIndex,o=e._getSpanModel().find(n,i);if(o?(e._activeRowCount=o.rowCount,e._activeColCount=o.colCount):(e._activeRowCount=1,e._activeColCount=1),!e._paintSuspended){var s=e._getSpanModel().find(h,c),l=1,a=1;s&&(l=s.rowCount,a=s.colCount);e._render.repaintSelection(new t.Range(h,c,l,a))}e.activeRowViewportIndex=r;e.activeColViewportIndex=u;e._setActiveCellCore(n,i,f);e._leadingCellRow=n;e._leadingCellCol=i},l.prototype.setActiveCell=function(n,t,i,r){this._setActiveCellAndSelection(n,t,i,r,2)},l.prototype._setActiveCellAndSelection=function(n,i,r,u,f){var e=this;e._bindToAutoRefresh(function(n,i,r,u,f){var h=e.getRowCount(),c=e.getColumnCount(),s,o;n<0?n=0:n>=h&&(n=h-1);i<0?i=0:i>=c&&(i=c-1);e._clearSelectionImp();s=!0;switch(f){case 1:s=!0;break;case 0:s=!1;break;case 2:s=t.FocusHelper.isActiveElement(e);break}e._setActiveCellImp(n,i,r,u,!s);o=e._getSpanModel().find(n,i);o?e._setSelectedRange(o.row,o.col,o.rowCount,o.colCount):e._setSelectedRange(n,i,1,1)})(n,i,r,u,f)},l.prototype.getActiveRowIndex=function(){return this._activeRowIndex},l.prototype.getActiveColumnIndex=function(){return this._activeColIndex},l.prototype.selectionPolicy=function(n){return arguments.length===0?this._selectionModel.selectionPolicy:(this._selectionModel.selectionPolicy=n,this)},l.prototype.selectionUnit=function(n){return arguments.length===0?this._selectionModel.selectionUnit:(this._selectionModel.selectionUnit=n,this)},l.prototype.getRowResizable=function(n,t){return this._sheetModelManager.getRowInfos(t).getResizeable(n)},l.prototype.setRowResizable=function(n,t,i){this.setRowColInfo(n,t,"resizable",!0,i)},l.prototype.setRowColInfo=function(n,t,r,f,e){(typeof e===u||e===i)&&(e=3);var h=this,o=h._sheetModelManager[f?"getRowInfos":"getColInfos"](e),s;switch(r){case"resizable":s=o.getResizeable(n);o.setResizeable(n,t);break;case"pageBreak":s=o.getPageBreak(n);o.setPageBreak(n,t);break;case"isVisible":s=o.getVisible(n);o.setVisible(n,t);break;case pt:s=o.getSize(n);o.setSize(n,t);e===3&&s!==t&&(s===0||t===0)&&h.recalcRows([n]);break;case yt:s=o.getSize(n);o.setSize(n,t);break}f?h.triggerRowChanged({sheet:h,sheetName:h._name,row:n,sheetArea:e,propertyName:r,oldValue:s}):h.triggerColumnChanged({sheet:h,sheetName:h._name,col:n,sheetArea:e,propertyName:r,oldValue:s})},l.prototype.getColumnResizable=function(n,t){return this._sheetModelManager.getColInfos(t).getResizeable(n)},l.prototype.setColumnResizable=function(n,t,i){this.setRowColInfo(n,t,"resizable",!1,i)},l.prototype.getRowHeight=function(n,t){var r=this,o,h,f,s,e;return((typeof t===u||t===i)&&(t=3),(t===3||t===2)&&((o=this._sheetModelManager.getDataModel(t),h=o&&o.getRowCount()||0,n<0||n>=h)||r.filterRowsVisibleInfo&&!r.filterRowsVisibleInfo.getRowVisible(n)||(f=r.rowRangeGroup,f&&!f._isEmpty()&&f.isCollapsed(n))))?0:(s=r.defaults.rowHeight,t===1&&(s=r.defaults.colHeaderRowHeight),e=r._sheetModelManager.getRowInfos(t).getSize(n),e||e===0?e:s)},l.prototype._getActualRowHeight=function(n,t){var f,r;return(typeof t===u||t===i)&&(t=3),f=this.defaults.rowHeight,t===1&&(f=this.defaults.colHeaderRowHeight),r=this._sheetModelManager.getRowInfos(t).getActualSize(n),r||r===0?r:f},l.prototype.setRowHeight=function(n,t,i){this.setRowColInfo(n,t,pt,!0,i);this._needSyncVScrollbarSize=!0;this.invalidate()},l.prototype.getRowVisible=function(n,t,r){var e=this,f;return((typeof t===u||t===i)&&(t=3),!r&&(e.isRowFilterOut(n,t)||(t===3||t===2)&&(f=e.rowRangeGroup,f&&!f._isEmpty()&&0<=n&&n<e.getRowCount(t)&&f.isCollapsed(n))))?!1:this._sheetModelManager.getRowInfos(t).getVisible(n)},l.prototype.isRowFilterOut=function(n,t){var r=this;return((typeof t===u||t===i)&&(t=3),(t===3||t===2)&&r.filterRowsVisibleInfo&&!r.filterRowsVisibleInfo.getRowVisible(n))?!0:!1},l.prototype.hasRowFilterOut=function(){return this.filterRowsVisibleInfo&&this.filterRowsVisibleInfo.hasFilterOut()},l.prototype.setRowVisible=function(n,t,i){var r=this;r._bindToAutoRefresh(function(n,t,i){r.setRowColInfo(n,t,"isVisible",!0,i);r._needSyncVScrollbarSize=!0})(n,t,i)},l.prototype.getColumnWidth=function(n,t){var e=this,o,s,h,r,f;return((typeof t===u||t===i)&&(t=3),o=e.defaults.colWidth,t===2&&(o=e.defaults.rowHeaderColWidth),(t===3||t===1)&&((s=this._sheetModelManager.getDataModel(t),h=s&&s.getColumnCount()||0,n<0||n>=h)||(r=e.colRangeGroup,r&&!r._isEmpty()&&r.isCollapsed(n))))?0:(f=this._sheetModelManager.getColInfos(t).getSize(n),f||f===0?f:o)},l.prototype._getActualColumnWidth=function(n,t){var f,r;return(typeof t===u||t===i)&&(t=3),f=this.defaults.colWidth,t===2&&(f=this.defaults.rowHeaderColWidth),r=this._sheetModelManager.getColInfos(t).getActualSize(n),r||r===0?r:f},l.prototype.setColumnWidth=function(n,t,i){this.setRowColInfo(n,t,yt,!1,i);this._needSyncHScrollbarSize=!0;this.invalidate()},l.prototype.getColumnVisible=function(n,t){if((typeof t===u||t===i)&&(t=3),t===3||t===1){var r=this.colRangeGroup;if(r&&!r._isEmpty()&&0<=n&&n<this.getColumnCount(t)&&r.isCollapsed(n))return!1}return this._sheetModelManager.getColInfos(t).getVisible(n)},l.prototype.setColumnVisible=function(n,t,i){var r=this;r._bindToAutoRefresh(function(n,t,i){this.setRowColInfo(n,t,"isVisible",!1,i);r._needSyncHScrollbarSize=!0})(n,t,i)},l.prototype.zoom=function(n){var t=this;return arguments.length===0?t._zoomFactor:(n=parseFloat(n),isNaN(n)||!isFinite(n))?t:(n>4?n=4:n<.25&&(n=.25),t._bindToAutoRefresh(function(n){t.showEditingLocator&&t._showEditingLocator();t._zoomFactor=n;t._needSyncHScrollbarSize=!0;t._needSyncVScrollbarSize=!0})(n),t)},l.prototype.invalidateLayout=function(){var n=this,r=n._eventHandler;n._layoutModel=i;n._cachedGroupLayout=i;n._rowLayoutCache={colHeader:i,viewport:i,colFooter:i};n._colLayoutCache={rowHeader:i,viewport:i};n._filterButtonsModel=i;r&&t.FocusHelper.isActiveElement(n)&&r._updateValidationUI(n._activeRowIndex,n._activeColIndex);n._needSyncHScrollbarSize&&(n._syncHScrollbarSize(),n._needSyncHScrollbarSize=!1);n._needSyncVScrollbarSize&&(n._syncVScrollbarSize(),n._needSyncVScrollbarSize=!1);n._dirty=!0},l.prototype.invalidate=function(){var n=this;!n._paintSuspended&&n._layoutSuspended<=0&&(n.invalidateLayout(),n.repaint())},l.prototype.getViewportHeight=function(n){var t=this._getSheetLayout();return n===0?t.frozenHeight:n===1?t.viewportHeight:n===2?t.frozenTrailingHeight:0},l.prototype.getViewportWidth=function(n){var t=this._getSheetLayout();return n===0?t.frozenWidth:n===1?t.viewportWidth:n===2?t.frozenTrailingWidth:0},l.prototype.getViewportTopRow=function(n){var t=this;return n===0?0:n===1?e(t.frozenRowCount,t._scrollTopRow):n===2?e(t.frozenRowCount,t.getRowCount()-t._frozenTrailingRowCount):-1},l.prototype.getViewportBottomRow=function(n){var t=this,i;if(n===2)return t.getRowCount()-1;var u=t.getViewportTopRow(n),s=t.getViewportHeight(n),e=0,o=0,r=t.getRowCount()-t._frozenTrailingRowCount;for(n===0&&(r=f(t.frozenRowCount,r)),i=u;i<r&&e<s;i++,o++)e+=t._getZoomRowHeight(i);return u+o-1},l.prototype.getViewportLeftColumn=function(n){var t=this;return n===0?0:n===1?e(t.frozenColCount,t._scrollLeftCol):n===2?e(t.frozenColCount,t.getColumnCount()-t._frozenTrailingColCount):-1},l.prototype.getViewportRightColumn=function(n){var t=this,i;if(n===2)return t.getColumnCount()-1;var u=t.getViewportLeftColumn(n),s=t.getViewportWidth(n),e=0,o=0,r=t.getColumnCount()-t._frozenTrailingColCount;for(n===0&&(r=f(t.frozenColCount,r)),i=u;i<r&&o<s;i++,e++)o+=t._getZoomColumnWidth(i);return u+e-1},l.prototype.clearSelection=function(){var n=this;this._bindToAutoRefresh(function(){n._clearSelectionImp();n._setActiveCellImp(0,0);n.unSelectAllComments()})()},l.prototype._clearSelectionImp=function(){this._selectionModel.clear()},l.prototype._validationError=function(n,t,i){var r=this,f=r.getDataValidator(n,t),u={sheet:r,sheetName:r._name,row:n,col:t,validator:f,validationResult:0};return r.triggerValidationError(u),u.validationResult},l.prototype.getSpans=function(n,t){(t===r||t===i)&&(t=3);var u=this._getSpanModel(t);return u?u.getSpans(n):[]},l.prototype.getSpan=function(n,t,u){(u===r||u===i)&&(u=3);var f=this._getSpanModel(u);return f.find(n,t)},l.prototype.getCell=function(n,i,r){return new t.Cell(this,n,i,r)},l.prototype.getCells=function(n,t,i,r,u){var f=this.getCell(n,t,u);return f.row2=i,f.col2=r,f},l.prototype.getRow=function(n,i){return new t.Row(this,n,i)},l.prototype.getRows=function(n,t,i){var r=this.getRow(n,i);return r.index2=t,r},l.prototype.getColumn=function(n,i){return new t.Column(this,n,i)},l.prototype.getColumns=function(n,t,i){var r=this.getColumn(n,i);return r.index2=t,r},l.prototype.setBorder=function(n,t,u,f){var s,y;(f===r||f===i)&&(f=3);s=this;y=s.isPaintSuspended();s.isPaintSuspended(!0);try{var v=s._getActualRange(n,f),h=v.row,c=v.col,l=v.rowCount,a=v.colCount,e,o;if(u.left||u.all||u.outline)for(e=0;e<l;e++)s.getCell(h+e,c,f).borderLeft(t);if(u.top||u.all||u.outline)for(o=0;o<a;o++)s.getCell(h,c+o,f).borderTop(t);if(u.right||u.all||u.outline)for(e=0;e<l;e++)s.getCell(h+e,c+a-1,f).borderRight(t);if(u.bottom||u.all||u.outline)for(o=0;o<a;o++)s.getCell(h+l-1,c+o,f).borderBottom(t);if(u.innerHorizontal||u.all||u.inside)for(e=0;e<l-1;e++)for(o=0;o<a;o++)s.getCell(h+e,c+o,f).borderBottom(t),s.getCell(h+e+1,c+o,f).borderTop(t);if(u.innerVertical||u.all||u.inside)for(o=0;o<a-1;o++)for(e=0;e<l;e++)s.getCell(h+e,c+o,f).borderRight(t),s.getCell(h+e,c+o+1,f).borderLeft(t)}finally{s.isPaintSuspended(y)}},l.prototype.search=function(n){var r,e,v,u,o;if(!n||!t.features.search)return i;var f=this,y=n.sheetArea,s=n.searchString,h=n.searchTarget,l=n.searchFlags,p=f.getRowCount(y),w=f.getColumnCount(y);if(!s||h===0||p<=0&&w<=0)return new t.SearchResult;for(n.rowStart===-1&&(n.rowStart=0),n.columnStart===-1&&(n.columnStart=0),n.findBeginRow===-1&&(n.findBeginRow=n.rowStart),n.findBeginColumn===-1&&(n.findBeginColumn=n.columnStart),n.rowEnd===-1&&(n.rowEnd=p-1),n.columnEnd===-1&&(n.columnEnd=w-1),r=new t.SearchResult,e=new t.CellsEnumerator(f,n),(l&8)>0&&(e.isBlockRange=!0);e.moveNext();){var b=e.currentRow,k=e.currentColumn,a=e.current();if(a&&((h&1)>0&&(v=a.text(),f._trySearch(v,s,l)&&v!==""&&(r.searchFoundFlag|=1,r.foundString=v)),(h&8)>0&&(u=a.formula(),u=typeof u===c?u.toString():i,f._trySearch(u,s,l)&&u!==""&&(r.searchFoundFlag|=8,r.foundString=u)),(h&4)>0&&(o=a.tag(),typeof o===c&&f._trySearch(o,s,l)&&o!==""&&(r.searchFoundFlag|=4,r.foundString=o)),r.searchFoundFlag!==0))return r.foundRowIndex=b,r.foundColumnIndex=k,r}return new t.SearchResult},l.prototype.showCell=function(n,t,i,r){var u=this,h=u.getRowCount(),c=u.getColumnCount(),f,s;if(!(n<0)&&!(n>=h)&&!(t<0)&&!(t>=c)){var e=u._getColumnViewportIndex(t),o=u._getRowViewportIndex(n),l=u.getViewportTopRow(o),a=u.getViewportLeftColumn(e);e===1&&(t=u._getNewLeftColumn(t,r));o===1&&(n=u._getNewTopRow(n,i));f=!1;o===1&&n!==l&&(n>u._getLastVisualScrollRow()&&(n=u._getLastVisualScrollRow()),u._scrollTopRow=n,u._syncVScrollbarPosition(),f=!0);e===1&&t!==a&&(t>u._getLastVisualScrollColumn()&&(t=u._getLastVisualScrollColumn()),u._scrollLeftCol=t,u._syncHScollbarPosition(),f=!0);f&&(s=u.parent,s&&!s._scrollbarShowMax&&(u._needSyncHScrollbarSize=!0,u._needSyncVScrollbarSize=!0),u.invalidateLayout(),u.repaint())}},l.prototype._getRowViewportIndex=function(n){var t=this,i=1;return n<t.frozenRowCount?i=0:n>=t.getRowCount()-t._frozenTrailingRowCount&&(i=2),i},l.prototype._getColumnViewportIndex=function(n){var t=this,i=1;return n<t.frozenColCount?i=0:n>=t.getColumnCount()-t._frozenTrailingColCount&&(i=2),i},l.prototype._getNewLeftColumn=function(n,t){var i=this,u=i._zoomFactor,f=i._getColumnViewportIndex(n),e=i.getViewportLeftColumn(f),r;if(t!==0)if(t===1){for(r=s((i.getViewportWidth(f)-s(i.getColumnWidth(n)*u))/2);0<n;n--)if(r-=s(i.getColumnWidth(n-1)*u),r<0)break}else if(t===2){for(r=i.getViewportWidth(f)-s(i.getColumnWidth(n)*u);0<n;n--)if(r-=s(i.getColumnWidth(n-1)*u),r<0)break}else if(t===3&&n>=e)for(r=i.getViewportWidth(f)-s(i.getColumnWidth(n)*u);e<n;n--)if(r-=s(i.getColumnWidth(n-1)*u),r<0)break;return n},l.prototype._getNewTopRow=function(n,t){var i=this,u=i._zoomFactor,f=i._getRowViewportIndex(n),e=i.getViewportTopRow(f),r;if(t!==0)if(t===1){for(r=s((i.getViewportHeight(f)-s(i.getRowHeight(n)*u))/2);0<n;n--)if(r-=s(i.getRowHeight(n-1)*u),r<0)break}else if(t===2){for(r=i.getViewportHeight(f)-s(i.getRowHeight(n)*u);0<n;n--)if(r-=s(i.getRowHeight(n-1)*u),r<0)break}else if(t===3&&!(n<e||e===-1))for(r=i.getViewportHeight(f)-s(i.getRowHeight(n)*u);e<n;n--)if(r-=s(i.getRowHeight(n-1)*u),r<0)break;return n},l.prototype.showColumn=function(n,t){this.showCell(this._scrollTopRow,n,0,t)},l.prototype.showRow=function(n,t){this.showCell(n,this._scrollLeftCol,t,0)},l.prototype.bind=function(n,t,i){this._eventHandler.bind(n+a,t,i)},l.prototype.unbind=function(n,t){this._eventHandler.unbind(n+a,t)},l.prototype.unbindAll=function(){this._eventHandler.unbind(a)},l.prototype._bind=function(n,t,i){n.indexOf(".")>=0?this._eventHandler.bind(n,t,i):this._eventHandler.bind(n+d,t,i)},l.prototype._unbind=function(n,t){n.indexOf(".")>=0?this._eventHandler.unbind(n,t):this._eventHandler.unbind(n+d,t)},l.prototype._unbindAll=function(){this._eventHandler.unbind(d)},l.prototype.suspendEvent=function(){this._eventHandler._eventSuspended++},l.prototype.resumeEvent=function(){var n=this._eventHandler;n._eventSuspended--;n._eventSuspended<0&&(n._eventSuspended=0)},l.prototype.currentTheme=function(n){var i=this;return arguments.length===0?(i._currentTheme||i.resetCurrentTheme(),i._currentTheme):(typeof n===c&&(n=t.SpreadThemes.hasOwnProperty(n)?t.SpreadThemes[n]:new t.SpreadTheme(n)),i._bindToAutoRefresh(function(n){i._currentTheme=n;i._render._resetDefaultFont();i.clearStyleCache()})(n),i)},l.prototype.resetCurrentTheme=function(){this._currentTheme=this._getDefaultSpreadTheme();this.clearStyleCache()},l.prototype._getDefaultSpreadTheme=function(){var n=t.ThemeStyleHelper.getCssClassThemeStyle(""),i=parseInt(n.zIndex);return i>2007?t.SpreadThemes.Office:t.SpreadThemes.Office2007},l.prototype._createSheetModelManager=function(n){return new t.SheetModelManager(this,n)},l.prototype.reset=function(){var n=this;n._bindToAutoRefresh(function(){n.resetImp()})()},l.prototype.resetImp=function(){var n=this,u,r,f;n.disposed=!1;n.defaults={rowHeight:n._defaultRowHeight,colWidth:n._defaultColWidth,rowHeaderColWidth:n._defaultRowHeaderColWidth,colHeaderRowHeight:n._defaultColHeaderRowHeight};n.gridline={color:t.ThemeStyleHelper.getCssClassThemeStyle("gc-gridlineColor").borderTopColor,showVerticalGridline:n._defaultShowVerticalGridline,showHorizontalGridline:n._defaultShowHorizontalGridline};n._rowLayoutCache={colHeader:i,viewport:i,colFooter:i};n._colLayoutCache={rowHeader:i,viewport:i};n._dragRect={};n._render=new t._SheetRender(n);u=i;n._eventHandler&&(u=n._eventHandler._elem);n._eventHandler=n._createEventHandler();n._eventHandler._elem=u;r=n.parent;r&&(f=r.getActiveSheet(),f&&n.getName()===f.getName()&&n._setHost(r._vp));n._composedDefaultStyle={};t.util.hasCalc()&&(n._vpCalcSheetModel?n._vpCalcSheetModel.clearAll():n._vpSheetSource=new t.Calc.SheetSource(n));this._sheetModelManager=this._createSheetModelManager(this._name);n._selectionModel=new t._SelectionModel;n.resetCurrentTheme();n._allowDragDrop=!0;n._allowDragFill=!0;n._defaultDragFillType=5;n._showDragFillSmartTag=!0;n._protectionOption={};t.features.group&&(n.rowRangeGroup=new t.RangeGroup(n.getRowCount()),n.colRangeGroup=new t.RangeGroup(n.getColumnCount()),n.rowRangeGroup.groupChangeHandler=function(){n._invalidateVScrollbar()},n.colRangeGroup.groupChangeHandler=function(){n._invalidateHScrollbar()});n._showRowRangeGroup=!0;n._showColumnRangeGroup=!0;n.autoGenerateColumns=!0;n._rowFilter=i;t.features.filter&&(n.filterRowsVisibleInfo=new t.FilterRowsVisibleInfo);n._initDefaultKeyMap();t.features.floatingObject&&n._initDefaultFloatingObjectKeyMap();t.features.tableSlicer&&n._initDefaultSlicerKeyMap();t.features.comment&&n._initDefaultCommentKeyMap();n._scrollTopRow=0;n._scrollLeftCol=0;n.frozenRowCount=0;n.frozenColCount=0;n._frozenTrailingRowCount=0;n._frozenTrailingColCount=0;t.features.binding&&(n._bindingManager=new t._BindingManager(n));t.features.sparkline&&(n._sparklineGroupManager=new t.WorksheetSparklineGroupManager(n,n));t.features.table&&(n._tableManager=new t._SheetTableManager(n));t.features.floatingObject&&(n._floatingObjectArray=new t._FloatingObjectArray(n));n._namedStyles={};n._needSyncHScrollbarSize=!0;n._needSyncVScrollbarSize=!0;n._cutCopyIndicatorManager=new t.CutCopyIndicatorManager(n);n.invalidateLayout();n._clipBoardOptions=0;n._containerDiv=i;t.features.comment&&(n._commentManager=new t.CommentManager(n));t.features.tableSlicer&&(n._slicerCollection=new t.SlicerCollection(n))},l.prototype.initCalc=function(n){var i=this,r=i.calcService;(!r||n)&&t.util.hasCalc()&&(i.calcService=n?n:new t.Calc.CalcService,i._getSheetSource().setCalcService(i.calcService),i.calcService.initParserContext(i._getSheetSource()),r&&n?n.setSourceModel(i._getSheetSource(),r.getSourceModel(i._vpSheetSource)):i._vpCalcSheetModel=i.calcService.getSourceModel(i._vpSheetSource))},l.prototype.onAttached=function(t){if(t instanceof n.Sheets.Spread){var r=t,i=this,u=r.isPaintSuspended();i._paintSuspended!==u&&(i._paintSuspended=u);i.enableFormulaTextbox(r.enableFormulaTextbox());i.initCalc(r.calcService)}else i.initCalc();i.parent=t},l.prototype.onDettached=function(){},l.prototype._createEventHandler=function(){return new t._SheetEventHandler(this)},l.prototype.undoManager=function(){var n=this,i=n.parent;return n._undoManager||(n._undoManager=i&&i._undoManager?i._undoManager:new t._UndoManager(n,-1,n.allowUndo())),n._undoManager},l.prototype.clipBoardOptions=function(n){return arguments.length===0?this._clipBoardOptions:(this._clipBoardOptions=n,this)},l.prototype.doCommand=function(n){this._doCommand(n)},l.prototype.copyTo=function(n,t,i,r,u,f,e){this.copyToCore(n,t,i,r,u,f,e)},l.prototype.copyToCore=function(n,t,i,r,u,f,e,s){var h=this,c=h.isPaintSuspended();h.isPaintSuspended(!0);h.suspendEvent();o.copyTo(h,n,t,h,i,r,u,f,e,s);h.resumeEvent();h.isPaintSuspended(c)},l.prototype.moveTo=function(n,t,i,r,u,f,e){var s=this,h=s.isPaintSuspended();s.isPaintSuspended(!0);s.suspendEvent();o.moveTo(s,n,t,s,i,r,u,f,e);s.resumeEvent();s.isPaintSuspended(h)},l.prototype.setCsv=function(n,t,i,r,u,f){var e=this,s=e.isPaintSuspended();e.isPaintSuspended(!0);e.suspendEvent();o.setRangeText(e,n,t,i,r,u,'"',f);e.resumeEvent();e.isPaintSuspended(s)},l.prototype.getCsv=function(n,t,i,r,u,f){return o.getRangeText(this,n,i,t,r,u,f,'"',!0,0)},l.prototype.canUserDragDrop=function(n){var i=this,t=i.parent;return arguments.length===0?(t&&t.canUserDragDrop&&(i._allowDragDrop=t.canUserDragDrop()),i._allowDragDrop):(t&&t.canUserDragDrop?t.canUserDragDrop(n):i._allowDragDrop=n,i)},l.prototype.canUserDragFill=function(n){var i=this,r=i.parent,u;return arguments.length===0?t.features.fill?(r&&r.canUserDragFill&&(i._allowDragFill=r.canUserDragFill()),i._allowDragFill):!1:(u=i.canUserDragFill(),u!==n&&(r&&r.canUserDragFill?r.canUserDragFill(n):i._allowDragFill=n,i.getSelections().length!==1||i._paintSuspended||i._render.repaintSelection(i.getSelections()[0])),i)},l.prototype.showDragFillSmartTag=function(n){var t=this,i=t.parent,r;return arguments.length===0?(i&&i.showDragFillSmartTag&&(t._showDragFillSmartTag=i.showDragFillSmartTag()),t._showDragFillSmartTag):(r=t.showDragFillSmartTag(),typeof n=="boolean"&&r!==n&&(i&&i.showDragFillSmartTag?i.showDragFillSmartTag(n):t._showDragFillSmartTag=n),t)},l.prototype.defaultDragFillType=function(n){var i=this,u=i.parent,f;return arguments.length===0?(u&&u.defaultDragFillType&&(i._defaultDragFillType=u.defaultDragFillType()),i._defaultDragFillType):(f=i.defaultDragFillType(),t.AutoFillType[n]!==r&&n!==4&&n!==f&&(u&&u.defaultDragFillType?u.defaultDragFillType(n):i._defaultDragFillType=n),i)},l.prototype.isColumnBound=function(n){var i=this,r,t;return n<0||n>=i.getColumnCount()?!1:(r=i.getDataSource(),r)?(t=this._sheetModelManager.getColInfos()._getItem(n),!!(t&&t.name)):!1},l.prototype.getDataColumnName=function(n){var r=this,u,t;return n<0||n>=r.getColumnCount()?i:(u=r.getDataSource(),u)?(t=this._sheetModelManager.getColInfos()._getItem(n),t&&(t.displayName||t.name)):i},l.prototype.getSparkline=function(n,t){if(!this._sparklineGroupManager)return i;var r=3,u=this._sheetModelManager.getDataModel(r);return u.getSparkline(n,t)},l.prototype.setSparkline=function(n,u,f,e,o,s,h,c){var l=this,a=l._sparklineGroupManager;return a?l._bindToAutoRefresh(function(n,u,f,e,o,s,h,c){var w=f,v=new t.Sparkline(n,u,w,e,o,s),y,p;return h&&c!==r&&c!==i&&(v.dateAxisData(h),v.dateAxisOrientation(c),v.group().displayDateAxis=!0),y=l.getSparkline(n,u),l.removeSparkline(n,u),p=l._getModel(),p.setSparkline(n,u,v),a.add(v.group()),l._raiseCellChanged("sparkline",n,u,y,v,3),v})(n,u,f,e,o,s,h,c):i},l.prototype.removeSparkline=function(n,t){var r=this,u=r._sparklineGroupManager;u&&r._bindToAutoRefresh(function(n,t){var s=3,o=r._getModel(s),e=o.getSparkline(n,t),f;e&&(f=e.group(),f.remove(e),f.count()<=0&&u.remove(f));o.setSparkline(n,t,i)})(n,t)},l.prototype.groupSparkline=function(n){var t=this._sparklineGroupManager,r;return t?(r=this,this._bindToAutoRefresh(function(n){for(var r,f,u=i,e=0;e<n.length;e++)if(r=n[e],r){if(!u){u=r.group();continue}f=r.group();f.remove(r);u.add(r);f.count()<=0&&t.remove(f)}return u})(n)):i},l.prototype.ungroupSparkline=function(n){var i=this,t=i._sparklineGroupManager;t&&i._bindToAutoRefresh(function(n){var i,r,u,f;if(n){for(i=[],i=i.concat(n._innerList),r=0;r<i.length;r++)u=i[r],u&&(n.remove(u),f=n.clone(),f.add(u),t.add(f));t.remove(n)}})(n)},l.prototype.fillAuto=function(n,i,r){if(t.features.fill){if(!i)throw new Error(t.SR.Exp_RangeIsNull);var u=this;u._checkFillRange(n,i,r)&&u._bindToAutoRefresh(function(n,i,r){n&&(u._eventHandler._dragFillStartRange=n);var f=new t.FillImp(u);f.fillAuto(i,r)})(n,i,r)}},l.prototype.fillAutobyDirection=function(n,r,u){if(t.features.fill){if(!r)throw new Error(t.SR.Exp_RangeIsNull);var f=this;f._checkFillRange(n,r,i,u)&&f._bindToAutoRefresh(function(n,i,r){n&&(f._eventHandler._dragFillStartRange=n);var u=new t.FillImp(f);u.fillAutobyDirection(i,r)})(n,r,u)}},l.prototype.fillLinear=function(n,i,r,u,f){if(t.features.fill){if(!i)throw new Error(t.SR.Exp_RangeIsNull);var e=this;e._checkFillRange(n,i,r)&&e._bindToAutoRefresh(function(n,i,r,u,f){n&&(e._eventHandler._dragFillStartRange=n);var o=new t.FillImp(e);o.fillLinear(i,r,u,f)})(n,i,r,u,f)}},l.prototype.fillGrowth=function(n,i,r,u,f){if(t.features.fill){if(!i)throw new Error(t.SR.Exp_RangeIsNull);var e=this;e._checkFillRange(n,i,r)&&e._bindToAutoRefresh(function(n,i,r,u,f){n&&(e._eventHandler._dragFillStartRange=n);var o=new t.FillImp(e);o.fillGrowth(i,r,u,f)})(n,i,r,u,f)}},l.prototype.fillDate=function(n,u,f,e,o,s){if(t.features.fill){if(!u)throw new Error(t.SR.Exp_RangeIsNull);var h=this;h._checkFillRange(n,u,f)&&h._bindToAutoRefresh(function(n,u,f,e,o,s){n&&(h._eventHandler._dragFillStartRange=n);var l=new t.FillImp(h),c=i;s!==r&&s!==i&&(c=new t._DateTimeHelper(s).toOADate());l.fillDate(u,f,e,o,c)})(n,u,f,e,o,s)}},l.prototype._checkFillRange=function(n,t,u,f){if(!n||!t||!t.containsRange(n))return!1;if(u!==r&&u!==i)if(u===1){if(n.row===t.row&&n.rowCount===t.rowCount)return!0}else if(u===0&&n.col===t.col&&n.colCount===t.colCount)return!0;if(f!==r&&f!==i)if(f===2||f===3){if(n.col===t.col&&n.colCount===t.colCount)return!0}else if((f===0||f===1)&&n.row===t.row&&n.rowCount===t.rowCount)return!0;return!1},l.prototype.clear=function(n,t,i,r,u,f){this.clearCore(n,t,i,r,u,f)},l.prototype._checkArrayFormula=function(n,i,r,u,f){return(f=f===undefined?!0:!1,f&&this._hasPartArrayFormulas(n,i,r,u)||!f&&this._hasArrayFormula(n,i,r,u))?(this._raiseInvalidOperation(4,t.SR.Exp_ChangePartOfArray),!1):!0},l.prototype.clearCore=function(n,t,u,f,e,o,s){var h=this;h._bindToAutoRefresh(function(n,t,u,f,e,o){var c,a,l,v,d,it,w,g,y,p,nt,b,tt;h.suspendCalcService();try{if(d=3,e===r||e===i||e===d){if(!h._checkArrayFormula(n,t,u,f))return!1;if(o&1){if(h.getDataSource()){for(h.suspendEvent(),c=n;c<n+u;c++)if(!s||!h.isRowFilterOut(c))for(a=t;a<t+f;a++)h.setValue(c,a,i,e);h.resumeEvent()}h._conditionalFormats&&h._conditionalFormats._clearCache();h._rowFilter&&h._rowFilter.range&&h._rowFilter._clear(n,t,u,f)}if(o&16&&h._sparklineGroupManager&&h._sparklineGroupManager.clear(n,t,u,f),h._tableManager){it=h._tableManager.clear(n,t,u,f,o);h.onTableRemoved(it)}o&4&&h._commentManager&&h._commentManager.clear(n,t,u,f)}if(w=h._getModel(e),g=h._getCalcModel(e),w){for(c=n===-1?0:n,y=n===-1?w.getRowCount():u,a=t===-1?0:t,p=t===-1?w.getColumnCount():f,nt=[],b=c;b<y;b++)s&&h.isRowFilterOut(b)&&nt.push(b);if(w.clear(c,a,y,p,o,nt),g&&o&1&&(h._getCalcModel().unlinkCellExpression(c,a,y,p),g.clear(c,a,y,p)),o&8&&!(n>=0&&t>=0))if(t>=0)for(v=0;v<p;v++)h.setTag(-1,a+v,i,e);else if(n>=0)for(l=0;l<y;l++)s&&h.isRowFilterOut(c+l)||h.setTag(c+l,-1,i,e);else h.setTag(-1,-1,i,e);if(o&2&&!(n>=0&&t>=0))if(t>=0)for(v=0;v<p;v++)h.setStyle(-1,a+v,i,e);else if(n>=0)for(l=0;l<y;l++)s&&h.isRowFilterOut(c+l)||h.setStyle(c+l,-1,i,e);else h.setStyle(-1,-1,i,e);if(o&32&&!(n>=0&&t>=0))if(t>=0)for(v=0;v<p;v++)h.setColumnVisible(a+v,!0,e),h.setColumnResizable(a+v,!0,e),h.setColumnWidth(a+v,e===2?h.defaults.rowHeaderColWidth:h.defaults.colWidth,e);else if(n>=0)for(l=0;l<y;l++)s&&h.isRowFilterOut(c+l)||(h.setRowVisible(c+l,!0,e),h.setRowResizable(c+l,!0,e),h.setRowHeight(c+l,e===1?h.defaults.colHeaderRowHeight:h.defaults.rowHeight,e));else{for(v=0;v<p;v++)h.setColumnVisible(a+v,!0,e),h.setColumnResizable(a+v,!0,e),h.setColumnWidth(a+v,e===2?h.defaults.rowHeaderColWidth:h.defaults.colWidth,e);for(l=0;l<y;l++)s&&h.isRowFilterOut(c+l)||(h.setRowVisible(c+l,!0,e),h.setRowResizable(c+l,!0,e),h.setRowHeight(c+l,e===1?h.defaults.colHeaderRowHeight:h.defaults.rowHeight,e))}for(l=0;l<y;l++)for(v=0;v<p;v++)c=n+l,a=t+v,o&1&&h._raiseCellChanged(vt,c,a,r,i,e),o&8&&h._raiseCellChanged(k,c,a,r,i,e),o&2&&h._raiseCellChanged("style",c,a,r,i,e),o&16&&h._raiseCellChanged("sparkline",c,a,r,i,e),o&4&&h._raiseCellChanged("comment",c,a,r,i,e),o&32&&h._raiseCellChanged("axis",c,a,r,i,e),o&64&&h._raiseCellChanged("bindingPath",c,a,r,i,e)}(e===r||e===i||e===d)&&(o&1)==1&&(tt=h._getCalcModel(),tt&&tt._addCellsToDirty(n,t,u,f))}finally{h.resumeCalcService(!1)}})(n,t,u,f,e,o)},l.prototype.getConditionalFormats=function(){var n=this;return!n._conditionalFormats&&t.features.conditionalFormat&&(n._conditionalFormats=new t.ConditionalFormats(n)),n._conditionalFormats},l.prototype.rowFilter=function(n){var t=this;return arguments.length===0?t._rowFilter:t._bindToAutoRefresh(function(n){return t._rowFilter&&t._rowFilter.reset(),t._rowFilter=n,t._rowFilter?t._rowFilter.sheet=t:(t.refreshObjectsAboveSheet(),t.filterRowsVisibleInfo&&t.filterRowsVisibleInfo.reset()),t})(n)},l.prototype.autoFitColumn=function(n){if(!(n<0)&&!(n>=this.getColumnCount())){var i=new t.UndoRedo.ColumnAutoFitUndoAction(this,[{col:n}],!1);i.execute(this)}},l.prototype.autoFitRow=function(n){if(!(n<0)&&!(n>=this.getRowCount())){var i=new t.UndoRedo.RowAutoFitUndoAction(this,[{row:n}],!1);i.execute(this)}},l.prototype.setGridlineOptions=function(n){var t=this;t._bindToAutoRefresh(function(n){if(n){t.gridline||(t.gridline={});var u=t.gridline;n.color&&(u.color=n.color);n.showVerticalGridline!==i&&n.showVerticalGridline!==r&&(u.showVerticalGridline=n.showVerticalGridline);n.showHorizontalGridline!==i&&n.showHorizontalGridline!==r&&(u.showHorizontalGridline=n.showHorizontalGridline)}})(n)},l.prototype.getGridlineOptions=function(){var i=this,t,n;return i.gridline||(i.gridline={}),t=i.gridline,n={},n.color=t.color,n.showVerticalGridline=t.showVerticalGridline,n.showHorizontalGridline=t.showHorizontalGridline,n},l.prototype.getFrozenRowCount=function(){return this.frozenRowCount},l.prototype.getFrozenColumnCount=function(){return this.frozenColCount},l.prototype.getFrozenTrailingRowCount=function(){return this._frozenTrailingRowCount},l.prototype.getFrozenTrailingColumnCount=function(){return this._frozenTrailingColCount},l.prototype.setRowHeaderVisible=function(n){var t=this;this._bindToAutoRefresh(function(i){t.rowHeaderVisible=n})(n)},l.prototype.getRowHeaderVisible=function(){return this.rowHeaderVisible},l.prototype.setColumnHeaderVisible=function(n){var t=this;this._bindToAutoRefresh(function(i){t.colHeaderVisible=n})(n)},l.prototype.getColumnHeaderVisible=function(){return this.colHeaderVisible},l.prototype.setRowHeaderAutoText=function(n){var t=this;this._bindToAutoRefresh(function(n){t.rowHeaderAutoText=n})(n)},l.prototype.getRowHeaderAutoText=function(){return this.rowHeaderAutoText},l.prototype.setColumnHeaderAutoText=function(n){var t=this;this._bindToAutoRefresh(function(n){t.colHeaderAutoText=n})(n)},l.prototype.getColumnHeaderAutoText=function(){return this.colHeaderAutoText},l.prototype.setRowHeaderAutoTextIndex=function(n){var t=this;this._bindToAutoRefresh(function(n){t.rowHeaderAutoTextIndex=n})(n)},l.prototype.getRowHeaderAutoTextIndex=function(){return this.rowHeaderAutoTextIndex},l.prototype.setColumnHeaderAutoTextIndex=function(n){var t=this;this._bindToAutoRefresh(function(n){t.colHeaderAutoTextIndex=n})(n)},l.prototype.getColumnHeaderAutoTextIndex=function(){return this.colHeaderAutoTextIndex},l.prototype.setIsProtected=function(n){var t=this;this._bindToAutoRefresh(function(n){t.isProtected=n;t.undoManager().clear();t.adjustActiveCellToSelectable()})(n)},l.prototype.getIsProtected=function(){return this.isProtected},l.prototype.protectionOption=function(n){var t=this;return arguments.length===0?t._protectionOption:(t._bindToAutoRefresh(function(n){t._protectionOption=n;t.adjustActiveCellToSelectable()})(n),t)},l.prototype.adjustActiveCellToSelectable=function(){var n=this,r=n.protectionOption(),t,i;n.isProtected&&(r.allowSelectLockedCells===!1||r.allowSelectUnlockedCells===!1)&&(t=n._activeRowIndex,i=n._activeColIndex,n.canSelect(t,i)||(n._clearSelectionImp(),n._moveActiveCellRight(t,i,!0),n.moveActiveCellEnd(4,t,i)))},l.prototype.setArray=function(n,i,r,u){var f=this,e=f.getRowCount(),o=f.getColumnCount(),s;if(r&&0<=n&&n<e&&0<=i&&i<o){f.suspendCalcService();s=f.isPaintSuspended();f.isPaintSuspended(!0);try{t.GC$.each(r,function(r,s){if(s instanceof Array)t.GC$.each(s,function(t,s){var h=n+r,c=i+t;h<e&&c<o&&(u?f.setFormula(h,c,s):f.setValue(h,c,s,3,!0))});else{var h=n+r,c=i;h<e&&c<o&&(u?f.setFormula(h,c,s):f.setValue(h,c,s,3,!0))}})}finally{f.resumeCalcService();f.isPaintSuspended(s)}}},l.prototype.getArray=function(n,t,i,r,u){var o=this,s=[],h=o.getRowCount(),c=o.getColumnCount(),f,e;if(0<=n&&n<h&&0<=t&&t<c)for(n+i>h&&(i=h-n),t+r>c&&(r=c-t),f=0;f<i;f++)for(s[f]=[],e=0;e<r;e++)s[f][e]=u?o.getFormula(n+f,t+e):o.getValue(n+f,t+e);return s},l.prototype.showRowRangeGroup=function(n){var i=this;return arguments.length===0?t.features.group?i._showRowRangeGroup:!1:(i._showRowRangeGroup!==n&&i._bindToAutoRefresh(function(n){i._showRowRangeGroup=n})(n),i)},l.prototype.showColumnRangeGroup=function(n){var i=this;return arguments.length===0?t.features.group?i._showColumnRangeGroup:!1:(i._showColumnRangeGroup!==n&&i._bindToAutoRefresh(function(n){i._showColumnRangeGroup=n})(n),i)},l.prototype.addTable=function(n,u,f,e,o,s){var h=this,c=h._tableManager,l;if(!c)return i;h._checkCanAddTable(n,u,f,e,o,!0);s===r&&(s=t.TableStyles.medium2());l=h.isPaintSuspended();h.isPaintSuspended(!0);try{return c.add(h._createTable(n,u,f,e,o,s))}finally{h.isPaintSuspended(l)}},l.prototype.addTableByDataSource=function(n,u,f,e,o){var s=this,v=s._tableManager,c,h,l,y,a;if(!v||!t.features.binding)return i;if(!e)throw new Error(t.SR.Exp_TableDataSourceNullError);s._checkCanAddTable(n,u,f,1,1,!0);c=new t._BindingManager;c.bind(e);h=c.getRowCount();l=c.getColumnCount();h=h+1;u+h>s.getRowCount()&&s.setRowCount(u+h);f+l>s.getColumnCount()&&s.setColumnCount(f+l);s._checkCanAddTable(n,u,f,h,l,!0);o===r&&(o=t.TableStyles.medium2());y=s.isPaintSuspended();s.isPaintSuspended(!0);try{return a=v.add(s._createTable(n,u,f,h,l,o)),a._bind(c),s.clearPendingChanges(),a}finally{s.isPaintSuspended(y)}},l.prototype._createTable=function(n,i,r,u,f,e){return new t.SheetTable(n,i,r,u,f,e)},l.prototype.findTable=function(n,t){var r=this._tableManager;return r?r.find(n,t):i},l.prototype.findTableByName=function(n){var t=this._tableManager,r=i,u,f;if(t&&(r=t.findByName(n)),!r&&(u=this.parent&&this.parent.sheets,u))for(f=0;f<u.length;f++)if(t=u[f]._tableManager,t&&(r=t.findByName(n),r))break;return r},l.prototype.removeTable=function(n){var t=this,i=t._tableManager,r;if(!n||!i)return t;r=t.isPaintSuspended();t.isPaintSuspended(!0);t.suspendCalcService();try{if(n=i.remove(n),n)this.onTableRemoved([n]);return t}finally{t.resumeCalcService(!1);t.isPaintSuspended(r)}},l.prototype.onTableRemoved=function(n){n&&o.adjustNamesOnRemoveTables(this,n)},l.prototype.removeTableByName=function(n){var t=this.findTableByName(n);return t&&this.removeTable(t),this},l.prototype.moveTable=function(n,t,i){var r=this,f=r._tableManager,o;if(!f||!n||t<0||i<0)return r;var e=n.range(),s=e.rowCount,h=e.colCount,u=f.findByRange(t,i,s,h);if(u)if(u.length>1)return r;else if(u.length===1&&u[0]!==n)return r;o=r.isPaintSuspended();r.isPaintSuspended(!0);try{return n._moveTo(t,i),r}finally{r.isPaintSuspended(o)}},l.prototype.moveTableByName=function(n,t,i){var r=this.findTableByName(n);return r&&this.moveTable(r,t,i),this},l.prototype.resizeTable=function(n,i){var u=this,e=u._tableManager,f,s;if(!e||!n)return u;var o=n.range(),h=o.row,c=o.col,r=i;if((arguments.length===3&&(r=new t.Range(h,c,arguments[1],arguments[2])),!r||r.rowCount<0||r.colCount<0)||(f=e.findByRange(r.row,r.col,r.rowCount,r.colCount),f&&f.length>1))return u;s=u.isPaintSuspended();u.isPaintSuspended(!0);try{return n._resize(r),u}finally{u.isPaintSuspended(s)}},l.prototype.resizeTableByName=function(n,i){var r=this.findTableByName(n),u,f;return r&&(u=r.range(),f=i,arguments.length===3&&(f=new t.Range(u.row,u.col,arguments[1],arguments[2])),this.resizeTable(r,f)),this},l.prototype.getTables=function(){var n=this._tableManager;if(n)return n.getTables()},l.prototype.clearTables=function(){var n=this,t=n._tableManager,i,r;if(t){i=n.isPaintSuspended();n.isPaintSuspended(!0);n.suspendCalcService();try{r=t.getTables();t.clearTables();n.onTableRemoved(r)}finally{n.resumeCalcService(!1);n.isPaintSuspended(i)}}return n},l.prototype.selectionBackColor=function(n){var i=this,r;return arguments.length===0?i._selectionBackColor?i._selectionBackColor:(r=t.ThemeStyleHelper.getCssClassThemeStyle("gc-selection"),r.backgroundColor):i._bindToAutoRefresh(function(n){return n&&(i._selectionBackColor=n),i})(n)},l.prototype.selectionBorderColor=function(n){var i=this,r;return arguments.length===0?i._selectionBorderColor?i._selectionBorderColor:(r=t.ThemeStyleHelper.getCssClassThemeStyle("gc-selection"),r.borderTopColor):i._bindToAutoRefresh(function(n){return n&&(i._selectionBorderColor=n),i})(n)},l.prototype._addTableInternal=function(n){var i=this._tableManager,t;i&&(t=n.range(),this._checkCanAddTable(n.name(),t.row,t.col,t.rowCount,t.colCount))&&i.add(n)},l.prototype._checkCanAddTable=function(n,i,r,u,f,e){var o=this,s,h,c;if(!n){if(e)throw new Error(t.SR.Exp_TableEmptyNameError);return!1}if(i<0||u<1||i+u>o.getRowCount()){if(e)throw new Error(t.SR.Exp_TableInvalidRow);return!1}if(r<0||f<1||r+f>o.getColumnCount()){if(e)throw new Error(t.SR.Exp_TableInvalidColumn);return!1}if(o._hasTable(i,r,u,f)){if(e)throw new Error(t.SR.Exp_TableIntersectError);return!1}if(o.parent&&o.parent._findTable(n)||!o.parent&&o.findTableByName(n)){if(e)throw new Error(t.SR.Exp_TableHasSameNameError);return!1}if(s=o._getsArrayFormulas(i,r,u,f),s&&s.ranges&&s.ranges.length>0)for(h=0;h<s.ranges.length;h++)if(c=s.ranges[h],c.rowCount>1||c.colCount>1){if(e)throw new Error(t.SR.Exp_ArrayFormulaTable);return!1}return!0},l.prototype.setComment=function(n,i,r){var u,s;if(t.features.comment){var f=this,e=this._commentManager,o=f.getSpan(n,i);o&&(o.row!==n||o.col!==i)&&r||(u=f.getComment(n,i),u&&e&&e.containsComment(u)&&e.removeComment(u),s=f._getModel(3),s.setComment(n,i,r),e.addComment(n,i,r),f._raiseCellChanged("comment",n,i,u,r,3))}},l.prototype.getComment=function(n,r){if(!t.features.comment)return i;var u=this._getModel(3);return u.getComment(n,r)},l.prototype.getComments=function(){if(t.features.comment)return this._commentManager.getCommentList()},l.prototype.setTag=function(n,t,r,f){var e,s,l,a,h,c;if((typeof f===u||f===i)&&(f=3),e=this,s=e._getModel(f),s){if(l=s.getRowCount(),a=s.getColumnCount(),n<-1||n>=l||t<-1||t>=a)return;r=o.tryConvertDateToOADate(r);c=e._eventHandler._eventSuspended>0;c||(h=s.getTag(n,t));s.setTag(n,t,r);c||h===r||(n!==-1&&t!==-1?e._raiseCellChanged(k,n,t,h,r,f):n!==-1&&t===-1?e.triggerRowChanged({sheet:e,sheetName:e._name,row:n,sheetArea:f,propertyName:k,oldValue:h}):n===-1&&t!==-1&&e.triggerColumnChanged({sheet:e,sheetName:e._name,col:t,sheetArea:f,propertyName:k,oldValue:h}))}},l.prototype.getTag=function(n,t,u){var s=this,f,e;return((u===r||u===i)&&(u=3),f=s._getModel(u),f)?(e=f.getTag(n,t),o.tryConvertOADateToDate(e)):i},l.prototype.tag=function(n){var t=this;return arguments.length===0?o.tryConvertOADateToDate(t._tag):(t._tag=o.tryConvertDateToOADate(n),t)},l.prototype.getParent=function(){return this.parent},l.prototype.addSlicer=function(n,i,r,u){var e=this.findTableByName(i),f;return!e||e.getColumnIndexInTable(r)===-1?null:(f=new t.Slicer(n,e,r),u&&f.style(u),this.addSlicerInternal(f),f)},l.prototype.addSlicerInternal=function(n){var t=this,i=t._slicerCollection;n&&i&&(i.addSlicer(n),t.addFloatingObject(n))},l.prototype.removeSlicer=function(n){var i=this,t=i._slicerCollection;t&&n&&(t.removeSlicer(t.getSlicer(n)),i.removeFloatingObject(n))},l.prototype.getSlicer=function(n){var t=this;if(t._slicerCollection&&n)return t._slicerCollection.getSlicer(n)},l.prototype.getSlicers=function(){return this._slicerCollection?this._slicerCollection.getSlicers():[]},l.prototype.getSlicersFromTable=function(n){return n?this._slicerCollection?this._slicerCollection.getSlicers(n):[]:[]},l.prototype.printInfo=function(n){var i=this;return arguments.length===0?(!i._printInfo&&t.features.print&&(i._printInfo=new t.PrintInfo),i._printInfo):(i._printInfo=n,i)},l.prototype.getRowPageBreak=function(n){return this._sheetModelManager.getRowInfos(3).getPageBreak(n)},l.prototype.setRowPageBreak=function(n,t){this.setRowColInfo(n,t,"pageBreak",!0,3)},l.prototype.getColumnPageBreak=function(n){return this._sheetModelManager.getColInfos(3).getPageBreak(n)},l.prototype.setColumnPageBreak=function(n,t){this.setRowColInfo(n,t,"pageBreak",!1)},l.prototype._bindToAutoRefresh=function(n,t){return t||(t=this),function(){var i=n.apply(t,arguments);return t._paintSuspended||(typeof t.invalidateLayout===v&&t.invalidateLayout(),typeof t.repaint===v&&t.repaint()),i}},l.prototype._isValidSheetName=function(n){var t,u,r,e,i,f;if(!n||n==="")return!1;for(i=0;i<n.length;i++)if(t=n.charAt(i),t==="*"||t===":"||t==="["||t==="]"||t==="?"||t==="\\"||t==="/")return!1;if(u=this,r=u.parent,!r)return!0;for(e=r.sheets.length,i=0;i<e;i++)if(f=r.sheets[i],f!==u&&n===f._name)return!1;return!0},l.prototype._init=function(n){this._name=n;this.setBounds(new t.Rect(0,0,0,0));this.resetImp()},l.prototype.applyOptions=function(n){var f,e,r;if(n){var t=this,i=t.defaults,u=t.gridline;typeof n.name===c&&n.name.length>0&&(t._name=n.name);n.data&&t.setDataSource(n.data);typeof n.defaultRowHeight===h&&(i.rowHeight=n.defaultRowHeight);typeof n.defaultColWidth===h&&(i.colWidth=n.defaultColWidth);typeof n.defaultRowHeaderColWidth===h&&(i.rowHeaderColWidth=n.defaultRowHeaderColWidth);typeof n.defaultColHeaderRowHeight===h&&(i.colHeaderRowHeight=n.defaultColHeaderRowHeight);typeof n.rowCount===h&&t.setRowCount(n.rowCount);typeof n.colCount===h&&t.setColumnCount(n.colCount);typeof n.frozenRowCount===h&&(t.frozenRowCount=n.frozenRowCount);typeof n.frozenColCount===h&&(t.frozenColCount=n.frozenColCount);typeof n.frozenTrailingRowCount===h&&(t._frozenTrailingRowCount=n.frozenTrailingRowCount);typeof n.frozenTrailingColCount===h&&(t._frozenTrailingColCount=n.frozenTrailingColCount);n.gridlineColor&&(u.color=n.gridlineColor);typeof n.showVerticalGridline===y&&(u.showVerticalGridline=n.showVerticalGridline);typeof n.showHorizontalGridline===y&&(u.showHorizontalGridline=n.showHorizontalGridline);n.borderColor&&(t.borderColor=n.borderColor);typeof n.borderWidth===h&&(t.borderWidth=n.borderWidth);typeof n._zoomFactor===h&&(t._zoomFactor=n._zoomFactor);typeof n.rowHeaderVisible===y&&(t.rowHeaderVisible=n.rowHeaderVisible);typeof n.colHeaderVisible===y&&(t.colHeaderVisible=n.colHeaderVisible);typeof n.autoGenerateColumns===y&&(t.autoGenerateColumns=n.autoGenerateColumns);n.rowHeaderAutoText&&(t.rowHeaderAutoText=n.rowHeaderAutoText);n.colHeaderAutoText&&(t.colHeaderAutoText=n.colHeaderAutoText);typeof n._activeRowIndex===h&&(f=n._activeRowIndex);typeof n._activeColIndex===h&&(e=n._activeColIndex);t._setActiveCellCore(f,e);typeof n._allowCellOverflow===y&&(t._allowCellOverflow=n._allowCellOverflow);typeof n.isProtected===y&&(t.isProtected=n.isProtected);typeof n.allowUndo===y&&t.allowUndo(n.allowUndo);r=n.columns;r&&r.length>0&&(t.autoGenerateColumns=!1,t.bindColumns(r))}},l.prototype._initDefaultFloatingObjectKeyMap=function(){var u=t.util.isMacOS(),i=!u,r=u,n=this;n.addFloatingObjectKeyMap(27,!1,!1,!1,!1,t.SpreadActions.unSelectAllFloatingObjects);n.addFloatingObjectKeyMap(46,!1,!1,!1,!1,t.SpreadActions.deleteFloatingObject);n.addFloatingObjectKeyMap(9,!1,!1,!1,!1,t.SpreadActions.navigationNextFloatingObject);n.addFloatingObjectKeyMap(9,!1,!0,!1,!1,t.SpreadActions.navigationPreviousFloatingObject);n.addFloatingObjectKeyMap(88,i,!1,!1,r,t.SpreadActions.clipboardCutFloatingObject);n.addFloatingObjectKeyMap(67,i,!1,!1,r,t.SpreadActions.clipboardCopyFloatingObject);n.addFloatingObjectKeyMap(86,i,!1,!1,r,t.SpreadActions.clipboardPasteFloatingObject);n.addFloatingObjectKeyMap(65,i,!1,!1,r,t.SpreadActions.selectAllFloatingObjects);n.addFloatingObjectKeyMap(38,!1,!1,!1,!1,t.SpreadActions.moveFloatingObjectUp);n.addFloatingObjectKeyMap(40,!1,!1,!1,!1,t.SpreadActions.moveFloatingObjectDown);n.addFloatingObjectKeyMap(37,!1,!1,!1,!1,t.SpreadActions.moveFloatingObjectLeft);n.addFloatingObjectKeyMap(39,!1,!1,!1,!1,t.SpreadActions.moveFloatingObjectRight)},l.prototype._initDefaultSlicerKeyMap=function(){var n=this;n.addSlicerKeyMap(67,!1,!1,!0,!1,t.SpreadActions.unfilterSlicer)},l.prototype._initDefaultCommentKeyMap=function(){var i=t.util.isMacOS(),r=!i,u=i,n=this;n.addCommentKeyMap(46,!1,!1,!1,!1,t.SpreadActions.deleteComment);n.addCommentKeyMap(27,!1,!1,!1,!1,t.SpreadActions.deactivateComment);n.addCommentKeyMap(38,!1,!1,!1,!1,t.SpreadActions.moveCommentUp);n.addCommentKeyMap(40,!1,!1,!1,!1,t.SpreadActions.moveCommentDown);n.addCommentKeyMap(37,!1,!1,!1,!1,t.SpreadActions.moveCommentLeft);n.addCommentKeyMap(39,!1,!1,!1,!1,t.SpreadActions.moveCommentRight)},l.prototype._initDefaultKeyMap=function(){var u=t.util.isMacOS(),i=!u,r=u,n=this;n.addKeyMap(37,!1,!1,!1,!1,t.SpreadActions.navigationLeft);n.addKeyMap(39,!1,!1,!1,!1,t.SpreadActions.navigationRight);n.addKeyMap(38,!1,!1,!1,!1,t.SpreadActions.navigationUp);n.addKeyMap(40,!1,!1,!1,!1,t.SpreadActions.navigationDown);n.addKeyMap(37,i,!1,!1,r,t.SpreadActions.navigationHome2);n.addKeyMap(39,i,!1,!1,r,t.SpreadActions.navigationEnd2);n.addKeyMap(38,i,!1,!1,r,t.SpreadActions.navigationTop);n.addKeyMap(40,i,!1,!1,r,t.SpreadActions.navigationBottom);n.addKeyMap(36,!1,!1,!1,!1,t.SpreadActions.navigationHome);n.addKeyMap(36,!0,!1,!1,!1,t.SpreadActions.navigationFirst);n.addKeyMap(35,!1,!1,!1,!1,t.SpreadActions.navigationEnd);n.addKeyMap(35,!0,!1,!1,!1,t.SpreadActions.navigationLast);n.addKeyMap(9,!1,!1,!1,!1,t.SpreadActions.moveToNextCell);n.addKeyMap(9,!1,!0,!1,!1,t.SpreadActions.moveToPreviousCell);n.addKeyMap(33,!1,!1,!1,!1,t.SpreadActions.navigationPageUp);n.addKeyMap(34,!1,!1,!1,!1,t.SpreadActions.navigationPageDown);n.addKeyMap(33,i,!1,!1,r,t.SpreadActions.navigationPreviousSheet);n.addKeyMap(34,i,!1,!1,r,t.SpreadActions.navigationNextSheet);n.addKeyMap(46,!1,!1,!1,!1,t.SpreadActions.clear);n.addKeyMap(8,!1,!1,!1,!1,t.SpreadActions.clearAndEditing);n.addKeyMap(13,!1,!1,!1,!1,t.SpreadActions.commitInputNavigationDown);n.addKeyMap(13,!1,!0,!1,!1,t.SpreadActions.commitInputNavigationUp);n.addKeyMap(27,!1,!1,!1,!1,t.SpreadActions.cancelInput);n.addKeyMap(13,!0,!0,!1,!1,t.SpreadActions.commitArrayFormula);n.addKeyMap(37,!1,!0,!1,!1,t.SpreadActions.selectionLeft);n.addKeyMap(39,!1,!0,!1,!1,t.SpreadActions.selectionRight);n.addKeyMap(38,!1,!0,!1,!1,t.SpreadActions.selectionUp);n.addKeyMap(40,!1,!0,!1,!1,t.SpreadActions.selectionDown);n.addKeyMap(36,!1,!0,!1,!1,t.SpreadActions.selectionHome);n.addKeyMap(35,!1,!0,!1,!1,t.SpreadActions.selectionEnd);n.addKeyMap(33,!1,!0,!1,!1,t.SpreadActions.selectionPageUp);n.addKeyMap(34,!1,!0,!1,!1,t.SpreadActions.selectionPageDown);n.addKeyMap(37,i,!0,!1,r,t.SpreadActions.selectionHome);n.addKeyMap(39,i,!0,!1,r,t.SpreadActions.selectionEnd);n.addKeyMap(38,i,!0,!1,r,t.SpreadActions.selectionTop);n.addKeyMap(40,i,!0,!1,r,t.SpreadActions.selectionBottom);n.addKeyMap(36,!0,!0,!1,!1,t.SpreadActions.selectionFirst);n.addKeyMap(35,!0,!0,!1,!1,t.SpreadActions.selectionLast);n.addKeyMap(67,i,!1,!1,r,t.SpreadActions.copy);n.addKeyMap(88,i,!1,!1,r,t.SpreadActions.cut);n.addKeyMap(86,i,!1,!1,r,t.SpreadActions.paste);n.addKeyMap(90,i,!1,!1,r,t.SpreadActions.undo);n.addKeyMap(89,i,!1,!1,r,t.SpreadActions.redo)},l.prototype._setHost=function(n){var h,c,i,r,f,o,s,e;n&&(h=t.util._isStandardCanvas(),c=t.util._isSilverlightCanvas(),h||!c)&&(i=this,r=i._eventHandler,i.disposed=!1,f=w.createElement("canvas"),t.DPIHelper.adjustDevicePixel(f,null,i),f.setAttribute("id",n.getAttribute("id")+"_vp"),t.GC$(f).html("You need a browser which full supports HTML5 Canvas to run SpreadJS"),n.appendChild(f),f.gcObject=!0,o=i._canvas,o&&(t.GC$(o).unbind(g).unbind(nt).unbind(tt).unbind(it).unbind(rt).unbind(ut).unbind(ft),i._unbindTouchEvents(),o.parentNode&&o.parentNode.removeChild(o)),i._canvas=f,t.features.comment&&(i._commentRender=i.parent?i.parent._commentRender:new t.CommentRender(i._getContainerDiv())),f.setAttribute("renderMethod","auto"),s=t.util.device(),e=s.ipad||s.iphone,i._mouseDownDelegate=function(n){if(!e){var u=i._touchManager;if(u&&u.preProcessMouseDown(n)){t.util.cancelDefault(n);return}return r.doMouseDown(n)}},i._mouseMoveDelegate=function(n){if(!e){var u=i._touchManager;if(u&&u.preProcessMouseMove(n)){t.util.cancelDefault(n);return}r._isMouseCapture||r.doMouseMove(n)}},i._mouseUpDelegate=function(n){if(!e){var u=i._touchManager;if(u&&u.preProcessMouseUp(n)){t.util.cancelDefault(n);return}if(!i._continueMouseUpBubble)return r._isMouseCapture?void 0:r.doMouseUp(n)}},i._mouseOutDelegate=function(n){if(!e)return r.doMouseOut(n)},i._dblClickDelegate=function(n){var u,s,f,c,h,o,l,a,v,y;if(!e&&(u=i,!u._isTouchMode)){if(h=u._currentTarget,h&&(u.triggerCellDoubleClick({sheet:u,sheetName:u._name,sheetArea:h.hitTestType,row:h.row,col:h.col}),o=h.resizeInfo,o)){if(o.action==="sizeRow"||o.action==="sizeHiddenRow"){if(l=[],u._isRowSelected(o.index)){for(s=0;s<u._selectionModel.length;s++)if(f=u._selectionModel[s],f.col===-1)for(f=u._getActualRange(f),a=0;a<f.rowCount;a++)l.push({row:f.row+a})}else l.push({row:o.index});c=new t.UndoRedo.RowAutoFitUndoAction(u,l,o.sheetArea===1);u._doCommand(c)}else{if(v=[],u._isColumnSelected(o.index)){for(s=0;s<u._selectionModel.length;s++)if(f=u._selectionModel[s],f.row===-1)for(f=u._getActualRange(f),y=0;y<f.colCount;y++)v.push({col:f.col+y})}else v.push({col:o.index});c=new t.UndoRedo.ColumnAutoFitUndoAction(u,v,o.sheetArea===2);u._doCommand(c)}return}return r.startEdit(n)}},i._mouseWheelDelegate=function(n){var i,f,l;if(!e){if(n=n?n:window.event,i=n.detail?n.detail:n.wheelDelta/-40,f=0,t.util.isMacOS()){var o=n.wheelDeltaY,h=n.deltaY,s=n.wheelDeltaX,c=n.deltaX;p(o)>=p(s)?s=0:o=0;t.util.browser.safari?(typeof o!==u&&typeof h!==u&&(i=et(-o/p(h))),typeof s!==u&&typeof c!==u&&(f=et(-s/p(c)))):t.util.browser.chrome&&(typeof o!==u&&(i=o/-40,i=(i>=0?1:-1)*ot(p(i))),typeof s!==u&&(f=s/-40,f=(f>=0?1:-1)*ot(p(f))))}return l=r.doMouseWheel(n,parseInt(i,10)||0,parseInt(f,10)||0),l?void 0:!1}},t.GC$(f).bind(g,i._mouseDownDelegate).bind(nt,i._mouseMoveDelegate).bind(tt,i._mouseUpDelegate).bind(it,i._mouseOutDelegate).bind(rt,i._dblClickDelegate).bind(ut,i._mouseWheelDelegate).bind(ft,i._mouseWheelDelegate),i._bindTouchEvents(),r.doResize(),i.repaint(),i.parent&&i.parent._paintSpreadBackgroundImage())},l.prototype._unbindTouchEvents=function(){this._touchManager&&this._touchManager.detach()},l.prototype._bindTouchEvents=function(){if(t.features.touch){var n=this,i=n.parent,u=i&&i._touchEventProvider?i._touchEventProvider:new t.TouchEventProvider,r=new t.TouchManager(n._canvas,n,u);r.attach();n._touchManager=r}},l.prototype._disposeValidationUI=function(){var n=this,e,u,f,r;return n._isDisposingValidationUI?!1:(n._isDisposingValidationUI=!0,e=n._validationInputMessage,e&&(r=e.parentNode,r&&r.removeChild(e),n._validationInputMessage=i),u=n._validationButton,u&&(t.GC$(u).unbind("click"),r=u.parentNode,r&&r.removeChild(u),n._validationButton=i),f=n._validationSelect,f&&(t.GC$(f).unbind("keydown").unbind("blur").unbind("click"),r=f.parentNode,r&&r.removeChild(f),n._validationSelect=i),n._isDisposingValidationUI=!1,!0)},l.prototype._disposeFloatingObjectUI=function(){var e=this._render,n=e&&e._floatingObjectRenderManager,r,u,o,s,t,f;if(n){for(r=0,o=n.length;r<o;r++)if(t=n[r],t){for(u=0,s=t.length;u<s;u++)f=t[u],f&&f._dispose();t.length=0}n.length=0;n=i}this._floatingObjectArray&&this._floatingObjectArray.dispose()},l.prototype._disposeComment=function(){var t=this,n=t._commentManager;n&&n.hideAllComments()},l.prototype._dispose=function(n){var r=this,u,f,e,o,s,h;t.DPIHelper.disposeSheet(r);r.isEditing()&&r.endEdit();u=r._canvas;u&&(t.GC$(u).unbind(g).unbind(nt).unbind(tt).unbind(it).unbind(rt).unbind(ut).unbind(ft),u.parentNode&&u.parentNode.removeChild(u),r._canvas=i);r._unbindTouchEvents();t.GC$(window).unbind(ni);t.StyleHelper._disposeMeasureSpan();f=r._eventHandler;f&&(f._dispose(),f._disposeFocusHolders());e=r._filterDialiog;e&&e.close();o=r._smartTag;o&&o.close();s=r._editor;s&&t.GC$(s).remove();r._disposeValidationUI();r._disposeFloatingObjectUI();r._disposeComment();r._disposeStringWidthPre();r._disposeStringWidthSpan();n!==!1&&(r.disposed=!0,r.clearCache(),h=r._cutCopyIndicatorManager,h&&h._dispose(),r._dblClickDelegate=i,r._mouseDownDelegate=i,r._mouseMoveDelegate=i,r._mouseOutDelegate=i,r._mouseUpDelegate=i,r._mouseWheelDelegate=i,r.parent=i,r.calcService=i,r._vpSheetSource=i,r._cutCopyIndicatorManager=i,r._bindingManager=i,r._sparklineGroupManager=i,r._tableManager=i,r._floatingObjectArray=i,r._commentManager=i,r._sheetModelManager=i,r._cachePool=i,r._render=i,r._eventHandler=i,r._touchManager=i,r.imageLoader=i,t.FocusHelper.isActiveElement(r)&&t.FocusHelper.setActiveElement(i,!0))},l.prototype._disposeStringWidthSpan=function(){var n=this._editingSpan;n&&(t.GC$(n).remove(),this._editingSpan=r)},l.prototype._disposeStringWidthPre=function(){var n=this._editingPre;n&&(t.GC$(n).remove(),this._editingPre=r)},l.prototype.clearCache=function(){var t=this,n=t._conditionalFormats;n&&n.clearCellRuleCache()},l.prototype._getModel=function(n){return this._sheetModelManager.getDataModel(n)},l.prototype._getCalcModel=function(n){return!this._vpCalcSheetModel&&t.util.hasCalc()&&(this._vpCalcSheetModel=this.getCalcService().getSourceModel(this._vpSheetSource)),this._vpCalcSheetModel},l.prototype._getValueImp=function(n,r,f,e){var y=this,h,c,w,v;(typeof e===u||e===i)&&(e=3);var p=e===3,s=i,l=!1,b=!1,a=y._tableManager;return p&&a&&a._tableList.length>0&&(h=a.find(r,f),h&&(h.showHeader()&&r===h.headerIndex()?(b=!0,s=h._getHeaderName(f),s!==i&&typeof s!==u&&(s=t.util.toString(s)),l=!0):h.hasBinding()&&(s=h._getValue(r,f),s.hasBinding?(l=!0,s=s.value):s=i))),l||(c=y._bindingManager,w=c&&c._dataSource,w&&p?(v=c.getValue(r,f),s=v.hasBinding?v.value:n.getValue(r,f)):s=n.getValue(r,f)),o.tryConvertOADateToDate(s)},l.prototype._getSwapIndex=function(n,t,i){for(var r=n[i-t];r.index<i;)r=n[r.index-t];return r.index},l.prototype._quickSortImp=function(n){var t,i;if(n.length<=1)return n;var e=s(n.length/2),o=n[e],r=[],u=[],f=[];for(t=0;t<n.length;t++)i=this._sortCompare(n[t],o),i<0?r.push(n[t]):i>0?u.push(n[t]):f.push(n[t]);return this._quickSortImp(r).concat(f,this._quickSortImp(u))},l.prototype._quickSort=function(n,t,i,r,u,f){var a=u?i:r,s=[],e,h,c,o,l;if(u)for(e=0;e<a;e++)s[e]={sheet:this,index:n+e,byRows:u,sortInfo:f};else for(e=0;e<a;e++)s[e]={sheet:this,index:t+e,byRows:u,sortInfo:f};if(u)for(h=[],o=s.length-1;o>=0;o--)c=s[o],this.isRowFilterOut(c.index)&&(s.splice(o,1),h.push({index:o,value:c}));if(s=this._quickSortImp(s),u)for(o=h.length-1;o>=0;o--)l=h[o],s.splice(l.index,0,l.value);return s},l.prototype._isEquals=function(n,i){return n instanceof Date&&i instanceof Date?new t._DateTimeHelper(n).toOADate()===new t._DateTimeHelper(i).toOADate():typeof n===c&&typeof i===c?n.toLowerCase()===i.toLowerCase():n===i},l.prototype._isGreaterThan=function(n,i){return(typeof n=="boolean"?n=n?1:0:n instanceof Date&&(n=new t._DateTimeHelper(n).toOADate()),typeof i=="boolean"?i=i?1:0:i instanceof Date&&(i=new t._DateTimeHelper(i).toOADate()),typeof n!=typeof i&&(typeof n=="number"||typeof i=="number"))?typeof i=="number":typeof n===c&&typeof i===c?n.toLowerCase()>i.toLowerCase():n>i},l.prototype._sortCompare=function(n,t){var l,e,u,f,o,s,h,a,c;if(n.sortInfo&&n.sortInfo.length>0){for(l=this,e=0,h=0;h<n.sortInfo.length;h++)if(n.sortInfo[h]&&(a=n.sortInfo[h].ascending,c=n.sortInfo[h].index,0<=c&&(n.byRows?(u=n.sheet.getValue(n.index,c),f=t.sheet.getValue(t.index,c),o=u===r||u===i||u===""||typeof u=="number"&&isNaN(u),s=f===r||f===i||f===""||typeof f=="number"&&isNaN(f),o||s?o&&s?e=0:o&&!s?e=1:!o&&s&&(e=-1):e=l._isEquals(u,f)?0:l._isGreaterThan(u,f)?a?1:-1:a?-1:1):(u=n.sheet.getValue(c,n.index),f=t.sheet.getValue(c,t.index),o=u===r||u===i||u===""||typeof u=="number"&&isNaN(u),s=f===r||f===i||f===""||typeof f=="number"&&isNaN(f),o||s?o&&s?e=0:o&&!s?e=1:!o&&s&&(e=-1):e=l._isEquals(u,f)?0:l._isGreaterThan(u,f)?a?1:-1:a?-1:1))),e!==0)break;return e}return 0},l.prototype._getActualRange=function(n,r){(typeof r===u||r===i)&&(r=3);var f=new t.Range(-1,-1,-1,-1);return n===i||typeof n===u?f:(f.col=n.col,f.row=n.row,f.colCount=n.colCount,f.rowCount=n.rowCount,f.col===-1&&(f.col=0,f.colCount=this.getColumnCount(r)),f.row===-1&&(f.row=0,f.rowCount=this.getRowCount(r)),f)},l.prototype._getRangeRect=function(n,i,r){var e=new t.Rect(-1,-1,-1,-1),o=this,c=o._getSheetLayout(),l,a;if(c.width===0||c.height===0||(l=o._getViewportColumnLayout(i),a=o._getViewportRowLayout(n),!l||l.length===0||!a||a.length===0))return e;var b=o._getActualRange(r),k=o._cachePool,v=function(n,t){for(var r=0,i=n;i<=t;i++)r+=k.getZoomColWidth(i);return r},y=function(n,t){for(var r=0,i=n;i<=t;i++)r+=k.getZoomRowHeight(i);return r},u=b.row,s=b.row+b.rowCount-1,f=b.col,h=b.col+b.colCount-1,d=o.frozenRowCount,g=o.getRowCount()-o._frozenTrailingRowCount-1,nt=o.frozenColCount,tt=o.getColumnCount()-o._frozenTrailingColCount-1,p=l[0].col,it=l[l.length-1].col,w=a[0].row,rt=a[a.length-1].row,ut=function(n,t){while(n>t)if(n--,o.getColumnVisible(n))return n;return n},ft=function(n,t){while(n<t)if(n++,o.getColumnVisible(n))return n;return n},et=function(n,t){while(n>t)if(n--,o.getRowVisible(n))return n;return n},ot=function(n,t){while(n<t)if(n++,o.getRowVisible(n))return n;return n};return(f<p&&(f=ut(p,f)),h>it&&(h=ft(it,h)),u<w&&(u=et(w,u)),s>rt&&(s=ot(rt,s)),h<f||s<u)?e:(i===0?f<nt&&(e.x=c.frozenX+v(0,f-1),e.width=v(f,h)):i===1?f<=tt&&h>=nt&&(e.x=f<p?l[0].x-v(f,p-1):l[0].x+v(p,f-1),e.width=v(f,h)):i===2&&h>tt&&(e.x=f<p?c.frozenTrailingX-v(f,p-1):c.frozenTrailingX+v(p,f-1),e.width=v(f,h)),n===0?u<d&&(e.y=c.frozenY+y(0,u-1),e.height=y(u,s)):n===1?u<=g&&s>=d&&(e.y=u<w?a[0].y-y(u,w-1):a[0].y+y(w,u-1),e.height=y(u,s)):n===2&&s>g&&(e.y=u<w?c.frozenTrailingY-y(u,w-1):c.frozenTrailingY+y(w,u-1),e.height=y(u,s)),e)},l.prototype._getRangeRect2=function(n){var o=this,i=new t.Rect(-1,-1,-1,-1),w=o._getSheetLayout();if(w.width===0||w.height===0)return i;var d=o._getActualRange(n),g=isNaN(o.frozenColCount)?0:o.frozenColCount,nt=isNaN(o.frozenRowCount)?0:o.frozenRowCount,b=isNaN(o._frozenTrailingColCount)?0:o._frozenTrailingColCount,k=isNaN(o._frozenTrailingRowCount)?0:o._frozenTrailingRowCount,tt=o._cachePool,y=function(n,t){for(var r=0,i=n;i<=t;i++)r+=tt.getZoomColWidth(i);return r},p=function(n,t){for(var r=0,i=n;i<=t;i++)r+=tt.getZoomRowHeight(i);return r},a=d.row,s=d.row+d.rowCount-1,v=d.col,h=d.col+d.colCount-1,c=o.getRowCount(),l=o.getColumnCount(),r,u;if(v<g)i.x=w.frozenX+y(0,v-1),i.width=y(v,f(h,g-1)),g<=h&&h<l-b?(r=o._getViewportColumnLayout(1),r&&r.length>0&&(i.width+=y(r[0].col,f(h,r[r.length-1].col)))):h>=l-b&&(r=o._getViewportColumnLayout(2),r&&r.length>0&&(i.width=r[0].x-i.x,i.width+=y(l-b,f(h,l-1))));else if(v<l-b){if(r=o._getViewportColumnLayout(1),!r||r.length===0||v>r[r.length-1].col||h<r[0].col)return i;i.x=w.viewportX+y(r[0].col,v-1);g<=h&&h<l-b?i.width=y(e(v,r[0].col),f(h,r[r.length-1].col)):h>=l-b&&(r=o._getViewportColumnLayout(2),r&&r.length>0&&(i.width=r[0].x-i.x,i.width+=y(l-b,f(h,l-1))))}else v<l&&(r=o._getViewportColumnLayout(2),r&&r.length>0&&(i.x=w.frozenTrailingX+y(r[0].col,v-1),i.width=y(v,f(h,l-1))));if(a<nt)i.y=w.frozenY+p(0,a-1),i.height=p(a,f(s,nt-1)),nt<=s&&s<c-k?(u=o._getViewportRowLayout(1),u&&u.length>0&&(i.height+=p(u[0].row,f(s,u[u.length-1].row)))):s>=c-k&&(u=o._getViewportRowLayout(2),u&&u.length>0&&(i.height=u[0].y-i.y,i.height+=p(c-k,f(s,c-1))));else if(a<c-k){if(u=o._getViewportRowLayout(1),!u||u.length===0||a>u[u.length-1].row||s<u[0].row)return i;i.y=w.viewportY+p(u[0].row,a-1);nt<=s&&s<c-k?i.height=p(e(a,u[0].row),f(s,u[u.length-1].row)):s>=c-k&&(u=o._getViewportRowLayout(2),u&&u.length>0&&(i.height=u[0].y-i.y,i.height+=p(c-k,f(s,c-1))))}else a<c&&(u=o._getViewportRowLayout(2),u&&u.length>0&&(i.y=w.frozenTrailingY+p(u[0].row,a-1),i.height+=p(a,f(s,c-1))));return i},l.prototype._getCanvas=function(){var n=this._canvas;return!n&&this.parent&&(n=this.parent.canvas),n&&!n.getContext&&n.firstChild&&(n.getContext=n.firstChild.getContext),n},l.prototype._getStringWidth=function(n,t){return this._getStringWidthByCanvas(n,t)+1},l.prototype._getStringWidthByCanvas=function(n,i){var r="",u=this._render;return r=i?i:u._getZoomFont(u._getDefaultFont()),t._WordWrapHelper._measureText(n,r)},l.prototype._getFontHeight=function(n,t){var i=this,r=i.fontHeightCache,f,u,e;if(!t)if(r){if(f=r[n],f)return f}else r=i.fontHeightCache={};return u=i._getEditingSpan(),u.style.font=n?n:i._render._getDefaultFont(),u.innerHTML="H",e=u.offsetHeight,t||(r[n]=e),e},l.prototype._getEditingSpan=function(){if(!this._editingSpan){var n=w.createElement("span"),t=n.style;t.visibility=wt;t.top="-10000px";t.left="-10000px";t.position="absolute";n.className="gcStringWidthSpanStyle";n.setAttribute("gcUIElement","gcStringWidthSpan");w.body.insertBefore(n,i);this._editingSpan=n}return this._editingSpan},l.prototype._getColumnViewportIndexFromX=function(n){var t=this._getSheetLayout(),r=i;return t.headerX<n&&n<t.headerX+t.rowHeaderWidth?r=-1:t.frozenX<n&&n<t.frozenX+t.frozenWidth?r=0:t.viewportX<n&&n<t.viewportX+t.viewportWidth?r=1:t.frozenTrailingX<n&&n<t.frozenTrailingX+t.frozenTrailingWidth&&(r=2),r},l.prototype._getRowViewportIndexFromY=function(n){var t=this._getSheetLayout(),r=i;return t.headerY<n&&n<t.headerY+t.colHeaderHeight?r=-1:t.frozenY<n&&n<t.frozenY+t.frozenHeight?r=0:t.viewportY<n&&n<t.viewportY+t.viewportHeight?r=1:t.frozenTrailingY<n&&n<t.frozenTrailingY+t.frozenTrailingHeight&&(r=2),r},l.prototype._getRowIndexFromY=function(n,t){var r=i,u;return r=t===-1?this._getColumnHeaderRowLayout():this._getViewportRowLayout(t),r&&(u=r.findY(n),u)?u.row:void 0},l.prototype._getColumnIndexFromX=function(n,t){var r=i,u;return r=t===-1?this._getRowHeaderColumnLayout():this._getViewportColumnLayout(t),r&&(u=r.findX(n),u)?u.col:void 0},l.prototype._isActiveCell=function(n,t){var i=this;return i._activeRowIndex<=n&&n<i._activeRowIndex+i._activeRowCount&&i._activeColIndex<=t&&t<i._activeColIndex+i._activeColCount},l.prototype._isColumnSelected=function(n){for(var t,r,i=0;i<this._selectionModel.length;i++)if(t=this._selectionModel[i],r=t.col===-1?0:t.col,t.row===-1&&n>=r&&n<r+t.colCount)return!0;return!1},l.prototype._isRowSelected=function(n){for(var t,r,i=0;i<this._selectionModel.length;i++)if(t=this._selectionModel[i],r=t.row===-1?0:t.row,t.col===-1&&n>=r&&n<r+t.rowCount)return!0;return!1},l.prototype._isSelected=function(n,t,r){for(var o,f,e=!1,h=this._selectionModel,s=0,c=h.length;s<c;s++)if(o=h[s],f=this._getActualRange(o),r===3||typeof r===u||r===i?e=f.row<=n&&n<f.row+f.rowCount&&f.col<=t&&t<f.col+f.colCount:r===2?e=f.row<=n&&n<f.row+f.rowCount:r===1?e=f.col<=t&&t<f.col+f.colCount:r===0&&(e=o.row===-1&&o.col===-1),e)return e;return e},l.prototype._isAllSelected=function(n,t,u){for(var f,h,c,o=this,e=!1,l=o.getRowCount(),a=o.getColumnCount(),s=0;s<o._selectionModel.length;s++)if(f=o._selectionModel[s],u!==r&&u!==i&&u!==3&&(u===2?(h=f.row===-1?0:f.row,e=f.col===-1&&n>=h&&n<h+f.rowCount):u===1?(c=f.col===-1?0:f.col,e=f.row===-1&&t>=c&&t<c+f.colCount):u===0&&(e=f.row===-1&&f.col===-1&&f.rowCount===l&&f.colCount===a)),e)return e;return e},l.prototype._isHover=function(n,t,r){var h=!1,f=this._currentTarget,e,o,s;if(f&&!f.resizeInfo&&typeof r!==u&&r!==i)if(r===1)return e=!1,o=this._getSpanModel(1).find(f.row,f.col),o&&(e=o.contains(n,t,1,1)),s=n===f.row&&t===f.col||e,f.hitTestType===r&&s;else if(r===2)return e=!1,o=this._getSpanModel(2).find(f.row,f.col),o&&(e=o.contains(n,t,1,1)),s=n===f.row&&t===f.col||e,f.hitTestType===r&&s;else if(r===3)return f.hitTestType===r&&n===f.row&&t===f.col;else if(r===0)return f.hitTestType===r;return h},l.prototype._indexToLetters=function(n){for(var r="A",u=r.charCodeAt(0),t="",i;n>0;n=parseInt((n-1)/26,10))i=(n-1)%26,t=String.fromCharCode(u+i)+t;return t},l.prototype._doStartEdit=function(n,t,i){var u=this,o=u.hitTest(t,i),f,e,c,s,h;if(o&&(f=o.row,e=o.col,f>=0&&e>=0&&o.rowViewportIndex>=0&&o.colViewportIndex>=0&&!o.resizeInfo&&!o.dragInfo&&f===u._activeRowIndex&&e===u._activeColIndex&&(c=u.isEditing(),u._startEditImp(n,f,e),!c&&u.isEditing()&&(s=o.hitTestType,h=u.getCellType(f,e),h._triggerButtonClicked)))){var a=s===1?-1:r,v=s===2?-1:r,y=u.getCellRect(f,e,a,v),p=u.getActualStyle(f,e,s),w={sheet:u,row:f,col:e,sheetArea:s},l=h.getHitInfo(t,i,p,y,w);l&&l.isReservedLocation&&h._triggerButtonClicked(u,f,e,3)}},l.prototype._getSheetArea=function(n,t){if(n>=0&&n<=2&&t>=0)return 3;else if(n>=0&&n<=2&&t<0)return 2;else if(n<0&&t>=0)return 1;else if(n<0&&t<0)return 0;return i},l.prototype.setFocus=function(){var n=this._eventHandler;n&&n.setFocus()},l.prototype._getHost=function(){var i=this,n,r=i.parent,t;return n=r&&r._host,n||(t=i._canvas,n=t&&t.parentElement),n},l.prototype._startEditImp=function(n,u,f,e,o,s,h){var c,v,k,l,d,a,g,tt,b,nt,ot,st,w;if(!(u<0)&&!(f<0)&&(c=this,!c.isEditing())){v=c._eventHandler;v&&v.setFocus();var y=u,p=f,b=c.getCellRect(y,p);if(b&&!(b.width<=0)&&!(b.height<=0)&&(c.showCell(c._activeRowIndex,c._activeColIndex,3,3),k=c.getActualStyle(u,f),!c.isProtected||k.locked===!1)&&(l=c.getCellType(y,p),l)&&(a={sheet:c,row:u,col:f,sheetArea:3},l.isImeAware(a)?v&&(d=v._cellTypeFocusHolder):d=l.createEditorElement(a),d)){if(c._editor=d,g={sheet:c,sheetName:c._name,row:y,col:p,cancel:!1},c.triggerEditStarting(g),g&&g.cancel===!0){t.util.device().ipad&&v&&v.changeFocusHolder();return}var it=c.getValue(y,p),rt=c.getFormula(y,p),ht=c._editorStatus;c._editorStatus=c._startEditByKeydown?1:(it===i||it===r)&&(rt===i||rt===r)?1:2;c.triggerEditorStatusChanged({sheet:c,sheetName:c._name,oldStatus:ht,newStatus:c._editorStatus});tt=c._getSheetLayout();b=c.getCellRect(y,p,e,o);l.isImeAware(a)&&v._resetFocusHolder();l.activateEditor(c._editor,k,b,a);c._setEditorValue(l,c._editor,y,p,k,h);var ut=1,ft=2,et=c._getHost();c.showEditingLocator&&(nt=l._getLocator(),d._editingLocator=nt,ot=this.getValue(this._sheetModelManager.getDataModel(ut).getRowCount()-1,f,ut),st=this.getValue(u,this._sheetModelManager.getDataModel(ft).getColumnCount()-1,ft),nt.innerHTML=ot+""+st,l._updateEditorLocator(c._editor,a),et.insertBefore(nt,i));l.isImeAware(a)||et.insertBefore(c._editor,i);l.updateEditor(c._editor,k,b,a);l.isImeAware(a)&&s||l.focus(c._editor,a);s&&l.selectAll(c._editor,a);c._allowCellOverflow&&(w=c.getCellRect(u,f,e,o),w.x-=2,w.y-=2,w.width+=4,w.height+=4,w.x=tt.frozenX,w.width=tt.viewportWidth,c.repaint(w));c._render.refreshTouchSelectionIndicator();c._attachFormulaTextBox(l.getEditingElement());t.FocusHelper.setActiveElement(c);c.triggerEditStarted({sheet:c,sheetName:c._name,row:y,col:p})}}},l.prototype._setEditorValue=function(n,t,u,f,e,o){var h=this,s=h.getFormula(u,f),c,l,a;s&&(s="="+s);c=s;l={sheet:h,row:u,col:f,sheetArea:3};s&&s.length!==0||(s=h.getValue(u,f),a=h.parent?h.parent.canUserEditFormula():!0,s&&s.length>0&&/^=/ig.test(s)&&a&&(s="'"+s),c=s,s=n._formatEditorValue(t,e,s,l));t._oldValue=s;o!==i&&o!==r&&(s=o);n.setEditorValue(t,s,l);t._originalValue=c},l.prototype._attachFormulaTextBox=function(i){var r=this,e,s,f;if(t.features.formulatextbox&&i&&(!r.parent||r.parent.canUserEditFormula())&&r._enableFormulaTextbox){r._formulaTextBox&&r._formulaTextBox.destroy();r._formulaTextBox=new t.FormulaTextBox(i,r.parent);e=r._formulaTextBox.text();s=r.getFormulaInformation(r._activeRowIndex,r._activeColIndex);s&&s.hasFormula||e[0]==="="&&(e="'"+e,r._formulaTextBox.text(e));var u=r._formulaTextBox,h=r._eventHandler,o=r._render;u.bind("AppendStarted",function(t){u.close();var f=n.Sheets.EditorStatus,i=r._editorStatus;i!==1&&(r._editorStatus=1,r.triggerEditorStatusChanged({sheet:r,sheetName:r._name,oldStatus:i,newStatus:1}))});u.bind("AppendEnded",function(n){o.paintFormulaTextBox()});u.bind("TextChanged",function(n,t){if(!r.disposed){if(t&&t.type!=="input"){h.updateEditingEditor(t);var i=r._activeRowIndex,f=r._activeColIndex,e=r.getCellType(i,f);r.triggerEditChange({sheet:r,sheetName:r._name,row:i,col:f,editingText:e.getEditorValue(r._editor)})}o.paintFormulaTextBox();r.triggerFormulaTextBoxTextChanged({sheet:r,sheetName:r._name,text:u.text()})}});u.bind("CaretChanged",function(){o.paintFormulaTextBox();r.triggerFormulaTextBoxCaretChanged({sheet:r,sheetName:r._name,caret:u.caret()})});u.add(t.SR.getHelpFuncs());f=this._functionDescriptions;f&&f.length>0&&u.add(f);f=this.parent&&this.parent._functionDescriptions;f&&f.length>0&&u.add(f);o.paintFormulaTextBox()}},l.prototype._detachFormulaTextBox=function(){var n=this;n._formulaTextBox&&(n._formulaTextBox.destroy(),n._formulaTextBox=i,n._render.paintFormulaTextBox())},l.prototype._showEditingLocator=function(){var n=this,i,r,s,h;if(n.isEditing()!==!1&&(i=n._editor,r=i&&i._editingLocator,r)){var e=t.GC$(i),u=parseInt(e.css(ti),10)+n.getColumnWidth(n._activeColIndex)/2,f=parseInt(e.css(ii),10)+n.getRowHeight(n._activeRowIndex)/2,o=t.GC$(n._getCanvas()).offset();u-=o.left;f-=o.top;s=n._getRowIndexFromY(f,n._getRowViewportIndexFromY(f));h=n._getColumnIndexFromX(u,n._getColumnViewportIndexFromX(u));s===n._activeRowIndex&&h===n._activeColIndex?t.GC$(r).css(bt,wt):t.GC$(r).css(bt,"visible")}},l.prototype._getKeyAction=function(n,t,i,r,u){return this._getKeyActionInternal(n,t,i,r,u,this.keyMap)},l.prototype._getKeyActionInternal=function(n,t,r,u,f,e){var h,o,s;if(!e)return i;for(h=e.length,s=0;s<h;s++)if(o=e[s],o&&o.key===n&&o.ctrl===t&&o.shift===r&&o.alt===u&&o.meta===f)return o;return i},l.prototype._getFloatingObjectKeyAction=function(n,t,i,r,u){return this._getKeyActionInternal(n,t,i,r,u,this.floatingObjectKeyMap)},l.prototype._getSlicerKeyAction=function(n,t,i,r,u){return this._getKeyActionInternal(n,t,i,r,u,this._slicerKeyMap)},l.prototype._getCommentKeyAction=function(n,t,i,r,u){return this._getKeyActionInternal(n,t,i,r,u,this._commentKeyMap)},l.prototype._moveActiveCellUp=function(n,t,i){var r=this,u=r._getMoveUpCell(n,t,i,r._leadingCellCol||0);if(u){var f=u.row,e=u.col,o=u.leadingCellCol;r._canMoveCurrentTo(f,e)&&(r._leadingCellRow=f,r._leadingCellCol=o,r._setActiveCellCore(f,e))}},l.prototype._getMoveUpCell=function(n,t,u,f){var o=this,c=o.getRowCount(),l=o.getColumnCount(),s=n,e=t,h;return s===0&&!u||!(c!==0&&l!==0)?i:(h=o._getPrevRow(s,f),u||o._adjustCell(h),s=h.r,e=h.c,s<0&&u&&(e=o._getPrevVisualColumn(e),(e<0||e===r||e===i)&&(e=o._getPrevVisualColumn(l)),f=e,h=o._getPrevRow(c,e),s=h.r,e=h.c,e===t&&s<=n))?i:{row:s,col:e,leadingCellCol:f}},l.prototype._moveActiveCellDown=function(n,t,i){var r=this,u=r._getMoveDownCell(n,t,i,r._leadingCellCol||0);if(u){var f=u.row,e=u.col,o=u.leadingCellCol;r._canMoveCurrentTo(f,e)&&(r._leadingCellRow=f,r._leadingCellCol=o,r._setActiveCellCore(f,e))}},l.prototype._getMoveDownCell=function(n,t,u,f){var o=this,c=o.getRowCount(),l=o.getColumnCount(),s=n,e=t,h;if((s!==c-1||u)&&c!==0&&l!==0)return(h=o._getNextRow(s,f),u||o._adjustCell(h),s=h.r,e=h.c,s===c&&u&&(e=o._getNextVisualColumn(e),(e>=l||e===r||e===i)&&(e=o._getNextVisualColumn(-1)),f=e,h=o._getNextRow(-1,e),s=h.r,e=h.c,e===t&&s>=n))?void 0:{row:s,col:e,leadingCellCol:f}},l.prototype._moveActiveCellLast=function(){var n=this,t=n._getMoveLastCell(),i,r;t&&(i=t.row,r=t.col,n._leadingCellRow=i,n._leadingCellCol=r,n._setActiveCellCore(i,r))},l.prototype._getMoveLastCell=function(){var t=this,r=t._getLastVisualRow(),e=t._getLastVisualColumn(),n=e,u,f,o;if(!r&&!n)return i;if(u=t._protectionOption.allowSelectLockedCells!==!1,f=t._protectionOption.allowSelectUnlockedCells!==!1,!t.isProtected||u&&f)return{row:r,col:n};if(!u&&!f)return i;for(;r!==i&&r>=0;r=t._getPrevVisualRow(r))for(n=e;n!==i&&n>=0;n=t._getPrevVisualColumn(n))if(o=t.getStyleProperty(r,n,"locked"),u===o)return{row:r,col:n};return i},l.prototype._moveActiveCellFirst=function(){var n=this,t=n._getMoveFirstCell(),i,r;t&&(i=t.row,r=t.col,n._leadingCellRow=i,n._leadingCellCol=r,n._setActiveCellCore(i,r))},l.prototype._getMoveFirstCell=function(){var n=this,r=n._getFirstVisualRow(),e=n._getFirstVisualColumn(),t=e,s=n._getLastVisualRow(),h=n._getLastVisualColumn(),u,f,o;if(r===i||t===i)return i;if(u=n._protectionOption.allowSelectLockedCells!==!1,f=n._protectionOption.allowSelectUnlockedCells!==!1,!n.isProtected||u&&f)return{row:r,col:t};if(!u&&!f)return i;for(;r!==i&&r<=s;r=n._getNextVisualRow(r))for(t=e;t!==i&&t<=h;t=n._getNextVisualColumn(t))if(o=n.getStyleProperty(r,t,"locked"),u===o)return{row:r,col:t};return i},l.prototype._moveActiveCellLeft=function(n,t,i){var r=this,u=r._getMoveLeftCell(n,t,i,r._leadingCellRow||0);if(u){var e=u.row,f=u.col,o=u.leadingCellRow;r._canMoveCurrentTo(e,f)&&(r._leadingCellRow=o,r._leadingCellCol=f,r._setActiveCellCore(e,f))}},l.prototype._getMoveLeftCell=function(n,t,u,f){var h=this,c=h.getRowCount(),l=h.getColumnCount(),e=n,o=t,s,a;if(o===0&&!u||!(c!==0&&l!==0))return i;for(s=h._getPrevColumn(f,o),a=f,u||h._adjustCell(s),e=s.r,o=s.c;o<0&&u;)if(e=h._getPrevVisualRow(e,3,!0),(e<0||e===r||e===i)&&(e=h._getPrevVisualRow(c,3,!0)),f=e,s=h._getPrevColumn(f,l),e=s.r,o=s.c,e===n&&o<t)return i;else if(e===n&&o===t){if(f===a)return i;s=h._getPrevColumn(f,o);e=s.r;o=s.c}return{row:e,col:o,leadingCellRow:f}},l.prototype._adjustCell=function(n){var t=this;n.r<0?n.r=t._getFirstVisualRow():n.r>=t.getRowCount()&&(n.r=t._getLastVisualRow());n.c<0?n.c=t._getFirstVisualColumn():n.c>=t.getColumnCount()&&(n.c=t._getLastVisualColumn())},l.prototype._fixRange=function(n){var i=n.row<0?0:n.row,r=n.col<0?0:n.col,u=n.row<0?this.getRowCount():n.rowCount,f=n.col<0?this.getColumnCount():n.colCount;return new t.Range(i,r,u,f)},l.prototype._moveActiveCellLeftInSelection=function(n,t){for(var i=this,s=i._selectionModel,v=s.activeSelectedRangeIndex,h=-1,e=i._fixRange(i._getActiveSelectedRange()),c=e.row,l=e.col,a=e.col+e.colCount-1,r=n,f=t,o,u;;){if(o=i._getPrevColumnInSelection(r,f),r=o.r,f=o.c,f>=l)break;if(h===v&&r===n&&f<=t)return;r--;r>=c?f=a+1:(u=i._fixRange(i._getActiveSelectedRange(3)),h=s.activeSelectedRangeIndex,c=u.row,l=u.col,a=u.col+u.colCount-1,r=u.row+u.rowCount-1,f=u.col+u.colCount)}r>=0&&(i._setActiveCellCore(r,f),i._leadingCellRow=r,i._leadingCellCol=f)},l.prototype._moveActiveCellRightInSelection=function(n,t){for(var i=this,s=i._selectionModel,v=s.activeSelectedRangeIndex,h=-1,e=i._fixRange(i._getActiveSelectedRange()),c=e.col,l=e.row+e.rowCount-1,a=e.col+e.colCount-1,r=n,u=t,o,f;;){if(o=i._getNextColumnInSelection(r,u),r=o.r,u=o.c,u<=a)break;if(h===v&&r===n&&u>=t)return;r++;r<=l?u=c-1:(f=i._fixRange(i._getActiveSelectedRange(4)),h=s.activeSelectedRangeIndex,c=f.col,l=f.row+f.rowCount-1,a=f.col+f.colCount-1,r=f.row,u=f.col-1)}r>=0&&(i._setActiveCellCore(r,u),i._leadingCellRow=r,i._leadingCellCol=u)},l.prototype._moveActiveCellRight=function(n,t,i){var r=this,u=r._getMoveRightCell(n,t,i,r._leadingCellRow||0);if(u){var e=u.row,f=u.col,o=u.leadingCellRow;r._canMoveCurrentTo(e,f)&&(r._leadingCellRow=o,r._leadingCellCol=f,r._setActiveCellCore(e,f))}},l.prototype._getMoveRightCell=function(n,t,u,f){var h=this,l=h.getRowCount(),c=h.getColumnCount(),e=n,s=t,o,a;if(s===c-1&&!u||!(l!==0&&c!==0))return i;if(o=h._getNextColumn(f,s),a=f,!u){if(o.c===c)return i;h._adjustCell(o)}for(e=o.r,s=o.c;s===c&&u;)if(e=h._getNextVisualRow(e,!0),(e>=l||e===r||e===i)&&(e=h._getNextVisualRow(-1,!0)),f=e,o=h._getNextColumn(f,-1),e=o.r,s=o.c,e===n&&s>t)return i;else if(e===n&&s===t){if(f===a)return i;o=h._getNextColumn(f,s);e=o.r;s=o.c}return{row:e,col:s,leadingCellRow:f}},l.prototype._getPrevColumn=function(n,i){for(var f={r:n,c:i},r,u;i>=0;){if(n=f.r,i--,i<0)break;if(r=this.getSpans(new t.Range(n,i,1,1)),r&&r.length>0&&(u=r[0],i>=u.col&&(i=u.col,n=u.row)),this._canMoveCurrentTo(n,i))return{r:n,c:i}}return{r:n,c:i}},l.prototype._getPrevColumnInSelection=function(n,t){for(var i,r;t>=0;){if(t--,t<0)break;if(i=this._getSpanModel().find(n,t),i){if(r=this._getActiveSelectedRange(),r.row<=i.row&&i.row+i.rowCount<=r.row+r.rowCount&&r.col<=i.col&&i.col+i.colCount<=r.col+r.colCount){if(!(i.row===n&&i.col===t))continue}else continue;t>=i.col&&(t=i.col,n=i.row)}if(this._canMoveCurrentTo(n,t))return{r:n,c:t}}return{r:n,c:t}},l.prototype._getNextColumn=function(n,i){for(var f=this,s=f.getColumnCount(),h={r:n,c:i},o,u,r;i<s;){if(n=h.r,o=this._getSpanModel().find(n,i),o?i+=o.colCount:i++,i>=s)break;if(u=f.getSpans(new t.Range(n,i,1,1)),u&&u.length>0&&(r=u[0],i>r.col?i=e(i,r.col+r.colCount):n=r.row),f._canMoveCurrentTo(n,i))return{r:n,c:i}}return{r:n,c:i}},l.prototype._getNextColumnInSelection=function(n,t){for(var f=this,o=f.getColumnCount(),u,i,r;t<o;){if(u=this._getSpanModel().find(n,t),u?t=u.col+u.colCount:t++,t>=o)break;if(i=this._getSpanModel().find(n,t),i){if(r=f._getActiveSelectedRange(),r.row<=i.row&&i.row+i.rowCount<=r.row+r.rowCount&&r.col<=i.col&&i.col+i.colCount<=r.col+r.colCount){if(!(i.row===n&&i.col===t))continue}else continue;t>i.col?t=e(t,i.col+i.colCount):n=i.row}if(f._canMoveCurrentTo(n,t))return{r:n,c:t}}return{r:n,c:t}},l.prototype._canMoveCurrentTo=function(n,t){var i=this,r=!1,e=i.getRowVisible(n),o=i.getColumnVisible(t),s=i._getZoomRowHeight(n),h=i._getZoomColumnWidth(t),u,f;return(r=n>=0&&n<i.getRowCount()&&t>=0&&t<i.getColumnCount()&&e&&o&&s>0&&h>0,!i.canSelect(n,t))?!1:(u=!!i._isTabNavigation,r===!0&&u===!0&&(f=i.getStyleProperty(n,t,"tabStop"),f===!1&&(r=!1)),r)},l.prototype._getPrevRow=function(n,i){for(var f={r:n,c:i},r,u;n>=0;){if(n--,n<0)break;if(r=this.getSpans(new t.Range(n,i,1,1)),r&&r.length>0&&(u=r[0],n>=u.row&&(n=u.row,i=u.col)),this._canMoveCurrentTo(n,i))return{r:n,c:i}}return{r:n,c:i}},l.prototype._getNextRow=function(n,i){for(var f=this,s=f.getRowCount(),h={r:n,c:i},o,u,r;n<s;){if(o=this._getSpanModel().find(n,i),o?n+=o.rowCount:n++,n>=s)break;if(u=f.getSpans(new t.Range(n,i,1,1)),u&&u.length>0&&(r=u[0],n>r.row?n=e(n,r.row+r.rowCount):i=r.col),f._canMoveCurrentTo(n,i))return{r:n,c:i}}return{r:n,c:i}},l.prototype._setSelectedRange=function(n,t,i,r,u){this._selectionModel.add(n,t,i,r);u&&!this._paintSuspended&&this._render.repaintSelection()},l.prototype._extendSelectedRange=function(n,t,i){var r=this,u=r._getExtendedRange(n,t,r._activeRowIndex,r._activeColIndex),f=u.row,e=u.col,o=u.rowCount,s=u.colCount,h=r.selectionPolicy(),c=r.selectionUnit();if(h===0)return;else h===1&&r._selectionModel.clear();c===1?(e=-1,s=-1):c===2&&(f=-1,o=-1);r._replaceActiveSelectedRange(f,e,o,s,i)},l.prototype._getExtendedRange=function(n,i,r,f){var e=this,h,c,l,a,o,s;return typeof r===u&&(r=e._activeRowIndex),typeof f===u&&(f=e._activeColIndex),h=new t.Range(r,f,1,1),c=this._getSpanModel().find(r,f),c&&(h=c),l=new t.Range(n,i,1,1),a=this._getSpanModel().find(n,i),a&&(l=a),o=h.union(l),s=e.getSpans(),s&&s.length>0&&(o=e._inflateRangeToCoverSpans(s,o)),o},l.prototype._replaceActiveSelectedRange=function(n,i,r,u,f){var o=this,s=o._getActiveSelectedRange(),e,h;if(o._selectionModel.length>0?o._selectionModel.splice(o._selectionModel.activeSelectedRangeIndex,1,new t.Range(n,i,r,u)):o._selectionModel.add(n,i,r,u),f&&!o._paintSuspended){if(e=o._getActiveSelectedRange(),e.row===s.row&&e.col===s.col&&e.rowCount===s.rowCount&&e.colCount===s.colCount)return;h=o._render;s.containsRange(e)?h.repaintSelection(s):e.containsRange(s)?h.repaintSelection(e):(h.repaintSelection(s),h.repaintSelection(e))}},l.prototype._changeActiveSelectedRange=function(n,t){var i=this,f,r,u;if(!(i._selectionModel.length<=0)&&(f=i._getActiveSelectedRange(),r=i._getKeyboardSelectedRange(f,n,t),r)){var e=i._selectionModel.toArray(),o=r.row,s=r.col,h=r.rowCount,c=r.colCount,l=i.selectionPolicy(),a=i.selectionUnit();if(l===0)return;else l===1&&i._selectionModel.clear();a===1?(s=-1,c=-1):a===2&&(o=-1,h=-1);i._replaceActiveSelectedRange(o,s,h,c,!0);u=i._selectionModel.toArray();i._eventHandler._notEqualSelecions(e,u)&&(i.triggerSelectionChanging({sheet:i,sheetName:i._name,oldSelections:e,newSelections:u}),i.triggerSelectionChanged({sheet:i,sheetName:i._name}))}},l.prototype._getKeyboardSelectedRange=function(n,t,r,u,f){var e=this,o=e._fixRange(n),s=i;return t===37?s=r?e._searchSelectedRangebyLeftCtrl(o,!1,u,f):e._searchSelectedRangebyLeft(o,u,f):t===39?s=r?e._searchSelectedRangebyRightCtrl(o,!1,u,f):e._searchSelectedRangebyRight(o,u,f):t===38?s=r?e._searchSelectedRangebyUpCtrl(o,!1,u,f):e._searchSelectedRangebyUp(o,u,f):t===40?s=r?e._searchSelectedRangebyDownCtrl(o,!1,u,f):e._searchSelectedRangebyDown(o,u,f):t===36?s=r?e._searchSelectedRangebyHomeCtrl(o,u,f):e._searchSelectedRangebyHome(o,u,f):t===35?s=r?e._searchSelectedRangebyEndCtrl(o,u,f):e._searchSelectedRangebyEnd(o,u,f):t===33?s=e._searchSelectedRangebyPageUp(o,u,f):t===34&&(s=e._searchSelectedRangebyPageDown(o,u,f)),s&&(n.row<0&&(s.row=-1,s.rowCount=-1),n.col<0&&(s.col=-1,s.colCount=-1)),s},l.prototype._searchSelectedRangebyLeft=function(n,r,u){for(var s=this,c=n.col+n.colCount-1,d=0,b={r:n.row+n.rowCount-1,c:c},o,l,h,k,a,v,y,p,w;c>d;)if((c--,s._canMoveCurrentTo(b.r,c))&&(o=s._getExtendedRange(b.r,c,r,u),l=f(n.row,o.row),h=f(n.col,o.col),k=e(n.row+n.rowCount-1,o.row+o.rowCount-1),a=f(n.col+n.colCount-1,o.col+o.colCount-1),v=k-l+1,y=a-h+1,!(l===n.row&&h===n.col&&v===n.rowCount&&y===n.colCount)))return p=s._scrollLeftCol,w=s._activeColIndex,n.col<w?h<=p&&s._setLeftColumn(h):n.col===w&&a<=p&&s._setLeftColumn(a),new t.Range(l,h,v,y);return i},l.prototype._searchSelectedRangebyLeftCtrl=function(n,u,o,s){var h=this,k=h.frozenColCount?h._getNextVisualColumn(h.frozenColCount-1):h._getFirstVisualColumn(),l=u?k:h._getFirstVisualColumn(),c,a,v,y,p,w,b;if(l===r||l===i)return;else(h.frozenColCount<=0||u)&&h._setLeftColumn(l);return c=h._getExtendedRange(n.row,l,o,s),a=f(n.row,c.row),v=f(n.col,c.col),y=e(n.row+n.rowCount-1,c.row+c.rowCount-1),p=f(n.col+n.colCount-1,c.col+c.colCount-1),w=y-a+1,b=p-v+1,new t.Range(a,v,w,b)},l.prototype._searchSelectedRangebyRight=function(n,r,u){for(var o=this,c=n.col,d=o.getColumnCount()-1,b={r:n.row+n.rowCount-1,c:c},s,l,h,k,a,v,y,p,w;c<d;)if((c++,o._canMoveCurrentTo(b.r,c))&&(s=o._getExtendedRange(b.r,c,r,u),l=f(n.row,s.row),h=e(n.col,s.col),k=e(n.row+n.rowCount-1,s.row+s.rowCount-1),a=e(n.col+n.colCount-1,s.col+s.colCount-1),v=k-l+1,y=a-h+1,!(l===n.row&&h===n.col&&v===n.rowCount&&y===n.colCount)))return p=o._getPageRightColumn(),w=o._activeColIndex,n.col<w?h>=p&&o._setLeftColumn(o._getNewLeftColumn(h,2)):n.col===w&&a>=p&&o._setLeftColumn(o._getNewLeftColumn(a,2)),new t.Range(l,h,v,y);return i},l.prototype._searchSelectedRangebyRightCtrl=function(n,u,o,s){var c=this,l=c._getLastPageLeftColumn(),a,h,v,y,p,w,b,k;if(l===r||l===i)return;else c._setLeftColumn(l);return a=c._getLastVisualColumn(),u||(a+=c._frozenTrailingColCount),h=c._getExtendedRange(n.row,a,o,s),v=f(n.row,h.row),y=e(n.col,h.col),p=e(n.row+n.rowCount-1,h.row+h.rowCount-1),w=e(n.col+n.colCount-1,h.col+h.colCount-1),b=p-v+1,k=w-y+1,new t.Range(v,y,b,k)},l.prototype._searchSelectedRangebyUp=function(n,r,u){for(var s=this,c=n.row+n.rowCount-1,d=0,b={r:c,c:n.col+n.colCount-1},o,h,l,a,k,v,y,p,w;c>d;)if((c--,s._canMoveCurrentTo(c,b.c))&&(o=s._getExtendedRange(c,b.c,r,u),h=f(n.row,o.row),l=f(n.col,o.col),a=f(n.row+n.rowCount-1,o.row+o.rowCount-1),k=e(n.col+n.colCount-1,o.col+o.colCount-1),v=a-h+1,y=k-l+1,!(h===n.row&&l===n.col&&v===n.rowCount&&y===n.colCount)))return p=s._scrollTopRow,w=s._activeRowIndex,n.row<w?h<=p&&s._setTopRow(h):n.row===w&&a<=p&&s._setTopRow(a),new t.Range(h,l,v,y);return i},l.prototype._searchSelectedRangebyUpCtrl=function(n,u,o,s){var h=this,k=h.frozenRowCount?h._getNextVisualRow(h.frozenRowCount-1):h._getFirstVisualRow(),l=u?k:h._getFirstVisualRow(),c,a,v,y,p,w,b;if(l===r||l===i)return;else(h.frozenRowCount<=0||u)&&h._setTopRow(l);return c=h._getExtendedRange(l,n.col,o,s),a=f(n.row,c.row),v=f(n.col,c.col),y=f(n.row+n.rowCount-1,c.row+c.rowCount-1),p=e(n.col+n.colCount-1,c.col+c.colCount-1),w=y-a+1,b=p-v+1,new t.Range(a,v,w,b)},l.prototype._searchSelectedRangebyDown=function(n,r,u){for(var o=this,c=n.row,d=o.getRowCount()-1,b={r:c,c:n.col+n.colCount-1},s,h,l,a,k,v,y,p,w;c<d;)if((c++,o._canMoveCurrentTo(c,b.c))&&(s=o._getExtendedRange(c,b.c,r,u),h=e(n.row,s.row),l=f(n.col,s.col),a=e(n.row+n.rowCount-1,s.row+s.rowCount-1),k=e(n.col+n.colCount-1,s.col+s.colCount-1),v=a-h+1,y=k-l+1,!(h===n.row&&l===n.col&&v===n.rowCount&&y===n.colCount)))return p=o._getPageBottomRow(),w=o._activeRowIndex,n.row<w?h>=p&&o._setTopRow(o._getNewTopRow(h,2)):n.row===w&&a>=p&&o._setTopRow(o._getNewTopRow(a,2)),new t.Range(h,l,v,y);return i},l.prototype._searchSelectedRangebyDownCtrl=function(n,u,o,s){var c=this,l=c._getLastPageTopRow(),a,h,v,y,p,w,b,k;if(l===r||l===i)return;else c._setTopRow(l);return a=c._getLastVisualRow(),u||(a+=c._frozenTrailingRowCount),h=c._getExtendedRange(a,n.col,o,s),v=e(n.row,h.row),y=f(n.col,h.col),p=e(n.row+n.rowCount-1,h.row+h.rowCount-1),w=e(n.col+n.colCount-1,h.col+h.colCount-1),b=p-v+1,k=w-y+1,new t.Range(v,y,b,k)},l.prototype._searchSelectedRangebyHome=function(n,r,u){for(var o=this,h=o.frozenColCount?o.frozenColCount-1:-1,b=o._activeColIndex,a={r:n.row+n.rowCount-1,c:n.col},s,c,l,v,y,p,w;h<b;)if(h++,o._canMoveCurrentTo(a.r,h)){if(n.col<=h&&n.col+n.colCount-1===o._activeColIndex)break;return s=o._getExtendedRange(a.r,h,r,u),c=f(n.row,s.row),l=f(n.col,s.col),v=e(n.row+n.rowCount-1,s.row+s.rowCount-1),y=f(n.col+n.colCount-1,s.col+s.colCount-1),p=v-c+1,w=y-l+1,o._setLeftColumn(o._getFirstVisualColumn()),new t.Range(c,l,p,w)}return i},l.prototype._searchSelectedRangebyHomeCtrl=function(n,t,i){return n=this._searchSelectedRangebyLeftCtrl(n,!0,t,i),this._searchSelectedRangebyUpCtrl(n,!0,t,i)},l.prototype._searchSelectedRangebyEnd=function(n,r,u){for(var o=this,h=o.getColumnCount(),b=o._activeColIndex,a={r:n.row+n.rowCount-1,c:n.col+n.colCount-1},s,c,l,v,y,p,w;h>b;)if(h--,o._canMoveCurrentTo(a.r,h)){if(n.col+n.colCount-1>=h&&n.col===o._activeColIndex)break;return s=o._getExtendedRange(a.r,h,r,u),c=f(n.row,s.row),l=e(n.col,s.col),v=e(n.row+n.rowCount-1,s.row+s.rowCount-1),y=e(n.col+n.colCount-1,s.col+s.colCount-1),p=v-c+1,w=y-l+1,o._setLeftColumn(o._getLastPageLeftColumn()),new t.Range(c,l,p,w)}return i},l.prototype._searchSelectedRangebyEndCtrl=function(n,t,i){return n=this._searchSelectedRangebyRightCtrl(n,!0,t,i),this._searchSelectedRangebyDownCtrl(n,!0,t,i)},l.prototype._searchSelectedRangebyPageUp=function(n,u,o){var s=this,l=s._getPrevPageTopRow(),c,a,v,y,p,w,b;if(l===r||l===i)return i;var k=s._getRowLayout(1),d=s._setTopRow(l),h=-1;return d?h=s._getNextVisualRow(n.row+n.rowCount-1-k.length):s.frozenRowCount<=0&&(h=s._getFirstVisualRow()),h<s._scrollTopRow?h=s._scrollTopRow:h>=s._getPageBottomRow()&&(h=s._getPrevVisualRow(s._getPageBottomRow())),c=s._getExtendedRange(h,n.col,u,o),a=f(n.row,c.row),v=f(n.col,c.col),y=f(n.row+n.rowCount-1,c.row+c.rowCount-1),p=e(n.col+n.colCount-1,c.col+c.colCount-1),w=y-a+1,b=p-v+1,new t.Range(a,v,w,b)},l.prototype._searchSelectedRangebyPageDown=function(n,u,o){var s=this,l=s._getNextPageTopRow(),y,c,h,a,v,p,w,b,k;return l===r||l===i?i:(y=s._getRowLayout(1),s._setTopRow(l),c=s._getPrevVisualRow(n.row+n.rowCount-1+y.length),c<s._scrollTopRow?c=s._scrollTopRow:c>=s._getPageBottomRow()&&(c=s._scrollTopRow>=s._getLastPageTopRow()?s._getPageBottomRow():s._getPrevVisualRow(s._getPageBottomRow())),h=s._getExtendedRange(c,n.col,u,o),a=e(n.row,h.row),v=f(n.col,h.col),p=e(n.row+n.rowCount-1,h.row+h.rowCount-1),w=e(n.col+n.colCount-1,h.col+h.colCount-1),b=p-a+1,k=w-v+1,new t.Range(a,v,b,k))},l.prototype._getPrevPageTopRow=function(){var n=this,r=n._getRowLayout(1);if(!r||r.length<=0)return i;for(var f=n.frozenRowCount?n._getNextVisualRow(n.frozenRowCount-1):n._getFirstVisualRow(),u=0,t=n._scrollTopRow,e=n._getSheetLayout();t>f;)if(t--,u+=n._getZoomRowHeight(t),u>e.viewportHeight)break;return t},l.prototype._getPrevPageLeftColumn=function(){var n=this,r=n._getColumnLayout(1);if(!r||r.length<=0)return i;for(var f=n.frozenColCount?n._getNextVisualColumn(n.frozenColCount-1):n._getFirstVisualColumn(),u=0,t=n._scrollLeftCol,e=n._getSheetLayout();t>f;)if(t--,u+=n._getZoomColumnWidth(t),u>e.viewportWidth)break;return t},l.prototype._getNextPageTopRow=function(){var n=this._getRowLayout(1);return!n||n.length<=0?i:this._getLastVisualRow()===n[n.length-1].row?this._scrollTopRow:n[n.length-1].row},l.prototype._getLastPageTopRow=function(){var n=this,i,t,r,u,f;if(n._getLastVisualRow()===n._getPageBottomRow()&&(i=n._getSheetLayout(),t=n._getRowLayout(1),t&&t.length>=1&&(r=t[t.length-1],r.y+r.height<=i.viewportY+i.viewportHeight)))return n._scrollTopRow;u=n._scrollTopRow;try{return n._scrollTopRow=n._getLastVisualRow(),f=n._getPrevPageTopRow(),n._getNextVisualRow(f)}catch(e){}finally{n._scrollTopRow=u}},l.prototype._getLastPageLeftColumn=function(){var n=this,i,r,u,f,t;if(n._getLastVisualColumn()===n._getPageRightColumn()&&(i=n._getSheetLayout(),r=n._getColumnLayout(1),r&&r.length>=1&&(u=r[r.length-1],u.x+u.width<=i.viewportX+i.width)))return n._scrollLeftCol;for(i=n._getSheetLayout(),f=0,t=n._getLastVisualColumn();t>0;){if(f+=n._getZoomColumnWidth(t),f>i.viewportWidth)break;t--}return t>0&&(t=n._getNextVisualColumn(t)),t},l.prototype._getPageBottomRow=function(){var n=this._getRowLayout(1);return!n||n.length<=0?i:n[n.length-1].row},l.prototype._getPageRightColumn=function(){var n=this._getColumnLayout(1);return!n||n.length<=0?i:n[n.length-1].col},l.prototype._getLastFullyVisibleRow=function(){var n=this._getRowLayout(1),r,t;return!n||n.length<=0?i:(r=this._getSheetLayout(),t=n.length-1,n[t].y+n[t].height<=r.viewportY+r.viewportHeight?n[t].row:n[e(t-1,0)].row)},l.prototype._getLastFullyVisibleColumn=function(){var n=this._getColumnLayout(1),r,t;return!n||n.length<=0?i:(r=this._getSheetLayout(),t=n.length-1,n[t].x+n[t].width<=r.viewportX+r.viewportWidth?n[t].col:n[e(t-1,0)].col)},l.prototype._getFirstVisualRow=function(){return this._getNextVisualRow(-1)},l.prototype._getLastVisualRow=function(n){(n===r||n===i)&&(n=3);var t=this.getRowCount(n);return(n===3||n===2)&&(t=t-this._frozenTrailingRowCount),this._getPrevVisualRow(t,n)},l.prototype._getFirstVisualColumn=function(){return this._getNextVisualColumn(-1)},l.prototype._getLastVisualColumn=function(n){(n===r||n===i)&&(n=3);var t=this.getColumnCount(n);return(n===3||n===1)&&(t=t-this._frozenTrailingColCount),this._getPrevVisualColumn(t,n)},l.prototype._getFirstPageLeftColumn=function(){var n=this,t=isNaN(n.frozenColCount)?0:n.frozenColCount;return t>0?n._getNextVisualColumn(t-1):n._getFirstVisualColumn()},l.prototype._getFirstPageTopRow=function(){var n=this,t=isNaN(n.frozenRowCount)?0:n.frozenRowCount;return t>0?n._getNextVisualRow(t-1):n._getFirstVisualRow()},l.prototype._getNextVisualRow=function(n,t){for(var r=this,u=t?r.getRowCount()-1:r.getRowCount()-1-r._frozenTrailingRowCount;n<u;)if(n++,r.getRowVisible(n)&&r._getZoomRowHeight(n)>0)return n;return i},l.prototype._getPrevVisualRow=function(n,t,r){for(var u=r?0:this.frozenRowCount;n>u;)if(n--,this.getRowVisible(n,t)&&this._getZoomRowHeight(n,t)>0)return n;return i},l.prototype._getNextVisualColumn=function(n){for(var t=this,r=t.getColumnCount()-1-t._frozenTrailingColCount;n<r;)if(n++,t.getColumnVisible(n)&&t._getZoomColumnWidth(n)>0)return n;return i},l.prototype._getPrevVisualColumn=function(n,t){while(n>this.frozenColCount)if(n--,this.getColumnVisible(n,t)&&this._getZoomColumnWidth(n,t)>0)return n;return i},l.prototype._inflateRangeToCoverSpans=function(n,t){var r,i;if(n&&n.length>0)for(r=0;r<n.length;r++)if(i=n[r],t.intersect(i.row,i.col,i.rowCount,i.colCount))return n.splice(r--,1),this._inflateRangeToCoverSpans(n,t.union(i));return t},l.prototype._getActiveSelectedRange=function(n){var i=this,r=new t.Range(-1,-1,0,0);return i._selectionModel.length<=0?r:(n===3?(i._selectionModel.activeSelectedRangeIndex--,i._selectionModel.activeSelectedRangeIndex<0&&(i._selectionModel.activeSelectedRangeIndex=i._selectionModel.length-1)):n===4&&(i._selectionModel.activeSelectedRangeIndex++,i._selectionModel.activeSelectedRangeIndex>=i._selectionModel.length&&(i._selectionModel.activeSelectedRangeIndex=0)),i._selectionModel.activeSelectedRangeIndex>=0&&(r=i._selectionModel[i._selectionModel.activeSelectedRangeIndex]),r)},l.prototype._initializeActiveCell=function(){var n=this,s=n._activeRowIndex,h=n._activeColIndex,c=n._selectionModel;if(s===r||s===i||h===r||h===i||c.length<=0){var t=0,u=0,f=1,e=1,o=this._getSpanModel().find(t,u);o&&(f=o.rowCount,e=o.colCount);c.add(t,u,f,e);n._activeRowIndex=t;n._activeColIndex=u;n._activeRowCount=f;n._activeColCount=e;n._leadingCellRow=t;n._leadingCellCol=u}},l.prototype._isResizeInfoEqual=function(n,t){var i=!1;return n||t?n&&t&&(i=n.action===t.action&&n.index===t.index&&n.sheetArea===t.sheetArea):i=!0,i},l.prototype._setHoverCell=function(n){var u=this,o=!1,r=u._currentTarget,s,h,f;if(r||(o=!0),o||n||(o=!0),o||(o=n.col!==r.col||n.row!==r.row||n.colViewportIndex!==r.colViewportIndex||n.rowViewportIndex!==r.rowViewportIndex||n.hitTestType!==r.hitTestType||!u._isResizeInfoEqual(n.resizeInfo,r.resizeInfo)),u._currentTarget=n,o){u._hoverCell=!0;var e=u._getSheetLayout(),l=u._render,t=i,c=!1;r&&(r.rowViewportIndex<0||r.colViewportIndex<0)&&(t=u.getCellRect(r.row,r.col,r.rowViewportIndex,r.colViewportIndex),t&&t.width>0&&t.height>0&&(s=0,h=0,f=u._getGroupLayout(),f&&(s=f.width,h=f.height),(t.x<e.rowHeaderWidth+s||t.y<e.colHeaderHeight+h||t.y>=e.height-e.footerHeight)&&(l.update(t.x,t.y,t.width,t.height),c=u._isHoverOnHeaderSelection(r))));n&&(n.rowViewportIndex<0||n.colViewportIndex<0)&&(t=u.getCellRect(n.row,n.col,n.rowViewportIndex,n.colViewportIndex),t&&t.width>0&&t.height>0&&(s=0,h=0,f=u._getGroupLayout(),f&&(s=f.width,h=f.height),(t.x<e.rowHeaderWidth+s||t.y<e.colHeaderHeight+h||t.y>=e.height-e.footerHeight)&&(l.update(t.x,t.y,t.width,t.height),c||(c=u._isHoverOnHeaderSelection(n)))));u._hoverCell=!1;c&&l.repaintSelection()}},l.prototype._isHoverOnHeaderSelection=function(n){var i=this,t;return i.parent&&i.parent._themeVersion>2007&&(t=3,n.rowViewportIndex<0&&(t=1),n.colViewportIndex<0&&(t=2),t!==3&&i._isSelected(n.row,n.col,t))?!0:!1},l.prototype._getAvailableActiveCell=function(n,t,i){var r=this._skipSpanCell(n,t,i);return this._skipInvisibleCell(r)},l.prototype._skipSpanCell=function(n,i,r){var u=this._getSpanModel().find(n,i);if(u){if(r&&u.rowCount===1||!r&&u.colCount===1)return u}else return new t.Range(n,i,1,1);return r?i++:n++,this._skipSpanCell(n,i,r)},l.prototype._skipInvisibleCell=function(n){for(var r=this,f=n.row,o=r.getRowCount(),u,e,i=f;i<o;i++)if(r.getRowVisible(i)===!0)break;for(i<o&&(f=i),u=n.col,e=r.getColumnCount(),i=u;i<e;i++)if(r.getColumnVisible(i)===!0)break;return i<e&&(u=i),new t.Range(f,u,n.rowCount,n.colCount)},l.prototype._processKeyMap=function(n){var u=n.ctrlKey,f=n.shiftKey,e=n.altKey,o=n.metaKey,s=n.keyCode,i=this._getKeyAction(s,u,f,e,o),r;return i&&typeof i.action===v?(r=i.action.call(this),r&&t.util.cancelDefault(n),r):!1},l.prototype._processSlicerKeyMap=function(n){var r=this,u=r._slicerCollection,f,i,e;return u?(f=u.getSelectedSlicers(),f.length!==1)?!1:(i=r._getSlicerKeyAction(n.keyCode,n.ctrlKey,n.shiftKey,n.altKey,n.metaKey),i&&i.action)?(e=i.action.call(r),e&&t.util.cancelDefault(n),!0):!1:!1},l.prototype._processFloatingObjectsKeyMap=function(n){var u,r,f;if(!t.features.floatingObject||(u=n.keyCode===90&&n.ctrlKey===!0||n.keyCode===89&&n.ctrlKey===!0,u))return!1;var i=this,o=i._eventHandler,e=n.keyCode===86&&(n.ctrlKey||n.metaKey);return i._hasFloatingObjectsSelected()||e&&i.isPasteFloatingObject()?(r=i._getFloatingObjectKeyAction(n.keyCode,n.ctrlKey,n.shiftKey,n.altKey,n.metaKey),r&&r.action&&(f=r.action.call(i),f&&t.util.cancelDefault(n)),!0):!1},l.prototype.isPasteFloatingObject=function(){var i=this,r=i._eventHandler,e=i._getFloatingObjectClipboardHelper(),u=e.fromSheet,t=u&&u._eventHandler,f=!0,n;return(r||t)&&(n=r._getClipboardFloatingObjectData(),!n&&t&&(n=t._getClipboardFloatingObjectData()),n&&n.length||(f=!1)),f},l.prototype._processCommentKeyMap=function(n){var f,i,u,r,e;if(!t.features.comment||(f=n.keyCode===90&&n.ctrlKey===!0||n.keyCode===89&&n.ctrlKey===!0,f))return!1;if(i=this,u=i._commentManager.getActiveComment(),u){if(n.keyCode===9)return t.util.cancelDefault(n),!0;if(r=i._getCommentKeyAction(n.keyCode,n.ctrlKey,n.shiftKey,n.altKey,n.metaKey),r&&r.action)return e=r.action.call(i),e&&t.util.cancelDefault(n),!0;else if(i._eventHandler.allowEnterEditing(n))return u.commentState(2),!0}return!1},l.prototype._hasFloatingObjectsSelected=function(){var f=this,n=f._floatingObjectArray,i,r,u;if(t.features.floatingObject&&n&&n.length>0)for(i=0,r=n.length;i<r;i++)if(u=n[i],u.isSelected())return!0;return!1},l.prototype._getZoomRowHeight=function(n,t){var i=this.getRowHeight(n,t),r=this._zoomFactor;return r!==1&&(i*=r),s(i)},l.prototype._getZoomColumnWidth=function(n,t){var i=this.getColumnWidth(n,t),r=this._zoomFactor;return r!==1&&(i*=r),s(i)},l.prototype._getGroupLayout=function(){var n=this;return n._cachedGroupLayout||(n._cachedGroupLayout=n._createGroupLayout()),n._cachedGroupLayout},l.prototype._getGroupButtonWidth=function(){return 17},l.prototype._getGroupButtonHeight=function(){return 17},l.prototype._getGroupPadding=function(){return 2},l.prototype._createGroupLayout=function(){var t={x:0,y:0,width:0,height:0,rowMaxLevel:-1,colMaxLevel:-1},n=this,o=n._getGroupButtonWidth(),s=n._getGroupButtonHeight(),h=n._getGroupPadding(),u=n.rowRangeGroup,e=n.colRangeGroup,v=n._showRowRangeGroup,y=n._showColumnRangeGroup,c=n._zoomFactor,i,l,r,a;return v&&u&&!u._isEmpty()&&(i=u.getMaxLevel(),i>=0&&(l=f(o,o*c),t.width=l*(i+2)+h*2,t.rowMaxLevel=i)),y&&e&&!e._isEmpty()&&(r=e.getMaxLevel(),r>=0&&(a=f(s,s*c),t.height=a*(r+2)+h*2,t.colMaxLevel=r)),t},l.prototype._createLayout=function(){var u=this,v=u.getBounds(),c=new t.Rect(v.x+u.borderWidth,v.y+u.borderWidth,e(0,v.width-2*u.borderWidth),e(0,v.height-2*u.borderWidth)),a=c.width,l=c.height,n={x:c.x,y:c.y,width:c.width,height:c.height,rowHeaderWidth:0,colHeaderHeight:0,frozenWidth:0,frozenHeight:0,frozenTrailingWidth:0,frozenTrailingHeight:0,footerHeight:0,footerWidth:0,footerX:0,footerY:0,frozenX:0,frozenY:0,frozenTrailingX:0,frozenTrailingY:0,viewportX:0,viewportY:0,viewportHeight:0,viewportWidth:0,headerX:0,headerY:0,headerCornerRect:function(){var n=this;return new t.Rect(n.x,n.y,n.rowHeaderWidth,n.colHeaderHeight)},colHeaderRect:function(n){var r=this;return n===0?new t.Rect(r.frozenX,r.y,r.frozenWidth,r.colHeaderHeight):n===1?new t.Rect(r.viewportX,r.y,r.viewportWidth,r.colHeaderHeight):n===2?new t.Rect(r.frozenTrailingX,r.y,r.frozenTrailingWidth,r.colHeaderHeight):i},rowHeaderRect:function(n){var r=this;return n===0?new t.Rect(r.x,r.frozenY,r.rowHeaderWidth,r.frozenHeight):n===1?new t.Rect(r.x,r.viewportY,r.rowHeaderWidth,r.viewportHeight):n===2?new t.Rect(r.x,r.frozenTrailingY,r.rowHeaderWidth,r.frozenTrailingHeight):i},viewportRect:function(n,r){var u=this;return n===0?r===0?new t.Rect(u.frozenX,u.frozenY,u.frozenWidth,u.frozenHeight):r===1?new t.Rect(u.viewportX,u.frozenY,u.viewportWidth,u.frozenHeight):r===2?new t.Rect(u.frozenTrailingX,u.frozenY,u.frozenTrailingWidth,u.frozenHeight):i:n===1?r===0?new t.Rect(u.frozenX,u.viewportY,u.frozenWidth,u.viewportHeight):r===1?new t.Rect(u.viewportX,u.viewportY,u.viewportWidth,u.viewportHeight):r===2?new t.Rect(u.frozenTrailingX,u.viewportY,u.frozenTrailingWidth,u.viewportHeight):i:n===2?r===0?new t.Rect(u.frozenX,u.frozenTrailingY,u.frozenWidth,u.frozenTrailingHeight):r===1?new t.Rect(u.viewportX,u.frozenTrailingY,u.viewportWidth,u.frozenTrailingHeight):r===2?new t.Rect(u.frozenTrailingX,u.frozenTrailingY,u.frozenTrailingWidth,u.frozenTrailingHeight):i:i},footerRect:function(n){var r=this;return n===0?new t.Rect(r.frozenX,r.footerY,r.frozenWidth,r.footerHeight):n===1?new t.Rect(r.viewportX,r.footerY,r.viewportWidth,r.footerHeight):n===2?new t.Rect(r.frozenTrailingX,r.footerY,r.frozenTrailingWidth,r.footerHeight):i},footerCornerRect:function(){var n=this;return new t.Rect(n.footerX,n.footerY,n.footerWidth,n.footerHeight)}},y=u._getGroupLayout(),f,s,o,h;if(n.x+=y.width,n.y+=y.height,a-=y.width,l-=y.height,u.rowHeaderVisible===i||u.rowHeaderVisible===r||u.rowHeaderVisible)for(h=u.getColumnCount(2),o=0;o<h;o++)n.rowHeaderWidth+=u._getZoomColumnWidth(o,2);if(u.colHeaderVisible===i||u.colHeaderVisible===r||u.colHeaderVisible)for(s=u.getRowCount(1),f=0;f<s;f++)n.colHeaderHeight+=u._getZoomRowHeight(f,1);if(u.frozenColCount>0)for(h=u.getColumnCount(),o=0;o<u.frozenColCount&&o<h;o++)u.getColumnVisible(o)&&(n.frozenWidth+=u._getZoomColumnWidth(o));if(u.frozenRowCount>0)for(s=u.getRowCount(),f=0;f<u.frozenRowCount&&f<s;f++)u.getRowVisible(f)&&(n.frozenHeight+=u._getZoomRowHeight(f));if(u._frozenTrailingColCount>0)for(h=u.getColumnCount(),o=e(u.frozenColCount,h-u._frozenTrailingColCount);o<h;o++)n.frozenTrailingWidth+=u._getZoomColumnWidth(o);if(u._frozenTrailingRowCount>0)for(s=u.getRowCount(),f=e(u.frozenRowCount,s-u._frozenTrailingRowCount);f<s;f++)n.frozenTrailingHeight+=u._getZoomRowHeight(f);return a-=n.rowHeaderWidth,l-=n.colHeaderHeight,a-=n.frozenWidth,l-=n.frozenHeight,a-=n.frozenTrailingWidth,l-=n.frozenTrailingHeight,l-=n.footerHeight,n.viewportWidth=e(0,a),n.viewportHeight=e(0,l),n.headerX=n.x,n.headerY=n.y,n.frozenX=n.headerX+n.rowHeaderWidth,n.frozenY=n.headerY+n.colHeaderHeight,n.viewportX=n.frozenX+n.frozenWidth,n.viewportY=n.frozenY+n.frozenHeight,n.frozenTrailingX=n.viewportX+n.viewportWidth,n.frozenTrailingY=n.viewportY+n.viewportHeight,n.footerX=n.headerX,n.footerY=n.y+n.height-n.footerHeight,n},l.prototype._getSheetLayout=function(){var n=this;return n._layoutModel||(n._layoutModel=n._createLayout()),n._layoutModel},l.prototype._getColumnLayout=function(n,t){if(typeof t===u||t===i||t===3||t===1)return this._getViewportColumnLayout(n);else if(t===2)return this._getRowHeaderColumnLayout();return i},l.prototype._getRowHeaderColumnLayout=function(){var n=this;return n._colLayoutCache.rowHeader||(n._colLayoutCache.rowHeader=n._createRowHeaderColumnLayout()),n._colLayoutCache.rowHeader},l.prototype._getViewportColumnLayout=function(n){var t=this;return t._colLayoutCache.viewport||(t._colLayoutCache.viewport={}),t._colLayoutCache.viewport[n]||(t._colLayoutCache.viewport[n]=t._createViewportColumnLayout(n)),t._colLayoutCache.viewport[n]},l.prototype._createRowHeaderColumnLayout=function(){for(var r=new t._LayoutModel,f=this._getSheetLayout(),u=f.headerX,i,e=this.getColumnCount(2),n=0;n<e;n++)i=this._getZoomColumnWidth(n,2),r.push(new t._Layout(-1,n,u,-1,i,-1)),u+=i;return r},l.prototype._createViewportColumnLayout=function(n){var r=this,h=new t._LayoutModel,c=r._getSheetLayout(),s=r.getColumnCount(),i,o,u,l=r._cachePool,a,v;if(n===0)for(o=c.frozenX,s=isNaN(r.frozenColCount)?0:f(r.frozenColCount,s),i=0;i<s;i++)u=l.getZoomColWidth(i),h.push(new t._Layout(-1,i,o,-1,u,-1)),o+=u;else if(n===1)for(o=c.viewportX,s=s-r._frozenTrailingColCount,a=c.viewportWidth,v=e(r.frozenColCount,r._scrollLeftCol),i=v;a>0&&i<s;i++)u=l.getZoomColWidth(i),h.push(new t._Layout(-1,i,o,-1,u,-1)),o+=u,a-=u;else if(n===2)for(o=c.frozenTrailingX,i=e(r.frozenColCount,s-r._frozenTrailingColCount);i<s;i++)u=l.getZoomColWidth(i),h.push(new t._Layout(-1,i,o,-1,u,-1)),o+=u;return h},l.prototype._getRowLayout=function(n,t){if(typeof t===u||t===i||t===3||t===2)return this._getViewportRowLayout(n);else if(t===1)return this._getColumnHeaderRowLayout();return i},l.prototype._getAllRowLayout=function(n){for(var i,r=new t._LayoutModel,u=0;u<3;u++)i=this._getRowLayout(u,n),i&&i.length>0&&(r=t.GC$.merge(r,i));return r},l.prototype._getAllColumnLayout=function(n){for(var i,r=new t._LayoutModel,u=0;u<3;u++)i=this._getColumnLayout(u,n),i&&i.length>0&&(r=t.GC$.merge(r,i));return r},l.prototype._getColumnHeaderRowLayout=function(){var n=this;return n._rowLayoutCache.colHeader||(n._rowLayoutCache.colHeader=n._createColumnHeaderRowLayout()),n._rowLayoutCache.colHeader},l.prototype._getViewportRowLayout=function(n){var t=this;return t._rowLayoutCache.viewport||(t._rowLayoutCache.viewport={}),t._rowLayoutCache.viewport[n]||(t._rowLayoutCache.viewport[n]=t._createViewportRowLayout(n)),t._rowLayoutCache.viewport[n]},l.prototype._createColumnHeaderRowLayout=function(){for(var r=new t._LayoutModel,f=this._getSheetLayout(),u=f.headerY,i,e=this.getRowCount(1),n=0;n<e;n++)i=this._getZoomRowHeight(n,1),r.push(new t._Layout(n,-1,-1,u,-1,i)),u+=i;return r},l.prototype._createViewportRowLayout=function(n){var r=this,h=new t._LayoutModel,c=r._getSheetLayout(),s=r.getRowCount(),i,o,u,l=r._cachePool,a,v;if(n===0)for(o=c.frozenY,s=isNaN(r.frozenRowCount)?0:f(r.frozenRowCount,s),i=0;i<s;i++)u=l.getZoomRowHeight(i),h.push(new t._Layout(i,-1,-1,o,-1,u)),o+=u;else if(n===1)for(o=c.viewportY,s=s-r._frozenTrailingRowCount,a=c.viewportHeight,v=e(r.frozenRowCount,r._scrollTopRow),i=v;a>0&&i<s;i++)u=l.getZoomRowHeight(i),h.push(new t._Layout(i,-1,-1,o,-1,u)),o+=u,a-=u;else if(n===2)for(o=c.frozenTrailingY,i=e(r.frozenRowCount,s-r._frozenTrailingRowCount);i<s;i++)u=l.getZoomRowHeight(i),h.push(new t._Layout(i,-1,-1,o,-1,u)),o+=u;return h},l.prototype._getCellLayout=function(n,i,r){var u=this,v=u.getRowCount(r),y=u.getColumnCount(r),f=u._getRowLayout(n,r),e=u._getColumnLayout(i,r),c=new t._LayoutModel;if(f&&f.length>0&&e&&e.length>0){var o=f[0].row,s=e[0].col,l=f[f.length-1].row,a=e[e.length-1].col,h=u.getSpans(new t.Range(o,s,l-o+1,a-s+1),r);h&&h.length>0&&u._addCellLayout(h,o,s,l,a,c,v,y,r,f,e)}return c},l.prototype._getCellLayoutByCell=function(n,r,u,f,e){var o=this,v=o.getRowCount(u),y=o.getColumnCount(u),h=o._getRowLayout(n,u),c=o._getColumnLayout(r,u),l=new t._LayoutModel,a;if(h&&h.length>0&&c&&c.length>0){var p=h[0].row,w=c[0].col,s=o.getSpan(f,e,u);return(s&&(a=[],a.push(s),o._addCellLayout(a,p,w,s.row+s.rowCount,s.col+s.colCount,l,v,y,u,h,c)),l.length>0)?l[0]:i}return i},l.prototype._addCellLayout=function(n,i,r,u,f,e,o,s,h,c,l){var ot=n.length,ut,v,ft,et,a;if(!(ot<=0)){var w=this,b=u+1,k=f+1,y=new Array(b),p=new Array(k),nt=new Array(k),tt=new Array(b),d=0,g=0;for(a=i-1;a>=0;a--)y[a]=w._getZoomRowHeight(a,h),g-=y[a],tt[a]=g;for(g=0,a=i;a<b;a++)tt[a]=g,y[a]=w._getZoomRowHeight(a,h),g+=y[a];for(a=r-1;a>=0;a--)p[a]=w._getZoomColumnWidth(a,h),d-=p[a],nt[a]=d;for(d=0,a=r;a<k;a++)nt[a]=d,p[a]=w._getZoomColumnWidth(a,h),d+=p[a];for(ut=0;ut<ot;ut++)if(v=n[ut],v.intersect(i,r,u-i+1,f-r+1)){if(ft=v.row+v.rowCount,ft>b){for(a=b;a<ft;a++)y.push(w._getZoomRowHeight(a,h)),tt.push(tt[a-1]+y[a]);b=ft}if(et=v.col+v.colCount,et>k){for(a=k;a<et;a++)p.push(w._getZoomColumnWidth(a,h)),nt.push(nt[a-1]+p[a]);k=et}for(var d=nt[v.col],g=tt[v.row],st=0,ht=0,it,rt=v.col;rt<v.col+v.colCount&&rt<s;rt++)st+=p[rt];for(it=v.row;it<v.row+v.rowCount&&it<o;it++)ht+=y[it];e.push(new t._Layout(v.row,v.col,l[0].x+d,c[0].y+g,st,ht,v.rowCount,v.colCount))}}},l.prototype._getRowViewportIndexNearY=function(n){var t=this._getSheetLayout();return this.frozenRowCount>0&&n<t.frozenY+t.frozenHeight?0:this._frozenTrailingRowCount>0&&n>t.frozenTrailingY?2:1},l.prototype._getColumnViewportIndexNearX=function(n){var t=this._getSheetLayout();return this.frozenColCount>0&&n<t.frozenX+t.frozenWidth?0:this._frozenTrailingColCount>0&&n>t.frozenTrailingX?2:1},l.prototype._getViewportColumnLayoutNearX=function(n,t){var r=this._getColumnLayout(n);return r?r.findNearX(t):i},l.prototype._getViewportRowLayoutNearY=function(n,t){var r=this._getRowLayout(n);return r?r.findNearY(t):i},l.prototype._syncHScollbarPosition=function(){var n=this,t=n.parent,i=n._getScrollableColumn(n._scrollLeftCol);i!==-1&&i!==n._scrollLeftCol&&(n._scrollLeftCol=i);t&&t._scrollbarH&&t._scrollbarH.value(n._getVisibleColIndex(n._scrollLeftCol))},l.prototype._syncVScrollbarPosition=function(){var n=this,t=n.parent,i=n._getScrollableRow(n._scrollTopRow);i!==-1&&i!==n._scrollTopRow&&(n._scrollTopRow=i);t&&t._scrollbarV&&t._scrollbarV.value(n._getVisibleRowIndex(n._scrollTopRow))},l.prototype._syncHScrollbarSize=function(){var t=this,n=t.parent;n&&n._resizeHScrollBar&&(n.scrollIgnoreHidden()&&(t._columnIndexInfo=t._getColumnIndexInfo(!0)),n._resizeHScrollBar())},l.prototype._syncVScrollbarSize=function(){var t=this,n=t.parent;n&&n._resizeVScrollBar&&(n.scrollIgnoreHidden()&&(t._rowIndexInfo=t._getRowIndexInfo(!0)),n._resizeVScrollBar())},l.prototype._invalidateVScrollbar=function(){var n=this.parent;n&&n.scrollIgnoreHidden()&&(this._needSyncVScrollbarSize=!0);this._syncVScrollbarPosition()},l.prototype._invalidateHScrollbar=function(){var n=this.parent;n&&n.scrollIgnoreHidden()&&(this._needSyncHScrollbarSize=!0);this._syncHScollbarPosition()},l.prototype._getVisibleRowIndex=function(n){var t=this.parent,i;return t&&t.scrollIgnoreHidden()?(i=this._getRowIndexInfo().visibleIndex,i[n]):n},l.prototype._getOriginalRowIndex=function(n){var t=this.parent,i;return t&&t.scrollIgnoreHidden()?(i=this._getRowIndexInfo().originalIndex,i[n]):n},l.prototype._getVisibleColIndex=function(n){var t=this.parent,i;return t&&t.scrollIgnoreHidden()?(i=this._getColumnIndexInfo().visibleIndex,i[n]):n},l.prototype._getOriginalColIndex=function(n){var t=this.parent,i;return t&&t.scrollIgnoreHidden()?(i=this._getColumnIndexInfo().originalIndex,i[n]):n},l.prototype._getColumnIndexInfo=function(n){var i=this,r,t;if(i._columnIndexInfo&&!n)return i._columnIndexInfo;var s=i.getColumnCount()-i._frozenTrailingColCount-i.frozenColCount,f=i.frozenColCount,e=f+s-1,o=i._cachePool,u={visibleIndex:{},originalIndex:{}};if(e-f+1<=0)return u;for(r=0,t=f;t<=e;t++)u.originalIndex[r]=t,u.visibleIndex[t]=r,o.getZoomColWidth(t)>0&&r++;for(t--,r--;o.getZoomColWidth(t)<=0&&t>=f;)u.originalIndex[r]=t,u.visibleIndex[t]=r,t--;return u},l.prototype._getRowIndexInfo=function(n){var i=this,r,t;if(i._rowIndexInfo&&!n)return i._rowIndexInfo;var s=i.getRowCount()-i._frozenTrailingRowCount-i.frozenRowCount,f=i.frozenRowCount,e=f+s-1,o=i._cachePool,u={visibleIndex:{},originalIndex:{}};if(e-f+1<=0)return u;for(r=0,t=f;t<=e;t++)u.originalIndex[r]=t,u.visibleIndex[t]=r,o.getZoomRowHeight(t)>0&&r++;for(t--,r--;o.getZoomRowHeight(t)<=0&&t>=f;)u.originalIndex[r]=t,u.visibleIndex[t]=r,t--;return u},l.prototype._getScrollableRow=function(n,t){var u=this,f=u.getFrozenRowCount(),e=u.getRowCount()-u.getFrozenTrailingRowCount()-1,r;if(t){if(n>e&&(n=e),r=u._getPrevVisualRow(n+1),r!=i&&r>=f)return r}else if(n<f&&(n=f),r=u._getNextVisualRow(n-1),r!=i&&r<=e)return r;return-1},l.prototype._getScrollableColumn=function(n,t){var u=this,f=u.getFrozenColumnCount(),e=u.getColumnCount()-u.getFrozenTrailingColumnCount()-1,r;if(t){if(n>e&&(n=e),r=u._getPrevVisualColumn(n+1),r!=i&&r>=f)return r}else if(n<f&&(n=f),r=u._getNextVisualColumn(n-1),r!=i&&r<=e)return r;return-1},l.prototype._getTopRowWhenLastRowShowComplete=function(n,t,i){var u,o,r,f,e;if(i<t)return i;for(u=0,o=this._cachePool,r=i,f=i;r>=t;r--)if(e=o.getZoomRowHeight(r),!(e<=0)){if(u+=e,u>n)break;f=r}return f},l.prototype._getBottomRowWhenFirstRowShowComplete=function(n,t,i){var u,o,r,f,e;if(i<t)return i;for(u=0,o=this._cachePool,r=t,f=t;r<=i;r++)if(e=o.getZoomRowHeight(r),!(e<=0)){if(u+=e,u>n)break;f=r}return f},l.prototype._getLeftColWhenLastColShowComplete=function(n,t,i){var u,o,r,f,e;if(i<t)return i;for(u=0,o=this._cachePool,r=i,f=i;r>=t;r--)if(e=o.getZoomColWidth(r),!(e<=0)){if(u+=e,u>n)break;f=r}return f},l.prototype._getPageValueH=function(){var e=this._getSheetLayout(),i=this._getColumnLayout(1,3),f=0,n=0,t,r,u;if(i)for(t=0;t<i.length;t++)r=i[t].width,f+=r,r>0&&n++;return(n=n===0?1:n,u=f/n,u===0)?1:s(e.viewportWidth/u)},l.prototype._getPageValueV=function(){var e=this._getSheetLayout(),i=this._getRowLayout(1,3),f=0,n=0,t,r,u;if(i)for(t=0;t<i.length;t++)r=i[t].height,f+=r,r>0&&n++;return(n=n===0?1:n,u=f/n,u===0)?1:s(e.viewportHeight/u)},l.prototype._getRightColWhenFirstColShowComplete=function(n,t,i){var u,o,r,f,e;if(i<t)return i;for(u=0,o=this._cachePool,r=t,f=t;r<=i;r++)if(e=o.getZoomColWidth(r),!(e<=0)){if(u+=e,u>n)break;f=r}return f},l.prototype._getLastVisualScrollRow=function(n){var s,u,f;(n===r||n===i)&&(n=3);var t=this,e=t.parent,o=t.frozenRowCount;return e&&e._scrollbarMaxAlign?(s=t._getSheetLayout(),t._getTopRowWhenLastRowShowComplete(s.viewportHeight,o,t.getRowCount()-t._frozenTrailingRowCount-1)):(u=t.getRowCount(n),(n===3||n===2)&&(u=u-t._frozenTrailingRowCount),f=t._getPrevVisualRow(u,n),f===i&&(f=o),f)},l.prototype._getLastVisualScrollColumn=function(n){var s,u,f;(n===r||n===i)&&(n=3);var t=this,e=t.parent,o=t.frozenColCount;return e&&e._scrollbarMaxAlign?(s=t._getSheetLayout(),t._getLeftColWhenLastColShowComplete(s.viewportWidth,o,t.getColumnCount()-t._frozenTrailingColCount-1)):(u=t.getColumnCount(n),(n===3||n===1)&&(u=u-t._frozenTrailingColCount),f=t._getPrevVisualColumn(u,n),f===i&&(f=o),f)},l.prototype._getLastNonNullRowAndCol=function(){var r=this,n=r.frozenRowCount,t=r.frozenColCount,v=r._floatingObjectArray,rt=r.getRowCount()-r._frozenTrailingRowCount-1,ut=r.getColumnCount()-r._frozenTrailingColCount-1,u=r._sheetModelManager,y,p,e,s,w,b,h,k,d,nt,g,tt,f,l,it,a,i,c,o;if(u&&(y=u.getRowInfos(3),p=u.getColInfos(3),y&&y._getItems()&&(e=y._getItems(),e.length>0&&e.length-1>n&&(n=e.length-1)),p&&p._getItems()&&(e=p._getItems(),e.length>0&&e.length-1>t&&(t=e.length-1)),s=u.getDataModel(3),s&&(s._lastNonNullRow>n&&(n=s._lastNonNullRow),s._lastNonNullColumn>t&&(t=s._lastNonNullColumn)),w=u.getDataModel(2),w&&w._lastNonNullRow>n&&(n=w._lastNonNullRow),b=u.getDataModel(1),b&&b._lastNonNullColumn>t&&(t=b._lastNonNullColumn)),h=u.getSpanModel(3),h&&(h._lastNonNullRow>n&&(n=h._lastNonNullRow),h._lastNonNullColumn>t&&(t=h._lastNonNullColumn)),k=u.getSpanModel(2),k&&k._lastNonNullRow>n&&(n=k._lastNonNullRow),d=u.getSpanModel(1),d&&d._lastNonNullColumn>t&&(t=d._lastNonNullColumn),nt=r._tableManager,nt&&(g=nt.getTables(),g))for(i=0,c=g.length;i<c;i++)tt=g[i],tt&&(f=tt.range(),f.row+f.rowCount-1>n&&(n=f.row+f.rowCount-1),f.col+f.colCount-1>t&&(t=f.col+f.colCount-1));if(v&&v.length>0)for(i=0,c=v.length;i<c;i++)l=v[i],l&&(l.endRow()>n&&(n=l.endRow()),l.endColumn()>t&&(t=l.endColumn()));if(it=r._commentManager,it&&(a=it._commentViewList,a&&a.length>0))for(i=0,c=a.length;i<c;i++)o=a[i],o&&o._comment&&(o._endRow>n&&(n=o._endRow),o._endColumn>t&&(t=o._endColumn));return n>rt&&(n=rt),t>ut&&(t=ut),{lastNonNullRow:n,lastNonNullCol:t}},l.prototype._setTopRow=function(n){var t=this,r=t._scrollTopRow,i;n>=t._getFirstPageTopRow()&&n<=t._getLastVisualScrollRow()&&n!==r&&(t._eventHandler.vScrollTo(n),t._syncVScrollbarPosition(),i=t.parent,i&&!i._scrollbarShowMax&&t._syncVScrollbarSize())},l.prototype._setLeftColumn=function(n){var t=this,r=t._scrollLeftCol,i;n>=t._getFirstPageLeftColumn()&&n<=t._getLastVisualScrollColumn()&&n!==r&&(t._eventHandler.hScrollTo(n),t._syncHScollbarPosition(),i=t.parent,i&&!i._scrollbarShowMax&&t._syncHScrollbarSize())},l.prototype._getSpanModel=function(n){return this._sheetModelManager.getSpanModel(n)},l.prototype._clipboardFloatingObjectCopy=function(n,r,u){var s,e,h;if(t.features.floatingObject){var f=this,o=f._getFloatingObjectClipboardHelper(),c=o.fromSheet,l=c&&c._eventHandler;for(l&&l._setClipboardFloatingObjectData(i),o.fromSheet=f,o.isCutting=r,s=new t.NamedObjectArray,e=0;e<n.length;e++)h=f._findFloatingObjectInternal(n[e]),h&&s.push(h);f._eventHandler._setClipboardFloatingObjectData(s)}},l.prototype._clipboardCopy=function(n,t,r){var h;if(n){var c="\t",l="\r\n",a='"',u=this,e=u._eventHandler,s=o.getRangeText(u,n.row,n.rowCount,n.col,n.colCount,l,c,a,!1,0),f=u._getClipboardHelper();f.fromSheet=u;f.range=n;f.isCutting=t;u._clearFloatingObjectClipboardHelper();try{h={sheet:u,sheetName:u._name,copyData:s,cancel:!1};u.triggerClipboardChanging(h);h&&h.cancel===!1?(e&&!r&&e._switchFocusForClipboard(s),u.triggerClipboardChanged({sheet:u,sheetName:u._name,copyData:s}),setTimeout(function(){!e||r||u.disposed||e._switchBackFocusAfterClipboard()},100)):(f.fromSheet=i,f.range=i)}catch(v){}finally{return s}}},l.prototype._trySearch=function(n,i,r){var l,u,o,s,h,e,c,f;return n?(l=t.SearchFlags,n=n.toString(),i=i.toString(),u=(r&2)>0,u&&(r&4)==0?(r&1)>0?(o=n.toLowerCase(),s=i.toLowerCase(),o===s):n===i:(h=(r&1)>0,e=(r&4)>0,c=h?new RegExp(at(i,e,u),"i"):new RegExp(at(i,e,u)),f=n.search(c)>-1,u&&f&&i.search(/\*/)<=-1&&(f=n.length===i.length),f)):!1},l.prototype._getFilterButtonModel=function(){var n=this;return!n._filterButtonsModel&&t.features.filter_ui&&(n._filterButtonsModel=n._createFilterButtonModle()),n._filterButtonsModel},l.prototype._createFilterButtonModle=function(){var o=this,y=new t._FilterButtonInfoModel,e=o.rowFilter(),c,l,a,p,f,v,u,n,s,i,r;if(e&&e.range){var n=e.range,i=n.col<0?0:n.col,w=n.col<0?o.getColumnCount():n.col+n.colCount,u,h;if(n.row<1?(u=o.getRowCount(1)-1,h=1):(u=n.row-1,h=3),u>=0)while(i<w)e.filterButtonVisible&&e.filterButtonVisible(i)?(r=new t._FilterButtonInfo(e),r.sheetArea=h,r.row=u,c=o.getSpans(new t.Range(u,i,1,1),h),c&&c.length>0?(l=c[0],r.row=l.row,r.col=l.col,i+=l.colCount):(r.col=i,i++),y.push(r)):i++}for(a=o.getTables(),p=a?a.length:0,v=0;v<p;v++)if(f=a[v],f&&f.showHeader()&&(u=f.headerIndex(),u>=0))for(n=f.range(),s=0;s<n.colCount;s++)i=n.col+s,f.filterButtonVisible(s)&&(r=new t._FilterButtonInfo(f.rowFilter(),u,i,3),y.push(r));return y},l.prototype._getFilterButtonHitInfo=function(n,r,u){var s,w,f;if(!t.features.filter_ui)return i;var e=this,p=n.rowViewportIndex,y=n.colViewportIndex,a,v,h;if(n.hitTestType===1?(a=e._getColumnHeaderRowLayout().findY(u),v=e._getViewportColumnLayout(y).findX(r),h=1):n.hitTestType===3&&(a=e._getViewportRowLayout(p).findY(u),v=e._getViewportColumnLayout(y).findX(r),h=3),!a||!v)return i;var c=a.row,l=v.col,o=e.getSpan(c,l,h);if(o){if(c!==o.row+o.rowCount-1||l!==o.col+o.colCount-1)return i;c=o.row;l=o.col}return(s=e._getFilterButtonModel().find(c,l,h),s&&(w=e.getCellRect(c,l,p,y),f=e._render._getFilterButtonRect(w,h),f.x<=r&&r<=f.x+f.width&&f.y<=u&&u<=f.y+f.height))?new t._FilterButtonInfo(s.rowFilter,s.row,s.col,s.sheetArea,f.x,f.y,f.width,f.height):i},l.prototype._getCellTypeHitInfo=function(n,t,u){var f=this,e=n.row,o=n.col,s=n.hitTestType;if(e===i||e===r||o===i||o===r)return i;var h=f.getActualStyle(e,o,s),c=s===1?-1:r,l=s===2?-1:r,a=f.getCellRect(e,o,c,l),v={sheet:f,row:e,col:o,sheetArea:s},y=h.cellType||f.getDefaultCellType(s);return f._allowEditorReservedLocations?y.getHitInfo(t,u,h,a,v):i},l.prototype._getFloatingObjectHitInfo=function(n,r){var f=this,o=f._floatingObjectArray,e=f._getSheetLayout(),s,u;if(t.features.floatingObject&&e&&o&&o.length>0)for(s=o.length-1;s>=0;s--)if(u=o[s],f.canSelectFloatingObject(u)){var h=u.position().x*f._zoomFactor+e.headerX+e.rowHeaderWidth,c=u.position().y*f._zoomFactor+e.headerY+e.colHeaderHeight,l=u.width(),a=u.height();if(n>=h&&n<h+l&&r>=c&&r<c+a)return{x:n,y:r,floatingObject:u}}return i},l.prototype._getCommentHitInfo=function(n,r){return t.features.comment?this._commentManager.getCommentHitInfo(n,r):i},l.prototype._disposeUserEvents=function(){this.unbindAll();this._unbindAll()},l.prototype._doCommand=function(n){var t=this.undoManager();return t.doAction(n)},l.prototype._refreshTabStrip=function(){var n=this;n.parent&&n.parent._tab&&n.parent._tab.repaint&&n.parent._tab.repaint()},l.prototype._isAnyCellInRangeLocked=function(n){for(var i,t=this._getActualRange(n),u=t.row,f=t.col,o=u+t.rowCount,s=f+t.colCount,e,r=u;r<o;r++)for(i=f;i<s;i++)if(e=this.getActualStyle(r,i),e.locked===!0)return!0;return!1},l.prototype._isValidRange=function(n,t,i,r,u,f){if(-1<=n&&n<u&&-1<=t&&t<f)if(n===-1&&t===-1)return!0;else if(n===-1){if(r!==0&&t+r<=f)return!0}else if(t===-1){if(i!==0&&n+i<=u)return!0}else if(r!==0&&t+r<=f&&i!==0&&n+i<=u)return!0;return!1},l.prototype._isValidPastedRange=function(n,t,i,r,u,f){return this._isValidRange(n,t,i,r,u,f)},l.prototype._hasPartSpans=function(n,t,r,u){var e,f,o,s,h,c;if(n<0&&t<0)return!1;else if(n<0){if(o=this._getSpanModel(1),o&&o.length!==0)for(e=o.getEnumerator(-1,t,-1,u),f=i;e.moveNext();)if(f=e.current(),f.col<t||f.col+f.colCount>t+u)return!0}else if(t<0&&(s=this._getSpanModel(2),s&&s.length!==0))for(e=s.getEnumerator(n,-1,r,-1),f=i;e.moveNext();)if(f=e.current(),f.row<n||f.row+f.rowCount>n+r)return!0;if(h=this._getSpanModel(),h&&h.length!==0)for(c=h.getEnumerator(n,t,r,u),f=i;c.moveNext();)if((f=c.current(),n!==-1&&(f.row<n||f.row+f.rowCount>n+r))||t!==-1&&(f.col<t||f.col+f.colCount>t+u))return!0;return!1},l.prototype._hasSpans=function(n,t,i,r){var f=this._getSpanModel(),u,e,o;if(f)for(u=0,e=f.length;u<e;u++)if(o=f[u],o.intersect(n,t,i,r))return!0;return!1},l.prototype._hasPartTable=function(n,i,r,u){var e=this.getTables(),s,h,f,o;if(e&&e.length>0)for(s=new t.Range(n,i,r,u),h=e.length,o=0;o<h;o++)if(f=e[o].range(),s.intersect(f.row,f.col,f.rowCount,f.colCount)&&!s.containsRange(f))return!0;return!1},l.prototype._hasTable=function(n,t,i,r){return this._tableManager&&this._tableManager.has(n,t,i,r)?!0:!1},l.prototype._hasPartArrayFormulas=function(n,t,i,r){return this._getCalcModel()&&this._getCalcModel()._getFormulaExps(n,t,i,r,!0,!0)},l.prototype._getsArrayFormulas=function(n,t,i,r){return this._getCalcModel()&&this._getCalcModel()._getFormulaExps(n,t,i,r,!1,!0)},l.prototype._hasArrayFormula=function(n,t,i,r){var u=this._getsArrayFormulas(n,t,i,r);return u&&u.formulas&&u.formulas.length>0},l.prototype._suspendInvalidate=function(){this._layoutSuspended++},l.prototype._resumeInvalidate=function(){var n=this;if(n._layoutSuspended--,n._layoutSuspended<=0){if(!n.isPaintSuspended())return n.invalidateLayout(),n.repaint(),!0;n._layoutSuspended=0}return!1},l.prototype._nextNonNullRow=function(n,t){var r=this,f=r._bindingManager,o=r.getDataSource(),u,i;for(n++,u=t?r._getModel(2):r._getModel(3),i=u.getRowCount(),t===!1&&o&&(i=e(i,f.getRowCount()));n>=0&&n<i;){if(u.dataTable.hasOwnProperty(n)&&u.dataTable[n])break;if(t===!1&&o&&f.getDataItem(n))break;n++}return n<i?n:-1},l.prototype._nextNonNullColumn=function(n,t,u){var o=this,h=o._bindingManager,c=o.getDataSource(),f=i,e=u?o._getModel(1):o._getModel(3),s;if(n>=0&&n<e.getRowCount()&&e.dataTable.hasOwnProperty(n)&&(f=e.dataTable[n]),u===!1&&!f&&c&&n>=0&&n<h.getRowCount()&&(f=h.getDataItem(n)),!f)return-1;for(t++;t>=0&&(t<e.getColumnCount()||t<f.length);){if(f.hasOwnProperty(t)&&f[t])break;if(u===!1&&c&&(s=o._getValueImp(e,n,t),s!==r&&s!==i))break;t++}return t<e.getColumnCount()||u===!1&&f&&t<f.length?t:-1},l.prototype._closeDragFillPopup=function(){this._smartTag&&this._smartTag.close()},l.prototype._cellRangeInflate=function(n,t){var r,i;if(n&&n.length>0)for(r=0;r<n.length;r++)if(i=n[r],t.intersect(i.row,i.col,i.rowCount,i.colCount))return n.splice(r--,1),this._cellRangeInflate(n,this._unionCellRange(t,i));return t},l.prototype._unionCellRange=function(n,i){var r=f(n.row,i.row),u=f(n.col,i.col),o=e(n.row+n.rowCount-1,i.row+i.rowCount-1),s=e(n.col+n.colCount-1,i.col+i.colCount-1);return r>=0&&u>=0?new t.Range(r,u,o-r+1,s-u+1):r>=0?new t.Range(r,-1,o-r+1,-1):u>=0?new t.Range(-1,u,-1,s-u+1):new t.Range(-1,-1,-1,-1)},l.prototype._getClipboardHelper=function(){var n=this;return!n._clipboardHelper&&n.parent&&n.parent._clipboardHelper?n._clipboardHelper=n.parent._clipboardHelper:n._clipboardHelper||(n._clipboardHelper={fromSheet:i,range:i,isCutting:!1}),n._clipboardHelper},l.prototype._getFloatingObjectClipboardHelper=function(){var n=this;return!n._floatingObjectClipboardHelper&&n.parent&&n.parent._floatingObjectClipboardHelper?n._floatingObjectClipboardHelper=n.parent._floatingObjectClipboardHelper:n._floatingObjectClipboardHelper||(n._floatingObjectClipboardHelper={fromSheet:i,isCutting:!1}),n._floatingObjectClipboardHelper},l.prototype._clearFloatingObjectClipboardHelper=function(){var t=this,n=t._getFloatingObjectClipboardHelper();n.fromSheet&&n.fromSheet._eventHandler._setClipboardFloatingObjectData(i);n.fromSheet=i;n.isCutting=!1},l.prototype._checkPastedRange=function(n,r,u,f,e,o){var c=t.SR.Exp_PasteSourceCellsLocked,s,h;if(o.pastedInternal=!1,o.pastedRange=i,!n&&(!e||e===""))return!1;if(s=this,h=s,s._isPastedInternal(n,r,h,e)||!e){if(o.pastedInternal=!0,f&&n.isProtected&&n._isAnyCellInRangeLocked(r))return s._raiseInvalidOperation(1,c),!1;o.pastedRange=s._getPastedRange(n,r,h,u,f)}else o.pastedRange=s._getPastedRangefromText(u,e);return s._checkPasteRangeImp(n,r,u,f,o)},l.prototype._checkPasteRangeImp=function(n,i,r,u,f){var g=t.SR.Exp_InvalidCopyPasteSize,it=t.SR.Exp_PasteDestinationCellsLocked,k=t.SR.Exp_PasteChangeMergeCell,d=t.SR.Exp_ChangePartOfArray,h=this,o=h,a,v,nt,tt,w,b,e;if(!f.pastedRange)return h._raiseInvalidOperation(1,g),!1;if(o.isProtected&&o._isAnyCellInRangeLocked(f.pastedRange))return h._raiseInvalidOperation(1,it),!1;if(f.pastedInternal){if(n._hasPartSpans(i.row,i.col,i.rowCount,i.colCount))return h._raiseInvalidOperation(1,k),!1;if(u&&n._hasPartArrayFormulas(i.row,i.col,i.rowCount,i.colCount))return h._raiseInvalidOperation(1,d),!1;var y=f.pastedRange.row<0?o.getRowCount():f.pastedRange.rowCount,p=f.pastedRange.col<0?o.getColumnCount():f.pastedRange.colCount,c=i.row<0?n.getRowCount():i.rowCount,l=i.col<0?n.getColumnCount():i.colCount;if(y>c||p>l)for(a=r.row,v=r.col,r.row<0&&c<o.getRowCount()&&(a=0),r.col<0&&l<o.getColumnCount()&&(v=0),y%c==0&&p===1?(p=l,f.pastedRange=new t.Range(a,v,y,p)):y===1&&p%l==0?(y=c,f.pastedRange=new t.Range(a,v,y,p)):(y%c!=0||p%l!=0)&&(y=c,p=l,f.pastedRange=new t.Range(a,v,y,p)),nt=s(y/c),tt=s(p/l),w=0;w<nt;w++)for(b=0;b<tt;b++){if(!h._isSingleCellToSpanCell(i,f.pastedRange)&&o._hasPartSpans(a<0?-1:a+w*c,v<0?-1:v+b*l,a<0?-1:c,v<0?-1:l))return h._raiseInvalidOperation(1,k),!1;if(o._hasPartArrayFormulas(a<0?-1:a+w*c,v<0?-1:v+b*l,a<0?-1:c,v<0?-1:l))return h._raiseInvalidOperation(1,d),!1}else{if(e=f.pastedRange,!h._isSingleCellToSpanCell(i,e)&&o._hasPartSpans(e.row,e.col,e.rowCount,e.colCount))return h._raiseInvalidOperation(1,k),!1;if(o._hasPartArrayFormulas(e.row,e.col,e.rowCount,e.colCount))return h._raiseInvalidOperation(1,d),!1}}else{if(e=f.pastedRange,o._hasPartSpans(e.row,e.col,e.rowCount,e.colCount))return h._raiseInvalidOperation(1,k),!1;if(o._hasPartArrayFormulas(e.row,e.col,e.rowCount,e.colCount))return h._raiseInvalidOperation(1,d),!1;if(!o._isValidPastedRange(e.row,e.col,e.rowCount,e.colCount,o.getRowCount(),o.getColumnCount()))return h._raiseInvalidOperation(1,g),!1}return!0},l.prototype._isSingleCellToSpanCell=function(n,t){if(n&&n.rowCount===1&&n.colCount===1){var i=this.getSpan(t.row,t.col);if(i&&i.equals(t))return!0}return!1},l.prototype._isPastedInternal=function(n,i,r,u){if(n&&i&&r){var e=o.getRangeText(n,i.row,i.rowCount,i.col,i.colCount,"\r\n","\t",'"',!1,0),f=e===u;return!f&&(t.util.browser.chrome||t.util.browser.safari||t.util.browser.webkit)&&(f=e===u+"\r\n"),f}return!1},l.prototype._getPastedRange=function(n,r,u,f,e){var v=r.row<0?0:r.row,y=r.col<0?0:r.col,h=r.row<0?n.getRowCount():r.rowCount,c=r.col<0?n.getColumnCount():r.colCount,l=f.row<0?0:f.row,a=f.col<0?0:f.col,o=f.row<0?u.getRowCount():f.rowCount,s=f.col<0?u.getColumnCount():f.colCount,p;if((e?(o=h,s=c):o%h==0&&s===1?s=c:o===1&&s%c==0?o=h:(o%h!=0||s%c!=0)&&(o=h,s=c),!this._isValidPastedRange(v,y,h,c,n.getRowCount(),n.getColumnCount()))||!this._isValidPastedRange(l,a,o,s,u.getRowCount(),u.getColumnCount()))return i;if(p=new t.Range(l,a,o,s),!e&&n._name===u._name)if(p.contains(v,y,h,c)){if((v-l)%h!=0||(y-a)%c!=0)return i}else if(p.intersect(v,y,h,c)&&(o>h||s>c))return i;return f.row===-1&&(l=-1,o=-1),f.col===-1&&(a=-1,s=-1),new t.Range(l,a,o,s)},l.prototype._getPastedRangefromText=function(n,r){var f=i,u=o.parseCsv(r,"\r\n","\t",'"');if(u){var h=n.row<0?0:n.row,c=n.col<0?0:n.col,e=u.length,s=o.getMaxLength(u);e>0&&s>0&&(f=new t.Range(h,c,e,s))}return f},l.prototype._clearClipboard=function(){var n=this._getClipboardHelper();n&&(n.fromSheet=i,n.range=i,n.isCutting=!1)},l.prototype._clipboardPaste=function(n,r,u,f,e,h,c){var v,y,l,a,p,w,it,d,b,k,rt,ut,tt,g,ot;if(n&&u._name===n._name&&u.parent&&!t.ArrayHelper.contains(u.parent.sheets,n)){n._clearClipboard();return}if(it=t.UndoRedo.ClipboardPasteRangeUndoAction.convertPasteOption,d=it(c),n&&r){if((d&2)!=0&&(e&&n._hasPartArrayFormulas(r.row,r.col,r.rowCount,r.colCount)||u._hasPartArrayFormulas(f.row,f.col,f.rowCount,f.colCount)))throw t.SR.Exp_ChangePartOfArray;if(e)o.moveTo(n,r.row,r.col,u,f.row,f.col,r.rowCount,r.colCount,d),n._clearClipboard();else if(b=f.row<0?u.getRowCount():f.rowCount,k=f.col<0?u.getColumnCount():f.colCount,l=r.row<0?n.getRowCount():r.rowCount,a=r.col<0?n.getColumnCount():r.colCount,b>l||k>a){v=f.row;y=f.col;f.row<0&&l<u.getRowCount()&&(v=0);f.col<0&&a<u.getColumnCount()&&(y=0);b%l==0&&k===1?k=a:b===1&&k%a==0?b=l:(b%l!=0||k%a!=0)&&(b=l,k=a);rt=s(b/l);ut=s(k/a);n.suspendCalcService();u.suspendCalcService();try{for(p=0;p<rt;p++)for(w=0;w<ut;w++)o.copyTo(n,r.row,r.col,u,v<0?-1:v+p*l,y<0?-1:y+w*a,v<0?-1:l,y<0?-1:a,d,!0)}finally{n.resumeCalcService(!1);u.resumeCalcService(!1)}}else o.copyTo(n,r.row,r.col,u,f.row,f.col,r.rowCount,r.colCount,d,!0)}else{v=f.row;y=f.col;l=f.rowCount;a=f.colCount;for(var ft=u._getSpanModel(),et=ft.getEnumerator(v,y,l,a),nt=[];et.moveNext();)tt=et.current(),tt&&nt.push(tt);for(g=0,ot=nt.length;g<ot;g++)ft.remove(nt[g]);if((d&1)>0&&o.clearFormula(u,v,y,l,a,!0),h&&h!=="")u.setCsv(v,y,h,"\r\n","\t",16);else for(p=0;p<l;p++)for(w=0;w<a;w++)u.setValue(v+p,y+w,i)}},l.prototype._copyFormula=function(n,i,r,u,f,e){t.Calc.CalcOperatorAdjustor.copyFormula(this._getCalcModel(),n,i,this._getCalcModel(),r,u,f,e)},l.prototype._getAutoFitType=function(){if(this.parent!=i){var n=this.parent;return n.autoFitType()}return 0},l.prototype._doCut=function(n){if(!this.isEditing()){var t=this.getSelections();if(t&&t.length===1)return this._clipboardCopy(t[0],!0,n)}return i},l.prototype._doCopy=function(n){if(!this.isEditing()){var t=this.getSelections();if(t&&t.length===1)return this._clipboardCopy(t[0],!1,n)}return i},l.prototype._doFloatingObjectCopy=function(n){var i=this,r,t,e,u,f;if(i._hasFloatingObjectsSelected()){for(r=[],u=i._floatingObjectArray,t=0,e=u.length;t<e;t++)f=u[t],f.isSelected()&&r.push(f.name());i._clipboardFloatingObjectCopy(r,!1,n)}},l.prototype._doFloatingObjectCut=function(n){var i=this,r,u,o,f,e,s,h;if(i._hasFloatingObjectsSelected()){for(r=[],f=i._floatingObjectArray,u=0,o=f.length;u<o;u++)e=f[u],e.isSelected()&&r.push(e.name());i._clipboardFloatingObjectCopy(r,!0,n);s={names:r};h=new t.UndoRedo.DeleteFloatingObjectUndoAction(i,s);i._doCommand(h)}},l.prototype._doFloatingObjectPaste=function(n,i){var r=this;if(!r.isEditing()&&t.features.floatingObject){var u=r._getFloatingObjectClipboardHelper(),f=u.fromSheet,e=f._eventHandler,o=u.isCutting;setTimeout(function(){var u,s,o,h,c;if(!r.disposed){if(u=n,e&&!n&&(u=e._getClipboardFloatingObjectData()),u&&u.length){for(s=[],o=0,h=u.length;o<h;o++)s.push(u[o].name());c=new t.UndoRedo.ClipboardPasteFloatingObjectUndoAction(r,{names:s},f);r._doCommand(c)}i&&i()}},100)}},l.prototype._doPaste=function(n,t){var i=this,r=i._eventHandler;i.isEditing()||(r&&!n&&r._switchFocusForClipboard(""),setTimeout(function(){var u,f,e;i.disposed||(u=n,r&&!n&&(u=r._getClipboardData(),r._switchBackFocusAfterClipboard()),f=i._getPasteInfo(u),f)&&(e=i._createPasteAction(f),i._doCommand(e),t&&t())},100))},l.prototype._createPasteAction=function(n){var i=this,r=n.pastedRanges,u=n.fromSheet,f=n.fromRange,e=n.isCutting,o=n.pasteOption,s=n.clipboardText,h={fromRange:f,pastedRanges:r.slice(0),isCutting:e,clipboardText:s};return new t.UndoRedo.ClipboardPasteUndoAction(i,u,i,h,o)},l.prototype._getPasteInfo=function(n){var r=this,k=r._eventHandler,b=t.SR.Exp_InvalidPastedArea,y=r._getClipboardHelper(),e=y.fromSheet,o=y.range,s=y.isCutting,l,p,w,a,v;s&&e&&o&&e.isProtected&&e._isAnyCellInRangeLocked(o)&&(s=!1);var u={pastedRange:i,pastedInternal:!1},h=[],c=r.getSelections(),f;if(c.length>1)for(l=0;l<c.length;l++){if(f=c[l],!r._checkPastedRange(e,o,f,s,n,u))return;if(f.containsRange(u.pastedRange)&&!f.equals(u.pastedRange)){r._raiseInvalidOperation(1,b);return}h.push(u.pastedRange)}else if(c.length>0){if(f=c[0],!r._checkPastedRange(e,o,f,s,n,u))return;h.push(u.pastedRange)}else{if(f=r._getSpanModel().find(r._activeRowIndex,r._activeColIndex),f||(f=new t.Range(r._activeRowIndex,r._activeColIndex,1,1)),!r._checkPastedRange(e,o,f,s,n,u))return;h.push(u.pastedRange)}for(p=r._cutCopyIndicatorManager,p&&p.isPastedInternal(u.pastedInternal),u.pastedInternal||(e=i,o=i,s=!1),w=r.clipBoardOptions(),s&&(w=0),a=0;a<h.length;a++)v=h[a],r._isSingleCellToSpanCell(o,v)&&(v.rowCount=1,v.colCount=1);return{fromSheet:e,fromRange:o,isCutting:s,pasteOption:w,pastedRanges:h,clipboardText:n}},l.prototype._getImageLoader=function(){if(!this.imageLoader){var n=this;n.imageLoader=new t._GcImageLoader(function(){n.imageLoader&&n.repaint()})}return this.imageLoader},l.prototype._getContainerDiv=function(){var n=this;return!n._containerDiv&&n._canvas&&n._canvas.parentNode&&(n._containerDiv=w.createElement("div"),t.GC$(n._containerDiv).css({position:"absolute",left:0,top:0,width:0,height:0}),t.GC$(n._canvas.parentNode).prepend(n._containerDiv)),n._containerDiv},l.prototype._raiseDragDropBlock=function(n,t,i,r,u,f,e,o,s){var h={sheet:this,sheetName:this._name,fromRow:n,fromCol:t,toRow:i,toCol:r,rowCount:u,colCount:f,copy:e,insert:o,copyOption:s,cancel:!1};return this.triggerDragDropBlock(h),h&&h.cancel===!0},l.prototype._raiseDragDropBlockCompleted=function(n,t,i,r,u,f,e,o,s){var h={sheet:this,sheetName:this._name,fromRow:n,fromCol:t,toRow:i,toCol:r,rowCount:u,colCount:f,copy:e,insert:o,copyOption:s};this.triggerDragDropBlockCompleted(h)},l.prototype._raiseInvalidOperation=function(n,t){var i={sheet:this,sheetName:this._name,invalidType:n,message:t};this.triggerInvalidOperation(i)},l.prototype._raiseSelectionChanging=function(n,t){var i=this,r=i._eventHandler._notEqualSelecions(n,t);return r===!0?(i.triggerSelectionChanging({sheet:i,sheetName:i._name,oldSelections:n,newSelections:t}),!0):!1},l.prototype._raiseSelectionChanged=function(){this.triggerSelectionChanged({sheet:this,sheetName:this._name})},l.prototype._raiseDragFillBlock=function(n){return n.cancel=!1,this.triggerDragFillBlock(n),n&&n.cancel===!0},l.prototype._raiseDragFillBlockCompleted=function(n){this.triggerDragFillBlockCompleted(n)},l.prototype._raiseCellChanged=function(n,t,i,r,u,f){var e={sheet:this,sheetName:this._name,row:t,col:i,sheetArea:f,propertyName:n,oldValue:r,newValue:u};this.triggerCellChanged(e)},l.prototype._raiseClipboardPasting=function(n,t){var i={sheet:this,sheetName:this._name,cellRange:n,pasteOption:t,cancel:!1};return this.triggerClipboardPasting(i),i.cancel===!0},l.prototype._raiseClipboardPasted=function(n,t){var i={sheet:this,sheetName:this._name,cellRange:n,pasteOption:t};this.triggerClipboardPasted(i)},l.prototype._raiseValueChanged=function(n,t,i,r){var u={sheet:this,sheetName:this._name,row:n,col:t,oldValue:i,newValue:r};this.triggerValueChanged(u)},l.prototype._raiseRangeDataChanged=function(n,t,i,r,u,f){var e={sheet:this,sheetName:this._name,row:n,column:t,rowCount:i,columnCount:r,changedCells:u,action:f};this.triggerRangeChanged(e)},l.prototype._trigger=function(n,t){var i=this._eventHandler;i&&i._eventSuspended===0&&i.trigger(n,t)},l.prototype.triggerValidationError=function(n){this._trigger(t.Events.ValidationError,n)},l.prototype.triggerCellClick=function(n){this._trigger(t.Events.CellClick,n)},l.prototype.triggerCellDoubleClick=function(n){this._trigger(t.Events.CellDoubleClick,n)},l.prototype.triggerEnterCell=function(n){this._trigger(t.Events.EnterCell,n)},l.prototype.triggerLeaveCell=function(n){this._trigger(t.Events.LeaveCell,n)},l.prototype.triggerValueChanged=function(n){this._trigger(t.Events.ValueChanged,n)},l.prototype.triggerTopRowChanged=function(n){this._trigger(t.Events.TopRowChanged,n)},l.prototype.triggerLeftColumnChanged=function(n){this._trigger(t.Events.LeftColumnChanged,n)},l.prototype.triggerInvalidOperation=function(n){this._trigger(t.Events.InvalidOperation,n)},l.prototype.triggerRangeFiltering=function(n){this._trigger(t.Events.RangeFiltering,n)},l.prototype.triggerRangeFiltered=function(n){this._trigger(t.Events.RangeFiltered,n)},l.prototype.triggerTableFiltering=function(n){this._trigger(t.Events.TableFiltering,n)},l.prototype.triggerTableFiltered=function(n){this._trigger(t.Events.TableFiltered,n)},l.prototype.triggerRangeSorting=function(n){this._trigger(t.Events.RangeSorting,n)},l.prototype.triggerRangeSorted=function(n){this._trigger(t.Events.RangeSorted,n)},l.prototype.triggerClipboardChanging=function(n){this._trigger(t.Events.ClipboardChanging,n)},l.prototype.triggerClipboardChanged=function(n){this._trigger(t.Events.ClipboardChanged,n)},l.prototype.triggerClipboardPasting=function(n){this._trigger(t.Events.ClipboardPasting,n)},l.prototype.triggerClipboardPasted=function(n){this._trigger(t.Events.ClipboardPasted,n)},l.prototype.triggerColumnWidthChanging=function(n){this._trigger(t.Events.ColumnWidthChanging,n)},l.prototype.triggerColumnWidthChanged=function(n){this._trigger(t.Events.ColumnWidthChanged,n)},l.prototype.triggerRowHeightChanging=function(n){this._trigger(t.Events.RowHeightChanging,n)},l.prototype.triggerRowHeightChanged=function(n){this._trigger(t.Events.RowHeightChanged,n)},l.prototype.triggerDragDropBlock=function(n){this._trigger(t.Events.DragDropBlock,n)},l.prototype.triggerDragDropBlockCompleted=function(n){this._trigger(t.Events.DragDropBlockCompleted,n)},l.prototype.triggerDragFillBlock=function(n){this._trigger(t.Events.DragFillBlock,n)},l.prototype.triggerDragFillBlockCompleted=function(n){this._trigger(t.Events.DragFillBlockCompleted,n)},l.prototype.triggerEditStarting=function(n){this._trigger(t.Events.EditStarting,n)},l.prototype.triggerEditChange=function(n){this._trigger(t.Events.EditChange,n)},l.prototype.triggerEditEnding=function(n){this._trigger(t.Events.EditEnding,n)},l.prototype.triggerEditEnded=function(n){this._trigger(t.Events.EditEnded,n)},l.prototype.triggerRangeGroupStateChanging=function(n){this._trigger(t.Events.RangeGroupStateChanging,n)},l.prototype.triggerRangeGroupStateChanged=function(n){this._trigger(t.Events.RangeGroupStateChanged,n)},l.prototype.triggerSelectionChanging=function(n){this._trigger(t.Events.SelectionChanging,n)},l.prototype.triggerSelectionChanged=function(n){this._trigger(t.Events.SelectionChanged,n)},l.prototype.triggerSheetNameChanging=function(n){this._trigger(t.Events.SheetNameChanging,n)},l.prototype.triggerSheetNameChanged=function(n){this._trigger(t.Events.SheetNameChanged,n)},l.prototype.triggerUserZooming=function(n){this._trigger(t.Events.UserZooming,n)},l.prototype.triggerUserFormulaEntered=function(n){this._trigger(t.Events.UserFormulaEntered,n)},l.prototype.triggerCellChanged=function(n){this._trigger(t.Events.CellChanged,n)},l.prototype.triggerColumnChanged=function(n){this._trigger(t.Events.ColumnChanged,n)},l.prototype.triggerRowChanged=function(n){this._trigger(t.Events.RowChanged,n)},l.prototype.triggerSparklineChanged=function(n){this._trigger(t.Events.SparklineChanged,n)},l.prototype.triggerRangeChanged=function(n){n.changedCells&&n.changedCells.length>0&&this._trigger(t.Events.RangeChanged,n)},l.prototype.triggerEditorStatusChanged=function(n){this._trigger(t.Events.EditorStatusChanged,n)},l.prototype.triggerFloatingObjectChanged=function(n){this._trigger(t.Events.FloatingObjectChanged,n)},l.prototype.triggerFloatingObjectSelectionChanged=function(n){this._trigger(t.Events.FloatingObjectSelectionChanged,n)},l.prototype.triggerPictureChanged=function(n){this._trigger(t.Events.PictureChanged,n)},l.prototype.triggerPictureSelectionChanged=function(n){this._trigger(t.Events.PictureSelectionChanged,n)},l.prototype.triggerCustomFloatingObjectLoaded=function(n){this._trigger(t.Events.CustomFloatingObjectLoaded,n)},l.prototype.triggerTouchToolStripOpening=function(n){this._trigger(t.Events.TouchToolStripOpening,n)},l.prototype.triggerCommentChanged=function(n){this._trigger(t.Events.CommentChanged,n)},l.prototype.triggerEditEnd=function(n){this._trigger(t.Events.EditEnd,n)},l.prototype.triggerEditStarted=function(n){this._trigger(t.Events.EditStarted,n)},l.prototype.triggerFormulaTextBoxTextChanged=function(n){this._trigger("FormulaTextBoxTextChanged",n)},l.prototype.triggerFormulaTextBoxCaretChanged=function(n){this._trigger("FormulaTextBoxCaretChanged",n)},l.prototype.triggerSlicerChanged=function(n){this._trigger(t.Events.SlicerChanged,n)},l.prototype.triggerFloatingObjectRemoving=function(n){this._trigger(t.Events.FloatingObjectRemoving,n)},l.prototype.triggerFloatingObjectRemoved=function(n){this._trigger(t.Events.FloatingObjectRemoved,n)},l.prototype.triggerCommentRemoving=function(n){this._trigger(t.Events.CommentRemoving,n)},l.prototype.triggerCommentRemoved=function(n){this._trigger(t.Events.CommentRemoved,n)},l.prototype.getBounds=function(){var n=this._bounds;return new t.Rect(n.x,n.y,n.width,n.height)},l.prototype.setBounds=function(n){var i=this._bounds=new t.Rect(0,0,0,0);i.x=n.x;i.y=n.y;i.width=n.width;i.height=n.height},l.sheetId=1,l}();t.Sheet=gt;ht=function(){function n(n){var i=1,r=2,u=8,f=16,t=this;t.rowHeader=(n&i)===i;t.columnHeader=(n&r)===r;t.unFormatted=(n&u)===u;t.formula=(n&f)===f;t.expandRows=!0;t.expandColumns=!0}return n.prototype.fixOptions=function(n){n&&(n.getColumnCount(2)<=0&&(this.rowHeader=!1),n.getRowCount(1)<=0&&(this.columnHeader=!1))},n}();var o=function(){function n(){}return n.saveTable=function(n,i,r,u,e,o,s,h){var v=[],a=n.getTables(),y,p,c,l;if(a)for(i<0&&(i=0,s=f(n.getRowCount(),u.getRowCount())),r<0&&(r=0,h=f(n.getColumnCount(),u.getColumnCount())),y=n._tableManager,p=new t.Range(i,r,s,h),c=a.length-1;c>=0;c--)l=a[c],p.containsRange(l.range())&&(y._tableList.splice(c,1),l._clearSheetModelFormula(),v.push(l));return v},n.restoreTableForCopyTo=function(n,i,u,f,e,o,s,h,c){var w,v,a,y,p,b;for(u<0&&(u=0),f<0&&(f=0),o<0&&(o=0),s<0&&(s=0),w=i._tableManager,v=0;v<n.length;v++)a=n[v],a._setOwner(w),w._tableList.push(a),a._syncSheetModelFormula();for(y=e._tableManager,p=0;p<n.length;p++){var a=n[p],d=JSON.stringify(a.toJSON()),k=a.bindingPath()?r:a.getSource(),l=new t.SheetTable;l._setOwner(y);l.fromJSON(JSON.parse(d));b=l.range();l.name(y.getNoConflictTableName(l.name()));l._moveToCore(o+b.row-u,s+b.col-f);y._tableList.push(l);l._syncSheetModelFormula();k&&l.copyDataSourceImp(k)}},n.restoreTableForMoveTo=function(n,t,i,r,u,f,e,o,s){var l,c,h,a;for(i<0&&(i=0),r<0&&(r=0),f<0&&(f=0),e<0&&(e=0),l=u._tableManager,c=0;c<n.length;c++)h=n[c],h._setOwner(l),a=h.range(),h._moveToCore(f+a.row-i,e+a.col-r),l._tableList.push(h),h._syncSheetModelFormula()},n.copyTo=function(r,u,f,e,o,s,h,c,l,a){var v=n,d=r._getCalcModel(),g=e._getCalcModel(),b,p,w,y;v.checkArguments(r,u,f,e,o,s,h,c);(l&64)>0&&v.copyStyle(r,u,f,e,o,s,h,c,a);(l&1)>0&&(l&2)>0&&(b=v.saveTable(r,u,f,e,o,s,h,c));r.suspendCalcService();e.suspendCalcService();p=i;(l&256)>0&&(p=v.copyBindingPath(r,u,f,e,o,s,h,c,a));try{if((l&1)>0&&(v.copyValue(r,u,f,e,o,s,h,c,a),(l&2)==0&&v.clearFormula(e,o,s,h,c,a),(l&256)>0)){var nt=p.length,k=o<0?0:o,tt=s<0?0:s;for(w=0;w<nt;w++)(y=p[w],a&&e.isRowFilterOut(k+y.row))||e.setValue(k+y.row,tt+y.col,y.value)}(l&1)>0&&(l&2)>0&&v.restoreTableForCopyTo(b,r,u,f,e,o,s,h,c);(l&2)>0&&t.Calc.CalcOperatorAdjustor.copyFormula(d,u,f,g,o,s,h,c,a)}finally{r.resumeCalcService(!1);e.resumeCalcService(!1)}(l&512)>0&&v.copyConditionalFormatRules(r,u,f,e,o,s,h,c);(l&4)>0&&v.copyComment(r,u,f,e,o,s,h,c,a);(l&128)>0&&v.copyTag(r,u,f,e,o,s,h,c);(l&16)>0&&v.copySparkline(r,u,f,e,o,s,h,c);(l&8)>0&&(u<0&&v.copyColumnRangeGroup(r,f,e,s,c),f<0&&v.copyRowRangeGroup(r,u,e,o,h));(l&32)>0&&(h===1&&c===1||v.copySpan(r,u,f,e,o,s,h,c));u<0&&v.copyColumnAxis(r,f,e,s,c,l);f<0&&v.copyRowAxis(r,u,e,o,h,l,a);u<0&&o<0&&f<0&&s<0&&v.copySheetInfo(r,e,l)},n.checkArguments=function(n,i,r,u,e,o,s,h){var c,v,a,y;if(!n)throw new Error(t.SR.Exp_SrcIsNull);if(!u)throw new Error(t.SR.Exp_DestIsNull);(i<-1||i>=n.getRowCount())&&l("from row index",i,"-1",n.getRowCount()-1);(r<-1||r>=n.getColumnCount())&&l("from column index",r,"-1",n.getColumnCount()-1);(e<-1||e>=u.getRowCount())&&l("to row index",e,"-1",u.getRowCount()-1);(o<-1||o>=u.getColumnCount())&&l("to column index",o,"-1",u.getColumnCount()-1);c=r;r<0&&(c=0,h=n.getColumnCount());v=o<0?0:o;(h<1||c+h>n.getColumnCount()||v+h>u.getColumnCount())&&l("column count",h,"1",f(n.getColumnCount()-c,u.getColumnCount()-v));a=i;i<0&&(a=0,s=n.getRowCount());y=e<0?0:e;(s<1||a+s>n.getRowCount()||y+s>u.getRowCount())&&l("row count",s,"1",f(n.getRowCount()-a,u.getRowCount()-y))},n.copyValue=function(r,e,o,s,h,c,l,a,v){var st=!(r===s&&r._name===s._name),b,k,y,p,w,ht,lt,yt;if(e<0){var d=1,g=o,ft=c;if(b=f(r.getRowCount(d),s.getRowCount(d)),k=a,o<0&&(g=0,k=r.getColumnCount()),c<0&&(ft=0),st)for(y=0;y<b;y++)for(p=0;p<k;p++)w=r._sheetModelManager.getDataModel(d).getValue(y,g+p),(typeof w===u||w===i)&&r.isColumnBound(g+p)&&(y===r.colHeaderAutoTextIndex||y===b-1&&r.colHeaderAutoTextIndex===-1)&&(w=r.getDataColumnName(g+p)),typeof w===u||w===i?s._setValueInternal(y,ft+p,i,d,!1):s._setValueInternal(y,ft+p,n.cloneObject(w),d,!1);else{for(ht=new t._GcSheetModel(b,k,i),y=0;y<b;y++)for(p=0;p<k;p++)w=r._sheetModelManager.getDataModel(d).getValue(y,g+p),(typeof w===u||w===i)&&r.isColumnBound(g+p)&&(y===r.colHeaderAutoTextIndex||y===b-1&&r.colHeaderAutoTextIndex===-1)&&(w=r.getDataColumnName(g+p)),typeof w!==u&&w!==i&&ht.setValue(y,p,n.cloneObject(w));for(y=0;y<b;y++)for(p=0;p<k;p++)s._setValueInternal(y,ft+p,ht.getValue(y,p),d,!1)}}if(o<0){var nt=2,ct=e,et=h;if(b=l,k=f(r.getColumnCount(nt),s.getColumnCount(nt)),e<0&&(ct=0,b=r.getRowCount()),h<0&&(et=0),st)for(y=0;y<b;y++)for(p=0;p<k;p++)w=r._sheetModelManager.getDataModel(nt).getValue(ct+y,p),typeof w===u||w===i?s._setValueInternal(et+y,p,i,nt,!1):s._setValueInternal(et+y,p,n.cloneObject(w),nt,!1);else{for(lt=new t._GcSheetModel(b,k,i),y=0;y<b;y++)for(p=0;p<k;p++)w=r._sheetModelManager.getDataModel(nt).getValue(ct+y,p),typeof w!==u&&w!==i&<.setValue(y,p,n.cloneObject(w));for(y=0;y<b;y++)for(p=0;p<k;p++)s._setValueInternal(et+y,p,lt.getValue(y,p),nt,!1)}}var it=3,at=e,vt=o,tt=h,ot=c,rt=l,ut=a;if(e<0&&(at=0,rt=f(r.getRowCount(),s.getRowCount())),o<0&&(vt=0,ut=f(r.getColumnCount(),s.getColumnCount())),h<0&&(tt=0),c<0&&(ot=0),st){for(y=0;y<rt;y++)if(!v||!s.isRowFilterOut(tt+y))for(p=0;p<ut;p++)w=r.getValue(at+y,vt+p,it),typeof w===u||w===i?s._setValueInternal(tt+y,ot+p,i,it,!1):s._setValueInternal(tt+y,ot+p,n.cloneObject(w),it,!1)}else{for(yt=new t._GcSheetModel(rt,ut,i),y=0;y<rt;y++)for(p=0;p<ut;p++)w=r.getValue(at+y,vt+p,it),typeof w!==u&&w!==i&&yt.setValue(y,p,n.cloneObject(w));for(y=0;y<rt;y++)if(!v||!s.isRowFilterOut(tt+y))for(p=0;p<ut;p++)s._setValueInternal(tt+y,ot+p,yt.getValue(y,p),it,!1)}},n._copyMoveBindingPath=function(n,r,u,e,o,s,h,c,l,a){var p=r,w=u,g=o,tt=s,k=h,d=c,nt,rt,it,b,v,y;if(r<0&&(p=0,k=f(n.getRowCount(),e.getRowCount())),u<0&&(w=0,d=f(n.getColumnCount(),e.getColumnCount())),o<0&&(g=0),s<0&&(tt=0),nt=[],rt=!(n===e&&n._name===e._name),rt)for(v=0;v<k;v++)for(y=0;y<d;y++)b=n.getBindingPath(p+v,w+y),e.setBindingPath(g+v,tt+y,b),b&&nt.push({row:v,col:y,value:n.getValue(p+v,w+y)}),l&&n.setBindingPath(p+v,w+y,i);else{for(it=new t._GcSheetModel(k,d,i),v=0;v<k;v++)for(y=0;y<d;y++)b=n.getBindingPath(p+v,w+y),it.setBindingPath(v,y,b),b&&nt.push({row:v,col:y,value:n.getValue(p+v,w+y)}),l&&n.setBindingPath(p+v,w+y,i);for(v=0;v<k;v++)if(!a||!e.isRowFilterOut(g+v))for(y=0;y<d;y++)e.setBindingPath(g+v,tt+y,it.getBindingPath(v,y))}return nt},n.copyBindingPath=function(t,i,r,u,f,e,o,s,h){return n._copyMoveBindingPath(t,i,r,u,f,e,o,s,!1,h)},n.cloneObject=function(t){var r,i;if(!t)return t;if(typeof t===h||typeof t===c||typeof t===y||typeof t===u)return t;else if(t instanceof Date)return new Date(t);else r=t instanceof Object?new t.constructor:new t.constructor(t.valueOf());for(i in t)t.hasOwnProperty(i)&&r[i]!==t[i]&&(r[i]=typeof this[i]=="object"?n.cloneObject(t[i]):t[i]);return r.toString=t.toString,r.valueOf=t.valueOf,r},n.clearFormula=function(n,t,r,u,f,e){var o,s;for(t<0&&(t=0,u=n.getRowCount()),r<0&&(r=0,f=n.getColumnCount()),o=0;o<u;o++)if(!e||!n.isRowFilterOut(o+t))for(s=0;s<f;s++)n.setFormula(o+t,s+r,i)},n.copyStyle=function(n,r,u,e,o,s,h,c,l){var ut=!(n===e&&n._name===e._name),p,w,a,v,y,tt,k,ft,it,d,et,ht;if(r<0)if(tt=u,k=s,p=f(n.getRowCount(1),e.getRowCount(1)),w=c,u<0&&(tt=0,w=n.getColumnCount()),s<0&&(k=0),ut)for(a=0;a<p;a++)for(v=0;v<w;v++)y=n.getCompositeStyle(a,tt+v,1),y?e.setStyleWithoutLocked(a,k+v,y.clone(),1):e.setStyleWithoutLocked(a,k+v,i,1);else{for(ft=new t._GcSheetModel(p,w,i),a=0;a<p;a++)for(v=0;v<w;v++)y=n.getCompositeStyle(a,tt+v,1),y&&ft.setValue(a,v,y.clone());for(a=0;a<p;a++)for(v=0;v<w;v++)e.setStyleWithoutLocked(a,k+v,ft.getValue(a,v),1)}if(u<0)if(it=r,d=o,p=h,w=f(n.getColumnCount(2),e.getColumnCount(2)),r<0&&(it=0,p=n.getRowCount()),o<0&&(d=0),ut)for(a=0;a<p;a++)for(v=0;v<w;v++)y=n.getCompositeStyle(it+a,v,2),y?e.setStyleWithoutLocked(d+a,v,y.clone(),2):e.setStyleWithoutLocked(d+a,v,i,2);else{for(et=new t._GcSheetModel(p,w,i),a=0;a<p;a++)for(v=0;v<w;v++)y=n.getCompositeStyle(it+a,v,2),y&&et.setValue(a,v,y.clone());for(a=0;a<p;a++)for(v=0;v<w;v++)e.setStyleWithoutLocked(d+a,v,et.getValue(a,v),2)}var ot=r,st=u,b=o,rt=s,g=h,nt=c;if(r<0&&(ot=0,g=f(n.getRowCount(),e.getRowCount())),u<0&&(st=0,nt=f(n.getColumnCount(),e.getColumnCount())),o<0&&(b=0),s<0&&(rt=0),ut){for(a=0;a<g;a++)if(!l||!e.isRowFilterOut(b+a))for(v=0;v<nt;v++)y=n.getCompositeStyle(ot+a,st+v,3),y?e.setStyleWithoutLocked(b+a,rt+v,y.clone(),3):e.setStyleWithoutLocked(b+a,rt+v,i,3)}else{for(ht=new t._GcSheetModel(g,nt,i),a=0;a<g;a++)for(v=0;v<nt;v++)y=n.getCompositeStyle(ot+a,st+v,3),y&&ht.setValue(a,v,y.clone());for(a=0;a<g;a++)if(!l||!e.isRowFilterOut(b+a))for(v=0;v<nt;v++)e.setStyleWithoutLocked(b+a,rt+v,ht.getValue(a,v),3)}},n.copyConditionalFormatRules=function(n,i,r,u,f,e,o,s){var it=[],g=n._conditionalFormats,c,l,nt,w,v,tt,b,a;if(g){for(c=0;c<o;c++)for(l=0;l<s;l++)for(nt=g.getRules(i+c,r+l),w=0;w<nt.length;w++){for(v=nt[w],tt=[],b=0;b<v.ranges.length;b++){var h=v.ranges[b],y=h.row,p=h.col,k=h.rowCount,d=h.colCount;if(y===-1&&(y=0,k=n.getRowCount()),p===-1&&(p=0,d=n.getColumnCount()),t.ArrayHelper.indexOf(it,h)>-1||!h.contains(i+c,r+l))continue;else it.push(h);a=new t.Range(-1,-1,-1,-1);a.row=f+c;a.col=e+l;a.rowCount=y+k>=o+i?o-c:i<y?k:y+k-i;a.colCount=p+d>=s+r?s-l:r<p?d:p+d-r;h.containsRange(a)||tt.push(a)}v.ranges=v.ranges.concat(tt)}g._resetCache()}},n.copyComment=function(n,t,i,r,u,e,o,s,h){var b=t,k=i,w=u,d=e,g=o,nt=s,y,a,v,l,p,tt,c;for(t<0&&(b=0,g=f(n.getRowCount(),r.getRowCount())),i<0&&(k=0,nt=f(n.getColumnCount(),r.getColumnCount())),u<0&&(w=0),e<0&&(d=0),y=[],a=0;a<g;a++)if(!h||!r.isRowFilterOut(w+a))for(v=0;v<nt;v++)c=n.getComment(b+a,k+v),c&&(l=c.clone(),l._sheet=r,l._rowIndex=w+a,l._colIndex=d+v,l._location=l._defaultLocation,y.push(l));for(p=0,tt=y.length;p<tt;p++)c=y[p],r.setComment(c._rowIndex,c._colIndex,c)},n.copyTag=function(r,e,o,s,h,c,l,a,v){var st=!(r===s&&r._name===s._name),b,k,y,p,w,vt,ht,yt,lt,ct,d,bt,kt;if(e<0){var g=1,ut=o,nt=c;if(b=f(r.getRowCount(g),s.getRowCount(g)),k=a,o<0&&(ut=0,k=r.getColumnCount()),c<0&&(nt=0),st){for(y=0;y<b;y++)for(p=0;p<k;p++)w=r.getTag(y,ut+p,g),typeof w===u||w===i?s.setTag(y,nt+p,i,g):s.setTag(y,nt+p,n.cloneObject(w),g);for(p=0;p<k;p++)w=r.getTag(-1,ut+p),typeof w===u||w===i?s.setTag(-1,nt+p,i):s.setTag(-1,nt+p,n.cloneObject(w))}else{for(vt=new t._GcSheetModel(b,k,i),y=0;y<b;y++)for(p=0;p<k;p++)w=r.getTag(y,ut+p,g),typeof w!==u&&w!==i&&vt.setTag(y,p,n.cloneObject(w));for(y=0;y<b;y++)for(p=0;p<k;p++)s.setTag(y,nt+p,vt.getTag(y,p),g);for(ht={},p=0;p<k;p++)w=r.getTag(-1,ut+p),typeof w!==u&&w!==i&&(ht[p]=n.cloneObject(w));for(ct in ht)d=parseInt(ct),isNaN(d)||s.setTag(-1,nt+d,ht[d])}}if(o<0){var tt=2,ft=e,it=h;if(b=l,k=f(r.getColumnCount(tt),s.getColumnCount(tt)),e<0&&(ft=0,b=r.getRowCount()),h<0&&(it=0),st){for(y=0;y<b;y++)for(p=0;p<k;p++)w=r.getTag(ft+y,p,tt),typeof w===u||w===i?s.setTag(it+y,p,i,tt):s.setTag(it+y,p,n.cloneObject(w),tt);for(y=0;y<b;y++)w=r.getTag(ft+y,-1),typeof w===u||w===i?s.setTag(it+y,-1,i):s.setTag(it+y,-1,n.cloneObject(w))}else{for(yt=new t._GcSheetModel(b,k,i),y=0;y<b;y++)for(p=0;p<k;p++)w=r.getTag(ft+y,p,tt),typeof w!==u&&w!==i&&yt.setTag(y,p,n.cloneObject(w));for(y=0;y<b;y++)for(p=0;p<k;p++)s.setTag(it+y,p,yt.getTag(y,p),tt);for(lt={},y=0;y<b;y++)w=r.getTag(ft+y,-1),typeof w!==u&&w!==i&&(lt[y]=n.cloneObject(w));for(ct in lt)d=parseInt(ct),isNaN(d)||s.setTag(it+d,-1,lt[d])}}var pt=e,wt=o,rt=h,at=c,et=l,ot=a;if(e<0&&(pt=0,et=f(r.getRowCount(),s.getRowCount())),o<0&&(wt=0,ot=f(r.getColumnCount(),s.getColumnCount())),h<0&&(rt=0),c<0&&(at=0),st){for(y=0;y<et;y++)if(!v||!s.isRowFilterOut(rt+y))for(p=0;p<ot;p++)w=r.getTag(pt+y,wt+p),typeof w===u||w===i?s.setTag(rt+y,at+p,i):s.setTag(rt+y,at+p,n.cloneObject(w))}else{for(bt=new t._GcSheetModel(et,ot,i),y=0;y<et;y++)for(p=0;p<ot;p++)w=r.getTag(pt+y,wt+p),typeof w!==u&&w!==i&&bt.setTag(y,p,n.cloneObject(w));for(y=0;y<et;y++)if(!v||!s.isRowFilterOut(rt+y))for(p=0;p<ot;p++)s.setTag(rt+y,at+p,bt.getTag(y,p))}if(e<0&&o<0){if(!st)return;kt=n.cloneObject(r.tag());s.tag(kt)}},n.copyColumnRangeGroup=function(t,i,r,u,e){var o=i,s=u,h=e,l,c;o<0&&(o=0,h=f(t.getColumnCount(),r.getColumnCount()));u<0&&(s=0);l=!(t===r&&t._name===r._name);l?t.colRangeGroup&&r.colRangeGroup&&n.crossSheetCopyRangeGroup(t.colRangeGroup,o,r.colRangeGroup,s,h):(c=t.colRangeGroup,c&&c._copy(o,s,h))},n.crossSheetCopyRangeGroup=function(n,i,r,u,f){var o,e,s,h;if(i<0&&(i=0),u<0&&(u=0),o=[],n)for(e=t.ArrayHelper.nextNonEmptyIndex(n.items,i-1);e>=0&&e<i+f;)o[e-i]=new t.RangeGroupItemInfo(n.items[e]),e=t.ArrayHelper.nextNonEmptyIndex(n.items,e);if(r&&(t.ArrayHelper.clear(r.items,u,f),o.length>0))for(s in o)o.hasOwnProperty(s)&&(h=o[s],r.items[u+s]=h)},n.copySparkline=function(n,t,i,r,u,e,o,s,h){var l=t,a=i,v=u,y=e,p=o,w=s,b,c;t<0&&(l=0,p=f(n.getRowCount(),r.getRowCount()));i<0&&(a=0,w=f(n.getColumnCount(),r.getColumnCount()));u<0&&(v=0);e<0&&(y=0);b=!(n===r&&n._name===r._name);b?(c=r._sparklineGroupManager,c&&c._exCopy(n,l,a,v,y,p,w,h)):(c=n._sparklineGroupManager,c&&c._copy(l,a,v,y,p,w,h))},n.copyRowRangeGroup=function(t,i,r,u,e){var o=i,s=u,h=e,l,c;i<0&&(o=0,h=f(t.getRowCount(),r.getRowCount()));u<0&&(s=0);l=!(t===r&&t._name===r._name);l?t.rowRangeGroup&&r.rowRangeGroup&&n.crossSheetCopyRangeGroup(t.rowRangeGroup,o,r.rowRangeGroup,s,h):(c=t.rowRangeGroup,c&&c._copy(o,s,h))},n.copySpan=function(t,i,r,u,e,o,s,h){var l=i,c=r,a=e,v=o,y=s,p=h,w,b,k,d;i<0&&(l=0,y=f(t.getRowCount(),u.getRowCount()));c<0&&(c=0,p=f(t.getColumnCount(),u.getColumnCount()));e<0&&(a=0);o<0&&(v=0);w=!(t===u&&t._name===u._name);i<0&&(w?n.crossSheetCopySpans(t._getSpanModel(1),-1,c,u._getSpanModel(1),-1,v,-1,p):(b=t._getSpanModel(1),b&&b.copy(-1,c,-1,v,-1,p)));r<0&&(w?n.crossSheetCopySpans(t._getSpanModel(2),l,-1,u._getSpanModel(2),a,-1,y,-1):(k=t._getSpanModel(2),k&&k.copy(l,-1,a,-1,y,-1)));w?n.crossSheetCopySpans(t._getSpanModel(),l,c,u._getSpanModel(),a,v,y,p):(d=t._getSpanModel(3),d&&d.copy(l,c,a,v,y,p))},n.crossSheetCopySpans=function(i,r,u,f,e,o,s,h){var v=n.getSpans(i),y=n.getSpans(f),w=[],l,a,c,p,b;if(r===-1){if(v&&v.length>0)for(l=0;l<v.length;l++)c=v[l],c.col>=u&&c.col+c.colCount<=u+h&&w.push(new t.Range(c.row,o+c.col-u,c.rowCount,c.colCount));if(y&&y.length>0)for(l=0;l<y.length;l++)if(c=y[l],c.col>=o&&c.col<o+h)for(a=0;a<f.length;a++)if(p=f[a],p.row===c.row&&p.col===c.col){f.splice(a,1);break}}else if(u===-1){if(v&&v.length>0)for(l=0;l<v.length;l++)c=v[l],r<=c.row&&c.row+c.rowCount<=r+s&&w.push(new t.Range(e+c.row-r,c.col,c.rowCount,c.colCount));if(y&&y.length>0)for(l=0;l<y.length;l++)if(c=y[l],c.row>=e&&c.row<e+s)for(a=0;a<f.length;a++)if(p=f[a],p.row===c.row&&p.col===c.col){f.splice(a,1);break}}else{if(v&&v.length>0)for(l=0;l<v.length;l++)c=v[l],r<=c.row&&c.row<r+s&&u<=c.col&&c.col<u+h&&w.push(new t.Range(e+c.row-r,o+c.col-u,c.rowCount,c.colCount));if(y&&y.length>0)for(l=0;l<y.length;l++)if(c=y[l],c.row>=e&&c.row<e+s&&c.col>=o&&c.col<o+h)for(a=0;a<f.length;a++)if(p=f[a],p.row===c.row&&p.col===c.col){f.splice(a,1);break}}if(w.length>0&&f)for(l=0;l<w.length;l++)b=w[l],f.push(b)},n.getSpans=function(n){return n&&n.length>0?n.slice(0):i},n.copyColumnAxis=function(n,t,u,e,o,s){var v=t,l=e,k=o,c,h,p,w,a,d,y,b;for(t<0&&(v=0,k=f(n.getColumnCount(),u.getColumnCount())),e<0&&(l=0),c=1,h=0;h<k;h++)p=n._getActualColumnWidth(h+v),p!==r&&p!==i&&u.setColumnWidth(h+l,p),w=n.getColumnVisible(h+v),w!==r&&w!==i&&u.setColumnVisible(h+l,w),(s&64)>0&&(a=n.getActualStyle(-1,h+v),a?u.setStyleWithoutLocked(-1,h+l,a.clone()):u.setStyleWithoutLocked(-1,h+l,i),a=n.getActualStyle(-1,h+v,c),a?u.setStyleWithoutLocked(-1,h+l,a.clone(),c):u.setStyleWithoutLocked(-1,h+l,i,c));for(d=f(n.getRowCount(c),u.getRowCount(c)),y=0;y<d;y++)b=n._getActualRowHeight(y,c),b!==r&&b!==i&&u.setRowHeight(y,b,c)},n.cloneAxisInfo=function(n,t,r){for(var u,s,f,e=[],o=0;o<r;o++)if(u=n[t+o],u){s={};for(f in u)u.hasOwnProperty(f)&&(s[f]=u[f]);e.push(s)}else e.push(i);return e},n.getAxisInfo=function(n,t,i){for(var u=[],r=0;r<i;r++)u.push(n[t+r]);return u},n.setAxisInfo=function(n,t,i){if(t)for(var r=0;r<n.length;r++)t[i+r]=n[r]},n.copyRowAxis=function(n,t,u,e,o,s,h){var y=t,l=e,d=o,a,c,w,b,v,g,p,k;for(t<0&&(y=0,d=f(n.getRowCount(),u.getRowCount())),e<0&&(l=0),a=2,c=0;c<d;c++)h&&u.isRowFilterOut(c+l)||(w=n._getActualRowHeight(c+y),w!==r&&w!==i&&u.setRowHeight(c+l,w),b=n.getRowVisible(c+y),b!==r&&b!==i&&u.setRowVisible(c+l,b),(s&64)>0&&(v=n.getActualStyle(c+y,-1),v?u.setStyleWithoutLocked(c+l,-1,v.clone()):u.setStyleWithoutLocked(c+l,-1,i),v=n.getActualStyle(c+y,-1,a),v?u.setStyleWithoutLocked(c+l,-1,v.clone(),a):u.setStyleWithoutLocked(c+l,-1,i,a)));for(g=f(n.getColumnCount(a),u.getColumnCount(a)),p=0;p<g;p++)k=n._getActualColumnWidth(p,a),k!==r&&k!==i&&u.setColumnWidth(p,k,a)},n.copySheetInfo=function(n,t,i){if(!(n===t&&n._name===t._name)){if((i&64)>0){var r=1,u=2;t.setDefaultStyle(n.getDefaultStyle().clone());t.setDefaultStyle(n.getDefaultStyle(r).clone(),r);t.setDefaultStyle(n.getDefaultStyle(u).clone(),u)}t.defaults.colWidth=n.defaults.colWidth;t.defaults.rowHeight=n.defaults.rowHeight;t.defaults.rowHeaderColWidth=n.defaults.rowHeaderColWidth}},n.moveTo=function(r,u,e,o,s,h,c,l,a){var v=n,rt=t.util.hasCalc()&&t.Calc.CalcOperatorAdjustor,g,p,w,b,k,d,y;v.checkArguments(r,u,e,o,s,h,c,l);(a&64)>0&&v.moveStyle(r,u,e,o,s,h,c,l);(a&1)>0&&(a&2)>0&&(g=v.saveTable(r,u,e,o,s,h,c,l));r.suspendCalcService();o.suspendCalcService();p=i;(a&256)>0&&(p=v.moveBindingPath(r,u,e,o,s,h,c,l));try{if((a&1)>0&&(v.moveValue(r,u,e,o,s,h,c,l),(a&2)==0&&v.clearFormula(o,s,h,c,l),(a&256)>0)){var nt=p.length,tt=s<0?0:s,it=h<0?0:h;for(w=0;w<nt;w++)b=p[w],o.setValue(tt+b.row,it+b.col,b.value)}v.adjustCustomNameOnMove(r,u,e,o,s,h,c,l);(a&2)>0&&v.moveFormula(r,u,e,o,s,h,c,l)}finally{(a&1)>0&&(a&2)>0&&v.restoreTableForMoveTo(g,r,u,e,o,s,h,c,l);r.resumeCalcService(!1);o.resumeCalcService(!1)}if((a&512)>0&&v.moveConditionalFormatRules(r,u,e,o,s,h,c,l),(a&4)>0&&v.moveComment(r,u,e,o,s,h,c,l),(a&128)>0&&v.moveTag(r,u,e,o,s,h,c,l),(a&16)>0&&v.moveSparkline(r,u,e,o,s,h,c,l),(a&8)>0&&(u<0&&v.moveColumnRangeGroup(r,e,o,h,l),e<0&&v.moveRowRangeGroup(r,u,o,s,c)),(a&32)>0&&v.moveSpan(r,u,e,o,s,h,c,l),u<0&&v.moveColumnAxis(r,e,o,h,l,a),e<0&&v.moveRowAxis(r,u,o,s,c,a),u<0&&s<0&&e<0&&h<0&&v.moveSheetInfo(r,o,a),u<0)for(k=e,d=l,e<0&&(k=0,d=f(r.getColumnCount(),o.getColumnCount())),y=0;y<d;y++)r.isColumnBound(k+y)&&r._sheetModelManager.getColInfos().reset(k+y)},n.moveFormula=function(n,u,e,o,s,h,c,l){var w=n._getCalcModel(),b=o._getCalcModel(),et,ut,a,v,ot,st,rt,ft,tt;if(w&&b){var it=w.getCalcService().getOperatorAdjustor(),k=u,d=e,y=s,p=h,g=c,nt=l;for(u<0&&(k=0,g=f(n.getRowCount(),o.getRowCount())),e<0&&(d=0,nt=f(n.getColumnCount(),o.getColumnCount())),s<0&&(y=0),h<0&&(p=0),et=!(n===o&&n._name===o._name),w.unlinkCellExpression(k,d,g,nt),it._addDependentsToAdjust(w,k,d,g,nt),b.unlinkCellExpression(y,p,g,nt),it._addDependentsToAdjust(b,y,p,g,nt),ut=[],a=0;a<g;a++)for(v=0;v<nt;v++){var ft=w._getExpr(a+k,v+d),tt=w.getArrayInfo(a+k,v+d),ht=w._getWorkingExpr(a+k,v+d);ft?(ut.push({expr:ft,arrayInfo:tt,workingExpr:ht}),w._clearAllExpr(a+k,v+d)):ut.push(i)}for(ot=o.getCalcService(),a=0;a<g;a++)for(v=0;v<nt;v++)rt=ut.shift(),rt?(ft=rt.expr,tt=rt.arrayInfo,ot&&tt&&tt.row===k+a&&tt.col===d+v&&(st=new t.Range(a+y,v+p,tt.rowCount,tt.colCount)),tt&&(tt.row=a+y,tt.col=v+p),b._setExpr(a+y,v+p,ft),b._setArrayInfo(a+y,v+p,tt?st:r),b._setWorkingExpr(a+y,v+p,rt.workingExpr)):(b._setExpr(a+y,v+p,r),b._setArrayInfo(a+y,v+p,r));it._addCellsToAdjust(w,k,d,g,nt);it._addCellsToAdjust(b,y,p,g,nt);it.adjustFormulasOnMoveSwap(w.getSource(),k,d,b.getSource(),y,p,g,nt,!0);et===!0&&it.adjustFormulasOnMoveSwap(w.getSource(),k,d,b.getSource(),y,p,g,nt,!0)}},n.moveValue=function(n,r,e,o,s,h,c,l){var ht=!(n===o&&n._name===o._name),p,w,a,v,y,ct,b,g,it,lt,at;if(r<0){var k=1,d=e,et=h;if(p=f(n.getRowCount(k),o.getRowCount(k)),w=l,e<0&&(d=0,w=n.getColumnCount()),h<0&&(et=0),ht)for(a=0;a<p;a++)for(v=0;v<w;v++)y=n._sheetModelManager.getDataModel(k).getValue(a,d+v),(typeof y===u||y===i)&&n.isColumnBound(d+v)&&(a===n.colHeaderAutoTextIndex||a===p-1&&n.colHeaderAutoTextIndex===-1)&&(y=n.getDataColumnName(d+v)),typeof y===u||y===i?o._setValueInternal(a,et+v,i,k,!1):(o._setValueInternal(a,et+v,y,k,!1),n._setValueInternal(a,d+v,i,k,!1));else{for(ct=new t._GcSheetModel(p,w,i),a=0;a<p;a++)for(v=0;v<w;v++)y=n._sheetModelManager.getDataModel(k).getValue(a,d+v),(typeof y===u||y===i)&&n.isColumnBound(d+v)&&(a===n.colHeaderAutoTextIndex||a===p-1&&n.colHeaderAutoTextIndex===-1)&&(y=n.getDataColumnName(d+v)),typeof y!==u&&y!==i&&ct.setValue(a,v,y),n._setValueInternal(a,d+v,i,k,!1);for(a=0;a<p;a++)for(v=0;v<w;v++)o._setValueInternal(a,et+v,ct.getValue(a,v),k,!1)}}if(b=2,e<0)if(g=r,it=s,p=c,w=f(n.getColumnCount(b),o.getColumnCount(b)),r<0&&(g=0,p=n.getRowCount()),s<0&&(it=0),ht)for(a=0;a<p;a++)for(v=0;v<w;v++)y=n.getValue(g+a,v,b),typeof y===u||y===i?o._setValueInternal(it+a,v,i,b,!1):(o._setValueInternal(it+a,v,y,b,!1),n._setValueInternal(g+a,v,i,b,!1));else{for(lt=new t._GcSheetModel(p,w,i),a=0;a<p;a++)for(v=0;v<w;v++)y=n._getModel(b).getValue(g+a,v),typeof y!==u&&y!==i&<.setValue(a,v,y),n._setValueInternal(g+a,v,i,b,!1);for(a=0;a<p;a++)for(v=0;v<w;v++)o._setValueInternal(it+a,v,lt.getValue(a,v),b,!1)}var rt=3,ut=r,ft=e,ot=s,st=h,nt=c,tt=l;if(r<0&&(ut=0,nt=f(n.getRowCount(),o.getRowCount())),e<0&&(ft=0,tt=f(n.getColumnCount(),o.getColumnCount())),s<0&&(ot=0),h<0&&(st=0),ht)for(a=0;a<nt;a++)for(v=0;v<tt;v++)y=n.getValue(ut+a,ft+v),typeof y===u||y===i?o._setValueInternal(ot+a,st+v,i,rt,!1):(o._setValueInternal(ot+a,st+v,y,rt,!1),n._setValueInternal(ut+a,ft+v,i,rt,!1));else{for(at=new t._GcSheetModel(nt,tt,i),a=0;a<nt;a++)for(v=0;v<tt;v++)y=n.getValue(ut+a,ft+v),typeof y!==u&&y!==i&&at.setValue(a,v,y);for(a=0;a<nt;a++)for(v=0;v<tt;v++)n._setValueInternal(ut+a,ft+v,i,rt,!1);for(a=0;a<nt;a++)for(v=0;v<tt;v++)o._setValueInternal(ot+a,st+v,at.getValue(a,v),rt,!1)}},n.adjustCustomNameOnMove=function(t,i,r,u,f,e,o,s){var w=n,c,p,v,l,a,y,h;if(!t.parent||!t.parent.sheets){if(c=t.getCustomNames(),c&&c.length>0)for(h=0;h<c.length;h++)l=c[h].getExpression(),a=w.adjustCustomNameExpOnMove(t,t,i,r,u,f,e,o,s,l),a!==l&&c[h].setExpression(a);return}if(p=t.parent.sheets,v=t.parent.getCustomNames(),v&&v.length>0)for(h=0;h<v.length;h++)l=v[h].getExpression(),a=w.adjustCustomNameExpOnMove(null,t,i,r,u,f,e,o,s,l),a!==l&&v[h].setExpression(a);for(y=0;y<p.length;y++)if(c=p[y].getCustomNames(),c&&c.length>0)for(h=0;h<c.length;h++)l=c[h].getExpression(),a=w.adjustCustomNameExpOnMove(p[y],t,i,r,u,f,e,o,s,l),a!==l&&c[h].setExpression(a)},n.adjustCustomNameExpOnMove=function(i,r,u,f,e,o,s,h,c,l){var g=n,w=o-u,b=s-f,ot=r._getSheetSource(),nt=e._getSheetSource(),tt,et,y,p;if(l.t===10){var it=l,st=it.left,ht=it.right,ct=g.adjustCustomNameExpOnMove(i,r,u,f,e,o,s,h,c,st),lt=g.adjustCustomNameExpOnMove(i,r,u,f,e,o,s,h,c,ht);if(st!==ct||ht!==lt)return new t.Calc.Expressions.BinaryOperatorExpression(it.operator,ct,lt)}else if(l.t===11){var at=l,vt=at.operand,yt=g.adjustCustomNameExpOnMove(i,r,u,f,e,o,s,h,c,vt);if(vt!==yt)return new t.Calc.Expressions.UnaryOperatorExpression(at.operator,yt)}else if(l.t===7){var rt=l,ut=!1,pt=[],ft;for(tt=0;tt<rt.args.length;tt++)ft=rt.args[tt],et=g.adjustCustomNameExpOnMove(i,r,u,f,e,o,s,h,c,ft),ut=ut||ft!==et,pt.push(et);if(ut)return new t.Calc.Expressions.FunctionExpression(rt.fn,pt)}else if(l.t===1){if(y=l,y.source===ot&&!y.rowRelative&&y.row>=u&&y.row<u+h&&!y.columnRelative&&y.column>=f&&y.column<f+c)return new t.Calc.Expressions.ExternalCellExpression(nt,y.row+w,y.column+b)}else if(l.t!==22)if(l.t===0){if(p=l,i===r&&!p.rowRelative&&p.row>=u&&p.row<u+h&&!p.columnRelative&&p.column>=f&&p.column<f+c)return new t.Calc.Expressions.ExternalCellExpression(nt,p.row+w,p.column+b)}else if(l.t===3){var a=l,k=!a.startRowRelative&&!a.startColumnRelative,d=!a.endRowRelative&&!a.endColumnRelative;if(a.source===ot&&(k&&a.startRow>=u&&a.startColumn>=f||d&&a.endColumn<f+c&&a.endRow<u+h))return new t.Calc.Expressions.ExternalRangeExpression(nt,a.startRow+(k?w:0),a.startColumn+(k?b:0),a.endRow+(d?w:0),a.endColumn+(d?b:0),a.startRowRelative,a.startColumnRelative,a.endRowRelative,a.endColumnRelative)}else if(l.t!==23)if(l.t===2){var v=l,k=!v.startRowRelative&&!v.startColumnRelative,d=!v.endRowRelative&&!v.endColumnRelative;if(i===r&&(k&&v.startRow>=u&&v.startColumn>=f||d&&v.endColumn<f+c&&v.endRow<u+h))return new t.Calc.Expressions.ExternalRangeExpression(nt,v.startRow+(k?w:0),v.startColumn+(k?b:0),v.endRow+(d?w:0),v.endColumn+(d?b:0),v.startRowRelative,v.startColumnRelative,v.endRowRelative,v.endColumnRelative)}else if(l.t===14){var kt=l,wt=kt.argument,bt=g.adjustCustomNameExpOnMove(i,r,u,f,e,o,s,h,c,wt);if(wt!==bt)return new t.Calc.Expressions.ParenthesesExpression(bt)}return l},n.adjustCustomNameOnInsertRemove=function(t,i,r,u,f){var v=n,o,a,c,s,h,l,e;if(!t.parent||!t.parent.sheets){if(o=t.getCustomNames(),o&&o.length>0)for(e=0;e<o.length;e++)s=o[e].getExpression(),h=v.adjustCustomNameExpOnInsertRemove(t,t,i,r,u,f,s),h!==s&&o[e].setExpression(h);return}if(a=t.parent.sheets,c=t.parent.getCustomNames(),c&&c.length>0)for(e=0;e<c.length;e++)s=c[e].getExpression(),h=v.adjustCustomNameExpOnInsertRemove(null,t,i,r,u,f,s),h!==s&&c[e].setExpression(h);for(l=0;l<a.length;l++)if(o=a[l].getCustomNames(),o&&o.length>0)for(e=0;e<o.length;e++)s=o[e].getExpression(),h=v.adjustCustomNameExpOnInsertRemove(a[l],t,i,r,u,f,s),h!==s&&o[e].setExpression(h)},n.adjustCustomNameExpOnInsertRemove=function(i,r,u,f,e,o,s){var b=n,p=r._getSheetSource(),w=new t.Calc.Expressions.ExternalErrorExpression(p,t.Calc.Errors.Reference),d,rt,c,k;if(s.t===10){var g=s,ut=g.left,ft=g.right,et=b.adjustCustomNameExpOnInsertRemove(i,r,u,f,e,o,ut),ot=b.adjustCustomNameExpOnInsertRemove(i,r,u,f,e,o,ft);if(ut!==et||ft!==ot)return new t.Calc.Expressions.BinaryOperatorExpression(g.operator,et,ot)}else if(s.t===11){var st=s,ht=st.operand,ct=b.adjustCustomNameExpOnInsertRemove(i,r,u,f,e,o,ht);if(ht!==ct)return new t.Calc.Expressions.UnaryOperatorExpression(st.operator,ct)}else if(s.t===7){var nt=s,tt=!1,lt=[],it;for(d=0;d<nt.args.length;d++)it=nt.args[d],rt=b.adjustCustomNameExpOnInsertRemove(i,r,u,f,e,o,it),tt=tt||it!==rt,lt.push(rt);if(tt)return new t.Calc.Expressions.FunctionExpression(nt.fn,lt)}else if(s.t!==22)if(s.t===1||s.t===0){if(c=s,k=s.source||i&&i._getSheetSource(),k&&k===p&&(o&&!c.rowRelative||!o&&!c.columnRelative))if(o&&e){if(c.row>=u)return new t.Calc.Expressions.ExternalCellExpression(p,c.row+f,c.column,c.rowRelative,c.columnRelative)}else if(!o&&e){if(c.column>=u)return new t.Calc.Expressions.ExternalCellExpression(p,c.row,c.column+f,c.rowRelative,c.columnRelative)}else if(o&&!e){if(c.row>=u+f)return new t.Calc.Expressions.ExternalCellExpression(p,c.row-f,c.column,c.rowRelative,c.columnRelative);else if(c.row>=u)return w}else if(c.column>=u+f)return new t.Calc.Expressions.ExternalCellExpression(p,c.row,c.column-f,c.rowRelative,c.columnRelative);else if(c.column>=u)return w}else if(s.t!==23)if(s.t===3||s.t===2){var h=s,k=s.source||i&&i._getSheetSource(),l=h.startRow,a=h.startColumn,v=h.endRow,y=h.endColumn;if(k&&k===p)if(o&&e){if(!h.startRowRelative&&l>=u&&(l+=f),!h.endRowRelative&&v>=u&&(v+=f),l!==h.startRow||v!==h.endRow)return new t.Calc.Expressions.ExternalRangeExpression(p,l,a,v,y,h.startRowRelative,h.startColumnRelative,h.endRowRelative,h.endColumnRelative)}else if(!o&&e){if(!h.startColumnRelative&&a>=u&&(a+=f),!h.endColumnRelative&&y>=u&&(y+=f),a!==h.startColumn||y!==h.endColumn)return new t.Calc.Expressions.ExternalRangeExpression(p,l,a,v,y,h.startRowRelative,h.startColumnRelative,h.endRowRelative,h.endColumnRelative)}else if(o&&!e){if(!h.startRowRelative&&l>=u&&!h.endRowRelative&&v<u+f)return w;else if(h.startRowRelative&&h.endRowRelative||v<u)return s;if(!h.startRowRelative)if(l>=u+f)l-=f;else if(!(l<u))if(h.endRowRelative)return w;else l>u&&(l=u);if(!h.endRowRelative)if(v>=u+f)v-=f;else if(h.startRowRelative)return w;else v<u+f&&(v=u-1);if(l!==h.startRow||v!==h.endRow)return new t.Calc.Expressions.ExternalRangeExpression(p,l,a,v,y,h.startRowRelative,h.startColumnRelative,h.endRowRelative,h.endColumnRelative)}else{if(!h.startColumnRelative&&a>=u&&!h.endColumnRelative&&y<u+f)return w;else if(h.startColumnRelative&&h.endColumnRelative||y<u)return s;if(!h.startColumnRelative)if(a>=u+f)a-=f;else if(!(a<u))if(h.endColumnRelative)return w;else a>u&&(a=u);if(!h.endColumnRelative)if(y>=u+f)y-=f;else if(h.startColumnRelative)return w;else y<u+f&&(y=u-1);if(a!==h.startColumn||y!==h.endColumn)return new t.Calc.Expressions.ExternalRangeExpression(p,l,a,v,y,h.startRowRelative,h.startColumnRelative,h.endRowRelative,h.endColumnRelative)}}else if(s.t===14){var yt=s,at=yt.argument,vt=b.adjustCustomNameExpOnInsertRemove(i,r,u,f,e,o,at);if(at!==vt)return new t.Calc.Expressions.ParenthesesExpression(vt)}return s},n.moveStyle=function(n,r,u,e,o,s,h,c){var ot=!(n===e&&n._name===e._name),b=1,y,p,l,a,v,k,g,st,w,d,nt,ht,ct;if(r<0)if(k=u,g=s,y=f(n.getRowCount(b),e.getRowCount(b)),p=c,u<0&&(k=0,p=n.getColumnCount()),s<0&&(g=0),ot)for(l=0;l<y;l++)for(a=0;a<p;a++)v=n.getCompositeStyle(l,k+a,b),v?(e.setStyleWithoutLocked(l,g+a,v.clone(),b),n.setStyleWithoutLocked(l,k+a,i,b)):e.setStyleWithoutLocked(l,g+a,i,b);else{for(st=new t._GcSheetModel(y,p,i),l=0;l<y;l++)for(a=0;a<p;a++)v=n.getCompositeStyle(l,k+a,b),v&&st.setValue(l,a,v.clone()),n.setStyleWithoutLocked(l,k+a,i,b);for(l=0;l<y;l++)for(a=0;a<p;a++)e.setStyleWithoutLocked(l,g+a,st.getValue(l,a),b)}if(w=2,u<0)if(d=r,nt=o,y=h,p=f(n.getColumnCount(w),e.getColumnCount(w)),r<0&&(d=0,y=n.getRowCount()),o<0&&(nt=0),ot)for(l=0;l<y;l++)for(a=0;a<p;a++)v=n.getCompositeStyle(d+l,a,w),v?(e.setStyleWithoutLocked(nt+l,a,v.clone(),w),n.setStyleWithoutLocked(d+l,a,i,w)):e.setStyleWithoutLocked(nt+l,a,i,w);else{for(ht=new t._GcSheetModel(y,p,i),l=0;l<y;l++)for(a=0;a<p;a++)v=n.getCompositeStyle(d+l,a,w),v&&ht.setValue(l,a,v.clone()),n.setStyleWithoutLocked(d+l,a,i,w);for(l=0;l<y;l++)for(a=0;a<p;a++)e.setStyleWithoutLocked(nt+l,a,ht.getValue(l,a),w)}var tt=r,it=u,ft=o,et=s,rt=h,ut=c;if(r<0&&(tt=0,rt=f(n.getRowCount(),e.getRowCount())),u<0&&(it=0,ut=f(n.getColumnCount(),e.getColumnCount())),o<0&&(ft=0),s<0&&(et=0),ot)for(l=0;l<rt;l++)for(a=0;a<ut;a++)v=n.getCompositeStyle(tt+l,it+a),v?(e.setStyleWithoutLocked(ft+l,et+a,v.clone()),n.setStyleWithoutLocked(tt+l,it+a,i)):e.setStyleWithoutLocked(ft+l,et+a,i);else{for(ct=new t._GcSheetModel(rt,ut,i),l=0;l<rt;l++)for(a=0;a<ut;a++)v=n.getCompositeStyle(tt+l,it+a),v&&ct.setValue(l,a,v.clone()),n.setStyleWithoutLocked(tt+l,it+a,i);for(l=0;l<rt;l++)for(a=0;a<ut;a++)e.setStyleWithoutLocked(ft+l,et+a,ct.getValue(l,a))}},n.moveTag=function(n,r,e,o,s,h,c,l){var ot=!(n===o&&n._name===o._name),p,w,a,v,y,vt,st,yt,ct,ht,nt,pt,wt;if(r<0){var b=1,k=e,tt=h;if(p=f(n.getRowCount(b),o.getRowCount(b)),w=l,e<0&&(k=0,w=n.getColumnCount()),h<0&&(tt=0),ot){for(a=0;a<p;a++)for(v=0;v<w;v++)y=n.getTag(a,k+v,b),typeof y===u||y===i?o.setTag(a,tt+v,i,b):(o.setTag(a,tt+v,y,b),n.setTag(a,k+v,i,b));for(v=0;v<w;v++)y=n.getTag(-1,k+v),typeof y===u||y===i?o.setTag(-1,tt+v,i):(o.setTag(-1,tt+v,y),n.setTag(-1,k+v,i))}else{for(vt=new t._GcSheetModel(p,w,i),a=0;a<p;a++)for(v=0;v<w;v++)y=n.getTag(a,k+v,b),typeof y!==u&&y!==i&&vt.setTag(a,v,y),n.setTag(a,k+v,i,b);for(a=0;a<p;a++)for(v=0;v<w;v++)o.setTag(a,tt+v,vt.getTag(a,v),b);for(st={},v=0;v<w;v++)y=n.getTag(-1,k+v),typeof y!==u&&y!==i&&(st[v]=y),n.setTag(-1,k+v,i);for(ht in st)nt=parseInt(ht),isNaN(nt)||o.setTag(-1,tt+nt,st[nt])}}if(e<0){var d=2,g=r,it=s;if(p=c,w=f(n.getColumnCount(d),o.getColumnCount(d)),r<0&&(g=0,p=n.getRowCount()),s<0&&(it=0),ot){for(a=0;a<p;a++)for(v=0;v<w;v++)y=n.getTag(g+a,v,d),typeof y===u||y===i?o.setTag(it+a,v,i,d):(o.setTag(it+a,v,y,d),n.setTag(g+a,v,i,d));for(a=0;a<p;a++)y=n.getTag(g+a,-1),typeof y===u||y===i?o.setTag(it+a,-1,i):(o.setTag(it+a,-1,y),n.setTag(g+a,-1,i))}else{for(yt=new t._GcSheetModel(p,w,i),a=0;a<p;a++)for(v=0;v<w;v++)y=n.getTag(g+a,v,d),typeof y!==u&&y!==i&&yt.setTag(a,v,y),n.setTag(g+a,v,i,d);for(a=0;a<p;a++)for(v=0;v<w;v++)o.setTag(it+a,v,yt.getTag(a,v),d);for(ct={},a=0;a<p;a++)y=n.getTag(g+a,-1),typeof y!==u&&y!==i&&(ct[a]=y),n.setTag(g+a,-1,i);for(ht in ct)nt=parseInt(ht),isNaN(nt)||o.setTag(it+nt,-1,ct[nt])}}var rt=r,ut=e,lt=s,at=h,ft=c,et=l;if(r<0&&(rt=0,ft=f(n.getRowCount(),o.getRowCount())),e<0&&(ut=0,et=f(n.getColumnCount(),o.getColumnCount())),s<0&&(lt=0),h<0&&(at=0),ot)for(a=0;a<ft;a++)for(v=0;v<et;v++)y=n.getTag(rt+a,ut+v),typeof y===u||y===i?o.setTag(lt+a,at+v,i):(o.setTag(lt+a,at+v,y),n.setTag(rt+a,ut+v,i));else{for(pt=new t._GcSheetModel(ft,et,i),a=0;a<ft;a++)for(v=0;v<et;v++)y=n.getTag(rt+a,ut+v),typeof y!==u&&y!==i&&pt.setTag(a,v,y),n.setTag(rt+a,ut+v,i);for(a=0;a<ft;a++)for(v=0;v<et;v++)o.setTag(lt+a,at+v,pt.getTag(a,v))}if(r<0&&e<0){if(!ot)return;wt=n.tag();n.tag(i);o.tag(wt)}},n.moveConditionalFormatRules=function(n,t,i,r,u,f,e,o){this.copyConditionalFormatRules(n,t,i,r,u,f,e,o);this._deleteConditionalFormatRange(n,t,i,r,u,f,e,o)},n._deleteConditionalFormatRange=function(n,i,r,u,o,s,h,c){var rt=[],ot=n._conditionalFormats,g,nt,st,ut,w,b,ft,k,y,p,d,et;if(ot){for(g=0;g<h;g++)for(nt=0;nt<c;nt++)for(st=ot.getRules(i+g,r+nt),ut=0;ut<st.length;ut++){for(w=st[ut],b=[],ft=0;ft<w.ranges.length;ft++){var v=w.ranges[ft],l=v.row,a=v.col,tt=v.rowCount,it=v.colCount;if(l===-1&&(l=0,tt=n.getRowCount()),a===-1&&(a=0,it=n.getColumnCount()),t.ArrayHelper.indexOf(rt,v)>-1||!v.contains(i+g,r+nt))continue;else rt.push(v);i>l&&(k=new t.Range(-1,-1,-1,-1),k.row=l,k.col=a,k.rowCount=i-l,k.colCount=it,b.push(k));r>a&&(y=new t.Range(-1,-1,-1,-1),y.row=e(i,l),y.col=a,y.rowCount=f(i+h,l+tt)-y.row,y.colCount=r-a,b.push(y));r+c<a+it&&(p=new t.Range(-1,-1,-1,-1),p.row=e(i,l),p.col=r+c,p.rowCount=f(i+h,l+tt)-p.row,p.colCount=a+it-(r+c),b.push(p));i+h<l+tt&&(d=new t.Range(-1,-1,-1,-1),d.row=i+h,d.col=a,d.rowCount=l+tt-(i+h),d.colCount=it,b.push(d))}for(et=0;et<rt.length;et++)t.ArrayHelper.remove(w.ranges,rt[et]);w.ranges=w.ranges.concat(b)}ot._resetCache()}},n.moveComment=function(n,t,r,u,e,o,s,h){var w=t,b=r,k=e,d=o,g=s,nt=h,y,l,a,v,p,tt,c;for(t<0&&(w=0,g=f(n.getRowCount(),u.getRowCount())),r<0&&(b=0,nt=f(n.getColumnCount(),u.getColumnCount())),e<0&&(k=0),o<0&&(d=0),y=[],l=0;l<g;l++)for(a=0;a<nt;a++)c=n.getComment(w+l,b+a),c&&(v=c.clone(),v._sheet=u,v._rowIndex=k+l,v._colIndex=d+a,y.push(v),n.setComment(w+l,b+a,i));for(p=0,tt=y.length;p<tt;p++)c=y[p],u.setComment(c._rowIndex,c._colIndex,c)},n.moveSparkline=function(n,t,i,r,u,e,o,s){var c=t,l=i,a=u,v=e,y=o,p=s,w,h;t<0&&(c=0,y=f(n.getRowCount(),r.getRowCount()));i<0&&(l=0,p=f(n.getColumnCount(),r.getColumnCount()));u<0&&(a=0);e<0&&(v=0);w=!(n===r&&n._name===r._name);w?(h=r._sparklineGroupManager,h&&h._exMove(n,c,l,a,v,y,p)):(h=n._sparklineGroupManager,h&&h._move(c,l,a,v,y,p))},n.moveColumnRangeGroup=function(i,r,u,e,o){var s=r,c=e,h=o,a,l;s<0&&(s=0,h=f(i.getColumnCount(),u.getColumnCount()));e<0&&(c=0);a=!(i===u&&i._name===u._name);a?i.colRangeGroup&&u.colRangeGroup&&(n.crossSheetCopyRangeGroup(i.colRangeGroup,s,u.colRangeGroup,c,h),t.ArrayHelper.clear(i.colRangeGroup.items,s,h)):(l=i.colRangeGroup,l&&l._move(s,c,h))},n.moveRowRangeGroup=function(i,r,u,e,o){var s=r,c=e,h=o,a,l;r<0&&(s=0,h=f(i.getRowCount(),u.getRowCount()));e<0&&(c=0);a=!(i===u&&i._name===u._name);a?i.rowRangeGroup&&u.rowRangeGroup&&(n.crossSheetCopyRangeGroup(i.rowRangeGroup,s,u.rowRangeGroup,c,h),t.ArrayHelper.clear(i.rowRangeGroup.items,s,h)):(l=i.rowRangeGroup,l&&l._move(s,c,h))},n.moveSpan=function(t,i,r,u,e,o,s,h){var l=i,c=r,y=e,p=o,a=s,v=h,w,b,k,d;i<0&&(l=0,a=f(t.getRowCount(),u.getRowCount()));c<0&&(c=0,v=f(t.getColumnCount(),u.getColumnCount()));e<0&&(y=0);o<0&&(p=0);w=!(t===u&&t._name===u._name);i<0&&(w?(n.crossSheetCopySpans(t._getSpanModel(1),-1,c,u._getSpanModel(1),-1,p,-1,v),t._getSpanModel(1)&&t._getSpanModel(1).clear(-1,c,-1,v)):(b=t._getSpanModel(1),b&&b.move(-1,c,-1,p,-1,v)));r<0&&(w?(n.crossSheetCopySpans(t._getSpanModel(2),l,-1,u._getSpanModel(2),y,-1,a,-1),t._getSpanModel(2)&&t._getSpanModel(2).clear(l,-1,a,-1)):(k=t._getSpanModel(2),k&&k.move(l,-1,y,-1,a,-1)));w?(n.crossSheetCopySpans(t._getSpanModel(),l,c,u._getSpanModel(),y,p,a,v),t._getSpanModel()&&t._getSpanModel().clear(l,c,a,v)):(d=t._getSpanModel(),d&&d.move(l,c,y,p,a,v))},n.moveColumnAxis=function(n,t,u,e,o,s){var l=t,a=e,k=o,c,h,p,w,v,d,y,b;for(t<0&&(l=0,k=f(n.getColumnCount(),u.getColumnCount())),e<0&&(a=0),c=1,h=0;h<k;h++)p=n._getActualColumnWidth(h+l),p!==r&&p!==i&&(n.setColumnWidth(h+l,n.defaults.colWidth),u.setColumnWidth(h+a,p)),w=n.getColumnVisible(h+l),w!==r&&w!==i&&(n.setColumnVisible(h+l,!0),u.setColumnVisible(h+a,w)),(s&64)>0&&(v=n.getActualStyle(-1,h+l),v?(u.setStyleWithoutLocked(-1,h+a,v.clone()),n.setStyleWithoutLocked(-1,h+l,i)):u.setStyleWithoutLocked(-1,h+a,i),v=n.getActualStyle(-1,h+l,c),v?(u.setStyleWithoutLocked(-1,h+a,v.clone(),c),n.setStyleWithoutLocked(-1,h+l,i,c)):u.setStyleWithoutLocked(-1,h+a,i,c));for(d=f(n.getRowCount(c),u.getRowCount(c)),y=0;y<d;y++)b=n._getActualRowHeight(y,c),b!==r&&b!==i&&(n.setRowHeight(y,n.defaults.colHeaderRowHeight,c),u.setRowHeight(y,b,c))},n.moveRowAxis=function(n,t,u,e,o,s){var l=t,a=e,k=o,c,h,p,w,v,d,y,b;for(t<0&&(l=0,k=f(n.getRowCount(),u.getRowCount())),e<0&&(a=0),c=2,h=0;h<k;h++)p=n._getActualRowHeight(h+l),p!==r&&p!==i&&(n.setRowHeight(h+l,n.defaults.rowHeight),u.setRowHeight(h+a,p)),w=n.getRowVisible(h+l),w!==r&&w!==i&&(n.setRowVisible(h+l,!0),u.setRowVisible(h+a,w)),(s&64)>0&&(v=n.getActualStyle(h+l,-1),v?(u.setStyleWithoutLocked(h+a,-1,v.clone()),n.setStyleWithoutLocked(h+l,-1,i)):u.setStyleWithoutLocked(h+a,-1,i),v=n.getActualStyle(h+l,-1,c),v?(u.setStyleWithoutLocked(h+a,-1,v.clone(),c),n.setStyleWithoutLocked(h+l,-1,i,c)):u.setStyleWithoutLocked(h+a,-1,i,c));for(d=f(n.getColumnCount(c),u.getColumnCount(c)),y=0;y<d;y++)b=n._getActualColumnWidth(y,c),b!==r&&b!==i&&(n.setColumnWidth(y,n.defaults.rowHeaderColWidth,c),u.setColumnWidth(y,b,c))},n.moveSheetInfo=function(n,t,r){if(n!==t||n._name!==t._name){if((r&64)>0){var u=1,f=2;t.setDefaultStyle(n.getDefaultStyle());t.setDefaultStyle(n.getDefaultStyle(u),u);t.setDefaultStyle(n.getDefaultStyle(f),f);n.setDefaultStyle(i);n.setDefaultStyle(i,u);n.setDefaultStyle(i,f)}t.defaults.colWidth=n.defaults.colWidth;t.defaults.rowHeight=n.defaults.rowHeight;t.defaults.rowHeaderColWidth=n.defaults.rowHeaderColWidth;n.defaults.colWidth=62;n.defaults.rowHeight=20;n.defaults.rowHeaderColWidth=40}},n.moveBindingPath=function(t,i,r,u,f,e,o,s){return n._copyMoveBindingPath(t,i,r,u,f,e,o,s,!0)},n.setRangeText=function(u,f,e,o,s,h,c,a){if(!u)throw new Error(t.SR.Exp_SheetIsNull);if((f<-1||f>=u.getRowCount())&&l("row",f,"-1",u.getRowCount()-1),(e<-1||e>=u.getColumnCount())&&l("column",e,"-1",u.getColumnCount()-1),o!==r&&o!==i&&o!==""){f===-1&&(f=0);e===-1&&(e=0);var v=n.parseText(o,s,h,c);v&&v.length>0&&n.setSheetData(u,f,e,v,a)}},n.getRangeText=function(n,u,f,e,o,s,h,c,a,v){var w,b,p,k,nt,d,y,g;if(!n)throw new Error(t.SR.Exp_SheetIsNull);for((u<-1||u>=n.getRowCount())&&l("row",u,"-1",n.getRowCount()-1),(f<-1||u+f>n.getRowCount())&&l("rowCount",u,"-1",n.getRowCount()-u),(e<-1||e>=n.getColumnCount())&&l("column",e,"-1",n.getColumnCount()-1),(o<-1||e+o>n.getColumnCount())&&l("columnCount",e,"-1",n.getColumnCount()-e),w=-1,b=-1,u===-1&&e===-1&&f===-1&&o===-1?(u=0,e=0,w=n.getRowCount()-1,b=n.getColumnCount()-1):(u===-1&&(u=0),e===-1&&(e=0),f===-1&&(f=n.getRowCount()-u),o===-1&&(o=n.getColumnCount()-e),w=u+f-1,b=e+o-1),(s===r||s===i||s==="")&&(s="\r\n"),(h===r||h===i||h==="")&&(h="\t"),(c===r||c===i||c==="")&&(c='"'),p="",k=u;k<=w;k++){for(nt=!0,d=e;d<=b;d++)nt||(p+=h),nt=!1,y="",g=n.getText(k,d),g!==r&&g!==i&&(y=g,y=y.replace(new RegExp(c,"g"),c+c)),p+=a||y.indexOf(c)!==-1||y.indexOf(h)!==-1||y.indexOf(s)!==-1||y.indexOf("\n")!==-1?c+y+c:y;p+=s}return p.toString()},n.parseText=function(n,u,f,e){var d,c,g,w,v,b;if(n===r||n===i||n==="")return i;(u===r||u===i||u==="")&&(u="\r\n");d="\n";(f===r||f===i||f==="")&&(f="\t");(e===r||e===i||e==="")&&(e='"');t.StringHelper.EndsWith(n,u)||(n+=u);var s=[],h=[],o="",l=!1,a=e.length,y=u.length,k=d.length,p=f.length;for(c=0;c<n.length;c++)o+=n[c],o.length>=a&&e===o.substr(o.length-a,a)?l&&n.length>=c+1+a&&e===n.substr(c+1,a)?c+=a:l?(o=o.substr(0,o.length-a),l=!1):(g=o,g.indexOf(e)===0&&(o=o.substr(0,o.length-a),l=!0)):!l&&o.length>=p&&f===o.substr(o.length-p,p)?(o=o.substr(0,o.length-p),h.push(o.toString()),o=""):!l&&o.length>=y&&u===o.substr(o.length-y,y)?(o=o.substr(0,o.length-y),h.push(o.toString()),s.push(h),h=[],o=""):!l&&o.length>=k&&d===o.substr(o.length-k,k)?(o=o.substr(0,o.length-k),h.push(o.toString()),s.push(h),h=[],o=""):l&&n.length>=c+1+p&&f===n.substr(c+1,p)&&f!=","&&(c+=a);if(l){if(h.length>0){for(w=0;w<s.length;w++)if(s[w]===h)break;w>=s.length&&s.push(h)}v=o.toString();v&&(v=v.replace(new RegExp(f,"g"),""),t.StringHelper.EndsWith(v,u)&&(v=v.substr(0,v.length-y)),s.length==0&&s.push([v]))}return s.length==0&&n&&(b=n,t.StringHelper.EndsWith(n,u)&&(b=b.substr(0,b.length-y)),s.push([b])),s},n.setSheetData=function(t,i,r,u,f){var e=u.length,s=n.getMaxLength(u),o,c,h,l;if(e!==0&&s!==0){o=new ht(f);o.fixOptions(t);var v=o.rowHeader?t.getColumnCount(2):0,a=o.columnHeader?t.getRowCount(1):0,y=0;for(s-=v,s<=0&&(s=0),e-=a,e<=0&&(y=0),e-=y,e<=0&&(e=0),o.expandRows&&i+e>t.getRowCount()&&t.setRowCount(i+e),o.expandColumns&&r+s>t.getColumnCount()&&t.setColumnCount(r+s),c=0,h=0;c<u.length;c++,h++)(l=u[c],l.length<=0)||(a>0&&c<a?n.setRowData(t,l,h,r,s,1,o):e>0&&h<t.getRowCount()&&(c===a&&(h=i),n.setRowData(t,l,h,0,v,2,o),l.splice(0,v),n.setRowData(t,l,h,r,s,3,o)))}},n.setRowData=function(t,i,r,u,f,e,o){for(var s=0,h=u;s<i.length;s++,h++)f>0&&h<t.getColumnCount(e)&&n.setCellData(t,e,r,h,i[s],o)},n.setCellData=function(n,u,f,e,o,s){var h=o,p=i,a,c,v,w;if(s.unFormatted===!1&&t.features.formatter&&(a={value:o},p=(new t.GeneralFormatter).GetPreferredDisplayFormatter(o,a),h=a.value),h===r||h===i)n.setValue(f,e,h,u);else if(o!=="")if(s.formula&&o[0]==="=")try{n.setFormula(f,e,o.substr(1))}catch(k){n.setText(f,e,o,u)}else{if(c=n.getActualStyle(f,e,u),s.unFormatted===!1&&t.features.formatter)if(c.formatter)c.formatter.toString()==="@"&&(h=o.toString());else{v=new t.AutoFormatter(p);n.getCell(f,e,u)._setStyleProperty("_autoFormatter",v);var l=o,y=n.getCellType(f,e,u),b=v.FormatString();y&&y.typeName==="7"&&(w={sheet:n,row:f,col:e,sheetArea:u},l=y.parse(o,b,w),h=l===i||l===r?o:l)}else c.formatter&&n.getCell(f,e,u).formatter(i);n.setValue(f,e,h,u)}else n.setValue(f,e,i,u)},n.getMaxLength=function(n){var t,u,f;if(n===r||n===i)return 0;for(t=0,u=0;u<n.length;u++)f=n[u],t=e(f.length,t);return t},n.parseCsv=function(t,r,u,f){var c=i,s=n.parseText(t,r,u,f),e,o;if(s){var l=s.length,a=n.getMaxLength(s),h=[];for(e=0;e<l;e++)for(h[e]=[],o=0;o<a;o++)h[e][o]=o<s[e].length?s[e][o]:i;c=h}return c},n.tryConvertDateToOADate=function(n){return typeof n!==u&&n!==i&&n.constructor===Date&&(n="/OADate("+new t._DateTimeHelper(n).toOADate()+")/"),n},n.tryConvertOADateToDate=function(n){if(typeof n===c&&n.charAt(0)==="/"){var i;dt.test(n)?(i=n.match(dt),n=t._DateTimeHelper.fromOADate(parseFloat(i[1]))):kt.test(n)&&(i=n.match(kt),n=new Date(parseFloat(i[1])))}return n},n.adjustModelFormulasAfterSetSheetName=function(n){var s,r,p,h,c,u,l,i,a,v,f,e,y,o;if(t.util.hasCalc()&&(s=n.getCalcService(),r=s.getSourceModel(n._getSheetSource()),r))for(h=function(n){var u=n.sourceModel.getSource(),f,t,i,e;n.name?(e=n.name,f=n.sourceModel.getNodeByName(e)):(t=n.row,i=n.column,t=t===undefined?-1:t,i=i===undefined?-1:i,f=n.sourceModel.getNode(t,i));var h=f.expr,r=f.arrayInfo,o=s.unparseWithoutCulture(u,h,t<0?0:t,i<0?0:i);r?u.setArrayFormula(r.row,r.col,r.rowCount,r.colCount,o):e?u.setFormulaByName(e,o):u.setFormula(t,i,o)},c=r.getAllNodes(),u=0;u<c.length;u++)if(l=c[u],i=l.calc,i)for(l.expr&&h(i),a=i._listeners,f=0;f<a.length;f++)if(e=i[a[f]],e)for(y=e.length,o=0;o<y;o++)v=e[o],v.sourceModel!==r&&h(v)},n.getDataValidatorsBeforeSetSheetName=function(n){var u,v,s,i,y,p,h,r,b,f,c,k;if(t.util.hasCalc()){var w=n.getCalcService(),e=n._getSheetSource(),l=0,a=0,o=[[],[]];if(t.features.dataValidator)for(u=t._DataValidatorCache.getAllValidators(),r=0;r<u.length;r++)if(v=u[r].validator,p=u[r].sheet,b=p._getSheetSource(),s=v.condition,i=s.getFormulas(),h=[],i&&i.length>0){for(f=0;f<i.length;f++)y=i[f],c=w.parse(e,y,l,a),h.push(c),k=e.getCalcService().unparse(e,c,l,a);o[0].push(s);o[1].push(h)}return o}},n.adjustValidatorsAfterSetSheetName=function(n,i){var r,u,o;if(t.util.hasCalc()){var s=i[0].length,h=n.getCalcService(),c=n._getSheetSource(),l=0,a=0;for(r=0;r<s;r++){var v=i[0][r],f=i[1][r],e=[];for(u=0;u<f.length;u++)o=h.unparse(c,f[u],l,a),e.push(o);v.setFormulas(e)}}},n.adjustNamesOnRemoveTables=function(t,i){var r=t.parent,e,f=function(i,r){for(var f,e,u=0;u<i.length;u++)f=i[u].getExpression(),e=n.adjustNameOnRemoveTable(f,r),e!==f&&(i[u].setExpression(e),t.getCalcService().getOperatorAdjustor().invalidName(t._getSheetSource(),i[u].getName()))},u;if(r)for(f(r.getCustomNames(),i),u=0;u<r.sheets.length;u++)t=r.sheets[u],f(t.getCustomNames(),i);else f(t.getCustomNames(),i);t.getCalcService().getOperatorAdjustor().onAfterRemoveTable()},n.adjustNameOnRemoveTable=function(i,r){var u=n.adjustNameOnRemoveTable,f,l,tt,e;if(i.t===10){var o=i,a=o.left,v=o.right,y=u(a,r),p=u(v,r);if(a!==y||v!==p)return new t.Calc.Expressions.BinaryOperatorExpression(o.operator,y,p)}else if(i.t===11){var w=i,b=w.operand,k=u(b,r);if(b!==k)return new t.Calc.Expressions.UnaryOperatorExpression(w.operator,k)}else if(i.t===7){var s=i,h=!1,d=[],c;for(f=0;f<s.args.length;f++)c=s.args[f],l=u(c,r),h=h||c!==l,d.push(l);if(h)return new t.Calc.Expressions.FunctionExpression(s.fn,d)}else if(i.t===14){var it=i,g=it.argument,nt=u(g,r);if(g!==nt)return new t.Calc.Expressions.ParenthesesExpression(nt)}else if(i.t===17)for(tt=i,e=0;e<r.length;e++)if(tt.baseTable()===r[e])return new t.Calc.Expressions.ErrorExpression(t.Calc.Errors.Reference);return i},n}(),b=[/\\/g,/\(/g,/\[/g,/\{/g,/\^/g,/\$/g,/\|/g,/\)/g,/\+/g,/\./g],ct=new RegExp("{113E2532-EAF5-444c-A5CB-3D7446971C4D}","g"),lt=new RegExp("{E21523B3-0F1F-458f-B547-23D25713D0EC}","g");var a=".gcSheet",d=".gcSheetInternal",g="mousedown"+a,nt="mousemove"+a,tt="mouseup"+a,it="mouseout"+a,rt="dblclick"+a,ut="mousewheel"+a,ft="DOMMouseScroll"+a,ni="resize"+a,vt="value",k="tag",ti="left",ii="top",yt="width",pt="height",wt="hidden",bt="visibility",ri="POST",ui="json",fi="application/json;charset=UTF-8",kt=new RegExp("^/Date\\((-?\\d+)([-+]{1}\\d+)?\\)/\\s*$"),dt=new RegExp("^/OADate\\(([-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)\\)/\\s*$")})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){var yi,pi;t.feature("core.spread",["core.common","core.theme","core.sheet_event","core.sheet_action","core.sheet","core.spreadpanelex","core.stringResource","core.imageLoader"]);var i=null,u=undefined,ut=Math.round,h=Math.max,g=Math.min,yt=Math.pow,wi=Math.sqrt,nt="string",p="boolean",w="number",r="undefined",f=window.document,rr="refresh",pt="scroll",wt="resize",ur="horizontal",fr="vertical",bt="input",b="div",e="px",o="0",er="3000",or="hidden",sr="visible",kt="top",dt="none",a=".gcSpread",ft=".gcSpreadInternal",hr="_data",v=".gcScrollbar",tt="scroll-handle",it="scroll-bar",gt="mousedown",ni="mouseup",bi=function(){function s(n,t){var r,f,e,o;this._isResizing=!1;r=this;r._host=i;r._allowUndo=!0;r._paintSuspended=!1;r._availableSheetIndex=-1;r._useTouchLayout=!1;r.touchScrollOnRails(!0);r.sheets=i;r.name=i;r._tabStripRatio=.5;r._tabStripRatioUserSet=.5;r._activeSheetIndex=0;r._allowUserZoom=!0;r._allowUserResize=!0;r._allowSheetReorder=!0;r._tabStripVisible=!0;r._tabEditable=!0;r._newTabVisible=!0;r._firstTabUserSet=0;r._canUserEditFormula=!0;r._enableFormulaTextbox=!0;r._highlightInvalidData=!1;r._autoFitType=0;r._allowDragDrop=!0;r._allowDragFill=!0;r._showDragFillSmartTag=!0;r._defaultDragFillType=5;r._showScrollTip=0;r._showResizeTip=0;r._showDragDropTip=!0;r._showDragFillTip=!0;r._tooltip=i;r._showVerticalScrollbar=!0;r._showHorizontalScrollbar=!0;r._scrollIgnoreHidden=!1;r._backColor="white";r._backgroundImage=i;r._backgroundImageLayout=0;r._imageLoader=i;r._suspendSetFocus=!1;r._cutCopyIndicatorVisible=!0;r._cutCopyIndicatorBorderColor="#217346";r._defaultSheetCount=1;r._defaultActiveSheetIndex=0;r._windowResizeTimer=i;r._scrollbarMaxAlign=!1;r._scrollbarShowMax=!0;r._hideSelection=!1;r._resizeZeroIndicator=1;r._tabNavigationVisible=!0;(typeof t===w||t===i||t===u)&&(f={},typeof arguments[0]===nt&&(f.name=arguments[0]),typeof arguments[1]===w&&(f.sheetCount=arguments[1]),t=f);(typeof n===nt||n===i||n===u)&&(n=i,typeof arguments[2]=="object"&&(n=arguments[2]));e=1;o=[];t&&(typeof t.sheetCount===w&&(e=t.sheetCount),typeof t.name===nt&&t.name.length>0&&(r.name=t.name),typeof t.font===nt&&t.font.length>0&&(r._font=t.font),typeof t.allowUserZoom===p&&(r._allowUserZoom=t.allowUserZoom),typeof t.allowUserResize===p&&(r._allowUserResize=t.allowUserResize),typeof t.tabStripVisible===p&&(r._tabStripVisible=t.tabStripVisible),typeof t.tabEditable===p&&(r._tabEditable=t.tabEditable),typeof t.newTabVisible===p&&(r._newTabVisible=t.newTabVisible),typeof t.tabStripRatio===w&&(r._tabStripRatio=t.tabStripRatio),typeof t.activeSheetIndex===w&&(r._activeSheetIndex=t.activeSheetIndex),t.sheets&&t.sheets.length>0&&(o=t.sheets));r._init(e,o,n)}return s.prototype._init=function(n,r,u){var e=this,o,c,l,a,h,s,v;for(e._initCalcService(),e._userEvents=[],e._userEventsElem=f.createElement(bt),e._eventSuspended=0,e._undoManager=new t._UndoManager(e,-1,e.allowUndo()),e._clipboardHelper={fromSheet:i,range:i,isCutting:!1},e._floatingObjectClipboardHelper={fromSheet:i,isCutting:!1},e._containerDiv=i,t.features.touch&&(e._touchEventProvider=new t.TouchEventProvider),e.sheets=[],e._namedStyles={},t.features.sparklineEx&&(e._sparklineExs={},e.addSparklineEx(new t.PieSparkline),e.addSparklineEx(new t.AreaSparkline),e.addSparklineEx(new t.ScatterSparkline),e.addSparklineEx(new t.LineSparkline),e.addSparklineEx(new t.ColumnSparkline),e.addSparklineEx(new t.WinlossSparkline),e.addSparklineEx(new t.BulletSparkline),e.addSparklineEx(new t.SpreadSparkline),e.addSparklineEx(new t.StackedSparkline),e.addSparklineEx(new t.HBarSparkline),e.addSparklineEx(new t.VBarSparkline),e.addSparklineEx(new t.BoxPlotSparkline),e.addSparklineEx(new t.VariSparkline),e.addSparklineEx(new t.CascadeSparkline),e.addSparklineEx(new t.ParetoSparkline)),o=0;o<n;o++){c=e._createSheet(e._getDefaultSheetName(o));e.sheets.push(c);c.onAttached(e)}if(l=t.util._isStandardCanvas(),a=t.util._isSilverlightCanvas(),l&&e._suspendInvalidate(),u&&e._setHost(u),r&&r.length>0){if(e.getSheetCount()<r.length)for(s=e.getSheetCount();s<r.length;)h=e._createSheet(e._getDefaultSheetName(s)),e._addSheetImp(s,0,h),s=e.getSheetCount();for(o=0;o<r.length;o++)h=e.getSheet(o),h.applyOptions(r[o])}l?(v=e._resumeInvalidate(),v||(e.invalidateLayout(),e.repaint())):a&&window.slcanvas&&window.slcanvas.autoLoad&&window.slcanvas.autoLoad();t.features.touch&&!e.touchToolStrip&&(e.touchToolStrip=new t.TouchToolStrip(e,e._getContainerDiv()))},s.prototype._getContainerDiv=function(){var n=this;return!n._containerDiv&&n._host&&(n._containerDiv=f.createElement("div"),t.GC$(n._containerDiv).css({position:"relative",left:0,top:0,height:0}),t.GC$(n._host).prepend(n._containerDiv)),n._containerDiv},s.prototype._getDefaultSheetName=function(n){var t=this,r,e,o,f,s;t._availableSheetIndex<t.getSheetCount()?t._availableSheetIndex=t.getSheetCount():t._availableSheetIndex++;(n===u||n===i||n<t._availableSheetIndex)&&(n=t._availableSheetIndex);r=!1;do if(e="Sheet"+(n+1),o=t.sheets.length,o>0)for(f=0;f<o;f++)if(f in t.sheets)if(s=t.sheets[f],s._name===e){n++;r=!0;break}else r&&(r=!1);while(r);return e},s.prototype._initCalcService=function(){var n=this;t.util.hasCalc()&&(n.calcService=new t.Calc.CalcService,n._spreadSource=new t.Calc.SpreadSource(n),n._spreadSourceModel=n.calcService.getGlobalSourceModel(n._spreadSource))},s.prototype._createSheet=function(n){return new t.Sheet(n)},s.prototype._slSetHost=function(n){var r=this,i;t.GC$(n).data("spread",r);i=f.createElement("canvas");i.setAttribute("width",""+n.clientWidth);i.setAttribute("height",""+n.clientHeight);n.appendChild(i);r.canvas=i;i.setAttribute("renderMethod","auto");i.setAttribute("gcSpreadsheet","true");i.setAttribute("onload","GcSpread.Sheets.util.initPaint('"+n.id+"')");this._resizeHandler=t.util.createEventHandler(r,r._doResize);t.GC$(window).bind("resize.gcSpread",this._resizeHandler)},s.prototype._setHost=function(n){var r=this,g,nt,l,u,y,tt,p,s,h,w,c,k,d;if(n){if(g=t.util._isStandardCanvas(),nt=t.util._isSilverlightCanvas(),!g&&nt){r._slSetHost(n);return}for(r._host=n,l=window.jQuery,l&&l(n).data("spread",r),t.GC$(n).data("spread",r),n.setAttribute("gcUIElement","gcSpread"),t.Global.prototype._createDummyObjects(),u=f.createElement("table"),u.cellSpacing="0px",u.cellPadding="0px",u.style.border="0px",s=0;s<2;s++){for(y=f.createElement("tr"),h=0;h<2;h++)tt=f.createElement("td"),y.appendChild(tt);u.appendChild(y)}for(n.appendChild(u),t.GC$(n).bind(t.Events.CultureChanged,r,r._onCultureChanged),t.GC$(n).addClass("no-user-select"),r._vp=f.createElement(b),r._vp.id=n.id+"vp",u.rows[0].cells[0].insertBefore(r._vp,i),p="100%",u.style.width=p,u.style.height=p,u.style.border=o,u.style.margin=o,s=0;s<u.rows.length;s++)for(h=0;h<u.rows[s].cells.length;h++)u.rows[s].cells[h].style.padding=o,u.rows[s].cells[h].style.border=o;for(r._scrollbarV=new t.Scrollbar(!1),w=r._scrollbarV.getScrollbar(),r._scrollbarVContainer=f.createElement(b),t.GC$(r._scrollbarVContainer).append(w),u.rows[0].cells[1].insertBefore(r._scrollbarVContainer,i),t.GC$(w).bind(pt+v,function(n,t){var f=r.getActiveSheet(),i=t.scrollEventType,u=t.scrollOrientation;if(n.data=r,u===1)switch(i){case 0:case 1:case 2:case 3:case 5:r._vscrollDelegate(n,t);break;case 4:r._vScrollStop(n);break;default:break}}).bind(gt+v,function(n,t){n.data=r;r._vScrollMouseDown(n)}).bind(ni+v,function(n,t){n.data=r;r._scrollMouseUp(n)}),u.rows[1].cells[0].innerHTML="<table cellspacing=0 cellpadding=0 border=0><tr><td><\/td><td><\/td><\/tr><\/table>",r._footerCornerContainer=f.createElement(b),t.GC$(u.rows[1].cells[1]).append(r._footerCornerContainer),c=u.rows[1].cells[0].firstChild,c.style.border=o,c.style.margin=o,t.GC$(c).css("user-select","none"),s=0;s<c.rows.length;s++)for(h=0;h<c.rows[s].cells.length;h++)c.rows[s].cells[h].style.padding=o,c.rows[s].cells[h].style.border=o;r._tabs=f.createElement(b);r._tabs.style.width=""+r._getActualTabStripRatio()*t.GC$(r._host).width()+e;r._tabs.style.height=""+r._getTabStripHeight()+e;r._tabs.style.fontSize="10pt";r._tabs.style.fontFamily="Arial";c.rows[0].cells[0].insertBefore(r._tabs,i);r._scrollbarH=new t.Scrollbar(!0);k=r._scrollbarH.getScrollbar();r._scrollbarHContainer=f.createElement(b);t.GC$(r._scrollbarHContainer).append(k);c.rows[0].cells[1].insertBefore(r._scrollbarHContainer,i);t.GC$(k).bind(pt+v,function(n,t){var f=r.getActiveSheet(),i=t.scrollEventType,u=t.scrollOrientation;if(n.data=r,u===0)switch(i){case 0:case 1:case 2:case 3:case 5:r._hscrollDelegate(n,t);break;case 4:r._hScrollStop(n);break;default:break}}).bind(gt+v,function(n,t){n.data=r;r._hScrollMouseDown(n)}).bind(ni+v,function(n,t){n.data=r;r._scrollMouseUp(n)});this._resizeHandler=t.util.createEventHandler(r,r._doWindowResize);t.GC$(window).bind(wt+a,this._resizeHandler);t.features.comment&&(r._commentRender=new t.CommentRender(r._getContainerDiv()));d=r.getActiveSheet();d&&(d._setHost(r._vp),t.GC$(window).unbind("resize.gcSheet"));r._refreshScrollbarAndTabStrip();r._doResize();r._createFocusElementForTab(n)}},s.prototype._createFocusElementForTab=function(n){var r=this,e=parseInt(t.GC$(n).attr("tabindex"),10)||0,u=f.createElement("div");t.GC$(u).css("position","absolute").css("overflow","hidden").attr("gcUIElement","gcSheetFocusElementForTab").attr("tabindex",e).bind("focus",function(){if(!r._ignoreFocusEvent){var n=r.getActiveSheet();n.setFocus()}r._ignoreFocusEvent=!1});n.insertBefore(u,i);r._tabFocusElement=u},s.prototype.focusTabFocusElement=function(){var n=this,t=n._tabFocusElement;t&&(n._ignoreFocusEvent=!0,t.focus())},s.prototype._onCultureChanged=function(n,t){var r=n.data,o,c,f,e,s,h;for(r.invalidateLayout(),r.touchToolStrip&&r.touchToolStrip._updateResource(),o=0,c=r.sheets.length;o<c;o++){var u=r.sheets[o],l=u.getRowCount(),a=u.getColumnCount();for(f=0;f<l;f++)for(e=0;e<a;e++)(s=u.getValue(f,e),s!==i)&&(h=u.getStyle(f,e),h&&u._changeFormatterAfterCultureChanged(h,s))}r.repaint()},s.prototype._hscrollDelegate=function(n,t){var s=n.data,f=s.getActiveSheet(),r,e,h,o;f&&t&&(r=parseInt(t.newValue,10),r=f._getOriginalColIndex(r),(t.oldValue===u||t.oldValue===i)&&(t.oldValue=0),t.oldValue=parseInt(t.oldValue,10),f._needSyncHScrollbarSize=!1,t.scrollEventType===2||t.scrollEventType===0?(t.scrollEventType===2&&(r=f._getPrevPageLeftColumn()),e=f._getScrollableColumn(r,!0),e!=-1&&e!=r&&(r=e),s._scrollbarShowMax||(f._needSyncHScrollbarSize=!0,t.ignoreUpdatePosition=!0)):(t.scrollEventType===3||t.scrollEventType===1)&&(t.scrollEventType===3&&(r=f._getPageRightColumn(),r===f._scrollLeftCol&&r++),s._scrollbarShowMax||(f._needSyncHScrollbarSize=!0,t.scrollEventType===1&&t.newValue===t.oldValue&&r++),e=f._getScrollableColumn(r),e!=-1&&e!=r&&(r=e)),h=f._getFirstPageLeftColumn(),r<h&&(r=h),r>f._getLastVisualScrollColumn()&&(r=f._getLastVisualScrollColumn()),o=f._getVisibleColIndex(r),t.newValue!==o&&(t.newValue=o),t.oldValue!==o&&f._eventHandler.doHScroll(r))},s.prototype._hScrollStop=function(n){var i=n.data,t=i.getActiveSheet(),r,u;t&&(r=i._scrollbarH,u=r.value(),u<t._getFirstPageLeftColumn()?r.value(t._getVisibleColIndex(t._getFirstPageLeftColumn())):u>t._getLastVisualScrollColumn()&&r.value(t._getVisibleColIndex(t._getLastVisualScrollColumn())),t._eventHandler._removeTooltip(),i._scrollbarShowMax||(t._eventHandler.scrolling?t._needSyncHScrollbarSize=!0:i._resizeHScrollBar()),t._formulaTextBox&&t._formulaTextBox.focus())},s.prototype._hScrollMouseDown=function(n){var f=n.data,u,e,i,r,o;f&&(u=f.getActiveSheet(),u&&u.setFocus(),e=f.showScrollTip(),(e===1||e===3)&&(i=t.GC$(n.srcElement||n.target),r=i.parent(),(i&&i.hasClass(tt)||r&&r.hasClass(tt)||i&&i.hasClass(it)||r&&r.hasClass(it))&&(i||r)&&(o=u&&u._eventHandler,o&&o._showScrollTooltip(!1,n))))},s.prototype._vscrollDelegate=function(n,t){var s=n.data,f=s.getActiveSheet(),r,e,h,o;f&&t&&(r=parseInt(t.newValue,10),r=f._getOriginalRowIndex(r),(t.oldValue===u||t.oldValue===i)&&(t.oldValue=0),t.oldValue=parseInt(t.oldValue,10),f._needSyncVScrollbarSize=!1,t.scrollEventType===2||t.scrollEventType===0?(t.scrollEventType===2&&(r=f._getPrevPageTopRow()),e=f._getScrollableRow(r,!0),e!=-1&&e!=r&&(r=e),s._scrollbarShowMax||(f._needSyncVScrollbarSize=!0,t.ignoreUpdatePosition=!0)):(t.scrollEventType===3||t.scrollEventType===1)&&(t.scrollEventType===3&&(r=f._getPageBottomRow(),r===f._scrollTopRow&&r++),s._scrollbarShowMax||(f._needSyncVScrollbarSize=!0,t.scrollEventType===1&&t.newValue===t.oldValue&&r++),e=f._getScrollableRow(r),e!=-1&&e!=r&&(r=e)),h=f._getFirstPageTopRow(),r<h&&(r=h),r>f._getLastVisualScrollRow()&&(r=f._getLastVisualScrollRow()),o=f._getVisibleRowIndex(r),t.newValue!==o&&(t.newValue=o),t.oldValue!==o&&f._eventHandler.doVScroll(r))},s.prototype._initPaint=function(){var u=t.util._isStandardCanvas(),n,r,i;u||(n=this,r=n.getActiveSheet(),r)&&(i=r._getCanvas(),i&&i.firstChild&&i.firstChild.loaded?(n.invalidateLayout(),n.repaint()):window.setTimeout(function(){n._initPaint.call(n)},10))},s.prototype._vScrollStop=function(n){var i=n.data,t=i.getActiveSheet(),r,u;t&&(r=i._scrollbarV,u=r.value(),u<t._getFirstPageTopRow()?r.value(t._getVisibleRowIndex(t._getFirstPageTopRow())):u>t._getLastVisualScrollRow()&&r.value(t._getVisibleRowIndex(t._getLastVisualScrollRow())),t._eventHandler._removeTooltip(),i._scrollbarShowMax||(t._eventHandler.scrolling?t._needSyncVScrollbarSize=!0:i._resizeVScrollBar()),t._formulaTextBox&&t._formulaTextBox.focus())},s.prototype._vScrollMouseDown=function(n){var f=n.data,i,e,r,u,o;f&&(i=f.getActiveSheet(),i&&i.setFocus(),e=f.showScrollTip(),(e===2||e===3)&&(r=t.GC$(n.srcElement||n.target),r&&(u=r.parent(),(r.hasClass(tt)||u&&u.hasClass(tt)||r.hasClass(it)||u&&u.hasClass(it))&&(o=i&&i._eventHandler,o&&o._showScrollTooltip(!0,n)))))},s.prototype._scrollMouseUp=function(n){var r=n.data,t,i;r&&(t=r.getActiveSheet(),i=t&&t._eventHandler,i&&i._removeTooltip())},s.prototype._dispose=function(){var n=this,f,e,u,r,o;for(t.DPIHelper.disposeSpread(n),t.GC$(window).unbind(wt+a,n._resizeHandler),n.unbindAll(),n._resizeHandler=i,n._scrollbarH&&n._scrollbarH.dispose(),n._scrollbarV&&n._scrollbarV.dispose(),n._touchEventProvider&&n._touchEventProvider.dispose(),n._disposeUserEvents(),t._DataValidatorCache.clear(),f=n.sheets,e=0;e<f.length;e++)f[e]._dispose(!0);f.splice(0,f.length);u=n._host;u&&(u.innerHTML="",u.removeAttribute("gcUIElement"),r=t.GC$(n._host),r.unbind(t.Events.CultureChanged),r.removeClass("no-user-select"),r.attr("class")||r.removeAttr("class"),r.attr("unselectable")||r.removeAttr("unselectable"),r.data("spread")&&r.data("spread",i),$&&$(u).data("spread")&&$(u).data("spread",i));n.touchToolStrip&&(n.touchToolStrip._dispose(),n.touchToolStrip=i);n._commentRender&&(n._commentRender=i);o=n._printer;o&&o.dispose();n._scrollbarHContainer=n._scrollbarVContainer=i;n._undoManager=i;n._tab&&(n._tab.dispose(),n._tab=i);n._tabFocusElement&&(t.GC$(n._tabFocusElement).unbind("focus"),n._tabFocusElement=i);n.calcService&&(n.calcService.dispose(),n.calcService=i,n._spreadSource=i,n._spreadSourceModel=i);n._imageLoader=i},s.prototype._disposeUserEvents=function(){var n,i;for(t.GC$(this._userEventsElem).unbind(a),n=0;n<this.sheets.length;n++)i=this.sheets[n],i._disposeUserEvents()},s.prototype._getCalcContexts=function(){for(var r,n,i=[],t=0;t<this.sheets.length;t++)if(r=this.sheets[t],n=r._getCalcContexts(),n)while(n.length>0)i.push(n.pop());return i},s.prototype._refreshScrollbarAndTabStrip=function(){var n=this,e=t.ThemeStyleHelper.getCssClassThemeStyle(""),i=parseInt(e.zIndex),u=i!==n._themeVersion,r,f;u&&(n._themeVersion=i);var o=n._getTabStripHeight(),s=n._getScrollbarSize(),h=n._getVScrollbarContainerWidth();n._tab&&!u?n._tab.repaint():(r=n._host,n._tab&&n._tab.dispose(),n._tab=i>2007?new pi(r.getAttribute("id")+"_tabStrip"):new yi(r.getAttribute("id")+"_tabStrip"),n._tab.setOwner(n),n._tab.setHost(n._tabs));f=0;i>2007&&(f=1);n._refreshVScrollContainer();n._refreshHScrollContainer();n._refreshFooterCorner()},s.prototype._refreshVScrollContainer=function(){var u=this,f=t.ThemeStyleHelper.getCssClassThemeStyle("gc-vertical-scrollbar ui-widget-header ui-state-default btn btn-default"),s=parseInt(f.zIndex),i=u._getScrollbarSize(),e=u._getVScrollbarContainerWidth(),n,o,r=0;s>2007&&(r=1);(e-i)%2==0?(n=(e-i)/2,o=n-r):(n=(e-i-r)/2,o=n);t.GC$(u._scrollbarVContainer).css({"box-sizing":"content-box",border:"none","border-color":"none","border-left-style":"solid","border-left-width":r+"px","border-left-color":f.borderLeftColor,"background-color":f.backgroundColor,width:i,padding:"0px "+n+"px 0px "+o+"px",margin:"0"})},s.prototype._refreshHScrollContainer=function(){var u=this,f=t.ThemeStyleHelper.getCssClassThemeStyle("gc-horizontal-scrollbar ui-widget-header ui-state-default btn btn-default"),s=parseInt(f.zIndex),e=u._getTabStripHeight(),i=u._getScrollbarSize(),n,o,r=0;s>2007&&(r=1);(e-i)%2==0?(n=(e-i)/2,o=n-r):(n=(e-i-r)/2,o=n);t.GC$(u._scrollbarHContainer).css({"box-sizing":"content-box",border:"none","border-color":"none","border-top-style":"solid","border-top-width":r+"px","border-top-color":f.borderTopColor,"background-color":f.backgroundColor,height:i,padding:o+"px 0px "+n+"px 0px",margin:"0"})},s.prototype._refreshFooterCorner=function(){var i=t.ThemeStyleHelper.getCssClassThemeStyle("gc-footer-corner ui-widget-header ui-state-default btn btn-default"),n=this,r=n._getVScrollbarContainerWidth(),u=n._getTabStripHeight();t.GC$(this._footerCornerContainer).css({border:"none",padding:"0",margin:"0",width:r+"px",height:u+"px","background-color":i.backgroundColor})},s.prototype._doWindowResize=function(){var n=this;n._windowResizeTimer&&window.clearTimeout(n._windowResizeTimer);n._windowResizeTimer=window.setTimeout(function(){t.DPIHelper.updateDPI();n._doResize();n._windowResizeTimer=i},100)},s.prototype._doResize=function(){var n=this;n._isResizing||(n._isResizing=!0,n._doResizeImp(),n._isResizing=!1)},s.prototype._doResizeImp=function(){var n=this,f,l,s,u,p,i,d;if(t.util.browser.msie&&parseInt(t.util.browser.version,10)<9&&(f=n.canvas,f)){var h=f.parentElement,r=h.parentElement,c=f.firstChild;c&&r&&(l=function(n){return n===""||n==="auto"||/%$/ig.test(n)},l(h.style.width)&&r.offsetWidth>12&&(c.width=r.offsetWidth-12),l(h.style.height&&r.offsetHeight>10)&&(c.height=r.offsetHeight-10))}var a=n._getTabStripHeight(),w=n._getScrollbarSize(),v=n._getVScrollbarContainerWidth(),y=n._host;if(y){var b=t.GC$(y),o=b.width(),k=t.GC$(y).height();n.showVerticalScrollbar()?(n._vp.style.width=""+(o-v)+e,t.GC$(n._scrollbarVContainer).css("display","block"),t.GC$(n._footerCornerContainer).css("width",v+e)):(n._vp.style.width=""+o+e,t.GC$(n._scrollbarVContainer).css("display","none"),t.GC$(n._footerCornerContainer).css("width","0"+e));n.showHorizontalScrollbar()||n._tabStripVisible?(n._vp.style.height=""+(k-a)+e,t.GC$(n._scrollbarHContainer).css("display","block"),t.GC$(n._footerCornerContainer).css("height",a+e)):(n._vp.style.height=""+k+e,t.GC$(n._scrollbarHContainer).css("display","none"),t.GC$(n._footerCornerContainer).css("height","0"+e));n.showHorizontalScrollbar()?(t.GC$(n._scrollbarH.getScrollbar()).show(),n.setTabStripRatio(n.getTabStripRatio())):(t.GC$(n._scrollbarH.getScrollbar()).hide(),n._setActualTabStripRatio(1));s=t.GC$(n._vp).width();u=ut(n._getActualTabStripRatio()*s);u===s&&(u=s-1);n._tabs.style.width=""+u+e;n._tabs.style.height=""+a+e;n._scrollbarV.width(w);n._scrollbarV.height(t.GC$(n._vp).height());p=o-(n._tabStripVisible?u:0)-(n.showVerticalScrollbar()?v:0);n._scrollbarH.width(p>0?p:1);n._scrollbarH.height(w);i=n.getActiveSheet();i&&(i._scrollTopRow===0&&(i._scrollTopRow=i._getFirstPageTopRow()),i._scrollLeftCol===0&&(i._scrollLeftCol=i._getFirstPageLeftColumn()));i&&i._eventHandler.doResize();n._resizeHScrollBar();n._resizeVScrollBar();i&&(i.invalidateLayout(),i.repaint());n._tabStripVisible===!0?t.GC$(n._tabs).show():t.GC$(n._tabs).hide();n._tab&&n._tab.doResize();d=b.width();o===d||n._haveLayoutFixing||(n._haveLayoutFixing=!0,setTimeout(function(){delete n._haveLayoutFixing;n._doResizeImp()},1))}},s.prototype._resizeHScrollBar=function(){var f=this,n=f.getActiveSheet(),s,i;if(n){var h=n.getColumnCount()-n._frozenTrailingColCount-n.frozenColCount,r=n.frozenColCount,c=n._getSheetLayout(),t=h===0?r:r+h-1,e=n._scrollLeftCol,o=1,l=n._getLeftColWhenLastColShowComplete(c.viewportWidth,r,t);if(f._scrollbarMaxAlign&&(t=l),!f._scrollbarShowMax){var a=n._getLastNonNullRowAndCol(),v=a.lastNonNullCol,u=n._getLeftColWhenLastColShowComplete(c.viewportWidth,r,v);u===r&&(u++,u>t&&(u=t));t=e>u?e<t?e:t:u}e>t&&(n._scrollLeftCol=t);s=n._getScrollableColumn(n._scrollLeftCol);s!==-1&&s!==n._scrollLeftCol&&(n._scrollLeftCol=s);o=n._getPageValueH();o<1&&(o=1);i=f._scrollbarH;i&&(i.minimum(n._getVisibleColIndex(r)),i.maximum(n._getVisibleColIndex(t)),i.pageValue(o),i.refreshLayout(),i.value(n._getVisibleColIndex(n._scrollLeftCol)))}},s.prototype._resizeVScrollBar=function(){var f=this,n=f.getActiveSheet(),s,i;if(n){var h=n.getRowCount()-n._frozenTrailingRowCount-n.frozenRowCount,r=n.frozenRowCount,c=n._getSheetLayout(),t=h===0?r:r+h-1,e=n._scrollTopRow,o=1,l=n._getTopRowWhenLastRowShowComplete(c.viewportHeight,r,t);if(f._scrollbarMaxAlign&&(t=l),!f._scrollbarShowMax){var a=n._getLastNonNullRowAndCol(),v=a.lastNonNullRow,u=n._getTopRowWhenLastRowShowComplete(c.viewportHeight,r,v);u===r&&(u++,u>t&&(u=t));t=e>u?e<t?e:t:u}e>t&&(n._scrollTopRow=t);s=n._getScrollableRow(n._scrollTopRow);s!==-1&&s!==n._scrollTopRow&&(n._scrollTopRow=s);o=n._getPageValueV();o<1&&(o=1);i=f._scrollbarV;i&&(i.minimum(n._getVisibleRowIndex(r)),i.maximum(n._getVisibleRowIndex(t)),i.pageValue(o),i.refreshLayout(),i.value(n._getVisibleRowIndex(n._scrollTopRow)))}},s.prototype._doTabHSResize=function(){var n=this,s=n._getScrollbarSize(),h=n._getTabStripHeight(),c=n._getVScrollbarContainerWidth(),o=n._host,f,i;if(o){var l=t.GC$(o),a=l.width(),u=t.GC$(n._vp).width(),r=ut(n._getActualTabStripRatio()*u);r===u&&(r=u-1);n._tabs.style.width=""+r+e;n._tabs.style.height=""+h+e;f=a-(n._tabStripVisible?r:0)-(n.showVerticalScrollbar()?c:0);n._scrollbarH.width(f>0?f:1);n._scrollbarH.height(s);n._scrollbarH.refreshLayout();i=n.getActiveSheet();i&&(i._scrollLeftCol===0&&(i._scrollLeftCol=i._getFirstPageLeftColumn()),n._scrollbarH.value(i._scrollLeftCol));n._tabStripVisible===!0?t.GC$(n._tabs).show():t.GC$(n._tabs).hide();n._tab&&n._tab.doResize()}},s.prototype._copyUserEvents=function(n){var t,i;for(n._eventHandler._eventSuspended=this._eventSuspended,t=0;t<this._userEvents.length;t++)i=this._userEvents[t],n.bind(i.type,i.data,i.fn)},s.prototype._suspendInvalidate=function(){var n=this.getActiveSheet();n&&n._suspendInvalidate()},s.prototype._resumeInvalidate=function(){var n=this.getActiveSheet();return n?n._resumeInvalidate():!1},s.prototype._paintSpreadBackgroundImage=function(){var n=this,r=n.getActiveSheet(),e,f;if(r){if(!n._backgroundImage)return;if(e=t.GC$(r._getCanvas()),e.css("background-image","url('"+n._backgroundImage+"')").css("background-repeat","no-repeat"),n._backgroundImageLayout===i||n._backgroundImageLayout===u)return;f=n._backgroundImage;n._imageLoader||(n._imageLoader=new t._GcImageLoader(function(){n._imageLoader&&n._paintSpreadBackgroundImage()}));try{if(n._imageLoader.getState(f)){var o=n._imageLoader.getImage(f),s=r.getBounds(),h=s.width,c=s.height;t.util._applyBackgroundImageLayout(r._getCanvas(),h,c,o.width,o.height,n._backgroundImageLayout)}else n._imageLoader.addImage(f)}catch(l){}}},s.prototype.touchScrollOnRails=function(n){var i=this;return arguments.length===0?i._touchScrollOnRails:(i._touchScrollOnRails=n,t.features.touch&&t.TouchHelper.TouchScrollOnRails(n),i)},s.prototype._changeSheetForFormulaAcrossSheet=function(n,t){typeof t=="undefined"&&(t=!0);var i=this;i._tab._doSheetTabClickChange(i.getSheetIndex(n.getName()),t)},s.prototype.scrollIgnoreHidden=function(n){var t=this,i;return arguments.length===0?t._scrollIgnoreHidden:(t._scrollIgnoreHidden!==n&&(t._scrollIgnoreHidden=n,i=t.getActiveSheet(),i&&(i._needSyncHScrollbarSize=!0,i._needSyncVScrollbarSize=!0,i.invalidate())),t)},s.prototype.scrollbarMaxAlign=function(n){var t=this,i;return arguments.length===0?t._scrollbarMaxAlign:(t._scrollbarMaxAlign!==n&&(t._scrollbarMaxAlign=n,i=t.getActiveSheet(),i&&(i._needSyncHScrollbarSize=!0,i._needSyncVScrollbarSize=!0,i.invalidate())),t)},s.prototype.scrollbarShowMax=function(n){var t=this,i;return arguments.length===0?t._scrollbarShowMax:(t._scrollbarShowMax!==n&&(t._scrollbarShowMax=n,i=t.getActiveSheet(),i&&(i._needSyncHScrollbarSize=!0,i._needSyncVScrollbarSize=!0,i.invalidate())),t)},s.prototype.showVerticalScrollbar=function(n){var t=this;return arguments.length===0?t._showVerticalScrollbar:(t._showVerticalScrollbar!==n&&(t._showVerticalScrollbar=n,t._doResize()),t)},s.prototype.showHorizontalScrollbar=function(n){var t=this;return arguments.length===0?t._showHorizontalScrollbar:(t._showHorizontalScrollbar!==n&&(t._showHorizontalScrollbar=n,t._doResize()),t)},s.prototype.allowUserZoom=function(n){return arguments.length===0?this._allowUserZoom:(this._allowUserZoom=n,this)},s.prototype.allowSheetReorder=function(n){return arguments.length===0?this._allowSheetReorder:(this._allowSheetReorder=n,this)},s.prototype.allowUserResize=function(n){return arguments.length===0?this._allowUserResize:(this._allowUserResize=n,this)},s.prototype.tabStripVisible=function(n){var t=this;return arguments.length===0?t._tabStripVisible:(t._tabStripVisible!==n&&(t._tabStripVisible=n,t._doResize()),t)},s.prototype.tabNavigationVisible=function(n){var t=this;return arguments.length===0?t._tabNavigationVisible:(t._tabNavigationVisible!==n&&(t._tabNavigationVisible=n,t._tab&&t._tab.repaint()),t)},s.prototype.tabEditable=function(n){return arguments.length===0?this._tabEditable:(this._tabEditable=n,this)},s.prototype.newTabVisible=function(n){var t=this;return arguments.length===0?t._newTabVisible:(t._newTabVisible!==n&&(t._newTabVisible=n,t._tab&&t._tab.repaint()),t)},s.prototype.cutCopyIndicatorVisible=function(n){var t=this,i;return arguments.length===0?t._cutCopyIndicatorVisible:t._cutCopyIndicatorVisible===n?t:(i=t.getActiveSheet(),i?i._bindToAutoRefresh(function(n){return t._cutCopyIndicatorVisible=n,t})(n):(t._cutCopyIndicatorVisible=n,t))},s.prototype.cutCopyIndicatorBorderColor=function(n){var t=this,i;return arguments.length===0?t._cutCopyIndicatorBorderColor:t._cutCopyIndicatorBorderColor===n?t:(i=t.getActiveSheet(),i?i._bindToAutoRefresh(function(n){return t._cutCopyIndicatorBorderColor=n,t})(n):(t._cutCopyIndicatorBorderColor=n,t))},s.prototype.canUserEditFormula=function(n){return arguments.length===0?t.util.hasCalc()&&this._canUserEditFormula:(this._canUserEditFormula=n,this)},s.prototype.enableFormulaTextbox=function(n){var t=this,i;if(arguments.length===0)return t._enableFormulaTextbox;for(i=0;i<t.sheets.length;i++)t.sheets[i].enableFormulaTextbox(n);return t._enableFormulaTextbox=n,t},s.prototype.autoFitType=function(n){return arguments.length===0?this._autoFitType:(this._autoFitType=n,this)},s.prototype.startSheetIndex=function(n){var t=this,i;return arguments.length===0?t._tab?t._firstTabUserSet:0:(t._tab&&0<=n&&n<t.getSheetCount()&&(t._firstTabUserSet=n,t.sheets[n].visible()?t._tab._firstTab=n:(i=t._tab._getNextVisibleIndex(n),i!==-1&&(t._tab._firstTab=i))),t._doTabHSResize(),t)},s.prototype.highlightInvalidData=function(n){if(arguments.length===0)return this._highlightInvalidData;var t=this,i=this.getActiveSheet();if(i)return i._bindToAutoRefresh(function(n){return t._highlightInvalidData=n,t})(n);else t._highlightInvalidData=n},s.prototype.isPaintSuspended=function(n){var t=this,i;if(arguments.length===0)return t._paintSuspended;else{if(t._paintSuspended!==n){for(t._paintSuspended=n,i=0;i<t.sheets.length;i++)t.sheets[i].isPaintSuspended(n);t._tab&&t._tab.isPaintSuspended(n)}return t}},s.prototype.destroy=function(){t.GC$(window).unbind("resize.gcSpread",this._resizeHandler);this._dispose()},s.prototype.repaint=function(){var n=this,t;n._tab&&n._tab.repaint();t=n.getActiveSheet();t&&t.repaint()},s.prototype.refresh=function(){var n=this;n._host&&(t.ThemeStyleHelper.clearCache(),n._refreshScrollbarAndTabStrip(),n._doResize(),n.repaint())},s.prototype.getHost=function(){return this._host},s.prototype.invalidateLayout=function(){var n=this.getActiveSheet();n&&n.invalidateLayout()},s.prototype.getActiveSheet=function(){return this.sheets.length>0?this.sheets[this._activeSheetIndex]:i},s.prototype.setActiveSheet=function(n){this._setActiveSheetInternal(n,2)},s.prototype._setActiveSheetInternal=function(n,t){for(var r=this.sheets,i=0;i<r.length;i++)r[i].getName()===n&&this._setActiveSheetIndexImp(i,t)},s.prototype.getActiveSheetIndex=function(){return this._activeSheetIndex},s.prototype.setActiveSheetIndex=function(n){this._setActiveSheetIndexImp(n,2)},s.prototype._setActiveSheetIndexImp=function(n,i){var r,u,f,s,e,o;typeof n=="number"&&(r=this,n!==r._activeSheetIndex)&&(u=r.sheets[n],u&&u.visible())&&((f=t.util.device(),(f.ipad||f.iphone)&&(e=r,o=(new Date).valueOf(),e.lastSetActiveSheetTime&&o-e.lastSetActiveSheetTime<300))||(s=r.getActiveSheet(),r._activeSheetIndex=n,u!==s&&(s&&s._dispose(!1),r._setActiveSheetImp(u,i,!1)),r._doResize(),(f.ipad||f.iphone)&&(e=r,o=(new Date).valueOf(),e.lastSetActiveSheetTime=o)))},s.prototype.addNamedStyle=function(n){this._addNamedStyleImp(n,!0)},s.prototype._addNamedStyleImp=function(n,r){var e=this,o,f;if(n!==i&&n!==u){if(n.name===i||n.name===u||n.name==="")throw new Error(t.SR.Exp_EmptyNamedStyle);r?(f=n.name.toUpperCase(),o=e.getActiveSheet(),o?o._bindToAutoRefresh(function(n){e._namedStyles[f]=n})(n):e._namedStyles[f]=n):(f=n.name.toUpperCase(),e._namedStyles[f]=n)}},s.prototype.getNamedStyle=function(n){return this.getNamedStyleImp(n,!0)},s.prototype.getNamedStyleImp=function(n,t){var u=this._namedStyles,r;return u&&n?(n=n.toUpperCase(),r=u[n]||i,r&&t&&this.clearStyleCache(),r):i},s.prototype.removeNamedStyle=function(n){var t=this._namedStyles,i;t&&n&&(n=n.toUpperCase(),t.hasOwnProperty(n)&&(delete t[n],i=this.getActiveSheet(),i&&i.invalidate()))},s.prototype.getNamedStyles=function(){var n=[],i=this._namedStyles;return i&&t.GC$.each(i,function(t,i){n.push(i)}),this.clearStyleCache(),n},s.prototype.clearStyleCache=function(){for(var n=0;n<this.sheets.length;n++)this.sheets[n].clearStyleCache()},s.prototype._setActiveSheetImp=function(n,r,u){u||n._setHost(this._vp);var f=!0;switch(r){case 1:f=!0;break;case 0:f=!1;break;case 2:f=t.FocusHelper.isActiveElement(n);break}t.FocusHelper.setActiveElement(i);!this._suspendSetFocus&&f&&n.setFocus();n._syncHScollbarPosition();n._syncVScrollbarPosition()},s.prototype.addSheet=function(n,t){this._addSheetImp(n,2,t)},s.prototype._addSheetImp=function(n,i,r){var u=this,f,h,e;if(r||(r=u._createSheet(u._getDefaultSheetName(n))),h=u.sheets.length,r._name){for(f=0;f<h;f++)if(u.sheets[f]._name===r._name)throw t.SR.Exp_NotSupport;}else r._name=u._getDefaultSheetName(n);u._copyUserEvents(r);var o=u.getActiveSheet(),c=u._activeSheetIndex,l=u.sheets.length-n,s=[];for(f=0;f<l&&u.sheets.length>0;f++)s.push(u.sheets.pop());u.sheets.push(r);r.onAttached(u);while(s.length>0)u.sheets.push(s.pop());u.sheets.length===1?(u._vp&&r._setHost(u._vp),u._activeSheetIndex=0):u._activeSheetIndex=c<0?0:c;e=u.getActiveSheet();e!==o&&(o&&o._dispose(!1),e&&u._setActiveSheetImp(e,i,u.sheets.length===1),u._doResize());u._tab&&u._tab.repaint()},s.prototype.removeSheet=function(n){this._removeSheetImp(n,2)},s.prototype._removeSheetImp=function(n,i){var r=this,l,e,s,h,u,f,o,c;if(isNaN(n)||n<0||n>=r.sheets.length)throw new Error(t.SR.Exp_IndexOutOfRange);if(l=n<=r._activeSheetIndex||n===r.sheets.length-1,e=r.getActiveSheet(),n<r._activeSheetIndex&&r._activeSheetIndex--,s=r.sheets[n],s._disposeUserEvents(),r.sheets.splice(n,1),h=r.sheets,u=h.length,u===0)r._activeSheetIndex=-1;else if(r._activeSheetIndex>=u)r._activeSheetIndex=r._tab._getPreVisibleIndex(u);else{for(f=r._activeSheetIndex;f<u;f++)if(h[f]._visible){r._activeSheetIndex=f;break}f>=u&&(r._activeSheetIndex=-1)}l&&(o=r.sheets[r._activeSheetIndex],e!==o&&(e&&e._dispose(!1),o&&r._setActiveSheetImp(o,i,!1)));r.calcService&&r.calcService.removeSource(s._getSheetSource());r._tab&&(c=r.sheets.length,r._tab._firstTab>=c?r.startSheetIndex(r._tab._getPreVisibleIndex(c)):r._tab._firstTab<0?r.startSheetIndex(0):r._doResize())},s.prototype.clearSheets=function(){for(var n=this,i=n.sheets,u=n.getActiveSheet(),r=0;r<i.length;r++)i[r]._disposeUserEvents(),i[r]._dispose();i.splice(0,i.length);n.calcService&&n.calcService.clearSource();n._activeSheetIndex=-1;n._tab&&(n._tab._firstTab=0,n._tab.repaint());t._DataValidatorCache.clear()},s.prototype.getSheet=function(n){return n>=0&&n<this.sheets.length?this.sheets[n]:i},s.prototype.getSheetFromName=function(n){for(var r=this.sheets,t=0;t<r.length;t++)if(r[t].getName()===n)return r[t];return i},s.prototype.getSheetIndex=function(n){for(var r=this.sheets,t=0;t<r.length;t++)if(r[t].getName()===n)return t;return i},s.prototype.getSheetCount=function(){return this.sheets.length},s.prototype.setSheetCount=function(n){this._setSheetCountImp(n,2)},s.prototype._setSheetCountImp=function(n,i){var e=this,f,r;if(n<0)throw t.SR.Exp_ArgumentOutOfRange;else n===0&&e.clearSheets();if(f=e.sheets.length,n<f)for(r=f-1;r>=n;r--)e._removeSheetImp(r,i);else if(n>f)for(r=f;r<n;r++)e._addSheetImp(r,i,u)},s.prototype.search=function(n){var r,e,u,o,f;if(!n||!t.features.search)return i;if(r=this,e=0,!n.searchString||n.searchTarget===e||r.getSheetCount()<=0)return new t.SearchResult;if(n.startSheetIndex===-1&&(n.startSheetIndex=0),n.endSheetIndex===-1&&(n.endSheetIndex=r.getSheetCount()-1),n.endSheetIndex>=n.startSheetIndex&&0<=n.startSheetIndex&&n.startSheetIndex<r.getSheetCount()&&0<=n.endSheetIndex&&n.endSheetIndex<r.getSheetCount())for(u=n.startSheetIndex;u<=n.endSheetIndex;u++)if(o=r.getSheet(u),f=o.search(n),f&&f.searchFoundFlag!==e)return f.foundSheetIndex=u,f;return new t.SearchResult},s.prototype.showCell=function(n,t,i,r){var u=this.getActiveSheet();u&&u.showCell(n,t,i,r)},s.prototype.showColumn=function(n,t){var i=this.getActiveSheet();i&&i.showColumn(n,t)},s.prototype.showRow=function(n,t){var i=this.getActiveSheet();i&&i.showRow(n,t)},s.prototype.showActiveCell=function(n,t){var i=this.getActiveSheet();i&&i.showCell(i._activeRowIndex,i._activeColIndex,n,t)},s.prototype.getCustomName=function(n){return this._names?this._names[n.toUpperCase()]:i},s.prototype.getCustomNames=function(){var n=[];return this._names&&t.GC$.each(this._names,function(t,i){n.push(i)}),n},s.prototype.addCustomName=function(n,t,i,r){this._addCustomNameCore(n,t,i,r,!1)},s.prototype._addCustomNameCore=function(n,r,f,e,o){var s,c,l,a,v,h;if(n===u||n===i||n===""||r===u||r===i||r==="")throw new Error(t.SR.Exp_InvalidCustomName);if(s=this,s._names||(s._names={}),s.calcService){if(c=this.getActiveSheet(),l=c?c._getSheetSource():i,o)try{a=s.calcService.parse(l,r,f,e,!1,!0)}catch(y){}else a=s.calcService.parse(l,r,f,e);v=n.toUpperCase();s._names[v]=new t.NameInfo(n,a,f,e);h=s._spreadSourceModel._getNameCalc(v,!0);h&&(h.updateListening(!0,!0),h.addToDirty());s._recalcAll()}},s.prototype.removeCustomName=function(n){var t=this,r,e,f;t._names&&n!==u&&n!==i&&n!==""&&(r=n.toUpperCase(),t._names[r]&&(delete t._names[r],e=t._spreadSourceModel,e&&(f=e._getNameCalc(r),f&&(f.updateListening(!0,!1),f.addToDirty())),t._recalcAll()))},s.prototype.clearCustomNames=function(){var i,t,r,n;if(this._names){if(i=this._names,delete this._names,t=this._spreadSourceModel,t)for(r in i)n=t._getNameCalc(r),n&&(n.updateListening(!0,!1),n.addToDirty());this._recalcAll()}},s.prototype._findCustomName=function(n){if(n===u||n===i||n==="")return i;return this.getCustomName(n)},s.prototype.addCustomFunction=function(n){this._addCustomFunctionCore(n);this._recalcAll()},s.prototype._addCustomFunctionCore=function(n){if(t.util.hasCalc()){if(n===u||n===i||!(n instanceof t.Calc.Functions.Function))throw new Error(t.SR.Exp_InvalidCustomFunction);var r=this,f=n.name.toUpperCase();r._functions||(r._functions={});r._functions[f]=n}},s.prototype.getCustomFunction=function(n){return this._functions&&n!==u&&n!==i&&n!==""?this._functions[n.toUpperCase()]:i},s.prototype.removeCustomFunction=function(n){var t=this;t._functions&&n!==u&&n!==i&&n!==""&&(n=n.toUpperCase(),t._functions.hasOwnProperty(n)&&(delete t._functions[n],t._recalcAll()))},s.prototype.clearCustomFunctions=function(){this._functions&&(this._functions=i,this._recalcAll())},s.prototype._recalcAll=function(){var n,t;this.calcService&&!this.calcService.IsSuspended()&&(n=this.getActiveSheet(),n&&(t=n.isPaintSuspended(),n.isPaintSuspended(!0),this.calcService.recalculateAll(),n.isPaintSuspended(t)))},s.prototype.getCalcService=function(){return this.calcService},s.prototype.addCustomFunctionDescription=function(n){if(n&&n.name&&!this.getCustomFunctionDescription(n.name)){var t=this._functionDescriptions;t||(t=this._functionDescriptions=[]);t.push(n)}},s.prototype.getCustomFunctionDescription=function(n){var u=this._functionDescriptions,f,t,r;if(u&&n)for(n=n.toUpperCase(),f=u.length,r=0;r<f;r++)if(t=u[r],t.name&&t.name.toUpperCase()===n)return t;return i},s.prototype.removeCustomFunctionDescription=function(n){var i=this._functionDescriptions,u,r,t;if(i&&n)for(n=n.toUpperCase(),u=i.length,t=0;t<u;t++)if(r=i[t],r.name&&r.name.toUpperCase()===n){i.splice(t,1);break}},s.prototype.clearCustomFunctionDescriptions=function(){this._functionDescriptions&&(this._functionDescriptions=i)},s.prototype.referenceStyle=function(n){var t=this,i=1,r=0;return arguments.length===0?t.calcService?t.calcService.useR1C1?i:r:r:(t.calcService&&(t.calcService.useR1C1=n===i),t)},s.prototype.bind=function(n,i,r){var u=this,f,e;for(u._userEvents.push({type:n,data:i,fn:r}),t.GC$(u._userEventsElem).bind(n+a,i,r),f=0;f<u.sheets.length;f++)e=u.sheets[f],e.bind(n,i,r)},s.prototype.unbind=function(n,i){for(var e,f,o,r=this,u=0;u<r._userEvents.length;u++)e=r._userEvents[u],e.type===n&&r._userEvents.splice(u,1);for(t.GC$(r._userEventsElem).unbind(n+a,i),f=0;f<r.sheets.length;f++)o=r.sheets[f],o.unbind(n,i)},s.prototype.unbindAll=function(){var n=this,i,r;for(n._userEvents.length=0,t.GC$(n._userEventsElem).unbind(a),i=0;i<n.sheets.length;i++)r=n.sheets[i],r.unbindAll()},s.prototype._bind=function(n,i,r){var u=this,f,e;for(u._userEvents.push({type:n,data:i,fn:r}),t.GC$(u._userEventsElem).bind(n+ft,i,r),f=0;f<u.sheets.length;f++)e=u.sheets[f],e._bind(n,i,r)},s.prototype._unbind=function(n,i){for(var e,f,o,r=this,u=0;u<r._userEvents.length;u++)e=r._userEvents[u],e.type===n&&r._userEvents.splice(u,1);for(t.GC$(r._userEventsElem).unbind(n+ft,i),f=0;f<r.sheets.length;f++)o=r.sheets[f],o._unbind(n,i)},s.prototype._unbindAll=function(){var n=this,i,r;for(n._userEvents.length=0,t.GC$(n._userEventsElem).unbind(ft),i=0;i<n.sheets.length;i++)r=n.sheets[i],r._unbindAll()},s.prototype.suspendEvent=function(){var n,t;for(this._eventSuspended++,n=0;n<this.sheets.length;n++)t=this.sheets[n],t.suspendEvent()},s.prototype.resumeEvent=function(){var n=this,t,i;for(n._eventSuspended--,n._eventSuspended<0&&(n._eventSuspended=0),t=0;t<n.sheets.length;t++)i=n.sheets[t],i.resumeEvent()},s.prototype.doCommand=function(n){this._undoManager.doAction(n)},s.prototype.allowUndo=function(n){var t=this;return arguments.length===0?t._allowUndo:(t._allowUndo=n,t._undoManager&&(t._undoManager._allowUndo=n),t)},s.prototype.undoManager=function(){var n=this;return n._undoManager||(n._undoManager=new t._UndoManager(n,-1,n.allowUndo())),n._undoManager},s.prototype.canUserDragDrop=function(n){return arguments.length===0?this._allowDragDrop:(this._allowDragDrop=n,this)},s.prototype.canUserDragFill=function(n){var u=this,r;return arguments.length===0?t.features.fill?u._allowDragFill:!1:(u._allowDragFill!==n&&(u._allowDragFill=n,r=u.getActiveSheet(),r&&(r._dragFillIndicatorRect=i,r.getSelections().length!==1||r._paintSuspended||r._render.repaintSelection(r.getSelections()[0]))),u)},s.prototype.showDragFillSmartTag=function(n){var t=this;return arguments.length===0?t._showDragFillSmartTag:(typeof n=="boolean"&&t._showDragFillSmartTag!==n&&(t._showDragFillSmartTag=n),t)},s.prototype.defaultDragFillType=function(n){var i=this;return arguments.length===0?i._defaultDragFillType:(t.AutoFillType[n]!==u&&n!==4&&n!==i._defaultDragFillType&&(i._defaultDragFillType=n),i)},s.prototype.toJSON=function(n){var r=this,w=r.getSheetCount(),b={activeSheetIndex:r.getActiveSheetIndex(),sheetCount:w,tabStripRatio:r.getTabStripRatio(),tabStripVisible:r._tabStripVisible,tabEditable:r._tabEditable,newTabVisible:r._newTabVisible,referenceStyle:r.referenceStyle(),canUserEditFormula:r._canUserEditFormula,startSheetIndex:r.startSheetIndex(),allowUndo:r._allowUndo,allowUserZoom:r._allowUserZoom,allowUserResize:r._allowUserResize,allowDragDrop:r._allowDragDrop,allowDragFill:r._allowDragFill,showDragFillSmartTag:r._showDragFillSmartTag,defaultDragFillType:r._defaultDragFillType,allowSheetReorder:r._allowSheetReorder,highlightInvalidData:r._highlightInvalidData,autoFitType:r._autoFitType,showScrollTip:r._showScrollTip,showResizeTip:r._showResizeTip,showDragDropTip:r._showDragDropTip,showDragFillTip:r._showDragFillTip,scrollIgnoreHidden:r._scrollIgnoreHidden,showHorizontalScrollbar:r._showHorizontalScrollbar,showVerticalScrollbar:r._showVerticalScrollbar,scrollbarMaxAlign:r._scrollbarMaxAlign,scrollbarShowMax:r._scrollbarShowMax,backColor:r._backColor,backgroundImage:r._backgroundImage,backgroundImageLayout:r._backgroundImageLayout,grayAreaBackColor:r._grayAreaBackColor,cutCopyIndicatorVisible:r._cutCopyIndicatorVisible,cutCopyIndicatorBorderColor:r._cutCopyIndicatorBorderColor,useTouchLayout:r._useTouchLayout,hideSelection:r._hideSelection,customFunctions:r._functions,resizeZeroIndicator:r._resizeZeroIndicator,tabNavigationVisible:r._tabNavigationVisible},u={version:t.productInfo.productVersion},y,e,o,s,h,f,c,p,a,g,nt,v;for(f in b)y=b[f],r._isDefaultValue(f,y)||(u[f]=y);for(e={},o=0;o<w;o++)s=r.getSheet(o),e[s._name]=s.toJSON(n),e[s._name].index=o;if(t.GC$.isEmptyObject(e)||(u.sheets=e),h=[],r._namedStyles)for(f in r._namedStyles)h.push(r._namedStyles[f]);if(h.length>0&&(u.namedStyles=h),c=[],r._names&&r.calcService)for(p in r._names)if(r._names.hasOwnProperty(p)){var l=r._names[p],tt=l.getName(),k=l.getRow(),d=l.getColumn(),it=l.getExpression(),rt=r.calcService.unparseWithoutCulture(i,it,k,d,!0);c.push({name:tt,formula:rt,row:k,col:d})}c.length>0&&(u.names=c);a=[];for(g in r._sparklineExs)nt=r._sparklineExs[g],v=nt.toJSON(),v&&v.typeName&&a.push(v);return a.length>0&&(u.sparklineExs=a),u},s.prototype._isDefaultValue=function(n,t){switch(n){case"activeSheetIndex":return t===this._defaultActiveSheetIndex;case"sheetCount":return t===this._defaultSheetCount;case"tabStripRatio":return t===.5;case"tabStripVisible":return t===!0;case"tabEditable":return t===!0;case"newTabVisible":return t===!0;case"referenceStyle":return t===0;case"canUserEditFormula":return t===!0;case"startSheetIndex":return t===0;case"allowUndo":return t===!0;case"allowUserZoom":return t===!0;case"allowUserResize":return t===!0;case"allowDragDrop":return t===!0;case"allowDragFill":return t===!0;case"showDragFillSmartTag":return t===!0;case"defaultDragFillType":return t===5;case"allowSheetReorder":return t===!0;case"highlightInvalidData":return t===!1;case"autoFitType":return t===0;case"showScrollTip":return t===0;case"showResizeTip":return t===0;case"showDragDropTip":return t===!0;case"showDragFillTip":return t===!0;case"scrollIgnoreHidden":return t===!1;case"showHorizontalScrollbar":return t===!0;case"showVerticalScrollbar":return t===!0;case"scrollbarMaxAlign":return t===!1;case"scrollbarShowMax":return t===!0;case"backColor":return t==="white";case"backgroundImage":return t===i;case"backgroundImageLayout":return t===0;case"cutCopyIndicatorVisible":return t===!0;case"cutCopyIndicatorBorderColor":return t==="#217346";case"useTouchLayout":return t===!1;case"hideSelection":return t===!1;case"resizeZeroIndicator":return t===1;case"tabNavigationVisible":return t===!0;default:return!1}},s.prototype.fromJSON=function(f){var e,a,ct,lt,w,b,k,it,d,l,g,s,o,p,nt,at,rt,ut,ft,et,c,ot,st,ht,v,h,y,tt;if(f){e=this;a=e._getJsonDataVersion(f)<3;e._suspendSetFocus=!0;ct=e.isPaintSuspended();e.isPaintSuspended(!0);e.suspendEvent();lt=n.Sheets.Culture();n.Sheets.switchCulture("");try{if(e._initCalcService(),e._availableSheetIndex=-1,e.clearSheets(),w=f.sheetCount,typeof w===r&&(w=e._defaultSheetCount),e._setSheetCountImp(w,0),f.referenceStyle!==i&&f.referenceStyle!==u&&e.referenceStyle(f.referenceStyle),e._names={},e._namedStyles={},f.namedStyles)for(o=0;o<f.namedStyles.length;o++)b=f.namedStyles[o],k=new t.Style,k.fromJSON(b,a),typeof b.validator!==r&&(t.features.dataValidator&&(it=new n.Sheets.DefaultDataValidator,it.fromJSON(b.validator,a)),k.validator=it),e._addNamedStyleImp(k,!1);if(o=0,l=f.sheets,l)for(v in l)typeof v=="string"&&(h=l[v],y=h.index!==u?h.index:h._index,d=y!=u?e.sheets[y]:e.sheets[o],d.fromJSON(h,!1,a),o++);if(g=f.activeSheetIndex,typeof g===r&&(g=e._defaultActiveSheetIndex),e._setActiveSheetIndexImp(g,0),typeof f.tabStripRatio!==r&&e.setTabStripRatio(f.tabStripRatio),typeof f.tabStripVisible!==r&&(e._tabStripVisible=f.tabStripVisible),typeof f.tabEditable!==r&&(e._tabEditable=f.tabEditable),typeof f.newTabVisible!==r&&(e._newTabVisible=f.newTabVisible),e.gcSpreadsheet=f.gcSpreadsheet,typeof f.canUserEditFormula!==r&&(e._canUserEditFormula=f.canUserEditFormula),typeof f.startSheetIndex!==r&&e.startSheetIndex(f.startSheetIndex),typeof f.allowUndo!==r&&e.allowUndo(f.allowUndo),typeof f.allowUserZoom!==r&&(e._allowUserZoom=f.allowUserZoom),typeof f.allowUserResize!==r&&(e._allowUserResize=f.allowUserResize),s=e.sheets,typeof f.allowDragDrop!==r&&(e._allowDragDrop=f.allowDragDrop,s&&s.length>0))for(o=0;o<s.length;o++)s[o]._allowDragDrop=e._allowDragDrop;if(typeof f.allowDragFill!==r&&(e._allowDragFill=f.allowDragFill,s&&s.length>0))for(o=0;o<s.length;o++)s[o]._allowDragFill=e._allowDragFill;if(typeof f.showDragFillSmartTag!==r&&(e._showDragFillSmartTag=f.showDragFillSmartTag,s&&s.length>0))for(o=0;o<s.length;o++)s[o]._showDragFillSmartTag=e._showDragFillSmartTag;if(typeof f.defaultDragFillType!==r&&(e._defaultDragFillType=f.defaultDragFillType,s&&s.length>0))for(o=0;o<s.length;o++)s[o]._defaultDragFillType=e._defaultDragFillType;if(typeof f.allowSheetReorder!==r&&(e._allowSheetReorder=f.allowSheetReorder),typeof f.highlightInvalidData!==r&&(e._highlightInvalidData=f.highlightInvalidData),typeof f.autoFitType!==r&&e.autoFitType(f.autoFitType),typeof f.showResizeTip!==r&&(e._showResizeTip=f.showResizeTip),typeof f.showScrollTip!==r&&(e._showScrollTip=f.showScrollTip),typeof f.showDragDropTip!==r&&(e._showDragDropTip=f.showDragDropTip),typeof f.showDragFillTip!==r&&(e._showDragFillTip=f.showDragFillTip),typeof f.scrollIgnoreHidden!==r&&(e._scrollIgnoreHidden=f.scrollIgnoreHidden),typeof f.showHorizontalScrollbar!==r&&(e._showHorizontalScrollbar=f.showHorizontalScrollbar),typeof f.showVerticalScrollbar!==r&&(e._showVerticalScrollbar=f.showVerticalScrollbar),typeof f.scrollbarMaxAlign!==r&&(e._scrollbarMaxAlign=f.scrollbarMaxAlign),typeof f.scrollbarShowMax!==r&&(e._scrollbarShowMax=f.scrollbarShowMax),typeof f.backColor!==r&&(e._backColor=f.backColor),typeof f.backgroundImage!==r&&e.backgroundImage(f.backgroundImage),typeof f.backgroundImageLayout!==r&&e.backgroundImageLayout(f.backgroundImageLayout),typeof f.grayAreaBackColor!==r&&(e._grayAreaBackColor=f.grayAreaBackColor),typeof f.cutCopyIndicatorVisible!==r&&(e._cutCopyIndicatorVisible=f.cutCopyIndicatorVisible),typeof f.cutCopyIndicatorBorderColor!==r&&(e._cutCopyIndicatorBorderColor=f.cutCopyIndicatorBorderColor),typeof f.useTouchLayout!==r&&(e._useTouchLayout=f.useTouchLayout),typeof f.hideSelection!==r&&e.hideSelection(f.hideSelection),typeof f.resizeZeroIndicator!==r&&(e._resizeZeroIndicator=f.resizeZeroIndicator),typeof f.tabNavigationVisible!==r&&(e._tabNavigationVisible=f.tabNavigationVisible),e.calcService&&e.calcService.suspend(),e.clearCustomNames(),f.names)for(c=0;c<f.names.length;c++)p=f.names[c],e._addCustomNameCore(p.name,p.formula,p.row,p.col,!0);if(e.clearCustomFunctions(),nt=f.customFunctions,nt)for(at in nt)rt=nt[at],ut=t.getTypeFromString(rt.typeName),ut&&(ft=new ut,ft.fromJSON(rt,a),e._addCustomFunctionCore(ft));if(et=f.sparklineExs,et)for(c=0;c<et.length;c++)ot=f.sparklineExs[c],st=t.getTypeFromString(ot.typeName),st&&(ht=new st,ht.fromJSON(ot),e.addSparklineEx(ht));if(l){o=0;for(v in l)typeof v=="string"&&(h=l[v],y=h.index!==u?h.index:h._index,d=y!=u?e.sheets[y]:e.sheets[o],d.formulaFromJSON(h,a),o++)}e.calcService&&(f.noRecalc?e.calcService.resumeWithoutCalc():e.calcService.resume(!0))}finally{n.Sheets.switchCulture(lt);e._suspendSetFocus=!1;tt=e.getActiveSheet();tt&&t.FocusHelper.isActiveElement(tt)&&tt.setFocus();e.resumeEvent();e._doResize();e.isPaintSuspended(ct)}}},s.prototype._getJsonDataVersion=function(n){var r=n.version,t,i,u;if(!r||!(typeof r=="string")||(t=r.split("."),!t||t.length===0))return 1;if(t.length>3)return 3;if(i=parseFloat(t[0]),t.length<=2)return isNaN(i)?1:i;else{if(u=parseFloat(t[1]),i>=3)if(u>=20143)return 3;else if(u>=20142)return 2;return 1}},s.prototype.setTabStripRatio=function(n,i){var r,o;if(isNaN(r=n))throw t.SR.Exp_InvalidArgument;var u=this,f=0,e=u._vp;e&&(o=t.GC$(e).width(),f=u._tab._resizeBarWidth/o);u._tabStripRatio=r<f?f:r>1?1:r;u._tabStripRatioUserSet=r<0?0:r>1?1:r;u._doTabHSResize()},s.prototype.getTabStripRatio=function(){return this._tabStripRatioUserSet},s.prototype._getActualTabStripRatio=function(){return this.showHorizontalScrollbar()?this._tabStripRatio:1},s.prototype._setActualTabStripRatio=function(n){this._tabStripRatio=n},s.prototype.showScrollTip=function(n){return arguments.length===0?this._showScrollTip:(this._showScrollTip=n,this)},s.prototype.showResizeTip=function(n){return arguments.length===0?this._showResizeTip:(this._showResizeTip=n,this)},s.prototype.showDragDropTip=function(n){return arguments.length===0?t.util.hasCalc()?this._showDragDropTip:!1:(this._showDragDropTip=n,this)},s.prototype.showDragFillTip=function(n){return arguments.length===0?t.features.fill?this._showDragFillTip:!1:(this._showDragFillTip=n,this)},s.prototype.grayAreaBackColor=function(n){var u,i,r;if(arguments.length===0)return this._grayAreaBackColor?this._grayAreaBackColor:(u=t.ThemeStyleHelper.getContentThemeStyle("gc-grayArea"),u.backgroundColor);if(i=this,r=this.getActiveSheet(),r)return r._bindToAutoRefresh(function(n){return i._grayAreaBackColor=n,i})(n);else i._grayAreaBackColor=n},s.prototype.backColor=function(n){if(arguments.length===0)return this._backColor;var t=this,i=this.getActiveSheet();if(i)return i._bindToAutoRefresh(function(n){return t._backColor=n,t})(n);else t._backColor=n},s.prototype.backgroundImage=function(n){var t=this,i;return arguments.length===0?t._backgroundImage:(i=t.getActiveSheet(),i?i._bindToAutoRefresh(function(n){return t._backgroundImage=n,t._paintSpreadBackgroundImage(),t})(n):(t._backgroundImage=n,t))},s.prototype.backgroundImageLayout=function(n){var t=this;return arguments.length===0?t._backgroundImageLayout:(t._backgroundImageLayout=n,t._paintSpreadBackgroundImage(),t)},s.prototype._findTable=function(n){var r,f,t,e,u;if(!this.sheets||this.sheets.length===0)return i;for(r=this.sheets,f=r.length,t=0;t<f;t++)if(e=r[t],u=e.findTableByName(n),u)return u;return i},s.prototype.addSparklineEx=function(n){var t=this._sparklineExs;n&&t&&(t[n.name()]=n)},s.prototype.getSparklineEx=function(n){var t=this._sparklineExs;return t&&t[n]},s.prototype.removeSparklineEx=function(n){var t=this._sparklineExs;t&&(t[n]=u)},s.prototype.useTouchLayout=function(n){var t=this;return arguments.length===0?t._useTouchLayout:(t._useTouchLayout=n,t._doResize(),t)},s.prototype.focus=function(n){if(n===!1)t.FocusHelper.setActiveElement(i);else{var r=this.getActiveSheet();r&&r.setFocus()}},s.prototype.hideSelection=function(n){var i=this,r;return arguments.length===0?i._hideSelection:(i._hideSelection=n,r=i.getActiveSheet(),n?t.FocusHelper.hideSelection(r):t.FocusHelper.showSelection(r),i)},s.prototype.nextControl=function(n){var t=this;return arguments.length===0?t._nextControl:(t._nextControl=n,t)},s.prototype.previousControl=function(n){var t=this;return arguments.length===0?t._previousControl:(t._previousControl=n,t)},s.prototype.resizeZeroIndicator=function(n){var t=this,i;return arguments.length===0?t._resizeZeroIndicator:(t._resizeZeroIndicator!==n&&(t._resizeZeroIndicator=n,i=t.getActiveSheet(),i&&i.invalidate()),t)},s.prototype._getScrollbarSize=function(){return this._themeVersion>2007?15:18},s.prototype._getVScrollbarContainerWidth=function(){return this._themeVersion>2007?22:this._getScrollbarSize()},s.prototype._getTabStripHeight=function(){return this._themeVersion>2007?28:this._getScrollbarSize()},s.prototype.suspendCalcService=function(n){this.calcService&&this.calcService.suspend(n)},s.prototype.resumeCalcService=function(n){this.calcService&&this.calcService.resume(n)},s.prototype.print=function(n){var t=this._getPrinter();t&&t.print(this,n)},s.prototype._getPrinter=function(){return!this._printer&&t.features.print&&(this._printer=new t.SpreadPrinter),this._printer},s.prototype._trigger=function(n,i){this._eventSuspended===0&&t.GC$(this._userEventsElem).trigger(n,i)},s.prototype.triggerSheetTabClick=function(n){this._trigger(t.Events.SheetTabClick,n)},s.prototype.triggerSheetTabDoubleClick=function(n){this._trigger(t.Events.SheetTabDoubleClick,n)},s.prototype.triggerActiveSheetChanging=function(n){this._trigger(t.Events.ActiveSheetChanging,n)},s.prototype.triggerActiveSheetChanged=function(n){this._trigger(t.Events.ActiveSheetChanged,n)},s.prototype.triggerButtonClicked=function(n){this._trigger(t.Events.ButtonClicked,n)},s}();t.Spread=bi;var k=".gcTab",et=".tabNameEditor",ti=".spliter",y="mouse",ki="down",ii="move",ri="up",di="out",gi="focusin",nr="focusout",tr="keydown",ui=y+ii+ti,fi=y+ri+ti,ei=tr+et,oi=gi+et,si=nr+et,ot=y+ki+k,st=y+ii+k,ht=y+ri+k,ct=y+di+k,lt="dblclick"+k,hi="canvas",at="2d",rt="resizeBar",c="navButton",s="tab",d="newTab",ci="#FFFFFF",cr="#D8E7FA",lr="#D5E5F9",ar="#B6D2F5",vr="#D9E7F9",yr="#688CAF",li="#92A5C7",ai="black",vi="white",l=4,ir="tab-tip-span",vt=function(){function n(n){this._reorderMaxDistance=10;var t=this;t._spread=i;t._activeIndex=0;t._firstTab=0;t._activePos=70;t._hoverNavButton=-1;t._hoverTab=-1;t._font="";t._tabSizes=[];t._targetTabIndex=-1;t._sourceTabIndex=-1;t._reorderSpeedTimeout=i;t._paintSuspended=!1;t._init(n)}return n.prototype._init=function(n){this.setBounds(new t.Rect(0,0,200,28));this.name=n},n.prototype.setHost=function(n){var i=this,r=f.createElement(hi);t.DPIHelper.adjustDevicePixel(r,i._spread);r.setAttribute("id",i.name);i._tabIndicator=i._getTabIndicator();n.appendChild(i._tabIndicator.getElement(0));n.appendChild(r);r.gcObject=!0;i.canvas&&(t.GC$(i.canvas).unbind(ot).unbind(st).unbind(ht).unbind(ct).unbind(lt),i._unbindTouchEvents(),i.canvas.parentNode.removeChild(i.canvas));i.canvas=r;!t.util._isStandardCanvas()&&t.util._isSilverlightCanvas()&&(r.setAttribute("renderMethod","auto"),r.setAttribute("onload",i._test(i)));t.GC$(r).bind(ot,t.util.createEventHandler(i,i.doMouseDown)).bind(st,t.util.createEventHandler(i,i.doMouseMove)).bind(ht,t.util.createEventHandler(i,i.doMouseUp)).bind(ct,t.util.createEventHandler(i,i.doMouseOut)).bind(lt,t.util.createEventHandler(i,i.doMouseDbClick));i._bindTouchEvents();i.doResize()},n.prototype.dispose=function(){this._dispose()},n.prototype.setOwner=function(t){this._spread=t;t&&t._font&&t._font.length>0&&t._font!==n.defaultFont&&(this._font=t._font)},n.prototype.getBounds=function(){var n=this._bounds;return new t.Rect(n.x,n.y,n.width,n.height)},n.prototype.setBounds=function(n){var i=this._bounds=new t.Rect(0,0,0,0);i.x=n.x;i.y=n.y;i.width=n.width;i.height=n.height},n.prototype.getNewTabSize=function(){return this._newTabSize},n.prototype.getTabEndPosition=function(){var n=this.getBounds();return n.x+n.width-this._resizeBarWidth},n.prototype.getTabStartPosition=function(){return 0},n.prototype.doResize=function(){var f=this,n=f._getCanvas(),u,i,r,e;n&&n.parentNode&&(u=t.GC$(n.parentNode),u.width()!==0&&u.height()!==0)&&(i=h(u.width(),0),r=h(u.height(),0),n.style.display=dt,n.width=i,n.height=r,n.style.display="",n.style.width=i+"px",n.style.height=r+"px",i=n.clientWidth||n.width,r=n.clientHeight||n.height,e=f.getBounds(),f.setBounds(new t.Rect(e.x,e.y,i,r)),t.DPIHelper.setSize(n,i,r),f.repaint())},n.prototype.isCoverSheetTab=function(){return!1},n.prototype.getCoverPosition=function(){return 0},n.prototype.getInputTopPosition=function(){return 0},n.prototype.getTabIndicatorEdgeElement=function(){return""},n.prototype.getBasicWidth=function(){return 0},n.prototype._test=function(n){return n._spread.initPaint(n._spread)},n.prototype._getTabIndicator=function(){return t.GC$(f.createElement("div")).css({position:"absolute","border-style":"solid","border-color":ai,"border-width":l,display:"none",width:"0","border-bottom":"0","border-left-color":"transparent","border-right-color":"transparent"})},n.prototype._unbindTouchEvents=function(){this._touchManager&&this._touchManager.unbindTouchEvents()},n.prototype._bindTouchEvents=function(){if(t.features.touch){var n=this,i=new t.TabStripTouchManager(n.canvas,n,n._spread._touchEventProvider);i.bindTouchEvents();n._touchManager=i}},n.prototype._dispose=function(){var n=this,r=n.canvas;r&&(t.GC$(r).unbind(ot).unbind(st).unbind(ht).unbind(lt).unbind(ct),r.parentNode&&r.parentNode.removeChild(r));n._touchManager&&(n._touchManager.unbindTouchEvents(),n._touchManager=i);t.GC$(n._tabIndicator).remove();n._spread=i},n.prototype.hitTest=function(n,t){return{element:""}},n.prototype.doMouseDown=function(n){var o=t.util.device(),l=o.ipad||o.iphone,r,u,y,e;if(!l){if(r=this,r._touchManager&&r._touchManager.preProcessMouseDown(n))return t.util.cancelDefault(n),!1;var h=t.GC$(r._getCanvas()).offset(),a=n.pageX-h.left,v=n.pageY-h.top,f=r._spread.getActiveSheet(),p;if(r._tabNameEditor&&r.endSheetTabEditing(f,!1),u=r.hitTest(a,v),y=t.Events,n.button===0&&(u.element===rt?(r.resizeTab=!0,r.activeX=n.pageX,r.handleDocumentMouseMove()):u.element===c?r.doNavButtonClick(u.index):u.element===s?(r.doSheetTabClick(u.index,u.position),r._initTabReorder(n,u)):u.element===d&&r.doNewTabClick(u.position),f=r._spread.getActiveSheet(),e=f&&f._eventHandler,e&&!f.isEditing()))try{e._tabStripHitTestResult={left:n.pageX,top:n.pageY};f.setFocus()}finally{e._tabStripHitTestResult=i}return r._isMouseDownInTab=!0,!1}},n.prototype.doMouseMove=function(n){var a=t.util.device(),p=a.ipad||a.iphone,i,f,e,v,h,l;if(!p){if(i=this,i._touchManager&&i._touchManager.preProcessMouseMove(n))return t.util.cancelDefault(n),!1;if(f="default",e="w-resize",i._tabStartPos&&!i._reorderSheet&&(v=wi(yt(i._tabStartPos.x-n.pageX,2)+yt(i._tabStartPos.y-n.pageY,2)),v>i._reorderMaxDistance&&(i._reorderSheet=!0)),i.resizeTab){i.canvas.style.cursor=e;var w=n.pageX-i.activeX,o=i._spread._vp.clientWidth,u=i._spread;u.setTabStripRatio(u._getActualTabStripRatio()+w/o,!0);h=i._resizeBarWidth/o;l=1;u._getActualTabStripRatio()<h?(u.setTabStripRatio(h,!0),i.activeX=i._resizeBarWidth):u._getActualTabStripRatio()>=l?(u.setTabStripRatio(l,!0),i.activeX=o):i.activeX=n.pageX}else if(i._reorderSheet)i._showTabTip(n.pageX,n.pageY),i._setTabIndicator(n);else{i._hoverNavButton=-1;i._hoverTab=-1;var y=t.GC$(i._getCanvas()).offset(),b=n.pageX-y.left,k=n.pageY-y.top,r=i.hitTest(b,k);if(r.element==="")return i.canvas.style.cursor=f,i.repaint(),!1;else r.element===rt?i.canvas.style.cursor=e:(i.canvas.style.cursor=f,r.element===c?i._hoverNavButton=r.index:r.element===s?i._hoverTab=r.index:r.element===d&&(i._hoverTab=-2));i.repaint()}return!1}},n.prototype.doMouseUp=function(n){var r=t.util.device(),u=r.ipad||r.iphone,i;if(!u)return(i=this,i._touchManager&&i._touchManager.preProcessMouseUp(n))?(t.util.cancelDefault(n),!1):(i.resizeTab&&(i.resizeTab=!1,i._spread._doTabHSResize()),i._clearSpeedTimeout(),i._reorderSheet&&(i._reorderSheet=!1,i._tabTip.remove(),i._reorderTab(),i._tabIndicator.hide()),i._tabStartPos=null,i._clearRepeatDown(),i.unhandleDocumentMouseMove(),i._isMouseDownInTab?(i._isMouseDownInTab=!1,!1):!0)},n.prototype.doMouseOut=function(n){var r=t.util.device(),e=r.ipad||r.iphone,i,u,f;if(!e)return i=this,i._clearRepeatDown(),u=i._hoverNavButton,i._hoverNavButton=-1,f=i._hoverTab,i._hoverTab=-1,(i._hoverNavButton!==u||i._hoverTab!==f)&&i.repaint(),!1},n.prototype.handleDocumentMouseMove=function(){var n=this,i;n._isCapture||(t.GC$(f).bind(ui,function(t){n.doMouseMove(t)}).bind(fi,function(t){n.doMouseUp(t)}),i=n._spread.getActiveSheet(),i&&(i._continueMouseUpBubble=!0),n._isCapture=!0)},n.prototype.unhandleDocumentMouseMove=function(){if(this._isCapture){this._isCapture=!1;t.GC$(f).unbind(ui).unbind(fi);var n=this._spread.getActiveSheet();n&&delete n._continueMouseUpBubble}},n.prototype.doNavButtonClick=function(n,t){var i=this,r,u;if(i._clearRepeatDown(),r=i._getVisibleTabs(),!(r.length<=0)){u=200;n=n%4;switch(n){case 0:i._navigateToFirst(r);break;case 1:t||(i._repeatDown=window.setTimeout(function(){i.doNavButtonClick(1)},u));i._navigateToPrevious(r);break;case 2:t||(i._repeatDown=window.setTimeout(function(){i.doNavButtonClick(2)},u));i._navigateToNext(r);break;case 3:i._navigateToLast(r);break;default:return}}},n.prototype.doSheetTabClick=function(n,i){var r=this,o=t.Events,f,e,u;(r._activeIndex=n,r._activePos=i,f=r._spread.isPaintSuspended(),r._spread.isPaintSuspended(!0),e=r._spread.getActiveSheet(),u=r._spread.getSheet(n),u&&u.isEditing()&&u!==e&&!u.endEdit())||(r._spread.triggerSheetTabClick({sheet:u,sheetName:u._name,sheetTabIndex:n}),r._doSheetTabClickChange(n),r._spread.isPaintSuspended(f),r.repaint())},n.prototype.doNewTabClick=function(n){var r=this,h=t.Events,u=r._spread,f=u.getActiveSheet(),e,o,s;if((!f||!f._formulaTextBox||!f._formulaTextBox.canAppendRange())&&(u.triggerSheetTabClick({sheet:i,sheetName:i,sheetTabIndex:-1}),e=u.sheets.length,o=u._createSheet(u._getDefaultSheetName(e)),u._addSheetImp(e,1,o),r._activeIndex=e,r._activePos=n,s={oldSheet:f,newSheet:o,cancel:!1},u.triggerActiveSheetChanging(s),s&&s.cancel===!1)){for(u._setActiveSheetIndexImp(e,1),u.triggerActiveSheetChanged({oldSheet:f,newSheet:o});r._activeIndex>r._firstTab&&r.isCoverSheetTab();)u.sheets[r._firstTab].visible()&&(r._activePos-=r._tabSizes[r._firstTab]),r._firstTab++;r.repaint()}},n.prototype._doSheetTabClickChange=function(n,i){var u,f;typeof i=="undefined"&&(i=!0);var r=this,s=t.Events,e=r._spread.getSheet(n),o=r._spread.getActiveSheet();n!==r._spread._activeSheetIndex&&(u={oldSheet:o,newSheet:e,cancel:!1},r._spread.triggerActiveSheetChanging(u),u&&u.cancel===!1&&(r._spread._setActiveSheetIndexImp(n,1),this._spread.triggerActiveSheetChanged({oldSheet:o,newSheet:e}),f=r._getNextVisibleIndex(r._firstTab),r._activeIndex>r._firstTab&&r._activePos+r._tabSizes[r._activeIndex]>r.getCoverPosition()&&f!=-1&&(r._firstTab=f)));r._activeIndex<r._firstTab&&(r._firstTab=r._getPreVisibleIndex(r._firstTab))},n.prototype._doMouseDbClickImp=function(n,r){var u=this,p=u.hitTest(n,r),a,l,v;if(p.element===s){if(a=u._activeIndex,l=u._spread.sheets[a],u._spread.triggerSheetTabDoubleClick({sheet:l,sheetName:l._name,sheetTabIndex:a}),!u._spread._tabEditable)return!1;if(v=t.FocusHelper.getActiveElement(),v&&v.endEdit&&!v.endEdit())return;t.FocusHelper.setActiveElement(i);var w=u._tabSizes[a],y=t.GC$(u._getCanvas()).offset(),h=f.createElement(bt),c=h.style;h.type="text";h.value=l._name;h.setAttribute("contentEditable","true");h.setAttribute("autocomplete","off");c.position="absolute";c.margin=o;c.padding=o;c.margin=o;c.left=y.left+u._activePos+u._tabLeftPadding+e;c.top=y.top+u.getInputTopPosition()+e;c.width=w-u._tabLeftPadding-u._tabRightPadding+2+e;c.backgroundColor=vi;c.borderWidth="0px";c.outline=dt;f.body.insertBefore(h,i);u._tabNameEditor=h;t.GC$(h).addClass("sheetTabEditor").bind(ei,function(n){if(n.keyCode===13)return u.endSheetTabEditing(l,!1),!1;else if(n.keyCode===27)return u.endSheetTabEditing(l,!0),!1}).bind(oi,function(n){h.selectionStart=0;h.selectionEnd=h.value.length}).bind(si,function(n){u.endSheetTabEditing(l,!1)});h.focus()}return!1},n.prototype.doMouseDbClick=function(n){var f=t.util.device(),u=f.ipad||f.iphone,i,r;if(!u&&(i=this._spread.getActiveSheet(),!i._isTouchMode)){if(u=i._formulaTextBox&&i._formulaTextBox.canAppendRange(),r=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,u)return;else r&&r.dom&&r.clear();var e=t.GC$(this._getCanvas()).offset(),o=n.pageX-e.left,s=n.pageY-e.top;return this._doMouseDbClickImp(o,s)}},n.prototype.endSheetTabEditing=function(n,r){var e=this,f,o,s,h,c;e._tabNameEditor&&(t.GC$(e._tabNameEditor).unbind(ei).unbind(oi).unbind(si),f=e._tabNameEditor.value,r===!1&&(o=n.getName(),f!==o&&(f!==u&&f!==i&&f!==""&&e._isValidSheetName(f)?(s={sheet:n,oldValue:o,newValue:f,cancel:!1},n.triggerSheetNameChanging(s),s&&s.cancel===!1&&(h=new t.UndoRedo.SheetRenameUndoAction(n,f),n._doCommand(h),c={sheet:n,oldValue:o,newValue:f},n.triggerSheetNameChanged(c))):n.triggerInvalidOperation({sheet:n,sheetName:n.getName(),invalidType:5,message:t.SR.Exp_SheetNameInvalid}))),e._tabNameEditor.parentNode.removeChild(e._tabNameEditor),delete e._tabNameEditor)},n.prototype._isValidSheetName=function(n){var t,f,r,e;if(n===u||n===i||n==="")return!1;for(r=0;r<n.length;r++)if(t=n.charAt(r),t==="*"||t===":"||t==="["||t==="]"||t==="?"||t==="\\"||t==="/")return!1;for(f=this._spread.sheets.length,r=0;r<f;r++)if(e=this._spread.sheets[r],n===e._name)return!1;return!0},n.prototype._initTabReorder=function(n,i){var r=this,u=r._spread,f=u&&u.getActiveSheet(),o=f&&f._formulaTextBox,e=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,s=t.features.formulatextbox&&e&&e.text;!this._spread._allowSheetReorder||s||o?r._reorderSheet=!1:(r._sourceTabIndex=i.index,r._tabTip=r._getTabTip(r._sourceTabIndex),r._tabStartPos=new t.Point(n.pageX,n.pageY),r.handleDocumentMouseMove())},n.prototype._getTabTip=function(n){var u=this._spread.sheets,e=u.length,i,r;if(!(n>=e)&&!(n<0))return i=u[n]._name,i||(i="sheet"),r=t.GC$(f.createElement("span")).text(i).css({position:"absolute",cursor:"default","border-radius":"5px",opacity:".7"}),r.addClass("ui-widget-header tab-tip-span btn-primary"),r},n.prototype._clearRepeatDown=function(){this._repeatDown&&(window.clearTimeout(this._repeatDown),this._repeatDown=i)},n.prototype._showTabTip=function(n,i){var r=this,u,e;r._tabTip&&t.GC$("."+ir).length()===0&&(r._tabTip.appendTo(f.body),r._tabTip.hide());u=r._tabTip.width();e=r._tabTip.height();r._tabTip.css({left:n-u/2,top:i-e/2});r._tabTip.show()},n.prototype._setTabIndicator=function(n){var u=this,h=t.GC$(u._getCanvas()),f=h.position(),c=h.offset(),o=n.pageX-c.left,p=n.pageY-c.top,e=u.hitTest(o,p),w=u.getBounds(),a=u.getTabStartPosition(),v=u._spread.sheets.length,y=100,b=w.x+u.getCoverPosition();o>b?u._reorderSpeedTimeout===i&&u._targetTabIndex<v&&(u._reorderSpeedTimeout=setInterval(function(){u._navigateToNext(u._getVisibleTabs());u._targetTabIndex===v?(u._clearSpeedTimeout(),u._tabIndicator.css({left:f.left+u._getLastTabPos()-l,top:f.top-l}),u._tabIndicator.show()):(u._targetTabIndex++,u._tabIndicator.hide())},y)):o<a?u._reorderSpeedTimeout===i&&u._targetTabIndex>0&&(u._reorderSpeedTimeout=setInterval(function(){u._navigateToPrevious(u._getVisibleTabs());u._targetTabIndex===0?(u._clearSpeedTimeout(),u._tabIndicator.css({left:f.left+a-l,top:f.top-l}),u._tabIndicator.show()):(u._targetTabIndex--,u._tabIndicator.hide())},y)):(u._clearSpeedTimeout(),(e.element===s||e.element===u.getTabIndicatorEdgeElement())&&(u._targetTabIndex=e.element===s&&typeof e.index!==r?e.index:u._spread.sheets.length,u._tabIndicator.css({left:f.left+e.position-l,top:f.top-l}),u._tabIndicator.show()))},n.prototype._getLastTabPos=function(){for(var f,n=this,e=n._tabSizes,t=n._getVisibleTabs(),o=n._getVisibleTabIndex(n._firstTab,t),u=0,s=n.getBounds().height,i=n.getTabStartPosition()+n._firstTabSpace,r=o;r<t.length;r++)u=t[r],f=e[u],i+=f,i+=n._tabSpace;return i},n.prototype._clearSpeedTimeout=function(){this._reorderSpeedTimeout!==i&&(window.clearInterval(this._reorderSpeedTimeout),this._reorderSpeedTimeout=i)},n.prototype._reorderTab=function(){var u=this,n=u._targetTabIndex,i=u._sourceTabIndex,f=-1,r,e,t;if(n!==-1&&i!==-1&&i!==n&&i!==n-1&&u._tabIndicator.isVisible()){if(r=u._spread.sheets,e=r[i],i>n){for(t=i;t>n;t--)r[t]=r[t-1];r[n]=e;f=n}else if(i<n-1){for(t=i;t<n-1;t++)r[t]=r[t+1];r[n-1]=e;f=n-1}u._spread._activeSheetIndex=f;u.doResize()}},n.prototype._getVisibleTabs=function(){for(var t=[],n=0;n<this._spread.sheets.length;n++)this._tabVisible(n)&&t.push(n);return t},n.prototype._navigateToFirst=function(n){n.length<=0||this._firstTab!=n[0]&&this._spread.startSheetIndex(n[0])},n.prototype._navigateToPrevious=function(n){var t,i;n.length<=0||(t=this,t._firstTab>n[0]&&(i=t._getPreVisibleIndex(t._firstTab),i!==-1&&t._spread.startSheetIndex(i)))},n.prototype._navigateToNext=function(n){var t,i;n.length<=0||(t=this,t._firstTab<n[n.length-1]&&(i=t._reCalculateFirstTabIndex(n),i!==-1&&t._spread.startSheetIndex(t._getNextVisibleIndex(t._firstTab))))},n.prototype._navigateToLast=function(n){if(!(n.length<=0)&&this._firstTab<n[n.length-1]){var t=this._reCalculateFirstTabIndex(n);t!==-1&&this._spread.startSheetIndex(t)}},n.prototype._reCalculateFirstTabIndex=function(n){var s,f,e;if(n.length<=0)return-1;var t=this,h=t.getBounds(),c=t.getCoverPosition(),r=0,l=t._tabSizes,i,o,v=h.height,a=t.getBasicWidth(),u=t._getVisibleTabIndex(t._firstTab,n);for(u===-1&&(u=0),i=n.length-1;i>=u;i--)if(o=n[i],s=l[o],r+=s,i!==n.length-1&&(r+=t._tabSpace),f=a+r,i!==0&&(f+=t._firstTabSpace),f>c)return e=i+1<n.length?n[i+1]:n[n.length-1],t._firstTab<e?e:-1;return-1},n.prototype._getPreVisibleIndex=function(n){for(var i=this._spread.sheets.length,t=n-1;t>=0;t--)if(this._tabVisible(t))return t;return-1},n.prototype._getNextVisibleIndex=function(n){for(var i=this._spread.sheets.length,t=n+1;t<i;t++)if(this._tabVisible(t))return t;return-1},n.prototype._getVisibleTabIndex=function(n,t){for(var i=0;i<=t.length-1;i++)if(n===t[i])return i;return-1},n.prototype._tabVisible=function(n){return this._spread.sheets[n].visible()},n.prototype.isPaintSuspended=function(n){var t=this;return arguments.length===0?t._paintSuspended:(t._paintSuspended!==n&&(t._paintSuspended=n,n||t.repaint()),t)},n.prototype.repaint=function(n){var i=this._getCanvas();if(i){if(!i.getContext&&t.util._isSilverlightCanvas()&&!i.getContext)return;i.getContext||typeof window.FlashCanvas===r||window.FlashCanvas.initElement(i);i.getContext&&this.paint(i.getContext(at),n)}},n.prototype.paint=function(n,u){var s=this,e,c,v,k,o,it;if(!s._paintSuspended){if(e=s.getBounds(),c=s.canvas,u){if(u.x>=e.x+e.width)return;if(u.y>=e.y+e.height)return;if(u.x+u.width>e.width&&(u.width=e.width-u.x,u.width<=0))return;if(u.y+u.height>e.height&&(u.height=e.height-u.y,u.height<=0))return;if(u.width<=0||u.height<=0)return}if(k=t.util._useDoubleBuffer(),k&&(o=s.buffer,o&&(!o||o.width===c.width&&o.height===c.height)&&(o||o.width===e.width&&o.height===e.height)||(o&&t.DPIHelper.disposeCanvasForSpread(s._spread,o),s.buffer=o=f.createElement(hi),t.DPIHelper.adjustDevicePixel(o,s._spread),t.DPIHelper.setSize(o,e.width,e.height)),!o.getContext))if(t.util._isSilverlightCanvas()){if(!o.getContext)return}else if(typeof window.FlashCanvas!==r&&(it=s._getCanvas(),window.FlashCanvas.initElement(it),!o.getContext))return;if(!(e.width<=0)&&!(e.height<=0)&&(!u||!(u.width<=0||u.height<=0))&&(v=k?s.buffer.getContext(at):n,v.clearRect(0,0,e.width,e.height),v.translate(-e.x,-e.y),s.paintTabs(v,u),v.translate(e.x,e.y),k)){var d=e.x>=0?0:-e.x,nt=e.y>=0?0:-e.y,l=d,a=nt,y,p;u&&(l=e.x+u.x,a=e.y+u.y,e=new t.Rect(l,a,u.width,u.height));d=e.x>=0?e.x:0;nt=e.y>=0?e.y:0;var tt=i,w=t.DPIHelper.getScaleX(c),b=t.DPIHelper.getScaleY(c);c&&w!==1&&(l*=w,a*=b,e.x*=w,e.y*=b,e.width*=w,e.height*=b);try{c?u?(y=h(e.width-l,0),p=h(e.height-a,0)):(y=g(e.width-l,h(c.width-e.x,3)),p=g(e.height-a,h(c.height-e.y,3))):(l=u.x,a=u.y,y=u.width,p=u.height);c?(n.scale(1/w,1/b),n.drawImage(s.buffer,l,a,y,p,d,nt,y,p),n.scale(w,b)):(v=s.buffer.getContext(at),tt=v.getImageData(l,a,y,p))}catch(rt){return}!c&&tt&&e.width>0&&e.height>0&&n.putImageData(tt,d,nt)}}},n.prototype.paintTabs=function(n,i){var r=this,v=r._spread,u,f,e,l,o,a;if(n&&v){u=r.getBounds();n.save();n.font=r._font;i?n.rect(i.x,i.y,i.width,i.height):n.rect(u.x,u.y,u.width,u.height);n.clip();n.beginPath();var s=60,c=r.getTabStartPosition(),h=c;for(n.save(),n.font=t.StyleHelper.setStringFont(n.font,{fontWeight:"bold"}),r._tabSizes=[],e=v.sheets,f=0;f<e.length;f++)s=ut(n.measureText(e[f]._name).width)+r._tabRightPadding+r._tabLeftPadding,r._tabSizes.push(s);if(n.restore(),l=[],o=r._firstTab,o>0&&r._getPreVisibleIndex(o)>=0&&(h+=r._firstTabSpace),o>=0)for(f=o;f<e.length;f++){if(a=e[f].visible(),s=r._tabSizes[f],h>u.x+u.width)break;l.push({i:f,x:h,w:s,t:e[f]._name,visible:a});a&&(h+=s+r._tabSpace)}r.paintBackground(n,u);r.paintNewSheetTab(n,u,h,c);r.paintTab(n,u,l,o,c);r._spread&&r._spread.tabNavigationVisible()&&r.paintNavigationButtons(n,u,c);r.paintResizeBar(n,u);n.beginPath();n.restore()}},n.prototype.paintBackground=function(n,t){},n.prototype.paintNewSheetTab=function(n,t,i,r){},n.prototype.paintTab=function(n,t,i,r,u){var f=this,c=f._spread,l=c.sheets,v=f._hoverTab,s,a,h,e,o;if(f._activeIndex=c.getActiveSheetIndex(),s=f._activeIndex,l.length>0){for(n.save(),n.beginPath(),a=t.x+f.getCoverPosition(),n.rect(u,0,a-u,t.height),n.clip(),h=i.length-1;h>=0;h--)e=i[h],e.i!==s&&e.visible&&f.drawTab(n,e.x,0,e.w,t.height,5,!1,e.i===v,e.t);o=i[s-r];s>=r&&s<l.length&&o&&o.visible&&f.drawTab(n,o.x,0,o.w,t.height,5,!0,!1,o.t);n.restore();n.save();n.beginPath();r>0&&f._getPreVisibleIndex(r)>=0&&f.paintTabBeforeFirstTab(n,t,r,u);n.restore()}},n.prototype.paintTabBeforeFirstTab=function(n,t,i,r){},n.prototype.paintNavigationButtons=function(n,t,i){},n.prototype.paintResizeBar=function(n,t){},n.prototype.drawNavButton=function(n,t,i,r,u,f,e,o,s,h){},n.prototype.drawTab=function(n,t,i,r,u,f,e,o,s){},n.prototype._getCanvas=function(){var n=this.canvas;return n&&!n.getContext&&n.firstChild&&(n.getContext=n.firstChild.getContext),n},n.prototype._getTabStripBackColor=function(n,i){var r=n.createLinearGradient(i.x,i.y,i.width,i.height),u=t.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-tabStripBackground"),e=u&&u.backgroundImage,h=u&&u.backgroundColor,o,f,c,s;if(e&&e.indexOf("linear-gradient")!==-1)for(o=t.util.getLinearGradientColors(e),f=0,c=o.length;f<c;f++)s=o[f],r.addColorStop(s.point,s.color);else h&&(r.addColorStop(0,"#DDDDDD"),r.addColorStop(1,h));return r},n.prototype._getTabBackColor=function(n,i,r,u){var o=this,s=o.getBounds(),f=n.createLinearGradient(s.x+.7*s.height,s.y+0,.7*s.height,s.height),h=o._spread.getSheetFromName(r),a,c,v,y,l,p,e;if(r===""&&o._firstTab>0&&(h=o._spread.getSheet(o._firstTab-1)),h&&h._sheetTabColor)a="rgba(0, 0, 0, 0)",n.fillStyle=a,n.fillStyle=t._ThemeContext.getColor(h,h._sheetTabColor),e=n.fillStyle,e!==a&&(i?(f.addColorStop(0,ci),f.addColorStop(.45,"#F1F6FD"),f.addColorStop(.9,e),f.addColorStop(1,ci)):f=e);else if(u)if(c=u&&u.backgroundImage,v=u&&u.backgroundColor,c&&c.indexOf("linear-gradient")!==-1)for(y=t.util.getLinearGradientColors(c),l=0,p=y.length;l<p;l++)e=y[l],f.addColorStop(e.point,e.color);else v&&f.addColorStop(0,v);return f},n.prototype._getTabForeColor=function(n,i){var r=ai,u;return n&&(r=n.color),i&&(u=t._Color.parse(i),u&&u.getBrightness()<255/2&&(r=vi)),r},n.defaultFont="10pt Arial",n}();t._GcTabBase=vt;yi=function(n){function r(t){n.call(this,t);var i=this;i._tabLeftPadding=12;i._tabRightPadding=8;i._tabSpace=3;i._resizeBarWidth=12;i._newTabSize=48;i._firstTabSpace=5;i._font="10pt Arial"}return __extends(r,n),r.prototype._getNavigationButtonWidth=function(){var n=this._spread,t;return!n||!n.tabNavigationVisible()?0:(t=0,n.useTouchLayout()?n._getScrollbarSize()*2:n._getScrollbarSize())},r.prototype._getNavigationButtonHeight=function(){var n=this._spread;return!n||!n.tabNavigationVisible()?0:n._getScrollbarSize()},r.prototype.getTabStartPosition=function(){return this._getNavigationButtonWidth()*4+this._getTabMarginLeft()},r.prototype._getTabMarginLeft=function(){var t=this,n=t._spread;return!n||!n.tabNavigationVisible()?0:2},r.prototype.hitTest=function(n,t){var i=this,f=i.getBounds(),o,e;if(f.x+f.width-i._resizeBarWidth<n&&n<f.x+f.width&&i._spread.showHorizontalScrollbar())return{element:rt};var h=-1,r=0,u,l=i._getNavigationButtonWidth(),a,v;for(a=0,v=4,u=a;u<v;u++){if(r<n&&n<r+l){h=u;break}r+=l}if(h!==-1)return{element:c,index:u};if(r=i.getTabStartPosition(),o=i._getPreVisibleIndex(i._firstTab),o!==-1){if(r<n&&n<r+i._firstTabSpace+i._tabSpace)return{element:s,index:o,position:r};r+=i._firstTabSpace}if(e=0,i._firstTab>-1)for(u=i._firstTab;u<i._spread.sheets.length&&u<i._tabSizes.length;u++)if(i._spread.sheets[u].visible()){if(e=i._tabSizes[u],r<n&&n<r+e+i._tabSpace)return{element:s,index:u,position:r};r+=e+i._tabSpace}return i._spread._newTabVisible&&n>r&&n<r+i.getNewTabSize()?{element:d,position:r}:{element:""}},r.prototype.isCoverSheetTab=function(){var n=this;return n._activePos+n._tabSizes[n._activeIndex]+n.getNewTabSize()>n.getCoverPosition()},r.prototype.getCoverPosition=function(){return this.getBounds().width-this._resizeBarWidth},r.prototype.getInputTopPosition=function(){return 1},r.prototype.getTabIndicatorEdgeElement=function(){return d},r.prototype.getBasicWidth=function(){var n=this,i=n.getBounds().height,t=n.getTabStartPosition()+i;return n._spread._newTabVisible&&(t+=n.getNewTabSize(),t+=n._tabSpace),t},r.prototype.paintBackground=function(n,i){var o,f,c,s;n.save();n.beginPath();var r=n.createLinearGradient(i.x,i.y,i.width,i.height),u=t.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-tabStripBackground"),e=u&&u.backgroundImage,h=u&&u.backgroundColor;if(e&&e.indexOf("linear-gradient")!==-1)for(o=t.util.getLinearGradientColors(e),f=0,c=o.length;f<c;f++)s=o[f],r.addColorStop(s.point,s.color);else h&&(r.addColorStop(0,"#DDDDDD"),r.addColorStop(1,h));n.fillStyle=r;n.fillRect(i.x,i.y,i.width,i.height);n.restore()},r.prototype.paintNewSheetTab=function(n,i,r,u){var f=this,e=f._spread;e._newTabVisible&&(f._newTabSize=n.measureText(t.SR.NewTab).width+f._tabLeftPadding,f.drawTab(n,r,0,f.getNewTabSize(),i.height,5,!1,f._hoverTab===-2,t.SR.NewTab))},r.prototype.paintTabBeforeFirstTab=function(n,t,i,r){var u=this,f=i-1,e=u._tabSizes[f];u.drawTab(n,r+u._firstTabSpace-e-u._tabSpace,0,e,t.height,5,u._activeIndex===f,u._hoverTab===f,"")},r.prototype.paintNavigationButtons=function(n,t,r){var o=this;n.fillStyle=li;n.fillRect(t.x,t.y,r-1,t.height);var u=5,s=o._getNavigationButtonWidth(),c=o._getNavigationButtonHeight(),f=s/2,e=c/2,h=o._hoverNavButton;o.drawNavButton(n,f,e,f+u,e+u,f+u,e-u,!0,f-u,h===0);f+=s;o.drawNavButton(n,f,e,f+u,e+u,f+u,e-u,!0,i,h===1);f+=s;o.drawNavButton(n,f,e,f-u,e+u,f-u,e-u,!1,i,h===2);f+=s;o.drawNavButton(n,f,e,f-u,e+u,f-u,e-u,!1,f+4,h===3)},r.prototype.paintResizeBar=function(n,i){var f=this,s=f._spread,r,c,u=f._resizeBarWidth,e=t.ThemeStyleHelper.getVisualStateThemeStyle,o=e(4,"gc-tabStripResizeBarInner"),h=e(0,"gc-tabStripResizeBarOuter");s.showHorizontalScrollbar()&&(r=i.x+i.width-u,n.fillStyle=h.backgroundColor,n.fillRect(r,i.y,u,i.height),n.fillStyle=o.backgroundColor,n.fillRect(r+1,i.y+1,u-2,i.height-2),n.fillStyle=o.color,n.fillRect(r+u/2-1,i.y+4,2,i.height-8))},r.prototype.drawTab=function(n,i,r,u,f,e,o,s,h){var c,l,v,a,y,p;n.save();n.beginPath();n.moveTo(i,r);n.lineTo(i,r+f-e);n.arcTo(i,r+f,i+u,r+f,e);n.lineTo(i+u,r+f);n.lineTo(i+u+f,r);o||n.lineTo(i,r);c=this;l=0;(o||s)&&(l=4);v=t.ThemeStyleHelper.getVisualStateThemeStyle(l,"gc-tab-"+t.VisualState[l].toLowerCase());a=c._getTabBackColor(n,o||s,h,v);n.fillStyle=a;n.fill();n.strokeStyle=li;n.stroke();n.textBaseline=kt;typeof a=="string"&&(y=a);n.fillStyle=c._getTabForeColor(v,y);p=c._tabLeftPadding;n.textBaseline="middle";n.fillText(h,i+p,r+f/2);n.restore()},r.prototype.drawNavButton=function(n,r,f,e,o,s,c,l,a,v){var b,d,nt,k,et,tt;n.save();var it=this,y=it.getBounds(),w=it._getNavigationButtonWidth(),rt=t.ThemeStyleHelper.getVisualStateThemeStyle,ut=rt(4,"gc-navButton-hover"),p=rt(0,"gc-navButton-normal"),ft=p&&p.backgroundColor;if(v)n.fillStyle=ut.backgroundColor,n.fillRect(r-w/2+2,y.y+2,w-4,y.height-4);else{if(b=p&&p.backgroundImage,b&&b.indexOf("linear-gradient")!==-1){for(d=n.createLinearGradient(y.x+.7*y.height,y.y+0,.7*y.height,y.height),nt=t.util.getLinearGradientColors(b),k=0,et=nt.length;k<et;k++)tt=nt[k],d.addColorStop(tt.point,tt.color);n.fillStyle=d}else ft&&(n.fillStyle=ft);n.fillRect(r-w/2,y.y+1,w,y.height-2)}n.fillStyle=v?ut.color:p.color;a!==u&&a!==i&&n.fillRect(a,g(o,c),1,h(o,c)-g(o,c));l?(r-=2,e-=2,s-=2):(r+=2,e+=2,s+=2);n.beginPath();n.moveTo(r,f);n.lineTo(e,o);n.lineTo(s,c);n.lineTo(r,f);n.fill();n.restore()},r}(vt);pi=function(n){function r(t){n.call(this,t);var i=this;i._tabLeftPadding=13;i._tabRightPadding=12;i._tabSpace=0;i._resizeBarWidth=30;i._itemWidth=28;i._moreTabWidth=28;i._newTabSize=28;i._firstTabSpace=0;i._font="10pt Segoe UI"}return __extends(r,n),r.prototype._getNavigationButtonWidth=function(){var n=this._spread;return!n||!n.tabNavigationVisible()?0:this._itemWidth},r.prototype._getNavigationButtonHeight=function(){var n=this._spread;return!n||!n.tabNavigationVisible()?0:n._getTabStripHeight()},r.prototype._getFirstMoreTabWidth=function(){return this._moreTabWidth},r.prototype._getSecondMoreTabWidth=function(){return this._hideNewTabSecondMoreTab?0:this._moreTabWidth},r.prototype.getNewTabSize=function(){return this._hideNewTabSecondMoreTab?0:this._newTabSize},r.prototype.getTabEndPosition=function(){for(var n=this,r=n._spread.sheets,t=n.getTabStartPosition(),e=n._tabSizes,u=n.getBounds(),f=u.x+u.width-n._resizeBarWidth-n.getNewTabSize()-n._getSecondMoreTabWidth(),i=n._firstTab,o=r.length;i<o;i++)if(r[i].visible()&&(t+=e[i]),t>f){t=f;break}return t},r.prototype.getTabStartPosition=function(){var n=this;return n._getNavigationButtonWidth()*2+n._getFirstMoreTabWidth()+n._getNavigationMarginLeft()},r.prototype._getNavigationMarginLeft=function(){var n=this,t=n._spread;return!t||!t.tabNavigationVisible()?0:n._resizeBarWidth/2},r.prototype.hitTest=function(n,t){var i=this,p=i._getFirstMoreTabWidth(),h=i._getSecondMoreTabWidth(),f=i.getBounds(),e,o;if(f.x+f.width-i._resizeBarWidth<n&&n<f.x+f.width&&i._spread.showHorizontalScrollbar())return{element:rt};var l=-1,r=i._resizeBarWidth/2,u,a=i._getNavigationButtonWidth(),v,y;for(v=1,y=3,u=v;u<y;u++){if(r<n&&n<r+a){l=u;break}r+=a}if(l!==-1)return{element:c,index:u};if(r=i.getTabStartPosition(),r-p<=n&&n<r)return{element:c,index:5,position:r};if(e=0,o=f.x+f.width-i._resizeBarWidth-i.getNewTabSize()-h,i._firstTab>-1)for(u=i._firstTab;u<i._spread.sheets.length&&u<i._tabSizes.length;u++)if(i._spread.sheets[u].visible()){if(e=i._tabSizes[u],n<o&&r<n&&n<r+e+i._tabSpace)return{element:s,index:u,position:r};r+=e+i._tabSpace}return(r>o&&(r=o),r<n&&n<r+h)?{element:c,index:6,position:r}:(r+=h,i._spread._newTabVisible&&r<n&&n<r+i.getNewTabSize())?{element:d,position:r}:{element:""}},r.prototype.isCoverSheetTab=function(){var n=this;return n._activePos+n._tabSizes[n._activeIndex]>n.getCoverPosition()},r.prototype.getCoverPosition=function(){var n=this;return n.getBounds().width-n._resizeBarWidth-n.getNewTabSize()-n._getSecondMoreTabWidth()},r.prototype.getInputTopPosition=function(){return 6},r.prototype.getTabIndicatorEdgeElement=function(){return c},r.prototype.getBasicWidth=function(){return this.getTabStartPosition()},r.prototype.paintBackground=function(n,i){n.save();n.beginPath();var r=t.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-tabStripBackground");this._backgroundColor=t._Color.parse(r.backgroundColor);n.fillStyle=r.backgroundColor;n.fillRect(i.x,i.y,i.width,i.height);n.beginPath();n.strokeStyle=r.borderTopColor;n.moveTo(i.x,i.y+.5);n.lineTo(i.x+i.width,i.y+.5);n.stroke();n.restore()},r.prototype.paintNewSheetTab=function(n,t,i,r){var u=this,h=u._spread,o=u._itemWidth,s=u._getSecondMoreTabWidth(),e,f;i+=s;u._newTabSize=h._newTabVisible?o:0;e=t.x+t.width-u._resizeBarWidth-u.getNewTabSize();i>e&&(i=e,f=e-s,f<r&&(f=r,i=f+o),u.drawMoreTab(n,f,0,s,t.height));h._newTabVisible&&u.drawNewSheetTab(n,i,0,o,t.height,u._hoverTab===-2)},r.prototype.paintTabBeforeFirstTab=function(n,t,i,r){var u=this._getFirstMoreTabWidth();this.drawMoreTab(n,r-u,0,u,t.height)},r.prototype.paintNavigationButtons=function(n,t,r){var e=this,u=5,s=e._getNavigationButtonWidth(),c=e._getNavigationButtonHeight(),f=e._resizeBarWidth/2+s/2,o=c/2,h=e._hoverNavButton;e.drawNavButton(n,f,o,f+u,o+u,f+u,o-u,!0,i,h===1);f+=s;e.drawNavButton(n,f,o,f-u,o+u,f-u,o-u,!1,i,h===2)},r.prototype.paintResizeBar=function(n,i){var r=this,o=r._spread,u,f,e=r._resizeBarWidth,s=t.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-tabStripResizeBarInner");o.showHorizontalScrollbar()&&(n.beginPath(),n.rect(i.x+i.width-e,0,e,i.height),n.clip(),r.paintBackground(n,r.getBounds()),u=i.x+i.width-e/2,f=i.y+i.height/2,n.fillStyle=s.color,n.fillRect(u,f,2,2),n.fillRect(u,f-4,2,2),n.fillRect(u,f+4,2,2))},r.prototype.drawTab=function(n,i,r,u,f,e,o,s,h){var p=this,v=0,l,w,c,a,y,b,k;s&&(v=4);o&&(v=3);l=t.ThemeStyleHelper.getVisualStateThemeStyle(v,"gc-tab-"+t.VisualState[v].toLowerCase());w=t.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-tab-"+t.VisualState[0].toLowerCase());n.save();c=4;a=3;o&&(n.fillStyle="white",n.fillRect(i,r,u,f-c));y=p._getTabBackColor(n,o,h,l);n.fillStyle=y;n.fillRect(i+a,r+a,u-a*2+1,f-a*2);n.beginPath();n.lineWidth=1;n.strokeStyle=w&&w.borderLeftColor;o?(n.moveTo(i+.5,r),n.lineTo(i+.5,r+f-c),n.moveTo(i+u+.5,r),n.lineTo(i+u+.5,r+f-c)):(n.moveTo(i+.5,r+c),n.lineTo(i+.5,r+f-c),n.moveTo(i+u+.5,r+c),n.lineTo(i+u+.5,r+f-c));n.stroke();o&&(n.beginPath(),n.strokeStyle=l&&l.borderBottomColor,n.lineWidth=2,n.moveTo(i,r+f-c),n.lineTo(i+u+1,r+f-c),n.stroke());n.textBaseline=kt;typeof y=="string"&&(b=y);n.fillStyle=p._getTabForeColor(l,b);(s||o)&&(n.font=t.StyleHelper.setStringFont(n.font,{fontWeight:"bold"}));k=p._tabLeftPadding;n.textBaseline="middle";n.fillText(h,i+k,r+f/2-1);n.restore()},r.prototype.drawNavButton=function(n,i,r,u,f,e,o,s,h,c){var v,a,y,p,w,l;n.save();v=this;a=1;c&&(a=4);s?(i-=2,u-=2,e-=2,y=v._getPreVisibleIndex(v._firstTab),y===-1&&(a=0)):(i+=2,u+=2,e+=2,p=v._reCalculateFirstTabIndex(v._getVisibleTabs()),p===-1&&(a=0));w=t.ThemeStyleHelper.getVisualStateThemeStyle(a,"gc-navButton-"+t.VisualState[a].toLowerCase());n.strokeStyle=this.getVisibleForeColor(w.borderTopColor);n.beginPath();l=1;i>u&&(l=-1);n.moveTo(i-.5,r);n.lineTo(i-.5,r+1);n.moveTo(i+l*1-.5,r-1);n.lineTo(i+l*1-.5,r+2);n.moveTo(i+l*2-.5,r-2);n.lineTo(i+l*2-.5,r+3);n.moveTo(i+l*3-.5,r-3);n.lineTo(i+l*3-.5,r+4);n.stroke();n.restore()},r.prototype.drawNewSheetTab=function(n,i,r,u,f,e){var s,o,h;n.save();n.beginPath();s=(f-14)/2;o=1;e&&(o=4);h=t.ThemeStyleHelper.getVisualStateThemeStyle(o,"gc-tabStripNewTab-"+t.VisualState[o].toLowerCase());n.lineWidth=1.5;n.strokeStyle=this.getVisibleForeColor(h.borderTopColor);n.arc(i+u/2,r+f/2,s,0,2*Math.PI);n.stroke();n.beginPath();n.lineWidth=2;n.moveTo(i+u/2-4,r+f/2);n.lineTo(i+u/2+4,r+f/2);n.moveTo(i+u/2,r+f/2-4);n.lineTo(i+u/2,r+f/2+4);n.stroke();n.restore()},r.prototype.drawMoreTab=function(n,i,r,u,f){var e,o;n.save();n.beginPath();e=1;(this._hoverNavButton===5||this._hoverNavButton===6)&&(e=4);o=t.ThemeStyleHelper.getVisualStateThemeStyle(e,"gc-navMoreButton-"+t.VisualState[e].toLowerCase());n.fillStyle=this.getVisibleForeColor(o.borderTopColor);n.fillRect(i+u/2,r+f/2,2,2);n.fillRect(i+u/2-4,r+f/2,2,2);n.fillRect(i+u/2+4,r+f/2,2,2);n.restore()},r.prototype.getVisibleForeColor=function(n){var i=t._Color.parse(n),r=this._backgroundColor;if(i.a<=.01)return t._Color.invertColor(r);else if(t._Color.isTwoColorSimilar(r,i))return t._Color.invertColor(i);return n},r}(vt)})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){var e,u,o,f,r,i;t.feature("core.spread_ui",["core.common","core.spread"]);e="undefined";u=function(){function n(){var n=this;n.sheetCount=1;n.name="";n.font=t._GcTabBase.defaultFont;n.allowUserZoom=!0;n.allowUserResize=!0;n.tabStripVisible=!0;n.tabEditable=!0;n.newTabVisible=!0;n.tabStripRatio=.5;n.activeSheetIndex=0;n.sheets=[]}return n}();t.GcSpreadSheetsOptions=u;o=new u;t.WijspreadOptions=u;f={init:function(n){n=t.GC$.extend(!0,o,n);var i=this.get(0);new t.Spread(i,n)},spread:function(){return this.data("spread")},destroy:function(){var n=this.data("spread");n&&n.destroy()},refresh:function(){var n=this.data("spread");n&&n.refresh()},repaint:function(){var n=this.data("spread");n&&n.repaint()}};r=window.jQuery;r&&(r.fn.wijspread=function(n){if(f[n])return f[n].apply(this,Array.prototype.slice.call(arguments,1));else if(typeof n=="object"||!n)return f.init.apply(this,arguments)},typeof r.wijmo===e&&(r.wijmo={wijspread:undefined}),r.wijmo.wijspread=n.Sheets);typeof window.wijmo===e&&(window.wijmo={spread:undefined});window.wijmo.spread=n.Sheets;i=window.ko;i&&(i.GcSpread=i.GcSpread||{},i.GcSpread.gcspreadsheetsBinding={init:function(n,i,r,u){new t.Spread(t.GC$("#"+n.id).getElement(0),i())},update:function(n,t,i,r){}},i.bindingHandlers["gcspread-sheets"]=i.GcSpread.gcspreadsheetsBinding,i.wijmo=i.GcSpread,i.bindingHandlers.wijspread=i.GcSpread.gcspreadsheetsBinding)})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){(function(i){function kr(n,t){t||(t=this);var i=ht(n.row,t.row),u=ht(n.column,t.column),f=rt(n.row+n.rowCount,t.row+t.rowCount),e=rt(n.column+n.columnCount,t.column+t.columnCount);return i>=f||u>=e?r:{row:i,column:u,rowCount:f-i,columnCount:e-u,intersectWith:kr}}function nf(n,t,i){n[t]||(n[t]=[]);n[t].push(i)}function tf(n,t,i){var u=n[t],r;if(u)for(r=0;r<u.length;r++)if(u[r]===i){u.splice(r,1);return}}function ei(n,t){return(n===f||n===r)&&(t===f||t===r)?!0:(n===f||n===r)&&t!==f&&t!==r||n!==f&&n!==r&&(t===f||t===r)?!1:n.toLowerCase()===t.toLowerCase()}function fu(n,t){var r=this,i={row:r.row,column:r.column,rowCount:1,columnCount:1};return r.rowRelative&&(i.row+=n,i.row=i.row>=l.maxRowCount?i.row%l.maxRowCount:i.row),r.columnRelative&&(i.column+=t,i.column=i.column>=l.maxColumnCount?i.column%l.maxColumnCount:i.column),i}function tr(n,t){var r={row:-1,column:-1,rowCount:-1,columnCount:-1},u,f,e,o,i=this;return i.isFullRow?(r.column=-1,r.columnCount=-1):(i.startColumnRelative?(e=i.startColumn+t,e=e>=l.maxColumnCount?e%l.maxColumnCount:e):e=i.startColumn,i.endColumnRelative?(o=i.endColumn+t,o=o>=l.maxColumnCount?o%l.maxColumnCount:o):o=i.endColumn,r.column=e<=o?e:o,r.columnCount=it(o-e)+1),i.isFullColumn?(r.row=-1,r.rowCount=-1):(i.startRowRelative?(u=i.startRow+n,u=u>=l.maxRowCount?u%l.maxRowCount:u):u=i.startRow,i.endRowRelative?(f=i.endRow+n,f=f>=l.maxRowCount?f%l.maxRowCount:f):f=i.endRow,r.row=u<=f?u:f,r.rowCount=it(f-u)+1),r}function ir(n){return n<=255}function rr(n){return n<=127}function ur(n){var t=n.charCodeAt(0);return t>=48&&t<=57}function oi(n){var t=n.charCodeAt(0);return ir(t)?rr(t)?(t|=32,t>=96&&t<=122):nt[t]===g.UppercaseLetter||nt[t]===g.LowercaseLetter:!0}function fr(n){var t=n.charCodeAt(0);return ir(t)?rr(t)?t<=57?t>=48:(t|=32,t>=96&&t<=122):nt[t]===g.UppercaseLetter||nt[t]===g.LowercaseLetter:!0}function eu(n){var t=n.charCodeAt(0);return ir(t)?nt[t]===g.MathSymbol||nt[t]===g.currencySymbol||nt[t]===g.ModifierSymbol||nt[t]===g.OtherSymbol:!1}function ni(n){var t=n.charCodeAt(0);return rr(t)?t>=48&&t<=57:nt[t]===g.DecimalDigitNumber||nt[t]===g.OtherNumber}function ff(n,t,i){for(var u,e=n.length,r=a.None,f=t;f<e;f++)if(u=n.charAt(f),ur(u))r===a.None?r=a.Int:r===a.Dot?r=a.Decimal:r===a.Sign?r=a.Int:(r===a.Exponent||r===a.SignExponent)&&(r=a.ScientificNotation);else if(u===i)if(r===a.Int)r=a.Decimal;else if(r===a.None||r===a.Sign)r=a.Dot;else return{result:!1};else if(u==="+"||u==="-")if(r===a.None)r=a.Sign;else if(r===a.Exponent)r=a.SignExponent;else return{result:!0,endIndex:f-1};else if(u==="E"||u==="e")if(r===a.Int||r===a.Decimal)r=a.Exponent;else return{result:!1};else if(r===a.Int||r===a.Decimal||r===a.ScientificNotation)return{result:!0,endIndex:f-1};return r===a.Int||r===a.Decimal||r===a.ScientificNotation?{result:!0,endIndex:e-1}:{result:!1}}function si(n,i,r,u,f){for(var o,c=n.length,h=r===u?0:1,s="",e=i+1;e<c;e++)if(o=n.charAt(e),o===r&&h++,o===u)if(h--,r===u&&e+2<c&&n.charAt(e+1)===r)s+=r,e++;else if(h!==0)s+=o;else return{result:s,endIndex:e};else s+=o;if(f)throw t._StringHelper.format(t.SR.Exp_NoSyntax,[u,r]);}function er(n,i,r,u,f,e){for(var o,l=n.length,c=0,h="",s=i;s<l;s++)if(o=n.charAt(s),o===f&&(h+=o,s++,o=n.charAt(s)),o===r)h+=o,c++;else if(o===u)if(c--,c!=0)h+=o;else return{result:h,endIndex:s};else h+=o;if(e)throw t._StringHelper.format(t.SR.Exp_NoSyntax,[u,r]);}function ou(n,i,r){for(var u,f,o,s=n.length,h=s-i,e=0;e<ii.length;e++)if((u=ii[e],f=u.length,!(i+f>s))&&(o=n.slice(i,i+f),f<=h&&(u===o||u===o.toUpperCase())))return{result:u,endIndex:i+f-1};if(r)throw t._StringHelper.format(t.SR.Exp_IsValid,[n.slice(i)]);}function ti(n){return n==="^"||n===":"?1:n==="*"||n==="/"||n===" "?2:n==="+"||n==="-"||n===","?3:n==="&"?4:5}function su(n){if(n.subType===11)return v.range;else if(n.subType===10)return v.union;else if(n.subType===9)return v.intersection;var t=n.value;if(t==="^")return v.exponent;else if(t==="*")return v.multiply;else if(t==="/")return v.divide;else if(t==="+")return v.add;else if(t==="-")return v.subtract;else if(t==="&")return v.concatenate;else if(t==="<")return v.lessThan;else if(t==="=")return v.equal;else if(t===">")return v.greaterThan;else if(t===">=")return v.greaterThanOrEqual;else if(t==="<=")return v.lessThanOrEqual;else if(t==="<>")return v.notEqual;else if(t===":"||t==="!")return v.range;else if(t===" "||t===",")return v.intersection;return v.add}function hi(n,t,i){return n&&n.hasOwnProperty(t)?n[t]:i}function hu(n,t){var i=t+1;return n<0?n%i+i:n>t?n%i:n}var ku,ai,br,dr,gr,du,ri,vt,yi,pi,wi,bi,ki,b,fi,ft,dt,gi,d,tu,iu,ru,e,gt,uu,v,nr,c,u,uf,ef,of,o,et,l,wt,k,or,sr,cu,hr;t.feature("calc.common",["core.stringResource","core.common","core.globalize"]);var w="undefined",ot="number",y="string",tt="boolean",bt="TRUE",kt="FALSE",yt="ARRAY",st="ARRAYROW",cr="#NULL!",lr="#DIV/0!",ar="#VALUE!",ci="#REF!",vr="#NAME?",yr="#N/A",pr="#NUM!",lu="expr",au="arrayInfo",vu="workingExpr",ii=[cr,lr,ar,ci,vr,yr,pr],yu=[0,7,15,23,29,42,36],li=[1,26,676],r=null,f=undefined,pu=!1,rt=Math.min,ht=Math.max,it=Math.abs,wu=Math.pow;i.missingArgument={},function(n){n[n.anyType=0]="anyType";n[n.numberType=1]="numberType";n[n.stringType=2]="stringType";n[n.booleanType=3]="booleanType";n[n.dateType=4]="dateType"}(i.CalcValueType||(i.CalcValueType={}));var sf=i.CalcValueType,wr=["o","n","s","b","d"],bu=[r,0,"",!1,new Date];(function(n){n[n.Cell=0]="Cell";n[n.Row=1]="Row";n[n.Col=2]="Col";n[n.NameIdentity=3]="NameIdentity"})(i.NodeType||(i.NodeType={}));ku=i.NodeType;ai=function(){function n(){this._headNames=["_head","_headRows","_headCols"];this._tailNames=["_tail","_tailRows","_tailCols"]}return n.prototype.isAdjustCell=function(n){return n.preAdj||n===this._head},n.prototype.isAdjust=function(n){return n.preAdj||n===this._head},n.prototype.addAdjust=function(n,t){var i=this,u=i._headNames[t],f=i._tailNames[t];n&&!n.preAdj&&n!==i[u]&&(i[u]?i[f].nextAdj=n:i[u]=n,n.preAdj=i[f],n.nextAdj=r,i[f]=n)},n.prototype.removeAdjust=function(n,t){var i=this,e=i._headNames[t],o=i._tailNames[t],u,f;n&&(n.preAdj||n===i[e])&&(u=n.preAdj,f=n.nextAdj,u?u.nextAdj=f:i[e]=f,f?f.preAdj=u:i[o]=u,n.preAdj=r,n.nextAdj=r)},n.prototype._adjustIndexesOnAdd=function(n,t,i,r,u,f,e,o,s,h){if(i>=0||!u){var l=r+(u?i:0),c=f+(e?i:0);return o===n&&s+h<=i&&(l-=u?h:0,c-=e?h:0),o===t&&(s<=l?(l+=h,c+=h):s<=c&&(c+=h)),l-=u?i:0,c-=e?i:0,{index:l,endIndex:c}}return{index:r,endIndex:f}},n.prototype._adjustCellExpressionOnAddRemove=function(n,t,i,r,f,o,s,h,c,l){if(t){var v=c?f.row:f.column,y=c?f.rowRelative:f.columnRelative,a;if(c&&i>=0||!c&&r>=0||!y){if(l)a=this._adjustIndexesOnAdd(n,t,c?i:r,v,y,-1,!1,o,s,h).index;else if(a=this._adjustCellOnRemove(n,t,c?i:r,v,y,o,s,h),e.err(a))return new u.ErrorExpression(a);a!==v&&(f=f.offset(c?a-v:0,c?0:a-v,!0))}}return f},n.prototype._adjustRangeExpressionOnAddRemove=function(n,t,i,r,f,o,s,h,l,a){var w,b,k;if(t){if(w=f._getRangeType(),w===c.sheet||l&&w===c.column||!l&&w===c.row)return f;var d=l?f.startRowRelative:f.startColumnRelative,g=l?f.endRowRelative:f.endColumnRelative,y=l?f.startRow:f.startColumn,p=l?f.endRow:f.endColumn,v;if(l&&i>=0||!l&&r>=0||!d||!g){if(a)v=this._adjustIndexesOnAdd(n,t,l?i:r,y,d,p,g,o,s,h);else if(v=this._adjustRangeOnRemove(n,t,l?i:r,y,d,p,g,o,s,h),e.err(v))return new u.ErrorExpression(v);b=v.index;k=v.endIndex;(b!==y||k!==p)&&(f=f.offset2(l?b-y:0,l?0:b-y,l?k-p:0,l?0:k-p))}}return f},n.prototype._adjustStructReferenceExpressionOnAddRemoveColumn=function(n,t,i,r,u,f,e,o,s){if(t){var h=u;if(h&&t===h.source())return h.offsetWhenInsertRemoveColumn(e,o,s)}return u},n.prototype.adjustFormulaOnAddRemove=function(n,t,i,e,o,s,h,c,l){var a=this,b=a.adjustFormulaOnAddRemove,y=e,p,g,nt;if(e.t===0)y=a._adjustCellExpressionOnAddRemove(n,n,t,i,e,o,s,h,c,l);else if(e.t===2)y=a._adjustRangeExpressionOnAddRemove(n,n,t,i,e,o,s,h,c,l);else if(e.t===1)y=a._adjustCellExpressionOnAddRemove(n,e.source,t,i,e,o,s,h,c,l);else if(e.t===3)y=a._adjustRangeExpressionOnAddRemove(n,e.source,t,i,e,o,s,h,c,l);else if(e.t===14)p=b.call(a,n,t,i,e.argument,o,s,h,c,l),p!==e.argument&&(y=new u.ParenthesesExpression(p));else if(e.t===11)p=b.call(a,n,t,i,e.operand,o,s,h,c,l),p!==e.operand&&(y=new u.UnaryOperatorExpression(e.operator,p));else if(e.t===10)g=b.call(a,n,t,i,e.left,o,s,h,c,l),nt=b.call(a,n,t,i,e.right,o,s,h,c,l),(g!==e.left||nt!==e.right)&&(y=new u.BinaryOperatorExpression(e.operator,g,nt));else if(e.t===7){for(var w=r,k,d=e,tt=d.argCount(),v=0;v<tt;v++)if(k=d.getArg(v),p=b.call(a,n,t,i,k,o,s,h,c,l),p!==k){w=[];w[v]=p;break}if(w){for(v=0;v<tt;v++)k=d.getArg(v),(w[v]===f||w[v]===r)&&(w[v]=b.call(a,n,t,i,k,o,s,h,c,l));y=new u.FunctionExpression(d.fn,w)}}else c||e.t!==17||(y=a._adjustStructReferenceExpressionOnAddRemoveColumn(n,n,t,i,e,o,s,h,l));return y},n.prototype.adjustFormulasOnAddRemove=function(n,t,i,r,u){this.adjustFormulasOnOperator(n,this.adjustFormulaOnAddRemove,t,i,r,u);var f=0,e=0,o=0,s=0;t===0&&(r&&u?o=i:r&&!u?f=i:!r&&u?s=i:e=i);this.adjustValidatorFormulasOnOperator(n,this.adjustFormulaOnAddRemove,t,i,f,e,o,s,r,u)},n.prototype._adjustCellOnRemove=function(n,t,i,r,u,f,e,o){if(i>=0||!u){var s=r+(u?i:0);if(f===n&&e<=i&&(s+=u?o:0),f===t)if(e+o<=s)s-=o;else if(e<=s)return h;return s-(u?i:0)}return r},n.prototype._adjustRangeOnRemove=function(n,t,i,r,u,f,e,o,s,c){if(i>=0||!u){var l=r+(u?i:0),a=f+(e?i:0),v=s+c-1;if(o===n&&s<=i&&(l+=u?c:0,a+=e?c:0),o===t)if(v<l)l-=c,a-=c;else if(s<=l&&v>=a)return h;else s>a||(v<=a?(l=s>=l?l:s,a-=c):a=s-1);return l-=u?i:0,a-=e?i:0,{index:l,endIndex:a}}return{index:r,endIndex:f}},n.prototype.adjustValidatorFormulasOnOperator=function(n,i,r,u,f,e,o,s,h,c){var v,ut,d,l,ft,et,a,y,p,g,ot,nt,tt,b,k,w,it,rt,st;if(t.features.dataValidator)for(v=t._DataValidatorCache.getAllValidators(),a=0;a<v.length;a++){y=!0;p=!0;for(g in v[a])if(!isNaN(parseFloat(g))){for(ot in v[a][g])if(nt=ot.split("_"),nt[0]!=="-1"&&(p=!1),nt[1]!=="-1"&&(y=!1),!y&&!p)break;if(!y&&!p)break}if((!h||!p)&&(h||!y)&&(ut=v[a].validator,et=v[a].sheet,tt=et._getSheetSource(),d=ut.condition,l=d.getFormulas(),b=o,k=s,tt!==n&&(b=f,k=e),l&&l.length>0)){for(w=0;w<l.length;w++)ft=l[w],it=n.getCalcService().parse(n,ft,f,e),rt=i.call(this,tt,b,k,it,n,r,u,h,c),(it!==rt||f!==o||e!==s)&&(st=n.getCalcService().unparse(n,rt,b,k),l[w]=st);d.setFormulas(l)}}},n.prototype.adjustFormulasOnOperator=function(n,i,r,u,e,o){for(var s=this,h,c,l,a,w={},b,v,y,p;s._head;){if(h=s._head.sourceModel,b=h.getSource(),c=s._head.row,l=s._head.column,w[c]&&w[c][l]){s.removeAdjust(s._head,0);continue}if(a=h._getExpr(c,l),a)if(a=i.call(s,b,c,l,a,n,r,u,e,o),v=h.getArrayInfo(c,l),v)for(v=new t.Range(c,l,v.rowCount,v.colCount),y=c;y<c+v.rowCount;y++)for(w[y]||(w[y]={}),p=l;p<l+v.colCount;p++)h.setExpression(y,p,a,v,y===c&&p===l),w[y][p]=!0;else h.setExpression(c,l,a,v,!0);else(h.getRowExpression&&h.getRowExpression(c)||h.getColumnExpression&&h.getColumnExpression(l))&&h._addCellsToDirty(c,l,1,1);s.removeAdjust(s._head,0)}while(s._headRows)h=s._headRows.sourceModel,c=s._headRows.row,h.getRowExpression&&(a=h.getRowExpression(c),a&&h.setExpression&&h.setExpression(c,-1,i.call(s,b,c,-1,a,n,r,u,e,o),f,!0)),s.removeAdjust(s._headRows,1);while(s._headCols)h=s._headCols.sourceModel,l=s._headCols.column,h.getColumnExpression&&(a=h.getColumnExpression(l),a&&h.setExpression&&h.setExpression(-1,l,i.call(s,b,-1,l,a,n,r,u,e,o),f,!0)),s.removeAdjust(s._headCols,2)},n.prototype.adjustFormulaOnRemoveSheet2=function(n,t,i,r,u){return this.adjustFormulaOnRemoveSheet(n,r,u)},n.prototype.adjustFormulaOnRemoveSheet=function(n,t,i){var b=this,c=b.adjustFormulaOnRemoveSheet,l=t,o,a,e,v,y,p,s,w;if(t instanceof u.ExternalReferenceExpression)v=t.source,(n!==i&&v===i||n===i&&v!==i)&&(l=new u.ErrorExpression(h));else if(t.t===14)o=c.call(this,n,t.argument,i),o!==t.argument&&(l=new u.ParenthesesExpression(o));else if(t.t===11)o=c.call(this,n,t.operand,i),o!==t.operand&&(l=new u.UnaryOperatorExpression(t.operator,o));else if(t.t===10)y=c.call(this,n,t.left,i),p=c.call(this,n,t.right,i),(y!==t.left||p!==t.right)&&(l=new u.BinaryOperatorExpression(t.operator,y,p));else if(t.t===7){for(s=r,w=t.argCount(),e=0;e<w;e++)if(a=t.getArg(e),o=c.call(this,n,a,i),o!==a){s=[];s[e]=o;break}if(s){for(e=0;e<w;e++)a=t.getArg(e),(s[e]===f||s[e]===r)&&(s[e]=c.call(this,n,a,i));l=new u.FunctionExpression(t.fn,s)}}return l},n.prototype.adjustFormulasOnRemoveSheet=function(n){var t=n.getCalcSourceModel(),i=n.getRowCount(),r=n.getColumnCount();this._addDependentsToAdjust(t,0,0,i,r);this.adjustFormulasOnOperator(n,this.adjustFormulaOnRemoveSheet2);this.adjustValidatorFormulasOnOperator(n,this.adjustFormulaOnRemoveSheet2,0,0,0,0,0,0,!0,!1)},n.prototype._adjustCellExpressionOnMove=function(n,t,i,r,e){var y=!!r.source,c=y?r.source:n,l=r.rowRelative,a=r.columnRelative,o,s,p,v;if((t>=0||!l)&&(i>=0||!a)){if(o=r.row+(l?t:0),s=r.column+(a?i:0),v=e.destinationContains(n,t,i,1,1),c===e._toModel&&e.destinationContains(c,o,s,1,1)&&(!l&&!a||!v))return new u.ErrorExpression(h);if(p=(y&&c===e._fromModel||!y&&n===e._fromModel)&&(!v&&e.sourceContains(e._fromModel,o,s,1,1)||v&&e.destinationContains(e._toModel,o,s,1,1)),v&&(o-=l?e.rowOffset():0,s-=a?e.colOffset():0),p&&(o+=e.rowOffset(),s+=e.colOffset()),o-=l?t:0,s-=a?i:0,e._fromModel===e._toModel?c=y?r.source:f:(c=f,p&&v&&y?c=e._toModel:p&&v||(p?c=e._toModel:v&&!y&&(c=e._fromModel))),o!==r.row||s!==r.column||c!=r.source)return c?new u.ExternalCellExpression(c,o,s,l,a):new u.CellExpression(o,s,l,a)}else if((t>=0||!l)&&i===-1){if(o=r.row+(l?t:0),e.destinationContains(n,t,i,1,1)&&(o-=l?e.rowOffset():0),e.sourceContains(c,o,-1,l,-1))o+=e.rowOffset();else if(e.destinationContains(c,o,-1,1,-1))return new u.ErrorExpression(h);if(o-=l?t:0,o!==r.row)if(r.t===0)return new u.CellExpression(o,r.column,l,r.columnRelative);else if(r.t===1)return new u.ExternalCellExpression(r.source,o,r.column,l,r.columnRelative)}else if(t===-1&&i>=0&&!a){if(s=r.column+(a?i:0),e.destinationContains(n,t,i,1,1)&&(s-=a?e.colOffset():0),e.sourceContains(c,o,s,1,1))s+=e.colOffset();else if(e.destinationContains(c,o,s,1,1))return new u.ErrorExpression(h);if(s-=a?i:0,o!==r.row||s!==r.column)if(r.t===0)return new u.CellExpression(r.row,s,r.rowRelative,a);else if(r.t===1)return new u.ExternalCellExpression(r.source,r.row,s,r.rowRelative,a)}return r},n.prototype._adjustRangeExpressionOnMove=function(n,t,i,r,e){var rt=!!r.source,p=rt?r.source:n,ht=r._getRangeType(),v,w,y,b,o,l,s,a,k,d,g,nt,ut,ft,et,ot,st,tt,ct,lt,at,it,vt,yt,pt,wt;if(ht===c.cell){if(v=r.startRowRelative,w=r.startColumnRelative,y=r.endRowRelative,b=r.endColumnRelative,t>=0||!v||!y||i>=0||!w||!b){if(o=r.startRow+(v?t:0),l=r.endRow+(y?t:0),s=r.startColumn+(w?i:0),a=r.endColumn+(b?i:0),k=l-o+1,d=a-s+1,tt=e.destinationContains(n,t,i,1,1),tt&&(ct=e._toRow-e._toColumn,lt=e._toColumn-e._toRow,k+=(v?-ct:0)+(y?ct:0),d+=(w?-lt:0)+(b?lt:0)),p===e._toModel&&e.destinationContains(p,o,s,k,d)&&(!v&&!w&&!y&&!b||!tt))return new u.ErrorExpression(h);if(st=(rt&&p===e._fromModel||!rt&&n===e._fromModel)&&(!tt&&e.sourceContains(e._fromModel,o,s,k,d)||tt&&e.destinationContains(e._toModel,o,s,k,d)),tt&&(ut=v?e.rowOffset():0,ft=y?e.rowOffset():0,et=w?e.colOffset():0,ot=b?e.colOffset():0,o-=ut,l-=ft,s-=et,a-=ot),at=!1,st)g=e.rowOffset(),nt=e.colOffset(),o+=g,l+=g,s+=nt,a+=nt;else if(e.destinationContains(p,o,s,k,d))if(it=e.intersectWith(p,o,s,k,d),it&&(it.rowCount===k||it.columnCount===d))o=it.row+e.rowOffset(),s=it.column+e.colOffset(),l=o+it.rowCount,a=s+it.columnCount,at=!0;else return new u.ErrorExpression(h);if(o-=v?t:0,l-=y?t:0,s-=w?i:0,a-=b?i:0,e._fromModel===e._toModel?p=rt?r.source:f:(p=f,st&&tt&&rt?p=e._toModel:st&&tt||(st?p=e._toModel:tt&&!rt&&(p=e._fromModel))),o!==r.startRow||s!==r.startColumn||l!==r.endRow||a!==r.endColumn||at||p!=r.source)return p?new u.ExternalRangeExpression(p,o,s,l,a,v,w,y,b):new u.RangeExpression(o,s,l,a,v,w,y,b)}else if((t>=0||!v||!y)&&i===-1){if(o=r.startRow+(v?t:0),l=r.endRow+(y?t:0),o>l)return new u.ErrorExpression(h);if(e.destinationContains(n,t,i,1,1)&&(ut=v?e.rowOffset():0,ft=y?e.rowOffset():0,o-=ut,l-=ft),k=l-o,e.sourceContains(p,o,-1,k,-1))g=e.rowOffset(),o+=g,l+=g;else if(e.destinationContains(p,o,-1,k,-1))return new u.ErrorExpression(h);if(o-=v?t:0,l-=y?t:0,o!==r.startRow||l!==r.endRow)if(r.t===2)return new u.RangeExpression(o,r.startColumn,l,r.endColumn,v,r.startColumnRelative,y,r.endColumnRelative);else if(r.t===3)return new u.ExternalRangeExpression(r.source,o,r.startColumn,l,r.endColumn,v,r.startColumnRelative,y,r.endColumnRelative)}else if(t===-1&&(i>=0||!w||!b)){if(s=r.startColumn+(w?i:0),a=r.endColumn+(b?i:0),s>a)return new u.ErrorExpression(h);if(e.destinationContains(n,t,i,1,1)&&(et=w?e.colOffset():0,ot=b?e.colOffset():0,s-=et,a-=ot),d=a-s,e.sourceContains(p,-1,s,-1,d))nt=e.colOffset(),s+=nt,a+=nt;else if(e.destinationContains(p,-1,s,-1,d))return new u.ErrorExpression(h);if(s-=w?i:0,a-=b?i:0,s!==r.startColumn||a!==r.endColumn)if(r.t===2)return new u.RangeExpression(r.startRow,s,r.endRow,a,r.startRowRelative,w,r.endRowRelative,b);else if(r.t===3)return new u.ExternalRangeExpression(r.source,r.startRow,s,r.endRow,a,r.startRowRelative,w,r.endRowRelative,b)}}else if(ht===c.row){if(v=r.startRowRelative,y=r.endRowRelative,t>=0||!v||!y){if(o=r.startRow+(v?t:0),l=r.endRow+(y?t:0),o>l)return new u.ErrorExpression(h);if(e.destinationContains(n,t,i,1,1)&&(ut=v?e.rowOffset():0,ft=y?e.rowOffset():0,o-=ut,l-=ft),k=l-o,e.sourceContains(p,o,-1,k,-1))g=e.rowOffset(),o+=g,l+=g;else if(e.destinationContains(p,o,-1,k,-1))return new u.ErrorExpression(h);if(o-=v?t:0,l-=y?t:0,o!==r.startRow||l!==r.endRow)if(r.t===2)return vt=new u.RangeExpression,vt.initBand(o,l,v,y,!0),vt;else if(r.t===3)return yt=new u.ExternalRangeExpression,yt.initBand(r.source,o,l,v,y,!0),yt}}else if(ht===c.column){if(w=r.startColumnRelative,b=r.endColumnRelative,s=r.startColumn+(w?i:0),a=r.endColumn+(b?i:0),s<a)return new u.ErrorExpression(h);if(e.destinationContains(n,t,i,1,1)&&(et=w?e.colOffset():0,ot=b?e.colOffset():0,s-=et,a-=ot),d=a-s,e.sourceContains(p,-1,s,-1,d))nt=e.colOffset(),s+=nt,a+=nt;else if(e.destinationContains(p,-1,s,-1,d))return new u.ErrorExpression(h);if(s-=w?i:0,a-=b?i:0,s!==r.startColumn||a!==r.endColumn)if(r.t===2)return pt=new u.RangeExpression,pt.initBand(s,a,w,b,!1),pt;else if(r.t===2)return wt=new u.ExternalRangeExpression,wt.initBand(r.source,s,a,w,b,!1),wt}return r},n.prototype.adjustFormulaOnMoveSwap=function(n,t,i,e,o,s){var c=this,y=c.adjustFormulaOnMoveSwap,a=e,l,d,b;if(e.t===0||e.t===1)a=s?c._adjustCellExpressionOnMove(n,t,i,e,o):c._adjustCellExpressionOnSwap(n,t,i,e,o);else if(e.t===2||e.t===3)a=s?c._adjustRangeExpressionOnMove(n,t,i,e,o):c._adjustRangeExpressionOnSwap(n,t,i,e,o);else if(e.t===14)d=e,l=y.call(c,n,t,i,d.argument,o,s),l!==d.argument&&(a=new u.ParenthesesExpression(l));else if(e.t===11)b=e,l=y.call(c,n,t,i,b.operand,o,s),l!==b.operand&&(a=new u.UnaryOperatorExpression(b.operator,l));else if(e.t===10){var p=e,g=y.call(c,n,t,i,p.left,o,s),nt=y.call(c,n,t,i,p.right,o,s);(g!==p.left||nt!==p.right)&&(a=new u.BinaryOperatorExpression(p.operator,g,nt))}else if(e.t===7){for(var v=r,w,k=e,tt=k.argCount(),h=0;h<tt;h++)if(w=k.getArg(h),l=y.call(c,n,t,i,w,o,s),l!==w){v=[];v[h]=l;break}if(v){for(h=0;h<tt;h++)w=k.getArg(h),(v[h]===f||v[h]===r)&&(v[h]=y.call(c,n,t,i,w,o,s));a=new u.FunctionExpression(k.fn,v)}}return a},n.prototype.adjustDataValidatorFormulasOnMoveSwap=function(n,i){var k=this,a=n._fromModel.getCalcService(),e,w,o,c,l,b;if(t.features.dataValidator){var s=t._DataValidatorCache.getAllValidators(),v,h,f,y,p,r=0,u=0;for((n._fromRow===0&&n._fromColumn===0||n._toRow===0||n._toColumn===0)&&(r=n._rowCount,u=n._columnCount,r>=n._toRow&&r<n._toRow+n._rowCount&&u>=n._toColumn&&u<n._toColumn+n._columnCount?r=n._toRow+n._rowCount:r>=n._fromRow&&r<n._fromRow+n._rowCount&&u>=n._fromColumn&&u<n._fromColumn+n._columnCount&&(r=n._fromRow+n._rowCount)),e=0;e<s.length;e++)if(v=s[e].validator,p=s[e].sheet,w=p._getSheetSource(),h=v.condition,f=h.getFormulas(),f&&f.length>0){for(o=0;o<f.length;o++)y=f[o],c=a.parse(n._fromModel,y,r,u),l=k.adjustFormulaOnMoveSwap(w,r,u,c,n,i),c!==l&&(b=a.unparse(n._fromModel,l,r,u),f[o]=b);h.setFormulas(f)}}},n.prototype._adjustCellExpressionOnSwap=function(n,t,i,r,f){var c=r.source||n,s=r.rowRelative,h=r.columnRelative,e,o;if((t>=0||!s)&&(i>=0||!h)){if(e=r.row+(s?t:0),o=r.column+(h?i:0),f.destinationContains(n,t,i,1,1)?(e-=s?f.rowOffset():0,o-=h?f.colOffset():0):f.sourceContains(n,e,o,1,1)&&(e+=s?f.rowOffset():0,o+=h?f.colOffset():0),f.sourceContains(c,e,o,1,1)?(e+=f.rowOffset(),o+=f.colOffset()):f.destinationContains(c,e,o,1,1)&&(e-=f.rowOffset(),o-=f.colOffset()),e-=s?t:0,o-=h?i:0,e!==r.row||o!==r.column)if(r.t===0)return new u.CellExpression(e,o,s,h);else if(r.t===1)return new u.ExternalCellExpression(r.source,e,o,s,h)}else if((t>=0||!s)&&i===-1){if(e=r.row+(s?t:0),f.destinationContains(n,t,-1,1,-1)?e-=s?f.rowOffset():0:f.sourceContains(n,e,-1,1,-1)&&(e+=s?f.rowOffset():0),f.sourceContains(c,e,-1,1,-1)?e+=f.rowOffset():f.destinationContains(c,e,-1,1,-1)&&(e-=f.rowOffset()),e-=s?t:0,e!==r.row||o!==r.column)if(r.t===0)return new u.CellExpression(e,r.column,s,r.columnRelative);else if(r.t===1)return new u.ExternalCellExpression(r.source,e,r.column,s,r.columnRelative)}else if(t===-1&&i>=0&&!h&&(o=r.column+(h?i:0),f.destinationContains(n,-1,i,-1,1)?o-=h?f.colOffset():0:f.sourceContains(n,-1,o,-1,1)&&(o+=h?f.colOffset():0),f.sourceContains(c,-1,o,-1,1)?o+=f.colOffset():f.destinationContains(c,-1,o,-1,1)&&(o-=f.colOffset()),o-=h?i:0,e!==r.row||o!==r.column))if(r.t===0)return new u.CellExpression(r.row,o,r.rowRelative,h);else if(r.t===1)return new u.ExternalCellExpression(r.source,r.row,o,r.rowRelative,h);return r},n.prototype._adjustRangeExpressionOnSwap=function(n,t,i,r,f){var tt=r.source||n,ut=r._getRangeType(),e,s,o,l,it,rt,a,v,p,y,w,b,k,d,g,nt,ft,et,ot,st;if(ut===c.cell){if(a=r.startRowRelative,v=r.startColumnRelative,p=r.endRowRelative,y=r.endColumnRelative,(t>=0||!a||!p)&&(i>=0||!v||!y)){if(e=r.startRow+(a?t:0),s=r.endRow+(p?t:0),o=r.startColumn+(v?i:0),l=r.endColumn+(y?i:0),it=s-e,rt=l-o,f.destinationContains(n,t,i,1,1)?(k=a?f.rowOffset():0,d=v?f.colOffset():0,g=p?f.rowOffset():0,nt=y?f.colOffset():0,e-=k,s-=g,o-=d,l-=nt):f.sourceContains(n,e,o,it,rt)&&(k=a?f.rowOffset():0,d=v?f.colOffset():0,g=p?f.rowOffset():0,nt=y?f.colOffset():0,e+=k,s+=g,o+=d,l+=nt),f.sourceContains(tt,e,o,it,rt)?(w=f.rowOffset(),b=f.colOffset(),e+=w,s+=w,o+=b,l+=b):f.destinationContains(tt,e,o,it,rt)&&(w=f.rowOffset(),b=f.colOffset(),e-=w,s-=w,o-=b,l-=b),e-=a?t:0,s-=p?t:0,o-=v?i:0,l-=y?i:0,e!==r.startRow||o!==r.startColumn||s!==r.endRow||l!==r.endColumn)if(r.t===2)return new u.RangeExpression(e,o,s,l,a,v,p,y);else if(r.t===3)return new u.ExternalRangeExpression(r.source,e,o,s,l,a,v,p,y)}else if((t>=0||!a||!p)&&i===-1){if(e=r.startRow+(a?t:0),s=r.endRow+(p?t:0),e<s)return new u.ErrorExpression(h);if(f.destinationContains(n,t,-1,1,-1)?(k=a?f.rowOffset():0,g=a?f.rowOffset():0,e-=k,s-=g):f.sourceContains(n,t,-1,1,-1)&&(k=a?f.rowOffset():0,g=a?f.rowOffset():0,e+=k,s+=g),it=s-e,f.sourceContains(tt,e,-1,it,-1)?(w=f.rowOffset(),e+=w,s+=w):f.destinationContains(tt,e,-1,it,-1)&&(w=f.rowOffset(),e-=w,s-=w),e-=a?t:0,s-=p?t:0,e!==r.startRow||s!==r.endRow)if(r.t===2)return new u.RangeExpression(e,r.startColumn,s,r.endColumn,a,r.startColumnRelative,p,r.endColumnRelative);else if(r.t===3)return new u.ExternalRangeExpression(r.source,e,r.startColumn,s,r.endColumn,a,r.startColumnRelative,p,r.endColumnRelative)}else if(t===-1&&(i>=0||!v||!y)){if(o=r.startColumn+(v?i:0),l=r.endColumn+(y?i:0),o<l)return new u.ErrorExpression(h);if(f.destinationContains(n,-1,i,-1,1)?(d=v?f.colOffset():0,nt=y?f.colOffset():0,o-=d,l-=nt):f.sourceContains(n,-1,i,-1,1)&&(d=v?f.colOffset():0,nt=y?f.colOffset():0,o+=d,l+=nt),rt=l-o,f.sourceContains(tt,-1,o,-1,rt)?(b=f.colOffset(),o+=b,l+=b):f.destinationContains(tt,-1,o,-1,rt)&&(b=f.colOffset(),o-=b,l-=b),o-=v?i:0,l-=y?i:0,o!==r.startColumn||l!==r.endColumn)if(r.t===2)return new u.RangeExpression(r.startRow,o,r.endRow,l,r.startRowRelative,v,r.endRowRelative,y);else if(r.t===3)return new u.ExternalRangeExpression(r.source,r.startRow,o,r.endRow,l,r.startRowRelative,v,r.endRowRelative,y)}}else if(ut===c.row){if(a=r.startRowRelative,p=r.endRowRelative,t>=0||!a||!p){if(e=r.startRow+(a?t:0),s=r.endRow+(p?t:0),e<s)return new u.ErrorExpression(h);if(f.destinationContains(n,t,-1,1,-1)?(k=a?f.rowOffset():0,g=p?f.rowOffset():0,e-=k,s-=g):f.sourceContains(n,t,-1,1,-1)&&(k=a?f.rowOffset():0,g=p?f.rowOffset():0,e+=k,s+=g),it=s-e,f.sourceContains(tt,e,-1,it,-1)?(w=f.rowOffset(),e+=w,s+=w):f.destinationContains(tt,e,-1,it,-1)&&(w=f.rowOffset(),e-=w,s-=w),e-=a?t:0,s-=p?t:0,e!==r.startRow||s!==r.endRow)if(r.t===2)return ft=new u.RangeExpression,ft.initBand(e,s,a,p,!0),ft;else if(r.t===3)return et=new u.ExternalRangeExpression,et.initBand(r.source,e,s,a,p,!0),et}}else if(ut===c.column){if(v=r.startColumnRelative,y=r.endColumnRelative,o=r.startColumn+(v?i:0),l=r.endColumn+(y?i:0),o>l)return new u.ErrorExpression(h);if(f.destinationContains(n,-1,i,-1,1)?(d=v?f.colOffset():0,nt=y?f.colOffset():0,o-=d,l-=nt):f.sourceContains(n,-1,i,-1,1)&&(d=v?f.colOffset():0,nt=y?f.colOffset():0,o+=d,l+=nt),rt=l-o,f.sourceContains(tt,-1,o,-1,rt)?(b=f.colOffset(),o+=b,l+=b):f.destinationContains(tt,-1,o,-1,rt)&&(b=f.colOffset(),o-=b,l-=b),o-=v?i:0,l-=y?i:0,o!==r.startColumn||l!==r.endColumn)if(r.t===2)return ot=new u.RangeExpression,ot.initBand(o,l,v,y,!1),ot;else if(r.t===3)return st=new u.ExternalRangeExpression,st.initBand(r.source,o,l,v,y,!1),st}return r},n.prototype.adjustFormulasOnMoveSwap=function(n,i,r,u,e,o,s,h,c){var l=this,nt=l.adjustFormulaOnMoveSwap,g=new br(n,i,r,u,e,o,s,h),a,v,y,p,d={},w,b,k;for(l.adjustDataValidatorFormulasOnMoveSwap(g,c);l._head;){if(a=l._head.sourceModel,v=l._head.row,y=l._head.column,d[v]&&d[v][y]){l.removeAdjust(l._head,0);continue}if(p=a.getExpression(v,y),p)if(p=nt.call(l,a.getSource(),v,y,p,g,c),w=a.getArrayInfo(v,y),w)for(w=new t.Range(v,y,w.rowCount,w.colCount),b=v;b<v+w.rowCount;b++)for(d[b]||(d[b]={}),k=y;k<y+w.colCount;k++)a.setExpression(b,k,p,w,b===v&&k===y),d[b][k]=!0;else a.setExpression(v,y,p,w,!0);else(a.getRowExpression&&a.getRowExpression(v)||a.getColumnExpression&&a.getColumnExpression(y))&&a._addCellsToDirty(v,y,1,1);l.removeAdjust(l._head,0)}while(l._headRows)a=l._headRows.sourceModel,v=l._headRows.row,a.getRowExpression&&(p=a.getRowExpression(v),p&&a._setRowExpression&&a._setRowExpression(v,nt.call(l,a.getSource(),v,-1,p,g,c),f)),l.removeAdjust(l._headRows,1);while(l._headCols)a=l._headCols.sourceModel,y=l._headCols.column,a.getColumnExpression&&(p=a.getColumnExpression(y),p&&a._setColumnExpression&&a._setColumnExpression(y,nt.call(l,a.getSource(),-1,y,p,g,c),f)),l.removeAdjust(l._headCols,2)},n.prototype._addDependentsToAdjust=function(n,t,i,r,u){n.addDependents(t,i,r,u,!0,!1)},n.prototype._addCellsToAdjust=function(n,t,i,u,f){for(var e,c,l=this,a=t+u,v=i+f,s,h,o=t;o<a;o++)for(e=i;e<v;e++)(s=n._getCalc(o,e),h=n._getExpr(o,e),s||h)&&(n._setCalc(o,e,r),c=n._getCellCalc(o,e,!0),l.addAdjust(c,0))},n.prototype._addColumnsToAdjust=function(n,t,i){for(var f,e=this,u=t;u!==-1&&u<t+i;u++)(n._getCalc(-1,u)||n._getExpr(-1,u))&&(n._setCalc(-1,u,r),f=n._getColumnCalc(u,!0),e.addAdjust(f,2))},n.prototype._addRowsToAdjust=function(n,t,i){for(var f,e=this,u=t;u!==-1&&u<t+i;u++)(n._getCalc(u,-1)||n._getExpr(u,-1))&&(n._setCalc(u,-1,r),f=n._getRowCalc(u,!0),e.addAdjust(f,1))},n.prototype._addVolatitleToAdjust=function(n){for(var i,f=this,e,o=n.getCalcService().getAllSouceModels(),r,t,u=0;u<o.length;u++)for(e=o[u],r=e._getAllVolatitles(),i=0;i<r.length;i++)t=r[i],t&&t instanceof vt&&!f.isAdjustCell(t)&&f.addAdjust(t,0)},n.prototype.onBeforeAddRemoveRows=function(n,t){var r=this,i=n.rC(),u=n.cC();n.unlinkCellExpression(t,0,i-t,u);n.unlinkRowExpression(t,i-t);r._addDependentsToAdjust(n,t,-1,i-t,-1)},n.prototype.onAfterAddRemoveRows=function(n,t,i,r){var u=this,f=n.rC(),e=n.cC();r?n._addCellsToDirty(t,0,i,e):f+=i;u._addCellsToAdjust(n,t,0,f-t,e);u._addRowsToAdjust(n,t,f-t);u._addVolatitleToAdjust(n);u.adjustFormulasOnAddRemove(n.getSource(),t,i,!0,r);n.getCalcService().autoCalculation&&n.getCalcService().recalculateAll(!1)},n.prototype.onAfterAddRemoveColumns=function(n,t,i,r){var u=this,e=n.rC(),f=n.cC();r?n._addCellsToDirty(0,t,e,i):f+=i;u._addCellsToAdjust(n,0,t,e,f-t);u._addColumnsToAdjust(n,t,f-t);u._addVolatitleToAdjust(n);u.adjustFormulasOnAddRemove(n.getSource(),t,i,!1,r);n.getCalcService().autoCalculation&&n.getCalcService().recalculateAll(!1)},n.prototype.onBeforeAddRemoveColumns=function(n,t){var r=this,u=n.rC(),i=n.cC();n.unlinkCellExpression(0,t,u,i-t);n.unlinkColumnExpression(t,i-t);r._addDependentsToAdjust(n,-1,t,-1,i-t)},n._copyExpression=function(r,u,f,e,o){var h=r,a=n,v=a._copyExpression,s,p;if(!t.util.hasCalc()||!r)return h;var c=i.Expressions,w=l.maxRowCount,b=l.maxColumnCount,y=i.Errors.Reference,k=c.ErrorExpression,d=c.ExternalErrorExpression;if(r.t===14)h=new c.ParenthesesExpression,h.argument=v.call(a,r.argument,u,f,e,o);else if(r.t===0||r.t===1){if(r.rowRelative&&(r.row+u<0||r.row+u>w)||r.columnRelative&&(r.column+f<0||r.column+f>b))return r.source?new d(r.source,y):new k(y);h=r.offset(0,0,!1)}else if(r.t===2||r.t===3||r.t===16){if(s=r,s.startRowRelative&&(s.startRow+u<0||s.startRow+u>w)||s.startColumnRelative&&(s.startColumn+f<0||s.startColumn+f>b)||s.endRowRelative&&(s.endRow+u<0||s.endRow+u>w)||s.endColumnRelative&&(s.endColumn+f<0||s.endColumn+f>b))return r.startSource?new c.SheetRangeErrorExpression(r.startSource,r.endSource,y):r.source?new d(r.source,y):new k(y);h=r.offset(0,0,!1)}else if(r.t===11)h=new c.UnaryOperatorExpression(r.operator,v.call(a,r.operand,u,f,e,o));else if(r.t===10)h=new c.BinaryOperatorExpression(r.operator,v.call(a,r.left,u,f,e,o),v.call(a,r.right,u,f,e,o));else if(r.t===7){if(h=new c.FunctionExpression(r.fn,[]),r.args&&r.args.length>0)for(p=0;p<r.args.length;p++)h.args[p]=v.call(a,r.args[p],u,f,e,o)}else r.t===17&&(h=r.offsetWhenCopy(e,o));return h},n.copyFormula=function(t,r,e,o,s,h,c,l,a){var yt=t,ut=o,ui=t.getSource(),ot=o.getSource(),ni=n,fi,et,v,y,lt,ti,at,w,b,p,it,dt,gt,pt,ct,g,ii,ri,vt,d;if(yt&&ut){var wt={},nt,bt=r,kt=e,tt=s,ft=h,st=c,ht=l;for(r<0&&(bt=0,st=rt(t.rC(),o.rC())),e<0&&(kt=0,ht=rt(t.cC(),o.cC())),s<0&&(tt=0),h<0&&(ft=0),fi=!(t===o),yt&&yt.unlinkCellExpression(tt,ft,st,ht),et=new i.CalcSourceModel(t.getCalcService(),ui),v=0;v<st;v++)for(y=0;y<ht;y++)yt._copyExpr(et,v+bt,y+kt,v,y),lt=t.getSource().getSheet().getStyleObject(v+tt,y+ft),lt&<.validator&&(nt=lt.validator.condition,nt&&nt.getFormulas&&nt.getFormulas().length>0&&(wt[lt.validator.id]=nt));for(ti={},at=o.getCalcService(),v=0;v<st;v++)if(!a||!ot.isHiddenRow(v+tt))for(w=v+tt,y=0;y<ht;y++)if(b=y+ft,p=et._getExpr(v,y),p){if(p===ti)continue;if(p=ni._copyExpression(et._getExpr(v,y),w,b,s-r,h-e),it=et.getArrayInfo(v,y),ot)if(it){for(dt=st-v<it.rowCount?st-v:it.rowCount,gt=ht-y<it.colCount?ht-y:it.colCount,d=0;d<dt;d++)for(pt=0;pt<gt;pt++)et._setExpr(v+d,y+pt,p);o.setArrayFormula(w,b,dt,gt,at.unparseWithoutCulture(ot,p,w,b))}else ct=p?at.unparseWithoutCulture(ot,p,w,b):f,ot.setFormula(w,b,ct),g=et._getWorkingExpr(v,y),g&&(g=ni._copyExpression(g,w,b,s-r,h-e),ii=new k(ot,!1,w,b),g=u._mappingArray(ii,p,!1,0,0),g=g===p?f:g),ut._setCellExpression(w,b,p,g,it);else ut._setExpr(v+tt,y+ft,p),ut._setArrayInfo(v+tt,y+ft,it)}else ut&&ut.getExpression(w,b)&&ut._clearAllExpr(w,b);for(ri in wt){for(nt=wt[ri],vt=nt.getFormulas(),d=0;d<vt.length;d++)ct=vt[d],p=at.parse(t.getSource(),ct,bt,kt),ct=at.unparse(t.getSource(),p,tt,ft),vt[d]=ct;nt.setFormulas(vt)}}},n.prototype.onAfterRemoveName=function(n,t){var i=n._getNameCalc(t,!1);i&&(i.updateListening(!0,!1),i.addToDirty(),i.updateListeningOnRemoved())},n.prototype.adjustFormulaOnRemoveName=function(n,t,i){var w=this,c=w.adjustFormulaOnRemoveName,l=t,o,a,e,v,y,s,p;if(t.t===8||t.t===18||t.t===9){if(t.name===i&&(!t.source||t.source===n.getSource()))return t.source?new u.ExternalErrorExpression(t.source,h):new u.ErrorExpression(h)}else if(t.t===14)o=c.call(this,n,t.argument,i),o!==t.argument&&(l=new u.ParenthesesExpression(o));else if(t.t===11)o=c.call(this,n,t.operand,i),o!==t.operand&&(l=new u.UnaryOperatorExpression(t.operator,o));else if(t.t===10)v=c.call(this,n,t.left,i),y=c.call(this,n,t.right,i),(v!==t.left||y!==t.right)&&(l=new u.BinaryOperatorExpression(t.operator,v,y));else if(t.t===7){for(s=r,p=t.argCount(),e=0;e<p;e++)if(a=t.getArg(e),o=c.call(this,n,a,i),o!==a){s=[];s[e]=o;break}if(s){for(e=0;e<p;e++)a=t.getArg(e),(s[e]===f||s[e]===r)&&(s[e]=c.call(this,n,a,i));l=new u.FunctionExpression(t.fn,s)}}return l},n.prototype.invalidName=function(n,t){if(t){var r=n.getCalcSourceModel(),i=r._getNameCalc(t.toUpperCase(),!0);i&&i.addListenersToAdjust()}},n.prototype.onAfterRemoveTable=function(n){for(var f=this,n,i,r,h,s={},c,u,e,o;f._head;){if(n=f._head.sourceModel,c=n.getSource(),i=f._head.row,r=f._head.column,s[i]&&s[i][r]){f.removeAdjust(f._head,0);continue}if(h=n._getExpr(i,r),h)if(u=n.getArrayInfo(i,r),u)for(u=new t.Range(i,r,u.rowCount,u.colCount),e=i;e<i+u.rowCount;e++)for(s[e]||(s[e]={}),o=r;o<r+u.colCount;o++)n.setExpression(e,o,h,u,e===i&&o===r),s[e][o]=!0;else n.setExpression(i,r,h,u,!0);else(n.getRowExpression&&n.getRowExpression(i)||n.getColumnExpression&&n.getColumnExpression(r))&&n._addCellsToDirty(i,r,1,1);f.removeAdjust(f._head,0)}},n}();i.CalcOperatorAdjustor=ai;br=function(){function n(n,t,i,r,u,f,e,o){var s=this;s._fromModel=n;s._fromRow=t;s._fromColumn=i;s._toModel=r;s._toRow=u;s._toColumn=f;s._rowCount=e;s._columnCount=o}return n.prototype.rowOffset=function(){return this._toRow-this._fromRow},n.prototype.colOffset=function(){return this._toColumn-this._fromColumn},n.prototype.sourceContains=function(n,t,i,r,u){var f=this;return f._fromModel===n&&(f._fromRow===-1||f._fromRow<=t&&t+r<=f._fromRow+f._rowCount)&&(f._fromColumn===-1||f._fromColumn<=i&&i+u<=f._fromColumn+f._columnCount)},n.prototype.destinationContains=function(n,t,i,r,u){var f=this;return f._toModel===n&&(f._toRow===-1||f._toRow<=t&&t+r<=f._toRow+f._rowCount)&&(f._toColumn===-1||f._toColumn<=i&&i+u<=f._toColumn+f._columnCount)},n.prototype.intersectWith=function(n,t,i,u,f){var e=this,o,s;return e._toModel!==n?r:(o=e._createValidCellRange(n,t,i,u,f),s=e._createValidCellRange(n,e._fromRow,e._fromColumn,u,f),s.intersectWith(o))},n.prototype._createValidCellRange=function(n,t,i,r,u){var f=t===-1?0:t,e=t===-1||r===-1?n.rowCount:r,o=i===-1?0:i,s=i===-1||u===-1?n.columnCount:u;return{row:f,column:o,rowCount:e,columnCount:s,intersectWith:kr}},n}();dr=function(){function n(t){this.id=n.sourceId++;this._service=t;this._calcSourceModel=null}return n.prototype.getCalcService=function(){return this._service},n.prototype.setCalcService=function(n){this._service=n},n.prototype.getCalcSourceModel=function(){return this._calcSourceModel},n.prototype.setCalcSourceModel=function(n){this._calcSourceModel=n},n.prototype.getValue=function(n,t,i){return r},n.prototype.getValueByName=function(n,t){return r},n.prototype.getName=function(){return""},n.prototype.setValue=function(n,t,i){},n.prototype.setValueByName=function(n,t){},n.prototype.getReference=function(n,i,r,u){return new d(this,[new t.Range(n,i,r,u)])},n.prototype.getSheetRangeReference=function(n,i,r,u,f){return new d(this,[new t.Range(i,r,u,f)])},n.prototype.getSources=function(n){return[this]},n.prototype.referenceToArray=function(n,t,i,u,o,h){var ft=this,tt,it,v=1,y=1,w,b,p,c=[],et,l,g,ot,st,ht=wr[t],ct=bu,lt=e.CalcConvertedError,rt,ut,a,at,vt,nt,k,d;if(p=n.getRangeCount(),p===0)return c.isError=!0,[];for(rt=this.getRowCount(),ut=this.getColumnCount(),i=i===f?!0:i,a=0;a<p;a++){if(i||(g=[],c.push(g)),v=n.getRowCount(a),v===0)return c.isError=!0,[];if(y=n.getColumnCount(a),y===0)return c.isError=!0,[];for(w=n.getRow(a),b=n.getColumn(a),v=Math.min(w+v,rt)-w,y=Math.min(b+y,ut)-b,k=0;k<v;k++)for(tt=w+k,i||(nt=[],g.push(nt)),d=0;d<y;d++){if(it=b+d,l=ft.getValue(tt,it),u&&e.err(l))return c=[l],c.isError=!0,c;if(l=e.convertValue(l,t,!0,h),o&&l===e.CalcConvertedError)return c=[s],c.isError=!0,c;l===r&&h||(i?c.push(l):nt.push(l))}}return i||p!==1||(c=c[0]),c.rowCount=v,c.colCount=y,c.rangeCount=p,c},n.prototype.getSheetReference=function(){var n=this;return n._reference=n._reference||new d(n),n._reference},n.prototype.setFormula=function(n,t,i){},n.prototype.setFormulaByName=function(n,t){},n.prototype.setArrayFormula=function(n,t,i,r,u){},n.prototype.getRowCount=function(){return 1e3},n.prototype.getColumnCount=function(){return 100},n.prototype.isHiddenRow=function(n,t){return!1},n.prototype.getParserContext=function(n,t,i,r){return new et(this,n,t,i,r)},n.prototype.startCalculation=function(){},n.prototype.endCalculation=function(){},n.prototype.getEvaluatorContext=function(n,t,i,r,u,e,o){return i?(r=r===f?n:r,u=u===f?t:u,e=e===f?1:e,o=o===f?1:o,new k(this,i,r,u,e,o,n,t)):new k(this,i,n,t)},n.prototype.getCustomFunction=function(n){return r},n.prototype.getCustomName=function(n){return r},n.prototype.refresh=function(){},n.prototype.toJSON=function(n,t){},n.sourceId=1,n}();i.CalcSource=dr;gr=function(){function n(){this._sourceModeles={};this.autoCalculation=!0;this._headNames=["_head","_headRows","_headCols","_headNamIDs"];this._tailNames=["_tail","_tailRows","_tailCols","_tailNameIDs"];this.maximumIterations=1;this.maximumChange=.01;var n=this;n._parser=new l;n._evaluator=new hr;n.useR1C1=!1;n._suspended=0;n._operatorAdjustor=new ai}return n.prototype.dispose=function(){var n=this;n._sourceModeles={};n._globalSourceModel=r},n.prototype.getOperatorAdjustor=function(){return this._operatorAdjustor},n.prototype.getSourceModel=function(n){var t=this._sourceModeles[n.id];return t||(t=this._sourceModeles[n.id]=new ri(this,n),n.setCalcSourceModel(t),n.setCalcService(this)),t},n.prototype.getGlobalSourceModel=function(n){return this._globalSourceModel||(this._globalSourceModel=new ri(this,n)),this._globalSourceModel},n.prototype.setSourceModel=function(n,t){this._sourceModeles[n.id]=t;t.setCalcService(this)},n.prototype.getAllSouceModels=function(){var n=[],t=this._sourceModeles;for(var i in t)n.push(t[i]);return n},n.prototype.removeSource=function(n){var t=this._sourceModeles[n.id];t&&(this._operatorAdjustor.adjustFormulasOnRemoveSheet(n),delete this._sourceModeles[n.id])},n.prototype.clearSource=function(){this._sourceModeles={};this.clearDirties()},n.prototype.ignoreDirty=function(){return this._ignoreDirty},n.prototype.suspend=function(n){this._parseCache||(this._parseCache={});this._suspended++;this._ignoreDirty=n?!0:n},n.prototype.resume=function(n){var t=this;t._suspended--;t._suspended<0&&(t._suspended=0);t.IsSuspended()||(this._parseCache=r,t._ignoreDirty=!1,t.recalculateAll(n))},n.prototype.clearDirties=function(){for(var n=this,t,i,e=[n._head,n._headRows,n._headCols,n._headNamIDs],u=0;u<e.length;u++)for(t=e[u];t;)i=t.nextDirty,i?(t.nextDirty=i.preDirty=f,t=i):t=r;n._head=n._tail=n._headRows=n._tailRows=n._headCols=n._tailCols=n._headNamIDs=n._tailNameIDs=r},n.prototype.resumeWithoutCalc=function(){this._suspended=0;this.clearDirties()},n.prototype.IsSuspended=function(){return this._suspended>0},n.prototype.recalculate=function(n,t,i,r){var u=this.getSourceModel(n);i===-1?u._addCellsToDirty(t,0,1,u.cC()):t===-1?u._addCellsToDirty(0,i,u.rC(),1):u._addCellsToDirty(t,i,1,1);this.IsSuspended()||this.recalculateAll(!1,r)},n.prototype.recalculateByName=function(n,t){if(t){var i=this.getSourceModel(n),r=i._getNameIDCalc(t.toUpperCase(),!0);this.addDirty(r,3);this.IsSuspended()||this.recalculateAll(!1)}},n.prototype.recalcRange=function(n,t,i,r,u){var f=this.getSourceModel(n);i===-1?f._addCellsToDirty(t,0,r,f.cC()):t===-1?f._addCellsToDirty(0,i,f.rC(),u):f._addCellsToDirty(t,i,r,u);this.IsSuspended()||this.recalculateAll(!1)},n.prototype.recalculateAll=function(n,t){var f=this,i,r,e,o,u;if(!f.IsSuspended()){f._evaluator.startCache();r=this._sourceModeles;for(u in r)i=r[u],i.getSource().startCalculation(),n!==!1?(e=i.cC(),o=i.rC(),i._addColumnsToDirty(0,e),i._addRowsToDirty(0,o),i._addCellsToDirty(0,0,o,e)):t!==!1&&i._addVolatitlesToDirty();f._recalculateImp();for(u in r)i=r[u],i._checkAndUpdateVolatitles();for(u in r)i=r[u],i.getSource().endCalculation();f._evaluator.endCache()}},n.prototype._cacheHeadDirtyColumns=function(n,t){for(var r=n.length,i=t;i;)n[r]=i,r++,i=i.nextDirty},n.prototype._recalculateImp=function(n){var y,tt,it,rt,e,k,v,d,ut,ft;n===undefined&&(n=!0);var t=this,a=r,w=!1,u,o,s,g,nt,p,b,i,c,h,l;if(n){for(y=[],t._headCols&&t._cacheHeadDirtyColumns(y,t._headCols);t._headRows;){for(u=t._headRows.sourceModel,b=u.cC(),s=0;s<b;s++)t.addDirty(u._getCellCalc(t._headRows.row,s,!0),0);t.removeDirty(t._headRows,1)}while(t._headCols){if(u=t._headCols.sourceModel,p=u.rC(),p>0)for(o=0;o<p;o++)t.addDirty(u._getCellCalc(o,t._headCols.column,!0),0);else t._headCols.addListenersToDirty();t.removeDirty(t._headCols,2)}for(i=t._head;i;i=i.nextDirty){for(u=i.sourceModel,g=i.row,nt=i.column,c=u._getRowCalc(g,!1),h=u._getColumnCalc(nt,!1),l=u._getRangeCalc(!1),i.addListenersToDirty(),c&&c.addListenersToDirty(),h&&h.addListenersToDirty(),l&&l.addListenersToDirty(g,nt,1,1);t._headRows;){for(u=t._headRows.sourceModel,b=u.cC(),s=0;s<b;s++)t.addDirty(u._getCellCalc(t._headRows.row,s,!0),0);t.removeDirty(t._headRows,1)}while(t._headCols){for(tt=!1,v=0;v<y.length;v++)if(y[v]==t._headCols){tt=!0;break}if(tt){t.removeDirty(t._headCols,2);continue}else y[y.length]=t._headCols;for(u=t._headCols.sourceModel,p=u.rC(),o=0;o<p;o++)t.addDirty(u._getCellCalc(o,t._headCols.column,!0),0);t.removeDirty(t._headCols,2)}}for(e=t._headNamIDs;e;e=e.nextDirty)u=e.sourceModel,e.addListenersToDirty()}for(i=t._head;i;i=a)u=i.sourceModel,it=u.rC(),rt=u.cC(),a=i.nextDirty,i.row<it&&i.column<rt?(pu&&(h=u._getColumnCalc(i.column,!1),h&&(h.delay=0)),i.delay=0):t.removeDirty(i,0);for(e=t._headNamIDs;e;e=e.nextDirty)e.delay=0;for(i=t._head;i;i=i.nextDirty)u=i.sourceModel,o=i.row,s=i.column,c=u._getRowCalc(o,!1),h=u._getColumnCalc(s,!1),l=u._getRangeCalc(!1),i.adjustDelayOfListeners(!0),c&&c.adjustDelayOfListeners(!0),h&&h.adjustDelayOfListeners(!0),l&&l.adjustDelayOfListeners(o,s,!0);for(e=t._headNamIDs;e;e=e.nextDirty)e.adjustDelayOfListeners(!0);do{for(w=!1,i=t._head;i;i=a)if(a=i.nextDirty,i.delay===0){if(u=i.sourceModel,o=i.row,s=i.column,c=u._getRowCalc(o,!1),h=u._getColumnCalc(s,!1),h&&h.delay)continue;l=u._getRangeCalc(!1);u.recalculateCell(o,s);t.removeDirty(i,0);i.adjustDelayOfListeners(!1);c&&c.adjustDelayOfListeners(!1);h&&h.adjustDelayOfListeners(!1);l&&l.adjustDelayOfListeners(o,s,!1);w=!0}for(e=t._headNamIDs;e;e=e.nextDirty)e.delay===0&&(u=e.sourceModel,u.recalculateNameID(e.name),t.removeDirty(e,3),e.adjustDelayOfListeners(!1),w=!0)}while(w);if(t._head){for(k=!0,v=0;k&&v<t.maximumIterations;v++)for(k=!1,i=t._head;i;i=a)a=i.nextDirty,d=i.sourceModel,o=i.row,s=i.column,ut=d.getSource().getValue(o,s),d.recalculateCell(o,s),ft=d.getSource().getValue(o,s),t._iterationChange(ut,ft)>=t.maximumChange&&(k=!0),i.nextDirty=f,a&&(a.preDirty=f);t._head=t._tail=f}},n.prototype._iterationChange=function(n,t){var i=parseFloat(n),r=parseFloat(t);return it(r-i)},n.prototype.initParserContext=function(n){var t=this._parserContext;t||(this._parserContext=t=n.getParserContext(this.useR1C1,0,0,r))},n.prototype.getParserContext=function(n){var i=this,t=i._parserContext;return t||(n?i._parserContext=t=n.getParserContext(i.useR1C1,0,0,r):t=new et(r,i.useR1C1,0,0,r)),t.setSource(n),t},n.prototype.parse=function(n,t,i,r,u,f){var o=this,s=o._parseCache,e=o.getParserContext(n),h,c;return e.useR1C1=f?!1:o.useR1C1,e.ignoreError=u,e.row=i,e.column=r,s?(e.useR1C1||(e.useR1C1=!0,t=o._parser.a1ToR1C1(e,t)),h=s[t],h)?h:(c=o._parser.parse(t,e),s[t]=c,c):o._parser.parse(t,e)},n.prototype.unparse=function(n,t,i,r){var u=this.getParserContext(n);return u.useR1C1=this.useR1C1,u.row=i,u.column=r,this._parser.unparse(t,u)},n.prototype.unparseWithoutCulture=function(n,t,i,r,u){var f=this.getParserContext(n),e;return f.row=i,f.column=r,f.useR1C1=this.useR1C1,f.source=n,u&&(f.toStandard=!0,f.useR1C1=!1),e=this._parser.unparseWithoutCulture(t,f),f.toStandard=!1,e},n.prototype.isDirtyCell=function(n){return!!n.preDirty||n===this._head},n.prototype.addDirty=function(n,t){var i=this,u=i._headNames[t],f=i._tailNames[t];n&&!n.preDirty&&n!==i[u]&&(i[u]?i[f].nextDirty=n:i[u]=n,n.preDirty=i[f],n.nextDirty=r,i[f]=n)},n.prototype.removeDirty=function(n,t){var i=this,e=i._headNames[t],o=i._tailNames[t],u,f;n&&(n.preDirty||n===i[e])&&(u=n.preDirty,f=n.nextDirty,u?u.nextDirty=f:i[e]=f,f?f.preDirty=u:i[o]=u,n.preDirty=r,n.nextDirty=r)},n.prototype.isDirtyRow=function(n){return n.preDirty||n===this._headRows},n.prototype.isDirtyColumn=function(n){return n.preDirty||n===this._headCols},n.prototype.evaluateParsedFormula=function(n,t,i,u,o,c,l,a,v,y){var it=n.getEvaluatorContext(i,u,o,l,a,v,y),w,b,k,d,g;if(w=arguments.length===5&&o?this._evaluator.evaluateExpression(t,it,c,!0):this._evaluator.evaluateExpression(t,it,c,!1),o&&arguments.length<=5)return w;if(e.ref(w))if(b=w.getRowCount(0),k=w.getColumnCount(0),w.getRangeCount()<=0)return h;else if(w.getRangeCount()!==1)return s;else try{if(d=o?i-l:i-w.getRow(0),g=o?u-a:u-w.getColumn(0),b===1&&k===1)w=w.getValue(0,0,0);else if(b===1&&k>1&&g>=0&&g<k)w=w.getValue(0,0,g);else if(b>1&&k===1&&d>=0&&d<b)w=w.getValue(0,d,0);else if(o&&d<b&&g<k)w=w.getValue(0,d,g);else return o?p:s}catch(ut){return s}else if(e.arr(w))if(o){var rt=w,nt=rt.getRowCount(),tt=rt.getColumnCount();if(nt!=1&&i-l>=nt||tt!=1&&u-a>=tt)return p;w=w.getValue(nt==1?0:i-l,tt==1?0:u-a)}else w=w.getValueByIndex(0);return w===f||w===r?c===!1?w:0:w},n.prototype._getParserContext=function(n,t,i){var f=this,e=f._parseCache,u=f._parserContext;return u||(f._parserContext=u=n.getParserContext(f.useR1C1,0,0,r)),u.useR1C1=f.useR1C1,u.row=t,u.column=i,u},n.prototype.evaluate=function(n,t,i,r){var u=this;return u._evaluator.evaluateFormula(t,n.getParserContext(u.useR1C1,i,r),n.getEvaluatorContext(i,r,!1),!1)},n}();i.CalcService=gr,function(n){n[n.Adjust=0]="Adjust";n[n.dirty=1]="dirty"}(i.ListenerActions||(i.ListenerActions={}));du=i.ListenerActions;ri=function(){function n(n,t){this._lastNonNullRow=0;this._lastNonNullColumn=0;this._volatitleCells=[];var i=this;i.dataTable={};i.dataTableByName={};i._rowDataArray=[];i._columnDataArray=[];i._defaultDataNode=r;i._source=t;i._service=n}return n.prototype.getNode=function(n,t,i){var u=this,f=r,e;return n>=0&&t>=0?(e=u.dataTable[n],i&&!e&&(e=u.dataTable[n]={},n>u._lastNonNullRow&&(u._lastNonNullRow=n)),e&&(f=e[t],i&&!f&&(f=e[t]={},t>u._lastNonNullColumn&&(u._lastNonNullColumn=t)))):n===-1&&t>=0?(f=u._columnDataArray[t],i&&!f&&(f=u._columnDataArray[t]={},t>u._lastNonNullColumn&&(u._lastNonNullColumn=t))):n>=0&&t===-1?(f=u._rowDataArray[n],i&&!f&&(f=u._rowDataArray[n]={},t>u._lastNonNullColumn&&(u._lastNonNullColumn=t))):n===-1&&t===-1&&(f=u._defaultDataNode,i&&!f&&(f=u._defaultDataNode={})),f},n.prototype.getNodeByName=function(n,t){var r=this,i=r.dataTableByName[n];return t&&!i&&(i=r.dataTableByName[n]={}),i},n.prototype._getExpr=function(n,t){var i=this.getNode(n,t);return i&&i.expr},n.prototype.getExpr=function(n,t){return this._getExpr(n,t)},n.prototype.getArray=function(n,t){return this._getArrayInfo(n,t)},n.prototype.clearAll=function(){var n=this;n.clear(-1,-1,-1,-1);n.dataTable={};n.dataTableByName={};n._rowDataArray=[];n._columnDataArray=[];n._defaultDataNode=r},n.prototype.clear=function(n,t,i,r){this._clear(n,t,i,r)},n.prototype.addRows=function(n,i){var r=this,f=r.rC(),u;if(!(n<0)&&!(n>f)&&!(i<0))for(t._ModelHelper.addElements(r.dataTable,f,n,i),t._ModelHelper.addElements(r._rowDataArray,f,n,i),u=0;u<i;u++)r.dataTable[n+u]&&(r.dataTable[n+u]={rs:"n"})},n.prototype.deleteRows=function(n,i){var u=this,r=u.rC();n<0||n>=r||i<=0||(n+i>r&&(i=r-n),t._ModelHelper.deleteElements(u.dataTable,r,n,i),t._ModelHelper.deleteElements(u._rowDataArray,r,n,i))},n.prototype.addColumns=function(n,i){var f=this,o=f.rC(),r=f.cC(),u,e;if(!(n<0)&&!(n>r)&&!(i<0)){for(u=0;u<o;u++)e=f.dataTable[u],e&&n<r&&t._ModelHelper.addElements(e,r,n,i);t._ModelHelper.addElements(this._columnDataArray,r,n,i)}},n.prototype.deleteColumns=function(n,i){var e=this,o=e.rC(),r=e.cC(),u,f;if(!(n<0)&&!(n>=r)&&!(i<0)){for(u=0;u<o;u++)f=this.dataTable[u],f&&n<r&&t._ModelHelper.deleteElements(f,r,n,i);t._ModelHelper.deleteElements(this._columnDataArray,r,n,i)}},n.prototype._setExpr=function(n,t,i){var r=this.getNode(n,t,!0);r.expr=i},n.prototype._clearAllExpr=function(n,t){var i=this.getNode(n,t,!0);i&&(i.expr=f,i.workingExpr&&(i.workingExpr=f),i.arrayInfo&&(i.arrayInfo=f),i.isVolatile&&this._removeVolatile(i))},n.prototype._copyExpr=function(n,i,r,u,f){var e=this.getNode(i,r),o;e&&e.expr&&(o=n.getNode(u,f,!0),e.arrayInfo&&(o.arrayInfo=new t.Range(u,f,e.arrayInfo.rowCount-(i-e.arrayInfo.row),e.arrayInfo.colCount-(r-e.arrayInfo.col))),o.expr=e.expr,e.workingExpr&&(o.workingExpr=e.workingExpr));e&&e.isVolatile&&(o.isVolatile=!0)},n.prototype._containsNoe=function(n,t){var r=this.dataTable,i=r[n];return i&&i[t]},n.prototype._getWorkingExpr=function(n,t){var i=this.getNode(n,t);return i&&i.workingExpr},n.prototype._setWorkingExpr=function(n,t,i){var r=this.getNode(n,t,!0);r.workingExpr=i},n.prototype._getArrayInfo=function(n,t){var i=this.getNode(n,t);return i&&i.arrayInfo},n.prototype._setArrayInfo=function(n,t,i){var r=this.getNode(n,t,!0);r.arrayInfo=i},n.prototype._getCalc=function(n,t){var i=this.getNode(n,t);return i&&i.calc},n.prototype._setCalc=function(n,t,i){var r=this.getNode(n,t,!0);r&&(r.calc&&r.calc.isVolatile&&this._removeVolatile(r),r.calc=i,i&&(i.node=r))},n.prototype._setNode4Swap=function(n,t,i,r,u){var f=this,e;i>=0&&r>=0?(e=f.dataTable[i],e||(e=f.dataTable[i]={}),e[r]=u,u&&u.calc&&delete u.calc):i>=0&&r===-1&&n>=0&&t===-1?f._rowDataArray[i]=u:r>=0&&i===-1&&t>=0&&n===-1&&(f._columnDataArray[r]=u)},n.prototype._swapNode=function(n,t,i,u){var f=this,e=f.getNode(n,t),o=f.getNode(i,u);e?f._setNode4Swap(n,t,i,u,e):o&&f._setNode4Swap(n,t,i,u,r);o?f._setNode4Swap(i,u,n,t,o):e&&f._setNode4Swap(i,u,n,t,r)},n.prototype._getAllVolatitles=function(){return this._volatitleCells},n.prototype._setVolatile=function(n){n.isVolatile||(n.isVolatile=!0,this._volatitleCells.push(n))},n.prototype._removeVolatile=function(n){var i,r,t;for(n.isVolatile=undefined,i=this._volatitleCells,r=i.length,t=0;t<r;t++)if(i[t]===n){i.splice(t,1);return}},n.prototype._clearCore=function(n,t){for(var i,r=0;r<n.length;r++)i=n[r],i&&(t&1)>0&&(i.arrayInfo&&(i.arrayInfo=f),i.expr&&(i.expr=f),i.workingExpr&&(i.workingExpr=f))},n.prototype.getCalcService=function(){return this._service},n.prototype.setCalcService=function(n){this._service=n},n.prototype.getSource=function(){return this._source},n.prototype.hasFormula=function(n,t){return n=n!==f?n:-1,t=t!==f?t:-1,!!this.getExpression(n,t)},n.prototype.setFormula=function(n,i,u,e){var o=this,s,h,c,l;if(u&&u.length===0&&(u=r),!e&&o._intersectWithArrayFormula(n,i,1,1)&&o._throwArrayPartException(),s=o.getFormula(n,i),s!==u&&!(s===""&&!u||!s&&u==="")){if(h=o.getCalcService(),c=r,h)try{c=u?h.parse(o._source,u,n>=0?n:0,i>=0?i:0,e,e):r;o.setExpression(n,i,c,f,!1)}catch(a){if(!e)throw a;}n>=0&&i>=0&&(l=t.Culture()===""||t.Culture()==="en-us",o._source.setFormula(n,i,e||l?u:h.unparseWithoutCulture(o._source,c,n,i)))}},n.prototype.getFormula=function(n,t){var f=this.getCalcService(),u,i;return f&&(u=this.getExpression(n,t),u)?(i=this.getArrayInfo(n,t),n=i?i.row:n,t=i?i.col:t,f.unparse(this._source,u,n,t)):r},n.prototype.setFormulaByName=function(n,i,u){var e,o,s,h,c;if(n&&(n=n.toUpperCase(),e=this,i&&i.length===0&&(i=r),o=e.getFormulaByName(n),o!==i&&!(o===""&&!i||!o&&i===""))){if(s=e.getCalcService(),h=r,s)try{h=i?s.parse(e._source,i,0,0,u):r;e.setExpressionByName(n,h,f,!1)}catch(l){if(!u)throw l;}c=t.Culture()===""||t.Culture()==="en-us";e._source.setFormulaByName(n,u||c?i:s.unparseWithoutCulture(e._source,h,0,0))}},n.prototype.getFormulaByName=function(n){var i=this.getCalcService(),t;return i&&n&&(t=this.getExpressionByName(n.toUpperCase()),t)?i.unparse(this._source,t,0,0):r},n.prototype._throwArrayPartException=function(){throw t.SR.Exp_ArrayFromulaPart;},n.prototype.rC=function(){return Math.min(this._source.getRowCount())},n.prototype.cC=function(){return Math.min(this._source.getColumnCount())},n.prototype.setArrayFormula=function(n,i,u,f,e,o){var s=this,h,a,c,l;if((e&&e.length===0&&(e=r),s._intersectWithArrayFormula(n,i,u,f)&&s._throwArrayPartException(),n=n<0?0:n,i=i<0?0:i,h=s.getCalcService(),h)&&(s._clear(n,i,u,f),e)){try{a=e?h.parse(s._source,e,n,i,o,o):r}catch(v){if(!o)throw v;return}for(c=n;c<n+u;c++)for(l=i;l<i+f;l++)s.setExpression(c,l,a,new t.Range(n,i,u,f),!1);n>=0&&i>=0&&s._source.setArrayFormula(n,i,u,f,h.unparseWithoutCulture(s._source,a,n,i))}},n.prototype.getExprInfo=function(n,t,i){var e=this,f=r,u,o=e._source;return n>=o.getRowCount()||t>=o.getColumnCount()?f:(n>=0&&t>=0?(u=e.getNode(n,t),f=u&&u[i],f||(u=e.getNode(n,-1),f=u&&u[i]),f||(u=e.getNode(-1,t),f=u&&u[i])):n>=0&&t===-1?(u=e.getNode(n,-1),f=u&&u[i]):n===-1&&t>=0?(u=e.getNode(-1,t),f=u&&u[i]):(u=e.getNode(-1,-1),f=u&&u[i]),f)},n.prototype.getArrayInfo=function(n,t){return this.getExprInfo(n,t,au)},n.prototype.getWorkingExpression=function(n,t){return this.getExprInfo(n,t,vu)},n.prototype.getExpression=function(n,t){return this.getExprInfo(n,t,lu)},n.prototype.getWorkingExpressionByName=function(n){var t=this.getNodeByName(n);return t&&t.workingExpr},n.prototype.getExpressionByName=function(n){var t=this.getNodeByName(n);return t&&t.expr},n.prototype.setExpression=function(n,t,i,r,e){var o=this,c=o.getCalcService(),s=r!==f&&r!==null,v=new k(o._source,s,s?r.row:n,s?r.col:t),h=u._mappingArray(v,i,s,s?n-r.row:0,s?t-r.col:0),l,a;h=h===i?f:h;r!==f&&(l=r);n>=0&&t>=0?((e===f||e)&&(a=i?c.unparseWithoutCulture(o._source,i,n>=0?n:0,t>=0?t:0):f,o._source.setFormula(n,t,a)),o._setCellExpression(n,t,i,h,l)):n>=0&&t===-1?o._setRowExpression(n,i,h):n===-1&&t>=0&&o._setColumnExpression(t,i,h);c.autoCalculation&&!c.IsSuspended()&&c.recalculateAll(!1)},n.prototype.setExpressionByName=function(n,t,i,r){var e=this,o=e.getCalcService(),c=new k(e._source,!1,0,0),s=u._mappingArray(c,t,!1,0,0),h;s=s===t?f:s;(r===f||r)&&(h=t?o.unparseWithoutCulture(e._source,t,0,0):f,e._source.setFormulaByName(n,h));e._setNameExpression(n,t,s);o.autoCalculation&&!o.IsSuspended()&&o.recalculateAll(!1)},n.prototype.getRowExpression=function(n){return this.getExpression(n,-1)},n.prototype.getColumnExpression=function(n){return this.getExpression(-1,n)},n.prototype._setNameExpression=function(n,t,i){var f=this,r=f._getNameIDCalc(n,!0),u;r&&(r.stopListening(),u=this.getNodeByName(n,!0),u.expr=t,i=t&&i?i:undefined,u.workingExpr=i,r.startListening(),f._service.addDirty(r,3))},n.prototype._setCellExpression=function(n,t,i,r,u){var e=this,o;o=u?e._getCellCalc(n,t,!0):e._getCellCalc(n,t,!0);o&&(o.stopListening(),e._setExpr(n,t,i),i?((r||e._getWorkingExpr(n,t))&&e._setWorkingExpr(n,t,r),(u||e.getArrayInfo(n,t))&&e._setArrayInfo(n,t,u)):(e._setWorkingExpr(n,t,f),e._setArrayInfo(n,t,f)),o.startListening(),e._service.addDirty(o,0))},n.prototype._setRowExpression=function(n,t,i){var r=this,u=r._getRowCalc(n,!0);u&&(u.stopListening(),r._setExpr(n,-1,t),(i||r._getWorkingExpr(n,-1))&&r._setWorkingExpr(n,-1,i),u.startListening(),r._service.addDirty(u,1))},n.prototype._setColumnExpression=function(n,t,i){var r=this,u=r._getColumnCalc(n,!0);u&&(u.stopListening(),r._setExpr(-1,n,t),(i||r._getWorkingExpr(-1,n))&&r._setWorkingExpr(-1,n,i),u.startListening(),r._service.addDirty(u,2))},n.prototype._clear=function(n,i,u,e){for(var c,o=this,a=n<0?0:n,v=i<0?0:i,w=n<0?o.rC():u,b=i<0?o.cC():e,k=a+w-1,d=v+b-1,g=o.getCalcService(),nt=!1,tt=[],it=[],y,p,s,l=function(n,i){if(y=o._getWorkingExpr(n,i),p=o._getExpr(n,i),y||p){s=o._getArrayInfo(n,i);var u=s?new t.Range(s.row,s.col,s.rowCount,s.colCount):f;o.setExpression(n,i,r,u,!0)}},h=a;h<=k&&h>=0;h++)for(i<0&&l(h,-1),c=v;c<=d&&c>=0;c++)h===a&&n<0&&l(-1,c),l(h,c);n<0&&i<0&&l(n,i)},n.prototype._intersectWithArrayFormula=function(n,t,i,r){return this._getFormulaExps(n,t,i,r,!0,!0)},n.prototype._getFormulaExps=function(n,i,r,u,f,e){for(var h,o,v,c=this,a=n<0?0:n,y=i<0?0:i,k=n<0?c.rC():r,d=i<0?c.cC():u,g=a+(k===0?1:k)-1,nt=y+(d===0?1:d)-1,rt=c.getCalcService(),tt=!1,p=[],w=[],l,b,it=c.dataTable,s=a;s<=g&&s>=0;s++){if(s>c._lastNonNullRow)break;if(b=it[s],b)for(h=y;h<=nt&&h>=0;h++){if(h>c._lastNonNullColumn)break;if(l=b[h],l)if(o=l.arrayInfo,o){if(o.row<a||o.row+o.rowCount-1>g||o.col<y||o.col+o.colCount-1>nt){if(f)return!0;tt=!0}if(s!==o.row&&s!==a)continue;p.push(new t.Range(o.row,o.col,o.rowCount,o.colCount));v=l.expr;w.push(v);h=o.col+o.colCount-1}else!e&&(v=l.expr)&&(p.push({row:s,col:h}),w.push(v))}}return f?!1:{hasPart:tt,ranges:p,formulas:w}},n.prototype._getNameIDCalc=function(n,t){var f=this,i=r,u=f.getNodeByName(n,t);return u&&(i=u.calc,!i&&t&&(i=new bi(f,n),u.calc=i,i.node=u)),i},n.prototype._getCellCalc=function(n,t,i){var u=this,f=r,s,o,e;if(n>=0&&t>=0){if(s=u.dataTable,o=s[n],!o)if(i)o=s[n]={},n>u._lastNonNullRow&&(u._lastNonNullRow=n);else return f;if(e=o[t],!e)return i&&(e=o[t]={},f=new vt(u,n,t),e.calc=f,f.node=e,t>u._lastNonNullColumn&&(u._lastNonNullColumn=t)),f;f=e.calc;!f&&i&&(f=new vt(u,n,t),e.calc=f,f.node=e,n>u._lastNonNullRow&&(u._lastNonNullRow=n),t>u._lastNonNullColumn&&(u._lastNonNullColumn=t))}return f},n.prototype._getRowCalc=function(n,t){var i=this,u=r;return n>=0&&(u=i._getCalc(n,-1),!u&&t&&(u=new yi(i,n),i._setCalc(n,-1,u),n>i._lastNonNullRow&&(i._lastNonNullRow=n))),u},n.prototype._getColumnCalc=function(n,t){var i=this,u=r;return n>=0&&(u=i._getCalc(-1,n),!u&&t&&(u=new pi(i,n),i._setCalc(-1,n,u),n>i._lastNonNullColumn&&(i._lastNonNullColumn=n))),u},n.prototype._getRangeCalc=function(n){var t=this;return!t._rangeCalc&&n&&(t._rangeCalc=new ki(t)),t._rangeCalc},n.prototype._getNameCalc=function(n,t){var i=this,u=r,f;return i._nameCalcs||(i._nameCalcs={}),u=i._nameCalcs[n],!u&&t&&(u=i._nameCalcs[n]=new wi(i,n)),u},n.prototype._addColumnsToDirty=function(n,t){for(var u,r=this,f=Math.min(r._lastNonNullColumn,n+t-1),i=n;i!==-1&&i<=f;i++)r.isDirty(-1,i)&&(u=r._getColumnCalc(i,!0),r._service.addDirty(u,2))},n.prototype._addRowsToDirty=function(n,t){for(var u,r=this,f=Math.min(r._lastNonNullRow,n+t-1),i=n;i!==-1&&i<=f;i++)r.isDirty(i,-1)&&(u=r._getRowCalc(i,!0),r._service.addDirty(u,1))},n.prototype._addCellsToDirty=function(n,t,i,r){for(var f,s,o,u=this,h=Math.min(u._lastNonNullRow,n+i-1),c=Math.min(u._lastNonNullColumn,t+r-1),e=n;e<=h;e++)for(f=t;f<=c;f++)u._containsNoe(e,f)&&(s=u._getCellCalc(e,f,!0),u._service.addDirty(s,0));u._addRowsToDirty(n,i);u._addColumnsToDirty(t,r);o=u._getRangeCalc(!1);o&&o.addListenersToDirty(n,t,i,r)},n.prototype._addVolatitlesToDirty=function(){for(var t,e,n=this,f=n._getAllVolatitles(),i,r,u=0;u<f.length;u++)t=f[u],t&&t instanceof vt&&!n._service.isDirtyCell(t)&&(e=n._getCellCalc(t.row,t.column,!0),n._service.addDirty(e,0),i=n._getRowCalc(t.row,!1),i&&!n._service.isDirtyRow(i)&&n._addRowsToDirty(t.row,1),r=n._getColumnCalc(t.column,!1),r&&!n._service.isDirtyRow(r)&&n._addColumnsToDirty(t.column,1))},n.prototype._checkAndUpdateVolatitles=function(){for(var n=this,e=n._getAllVolatitles(),u,f,i=!0,o=5,r,t,s;i&&o;){for(i=!1,o--,r=0;r<e.length;r++)t=e[r],t&&t instanceof vt&&!n._service.isDirtyCell(t)&&n.recalculateCell(t.row,t.column)&&(i=!0,s=n._getCellCalc(t.row,t.column,!0),n._service.addDirty(s,0),u=n._getRowCalc(t.row,!1),u&&!n._service.isDirtyRow(u)&&n._addRowsToDirty(t.row,1),f=n._getColumnCalc(t.column,!1),f&&!n._service.isDirtyRow(f)&&n._addColumnsToDirty(t.column,1));i&&n._service._recalculateImp(!0)}},n.prototype.isDirty=function(n,t){return!!(this._getCalc(n,t)||this._getExpr(n,t))},n.prototype.recalculateCell=function(n,t){var i=this,e=i._source,o=i.getWorkingExpression(n,t)||i.getExpression(n,t),u;if(o){var f=e.getValue(n,t),s=!1,h,c,l,a,r=i.getArrayInfo(n,t);if(r&&(s=!0,h=r.row,c=r.col,l=r.rowCount,a=r.colCount),u=i._service.evaluateParsedFormula(i._source,o,n,t,s,!0,h,c,l,a),f===u)return;else if(f instanceof Date&&u instanceof Date&&f.valueOf()===u.valueOf())return!1;return e.setValue(n,t,u),!0}return!1},n.prototype.recalculateNameID=function(n){var t=this,u=t._source,f=t.getWorkingExpressionByName(n)||t.getExpressionByName(n),r,i;if(f){if(r=u.getValueByName(n),i=t._service.evaluateParsedFormula(t._source,f,0,0,!1,!0,0,0,1,1),r===i)return;else if(r instanceof Date&&i instanceof Date&&r.valueOf()===i.valueOf())return;u.setValueByName(n,i)}},n.prototype._dealWithExpression=function(n,t,f,e,o,s){for(var w=this,d,st,ht,g,ut,nt,ft,wt,bt,p,tt,rt,a,v,b,l,k,h,at,kt,y,vt,pt,ot,yt,lt,ct,gt,et,ni,dt;e.t===24;)e=e.expr;while(e.t===14)e=e.argument;while(e.t===24)e=e.expr;if(e.t===17){if(d=e.getRange(t,f,!0),d===r)return;e=d.rowCount===1&&d.columnCount===1?new u.CellExpression(d.row,d.column,!1,!1):new u.RangeExpression(d.row,d.column,d.row+d.rowCount-1,d.column+d.columnCount-1,!1,!1,!1,!1)}if(o&&o!==e&&(o.t===8||o.t===9)&&(ot=o.name.toUpperCase(),b=o.source||w._source,b.getCustomName(ot)?l=b.getCalcSourceModel():(l=w._service.getGlobalSourceModel(),l.getSource().getCustomName(ot)||(yt=b.getCalcSourceModel()._getNameCalc(ot,!0),yt.processCellListener(n,s))),lt=l._getNameCalc(ot,!0),lt.processCellListener(n,s),o=null),e.t===0||e.t===1){if(k=e,b=e.source||w._source,l=b.getCalcSourceModel(),0<=t&&0<=f){if(st=k.row+(k.rowRelative?t:0),ht=k.column+(k.columnRelative?f:0),p=l._getCellCalc(st,ht,!0),!p)return;p.processCellListener(n,s)}else if(0<=t&&f===-1)if(st=k.row+(k.rowRelative?t:0),ht=k.column,k.columnRelative){if(tt=l._getRowCalc(st,!0),!tt)return;tt.processRowListener2(n,-ht,s)}else{if(p=l._getCellCalc(st,ht,!0),!p)return;p.processRowListener(n,s)}else if(t===-1&&0<=f)if(st=k.row,ht=k.column+(k.columnRelative?f:0),k.rowRelative){if(rt=l._getColumnCalc(ht,!0),!rt)return;rt.processColumnListener2(n,-st,s)}else{if(p=l._getCellCalc(st,ht,!0),!p)return;p.processColumnListener(n,s)}}else if(e.t===2||e.t===3)if(b=e.source||w._source,l=b.getCalcSourceModel(),h=e,at=h._getRangeType(),at===c.cell){if(0<=t&&0<=f)if(g=h.startRow+(h.startRowRelative?t:0),nt=h.startColumn+(h.startColumnRelative?f:0),ut=h.endRow+(h.endRowRelative?t:0),ft=h.endColumn+(h.endColumnRelative?f:0),wt=it(ut-g)+1,bt=it(ft-nt)+1,w.shouldUseRange(st,ht,wt,bt)){if(kt=l._getRangeCalc(!0),!kt)return;kt.processCellListener(g,nt,wt,bt,n,s)}else for(a=g;a<=ut;a++)for(v=nt;v<=ft;v++)p=l._getCellCalc(a,v,!0),p&&p.processCellListener(n,s);else if(0<=t&&f===-1)for(g=h.startRow+(h.startRowRelative?t:0),nt=h.startColumn,ut=h.endRow+(h.endRowRelative?t:0),ft=h.endColumn,a=g;a<=ut;a++)for(v=nt;v<=ft;v++)h.startColumnRelative||h.endColumnRelative?(tt=l._getRowCalc(a,!0),tt&&tt.processRowListener2(n,-v,s)):(p=l._getCellCalc(a,v,!0),p&&p.processRowListener(n,s));else if(t===-1&&0<=f)for(g=h.startRow,nt=h.startColumn+(h.startColumnRelative?f:0),ut=h.endRow,ft=h.endColumn+(h.endColumnRelative?f:0),a=g;a<=ut;a++)for(v=nt;v<=ft;v++)h.startRowRelative||h.endRowRelative?(rt=l._getColumnCalc(v,!0),rt&&rt.processColumnListener2(n,-a,s)):(p=l._getCellCalc(a,v,!0),p&&p.processColumnListener(n,s))}else if(at===c.row){if(0<=t&&0<=f)for(g=h.startRow+(h.startRowRelative?t:0),ut=h.endRow+(h.endRowRelative?t:0),a=g;a<=ut;a++)tt=l._getRowCalc(a,!0),tt&&tt.processCellListener(n,s);else if((!(0<=t)||f!==-1)&&t===-1&&0<=f&&!h.startRowRelative&&!h.endRowRelative)for(g=h.startRow,ut=h.endRow,a=g;a<=ut;a++)tt=l._getRowCalc(a,!0),tt&&tt.processColumnListener(n,s)}else if(at===c.column){if(0<=t&&0<=f)for(nt=h.startColumn+(h.startColumnRelative?f:0),ft=h.endColumn+(h.endColumnRelative?f:0),v=nt;v<=ft;v++)rt=l._getColumnCalc(v,!0),rt&&rt.processCellListener(n,s);else if((!(0<=t)||f!==-1)&&t===-1&&0<=f)for(nt=h.startColumn+(h.startColumnRelative?f:0),ft=h.endColumn+(h.endColumnRelative?f:0),v=nt;v<=ft;v++)rt=l._getColumnCalc(v,!0),rt&&rt.processColumnListener(n,s)}else at===c.sheet&&(0<=t&&0<=f||0<=t&&f===-1||t===-1&&0<=f);else if(e.t===16)for(y=e,vt=y.startSource.getSources(y.endSource),et=0;et<vt.length;et++)pt=new u.ExternalRangeExpression(vt[et],y.startRow,y.startColumn,y.endRow,y.endColumn,y.startRowRelative,y.startColumnRelative,y.endRowRelative,y.endColumnRelative),y.isFullRow?pt.initBand(vt[et],y.startRow,y.endRow,y.startRowRelative,y.endRowRelative,!0):y.isFullColumn&&pt.initBand(vt[et],y.startColumn,y.endColumn,y.startColumnRelative,y.endColumnRelative,!1),w._dealWithExpression(n,t,f,pt,r,s);else if(e.t===11)w._dealWithExpression(n,t,f,e.operand,o&&o.t===11&&o.operand,s);else if(e.t===10)w._dealWithExpression(n,t,f,e.left,o&&o.t===10&&o.left,s),w._dealWithExpression(n,t,f,e.right,o&&o.t===10&&o.right,s);else if(e.t===8||e.t===9){if(b=e.source||w._source,ot=e.name.toUpperCase(),b.getCustomName(ot)?l=b.getCalcSourceModel():(l=w._service.getGlobalSourceModel(),l.getSource().getCustomName(ot)||(yt=b.getCalcSourceModel()._getNameCalc(ot,!0),yt.processCellListener(n,s))),lt=l._getNameCalc(ot,!0),!lt)return;lt.processCellListener(n,s);w._dealWithExpression(n,t,f,b.getCustomName(e.name),r,s)}else if(e.t===7){if(ct=e,ct.fn&&ct.fn instanceof i.Functions.Function&&(ct.fn.isVolatile()&&(s?w._setVolatile(n):w._removeVolatile(n)),!ct.fn.precedentReference()))return;for(gt=ct.argCount(),et=0;et<gt;et++)w._dealWithExpression(n,t,f,ct.getArg(et),o&&o.t===7&&o.getArg(et),s)}else if(e.t===25||e.t===26){if(ni=e,b=e.source||w._source,l=b.getCalcSourceModel(),dt=l._getNameIDCalc(ni.nameIdentity,!0),!dt)return;dt.processCellListener(n,s)}},n.prototype.shouldUseRange=function(n,t,i,r){return n===-1&&r>127||t===-1&&i>127||i*r>127},n.prototype.dealWithNameIDExpression=function(n,t){var i=this.getNodeByName(n);i&&(i.workingExpr||i.expr)&&this._dealWithExpression(this._getNameIDCalc(n),0,0,i.workingExpr||i.expr,i.expr,t)},n.prototype.dealWithCellExpression=function(n,t,i,r,u){for(var f,o=this,l=n+i,a=t+r,h,s,c,e=n;e<l;e++)for(f=t;f<a;f++)h=o._getWorkingExpr(e,f),s=o._getExpr(e,f),(h||s)&&(c=o._getArrayInfo(e,f),c?o._dealWithExpression(o._getCellCalc(e,f),c.row,c.col,h||s,s,u):o._dealWithExpression(o._getCellCalc(e,f),e,f,h||s,s,u))},n.prototype._dealWithColumnExpression=function(n,t,i){for(var u,f=n+t,r=n;r!==-1&&r<f;r++)u=this.getColumnExpression(r),u&&this._dealWithExpression(this._getColumnCalc(r,!1),-1,r,u,u,i)},n.prototype.linkCellExpression=function(n,t,i,r){this.dealWithCellExpression(n,t,i,r,!0)},n.prototype.unlinkCellExpression=function(n,t,i,r){this.dealWithCellExpression(n,t,i,r,!1)},n.prototype.linkRowExpression=function(n,t){},n.prototype.unlinkRowExpression=function(n,t){},n.prototype.linkColumnExpression=function(n,t){this._dealWithColumnExpression(n,t,!0)},n.prototype.unlinkColumnExpression=function(n,t){this._dealWithColumnExpression(n,t,!1)},n.prototype._iterateEachCell=function(n,t,i,r,u,f){for(var e,o,h=n+i,c=t+r,s=n;s<h;s++)for(e=t;e<c;e++)o=this._getCellCalc(s,e,!1),o&&(u&&o.addListenersToAdjust(),f&&o.addListenersToDirty())},n.prototype._iterateEachRow=function(n,t,i,r){var e=this._rowDataArray,u,f,o;if(e)for(u=n;u!==-1&&u<n+t&&u<e.length;u++)(f=e[u],f&&f.calc)&&(o=f.calc,i&&o.addListenersToAdjust(),r&&o.addListenersToDirty())},n.prototype._iterateEachColumn=function(n,t,i,r){var e=this._columnDataArray,u,f,o;if(e)for(u=n;u!==-1&&u<n+t&&u<e.length;u++)(f=e[u],f&&f.calc)&&(o=f.calc,i&&o.addListenersToAdjust(),r&&o.addListenersToDirty())},n.prototype.addDependents=function(n,t,i,r,u,f){var e,o,s;(u||f)&&(e=this,0<=n&&0<=t?(e._iterateEachCell(n,t,i,r,u,f),e._iterateEachRow(n,i,u,f),e._iterateEachColumn(t,r,u,f),e._rangeCalc&&(u&&e._rangeCalc.addListenersToAdjust(n,t,i,r),f&&e._rangeCalc.addListenersToDirty(n,t,i,r))):0<=n&&t===-1?(e._iterateEachCell(n,0,i,e.cC(),u,f),e._iterateEachRow(n,i,u,f),e._rangeCalc&&(u&&e._rangeCalc.addListenersToAdjust(n,t,i,r),f&&e._rangeCalc.addListenersToDirty(n,t,i,r))):n===-1&&0<=t?(e._iterateEachCell(0,t,e.rC(),r,u,f),e._iterateEachColumn(t,r,u,f),e._rangeCalc&&(u&&e._rangeCalc.addListenersToAdjust(n,t,i,r),f&&e._rangeCalc.addListenersToDirty(n,t,i,r))):n===-1&&t===-1&&(o=e.rC(),s=e.cC(),e._iterateEachCell(0,0,o,s,u,f),e._iterateEachRow(0,o,u,f),e._iterateEachColumn(0,s,u,f),e._rangeCalc&&(u&&e._rangeCalc.addListenersToAdjust(n,t,i,r),f&&e._rangeCalc.addListenersToDirty(n,t,i,r))))},n.prototype.getAllNodes=function(){var t=[],r=this.dataTable,u=this._rowDataArray,f=this._columnDataArray,e=this._defaultDataNode,i,n,o;e&&t.push(e);for(n in u)t.push(u[n]);for(n in f)t.push(f[n]);for(o in r){i=r[o];for(n in i)t.push(i[n])}return t},n.prototype.toJSON=function(n){this._source.toJSON(n,this.dataTable)},n}();i.CalcSourceModel=ri;var hf="cell",cf="row",lf="column",ct="cellListeners",lt="rowListeners",at="columnListeners",vi="rowSliceListeners",gu="columnSliceListeners",pt=function(){function n(n){this.cellListeners=[];this.rowListeners=[];this.columnListeners=[];this.sourceModel=n}return n.prototype.hasListeners=function(){for(var t,i=this,r=i._listeners,n=0;n<r.length;n++)if(t=i[r[n]],t&&t.length>0)return!0;return!1},n.prototype.processCellListener=function(n,t){var r=this.cellListeners,i;if(t)r.push(n);else for(i=0;i<r.length;i++)if(r[i]===n){r.splice(i,1);return}},n.prototype.processRowListener=function(n,t){var r=this.rowListeners,i;if(t)r.push(n);else for(i=0;i<r.length;i++)if(r[i]===n){r.splice(i,1);return}},n.prototype.processColumnListener=function(n,t){var r=this.columnListeners,i;if(t)r.push(n);else for(i=0;i<r.length;i++)if(r[i]===n){r.splice(i,1);return}},n.prototype.addListenersToAdjust=function(){for(var n,f,t,r=this._listeners,u,i=0;i<r.length;i++)if(n=this[r[i]],n)for(f=n.length,t=0;t<f;t++)u=n[t],u.addToAdjust()},n.prototype.addListenersToDirty=function(){for(var t,f,i,u=this._listeners,n,r=0;r<u.length;r++)if(t=this[u[r]],t)for(f=t.length,i=0;i<f;i++)n=t[i],n.preDirty||n.nextDirty||n.addToDirty()},n.prototype.adjustDelayOfListeners=function(n){for(var t,e,i,u=this._listeners,f,o=n?1:-1,r=0;r<u.length;r++)if(t=this[u[r]],t)for(e=t.length,i=0;i<e;i++)f=t[i],f.delay+=o},n.prototype.addToAdjust=function(){},n.prototype.addToDirty=function(){},n.prototype.stopListening=function(){},n.prototype.startListening=function(){},n}();i.BaseCalc=pt;vt=function(n){function t(t,i,r){n.call(this,t);var u=this;u.row=i;u.column=r;u.delay=0;u._listeners=[ct,lt,at]}return __extends(t,n),t.prototype.startListening=function(){var n=this;n.sourceModel.linkCellExpression(n.row,n.column,1,1)},t.prototype.stopListening=function(){var n=this;n.sourceModel.unlinkCellExpression(n.row,n.column,1,1)},t.prototype.addToAdjust=function(){this.sourceModel.getCalcService().getOperatorAdjustor().addAdjust(this,0)},t.prototype.addToDirty=function(){this.sourceModel.getCalcService().addDirty(this,0)},t}(pt);i.CellCalc=vt;yi=function(n){function t(t,i){n.call(this,t);var r=this;r.row=i;r._listeners=[ct,lt,vi,at]}return __extends(t,n),t.prototype.incrementDelay2=function(n,t){},t.prototype.decrementDelay2=function(n,t){},t.prototype.startListening=function(){this.sourceModel.linkRowExpression(this.row,1)},t.prototype.stopListening=function(){this.sourceModel.unlinkRowExpression(this.row,1)},t.prototype.processRowListener2=function(n,t,i){i?nf(this,vi,{row:n,columnOffset:t,columnCount:1}):tf(this,vi,{row:n,columnOffset:t,columnCount:1})},t.prototype.addToAdjust=function(){this.sourceModel.getCalcService().getOperatorAdjustor().addAdjust(this,1)},t.prototype.addToDirty=function(){this.sourceModel.getCalcService().addDirty(this,1)},t}(pt);i.RowCalc=yi;pi=function(n){function t(t,i){n.call(this,t);var r=this;r.column=i;r._listeners=[ct,lt,at,gu]}return __extends(t,n),t.prototype.incrementDelay2=function(n,t){},t.prototype.decrementDelay2=function(n,t){},t.prototype.startListening=function(){this.sourceModel.linkColumnExpression(this.column,1)},t.prototype.stopListening=function(){this.sourceModel.unlinkColumnExpression(this.column,1)},t.prototype.processColumnListener2=function(n,t,i){this.processColumnListener(n,i)},t.prototype.addToAdjust=function(){this.sourceModel.getCalcService().getOperatorAdjustor().addAdjust(this,2)},t.prototype.addToDirty=function(){this.sourceModel.getCalcService().addDirty(this,2)},t}(pt);i.ColumnCalc=pi;wi=function(n){function t(t,i){n.call(this,t);this.name=i;this._listeners=[ct,lt,at]}return __extends(t,n),t.prototype.updateListening=function(n,t){for(var u,h,f,o=this,s=o._listeners,i,r,e=0;e<s.length;e++)if(u=o[s[e]],u)for(h=u.length,f=0;f<h;f++)i=u[f],r=i.node,i.stopListening(),r&&(!r.arrayInfo||r.arrayInfo.row===i.row&&r.arrayInfo.col===i.column)&&i.sourceModel.setExpression(i.row,i.column,r.expr,r.arrayInfo,!0)},t.prototype.updateListeningOnRemoved=function(){for(var o,v,s,y,c,i=this,l=i._listeners,r,u,n,t,e,a=i.sourceModel,p=a.getCalcService(),h=0;h<l.length;h++)if(o=i[l[h]],o)for(v=o.length,s=0;s<v;s++)r=o[s],u=r.sourceModel,n=r.row,t=r.col,n=n===f?-1:n,t=t===f?-1:t,e=u.getExpr(n,t),y=u.getArrayInfo(n,t),e&&(c=p.getOperatorAdjustor().adjustFormulaOnRemoveName(a,e,i.name),c!==e&&u.setExpression(n,t,c,y,!0))},t.prototype.addToDirty=function(){for(var n,f,t,r=this._listeners,u,i=0;i<r.length;i++)if(n=this[r[i]],n)for(f=n.length,t=0;t<f;t++)u=n[t],u.addToDirty()},t}(pt);i.NameCalc=wi;bi=function(n){function t(t,i){n.call(this,t);var r=this;r.name=i;r.delay=0;r._listeners=[ct,lt,at]}return __extends(t,n),t.prototype.startListening=function(){var n=this;n.sourceModel.dealWithNameIDExpression(n.name,!0)},t.prototype.stopListening=function(){var n=this;n.sourceModel.dealWithNameIDExpression(n.name,!1)},t.prototype.addToAdjust=function(){this.sourceModel.getCalcService().getOperatorAdjustor().addAdjust(this,3)},t.prototype.addToDirty=function(){this.sourceModel.getCalcService().addDirty(this,3)},t}(pt);i.NameIDCalc=bi;ki=function(){function n(n){this.sourceModel=n;this._listeners=[ct,lt,at]}return n.prototype.processListener=function(n,t,i,r,u,f,e){var c=this,h=c[n],l=t+","+i+","+r+","+u,o,s;if(h||(c[n]=h={}),o=h[l],!o){if(!e)return;o=h[l]=[];o.row=t;o.column=i;o.rowCount=r;o.columnCount=u}if(e){for(s=0;s<o.length;s++)if(o[s]===f)return;o.push(f)}else for(s=0;s<o.length;s++)o[s]===f&&o.splice(s,1)},n.prototype.processCellListener=function(n,t,i,r,u,f){this.processListener(ct,n,t,i,r,u,f)},n.prototype.processRowListener=function(n,t,i,r,u,f,e,o,s){this.processListener(lt,n,t,i,r,u,s)},n.prototype.processColumnListener=function(n,t,i,r,u,f,e,o,s){this.processListener(at,n,t,i,r,u,s)},n.prototype.addListenersToAdjust=function(n,t,i,r){this.visit(0,n,t,i,r)},n.prototype.visit=function(n,t,i,r,u){for(var e,y,o,a=this._listeners,s,v,h=0;h<a.length;h++)if(e=this[a[h]],e)for(v in e){var f=e[v],c=f.row,l=f.column,p=f.rowCount,w=f.columnCount;if((c===-1||t===-1||c<t+r&&t<c+p)&&(l===-1||i===-1||l<i+u&&i<l+w))for(y=f.length,o=0;o<y;o++)s=f[o],n===0?s.addToAdjust():s.addToDirty()}},n.prototype.addListenersToDirty=function(n,t,i,r){this.visit(1,n,t,i,r)},n.prototype.adjustDelayOfListeners=function(n,t,i){for(var u,h,f,c,e,s=this._listeners,r,l=i?1:-1,o=0;o<s.length;o++)if(u=this[s[o]],u)for(h in u)if(f=u[h],r=f,(r.row===-1||r.row<=n&&n<r.row+r.rowCount)&&(r.column===-1||r.column<=t&&t<r.column+r.columnCount))for(c=f.length,e=0;e<c;e++)f[e].delay+=l},n.prototype.startListening=function(){},n.prototype.stopListening=function(){},n}();i.RangeCalc=ki;b=function(){function n(n,t){this._error=n;this._code=t}return n.prototype.toString=function(){return this._error},n.parse=function(t){var i=n._parseCore(t);if(i===f)throw"Incorrect error!";return i},n._parseCore=function(t){var i,u;if(typeof t!==w&&t!==r&&t!=="")for(i=0;i<ii.length;i++)if(u=ii[i],u===t||u===t.toUpperCase())return new n(u,yu[i]);return f},n.prototype.toJSON=function(){return{_calcError:this._error,_code:this._code}},n}();i.CalcError=b;var rf=new b(cr,0),ui=new b(lr,7),s=new b(ar,15),h=new b(ci,23),ut=new b(vr,29),p=new b(yr,42),di=new b(pr,36),nu=function(){function n(){}return n.Null=rf,n.DivideByZero=ui,n.Value=s,n.Reference=h,n.Name=ut,n.NotAvailable=p,n.Number=di,n}();i.Errors=nu;fi=function(){function n(){}return n.prototype.getRowCount=function(){return 1},n.prototype.getColumnCount=function(){return 1},n.prototype.length=function(){return this.getRowCount()*this.getColumnCount()},n.prototype.getValueByIndex=function(n){var t=this.getColumnCount(),i=parseInt(n/t,10),r=n%t;return this.getValue(i,r)},n.prototype.getValue=function(n,t){return r},n.prototype.toArray=function(n,t,i,r,u){var l=this,a=1,v=1,o=[],s,y,p=e.CalcConvertedError,h,c;for(t=t===f?!0:t,a=l.getRowCount(),v=l.getColumnCount(),h=0;h<a;h++)for(t||(y=[],o.push(y)),c=0;c<v;c++){if(s=l.getValue(h,c),i&&e.err(s))return o=[s],o.isError=!0,o;if(s=e.convertValue(s,n,!1,u),r&&s===p)return o=[s],o.isError=!0,o;t?o.push(s):y.push(s)}return o.rowCount=a,o.colCount=v,o.rangeCount=1,o},n.prototype.slice=function(n,t,i,r){throw"slice function not implement.";},n}();i.CalcArray=fi;ft=function(n){function t(t,i){var r,f,u;if(n.call(this),r=this,f=t.length,r._array=t,r._rowCount=f,arguments.length<2)for(i=0,u=0;u<f;u++)i=ht(t[u].length,i);r._columnCount=i}return __extends(t,n),t.prototype.getRowCount=function(){return this._rowCount},t.prototype.getColumnCount=function(){return this._columnCount},t.prototype.getValue=function(n,t){return this._array[n][t]},t.prototype.toArray=function(n,t,i,r,u){var b=this,h=1,a=1,f=[],o,v=b._array,y,p,w,k=e.CalcConvertedError,c,l;if(h=v.length,h===0)return f.isError=!0,f;for(w=e.convertArray(v,n,!1),a=v[0].length,c=0;c<h;c++)for(t||(y=[],f.push(y)),p=w[c],l=0;l<a;l++){if(o=p[l],i&&e.err(o))return f=[o],f.isError=!0,f;if(o=e.convertValue(o,n,!1),r&&o===k)return f=[s],f.isError=!0,f;t?f.push(o):y.push(o)}return f.rowCount=h,f.colCount=a,f.rangeCount=1,f},t.prototype.slice=function(n,i,r,u){var f=this,c=f._array,h=[],s,e,o;for(n=n<0?0:n,i=i<0?0:i,r=n+r>f._rowCount?f._rowCount-n:r,u=i+u>f._columnCount?f._columnCount-i:u,e=0;e<r;e++)for(s=[],h.push(s),o=0;o<u;o++)s.push(c[e+n][o+i]);return new t(h)},t}(fi);i._ConcreteArray=ft;dt=function(){function n(){}return n.prototype.getRangeCount=function(){return 1},n.prototype.getRow=function(n){return 0},n.prototype.getColumn=function(n){return 0},n.prototype.getRowCount=function(n){return 0},n.prototype.getColumnCount=function(n){return 0},n.prototype.getValue=function(n,t,i){return r},n.prototype.isSubtotal=function(n,t,i){return!1},n.prototype.isHiddenRow=function(n,t,i){return!1},n.prototype.getSource=function(){return r},n.prototype.create=function(n){throw"create not implement.";},n.prototype.toArray=function(n,t,i,r,u){var l=this,a=1,v=1,c,o=[],h,b,k,d=e.CalcConvertedError,y,p,w;if(t=t===f?!0:t,c=l.getRangeCount(),c===0)return o.isError=!0,[];if(a=l.getRowCount(0),a===0)return o.isError=!0,[];if(v=l.getColumnCount(0),v===0)return o.isError=!0,[];for(y=0;y<c;y++)for(t||(b=[],o.push(b)),p=0;p<a;p++)for(t||(k=[],b.push(k)),w=0;w<v;w++){if(h=l.getValue(y,p,w),i&&e.err(h))return o=[h],o.isError=!0,o;if(h=e.convertValue(h,n,!0,u),r&&h===d)return o=[s],o.isError=!0,o;t?o.push(h):k.push(h)}return t||c!==1||(o=o[0]),o.rowCount=a,o.colCount=v,o.rangeCount=c,o},n}();i.Reference=dt;gi=function(n){function i(i){var f,o,e,u;if(n.call(this),!i||i.length===0)throw t.SR.Exp_InvalidArgument;for(f=r,o=0;o<i.length;o++)if(e=i[o],f){if(e.getRangeCount()!==f.getRangeCount())throw t.SR.Exp_InvalidArgument;for(u=0;u<e.getRangeCount();u++)if(e.getColumn(u)!==f.getColumn(u)||e.getColumnCount(u)!==f.getColumnCount(u)||e.getRow(u)!==f.getRow(u)||e.getRowCount(u)!==f.getRowCount(u))throw t.SR.Exp_InvalidArgument;}else f=e;this._references=i.slice(0)}return __extends(i,n),i.prototype.getSheetCount=function(){return this._references.length},i.prototype.getRangeCount=function(){return this._references[0].getRangeCount()},i.prototype.getRow=function(n){return this._references[0].getRow(n)},i.prototype.getColumn=function(n){return this._references[0].getColumn(n)},i.prototype.getRowCount=function(n){return this._references[0].getRowCount(n)},i.prototype.getColumnCount=function(n){return this._references[0].getColumnCount(n)},i.prototype.getValue=function(n,t,i){return r},i.prototype.isHiddenRow=function(n,t,i){return!1},i.prototype.isSubtotal=function(n,t,i){return!1},i.prototype.getSource=function(){return r},i.prototype.toArray=function(n,t,i,r,u){for(var f=[],h=this._references,e,c,l,o,s=0;s<h.length;s++){if(e=h[s].toArray(n,t,i,r,u),e.rangeCount>1)return f.isError=!0,[];t?f=f.concat(e):f.push(e[0]);c=e.rowCount;l=e.colCount;o=o||e.isError}return f.isArray=!1,f.isReference=!0,f.rowCount=c,f.colCount=l,f.isError=o,f},i}(dt);i._SheetRangeReference=gi,function(n){n.getSource=function(n){return this._references[n].getSource()};n.getValue=function(n,t,i,u){return(typeof n===w||n===r)&&(n=0),this._references[n].getValue(t,i,u)};n.isSubtotal=function(n,t,i,u){return(typeof n===w||n===r)&&(n=0),this._references[n].isSubtotal(t,i,u)};n.isHiddenRow=function(n,t,i,u){return(typeof n===w||n===r)&&(n=0),this._references[n].isHiddenRow(t,i,u)}}(gi.prototype);d=function(n){function t(t,i){n.call(this);var r=this;r._sheetSource=t;i?(r._ranges=i,r._rangeCount=i.length):r._rangeCount=1}return __extends(t,n),t.prototype.getRangeCount=function(){return this._rangeCount},t.prototype.getRow=function(n){return this._ranges?this._ranges[n].row:0},t.prototype.getColumn=function(n){return this._ranges?this._ranges[n].col:0},t.prototype.getRowCount=function(n){return this._ranges?this._ranges[n].rowCount:this._sheetSource.getRowCount()},t.prototype.getColumnCount=function(n){return this._ranges?this._ranges[n].colCount:this._sheetSource.getColumnCount()},t.prototype.getValue=function(n,t,i){if(t>=0||i>=0){var r=this._ranges;if(r){if(n<r.length)return this._sheetSource.getValue(t+r[n].row,i+r[n].col)}else return this._sheetSource.getValue(t,i)}return h},t.prototype.isHiddenRow=function(n,t,i){return this._sheetSource.isHiddenRow(t+this.getRow(n),i)},t.prototype.isSubtotal=function(n,t,i){var u=this._sheetSource,r;return n===0&&t<u.getRowCount()&&i<u.getColumnCount()?(r=u.getCalcSourceModel().getExpression(t,i),r&&r.t===7&&r.getFunctionName().toUpperCase()==="SUBTOTAL"):!1},t.prototype.getSource=function(){return this._sheetSource},t.prototype.create=function(n){return new t(this._sheetSource,n)},t.prototype.toArray=function(n,t,i,r,u){return this._sheetSource.referenceToArray(this,n,t,i,r,u)},t}(dt);i.SheetReference=d;tu=function(n){function i(i,r,u,f,e,o,s,h){n.call(this,i,[new t.Range(r,u,f,e)]);var c=this;c.Action=o;c.Operand1=s;c.Operand2=h}return __extends(i,n),i.prototype.getValue=function(t,i,r){var u=this;return u.Action(n.prototype.getValue.call(this,t,i,r),u.Operand1,u.Operand2)},i}(d);i._TernaryCompositeConcreteReference=tu;iu=function(n){function i(i,r,u,f,e,o){n.call(this,i,[new t.Range(r,u,f,e)]);this.Action=o}return __extends(i,n),i.prototype.getValue=function(t,i,r){return this.Action(n.prototype.getValue.call(this,t,i,r))},i}(d);i._UnaryCompositeConcreteReference=iu;ru=function(n){function i(i,r,u,f,e,o,s,h){n.call(this,i,[new t.Range(r,u,f,e)]);var c=this;c.Action=o;c.Operand1=s;c.SwitchOrder=h}return __extends(i,n),i.prototype.getValue=function(t,i,r){var u=this,f=n.prototype.getValue.call(this,t,i,r);return u.SwitchOrder?u.Action(u.Operand1,f):u.Action(f,u.Operand1)},i}(d);i._BinaryCompositeConcreteReference=ru;e=function(){function n(){}return n.num=function(n){return typeof n===ot||typeof n===tt||!isNaN(n)&&!isNaN(parseFloat(n))||n instanceof Date},n.err=function(n){return n instanceof b},n.arr=function(n){return n instanceof fi},n.ref=function(n){return n instanceof dt},n.toResult=function(n){return isNaN(n)||!isFinite(n)?di:n},n.toArr=function(i,r,u,f,e,o){var h,c,l;if(i&&i.length&&i.rowCount&&i.colCount)return i;else if(n.arr(i))h=i.toArray(r,u,f,e,o),h.isArray=!0;else if(n.ref(i))h=i.toArray(r,u,f,e,o),h.isReference=!0;else if(t.GC$.isArray(i)&&i.length>0){if(h=[],t.GC$.isArray(i[0]))return n.convertArray(i,r,!0);for(c=0;c<i.length;c++)l=n.convertValue(i[c],r,!1),l===n.CalcConvertedError&&(h.isConvertError=!0),h.push(l);h.rowCount=1;h.colCount=i.length;h.rangeCount=1}else n.arr(i)?h=[]:(i=n.convertValue(i,r,!0),f&&n.err(i)?(h=[s],h.isError=!0):i===n.CalcConvertedError?(h=[n.CalcConvertedError],h.isConvertError=!0):u?(h=[],h.push(i)):(h=[[]],h[0].push(i)),h.rowCount=1,h.colCount=1,h.rangeCount=1);return h},n.convertValue=function(i,u,e,o){var h,s,c;if(n.err(i))return i;if(h={value:r},s=n.CalcConvertedError,o&&u!==0&&(i===r||i===f))return s;switch(u){case 1:e?i=n.rD(i,h)?h.value:s:typeof i===ot||i instanceof Date||(i=s);break;case 4:typeof i===y?(c=t._DateTimeHelper.parseLocale(i),i=typeof c!==w&&c!==r?new t._DateTimeHelper(c).toOADate():s):e?i=n.rD(i,h)?h.value:s:typeof i===ot||i instanceof Date||(i=s);break;case 3:e?i=n.rB(i,h)?h.value:!1:typeof i!==tt&&(i=s);break;case 2:i=i===r||i===f?"":i.toString();break}return i},n.convertArray=function(t,i,u){var o,h,l;if(!t||!t.length||!t[0].length)return o=[],o.isError=!0,[[nu.Value]];if(i===0)return t;else{var v=wr[i],b=t.length,k=t[0].length,y,a,e,c={value:r},p=!1,s=!1,w=n.CalcConvertedError;if(o=t[v],!o)for(o=[],t[v]=o,h=0;h<b;h++)for(y=t[h],a=o[h]=[],l=0;l<k;l++){if(e=y[l],n.err(e)){p||(o.isError=!0,p=!0);a.push(e);continue}switch(i){case 1:u?n.rD(e,c)?e=c.value:(s||(s=!0,o.isConvertError=!0),e=0):typeof e===ot||e instanceof Date||(s||(s=!0,o.isConvertError=!0),e=w);break;case 3:u?n.rB(e,c)?e=c.value:(s||(s=!0,o.isConvertError=!0),e=!1):typeof e!==tt&&(s||(s=!0,o.isConvertError=!0),e=w);break;case 2:e=e===r||e===f?"":e.toString();break}a.push(e)}}return o},n._isNaNOrInfinite=function(n){return isNaN(n)||!isFinite(n)},n.I=function(i){var r=n.D(i);if(it(r)<1e21)return parseInt(r,10);throw t.SR.Exp_InvalidCast;},n.rI=function(t,i){var r=n.rD(t,i);return r?it(i.value)<1e21?(i.value=parseInt(i.value,10),!0):!1:!1},n.D=function(i){var r={value:0};if(n.rD(i,r))return r.value;throw t.SR.Exp_InvalidCast;},n.rD=function(i,u){var f=r,e,o;if(typeof i===w||i===r)return u.value=0,!0;e=typeof i;try{if(e===ot)f=i;else if(e===y){if(i=i.trim(),i.length===0)return u.value=0,!0;if(o=!1,i.charAt(i.length-1)==="%"&&(o=!0,i=i.substr(0,i.length-1)),i.length>=2&&i[0]==="0"&&i[1]==="x")return!1;if(f=new Number(i).valueOf(),n._isNaNOrInfinite(f)){if(f=new Date(i),n._isNaNOrInfinite(f.valueOf()))return!1;f=t._DateTimeHelper.___toOADate(f)}o&&(f/=100)}else if(e===tt)f=i?1:0;else if(i instanceof Date)f=new t._DateTimeHelper(i).toOADate();else return!1}catch(s){return!1}return u.value=f,!0},n.rB=function(i,u){try{if(typeof i===w||i===r)return!1;else if(typeof i!==tt)if(i instanceof Date)i=t._DateTimeHelper.___toOADate(i)!==0;else if(n.num(i))i=i!==0;else throw t.SR.Exp_InvalidCast;}catch(f){}return u.value=i,!0},n.B=function(i){if(typeof i===w||i===r)return!1;else if(typeof i===tt)return i;else if(i instanceof Date)return new t._DateTimeHelper(i).toOADate()!==0;else if(n.num(i))return i!==0;else if(n.err(i))return!1;else throw t.SR.Exp_InvalidCast;},n.S=function(i){try{if(typeof i===w||i===r)return"";else if(typeof i===tt)return i?bt:kt;else if(typeof i===y)return i;else if(i instanceof Date)return t._DateTimeHelper.___toOADate(i).toString();else if(n.arr(i))throw t.SR.Exp_InvalidCast;else return i.toString()}catch(u){throw t.SR.Exp_InvalidCast;}},n.DT=function(i){var u={value:r};if(n.rDT(i,u))return u.value;throw t.SR.Exp_InvalidCast;},n.rDT=function(n,i){var u,e,f;if(typeof n===w||n===r)i.value=t._DateTimeHelper.fromOADate(0);else if(n instanceof Date)i.value=new Date(n);else if(typeof n===y){if(u=t._DateTimeHelper.parseLocale(n),!u)if(isNaN(n)){if(u=new Date(n),isNaN(u.valueOf()))return!1;try{if(e=/^[-+=\s]*(\d+)\W+(\d+)\W+(\d+)$/,f=e.exec(t.StringHelper.Trim(n.replace(/ |\n/g,""))),f&&f.length===4&&(f.indexOf(u.getFullYear().toString())===-1||f.indexOf((u.getMonth()+1).toString())===-1||f.indexOf(u.getDate().toString())===-1))return!1}catch(o){return!1}}else if(u=t._DateTimeHelper.fromOADate(parseFloat(n)),!u)return!1;i.value=u}else if(typeof n===ot)i.value=t._DateTimeHelper.fromOADate(n);else return!1;return!0},n.CalcConvertedError={},n}();i.Convert=e;gt=function(){function n(){}return n._argumentExists=function(n,t){return n&&t<n.length&&n[t]!==i.missingArgument},n._argumentValid=function(n,t){if(!n)return!1;var u=n[t];return u!==i.missingArgument&&u!==r&&u!==f&&!u._error},n.getArrayValue=function(n,t,i){return typeof n===w||n===r?s:t<n.getRowCount()&&i<n.getColumnCount()?n.getValue(t,i):i>=n.getColumnCount()&&n.getColumnCount()===1&&t<n.getRowCount()?n.getValue(t,0):t>=n.getRowCount()&&n.getColumnCount()===1&&i<n.getColumnCount()?n.getValue(0,i):s},n.tryExtractToSingleValue=function(n){var i=!0,t;return(e.ref(n)||e.arr(n))&&(t=e.toArr(n,0,!1,!0),t.isError?n=t[0]:t.rowCount===1&&t.colCount===1?n=t[0][0]:(n=t,i=!1)),{value:n,success:i}},n}();i._Helper=gt;uu=function(){function n(){}return n.getLength=function(n,t){if(e.arr(n))return n.getRowCount()*n.getColumnCount();else if(e.ref(n))return t=t?t:0,n.getRowCount(t)*n.getColumnCount(t)},n.getRowCount=function(n,t){if(e.arr(n))return n.getRowCount();else if(e.ref(n))return t=t?t:0,n.getRowCount(t)},n.getColumnCount=function(n,t){if(e.arr(n))return n.getColumnCount();else if(e.ref(n))return t=t?t:0,n.getColumnCount(t)},n.getValueByIndex=function(n,t,i){if(e.arr(n))return n.getValueByIndex(t);else if(e.ref(n)){i=i?i:0;var r=n.getColumnCount(i);return n.getValue(i,parseInt(t/r,10),t%r)}},n.getValue=function(n,t,i,r){if(e.arr(n))return n.getValue(t,i);else if(e.ref(n))return r=r?r:0,n.getValue(r,t,i)},n}();i.CalcArrayHelper=uu;i.compareStringIgnoreCase=ei,function(n){function c(n,t){return n===t?!0:it(n-t)<it(n)/281474976710656}function o(n,t){var i,u;if(e.err(n))return{error:n};if(e.err(t))return{error:t};if((n===f||n===r)&&(n=0),(t===f||t===r)&&(t=0),typeof n===y&&typeof t===y)return{result:n.toString().toUpperCase()-t.toString().toUpperCase()};else if(typeof n===y)return{result:1};else if(typeof t===y)return{result:-1};return(i={value:0},!e.rD(n,i))?{error:s}:(n=i.value,u={value:0},!e.rD(t,u))?{error:s}:(t=u.value,{result:c(n,t)?0:n-t})}var h=function(){function n(n){this.name=n}return n.prototype.getName=function(){return this.name},n.prototype.compareTo=function(n){return ei(this.name,n.name)},n.prototype.toString=function(){return this.getName()},n}(),u,t;n.Operator=h;u=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype._evaluateSingle=function(n,t){},t.prototype._evaluateImp=function(n,t){var i=r,s,u,o;if(e.arr(n)&&(i=n),e.ref(n)&&(i=e.toArr(n,0,!1,!1)),i===f||i===r)return this._evaluateSingle(n,t);if(i.length()<1)return di;for(s=[],u=0;u<i.getRowCount();u++)for(s[u]=[],o=0;o<i.getColumnCount();o++)s[u][o]=this._evaluateSingle(i.getValue(u,o),t);return new ft(s,i.getColumnCount())},t.prototype.evaluate=function(n,t){return this._evaluateImp(n,t)},t}(h);n.UnaryOperator=u;n.plus=new u("+");n.plus._evaluateSingle=function(n,t){if(n===f||n===r)return 0;var i={value:0};return e.rD(n,i)?e.D(i.value):typeof n=="string"?n:s};n.negate=new u("-");n.negate._evaluateSingle=function(n,t){if(n===f||n===r)return 0;var i={value:0};return e.rD(n,i)?-i.value:s};n.percent=new u("%");n.percent._evaluateSingle=function(n,t){if(n===f||n===r)return 0;var i={value:0};return e.rD(n,i)?i.value/100:s};t=function(n){function t(t,i){n.call(this,t);this.acceptsReference=i}return __extends(t,n),t.prototype._evaluateSingle=function(n,t,i){},t.prototype.evaluate=function(n,t,i){var r=gt.tryExtractToSingleValue(n),u=gt.tryExtractToSingleValue(t),v,c,a;if(r.success&&u.success)return this._evaluateSingle(r.value,u.value);n=r.value;t=u.value;var f=r.success?-1:n.rowCount,e=r.success?-1:n.colCount,o=u.success?-1:t.rowCount,s=u.success?-1:t.colCount,l=-1,h=-1;if(r.success||u.success)r.success?(l=o,h=s):(l=f,h=e);else{if(f!=1&&o!=1&&f!=o||e!=1&&s!=1&&e!=s)return p;l=f==1?o:f;h=e==1?s:e}for(v=[],c=0;c<l;c++)for(v[c]=[],a=0;a<h;a++)v[c][a]=!r.success&&(f!==1&&f<l||e!==1&&e<h)||!u.success&&(o!==1&&o<l||s!==1&&s<h)?p:this._evaluateSingle(r.success?n:n[f===1?0:c][e===1?0:a],u.success?t:t[o==1?0:c][s===1?0:a]);return new ft(v,h)},t}(h);n.BinaryOperator=t;n.add=new t("+",!1);n.add._evaluateSingle=function(n,t,i){var u,o;return e.err(n)?n:e.err(t)?t:((n===f||n===r)&&(n=0),(t===f||t===r)&&(t=0),u={value:0},!e.rD(n,u))?s:(o={value:0},!e.rD(t,o))?s:u.value+o.value};n.subtract=new t("-",!1);n.subtract._evaluateSingle=function(n,t,i){var u,o;return e.err(n)?n:e.err(t)?t:((n===f||n===r)&&(n=0),(t===f||t===r)&&(t=0),u={value:0},!e.rD(n,u))?s:(o={value:0},!e.rD(t,o))?s:u.value-o.value};n.multiply=new t("*",!1);n.multiply._evaluateSingle=function(n,t,i){var u,o;return e.err(n)?n:e.err(t)?t:((n===f||n===r)&&(n=0),(t===f||t===r)&&(t=0),u={value:0},!e.rD(n,u))?s:(o={value:0},!e.rD(t,o))?s:u.value*o.value};n.divide=new t("/",!1);n.divide._evaluateSingle=function(n,t,i){var o,u;return t===f||t===r||t===""||t===0?ui:e.err(n)?n:e.err(t)?t:((n===f||n===r)&&(n=0),o={value:0},!e.rD(n,o))?s:(u={value:0},!e.rD(t,u))?s:u.value===0?ui:o.value/u.value};n.exponent=new t("^",!1);n.exponent._evaluateSingle=function(n,t,i){var u,o;return e.err(n)?n:e.err(t)?t:((n===f||n===r)&&(n=0),(t===f||t===r)&&(t=0),u={value:0},!e.rD(n,u))?s:(n=u.value,o={value:0},!e.rD(t,o))?s:(t=o.value,n===0&&t<0)?ui:wu(n,t)};n.concatenate=new t("&",!1);n.concatenate._evaluateSingle=function(n,t,u){return e.err(n)?n:e.err(t)?t:((n===f||n===r)&&(n=""),(t===f||t===r)&&(t=""),i.Convert.S(n)+i.Convert.S(t))};n.equal=new t("=",!1);n.equal._evaluateSingle=function(n,t,i){var u,o,h,l;return e.err(n)?n:e.err(t)?t:((n===f||n===r)&&(n=typeof t===y?"":0),(t===f||t===r)&&(t=typeof n===y?"":0),typeof n===y||typeof t===y?n.toString().toUpperCase()===t.toString().toUpperCase():(u={value:0},!e.rD(n,u))?s:(n=u.value,o={value:0},!e.rD(t,o))?s:(t=o.value,h=n,l=t,c(h,l)))};n.notEqual=new t("<>",!1);n.notEqual._evaluateSingle=function(t,i,r){var u=n.equal._evaluateSingle.call(this,t,i,r);return typeof u===tt?!u:u};n.lessThan=new t("<",!1);n.lessThan._evaluateSingle=function(n,t,i){var r=o(n,t);return r.error?r.error:r.result<0};n.greaterThan=new t(">",!1);n.greaterThan._evaluateSingle=function(n,t,i){var r=o(n,t);return r.error?r.error:r.result>0};n.lessThanOrEqual=new t("<=",!1);n.lessThanOrEqual._evaluateSingle=function(n,t,i){var r=o(n,t);return r.error?r.error:r.result<=0};n.greaterThanOrEqual=new t(">=",!1);n.greaterThanOrEqual._evaluateSingle=function(n,t,i){var r=o(n,t);return r.error?r.error:r.result>=0};n.range=new t(":",!0);n.range.evaluate=function(n,t,i){var u;if(n===f||n===r||t===f||t===r||n.getRangeCount()!==1||t.getRangeCount()!==1||(u=n.getSource(),!u||u!==t.getSource()))return s;var e=n.getRow(0),o=n.getColumn(0),h=t.getRow(0),c=t.getColumn(0),l=rt(e,h),a=rt(o,c),v=ht(e+n.getRowCount(0),h+t.getRowCount(0))-l,y=ht(o+n.getColumnCount(0),c+t.getColumnCount(0))-a;return new d(u,[{row:l,col:a,rowCount:v,colCount:y}])};n.union=new t(",",!0);n.union.evaluate=function(n,t,i){if(n===f||n===r||t===f||t===r)return s;for(var e=[],u=0,u=0;u<n.getRangeCount();u++)e.push({row:n.getRow(u),col:n.getColumn(u),rowCount:n.getRowCount(u),colCount:n.getColumnCount(u)});for(u=0;u<t.getRangeCount();u++)e.push({row:t.getRow(u),col:t.getColumn(u),rowCount:t.getRowCount(u),colCount:t.getColumnCount(u)});return new d(n.getSource(),e)};n.intersection=new t(" ",!0);n.intersection.evaluate=function(n,t,i){var u;if(n===f||n===r||t===f||t===r||n.getRangeCount()!==1||t.getRangeCount()!==1||(u=n.getSource(),!u||u!==t.getSource()))return s;var e=n.getRow(0),o=n.getColumn(0),h=t.getRow(0),c=t.getColumn(0),l=ht(e,h),a=ht(o,c),v=rt(e+n.getRowCount(0),h+t.getRowCount(0))-l,y=rt(o+n.getColumnCount(0),c+t.getColumnCount(0))-a;return new d(u,[{row:l,col:a,rowCount:v,colCount:y}])}}(i.Operators||(i.Operators={}));v=i.Operators,function(n){function o(i,u,e){var o,s;if(i===f||i===r)throw t.SR.Exp_InvalidFunctionName;if(i=i.toUpperCase(),n._builtInFunctions.hasOwnProperty(i))throw t.SR.Exp_InvalidOverrideFunction;if(n._customFunctions.hasOwnProperty(i))if(o=n._customFunctions[i],o){if(!e||!e.override)throw t.SR.Exp_OverrideNotAllowed;}else n._customFunctions[i]=new n.Function(i,0,255),o=n[i.toUpperCase()];else o=new n.Function(i,0,255),n._customFunctions[i]=o;if(u&&typeof u=="function"&&(o.evaluate=u),e)for(s in e)e.hasOwnProperty(s)&&s!=="override"&&(o[s]=e[s]);return o}function s(t){return t===f||t===r?r:(t=t.toUpperCase(),n._builtInFunctions&&n._builtInFunctions.hasOwnProperty(t))?n._builtInFunctions[t]:n._customFunctions.hasOwnProperty(t)?n._customFunctions[t]:r}var e,i,u;(function(n){n[n.normal=0]="normal";n[n.allwaysExpand=1]="allwaysExpand";n[n.neverExpand=2]="neverExpand"})(n.ArrayArgumentEvaluateMode||(n.ArrayArgumentEvaluateMode={}));e=n.ArrayArgumentEvaluateMode;i=function(){function t(n,t,i){var r=arguments.length;this._init(n,r<2?0:t,r<3?0:i);this.typeName=""}return t.prototype._init=function(n,t,i){var r=this;r.name=n;r.minArgs=t;r.maxArgs=i},t.prototype.acceptsArray=function(n){return!1},t.prototype.acceptsReference=function(n){return!1},t.prototype.acceptsError=function(n){return!1},t.prototype.acceptsMissingArgument=function(n){return!1},t.prototype.isVolatile=function(){return!1},t.prototype.isContextSensitive=function(){return!1},t.prototype.isBranch=function(){return!1},t.prototype.findTestArgument=function(){return-1},t.prototype.findBranchArgument=function(n){return-1},t.prototype.expandRows=function(){return!0},t.prototype.expandColumns=function(){return!0},t.prototype.precedentReference=function(){return!0},t.prototype.returnReference=function(){return!1},t.prototype.evaluate=function(n,t){},t.prototype.evaluateWithContext=function(n,t){var i=this;return i.isContextSensitive()?i.evaluate(n,t):i.evaluate(n)},t.prototype.toString=function(){return this.name},t._create=function(t,i,r){var f=new n.Function(t,0,255),u;if(i&&typeof i=="function"&&(f.evaluate=i),r)for(u in r)r.hasOwnProperty(u)&&u!=="override"&&(f[u]=r[u]);return f},t.prototype.toJSON=function(){var t={};for(var n in this)this.hasOwnProperty(n)&&(t[n]=this[n]);return t},t.prototype.fromJSON=function(n){if(n)for(var t in n)n[t]!==f&&(this[t]=n[t])},t}();n.Function=i;u=function(n){function t(t,i,r){n.call(this,t,i,r)}return __extends(t,n),t.prototype.isContextSensitive=function(){return!0},t.prototype.evaluate=function(n,t){return this.evaluateAsync(n,t)},t.prototype.evaluateAsync=function(n,t){},t.prototype.defaultValue=function(){return 0},t}(i);n.AsyncFunction=u;n._customFunctions={};n._builtInFunctions={};n.defineGlobalCustomFunction=o;n.findGlobalFunction=s}(i.Functions||(i.Functions={}));nr=i.Functions;c={cell:0,row:1,column:2,sheet:3},function(n){function ui(u,f,e,o,h){var pi=u.row,wi=u.column,pt=[],yt=0,ni,bt,rr,kt,ai,cr,ki,fi,ur,it,fr,c,at,vt,er,dt,di,ft,lr,or,gi,si,ar,ei,nr;pt[yt]={expr:f,acceptsArray:!1,acceptsRef:!1,index:-1};for(var hi=0,tr=0,gt=!1,ci=o,li=h,ir=!1,vr=!1,g,bi,hr,nt,wt;yt>=0;){if(g=pt[yt--],bi=g.acceptsArray,hr=g.acceptsRef,f=g.expr,nt=r,f)if(f.t===7){if(ni=f,rr=ni.argCount(),typeof ni.fn===y)if(u)if(bt=u.getFunction(ni.fn),bt)if(rr<bt.minArgs||rr>bt.maxArgs){nt=new t(s);continue}else ni.fn=bt;else{nt=new t(ut);continue}else nt=new t(ut);if(bt=ni.fn,kt=g.index,ft=g.neeedExpendindexs,kt<0?(g.noExpendCatchValue=ir,g.arrayFormulaCatchValue=e,bt.arrayArgumentEvaluateMode===2&&(ir=!0),bt.arrayArgumentEvaluateMode===1&&(e=!0),g.args=[]):(bt.acceptsArray(kt)?hi--:gt&&(ft||(ft=[],g.neeedExpendindexs=ft),ni.getArg(kt)!=wt,ft.push(kt)),g.args.push(wt)),kt==rr-1){if(ir=g.noExpendCatchValue,e=g.arrayFormulaCatchValue,ai=g.args,cr=!1,ai&&ai.length>0)for(ki=0;ki<ai.length;ki++)if(ai[ki]!==ni.getArg(ki)){cr=!0;break}nt=cr?new ot(ni.fn,ai):f;ft&&ft.length>0&&(nt=new d(nt,ft),gt=!0)}else gt=!1,kt++,g.index=kt,bt.acceptsArray(kt)&&hi++,pt[++yt]=g,pt[++yt]={expr:ni.getArg(kt),acceptsArray:bt.acceptsArray(kt),acceptsRef:bt.acceptsReference(kt),index:-1}}else if(f.t===0||f.t===1){if(fi=f,tr&&(fi.rowRelative||fi.columnRelative)){var oi=f.source||u.source,vi=oi.getRowCount(),yi=oi.getColumnCount(),at=fi.rowRelative?(fi.row+u.activeRow)%l.maxRowCount%vi:fi.row,vt=fi.columnRelative?(fi.column+u.activeColumn)%l.maxColumnCount%yi:fi.column;at=at<0?at+vi:at;vt=vt<0?vt+yi:vt;f=f.t===1?new v(oi,at,vt,!1,!1):new a(at,vt,!1,!1)}}else if(f.t===2||f.t===3||f.t===16||f.t===17){if(f.t===17){if(ur=f,c=ur.getRange(pi,wi),!c){nt=f;wt=f;continue}f=ur.source()===u.source?new w(c.row,c.column,c.row+c.rowCount-1,c.column+c.columnCount-1):new rt(ur.source(),c.row,c.column,c.row+c.rowCount-1,c.column+c.columnCount-1)}if(it=f,tr&&(it.startRowRelative||it.startColumnRelative||it.endRowRelative||it.endColumnRelative)){var oi=f.source||f.startSource||u.source,vi=oi.getRowCount(),yi=oi.getColumnCount(),ti=it.startRowRelative?(it.startRow+u.activeRow)%vi:it.startRow,ii=it.startColumnRelative?(it.startColumn+u.activeColumn)%yi:it.startColumn,ri=it.endRowRelative?(it.endRow+u.activeRow)%vi:it.endRow,ui=it.endColumnRelative?(it.endColumn+u.activeColumn)%yi:it.endColumn;ti=ti<0?ti+vi:ti;ii=ii<0?ii+yi:ii;ri=ri<0?ri+vi:ri;ui=ui<0?ui+yi:ui;ti>ri&&(fr=ti,ti=ri,ri=fr);ii>ui&&(fr=ii,ii=ui,ui=fr);f=f.t===2?new w(ti,ii,ri,ui,!1,!1,!1,!1):f.t===3?new rt(oi,ti,ii,ri,ui,!1,!1,!1,!1):new b(oi,f.endSource,ti,ii,ri,ui,!1,!1,!1,!1)}hr&&(bi||!e)||u.row<0||u.column<0||(hi>0&&!e||hi===0||ir?(c=it.getRange(pi,wi),e?!it.isFullColumn&&c.rowCount!=1&&ci>=c.rowCount||!it.isFullRow&&c.columnCount!=1&&li>=c.columnCount?nt=new t(p):(at=(it.isFullColumn?0:c.row)+(c.rowCount==1?0:ci),vt=(it.isFullRow?0:c.column)+(c.columnCount==1?0:li),nt=f.t===16?new b(f.startSource,f.endSource,at,vt,at,vt,!1,!1,!1,!1):f.t===3?new v(f.source,at,vt,!1,!1):new a(at,vt,!1,!1)):c.rowCount>1&&c.columnCount>1||c.rowCount>1&&!it.isFullColumn&&(pi<c.row||pi>=c.row+c.rowCount)||c.columnCount>1&&!it.isFullRow&&(wi<c.column||wi>=c.column+c.columnCount)?nt=new t(s):(at=it.isFullColumn||c.rowCount>1?pi:c.row,vt=it.isFullRow||c.columnCount>1?wi:c.column,nt=f.t===16?new b(f.startSource,f.endSource,at,vt,at,vt,!1,!1,!1,!1):f.t===3?new v(f.source,at,vt,!1,!1):new a(at,vt,!1,!1))):gt=!0)}else if(f.t===11)er=f,g.index===-1?(g.index=0,pt[++yt]=g,pt[++yt]={expr:er.operand,acceptsArray:!1,acceptsRef:!1,index:-1}):(nt=wt!=er.operand?new ct(er.operator,wt):f,gt&&(ft=[],ft.push(0),nt=new d(nt,ft)));else if(f.t===10)dt=f,di=dt.operator.acceptsReference,g.index===-1?(g.index=0,pt[++yt]=g,pt[++yt]={expr:dt.left,acceptsArray:di,acceptsRef:di,index:-1}):g.index==0?(wt!=dt.left&&(nt=new tt(dt.operator,wt,dt.right),g.expr=nt),gt&&(ft=[],ft.push(0),g.neeedExpendindexs=ft,gt=!1),g.index=1,pt[++yt]=g,pt[++yt]={expr:dt.right,acceptsArray:di,acceptsRef:di,index:-1}):(nt=wt!=dt.right?new tt(dt.operator,dt.left,wt):dt,ft=g.neeedExpendindexs,gt&&(ft||(ft=[]),ft.push(1)),ft&&(nt=new d(nt,ft),gt=!0));else if(f.t===14)lr=f,g.index===-1?(g.index=0,pt[++yt]=g,pt[++yt]={expr:lr.argument,acceptsArray:bi,acceptsRef:hr,index:-1}):lr.argument!==wt&&(nt=new et(wt));else if(f.t===8||f.t===9)or=f,g.index==1?(tr--,nt=wt,g.context&&(u=g.context)):(tr++,pt[++yt]={expr:f,acceptsArray:!0,acceptsRef:!0,index:1},si=u,f.t===9?(ar=f.source,si=new k(ar),si.cloneFrom(u),gi=ar.getCustomName(or.name)):(gi=u.getName(or.name),u.source.getCustomName(or.name)||(si=new sr(u.source),si.cloneFrom(u))),gi||(gi=new n.ErrorExpression(ut)),si&&(u=si),pt[++yt]={expr:gi,acceptsArray:!0,acceptsRef:!0,index:-1,context:u});else if(f.t===15)if(ei=f,!bi&&(hi>0||e))gt=!0;else if(!bi&&hi==0)if(ci>=ei.value.RowCount&&ei.value.RowCount>1||li>=ei.value.ColumnCount&&ei.value.ColumnCount>1)nt=new t(p);else try{ei.value.RowCount==1&&(ci=0);ei.value.ColumnCount==1&&(li=0);nr=ei.value.getValue(ci,li);typeof nr=="string"?nt=new ht(nr):typeof nr=="number"&&(nt=new st(nr));lt||(lt=new i.Parser);nt=lt.parse(ei.value.getValue(ci,li).toString(),r)}catch(yr){nt=new t(p)}nt===r?nt=f:nt!=f&&(vr=!0);wt=nt}return nt}var u=function(){function n(){}return n.prototype.offset=function(n,t,i){return this},n}(),et,ot,g,at,vt,e,yt,st,ht,t,pt,wt,bt,kt,dt,nt,ct,tt,o,it,a,gt,v,w,ni,rt,b,ti,ii,ri,d,lt;n.Expression=u;et=function(n){function t(t){n.call(this);this.argument=t;this.t=14}return __extends(t,n),t.prototype.offset=function(n,t,i){return this.argument.offset(n,t,i)},t}(u);n.ParenthesesExpression=et;ot=function(n){function t(t,i){n.call(this);this.fn=t;this.args=i;this.t=7}return __extends(t,n),t.prototype.argCount=function(){return this.args?this.args.length:0},t.prototype.getArg=function(n){return this.args?this.args[n]:r},t.prototype.getFunctionName=function(){var n=this;return typeof n.fn===y?n.fn:n.fn.name},t.prototype.offset=function(n,i,r){for(var f=this.args,e=[],u=0;u<f.length;u++)e.push(f[u].offset(n,i,r));return new t(this.fn,e)},t}(u);n.FunctionExpression=ot;g=function(n){function t(t){n.call(this);this.name=t;this.t=8}return __extends(t,n),t}(u);n.NameExpression=g;at=function(n){function t(t){n.call(this,t);this.t=18}return __extends(t,n),t}(g);n.BangNameExpression=at;vt=function(n){function t(t,i){n.call(this,i);this.source=t;this.t=9}return __extends(t,n),t}(g);n.ExternalNameExpression=vt;e=function(n){function t(t){n.call(this);this.value=t}return __extends(t,n),t}(u);n.ConstantExpression=e;yt=function(n){function t(t){n.call(this,t);this.t=6}return __extends(t,n),t}(e);n.BooleanExpression=yt;st=function(n){function t(t,i){n.call(this,t);this.originalValue=i;this.t=4}return __extends(t,n),t}(e);n.DoubleExpression=st;ht=function(n){function t(t){n.call(this,t);this.t=5}return __extends(t,n),t}(e);n.StringExpression=ht;t=function(n){function t(t){n.call(this,t);this.t=12}return __extends(t,n),t}(e);n.ErrorExpression=t;pt=function(n){function t(t,i){n.call(this,i);this.source=t;this.t=13}return __extends(t,n),t}(t);n.ExternalErrorExpression=pt;wt=function(n){function t(t,i,r){n.call(this,r);this.startSource=t;this.endSource=i;this.t=19}return __extends(t,n),t}(t);n.SheetRangeErrorExpression=wt;bt=function(n){function t(t){n.call(this,t);this.t=20}return __extends(t,n),t}(t);n.BangErrorExpression=bt;kt=function(n){function t(t){n.call(this,new ft(t));this.t=15}return __extends(t,n),t}(e);n.ArrayExpression=kt;dt=function(n){function t(){n.call(this,i.missingArgument);this.t=21}return __extends(t,n),t}(e);n.MissingArgumentExpression=dt;nt=function(n){function t(t){n.call(this);this.operator=t}return __extends(t,n),t}(u);n.OperatorExpression=nt;ct=function(n){function t(t,i){n.call(this,t);this.operand=i;this.t=11}return __extends(t,n),t.prototype.offset=function(n,i,r){return new t(this.operator,this.operand.offset(n,i,r))},t}(nt);n.UnaryOperatorExpression=ct;tt=function(n){function t(t,i,r){n.call(this,t);this.left=i;this.right=r;this.t=10}return __extends(t,n),t.prototype.offset=function(n,i,r){return new t(this.operator,this.left.offset(n,i,r),this.right.offset(n,i,r))},t}(nt);n.BinaryOperatorExpression=tt;o=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.getRange=function(n,t){return r},t}(u);n.ReferenceExpression=o;it=function(n){function t(t){n.call(this);this.source=t}return __extends(t,n),t}(o);n.ExternalReferenceExpression=it;a=function(n){function t(t,i,r,u){n.call(this);var f=this;f.row=t;f.column=i;f.rowRelative=r;f.columnRelative=u;this.t=0}return __extends(t,n),t.prototype.getRange=function(n,t){return fu.call(this,n,t)},t.prototype.offset=function(n,i,r){var u=this;return new t(u.row+(u.rowRelative||r?n:0),u.column+(u.columnRelative||r?i:0),u.rowRelative,u.columnRelative)},t}(o);n.CellExpression=a;gt=function(n){function t(t,i,r,u){n.call(this,t,i,r,u);this.t=22}return __extends(t,n),t.prototype.offset=function(n,i,r){var u=this;return new t(u.row+(u.rowRelative||r?n:0),u.column+(u.columnRelative||r?i:0),u.rowRelative,u.columnRelative)},t}(a);n.BangCellExpression=gt;v=function(n){function t(t,i,r,u,f){n.call(this,t);var e=this;e.row=i;e.column=r;e.rowRelative=u;e.columnRelative=f;this.t=1}return __extends(t,n),t.prototype.getRange=function(n,t){return fu.call(this,n,t)},t.prototype.offset=function(n,i,r){var u=this;return new t(u.source,u.row+(u.rowRelative||r?n:0),u.column+(u.columnRelative||r?i:0),u.rowRelative,u.columnRelative)},t}(it);n.ExternalCellExpression=v;w=function(t){function i(n,i,r,u,f,e,o,s){t.call(this);arguments.length===0?this._initDefault():this.init(n,i,r,u,f,e,o,s);this.t=2}return __extends(i,t),i.prototype._initDefault=function(){var n=l.BAND_INDEX_CONST,t=this;t.init(n,n,n,n,!1,!1,!1,!1);t.isFullRow=!0;t.isFullColumn=!0},i.prototype.init=function(n,t,i,r,u,f,e,o){var s=this;u===e&&n>i?(s.startRow=i,s.endRow=n,s.startRowRelative=e,s.endRowRelative=u):(s.startRow=n,s.endRow=i,s.startRowRelative=u,s.endRowRelative=e);f===o&&t>r?(s.startColumn=r,s.endColumn=t,s.startColumnRelative=o,s.endColumnRelative=f):(s.startColumn=t,s.endColumn=r,s.startColumnRelative=f,s.endColumnRelative=o);s.isFullRow=!1;s.isFullColumn=!1},i.prototype.initBand=function(n,t,i,r,u){var e,o,f;n>t&&(e=n,n=t,t=e,o=i,i=r,r=o);f=this;u?(f.startRow=n,f.startColumn=l.BAND_INDEX_CONST,f.endRow=t,f.endColumn=l.BAND_INDEX_CONST,f.startRowRelative=i,f.startColumnRelative=!1,f.endRowRelative=r,f.endColumnRelative=!1,f.isFullRow=!0,f.isFullColumn=!1):(f.startRow=l.BAND_INDEX_CONST,f.startColumn=n,f.endRow=l.BAND_INDEX_CONST,f.endColumn=t,f.startRowRelative=!1,f.startColumnRelative=i,f.endRowRelative=!1,f.endColumnRelative=r,f.isFullRow=!1,f.isFullColumn=!0)},i.prototype._getRangeType=function(){var n=this;return n.isFullRow&&n.isFullColumn?c.sheet:n.isFullRow?c.row:n.isFullColumn?c.column:c.cell},i.prototype.getRange=function(n,t){return tr.call(this,n,t)},i.prototype.offset=function(t,i,r){var u=this,f=new n.RangeExpression(u.startRow+(!u.isFullColumn&&(u.startRowRelative||r)?t:0),u.startColumn+(!u.isFullRow&&(u.startColumnRelative||r)?i:0),u.endRow+(!u.isFullColumn&&(u.endRowRelative||r)?t:0),u.endColumn+(!u.isFullRow&&(u.endColumnRelative||r)?i:0),u.startRowRelative,u.startColumnRelative,u.endRowRelative,u.endColumnRelative);return f.isFullRow=u.isFullRow,f.isFullColumn=u.isFullColumn,f},i.prototype.offset2=function(t,i,r,u){var f=this,e=new n.RangeExpression(f.startRow+(f.isFullColumn?0:t),f.startColumn+(f.isFullRow?0:i),f.endRow+(f.isFullColumn?0:r),f.endColumn+(f.isFullRow?0:u),f.startRowRelative,f.startColumnRelative,f.endRowRelative,f.endColumnRelative);return e.isFullRow=f.isFullRow,e.isFullColumn=f.isFullColumn,e},i}(o);n.RangeExpression=w;ni=function(t){function i(n,i,r,u,f,e,o,s){t.call(this,n,i,r,u,f,e,o,s);this.t=23}return __extends(i,t),i.prototype.offset=function(t,i,r){var u=this,f=new n.BangRangeExpression(u.startRow+(!u.isFullColumn&&(u.startRowRelative||r)?t:0),u.startColumn+(!u.isFullRow&&(u.startColumnRelative||r)?i:0),u.endRow+(!u.isFullColumn&&(u.endRowRelative||r)?t:0),u.endColumn+(!u.isFullRow&&(u.endColumnRelative||r)?i:0),u.startRowRelative,u.startColumnRelative,u.endRowRelative,u.endColumnRelative);return f.isFullRow=u.isFullRow,f.isFullColumn=u.isFullColumn,f},i}(w);n.BangRangeExpression=ni;rt=function(t){function i(n,i,u,f,e,o,s,h,c){t.call(this,r);arguments.length===1?this._initDefault(n):this.init(n,i,u,f,e,o,s,h,c);this.t=3}return __extends(i,t),i.prototype._initDefault=function(n){var t=l.BAND_INDEX_CONST,i=this;i.init(n,t,t,t,t,!1,!1,!1,!1);i.isFullRow=!0;i.isFullColumn=!0},i.prototype.init=function(n,t,i,r,u,f,e,o,s){var h=this;h.source=n;f===o&&t>r?(h.startRow=r,h.endRow=t,h.startRowRelative=o,h.endRowRelative=f):(h.startRow=t,h.endRow=r,h.startRowRelative=f,h.endRowRelative=o);e===s&&i>u?(h.startColumn=u,h.endColumn=i,h.startColumnRelative=s,h.endColumnRelative=e):(h.startColumn=i,h.endColumn=u,h.startColumnRelative=e,h.endColumnRelative=s)},i.prototype.initBand=function(n,t,i,r,u,f){var e=this,o,s;e.source=n;t>i&&(o=t,t=i,i=o,s=r,r=u,u=s);f?(e.startRow=t,e.startColumn=l.BAND_INDEX_CONST,e.endRow=i,e.endColumn=l.BAND_INDEX_CONST,e.startRowRelative=r,e.startColumnRelative=!1,e.endRowRelative=u,e.endColumnRelative=!1,e.isFullRow=!0):(e.startRow=l.BAND_INDEX_CONST,e.startColumn=t,e.endRow=l.BAND_INDEX_CONST,e.endColumn=i,e.startRowRelative=!1,e.startColumnRelative=r,e.endRowRelative=!1,e.endColumnRelative=u,e.isFullColumn=!0)},i.prototype._getRangeType=function(){var n=this;return n.isFullRow&&n.isFullColumn?c.sheet:n.isFullRow?c.row:n.isFullColumn?c.column:c.cell},i.prototype.getRange=function(n,t){return tr.call(this,n,t)},i.prototype.offset=function(t,i,r){var u=this,f=new n.ExternalRangeExpression(u.source,u.startRow+(!u.isFullColumn&&(u.startRowRelative||r)?t:0),u.startColumn+(!u.isFullRow&&(u.startColumnRelative||r)?i:0),u.endRow+(!u.isFullColumn&&(u.endRowRelative||r)?t:0),u.endColumn+(!u.isFullRow&&(u.endColumnRelative||r)?i:0),u.startRowRelative,u.startColumnRelative,u.endRowRelative,u.endColumnRelative);return f.isFullRow=u.isFullRow,f.isFullColumn=u.isFullColumn,f},i.prototype.offset2=function(t,i,r,u){var f=this,e=new n.ExternalRangeExpression(f.source,f.startRow+(f.isFullColumn?0:t),f.startColumn+(f.isFullRow?0:i),f.endRow+(f.isFullColumn?0:r),f.endColumn+(f.isFullRow?0:u),f.startRowRelative,f.startColumnRelative,f.endRowRelative,f.endColumnRelative);return e.isFullRow=f.isFullRow,e.isFullColumn=f.isFullColumn,e},i}(it);n.ExternalRangeExpression=rt;b=function(t){function i(n,i,r,u,f,e,o,s,h,c){t.call(this);this.init(n,i,r,u,f,e,o,s,h,c);this.t=16}return __extends(i,t),i.prototype.init=function(n,t,i,r,u,f,e,o,s,h){var c=this;c.startSource=n;c.endSource=t;e===s&&i>u?(c.startRow=u,c.endRow=i,c.startRowRelative=s,c.endRowRelative=e):(c.startRow=i,c.endRow=u,c.startRowRelative=e,c.endRowRelative=s);o===h&&r>f?(c.startColumn=f,c.endColumn=r,c.startColumnRelative=h,c.endColumnRelative=o):(c.startColumn=r,c.endColumn=f,c.startColumnRelative=o,c.endColumnRelative=h)},i.prototype.initBand=function(n,t,i,r,u,f,e){var o=this,s,h;o.startSource=n;o.endSource=t;i>r&&(s=i,i=r,r=s,h=u,u=f,f=h);e?(o.startRow=i,o.startColumn=l.BAND_INDEX_CONST,o.endRow=r,o.endColumn=l.BAND_INDEX_CONST,o.startRowRelative=u,o.startColumnRelative=!1,o.endRowRelative=f,o.endColumnRelative=!1,o.isFullRow=!0):(o.startRow=l.BAND_INDEX_CONST,o.startColumn=i,o.endRow=l.BAND_INDEX_CONST,o.endColumn=r,o.startRowRelative=!1,o.startColumnRelative=u,o.endRowRelative=!1,o.endColumnRelative=f,o.isFullColumn=!0)},i.prototype.getRange=function(n,t){return tr.call(this,n,t)},i.prototype._getRangeType=function(){var n=this;return n.isFullRow&&n.isFullColumn?c.sheet:n.isFullRow?c.row:n.isFullColumn?c.column:c.cell},i.prototype.offset=function(t,i,r){var u=this,f=new n.SheetRangeExpression(u.startSource,u.endSource,u.startRow+(!u.isFullColumn&&(u.startRowRelative||r)?t:0),u.startColumn+(!u.isFullRow&&(u.startColumnRelative||r)?i:0),u.endRow+(!u.isFullColumn&&(u.endRowRelative||r)?t:0),u.endColumn+(!u.isFullRow&&(u.endColumnRelative||r)?i:0),u.startRowRelative,u.startColumnRelative,u.endRowRelative,u.endColumnRelative);return f.isFullRow=u.isFullRow,f.isFullColumn=u.isFullColumn,f},i}(o);n.SheetRangeExpression=b;ti=function(n){function i(t,i){n.call(this);i!==r&&t&&this._parseStructReferenceString(i,t);this.t=17}return __extends(i,n),i.create=function(n,t,u,f,e){typeof t=="undefined"&&(t=16);typeof u=="undefined"&&(u=1);typeof f=="undefined"&&(f=0);typeof e=="undefined"&&(e=n.endColumn()-n.startColumn());var o=new i(r,r);return o._baseTable=n,o._referencePortions=t,o._columnReferenceStartInTable=f,o._columnReferenceEndInTable=e,o._referenceColumnSpecifier=u,o},i.prototype.tableName=function(){return this._baseTable.tableName()},i.prototype.baseTable=function(){return this._baseTable},i.prototype._updateCatch=function(){this._catchedTableStartColumn=this._baseTable.startColumn()},i.prototype.columnReferenceStart=function(){return this._columnReferenceStartInTable+this._baseTable.startColumn()},i.prototype.columnReferenceEnd=function(){return this._columnReferenceEndInTable+this._baseTable.startColumn()},i.prototype.referencePortions=function(){return this._referencePortions},i.prototype.referenceColumnSpecifier=function(){return this._referenceColumnSpecifier},i.prototype.source=function(){return this._baseTable.source()},i.prototype.getRange=function(n,t,i){var s=this;s._updateCatch();var u,l,f,a,v,y,e=s._baseTable.startRow(),o=s._baseTable.endRow(),h=s._baseTable.hasTotalsRow(),c=s._baseTable.hasHeadersRow();switch(s._referencePortions){case 3:case 16:u=c?e+1:e;f=h?o-1:o;break;case 2:if(c)u=e,f=e;else if(i)u=e-1,f=e-1;else return r;break;case 8:if(h)u=o,f=o;else if(i)u=o+1,f=o+1;else return r;break;case 1:u=n;f=n;break;case 6:u=e+(i&&!c?-1:0);f=h?o-1:o;break;case 12:u=c?e+1:e;f=o+(i&&!h?1:0);break;case 14:default:u=e+(i&&!c?-1:0);f=o+(i&&!h?1:0);break}return(l=s.columnReferenceStart(),a=s.columnReferenceEnd(),f<u||!i&&u<e||!i&&f>o)?r:(v=f-u+1,y=a-l+1,{row:u,column:l,rowCount:v,columnCount:y})},i.prototype._parseStructReferenceString=function(n,t){var h=i,e=this,y,p,l,v,k,w;t=t.trim();var u=0,f=t.charAt(u),o=h._parseTableObject(n,t,u,f);for(o.table===r&&h._throwError(),y=o.table,e._baseTable=y,u=o.charIndex,f=o.currentChar,u++,f=t.charAt(u),p=u;f===" ";)u++,f=t.charAt(u);f!=="@"&&f!=="["&&(u=p,f=t.charAt(u));for(var s=1,c=!1,a=!1,b=t.length;s!==0&&u<b;)if(f==="["&&(s++,u++,f=t.charAt(u)),f==="#")c&&s<=1&&h._throwError(),o=h._parsePortion(t,u,f,s),l=o.portion,u=o.charIndex,f=o.currentChar,s=o.lbracketLever,c?e._referencePortions===2&&l===3||l===2&&e._referencePortions===3?e._referencePortions=6:e._referencePortions===3&&l===8||l===3&&e._referencePortions===8?e._referencePortions=12:h._throwError():e._referencePortions=l,c=!0;else if(f==="@"){for((s>1||c)&&h._throwError(),c=!0,e._referencePortions=1,u++,f=t.charAt(u);f===" ";)u++,f=t.charAt(u);f===","&&h._throwError()}else{for(v=u,k=!1;f!=="]"&&f!=="[";)if(f==="'"&&u++,f===","){for(u++,f=t.charAt(u),w=u;f===" ";)u++,f=t.charAt(u);if(f==="["){u=w;f=",";break}}else u++,f=t.charAt(u);if(u>v&&((a||f==="["&&s>1)&&h._throwError(),o=e._parseColumnRange(t,u,f,s,v),u=o.charIndex,f=o.currentChar,s=o.lbracketLever,a=!0),f==="]"){if(s--,s===0)break;else u>=t.length&&h._throwError();u++;f=t.charAt(u)}f===","&&(u++,f=t.charAt(u))}c||(e._referencePortions=16);a||(e._columnReferenceStartInTable=0,e._columnReferenceEndInTable=e._baseTable.endColumn()-e._baseTable.startColumn(),e._referenceColumnSpecifier=1)},i.prototype._parseColumnRange=function(n,t,r,u,e){var c=this,y=i,s="",l="",w=!1,b=!1,o,p,h,a,v,k;if(u>1)w=!0,u--,s=n.substring(e,t),t++,r=n.charAt(t),r===":"&&(t++,r=n.charAt(t),b=r==="[",o=y._getColumnEndString(n,t,r,u),l=o.columnEndString,t=o.charIndex,r=o.currentChar,u=o.lbracketLever);else if(r==="["){for(b=!0,h=t-1,r=n[h];r===" ";)h--,r=n[h];r!==":"&&y._throwError();s=n.substring(e,h);w||(s=y._trimStart(s));r=n.charAt(t);o=y._getColumnEndString(n,t,r,u);l=o.columnEndString;t=o.charIndex;r=o.currentChar;u=o.lbracketLever}else(c._referencePortions===f||c._referencePortions===16)&&(w=!0),p=n.substring(e,t),h=p.indexOf(":"),h>0?(s=p.substring(0,h),s=s,l=p.substring(h+1),l.charAt(0)!=="["&&y._throwError()):s=p;if(a=c._getColumnIndex(s,w),l?(v=c._getColumnIndex(l,b),c._referenceColumnSpecifier=4):(v=a,c._referenceColumnSpecifier=2),a>v&&(k=a,a=v,v=k),c._columnReferenceStartInTable=a,c._columnReferenceEndInTable=v,t++,t<n.length)for(r=n.charAt(t);r===" ";)t++,r=n.charAt(t);return{charIndex:t,currentChar:r,lbracketLever:u}},i._trimStart=function(n){for(var t=n.length-1;t>=0&&n[t]===" ";)t--;while(t>=0&&n[t]!==" ")t--;return t>=0?n.substr(t+1,n.length-t-1):n},i._trimEnd=function(n){for(var t=0,r=n.length,i=0;t<r&&n[t]===" ";)t++;for(i=t,t=r-1;t>i&&n[t]===" ";)t++;return t>=i?n.substring(i,t+1):n},i.prototype._getColumnIndex=function(n,t){var u,r,f,e;if(n&&i._validateColumnString(n,t)){for(u="",r=0,f=n.length;r<f;r++)n[r]==="'"&&r<f-1&&n.charAt(r+1)!=="'"||(u+=n.charAt(r));return n=u,e=this._baseTable.getColumnIndexInTable(n),e<0&&i._throwError(),e}return-1},i._validateColumnString=function(n,t,i){var r,u,f;if(t)return!0;if(arguments.length===2&&(i=!0),r="",r=n[0],u=r,r==="#"||r===" "||r==="@"||r===" "||r===","||r===":"||r==="["||r==="]")return!1;for(f=1;f<n.length;f++){if(r=n[f],r===" "||r===","||r===":"||r==="["&&u!=="'"||r==="]"&&u!=="'"||r==="@"&&u!=="'"||r==="#"&&u!=="'")return!1;u=r}return!0},i._getValidaColumnString=function(n){for(var t="",r="",t=n.charAt(0),i=0;i<n.length;i++)t=n.charAt(i),(t==="["||t==="]"||t==="@"||t==="#"||t==="'")&&(r+="'"),r+=t;return r},i._containsInvalidateColumnString=function(n){var t="",i;if(t=n.charAt(0),t==="#"||t===" "||t==="@"||t===" "||t===","||t===":"||t==="["||t==="]")return!0;for(i=1;i<n.length;i++)if(t=n.charAt(i),t===" "||t===","||t===":"||t==="["||t==="]"||t==="@"||t==="#")return!0;return!1},i._getColumnEndString=function(n,t,r,u){var o=!1,e,f;if(r==="[")for(o=!0,u++,t++,r=n.charAt(t);r===" ";)t++,r=n.charAt(t);for(e=t;r!=="]"&&(r!==","||u>1);)r==="'"&&t++,t++,r=n.charAt(t);return t<=e&&i._throwError(),f=n.substring(e,t),u>1&&u--,o||(f=i._trimEnd(f)),{columnEndString:f,charIndex:t,currentChar:r,lbracketLever:u}},i._parsePortion=function(n,t,r,u){for(var f=i,h=14,l=t,o,s,e,c;r!=="]";)r==="'"&&t++,t++,r=n.charAt(t);for(o=n.substring(l,t).toLowerCase().trim(),s=!1,e=0;e<f._structReferenceKeywordsLlowercase.length;e++)if(c=f._structReferenceKeywordsLlowercase[e],o===c){h=f._getPortion(o);s=!0;break}if(s||f._throwError(),t++,t>=n.length)u--;else{for(r=n.charAt(t);r===" ";)t++,r=n.charAt(t);if(r===","){for(u<=1&&f._throwError(),t++,r=n.charAt(t);r===" ";)t++,r=n.charAt(t);for(r==="["&&(u++,t++,r=n.charAt(t));r===" ";)t++,r=n.charAt(t)}u>1&&u--}return{portion:h,charIndex:t,currentChar:r,lbracketLever:u}},i._getPortion=function(n){switch(n){case"#all":return 14;case"#data":return 3;case"#headers":return 2;case"#totals":return 8;case"#this row":return 1;default:break}return 14},i._parseTableObject=function(n,t,i,u){for(var f=r,e=0,s=t.length,o;u!=="["&&i<s;)i++,u=t.charAt(i);return e=i,e>0?(o=t.substring(0,e),f=n.getTableByName(o)):f=n.getTableByIndex(n.row,n.column),{table:f,charIndex:i,currentChar:u}},i._throwError=function(){throw"";},i.prototype.unParse=function(n,t){var r=this,f,o,s,u,e;if(r._referencePortions===16&&r._referenceColumnSpecifier===1){t.content+=r._baseTable.tableName();n.toStandard&&(t.content+="[]");return}f=i;o=n.source===r._baseTable.source()&&n.row>=r._baseTable.startRow()&&n.column>=r._baseTable.startColumn()&&n.row<=r._baseTable.endRow()&&n.column<=r._baseTable.endColumn();(!o||n.toStandard)&&(t.content+=r._baseTable.tableName());t.content+="[";r._referencePortions!==16&&(s=f._getPortionsString(r._referencePortions,r._referenceColumnSpecifier!==1,n.toStandard),t.content+=s);r._referenceColumnSpecifier!==1&&((r._referencePortions!==1||n.toStandard)&&r._referencePortions!==16&&(t.content+=", "),u=r._baseTable.getColumnName(r._columnReferenceStartInTable),u=f._getValidaColumnString(u),r._referenceColumnSpecifier===4?(e=r._baseTable.getColumnName(r._columnReferenceEndInTable),e=f._getValidaColumnString(e),t.content+="["+u+"]:["+e+"]"):t.content+=(r._referencePortions!==1||n.toStandard||f._containsInvalidateColumnString(u))&&r._referencePortions!==16?"["+u+"]":u);t.content+="]"},i._getPortionsString=function(n,t,i){switch(n){case 1:return i?"[#This Row]":"@";case 2:return t?"[#Headers]":"#Headers";case 3:return t?"[#Data]":"#Data";case 8:return t?"[#Totals]":"#Totals";case 6:return"[#Headers], [#Data]";case 12:return"[#Data], [#Totals]";case 14:case 16:break;default:break}return t?"[#All]":"#All"},i.prototype.offsetWhenInsertRemoveColumn=function(n,u,f){var o=this,s=o._catchedTableStartColumn,c,e;return n<s||n===s&&f||n>o._columnReferenceEndInTable+s?o:(u=f?u:-u,c=n-s,e=new i(r,r),e._baseTable=o._baseTable,e._columnReferenceEndInTable=o._columnReferenceEndInTable+u,e._columnReferenceStartInTable=o._columnReferenceStartInTable,n<=s+o._columnReferenceStartInTable&&(e._columnReferenceStartInTable+=u,e._columnReferenceStartInTable<c&&(e._columnReferenceStartInTable=c)),e._referenceColumnSpecifier=o._referenceColumnSpecifier,e._referencePortions=o._referencePortions,e._columnReferenceEndInTable<e._columnReferenceStartInTable)?new t(h):e},i.prototype.offsetWhenCopy=function(n,t){var f=this,u=new i(r,r),e;return u._baseTable=f._baseTable,u._columnReferenceEndInTable=f._columnReferenceEndInTable,u._columnReferenceStartInTable=f._columnReferenceStartInTable,f._referenceColumnSpecifier===2&&t&&(e=f._baseTable.endColumn()-f._baseTable.startColumn()+1,t%=e,u._columnReferenceStartInTable+=t,u._columnReferenceStartInTable<0&&(u._columnReferenceStartInTable+=e),u._columnReferenceEndInTable=u._columnReferenceStartInTable),u._referenceColumnSpecifier=f._referenceColumnSpecifier,u._referencePortions=f._referencePortions,u},i.prototype.offset=function(n,t,u){var e=this,f=new i(r,r);return f._baseTable=e._baseTable,f._referencePortions=e._referencePortions,f._columnReferenceStartInTable=e._columnReferenceStartInTable,f._columnReferenceEndInTable=e._columnReferenceEndInTable,f._referenceColumnSpecifier=e._referenceColumnSpecifier,f},i._structReferenceKeywordsLlowercase=["#all","#data","#headers","#totals","#this row"],i}(o);n.StructReferenceExpression=ti;ii=function(n){function t(t){n.call(this);this.nameIdentity=t.toUpperCase();this.t=25}return __extends(t,n),t}(u);n.NameIdentityExpression=ii;ri=function(n){function t(t,i){n.call(this);this.nameIdentity=i.toUpperCase();this.source=t;this.t=26}return __extends(t,n),t}(u);n.ExternalNameIdentityExpression=ri;d=function(n){function t(t,i){n.call(this);this.expr=t;this.needExpendIndexs=i;this.t=24}return __extends(t,n),t}(u);n.ExpandExpression=d;n._mappingArray=ui}(i.Expressions||(i.Expressions={}));u=i.Expressions,function(n){n[n.ThisRow=1]="ThisRow";n[n.Headers=2]="Headers";n[n.Data=3]="Data";n[n.Totals=8]="Totals";n[n.HeadersAndData=6]="HeadersAndData";n[n.DataAndTotals=12]="DataAndTotals";n[n.All=14]="All";n[n.NotSpecific=16]="NotSpecific"}(i.StructReferencePortions||(i.StructReferencePortions={}));uf=i.StructReferencePortions,function(n){n[n.All=1]="All";n[n.NotSpecific=1]="NotSpecific";n[n.SingleColumn=2]="SingleColumn";n[n.ColumnRange=4]="ColumnRange"}(i.StructReferenceColumnSpecifier||(i.StructReferenceColumnSpecifier={}));var af=i.StructReferenceColumnSpecifier,a={None:0,Sign:1,Int:2,Dot:3,Decimal:4,Exponent:5,SignExponent:6,ScientificNotation:7,Number:8},g={UppercaseLetter:0,LowercaseLetter:1,DecimalDigitNumber:8,OtherNumber:10,SpaceSeparator:11,Control:14,ConnectorPunctuation:18,DashPunctuation:19,OpenPunctuation:20,ClosePunctuation:21,InitialQuotePunctuation:22,FinalQuotePunctuation:23,OtherPunctuation:24,MathSymbol:25,currencySymbol:26,ModifierSymbol:27,OtherSymbol:28},nt=[14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,24,24,24,26,24,24,24,20,21,24,25,24,19,24,24,8,8,8,8,8,8,8,8,8,8,24,24,25,25,25,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,24,21,27,18,27,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,20,25,21,25,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,24,26,26,26,26,28,28,27,28,1,22,25,19,28,27,28,25,10,10,27,1,28,24,27,10,1,23,10,10,10,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,25,1,1,1,1,1,1,1,1];(function(n){n[n.Operand=0]="Operand";n[n.Function=1]="Function";n[n.Subexpression=2]="Subexpression";n[n.Argument=3]="Argument";n[n.OperatorPrefix=4]="OperatorPrefix";n[n.OperatorInfix=5]="OperatorInfix";n[n.OperatorPostfix=6]="OperatorPostfix";n[n.Whitespace=7]="Whitespace";n[n.Unknown=8]="Unknown"})(i.ExcelFormulaTokenType||(i.ExcelFormulaTokenType={}));ef=i.ExcelFormulaTokenType,function(n){n[n.Nothing=0]="Nothing";n[n.Start=1]="Start";n[n.Stop=2]="Stop";n[n.Text=3]="Text";n[n.Number=4]="Number";n[n.Logical=5]="Logical";n[n.Error=6]="Error";n[n.RangeOrName=7]="RangeOrName";n[n.Concatenation=8]="Concatenation";n[n.Intersection=9]="Intersection";n[n.Union=10]="Union";n[n.RangeOp=11]="RangeOp"}(i.ExcelFormulaTokenSubtype||(i.ExcelFormulaTokenSubtype={}));of=i.ExcelFormulaTokenSubtype;o=function(){function n(n,t,i,u){(u===f||u===r)&&(u=0);var e=this;e.value=n;e.type=t;e.index=i;e.subType=u;e.children=[]}return n}();et=function(){function n(n,t,i,u,f){this.toStandard=!1;this.ignoreError=!1;this.source=r;var e=this;e.useR1C1=t;e.row=i;e.column=u;e.option=f;this.source=n}return n.prototype.getExternalSource=function(n,t){for(var e=this.source.getCalcService(),f=e.getAllSouceModels(),u=0;u<f.length;u++)if(i.compareStringIgnoreCase(f[u].getSource().getName(),t))return f[u].getSource();return r},n.prototype.getExternalSourceToken=function(n){return n.getName()},n.prototype.getTableByName=function(n){return r},n.prototype.getTableByIndex=function(n,t){return r},n.prototype.setSource=function(n){this.source=n},n}();i.ParserContext=et;l=function(){function e(n){typeof n!==w&&n!==r&&e.setParserOption(n)}return e.setParserOption=function(n){e.listSeparator=hi(n,"listSeparator",",");e.numberDecimalSeparator=hi(n,"numberDecimalSeparator",".");e.arrayGroupSeparator=hi(n,"arrayGroupSeparator",";");e.arrayListSeparator=hi(n,"arrayListSeparator",",");e._operatorInfix="\\+-*/^&=><: "+e.listSeparator},e.getParserOption=function(){return{numberDecimalSeparator:e.numberDecimalSeparator,listSeparator:e.listSeparator,arrayGroupSeparator:e.arrayGroupSeparator,arrayListSeparator:e.arrayListSeparator}},e.prototype.parse=function(n,t){var i=this,u;return t||(t=new et(r,!1,0,0)),t.option&&e.setParserOption(t.option),u=i._parseToToken(n),i._buildExpressionTree(t,u)},e.prototype.unparse=function(n,t){if(e.unparseWithoutCulture=!1,!n)return"";t||(t=new et(r,!1,0,0));t.option&&e.setParserOption(t.option);var i={content:""};return this._unparseExpression(n,t,i),i.content},e.prototype.unparseWithoutCulture=function(n,t){if(e.unparseWithoutCulture=!0,!n)return"";t||(t=new et(r,!1,0,0));t.option&&e.setParserOption(t.option);var i={content:""};return this._unparseExpression(n,t,i),e.unparseWithoutCulture=!1,i.content},e.prototype.a1ToR1C1=function(n,t){for(var i=0,a=t.length,f,u,l,h,v,et=nt,ot=g,c=-1,b=-1,y=-1,r=!1,st,tt,s="",p=!0,k=!0,it,w,rt,ut,o,ft,d;i<a&&t.charAt(i)===" ";)i++;for(t.charAt(i)==="="&&i++,i=0;i<=a;i++)if(i!==a?(f=t[i],h=f.charCodeAt(0),v=h|32):(f="\0",h=v=0),f==="$")l||(r?(l=!0,u=r=!1):u&&(r=!0,p=!1));else if(h<127&&v>=96&&v<=122)l||(r?(l=!0,u=r=!1):u?rt.push(v):(i>0&&t.charAt(i-1)==="$"?(c=i-1,k=!1):c=i,u=!0,rt=[v]));else if(h<127&&h>=48&&h<=57||h>=127&&(et[h]===ot.DecimalDigitNumber||et[h]===ot.OtherNumber))l||(r=!0,!u&&c<0&&(i>0&&t.charAt(i-1)==="$"?(c=i-1,p=!1):c=i),y<0&&(y=i));else if(f==="'"||f==='"'||f==="[")l=u=r=!1,c=y=-1,p=k=!0,ut=f==="["?er(t,i,"[","]","'",!1):si(t,i,f,f,!1),i=ut?ut.endIndex:a-1;else if(f==="_"||f==="\\"||f==="?"||f===".")l=!0,u=r=!1;else if(l||u||r){if((u||r)&&f!=="!"&&f!=="("&&f!=="["){if(tt="",u&&r)tt=t.substring(y,i);else{for(o=c-1;o>=0&&t.charAt(o)===" ";)o--;if(o<=0||t.charAt(o)!==":")for(o=i;o<a&&t.charAt(o)===" ";)o++;o>0&&o<a&&t.charAt(o)===":"?r&&(tt=t.substr(y,i-1)):u=r=!1}if(r&&(it=parseInt(tt,10),it>e.maxRowCount&&(r=u=!1)),u){for(w=0,ft=rt.length-1,d=ft;d>=0;d--)w=w+(rt[d]-96)*Math.pow(26,ft-d);w>e.maxColumnCount&&(r=u=!1)}(u||r)&&(c>b+1&&(s+=t.substring(b+1,c)),b=i-1);r&&(s+="R",p&&(s+="[",it-=n.row+1),s+=it.toString(),p&&(s+="]"));u&&(s+="C",k&&(s+="[",w-=n.column+1),s+=w.toString(),k&&(s+="]"))}l=u=r=!1;c=y=-1;p=k=!0}return a>b+1&&(s+=t.substring(b+1,a)),s},e.prototype._unparseExpression=function(i,r,f){var o=this,c,h,s;if(i instanceof u.ConstantExpression)o._unparseConstantExpression(i,r,f);else if(i instanceof u.OperatorExpression)o._unParseOperatorExpressions(i,r,f);else if(i instanceof u.ReferenceExpression)o._unParseRefenceExpressions(i,r,f);else if(i.t===18)f.content+="!",f.content+=i.name;else if(i.t===9)c=i.source,o._unparseSource(c,r,f),f.content+="!",h=i.name,f.content+=h;else if(i.t===8)h=i.name,f.content+=h;else if(i.t===14)f.content+="(",o._unparseExpression(i.argument,r,f),f.content+=")";else if(i.t===7){for(f.content+=i.getFunctionName(),f.content+="(",s=0;s<i.argCount();s++)s!==0&&(f.content+=e.unparseWithoutCulture?",":n.Sheets.CR.listSeparator),o._unparseExpression(i.getArg(s),r,f);f.content+=")"}else throw t.SR.Exp_NotSupport;},e.prototype._unparseSource=function(n,t,i){t.getExternalSourceToken&&(i.content+=this._getValidSource(t,t.getExternalSourceToken(n),t.useR1C1))},e.prototype._unparseSource2=function(n,t,i,r){var u=this,f={content:""};u._unparseSource(n,i,f);var s=u._removeApostrophe(f),h=u._removeWorkbook(f),c=h.success,o=h.workBookName,e={content:""};u._unparseSource(t,i,e);s|=u._removeApostrophe(e);o=u._removeWorkbook(e).workBookName;s?(r.content+="'",c&&(r.content+=o),r.content+=f.content,r.content+=":",r.content+=e.content,r.content+="'"):(c&&(r.content+=o),r.content+=f.content,r.content+=":",r.content+=e.content)},e.prototype._getValidSource=function(n,t,i){if(t===f||t===r||t==="")return"";var u=this._readSheetReference(n,t,i,!0),e=t.length;return u.success?(t.charAt(0)==="'"&&t.charAt(e-1)==="'"&&(t=t.substr(1,e-2),t=t.replace("'","''"),t="'"+t+"'"),t):(u=this._readSheetReference(n,"'"+t+"'",i,!0),u.success)?(t=t.replace("'","''"),"'"+t+"'"):""},e.prototype._unParseRefenceExpressions=function(n,i,r){var e=this,h=i.row,c=i.column,a,v,l,o,s,f,u;if(n.t===22)r.content+="!",a=n,e._unParseCell(i.useR1C1,h,c,a.row,a.column,a.rowRelative,a.columnRelative,r);else if(n.t===0)v=n,e._unParseCell(i.useR1C1,h,c,v.row,v.column,v.rowRelative,v.columnRelative,r);else if(n.t===1)l=n,e._unparseSource(l.source,i,r),r.content+="!",e._unParseCell(i.useR1C1,h,c,l.row,l.column,l.rowRelative,l.columnRelative,r);else if(n.t===23)r.content+="!",o=n,e._unParseRange(i.useR1C1,h,c,o.startRow,o.startColumn,o.endRow,o.endColumn,o.startRowRelative,o.startColumnRelative,o.endRowRelative,o.endColumnRelative,r,o._getRangeType());else if(n.t===2)s=n,e._unParseRange(i.useR1C1,h,c,s.startRow,s.startColumn,s.endRow,s.endColumn,s.startRowRelative,s.startColumnRelative,s.endRowRelative,s.endColumnRelative,r,s._getRangeType());else if(n.t===3)f=n,e._unparseSource(f.source,i,r),r.content+="!",e._unParseRange(i.useR1C1,h,c,f.startRow,f.startColumn,f.endRow,f.endColumn,f.startRowRelative,f.startColumnRelative,f.endRowRelative,f.endColumnRelative,r,f._getRangeType());else if(n.t===16)u=n,e._unparseSource2(u.startSource,u.endSource,i,r),r.content+="!",e._unParseRange(i.useR1C1,h,c,u.startRow,u.startColumn,u.endRow,u.endColumn,u.startRowRelative,u.startColumnRelative,u.endRowRelative,u.endColumnRelative,r,u._getRangeType());else if(n.t===17)n.unParse(i,r);else throw t.SR.Exp_NotSupport;},e.prototype._removeApostrophe=function(n){var t=n.content,i=t.length;return t.charAt(i-1)==="'"?(n.content=t.substr(1,i-2),!0):!1},e.prototype._removeWorkbook=function(n){if(n.content.charAt(0)!=="[")return{success:!1,workBookName:""};var t=n.content.indexOf("]"),i=n.content.substr(0,t+1);return n.content=n.content.substr(t),{success:!0,workBookName:i}},e.prototype._unParseCell=function(n,t,i,u,o,s,l,a,v){var g,b,k,p,y,w,d,nt,tt;if((v===f||v===r)&&(v=c.cell),g=e.BAND_INDEX_CONST,b=e.maxRowCount-1,(v===c.cell||v===c.row)&&u!==g&&u>-b&&u<=2*b&&(u+=s?t:0,u=hu(u,b)),k=e.maxColumnCount-1,(v===c.cell||v===c.column)&&o!==g&&o>-k&&o<=2*k&&(o+=l?i:0,o=hu(o,k)),this._isCellIndexsError(t,i,u,o,s,l,v)){a.content+=h.toString();return}if(p="",y="",n){if(p="R",u>=0&&(t!==u||!s)&&(s?p=p+"["+(u-t)+"]":(u++,p=p+u)),o<0){a.content+=p;return}if(y="C",i===o&&l||(l?y=y+"["+(o-i)+"]":(o++,y=y+o)),s&&u<0||!s&&u<=0){a.content+=y;return}a.content+=p;a.content+=y}else{if(u++,p=""+u,s||(p="$"+u),o<0){a.content+=p;return}for(w=o,d=1,nt=li.length;d<nt;d++)tt=li[nt-d],o=parseInt(w/tt,10),w=w%tt,o!==0&&(y=y+String.fromCharCode(o+65-1));if(y=y+String.fromCharCode(w+65),l||(y="$"+y),u<=0){a.content+=y;return}a.content+=y;a.content+=p}},e.prototype._isCellIndexsError=function(n,t,i,r,u,f,e){var o=!1;switch(e){case c.sheet:break;case c.cell:o|=i<0;o|=r<0;break;case c.row:o|=i<0;break;case c.column:o|=r<0;break}return o},e.prototype._unParseRange=function(n,t,i,u,o,s,h,l,a,v,y,p,w){(w===f||w===r)&&(w=c.cell);this._unParseCell(n,t,i,u,o,l,a,p,w);var b=e.BAND_INDEX_CONST;n&&u===s&&o===h&&(s===b||h===b)||(s!==b||h!==b)&&(p.content+=":",this._unParseCell(n,t,i,s,h,v,y,p,w))},e.prototype._unParseOperatorExpressions=function(n,i,r){var u=this,s,f,o;if(n.t===11)s=n.operator,s===v.percent?(u._unparseExpression(n.operand,i,r),r.content+=s.name):(r.content+=s.name,u._unparseExpression(n.operand,i,r));else if(n.t===10){f={content:""};o={content:""};u._unparseExpression(n.right,i,o);var c=n.left.t===10,l=n.right.t===10,h=ti(n.operator.name);c&&ti(n.left.operator.name)>h?(f.content+="(",u._unparseExpression(n.left,i,f),f.content+=")"):u._unparseExpression(n.left,i,f);l&&ti(n.right.operator.name)>h&&(o.content+="(",u._unparseExpression(n.right,i,o),o.content+="(");r.content+=f.content;r.content+=n.operator.t===11?e.listSeparator:n.operator.name;r.content+=o.content}else throw t.SR.Exp_NotSupport;},e.prototype._unparseConstantExpression=function(i,o,s){var p=this,w=t.SR.Exp_InvalidArray,v,c,b,k,l,a,d,h;if(i.t===5)s.content+='"',s.content+=i.value,s.content+='"';else if(i.t===4)v=i.originalValue,e.unparseWithoutCulture||(v=t._NumberHelper.replaceNormalToCultureSymble(v.toString())),s.content+=v;else if(i.t===6)s.content+=i.value?bt:kt;else if(i.t===15){if(s.content+="{",c=i.value,c.getRowCount()<=0)throw w;for(b=e.BAND_INDEX_CONST,k=b,l=0;l<c.getRowCount();l++)for(l>=1&&(s.content+=e.unparseWithoutCulture?";":n.Sheets.CR.arrayGroupSeparator),a=0;a<c.getColumnCount();a++){if(k!==b&&(k!==c.getColumnCount()||c.getColumnCount()===0))throw w;if(a!==0&&(d=e.unparseWithoutCulture?",":n.Sheets.CR.arrayListSeparator,s.content+=d),h=c.getValue(l,a),h===f||h===r)throw w;h instanceof u.Expression?p._unparseExpression(h,o,s):typeof h===y?(s.content+='"',s.content+=h,s.content+='"'):s.content+=typeof h===tt?h?bt:kt:e.unparseWithoutCulture||typeof h!==ot?h.toString():t._NumberHelper.replaceNormalToCultureSymble(h.toString())}s.content+="}"}else if(i.t===13)p._unparseSource(i.source,o,s),s.content+="!",s.content+=i.value.toString();else if(i.t===19)p._unparseSource2(i.startSource,i.endSource,o,s),s.content+="!",s.content+=i.value.toString();else if(i.t===20)s.content+="!",s.content+=i.value.toString();else if(i.t===12)s.content+=i.value.toString();else if(i.t!==21)throw t.SR.Exp_NotSupport;},e.prototype._parseToToken=function(n,i){var r,f,p,g,rt,w,ut,k,nt,ft,tt,b,it;typeof i=="undefined"&&(i=!0);for(var et=this,y=n.length,s=[],v=[],l=-1,u="",c,h=0,d=0,a;d<y&&n.charAt(d)===" ";)d++;for(n.charAt(d)==="="&&d++,h=d,r=d;r<y;r++)if(f=n.charAt(r),f==='"')p=si(n,r,'"','"',i),p?(s.push(new o(p.result,0,r+1,3)),r=p.endIndex,h=r+1):(u+=n.substring(r,y),r=y-1);else if(f==="'")p=si(n,r,"'","'",i),p?(u+="'",u+=p.result,u+="'",r=p.endIndex):(u+="'",r=r+1);else if(f==="[")if(p=er(n,r,"[","]","'",i),p)u+=p.result,u+="]",r=p.endIndex;else{if(u==="R"||u==="r"||u==="C"||u==="c")continue;u+=n.substring(r,y);r=y-1}else if(f==="\r"||f==="\n")continue;else if(f==="#")g=ou(n,r),g?(rt=r<y?n.charAt(r+1):'\0',r>0&&n.charAt(r-1)==="!"?u+=g.result:ci===g.result.toUpperCase()&&r<y&&(fr(rt)||rt==="$")?u+=g.result:(s.push(new o(g.result,0,r,6)),h=r+1),r=g.endIndex):u+=f;else if(f==="+"||f==="-")w=s.length===0?null:s[s.length-1],u.length!==0?(s.push(new o(u,0,h)),s.push(new o(f,5,r)),u="",h=r+1):(w&&w.type===7&&(s.pop(),w=s[s.length-1]),w&&(w.type===1&&w.subType===2||w.type===2&&w.subType===2||w.type===6||w.type===0)?(s.push(new o(f,5,r)),h=r+1):(s.push(new o(f,4,r)),h=r+1));else if(f===e.numberDecimalSeparator||ur(f))if(u.length>0)u+=f;else if((ut=ff(n,r,e.numberDecimalSeparator)).result){for(k=ut.endIndex,nt=n.slice(r,k+1),e.numberDecimalSeparator!=="."&&(nt=t._NumberHelper.replaceCultureSymbolToNormal(nt));k<=y-2&&n.charAt(k+1)===" ";)k++;k<=y-2&&n.charAt(k+1)===":"?(u+=nt,u+=":",k++,h=r):(s.push(new o(nt,0,r,4)),h=r+1);r=k}else u+=f;else if(f==="{"){if(u.length>0&&i)throw t._StringHelper.format(t.SR.Exp_FormulaInvalid,[f,r]);c=new o(yt,1,r,1);s.push(c);v[++l]=c;c=new o(st,1,r,1);s.push(c);v[++l]=c;h=r+1}else if(f===e.arrayGroupSeparator&&l>=0&&(v[l].value===yt||v[l].value===st)){if(u.length>0&&(s.push(new o(u,0,h)),u=""),l<0&&i)throw t._StringHelper.format(t.SR.Exp_FormulaInvalid,[f,r]);a=v[l--];a=new o(f,a.type,r,2);s.push(a);s.push(new o(e.listSeparator,3,r));c=new o(st,1,r+1,1);s.push(c);v[++l]=c;h=r+1}else if(f==="}"){if(u.length>0&&(s.push(new o(u,0,h)),u=""),k<0&&i)throw t._StringHelper.format(t.SR.Exp_FormulaInvalid,[f,r]);a=v[l--];a=new o(f,a.type,r,2);s.push(a);a=v[l--];a=new o(f,a.type,r,2);s.push(a);h=r+1}else if(f===" "){for(ft=r,r++;r<y&&u.charAt(u.length-1)===" ";)r++;u.length>0&&u.charAt(u.length-1)!==":"&&r<y&&n.charAt(r)!==":"&&(s.push(new o(u,0,h)),u="",s.push(new o("",7,ft)));h=r;r--}else if(r+2<=y&&f==="<"&&n.charAt(r+1)==="="||f===">"&&n.charAt(r+1)==="="||f==="<"&&n.charAt(r+1)===">")u.length>0&&(s.push(new o(u,0,h)),u=""),s.push(new o(n.slice(r,r+2),5,r,5)),r++,h=r+1;else if(f==="%")u.length>0&&(s.push(new o(u,0,h)),u=""),s.push(new o(n.charAt(r),6,r)),h=r+1;else if(f==="+"||f==="-"||f==="*"||f==="/"||f==="="||f===">"||f==="<"||f==="&"||f==="^")u.length>0&&(s.push(new o(u,0,h)),u=""),s.push(new o(f,5,r)),h=r+1;else if(f==="(")u.length>0?(tt=u.charAt(u.length-1),tt===":"||tt===e.listSeparator||tt===" "?(u=u.slice(0,u.length-1),s.push(new o(u,0,h,7)),s.push(new o(tt,5,r-1,0)),c=new o("",2,r,1),s.push(c),v[++l]=c):(b=u.indexOf(":"),it=":",b===-1&&(b=u.indexOf(e.listSeparator),it=e.listSeparator),b===-1&&(b=u.indexOf(" "),it=" "),b!==-1&&b>0?(s.push(new o(u.substr(0,b),0,h,7)),s.push(new o(it,5,h+b,0)),u=u.slice(b+1),c=new o(u.toUpperCase(),1,h+b+1,1),s.push(c),v[++l]=c):(c=new o(u.toUpperCase(),1,r-u.length,1),s.push(c),v[++l]=c)),u=""):(c=new o("",2,r,1),s.push(c),v[++l]=c),h=r+1;else if(f===e.listSeparator||f===e.arrayListSeparator||f===e.arrayGroupSeparator)u.length>0&&(s.push(new o(u,0,h)),u=""),l<0||v[l].type!==1?s.push(new o(e.listSeparator,5,r,10)):s.push(new o(e.arrayListSeparator,3,r)),h=r+1;else if(f===")"){if(u.length>0&&(s.push(new o(u,0,h)),u=""),l<0&&i)throw t._StringHelper.format(t.SR.Exp_FormulaInvalid,[f,r]);a=v[l--];a=new o(f,a.type,r,2);s.push(a);h=r+1}else f===":"?u.length===0&&s[s.length-1].subType===2?(s.push(new o(":",5,r,11)),h=r+1):u+=":":u+=f;return u.length>0&&s.push(new o(u,0,h)),et._processTokens(s,i)},e.prototype._processTokens=function(n,i){var h=this._removeWhiteSpace(n),s=[],y=new o("",8,0,1),l,v,e,u,f,c,a,p;for(s.push(y),v=h.length,e=0;e<v;e++)if(u=h[e],u){if(f=e===0?r:h[e-1],c=e===v-1?r:h[e+1],u.type===0&&u.subType===0?(a=u.value.toUpperCase(),a===bt||a===kt?(u.subType=5,u.value=a):u.subType=7):u.type===1&&u.value.length>0&&u.value.charAt(0)==="@"&&(u.value=u.value.substr(1)),s.length===0&&i)throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);if(l=s[s.length-1],l.value===st&&i&&u.type!==3&&u.subType!==6&&u.subType!==2&&u.subType!==5&&u.subType!==4&&u.subType!==3&&u.type!==4)throw t._StringHelper.format(t.SR.Exp_InvalidArrayAt,[u.index]);switch(u.type){case 0:if(i&&f&&(f.type===0||f.type===6||f.type===1&&f.subType===2||f.type===2&&f.subType===2))throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);break;case 1:case 2:if(u.value!==yt||u.type!==1||u.subType!==1||f){if(i&&(u.subType===2&&(!f||f.type===4||f.type===5)||u.subType===1&&f&&(!c||f.type===6||f.subType===2||f.type===0)))throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);}else break;if(i&&u.subType===2&&u.type===2&&f.subType===1)throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);if(i&&u.subType===2&&u.type===1&&f.type===2&&f.subType===1)throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);if(i&&u.subType===1&&f&&(f.type===1&&f.subType===2||f.type===0||f.type===6))throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);break;case 3:if(i&&(!c||!f||f.type===5||f.type===4))throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);break;case 4:if(i&&(!c||f&&f.type===6))throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);break;case 5:if(i&&(!c||!f||f.type===5||f.type===4||f.type===3||f.type===1&&f.subType===1||f.type===2&&f.subType===1))throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);break;case 6:if(i&&(!f||f.type===4||f.type===5||f.type===1&&f.subType===1||f.type===2&&f.subType===1))throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);break;default:if(i)throw t._StringHelper.format(t.SR.Exp_InvalidTokenAt,[u.index]);}if(i)if(u.subType===1)s.push(u),l.children.push(u);else if(u.subType===2){if(s.length===0&&(p=u.value===yt||u.value===st?"}":")",i))throw t._StringHelper.format(t.SR.Exp_FormulaInvalid,[p,u.index]);s.pop()}else l.children.push(u)}return i?y.children:h},e.prototype._removeWhiteSpace=function(n){for(var f,i,u,e=[],s=n.length,t=0;t<s;t++)if(f=n[t],f){if(f.type!==7){e.push(f);continue}(i=t==0?r:n[t-1],u=t==s-1?r:n[t+1],i&&u)&&(i.type===1&&i.subType===2||i.type===2&&i.subType===2||i.type===0)&&(u.type===1&&u.subType===1||u.type===2&&u.subType===1||u.type===0)&&e.push(new o(" ",5,f.index,9))}return e},e.prototype._buildExpressionNode=function(n,t){var r=this,i;return t.type===1?i=t.value===yt?r._buildArraryExpression(n,t):r._buildFunctionExpression(n,t):t.type===2?i=r._buildSubExpression(n,t):t.type===0&&(t.subType===4?i=new u.DoubleExpression(parseFloat(t.value),t.value):t.subType===6?i=new u.ErrorExpression(b.parse(t.value)):t.subType===5?ei(t.value,bt)?i=new u.BooleanExpression(!0):ei(t.value,kt)&&(i=new u.BooleanExpression(!1)):i=t.subType===7?r._buildCellReferenceOrNameExpressions(n,t.value,t.index):new u.StringExpression(t.value)),i},e.prototype._buildExpressionTree=function(n,t){for(var r=this._parseToBinaryOperatorList(n,t),f,e,o,s,h,i=3;i<r.length;)if(s=r[i],h=r[i-2],s&&s.type===5){while(i>=3&&ti(s.value)>=ti(h.value))e=r[i-3],o=r[i-1],f=new u.BinaryOperatorExpression(su(h),e,o),r.splice(i-3,3),r.splice(i-3,0,f),i-=2,i>=3&&(h=r[i-2]);i+=2}else i++;if(r.length===1)return r[0];else{for(i=r.length-2;i>0;i-=2)e=r[i-1],o=r[i+1],f=new u.BinaryOperatorExpression(su(r[i]),e,o),r.splice(i-1,3),r.push(f);return f}},e.prototype._parseToBinaryOperatorList=function(n,t){for(var i,o,s,h,r=[],f,e=0;e<t.length;e++)if(i=t[e],i.type===4){for(o=[];i.type===4;)o.push(i.value==="+"?v.plus:v.negate),e++,i=t[e];for(s=t[e],f=new u.UnaryOperatorExpression(o.pop(),this._buildExpressionNode(n,s));o.length>0;)f=new u.UnaryOperatorExpression(o.pop(),f);r.push(f)}else i.type===6?(h=r[r.length-1],f=new u.UnaryOperatorExpression(v.percent,h),r.pop(),r.push(f)):i.type===5?r.push(i):(f=this._buildExpressionNode(n,i),r.push(f));return r},e.prototype._buildFunctionExpression=function(n,i){for(var s,f,h,r=[],e=[],o=0;o<i.children.length;o++)s=i.children[o],s.type!==3?e.push(s):e.length===0?r.push(new u.MissingArgumentExpression):(r.push(this._buildExpressionTree(n,e)),e=[]);if(e.length!==0?r.push(this._buildExpressionTree(n,e)):i.children.length!==0&&r.push(new u.MissingArgumentExpression),f=nr.findGlobalFunction(i.value),f||(f=n.source.getCustomFunction(i.value)),f){if(h=r.length,h<f.minArgs||h>f.maxArgs)throw t._StringHelper.format(t.SR.Exp_InvalidParameters,[i.index]);return new u.FunctionExpression(f,r)}else return new u.FunctionExpression(i.value,r)},e.prototype._buildSubExpression=function(n,t){return new u.ParenthesesExpression(this._buildExpressionTree(n,t.children))},e.prototype._buildArraryExpression=function(n,e){for(var v,w,s,h,a,g,c=[],k=-1,o,d=e.children,nt=d.length,l=0;l<nt;l++){if(o=d[l],v=l===0?r:d[l-1],o.type===3){if(!v||v.type===3||l===nt-1)throw t._StringHelper.format(t.SR.Exp_InvalidArrayAt,[o.index]);continue}else if(v&&v.type!==3)throw t._StringHelper.format(t.SR.Exp_InvalidArrayAt,[o.index]);else if(o.type!==1||o.value!==st)throw t._StringHelper.format(t.SR.Exp_InvalidArrayAt,[o.index]);else if(k!==-1&&o.children.length!==k)throw t._StringHelper.format(t.SR.Exp_InvalidArrayColumns,[o.index]);else k=o.children.length;w=[];c.push(w);var y=o.children,b=y.length,p=r;for(s=0;s<b;s++){if(h=y[s],h.type===3)p&&p.type!==3&&s!==b-1||w.push(i.missingArgument);else if(p&&p.type!==3)throw t._StringHelper.format(t.SR.Exp_InvalidArrayAt,[o.index]);else{if(h.type===4){if(s+1>=b)throw t._StringHelper.format(t.SR.Exp_InvalidArrayAt,[o.index]);a=y[s+1];a.value=""+h.value+a.value;h=a;s++}else s+1<b&&y[s+1].type===6&&(a=y[s+1],h.value=""+h.value+a.value,s++);g=this._buildExpressionNode(n,h);g&&w.push(g.value)}p=h}}if(c.length===0||c[0]===f||c[0]===r||c[0].length===0)throw t._StringHelper.format(t.SR.Exp_InvalidArrayAt,[o.index]);return new u.ArrayExpression(c)},e.prototype._buildCellReferenceOrNameExpressions=function(n,i,r){var s=this._buildCellReferenceOrNameExpressions2(n,i,r),f=s.endIndex,e=s.expression,c=i.length,o,l,h;if(!e)throw t._StringHelper.format(t.SR.Exp_InvalidCellReference,[r]);if(f<=0||f>=c)return e;if(i.charAt(f)!==":")throw t._StringHelper.format(t.SR.Exp_InvalidCellReference,[r]);for(f++,o=[],o.push(e);f>0&&f<c;){if(l=f,s=this._buildCellReferenceOrNameExpressions2(n,i.substr(f),r),f=s.endIndex,e=s.expression,!e)throw t._StringHelper.format(t.SR.Exp_InvalidCellReference,[r]);if(o.push(e),f+=l,f<c&&i.charAt(f)!==":")throw t._StringHelper.format(t.SR.Exp_InvalidCellReference,[r]);f++}for(e=o[0],h=1;h<o.length;h++)e=new u.BinaryOperatorExpression(v.range,e,o[h]);return e},e.prototype._buildCellReferenceOrNameExpressions2=function(n,t,e){var b=this,c,g,it,p,ut,ft,rt,tt,ot,st,et,ht,l,d,ct,lt,at;if(t===f||t===r||t==="")return{endIndex:0,expression:r};if(c=t.length,t.length>=5&&t.substr(0,5)==="#REF!")return{endIndex:c,expression:new u.ErrorExpression(h)};if(g=t.charAt(0)==="!",it=g?1:0,c<1)return{endIndex:0,expression:r};var y=-1,nt="",o=0;if(g)y=it;else if(t.charAt(0)==="'")y=t.indexOf("!")+1,nt=t.substr(0,y-1);else if(p=t.indexOf("!"),l=t.indexOf(":"),p!==-1)if(ut=t.substr(it,p-it),l<0||p<l)p<c-1&&(nt=ut,y=p+1);else{if(ft=b._parseToCellReference(n,ut,g),ft.expression)return ft;else p<c-1&&(nt=ut,y=p+1);o=ft.endIndex}var k="",a="",w="";if(y!==-1&&nt&&nt!==""){if(rt=b._readSheetReference(n,nt,n.useR1C1,!1),!rt.success)return{endIndex:o,expression:r};k=rt.workBookName;a=rt.startSheetName;w=rt.endSheetName}else y=it;if(et=!1,(k&&k!==""||a&&a!=="")&&(et=!0,n.getExternalSource&&(ot=n.getExternalSource(k,a),!ot)))return{endIndex:o,expression:new u.ErrorExpression(h)};if(w&&w!==""&&(et=!0,n.getExternalSource&&(st=n.getExternalSource(k,w),!st)))return{endIndex:o,expression:new u.ErrorExpression(h)};var v=t.substr(y),vt=b._parseToCellReference(n,v,g,ot,st),s=vt.expression;if(o=vt.endIndex,s)if(!et||s.t===16||s instanceof u.ExternalReferenceExpression||s.t===13||s.t===19||s.t===9)if(o<v.length-1){if(o=c-(v.length-o),t.charAt(o)!==":"){if(a&&a!==""){if(w&&w!=="")return{endIndex:o,expression:r};if(!n.getExternalSource)return{endIndex:o,expression:new u.ErrorExpression(h)};if(tt=n.getExternalSource(k,a),!tt)return{endIndex:o,expression:new u.ErrorExpression(h)};s=new u.ExternalNameExpression(tt,v)}else s=new u.NameExpression(v);o=c}}else o=c;else return{endIndex:c,expression:new u.ErrorExpression(h)};else{for(l=-1,d=0;d<t.length;d++)if(ht=t[d],ht==="[")ct=er(t,d,"[","]","'"),ct&&(d=ct.endIndex);else if(ht===":"){l=d;break}if(g)s=new u.BangNameExpression(v);else if(a&&a!==""){if(w&&w!=="")return{endIndex:o,expression:r};if(!n.getExternalSource)return{endIndex:o,expression:new u.ErrorExpression(h)};if(tt=n.getExternalSource(k,a),!tt)return{endIndex:o,expression:new u.ErrorExpression(h)};s=new u.ExternalNameExpression(tt,v)}else if(l>0)if(lt=t.substr(0,l),n.ignoreError||b._validateName(lt))return s=new i.Expressions.BinaryOperatorExpression(i.Operators.range,new i.Expressions.NameExpression(lt),b._buildCellReferenceOrNameExpressions(n,t.substr(l+1),e+l+1)),{range1EndIndex:l,endIndex:c,expression:s};else s=r;else s=new u.NameExpression(v);o=c}if(s&&(s.t===9||s.t===8))if(at=b._createStructExpression(n,v,e),at)s=at;else if(!n.ignoreError&&!b._validateName(v))return{endIndex:o,expression:r};return{endIndex:o,expression:s}},e.prototype._parseToCellReference=function(n,t,i,u,f){var h=this,a=0,c,l,o,s,v;if(t.charAt(0)==="#"&&(c=ou(t,0),a=c.endIndex+1,l=b.parse(c.result),l))return{endIndex:a,expression:h._createExternalErrorExpression(l,i,u,f)};if(o=n.useR1C1?h._isR1C1CellReferance(t,n.row,n.column):h._isA1CellReferance(t),s=e.BAND_INDEX_CONST,o.success&&n.useR1C1&&o.startRow!==s&&o.startColumn===s&&o.endRow===s&&o.endColumn===s)o.endRow=o.startRow,o.endRowRelative=o.startRowRelative;else if(o.success&&n.useR1C1&&o.startColumn!==s&&o.startRow===s&&o.endRow===s&&o.endColumn===s)o.endColumn=o.startColumn,o.endColumnRelative=o.startColumnRelative;else if(!o.success||o.startRow===s&&(o.startColumn===s||o.endColumn===s)||o.startColumn===s&&o.endRow===s)return{endIndex:o.endIndex,expression:r};return v=h._createCellReferenceExpression(n,n.row,n.column,o.startRow,o.startColumn,o.endRow,o.endColumn,o.startRowRelative,o.startColumnRelative,o.endRowRelative,o.endColumnRelative,i,u,f),{endIndex:o.endIndex,expression:v}},e.prototype._createExternalErrorExpression=function(n,t,i,r){return t?new u.BangErrorExpression(n):i&&r?new u.SheetRangeErrorExpression(i,r,n):i?new u.ExternalErrorExpression(i,n):new u.ErrorExpression(n)},e.prototype._createCellReferenceExpression=function(n,t,i,f,o,s,h,c,l,a,v,y,p,w){var b=e.BAND_INDEX_CONST,k,d,g;return f!==b&&s!=b&&f>s&&(d=f,f=s,s=d,g=c,c=a,a=g),o!==b&&h!=b&&o>h&&(d=o,o=h,h=d,g=l,l=v,v=g),f-=f!==b&&c?t:0,o-=o!=b&&l?i:0,s-=s!==b&&a?t:0,h-=h!==b&&v?i:0,p&&w?(k=new u.SheetRangeExpression(p,w),f===b?k.initBand(p,w,o,h,l,v,!1):o===b?k.initBand(p,w,f,s,c,a,!0):((s===b||h===b)&&(s=f,h=o),k.init(p,w,f,o,s,h,c,l,a,v)),k):s===b&&h===b?y?p||w?r:new u.BangCellExpression(f,o,c,l):p?new u.ExternalCellExpression(p,f,o,c,l):new u.CellExpression(f,o,c,l):y?p&&w?r:(k=new u.BangRangeExpression,f===b?k.initBand(o,h,l,v,!1):o===b?k.initBand(f,s,c,a,!0):k.init(f,o,s,h,c,l,a,v),k):p?(k=new u.ExternalRangeExpression,f===b?k.initBand(p,o,h,l,v,!1):o===b?k.initBand(p,f,s,c,a,!0):k.init(p,f,o,s,h,c,l,a,v),k):(k=new u.RangeExpression,f===b?k.initBand(o,h,l,v,!1):o===b?k.initBand(f,s,c,a,!0):k.init(f,o,s,h,c,l,a,v),k)},e.prototype._readSheetReference=function(n,t,i,r){var u={success:!1,startSheetName:"",endSheetName:"",workBookName:""},e=!1,l=t.length,f,c,o,s,h;return(t.charAt(0)==="'"&&t.charAt(l-1)==="'"&&(e=!0,t=t.substr(1,l-2)),f=t.indexOf("["),f!==-1&&(f!==0&&(u.workBookName=t.substr(0,f),u.workBookName.charAt(f-1)!=="\\"&&(u.workBookName=u.workBookName+"\\")),c=si(t,f,"[","]"),u.workBookName=u.workBookName+c.result,t=t.substr(c.endIndex+1)),o=t.indexOf(":"),o===-1?u.startSheetName=t:(u.startSheetName=t.substr(0,o),u.endSheetName=t.substr(o+1)),!u.startSheetName||u.startSheetName==="")?(u.success=!1,u):(s=this,h=s._validateWorkbook(u.workBookName,e),h=n.ignoreError&&!r||s._validateSheetName(u.startSheetName,i,e),h&=n.ignoreError&&!r||s._validateSheetName(u.endSheetName,i,e),r&&(u.startSheetName&&(u.startSheetName=u.startSheetName.replace("'","''")),u.endSheetName&&(u.endSheetName=u.endSheetName.replace("'","''"))),u.success=h,u)},e.prototype._isStartWithCellReference=function(n,t){return t?this._isR1C1CellReferance(n):this._isA1CellReferance(n)},e.prototype._isA1CellReferance=function(n){var u=this,s=e.BAND_INDEX_CONST,t={startRow:s,startColumn:s,endRow:s,endColumn:s,startRowRelative:!0,startColumnRelative:!0,endRowRelative:!0,endColumnRelative:!0,success:!1,endIndex:0},h,r,i,c,l,a,f,o;if(n=n.replace(" ",""),h=n.length,r=u._readOneA1Element(n,0),t.endIndex=r.endIndex,!r.success||t.endIndex>h)return t;if(r.isRow)return t.startRow=r.elementIndex,t.startRowRelative=r.isRelative,n.charAt(t.endIndex)===":"?(t.endIndex++,i=u._readOneA1Element(n,t.endIndex),t.endIndex=i.endIndex,!i.success||!i.isRow)?t:(t.endRow=i.elementIndex,t.endRowRelative=i.isRelative,t.success=!0,t):t;else if(t.startColumn=r.elementIndex,t.startColumnRelative=r.isRelative,n.charAt(t.endIndex)===":")return(t.endIndex++,i=u._readOneA1Element(n,t.endIndex),t.endIndex=i.endIndex,!i.success||i.isRow)?t:(t.endColumn=i.elementIndex,t.endColumnRelative=i.isRelative,t.success=!0,t);if(ni(n.charAt(t.endIndex))||n.charAt(t.endIndex)==="$"){if(i=u._readOneA1Element(n,t.endIndex),t.endIndex=i.endIndex,!i.success||!i.isRow)return t;if(t.startRow=i.elementIndex,t.startRowRelative=i.isRelative,c=t.endIndex,t.endIndex<h-1&&n.charAt(t.endIndex)===":"){if(n.charAt(t.endIndex+1)==="'"||(l=n.indexOf("!",t.endIndex+1),a=n.indexOf(":",t.endIndex+1),l!==-1&&(a===-1||a>l)))return t.success=!0,t;if(t.endIndex++,f=u._readOneA1Element(n,t.endIndex),!f.success||f.isRow)return t.endIndex=c,t.success=!0,t;else t.endIndex=f.endIndex;if(t.endColumn=f.elementIndex,t.endColumnRelative=f.isRelative,o=u._readOneA1Element(n,t.endIndex),o.success&&o.isRow)t.endIndex=o.endIndex;else return t.endIndex=c,t.endColumn=s,t.success=!0,t;return t.endRow=o.elementIndex,t.endRowRelative=o.isRelative,t.success=!0,t}else return t.success=!0,t}else return t},e.prototype._isR1C1CellReferance=function(n,t,i){var o=this,c=e.BAND_INDEX_CONST,r={startRow:c,startColumn:c,endRow:c,endColumn:c,startRowRelative:!0,startColumnRelative:!0,endRowRelative:!0,endColumnRelative:!0,success:!1,endIndex:0},l,f,u,a,v,y,s,h;if(n=n.replace(" ",""),l=n.length,f=o._readOneR1C1Element(n,t,i,0),r.endIndex=f.endIndex,!f.success)return r;if(f.isRow){if(r.startRow=f.elementIndex,r.startRowRelative=f.isRelative,r.endIndex>=l)return r.success=!0,r;if(n.charAt(r.endIndex)===":")return(r.endIndex++,u=o._readOneR1C1Element(n,t,i,r.endIndex),r.endIndex=u.endIndex,!u.success||!u.isRow)?r:(r.endRow=u.elementIndex,r.endRowRelative=u.isRelative,r.success=!0,r)}else return(r.startColumn=f.elementIndex,r.startColumnRelative=f.isRelative,r.endIndex>=l)?(r.success=!0,r):n.charAt(r.endIndex)===":"?(r.endIndex++,u=o._readOneR1C1Element(n,t,i,r.endIndex),r.endIndex=u.endIndex,!u.success||u.isRow)?r:(r.endColumn=u.elementIndex,r.endColumnRelative=u.isRelative,r.success=!0,r):r;if(n.charAt(r.endIndex)==="C"||n.charAt(r.endIndex)==="c"){if(u=o._readOneR1C1Element(n,t,i,r.endIndex),r.endIndex=u.endIndex,!u.success||u.isRow)return r;if(r.startColumn=u.elementIndex,r.startColumnRelative=u.isRelative,a=r.endIndex,r.endIndex<l-1&&n.charAt(r.endIndex)===":"){if(n.charAt(r.endIndex+1)==="'"||(v=n.indexOf("!",r.endIndex+1),y=n.indexOf(":",r.endIndex+1),v!==-1&&(y===-1||y>v)))return r.success=!0,r;if(r.endIndex++,s=o._readOneR1C1Element(n,t,i,r.endIndex),s.success&&s.isRow)r.endIndex=s.endIndex;else return r.endIndex=a,r.success=!0,r;if(r.endRow=s.elementIndex,r.endRowRelative=s.isRelative,h=o._readOneR1C1Element(n,t,i,r.endIndex),!h.success||h.isRow)return r.endIndex=a,r.success=!0,r;else r.endIndex=h.endIndex;return r.endColumn=h.elementIndex,r.endColumnRelative=h.isRelative,r.success=!0,r}else return r.success=!0,r}else return r},e.prototype._readOneA1Element=function(n,t){var c=e.BAND_INDEX_CONST,i={endIndex:t,elementIndex:c,isRow:!0,isRelative:!0,success:!1},s=n.length,r,u,f,o,h;if(t>=s||(n.charAt(t)==="$"&&(i.isRelative=!1,t++),t>=s))return i;if(r=t,f=n.charAt(r),ni(f)&&f!=="0"){for(i.isRow=!0;r<s&&ni(f);)r++,r<s&&(f=n.charAt(r));if(u=parseInt(n.substr(t,r-t),10),u>=1&&u<=e.maxRowCount)return i.elementIndex=u-1,i.endIndex=r,i.success=!0,i}else if(oi(f)){for(i.isRow=!1;r<s&&oi(f);)r++,r<s&&(f=n.charAt(r));if(o=n.substr(t,r-t),o.length>3)return i;for(o=o.toUpperCase(),u=0,h=o.length-1;h>=0;h--)u+=(o.charCodeAt(h)-64)*li[o.length-h-1];if(u<=e.maxColumnCount)return i.elementIndex=u-1,i.endIndex=r,i.success=!0,i}return i},e.prototype._readOneR1C1Element=function(n,t,i,r){var a=e.BAND_INDEX_CONST,u={endIndex:r,elementIndex:a,isRow:!0,isRelative:!1,success:!1},s=n.length,f,o,c,l,h;if(r>=s)return u;if(f=r,o=n.charAt(f),o==="R"||o==="r")u.isRow=!0,c=t;else if(o==="C"||o==="c")u.isRow=!1,c=i;else return u;if(r++,f++,r>=s)return u.endIndex=r,u.elementIndex=c,u.isRelative=!0,u.success=!0,u;if((o=n.charAt(f),o==="["&&(r++,f++,u.isRelative=!0),r>=s)||(l=!1,o=n.charAt(f),u.isRelative&&o==="-"&&(r++,f++,l=!0),r>=s))return u;if(o=n.charAt(f),ni(o)){while(f<s&&ni(o))f++,f<s&&(o=n.charAt(f));if(h=parseInt(n.substr(r,f-r),10),u.isRelative){if(f>=s||n.charAt(f)!=="]")return u;f++}if(h<(u.isRow?e.maxRowCount:e.maxColumnCount))return u.isRelative?(h=l?-h:h,u.elementIndex=h+c):u.elementIndex=h-1,u.endIndex=f,u.success=!0,u}else return u.isRelative?u:(u.endIndex=r,u.elementIndex=c,u.isRelative=!0,u.success=!0,u)},e.prototype._validateWorkbook=function(n,t){var i,u;if(n===f||n===r||n==="")return!0;for(u=0;u<n.length;u++)if(i=n[u],t){if(i==="*"||i===":"||i==="["||i==="]"||i==="?"||i==="'"&&(u===0||u>=n.length-1||n.charAt(u+1)!=="'"))return!1}else if(i==="'"||i==="["||i==="]"||i==="?"||i==="%"||e._operatorInfix.indexOf(i)!==-1)return!1;return!0},e.prototype._validateSheetName=function(n,t,i){var s,u,o;if(n===f||n===r||n==="")return!0;if(!i&&ur(n.charAt(0))||(s=this._isStartWithCellReference(n,t),!i&&s.success&&s.endIndex===n.length))return!1;for(o=0;o<n.length;o++)if(u=n.charAt(o),i){if(u==="*"||u===":"||u==="["||u==="]"||u==="?"||u==="\\"||u==="/")return!1}else if(u==="'"||u==="["||u==="]"||u==="?"||u==="\\"||u==="%"||u==='"'||u==="("||u===")"||e._operatorInfix.indexOf(u)!==-1)return!1;return!0},e.prototype._createStructExpression=function(n,i,f){if(i.charAt(i.length-1)==="]")try{return new u.StructReferenceExpression(i,n)}catch(o){throw t._StringHelper.format(t.SR.Exp_FormulaInvalid,["{",f]);}else{var e=n.getTableByName(i);if(e)return u.StructReferenceExpression.create(e)}return r},e.prototype._validateName=function(n){var u,t,i;if(n===f||n===r||n===""||(u=n.length,u===1&&(n==="R"||n==="r"||n==="C"||n==="c"))||(t=n.charAt(0),!(t==="_"||t==="\\"||oi(t)||eu(t))))return!1;for(i=1;i<u;i++)if(t=n.charAt(i),!(t==="_"||t==="\\"||t==="?"||t==="."||fr(t)||eu(t)))return!1;return!0},e.prototype.parseReferenceExpressionInfos=function(n,t,i,r){var f=this,u=[];try{u=f._parseToToken(n,!1)}catch(e){}return u=f._fillBlankToTokens(u,n),f._getExpressToken(u,n,t,i,r)},e.prototype._adjustArrayTokens=function(n){for(var t,r=0,i=0;i<n.length;i++)t=n[i],t.type===1&&t.subType===1&&t.value===yt?r=0:t.type===1&&t.subType===1&&t.value===st?(r===0&&(n.splice(i,1),i--),r++):t.type===1&&t.subType===2&&t.value==="}"&&(r--,r===0&&(n.splice(i,1),i--));return n},e.prototype._fillBlankToTokens=function(n,i){var h=0,s,e,f,r,u;for(n.splice(0,0,new o("=",1,0,0)),f=n.length-1;f>0;f--)n[f].index===n[f-1].index&&n[f].value===n[f-1].value&&(n=t.ArrayHelper.removeByIndex(n,f));for(r=0;r<n.length-1;r++)e=this._getTokenLength(n[r]),h=n[r+1].index-n[r].index-e,h>0&&(s={index:n[r].index+e,value:i.substring(n[r].index+e,n[r+1].index),type:7},n.splice(r+1,0,s));for(e=this._getTokenLength(n[r]),n.length>0&&i.length>n[r].index+e&&(s={index:n[r].index+n[r].value.length,value:i.substring(n[r].index+n[r].value.length,i.length),type:7},n.splice(r+1,0,s)),u=0;u<n.length;u++)n[u].value.trim()==="("?(n[u].type=1,n[u].subType=1):n[u].value.trim()===")"?(n[u].type=1,n[u].subType=2):n[u].value.trim()==="{"?(n[u].type=1,n[u].subType=1):n[u].value.trim()==="}"&&(n[u].type=1,n[u].subType=2);return n},e.prototype._getTokenLength=function(n){return n.type===1&&(n.value==="ARRAY"||n.value==="ARRAYROW")&&(n.value==="ARRAY"||n.value==="ARRAYROW")?1:n.value.length},e.prototype._getExpressToken=function(n,e,s,h,c){var b=this,ut,nt=f,tt=s._getSheetSource(),st=s.getCalcService(),y,it,l,d,w,ht,ot,p;for(st?(ut=new i.SheetParserContext(s,st.useR1C1,h,c),nt=new k(tt,!1,h,c)):ut=new et(r,!1,0,0),y=[],it=0;it<n.length;it++)try{if(l=n[it],l.value==="["||t.StringUtil.startsWith(l.value,"#")||l.subType===3){y.push({text:l.value,type:l.type,subType:l.subType,canDrag:!1,ranges:l.ranges,value:l.value});continue}if(d=[],b._buildExpressionInfo(ut,l,d),d.length>0){for(p=0;p<d.length;p++)if(w=d[p],w instanceof o)y.push({text:w.value,type:w.type,subType:w.subType,canDrag:g,ranges:[],value:w.value});else if(w instanceof wt){var ft=w,a=ft.expression,rt=e.substring(ft.startIndex,ft.endIndex+1),v=[],g=!0;if(a)if(a.t===8)g=!1,nt&&(ht=nt.getName(a.name),b._getRanges(ht,v,nt,h,c));else if(a.t===17)g=!1,a.source()===tt?(ot=a.getRange(h,c),ot&&v.push(b._cellRange2Range(ot))):v=null;else if(a instanceof u.ReferenceExpression)if(a.t===16){var lt=a.startSource,at=a.endSource,ct=lt.getSources(at);for(p=0;p<ct.length;p++)if(ct[p]===tt){v.push(b._cellRange2Range(a.getRange(h,c)));break}}else a instanceof u.ExternalReferenceExpression?a.source===tt?v.push(b._cellRange2Range(a.getRange(h,c))):v=null:v.push(b._cellRange2Range(a.getRange(h,c)));else v=null;else v=null;v&&v.length>0?y.push({text:rt,type:0,subType:7,canDrag:g,ranges:v,value:rt}):y.push({text:rt,type:l.type,subType:l.subType,canDrag:g,ranges:v,value:rt})}}else y.push({text:l.value,type:l.type,subType:l.subType,canDrag:!1,ranges:l.ranges,value:l.value})}catch(vt){y.push({text:l.value,type:l.type,subType:l.subType,canDrag:!1,ranges:l.ranges,value:l.value})}return y},e.prototype._cellRange2Range=function(n){return new t.Range(n.row,n.column,n.rowCount,n.columnCount)},e.prototype._getRanges=function(n,t,i,f,e){var o,a,s,p,h,v,y,l,c;if(n){while(n.t===14)n=n.argument;if(o=this,n.t===24&&(a=n,n=a.expr),!(n instanceof u.ConstantExpression))if(n instanceof u.ExternalReferenceExpression)i.source&&n.source===i.source&&(s=n.getRange(f,e),t.push(o._cellRange2Range(s)));else if(n.t===17)n.source()===i.source&&(s=n.getRange(f,e),s&&t.push(o._cellRange2Range(s)));else if(n instanceof u.ReferenceExpression)s=n.getRange(f,e),t.push(o._cellRange2Range(s));else if(n.t===9)h=r,(p=n.source.getCalcService())&&(h=new k(n.source,!1,f,e)),v=h.getName(n.name),o._getRanges(v,t,h,f,e);else if(n.t===8)y=i.getName(n.name),o._getRanges(y,t,i,f,e);else if(n.t===11)o._getRanges(n.operand,t,i,f,e);else if(n.t===10)o._getRanges(n.left,t,i,f,e),o._getRanges(n.right,t,i,f,e);else if(n.t===7)for(l=n,c=0;c<l.argCount();c++)o._getRanges(l.getArg(c),t,i,f,e)}},e.prototype._buildExpressionInfo=function(n,t,i){var s,a,v,h,c;if(typeof t!="undefined"&&typeof t!="function"&&t!==null&&t.type===0){var l=this,f=t.value,r,e,u=l._buildCellReferenceOrNameExpressions2(n,f,t.index);if(u!=null&&(r=u.endIndex,e=u.expression,e.t===10?(a=e.left,v=e.right,i.push(new wt(t.index,t.index+u.range1EndIndex-1,a)),i.push(new wt(t.index+u.range1EndIndex,t.index+r-1,v))):(s=new wt(t.index,t.index+r-1,e),i.push(s)),!(r<=0)&&!(r>=f.length))&&f[r]==":")for(i.push(new o(":",5,r+t.index)),r++;r>0&&r<f.length;){if(h=r+t.index,u=l._buildCellReferenceOrNameExpressions2(n,f.substring(r),t.index),u==null)return;if(c=u.endIndex,e=u.expression,s=new wt(h,h+c-1,e),i.push(s),r+=c,r>=f.length||f[r]!==":")return;i.push(new o(":",5,r+t.index));r++}}},e.BAND_INDEX_CONST=-2147483648,e.maxRowCount=1048576,e.maxColumnCount=16384,e._isLetter=oi,e._isLetterOrDigit=fr,e.listSeparator=",",e.numberDecimalSeparator=".",e.arrayGroupSeparator=";",e.arrayListSeparator=",",e._operatorInfix="\\+-*/^&=><: "+e.listSeparator,e.unparseWithoutCulture=!1,e}();i.Parser=l;wt=function(){function n(n,t,i){var r=this;this.startIndex=n;this.endIndex=t;this.expression=i}return n}();k=function(){function n(n,t,i,r,u,e,o,s){this.asyncId=0;this.asyncCount=0;this._expandArrayToMultiCallCount=0;var h=this,c=arguments.length;h.source=n;h.arrayFormulaMode=!!t;h.row=i||0;h.column=r||0;h.rowCount=u||1;h.columnCount=e||1;h.activeRow=o!==f?o:h.row;h.activeColumn=s!==f?s:h.column;h.rowOffset=o===f?h.row:h.activeRow-h.row;h.columnOffset=s===f?h.column:h.activeColumn-h.column}return n.prototype.getValue=function(n,t,i){return n?n.getValue(t,i):h},n.prototype.getReference=function(n,t,i,r,u){return n?n.getReference(t,i,r,u):h},n.prototype.getSheetRangeReference=function(n,t,i,r,u,f){return!n||!t?h:n.getSheetRangeReference(t,i,r,u,f)},n.prototype.getFunction=function(n){var t=this;return t.source?t.source.getCustomFunction(n):r},n.prototype.getName=function(n){var t=this,i=t.source?t.source.getCustomName(n):r;return!i&&t.source&&(i=t.source.getCalcService().getGlobalSourceModel().getSource().getCustomName(n)),i},n.prototype._isExpandArrayToMultiCall=function(){return this._expandArrayToMultiCallCount>0},n.prototype._beginExpandArrayToMultiCall=function(){this._expandArrayToMultiCallCount++},n.prototype._endExpandArrayToMultiCall=function(){this._expandArrayToMultiCallCount--},n.prototype._offset=function(t,i){var r=this;return new n(r.source,r.arrayFormulaMode,r.row+t,r.column+i,r.rowCount,r.columnCount,r.rowOffset,r.columnOffset)},n.prototype.SetAsyncResult=function(n,t){this.source.getCalcService()._evaluator.SetAsyncResult(n,t);this.source.refresh()},n.prototype.cloneFrom=function(n){var t=this;t.acceptsReference=n.acceptsReference;t.activeColumn=n.activeColumn;t.activeRow=n.activeRow;t.arrayFormulaMode=n.arrayFormulaMode;t.column=n.column;t.columnCount=n.columnCount;t.columnOffset=n.columnOffset;t.row=n.row;t.rowCount=n.rowCount;t.rowOffset=n.rowOffset},n}();i.EvaluateContext=k;or=function(){function n(n,t){this.id=n.asyncId++;this.ctx=n;this.row=n.activeRow;this.col=n.activeColumn;this.expression=t}return n.prototype.getFormula=function(){return this.ctx.source.getCalcService().unparse(this.ctx.source,this.expression,this.row,this.col)},n.prototype.SetAsyncResult=function(n){this.ctx.SetAsyncResult(this,n)},n}();i.AsyncEvaluateContext=or;sr=function(n){function t(t,i,r,u,f,e,o,s){n.call(this,t,i,r,u,f,e,o,s);this._globalSource=t.getCalcService().getGlobalSourceModel().getSource()}return __extends(t,n),t.prototype.getName=function(n){var t=this;return t._globalSource?t._globalSource.getCustomName(n):r},t}(k);i.GloableEvaluateContext=sr;cu=new l;hr=function(){function n(){this._aync2={};this._aync={}}return n.prototype.evaluateFormula=function(n,t,i,r){return this.evaluateExpression(cu.parse(n,t),i,r)},n.prototype.evaluateExpression=function(n,t,i,u,e){var o=this._evaluate(n,t,!!u,!!e);return o===f||o===r?i===!1?o:0:typeof o=="number"&&o.toString().length>=15?+o.toPrecision(15):o},n.prototype._evaluate=function(n,i,f,e){var s,o,h,l,v,c,a;if(!n)throw t.SR.Exp_ExprIsNull;while(n.t===14)n=n.argument;return s=this,h=r,n.t===24&&(l=n,n=l.expr,h=l.needExpendIndexs),n instanceof u.ConstantExpression?o=s._evaluateConst(n,i,f):n instanceof u.ReferenceExpression?o=s._evaluateReference(n,i,e,f):n.t===9?(c=r,(v=n.source.getCalcService())&&(c=new k(n.source,i.arrayFormulaMode,i.row,i.column)),c||(o=ut),o=s._evaluateName(n.name,c,i,f,e)):n.t===8?o=s._evaluateName(n.name,i,i,f,e):n.t===11?o=s._evaluateUnaryOperation(n,i,f,e,h):n.t===10?o=s._evaluateBinaryOperation(n,i,f,e,h):n.t===7?o=s._evaluateFunction(n,i,f,e,h):(n.t===25||n.t===26)&&(a=n.source||i&&i.source,o=a&&a.getValueByName(n.nameIdentity)),o},n.prototype._evaluateConst=function(n,t,i){var r=n.value;return e.arr(r)?i||t&&(t.arrayFormulaMode||t._isExpandArrayToMultiCall())?r:gt.getArrayValue(r,0,0):r},n.prototype._evaluateReference=function(n,t,i,r){var c,p,l,y,w,b;if(!t)return s;c=t.source;n instanceof u.ExternalReferenceExpression?c=n.source:n.t===17&&(c=n.source());var k=t.row,d=t.column,f=n.getRange(k,d);if(!f)return h;var a=f.row<0?0:f.row,v=f.column<0?0:f.column,o=f.rowCount,e=f.columnCount;if(i||t.arrayFormulaMode)return n.t===16?t.getSheetRangeReference(n.startSource,n.endSource,f.row,f.column,o,e):t.getReference(c,f.row,f.column,o,e);else if(r&&(o>1||e>1)){for(p=[],l=0;l<o;l++)for(p[l]=[],y=0;y<e;y++)p[l][y]=t.getValue(c,l+a,y+v);return new ft(p,e)}if(o>1||e>1)if(w=t.row>=f.row&&t.row<f.row+o,b=t.column>=f.column&&t.column<f.column+e,w||b)if(w&&!b&&e===1)a=t.row;else if(!w&&b&&o===1)v=t.column;else if(o===1||e===1)a=t.row,v=t.column;else return s;else return s;else if(f.row===-1&&o===-1){if(e!==1)return s;a=t.row}else if(f.column===-1&&e===-1){if(o!==1)return s;v=t.column}return t.getValue(c,a,v)},n.prototype._evaluateName=function(n,t,i,r,u){if(!t||!i)return ut;var f=t.getName(n);return f?this._evaluate(f,i,r,u):ut},n.prototype._evaluateOperationArg=function(n,t,r,u){var f=this._evaluate(n,t,r,u);return e.err(f)?f:f===i.missingArgument?p:f},n.prototype._evaluateUnaryOperation=function(n,t,u,f,o){var h=!1,s;return(o!=r&&o.length>0&&(u=!0,h=!0),s=this._evaluate(n.operand,t,u,h),e.err(s))?s:s===i.missingArgument?p:this._evaluateWithArgs(n,function(i){return n.operator.evaluate(i[0],t)},t,o,[s],u,f)},n.prototype._evaluateBinaryOperation=function(n,t,u,f,o){var l=[u,u],a=[n.operator.acceptsReference,n.operator.acceptsReference],v,c,s,h;if(o!=r&&o.length>0)for(s=0;s<o.length;s++)l[o[s]]=!0,a[o[s]]=!0;for(v=[n.left,n.right],c=[],s=0;s<2;s++){if(h=this._evaluate(v[s],t,l[s],a[s]),e.err(h))return h;if(h===i.missingArgument)return p;c[s]=h}return this._evaluateWithArgs(n,function(i){return n.operator.evaluate(i[0],i[1],t)},t,o,c,u,f)},n.prototype.startCache=function(){this._functionResultCaches={}},n.prototype.endCache=function(){this._functionResultCaches=r},n.prototype._evaluateFunction=function(n,t,u,o,s){var y,p,w,k,rt,a,h,l,d,g,ft,et,nt;if(!n||!n.fn||typeof n.fn=="string")return ut;var tt=n.argCount(),v=this,ot=t.asyncCount,c=n.fn,b,it=r;if(tt===0)b=[];else{for(b=[],y=[],p=[],h=0;h<tt;h++)y[h]=c.acceptsArray(h),p[h]=c.acceptsReference(h);if(s&&s.length>0){for(it=[],h=0;h<tt;h++)it[h]=!0;for(h=0;h<s.length;h++)w=s[h],y[w]=!0,p[w]=!0,it[w]=!(c.acceptsReference(w)&&!c.acceptsArray(w))}for(c.isBranch()&&(t.arrayFormulaMode||t._isExpandArrayToMultiCall())&&(y[c.findTestArgument()]=!0,p[c.findTestArgument()]=!0),a=-1,rt=-1,c.isBranch()&&(a=c.findTestArgument(),c.acceptsArray(a)&&t._beginExpandArrayToMultiCall(),k=v._evaluate(n.getArg(a),t,y[a],p[a]),c.acceptsArray(a)&&t._endExpandArrayToMultiCall(),e.ref(k)||e.arr(k)||(rt=c.findBranchArgument(k))),h=0;h<tt;h++){if(a===h)l=k;else if(rt>=0&&h!==rt){b[h]=null;continue}else c.acceptsArray(h)&&t._beginExpandArrayToMultiCall(),l=v._evaluate(n.getArg(h),t,y[h],p[h]),c.acceptsArray(h)&&t._endExpandArrayToMultiCall();if(!c.acceptsArray(h)&&e.arr(l)||!c.acceptsReference(h)&&e.ref(l))if(d=e.arr(l)?l:r,g=e.ref(l)?l:r,d!=r&&d.getRowCount()==1&&d.getColumnCount()==1)l=d.getValue(0,0);else if(g!=r&&g.getRowCount(0)==1&&g.getColumnCount(0)==1)l=g.getValue(0,0,0);else{if(ft=[],et=!1,s!=r)for(nt=0;nt<s.length;nt++)ft.push(s[nt]),s[nt]==h&&(et=!0);et||(ft.push(h),s=ft)}if(e.err(l)&&!c.acceptsError(h))return l;l===i.missingArgument&&(c.acceptsMissingArgument(h)||(l=r));b[h]=l}}return v._evaluateWithArgs(n,function(n,u){var p,w,e,b,k,l,a,it,s,rt,d,g,h;if(c.isContextSensitive()){if(t.acceptsReference=o||t._isExpandArrayToMultiCall(),c instanceof nr.AsyncFunction){var ut=new or(t,u),tt=t.source.getName()+"_"+t.activeRow+"_"+t.activeColumn+"_"+ut.getFormula(),y=v._aync[tt],nt=t.source.getCalcService().currentAsync;return y!==f&&nt&&nt.source===t.source.getName()&&nt.row===t.activeRow&&nt.col===t.activeColumn?y:(t.asyncCount++,t.asyncCount===ot+1?(y=c.evaluateWithContext(n,ut),y===f&&(y=c.defaultValue())):y=c.defaultValue(),v._aync2[tt]!==f)?v._aync2[tt]:y}return c.evaluateWithContext(n,t)}else{if(p=t.arrayFormulaMode?v._functionResultCaches:r,p)if(w=!1,e=p[c.name+n.length],e)for(h=0;h<e.length;h++){if(b=e[h],w=!0,b.args.length===n.length)for(k=0;k<n.length;k++)if(l=b.args[k],a=n[k],l!==a)if(l instanceof i.SheetReference&&a instanceof i.SheetReference){if(it=l._rangeCount,l._sheetSource!==a._sheetSource||it!==a._rangeCount){w=!1;break}for(s=0;s<it;s++)if(l.getRow(s)!==a.getRow(s)||l.getColumn(s)!==a.getColumn(s)||l.getRowCount(s)!==a.getRowCount(s)||l.getColumnCount(s)!==a.getColumnCount(s)){w=!1;break}}else{w=!1;break}if(w)return b.flag++,b.value}else e=p[c.name+n.length]=[];if(rt=c.evaluate(n),p){if(d=e.length,d>=100){for(g=[],h=0;h<d;h++)e[h].flag>0&&g.push(e[h]);g.sort(function(n,t){return t.flag-n.flag});d=Math.min(50,g.length);e=g.slice(0,d);p[c.name+n.length]=e}e.push({args:n,value:rt,flag:0})}return rt}},t,s,b,u,o,it)},n.prototype.SetAsyncResult=function(n,t){var i=n.ctx,r=i.source.getName()+"_"+i.activeRow+"_"+i.activeColumn+"_"+n.getFormula();this._aync[r]=t;this._aync2[r]!=t&&(this._aync2[r]=t,i.source.getCalcService().currentAsync={source:i.source.getName(),row:n.row,col:n.col},i.source.getCalcService().recalculate(i.source,i.activeRow,i.activeColumn,!1),i.source.getCalcService().currentAsync=null)},n.prototype._evaluateWithArgs=function(n,t,i,u,f,o,h,c){var b,a,v,tt,k,it,l,y,nt,w,d;if(u&&u.length>0){if(b=this._expandArgs(i,n,f,u,c),b==r)return p;var g=[],rt=b[0].length,ut=b[0][0].length;for(a=0;a<rt;a++)for(g[a]=[],v=0;v<ut;v++)try{for(tt=[],k=0;k<f.length;k++)tt[k]=b[k][a][v];if(l=t(tt,n),e.ref(l)){if(n.t===7&&(it=n.fn,it.returnReference&&it.returnReference()))return l;l=this.getOneValue(i,l)}g[a][v]=l}catch(et){g[a][v]=s}return new ft(g)}else try{if(l=t(f,n),i.arrayFormulaMode&&i._isExpandArrayToMultiCall())return l;if(e.arr(l)&&!o)return this.getOneValue(i,l);else if(e.ref(l)&&!h){if(y=l,o&&y.getRangeCount()===1){for(nt=[],w=0;w<y.getRowCount(0);w++)for(nt[w]=[],d=0;d<y.getColumnCount(0);d++)nt[w][d]=y.getValue(0,w,d);return new ft(nt,y.getColumnCount(0))}return this.getOneValue(i,l)}else return l}catch(et){return s}},n.prototype.getOneValue=function(n,t){var i,f,r,u;return e.ref(t)?(i=t,i.getRangeCount()>1?t=s:(n.rowOffset!=-1||n.columnOffset!=-1?(r=i.getRowCount(0)==1?0:n.rowOffset,u=i.getColumnCount(0)==1?0:n.columnOffset):(r=i.getRowCount(0)==1?0:n.row-i.getRow(0),u=i.getColumnCount(0)==1?0:n.column-i.getColumn(0)),t=r>=i.getRowCount(0)||u>=i.getColumnCount(0)?p:i.getValue(0,r,u))):e.arr(t)&&(f=t,n.arrayFormulaMode&&(n.rowOffset!=-1||n.columnOffset!=-1)?(r=f.getRowCount()==1?0:n.rowOffset,u=f.getColumnCount()==1?0:n.columnOffset,t=r>=f.getRowCount()||u>=f.getColumnCount()?p:f.getValue(r,u)):t=f.getValue(0,0)),t},n.prototype._expandArgs=function(n,i,u,o,s){var k=1,d=1,y=-1,ut=!0,ft=!0,g=i.t===7?i:r,it,ct,rt,nt,et,v,b,tt;if(g==r||g.fn.expandRows()||(ut=!1),g==r||g.fn.expandColumns()||(ft=!1),g!=r&&g.fn.isBranch&&(n.arrayFormulaMode||n._isExpandArrayToMultiCall())){if(y=g.fn.findTestArgument(),it=[],ct=!1,o)for(rt=0;rt<o.length;rt++)it.push(o[rt]),o[rt]===y&&(ct=!0);if(ct||e.arr(u[y])||e.ref(u[y])){for(nt=0;nt<g.argCount();nt++)nt!=y&&t.ArrayHelper.indexOf(it,nt)<0&&(e.arr(u[nt])||e.ref(u[nt]))&&it.push(nt);o=it}}for(et=0;et<o.length;et++){var ot=u[o[et]],c=e.arr(ot)?ot:null,h=e.ref(ot)?ot:null,l=0,a=0;if(c!=r)l=c.getRowCount(),a=c.getColumnCount();else if(h!=r){if(h.getRangeCount()>1)return r;l=ut?h.getRowCount(0):1;a=ft?h.getColumnCount(0):1}k=l>k?l:k;d=a>d?a:d}var st=[],ht=0,lt=o[ht];for(v=0;v<u.length;v++){st[v]=[];var w=u[v],c=null,h=null,l=1,a=1;if(v===lt){if(c=e.arr(w)?w:r,h=e.ref(w)?w:r,(c!=r||h!=r)&&(l=c!=r?c.getRowCount():ut?h.getRowCount(0):1,a=c!=r?c.getColumnCount():ft?h.getColumnCount(0):1,(l!=1&&l!=k||a!=1&&a!=d)&&(y==-1||v==y)&&!n.arrayFormulaMode))return r;ht++;lt=ht<o.length?o[ht]:-1}else if(s===f&&(c=e.arr(w)?w:r,h=e.ref(w)?w:r,(c!=r||h!=r)&&(l=c!=r?c.getRowCount():ut?h.getRowCount(0):1,a=c!=r?c.getColumnCount():ft?h.getColumnCount(0):1,(l!=1&&l!=k||a!=1&&a!=d)&&(y==-1||v==y)&&!n.arrayFormulaMode)))return r;if(h!=r){var yt=i.source||n.source,at=h.getRow(0),vt=h.getColumn(0);k=at+k-at;d=vt+d-vt}for(b=0;b<k;b++)for(st[v][b]=[],tt=0;tt<d;tt++)st[v][b][tt]=l!=1&&b>=l||a!=1&&tt>=a?p:c!=r?c.getValue(l==1?0:b,a==1?0:tt):h!=r?s==r||s[v]?h.getValue(0,l==1?0:b,a==1?0:tt):h.create([new t.Range(h.getRow(0)+(l==1?0:b),h.getColumn(0)+(a==1?0:tt),1,1)]):w}return st},n}();i.Evaluator=hr})(t.Calc||(t.Calc={}));var i=t.Calc})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){(function(i){function k(t,r,e,o,s){var l=t&&t instanceof n.Sheets.Sheet&&t,a=new i.Parser,h,c;return e=e===u?0:e,o=o===u?0:o,h=new f(l,!!s,e,o),c=a.parse(r,h),i.evaluateExpression(t,c,e,o)}function d(n,t,i,r){var o=n.getCalcService(),f,e;return i===u&&(i=n.getActiveRowIndex()),r===u&&(r=n.getActiveColumnIndex()),f=n._getSheetSource(),e=o.evaluateParsedFormula(f,t,i,r,!1,!0),e}function g(n,t,r,u,f){var h=n.row,c=n.col,v=n.row+n.rowCount-1,y=n.col+n.colCount-1,o=!1,l=!1,s=!1,a=!1,e,p,w;return(arguments.length>=4&&(o=(u&1)!=0,l=(u&4)!=0,s=(u&2)!=0,a=(u&8)!=0,h-=o?t:0,v-=l?t:0,c-=s?r:0,y-=a?r:0),f&&(p=nt(n,f,t),w=tt(n,f,t),p&&w))?i.Expressions.StructReferenceExpression.create(f,p,w,n.col-f.dataRange().col,n.col+n.colCount-f.dataRange().col-1):(n.row<0&&n.col<0?e=new i.Expressions.RangeExpression:n.row<0?(e=new i.Expressions.RangeExpression,e.initBand(c,y,s,a,!1)):n.col<0?(e=new i.Expressions.RangeExpression,e.initBand(h,v,o,l,!0)):e=n.rowCount===1&&n.colCount===1?new i.Expressions.CellExpression(h,c,o,s):new i.Expressions.RangeExpression(h,c,v,y,o,s,l,a),e)}function nt(n,t,i){if(n.rowCount===1){if(t.hasHeadersRow()&&n.row===t.startRow())return 2;if(t.hasTotalsRow()&&n.row===t.endRow())return 8;if(i===n.row)return 1}else{if(t.hasHeadersRow()&&n.row===t.startRow()){if(n.rowCount===t.dataRange().rowCount+1)return 6;if(t.hasTotalsRow()&&n.rowCount===t.dataRange().rowCount+1+1)return 14}if(n.row===t.dataRange().row){if(n.rowCount===t.dataRange().rowCount)return 3;if(t.hasTotalsRow()&&n.rowCount===t.dataRange().rowCount+1)return 12}}return u}function tt(n,t,i){return n.col===t.startColumn()&&n.colCount===t.dataRange().colCount?1:n.colCount===1?2:n.col>=t.startColumn()&&n.col+n.colCount-1<=t.endColumn()?4:u}function it(n,t,u,f,e){var o=i.rangeToExpression(n,t,u,f),s=new i.ParserContext(r,!!e,t,u),h=new i.Parser;return h.unparse(o,s)}function rt(n,t,r,u,f,e,o){var s=i.rangeToExpression(t,r,u,f,o),h=new i.SheetParserContext(n,!!e,r,u),c=new i.Parser;return c.unparse(s,h)}function ut(n,i,r,u){var h,f,o,s,e;if(!i)return null;if(r=r?r:0,u=u?u:0,h=n.getCalcService(),f=h.parse(n._getSheetSource(),i,r,u),f)if(o=f.source,o&&f.t===17)o=f.source();else if(f.t===16){var a=f.startSource,v=f.endSource,c=a.getSources(v),l=!1;for(s=0;s<c.length;s++)if(c[s]===n._getSheetSource()){l=!0;break}f=l&&f}return f&&f.getRange&&(!o||o===n._getSheetSource())?(e=f.getRange(r,u),!e)?null:new t.Range(e.row,e.column,e.rowCount,e.columnCount):null}function ft(n,t,u,f,e){var o="",l=new i.Parser,a=new i.ParserContext(r,!!e,t,u),s,c,h;for(n.length>1&&(o="("),s=0;s<n.length;s++)c=i.rangeToExpression(n[s],t,u,f),h=l.unparse(c,a),s>0?o+=", "+h:o=h;return n.length>1&&(o+=")"),o}var p,f,et;t.feature("calc.common",["core.stringResource","core.common","core.globalize"]);var ot="undefined",st="number",ht="string",ct="boolean",lt="TRUE",at="FALSE",vt="ARRAY",yt="ARRAYROW",e="#NULL!",o="#DIV/0!",s="#VALUE!",h="#REF!",c="#NAME?",l="#N/A",a="#NUM!",pt=[e,o,s,h,c,l,a],wt=[0,7,15,23,29,42,36],bt=[1,26,676],r=null,u=undefined,kt=!1,dt=Math.min,gt=Math.max,ni=Math.abs,ti=Math.pow,v=["v","n","s","b","d"],w=[r,0,"",!1,new Date],ii=new i.CalcError(e,0),ri=new i.CalcError(o,7),y=new i.CalcError(s,15),ui=new i.CalcError(h,23),fi=new i.CalcError(c,29),ei=new i.CalcError(l,42),oi=new i.CalcError(a,36),b=function(n){function e(t){n.call(this,r);this._sheet=t}return __extends(e,n),e.prototype.startCalculation=function(){if(!this._valueCaches){var n=this.getRowCount(),t=this.getColumnCount();this._valueCaches={rowCount:n,colCount:t};this._changedCells=[]}},e.prototype.endCalculation=function(){this._valueCaches=r;var n=this._changedCells;n&&n.length>0&&this._sheet.triggerRangeChanged({sheet:this._sheet,sheetName:this._sheet.getName(),row:0,column:0,rowCount:this._sheet.getRowCount(),columnCount:this._sheet.getColumnCount(),changedCells:n,action:6});this._changedCells=r},e.prototype.getValue=function(n,t,f){var s=this,h=s._sheet,e,a,p,w,c,o,l;return(f=f===u?0:f,n<0||t<0)?y:h._isValidatingCell&&h._validatingRow===n&&h._validatingColumn===t?h._validatingValue:(e=s._valueCaches,a=v[f],e?(p=e.rowCount,w=e.colCount,n>=p)?r:t>=w?r:(c=e[n],c||(c=e[n]={}),o=c[t],o||(o=c[t]={v:h.getValue(n,t)}),l=o[a],l===u&&(l=i.Convert.convertValue(o.v,f,!0),o[a]=l),l):n>=s.getRowCount()?r:t>=s.getColumnCount()?r:s._sheet.getValue(n,t))},e.prototype.getReference=function(n,t,r,u){var f=this;return n===-1&&t===-1?f.getSheetReference():n===-1?new i.SheetReference(f,[{row:0,rowCount:f.getRowCount(),col:t,colCount:u}]):t===-1?new i.SheetReference(f,[{row:n,rowCount:r,col:0,colCount:f.getColumnCount()}]):new i.SheetReference(f,[{row:n,rowCount:r,col:t,colCount:u}])},e.prototype.getSheetRangeReference=function(n,t,r,u,f){var s;if(this._sheet&&this._sheet.parent&&this._sheet.parent.sheets&&n instanceof e){var c=this._sheet.parent.sheets,l=!1,o,h=[];for(s=0;s<c.length;s++){if(o=c[s]._getSheetSource(),o===this)l=!0;else if(o===n){h.push(o.getReference(t,r,u,f));break}l&&h.push(o.getReference(t,r,u,f))}return new i._SheetRangeReference(h)}},e.prototype.getSources=function(n){var i;if(this._sheet&&this._sheet.parent&&this._sheet.parent.sheets&&n instanceof e){var u=this._sheet.parent.sheets,f=!1,t,r=[];for(i=0;i<u.length;i++){if(t=u[i]._getSheetSource(),t===this&&(f=!0),t===n){r.push(t);break}f&&r.push(t)}return r}},e.prototype.referenceToArray=function(n,t,f,e,o,s){var at=this,b,k,d=1,g=1,et,ot,nt,h=[],pt,c,st,tt=at._sheet,l=at._valueCaches,rt,it,ht=v[t],wt=w,bt=i.Convert.CalcConvertedError,vt,yt,p,kt,dt,ct,a,lt,ut,ft;if(nt=n.getRangeCount(),nt===0)return h.isError=!0,[];if(l&&(it=n.getRangeCount()+"_"+n.getRow(0)+"_"+n.getColumn(0)+"_"+n.getRowCount(0)+"_"+n.getColumnCount(0)+"_"+t+"_"+f,c=l[it],c))return h=c.slice(0),h.rowCount=c.rowCount,h.colCount=c.colCount,h.rangeCount=c.rangeCount,h;for(vt=this.getRowCount(),yt=this.getColumnCount(),f=f===u?!0:f,p=0;p<nt;p++){if(f||(st=[],h.push(st)),d=n.getRowCount(p),d===0)return h.isError=!0,[];if(g=n.getColumnCount(p),g===0)return h.isError=!0,[];if(et=n.getRow(p),ot=n.getColumn(p),e&&(et+d>vt||ot+g>yt))return h=[r],h.isError=!0,h;for(lt=tt._isValidatingCell,ut=0;ut<d;ut++)for(b=et+ut,f||(ct=[],st.push(ct)),l&&(rt=l[b],rt||(rt=l[b]={})),ft=0;ft<g;ft++){if(k=ot+ft,lt&&tt._validatingRow===b&&tt._validatingColumn===k)c=tt._validatingValue,lt=!1;else{if(l?(a=rt[k],a?c=a.v:(c=tt.getValue(b,k),a=rt[k]={v:c})):c=tt.getValue(b,k),e&&i.Convert.err(c))return h=[c],h.isError=!0,h;if(a&&a[ht]!==u)c=a[ht];else if(c=i.Convert.convertValue(c,t,!0,s),a&&(a[ht]=c),o&&a===c)return h=[y],h.isError=!0,h}c===r&&s||(f?h.push(c):ct.push(c))}}return f||nt!==1||(h=h[0]),h.rowCount=d,h.colCount=g,h.rangeCount=nt,l&&(l[it]=h.slice(0),l[it].rowCount=d,l[it].colCount=g,l[it].rangeCount=nt),h},e.prototype.getColumnCount=function(){return this._sheet.getColumnCount()},e.prototype.getRowCount=function(){return this._sheet.getRowCount()},e.prototype.isHiddenRow=function(n,t){var i=this._sheet,r=i.hasRowFilterOut();return r||!t?i.getRowHeight(n)===0:!1},e.prototype.getName=function(){return this._sheet.getName()},e.prototype.setValue=function(n,i,r){var a=this,f=a._sheet,v=a._valueCaches,c,u,s,p,w,o,l,b;if(v&&(c=v[n],c&&(u=c[i],u&&(u.v=r,u.b!==undefined&&(u.b=undefined),u.d!==undefined&&(u.d=undefined),u.n!==undefined&&(u.n=undefined),u.s!==undefined&&(u.s=undefined)))),s=f._getModel(),s){var k=f.getValue(n,i),h=!1,y=f._tableManager,e=y&&y.find(n,i);e&&(p=e.showHeader()&&n===e.headerIndex(),w=e.showFooter()&&n===e.footerIndex(),p||w||(h=e._setValue(n,i,r)));o=f._bindingManager;!h&&o&&o._dataSource&&(l=o.getValue(n,i),l.hasBinding&&(b=t.GC$.extend({},f.getDataItem(n)),s._updateDirty(n,i,{originalItem:b,oldValue:o.getValue(n,i).value}),o.setValue(n,i,r)),h=l.hasBinding);(!h||f.checkingChanges)&&s.setValue(n,i,r);this._changedCells?this._changedCells.push({row:n,column:i}):this._sheet.triggerCellChanged({sheet:this._sheet,sheetName:this._sheet.getName(),row:n,col:i,sheetArea:3,propertyName:"value",oldValue:k,newValue:r})}},e.prototype.getCustomFunction=function(n){return this._sheet?this._sheet._findCustomFunction(n):r},e.prototype.getCustomName=function(n){var t=this._sheet?this._sheet.getCustomName(n):r;return t?t.getExpression():r},e.prototype.getSheet=function(){return this._sheet},e.prototype.getParserContext=function(n,t,i,r){return new f(this._sheet,n,t,i,r)},e.prototype.setFormula=function(n,t,i){},e.prototype.setArrayFormula=function(n,t,i,r,u){},e.prototype.setFormulaByName=function(n,t){},e.prototype.refresh=function(){this._sheet.repaint()},e.prototype.toJSON=function(n,i){var f,y=i,c,r,e,u,h=n.data||{},o,l,s,a,v;for(o in y){l=parseInt(o,10);f=h.dataTable||{};c=y[o];e=f[o]||{};for(s in c)a=parseInt(s,10),r=c[s],r&&r.expr&&(u=e[s]||{},v=this.getCalcService().unparseWithoutCulture(this,r.expr,l,a,!0),r.arrayInfo?r.arrayInfo.row===l&&r.arrayInfo.col===a&&(u.arrayInfo=r.arrayInfo,u.formula=v):u.formula=v,t.GC$.isEmptyObject(u)||(e[s]=u));t.GC$.isEmptyObject(e)||(f[o]=e);t.GC$.isEmptyObject(f)||(h.dataTable=f)}t.GC$.isEmptyObject(h)||(n.data=h)},e}(i.CalcSource);i.SheetSource=b;p=function(n){function t(t){n.call(this,r);this._spread=t}return __extends(t,n),t.prototype.getCustomFunction=function(n){return this._spread?this._spread.getCustomFunction(n):r},t.prototype.getCustomName=function(n){var t=this._spread?this._spread.getCustomName(n):r;return t?t.getExpression():r},t}(i.CalcSource);i.SpreadSource=p;f=function(n){function t(t,i,r,u,f){n.call(this,t._getSheetSource(),i,r,u,f);this._sheet=t}return __extends(t,n),t.prototype.getExternalSource=function(t,u){var s=this,e=s._sheet.parent,f,o,h;if(t&&(!e||e.name!==t))return r;else if(!e)return i.compareStringIgnoreCase(s._sheet._name,u)?s._sheet._getSheetSource():r;if(f=e.sheets,f&&f.length>0)for(o=0;o<f.length;o++)if(h=f[o],i.compareStringIgnoreCase(h._name,u))return h._getSheetSource();return n.prototype.getExternalSource.call(this,t,u)},t.prototype.getExternalSourceToken=function(n){return n.getName()},t.prototype.getTableByName=function(n){return this._sheet.findTableByName(n)},t.prototype.getTableByIndex=function(n,t){return this._sheet.findTable(n,t)},t.prototype.setSource=function(n){this.source=n;n&&n.getSheet&&(this._sheet=n.getSheet())},t}(i.ParserContext);i.SheetParserContext=f;i.evaluateFormula=k;i.evaluateExpression=d;i.rangeToExpression=g;i.rangeToFormula=it;i.rangeToFormulaWithStructReference=rt;i.formulaToRange=ut;i.rangesToFormula=ft,function(n){n[n.allAbsolute=0]="allAbsolute";n[n.startRowRelative=1]="startRowRelative";n[n.startColRelative=2]="startColRelative";n[n.endRowRelative=4]="endRowRelative";n[n.endColRelative=8]="endColRelative";n[n.rowRelative=5]="rowRelative";n[n.colRelative=10]="colRelative";n[n.allRelative=15]="allRelative"}(i.RangeReferenceRelative||(i.RangeReferenceRelative={}));et=i.RangeReferenceRelative})(t.Calc||(t.Calc={}));var i=t.Calc})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){(function(i){(function(r){function ai(n,i,r){var u,f;if(n===h||n===s)throw t.SR.Exp_InvalidFunctionName;if(n=n.toUpperCase(),c._builtInFunctions.hasOwnProperty(n))if(u=c._builtInFunctions[n],u){if(!r||!r.override)throw t.SR.Exp_OverrideNotAllowed;}else c._builtInFunctions[n]=new c.Function(n,0,255),u=c[n.toUpperCase()];else u=new c.Function(n,0,255),c._builtInFunctions[n]=u;if(i&&typeof i=="function"&&(u.evaluate=i),r)for(f in r)r.hasOwnProperty(f)&&f!=="override"&&(u[f]=r[f]);return u}function e(n){return!0}function nu(){return!1}function gt(n){return n!==0}function d(n){return n===1}function y(n){return n===2}function ni(n){return n===0||n===2}function ti(n){return n===0||n%2==1}function wt(n){return n===3}function ot(){return!0}function st(n){return n===1||n===2}function yi(){return!0}function ii(n){return n===0}function ri(n,r,f){var e,o,s,h,c;if(u.err(n))return f.value=n,!1;else if(u.ref(n)){for(e=0;e<n.getRangeCount();e++)for(o=0;o<n.getRowCount(e);o++)for(s=0;s<n.getColumnCount(e);s++)if(n instanceof i._SheetRangeReference){for(h=0;h<n.getSheetCount();h++)if((f.includeSubtotal||!n.isSubtotal(h,e,o,s))&&r(n.getValue(h,e,o,s),f)===!1)return!1}else if((f.includeSubtotal||!n.isSubtotal(e,o,s))&&r(n.getValue(e,o,s),f)===!1)return!1}else if(u.arr(n)){for(c=0;c<n.length();c++)if(r(n.getValueByIndex(c),f)===!1)return!1}else if(t.GC$.isArray(n))t.GC$.each(n,function(n,t){return r(t,f)});else if(r(n,f)===!1)return!1;return!0}function pi(){return 0}function tu(n){if(u.err(n))return-1;var t=!1;try{t=u.B(n)}catch(i){}return t?1:2}function ui(n){return n>0}function iu(n){return n===1}function fi(n){return n===1||n===2||n===3}function ru(n){return n===2}function uu(n){return n===0||n===2}function fu(n){return n===0||n===1}function eu(n){return n===0||n%2==1}function ht(n){return n===0}function ei(n){return n===0||n===1||n===2}function ou(n){return n%2==0}function su(n){return n===3}function oi(n){return n!==3}function hu(n){return n===3||n===4}function cu(n){return n!==1}function lu(n){return n===3||n===4}function it(n){return n===2||n===3}function au(n){return n>0}function vu(n){return n===4}function yu(n){return n===4||n===5}function pu(n){return n===5}function wu(n){return n===6}function bu(n){return n===8}function ku(n){return n===7}function du(n){return n!==2}function gu(n){return n===5||n===6}function nf(n){return n===4||n===6||n===7}function tf(n){return n===3||n===4||n===5}function rf(n){return n>=1}function uf(n){return n===2||n===3||n===4}function ff(n){return n===1||n===2||n===3}function ea(n){if(n===""||n===h||n===s)return n;for(var t in ct)ct.hasOwnProperty(t)&&(n=n.replace(ct[t],ct[t].source));return n=n.replace("~?","{113E2532-EAF5-444c-A5CB-3D7446971C4D}"),n=n.replace("~*","{E21523B3-0F1F-458f-B547-23D25713D0EC}"),n=n.replace("?","."),n=n.replace("*","((.|\\n)*)"),n=n.replace("{113E2532-EAF5-444c-A5CB-3D7446971C4D}","\\?"),n=n.replace("{E21523B3-0F1F-458f-B547-23D25713D0EC}","\\*"),n.toString()}function ef(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult(l(t))}function of(n){var t=parseFloat(n[0]);return t===h||t===s?f:c._MathHelper.approxFloor(t)}function sf(n){var i=u.D(n[0]),t=u.D(n[1]);return isNaN(i)||isNaN(t)?f:i===0||t===0?0:i>0&&t<0?o:i<0&&0<t?(t=-t,c._MathHelper.approxFloor(i/t)*t):c._MathHelper.approxCeiling(i/t)*t}function hf(n){var i=parseFloat(n[0]),t=parseFloat(n[1]),e,r;if(isNaN(i)||isNaN(t))return f;if(i<0||t<0||i<t)return o;for(e=1,t=vt(i-t,t),r=1;r<=t;r++)e*=i-r+1,e/=r;return u.toResult(e)}function cf(n){var t;return isNaN(t=parseFloat(n[0]))?f:180*t/yt}function lf(n){var t=parseFloat(n[0]);return t<0?(t=nt(t),t%2!=0&&(t-=1)):(t=dt(t),t%2!=0&&(t+=1)),t}function af(n){var t=parseInt(n[0],10),r=1,i;if(isNaN(t))return f;if(t<0||170<t)return o;for(i=1;i<=t;i++)r*=i;return r}function vf(n){var t=parseInt(n[0],10),r=1,i;if(isNaN(t))return f;if(t<0||300<t)return o;for(i=t;i>1;i-=2)r*=i;return r}function yf(n){var t=parseFloat(n[0]);return t===h||t===s?f:t<=0?o:u.toResult(k(t))}function pf(n){var i=parseFloat(n[0]),t=parseFloat(n[1]);return t===0?"#DIV/0!":i-t*nt(i/t)}function wf(n){var t=parseFloat(n[0]);return t<0?(t=nt(t),t%2==0&&(t-=1)):(t=dt(t),t%2==0&&(t+=1)),t}function bf(n){return yt}function kf(n){var t=parseFloat(n[0]),i=parseFloat(n[1]);return et(t,i)}function df(n,i){var f,r;return u.err(n)?(i.value=n,!1):u.ref(n)||u.arr(n)||t.GC$.isArray(n)?ri(n,df,i):(f={value:0},u.rD(n,f)&&(r=f.value,!isNaN(r)&&isFinite(r)&&(i.value+=r)),!0)}function gf(n){var o,s,h,c,e,i,r,f;if(!n||n.length<1)throw t.SR.Exp_InvalidArgument;for(o=0,e=0;e<n.length;e++){if(i=n[e],u.err(i))return i;else if(u.ref(i)||u.arr(i)){if(r=u.toArr(i,1,!0,!0,!1),r.isError)return r[0]}else r=u.toArr(i,1,!0,!0,!0);for(s=r.length,f=0;f<s;f++)r[f]!==u.CalcConvertedError&&(o+=r[f])}return o}function ne(n){var t=parseFloat(n[0]);return t>0?1:t===0?0:-1}function bi(n,t){while(t!==0){var i=n%t;n=t;t=i}return n}function te(n){for(var t,i,r,e=0,s=0;s<n.length;s++){if(t=u.toArr(n[s],1,!0,!0,!1),t.isError)return t[0];if(t.isConvertError)return f;for(i=0;i<t.length;i++)if(r=t[i],r!==u.CalcConvertedError){if(r<0)return o;e=bi(e,u.I(r))}}return e}function ie(n){for(var t,e,i,s,l,r=1,h=[],c=0;c<n.length;c++){if(t=u.toArr(n[c],1,!0,!0,!1),t.isError)return t[0];if(t.isConvertError)return f;for(e=0;e<t.length;e++)if(i=t[e],i!==u.CalcConvertedError){if(i<0)return o;else if(i===0)return 0;h.push(u.I(i))}for(s=0;s<h.length;s++)l=h[s],r/=bi(r,l),r*=l}return r}function ki(n,t,i){for(var r,f,h,y,p,o,c,s,l,a=1,v=0,e=0;e<n.length;e++)for(r=u.toArr(n[e],1,!1,!1,!1,!0),f=0;f<r.rangeCount;f++)for(h=r.rangeCount>1?r[f]:r,r.isReference&&(y=n[e].getRow(f),p=n[e].getColumn(f)),o=0;o<h.length;o++)if(t||!r.isReference||!n[e].isHiddenRow(f,o,i))for(c=h[o],s=0;s<c.length;s++)!t&&r.isReference&&n[e].isSubtotal(f,o+y,s+p)||(l=c[s],l!==u.CalcConvertedError&&(a*=u.D(l),v++));return u.toResult(v>0?a:0)}function re(n){return ki(n,!0,!0)}function ue(n){var t=parseFloat(n[0]);return t>=0?rt(t):o}function fe(n){if(u.err(n[0]))return n[0];if(u.err(n[1]))return n[1];var i=u.D(n[0]),t=u.D(n[1]);return isNaN(i)||isNaN(t)?f:t===0?w:parseInt((i/t).toString(),10)}function ee(n){for(var s,e,t=u.I(n[0]),r=[],o=1;o<n.length;o++)r[o-1]=n[o];if(s=i.Functions,e=s._StatHelper,t===1||t===101)return e.__averageIncludeSubtotals(r,!1,t===1);else if(t===2||t===102)return e.__countIncludeSubtotals(r,!1,t===2);else if(t===3||t===103)return e.__countaIncludeSubtotals(r,!1,t===3);else if(t===4||t===104)return e.__maxIncludeSubtotals(r,!1,t===4);else if(t===5||t===105)return e.__minIncludeSubtotals(r,!1,t===5);else if(t===6||t===106)return ki(r,!1,t===6);else if(t===7||t===107)return e.__stdevIncludeSubtotals(r,!1,t===7);else if(t===8||t===108)return e.__stdevpIncludeSubtotals(r,!1,t===8);else if(t===9||t===109)return e.__sumIncludeSubtotals(r,!1,t===9);else if(t===10||t===110)return e.__varrIncludeSubtotals(r,!1,t===10);else if(t===11||t===111)return e.__varpIncludeSubtotals(r,!1,t===11);return f}function oe(n){var i=u.D(n[0]),t=u.D(n[1]),r;return isNaN(i)||isNaN(t)?f:i===0||t===0?0:i>0&&t<0?o:(r=c._MathHelper,i<0&&0<t)?(t=-t,r.approxCeiling(i/t)*t):r.approxFloor(i/t)*t}function se(n){var i=u.D(n[0]),t=u.D(n[1]);return isNaN(i)||isNaN(t)?f:i===0||t===0?0:i<0&&0<t||t<0&&0<i?o:c._MathHelper.approxFloor(i/t+.5)*t}function si(n){var t=u.D(n[0]);if(isNaN(t))return f;var r=u.I(n[1]),e=c._MathHelper,i=e.pow10(l(r));return r<0?t/=i:t*=i,t=t<0?e.approxCeiling(t-.5):e.approxFloor(t+.5),r<0?t*=i:t/=i,u.toResult(t)}function he(n){var t=u.D(n[0]);if(isNaN(t))return f;var r=u.I(n[1]),e=c._MathHelper,i=e.pow10(l(r));return r<0?t/=i:t*=i,t=t<0?e.approxCeiling(t):e.approxFloor(t),r<0?t*=i:t/=i,u.toResult(t)}function ce(n){var t=u.D(n[0]);if(isNaN(t))return f;var r=u.I(n[1]),e=c._MathHelper,i=e.pow10(l(r));return r<0?t/=i:t*=i,t=t<0?e.approxFloor(t):e.approxCeiling(t),r<0?t*=i:t/=i,u.toResult(t)}function le(n){var t=u.D(n[0]);if(isNaN(t))return f;var e=i._Helper._argumentExists(n,1)?u.I(n[1]):0,o=c._MathHelper,r=o.pow10(l(e));return e<0?t/=r:t*=r,t=t<0?o.approxCeiling(t):o.approxFloor(t),e<0?t*=r:t/=r,u.toResult(t)}function ae(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult(v(t))}function di(n){var r=u.D(n[0]),t;if(i._Helper._argumentExists(n,1)){if(t=u.D(n[1]),isNaN(t))return f}else t=1;return r==0||t==0?0:c._MathHelper.approxCeiling(r/l(t))*l(t)}function ve(n){var r=u.D(n[0]),t=i._Helper._argumentExists(n,1)?u.D(n[1]):1;return r==0||t==0?0:c._MathHelper.approxFloor(r/l(t))*l(t)}function ye(n){var r=u.D(n[0]),t;if(isNaN(r))return f;if(i._Helper._argumentExists(n,1)){if(t=u.D(n[1]),isNaN(t))return f}else t=10;return r<=0||t<=0?o:t===1?w:u.toResult(lt.log(r,t))}function pe(n){var t=u.D(n[0]);return isNaN(t)?f:t<=0?o:u.toResult(lt.log10(t))}function kt(n,t,i){var l=0,d,g,r,o,e,nt,tt;if(n===h||n===s)return l;var w=c._MathHelper.parseCriteria(n),a=u.arr(t),v=u.arr(i),b=t,y=t,k=i,p=i,it=a?1:y.getRangeCount();if(it!=(v?1:p.getRangeCount())||(d=a?b.getRowCount():y.getRowCount(0),d>(v?k.getRowCount():p.getRowCount(0)))||(g=a?b.getColumnCount():y.getColumnCount(0),g>(v?k.getColumnCount():p.getColumnCount(0))))return f;if(r=t.toArray(0,!0,!0),r.isError)return r[0];if(o=i.toArray(1,!0,!0),o.isError)return o[0];for(e=0;e<r.length;e++)nt=r[e],w&&w(nt)&&(tt=o[e],l+=tt);return u.toResult(l)}function we(n){var v=n[0],y=n[1],o,r,c,f,e,p,l,a;if(y===h||y===s)throw t.SR.Exp_CriteriaIsNull;if(o=i._Helper._argumentExists(n,2)?n[2]:n[0],r=n[1],u.ref(r))return(c=r.getRowCount(0),f=r.getColumnCount(0),c===1&&f===1)?kt(r.getValue(0,0,0),v,o):new i._TernaryCompositeConcreteReference(r.getSource(),r.getRow(0),r.getColumn(0),c,f,kt,v,o);if(e=n[1],u.arr(e)){for(c=e.getRowCount(),f=e.getColumnCount(),p=new i._ConcreteArray(e,f),l=0;l<c;l++)for(a=0;a<f;a++)p._array[l][a]=kt(e.getValue(l,a),v,o);return p}return kt(y,v,o)}function be(n){var a=0,i=u.toArr(n[0],1,!0,!0,!1),r,y,o,p,e,s,t,l;if(i.isError)return i[0];var w=i.length,b=i.rowCount,k=i.colCount,h=[],v=[];for(t=1;t<n.length;t=t+2){if(r=u.toArr(n[t],0,!0,!1,!1),r.rowCount!==b||r.colCount!==k)return f;y=n[t+1];o=c._MathHelper.parseCriteria(y);h.push(r);v.push(o)}for(p=h.length,e=0;e<w;e++){for(s=!0,t=0;t<p;t++){var r=h[t],o=v[t],d=r[e];if(s=o&&o(d),!s)break}s&&(l=i[e],l!==u.CalcConvertedError&&(a+=l))}return u.toResult(a)}function ke(n){for(var t,r,e,o,s=0,v=u,h=[],c,l,a,i=0;i<n.length;i++){if(t=u.toArr(n[i],1,!0,!0,!1),t.isError)return t[0];if(t.isConvertError)return f;if(i==0)c=t.rowCount,l=t.colCount,a=t.length;else if(t.rowCount!==c||t.colCount!==l)return f;h.push(t)}for(i=0;i<a;i++){for(r=1,e=0;e<n.length;e++)if(o=h[e][i],o!==u.CalcConvertedError)r*=o;else{r=0;break}s+=r}return u.toResult(s)}function de(n){for(var t,r,i,o=0,e=0;e<n.length;e++){if(t=u.toArr(n[e],1,!0,!0,!1),t.isError)return t[0];if(t.isConvertError)return f;for(r=0;r<t.length;r++)i=t[r],i!==u.CalcConvertedError&&(o+=i*i)}return u.toResult(o)}function ge(n){var s=0,e,o,t=u.toArr(n[0],1,!0,!0,!1),i,r;if(t.isError)return t[0];if(t.isConvertError)return f;if(i=u.toArr(n[1],1,!0,!0,!1),i.isError)return i[0];if(i.isConvertError)return f;if(t.length!==i.length)return a;for(r=0;r<t.length;r++)e=t[r],o=i[r],e!==u.CalcConvertedError&&o!==u.CalcConvertedError&&(s+=e*e-o*o);return u.toResult(s)}function no(n){var s=0,e,o,t=u.toArr(n[0],1,!0,!0,!1),i,r;if(t.isError)return t[0];if(t.isConvertError)return f;if(i=u.toArr(n[1],1,!0,!0,!1),i.isError)return i[0];if(i.isConvertError)return f;if(t.length!==i.length)return a;for(r=0;r<t.length;r++)e=t[r],o=i[r],e!==u.CalcConvertedError&&o!==u.CalcConvertedError&&(s+=e*e+o*o);return u.toResult(s)}function to(n){var s=0,e,o,t=u.toArr(n[0],1,!0,!0,!1),i,r;if(t.isError)return t[0];if(t.isConvertError)return f;if(i=u.toArr(n[1],1,!0,!0,!1),i.isError)return i[0];if(i.isConvertError)return f;if(t.length!==i.length)return a;for(r=0;r<t.length;r++)e=t[r],o=i[r],e!==u.CalcConvertedError&&o!==u.CalcConvertedError&&(s+=(e-o)*(e-o));return u.toResult(s)}function io(n){var e,o,s,t,r,i,h;if(isNaN(e=u.D(n[0]))||isNaN(s=u.I(n[1]))||isNaN(o=u.I(n[2])))return f;if(t=u.toArr(n[3],1,!0,!0,!0),t.isError)return t[0];if(t.isConvertError)return f;for(r=0,i=0;i<t.length;i++){if(isNaN(h=u.D(t[i])))return f;r+=h*et(e,s+i*o)}return u.toResult(r)}function ro(n){var t;return isNaN(t=u.D(n[0]))?f:t<0?o:u.toResult(rt(t*yt))}function uo(n){var t;return isNaN(t=u.D(n[0]))?f:yt*t/180}function fo(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult(ar(t))}function eo(n){var t;return isNaN(t=u.D(n[0]))?f:t<-1||1<t?o:u.toResult(vr(t))}function oo(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult((v(t)+v(-t))/2)}function so(n){var t;return isNaN(t=u.D(n[0]))?f:t<1?o:u.toResult(k(t+rt(t*t-1)))}function ho(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult(cr(t))}function co(n){var t;return isNaN(t=u.D(n[0]))?f:t<-1||1<t?o:u.toResult(lr(t))}function lo(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult((v(t)-v(-t))/2)}function ao(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult(k(t+rt(t*t+1)))}function vo(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult(yr(t))}function yo(n){var t;return isNaN(t=u.D(n[0]))?f:u.toResult(pr(t))}function po(n){var t,i;return isNaN(t=u.D(n[0]))||isNaN(i=u.D(n[1]))?f:t===0&&i===0?w:u.toResult(wr(i,t))}function wo(n){var t,i,r;return isNaN(t=u.D(n[0]))?f:(i=v(t),r=v(-t),u.toResult(i-r)/(i+r))}function bo(n){var t;return isNaN(t=u.D(n[0]))?f:t<=-1||1<=t?o:u.toResult(k((1+t)/(1-t))/2)}function ko(n){var p=u,w=u.CalcConvertedError,t=u.toArr(n[0],1,!1,!0,!0),r,l,i,a,o,e,v,s,y,h,c;if(t.isError)return t[0];if(t.rangeCount>1||t.rowCount!==t.colCount)return f;for(r=t.rowCount,l=1,i=0;i<r-1;i++){if(t[i][i]===0){for(a=!1,o=i+1;!a&&o<r;o++)if(t[o][i]!==0){for(e=i;e<r;e++)v=t[i][e],t[i][e]=t[o][e],t[o][e]=v;l*=-1;a=!0}if(!a)return 0}for(s=i+1;s<r;s++)if(t[s][i]!==0)for(y=t[s][i]/t[i][i],h=i;h<r;h++)t[s][h]-=y*t[i][h]}for(c=0;c<r;c++)l*=t[c][c];return l}function go(n){var rt=u,ut=u.CalcConvertedError,r=u.toArr(n[0],1,!1,!0,!0),e,s,v,p,t,k,h,l,nt,a,tt,c,g,w,b,y,it,d;if(r.isError)return r[0];if(r.rangeCount>1||r.rowCount!==r.colCount)return f;for(e=r.rowCount,s=[],v=0;v<e;v++)for(s[v]=[e],p=0;p<e;p++)s[v][p]=v===p?1:0;for(t=0;t<e;t++){if(r[t][t]===0){for(k=!1,h=t+1;!k&&h<e;h++)if(r[h][t]!==0){for(l=t;l<e;l++)nt=r[t][l],r[t][l]=r[h][l],r[h][l]=nt;for(a=1;a<e;a++)tt=s[t][a],s[t][a]=s[h][a],s[h][a]=tt;k=!0}if(!k)return o}for(c=0;c<e;c++)if(c!==t&&r[c][t]!==0){for(g=r[c][t]/r[t][t],w=t;w<e;w++)r[c][w]-=g*r[t][w];for(b=0;b<e;b++)s[c][b]-=g*s[t][b]}}for(y=0;y<e;y++)for(it=r[y][y],d=0;d<e;d++)s[y][d]/=it;return new i._ConcreteArray(s)}function ns(n){var t=u.toArr(n[0],1,!1,!0,!0),r=u.toArr(n[1],1,!1,!0,!0),h,a,v,e,o,c,s;if(t.isError||r.isError)return t.isError?t[0]:r[0];var y=t.rowCount,p=t.colCount,l=r.rowCount,w=r.colCount;if(t.isConvertError||r.isConvertError||p!==l)return f;for(h=[],e=0;e<y;e++)for(h[e]=a=[],v=t[e],o=0;o<w;o++){for(c=0,s=0;s<l;s++)c+=v[s]*r[s][o];a[o]=c}return new i._ConcreteArray(h)}function gi(n){for(var i=1,t=n;t>1;t--)i*=t;return i}function ts(n){for(var e,c,i,r=0,h=1,l=u,t,s=0;s<n.length;s++){if(t=u.toArr(n[s],0,!0,!0,!1),t.isError)return t[0];if(t.isConvertError)return f;for(e=0;e<t.length;e++){if(c=t[e],i=u.I(c),i<0||170<i)return o;r+=i;h*=gi(i)}}return r<0||170<r?o:gi(r)/h}function is(n){var t=li(),i=-1+t*2;return l(i)}function rs(n){var t,i,r;return u.err(n[1])?n[1]:u.err(n[0])?n[0]:isNaN(t=u.I(n[0]))||isNaN(i=u.I(n[1]))?f:i<t?o:(r=li(),u.I(t+r*(i-t+1)))}function us(){var n=[];return n.push(new g("M",1e3)),n.push(new g("D",500)),n.push(new g("C",100)),n.push(new g("L",50)),n.push(new g("X",10)),n.push(new g("V",5)),n.push(new g("I",1)),n}function fs(n){var w=u,p=i._Helper,e,s,o,t,r,h,l,v,c,a,y;if(u.err(n[0]))return n[0];if(e=u.I(n[0]),s=0,p._argumentExists(n,1)){if(u.err(n[1]))return n[1];s=typeof n[1]=="boolean"?n[1]?0:4:u.I(n[1])}if(o=[],e<0||3999<e||s<0||4<s)return f;for(t=us(),r=0;r<t.length;r+=2){if(2<=r&&t[r-2].Value-t[r].Value<=e){for(h=r,l=r-2,v=0;v<s&&h+1<t.length&&t[l].Value-t[h+1].Value<=e;v++)h++;o.push(t[h].Key);o.push(t[l].Key);e+=t[h].Value;e-=t[l].Value}if(1<=r&&t[r-1].Value<=e&&(o.push(t[r-1].Key),e-=t[r-1].Value),1<=r&&t[r-1].Value-t[r].Value<=e){for(c=r,a=r-1,y=0;y<s&&c+1<t.length&&t[a].Value-t[c+1].Value<=e;y++)c++;o.push(t[c].Key);o.push(t[a].Key);e+=t[c].Value;e-=t[a].Value}while(t[r].Value<=e)o.push(t[r].Key),e-=t[r].Value}return o.join("")}function es(n){for(var t,r,i=0;i<n.length;i++){if(t=u.toArr(n[i],3,!0,!0,!1),t.isError)return t[0];else if(t.isConvertError)return f;for(r=0;r<t.length;r++)if(!t[r])return!1}return!0}function os(n){for(var t,i,r=0;r<n.length;r++){if(t=u.toArr(n[r],3,!0,!0,!1),t.isError)return t[0];else if(t.isConvertError)return f;for(i=0;i<t.length;i++)if(t[i]&&t[i]!==u.CalcConvertedError)return!0}return!1}function nr(n){try{var t=u.B(n);return!t}catch(i){return f}}function ss(n){var t,r,o,s;if(u.ref(n[0]))return n[0].getRangeCount()>1?f:new i._UnaryCompositeConcreteReference(n[0].getSource(),n[0].getRow(0),n[0].getColumn(0),n[0].getRowCount(0),n[0].getColumnCount(0),nr);if(u.arr(n[0])){var e=[],c=n[0].getRowCount(),h=n[0].getColumnCount();for(t=0;t<c;t++)for(e[t]=[h],r=0;r<h;r++)o=n[0].getValue(t,r),s=typeof o,e[t][r]=s===pt||s===br?!o:f;return new i._ConcreteArray(e)}return nr(n[0])}function tr(n,t,i){try{var r=u.B(n);return r?t:i}catch(e){return f}}function hs(n){var f=n[0],o=n[1],e=i._Helper,s=e._argumentExists(n,2)?n[2]:n.length===2?!1:0,t=e.tryExtractToSingleValue(f),c,r,u;if(t.success)return f=t.value,tr(f,o,s);t=e.tryExtractToSingleValue(o);o=t.value;c=t.success;t=e.tryExtractToSingleValue(s);s=t.value;var a=t.success,v=f.getRowCount(),l=f.getColumnCount(),h=[];for(r=0;r<v;r++)for(h[r]=[l],u=0;u<l;u++)h[r][u]=tr(f.getValue(r,u),c?o:e.getArrayValue(o,r,u),a?s:e.getArrayValue(s,r,u));return new i._ConcreteArray(h)}function cs(n,t){return u.err(n)?t!==h&&t!==s?t:0:n!==h&&n!==s?n:0}function ls(n){var r=u.err(n[0]),t;return!r&&u.ref(n[0])?(t=n[0],t.getRangeCount()>1)?f:new i._BinaryCompositeConcreteReference(t.getSource(),t.getRow(0),t.getColumn(0),t.getRowCount(0),t.getColumnCount(0),cs,n[1]):r?n[1]!==h&&n[1]!==s?n[1]:0:n[0]!==h&&n[0]!==s?n[0]:0}function as(n){return!0}function vs(n){return!1}function ys(n){var t,r,e,i;try{return isNaN(t=u.I(n[0]))||isNaN(r=u.I(n[1]))||isNaN(e=u.I(n[2]))?f:t<0||9999<t?o:(t<=1899&&(t+=1900),i=new Date(t,r-1,e),i<new Date(1899,11,30))?o:i}catch(s){return o}}function ps(t){var r,e,s,i;try{return isNaN(r=u.I(t[0]))||isNaN(e=u.I(t[1]))||isNaN(s=u.I(t[2]))?f:(i=n.Sheets._DateTimeHelper.fromOADate(0),i.setHours(r),i.setMinutes(e),i.setSeconds(s),i.setMilliseconds(0),i.getHours()<0&&i.getMinutes()<0&&i.getSeconds()<0)?o:i}catch(h){return o}}function ft(n){return n%400==0||n%4==0&&n%100!=0||n===1900}function ws(t){var r,i,o,c,l;try{if((r=u.S(t[0]),r===h||r===s||r==="")||(i=n.Sheets._DateTimeHelper.parseLocale(r),i||(i=new Date(r),(!i||isNaN(i.valueOf()))&&(i=null)),!i)||(o=i.getFullYear(),o<1900))return f;var a=i.getMonth(),v=i.getDate(),e=0;for(c=1900;c<o;c++)e+=ft(c)?366:365;for(l=0;l<a;l++)switch(l){case 0:case 2:case 4:case 6:case 7:case 9:case 11:e+=31;break;case 1:e+=ft(o)?29:28;break;case 3:case 5:case 8:case 10:e+=30;break}return e+v}catch(y){return f}}function bs(t){try{return n.Sheets._DateTimeHelper.parseLocale(t)}catch(i){return f}}function ir(n){var t=u.S(n[0]);if(t===h||t===s||t==="")return f;try{var i=bs(t),r=(i.getHours()*60+i.getMinutes())*60+i.getSeconds(),e=86400;return r/e}catch(o){return f}}function ks(n){return new Date}function ds(n){var t=new Date;return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t}function gs(n){try{var t=u.DT(n[0]);return t.getHours()}catch(i){return f}}function nh(n){try{var t=u.DT(n[0]);return t.getMinutes()}catch(i){return f}}function th(n){try{var t=u.DT(n[0]);return t.getSeconds()}catch(i){return f}}function ih(n){try{var t=u.DT(n[0]);return t.getDate()}catch(i){return f}}function rh(n){try{var t=u.DT(n[0]);return t.getMonth()+1}catch(i){return f}}function uh(n){try{var t=u.DT(n[0]);return t.getFullYear()}catch(i){return f}}function fh(n){for(var r=n.getFullYear(),u=n.getMonth(),f=n.getDate(),t=0,i=0;i<u;i++)switch(i){case 0:case 2:case 4:case 6:case 7:case 9:case 11:t+=31;break;case 1:t+=ft(r)?29:28;break;case 3:case 5:case 8:case 10:t+=30;break}return t+f}function eh(n,t){var f=fh(n),r=new Date(n.getFullYear(),0,1).getDay(),i;return t===2&&(r-=1,r<0&&(r=6)),i=f-1-(6-r),i<0&&(i=0),1+u.I(i/7)+(i%7!=0?1:0)}function oh(n){var r,t,s;try{r=u.DT(n[0])}catch(e){return f}if(isNaN(t=u.I(i._Helper._argumentExists(n,1)?n[1]:1)))return f;switch(t){case 1:case 2:return eh(r,t);default:return o}}function b(n){var t,e,r;try{t=u.DT(n[0])}catch(s){return f}if(isNaN(e=u.I(i._Helper._argumentExists(n,1)?n[1]:1)))return f;switch(e){case 1:r=t.getDay()+1;break;case 2:r=t.getDay()===0?7:t.getDay();break;case 3:r=t.getDay()===0?6:t.getDay()-1;break;default:return o}return r}function sh(n){var t,i;try{t=u.DT(n[0])}catch(r){return f}return isNaN(i=u.I(n[1]))?f:(t.setMonth(t.getMonth()+i),t)}function hh(n,t){switch(t){case 0:case 2:case 4:case 6:case 7:case 9:case 11:return 31;case 1:return ft(n)?29:28;case 3:case 5:case 8:case 10:return 30}}function ch(n){var t,i,r;try{t=u.DT(n[0])}catch(e){return f}return isNaN(i=u.I(n[1]))?f:(t.setMonth(t.getMonth()+i),r=hh(t.getFullYear(),t.getMonth()),t.setDate(r),t)}function rr(n,t){return n-t}function oa(n,t){for(var r,u=n.length,i=0;i<u;i++)if(r=n[i],rr(r,t)===0)return!0;return!1}function lh(r){var y=u,v=i._Helper,s=u.DT(r[0]),h=u.I(r[1]),c=[],l,a,e;if(v._argumentExists(r,2)){if(c=u.toArr(r[2],4,!0,!0,!0),c.isError)return c[0];if(c.isConvertError)return f}if(l=[],l[0]=s,l[1]=3,a=b(l),u.err(a))return a;for(e=u.I(a);h<0;++h){try{s.setDate(s.getDate()-1)}catch(p){return o}e===0?e=6:e--;e===5||e===6?h--:c.indexOf(t._DateTimeHelper.___toOADate(s))>=0&&h--}for(;h>0;--h){try{s.setDate(s.getDate()+1)}catch(w){return o}e===6?e=0:e++;e===5||e===6?h++:c.indexOf(t._DateTimeHelper.___toOADate(s))>=0&&h++}return new n.Sheets._DateTimeHelper(s).toOADate()}function ah(n){var w=u,v=i._Helper,e=u.DT(n[0]),s=u.I(n[1]),p=v._argumentExists(n,2)?n[2]:"0000011",c=hi(p),y,h,l,a,r;if(u.err(c))return c;if(y=c.join(""),y==="1111111")return f;if(h=[],v._argumentExists(n,3)){if(h=u.toArr(n[3],4,!0,!0,!0),h.isError)return h[0];if(h.isConvertError)return f}if(l=[],l[0]=e,l[1]=3,a=b(l),u.err(a))return a;for(r=u.I(a);s<0;++s){try{e.setDate(e.getDate()-1)}catch(k){return o}r===0?r=6:r--;c[r]?s--:h.indexOf(t._DateTimeHelper.___toOADate(e))>=0&&s--}for(;s>0;--s){try{e.setDate(e.getDate()+1)}catch(d){return o}r===6?r=0:r++;c[r]?s++:h.indexOf(t._DateTimeHelper.___toOADate(e))>=0&&s++}return t._DateTimeHelper.___toOADate(e)}function ur(n){var v=u,h=i._Helper,e=u.DT(n[0]),o=u.DT(n[1]),c=h._argumentExists(n,2)?u.B(n[2]):!1,t=e.getDate(),r=o.getDate(),l=e.getMonth(),f=o.getMonth(),a=e.getFullYear(),s=o.getFullYear();return c?(r=r===31?30:r,t=t===31?30:t):(t=t===31?30:t,r===31&&(t<30?(r=1,f++,f>12&&(f=1,s++)):r=30)),((s-a)*12+(f-l))*30+(r-t)}function vh(n,t){return t&&t.length&&t.length>0?t[b([n,3])]:n.getDay()===6||n.getDay()===0}function fr(n,r,f,e,o){var b=u,v=i._Helper,s,c,y,p,l,a,h,w;if(o){if(y=v._argumentExists(n,2)?n[2]:"0000011",c=hi(y),u.err(c))return c;v._argumentExists(n,3)&&(s=u.toArr(n[3],4,!0,!0,!1))}else v._argumentExists(n,2)&&(s=u.toArr(n[2],4,!0,!0,!1));if(!s)return e;if(s.isError)return s[0];for(p=s.length,l=[],a=0;a<p;a++)h=s[a],w=t._DateTimeHelper._fromOADate(h),l.indexOf(h)===-1&&!vh(w,c)&&h>=r&&h<=f&&l.push(h);return e-l.length}function yh(t,i,r){var c=u,o=n.Sheets._DateTimeHelper,f=u.I(new o(i).toOADate()-new o(t).toOADate())%7,s=u.I(b([t,2])+f),e,h;return f=s>5?s-5:0,e=t.getDay()===0?1:2,f=f>e?e:f,r-=f,h=nt(r/7)*2,r-h}function ph(t){var a=u,s=n.Sheets._DateTimeHelper,e=u.DT(t[0]),o=u.DT(t[1]),r=u.I(new s(e).toOADate()),f=u.I(new s(o).toOADate()),h=!1,c,l,i;return(r>f&&(c=e,l=r,r=f,f=l,e=o,o=c,h=!0),i=f-r+1,i=yh(e,o,i),i<=0)?0:(i=fr(t,r,f,i),h?-i:i)}function wh(t){var a=u,s=n.Sheets._DateTimeHelper,e=u.DT(t[0]),o=u.DT(t[1]),r=u.I(new s(e).toOADate()),f=u.I(new s(o).toOADate()),h=!1,c,l,i;return(r>f&&(c=e,l=r,r=f,f=l,e=o,o=c,h=!0),i=f-r+1,i=bh(t,e,o,i),u.err(i))?i:i<=0?0:(i=fr(t,r,f,i,!0),h?-i:i)}function bh(n,t,r,f){var k=u,p=i._Helper,w=p._argumentExists(n,2)?n[2]:"0000011",o=hi(w),l,c,s,y;if(u.err(o))return o;for(l=0,c=0;c<o.length;c++)o[c]===1&&l++;if(s=0,f<30){for(e=0;e<f;e++)o[(u.I(b([t,3]))+e)%7]&&s++;return f-s}else{for(var h=f,a=0,v=0,e=0;e<h;e++){if(u.I(b([t,3])+e)%7==0)break;a++}for(e=0;e<a;e++)o[(u.I(b([t,3]))+e)%7]&&s++;for(e=0;e<h;e++){if((u.I(b([r,3]))+7-e)%7==6)break;v++}for(e=0;e<v;e++)o[(u.I(b([r,3]))+7-e)%7]&&s++;return h=h-a-v,y=u.I(h/7)*l,f-=y,f-s}}function hi(n){var t,r,i;if(typeof n===ut){if(n.length!==7||isNaN(parseInt(n)))return f}else if(!isNaN(n)){if(nt(n)<1||nt(n)>17)return o;n=n.toString()}t=[0,0,0,0,0,0,0];r=n.length;switch(r){case 1:switch(n){case"1":t[5]=1;t[6]=1;break;case"2":t[6]=1;t[0]=1;break;case"3":t[0]=1;t[1]=1;break;case"4":t[1]=1;t[2]=1;break;case"5":t[2]=1;t[3]=1;break;case"6":t[3]=1;t[4]=1;break;case"7":t[4]=1;t[5]=1;break;default:return o}break;case 2:if(n[0]==="1")switch(n[1]){case"1":t[6]=1;break;case"2":t[0]=1;break;case"3":t[1]=1;break;case"4":t[2]=1;break;case"5":t[3]=1;break;case"6":t[4]=1;break;case"7":t[5]=1;break;default:return o}else return o;break;case 7:for(i=0;i<7;i++)t[i]=parseInt(n[i]);break;default:return f}return t}function kh(t,r,f){var k=i.Functions,y=k._FinancialHelper,h=y.__days_between_basis(t,r,f),c,p,o,s,e,w,l,a,v,b;return h<0&&(h=-h,p=t,t=r,r=p),f===1?(o=t.getFullYear(),s=r.getFullYear(),e=t,e.setFullYear(e.getFullYear()+1),rr(r,e)>0?(a=s+1-o,e=new Date(o,0,1),w=new Date(s+1,0,1),v=n.Sheets._DateTimeHelper,l=u.I(new v(w).toOADate()-new v(e).toOADate())-365*(s+1-o)):(a=1,l=ft(o)&&t.getMonth()<3||ft(s)&&r.getMonth()*256+r.getDate()>=541?1:0),b=u.D(l)/u.D(a),c=365+b):c=y.__annual_year_basis(new Date,f),h/c}function er(n){var s=u,r=i._Helper,f=u.DT(n[0]),e=u.DT(n[1]),t=r._argumentExists(n,2)?u.I(n[2]):0;return t<0||t>4?o:kh(f,e,t)}function dh(){var n=[];return n[0]=function(n,t){return t.getFullYear()-n.getFullYear()+(t.getMonth()<n.getMonth()||t.getMonth()===n.getMonth()&&t.getDate()<n.getDate()?-1:0)},n[1]=function(n,t){return 12*(t.getFullYear()-n.getFullYear())+(t.getMonth()-n.getMonth())+(t.getDate()<n.getDate()?-1:0)},n[2]=function(n,t){return(t.getTime()-n.getTime())/864e5},n[3]=function(n,t){var i=new Date(t.getFullYear(),t.getMonth()+(t.getDate()<n.getDate()?-1:0),n.getDate());return(t.getTime()-i.getTime())/864e5},n[4]=function(n,t){return t.getMonth()-n.getMonth()+(t.getMonth()<n.getMonth()||t.getMonth()===n.getMonth()&&t.getDate()<n.getDate()?12:0)+(t.getDate()<n.getDate()?-1:0)},n[5]=function(n,t){var i=new Date(t.getFullYear()+(t.getMonth()<n.getMonth()||t.getMonth()===n.getMonth()&&t.getDate()<n.getDate()?-1:0),n.getMonth(),n.getDate());return(t-i)/864e5},n}function gh(n,i){var r;switch(i){case"Y":r=0;break;case"M":r=1;break;case"D":r=2;break;case"MD":r=3;break;case"YM":r=4;break;case"YD":r=5;break;default:throw t.SR.Exp_NotSupport;}return n[r]}function nc(n){var i=u.DT(n[0]),r=u.DT(n[1]),s=u.S(n[2]).toLocaleUpperCase(),e,t;if(r<i)return o;if(e=dh(),t=gh(e,s),t)try{return t(i,r)}catch(h){return f}return o}function tc(n){return 0<=n&&n<=31||127===n||128<=n&&n<=159}function ic(n){for(var i=u.S(n[0]),r=[],t=0;t<i.length;t++)tc(i.charCodeAt(t))||r.push(i[t]);return r.join("")}function or(n){return n===" "||n==="\t"||n==="\n"}function rc(n){for(var t,r=u.S(n[0]).trim(),f=[],e=!0,i=0;i<r.length;i++)t=r.charAt(i),(!or(t)||e)&&f.push(t),e=!or(t);return f.join("")}function sr(n){var i=n.toString(),e="",u,t,r;if(n<0&&(i=i.substr(1),e="-"),u=i.split("."),u.length<1||u.length>2)return f;for(t=[],u.length===2&&(t.push(u[1]),t.push(".")),i=u[0],r=i.length-3;r>=0;r=r-3)t.push(i.substr(r,3)),r>0&&t.push(",");return t.push(i.substring(0,r+3)),t.reverse(),e+t.join("")}function uc(n){var i=sr(n),t;return n<0&&(i=i.substr(1)),t=[],t.push("$"),t.push(i),n<0&&(t.push(")"),t.unshift("(")),t.join("")}function fc(n){var t,o=u,e=i._Helper,r;return isNaN(t=u.D(n[0]))?f:(r=e._argumentExists(n,1)?u.I(n[1]):2,r>99)?f:(t=u.D(si([t,r])),uc(t))}function ec(n){var t,c=u,s=i._Helper;if(isNaN(t=u.D(n[0])))return f;var e=s._argumentExists(n,1)?u.I(n[1]):2,h=s._argumentExists(n,2)?u.B(n[2]):!1,r=[],o=0;return e<0?(o=u.I(et(10,l(e))),t/=o,r[0]=t,r[1]=0):(r[0]=t,r[1]=e),t=u.D(si(r)),e<0&&(t*=o),h?t.toString():sr(t)}function oc(n){var i,r,u,f;if(t.StringUtil.startsWith(n,"[$-"))return n;if(n.indexOf("[")!==-1&&n.indexOf("]")!==-1)for(i=n.indexOf("["),r=n.indexOf("]",i);i!==-1&&r!==-1;)u=n.substring(0,i),f=n.substring(r+1),n=u.concat(f),i=n.indexOf("["),r=i===-1?-1:n.indexOf("]",i);return n}function sc(n){var r=n[0],o=u,c=t._StandardDateTimeFormatter,l=t._StandardNumberFormatter,i=u.S(n[1]),e;if(i===""||i===s||i===h)return u.S(r);(r===s||r===h)&&(r=0);i=oc(i);try{return e=new t.GeneralFormatter(i),e.Format(r)}catch(a){return f}}function hc(t){var l=u,e=n.Sheets._DateTimeHelper,o=u.S(t[0]),i=e.parseLocale(o),r,c;return i!==h&&i!==s?(r=new e(i).toOADate(),l.err(r)?ir([i]):r):isNaN(c=parseFloat(o))?f:c}function cc(n){var t=u.S(n[0]);return t.toLowerCase()}function lc(n){var t=u.S(n[0]);return t.toUpperCase()}function ac(n){var r=u.S(n[0]),o=r.length,f=[],e,s,t;if(o>0)for(e=r.toUpperCase(),s=r.toLowerCase(),f[0]=e[0],t=1;t<o;)f[t]=i.Parser._isLetter(r[t-1])?s[t]:e[t],t++;return f.join("")}function vc(n){var t=u.I(n[0]);return t<1||255<t?f:String.fromCharCode(t)}function yc(n){var t=u.S(n[0]);if(t===""||t===h||t===s)return f;try{return t[0].charCodeAt(0)}catch(i){return f}}function pc(n){var i=u.S(n[0]),t=u.I(n[1]),r=u.I(n[2]),s=u.S(n[3]),e,o;return t<1||r<0?f:(t=vt(t,i.length+1),r=vt(r,i.length-t+1),e=i.substring(0,t-1),o=i.substr(t-1+r),e.concat(s).concat(o))}function wc(n){var e=u.S(n[0]),i=u.S(n[1]),a=u.S(n[2]),o,c,r,l,v,y;if(i===""||i===h||i===s)return e;if(n.length>3){if(c=u.I(n[3]),r=0,c<1)return f;for(l=0;l<c;l++){if(r=e.indexOf(i,r),r===-1)return e;r+=i.length}r-=i.length;v=e.substring(0,r);y=e.substr(r+i.length);o=v.concat(a).concat(y)}else o=t.StringUtil.replace(e,i,a);return o}function bc(n){for(var f,o,t,i,e=[],c=n.length,r=0;r<c;r++)for(f=u.toArr(n[r],0,!0,!1,!1),o=f.length,t=0;t<o;t++)i=f[t],i!==h&&i!==s&&e.push(u.S(i));return e.join("")}function kc(n){var o=u,e=i._Helper,t=u.S(n[0]),r=e._argumentExists(n,1)?u.I(n[1]):1;return r<0?f:r>=t.length?t:t.substr(0,r)}function dc(n){var i=u.S(n[0]),t=u.I(n[1])-1,r=u.I(n[2]);return t<0||r<0?f:t>=i.length?"":i.length<t+r?i.substr(t):i.substr(t,r)}function gc(n){var o=u,e=i._Helper,t=u.S(n[0]),r=e._argumentExists(n,1)?u.I(n[1]):1;return r<0?f:t.length<r?t:t.substr(t.length-r,r)}function nl(n){var e=u.S(n[0]),t=u.I(n[1]),i,r;if(t<0||32767<t*e.length)return f;for(i=[],r=0;r<t;r++)i.push(e);return i.join("")}function tl(n){return u.S(n[0]).length}function il(n){var h=u,o=i._Helper,s=u.S(n[0]),e=u.S(n[1]),t=o._argumentExists(n,2)?u.I(n[2]):1,r;return t<1||e.length<t?f:(r=e.indexOf(s,t-1),r===-1)?f:r+1}function rl(n){var p=u,y=i._Helper,l=u.S(n[0]),a=u.S(n[1]),o=y._argumentExists(n,2)?u.I(n[2]):1,r,c,v,e;if(o--,o<0)return f;r=-1;try{c=t.RegUtil.getWildcardCriteria(l);c?(v=t.RegUtil.getRegIgnoreCase(c),e=v.exec(a),r=e!==h&&e!==s?e.index:-1):r=a.toLowerCase().indexOf(l.toLowerCase(),o)}catch(w){}return r===-1?f:r+1}function ul(n){var t=u.S(n[0]),i=u.S(n[1]);return t===i}function fl(n){var t=n[0];return typeof t=="string"?t:""}function el(n,t){if(u.err(n))t.value=!0;else if(typeof n===ut){var r=i.CalcError._parseCore(n);t.value=r!==h&&r!==s}t.value=!1}function ol(n,t){if(u.err(n)&&n._code!==a._code)t.value=!0;else if(typeof n===ut){var r=i.CalcError._parseCore(n);t.value=r!==h&&r!==s&&r!==a}t.value=!1}function p(n){if(n===h||n===s)throw t.SR.Exp_InvalidArgument;else if(n.length<1||n.length>1)throw t.SR.Exp_InvalidArgument;}function sl(n){p(n);var t={value:!1};return u.err(n[0])?t.value=!0:ri(n[0],el,t),t.value}function hl(n){p(n);var t={value:!1};return u.err(n[0])&&n[0]._code!==a._code?t.value=!0:u.err(n[0])&&n[0]._code===a._code?t.value=!1:ri(n[0],ol,t),t.value}function cl(n){return(p(n),u.err(n[0]))?n[0]._code===a._code:!1}function ll(n){p(n);var t=n[0];if(t!==h&&t!==s&&u.err(t))switch(t._code){case kr._code:return 1;case w._code:return 2;case f._code:return 3;case dr._code:return 4;case gr._code:return 5;case o._code:return 6;case a._code:return 7;default:break}return a}function al(n){return p(n),u.num(n[0])}function vl(n){p(n);var t;return isNaN(t=u.D(n[0]))?f:c._MathHelper.approxFloor(l(t))%2==0}function yl(n){p(n);var t;return isNaN(t=u.D(n[0]))?f:c._MathHelper.approxFloor(l(t))%2!=0}function pl(n){p(n);var t=n[0];if(u.num(t))return u.D(t);else if(typeof t===pt)return t?1:0;else if(u.err(t))return t;return 0}function wl(n){return p(n),n[0]===h||n[0]===s}function bl(n){return p(n),typeof n[0]===pt}function kl(n){return p(n),typeof n[0]===ut}function dl(n){return p(n),typeof n[0]!==ut}function gl(n){return p(n),u.ref(n[0])}function na(n){p(n);var t=n[0];return typeof t===pt?4:u.num(t)?1:typeof t===ut?2:u.err(t)?16:u.arr(t)?64:f}function ta(n){return a}function ia(n){var ft=u,et=i._Helper,l=u.toArr(n[0],0,!1,!0,!1),h=[],b,ot,t,r,y,e,s,p,c,k,w,d,v,tt,o,rt,ut;for(h=et._argumentExists(n,1)?u.toArr(n[1],0,!1,!0,!1):l,b=et._argumentExists(n,2)?u.toArr(n[2],0,!1,!0,!1):h,ot=et._argumentExists(n,3)?u.B(n[3]):!0,t=0;t<l.rowCount;t++)for(r=0;r<l.colCount;r++)if(!ft.num(l[t][r]))return f;for(t=0;t<h.rowCount;t++)for(r=0;r<h.colCount;r++)if(!ft.num(h[t][r]))return f;for(t=0;t<b.rowCount;t++)for(r=0;r<b.colCount;r++)if(!ft.num(b[t][r]))return f;if(l.rowCount===h.rowCount&&l.colCount===h.colCount){p=h.rowCount*h.colCount;var g=0,nt=0,st=0,it=0,ht;for(t=0;t<h.rowCount;t++)for(r=0;r<h.colCount;r++){if(isNaN(c=u.D(h[t][r]))||isNaN(k=u.D(l[t][r])))return f;g+=c;nt+=c*c;st+=k;it+=c*k}for(ot?(s=(p*it-g*st)/(p*nt-g*g),ht=(st*nt-g*it)/(p*nt-g*g)):(s=it/nt,ht=0),w=[],t=0;t<b.rowCount;t++)for(w[t]=[],r=0;r<b.colCount;r++){if(isNaN(c=u.D(b[t][r])))return f;w[t][r]=s*c+ht}return new i._ConcreteArray(w)}else if(l.colCount===1&&l.rowCount===h.rowCount||l.rowCount===1&&l.colCount===h.colCount){if(k=[],c=[],l.colCount===1){for(p=h.rowCount,s=h.colCount,t=0;t<p;t++){if(isNaN(y=u.D(l[t][0])))return f;k[t]=y}for(t=0;t<p;t++)for(c[t]=[],r=0;r<s;r++){if(isNaN(y=u.D(h[t][r])))return f;c[t][r]=y}}else{for(p=h.colCount,s=h.rowCount,c=[],k=[],t=0;t<p;t++){if(isNaN(y=u.D(l[0][t])))return f;k[t]=y}for(t=0;t<p;t++)for(c[t]=[],r=0;r<s;r++){if(isNaN(y=u.D(h[r][t])))return f;c[t][r]=y}}for(o=[],e=0;e<s+1;e++)o[e]=[];for(rt=0;rt<s+1;rt++)for(ut=0;ut<s+2;ut++)o[rt][ut]=0;for(e=0;e<p;e++)for(o[0][s+1]=o[0][s+1]+k[e],t=0;t<s;t++)for(o[0][t+1]=o[0][t+1]+c[e][t],o[t+1][0]=o[0][t+1],o[t+1][s+1]=o[t+1][s+1]+c[e][t]*k[e],r=t;r<s;r++)o[r+1][t+1]=o[r+1][t+1]+c[e][t]*c[e][r],o[t+1][r+1]=o[r+1][t+1];if(o[0][0]=p,ot)for(t=0;t<s+1;t++){if(o[t][t]===0){for(d=!1,r=t+1;!d&&r<s+1;r++)if(o[r][t]!==0){for(e=0;e<s+2;e++)tt=o[t][e],o[t][e]=o[r][e],o[r][e]=tt;d=!0}if(!d)return a}for(v=1/o[t][t],e=0;e<s+2;e++)o[t][e]=o[t][e]*v;for(r=0;r<s+1;r++)if(r!==t)for(v=-o[r][t],e=0;e<s+2;e++)o[r][e]=o[r][e]+v*o[t][e]}else for(t=1;t<s+1;t++){if(o[t][t]===0){for(d=!1,r=t+1;!d&&r<s+1;r++)if(o[r][t]!==0){for(e=0;e<s+2;e++)tt=o[t][e],o[t][e]=o[r][e],o[r][e]=tt;d=!0}if(!d)return a}for(v=1/o[t][t],e=1;e<s+2;e++)o[t][e]=o[t][e]*v;for(r=1;r<s+1;r++)if(r!==t)for(v=-o[r][t],e=1;e<s+2;e++)o[r][e]=o[r][e]+v*o[t][e];o[0][s+1]=0}if(l.colCount===1){for(w=[],t=0;t<b.rowCount;t++){for(w[t]=[],v=o[0][s+1],r=0;r<s;r++){if(isNaN(y=u.D(b[t][r])))return f;v+=o[r+1][s+1]*y}w[t][0]=v}return new i._ConcreteArray(w)}else{for(w=[],w[0]=[],t=0;t<b.colCount;t++){for(v=o[0][s+1],r=0;r<s;r++){if(isNaN(y=u.D(b[r][t])))return f;v+=o[r+1][s+1]*y}w[0][t]=v}return new i._ConcreteArray(w)}}return a}function ra(n){var at=i.Convert,st=i._Helper,p=u.toArr(n[0],1,!1,!0,!0),l=[],it,ht,b,nt,t,f,e,d,y,w,tt,et,g,h,c,s,r,ut;for(l=st._argumentExists(n,1)?u.toArr(n[1],1,!1,!0,!0):p,it=st._argumentExists(n,2)?u.toArr(n[2],1,!1,!0,!0):l,ht=st._argumentExists(n,3)?u.B(n[3]):!0,t=0;t<p.rowCount;t++)for(f=0;f<p.colCount;f++)if(c=p[t][f],c<=0)return o;if(p.rowCount===l.rowCount&&p.colCount===l.colCount){d=l.rowCount*l.colCount;var rt=0,ft=0,ct=0,ot=0,lt;for(t=0;t<l.rowCount;t++)for(f=0;f<l.colCount;f++)y=l[t][f],w=p[t][f],w=k(w),rt+=y,ft+=y*y,ct+=w,ot+=y*w;for(ht?(e=(d*ot-rt*ct)/(d*ft-rt*rt),lt=(ct*ft-rt*ot)/(d*ft-rt*rt)):(e=ot/ft,lt=0),g=[],t=0;t<it.rowCount;t++)for(g[t]=[],f=0;f<it.colCount;f++)y=it[t][f],g[t][f]=v(e*y+lt);return new i._ConcreteArray(g)}else if(p.colCount===1&&p.rowCount===l.rowCount||p.rowCount===1&&p.colCount===l.colCount){if(w=[],y=[],p.colCount===1){for(d=l.rowCount,e=l.colCount,t=0;t<d;t++)b=p[t][0],w[t]=k(b);for(t=0;t<d;t++)for(y[t]=[],f=0;f<e;f++)b=l[t][f],y[t][f]=b}else{for(d=l.colCount,e=l.rowCount,y=[],w=[],t=0;t<d;t++)b=p[0][t],w[t]=b;for(t=0;t<d;t++)for(y[t]=[],f=0;f<e;f++)b=l[f][t],y[t][f]=b}for(r=[],tt=0;tt<e+1;tt++)for(r[tt]=[],et=0;et<e+2;et++)r[tt][et]=0;for(ut=[],tt=0;tt<e+2;tt++)ut[tt]=0;for(nt=0;nt<d;nt++)for(ut[e+1]=ut[e+1]+w[nt]*w[nt],r[0][e+1]=r[0][e+1]+w[nt],ut[0]=r[0][e+1],t=0;t<e;t++)for(r[0][t+1]=r[0][t+1]+y[nt][t],r[t+1][0]=r[0][t+1],r[t+1][e+1]=r[t+1][e+1]+y[nt][t]*w[nt],ut[t+1]=r[t+1][e+1],f=t;f<e;f++)r[f+1][t+1]=r[f+1][t+1]+y[nt][t]*y[nt][f],r[t+1][f+1]=r[f+1][t+1];if(r[0][0]=d,ht)for(h=0;h<e+1;h++){for(t=h;t<e+1&&r[t][h]===0;)t++;if(t>=e+1)return a;for(s=0;s<e+2;s++)c=r[h][s],r[h][s]=r[t][s],r[t][s]=c;for(c=1/r[h][h],s=0;s<e+2;s++)r[h][s]=r[h][s]*c;for(t=0;t<e+1;t++)if(t!==h)for(c=-r[t][h],s=0;s<e+2;s++)r[t][s]=r[t][s]+c*r[h][s]}else for(h=1;h<e+1;h++){for(t=h;t<e+1&&r[t][h]===0;)t++;if(t>=e+1)return a;for(s=1;s<e+2;s++)c=r[h][s],r[h][s]=r[t][s],r[t][s]=c;for(c=1/r[h][h],r[h][s]=r[h][s]*c,t=1;t<e+1;t++)t!==h&&(c=-r[t][h],r[t][s]=r[t][s]+c*r[h][s]);r[0][e+1]=0}if(p.colCount===1){for(g=[],t=0;t<it.rowCount;t++){for(g[t]=[],c=r[0][e+1],f=0;f<e;f++)b=it[(t,f)],c+=r[f+1][e+1]*b;g[t][0]=v(c)}return new i._ConcreteArray(g)}else{for(g=[],g[0]=[],t=0;t<it.colCount;t++){for(c=r[0][e+1],f=0;f<e;f++)b=it[f][t],c+=r[f+1][e+1]*b;g[0][t]=v(c)}return new i._ConcreteArray(g)}}return a}function ua(n){var p,e,y,t,o;if(isNaN(p=u.D(n[0])))return f;var s,r,c=0,i=0,l=0,b=0,k,v,h=u.toArr(n[1],1,!0,!0,!1);if(h.isError)return h[0];if(e=u.toArr(n[2],1,!0,!0,!1),e.isError)return e[0];if(y=h.length,y!==e.length)return a;for(t=0,o=0;o<y;o++)s=h[o],r=e[o],s!==u.CalcConvertedError&&r!==u.CalcConvertedError&&(c+=s,i+=r,l+=r*r,b+=r*s,t++);return t===0?w:t*l-i*i==0?w:(v=(t*b-i*c)/(t*l-i*i),k=c/t-v*(i/t),u.toResult(k+v*p))}function fa(n){return bt.__averageIncludeSubtotals(n,!0,!0)}function hr(n){return bt.__stdevIncludeSubtotals(n,!0,!0)}function ci(n){var s,a=i.Convert,e,t,h,c,r,l;if(isNaN(s=u.D(n[1])))return f;if(e=u.toArr(n[0],1,!0,!0,!1,!0),e.isError)return e[0];if(e.isConvertError)return f;for(t=[],h=0;h<e.length;h++)c=e[h],c!==u.CalcConvertedError&&t.push(c);return(t.sort(function(n,t){return n-t}),t.length===0)?o:s<0||1<s?o:(r=s*(t.length-1),l=r%1,r=parseInt(r.toString(),10),l===0?t[r]:u.D(t[r])+l*(u.D(t[r+1])-u.D(t[r])))}var vi,g,ct,wi,bt,lt;t.feature("calc.functions",["calc.common"]);var s=null,h=undefined,u=i.Convert,l=Math.abs,rt=Math.sqrt,at=Math.max,vt=Math.min,nt=Math.floor,dt=Math.ceil,cr=Math.sin,lr=Math.asin,ar=Math.cos,vr=Math.acos,yr=Math.tan,pr=Math.atan,wr=Math.atan2,v=Math.exp,k=Math.log,yt=Math.PI,li=Math.random,et=Math.pow,ut="string",pt="boolean",br="number",tt=i.Errors,kr=tt.Null,w=tt.DivideByZero,f=tt.Value,dr=tt.Reference,gr=tt.Name,a=tt.NotAvailable,o=tt.Number,c=i.Functions;c._builtInFunctions=c._builtInFunctions||{};r._defineBuildInFunction=ai;r.def=ai;vi=function(){function n(){}return n.days360=ur,n.yearfrac=er,n}();r._DateHelper=vi;r.acceptsAny=e;r.acceptsNone=nu;r.acceptsNotZero=gt;r.acceptsOne=d;r.acceptsTwo=y;r.acceptsZeroTwo=ni;r.acceptsZeroOdd=ti;r.acceptsThree=wt;r.isVolatile=ot;r.acceptsOneTwo=st;r.isBranch=yi;r.acceptsZero=ii;r.findTestArgument=pi;r.acceptAboveZero=ui;r.acceptsSecond=iu;r.acceptsSecondOrThirdOrFourth=fi;r.acceptsThird=ru;r.acceptsFirstOrThird=uu;r.acceptsFirstOrOne=fu;r.acceptsFirstOrOdd=eu;r.acceptsFirst=ht;r.acceptsFirstOrSecondOrThird=ei;r.acceptsEven=ou;r.acceptsFourth=su;r.acceptsNotFourth=oi;r.acceptsFourthOrFifth=hu;r.acceptsNotSecond=cu;r.acceptsThreeFour=lu;r.acceptsTwoThree=it;r.acceptsPositive=au;r.acceptsFour=vu;r.acceptsFourFive=yu;r.acceptsFive=pu;r.acceptsSix=wu;r.acceptsEight=bu;r.acceptsSeven=ku;r.acceptsNotTwo=du;r.acceptsFiveSix=gu;r.acceptsFourSixSeven=nf;r.acceptsThreeFourFive=tf;r.acceptsMoreThanOne=rf;r.acceptsTwoThreeFour=uf;r.acceptsOneTwoThree=ff;g=function(){function n(n,t){this.Key=n;this.Value=t}return n}();ct=[/\\/g,/\(/g,/\[/g,/\{/g,/\^/g,/\$/g,/\|/g,/\)/g,/\+/g,/\./g];wi=function(){function t(){}return t.__isLeapYear=function(n){return n%400==0||n%4==0&&n%100!=0||n===1900},t.__compareDateTime=function(n,t){return n-t},t.__toOADate=function(t){return new n.Sheets._DateTimeHelper(t).toOADate()},t.__annual_year_basis=function(n,i){var r;switch(i){case 0:return 360;case 1:return r=t.__isLeapYear(n.getFullYear()),r?366:365;case 2:return 360;case 3:return 365;case 4:return 360;default:return-1}},t.__getDaysInMonth=function(n,i){switch(i){case 0:case 2:case 4:case 6:case 7:case 9:case 11:return 31;case 1:return t.__isLeapYear(n)?29:28;case 3:case 5:case 8:case 10:return 30}},t.__Days_Between_BASIS_30E_360=function(n,t){var u,f,i,e,o,r;return u=n.getFullYear(),f=n.getMonth(),i=n.getDate(),e=t.getFullYear(),o=t.getMonth(),r=t.getDate(),i===31&&(i=30),r===31&&(r=30),(e-u)*360+(o-f)*30+(r-i)},t.__Days_Between_BASIS_30Ep_360=function(n,t){var f,e,i,o,u,r;return f=n.getFullYear(),e=n.getMonth(),i=n.getDate(),o=t.getFullYear(),u=t.getMonth(),r=t.getDate(),i===31&&(i=30),r===31&&(r=1,u++),(o-f)*360+(u-e)*30+(r-i)},t.__Days_Between_BASIS_MSRB_30_360_SYM=function(n,i){var o,f,r,s,e,u;return o=n.getFullYear(),f=n.getMonth(),r=n.getDate(),s=i.getFullYear(),e=i.getMonth(),u=i.getDate(),f===2&&t.__getDaysInMonth(o,f)===r&&(r=30),e===2&&t.__getDaysInMonth(s,e)===u&&(u=30),u===31&&r>=30&&(u=30),r===31&&(r=30),(s-o)*360+(e-f)*30+(u-r)},t.__Days_Between_BASIS_MSRB_30_360=function(n,i){var o,f,r,s,e,u;return o=n.getFullYear(),f=n.getMonth(),r=n.getDate(),s=i.getFullYear(),e=i.getMonth(),u=i.getDate(),f===2&&t.__getDaysInMonth(o,f)===r&&e===2&&t.__getDaysInMonth(s,e)===u&&(r=30,u=30),u===31&&r>=30&&(u=30),r===31&&(r=30),(s-o)*360+(e-f)*30+(u-r)},t.__days_between_basis=function(n,i,r){var f=1,e;t.__compareDateTime(n,i)>0&&(e=n,n=i,i=e,f=-1);switch(r){case 1:case 2:case 3:return f*u.I(t.__toOADate(i)-t.__toOADate(n));case 4:return f*t.__Days_Between_BASIS_30E_360(n,i);case 5:return f*t.__Days_Between_BASIS_30Ep_360(n,i);case 6:return f*t.__Days_Between_BASIS_MSRB_30_360_SYM(n,i);default:return f*t.__Days_Between_BASIS_MSRB_30_360(n,i)}},t}();r._FinancialHelper=wi;bt=function(){function n(){}return n.__dev1=function(n,t,i,r){for(var e,o,l,v,y,s,a,h,c,f=0;f<n.length;f++)for(e=u.toArr(n[f],1,!1,!1,!1,!0),o=0;o<e.rangeCount;o++)for(l=e.rangeCount>1?e[o]:e,e.isReference&&(v=n[f].getRow(o),y=n[f].getColumn(o)),s=0;s<l.length;s++)if(i||!e.isReference||!n[f].isHiddenRow(o,s,r))for(a=l[s],h=0;h<a.length;h++)!i&&e.isReference&&n[f].isSubtotal(o,s+v,h+y)||(c=a[h],c!==u.CalcConvertedError&&(t.sumx+=c,t.sumx2+=c*c,t.n++))},n.st_normsdist=function(n){var e,o,t,r,i;return isNaN(e=u.D(n[0]))?f:(o=6,e===0?r=0:(t=.5*l(e),t>=o*.5?r=1:t<1?(i=t*t,r=((((((((.000124818987*i-.001075204047)*i+.005198775019)*i-.019198292004)*i+.059054035642)*i-.151968751364)*i+.319152932694)*i-.5319230073)*i+.797884560593)*t*2):(t-=2,r=(((((((((((((-45255659e-12*t+.00015252929)*t-19538132e-12)*t-.000676904986)*t+.001390604284)*t-.00079462082)*t-.002034254874)*t+.006549791214)*t-.010557625006)*t+.011630447319)*t-.009279453341)*t+.005353579108)*t-.002141268741)*t+.000535310849)*t+.999936657524)),e>0?(r+1)*.5:(1-r)*.5)},n.__averageIncludeSubtotals=function(n,t,i){for(var r,f,c,y,p,o,l,s,a,v=0,h=0,h=0,e=0;e<n.length;e++)for(r=u.toArr(n[e],1,!1,!1,!1,!0),f=0;f<r.rangeCount;f++)for(c=r.rangeCount>1?r[f]:r,r.isReference&&(y=n[e].getRow(f),p=n[e].getColumn(f)),o=0;o<c.length;o++)if(t||!r.isReference||!n[e].isHiddenRow(f,o,i))for(l=c[o],s=0;s<l.length;s++)!t&&r.isReference&&n[e].isSubtotal(f,o+y,s+p)||(a=l[s],a!==u.CalcConvertedError&&(v+=a,h++));return h===0?w:u.toResult(v/h)},n.__countIncludeSubtotals=function(n,t,i){for(var r,f,c,v,y,o,l,s,h,a=0,e=0;e<n.length;e++)for(r=u.toArr(n[e],0,!1,!1,!1,!0),f=0;f<r.rangeCount;f++)for(c=r.rangeCount>1?r[f]:r,r.isReference&&(v=n[e].getRow(f),y=n[e].getColumn(f)),o=0;o<c.length;o++)if(t||!r.isReference||!n[e].isHiddenRow(f,o,i))for(l=c[o],s=0;s<l.length;s++)!t&&r.isReference&&n[e].isSubtotal(f,o+v,s+y)||(h=l[s],h!==null&&h!==""&&h!==u.CalcConvertedError&&u.num(h)&&a++);return a},n.__countaIncludeSubtotals=function(n,t,i){for(var r,f,l,p,w,o,a,c,v,y=0,e=0;e<n.length;e++)for(r=u.toArr(n[e],0,!1,!1,!1),f=0;f<r.rangeCount;f++)for(l=r.rangeCount>1?r[f]:r,r.isReference&&(p=n[e].getRow(f),w=n[e].getColumn(f)),o=0;o<l.length;o++)if(t||!r.isReference||!n[e].isHiddenRow(f,o,i))for(a=l[o],c=0;c<a.length;c++)!t&&r.isReference&&n[e].isSubtotal(f,o+p,c+w)||(v=a[c],v!==s&&v!==h&&y++);return y},n.__maxIncludeSubtotals=function(n,t,i){for(var r,e,a,p,w,s,v,h,y=!1,l=0,c,o=0;o<n.length;o++){if(r=u.toArr(n[o],1,!1,!0,!1,!0),r.isError)return r[0];if(r.isConvertError)return f;for(e=0;e<r.rangeCount;e++)for(a=r.rangeCount>1?r[e]:r,r.isReference&&(p=n[o].getRow(e),w=n[o].getColumn(e)),s=0;s<a.length;s++)if(t||!r.isReference||!n[o].isHiddenRow(e,s,i))for(v=a[s],h=0;h<v.length;h++)!t&&r.isReference&&n[o].isSubtotal(e,s+p,h+w)||(c=v[h],c!==u.CalcConvertedError&&((!y||c>l)&&(l=c),y=!0))}return l},n.__minIncludeSubtotals=function(n,t,i){for(var r,e,a,p,w,s,v,h,y=!1,l=0,c,o=0;o<n.length;o++){if(r=u.toArr(n[o],1,!1,!0,!1,!0),r.isError)return r[0];if(r.isConvertError)return f;for(e=0;e<r.rangeCount;e++)for(a=r.rangeCount>1?r[e]:r,r.isReference&&(p=n[o].getRow(e),w=n[o].getColumn(e)),s=0;s<a.length;s++)if(t||!r.isReference||!n[o].isHiddenRow(e,s,i))for(v=a[s],h=0;h<v.length;h++)!t&&r.isReference&&n[o].isSubtotal(e,s+p,h+w)||(c=v[h],c!==u.CalcConvertedError&&((!y||c<l)&&(l=c),y=!0))}return l},n.__sumIncludeSubtotals=function(n,t,i){for(var r,e,l,y,p,s,a,h,v=0,c,o=0;o<n.length;o++){if(r=u.toArr(n[o],1,!1,!0,!1,!0),r.isError)return r[0];if(r.isConvertError)return f;for(e=0;e<r.rangeCount;e++)for(l=r.rangeCount>1?r[e]:r,r.isReference&&(y=n[o].getRow(e),p=n[o].getColumn(e)),s=0;s<l.length;s++)if(t||!r.isReference||!n[o].isHiddenRow(e,s,i))for(a=l[s],h=0;h<a.length;h++)!t&&r.isReference&&n[o].isSubtotal(e,s+y,h+p)||(c=a[h],c!==u.CalcConvertedError&&(v+=c))}return v},n.__stdevIncludeSubtotals=function(t,i,r){var f={sumx:0,sumx2:0,n:0},e=n.__dev1(t,f,i,r);return u.err(e)?e:f.n<=1?w:u.toResult(rt(at(0,(f.n*f.sumx2-f.sumx*f.sumx)/(f.n*(f.n-1)))))},n.__stdevpIncludeSubtotals=function(t,i,r){var f={sumx:0,sumx2:0,n:0},e=n.__dev1(t,f,i,r);return u.err(e)?e:f.n<=0?w:u.toResult(rt(at(0,(f.n*f.sumx2-f.sumx*f.sumx)/(f.n*f.n))))},n.__varrIncludeSubtotals=function(t,i,r){var f={sumx:0,sumx2:0,n:0},e=n.__dev1(t,f,i,r);return u.err(e)?e:f.n<=1?w:u.toResult(at(0,(f.n*f.sumx2-f.sumx*f.sumx)/(f.n*(f.n-1))))},n.__varpIncludeSubtotals=function(t,i,r){var f={sumx:0,sumx2:0,n:0},e=n.__dev1(t,f,i,r);return u.err(e)?e:f.n<=0?w:u.toResult(at(0,(f.n*f.sumx2-f.sumx*f.sumx)/(f.n*f.n)))},n.st_percentile=ci,n}();r._StatHelper=bt;lt=function(){function n(){}return n.log=function(n,t){return isNaN(n)?n:isNaN(t)?t:t!==1&&n===1||t!==0&&t!==Number.POSITIVE_INFINITY?k(n)/k(t):NaN},n.log10=function(t){return n.log(t,10)},n}();r._MathHelper=function(){function i(n){var t=nt(n);return c._MathHelper.approxEqual(n,t+1)?t+1:t}function r(n){var t=dt(n);return c._MathHelper.approxEqual(n,t-1)?t-1:t}function y(n,t){return n===t?!0:l(n-t)<l(n)/281474976710656}function p(){var n=[];return n[0]=1,n[1]=10,n[2]=100,n[3]=1e3,n[4]=1e4,n[5]=1e5,n[6]=1e6,n[7]=1e7,n[8]=1e8,n[9]=1e9,n[10]=1e10,n[11]=1e11,n[12]=1e12,n[13]=1e13,n[14]=1e14,n[15]=1e15,n[16]=1e16,n}function e(n){var i=p(),t=i[n];return t!==h&&t!==s?t:et(10,parseFloat(n))}function n(n,i){var r,l,f,e,a,o,c,v;switch(n){case 0:r=function(n,t){return n<=t};f=function(n,t){return n<=t};break;case 1:r=function(n,t){return n>=t};f=function(n,t){return n>=t};break;case 2:r=function(n,t){return n!==t};f=function(n,t){return n!==t};break;case 3:r=function(n,t){return n<t};f=function(n,t){return n<t};break;case 4:r=function(n,t){return n===t};f=function(n,t){return n===t};e=t.RegUtil.getWildcardCriteriaFullMatch(i);e&&(a=t.RegUtil.getRegIgnoreCase(e),l=function(n){return a.lastIndex=0,a.test(n)});break;case 5:r=function(n,t){return n>t};f=function(n,t){return n>t};break;default:return function(n){return!1}}o=-1;c=!0;try{v={value:0};i===h||i===s?o=0:u.rD(i.toString(),v)?o=v.value:c=!1}catch(y){c=!1}return function(n){var a,t;if((n===h||n===s)&&(n=""),c){a=-1;try{if(t={value:0},u.rD(n,t))return f(t.value,o)}catch(v){}}return e&&l?l(n.toString()):r(n.toString().toUpperCase(),i!==h&&i!==s?i.toString().toUpperCase():"")}}function w(t){var f,e;if(u.num(t))return n(4,t);var o="=><",i=t!==h&&t!==s?t.toString().toUpperCase():"",r='\0';for(f=0;f<2&&f<i.length;f++)if(e=i[f],o.indexOf(e)!==-1)if(e==="=")switch(r){case"<":return n(0,i.substring(2));case">":return n(1,i.substring(2));default:return n(4,r==='\0'?i.substring(1):t)}else{if(r==='\0'){r=e;continue}if(r==="<")return e===">"?n(2,i.substring(2)):n(3,i.substring(1));else if(r===">")return n(5,i.substring(1))}else switch(r){case"<":return n(3,i.substring(1));case">":return n(5,i.substring(1));default:break}return n(4,t)}function b(n,t){if(isNaN(n))return f;var o=e(l(t));return t<0?n/=o:n*=o,n=n<0?r(n-.5):i(n+.5),t<0?n*=o:n/=o,u.toResult(n)}function d(n,t){var r,i;if(isNaN(n)||isNaN(t))return f;if(n<0||t<0||n<t)return o;for(r=1,t=vt(n-t,t),i=1;i<=t;i++)r*=n-i+1,r/=i;return u.toResult(r)}function a(n){return k(1+n)-(1+n-1-n)/(1+n)}function g(n,t){var i;return i=l(n)>.5?et(1+n,t):v(t*a(n)),isFinite(i)?isNaN(i)&&(i=494065645841247e-338):i===Number.POSITIVE_INFINITY?i=179769e303:i===Number.NEGATIVE_INFINITY&&(i=-179769e303),i}function tt(n){return(v(n)+v(-n))/2}function it(n){return(v(n)-v(-n))/2}return{approxFloor:i,approxCeiling:r,approxEqual:y,pow10:e,parseCriteria:w,round:b,combin:d,log10:lt.log10,log:lt.log,pow1p:g,log1p:a,cosh:tt,sinh:it}}();r.def("ABS",ef,{minArgs:1,maxArgs:1});r.def("ACOS",eo,{minArgs:1,maxArgs:1});r.def("ASIN",co,{minArgs:1,maxArgs:1});r.def("ATAN",yo,{minArgs:1,maxArgs:1});r.def("ATAN2",po,{minArgs:2,maxArgs:2});r.def("COS",fo,{minArgs:1,maxArgs:1});r.def("CEILING",sf,{minArgs:2,maxArgs:2});r.def("ODD",wf,{minArgs:1,maxArgs:1});r.def("EVEN",lf,{minArgs:1,maxArgs:1});r.def("FLOOR",oe,{minArgs:2,maxArgs:2});r.def("LN",yf,{minArgs:1,maxArgs:1});r.def("SQRT",ue,{minArgs:1,maxArgs:1});r.def("SIN",ho,{minArgs:1,maxArgs:1});r.def("TAN",vo,{minArgs:1,maxArgs:1});r.def("SIGN",ne,{minArgs:1,maxArgs:1});r.def("GCD",te,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("LCM",ie,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("PRODUCT",re,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("POWER",kf,{minArgs:2,maxArgs:2});r.def("MOD",pf,{minArgs:2,maxArgs:2});r.def("QUOTIENT",fe,{minArgs:2,maxArgs:2});r.def("SUBTOTAL",ee,{minArgs:2,acceptsReference:gt,acceptsArray:gt});r.def("INT",of,{minArgs:1,maxArgs:1});r.def("MROUND",se,{minArgs:2,maxArgs:2});r.def("ROUND",si,{minArgs:2,maxArgs:2});r.def("ROUNDDOWN",he,{minArgs:2,maxArgs:2});r.def("ROUNDUP",ce,{minArgs:2,maxArgs:2});r.def("TRUNC",le,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("EXP",ae,{minArgs:1,maxArgs:1});r.def("LOG",ye,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("LOG10",pe,{minArgs:1,maxArgs:1});r.def("SUM",gf,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("SUMIF",we,{minArgs:2,maxArgs:3,acceptsMissingArgument:y,acceptsReference:ni,acceptsArray:ni});r.def("SUMIFS",be,{minArgs:3,acceptsReference:ti,acceptsArray:ti});r.def("SUMPRODUCT",ke,{minArgs:1,acceptsReference:e,acceptsArray:e,arrayArgumentEvaluateMode:1});r.def("SUMSQ",de,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("SUMX2MY2",ge,{minArgs:2,maxArgs:2,acceptsReference:e,acceptsArray:e});r.def("SUMX2PY2",no,{minArgs:2,maxArgs:2,acceptsReference:e,acceptsArray:e});r.def("SUMXMY2",to,{minArgs:2,maxArgs:2,acceptsReference:e,acceptsArray:e});r.def("SERIESSUM",io,{minArgs:4,maxArgs:4,acceptsReference:wt,acceptsArray:wt});r.def("PI",bf,{minArgs:0,maxArgs:0});r.def("SQRTPI",ro,{minArgs:1,maxArgs:1});r.def("DEGREES",cf,{minArgs:1,maxArgs:1});r.def("RADIANS",uo,{minArgs:1,maxArgs:1});r.def("COSH",oo,{minArgs:1,maxArgs:1});r.def("ACOSH",so,{minArgs:1,maxArgs:1});r.def("SINH",lo,{minArgs:1,maxArgs:1});r.def("ASINH",ao,{minArgs:1,maxArgs:1});r.def("TANH",wo,{minArgs:1,maxArgs:1});r.def("ATANH",bo,{minArgs:1,maxArgs:1});r.def("MDETERM",ko,{minArgs:1,maxArgs:1,acceptsArray:e,acceptsReference:e});r.def("MINVERSE",go,{minArgs:1,maxArgs:1,acceptsArray:e,acceptsReference:e});r.def("MMULT",ns,{minArgs:2,maxArgs:2,acceptsArray:e,acceptsReference:e});r.def("FACT",af,{minArgs:1,maxArgs:1});r.def("FACTDOUBLE",vf,{minArgs:1,maxArgs:1});r.def("MULTINOMIAL",ts,{minArgs:1,acceptsArray:e,acceptsReference:e});r.def("RAND",is,{minArgs:0,maxArgs:0,isVolatile:ot});r.def("RANDBETWEEN",rs,{minArgs:2,maxArgs:2,isVolatile:ot});r.def("COMBIN",hf,{minArgs:2,maxArgs:2});r.def("ROMAN",fs,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("CEILING.PRECISE",di,{minArgs:1,maxArgs:2});r.def("ISO.CEILING",di,{minArgs:1,maxArgs:2});r.def("FLOOR.PRECISE",ve,{minArgs:1,maxArgs:2});r.def("AND",es,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("OR",os,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("NOT",ss,{minArgs:1,maxArgs:1});r.def("IF",hs,{minArgs:2,maxArgs:3,acceptsReference:st,acceptsArray:st,acceptsError:st,acceptsMissingArgument:y,isBranch:yi,findTestArgument:pi,findBranchArgument:tu});r.def("IFERROR",ls,{minArgs:2,maxArgs:2,acceptsReference:ii,acceptsError:ii});r.def("TRUE",as,{minArgs:0,maxArgs:0});r.def("FALSE",vs,{minArgs:0,maxArgs:0});r.def("DATE",ys,{minArgs:3,maxArgs:3});r.def("TIME",ps,{minArgs:3,maxArgs:3});r.def("DATEVALUE",ws,{minArgs:1,maxArgs:1});r.def("TIMEVALUE",ir,{minArgs:1,maxArgs:1});r.def("NOW",ks,{minArgs:0,maxArgs:0,isVolatile:ot});r.def("TODAY",ds,{minArgs:0,maxArgs:0,isVolatile:ot});r.def("HOUR",gs,{minArgs:1,maxArgs:1});r.def("MINUTE",nh,{minArgs:1,maxArgs:1});r.def("SECOND",th,{minArgs:1,maxArgs:1});r.def("DAY",ih,{minArgs:1,maxArgs:1});r.def("MONTH",rh,{minArgs:1,maxArgs:1});r.def("YEAR",uh,{minArgs:1,maxArgs:1});r.def("WEEKNUM",oh,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("WEEKDAY",b,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("EDATE",sh,{minArgs:2,maxArgs:2});r.def("EOMONTH",ch,{minArgs:2,maxArgs:2});r.def("WORKDAY",lh,{minArgs:2,maxArgs:3,acceptsMissingArgument:y,acceptsArray:y,acceptsReference:y});r.def("WORKDAY.INTL",ah,{minArgs:2,maxArgs:4,acceptsMissingArgument:it,acceptsArray:it,acceptsReference:it});r.def("DAYS360",ur,{minArgs:2,maxArgs:3,acceptsMissingArgument:y});r.def("NETWORKDAYS",ph,{minArgs:2,maxArgs:3,acceptsMissingArgument:y,acceptsArray:y,acceptsReference:y});r.def("NETWORKDAYS.INTL",wh,{minArgs:2,maxArgs:4,acceptsMissingArgument:it,acceptsArray:it,acceptsReference:it});r.def("YEARFRAC",er,{minArgs:2,maxArgs:3,acceptsMissingArgument:y});r.def("DATEDIF",nc,{minArgs:3,maxArgs:3});r.def("CLEAN",ic,{minArgs:1,maxArgs:1});r.def("TRIM",rc,{minArgs:1,maxArgs:1});r.def("DOLLAR",fc,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("FIXED",ec,{minArgs:1,maxArgs:3,acceptsMissingArgument:st});r.def("TEXT",sc,{minArgs:2,maxArgs:2});r.def("VALUE",hc,{minArgs:1,maxArgs:1});r.def("LOWER",cc,{minArgs:1,maxArgs:1});r.def("UPPER",lc,{minArgs:1,maxArgs:1});r.def("PROPER",ac,{minArgs:1,maxArgs:1});r.def("CHAR",vc,{minArgs:1,maxArgs:1});r.def("CODE",yc,{minArgs:1,maxArgs:1});r.def("REPLACE",pc,{minArgs:4,maxArgs:4,acceptsMissingArgument:y});r.def("SUBSTITUTE",wc,{minArgs:3,maxArgs:4,acceptsMissingArgument:wt});r.def("CONCATENATE",bc,{minArgs:2,acceptsArray:e});r.def("LEFT",kc,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("MID",dc,{minArgs:3,maxArgs:3});r.def("RIGHT",gc,{minArgs:1,maxArgs:2,acceptsMissingArgument:d});r.def("REPT",nl,{minArgs:2,maxArgs:2});r.def("LEN",tl,{minArgs:1,maxArgs:1});r.def("FIND",il,{minArgs:2,maxArgs:3,acceptsMissingArgument:y});r.def("SEARCH",rl,{minArgs:2,maxArgs:3,acceptsMissingArgument:y});r.def("EXACT",ul,{minArgs:2,maxArgs:2});r.def("T",fl,{minArgs:1,maxArgs:1});r.def("ISERROR",sl,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISERR",hl,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISNA",cl,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ERROR.TYPE",ll,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISNUMBER",al,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISEVEN",vl,{minArgs:1,maxArgs:1});r.def("ISODD",yl,{minArgs:1,maxArgs:1});r.def("N",pl,{minArgs:1,maxArgs:1});r.def("ISBLANK",wl,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISLOGICAL",bl,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISTEXT",kl,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISNONTEXT",dl,{minArgs:1,maxArgs:1,acceptsError:e});r.def("ISREF",gl,{minArgs:1,maxArgs:1,acceptsError:e,acceptsReference:e});r.def("TYPE",na,{minArgs:1,maxArgs:1,acceptsArray:e,acceptsError:e});r.def("NA",ta,{minArgs:0,maxArgs:0});r.def("TREND",ia,{minArgs:1,maxArgs:4,acceptsReference:ei,acceptsArray:ei,acceptsMissingArgument:fi});r.def("GROWTH",ra,{minArgs:1,maxArgs:4,acceptsReference:oi,acceptsArray:oi,acceptsMissingArgument:fi});r.def("FORECAST",ua,{minArgs:3,maxArgs:3,acceptsArray:ui,acceptsReference:ui});r.def("AVERAGE",fa,{minArgs:1,acceptsArray:e,acceptsReference:e});r.def("STDEV",hr,{minArgs:1,acceptsArray:e,acceptsReference:e});r.def("STDEV.S",hr,{minArgs:1,acceptsReference:e,acceptsArray:e});r.def("PERCENTILE",ci,{minArgs:2,maxArgs:2,acceptsArray:ht,acceptsReference:ht});r.def("PERCENTILE.INC",ci,{minArgs:2,maxArgs:2,acceptsReference:ht,acceptArray:ht})})(i.Functions||(i.Functions={}));var r=i.Functions})(t.Calc||(t.Calc={}));var i=t.Calc})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var a,wt,bt,it,i,u,b,k,d,rt,g,y;n.feature("formatter",["core.common","core.globalize"]);var t=null,f=undefined,o=Math.abs,c=Math.ceil,nt=Math.pow,v=Math.floor,lt=Math.max,at=Math.min,vt=Math.round,yt="\u4e00\u5341",pt="\u5341",r={Empty:"",Format:function(){for(var r,n,f,u=[],i=0;i<arguments.length-0;i++)u[i]=arguments[i+0];if(arguments.length===0)return t;for(r=u[0],n=1;n<arguments.length;n++)f=new RegExp("\\{"+(n-1)+"\\}","gm"),r=r.replace(f,arguments[n]);return r},IsNullOrEmpty:function(n){return!n||n===r.Empty}},tt;(function(n){n[n.None=0]="None";n[n.AllowLeadingWhite=1]="AllowLeadingWhite";n[n.AllowTrailingWhite=2]="AllowTrailingWhite";n[n.AllowInnerWhite=4]="AllowInnerWhite";n[n.AllowWhiteSpaces=7]="AllowWhiteSpaces";n[n.NoCurrentDateDefault=8]="NoCurrentDateDefault";n[n.AdjustToUniversal=16]="AdjustToUniversal";n[n.AssumeLocal=32]="AssumeLocal";n[n.AssumeUniversal=64]="AssumeUniversal";n[n.RoundtripKind=128]="RoundtripKind"})(tt||(tt={}));a={IsDigit:function(n){var t=n.charCodeAt(0);return t>=48&&t<=57},IsWhiteSpace:function(n){var t=n.charCodeAt(0);return t>=9&&t<=13||t===32||t===133||t===160}},function(n){n[n.CustomMode=0]="CustomMode";n[n.StandardDateTimeMode=1]="StandardDateTimeMode";n[n.StandardNumericMode=2]="StandardNumericMode"}(n.FormatMode||(n.FormatMode={}));wt=n.FormatMode,function(n){n[n.General=0]="General";n[n.Number=1]="Number";n[n.DateTime=2]="DateTime";n[n.Text=3]="Text"}(n.NumberFormatType||(n.NumberFormatType={}));bt=n.NumberFormatType,function(n){n[n.Hour=0]="Hour";n[n.Minute=1]="Minute";n[n.Second=2]="Second"}(it||(it={}));i=function(){function i(){}return i.DateTimeFormatInfo=function(){return n._CultureInfo._currentCulture.DateTimeFormat()},i.NumberFormatInfo=function(){return n._CultureInfo._currentCulture.NumberFormat()},i.Filter=function(n,i,r){var s,u,e,o;if(n===f||n===t||n==="")return n;for(s="",u=0,e=0;e<n.length;e++)o=n[e],o===i?u++:o===r?(u--,u<0&&(u=0)):u===0&&(s+=o);return s.toString()},i.TrimSquareBracket=function(t){return!t||t===r.Empty?t:(t[0]===i.LeftSquareBracket&&(t=n.StringHelper.TrimStart(t,i.LeftSquareBracket)),t[t.length-1]===i.RightSquareBracket&&(t=n.StringHelper.TrimEnd(t,i.RightSquareBracket)),t)},i.IsOperator=function(n){return n===i.LessThanSign||n===i.GreaterThanSign||n===i.EqualsThanSign},i.TrimEscape=function(n){for(var r,e=n.length,t=!1,u="",f=0;f<e;f++)r=n.charAt(f),r===i.ReverseSolidusSign?(t=!t,t||(u+=r)):(t=!1,u+=r);return u},i.AddSquareBracket=function(t){if(!t)throw new Error(n.SR.Exp_TokenIsNull);return(t.length===0||t[0]!==i.LeftSquareBracket)&&(t=n.StringHelper.Insert(t,0,i.LeftSquareBracket.toString())),(t.length===0||t[t.length-1]!==i.RightSquareBracket)&&(t=n.StringHelper.Insert(t,t.length,i.RightSquareBracket.toString())),t},i.IsEquals=function(n,t,i){return n||t?n&&t?i?n.toLowerCase()===t.toLowerCase():n===t:!1:!0},i.ReplaceKeyword=function(t,i,u){var f,o,e;if(!t||t===r.Empty||this.IsEquals(i,u,!0))return t;for(f=t,o=0;;)if(e=n.StringHelper.IndexOf(f,i,1),e>-1)f=n.StringHelper.Remove(f,e,i.length),f=n.StringHelper.Insert(f,e,u),o=e+u.length;else break;return f},i.IsDecimal=function(n,t){var r=i.DecimalSeparator;return t&&(r=t.numberDecimalSeparator),n.indexOf(r)>-1},i.Split=function(r,u){var e=[],l='"',h,f;if(r===t||r==="")return e;var o=!1,s=new n._StringBuilder,c=!1;for(h=0;h<r.length;h++)f=r[h],f!=l||o||(c=!c),o||c||f!=u?s.append(f):(e.push(s.toString()),s.clear()),o=f==i.ReverseSolidusSign?o?!1:!0:!1;return e.push(s.toString()),e},i.DoubleQuote='"',i.SingleQuote="'",i.Tab="\t",i.LeftSquareBracket="[",i.RightSquareBracket="]",i.LessThanSign="<",i.GreaterThanSign=">",i.EqualsThanSign="=",i.PlusSign="+",i.HyphenMinus="-",i.UnderLine="_",i.LeftParenthesis="(",i.RightParenthesis=")",i.Dollar="$",i.Comma=";",i.Space=" ",i.SolidusSign="/",i.ReverseSolidusSign="\\",i.Zero="0",i.QuestionMark="?",i.Colon=":",i.Semicolon=";",i.Sharp="#",i.CommercialAt="@",i.NumberSign="#",i.Asterisk="*",i.Exponential1="E+",i.Exponential2="E-",i.DecimalSeparator=".",i.numberGroupSeparator=",",i.percentSymbol="%",i.nanSymbol="NaN",i.FormatSeparator=";",i.negativeSign="-",i.ReplacePlaceholder="@",i.ExponentialSymbol="E",i}();n.DefaultTokens=i;u=function(){function u(i,r,u){this._classNames=["NumberFormatBase","IFormatter","IFormatProviderSupport"];this.numberFormatInfo=t;this.dateTimeFormatInfo=t;this.cultureName="";var f=this;f._initFileds();f.partLocaleID=i;f.partDbNumberFormat=r;f.cultureName=u?u:n._CultureInfo._currentCulture.Name()}return u.prototype._initFileds=function(){var n=this;n.numberStringConverter=t;n.numberFormatInfo=t;n.dateTimeFormatInfo=t;n.partLocaleID=t;n.partDbNumberFormat=t},u.prototype.NumberStringConverter=function(n){return arguments.length===0?this.numberStringConverter?this.numberStringConverter:t:(this.numberStringConverter=n,n)},u.prototype.PartLocaleID=function(){return n.util.asCustomType(this.partLocaleID,"LocaleIDFormatPart")},u.prototype.PartDBNumberFormat=function(){return n.util.asCustomType(this.partDbNumberFormat,"DBNumberFormatPart")},u.prototype.DateTimeFormatInfo=function(n){return arguments.length===0?this.dateTimeFormatInfo:(this.dateTimeFormatInfo=n,n)},u.prototype.NumberFormatInfo=function(n){return arguments.length===0?this.numberFormatInfo:(this.numberFormatInfo=n,n)},u.prototype.CultureName=function(n){var t=this;return arguments.length===0?t.partLocaleID?t.partLocaleID.CultureInfo().Name():t.cultureName:(t.cultureName=n,n)},u.prototype.numberGroupSeparator=function(){return this.NumberFormatInfo()?this.NumberFormatInfo().numberGroupSeparator:i.numberGroupSeparator},u.prototype.PercentSymbol=function(){return this.NumberFormatInfo()?this.NumberFormatInfo().percentSymbol:i.percentSymbol},u.prototype.PositiveSign=function(){return this.NumberFormatInfo()?this.NumberFormatInfo().positiveSign:i.NumberFormatInfo().positiveSign},u.prototype.NegativeSign=function(){return this.NumberFormatInfo()?this.NumberFormatInfo().negativeSign:i.negativeSign},u.prototype.DecimalSeparator=function(){return i.DecimalSeparator},u.prototype.NaNSymbol=function(){return this.NumberFormatInfo()?this.NumberFormatInfo().nanSymbol:i.nanSymbol},u.TrimNotSupportSymbol=function(n,t){var e,o,i,r,f;for(arguments.length===1&&(t=!0),e=!1,o="",i=0;i<n.length;i++)r=n[i],f=!0,r==='"'?e=!e:e||(t||(r==="?"&&(u.IsTransform(n,i)||(f=!1)),r==="/"&&(u.IsTransform(n,i)||(f=!1))),r==="_"?u.IsTransform(n,i)||(f=!1,i++):r==="*"&&(u.IsTransform(n,i)||(f=!1))),f&&(o+=r);return o},u.IsTransform=function(t,i){if(t[i]==="\\")throw new Error(n.SR.Exp_InvalidBackslash);if(i-1>0&&i-1<t.length&&t[i-1]==="\\")if(i-2<0)return!0;else if(i-2>0&&i-2<t.length)return t[i-2]!=="\\";return!1},u.ContainsKeywords=function(n,u,f){var s,e,l,h;if(!n||n===r.Empty)return!1;if(f[n])return!0;var a="",c=!1,v=t,o;for(s=0;s<n.length;s++)e=n[s],e==='"'?c=!c:c||e!==i.UnderLine&&v!==i.UnderLine&&(e!=="E"&&(o=e.charCodeAt(0),o>=65&&o<=90&&(o|=32,e=String.fromCharCode(o))),a+=e),v=e;if(l=a,f[l])return!0;for(h=0;h<u.length;h++)if(l.indexOf(u[h])>=0)return!0;return!1},u.prototype.Format=function(n){return""},u.prototype.Parse=function(n){return t},u.prototype.FormatString=function(){return""},u.prototype.ExcelCompatibleFormatString=function(){return""},u.General="General",u.General_Lower="general",u._keywords=[u.General_Lower],u._keywordsSet={general:!0},u}();b=function(){function r(i,r){var u=this;u.shortDatePattern="d";u.longDatePattern="D";u.FullDatePatternShortTime="f";u.FullDatePatternLongTime="F";u.GeneralDatePatternLongTimeShortTime="g";u.GeneralDatePatternLongTimeLongTime="G";u.MonthDayPattern1="m";u.MonthDayPattern2="M";u.RoundTripDatePattern1="o";u.RoundTripDatePattern2="O";u.RFC1123Pattern1="r";u.RFC1123Pattern2="R";u.SortableDatePattern="s";u.shortTimePattern="t";u.longTimePattern="T";u.UniversalSortableDatePattern="u";u.UniversalFullDatePattern="U";u.YearMonthPattern1="y";u.YearMonthPattern2="Y";u._cultureInfo=t;u._classNames=["StandardDateTimeFormatter","IFormatter"];u._formatString=i;r&&(u._cultureInfo=n._CultureInfo.getCulture(r))}return r.prototype.EvaluateFormat=function(n){var t=this;return n===t.shortDatePattern||n===t.longDatePattern||n===t.FullDatePatternShortTime||n===t.FullDatePatternLongTime||n===t.GeneralDatePatternLongTimeShortTime||n===t.GeneralDatePatternLongTimeLongTime||n===t.MonthDayPattern1||n===t.MonthDayPattern2||n===t.RoundTripDatePattern1||n===t.RoundTripDatePattern2||n===t.RFC1123Pattern1||n===t.RFC1123Pattern2||n===t.SortableDatePattern||n===t.shortTimePattern||n===t.longTimePattern||n===t.UniversalSortableDatePattern||n===t.UniversalFullDatePattern||n===t.YearMonthPattern1||n===t.YearMonthPattern2?!0:!1},r.prototype.Format=function(i){try{return i===f||i===t||i===""?"":new n._DateTimeHelper(i).localeFormat(this._formatString,this._cultureInfo)}catch(r){return i.toString()}},r.prototype.Parse=function(i){try{if(!i||i==="")return t;var r=n._DateTimeHelper.parseLocale(i,this._formatString,this._cultureInfo);return r?r:(r=new Date(i),isNaN(r.valueOf())?t:r)}catch(u){return new Date(i)}},r.prototype.FormatString=function(){return this._formatString},r.prototype.ExcelCompatibleFormatString=function(){var r="",f=this,n=i.DateTimeFormatInfo(),u;switch(f.FormatString()){case"D":r=n.longDatePattern;break;case"d":r=n.shortDatePattern;break;case"F":r=n.fullDateTimePattern;break;case"f":r=n.longDatePattern+" "+n.shortTimePattern;break;case"G":r=n.shortDatePattern+" "+n.longTimePattern;break;case"g":r=n.shortDatePattern+" "+n.shortTimePattern;break;case"M":case"m":r=n.monthDayPattern;break;case"R":case"r":r=n.rfc1123Pattern;break;case"s":r=n.sortableDateTimePattern;break;case"T":r=n.longTimePattern;break;case"t":r=n.shortTimePattern;break;case"u":r=n.universalSortableDateTimePattern;break;case"U":r=n.fullDateTimePattern;break;case"Y":case"y":r=n.yearMonthPattern;break}return r?(u=new h(r,t,t,t,t),u.ExcelCompatibleFormatString()):t},r}();n._StandardDateTimeFormatter=b;k=function(){function e(i,r){var u=this;u.CurrencyPattern1="c";u.CurrencyPattern2="C";u.DecimalPattern1="d";u.DecimalPattern2="D";u.ScientificPattern1="e";u.ScientificPattern2="E";u.FixedPointPattern1="f";u.FixedPointPattern2="F";u.GeneralPattern1="g";u.GeneralPattern2="G";u.NumberPattern1="n";u.NumberPattern2="N";u.PercentPattern1="p";u.PercentPattern2="P";u.RoundTripPattern1="r";u.RoundTripPattern2="R";u.HexadecimalPattern1="x";u.HexadecimalPattern2="X";u._classNames=["StandardNumberFormatter","IFormatter"];u._formatString=i;u._cultureInfo=t;r&&(u._cultureInfo=n._CultureInfo.getCulture(r))}return e.prototype.EvaluateFormat=function(n){var i=this,t;return n&&n!==r.Empty&&n.length>0&&(t=n.substr(0,1),t===i.CurrencyPattern1||t===i.CurrencyPattern2||t===i.DecimalPattern1||t===i.DecimalPattern2||t===i.ScientificPattern1||t===i.ScientificPattern2||t===i.FixedPointPattern1||t===i.FixedPointPattern2||t===i.GeneralPattern1||t===i.GeneralPattern2||t===i.NumberPattern1||t===i.NumberPattern2||t===i.PercentPattern1||t===i.PercentPattern2||t===i.RoundTripPattern1||t===i.RoundTripPattern2||t===i.HexadecimalPattern1||t===i.HexadecimalPattern2)?!0:!1},e.prototype.Format=function(i){try{return i===t||i===f||i===""?"":new n._NumberHelper(i).localeFormat(this._formatString,this._cultureInfo)}catch(r){return i.toString()}},e.prototype.Parse=function(i){try{return i===t||i===f||i===""?t:n._NumberHelper.parseLocale(i)}catch(u){var r=parseFloat(i);return isNaN(r)||!isFinite(r)?t:r}},e.prototype.FormatString=function(){return this._formatString},e.prototype.GetPrecision=function(){var f=this,i=f.FormatString(),u,r;return i&&i.length>0?(u=n.StringHelper.Remove(i,0,1),r=parseInt(u),!isNaN(r))?r:t:t},e.AddDecimalPrecision=function(n,t,r){var u=n,f;if(r>0)for(u+=i.DecimalSeparator,f=0;f<r;f++)u+=t;return u},e.AddIntegralPrecision=function(n,t,i){var r=n,u,f;if(i>0){for(u="",f=0;f<i;f++)u+=t;r=u+r}return r},e.prototype.ExcelCompatibleFormatString=function(){var o=this,s=o.FormatString(),c,f,h,r,l,a;return s?(c=i.NumberFormatInfo(),r=o.GetPrecision(),n.StringHelper.StartsWith(s,o.CurrencyPattern1,1)?(f=c.currencySymbol+"#,##0",h=r!==t?r:c.currencyDecimalDigits,e.AddDecimalPrecision(f,i.Zero,h)):n.StringHelper.StartsWith(s,o.DecimalPattern1,1)?(f="0",h=r!==t?r:1,e.AddIntegralPrecision(f,i.Zero,h-1)):n.StringHelper.StartsWith(s,o.ScientificPattern1,1)?(f="0",l="E+000",r!==t?(a=e.AddDecimalPrecision(f,i.Zero,r),a+l):"0.########################################E+000"):n.StringHelper.StartsWith(s,o.FixedPointPattern1,1)?(f="0",h=r!==t?r:c.numberDecimalDigits,e.AddDecimalPrecision(f,i.Zero,h)):n.StringHelper.StartsWith(s,o.GeneralPattern1,1)?u.General:n.StringHelper.StartsWith(s,o.NumberPattern1,1)?(f="#,##0",h=r!==t?r:c.numberDecimalDigits,e.AddDecimalPrecision(f,i.Zero,h)):n.StringHelper.StartsWith(s,o.PercentPattern1,1)?(f="0",h=r!==t?r:c.numberDecimalDigits,e.AddDecimalPrecision(f,i.Zero,h)+i.percentSymbol):n.StringHelper.StartsWith(s,o.RoundTripPattern1,1)?u.General:n.StringHelper.StartsWith(s,o.HexadecimalPattern1,1)?u.General:t):t},e}();n._StandardNumberFormatter=k;d=function(r){function e(n,t,f,e){var s,o;r.call(this,t,f,e);s=this;s._classNames=["NumberFormatText","IFormatter"];o=u.TrimNotSupportSymbol(n,!1);t&&(o=i.ReplaceKeyword(o,s.PartLocaleID().OriginalToken(),s.PartLocaleID().CurrencySymbol()));o=i.Filter(o,i.LeftSquareBracket,i.RightSquareBracket);o=i.TrimEscape(o);s._formatString=o}return __extends(e,r),e.prototype.Format=function(i){try{var r=n.Calc.Convert.S(i),u=n.StringHelper.Replace(this._formatString,'"',"");return u!==t&&u!==f&&(r=n.StringHelper.Replace(u,"@",r)),r}catch(e){return""}},e.prototype.Parse=function(n){return n?n:""},e.prototype.FormatString=function(){return this._formatString},e.EvaluateFormat=function(n){return!0},e.prototype.DefaultDateTimeNumberStringConverter=function(){},e}(u);rt=function(){function n(n){this._innerFormatter=n}return n.prototype.FormatString=function(){return this._innerFormatter?this._innerFormatter.FormatString():""},n.prototype.innerFormatter=function(n){return arguments.length===0?this._innerFormatter:(this._innerFormatter=n,this)},n.prototype.Parse=function(n){return this._innerFormatter?this._innerFormatter.Parse(n):n},n.prototype.Format=function(n){return this._innerFormatter?this._innerFormatter.Format(n):n===f||n===t?"":n.toString()},n.prototype.toJSON=function(){return this._innerFormatter.toJSON()},n.prototype.fromJSON=function(n){this._innerFormatter=new y(n.formatCached,n.formatModeType,n.customerCultureName)},n}();n.AutoFormatter=rt;g=function(){function o(i,r){var f=this;f.conditionFormatPart=t;f.colorFormatPart=t;f.localeIDFormatPart=t;f.dbNumberFormatPart=t;f.numberFormat=t;f.dateTimeFormatInfo=t;f.numberFormatInfo=t;f.formatCached=t;f._classNames=["CustomNumberFormat","IFormatter","IFormatProviderSupport"];r||(r=n._CultureInfo._currentCulture.Name());arguments.length===0?(f.formatCached=u.General,f.numberFormat=new e):f.Init(i,r)}return o.prototype.Init=function(u,o){var c,k,y,nt,p,v,tt;if(u===t||u===f)throw new Error(n.SR.Exp_FormatIllegal);c=this;c.formatCached=u;var a="",l="",b=!1,g=[];for(k=0;k<u.length;k++)if(y=u[k],y===i.LeftSquareBracket){if(b)throw new Error(n.SR.Exp_FormatIllegal);else l&&(a||(a=""),a+=l,l=""),l=y.toString();b=!0}else if(y===i.RightSquareBracket){if(b)if(l){if(l+=y,nt=l.toString(),p=n.util.asCustomType(s.Create(nt),"FormatPartBase"),p&&!n.util.isCustomType(p,"ABSTimeFormatPart"))c.AddPart(p);else if(n.util.isCustomType(p,"ABSTimeFormatPart"))g.push(n.util.asCustomType(p,"ABSTimeFormatPart")),a+=l;else throw new Error(n.SR.Exp_FormatIllegal);l=""}else throw new Error(n.SR.Exp_FormatIllegal);else throw new Error(n.SR.Exp_FormatIllegal);b=!1}else l+=y;if(l)if(b)throw new Error(n.SR.Exp_FormatIllegal);else a+=l;if(c.localeIDFormatPart!==t&&(o=c.localeIDFormatPart.CultureInfo().Name()),v=a?a.toString():r.Empty,e.EvaluateFormat(v))c.numberFormat=new e(v,c.LocaleIDFormatPart(),c.dbNumberFormatPart,o);else if(h.EvaluateFormat(v))tt=g.length>0?g:t,c.numberFormat=new h(v,tt,c.LocaleIDFormatPart(),c.dbNumberFormatPart,o);else if(w.EvaluateFormat(v))c.numberFormat=new w(u,c.LocaleIDFormatPart(),c.dbNumberFormatPart,o);else if(d.EvaluateFormat(v))c.numberFormat=new d(u,c.LocaleIDFormatPart(),c.dbNumberFormatPart,o);else throw new Error(n.SR.Exp_FormatIllegal);},o.prototype.FormatString=function(){var n=this,t="";return n.numberFormat&&n.numberFormat.FormatString()&&(n.ColorFormatPart()&&(t+=n.ColorFormatPart().toString()),n.ConditionFormatPart()&&(t+=n.ConditionFormatPart().toString()),n.DBNumberFormatPart()&&(t+=n.DBNumberFormatPart().toString()),n.LocaleIDFormatPart()&&(t+=n.LocaleIDFormatPart().toString()),t+=n.numberFormat.FormatString()),t.toString()},o.prototype.ConditionFormatPart=function(){return this.conditionFormatPart},o.prototype.ColorFormatPart=function(){return this.colorFormatPart},o.prototype.LocaleIDFormatPart=function(){return this.localeIDFormatPart},o.prototype.DBNumberFormatPart=function(){return this.dbNumberFormatPart},o.prototype.NumberStringConverter=function(n){var i=this;if(arguments.length===0)return i.numberFormat?i.numberFormat.NumberStringConverter():t;else i.numberFormat&&i.numberFormat.NumberStringConverter(n)},o.prototype.ExcelCompatibleFormatString=function(){var t=this,i="";return t.numberFormat&&t.numberFormat.ExcelCompatibleFormatString()&&(n.util.isCustomType(t.numberFormat,"NumberFormatDigital")||(t.DBNumberFormatPart()&&(i+=t.DBNumberFormatPart().toString()),t.LocaleIDFormatPart()&&(i+=t.LocaleIDFormatPart().toString()),t.ConditionFormatPart()&&(i+=t.ConditionFormatPart().toString()),t.ColorFormatPart()&&(i+=t.ColorFormatPart().toString())),i+=t.numberFormat.ExcelCompatibleFormatString()),i.toString()},o.prototype.Formatter=function(){return this.numberFormat},o.prototype.DateTimeFormatInfo=function(n){return arguments.length===0?this.Formatter().DateTimeFormatInfo():(this.Formatter().DateTimeFormatInfo(n),this.dateTimeFormatInfo=n,n)},o.prototype.NumberFormatInfo=function(n){return arguments.length===0?this.Formatter().NumberFormatInfo():(this.Formatter().NumberFormatInfo(n),this.numberFormatInfo=n,n)},o.prototype.AddPart=function(t){if(!t)throw new Error(n.SR.Exp_PartIsNull);var i=this;if(n.util.isCustomType(t,"ConditionFormatPart"))if(i.conditionFormatPart)throw new Error(n.SR.Exp_DuplicatedDescriptor);else i.conditionFormatPart=n.util.asCustomType(t,"ConditionFormatPart");else if(n.util.isCustomType(t,"ColorFormatPart"))if(i.colorFormatPart)throw new Error(n.SR.Exp_DuplicatedDescriptor);else i.colorFormatPart=n.util.asCustomType(t,"ColorFormatPart");else if(n.util.isCustomType(t,"LocaleIDFormatPart"))if(i.localeIDFormatPart)throw new Error(n.SR.Exp_DuplicatedDescriptor);else i.localeIDFormatPart=n.util.asCustomType(t,"LocaleIDFormatPart");else if(n.util.isCustomType(t,"DBNumberFormatPart"))if(i.dbNumberFormatPart)throw new Error(n.SR.Exp_DuplicatedDescriptor);else i.dbNumberFormatPart=n.util.asCustomType(t,"DBNumberFormatPart")},o.prototype.Format=function(n){return this.numberFormat.Format(n)},o.prototype.Parse=function(n){return this.numberFormat.Parse(n)},o}();y=function(){function s(i,f,e){var o=this,s;o.formatters=t;o.formatModeType=0;o.dateTimeFormatInfo=t;o.numberFormatInfo=t;o.isSingleFormatterInfo=!0;o.isDefault=!0;o.isConstructed=!1;o.cultureName=t;o.isCustomCultureSetted=!1;o.PropertyChanged=[];o._classNames=["GeneralFormatter","IFormatter","INotifyPropertyChanged","IColorFormatter"];r.IsNullOrEmpty(i)&&(i=u.General);f||(f=0);o.formatCached=i;o.formatModeType=f;o.isDefault=o.formatCached.toLowerCase()===u.General_Lower;o.isConstructed=!1;e?(s=n._CultureInfo.getCulture(e),o.cultureName=s.Name(),o.numberFormatInfo=s.NumberFormat(),o.dateTimeFormatInfo=s.DateTimeFormat(),o.isCustomCultureSetted=!0):o.cultureName=n._CultureInfo._currentCulture.Name()}return s._needChangeDefaultFormat=function(t){if(t){var i=n._CultureInfo._currentCulture.Name().toLowerCase(),r=t.cultureName.toLowerCase();return r===i||t.isCustomCultureSetted?!1:!0}else return!0},s.DefaultNumberFormatter=function(n){return s._needChangeDefaultFormat(this.defaultNumberFormatter)&&(this.defaultNumberFormatter=new s("###################0.################",0,n)),this.defaultNumberFormatter},s.DefaultGeneralFormatter=function(n){return s._needChangeDefaultFormat(this.defaultGeneralFormatter)&&(this.defaultGeneralFormatter=new s(t,t,n)),this.defaultGeneralFormatter},s.DefaultShortDatePatternFormatter=function(n){return s._needChangeDefaultFormat(this.defaultShortDatePatternFormatter)&&(this.defaultShortDatePatternFormatter=new s(i.DateTimeFormatInfo().shortDatePattern,t,n)),this.defaultShortDatePatternFormatter},s.DefaultSXDatetimePatternFormatter=function(n){var r=i.DateTimeFormatInfo().shortDatePattern+" h:mm:ss";return s._needChangeDefaultFormat(this.defaultSXDatetimePatternFormatter)&&(this.defaultSXDatetimePatternFormatter=new s(r,t,n)),this.defaultSXDatetimePatternFormatter},s.DefaultLongTimePatternFormatter=function(n){var r=i.DateTimeFormatInfo().longTimePattern;return s._needChangeDefaultFormat(this.defaultLongTimePatternFormatter)&&(this.defaultLongTimePatternFormatter=new s(r,t,n)),this.defaultLongTimePatternFormatter},s.DefaultDMMMFormatter=function(n){return s._needChangeDefaultFormat(this.defaultDMMMFormatter)&&(this.defaultDMMMFormatter=new s("d-mmm",0,n)),this.defaultDMMMFormatter},s.DefaultMMMYYFormatter=function(n){return s._needChangeDefaultFormat(this.defaultMMMYYFormatter)&&(this.defaultMMMYYFormatter=new s("mmm-yy",0,n)),this.defaultMMMYYFormatter},s.DefaultHMMFormatter=function(n){return s._needChangeDefaultFormat(this.defaultHMMFormatter)&&(this.defaultHMMFormatter=new s("h:mm",0,n)),this.defaultHMMFormatter},s.DefaultHMMSSFormatter=function(n){return s._needChangeDefaultFormat(this.defaultHMMSSFormatter)&&(this.defaultHMMSSFormatter=new s("h:mm:ss",0,n)),this.defaultHMMSSFormatter},s.DefaultHMMSS0Formatter=function(n){return s._needChangeDefaultFormat(this.defaultHMMSS0Formatter)&&(this.defaultHMMSS0Formatter=new s("h:mm:ss.0",0,n)),this.defaultHMMSS0Formatter},s.DefaultComboNumberFormatter1=function(n){return s._needChangeDefaultFormat(this.defaultComboNumberFormatter1)&&(this.defaultComboNumberFormatter1=new s(r.Format("{0}#,##0.00;[Red]({0}#,##0.00)",i.NumberFormatInfo().currencySymbol),t,n)),this.defaultComboNumberFormatter1},s.DefaultComboNumberFormatter2=function(n){return s._needChangeDefaultFormat(this.defaultComboNumberFormatter2)&&(this.defaultComboNumberFormatter2=new s(r.Format("{0}#,##0;[Red]({0}#,##0)",i.NumberFormatInfo().currencySymbol),t,n)),this.defaultComboNumberFormatter2},s.DefaultStandardNumberFormatter=function(n){return s._needChangeDefaultFormat(this.defaultStandardNumberFormatter)&&(this.defaultStandardNumberFormatter=new s("0.00E+00",0,n)),this.defaultStandardNumberFormatter},s.DefaultStandardPercentFormatter1=function(n){return s._needChangeDefaultFormat(this.defaultStandardPercentFormatter1)&&(this.defaultStandardPercentFormatter1=new s("0.00%",0,n)),this.defaultStandardPercentFormatter1},s.DefaultStandardPercentFormatter2=function(n){return s._needChangeDefaultFormat(this.defaultStandardPercentFormatter2)&&(this.defaultStandardPercentFormatter2=new s("0%",0,n)),this.defaultStandardPercentFormatter2},s.DefaultStandardGroupNumberFormatter1=function(n){return s._needChangeDefaultFormat(this.defaultStandardGroupNumberFormatter1)&&(this.defaultStandardGroupNumberFormatter1=new s("#,##0.00",0,n)),this.defaultStandardGroupNumberFormatter1},s.DefaultStandardGroupNumberFormatter2=function(n){return s._needChangeDefaultFormat(this.defaultStandardGroupNumberFormatter2)&&(this.defaultStandardGroupNumberFormatter2=new s("#,##0",0,n)),this.defaultStandardGroupNumberFormatter2},s.prototype.findDateTimeGeneralFormatter=function(i,r,u,f){var e,s,o;if(u&&u.length>0)for(e in u)if(u.hasOwnProperty(e)&&(s=u[e],o=n._DateTimeHelper.parseLocale(i,s),o&&o-r==0))return f();return t},s.prototype.toJSON=function(){var n=this,i={formatModeType:n.formatModeType,formatCached:n.formatCached},r,t,u;n.isCustomCultureSetted&&(i.customerCultureName=n.cultureName);r={};for(t in i)u=i[t],n._isDefaultValue(t,u)||(r[t]=u);return r},s.prototype._isDefaultValue=function(n,t){switch(n){case"formatModeType":return t===0;case"formatCached":return t==="General";default:return!1}},s.prototype.HasFormatedColor=function(){var n=this;return n.isDefault?!1:n.PositiveExpression()&&n.PositiveExpression().ColorFormatPart()?!0:n.NegativeExpression()&&n.NegativeExpression().ColorFormatPart()?!0:n.ZeroExpression()&&n.ZeroExpression().ColorFormatPart()?!0:n.TextExpression()&&n.TextExpression().ColorFormatPart()?!0:!1},s.prototype.IsDefaultFormat=function(){return this.isDefault},s.prototype.FormatString=function(f){var e=this,o,s,h,c;if(arguments.length===0){e.Init();o=t;switch(e.FormatMode()){case 0:if(e.formatters)for(s=0;s<e.formatters.length;s++)h=e.formatters[s],n.util.isCustomType(h,"CustomNumberFormat")&&(o==t?o="":o+=i.FormatSeparator,c=h.FormatString(),o+=c);break;case 1:if(n.util.isCustomType(e.formatters[0],"StandardDateTimeFormatter"))return e.formatters[0].FormatString();break;case 2:if(n.util.isCustomType(e.formatters[0],"StandardNumberFormatter"))return e.formatters[0].FormatString();break}return o?o:r.Empty}else{if(!f)throw new Error(n.SR.Exp_ValueIsNull);e.formatters=t;e.formatCached=f;e.isDefault=e.formatCached.toLowerCase()===u.General_Lower;e.isConstructed=!1;e.Init();e.RaisePropertyChanged("FormatString")}},s.prototype.DateTimeFormatInfo=function(t){var r=this,u,f,e;if(arguments.length===0)return(r.Init(),r.dateTimeFormatInfo)?r.dateTimeFormatInfo:i.DateTimeFormatInfo();else{if(r.Init(),r.dateTimeFormatInfo=t,r.formatters)for(u=0;u<r.formatters.length;u++)f=r.formatters[u],n.util.isCustomType(f,"IFormatProviderSupport")&&(e=f,e.DateTimeFormatInfo(t));return r.RaisePropertyChanged("DateTimeFormatInfo"),t}},s.prototype.NumberFormatInfo=function(t){var r=this,u,f,e;if(arguments.length===0)return(r.Init(),r.numberFormatInfo)?r.numberFormatInfo:i.NumberFormatInfo();else{if(r.Init(),r.numberFormatInfo=t,r.formatters)for(u=0;u<r.formatters.length;u++)f=r.formatters[u],n.util.isCustomType(f,"IFormatProviderSupport")&&(e=f,e.NumberFormatInfo(t));return r.RaisePropertyChanged("NumberFormatInfo"),t}},s.prototype.FormatMode=function(n){return arguments.length===0?this.formatModeType:(this.formatModeType=n,this.RaisePropertyChanged("FormatMode"),n)},s.prototype.ExcelCompatibleFormatString=function(){var u=this,f,e,o,s;u.Init();f=t;switch(u.FormatMode()){case 0:if(u.formatters)for(e=0;e<u.formatters.length;e++)o=u.formatters[e],n.util.isCustomType(o,"CustomNumberFormat")&&(f==t?f="":f+=i.FormatSeparator,s=o.ExcelCompatibleFormatString(),f+=s);break;case 1:if(n.util.isCustomType(u.formatters[0],"StandardDateTimeFormatter"))return u.formatters[0].ExcelCompatibleFormatString();break;case 2:if(n.util.isCustomType(u.formatters[0],"StandardNumberFormatter"))return u.formatters[0].ExcelCompatibleFormatString();break}return f?f.toString():r.Empty},s.prototype.PositiveExpression=function(){var i=this;return(i.Init(),i.formatters&&i.formatters.length>0)?n.util.asCustomType(i.formatters[0],"CustomNumberFormat"):t},s.prototype.NegativeExpression=function(){var i=this;return(i.Init(),i.formatters&&i.formatters.length>1)?n.util.asCustomType(i.formatters[1],"CustomNumberFormat"):t},s.prototype.ZeroExpression=function(){var i=this;return(i.Init(),i.formatters&&i.formatters.length>2)?n.util.asCustomType(i.formatters[2],"CustomNumberFormat"):t},s.prototype.TextExpression=function(){var i=this;return(i.Init(),i.formatters&&i.formatters.length>3)?n.util.asCustomType(i.formatters[3],"CustomNumberFormat"):t},s.prototype.GetFormatType=function(t){var i,r;if(this.Init(),i=this.GetFormatInfo(t),n.util.isCustomType(i,"CustomNumberFormat")){if(r=i.Formatter(),n.util.isCustomType(r,"NumberFormatDigital"))return 1;else if(n.util.isCustomType(r,"NumberFormatDateTime"))return 2;else if(n.util.isCustomType(r,"NumberFormatText"))return 3}else if(n.util.isCustomType(i,"NumberFormatDigital")||n.util.isCustomType(i,"StandardNumberFormatter"))return 1;else if(n.util.isCustomType(i,"NumberFormatDateTime")||n.util.isCustomType(i,"StandardDateTimeFormatter"))return 2;else if(n.util.isCustomType(i,"NumberFormatText"))return 3;return 0},s.prototype.GetPreferredEditingFormatter=function(t){var i,r,u;return this.Init(),i=this.isCustomCultureSetted?this.cultureName:f,n.util.isType(t,"DateTime")?(r=new n._DateTimeHelper(t),r.Hour()===0&&r.Minute()===0&&r.Second()===0&&r.Millisecond()===0?s.DefaultShortDatePatternFormatter(i):s.DefaultSXDatetimePatternFormatter(i)):n.util.isType(t,"TimeSpan")?s.DefaultLongTimePatternFormatter(i):n.FormatConverter.IsNumber(t)?(u=n.FormatConverter.ToDouble(t),u>1e20?new s("0.##E+00",0,i):s.DefaultNumberFormatter(i)):n.util.isType(t,"string")?s.DefaultGeneralFormatter(i):s.DefaultGeneralFormatter(i)},s.prototype.GetPreferredDisplayFormatter=function(u,o){var c=this,h,a,l,v;if(o||(o={value:t}),o.value=t,c.Init(),h=this.isCustomCultureSetted?this.cultureName:f,r.IsNullOrEmpty(u))return new s(t,t,h);if(a=u,l=o.value=c.Parse(a),n.util.isType(l,"DateTime")||n.util.isType(l,"TimeSpan")){if((v=c.findDateTimeGeneralFormatter(u,l,e.GeneralMonthDay(),function(){return s.DefaultDMMMFormatter(h)}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralYearMonth(),function(){return s.DefaultMMMYYFormatter(h)}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralYearMonthDay(),function(){return s.DefaultShortDatePatternFormatter(h)}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralHourMinute(),function(){return s.DefaultHMMFormatter(h)}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralHourMinuteSecond(),function(){return s.DefaultHMMSSFormatter(h)}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralHourMinuteSecondSubSecond(),function(){return s.DefaultHMMSS0Formatter(h)}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralHourMinuteWithDate(),function(){return s._needChangeDefaultFormat(s.defaultShortDatePatternHMMFormatter)&&(s.defaultShortDatePatternHMMFormatter=new s(c.DateTimeFormatInfo().shortDatePattern+" h:mm",t,h)),s.defaultShortDatePatternHMMFormatter}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralHourMinuteSecondWithDate(),function(){return s._needChangeDefaultFormat(s.defaultShortDatePatternHMMSSFormatter)&&(s.defaultShortDatePatternHMMSSFormatter=new s(c.DateTimeFormatInfo().shortDatePattern+" h:mm:ss",t,h)),s.defaultShortDatePatternHMMSSFormatter}))||(v=c.findDateTimeGeneralFormatter(u,l,e.GeneralHourMinuteSecondSubSecondWithDate(),function(){return s._needChangeDefaultFormat(s.defaultShortDatePatternHMMSS0Formatter)&&(s.defaultShortDatePatternHMMSS0Formatter=new s(c.DateTimeFormatInfo().shortDatePattern+" h:mm:ss.0",t,h)),s.defaultShortDatePatternHMMSS0Formatter})))return v}else if(n.FormatConverter.IsNumber(l)){var y=i.NumberFormatInfo(),p=y&&y.numberDecimalSeparator||i.DecimalSeparator,w=y&&y.numberGroupSeparator||i.numberGroupSeparator;if(a[0]===i.NumberFormatInfo().currencySymbol[0])return n.StringHelper.Contains(a,p)?s.DefaultComboNumberFormatter1(h):s.DefaultComboNumberFormatter2(h);else if(n.StringHelper.IndexOf(a,"e",1)>-1)return s.DefaultStandardNumberFormatter(h);else if(a[0].toString()===i.percentSymbol||a[a.length-1].toString()===i.percentSymbol)return n.StringHelper.Contains(a,p)?s.DefaultStandardPercentFormatter1(h):s.DefaultStandardPercentFormatter2(h);else if(n.StringHelper.Contains(a,w))return n.StringHelper.Contains(a,p)?s.DefaultStandardGroupNumberFormatter1(h):s.DefaultStandardGroupNumberFormatter2(h)}return s.DefaultGeneralFormatter(h)},s.prototype.Format=function(u,e){var s,v,c,l,h,a;if(n.util.isType(u,"boolean"))return u.toString().toUpperCase();if(e&&(e.value=t),this.Init(),s=this.GetFormatInfo(u),n.util.isCustomType(s,"CustomNumberFormat")&&(v=s.ColorFormatPart(),e&&v&&(e.value=v.ForeColor())),c=0,l=n.FormatConverter.IsNumber(u,this.NumberFormatInfo()),l&&(c=n.FormatConverter.ToDouble(u)),s){if(h=t,l&&s===this.NegativeExpression())h=s.Format(o(c)),n.util.isCustomType(s,"CustomNumberFormat")&&(a=n.util.asCustomType(s,"CustomNumberFormat"),a&&a.ConditionFormatPart()&&a.ConditionFormatPart().Value()>0&&c<0&&(h=i.negativeSign+h));else try{h=s.Format(u)}catch(y){n.util.isType(u,"string")&&(h=u.toString())}return h?h:r.Empty}else return l&&c<0?i.HyphenMinus.toString():n.util.isType(u,"string")?u.toString():u===f||u===t?r.Empty:u.toString()},s.prototype.Parse=function(n){var i=this;return(i.Init(),i.formatters&&i.formatters.length>0)?i.formatters[0].Parse(n):t},s.prototype.Init=function(){var n=this;if(!n.isConstructed){n.isConstructed=!0;switch(n.formatModeType){case 0:n.InitExcelCompatibleMode(n.formatCached);break;case 1:n.InitStandardDateTimeMode(n.formatCached);break;case 2:n.InitStandardNumericMode(n.formatCached);break}}},s.prototype.InitStandardDateTimeMode=function(i){var r=new b(i,this.isCustomCultureSetted?this.cultureName:t);if(r.EvaluateFormat(i))this.formatters=[],this.formatters.push(r);else throw new Error(n.SR.Exp_FormatIllegal);},s.prototype.InitStandardNumericMode=function(i){var r=new k(i,this.isCustomCultureSetted?this.cultureName:t);if(r.EvaluateFormat(i))this.formatters=[],this.formatters.push(r);else throw new Error(n.SR.Exp_FormatIllegal);},s.prototype.InitExcelCompatibleMode=function(u){var f,e,s,o,h;if(r.IsNullOrEmpty(u))throw new Error(n.SR.Exp_FormatIllegal);if(f=this,f.formatters=[],f.isDefault)f.formatters.push(new g);else{if(f.isSingleFormatterInfo=!n.StringHelper.Contains(u,i.FormatSeparator.toString()),e=u.split(i.FormatSeparator),!e)throw new Error(n.SR.Exp_FormatIllegal);if(e.length<1||e.length>5)throw new Error(n.SR.Exp_FormatIllegal);for(s=0,o=0;o<e.length;o++){if(s++,s>4)break;h=new g(e[o],f.isCustomCultureSetted?f.cultureName:t);h&&f.formatters.push(h)}if(!f.PositiveExpression())throw new Error(n.SR.Exp_FormatIllegal);}},s.prototype.GetFormatInfo=function(i){var r=this;if(r.FormatMode()===0){if(typeof i=="string"&&isNaN(i))return r.TextExpression()?r.TextExpression():r.PositiveExpression();else if(n.FormatConverter.IsNumber(i,this.NumberFormatInfo())||n.util.isType(i,"boolean")){var f=r.PositiveExpression(),o=r.NegativeExpression(),e=n.FormatConverter.ToDouble(i),s=f&&f.ConditionFormatPart(),h=o&&o.ConditionFormatPart(),u=r.isSingleFormatterInfo?f:t;return f&&(s?f.ConditionFormatPart().IsMeetCondition(e)&&(u=f):(e>0||e===0&&!r.ZeroExpression())&&(u=f)),!u&&r.NegativeExpression()&&(h?o.ConditionFormatPart().IsMeetCondition(e)&&(u=o):e<0&&(u=o)),!u&&r.ZeroExpression()&&e===0&&(u=r.ZeroExpression()),!u&&r.ZeroExpression()&&(u=r.ZeroExpression()),!u&&r.NegativeExpression()&&(u=r.NegativeExpression()),u}}else if((r.FormatMode()===1||r.FormatMode()===2)&&r.formatters&&r.formatters.length===1)return r.formatters[0];return t},s.prototype.RaisePropertyChanged=function(n){var t=this,i,r;if(t.PropertyChanged)for(i=0;i<t.PropertyChanged.length;i++)r=t.PropertyChanged[i],typeof r=="function"&&r(t,n)},s.defaultNumberFormatter=t,s.defaultGeneralFormatter=t,s.defaultShortDatePatternFormatter=t,s.defaultLongTimePatternFormatter=t,s.defaultSXDatetimePatternFormatter=t,s.defaultDMMMFormatter=t,s.defaultMMMYYFormatter=t,s.defaultHMMFormatter=t,s.defaultHMMSSFormatter=t,s.defaultHMMSS0Formatter=t,s.defaultShortDatePatternHMMFormatter=t,s.defaultShortDatePatternHMMSSFormatter=t,s.defaultShortDatePatternHMMSS0Formatter=t,s.defaultComboNumberFormatter1=t,s.defaultComboNumberFormatter2=t,s.defaultStandardNumberFormatter=t,s.defaultStandardPercentFormatter1=t,s.defaultStandardPercentFormatter2=t,s.defaultStandardGroupNumberFormatter1=t,s.defaultStandardGroupNumberFormatter2=t,s}();n.GeneralFormatter=y;var s=function(){function n(n){this._classNames=["FormatPartBase"];this.originalToken=n}return n.prototype.OriginalToken=function(){return this.originalToken},n.prototype.SupportedPartFormat=function(){return n._supportedPartFormat||(n._supportedPartFormat=["ConditionFormatPart","ColorFormatPart","LocaleIDFormatPart"]),n._supportedPartFormat},n.Create=function(n){return ut.EvaluateFormat(n)?new ut(n):ot.EvaluateFormat(n)?new ot(n):ht.EvaluateFormat(n)?new ht(n):et.EvaluateFormat(n)?new et(n):ft.EvaluateFormat(n)?new ft(n):t},n}(),ut=function(u){function f(f){var e,h,v,y,a;if(u.call(this,f),e=this,s.call(e,f),e._classNames.push("ConditionFormatPart"),e._initFileds(),h=i.TrimSquareBracket(f),r.IsNullOrEmpty(h))throw new Error(n.SR.Exp_TokenIllegal);for(var o="",c=0,l=t;c<h.length;c++)if(l=h[c],i.IsOperator(l))o+=l;else break;if(!o)throw new Error(n.SR.Exp_TokenIllegal);v=o;o="";switch(v){case"<":e.compareOperator=4;break;case"<=":e.compareOperator=5;break;case"=":e.compareOperator=0;break;case">=":e.compareOperator=3;break;case">":e.compareOperator=2;break;case"<>":e.compareOperator=1;break;default:throw new Error(n.SR.Exp_TokenIllegal);}for(;c<h.length;c++){if(l=h[c],i.IsOperator(l))throw new Error(n.SR.Exp_TokenIllegal);o+=l}if(!o)throw new Error(n.SR.Exp_TokenIllegal);if(y=o,a=parseFloat(y),isNaN(a))throw new Error(n.SR.Exp_TokenIllegal);else e.value=a}return __extends(f,u),f.prototype._initFileds=function(){this.value=0;this.compareOperator=t},f.prototype.CompareOperator=function(){return this.compareOperator},f.prototype.Value=function(){return this.value},f.prototype.toString=function(){var n="";switch(this.compareOperator){case 0:n+="=";break;case 2:n+=">";break;case 3:n+=">=";break;case 4:n+="<";break;case 5:n+="<=";break;case 1:n+="<>";break;default:throw new Error;}return n+=this.value.toString(),i.AddSquareBracket(n)},f.prototype.IsMeetCondition=function(n){var t=this;switch(t.compareOperator){case 0:return n===t.value;case 2:return n>t.value;case 3:return n>=t.value;case 4:return n<t.value;case 5:return n<=t.value;case 1:return n!==t.value}return!1},f.EvaluateFormat=function(n){if(!n||n===r.Empty)return!1;var t=i.TrimSquareBracket(n);return!t||t===r.Empty?!1:i.IsOperator(t[0])},f}(s),ft=function(u){function f(f){var o,e,h,c;if(u.call(this,f),this.foreColor="black",this.index=-1,this.colorName=t,o=this,s.call(o,f),o._classNames.push("ColorFormatPart"),e=i.TrimSquareBracket(f),!e||e===r.Empty)throw new Error(n.SR.Exp_TokenIllegal);try{o.foreColor=e;o.colorName=e;return}catch(l){}if(!(e.length>5)||(e=n.StringHelper.Remove(e,0,5),h=-1,c=parseInt(e,10),isNaN(c)||(h=c,!(h>=1)||!(h<=56))))throw new Error(n.SR.Exp_TokenIllegal);}return __extends(f,u),f.prototype.ForeColor=function(){return this.foreColor},f.prototype.toString=function(){var n=this;if(n.index>-1)return i.AddSquareBracket("Color"+n.index);else if(n.colorName)return i.AddSquareBracket(n.colorName);throw new Error;},f.EvaluateFormat=function(t){if(!t||t===r.Empty)return!1;var u=i.TrimSquareBracket(t);return!u||u===r.Empty?!1:u.length<3?!1:isNaN(t[t.length-1])?t[0]!==t[1]:n.StringHelper.StartsWith(t,"Color",1)},f}(s),et=function(u){function f(t){var i,r,e;if(u.call(this,t),i=this,s.call(i,t),i._classNames.push("ABSTimeFormatPart"),i._initFileds(),f.EvaluateFormat(t))if(i.token=t.toLowerCase(),i.token[1]===f.HoursABSContent)i.type=0;else if(i.token[1]===f.MinuteABSContent)i.type=1;else if(i.token[1]===f.SecondABSContent)i.type=2;else throw new Error(n.SR.Exp_TokenIllegal);else throw new Error(n.SR.Exp_TokenIllegal);for(r="",e=0;e<i.token.length-2;e++)r+="0";i.formatString=r}return __extends(f,u),f.prototype._initFileds=function(){this.token=t;this.type=t;this.formatString=t},f.prototype.FormatString=function(){return this.formatString},f.prototype.TimePartType=function(){return this.type},f.prototype.Token=function(){return this.token},f.EvaluateFormat=function(n){var u,e,o,s;if(!n||n===r.Empty||(u=i.TrimSquareBracket(n),!u||u===r.Empty))return!1;for(u=u.toLowerCase(),e=t,o=0;o<u.length;o++)if((e||(e=u[o]),s=f,e!==s.HoursABSContent&&e!==s.MinuteABSContent&&e!==s.SecondABSContent)||e!==u[o])return!1;return!0},f.HoursABSContent="h",f.MinuteABSContent="m",f.SecondABSContent="s",f}(s),l=function(){function n(n,i){var f=this,o,e,u;if(f._classNames=["DBNumber"],o=t,e=t,n)for(f.units=[],u=0;u<n.length;u++)e=n[u],e===0?f.units.push(r.Empty):f.units.push(String.fromCharCode(e));if(i)for(f.numbers=[],u=0;u<i.length;u++)e=i[u],e===0?f.numbers.push(r.Empty):f.numbers.push(String.fromCharCode(e))}return n.ChineseDBNum1=function(){return n.chineseDBNum1||(n.chineseDBNum1=new n(n.ChineseNumberUnitLetter1,n.ChineseNumberLetterValues1)),n.chineseDBNum1},n.ChineseDBNum2=function(){return n.chineseDBNum2||(n.chineseDBNum2=new n(n.ChineseNumberUnitLetter2,n.ChineseNumberLetterValues2)),n.chineseDBNum2},n.ChineseDBNum3=function(){return n.chineseDBNum3||(n.chineseDBNum3=new n(t,n.ChineseNumberLetterValues3)),n.chineseDBNum3},n.JapaneseDBNum1=function(){return n.japaneseDBNum1||(n.japaneseDBNum1=new n(n.JapaneseNumberUnitLetter1,n.JapaneseNumberLetterValues1)),n.japaneseDBNum1},n.JapaneseDBNum2=function(){return n.japaneseDBNum2||(n.japaneseDBNum2=new n(n.JapaneseNumberUnitLetter2,n.JapaneseNumberLetterValues2)),n.japaneseDBNum2},n.JapaneseDBNum3=function(){return n.japaneseDBNum3||(n.japaneseDBNum3=new n(t,n.JapaneseNumberLetterValues3)),n.japaneseDBNum3},n.prototype.Units=function(){return this.units},n.prototype.Numbers=function(){return this.numbers},n.chineseDBNum1=t,n.chineseDBNum2=t,n.chineseDBNum3=t,n.ChineseNumberUnitLetter1=[20806,21315,30334,21313,20159,21315,30334,21313,19975,21315,30334,21313,0],n.ChineseNumberUnitLetter2=[20806,20191,20336,25342,20159,20191,20336,25342,19975,20191,20336,25342,0],n.ChineseNumberLetterValues1=[9675,19968,20108,19977,22235,20116,20845,19971,20843,20061],n.ChineseNumberLetterValues2=[38646,22777,36144,21441,32902,20237,38470,26578,25420,29590],n.ChineseNumberLetterValues3=[65296,65297,65298,65299,65300,65301,65302,65303,65304,65305],n.japaneseDBNum1=t,n.japaneseDBNum2=t,n.japaneseDBNum3=t,n.JapaneseNumberUnitLetter1=[20806,21315,30334,21313,20740,21315,30334,21313,19975,21315,30334,21313,0],n.JapaneseNumberUnitLetter2=[20806,38433,30334,25342,20740,38433,30334,25342,33836,38433,30334,25342,0],n.JapaneseNumberLetterValues1=[12295,19968,20108,19977,22235,20116,20845,19971,20843,20061],n.JapaneseNumberLetterValues2=[12295,22769,24336,21442,22235,20237,20845,19971,20843,20061],n.JapaneseNumberLetterValues3=[65296,65297,65298,65299,65300,65301,65302,65303,65304,65305],n}(),ot=function(u){function f(r){var e,o,s;if(u.call(this,r),this.token=t,this.type=0,e=this,e._classNames.push("DBNumberFormatPart"),f.EvaluateFormat(r)){if(e.token=r,o=i.TrimSquareBracket(r),s=n.StringHelper.Remove(o,0,5),e.type=parseInt(s,10),e.type<0||e.type>3)throw new Error(n.SR.Exp_TokenIllegal);}else throw new Error(n.SR.Exp_TokenIllegal);}return __extends(f,u),f.prototype.Token=function(){return this.token?this.token:r.Empty},f.prototype.Type=function(){return this.type},f.prototype.ReplaceNumberString=function(u,f,e){var l,p;if(!u||u===r.Empty)return u;var h=u,w=u,s=-1,o=-1,a=!1,c=t,v=t,y=t;for(l=u.length-1;l>=0;l--)p=w[l],isNaN(p)&&(!i.IsEquals(p,i.DecimalSeparator,!1)||a)?o>-1&&s>-1&&(c=w.substr(o,s-o+1),v=parseFloat(c),isNaN(v)||(y=this.NumberString(c,f,e),h=n.StringHelper.Remove(h,o,s-o+1),h=n.StringHelper.Insert(h,o,y)),s=-1,o=-1,a=!1):(i.IsEquals(p,i.DecimalSeparator,!1)&&(a=!0),s===-1&&(s=l),o=l);return o>-1&&s>-1&&(c=w.substr(o,s-o+1),v=parseFloat(c),isNaN(v)||(y=this.NumberString(c,f,e),h=n.StringHelper.Remove(h,o,s-o+1),h=n.StringHelper.Insert(h,o,y)),s=-1,o=-1,a=!1),h},f.prototype.NumberString=function(i,r,u){var e=i.split("."),o,s;if(e)if(e.length===1)return f.FormatNumberString(e[0],r.Numbers(),u?r.Units():t);else if(e.length===2)return o=f.FormatNumberString(e[0],r.Numbers(),u?r.Units():t),s=f.FormatNumberString(e[1],r.Numbers()),o+"."+s;throw new Error(n.SR.Exp_ValueIllegal);},f.prototype.toString=function(){if(this.type>-1)return i.AddSquareBracket("DBNum"+this.type);throw new Error;},f.EvaluateFormat=function(t){if(!t||t===r.Empty)return!1;var u=i.TrimSquareBracket(t);return!u||u===r.Empty?!1:n.StringHelper.StartsWith(u,"DBNum",1)?!0:!1},f.FormatNumberString=function(n,i,u){var w=n,v=0,a=t,y=0,k,g,nt,b,e,c,h,it,tt;if(arguments.length===2){for(k="",v=0;v<w.length;v++)a=w.substr(v,1),y=parseInt(a,10),k+=i[y];return k}else if(arguments.length===3){if(!u)return f.FormatNumberString(n,i);var o=0,d="",l=w.length,p=!1,s=[];for(v=0;v<l;v++)g=u.length-1-v,g>-1?s.push(u[g].toString()):s.push(r.Empty);for(nt=[],e=s.length-1;e>=0;e--)nt[s.length-e-1]=s[e];for(s=nt,b=!1,e=0;e<l;e++)a=w.substr(e,1),y=parseInt(a,10),c=r.Empty,h=r.Empty,l-e-16>0?(c=i[y],h="",b=!0):e!==l-1&&e!==l-5&&e!==l-9&&e!==l-13?a==="0"?(c="",h="",o=o+1):a!=="0"&&o!==0?(c=i[0]+i[y],h=s[e],o=0):(c=i[y],h=s[e],o=0):a!=="0"&&o!==0?(c=i[0]+i[y],h=s[e],o=0):a!=="0"&&o===0||b?(c=i[y],h=s[e],o=0,b=!1):a==="0"&&o>=3?(c="",h="",o=o+1):l>=11?(c="",o=o+1):(c="",h=s[e],o=o+1),it=c+h===r.Empty,it||(p=!1),e!==l-13||p||(h=s[e],p=!0),e!==l-9||p||(h=s[e],p=!0),e===l-1&&(h=s[e],p=!0),d=d+c+h;return(tt=parseInt(n,10),!isNaN(tt)&&tt===0)?i[0]:d}},f}(s),p=function(){function t(){}return t.ParseHexString=function(t){if(!t||t===r.Empty)throw new Error(n.SR.Exp_StringIllegal);return parseInt(t,16)},t.FixJapaneseChars=function(n){return n},t.GetFraction=function(n,t,i,r,u){var l=0,y=0,p=0,f=0,s,h,a,v,e;for(n>0?(f=n-c(n)+1,f==1?(f=0,l=n):l=c(n)-1):n<0&&(l=c(n),f=c(n)-n),s=2,h=9,s=nt(10,t-1),h=nt(10,t)-1,s<2&&(s=2),h<2&&(h=2),a=!1,v=0,e=s;e<=h;e++){var d=e*f,w=vt(d),b=w/e,k=o(b-f);if((a?k<o(v-f):!0)&&(a=!0,v=b,y=w,p=e,k<1e-5))break}return i.value=l,r.value=y,u.value=p,a},t}(),st=function(){function t(){}return t.AllowScience=function(n){return n?!(n.indexOf("ja")===0)&&!(n.indexOf("zh")===0):!0},t.CreateCultureInfo=function(i){switch(i){case 1033:return n._CultureInfo.getCulture(t.EnglishUnitedStates);case 1041:return n._CultureInfo.getCulture(t.JapanneseJapan);case 2052:return n._CultureInfo.getCulture(t.ChinesePRC);default:return n._CultureInfo.currentCulture()}},t.JapanneseJapan="ja-JP",t.EnglishUnitedStates="en-US",t.ChinesePRC="zh-cn",t}(),ht=function(u){function f(f){var o,e,h;if(u.call(this,f),this.currencySymbol=t,this.locateID=-1,this.cultureInfo=t,this.content=t,o=this,s.call(o,f),o._classNames.push("LocaleIDFormatPart"),!f)throw new Error(n.SR.Exp_TokenIsNull);if(f===r.Empty)throw new Error(n.SR.Exp_TokenIllegal);if(o.content=i.TrimSquareBracket(f),e=o.content,!e||e===r.Empty)throw new Error(n.SR.Exp_TokenIllegal);if(i.IsEquals(e[0],i.Dollar,!1))e=n.StringHelper.Remove(e,0,1);else throw new Error(n.SR.Exp_TokenIllegal);if(h=e.indexOf(i.HyphenMinus),h>-1)o.currencySymbol=e.substr(0,h),e=n.StringHelper.Remove(e,0,h);else{o.currencySymbol=e;return}if(i.IsEquals(e[0],i.HyphenMinus,!1))e=n.StringHelper.Remove(e,0,1);else throw new Error(n.SR.Exp_TokenIllegal);if(e.length>0)o.locateID=p.ParseHexString(e);else throw new Error(n.SR.Exp_TokenIllegal);}return __extends(f,u),f.prototype.CultureInfo=function(){var n=this;return n.cultureInfo||(n.cultureInfo=st.CreateCultureInfo(n.locateID),n.currencySymbol&&n.currencySymbol!==r.Empty&&n.cultureInfo&&!n.cultureInfo.NumberFormat().isReadOnly&&(n.cultureInfo.NumberFormat().currencySymbol=n.currencySymbol)),n.cultureInfo},f.prototype.CurrencySymbol=function(){return this.currencySymbol?this.EncodeSymbol(this.currencySymbol):r.Empty},f.prototype.AllowScience=function(){if(this.cultureInfo)return st.AllowScience(this.cultureInfo.Name())},f.prototype.GetDBNumber=function(n){var i=this.locateID&255;switch(i){case 4:switch(n){case 1:return l.ChineseDBNum1();case 2:return l.ChineseDBNum2();case 3:return l.ChineseDBNum3()}break;case 17:switch(n){case 1:return l.JapaneseDBNum1();case 2:return l.JapaneseDBNum2();case 3:return l.JapaneseDBNum3()}break;default:break}return t},f.prototype.toString=function(){return this.content?i.AddSquareBracket(this.content):r.Empty},f.prototype.EncodeSymbol=function(t){return n.StringHelper.Replace(t,"\\.","'.'")},f.EvaluateFormat=function(n){if(!n||n===r.Empty)return!1;var t=i.TrimSquareBracket(n);return!t||t===r.Empty?!1:i.IsEquals(t[0],i.Dollar,!1)},f}(s),ct=function(){function r(){}return r.prototype.ConvertTo=function(r,u,f,e,o){var s=r,c;return e!=t&&o!=t&&u instanceof Date&&(c=e.GetDBNumber(o.Type()),s=o.ReplaceNumberString(s,c,!0),o.Type()===1&&(s=s.replace(new RegExp(yt,"g"),pt)),s=s.replace(i.ReplacePlaceholder+h.YearFourDigit,new n._DateTimeHelper(u).localeFormat(h.YearFourDigit)),s=s.replace(i.ReplacePlaceholder+h.YearTwoDigit,new n._DateTimeHelper(u).localeFormat(h.YearTwoDigit)),s=o.ReplaceNumberString(s,c,!1)),s},r}(),h=function(e){function o(n,i,r,f,o){e.call(this,r,f,o);this.baseNumberStringConverter=u.prototype.NumberStringConverter;this.baseDateTimeFormatInfo=u.prototype.DateTimeFormatInfo;this.baseCultureName=u.prototype.CultureName;var s=this;s.validDateTimeFormatString=t;s.formatString=t;s.hasJD=!1;s.absoluteTime=t;s.absTimeParts=t;s.hasYearDelay=!1;s.exactlyMatch=!1;s._classNames.push("NumberFormatDateTime");s.exactlyMatch=!1;s.formatString=s.FixFormat(u.TrimNotSupportSymbol(n));s.absTimeParts=i;s._init(n,i,r,f)}return __extends(o,e),o.EvaluateFormat=function(n){return u.ContainsKeywords(n,o.keyWords,o.keyWordsSet())},o.prototype._init=function(t,r,u,f){var s=this,e={value:s.formatString},h=o,a,c,l;if(h.EvaluateFormat(e.value)){if(a=s.ProcessAMPM(e),s.hasJD=s.Replace(e.value,h.MonthJD,'"'+h.PlaceholderMonthJD+'"',!0,!1,e,!1,!1),s.Replace(e.value,h.MonthUnabbreviated,h.StandardMonthUnabbreviated,!0,!1,e,!1,!1),s.Replace(e.value,h.MonthAbbreviation,h.StandardMonthAbbreviation,!0,!1,e,!1,!1),s.Replace(e.value,h.MonthTwoDigit,h.StandardMonthTwoDigit,!0,!1,e,!1,!1),s.Replace(e.value,h.MonthSingleDigit,h.StandardMonthSingleDigit,!0,!1,e,!1,!1),s.Replace(e.value,h.DayWeekDayAbbreviation,h.StandardDayWeekDayAbbreviation,!0,!0,e,!1,!0),s.Replace(e.value,h.DayWeekDayUnabbreviated,h.StandardDayWeekDayUnabbreviated,!0,!0,e,!1,!0),s.Replace(e.value,h.MinuteSingleDigit,h.StandardMinuteSingleDigit,!1,!0,e,!1,!1),a||(s.Replace(e.value,h.HoursSingleDigit,h.StandardHourSingleDigit,!0,!0,e,!1,!1),s.Replace(e.value,h.HoursTwoDigit,h.StandardHourTwoDigit,!0,!0,e,!1,!1)),s.Replace(e.value,h.SecondSingleDigit,h.StandardSecondSingleDigit,!0,!0,e,!1,!0),s.PartDBNumberFormat()&&s.PartLocaleID()&&(s.hasYearDelay=s.hasYearDelay||s.Replace(e.value,h.YearFourDigit,'"'+i.ReplacePlaceholder+h.YearFourDigit+'"',!0,!1,e,!1,!0),s.hasYearDelay=s.hasYearDelay||s.Replace(e.value,h.YearTwoDigit,'"'+i.ReplacePlaceholder+h.YearTwoDigit+'"',!0,!1,e,!1,!0)),s.absTimeParts)for(c=0;c<s.absTimeParts.length;c++)l=s.absTimeParts[c],s.Replace(e.value,l.token,i.ReplacePlaceholder+l.token,!0,!0,e,!1,!0);s.validDateTimeFormatString=e.value}else throw new Error(n.SR.Exp_FormatIllegal);},o.prototype._isJanpaneseCulture=function(){var i=this.PartLocaleID();if(i!==t&&i.CultureInfo()!==t){if(i.CultureInfo()===n._CultureInfo.jaCulture())return!0}else if(this.CultureName()===n._CultureInfo.jaCulture().Name())return!0;return!1},o.prototype.NumberStringConverter=function(n){return arguments.length===0?this.baseNumberStringConverter()?this.baseNumberStringConverter():o.defaultDateTimeNumberStringConverter:(this.baseNumberStringConverter(n),n)},o.prototype.AbsoluteTime=function(){return this.absoluteTime?this.absoluteTime:o.defaultAbsoluteTime},o.prototype.FormatString=function(){return this.formatString},o.prototype.DateTimeFormatInfo=function(t){var r=this;return arguments.length===0?r.baseDateTimeFormatInfo()?r.baseDateTimeFormatInfo():r.PartLocaleID()&&r.PartLocaleID().CultureInfo()?r.PartLocaleID().CultureInfo().DateTimeFormat():r.baseCultureName()?n._CultureInfo.getCulture(r.baseCultureName()).DateTimeFormat():i.DateTimeFormatInfo():(r.baseDateTimeFormatInfo(t),t)},o.prototype.ExcelCompatibleFormatString=function(){var t=this,i=t.formatString,n=o,r={value:i};return t.Replace(i,n.StandardAMPMSingleDigit,t.CurrentAMPM(),!0,!0,r,!1,!0),t.Replace(i,n.StandardMonthUnabbreviated,n.MonthUnabbreviated,!0,!1,r,!1,!0),t.Replace(i,n.StandardMonthAbbreviation,n.MonthAbbreviation,!0,!1,r,!1,!0),t.Replace(i,n.StandardMonthTwoDigit,n.MonthTwoDigit,!0,!1,r,!1,!0),t.Replace(i,n.StandardMonthSingleDigit,n.MonthSingleDigit,!0,!1,r,!1,!0),t.Replace(i,n.StandardDayWeekDayAbbreviation,n.DayWeekDayAbbreviation,!0,!0,r,!1,!0),t.Replace(i,n.StandardDayWeekDayUnabbreviated,n.DayWeekDayUnabbreviated,!0,!0,r,!1,!0),t.Replace(i,n.StandardMinuteSingleDigit,n.MinuteSingleDigit,!1,!0,r,!1,!0),t.Replace(i,n.StandardHourSingleDigit,n.HoursSingleDigit,!0,!0,r,!1,!1),t.Replace(i,n.StandardHourTwoDigit,n.HoursTwoDigit,!0,!0,r,!1,!1),t.Replace(i,n.StandardSecondSingleDigit,n.SecondSingleDigit,!0,!0,r,!1,!0),t.Replace(i,n.StandardSubSecondThreeDigit,n.SubSecondThreeDigit,!0,!0,r,!1,!0),t.Replace(i,n.StandardSubSecondTwoDigit,n.SubSecondTwoDigit,!0,!0,r,!1,!0),t.Replace(i,n.StandardSubSecondSingleDigit,n.SubSecondSingleDigit,!0,!0,r,!1,!0),r.value},o.prototype.CurrentAMPM=function(){var n=t;return(n=this.DateTimeFormatInfo()?this.DateTimeFormatInfo():i.DateTimeFormatInfo(),n&&n.amDesignator&&n.amDesignator!==r.Empty&&n.pmDesignator&&n.pmDesignator!==r.Empty)?r.Format("{0}/{1}",n.amDesignator,n.pmDesignator):o.AMPMTwoDigit},o.prototype.Format=function(u){var l,c,b,y,p,w,a,k;if(n.util.isType(u,"boolean"))return u.toString().toUpperCase();var e=this,s=r.Empty,h=t;try{try{h=n.Calc.Convert.DT(u);h?u=h:s=u.toString()}catch(d){s=u.toString()}if(h&&(l=e.validDateTimeFormatString,c=e.validDateTimeFormatString.replace(/%/g,""),c==="H"||c==="h"||c==="m"||c==="M"||c==="d"||c==="s"||c==="y"?(l="%"+c,e.validDateTimeFormatString=l):l=c,s=e.PartLocaleID()&&e.PartLocaleID().CultureInfo()?new n._DateTimeHelper(h).customCultureFormat(l,e.PartLocaleID().CultureInfo()):e.CultureName()?new n._DateTimeHelper(h).customCultureFormat(l,n._CultureInfo.getCulture(e.CultureName())):new n._DateTimeHelper(h).localeFormat(l),e.hasJD&&(b=e._getMonthName(h.getMonth()),s=n.StringHelper.Replace(s,o.PlaceholderMonthJD,b.substr(0,1))),e.absTimeParts))for(y=(n._DateTimeHelper.___toOADate(h)-n._DateTimeHelper.___toOADate(e.AbsoluteTime()))*864e5,p=0;p<e.absTimeParts.length;p++){w=e.absTimeParts[p];a=t;switch(w.TimePartType()){case 0:a=v(y/36e5);break;case 1:a=v(y/6e4);break;case 2:a=v(y/1e3);break}a!==t&&a!==f&&(k=w.token.replace("[","\\[").replace("]","\\]"),s=n.StringHelper.Replace(s,i.ReplacePlaceholder+k,a))}}catch(g){s=n.FormatConverter.toString(u)}return e.NumberStringConverter()&&(e.NumberStringConverter()instanceof ct?s=e.NumberStringConverter().ConvertTo(s,u,!1,e.PartLocaleID(),e.PartDBNumberFormat()):(e.hasYearDelay&&(s=n.StringHelper.Replace(s,i.ReplacePlaceholder+o.YearFourDigit,new n._DateTimeHelper(h).localeFormat(o.YearFourDigit)),s=n.StringHelper.Replace(s,i.ReplacePlaceholder+o.YearTwoDigit,new n._DateTimeHelper(h).localeFormat(o.YearTwoDigit))),s=e.NumberStringConverter().ConvertTo(s,u,!0,e.PartLocaleID(),e.PartDBNumberFormat()))),s},o.prototype._getMonthName=function(n){var t=["January","February","March","April","May","June","July","August","September","October","November","December"];return t[n]},o.prototype.Parse=function(i){var o,u;if(!i||i===r.Empty)return t;var e=this,f=p.FixJapaneseChars(i),s=f.toLowerCase();if(s==="true")return!0;else if(s==="false")return!1;if(e.validDateTimeFormatString&&(o=n._DateTimeHelper.parseExact(f,e.validDateTimeFormatString,n._CultureInfo.getCulture(e.CultureName())),o))return o;if(!e.exactlyMatch)try{return u=n.Calc.Convert.DT(f),u&&!isNaN(u)?u:(u=new Date(f),isNaN(u.valueOf())?f:u)}catch(h){return f}return t},o.prototype.FixFormat=function(t){for(var r,u=t,s="",e=!1,h=n.StringHelper.IndexOf(u,o.HoursSingleDigit[0],1)>-1||n.StringHelper.IndexOf(u,o.SecondSingleDigit[0],1)>-1,c=n.StringHelper.IndexOf(u,o.YearTwoDigit[0],1)>-1||n.StringHelper.IndexOf(u,o.DaySingleDigit[0],1)>-1,f=0;f<u.length;f++)r=u[f],r==='"'?e=!e:e||(r==="Y"||r==="D"||r==="S"||r==="E"||r==="G"?r=r.toLowerCase():r==="M"&&(f>1?i.IsEquals("A",u[f-1],!0)||i.IsEquals("P",u[f-1],!0)||(r=r.toLowerCase()):r=r.toLowerCase())),s+=r;return s},o.prototype.ProcessAMPM=function(t){var u=!1,i,f,r;return n.StringHelper.Contains(t.value,o.AMPMTwoDigit)&&(t.value=n.StringHelper.Replace(t.value,o.AMPMTwoDigit,o.StandardAMPMSingleDigit),u=!0),i=this.DateTimeFormatInfo(),n.StringHelper.Contains(t.value,o.AMPMSingleDigit)&&(t.value=n.StringHelper.Replace(t.value,o.AMPMSingleDigit,o.StandardAMPMSingleDigit),i&&(i.amDesignator=o.AMPMSingleDigit.substr(0,1),i.pmDesignator=o.AMPMSingleDigit.substr(2,1)),u=!0),f=this.CurrentAMPM(),n.StringHelper.Contains(t.value,f)&&(t.value=n.StringHelper.Replace(t.value,f,o.StandardAMPMSingleDigit),r=f.split("/"),r&&r.length===2&&(i.amDesignator=r[0],i.pmDesignator=r[1]),u=!0),u},o.prototype.Replace=function(t,r,u,f,e,s,h,c){var a,w,y,b,tt,v,g;if(s.value=t,f||e){var k=[],p=!0,it=n.StringHelper.IndexOf(s.value,o.HoursSingleDigit[0],1)>-1||n.StringHelper.IndexOf(s.value,o.SecondSingleDigit[0],1)>-1,rt=n.StringHelper.IndexOf(s.value,o.YearTwoDigit[0],1)>-1||n.StringHelper.IndexOf(s.value,o.DaySingleDigit[0],1)>-1;!rt&&it&&(p=!1);for(var d=!1,nt=0,l=0;l<s.value.length;l++){if(a=s.value[l],i.IsEquals(a,o.HoursSingleDigit[0],!0)||i.IsEquals(a,o.SecondSingleDigit[0],!0)?p=!1:(i.IsEquals(a,o.YearTwoDigit[0],!0)||i.IsEquals(a,o.DaySingleDigit[0],!0))&&(p=!0),f&&i.IsEquals(a,r[nt],c)&&p||e&&i.IsEquals(a,r[nt],c)&&!p){for(w=!0,y=0;y<r.length;y++)if(y+l>=t.length||!i.IsEquals(r[y],s.value[y+l],c)){w=!1;break}if(b=l+r.length-1,w&&b+1<s.value.length){for(tt=s.value[b],v=-1,v=b+1;v<s.value.length;v++)if(!i.IsEquals(tt,s.value[v],c))break;v>b+1&&(l=v,w=!1)}w&&!d&&n.ArrayHelper.insert(k,0,l)}a==='"'&&(d=!d)}if(k.length>0){if(!h)for(l=0;l<k.length;l++)g=k[l],s.value=n.StringHelper.Remove(s.value,g,r.length),s.value=n.StringHelper.Insert(s.value,g,u);return!0}else return!1}return!1},o.keyWordsSet=function(){var n=o,i,t;if(!n._keyWordsSet){for(i={},t=0;t<n.keyWords.length;t++)i[n.keyWords[t]]=!0;n._keyWordsSet=i}return n._keyWordsSet},o.defaultDateTimeNumberStringConverter=new ct,o.YearTwoDigit="yy",o.YearSingleDigit="y",o.YearFourDigit="yyyy",o.MonthSingleDigit="m",o.MonthTwoDigit="mm",o.MonthAbbreviation="mmm",o.MonthUnabbreviated="mmmm",o.MonthJD="mmmmm",o.DaySingleDigit="d",o.DayTwoDigit="dd",o.DayWeekDayAbbreviation="aaa",o.DayWeekDayUnabbreviated="aaaa",o.HoursSingleDigit="h",o.HoursTwoDigit="hh",o.MinuteSingleDigit="m",o.MinuteTwoDigit="mm",o.SecondSingleDigit="s",o.SecondTwoDigit="ss",o.SubSecondSingleDigit=".0",o.SubSecondTwoDigit=".00",o.SubSecondThreeDigit=".000",o.EraYear="e",o.AMPMTwoDigit="AM/PM",o.AMPMSingleDigit="A/P",o.StandardYearSingleDigit="%y",o.StandardMonthSingleDigit="%M",o.StandardMonthTwoDigit="MM",o.StandardMonthAbbreviation="MMM",o.StandardMonthUnabbreviated="MMMM",o.StandardAMPMSingleDigit="tt",o.StandardMinuteSingleDigit="%m",o.StandardHourSingleDigit="H",o.StandardHourTwoDigit="HH",o.StandardSecondSingleDigit="%s",o.StandardSubSecondSingleDigit=".f",o.StandardSubSecondTwoDigit=".ff",o.StandardSubSecondThreeDigit=".fff",o.StandardDayWeekDayAbbreviation="ddd",o.StandardDayWeekDayUnabbreviated="dddd",o.PlaceholderMonthJD=i.ReplacePlaceholder+"mmmmm",o.defaultAbsoluteTime=new Date(1899,11,30,0,0,0,0),o.keyWords=[o.YearSingleDigit,o.YearTwoDigit,o.YearFourDigit,o.MonthSingleDigit,o.MonthTwoDigit,o.MonthAbbreviation,o.MonthUnabbreviated,o.MonthJD,o.DaySingleDigit,o.DayTwoDigit,o.DayWeekDayAbbreviation,o.DayWeekDayUnabbreviated,o.HoursSingleDigit,o.HoursTwoDigit,o.MinuteSingleDigit,o.MinuteTwoDigit,o.SecondSingleDigit,o.SecondTwoDigit,"ggg","gg","g","ee","e"],o}(u),kt=function(){function n(){}return n.prototype.ConvertTo=function(n,i,r,u,f){if(u!=t&&f!=t){var e=u.GetDBNumber(f.Type());if(e!=t)return f.ReplaceNumberString(n,e,r)}return n},n}(),w=function(f){function e(e,o,s,h){var c,l,p,w,v,a,y;f.call(this,o,s,h);this.baseNumberStringConverter=u.prototype.NumberStringConverter;this.baseNumberFormatInfo=u.prototype.NumberFormatInfo;this.baseCultureName=u.prototype.CultureName;c=this;c.numberFormatString=t;c.fullFormatString=t;c.isGeneralNumber=!1;c.fractionIntegerFormat=t;c.fractionNumeratorFormat=t;c.fractionDenominatorFormat=t;c.excelFormatString=r.Empty;c._classNames.push("NumberFormatDigital");l=u.TrimNotSupportSymbol(e);c.fullFormatString=i.Filter(e,i.LeftSquareBracket,i.RightSquareBracket);c.excelFormatString=l;o&&(p=l,l=i.ReplaceKeyword(p,c.PartLocaleID().OriginalToken(),c.PartLocaleID().CurrencySymbol()));c.PartDBNumberFormat()&&(c.excelFormatString=i.ReplaceKeyword(c.excelFormatString,c.PartDBNumberFormat().OriginalToken(),c.PartDBNumberFormat().toString()));l=i.Filter(l,i.LeftSquareBracket,i.RightSquareBracket);w=l.indexOf(i.SolidusSign);w>-1&&(l=n.StringHelper.Replace(l,"\\"+i.QuestionMark,i.Zero),v=i.Split(l,i.SolidusSign),v&&v.length===2&&(c.fractionDenominatorFormat=v[1],a=v[0],a&&(y=a.lastIndexOf(i.Space),y>-1?(c.fractionIntegerFormat=a.substr(0,y),c.fractionNumeratorFormat=a.substr(y+1,a.length-y-1)):c.fractionNumeratorFormat=a)));c.numberFormatString=l}return __extends(e,f),e.prototype.NumberStringConverter=function(n){var t=this;return arguments.length===0?t.baseNumberStringConverter()?t.baseNumberStringConverter():e.defaultNumberStringConverter:(t.baseNumberStringConverter(n),n)},e.prototype.FormatString=function(){return this.fullFormatString},e.prototype.NumberFormatInfo=function(t){var r=this;return arguments.length===0?r.baseNumberFormatInfo()?r.baseNumberFormatInfo():r.PartLocaleID()&&r.PartLocaleID().CultureInfo()?r.PartLocaleID().CultureInfo().NumberFormat():r.baseCultureName()?n._CultureInfo.getCulture(r.baseCultureName()).NumberFormat():i.NumberFormatInfo():(r.baseNumberFormatInfo(t),t)},e.prototype.IsGeneralNumber=function(n){return arguments.length===0?this.isGeneralNumber:(this.isGeneralNumber=n,n)},e.prototype.ExcelCompatibleFormatString=function(){return this.excelFormatString},e.prototype.Format=function(u){var f,l,g,o,y,it,w,a,k,ut,v,b;if(n.util.isType(u,"boolean"))return u.toString().toUpperCase();if(f=this,l=n.FormatConverter.ToDouble(u),isNaN(l)||!isFinite(l)||isNaN(u))return typeof u=="string"?u:t;if(g=f.NaNSymbol(),o=t,y=f.CultureName()?n._CultureInfo.getCulture(f.CultureName()):n._CultureInfo._currentCulture,f.fractionNumeratorFormat&&f.fractionDenominatorFormat){var p={value:0},s={value:0},h={value:0},ft=f.fractionDenominatorFormat.length;if(e.GetFraction(l,ft,p,s,h))if(it=f.GetGCD(s.value,h.value),it>1&&(s.value/=it,h.value/=it),f.fractionIntegerFormat){if(o="",h.value===1&&(p.value+=s.value,s.value=0,h.value=0),p.value!==0&&(o+=new n._NumberHelper(p.value).customCultureFormat(f.fractionIntegerFormat,y),o+=i.Space),p.value===0&&l<0&&(o+=i.negativeSign),l===0&&(o+="0"),w=f.fractionDenominatorFormat,a=parseFloat(w),isNaN(a)||a>0&&(s.value*=a/h.value,w=r.Empty,h.value=a,v=c(s.value),b=v-s.value,s.value=b<=.5&&b>=0?parseFloat(v.toString()):parseFloat((v-1).toString())),k=f.fractionNumeratorFormat,ut=parseFloat(k),!isNaN(ut)&&ut===0){var nt=k.length,rt=s.value.toString(),tt=rt.length;nt>tt?k=k.substr(0,nt-(nt-tt)):nt<tt&&(rt=rt.substr(0,tt-(tt-nt)),s.value=parseInt(rt,10))}return s.value!==0&&(o+=new n._NumberHelper(s.value).customCultureFormat(k,y).replace(/^0*/,""),o+=i.SolidusSign,o+=new n._NumberHelper(h.value).customCultureFormat(w,y).replace(/^0*/,"")),o===""?"0":o}else{o="";var d=p.value*h.value+s.value,w=f.fractionDenominatorFormat,a=parseFloat(w);return a>0?(d*=a/h.value,w=r.Empty,h.value=a,v=c(d),b=v-d,d=b<=.5&&b>=0?parseFloat(v.toString()):parseFloat((v-1).toString()),o+=d+i.SolidusSign+h.value):(o+=new n._NumberHelper(d).customCultureFormat(f.fractionNumeratorFormat,y).replace(/^0*/,""),o+=i.SolidusSign,o+=new n._NumberHelper(h.value).customCultureFormat(f.fractionDenominatorFormat,y).replace(/^0*/,"")),o===""?"0":o}else return l.toString()}else g=new n._NumberHelper(l).customCultureFormat(f.EncodeNumberFormat(f.numberFormatString),y),f.NumberStringConverter()&&(g=f.NumberStringConverter().ConvertTo(g,u,f.isGeneralNumber,f.PartLocaleID(),f.PartDBNumberFormat()));return g},e.prototype.Parse=function(u){var a=this,d,g,w,h,c,b,k,rt,tt,ut,f,l,it;if(u=a.TrimSpecialSymbol(u),u=a.TrimCurrencySymbol(u),u=n._NumberHelper.replaceCultureSymbolToNormal(u,this.NumberFormatInfo()),!u||u===r.Empty)return t;if(d=i.numberGroupSeparator,n.StringHelper.EndsWith(u,d)&&!isNaN(u.substr(0,u.length-d.length)))return u;if(g=p.FixJapaneseChars(u),u.toLowerCase()==="true")return!0;else if(u.toLowerCase()==="false")return!1;var e=i.IsDecimal(g),nt=n.StringHelper.IndexOf(g,i.ExponentialSymbol,1),s=nt>-1;if(a.numberFormatString){if(w={value:0},u=a.TrimPercentSign(u,w),h=u,s&&(h=u.substr(0,nt)),h[0]===i.NumberFormatInfo().positiveSign&&(h=h.substr(1),u=u.substr(1)),c=n.StringHelper.Replace(h,i.numberGroupSeparator,""),b=c.indexOf(i.DecimalSeparator),b===c.lastIndexOf(i.DecimalSeparator)){if(k="#,##0",b!==-1)for(k+=".",rt=c.length-b-1,tt=0;tt<rt;tt++)k+="0";ut=new y(k,0,"en-us").Format(c);ut===h&&(u=s?c+u.substr(nt):c)}if(f=parseFloat(u),l=t,f.toString()!==u&&(it=i.DecimalSeparator,e||s?e&&!s?l=new RegExp("^((\\+|-)?\\d*)"+it+"(\\d*)$","ig"):!e&&s?l=new RegExp("^((\\+|-)?\\d+)((E(\\+|-)?|e(\\+|-)?)\\d+)$","ig"):e&&s&&(l=new RegExp("^((\\+|-)?\\d*)"+it+"(\\d*)((E(\\+|-)?|e(\\+|-)?)\\d+)$","ig")):l=new RegExp("^((\\+|-)?\\d+)$","ig")),!isNaN(f)&&isFinite(f)&&(!l||l.test(u)))return w.value>0&&(f=f/parseFloat((100*w.value).toString())),f!==0&&o(f-v(f))!==0&&(e=!0),s&&(e=!0),a.ToObject(f,e)}return t},e.prototype.EncodeNumberFormat=function(n){var i,r,t;if(n){for(i=n.split(""),r="",t=0;t<i.length-1;)i[t]==="\\"?(r+=i[t+1],t+=2):(r+=i[t],t++);t===i.length-1&&i[t]!=="\\"&&(r+=i[t]);n=r}return n},e.prototype.ToObject=function(n,t){return t?n:n<=1e22?n:n},e.prototype.TrimPercentSign=function(t,u){if(u.value=0,!t||t===r.Empty)return t;var f=t,e=i.percentSymbol,o=t.indexOf(e);return o===t.length-1&&o===t.lastIndexOf(e)&&(f=n.StringHelper.Replace(f,e,""),u.value+=(t.length-f.length)/e.length),f},e.prototype.TrimSpecialSymbol=function(t){var u,h,e,c,o,f,s;if(!t||t===r.Empty)return t;for(u=t,h=-1,e=0;e<u.length;e++)if(a.IsDigit(u[e])){h=e;break}for(c=-1,o=u.length-1;o>-1;o--)if(a.IsDigit(u[o])){c=o;break}for(f=u.length-1;f>-1;f--)if(s=u[f],this.IsSpecialSymbol(s))a.IsWhiteSpace(s)?(f<h||c<f)&&(u=n.StringHelper.Remove(u,f,1)):u=n.StringHelper.Remove(u,f,1);else if((s==="-"||s==="+")&&f>0&&u[f-1]!=="e"&&u[f-1]!=="E"&&u[f-1]!=="("&&u[f-1].toString()!==i.NumberFormatInfo().currencySymbol)break;return u},e.prototype.IsStandardNumberSymbol=function(n){var t=this.NumberFormatInfo()?this.NumberFormatInfo():i.NumberFormatInfo(),r;return t&&(r=n.toString(),r===t.currencyDecimalSeparator||r===t.currencyGroupSeparator||r===t.currencySymbol||r===t.nanSymbol||r===t.negativeInfinitySymbol||r===t.negativeSign||r===t.numberDecimalSeparator||r===t.numberGroupSeparator||r===t.percentDecimalSeparator||r===t.percentGroupSeparator||r===t.percentSymbol||r===t.perMilleSymbol||r===t.positiveInfinitySymbol||r===t.positiveSign)?!0:!1},e.prototype.IsSpecialSymbol=function(n){return this.IsStandardNumberSymbol(n)?!1:a.IsWhiteSpace(n)?!0:!1},e.prototype.TrimCurrencySymbol=function(n){var t,r,u;return n?(t=this.NumberFormatInfo()?this.NumberFormatInfo():i.NumberFormatInfo(),t&&(r=t.currencySymbol,u=n.toString().indexOf(r),u===0&&u===n.lastIndexOf(r)&&(n=n.substr(1))),n):n},e.keyWordsSet=function(){var n=e,i,t;if(!n._keyWordsSet){for(i={},t=0;t<n.keywords.length;t++)i[n.keywords[t]]=!0;n._keyWordsSet=i}return n._keyWordsSet},e.EvaluateFormat=function(n){return u.ContainsKeywords(n,e.keywords,e.keyWordsSet())},e.GetFraction=function(n,t,i,r,u){return p.GetFraction(n,t,i,r,u)},e.prototype.GetGCD=function(n,t){if(n==0)return o(t);if(t==0)return o(n);for(var r=lt(n,t),i=at(n,t),u=r%i;u!=0;)r=i,i=u,u=r%i;return o(i)},e.defaultNumberStringConverter=new kt,e.keywords=[i.Exponential1,i.Exponential2,i.NumberSign,i.DecimalSeparator,i.numberGroupSeparator,i.percentSymbol,i.Zero,i.SolidusSign],e}(u),e=function(e){function s(r,f,o,h){if(e.call(this,f,o,h),this.digitalFormat=t,this.exponentialDigitalFormat=t,this.fullFormatString=t,this._classNames.push("NumberFormatGeneral"),arguments.length>0)if(s.EvaluateFormat(r)){if(r.indexOf(i.Zero)>=0||r.indexOf(i.NumberSign)>=0||r.indexOf(i.DecimalSeparator)>=0||r.indexOf(i.CommercialAt)>=0)throw n.SR.Exp_FormatIllegal;this.fullFormatString=r}else throw n.SR.Exp_FormatIllegal;else this.fullFormatString=u.General}return __extends(s,e),s.prototype.DigitalFormat=function(){var n=this,t;return n.digitalFormat||(t=n.fullFormatString,t=i.ReplaceKeyword(t,u.General,s.GeneralNumber),n.digitalFormat=new w(t,n.PartLocaleID(),n.PartDBNumberFormat(),n.CultureName()),n.digitalFormat.IsGeneralNumber(!0)),n.digitalFormat},s.prototype.ExponentialDigitalFormat=function(){var n=this;return n.exponentialDigitalFormat||(n.exponentialDigitalFormat=new w("0.#####E+00",n.PartLocaleID(),n.PartDBNumberFormat(),n.CultureName()),n.exponentialDigitalFormat.IsGeneralNumber(!0)),n.exponentialDigitalFormat},s.prototype.FormatString=function(){return n.StringHelper.Replace(this.fullFormatString,s.GeneralPlaceholder,u.General)},s.prototype.Format=function(r){var e=this,h,u,s;if(n.FormatConverter.IsNumber(r)){if(h=e.PartLocaleID()?e.PartLocaleID().AllowScience():!0,u=n.FormatConverter.ToDouble(r),u!==f&&u!==t)return o(u)>99999999999&&h||o(u)<1e-11&&u!==0?e.ExponentialDigitalFormat().Format(r):e.DigitalFormat().Format(r)}else if(n.util.isType(r,"string"))return(s=n.StringHelper.Replace(e.FormatString(),'"',""),s=i.TrimEscape(s),s)?n.StringHelper.Replace(s,"General",r):r;else if(n.util.isType(r,"boolean"))return r.toString().toUpperCase();return""},s.prototype.Parse=function(u){var c,l,a,v;if(r.IsNullOrEmpty(u))return t;if(c=!1,l=n.StringHelper.IndexOf(u,"-"),l>0&&(i.IsEquals(u.charAt(l-1),i.ExponentialSymbol,!0)||(c=!0)),(n.StringHelper.Contains(u,"/")||c||n.StringHelper.Contains(u,":")||n.StringHelper.Contains(u,"-"))&&(a=n._DateTimeHelper.parseLocale(u),a))return a;var s=u,e=t,h=t;if(s.charAt(0)===i.negativeSign?h=!0:s.charAt(0)===i.NumberFormatInfo().positiveSign&&(h=!1),v=!1,h&&s.length>3&&s.charAt(1)===i.LeftParenthesis&&s.charAt(s.length-1)===i.RightParenthesis&&(v=!0),h&&v){if(e=this.DigitalFormat().Parse(n.StringHelper.Remove(u,0,1)),e)return n.util.isType(e,"number")?o(e)*(h?-1:1):e}else if(e=this.DigitalFormat().Parse(u),e!==f&&e!==t)return e;return u},s.GeneralMonthDay=function(){return["M/d","MMM/d","MMMM/d","d/M","d/MMM","d/MMMM","M-d","MMM-d","MMMM-d","d-M","d-MMM","d-MMMM"]},s.GeneralYearMonth=function(){return["M/y","MMM/y","M/yyyy","MMM/yyyy","M-y","MMM-y","M-yyyy","MMM-yyyy"]},s.GeneralYearMonthDay=function(){return["M/d/y","MMM/d/y","MMMM/d/y","M/d/yyyy","MMM/d/yyyy","MMMM/d/yyyy","d/M/y","d/MMM/y","d/MMMM/y","d/M/yyyy","d/MMM/yyyy","d/MMMM/yyyy","yyyy/M/d","M-d-y","MMM-d-y","MMMM-d-y","M-d-yyyy","MMM-d-yyyy","MMMM-d-yyyy","d-M-y","d-MMM-y","d-MMMM-y","d-M-yyyy","d-MMM-yyyy","d-MMMM-yyyy","yyyy-M-d"]},s.GeneralHourMinute=function(){return["H:m","h:m tt"]},s.GeneralHourMinuteWithDate=function(){return["M/d H:m","MMM/d H:m","MMMM/d H:m","d/M H:m","d/MMM H:m","d/MMMM H:m","M/y H:m","MMM/y H:m","M/yyyy H:m","MMM/yyyy H:m","M/d/y H:m","MMM/d/y H:m","MMMM/d/y H:m","M/d/yyyy H:m","MMM/d/yyyy H:m","MMMM/d/yyyy H:m","M-d H:m","MMM-d H:m","MMMM-d H:m","d-M H:m","d-MMM H:m","d-MMMM H:m","M-y H:m","MMM-y H:m","M-yyyy H:m","MMM-yyyy H:m","M-d-y H:m","MMM-d-y H:m","MMMM-d-y H:m","M-d-yyyy H:m","MMM-d-yyyy H:m","MMMM-d-yyyy H:m","M/d h:m tt","MMM/d h:m tt","MMMM/d h:m tt","d/M h:m tt","d/MMM h:m tt","d/MMMM h:m tt","M/y h:m tt","MMM/y h:m tt","M/yyyy h:m tt","MMM/yyyy h:m tt","M/d/y h:m tt","MMM/d/y h:m tt","MMMM/d/y h:m tt","M/d/yyyy h:m tt","MMM/d/yyyy h:m tt","MMMM/d/yyyy h:m tt","M-d h:m tt","MMM-d h:m tt","MMMM-d h:m tt","d-M h:m tt","d-MMM h:m tt","d-MMMM h:m tt","M-y h:m tt","MMM-y h:m tt","M-yyyy h:m tt","MMM-yyyy h:m tt","M-d-y h:m tt","MMM-d-y h:m tt","MMMM-d-y h:m tt","M-d-yyyy h:m tt","MMM-d-yyyy h:m tt","MMMM-d-yyyy h:m tt"]},s.GeneralHourMinuteSecond=function(){return["H:m:s","h:m:s tt","H:m:s","h:mm:ss tt"]},s.GeneralHourMinuteSecondSubSecond=function(){return["H:m:s.FFF","h:m:s.FFF tt"]},s.GeneralHourMinuteSecondWithDate=function(){return["M/d H:m:s","MMM/d H:m:s","MMMM/d H:m:s","d/M H:m:s","d/MMM H:m:s","d/MMMM H:m:s","M/y H:m:s","MMM/y H:m:s","M/yyyy H:m:s","MMM/yyyy H:m:s","M/d/y H:m:s","MMM/d/y H:m:s","MMMM/d/y H:m:s","M/d/yyyy H:m:s","MMM/d/yyyy H:m:s","MMMM/d/yyyy H:m:s","d/M/y H:m:s","d/MMM/y H:m:s","d/MMMM/y H:m:s","d/M/yyyy H:m:s","d/MMM/yyyy H:m:s","d/MMMM/yyyy H:m:s","yyyy/M/d H:m:s","M-d H:m:s","MMM-d H:m:s","MMMM-d H:m:s","d-M H:m:s","d-MMM H:m:s","d-MMMM H:m:s","M-y H:m:s","MMM-y H:m:s","M-yyyy H:m:s","MMM-yyyy H:m:s","M-d-y H:m:s","MMM-d-y H:m:s","MMMM-d-y H:m:s","M-d-yyyy H:m:s","MMM-d-yyyy H:m:s","MMMM-d-yyyy H:m:s","d-M-y H:m:s","d-MMM-y H:m:s","d-MMMM-y H:m:s","d-M-yyyy H:m:s","d-MMM-yyyy H:m:s","d-MMMM-yyyy H:m:s","yyyy-M-d H:m:s","M/d h:m:s tt","MMM/d h:m:s tt","MMMM/d h:m:s tt","d/M h:m:s tt","d/MMM h:m:s tt","d/MMMM h:m:s tt","M/y h:m:s tt","MMM/y h:m:s tt","M/yyyy h:m:s tt","MMM/yyyy h:m:s tt","M/d/y h:m:s tt","MMM/d/y h:m:s tt","MMMM/d/y h:m:s tt","M/d/yyyy h:m:s tt","MMM/d/yyyy h:m:s tt","MMMM/d/yyyy h:m:s tt","d/M/y h:m:s tt","d/MMM/y h:m:s tt","d/MMMM/y h:m:s tt","d/M/yyyy h:m:s tt","d/MMM/yyyy h:m:s tt","d/MMMM/yyyy h:m:s tt","yyyy/M/d h:m:s tt","M/d/yyyy h:mm:ss tt","M-d h:m:s tt","MMM-d h:m:s tt","MMMM-d h:m:s tt","d-M h:m:s tt","d-MMM h:m:s tt","d-MMMM h:m:s tt","M-y h:m:s tt","MMM-y h:m:s tt","M-yyyy h:m:s tt","MMM-yyyy h:m:s tt","M-d-y h:m:s tt","MMM-d-y h:m:s tt","MMMM-d-y h:m:s tt","M-d-yyyy h:m:s tt","MMM-d-yyyy h:m:s tt","MMMM-d-yyyy h:m:s tt","d-M-y h:m:s tt","d-MMM-y h:m:s tt","d-MMMM-y h:m:s tt","d-M-yyyy h:m:s tt","d-MMM-yyyy h:m:s tt","d-MMMM-yyyy h:m:s tt","yyyy-M-d h:m:s tt"]},s.GeneralHourMinuteSecondSubSecondWithDate=function(){return["M/d H:m:s.FFF","MMM/d H:m:s.FFF","MMMM/d H:m:s.FFF","d/M H:m:s.FFF","d/MMM H:m:s.FFF","d/MMMM H:m:s.FFF","M/y H:m:s.FFF","MMM/y H:m:s.FFF","M/yyyy H:m:s.FFF","MMM/yyyy H:m:s.FFF","d/M/y H:m","d/MMM/y H:m","d/MMMM/y H:m","d/M/yyyy H:m","d/mmm/yyyy H:m","d/MMMM/yyyy H:m","yyyy/M/d H:m","M/d/y H:m:s.FFF","MMM/d/y H:m:s.FFF","MMMM/d/y H:m:s.FFF","M/d/yyyy H:m:s","MMM/d/yyyy H:m:s.FFF","MMMM/d/yyyy H:m:s.FFF","d/M/y H:m:s.FFF","d/MMM/y H:m:s.FFF","d/MMMM/y H:m:s.FFF","d/M/yyyy H:m:s.FFF","d/MMM/yyyy H:m:s.FFF","d/MMMM/yyyy H:m:s.FFF","yyyy/M/d H:m:s.FFF","M-d H:m:s.FFF","MMM-d H:m:s.FFF","MMMM-d H:m:s.FFF","d-M H:m:s.FFF","d-MMM H:m:s.FFF","d-MMMM H:m:s.FFF","M-y H:m:s.FFF","MMM-y H:m:s.FFF","M-yyyy H:m:s.FFF","MMM-Yyyy H:m:s.FFF","d-M-y H:m","d-MMM-y H:m","d-MMMM-y H:m","d-M-yyyy H:m","d-MMM-yyyy H:m","d-MMMM-yyyy H:m","yyyy-M-d H:m","M-d-y H:m:s.FFF","MMM-d-y H:m:s.FFF","MMMM-d-y H:m:s.FFF","M-d-yyyy H:m:s","MMM-d-yyyy H:m:s.FFF","MMMM-d-yyyy H:m:s.FFF","D-M-y H:m:s.FFF","d-MMM-y H:m:s.FFF","d-MMMM-y H:m:s.FFF","D-M-yyyy H:m:s.FFF","d-MMM-yyyy H:m:s.FFF","d-MMMM-yyyy H:m:s.FFF","yyyy-M-d H:m:s.FFF","M/d h:m:s.FFF tt","MMM/d h:m:s.FFF tt","MMMM/d h:m:s.FFF tt","d/M h:m:s.FFF tt","d/MMM h:m:s.FFF tt","d/MMMM h:m:s.FFF tt","M/y h:m:s.FFF tt","MMM/y h:m:s.FFF tt","M/yyyy h:m:s.FFF tt","MMM/yyyy h:m:s.FFF tt","d/M/y h:m tt","d/MMM/y h:m tt","d/MMMM/y h:m tt","d/M/yyyy h:m tt","d/mmm/yyyy h:m tt","d/MMMM/yyyy h:m tt","yyyy/M/d h:m tt","M/d/y h:m:s.FFF tt","MMM/d/y h:m:s.FFF tt","MMMM/d/y h:m:s.FFF tt","M/d/yyyy h:m:s tt","MMM/d/yyyy h:m:s.FFF tt","MMMM/d/yyyy h:m:s.FFF tt","d/M/y h:m:s.FFF tt","d/MMM/y h:m:s.FFF tt","d/MMMM/y h:m:s.FFF tt","d/M/yyyy h:m:s.FFF tt","d/MMM/yyyy h:m:s.FFF tt","d/MMMM/yyyy h:m:s.FFF tt","yyyy/M/d h:m:s.FFF tt","M-d h:m:s.FFF tt","MMM-d h:m:s.FFF tt","MMMM-d h:m:s.FFF tt","d-M h:m:s.FFF tt","d-MMM h:m:s.FFF tt","d-MMMM h:m:s.FFF tt","M-y h:m:s.FFF tt","MMM-y h:m:s.FFF tt","M-yyyy h:m:s.FFF tt","MMM-Yyyy h:m:s.FFF tt","d-M-y h:m tt","d-MMM-y h:m tt","d-MMMM-y h:m tt","d-M-yyyy h:m tt","d-MMM-yyyy h:m tt","d-MMMM-yyyy h:m tt","yyyy-M-d h:m tt","M-d-y h:m:s.FFF tt","MMM-d-y h:m:s.FFF tt","MMMM-d-y h:m:s.FFF tt","M-d-yyyy H:m:s tt","MMM-d-yyyy H:m:s.FFF tt","MMMM-d-yyyy h:m:s.FFF tt","d-M-y h:m:s.FFF tt","d-MMM-y h:m:s.FFF tt","d-MMMM-y h:m:s.FFF tt","d-M-yyyy h:m:s.FFF tt","d-MMM-yyyy h:m:s.FFF tt","d-MMMM-yyyy h:m:s.FFF tt","yyyy-M-d h:m:s.FFF tt"]},s.EvaluateFormat=function(n){if(!n||n===r.Empty)return!1;var t=u;return t.ContainsKeywords(n,t._keywords,t._keywordsSet)},s.GeneralPlaceholder="@NumberFormat",s.GeneralNumber="##################0.################",s}(u),dt=function(){function n(n,t){this.formatCached=n;this.cultureName=t;this.typeName=""}return n.prototype.Format=function(n,i){return t},n.prototype.Parse=function(n){return t},n.prototype.FormatString=function(){return this.formatCached},n.prototype.toJSON=function(){var t={};for(var n in this)this.hasOwnProperty(n)&&(t[n]=this[n]);return t},n.prototype.fromJSON=function(n){if(n)for(var t in n)n[t]!==f&&(this[t]=n[t])},n}();n.CustomFormatterBase=dt})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var ti,ii,f,s,a,g,h,pt,nt,tt,wt,it,rt,k,ut,ft,bt,et,b,ot,st,d,ht,ct,u,v,lt,at,vt,c,yt,kt,gt;n.feature("conditionalFormat",["core.common","core.globalize","core.stringResource","core.theme","core.imageLoader"]);var t=null,i=undefined,l="undefined",e=Math.min,o=Math.max,y=Math.abs,p=Math.floor,r=n.Calc.Convert,w=n.StringHelper.TrimStart,dt=function(t){var i;if(t instanceof n.Calc.Expressions.Expression)i=t;else if(t instanceof n.Range)i=ni(t);else if(r.num(t)&&!isNaN(t=r.D(t)))i=new n.Calc.Expressions.DoubleExpression(t,t.toString());else throw n.SR.Exp_NotSupport;return i},ni=function(t){var i=new n.Calc.Expressions.RangeExpression(t.row,t.col,t.row+t.rowCount-1,t.col+t.colCount-1);return t.row<0?i.initBand(i.startColumn,i.endColumn,i.startColumnRelative,i.endColumnRelative,!1):t.col<0&&i.initBand(i.startRow,i.startColumn,i.startRowRelative,i.endRowRelative,!0),i};(function(n){n[n.RelationCondition=0]="RelationCondition";n[n.NumberCondition=1]="NumberCondition";n[n.TextCondition=2]="TextCondition";n[n.ColorCondition=3]="ColorCondition";n[n.FormulaCondition=4]="FormulaCondition";n[n.DateCondition=5]="DateCondition";n[n.DateExCondition=6]="DateExCondition";n[n.TextLengthCondition=7]="TextLengthCondition";n[n.Top10Condition=8]="Top10Condition";n[n.UniqueCondition=9]="UniqueCondition";n[n.AverageCondition=10]="AverageCondition";n[n.CellValueCondition=11]="CellValueCondition";n[n.AreaCondition=12]="AreaCondition"})(n.ConditionType||(n.ConditionType={}));ti=n.ConditionType,function(n){n[n.ConditionRuleBase=0]="ConditionRuleBase";n[n.CellValueRule=1]="CellValueRule";n[n.SpecificTextRule=2]="SpecificTextRule";n[n.FormulaRule=3]="FormulaRule";n[n.DateOccurringRule=4]="DateOccurringRule";n[n.Top10Rule=5]="Top10Rule";n[n.UniqueRule=6]="UniqueRule";n[n.DuplicateRule=7]="DuplicateRule";n[n.AverageRule=8]="AverageRule";n[n.ScaleRule=9]="ScaleRule";n[n.TwoScaleRule=10]="TwoScaleRule";n[n.ThreeScaleRule=11]="ThreeScaleRule";n[n.DataBarRule=12]="DataBarRule";n[n.IconSetRule=13]="IconSetRule"}(n.RuleType||(n.RuleType={}));ii=n.RuleType;f=function(){function n(){this.offsetRow=0;this.offsetCol=0}return n.prototype.evaluate=function(n,t,i,r,u){},n.prototype.toJSON=function(){return{}},n.prototype.adjustOffset=function(n,t){this.offsetRow=n;this.offsetCol=t},n.prototype._cloneToActualRanges=function(n,t){for(var u,r=[],i=0,f=t.length;i<f;i++)u=n._getActualRange(t[i]),r.push(u);return r},n}();n.ConditionalBase=f;s=function(){function i(n){var i=this;i.condition=t;i.ranges=t;i.style=t;i._priority=1;i._stopIfTrue=!1;i.style=n}return i.prototype.hasNoReference=function(){return!(this.ranges&&this.ranges.length>0)},i.prototype.evaluate=function(n,i,r,u){var f=this,e,o;return f.contains(i,r)?(f.initCondition(),e={baseRow:0,baseCol:0},f.getBaseCoordinate(e),f.condition.adjustOffset(i-e.baseRow,r-e.baseCol),o=t,f.condition.evaluate(n,i,r,u)&&(o=f.getExpected()),f.condition.adjustOffset(0,0),o):t},i.prototype.contains=function(n,t){var r=this.ranges,u,f,i;if(r)for(u=r.length,i=0;i<u;i++)if(f=this.ranges[i],f.contains(n,t))return!0;return!1},i.prototype.createCondition=function(){return null},i.prototype.initCondition=function(){this.condition||(this.condition=this.createCondition())},i.prototype.priority=function(){return this._priority},i.prototype.stopIfTrue=function(n){return arguments.length===0?this._stopIfTrue:(this._stopIfTrue=n,this)},i.prototype.getExpected=function(){return this.style},i.prototype.reset=function(){var n=this;n.ranges=t;n.condition=t;n.style=t;n._stopIfTrue=!1;n._priority=1},i.prototype.intersects=function(n,t,i,r){var f=this.ranges,e,o,u;if(f)for(e=f.length,u=0;u<e;u++)if(o=f[u],o.intersect(n,t,i,r))return!0;return!1},i.prototype.isScaleRule=function(){return!1},i.prototype.getBaseCoordinate=function(n){var t,i;if(n.baseRow=Number.MAX_VALUE,n.baseCol=Number.MAX_VALUE,t=this,t.ranges&&t.ranges.length>0)for(i=0;i<t.ranges.length;i++){var f=t.ranges[i],r=f.row,u=f.col;r=r===-1?0:r;u=u===-1?0:u;n.baseRow=e(r,n.baseRow);n.baseCol=e(u,n.baseCol)}else n.baseRow=0,n.baseCol=0},i.prototype._addRows=function(t,i){var f=this,e,u,r;if(f.ranges)for(e=f.ranges.length,u=0;u<e;u++)if(r=f.ranges[u],r.row===-1)continue;else r.row>=t?f.ranges[u]=new n.Range(r.row+i,r.col,r.rowCount,r.colCount):r.row<t&&t<r.row+r.rowCount&&(f.ranges[u]=new n.Range(r.row,r.col,r.rowCount+i,r.colCount))},i.prototype._addColumns=function(t,i){var f=this,e,u,r;if(f.ranges)for(e=f.ranges.length,u=0;u<e;u++)if(r=f.ranges[u],r.col===-1)continue;else r.col>=t?f.ranges[u]=new n.Range(r.row,r.col+i,r.rowCount,r.colCount):r.col<t&&t<r.col+r.colCount&&(f.ranges[u]=new n.Range(r.row,r.col,r.rowCount,r.colCount+i))},i.prototype._removeRows=function(t,i){var u=this,o,c,f,r,s,l,h,a;if(u.ranges){for(o=[],c=u.ranges.length,f=0;f<c;f++)if(r=u.ranges[f],r.row===-1)continue;else r.row>t?r.row+r.rowCount<=t+i?o.push(r):u.ranges[f]=new n.Range(r.row-i,r.col,r.rowCount,r.colCount):r.row<=t&&t<r.row+r.rowCount&&(s=new n.Range(r.row,r.col,r.rowCount-e(r.row+r.rowCount-t,i),r.colCount),s.colCount===0||s.rowCount===0?o.push(r):u.ranges[f]=s);for(l=o.length,h=0;h<l;h++)a=o[h],n.ArrayHelper.remove(u.ranges,a)}},i.prototype._removeColumns=function(t,i){var u=this,o,c,f,r,s,l,h,a;if(u.ranges){for(o=[],c=u.ranges.length,f=0;f<c;f++)if(r=u.ranges[f],r.col===-1)continue;else r.col>t?r.col+r.colCount<=t+i?o.push(r):u.ranges[f]=new n.Range(r.row,r.col-i,r.rowCount,r.colCount):r.col<=t&&t<r.col+r.colCount&&(s=new n.Range(r.row,r.col,r.rowCount,r.colCount-e(r.col+r.colCount-t,i)),s.colCount===0||s.rowCount===0?o.push(r):u.ranges[f]=s);for(l=o.length,h=0;h<l;h++)a=o[h],n.ArrayHelper.remove(u.ranges,a)}},i.prototype._isDefaultValue=function(n,i){switch(n){case"ranges":return i===t;case"style":return i===t;case"priority":return i===1;case"stopIfTrue":return i===!1;default:return!1}},i.prototype.toJSON=function(){},i.prototype.fromJSON=function(n,t){},i}();n.ConditionRuleBase=s;a=function(r){function u(n,i,u){r.call(this);var f=this;f.conditionType="RelationCondition";f.compareType=1;f.item1=t;f.item2=t;f.ignoreBlank=!1;f._dict=t;f.compareType=n;f.item1=i;f.item2=u}return __extends(u,r),u.prototype.adjustOffset=function(n,t){this.item1&&this.item1.adjustOffset&&this.item1.adjustOffset(n,t);this.item2&&this.item2.adjustOffset&&this.item2.adjustOffset(n,t)},u.prototype.create=function(n,t,i){return new u(n,t,i)},u.prototype._getActualValue=function(n,t,i,r,u){if(n&&t&&t.conditionType==="ColorCondition"){var f=n.getActualStyle(i,r);f&&(t.compareType===0?u=f.backColor:t.compareType===1&&(u=f.foreColor))}return u},u.prototype.evaluate=function(n,r,u,f,e){var o=this,h,c,s;if(o.item1&&(o.item1.ignoreBlank=o.ignoreBlank,h=arguments.length<5?o._getActualValue(n,o.item1,r,u,f):f),o.item2&&(o.item2.ignoreBlank=o.ignoreBlank,c=arguments.length<5?o._getActualValue(n,o.item2,r,u,f):e),o.compareType===1)return(s=o.item1===i||o.item1===t?!1:o.item1.evaluate(n,r,u,h),!s)?!1:o.item2===i||o.item2===t?!1:o.item2.evaluate(n,r,u,c);else if(o.compareType===0)return(s=o.item1===i||o.item1===t?!1:o.item1.evaluate(n,r,u,h),s)?!0:o.item2===i||o.item2===t?!1:o.item2.evaluate(n,r,u,c);return!1},u.prototype.reset=function(){var n=this;n.ignoreBlank=!1;n.compareType=1;n.item1=t;n.item2=t},u.prototype._getConditionTypeDictionary=function(){if(!this._dict){var n={};n[0]=u;n[1]=pt;n[2]=tt;n[3]=wt;n[4]=rt;n[5]=k;n[6]=ft;n[7]=bt;n[8]=b;n[9]=d;n[10]=ct;n[11]=h;n[12]=kt;this._dict=n}return this._dict},u.prototype.toJSON=function(){var r=this,o={compareType:r.compareType,item1:r.item1?r.item1.toJSON():t,item2:r.item2?r.item2.toJSON():t,conType:0,ignoreBlank:r.ignoreBlank},f={},u,e;for(u in o)e=o[u],r._isDefaultValue(u,e)||(f[u]=e);return n.GC$.isEmptyObject(f)?i:f},u.prototype._isDefaultValue=function(n,i){switch(n){case"ignoreBlank":return i===!1;case"item1":return i===t;case"item2":return i===t;default:return!1}},u.prototype.fromJSON=function(n,r){var u,e;if(n){if(u=this,n.compareType!==t&&n.compareType!==i&&(u.compareType=n.compareType),n.item1!==t&&n.item1!==i){var f=t,h=u._getConditionTypeDictionary(),o=n.item1.conType;typeof o===l&&(o=0);e=h[o];e&&(f=new e,f.fromJSON(n.item1,r));u.item1=f}if(n.item2!==t&&n.item2!==i){var f=t,h=u._getConditionTypeDictionary(),s=n.item2.conType;typeof s===l&&(s=0);e=h[s];e&&(f=new e,f.fromJSON(n.item2,r));u.item2=f}n.ignoreBlank!==t&&n.ignoreBlank!==i&&(u.ignoreBlank=n.ignoreBlank)}},u.prototype.getFormulas=function(){var n=[],t=this;return t.item1&&t.item1.getFormulas&&(n=this.item1.getFormulas()),t.item2&&t.item2.getFormulas&&(n=n.length>0?n.concat(this.item2.getFormulas()):this.item2.getFormulas()),n},u.prototype.setFormulas=function(n){var t=this,i;t.item1&&t.item1.getFormulas&&t.item2&&t.item2.getFormulas?(i=t.item1.getFormulas().length,i!==0&&t.item1.setFormulas(n.slice(0,i)),t.item2.setFormulas(n.slice(i))):t.item1&&t.item1.setFormulas?t.item1.setFormulas(n):t.item2&&t.item2.setFormulas&&t.item2.setFormulas(n)},u}(f);n.RelationCondition=a;g=function(r){function u(t,i,u,f){r.call(this,f);this.operator=t;this.value1=typeof i=="string"?n.GC$.trim(i):i;this.value2=typeof u=="string"?n.GC$.trim(u):u}return __extends(u,r),u.prototype.createCondition=function(){var n=this,s=n.isFormula(n.value1)?w(n.value1,"="):t,p=n.isFormula(n.value1)?t:n.value1,c=n.isFormula(n.value2)?w(n.value2,"="):t,b=n.isFormula(n.value2)?t:n.value2,u,f,i=n.operator,r=t,l,e,o,v,y;if(i===6)return u=new h(3,n.value1,s),u.treatNullValueAsZero=!0,f=new h(5,n.value2,c),f.treatNullValueAsZero=!0,l=new a(1,u,f),e=new h(5,n.value1,s),e.treatNullValueAsZero=!0,o=new h(3,n.value2,c),o.treatNullValueAsZero=!0,v=new a(1,e,o),new a(0,l,v);else if(i===7)return u=new h(4,n.value1,s),u.treatNullValueAsZero=!0,f=new h(2,n.value2,c),f.treatNullValueAsZero=!0,l=new a(0,u,f),e=new h(2,n.value1,s),e.treatNullValueAsZero=!0,o=new h(4,n.value2,c),o.treatNullValueAsZero=!0,v=new a(0,e,o),new a(1,l,v);else i===0?r=0:i===2?r=2:i===3?r=3:i===4?r=4:i===5?r=5:i===1&&(r=1);return r!==t?(y=new h(r,n.value1,s),y.treatNullValueAsZero=!0,y):t},u.prototype.reset=function(){var n=this;n.operator=6;n.value1=t;n.value2=t;n.style=t;n._stopIfTrue=!1;n._priority=1},u.prototype.isFormula=function(n){return n!==i&&n!==t&&n[0]==="="},u.prototype.toJSON=function(){var t=this,e={ruleType:1,ranges:t.ranges,style:t.style,operator:t.operator,value1:t.value1,value2:t.value2,priority:t._priority,stopIfTrue:t._stopIfTrue},u={},r,f;for(r in e)f=e[r],t._isDefaultValue(r,f)||(u[r]=f);return n.GC$.isEmptyObject(u)?i:u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.operator!==t&&r.operator!==i&&(f.operator=r.operator);r.value1!==t&&r.value1!==i&&(f.value1=r.value1);r.value2!==t&&r.value2!==i&&(f.value2=r.value2);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.CellValueRule=g;h=function(u){function f(n,i,r){u.call(this);var f=this;f.compareType=t;f.treatNullValueAsZero=!1;f.compareType=n;f.expected=i;f.formula=r}return __extends(f,u),f.prototype.getExpected=function(n,t,i,r){var u=this,f,e;return u.formula&&u.formula.length>0?(f=n.getCalcService(),!f)?u.expected:(e=f.parse(n._getSheetSource(),u.formula,t-u.offsetRow,i-u.offsetCol),f.evaluateParsedFormula(n._getSheetSource(),e,t,i,!1)):u.expected},f.prototype.evaluate=function(n,t,i,r){var u=this.getExpected(n,t,i);return this.checkCondition(u,r)},f.prototype.isSatisfyingCondition=function(n){var i=this.getExpected(t,0,0);return this.checkCondition(i,n)},f.prototype.checkCondition=function(n,u){var f=this,e=0,c=!1,a,o,v,l,s,h;if(typeof n=="boolean"){a=n;switch(f.compareType){case 0:return u===n;case 1:return u!==n;case 2:return f._compareBool(a,u)<0;case 3:return f._compareBool(a,u)<=0;case 4:return f._compareBool(a,u)>0;case 5:return!!f._compareBool(a,u);default:break}}try{u===i||u===t?f.treatNullValueAsZero?(c=!0,e=0):(c=!1,e=u):(l={value:undefined},typeof u!="boolean"&&r.rD(u,l)?(e=l.value,c=!isNaN(e)):c=!1)}catch(y){c=!1}if((u===i||u===t)&&(n===i||n===t))switch(f.compareType){case 0:case 3:case 5:return!0;case 1:case 2:case 4:return!1;default:return!1}if(c){o=0;v=!1;try{l={value:undefined};r.rD(n,l)&&(o=l.value,v=!0)}catch(p){}if(!v){switch(f.compareType){case 0:return!1;case 1:return!0}return!1}switch(f.compareType){case 0:return e===o;case 1:return e!==o;case 2:return e>o;case 3:return e>=o;case 4:return e<o;case 5:return e<=o}}else if(typeof u=="string"){if(s=t,typeof n=="string")s=n;else{switch(f.compareType){case 0:return!1;case 1:return!0}return!1}h=u;switch(f.compareType){case 0:return h===s;case 1:return h!==s;case 2:return s<h;case 3:return s<=h;case 4:return s>h;case 5:return s>=h}}return!1},f.prototype._compareBool=function(n,t){return n===t?0:n===!1&&t===!0?-1:1},f.prototype._isDefaultValue=function(n,t){switch(n){case"treatNullValueAsZero":return t===!1;default:return!1}},f.prototype.toJSON=function(){var t=this,e={compareType:t.compareType,expected:t.expected,formula:t.formula,conType:11,treatNullValueAsZero:t.treatNullValueAsZero},u={},r,f;for(r in e)f=e[r],t._isDefaultValue(r,f)||(u[r]=f);return n.GC$.isEmptyObject(u)?i:u},f.prototype.fromJSON=function(n,r){if(n){var u=this;n.compareType!==t&&n.compareType!==i&&(u.compareType=n.compareType);n.expected!==t&&n.expected!==i&&(u.expected=n.expected);n.formula!==t&&n.formula!==i&&(u.formula=n.formula);n.treatNullValueAsZero!==t&&n.treatNullValueAsZero!==i&&(u.treatNullValueAsZero=n.treatNullValueAsZero)}},f.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},f.prototype.setFormulas=function(n){this.formula=n[0]},f}(f);n.CellValueCondition=h;pt=function(r){function u(t,i,u){r.call(this);var f=this;f.compareType=0;f.conditionType="NumberCondition";f.ignoreBlank=!1;f.integerValue=!1;f.compareType=t;f.expected=i;f.formula=typeof u=="string"?w(n.GC$.trim(u),"="):u}return __extends(u,r),u.prototype.evaluate=function(n,i,r,u){var f=this.getExpected(n,i,r);return this.integerValue&&(f=isNaN(f)?t:parseInt(f,10)),this.checkCondition(f,u)},u.prototype.checkCondition=function(n,r){var f=this,u,e;if((r===i||r===t||r==="")&&f.ignoreBlank)return!0;if(isNaN(r))return!1;if(n===i||n===t)if(f.ignoreBlank)return!0;else n=0;u=0;try{u=parseFloat(r)}catch(o){return!1}if(f.integerValue===!0&&(e=u-p(u)==0,e===!1))return!1;switch(f.compareType){case 0:return u===n;case 1:return u!==n;case 2:return u>n;case 3:return u>=n;case 4:return u<n;case 5:return u<=n}return!1},u.prototype.getExpected=function(n,t,i){var r=this,u;return r.formula&&r.formula.length>0?(u=n.getCalcService(),!u)?r.expected:u.evaluate(n._getSheetSource(),r.formula,t,i):r.expected},u.prototype.reset=function(){var n=this;n.expected=t;n.ignoreBlank=!1;n.compareType=0;n.integerValue=!1},u.prototype._isDefaultValue=function(n,t){switch(n){case"ignoreBlank":return t===!1;case"integerValue":return t===!1;default:return!1}},u.prototype.toJSON=function(){var t=this,e={compareType:t.compareType,expected:t.expected,formula:t.formula,conType:1,ignoreBlank:t.ignoreBlank,integerValue:t.integerValue},u={},r,f;for(r in e)f=e[r],t._isDefaultValue(r,f)||(u[r]=f);return n.GC$.isEmptyObject(u)?i:u},u.prototype.fromJSON=function(n,r){if(n){var u=this;n.compareType!==t&&n.compareType!==i&&(u.compareType=n.compareType);n.expected!==t&&n.expected!==i&&(u.expected=n.expected);n.formula!==t&&n.formula!==i&&(u.formula=n.formula);n.ignoreBlank!==t&&n.ignoreBlank!==i&&(u.ignoreBlank=n.ignoreBlank);n.integerValue!==t&&n.integerValue!==i&&(u.integerValue=n.integerValue)}},u.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},u.prototype.setFormulas=function(n){this.formula=n[0]},u}(f);n.NumberCondition=pt;nt=function(r){function u(n,t,i){r.call(this,i);this.text=t;this.operator=n}return __extends(u,r),u.prototype.createCondition=function(){var n,r,i;switch(this.operator){case 2:n=2;break;case 3:n=4;break;case 0:n=6;break;case 1:n=7;break;default:n=0;break}return r=this.isFormula(this.text)?this.text:t,i=new tt(n,this.text,r),i.ignoreCase=!0,i.useWildCards=this.operator===2||this.operator===3?!1:!0,i},u.prototype.reset=function(){var n=this;n.operator=0;n.text="";n.style=t;n._stopIfTrue=!1;n._priority=1},u.prototype.isFormula=function(n){return n!==i&&n!==t&&n[0]==="="},u.prototype.toJSON=function(){var t=this,e={ruleType:2,ranges:t.ranges,style:t.style,operator:t.operator,text:t.text,priority:t._priority,stopIfTrue:t._stopIfTrue},u={},r,f;for(r in e)f=e[r],t._isDefaultValue(r,f)||(u[r]=f);return n.GC$.isEmptyObject(u)?i:u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.operator!==t&&r.operator!==i&&(f.operator=r.operator);r.text!==t&&r.text!==i&&(f.text=r.text);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.SpecificTextRule=nt;tt=function(r){function u(i,u,f){r.call(this);var e=this;e.forceValue2Text=!1;e.useWildCards=!0;e.regex=t;e.ignoreCase=!1;e.conditionType="TextCondition";e.questionMarkWildcard="?";e.questionMarkWildcardRegularExpression=".";e.asteriskWildcard="*";e.asteriskWildcardRegularExpression="[.\n]*";e.ignoreBlank=!1;e.compareType=i;e.expected=u;e.formula=typeof f=="string"?w(n.GC$.trim(f),"="):f}return __extends(u,r),u.prototype.evaluate=function(n,r,u,f){var e=this,o=t,s;if(e.forceValue2Text===!0||typeof f=="string"||typeof f=="number")o=f!==i&&f!==t?f.toString():"";else{if(f instanceof Date)return e.compareType===2||e.compareType===4||e.compareType===6?!1:e.compareType===3||e.compareType===5||e.compareType===7;o=f!==i&&f!==t?f.toString():""}if(e.ignoreBlank&&(o===i||o===t||o===""))return!0;if(s=e.getExpectedString(n,r,u),e.hasWildcard(s)&&typeof f=="number")return e.compareType===3||e.compareType===7||e.compareType===5||e.compareType===1;switch(e.compareType){case 0:return e.isEquals(s,o);case 1:return!e.isEquals(s,o);case 2:return e.isStartWith(s,o);case 3:return!e.isStartWith(s,o);case 4:return e.isEndWith(s,o);case 5:return!e.isEndWith(s,o);case 6:return e.isContains(s,o);case 7:return!e.isContains(s,o)}return!1},u.prototype.getExpectedString=function(n,r,u){var f=this.getExpected(n,r,u);return f===i||f===t?t:f.toString()},u.prototype.getExpected=function(n,t,i){var r=this,u,f;return r.formula&&r.formula.length>0?(u=n.getCalcService(),!u)?r.expected:(f=u.parse(n._getSheetSource(),r.formula,t-this.offsetRow,i-this.offsetCol),u.evaluateParsedFormula(n._getSheetSource(),f,t,i,!1,!1)):r.expected},u.prototype.hasWildcard=function(n){return n===i||n===t||n===""?!1:n.indexOf(this.asteriskWildcard)>-1||n.indexOf(this.questionMarkWildcard)>-1},u.prototype.isEquals=function(n,r){var u=this,f,e,o;return u.useWildCards&&u.hasWildcard(n)?(f=u.createEqualsRegex(n),f&&(e=r===i&&r===t?"":r,f.lastIndex=-1,e!==i&&e!==t))?e.search(f)>-1:!1:r!==i&&r!==t&&r!==""?(o=n!==i&&n!==t?n:"",u.ignoreCase?o.toLowerCase()===r.toLowerCase():o===r):n===i||n===t||n===""},u.prototype.createEqualsRegex=function(n){var i=this,r,u,f,e;if(i.regex)return i.regex;n=i.encodeExpression(n);r=n;u=new RegExp("\\"+i.questionMarkWildcard,"g");r=r.replace(u,i.questionMarkWildcardRegularExpression);u=new RegExp("\\"+i.asteriskWildcard,"g");r=r.replace(u,i.asteriskWildcardRegularExpression);f=t;try{e=i.ignoreCase?"ig":"g";f=new RegExp("^"+r+"$",e)}catch(o){return t}return f},u.prototype.encodeExpression=function(n){if(!n)return t;var i=n;return i=i.replace(/\^/g,"\\^"),i=i.replace(/\$/g,"\\$"),i=i.replace(/\(/g,"\\("),i=i.replace(/\)/g,"\\)"),i=i.replace(/\[/g,"\\["),i=i.replace(/\]/g,"\\]"),i=i.replace(/\{/g,"\\{"),i=i.replace(/\}/g,"\\}"),i=i.replace(/\./g,"\\."),i=i.replace(/\+/g,"\\+"),i.replace(/\|/g,"\\|")},u.prototype.isStartWith=function(n,r){var e=this,u,o,f;return e.useWildCards&&e.hasWildcard(n)?(o=e.createStartWithRegex(n),o&&(u=r===i||r===t?"":r,o.lastIndex=-1,u!==i&&u!==t))?u.search(o)>-1:!1:r!==i&&r!==t&&r!==""?n===i||n===t?!1:(f=n,u=r,e.ignoreCase&&(f=f.toLowerCase(),u=u.toLowerCase()),u.slice(0,f.length)===f):n===i||n===t||n===""},u.prototype.createStartWithRegex=function(n){var i=this,r,u,f,e;if(i.regex)return i.regex;n=i.encodeExpression(n);r=n;u=new RegExp("\\"+i.questionMarkWildcard,"g");r=r.replace(u,i.questionMarkWildcardRegularExpression);u=new RegExp("\\"+i.asteriskWildcard,"g");r=r.replace(u,i.asteriskWildcardRegularExpression);f=t;try{e=i.ignoreCase?"ig":"g";f=n[0]===i.asteriskWildcard?new RegExp(r,e):new RegExp("^"+r,e)}catch(o){return t}return f},u.prototype.isEndWith=function(n,r){var e=this,u,o,f;return e.useWildCards&&e.hasWildcard(n)?(o=e.createEndWithRegex(n),o&&(u=r===i||r===t?"":r,o.lastIndex=-1,u!==i&&u!==t))?u.search(o)>-1:!1:r!==i&&r!==t&&r!==""?n===i||n===t?!1:(f=n,u=r,e.ignoreCase&&(f=f.toLowerCase(),u=u.toLowerCase()),u.slice(-f.length)===f):n===i||n===t||n===""},u.prototype.createEndWithRegex=function(n){var i=this,r,u,f,e;if(i.regex)return i.regex;n=i.encodeExpression(n);r=n;u=new RegExp("\\"+i.questionMarkWildcard,"g");r=r.replace(u,i.questionMarkWildcardRegularExpression);u=new RegExp("\\"+i.asteriskWildcard,"g");r=r.replace(u,i.asteriskWildcardRegularExpression);f=t;try{e=i.ignoreCase?"ig":"g";f=n[n.length-1]===i.asteriskWildcard?new RegExp(r,e):new RegExp(r+"$",e)}catch(o){return t}return f},u.prototype.isContains=function(n,r){var f=this,u,e,o;return f.useWildCards&&f.hasWildcard(n)?(e=f.createContainsRegex(n),e&&(u=r===i||r===t?"":r,e.lastIndex=-1,u!==i&&u!==t))?u.search(e)>-1:!1:r!==i&&r!==t&&r!==""?(o=n===i||n===t?"":n,u=r,f.ignoreCase&&(o=o.toLowerCase(),u=u.toLowerCase()),u.indexOf(o)>-1):n===i||n===t||n===""},u.prototype.createContainsRegex=function(n){var i=this,r,u,f,e;if(i.regex)return i.regex;n=i.encodeExpression(n);r=n;u=new RegExp("\\"+i.questionMarkWildcard,"g");r=r.replace(u,i.questionMarkWildcardRegularExpression);u=new RegExp("\\"+i.asteriskWildcard,"g");r=r.replace(u,i.asteriskWildcardRegularExpression);f=t;try{e=i.ignoreCase?"ig":"g";f=new RegExp(r,e)}catch(o){return t}return f},u.prototype.reset=function(){var n=this;n.expected=t;n.ignoreBlank=!1;n.compareType=0;n.useWildCards=!0;n.ignoreCase=!1;n.forceValue2Text=!1},u.prototype._isDefaultValue=function(n,i){switch(n){case"forceValue2Text":return i===!1;case"useWildCards":return i===!0;case"ignoreCase":return i===!1;case"regex":return i===t;case"ignoreBlank":return i===!1;default:return!1}},u.prototype.toJSON=function(){var n=this,r={compareType:n.compareType,expected:n.expected,formula:n.formula,forceValue2Text:n.forceValue2Text,useWildCards:n.useWildCards,ignoreCase:n.ignoreCase,regex:n.regex,conType:2,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(n,r){if(n){var u=this;n.compareType!==t&&n.compareType!==i&&(u.compareType=n.compareType);n.expected!==t&&n.expected!==i&&(u.expected=n.expected);n.formula!==t&&n.formula!==i&&(u.formula=n.formula);n.forceValue2Text!==t&&n.forceValue2Text!==i&&(u.forceValue2Text=n.forceValue2Text);n.useWildCards!==t&&n.useWildCards!==i&&(u.useWildCards=n.useWildCards);n.ignoreCase!==t&&n.ignoreCase!==i&&(u.ignoreCase=n.ignoreCase);n.regex!==t&&n.regex!==i&&(u.regex=n.regex);n.ignoreBlank!==t&&n.ignoreBlank!==i&&(u.ignoreBlank=n.ignoreBlank)}},u.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},u.prototype.setFormulas=function(n){this.formula=n[0]},u}(f);n.TextCondition=tt;wt=function(r){function u(n,t){r.call(this);this.conditionType="ColorCondition";this.ignoreBlank=!1;this.compareType=n;this.expected=t}return __extends(u,r),u.prototype.evaluate=function(n,t,i,r){return this.isEqualsColor(n,r)},u.prototype.isEqualsColor=function(n,r){var o=this,u=o.getColorFromString(o.expected),f,e;if(u!==i&&u!==t&&u!==""){if(f=o.getColorFromString(r),f!==i&&f!==t&&f!=="")return f.a===u.a&&f.r===u.r&&f.g===u.g&&f.b===u.b;else if(o.compareType===0?n&&n.getDefaultStyle&&(e=n.getDefaultStyle().backColor):o.compareType===1&&n&&n.getDefaultStyle&&(e=n.getDefaultStyle().foreColor),e)return u.a===e.a&&u.r===e.r&&u.g===e.g&&u.b===e.b}else if(o.ignoreBlank)return!0;return!1},u.prototype.getColorFromString=function(r){return r===i||r===t||r===""?t:n._Color.parse(r)},u.prototype.reset=function(){this.expected=t;this.ignoreBlank=!1;this.compareType=0},u.prototype._isDefaultValue=function(n,t){switch(n){case"ignoreBlank":return t===!1;default:return!1}},u.prototype.toJSON=function(){var n=this,r={compareType:n.compareType,expected:n.expected,conType:3,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(n,r){n&&(n.compareType!==t&&n.compareType!==i&&(this.compareType=n.compareType),n.expected!==t&&n.expected!==i&&(this.expected=n.expected),n.ignoreBlank!==t&&n.ignoreBlank!==i&&(this.ignoreBlank=n.ignoreBlank))},u}(f);n.ColorCondition=wt;it=function(r){function u(t,i){if(r.call(this,i),t&&typeof t!="string")throw new Error(n.SR.Exp_InvalidArgument);this.formula=t}return __extends(u,r),u.prototype.createCondition=function(){var f=this,n=f.ranges,e=new rt(4,!f.formula||f.formula===""?t:f.formula),i,r,u;if(n&&n.length>0){for(i=n[0].row,r=n[0].col,u=1;u<n.length;u++)i=i>n[u].row?n[u].row:i,r=r>n[u].col?n[u].col:r;i=i===-1?0:i;r=r===-1?0:r;e._baseRow=i;e._baseCol=r}return e},u.prototype.reset=function(){var n=this;n.formula=t;n.style=t;n._stopIfTrue=!1;n._priority=1},u.prototype.isFormula=function(n){return n&&n[0]==="="},u.prototype.toJSON=function(){var n=this,r={ruleType:3,ranges:n.ranges,style:n.style,formula:n.formula,priority:n._priority,stopIfTrue:n._stopIfTrue},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.formula!==t&&r.formula!==i&&(f.formula=r.formula);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.FormulaRule=it;rt=function(u){function f(i,r){var f,e,o;u.call(this);f=this;f.expected=t;f.ignoreBlank=!1;f.conditionType="FormulaCondition";f._baseRow=t;f._baseCol=t;f._expr=t;f.customValueType=i;e=r;typeof e=="string"&&(o=n.GC$.trim(e),e=o[0]==="="?o.substr(1):o);f.formula=e}return __extends(f,u),f.prototype.evaluate=function(u,f,e,o){var s,h,c;if(!n.util.hasCalc())return!1;if(s=this,s.customValueType===4){if(h=s.getExpected(u,f,e),s.ignoreBlank&&(h===i||h===t||h===""))return!0;try{return r.B(h)}catch(l){return!1}}else{c=r.err;switch(s.customValueType){case 0:return o===i||o===t||o==="";case 1:return o!==i&&o!==t&&o!=="";case 2:return c(o);case 3:return!c(o)}}return!1},f.prototype.getExpected=function(u,f,e){var o=this,y,s,a,v,l,h,c,p,w;if(o.formula&&o.formula.length>0){if(y=u.getCalcService(),!y)return o.expected;if(o._expr||((o._baseRow===i||o._baseRow===t)&&(o._baseCol===i||o._baseCol===t)&&(o._baseRow=f,o._baseCol=e),o._expr=y.parse(u._getSheetSource(),o.formula,o._baseRow,o._baseCol)),s=y.evaluateParsedFormula(u._getSheetSource(),o._expr,f,e,!0),r.ref(s)){for(a=s.getRowCount(0),v=s.getColumnCount(0),l=[],h=0;h<a;h++)for(l[h]=[],c=0;c<v;c++)l[h][c]=s.getValue(0,h,c);s=l}else if(r.arr(s)){for(a=s.getRowCount(),v=s.getColumnCount(),l=[],h=0;h<a;h++)for(l[h]=[],c=0;c<v;c++)l[h][c]=s.getValue(h,c);s=l}return s instanceof Array?(a=s.length,v=s[0].length,a===1&&v===1)?s[0][0]:(p=f-o._baseRow,w=e-o._baseCol,p<a&&w<v?s[p][w]:n.Calc.Errors.NotAvailable):s}else return o.expected},f.prototype.reset=function(){var n=this;n.expected=t;n.ignoreBlank=!1;n.customValueType=0;n._expr=t;n._baseRow=t;n._baseCol=t},f.prototype._isDefaultValue=function(n,i){switch(n){case"expected":return i===t;case"ignoreBlank":return i===!1;default:return!1}},f.prototype.toJSON=function(){var n=this,r={customValueType:n.customValueType,expected:n.expected,formula:n.formula,conType:4,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},f.prototype.fromJSON=function(n,r){if(n){var u=this;n.customValueType!==t&&n.customValueType!==i&&(u.customValueType=n.customValueType);n.expected!==t&&n.expected!==i&&(u.expected=n.expected);n.formula!==t&&n.formula!==i&&(u.formula=n.formula);n.ignoreBlank!==t&&n.ignoreBlank!==i&&(u.ignoreBlank=n.ignoreBlank)}},f.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},f.prototype.setFormulas=function(n){this.formula=n[0];this._expr=null},f}(f);n.FormulaCondition=rt;k=function(r){function u(t,i,u){r.call(this);var f=this;f.conditionType="DateCondition";f.ignoreBlank=!1;f.compareType=t;f.expected=i;f.formula=typeof u=="string"?w(n.GC$.trim(u),"="):u}return __extends(u,r),u.prototype.evaluate=function(n,r,u,f){var e=this,o;if((f===i||f===t||f==="")&&e.ignoreBlank)return!0;if(!(f instanceof Date))return!1;if(o=e.getExpectedDateTime(n,r,u),o===i||o===t)return!!e.ignoreBlank;switch(e.compareType){case 0:return e.isEquals(o,f);case 1:return!e.isEquals(o,f);case 4:return e.isAfter(o,f);case 5:return e.isAfter(o,f)||e.isEquals(o,f);case 2:return e.isBefore(o,f);case 3:return e.isBefore(o,f)||e.isEquals(o,f)}return!1},u.prototype.getExpectedDateTime=function(i,r,u){var f=this.getExpected(i,r,u);if(f instanceof Date)return f;else if(typeof f=="string")return n._DateTimeHelper.parseLocale(f);return t},u.prototype.getExpected=function(n,t,i){var r=this,u,f;return r.formula&&r.formula.length>0?(u=n.getCalcService(),!u)?r.expected:(f=u.parse(n._getSheetSource(),r.formula,t-this.offsetRow,i-this.offsetCol),u.evaluateParsedFormula(n._getSheetSource(),f,t,i,!1)):r.expected},u.prototype.isEquals=function(n,t){return n.getYear()===t.getYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()},u.prototype.isAfter=function(n,t){var i=this.createDayEnding(n);return t>i},u.prototype.createDayEnding=function(n){return new Date(n.getFullYear(),n.getMonth(),n.getDate(),23,59,59,999)},u.prototype.isBefore=function(n,t){var i=this.createDayBeginning(n);return t<i},u.prototype.createDayBeginning=function(n){return new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0)},u.prototype.reset=function(){this.expected=t;this.ignoreBlank=!1;this.compareType=0},u.prototype._isDefaultValue=function(n,t){switch(n){case"ignoreBlank":return t===!1;default:return!1}},u.prototype.toJSON=function(){var n=this,r={compareType:n.compareType,expected:n.expected,formula:n.formula,conType:5,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(r,u){if(r){var f=this;r.compareType!==t&&r.compareType!==i&&(f.compareType=r.compareType);r.expected!==t&&r.expected!==i&&(f.expected=n.GC$.getType(r.expected)==="string"?new Date(r.expected):r.expected);r.formula!==t&&r.formula!==i&&(f.formula=r.formula);r.ignoreBlank!==t&&r.ignoreBlank!==i&&(f.ignoreBlank=r.ignoreBlank)}},u.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},u.prototype.setFormulas=function(n){this.formula=n[0]},u}(f);n.DateCondition=k;ut=function(r){function u(n,t){r.call(this,t);this.type=n}return __extends(u,r),u.prototype.createCondition=function(){return new ft(this.type)},u.prototype.reset=function(){var n=this;n.type=0;n.style=t;n._stopIfTrue=!1;n._priority=1},u.prototype.toJSON=function(){var n=this,r={ruleType:4,ranges:n.ranges,style:n.style,type:n.type,priority:n._priority,stopIfTrue:n._stopIfTrue},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.type!==t&&r.type!==i&&(f.type=r.type);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.DateOccurringRule=ut;ft=function(n){function u(i){n.call(this);var r=this;r.ignoreBlank=!1;r.formula=t;r.expectTypeId=0;r.conditionType="DateExCondition";r.expected=i}return __extends(u,n),u.prototype.evaluate=function(n,r,u,f){var e=this.getExpectedInt(n,r,u);return e!==i&&e!==t?this.checkCondition(e,f):!1},u.prototype.getExpectedInt=function(n,i,r){var u=this.getExpected(n,i,r);return u=parseInt(u,10),isNaN(u)?t:u},u.prototype.getExpected=function(n,t,i){var r=this,u,f;return r.formula&&r.formula.length>0?(u=n.getCalcService(),!u)?r.expected:(f=u.parse(n._getSheetSource(),r.formula,t-this.offsetRow,i-this.offsetCol),u.evaluateParsedFormula(n._getSheetSource(),f,t,i,!1)):r.expected},u.prototype.checkCondition=function(n,u){var s=this,l=u,o,b,d,g,nt,tt,it,p,rt,ut,v,w,y;if(s.ignoreBlank&&(l===i||l===t||l===""))return!0;try{l=r.DT(l)}catch(st){return!1}if(s.expectTypeId===0){var h=t,c=t,e=new Date,f=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());switch(n){case 3:f.setDate(f.getDate()-6);h=new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0);c=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999);break;case 1:f.setDate(f.getDate()-1);h=new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0);c=new Date(f.getFullYear(),f.getMonth(),f.getDate(),23,59,59,999);break;case 0:h=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0);c=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999);break;case 2:f.setDate(f.getDate()+1);h=new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0);c=new Date(f.getFullYear(),f.getMonth(),f.getDate(),23,59,59,999);break;case 8:b=e;b.setDate(e.getDate()-e.getDay()-7);d=f;d.setDate(f.getDate()-f.getDay()-1);h=new Date(b.getFullYear(),b.getMonth(),b.getDate(),0,0,0,0);c=new Date(d.getFullYear(),d.getMonth(),d.getDate(),23,59,59,999);break;case 7:g=e;g.setDate(e.getDate()-e.getDay());nt=f;nt.setDate(f.getDate()-f.getDay()+6);h=new Date(g.getFullYear(),g.getMonth(),g.getDate(),0,0,0,0);c=new Date(nt.getFullYear(),nt.getMonth(),nt.getDate(),23,59,59,999);break;case 9:tt=e;tt.setDate(e.getDate()-e.getDay()+7);it=f;it.setDate(f.getDate()-f.getDay()+13);h=new Date(tt.getFullYear(),tt.getMonth(),tt.getDate(),0,0,0,0);c=new Date(it.getFullYear(),it.getMonth(),it.getDate(),23,59,59,999);break;case 5:p=e;p.setDate(1);p.setMonth(e.getMonth()-1);rt=f;rt.setDate(0);h=new Date(p.getFullYear(),p.getMonth(),p.getDate(),0,0,0,0);c=new Date(rt.getFullYear(),rt.getMonth(),rt.getDate(),23,59,59,999);break;case 4:ut=e;ut.setDate(1);v=f;v.setDate(1);v.setMonth(f.getMonth()+1);v.setDate(0);h=new Date(ut.getFullYear(),ut.getMonth(),ut.getDate(),0,0,0,0);c=new Date(v.getFullYear(),v.getMonth(),v.getDate(),23,59,59,999);break;case 6:w=e;w.setDate(1);w.setMonth(e.getMonth()+1);y=f;y.setDate(1);y.setMonth(f.getMonth()+2);y.setDate(0);h=new Date(w.getFullYear(),w.getMonth(),w.getDate(),0,0,0,0);c=new Date(y.getFullYear(),y.getMonth(),y.getDate(),23,59,59,999);break}if(h!==i&&h!==t&&c!==i&&c!==t){var ft=new k(5,h,t),et=new k(3,c,t),ot=new a(1,ft,et);return ot.evaluate(t,0,0,l)}}else if(s.expectTypeId===1){if(o=s.getExpectedInt(t,0,0),o!==i&&o!==t)return s.isEqualsYear(o,l)}else if(s.expectTypeId===2){if(o=s.getExpectedInt(t,0,0),o!==i&&o!==t)return s.isEqualsQuarter(o,l)}else if(s.expectTypeId===3){if(o=s.getExpectedInt(t,0,0),o!==i&&o!==t)return s.isEqualsMonth(o,l)}else if(s.expectTypeId===4){if(o=s.getExpectedInt(t,0,0),o!==i&&o!==t)return s.isEqualsWeek(o,l)}else if(s.expectTypeId===5&&(o=s.getExpectedInt(t,0,0),o!==i&&o!==t))return s.isEqualsDay(o,l);return!1},u.prototype.isEqualsYear=function(n,t){return n===t.getFullYear()},u.prototype.isEqualsQuarter=function(n,t){switch(n){case 0:return t.getMonth()>=0&&t.getMonth()<=2;case 1:return t.getMonth()>=3&&t.getMonth()<=5;case 2:return t.getMonth()>=6&&t.getMonth()<=8;case 3:return t.getMonth()>=9&&t.getMonth()<=11}return!1},u.prototype.isEqualsMonth=function(n,t){return n===t.getMonth()},u.prototype.isEqualsWeek=function(n,t){return n===t.getDay()},u.prototype.isEqualsDay=function(n,t){return n===t.getDate()},u.prototype.reset=function(){this.expected=t;this.ignoreBlank=!1;this.expectTypeId=0},u.prototype._isDefaultValue=function(n,i){switch(n){case"ignoreBlank":return i===!1;case"formula":return i===t;case"expectTypeId":return i===0;default:return!1}},u.prototype.toJSON=function(){var n=this,r={ignoreBlank:n.ignoreBlank,formula:n.formula,expected:n.expected,expectTypeId:n.expectTypeId,conType:6},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(n,r){if(n){var u=this;n.ignoreBlank!==t&&n.ignoreBlank!==i&&(u.ignoreBlank=n.ignoreBlank);n.formula!==t&&n.formula!==i&&(u.formula=n.formula);n.expected!==t&&n.expected!==i&&(u.expected=n.expected);n.expectTypeId!==t&&n.expectTypeId!==i&&(u.expectTypeId=n.expectTypeId)}},u.fromDay=function(n){var t=new u(n);return t.expectTypeId=5,t},u.fromMonth=function(n){var t=new u(n);return t.expectTypeId=3,t},u.fromQuarter=function(n){var t=new u(n);return t.expectTypeId=2,t},u.fromWeek=function(n){var t=new u(n);return t.expectTypeId=4,t},u.fromYear=function(n){var t=new u(n);return t.expectTypeId=1,t},u.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},u.prototype.setFormulas=function(n){this.formula=n[0]},u}(f);n.DateExCondition=ft;bt=function(r){function u(t,i,u){r.call(this);var f=this;f.ignoreBlank=!1;f.conditionType="TextLengthCondition";f.compareType=t;f.expected=i;f.formula=typeof u=="string"?w(n.GC$.trim(u),"="):u}return __extends(u,r),u.prototype.evaluate=function(n,r,u,f){if(f===i||f===t||f==="")return this.ignoreBlank;var o=f===i||f===t?0:f.toString().length,e=this.getExpectedInt(n,r,u);if(typeof e=="number")switch(this.compareType){case 0:return o===e;case 2:return o>e;case 3:return o>=e;case 4:return o<e;case 5:return o<=e;case 1:return o!==e}return!1},u.prototype.getExpectedInt=function(n,i,r){var u=this.getExpected(n,i,r);return u=parseInt(u,10),isNaN(u)?t:u},u.prototype.getExpected=function(n,t,i){var r=this,u,f;return r.formula&&r.formula.length>0?(u=n.getCalcService(),!u)?r.expected:(f=u.parse(n._getSheetSource(),r.formula,t-this.offsetRow,i-this.offsetCol),u.evaluateParsedFormula(n._getSheetSource(),f,t,i,!1)):r.expected},u.prototype.reset=function(){this.expected=t;this.ignoreBlank=!1;this.compareType=0},u.prototype._isDefaultValue=function(n,t){switch(n){case"ignoreBlank":return t===!1;default:return!1}},u.prototype.toJSON=function(){var n=this,r={compareType:n.compareType,expected:n.expected,formula:n.formula,conType:7,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(n,r){if(n){var u=this;n.compareType!==t&&n.compareType!==i&&(u.compareType=n.compareType);n.expected!==t&&n.expected!==i&&(u.expected=n.expected);n.formula!==t&&n.formula!==i&&(u.formula=n.formula);n.ignoreBlank!==t&&n.ignoreBlank!==i&&(u.ignoreBlank=n.ignoreBlank)}},u.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},u.prototype.setFormulas=function(n){this.formula=n[0]},u}(f);n.TextLengthCondition=bt;et=function(r){function u(n,t,i){r.call(this,i);this.type=n;this.rank=t}return __extends(u,r),u.prototype.createCondition=function(){return new b(this.type,this.rank,this.ranges)},u.prototype.reset=function(){var n=this;n.type=0;n.rank=10;n.style=t;n._stopIfTrue=!1;n._priority=1},u.prototype.toJSON=function(){var n=this,r={ruleType:5,ranges:n.ranges,style:n.style,type:n.type,rank:n.rank,priority:n._priority,stopIfTrue:n._stopIfTrue},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.type!==t&&r.type!==i&&(f.type=r.type);r.rank!==t&&r.rank!==i&&(f.rank=r.rank);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.Top10Rule=et;b=function(u){function f(n,i,r){u.call(this);var f=this;f.isPercent=!1;f.ignoreBlank=!1;f.conditionType="Top10Condition";f.formula=t;f.expected=i;f.type=n;f.ranges=r}return __extends(f,u),f.prototype.evaluate=function(r,u,f,e){var o=this,s,h,c;if(e===i||e===t||e==="")return o.ignoreBlank;if(s=o.getExpectedInt(r,u,f),s!==i&&s!==t&&(h=t,o.type===0?h=o.getMaxValues(r,s,o.ranges):o.type===1&&(h=o.getMinValues(r,s,o.ranges)),h)){c=0;try{c=o._toDouble(e)}catch(l){return!1}if(n.ArrayHelper.contains(h,c))return!0}return!1},f.prototype.getExpectedInt=function(n,i,r){var u=this.getExpected(n,i,r);return u=parseInt(u,10),isNaN(u)||!isFinite(u)?t:u},f.prototype.getExpected=function(n,t,i){var r=this,u,f;return r.formula&&r.formula.length>0?(u=n.getCalcService(),!u)?r.expected:(f=u.parse(n._getSheetSource(),r.formula,t,i),u.evaluateParsedFormula(n._getSheetSource(),f,t,i,!1)):r.expected},f.prototype.adjustRange=function(t,i){return new n.Range(t.row,t.col,Math.min(t.rowCount,i.getRowCount()),Math.min(t.colCount,i.getColumnCount()))},f.prototype.getMaxValues=function(i,r,u){var f=[],a,v,y,h,nt;if(!u)return f;var p=this._cloneToActualRanges(i,u),o=Number.MAX_VALUE,w=0,tt=p.length,s,b,k,d,g,c,e;for(a=0;a<tt;a++)for(s=p[a],s=this.adjustRange(s,i),b=s.rowCount,k=s.colCount,v=0;v<b;v++)for(d=v+s.row,y=0;y<k;y++)if(g=y+s.col,c=i.getValue(d,g),e=this._toDouble(c),typeof c!==l&&c!==t&&typeof e!==l&&e!==t)try{if(w<r)f.push(e),e<o&&(o=e),w++;else if(e>o&&(n.ArrayHelper.remove(f,o),f.push(e),n.ArrayHelper.indexOf(f,o)<0))for(o=e,h=0,nt=f.length;h<nt;h++)f[h]<o&&(o=f[h])}catch(it){}return f},f.prototype.getMinValues=function(i,r,u){var f=[],a,v,y,h,nt;if(!u)return f;var p=this._cloneToActualRanges(i,u),o=-Number.MAX_VALUE,w=0,tt=p.length,s,b,k,d,g,c,e;for(a=0;a<tt;a++)for(s=p[a],s=this.adjustRange(s,i),b=s.rowCount,k=s.colCount,v=0;v<b;v++)for(d=v+s.row,y=0;y<k;y++)if(g=y+s.col,c=i.getValue(d,g),e=this._toDouble(c),typeof c!==l&&c!==t&&typeof e!==l&&e!==t)try{if(w<r)f.push(e),e>o&&(o=e),w++;else if(e<o&&(n.ArrayHelper.remove(f,o),f.push(e),n.ArrayHelper.indexOf(f,o)<0))for(o=e,h=0,nt=f.length;h<nt;h++)f[h]>o&&(o=f[h])}catch(it){}return f},f.prototype.reset=function(){var n=this;n.expected=t;n.ignoreBlank=!1;n.type=0;n.isPercent=!1;n.ranges=t},f.prototype._toDouble=function(i){return(typeof i=="number"||i instanceof Date)&&n.util.hasCalc()?r.D(i):t},f.prototype._isDefaultValue=function(n,i){switch(n){case"formula":return i===t;case"isPercent":return i===!1;case"ignoreBlank":return i===!1;default:return!1}},f.prototype.toJSON=function(){var n=this,r={expected:n.expected,formula:n.formula,type:n.type,isPercent:n.isPercent,ignoreBlank:n.ignoreBlank,ranges:n.ranges,conType:8},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},f.prototype.fromJSON=function(r,u){var f,o,e;if(r&&(f=this,r.expected!==t&&r.expected!==i&&(f.expected=r.expected),r.formula!==t&&r.formula!==i&&(f.formula=r.formula),r.type!==t&&r.type!==i&&(f.type=r.type),r.isPercent!==t&&r.isPercent!==i&&(f.isPercent=r.isPercent),r.ignoreBlank!==t&&r.ignoreBlank!==i&&(f.ignoreBlank=r.ignoreBlank),r.ranges))for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount))},f.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},f.prototype.setFormulas=function(n){this.formula=n[0]},f}(f);n.Top10Condition=b;ot=function(r){function u(n){r.call(this,n)}return __extends(u,r),u.prototype.createCondition=function(){return new d(!1,this.ranges)},u.prototype.toJSON=function(){var n=this,r={ruleType:6,ranges:n.ranges,style:n.style,priority:n._priority,stopIfTrue:n._stopIfTrue},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.UniqueRule=ot;st=function(r){function u(n){r.call(this,n)}return __extends(u,r),u.prototype.createCondition=function(){return new d(!0,this.ranges)},u.prototype.toJSON=function(){var n=this,r={ruleType:7,ranges:n.ranges,style:n.style,priority:n._priority,stopIfTrue:n._stopIfTrue},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.DuplicateRule=st;d=function(u){function f(n,i){u.call(this);var r=this;r.conditionType="UniqueCondition";r.ignoreBlank=!1;r.formula=t;r.expected=n;r.ranges=i}return __extends(f,u),f.prototype.evaluate=function(u,f,e,o){var c=this,s=o,h,l;return s===i||s===t||s===""?c.ignoreBlank:(n.util.hasCalc()&&r.num(s)&&(s=r.D(s)),h=c.getExpectedBoolean(u,f,e),h!==i&&h!==t)?(l=c.getDuplicated(u,c.ranges),l!==i&&l!==t)?n.ArrayHelper.contains(l,s)?h===!0:h!==!0:h!==!0:!1},f.prototype.getExpectedBoolean=function(n,i,u){var f=this.getExpected(n,i,u);try{return r.B(f)}catch(e){return t}},f.prototype.getExpected=function(n,t,i){var r=this,u,f;return r.formula&&r.formula.length>0?(u=n.getCalcService(),!u)?r.expected:(f=u.parse(n._getSheetSource(),r.formula,t-r.offsetRow,i-r.offsetCol),u.evaluateParsedFormula(n._getSheetSource(),f,t,i,!1)):r.expected},f.prototype.adjustRange=function(t,i){return new n.Range(t.row,t.col,Math.min(t.rowCount,i.getRowCount()),Math.min(t.colCount,i.getColumnCount()))},f.prototype.getDuplicated=function(u,f){var e=[],p=[],w=this._cloneToActualRanges(u,f),b,l,o,a,k,v,d,s;if(w){for(b=w.length,l=0;l<b;l++)for(o=w[l],o=this.adjustRange(o,u),a=0;a<o.rowCount;a++)for(k=a+o.row,v=0;v<o.colCount;v++)d=v+o.col,s=u.getValue(k,d,3),s!==i&&s!==t&&n.util.hasCalc()&&r.num(s)&&(s=r.D(s)),e.push(s);e.sort();for(var h=0,c=0,g=e.length,y=e[h];c<g;)e[c]!==y&&(c!==h+1&&p.push(y),h=c,y=e[h]),c++;h!==g-1&&p.push(y)}return e=t,p},f.prototype._containsKey=function(n,t){for(var r=n.length,i=0;i<r;i++)if(n[i].key===t)return!0;return!1},f.prototype.reset=function(){this.expected=t;this.ignoreBlank=!1;this.ranges=t},f.prototype._isDefaultValue=function(n,i){switch(n){case"formula":return i===t;case"ignoreBlank":return i===!1;default:return!1}},f.prototype.toJSON=function(){var n=this,r={expected:n.expected,formula:n.formula,ranges:n.ranges,conType:9,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},f.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.expected!==t&&r.expected!==i&&(f.expected=r.expected),r.formula!==t&&r.formula!==i&&(f.formula=r.formula),r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.ignoreBlank!==t&&r.ignoreBlank!==i&&(f.ignoreBlank=r.ignoreBlank)}},f.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},f.prototype.setFormulas=function(n){this.formula=n[0]},f}(f);n.UniqueCondition=d;ht=function(r){function u(n,t){r.call(this,t);this.type=n}return __extends(u,r),u.prototype.createCondition=function(){return new ct(this.type,this.ranges)},u.prototype.reset=function(){var n=this;n.type=0;n.style=t;n._stopIfTrue=!1;n._priority=1},u.prototype.toJSON=function(){var n=this,r={ruleType:8,ranges:n.ranges,style:n.style,type:n.type,priority:n._priority,stopIfTrue:n._stopIfTrue},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.style&&(f.style=new n.Style,f.style.fromJSON(r.style,u));r.type!==t&&r.type!==i&&(f.type=r.type);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);r.stopIfTrue!==t&&r.stopIfTrue!==i&&(f._stopIfTrue=r.stopIfTrue)}},u}(s);n.AverageRule=ht;ct=function(u){function f(n,i){u.call(this);var r=this;r.conditionType="AverageCondition";r.ignoreBlank=!1;r._expr=t;r._stdevExpr=t;r.type=n;r.ranges=i}return __extends(f,u),f.prototype.evaluate=function(u,f,e,o){var l,a,c;if(!n.util.hasCalc())return!1;if(l=this,l.ignoreBlank&&(o===i||o===t||o===""))return!0;a=r.D;l._rebuildFormula();var h=l.getExpectedDouble(u,f,e),s=t,v=l._stdevExpr?l._getExpectedByExpression(u,l._stdevExpr,f,e):t;if(v!==i&&v!==t)try{s=a(v)}catch(y){s=NaN}if(r.num(o)&&(c=a(o),!isNaN(h)))switch(l.type){case 0:return c>h;case 1:return c<h;case 2:return c>=h;case 3:return c<=h;case 4:return isNaN(s)?!1:c>h+s;case 5:return isNaN(s)?!1:c<h-s;case 6:return isNaN(s)?!1:c>h+2*s;case 7:return isNaN(s)?!1:c<h-2*s;case 8:return isNaN(s)?!1:c>h+3*s;case 9:return isNaN(s)?!1:c<h-3*s}return!1},f.prototype._rebuildFormula=function(){var n=this;n.ranges&&(n._expr=n._createExpression("AVERAGE",n.ranges),(n.type===4||n.type===5||n.type===6||n.type===7||n.type===8||n.type===9)&&(n._stdevExpr=n._createExpression("STDEV",n.ranges)))},f.prototype._createExpression=function(i,r){var f,o,u;if(!n.util.hasCalc())return t;var s=n.Calc.Expressions,h=n.Calc.Functions,e=h.findGlobalFunction(i);if(e){for(f=[],o=r.length,u=0;u<o;u++)f[u]=dt(r[u]);return new s.FunctionExpression(e,f)}return t},f.prototype.getExpectedDouble=function(n,t,i){var u=this.getExpected(n,t,i);try{return r.D(u)}catch(f){return NaN}},f.prototype.getExpected=function(n,i,r){var u=n.getCalcService(),f;return u?(f=u.unparseWithoutCulture(t,this._expr,i,r),this._expr=u.parse(n._getSheetSource(),f,i,r),u.evaluateParsedFormula(n._getSheetSource(),this._expr,i,r,!1)):t},f.prototype._getExpectedByExpression=function(n,i,r,u){var f=n.getCalcService(),e;return f?(e=f.unparseWithoutCulture(t,i,r-this.offsetRow,u-this.offsetCol),i=f.parse(n._getSheetSource(),e,r,u),f.evaluateParsedFormula(n._getSheetSource(),i,r,u,!1)):t},f.prototype.reset=function(){var n=this;n.ignoreBlank=!1;n.type=0;n.ranges=t;n._expr=t;n._stdevExpr=t},f.prototype._isDefaultValue=function(n,t){switch(n){case"ignoreBlank":return t===!1;default:return!1}},f.prototype.toJSON=function(){var n=this,r={type:n.type,ranges:n.ranges,conType:10,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},f.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.type!==t&&r.type!==i&&(f.type=r.type),r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.ignoreBlank!==t&&r.ignoreBlank!==i&&(f.ignoreBlank=r.ignoreBlank)}},f}(f);n.AverageCondition=ct;u=function(){function n(n,t){this.type=n;this.value=t}return n}();n.ScaleValue=u;v=function(u){function f(n,i,r){u.call(this,t);var f=this;f.expected=[];f.lowestValueCached=t;f.highestValueCached=t;f.cached=!1;f._oldRanges=t;f.scales=[n,i,r]}return __extends(f,u),f.prototype.stopIfTrue=function(){return this._stopIfTrue},f.prototype.isScaleRule=function(){return!0},f.prototype.createCondition=function(){return t},f.prototype._calculateLowestValueEx=function(n){var i=(new b).getMinValues(n,1,this.ranges);return i.length>0?i[0]:t},f.prototype._calculateHighestValueEx=function(n){var i=(new b).getMaxValues(n,1,this.ranges);return i.length>0?i[0]:t},f.prototype._cloneRanges=function(t){for(var u=[],f=t.length,i,r=0;r<f;r++)i=t[r],u.push(new n.Range(i.row,i.col,i.rowCount,i.colCount));return u},f.prototype._rangesChanged=function(){var t=this._oldRanges,i=this.ranges,u,r,n;if(!t)return t=this._oldRanges=this._cloneRanges(i),!1;if(u=t.length,r=i.length,u!==r)return!0;for(n=0;n<r;n++)if(!t[n].equals(i[n]))return!0;return!1},f.prototype._tryCache=function(n){var t=this;t._rangesChanged()&&(t._clearCache(),t._oldRanges=t._cloneRanges(t.ranges));t.cached===!1&&(t.lowestValueCached=t._calculateLowestValueEx(n),t.highestValueCached=t._calculateHighestValueEx(n),t.cached=!0)},f.prototype._clearCache=function(){this.lowestValueCached=t;this.highestValueCached=t;this.cached=!1},f.prototype._calculateFormula=function(n,i,r,u){var f,e;return u&&u.length>0?(f=n.getCalcService(),!f)?t:(e=f.parse(n._getSheetSource(),u,i,r),f.evaluateParsedFormula(n._getSheetSource(),e,i,r,!1)):t},f.prototype._isFormula=function(n){return n&&n[0]==="="},f.prototype._trimFormula=function(n){return n===i||n===t||n===""?t:n[0]==="="?n.substr(1):n},f.prototype._calculateValue=function(n,i,u,f){var e=t;if(this._isFormula(f))e=this._calculateFormula(n,i,u,this._trimFormula(f.toString()));else try{e=r.D(f)}catch(o){e=NaN}return e},f.prototype._getHighestValue=function(n){return this._tryCache(n),this.highestValueCached},f.prototype._getLowestValue=function(n){return this._tryCache(n),this.lowestValueCached},f.prototype._calculatePercent=function(n,i,r,u){var e=this._calculateValue(n,i,r,u),f,o;return!isNaN(e)&&0<=e&&e<=100&&(f=this._getLowestValue(n),o=this._getHighestValue(n),typeof f!==l&&f!==t&&typeof o!==l&&o!==t)?f+(o-f)*e/100:t},f.prototype._calculatePercentile=function(n,i,u,f){var e=this._calculateValue(n,i,u,f),o;if(!isNaN(e)&&0<=e&&e<=100){var h=0,c=this.ranges,l=c.length;for(o=0;o<l;o++){var a=this._createExpression("PERCENTILE",[n._getActualRange(c[o]),e/100]),s=n.getCalcService(),v=s.unparseWithoutCulture(t,a,i,u),a=s.parse(n._getSheetSource(),v,i,u),y=s.evaluateParsedFormula(n._getSheetSource(),a,i,u,!1);try{h+=r.D(y)}catch(p){}}return h/l}return t},f.prototype._getActualValue=function(n,i,r,u,f){var e=this,o=e.scales[u],s,h;if(o)switch(o.type){case 6:return e._calculateValue(n,i,r,o.value);case 2:return e._getHighestValue(n);case 1:return e._getLowestValue(n);case 0:return e._calculateValue(n,i,r,o.value);case 3:return e._calculatePercent(n,i,r,o.value);case 4:return e._calculatePercentile(n,i,r,o.value);case 7:return s=e._getHighestValue(n),s<0?0:s;case 5:return h=e._getLowestValue(n),h>0?0:h}return t},f.prototype._evaluate2Scale=function(n,t,i){return n===t&&n===i?1:n<=t?0:n>=i?1:(n-t)/(i-t)},f.prototype.evaluate=function(n,u,f,e){var s=this,a;if(s._tryCache(n),s.contains(u,f)){if(e===i||e===t)return t;try{var c=r.D(e),o=s._getActualValue(n,u,f,0),l=s._getActualValue(n,u,f,1),h=s._getActualValue(n,u,f,2);if(isNaN(l)){if(!isNaN(o)&&!isNaN(h))return o>h?t:s._evaluate2Scale(c,o,h)}else if(!isNaN(o)&&!isNaN(h)&&!isNaN(l))return o>h?t:c<o?0:c>=h?2:(a=s._evaluate2Scale(l,o,h),o<=c&&c<=l?s._evaluate2Scale(c,o,l):1+s._evaluate2Scale(c,o,h))}catch(v){return t}}return t},f.prototype._evaluateColor=function(i,r,u){if(0<=i&&i<=1){var f=n._Color.parse(r),e=n._Color.parse(u),o=f.a*(1-i)+e.a*i,s=f.r*(1-i)+e.r*i,h=f.g*(1-i)+e.g*i,c=f.b*(1-i)+e.b*i;return new n._Color(parseFloat(o/255),parseInt(s,10),parseInt(h,10),parseInt(c,10)).toString()}return t},f.prototype._createExpression=function(i,r){var f,o,u;if(!n.util.hasCalc())return t;var s=n.Calc.Expressions,h=n.Calc.Functions,e=h.findGlobalFunction(i);if(e){for(f=[],o=r.length,u=0;u<o;u++)f[u]=dt(r[u]);return new s.FunctionExpression(e,f)}return t},f.prototype._addRows=function(n,t){u.prototype._addRows.call(this,n,t);this._clearCache()},f.prototype._addColumns=function(n,t){u.prototype._addColumns.call(this,n,t);this._clearCache()},f.prototype._removeRows=function(n,t){u.prototype._removeRows.call(this,n,t);this._clearCache()},f.prototype._removeColumns=function(n,t){u.prototype._removeColumns.call(this,n,t);this._clearCache()},f}(s);n.ScaleRule=v;lt=function(f){function e(i,r,e,o,s,h){var c=i,l=r,a=e,v=o,y=s,p=h,w,b;arguments.length===0&&(c=1,l=t,a=new n._Color(0,255,255,255).toString(),v=2,y=t,p=new n._Color(255,99,190,123).toString());w=new u(c,l);b=new u(v,y);f.call(this,w,t,b);this.expected[0]=a;this.expected[2]=p}return __extends(e,f),e.prototype.evaluate=function(n,u,f,e){var s,l;if(e!==i&&e!==t){s=NaN;try{r.num(e)&&(s=r.D(e))}catch(a){return t}if(isNaN(s))return t;var o=this,h=o._getActualValue(n,u,f,0),c=o._getActualValue(n,u,f,2);if(h!==i&&h!==t&&c!==i&&c!==t)return l=o._evaluate2Scale(s,h,c),o._evaluateColor(l,o.expected[0],o.expected[2])}return t},e.prototype._init=function(){var i=this;i.scales=new Array(3);i.scales[0]=new u(1,t);i.scales[2]=new u(2,t);i.expected=new Array(3);i.expected[0]=new n._Color(0,255,255,255).toString();i.expected[2]=new n._Color(255,99,190,123).toString()},e.prototype.reset=function(){var n=this;n.ranges=t;n.condition=t;n.style=t;n._stopIfTrue=!1;n._priority=1;n._init()},e.prototype.getMinimumType=function(){var n=this.scales;return n&&n.length===3?n[0].type:t},e.prototype.setMinimumType=function(n){var t=this.scales;t&&t.length===3&&(t[0].type=n)},e.prototype.getMinimumValue=function(){var n=this.scales;return n&&n.length===3?n[0].value:t},e.prototype.setMinimumValue=function(n){var t=this.scales;t&&t.length===3&&(t[0].value=n)},e.prototype.getMinimumColor=function(){return this.expected&&this.expected.length===3?this.expected[0]:t},e.prototype.setMinimumColor=function(n){this.expected&&this.expected.length===3&&(this.expected[0]=n)},e.prototype.getMaximumType=function(){var n=this.scales;return n&&n.length===3?n[2].type:t},e.prototype.setMaximumType=function(n){var t=this.scales;t&&t.length===3&&(t[2].type=n)},e.prototype.getMaximumValue=function(){var n=this.scales;return n&&n.length===3?n[2].value:t},e.prototype.setMaximumValue=function(n){var t=this.scales;t&&t.length===3&&(t[2].value=n)},e.prototype.getMaximumColor=function(){return this.expected&&this.expected.length===3?this.expected[2]:t},e.prototype.setMaximumColor=function(n){this.expected&&this.expected.length===3&&(this.expected[2]=n)},e.prototype._isDefaultValue=function(n,i){switch(n){case"ranges":return i===t;case"priority":return i===1;case"stopIfTrue":return i===!1;default:return!1}},e.prototype.toJSON=function(){var n=this,r={ruleType:10,ranges:n.ranges,minType:n.getMinimumType(),minValue:n.getMinimumValue(),minColor:n.getMinimumColor(),maxType:n.getMaximumType(),maxValue:n.getMaximumValue(),maxColor:n.getMaximumColor(),priority:n._priority},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},e.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.minType!==t&&r.minType!==i&&f.setMinimumType(r.minType);r.minValue!==t&&r.minValue!==i&&f.setMinimumValue(r.minValue);r.minColor!==t&&r.minColor!==i&&f.setMinimumColor(r.minColor);r.maxType!==t&&r.maxType!==i&&f.setMaximumType(r.maxType);r.maxValue!==t&&r.maxValue!==i&&f.setMaximumValue(r.maxValue);r.maxColor!==t&&r.maxColor!==i&&f.setMaximumColor(r.maxColor);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);f._stopIfTrue=!1}},e}(v);n.TwoScaleRule=lt;at=function(f){function e(i,r,e,o,s,h,c,l,a){var v=i,y=r,p=e,w=o,b=s,k=h,d=c,g=l,nt=a;arguments.length===0&&(v=1,y=t,p=new n._Color(255,248,105,107).toString(),w=4,b=50,k=new n._Color(255,255,235,132).toString(),d=2,g=t,nt=new n._Color(255,99,190,123).toString());f.call(this,new u(v,y),new u(w,b),new u(d,g));this.expected[0]=p;this.expected[1]=k;this.expected[2]=nt}return __extends(e,f),e.prototype.evaluate=function(n,u,f,e){var o=this,s,a;if(o._evaluator=n,e!==i&&e!==t){s=NaN;try{r.num(e)&&(s=r.D(e))}catch(v){return t}if(isNaN(s))return t;var h=o._getActualValue(n,u,f,0),l=o._getActualValue(n,u,f,1),c=o._getActualValue(n,u,f,2);if(h!==i&&h!==t&&c!==i||c!==t&&l!==i&&l!==t)return h>c?t:s<=h||h===c?s>=c?o.expected[2]:o.expected[0]:s>=c?o.expected[2]:h<=s&&s<=l?(a=o._evaluate2Scale(s,h,l),o._evaluateColor(a,o.expected[0],o.expected[1])):(a=o._evaluate2Scale(s,l,c),o._evaluateColor(a,o.expected[1],o.expected[2]))}return t},e.prototype._init=function(){var i=this;i.scales=new Array(3);i.scales[0]=new u(1,t);i.scales[1]=new u(4,50);i.scales[2]=new u(2,t);i.expected=new Array(3);i.expected[0]=new n._Color(255,248,105,107).toString();i.expected[1]=new n._Color(255,255,235,132).toString();i.expected[2]=new n._Color(255,99,190,123).toString()},e.prototype.reset=function(){var n=this;n.ranges=t;n.condition=t;n.style=t;n._init();n._evaluator=t;n._stopIfTrue=!1;n._priority=1},e.prototype.getMinimumType=function(){var n=this.scales;return n&&n.length===3?n[0].type:t},e.prototype.setMinimumType=function(n){var t=this.scales;t&&t.length===3&&(t[0].type=n)},e.prototype.getMinimumValue=function(){var n=this.scales;return n&&n.length===3?n[0].value:t},e.prototype.setMinimumValue=function(n){var t=this.scales;t&&t.length===3&&(t[0].value=n)},e.prototype.getMinimumColor=function(){return this.expected&&this.expected.length===3?this.expected[0]:t},e.prototype.setMinimumColor=function(n){this.expected&&this.expected.length===3&&(this.expected[0]=n)},e.prototype.getMidpointType=function(){var n=this.scales;return n&&n.length===3?n[1].type:t},e.prototype.setMidpointType=function(n){var t=this.scales;t&&t.length===3&&(t[1].type=n)},e.prototype.getMidpointValue=function(){var n=this,i=n.scales;if(i&&i.length===3){if(n._evaluator)if(i[1].type===2)return n._getHighestValue(n._evaluator);else if(i[1].type===1)return n._getLowestValue(n._evaluator);return i[1].value}return t},e.prototype.setMidpointValue=function(n){var t=this.scales;t&&t.length===3&&(t[1].value=n)},e.prototype.getMidpointColor=function(){return this.expected&&this.expected.length===3?this.expected[1]:t},e.prototype.setMidpointColor=function(n){this.expected&&this.expected.length===3&&(this.expected[1]=n)},e.prototype.getMaximumType=function(){var n=this.scales;return n&&n.length===3?n[2].type:t},e.prototype.setMaximumType=function(n){var t=this.scales;t&&t.length===3&&(t[2].type=n)},e.prototype.getMaximumValue=function(){var n=this.scales;return n&&n.length===3?n[2].value:t},e.prototype.setMaximumValue=function(n){var t=this.scales;t&&t.length===3&&(t[2].value=n)},e.prototype.getMaximumColor=function(){return this.expected&&this.expected.length===3?this.expected[2]:t},e.prototype.setMaximumColor=function(n){this.expected&&this.expected.length===3&&(this.expected[2]=n)},e.prototype._isDefaultValue=function(n,i){switch(n){case"ranges":return i===t;case"priority":return i===1;case"stopIfTrue":return i===!1;default:return!1}},e.prototype.toJSON=function(){var n=this,r={ruleType:11,ranges:n.ranges,minType:n.getMinimumType(),minValue:n.getMinimumValue(),minColor:n.getMinimumColor(),midType:n.getMidpointType(),midValue:n.getMidpointValue(),midColor:n.getMidpointColor(),maxType:n.getMaximumType(),maxValue:n.getMaximumValue(),maxColor:n.getMaximumColor(),priority:n._priority},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},e.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.minType!==t&&r.minType!==i&&f.setMinimumType(r.minType);r.minValue!==t&&r.minValue!==i&&f.setMinimumValue(r.minValue);r.minColor!==t&&r.minColor!==i&&f.setMinimumColor(r.minColor);r.midType!==t&&r.midType!==i&&f.setMidpointType(r.midType);r.midValue!==t&&r.midValue!==i&&f.setMidpointValue(r.midValue);r.midColor!==t&&r.midColor!==i&&f.setMidpointColor(r.midColor);r.maxType!==t&&r.maxType!==i&&f.setMaximumType(r.maxType);r.maxValue!==t&&r.maxValue!==i&&f.setMaximumValue(r.maxValue);r.maxColor!==t&&r.maxColor!==i&&f.setMaximumColor(r.maxColor);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);f._stopIfTrue=!1}},e}(v);n.ThreeScaleRule=at;vt=function(f){function e(i,r,e,o,s){var h=i,c=r,l=e,a=o,v=s,y,p;arguments.length===0&&(h=5,c=t,l=7,a=t,v=new n._Color(255,99,142,198).toString());y=new u(h,c);p=new u(l,a);f.call(this,y,t,p);this._init(v)}return __extends(e,f),e.prototype._init=function(n){var t=this;t._gradient=!0;t._color=n;t._showBorder=!1;t._borderColor="black";t._dataBarDirection=0;t._negativeFillColor="red";t._useNegativeFillColor=!0;t._negativeBorderColor="black";t._useNegativeBorderColor=!1;t._axisPosition=0;t._axisColor="black";t._showBarOnly=!1},e.prototype.reset=function(){var i=this;i.ranges=t;i.condition=t;i.style=t;i._init(new n._Color(255,99,142,198).toString());i._stopIfTrue=!1;i._priority=1;i.scales=[];i.scales[0]=new u(5,t);i.scales[2]=new u(7,t);i.expected=[]},e.prototype._calcuteMinValue=function(n,i,r,u,f){var e=this,l=e.scales[u],c=t,o,s,h;if(l)if(l.type===6||l.type===4){for(o=0;o<e.ranges.length;o++)if(e.ranges[o].intersect(i,-1,1,-1)){c=e.ranges[o];break}if(c)return s=c.row,h=c.col,s=s===-1?0:s,h=h===-1?0:h,e._getActualValue(n,s,h,0,f)}else return e._getActualValue(n,i,r,0,f);return t},e.prototype._calcuteMaxValue=function(n,i,r,u,f){var e=this,l=e.scales[u],c=t,o,s,h;if(l)if(l.type===6||l.type===4){for(o=0;o<e.ranges.length;o++)if(e.ranges[o].intersect(i,-1,1,-1)){c=e.ranges[o];break}if(c)return s=c.row,h=c.col,s=s===-1?0:s,h=h===-1?0:h,e._getActualValue(n,s,h,2,f)}else return e._getActualValue(n,i,r,2,f);return t},e.prototype._evaluateNoneScale=function(n,t,i,r){return(r=0,i===t)?n<t?[0,r]:n>i?[1,r]:[.5,r]:n>=i?[1,r]:n<=t?[0,r]:[(n-t)/(i-t),r]},e.prototype._evaluateMidScale=function(n,t,i,r){var u,f,e;if(r=.5,u=y(i-t),i>0&&t>=0)return i===t?[.5,r]:n>=i?[.5,r]:n<=t?[t/i*.5,r]:[y(n/i)*.5,r];else if(i>0&&t<0)return f=i>y(t)?.5:i/u,e=i>y(t)?t/u:-.5,n>0?n>=i?[f,r]:[n/i*f,r]:n<0?n<=t?[e,r]:[n/t*e,r]:[0,r];else if(i<=0&&t<0)return i===t?[-.5,r]:n>=i?[-i/t*.5,r]:n<=t?[-.5,r]:[-n/t*.5,r];else if(i===0&&t===0)return[0,r];return r=-1,[-1,r]},e.prototype._evaluateAutoScale=function(n,t,i,r){var u=y(i-t);if(i>0&&t>=0)return(r=0,t===i)?n<t?[0,r]:n>i?[1,r]:[.5,r]:n<=t?[0,r]:n>=i?[1,r]:[(n-t)/u,r];else if(i>0&&t<0)return r=y(t)/u,n>=i?[1-r,r]:n<=t?[-r,r]:n===0?[0,r]:[(+n)/u,r];else if(i<=0&&t<0)return(r=1,i===t)?n<t?[-1,r]:n>i?[0,r]:[-.5,r]:n>=i?[-0,r]:n<=t?[-1,r]:[(n-i)/u,r];else if(i===0&&t===0)return r=.5,n>0?[.5,r]:n<0?[-.5,r]:[0,r];return r=-1,[-1,r]},e.prototype._evaluateScale=function(n,t,i,r){var u=this;return u._axisPosition===0?u._evaluateAutoScale(n,t,i,r):u._axisPosition===1?u._evaluateMidScale(n,t,i,r):u._evaluateNoneScale(n,t,i,r)},e.paintDataBar=function(t,i,r,u,f,e){var a=new n.Rect(r+2,u+2,f-4,e-4),s=a.x,h=a.y,o=p(y(a.width*i.scale)),v=a.height,w,l,c;if(i.axisLocation===0)i.scale<=0&&(o=0);else if(i.axisLocation===1)i.scale<0?s=s+a.width-o:o=0;else{var b=p(a.width*i.axisLocation+s)+.5,k=a.y,g=1,ut=e-1;for(t.lineWidth=g,t.strokeStyle=i.axisColor,t.beginPath(),w=0;w<=ut;w+=2)i.direction===1?(t.moveTo(2*r+f-b,k+w),t.lineTo(2*r+f-b,k+w+1)):(t.moveTo(b,k+w),t.lineTo(b,k+w+1));t.stroke();i.scale>0?s=b+g:i.scale<0?s=b-o:o=0}if(i.showBorder&&(s=p(s)+.5,o-=1,h+=.5,v-=1),o>=0&&v>=0){if(l=i.fillColor,i.isGradient){c=.9;l=i.direction===1?t.createLinearGradient(2*r+f-s-o,h,2*r+f-s,h):t.createLinearGradient(s,h,s+o,h);var d=n._Color.parse(i.fillColor),nt=new n._Color(d.a,p(255*c+d.r*(1-c)),p(255*c+d.g*(1-c)),p(255*c+d.b*(1-c))).toString(),tt=i.scale<0?1-c:c,it=i.fillColor,rt=i.scale<0?1:0;i.direction===1?(l.addColorStop(tt,it),l.addColorStop(rt,nt)):(l.addColorStop(tt,nt),l.addColorStop(rt,it))}t.fillStyle!==l&&(t.fillStyle=l);i.direction===1?t.fillRect(2*r+f-s-o,h,o,v):t.fillRect(s,h,o,v);i.showBorder&&o>0&&v>0&&(t.strokeStyle=i.borderColor,i.direction===1?t.strokeRect(2*r+f-s-o,h,o,v):t.strokeRect(s,h,o,v))}},e.prototype.evaluate=function(u,f,e,o){var v=o,l,p,y,a,w,b,k;if(v!==t&&v!==i){l=NaN;try{r.num(v)&&(l=r.D(v))}catch(d){return t}if(isNaN(l))return t;var s=this,h=s._calcuteMinValue(u,f,e,0,o),c=s._calcuteMaxValue(u,f,e,2,o);if(h instanceof Date&&(h=new n._DateTimeHelper(h).toOADate()),c instanceof Date&&(c=new n._DateTimeHelper(c).toOADate()),h!==t&&h!==i&&c!==t&&c!==i)return(h>c&&(p=c,c=h,h=p),a=s._evaluateScale(l,h,c,y),!a||a.length<2)?t:(w=a[0],y=a[1],b=l<0&&s._useNegativeFillColor?s._negativeFillColor:s._color,k=l<0&&s._useNegativeBorderColor?s._negativeBorderColor:s._borderColor,{fillColor:b,borderColor:k,showBorder:s._showBorder,axisColor:s._axisColor,isGradient:s._gradient,direction:s._dataBarDirection,axisLocation:y,scale:w,showBarOnly:s._showBarOnly})}return t},e.prototype.minimumType=function(n){var r=this,i=r.scales;return arguments.length===0?i&&i.length===3?i[0].type:t:(i&&i.length===3&&(i[0].type=n),r)},e.prototype.minimumValue=function(n){var r=this,i=r.scales;return arguments.length===0?i&&i.length===3?i[0].value:t:(i&&i.length===3&&(i[0].value=n),r)},e.prototype.maximumType=function(n){var r=this,i=r.scales;return arguments.length===0?i&&i.length===3?i[2].type:t:(i&&i.length===3&&(i[2].type=n),r)},e.prototype.maximumValue=function(n){var r=this,i=r.scales;return arguments.length===0?i&&i.length===3?i[2].value:t:(i&&i.length===3&&(i[2].value=n),r)},e.prototype.gradient=function(n){return arguments.length===0?this._gradient:(this._gradient=n,this)},e.prototype.color=function(n){return arguments.length===0?this._color:(this._color=n,this)},e.prototype.showBorder=function(n){return arguments.length===0?this._showBorder:(this._showBorder=n,this)},e.prototype.borderColor=function(n){return arguments.length===0?this._borderColor:(this._borderColor=n,this)},e.prototype.dataBarDirection=function(n){return arguments.length===0?this._dataBarDirection:(this._dataBarDirection=n,this)},e.prototype.negativeFillColor=function(n){return arguments.length===0?this._negativeFillColor:(this._negativeFillColor=n,this)},e.prototype.useNegativeFillColor=function(n){return arguments.length===0?this._useNegativeFillColor:(this._useNegativeFillColor=n,this)},e.prototype.negativeBorderColor=function(n){return arguments.length===0?this._negativeBorderColor:(this._negativeBorderColor=n,this)},e.prototype.useNegativeBorderColor=function(n){return arguments.length===0?this._useNegativeBorderColor:(this._useNegativeBorderColor=n,this)},e.prototype.axisPosition=function(n){return arguments.length===0?this._axisPosition:(this._axisPosition=n,this)},e.prototype.axisColor=function(n){return arguments.length===0?this._axisColor:(this._axisColor=n,this)},e.prototype.showBarOnly=function(n){return arguments.length===0?this._showBarOnly:(this._showBarOnly=n,this)},e.prototype._isDefaultValue=function(n,i){switch(n){case"ranges":return i===t;case"gradient":return i===!0;case"showBorder":return i===!1;case"borderColor":return i==="black";case"dataBarDirection":return i===0;case"negativeFillColor":return i==="red";case"useNegativeFillColor":return i===!0;case"negativeBorderColor":return i==="black";case"useNegativeBorderColor":return i===!1;case"axisPosition":return i===0;case"axisColor":return i==="black";case"showBarOnly":return i===!1;case"priority":return i===1;case"stopIfTrue":return i===!1}},e.prototype.toJSON=function(){var n=this,r={ruleType:12,ranges:n.ranges,minType:n.minimumType(),minValue:n.minimumValue(),maxType:n.maximumType(),maxValue:n.maximumValue(),gradient:n.gradient(),color:n.color(),showBorder:n.showBorder(),borderColor:n.borderColor(),dataBarDirection:n.dataBarDirection(),negativeFillColor:n.negativeFillColor(),useNegativeFillColor:n.useNegativeFillColor(),negativeBorderColor:n.negativeBorderColor(),useNegativeBorderColor:n.useNegativeBorderColor(),axisPosition:n.axisPosition(),axisColor:n.axisColor(),showBarOnly:n.showBarOnly(),priority:n._priority},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},e.prototype.fromJSON=function(r,u){var f,o,e;if(r){if(f=this,r.ranges)for(f.ranges=[],o=0;o<r.ranges.length;o++)e=r.ranges[o],f.ranges.push(new n.Range(e.row,e.col,e.rowCount,e.colCount));r.minType!==t&&r.minType!==i&&f.minimumType(r.minType);r.minValue!==t&&r.minValue!==i&&f.minimumValue(r.minValue);r.maxType!==t&&r.maxType!==i&&f.maximumType(r.maxType);r.maxValue!==t&&r.maxValue!==i&&f.maximumValue(r.maxValue);r.gradient!==t&&r.gradient!==i&&f.gradient(r.gradient);r.color!==t&&r.color!==i&&f.color(r.color);r.showBorder!==t&&r.showBorder!==i&&f.showBorder(r.showBorder);r.borderColor!==t&&r.borderColor!==i&&f.borderColor(r.borderColor);r.dataBarDirection!==t&&r.dataBarDirection!==i&&f.dataBarDirection(r.dataBarDirection);r.negativeFillColor!==t&&r.negativeFillColor!==i&&f.negativeFillColor(r.negativeFillColor);r.useNegativeFillColor!==t&&r.useNegativeFillColor!==i&&f.useNegativeFillColor(r.useNegativeFillColor);r.negativeBorderColor!==t&&r.negativeBorderColor!==i&&f.negativeBorderColor(r.negativeBorderColor);r.useNegativeBorderColor!==t&&r.useNegativeBorderColor!==i&&f.useNegativeBorderColor(r.useNegativeBorderColor);r.axisPosition!==t&&r.axisPosition!==i&&f.axisPosition(r.axisPosition);r.axisColor!==t&&r.axisColor!==i&&f.axisColor(r.axisColor);r.showBarOnly!==t&&r.showBarOnly!==i&&f.showBarOnly(r.showBarOnly);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);f._stopIfTrue=!1}},e}(v);n.DataBarRule=vt;c=function(){function n(n,t,i){this.isGreaterThanOrEqualTo=n;this.iconValueType=t;this.iconValue=i}return n}();n.IconCriterion=c;yt=function(u){function f(n){var i=n;arguments.length===0&&(i=0);u.call(this,t,t,t);this._init(i)}return __extends(f,u),f.prototype._initIconSetType=function(n){var t=this;t._iconSetType=n;t._iconSetType>=0&&t._iconSetType<=9?(t._iconCriteria=new Array(2),t._iconCriteria[0]=new c(!0,4,33),t._iconCriteria[1]=new c(!0,4,67)):t._iconSetType>=10&&t._iconSetType<=14?(t._iconCriteria=new Array(3),t._iconCriteria[0]=new c(!0,4,25),t._iconCriteria[1]=new c(!0,4,50),t._iconCriteria[2]=new c(!0,4,75)):t._iconSetType>=15&&t._iconSetType<=19?(t._iconCriteria=new Array(4),t._iconCriteria[0]=new c(!0,4,20),t._iconCriteria[1]=new c(!0,4,40),t._iconCriteria[2]=new c(!0,4,60),t._iconCriteria[3]=new c(!0,4,80)):t._iconSetType>19&&(t._iconCriteria=[])},f.prototype._init=function(n){this._showIconOnly=!1;this._reverseIconOrder=!1;this._initIconSetType(n)},f.prototype._modifyIconIndex=function(n){var t=this._iconCriteria.length+1;return this._reverseIconOrder&&t>2?t-1-n:n},f.prototype._getActualValue=function(n,i,r,u){var e=this,f=e._iconCriteria[u];if(f)switch(f.iconValueType){case 7:return e._calculateValue(n,i,r,f.iconValue);case 1:return e._calculateValue(n,i,r,f.iconValue);case 4:return e._calculatePercent(n,i,r,f.iconValue);case 5:return e._calculatePercentile(n,i,r,f.iconValue)}return t},f.paintIconSet=function(t,i,r,u,e,o,s,h){var l=r+1,a=u+2,v=16,y=16,c;i.showIconOnly&&(s.hAlign==1?l=r+e/2-v/2:s.hAlign==2&&(l=r+e-v-2));s.vAlign==1?a=u+o/2-y/2:s.vAlign==2&&(a=u+o-y-2);c=f.getIcon(i.iconSetType,i.iconIndex);try{c&&h&&(n.GC$.getType(c)==="string"?h.getState(c)?t.drawImage(h.getImage(c),l,a,v,y):h.addImage(c):h.getState(c.image)?t.drawImage(h.getImage(c.image),c.x,c.y,c.w,c.h,l,a,v,y):h.addImage(c.image))}catch(p){}},f.prototype.evaluate=function(n,u,f,e){var s=this,v=e,c,k,a,w,d,h,y;if(v===t||v===i)return t;c=NaN;try{r.num(v)&&typeof v!="boolean"&&(c=r.D(v))}catch(g){return t}if(isNaN(c))return t;var p=0,o=s._iconSetType,b=s._iconCriteria;if(o>=0&&o<=9?p=3:o>=10&&o<=14?p=4:o>=15&&o<=19&&(p=5),!b)return 0;for(k=Number.MAX_VALUE,a=s._showIconOnly,h=p-1;h>0;h--)if(h<b.length+1)if(w=b[h-1],d=w&&w.iconValue,d!==t&&typeof d!==l)if(y=s._getActualValue(n,u,f,h-1),y!==t&&typeof y!==l){if(w.isGreaterThanOrEqualTo){if(c<k&&c>=y)return{iconSetType:o,iconIndex:s._modifyIconIndex(h),showIconOnly:a}}else if(c<k&&c>y)return{iconSetType:o,iconIndex:s._modifyIconIndex(h),showIconOnly:a}}else return{iconSetType:o,iconIndex:s._modifyIconIndex(0),showIconOnly:a};else return{iconSetType:o,iconIndex:s._modifyIconIndex(0),showIconOnly:a};else return{iconSetType:o,iconIndex:s._modifyIconIndex(0),showIconOnly:a};return{iconSetType:o,iconIndex:s._modifyIconIndex(0),showIconOnly:a}},f.prototype.reset=function(){var n=this;n.ranges=t;n.condition=t;n.style=t;n._showIconOnly=!1;n._reverseIconOrder=!1;n._iconSetType=0;n._iconCriteria=t;n._stopIfTrue=!1;n._priority=1;n.scales=[];n.expected=[]},f.prototype.iconSetType=function(n){return arguments.length===0?this._iconSetType:(this._initIconSetType(n),this)},f.prototype.reverseIconOrder=function(n){return arguments.length===0?this._reverseIconOrder:(this._reverseIconOrder=n,this)},f.prototype.showIconOnly=function(n){return arguments.length===0?this._showIconOnly:(this._showIconOnly=n,this)},f.prototype.iconCriteria=function(){return this._iconCriteria},f.prototype._isDefaultValue=function(n,t){switch(n){case"showIconOnly":return t===!1;case"reverseIconOrder":return t===!1;case"priority":return t===1;case"stopIfTrue":return t===!1;default:return!1}},f.prototype.toJSON=function(){var n=this,r={ruleType:13,ranges:n.ranges,iconSetType:n.iconSetType(),iconCriteria:n.iconCriteria(),showIconOnly:n.showIconOnly(),reverseIconOrder:n.reverseIconOrder(),priority:n._priority},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},f.prototype.fromJSON=function(r,u){var f,o,h,e,s;if(r){if(f=this,r.ranges)for(f.ranges=[],e=0;e<r.ranges.length;e++)o=r.ranges[e],f.ranges.push(new n.Range(o.row,o.col,o.rowCount,o.colCount));if(r.iconSetType!==t&&r.iconSetType!==i&&f._initIconSetType(r.iconSetType),r.iconCriteria!==t&&r.iconCriteria!==i)for(h=r.iconCriteria.length,e=0;e<h;e++)s=r.iconCriteria[e],f._iconCriteria[e]=new c(s.isGreaterThanOrEqualTo,s.iconValueType,s.iconValue);r.showIconOnly!==t&&r.showIconOnly!==i&&f.showIconOnly(r.showIconOnly);r.reverseIconOrder!==t&&r.reverseIconOrder!==i&&f.reverseIconOrder(r.reverseIconOrder);r.priority!==t&&r.priority!==i&&(f._priority=r.priority);f._stopIfTrue=!1}},f._getImageSrc=function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAQgCAYAAADvxtzfAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAANyVJREFUeF7tfQl8TFf7/6CvVsXaIkqrtVZqKxq0SCyxxxpr0ailtUYoYilCrLWEqC0h9i2xJyKSEJSiUcQWW4tGFRFEJJlkMs//+Z577yzJzGQm+v5/fd93ns/n+7nnnvN8v2e59z5z7ty5Z1R/u7m4uDR1dXWlFi1aDJOzrDeFfPv2bbJZxJCswGqRnOSYmJg8RZjjgTKxk5MMREVHmRVRyDoBzmhnKBIVFU2RR45QRMThXCIKWckTArCcIhERERQeFk4HDhwwEgFu3bqVnksAllPkwP4DtHfvXgoNDdHlGSKXACynSEhIKO3YsYO2bt1KGzdtovXB6ykwMNC8ACynCMibNm2k4PUSefXq1ZYFYIYiIK8PDtaRf/zxR6sEdOeG0myFvDxguWUBQzKgI69cSQHLA8jff5l5Ac50MSRbQi6Bnj17FkKmLZCpdjM0UwNlCTJNb3wO6C7XvGBSAKaIKJctAswRjg+HDh2i/fv3U4h8dZoVgBm2JDIyksLDw2nf3n20a9cu2rJlS94CiD6KQNjBg7R3zx7auWMnbd68mdavW2dZwJAM7N4dStu3b6dNGzdSUFAQreRrwqxATnJoaCht27aNNmzYQGsD1/LVuJKWLfM3LZCTrPQ3eH2wLs8QRgI5yTu4v5u4v+vk/ioEQx+dQE6y0t9A7q+hMx+ZdoaxQidgSNb1d60UOA3JwplNEdEJGKoCa9asMUtWjPNF4JF3c4tYIiuGACQnJTMUyYts1hSRfJHt9k+xlLUuHi8DmxPj5KMVLg5ytnUmyEEuROnXKWXN57aJGJIVvFjlbJ1ITrL2N2+9yIp6JkVeBroEpaxuLF1MLwObGZEF7ozR5T33/8RIhNPBzxZUpBcrG0oCogVrmuhFmKy9PZLxjV5kcVUhAnLy/Aoi78WKuvrLGSIpqz7Ti4B8czDRjYG6vGcLP6Dk+e+R9uWldOw/X1ZTLwCDyIuAunqRmwOIEvqQ9noPXZ4hnnGrZKreIPLcv6bOSXutO9E1d6LLbYniWxBdakp00VkS+KFSbgEYRJ4trqIXudKWtPEtZXIjogv1RX7yvPKmBWBChEdaCMhkrSB/StrztUX+U793zQukrnWplzy/vNQKmaxFzb8y+bzUxaezipsWkMjvSWQANf/KZNQcx+Rfqon8pJlvmxjEda4uuprzwJPphXMLvPixPr0IqMNnX01xmDDSyQsqUPLcMpQ8uxQ99S1GSTOKUNL3henJ1ILmx+B/2XCN4zLFlYaLRTeQfNbhxMGxx+HDETA5iAgUyhmYF3AkZJqxKde8ctlKAWYUaW8N5cubr9BrHpIAH06ZktskEelsVMhaJmuv9SDt1Q4iH+eE7G5sCF2IPgggQkCuWcs1a68wGZc15+PEkil6U8gIYXASAmg2ggpqBvliY0mAz06ZJpmOzEFUT+5vVLOWydrz9SQBPsVlqp6MMK4jJ3Czr/OAgSznGUIXkXRk/iBRCkWzMdoGZBxewytVFxNBxkeZUpBztCXnKoQoZRgrcMUqAsZkbrbos5wHR5CFM5sSrXDZiwwUGn20GZAR5g3JiiHwIHbIu7lFAHzQmCKbNUMRfNTZRFZMiPCHbb7Idvs3WIl1Dh4l1xWNKx74tu0zd5BLrCt675vY4VR8zduJxVfYIGJIXnEhiLAttvytxLcXWyGSk9zuWCedSNEfCie+PfdN8yKG5ICLgdQ6pr2AGwP7yH9r1r8S35xhQsSIfGkNuUS65cLyS2uFSOFpbyS+6VNIL2JIXh6/mh1X0zJGk3BXhovYIh95KIPfG98VSizkLYvwoaISgYw1Ran4yrep2yl38o9fSZ/u/5zqy/C/vFLkF570Bv1rfCF6w7sgFRptZn7gsPQtWnplBTmFNqRPQj8jp92f8X4AFfZ5wzQhpxX94S1acnUZVdlRl6pur8Ooy/vL0WzrBN6e9yYtvuZP72+uSe9vceKtEy25tpQKjbVySlNkdmFalLCEym2oRuWCq1FZBvYLjbJS4K0ZhemHG4uoVNBHVHrdR2K7iPcLDi9gnUDhqW+wwA9UfO0HOmC/wDfWCkwqRAtvLsyFAkNV1gn8i0cbA4bjjGYX+JYB8mArBexm+TtF2cWywdHwyxgFNgsoDyuAfAlERUXRkagjdOSI9LTDZoGIQ4cE8E1mvgQOHDwgnnAoTzlsFti9e7cO+RLAk40d2yWYFTD3hTwImzdtok2MzZs26wRyQogoX3+dOXNGOCrAl5HrghgGX0oC8IM/eEIAllNk9epVtGr1avFgQoFZsmI5RQJWBFBAwAqxzZOsWE6Rpf7SN7hWkRXLKWITWTFDEZvJiiki+SLbTW/KIPI1U1jOss0g8FoiIBueCzaLgJjzbDQSQWZegIBZEUMHSwiUHxfkElEETp0+TcdPnKDomGg6FBEhPU8KCRHPWzdsCGaBtbRq5apcIiYEYsQz5/0HJIFtEBDPWyGwklYEGMcGvcApFjgutUAIyC2AQHDwBrkF0uMhky3IC6bGQDeIeUERyUW2xhSBfJFhIOWbDAMx32TYa5FhfLYZPwqym3WGyxQjn68jYEi2+QTKSbbpFDZFxjzRKhFTZMwNxRyRY4NFEVNkZW6o4CDPF82K5CQryDlHVJBLBDs5AUdpfrjdaI6YE9z63NcJCkDYvFmaH27irSIgu1g2RSAIc8R1QQL5Eli9ynh+aLOANEeUkC8B/6VLeY64lPzleaLNAosXL9YhXwI5YZOAOcgudrPGHgz7ksxBdrFsfwzuQ3TnTi5YLXB3YHdByAoJ1QH797/ubZ3A7T7ukgDHgqxtOyhz23ax/3v/btYJ3OjRRhAyN26izA0SsH+zZ3vrBK65uwqCek0QqXlupF4TKPavd25pncDldl8IQsayFZSxPIC3AWL/cvum1glccmssCOkLf6CMBYsYP4h95Msuervi4uRw+YtamguNaz6EA4DDBUKa72xK9/VjzBb7yD/a+BOBsHJvvTzw7hsJQuSScw0PEFOjDgtHBWlTpgm8mjzNKD9x5TIKr+5Ie0v+q7YQgJ2p/ZHHL80+pZeRh4TTq/ETGBNlID1B5P+hI6v0ZMVO1HD0+Mm5JqVEhEsio8cKpDIE+Ud/82TFoj8o7QGnF4cOClLq8FHG5KIWyIodciwiRJ6HH7C+5py2r3Qhj32lCj2+7jPW+ppz2u4SKtESm2q2W25LXd+SHk1W5f+p18v1LpQS+HlWvkVeBjWjjMshlBL0Rf5EXq7l4JJ+XRIJNCHy1NeBnvqVpuR5ZSl5QUV6trgyPfevQS8CalPKygaCqDx/NCmSNLOIzsESxMNr3uYSefJ9YcnpXCXpxxnna5MWP1S55CI98cUDazyHxaPzO3xl5hRJmvaGTkAbV50F6pD2gjNp4zkyX20vfkYjHiFD4PYo3U+NhMjqxq9USVMLGrfgV24BC9AlV+nhrWELWEDfgqaaRz6qdqonU1SSQB4wGoPVzhJZjAELPJlSgJ5wV5Kmv0U4KniqnzwXR6WCICgiSD//sZ6ebI09W/i+jvzMv6ZtZBiecAvyDx/aTobhNwZP5znmjwxL9itF+SbbLf9WhOHJCGHEyUAaeSizaM6MhOrVq1OvXr1o2rRpAkgjD2Wyj0nzKlKkiGb8+PEUGxsrgFtfQNlHGXzgK1H05la0aFENfk4NR/zIecWKFTRr1iyazViwYIH4pTTK4ANfcCSqZPFo6rFjx2jVqlXk5+dHM2fOpKnTptKECRPIy8uLxo4dS/Pnzxc+8AVHoqpUTcuXLy/U8TPjuXPnSuSpEnnMmDE0bNgw6t9/APXt00c8a4AvOOBCwAeDBOUlS5aQr69vDvJQGsDkHh49qEP79uTNLYEvOOBCwB9NxA/b0cRpCnm0XPOA/tSjh0Ru4eJCLfjeCb7ggAsBPzhitOfNm0cTDZo9QCF3aM83XS7UyNmZGtSvL3xRzlxfCAxu3bq1aNaiRYtYmclDQeZmi5o76Mh1atchV24FfMFhLk4uVRk+LGp80YABQtNRs4eoGWRXHbkGn0w4nPAFB1wIwPxdZGUMZN++fUWfDcnVq1UjrzFewge+4EhUyUow4keMGCEOEe7cO7u7i2a6NGsmtkv5Xhpl8IGvzDGyCoyzzlwjfrcOZ4z2zp07RBp5KIMP4wMQTBmutnGMRFw87twKQL6QEhkTZB+rzInRUQbSdrPWFi9eXISvd89Jk3xCvL2940aOHBk3ePDQkP79+3t6eHhYPgIcSJynT5+e4OMzmcaNG0cjR42kIUOGiOuiZ8+e1KlTp4Q2bdqYjokcvryYrPGZ7CPIo0aOoiFDh/DlPIB6MblzZ3dya+NGzZo11TRs1Mg4JnIQcZv+/XTNZF3NTBY19+eae4mTqY2bGzVv3ozPxs/42qit+bjqx/qYyDXHKzWP5JqHDuEoJDe7c+fO1IZrbt68uUSuw1dljepUqVIlKSbOmDGjqb7Zxn1GzW5t2lAzQearEuTqNejDDz8kR46JpUqVaqqaxMNtasBwNbq5tdHXXLeuiAcgI6C+88475ODg4KPiQ+U/Stdng5q5z81En6Waq9eoQZU+rCTIpd8pTcWKFaO33nrLX8XXtx9GW0/uLJqtG7A6XLMgKzXryFSoUCFfFdc8WN9sJivN/oxrrss1iz5LNb9T+h09+Q3xuxxP1aBBg8p49PJQS2RltA0GrJJM5j4r5DcKCbI+Jrp3cvfHoVJGu658qKQBc6TSBjXLZEAfEznmleAzLP4zpWbus+Fo68hSs4HcMbFx48YV6tSpfdbwUJWWyW++9aZhzeZjYsWKFYvwGTbO0dEx0XjAxC+hbIuJfJI4FS5cuCMfKntMtMYmz91J5mBNuXA4dvpWLigOeZXbBWQHc7Cm/PXNlLICa8rz7GNe5XYB2cEcrCm3299hpkZXgTXleR7nvMrtArKDOVhT/jdYrRAyCzZTNSsQfDj2mH4tFwwFLI6BXYANjubABkdzEHy7/Q1manQVWFOe53HOq9wuIDuYgzXlf4OZugoVWFOOhKV4kGe5XUByMAtryu32d5ip0VXAZuoqVCD4cLR0nOFoMR7YBdjgaA5scDQHwX99M1WzAmvKkbA0BnmW2wUkB7Owptxuf4eZGl0F1pQjYfE451VuF5AczMKa8tc3U8oKrClHwmIf8yq3C0gOZmFNud3+Zjt9+nSRY8eOecbExIQciYqKi4w8EhcRERESFhHhuXPnTstPuaKPH3eOPno0AW+W4YcaypKoeCHk4MGDtP/AgYQ9e/aYfu58NDbWK+boUY1EjiaumSIOH6bwcJDDQKa9e/fhnQ4Nt8T4uXNsbKwbyGKhxegoOnwkUiIfCqeDYUyWl0XFCyF4VW3Hjh2abdu26Z87Mzle1CzIR+iwIHPNOrKoWZCxhiJ+TrF161bpuTMPWFOFHKnUjGYb1byHdoWE6slbtopfBW3cuLGpKioqxicqWu4zD1juPu+hkF1M3rmLtm8zIlNwcLCPKjIqyl+MtqiZ+wzy/v26mrGi684du2ib1GzxasrGDZtow/pg/PDFXxUZGemnb/ZB8SuXfQYDJmqWm70JZFHzBrGOZNDaIF8VH+PBumYb9Fki6waMm72FyZvEao7r162ndYFBtHbtWk8IlOGa1YK8T+rzLh15h9xnJotmo2YmBzF5zVo1d0F67sxkf5M1K2RpwGTyOvGm4drVa/XPnXft2lUiNDQ0XiyBC/I2ueZNClmqOShQR45fs2aN8XNnrrXC9h07zhoN2IaN4u1Kw5qZeJZh+rkzixTZunnrOD5UiQp5nb7mRK55An4lIrtbNh4gp6CgoI7AulXr7M+d/27rues1Xpr0vPyNl2f8tydHXBlh29qKMJAHXf6WAJtFvrw01Kv/xcHU/+IQgQEXB6cNuDhM/4Zdz7hhuX5nppjHuYFeveIGUK+4gRJ+Gaj2OP+V/tezXX7qWa/z6d6P3X/uLX5rZ2idT/X24jJS4H6qt9r9dB89uc3Jrg3cjnV+6hbbhdyOd9a4He+iE2kd29mrzfEupID31a2OuRv/brdptJvHF0faaJpFtSWgKdKRbT2bH2nrpc9jRLVRM0z/6LfBIRePBuHNNQ3DXahhmCuDt5xuoKTDXNT1w1zxYw7z5rTP2eOTvY00tfY2ptr7GhO2tXjLaXWtfc6WyYpV3VnPo3rop5rqIQ2oemh9qhZaX11tZ33ryIp9tK22x0fba2s+3F5H/eG22p3lbNvso511nSvvcjL7E0K7/Q+Yt6pIMa9insXGFAtx8CoWByCNPJTJXqatuHdxZ4cxxRNqza9N3bd7kPfx8QJIIw9l8JHdjY1r8Xp3QhnN8KhRtP0pz0oYwY830XqGso8y+MBXpklWfExxt7ITy2mW3lwuHBf+sUQEzl7nB1C3c33I41x/Gn9lMv2YuJZmXp5DZSeV04Aj01F78Xg0dWvSDvru1mT68tIg6vkrk8/2oU6ne5BzREuqtK0WtQh3p+o7G1Dbg10IHEF2GOPQ9KMZlUXN3170ovanulObE12o5bFOIo2Y8P7WT2jiuen0KiuNttzZSZ2P9iFwwGWB4j4YpLm3fxCO3572piGnRtOH22tTlZ31RI377oeTYuF/HCH3o73FwIKrcvAq7j/s8Lc08+Yc6n98mHBKzXpFLbm5bSO6093U+yIvMzuTZp6fLyppF92DwAEXo+/31YFBLDBXFEb/FSsIf6U/ogxNhkgnvnpAnSJ7i/JK3LK1f64ncJjrizEY3CrQjbY93Un1DjQVTb6ZclsQYUf/PEGf7GpMH/AgglxrdxMx2OCIk8thtEOZMhPKqoMSg2nitWlUZden9Pn+tvQo/QnNvbhEV+tH2+uK9NBzowm+4IArHQnui+uaFkK5+09fCkKNnQ1FrR/tqMsDWofJtajlYXfa8mQ7wVf0X7FSk0qVwHH9OnyIOJxjLk2gzw66UtWQ+ixQh2qGNqaRv44XZfCBLzgyXbIi3kUqOIwpdrZxwOcUcGelcF71IIgRKNLIQxl8So0pZSbgSlfiOK4hERdPx42dBJBGHpdNyPOKVIwHyKnY2GIdAaTlbLtZZf+9MXHmrTmiDD7wtSkmunGIc4lpT/3ODKYt7ANfcATZMCbOubeQ+jG5F5O7MrkjyMc7k8vRDvR5ZGsx8cKFBt9cMREBZciVEdRTNLuvnhzTgZqAfMiF6h74nBqHu3FLd+aOiesfb5T6jJpP9RCR2RU1H0HNrlSHyTX3NKJqfInjCs0VEzHaSs0go89odgNB/oLJzlR1V336kOOD2ZjYk0fb7YTc7CNu3Gwm72fybj3ZYkycnDBDrpnJXHNdJjtxzdWYbHVM7HtmkFSz3Gz02eaY6H3Zh5zDWthj4v+YubpPoGETlmORyeGMh2KxSQl7VF+rashu5g0C7JzIzhHFllegxodb0ldXh1KdjQ2J8+5xmTPDjRHLOCnT9CYLnCwZ+CEBjQ+3EgIuh9sgX80icSh3+rGW8JNpesst0JI8IRDBAtwCXAvdfulL7aM6WyvQShI43FYS2JYfgWtDpC4Igdq2CshdkAUqWdsChyXlQYjg9HDeXqi+8hMjAbdD7S0IsCMXXuWtp6qnqpBqkMqF02c572GFoBrUYEsjkB9yHt6iMDYICJGcNlhVlQlxjBjGbyxq+qo0K2BoPVXm14qzSsCS/ZcIfDthZf4F7KZS4d01oE+fPjR0kCd9NbCfeMer35cDqFcfvkPr0ZO6dOlGHTq0o1ZuralzJ3fhD+gE/P2XC3zJpJ4e3cm9Uwdq2bIlOTdqQnXq1KLKH1Wn9xzLU/GSJfDKMhVQFdQL9O3dh5Yt9ceODu+3rET1vBqS88zPqYanE5Wq9Y5ROdDFvSu2KtWQrwfTgC/7i8wi775NLX5sS/1+5aneuYHU9ee+1OEkT3tiu1DV4TWpwBtijWUB+X1Xleqrr74Sr+Uis9Wa9jTg1yH0zeUxNCLem/qeG0Rtj3cjV572fMEzl/cHVJYFClJz12aSAAasU6dOVLlzNep3fhCNuvIdBf21kXYl76ZZt+dTh+M9xLSnMd+Ef3HIjRxqFKeCqgLk6iIL9OvXj1q1akVNFrhQ73Nf0XfXp9Ke5wfoYEoEreRb/k7He9JnPGdyPtSCWh11pxoTa4tW6LrQu3dvaty4MTVf05q6nO5Nnue/pSX3Aijo4UYad3kKNYtsLyZcEMFY1JrbgFQFVOTq2lwSQP9r165N9b535v52FU4dTvSkTid6UdPIdnxL/AV9sreR6EL7E93ooxHVjbvQpUsXqlKlCpVtXp5aHO0ovsFsFNGKGhxsTvW45tr7moh5cqujnVigO735/tviPGjuKncB7zU7OjqKfjVc+QU1j24nRrwJi+BDphkLolXuP/WkGt+L/xsQwHuA4OPVPCpeXPw1ChUuWZg+W9mM2vGhAzqc7E6dfvKgtrFdqco4Jx0Z0B1GnJI4PZUCoIyrI33i14BqL/mMPvL6mN6qaFwOuHcxuBYKFCjA/VKJbSHZAfsYbeSJrZyvwOhiUoBjC7g2x7aFvG0mRhyvcKPM0F8I2O1vNu3p00U0EZGe2WHhIZr9++M0obvjMnfsDFFv2eKpzeu5szY62jn78JGE7PBDpNl/gDS795Bm5y7K2rKNsjZsoMy1gQmZq1aZvnfWHIn20hyO1GSHHaJshbxDIW9kchBlrlxNGcuWazIWLTG+d86KjnYTZK5ZIu+lLJmcCXJgEKmZrF4WQBmLl1D6vAWadN85+ntnJsdLzT5ImtAcNTM5c+UqHTlj/kJK95tLaTNmSvfOdCiqqQY17zNutlIzmq1etlxHzvCbQ+kzZlLa1O8pbdKkpipN2CEfZcCy5AHLDEaf13GzpZrVi5YyeQFlzAbZl9IFeTKljZvko+I++wuyqHkrZYGsq5nJSrMFmWue9j2lT5pCad9NpFRvb39VVsheP+OaMWByzYJsULMgc81MfuU9nl6NGeurUm/fOdi4ZkOyUrOv1GcfmTyWyV5jKXXUKE8Vn11l1MEb1FLN8qFCn+fxgBn0OV0hSzVT6sjR6pTRo6V7Z/Xadf6i2csxYPJoz56rr1lp9thxgvxq1BiufbT+3pnWrCmR4b88XjpUC/g465stDdgErhlkb0FmxCcPy/Fs7tXixRXS5y08q/RZd6i45jRudppS88gxZ9PGjDF976xdvLhI2gzfcelTpyXqmi1qxoCNTuRBm6D19rbu3jll/Hin1LHjO6aOGtuRB8t+75xPQ+jC3xEDpsOYGRtWvXr1F127dqXvvvtOAGnkoUxyMW2Ob7/99hEsZRAWFiaWLYmPjxdAGnkogw98JYqBFStW7CgWHo2OjqbHjx/L3+3rDXkogw98ZZrOhqGpR48epczMTJmS21AGEfgyZ7hEVamK8PTmGZqYlJQku5q3J0+eiO6Aw1zxEL8pBun06dOyS952/PhxMbDMbQIBz2+//ZYuX74sF+dtFy9eJHDAFQKYK1+9elUuztsuXbpE4CgCTTF1wXK31hq6K69uKrpQhI9tMv4qITU1VXYxbykpKeJvFcBhru6XEMO/+OILoZydnS275jaNRkM//fQTwRcciaq3GCym8fPPP5tsCfJAhg98JYqxYV2c2AYNGtD69euFM44McPLkSbHsD8rgI/uaNVwwT6tWrUrt2rUTQBp5cpnVlu/L2W56+4fEROwjjOU7JnKRAM5C/MTM5pjIZTpgdRKI2BQTudwIn376qW0xUSEaAkuhWR0TFZIhsPSZPSbaY6LdrDd7TJSNy3T4X42JCskQWF/R6piokAyxcOFC62OiQlKARbjwI3CrYyKX6VC4cGGxvqJNMZHzBbD0F8g2x0QsuIg/MLDHxP9Us8dE2bhMh//2mCivEWsVTMbE2bNn53I0B5MxEXEOUUdxMgeLMRHKb0gLDZqEVTERi/OaaolNMTEwMFA4Ix7aY+J/uv0fx0SELqRtjokIWfIZZwSrYiJOV8Q93jeJPGNi3bp1c5FywmxMxKWsOOUFkzFRXvrZKthjoj0m2u1vsNdejQVE4/VgbDSbBeCoQNm3WcCQ8B8ggAIFyr7NApYIOfdzWV6EnPsiQ4Eph7z2bSbk3P9vEVCQn3275cNeexBBNDqMtprNAnBUoOzbLGDxTMzL/v8LoECBsm+zgCVCzv1clhch577xei9seRFy7guBMTsfvp7A4FV3X0/AcI2bvAg594VAu5EXXk9ABzYUKLBm3275sNceRBCND6ONZrMAHBUo+zYLWD4T87D/AwET14bNAl67rA8wuY2JIzcn2iAARwXy/rC192wTMIyJ2H619I5tAoYxEds+c27YJmC07hdvu025apuAYUzEtpP3JdsEdDCxD0cFpvbtlg977UEE0fgw2mi2C5g4L2wWsBQf8jYmjtr65+sJjNhoPsDkNjgqkPeHBd63TcCwz9h+veJ32wQMYyK2A5bctiCAAgXyvmFMxLbvvJuWBSzFRGx7zrxuWcBSTMS26+QrlgUsxURsO38Xb1nAUkzEtqOX+RgpHHSwYh9EBaLcbvmwHINquzFxjOHFZrMxcfR2fYDJ2+CoQN4fufmBbQI548O3wX/YJmAYE7EdGmhwuedp7GgYE7H9eqXB1ZvLUKBA3jeMidgO9DeIF7mMCyzFRGy/XHjLsoClmIitUcARCQXyvqWYiK3HDH2IExm2xERsjSIWErbERGy7TLhsLGBLTMS20ziDfSRsiYnYth9z0VhAh/zs2y23na6oKnKshMozpqQq5GhJVRyANPJQJruZtujiKmcmJPzyeW26NWYo/bUmQABp5KEMPrK7sXGh1/H3imoeLJ1P9McfEn77TYK8jzL4wFemScaqbicqFtO8OhkrHLWXL1P2kSjSHJBfmGNknz0ryuADX3BkukoVU0IVj6bS/fukPfUzZR+SX08MZfL2HZS1cTNlBq2jLN6ne/dEt8AR5GOlVE1Pf/K+1MwLF0m8JLhvP2WFhJJm23Ymb5LeLvxxJWX4+5Mm8ojwBQdcVUwplQ8Gie7/wc0+IsiakBAmyy8Irg2kzB9/pIwl/pSxYCGpeYuWggMumu//x8LZRHd+o+y9+0izK0R6NTF4A6nXBJJ6BZMX4+XAhZQxy4/Sv59B2uvXCRxwIeB3d6YPC9yRyVspcz3IaykzYIUgp+P9Ppmc5jOFtDduEDjM9VUdLaEafLVfV9GsrF2hlLUumDJXryH18hXSW3bzFlC672xKmzZdvJ6Hd97gCw5OLtUJB1WZ4xWKqTOv8KE7cZLUq1YzeTllLFpMGXPnCXL6VCZPmkyvxk+gTD4S8AUHXHEk0JfLvTqKQ5S1Yyepf1gkkWfOkt7tm8jkcd/xUVhGdPcuwVf0X7GoUqoSnBF/f850cYiy+FCpecTTpk5jsg/3fTpl7T8oyuADX3BkumTRpVUV+BQ9e7GTK6WfOS2ctdeuCSCNPJTBh8mm3+3D1caDOo6RiIsnYciXAuJC4jyueUKeV6Ri3CInrq0jgLScbbd/q/3ernXju1066c8uE/ZbB7fm97p2WCTv6g3k5G++yUr1Hk/3unUKkrONDORnI0ZohE/XjivkbMn+GtD/Ac51wJSIQlZ8UsaM1d5s16KKXKxSYefpkMFppkRykl96jaXf3duMF0RDyykC3O/RJcwqsmKmRKwmKyZEhg7NMCSnjh1nHRkm+jx8RLahAGDu6BjZ7U6tWxn2WbyabK1ITjL6fLdLh7k5x8SkiCmy0mdTA5tLxPBEMjXaEEka/PUrxSfXiXSrTZv32SHV0qFSRED+vVO7EXK23iDyW8f2Q+VdkwaR253aDJJ37fZvs3/WPFGbkCCg7Fs9T8w6HEnpPKXBdAZAOisqSpRZnifevSf9yjkzkzJ4aqcIZPJEk7RaqYx9zM4Ts3hymXVMWpAVBIgIsmyZmD+yD3xNzBPvU/qcuaLGrJM/SQylVjaQRXfYx+Q8UXvtuq7JQPZvv8tUoqwzZ43K4JtrnojRVhwMmy1M7o5OwNw8EWsf5OqzQXcgAh+z88SssHBdv5U+AzqR7GwxiObniXyIsniyaUg2FEEZfPKeJx4My30iHYoQZTbOE68LIG2fJ/7HWlh1x3bh1R0pvEZZ4whkjSnkRzu2kM0iCvnZsWjS3rxF6Rd+tV5EISfHHn2Qfeq0uIPNPn/eOhHDmjUnTgiyAiHy63nzIjry0SjKijlKmbgB3cq3v1hsBneyjOxz51gkLreIjhxzRIR0NW62Bdbxjfc6g/0g0vBlnR73i15kl0pVCDs3p06g7MtXxL2hBL75NIKSt4y0t27RX6sChIhowaGqjk7YeRC0WoT1ND++6dRhrgwpreGBTYo+cgr+aLkQgCki2VeuUtaRKEqbPJVeTeYbT94qQPOf7dktajYiK6aI3AsOvJEVESktYwN4jSNN7Al6tnuXebJiiojmwgXKCj9EqcNHUVZ0DD3btSNvsmK6MeGByk64YbrPeZkicmPUMOtrzmmKSL7IdnsNwwpFtHy5Z/aixSGaOfPjNLNmx2mmfB+i/m6SZ54rE2mXr3LW+i9P0P6wmLLnzScmU9bU7ylr4iTK5NNZ/c3IhMzBg03PE7UBP3plL12myTYkT2PyBB8me5P62xGU8fUQSu83QJPRvbdxRNIGBLgJ8iImz51P2b6zSWNEHklqiUxpHr3pVacumpdt2uvnidn+y+KVmkHOmjadMtHsMTJ5EJO/HEDpTE5z70av2nSgV64t5bXC/P2b6sjcbMOaM9FsJmd8OZDSe3DN7l1lcit6+XkzSmnQqKlKs3CRj+gzasaACTIPGNeskNMMyKlMTv28Ob1s0JhS6jTwUXGf/QVZ1IzR1jdb1CyarZBbM7kZvWzI5LoN6PnHdfxVWb6z/dBnHXn4CKnP/bhmXZ/bU6pLa3rZBM0GuT6l1KxDL6rV9FVppk4fbDTag4ZKA8bNTuskDZhCFs3mml9IZHpRuZqnSjt5chn1aG915nCpzzhU6R69mMzNbis3uwn3Gc2uo5Cd6NmH1dQpjlXltcK+HeEvnSRKs+U+o2b9gFGKE5OrOtHzytXp+QdVDNYKGzasRFrfAfEYMP1oy2S5ZqnPTP5IkOOTK1fOsVaYh0eFNPcuZ41qVsioWfS5Oj37oMpZJptZK6yxR5GXrq3G8YAlpih9lslcc+KzDypPuF+xonXzxJR69ZxefFy344tqH3dM+aCqfZ6Yl2Fh3hHjA+hQdcfh4dUcH+LTSEK5PRE13rNunW12TgyvVi7i6eQpRHvDKDtkH931HID8ewerlXMOr1rWLax6udiwauVMr/CMAnyUqxcsIS0LaFngGV+hLKpmxKH86uCBwk+m6c1IYCEEwvUC3IKMOQtIG7qfkpcvz1sgQwgYtMBWAakFLBDKAhxYbW8Bj4EYRBZ4PmFiDoEAywJ/9uuLQYsQh7N6uQtXunUUAmpZ4PEPP5gXgCMfpqvs4InJJ89OXPhcOIvzInmiD/0xBUfE8SGXW7/O9uEqZapKh9Axhsm/YcojFxmbOQFD2+XkZF9n25KBbF9n+zVNWaX3n7XOdtcmTWj+V560YfQYmty1GzWW3vM0gsl1th1LlaLDfn6kwaPjA/spa9cuysST36B1tLCHBxUuVEgnYHKd7WhM92KiKPvCz5R98QxpIsNJjWew0oq2NLNdB1nAxDrbX7VuTVlhHM5+OUXaZ78TpdwnzaWfKXPDBkHGA9xXywKo/vvvm15neycH0ax9+yn7zAnSJv9O2hf3SPPrKb5/DqR0noxmLFoi7qUDBwwUrci1znYs912sLbt/L2lOHyPNmVjKDN1JGTzA6XPnUQaLZK4Ppv0jRppeZzuYZ2p4VC76vI7v2teulcnzKW32HHHjnblxMy3p3sP0OtvdGjTk0V4vDRju1LlG1JzGN91ovhplLFDt3XfFeWByne1Ib54nL1/BNfPtPh6ZM7CPp+H4EmLLQPGmtYDJdbZLvv02hQz9htSr1kgLEgdLRHXwRgrgpsNHgcV1tjt+Uou2ff01RfGZuLpnL6pRpoxROWBfZ/t/w0aMGOEAyLu225gxY/wAedc28/b2rjBx4sRUAGk523obPXp00L59+whAWs62zry8vOpNnTpV8+DBAwKQRp5cbNrYoQb3tx9jIeMq/uP62rVrAkgjTy7rB1+ZJpo6nTNfzpkzRywuhb9oPn/+PD18+FCs1AMgjTyUwQe+4ICLwSrCiZNYFAFrAiUkJNCZM2fFGkEghB8Kp5ijMSIPZfCBLzjgilYM4/tGzriA/3S+e/cuhXNoxz8t79u7T2zxT9Ph4WGiDD5cexw4gqwYC5RhJGCNixs3boh/WDYE8lAGH/jKNGPjgnZYOOH27du0afNm8QfJmzdvElvkYSEF+MjuuW3UqFGeG/hTCAsrhYaG0sWLF8QaukjHx18ilMFHds9t3DdfnDh//vkn/fbbb2KwAKSRhzL4yO65jQs3YZBQE4/wS95fDCCNPHkAN8nuuY37d5LxlDGdSaXlbBzq0siTy3JP9xVj9X6WLl+UwUfetZs19mhGmdeLiU9nl8p/TEzyK10heWHF/MfEp34lg9JjvPIXE5/5laiXvKSqRpsUZX1MfDLrnRpP55TslzS75MKns0tezfh5BtFfG/OOiUyYzs19+Xx1fUrd04vST/Bc8fpqouRo0v7uk3dMvL+4YpEkv5InX4V5Ej0/wbVuIO29WaS9PYq0NwZaFxOT55cqkTS71IW0qJFET0JJe60Laa+4CVgdE1PmOJThriSkH59A9DCQtL/WJPrVybaYyCdOu5QNLtyNYKIzJUl7tpRtMTHJr4Rn6t4+RPf9iM7XILo307aY+NSvlC9OHkqOpOw/9xMG1qaYyAKbMJBoxdN5777ko2NbTMThTPIr9RTnxvMZxW2PiTgTcQnLu7nMHhPzYRhQS4OapyEmAvKubabERABpOdt6U2IigLScbZ0ZxkQAaeTJxabNXEwEkEaeKGMf+Mq0vGMigDTyUAYf+IIDrumYeF8fEwXujBZxEmXwgS844IpW5IqJV5WY2EZsCVuOkyiDD1/2ceAIsmI5YyLiofZ8TYYTpzk+ch7K4ANfmWZs+pi4nojjIZ0xAMfJlI0teDBL2RYTBX7lNOehDD6ye24zFRMBpJEnnVSlbIuJANLIkwfQ9piINPJEGfvI2bktr5iIMvjIu3b7/2IVvSsWKfM6QbXspHKxZSeWixP/qmmrlZ1Ytt8XK5oSUGaiY6418iwamv3BtEoPVt8LpDX3g+j97yslc3d0Z2aeVnai47zB4UMp8NF6CnoUTEiXm1hupVxs2cpPKv/BJ/NqZW5+tI3GJ/jQuIRJtPnxNnKaV0tT5rv3LEdmWLmJjlu/PzeDZt+ZT1/+8jX1Y/jdWUDIKzfJEQtQmrcyk8o3bbG2Fa3jUO5+oje1j+1O7WJ7UNeTfWjD4y3UdGVzdKWj7J7D+FA5Ti5/cdmtFfTV2W+oUXhLRisdhsaNpkXXl5LjpPK3nGaYeFyCQ9V9hwctuLOEPg51phohn8ngdOhnVDO0ES29t4LgU25SOR+ZJhkOUeUZVZLXPdhALQ93Fv/lbApto3oQfCrPqJxaekpF/QcuDlHv0L7ib5jx/9U//L7MJIIebhA+Hjt78Vg4bpXpOO7lrr43pQI1XPqZVYAvH5GHMl26aMr7lG9gC17rIrPbv8OOOZVxCPu4fANbsNPwZwR4khnh9D791NHFKsAXT0dluvhx39Yr3/H05s4d4tsz8W6fKfCNo/C55jMWz171EepgtYoVohpWT828eIHwF3xZm7dSpsAWgSwFBw8SfNg3+bBTjhjJTfK57D2ctHyXhpfi1KvXUMaqNeJbfgVavv2FD54KyzS94ZlqeI3yt15EHaas0N2UsXARpctAOnP7Tko9fozCP37vIp4KyzRj4351PNOzI0/prlH67LmUNm0GpeF1vFmzxRj80r87116+qexu2nhAjzzavpkyQ3ZLr6F4f0eZu0IJeRhs2c28hVV7r94xlwaa7GtXKU38PnEaIX2sxWeZByqXN/M/7zkMh+j2vJmUffIn8WtRpPlcmScX5204RJF1KydnxJ2j9HNn6HCdyg9wtsrF1hkO1c892hMQXrWs7RMr8etRPHevXg5ryObP0Gyji8ZudvtnW9IcB6cns0o0sAWPZhSvKpFnlViZNLsE5QuzSszju/biJ8Wd6sMfbYI2cS0EwvjuvXhs1vnBRNf7MwbI25xQ8rEdQFpG5s8DuRXF9/PtbvHeT2aXOM1NirMFaPljv2JmJp12s9v/ud33VhV5NKWg55MpBUKeTCkYJ6FACPJQJruZtqQpKufHUwomPFtRh1IPDKaMX5YKII08lMFHdje2x9MKej2Z6aBJPzWHKP22hFdXGDy9k/dRBh/4yjTJkiYXcnviW0KjSYySnF8ck677xHlE92cyfIme7hNl8IEvODJdpeJ+xqOplH6T6MkOogeLmYw36KYT3Z3Ak8vRRLeGSGJpN0S3wBHkR1NVTZN/+ECq+VkkkxcR/YF3174n+h1knsHe4oCT0JcIX8j9yS1jX3DAVT2ZWtAHg0Tpt6Rm/+FHdG8ak79j8giim4OY3Ifoameiy2687SpaCg643PwC/uknuGmv4pk8m5s8lei38US3hzPZk0NYLya5M7kV0cUviH5tQJTyM4EDLreggF9aDDcVAnenMHksk7/hSfdXTO7J5I5E8S2Z/DmT6xOd/4To5S8EDgv4qh5PLTg4ZTv3DV24x7XfGsZkBE8PoisdmNyCyY2Z/ClRnBOnG/FA3iRwcHKp/pysKsMfFGpt8nkivkOnGxx9r3VncnsmuxJdALke0S81ic5V4Up42su+4IArjgT6krKFa+NDRPgS9kpbokvNmcy1/VqHawa5Mgtzq9ISCL6i/4olT1KVwHFNi+Uu4HDiUF1uw/0FuQaLNOTzgg8vl8EHvuDIdMn4HK/A43H2xXpX0jyMlYR4tCnltEgjD2XwYbLpOTOuNnYYx0jExfNyd18BcSFxHtc8Ic8rUrGkySqnx1MKdQSQlrPtZoul7Clc8+Xmt/oDSMvZ1ltaWMG9GdEqyohREdJytvWWduhfezOO/osApOVs6y09oujejNiipGYgLWdbb+mRpfeqT7xD6hOlCWk523pLi3IMzDxVgQCk5WzrLf3oR7Mzf67Ks7GqhLScbb1lnq71TdYvdSjrXB1CWs623rLON+qcdb4xZcUxOC1nW2+Z8a4umostKfNc82yk5ez/JEuPVg3JiFKdAZCWs603Jt0U1wIDaTnbenvtFtjtNewfNk/kmYiAvG/9PPGv9ZQa60ipx0oLpJ/iicXDtaLM8jyRJw90x0tMa1KOvEmkzSSt+k96dexdniN8xpMuniuyj/l54p8rpDlRvIskIJYsSGOBd1iAZ2fnearzx0Lha2KeyLPUaz14auMipjeSgJYo6wULlJbmSedrcxnPm3iSlXue+PKcTG4m5oMpUUWYryFtxp88reEugIwnwHEfm5knYrQxsbrYlNGEXkY7cPPVpH2VwM5lmczzQ8zUfqlubp7IXbjCM1ImY3b26mhJrvkd3hanjJOO0kwtjsmY9pmdJz7wl6d2DSn9eBk+CEmU/fw0qU++xzXzbO1cNZ6Ez7E0T+TDiEPFU9r04+9S9st40vy1gwW4BSBf50m3VfPEB0tJfbqKIKpPlqOsM1x74hJRlo95IoPT9nniP97wMtDICQH0dKbD8Ke+Dg8ZJDCz6J4ns4pZ924fkxOTfB0iNBEF+UaLrw2OSuqYjsR595JmFHdO8i3qljSzaCxvTb9VhgI6oSIBIRBM2Ze+hoCaxeNQ/mqPu/CTaXozKxAvBO7RWY5Y92ZS1qXp1grw3Sl34fUEHrGA1IV7dC6/LVAEzlayTiDrYCEQInA4eXshLfQLWUBqQWbcJEsCDvee+ha9mjSrmCftUhVK9nVw4f2zOC80RyvwtN8D58bDpzOLWf9uH743xSFkYgyfA78lzXDI/7t9NENlf7fPkoFsf7fvNU15M+if9W5ftzZVaOGkJrRpoStNHV6HmtR716gcMP1uX5miFLmRJ1t3xktTvhs8XxDf5PWgxRM+ocL/KqgTMPlu39GtHiJ40KNgxmZOT+eJRW9p+nO5Hc0ZrbxlaOLdPs8ePA+6PZZnpat5JnKV5wW3iB5v5Rb047ljGwHN5W7UwKm46Xf7QgLciG6NkCacaVdYgCdejzdx83tKU0BuASUMpLUzpT9NzfVu38ltPE/C14B3vCWRh2u4RWO45tY8e+PZGb6gu/E17VnW0PS7fZsWfC7Vhhkrvg7Et3rx+CKSyRd4rnylk5iELfSuavrdvh5tKrITvvrEV4FMxKxVnvbRRe7C9b6kTRhE1T+QzgOT7/Zd2MPNvcIfbVc6Sn1G8zGAmOLdHEqhS+oJP8Dku31lS79JcaFMuDGI4SmNCW+1CV/Txjm1dWTA4rt9vdqWp7CVjejnbU1p24K6VLtaUaNywP5un92sskczVI4WP9bzssdTC2wV94b5MdyVPp1fnp4tc3qFuxk523rju5O4jLhllHkrhO9WCuT9+xNDezK5YL/nq52JMn4XSNneVbpPtsZ44Bxwf5R1ew9pf/MWyH5yhu8Ti1+SXSzb4ykF5qFG1Ky9PYIxXKRfRXoRWia7mTbczj3h2Tlq1HIgMULKVXq6oMJDtFB2z20YrLSYSVLtHFC117rJWw6unIdBRQtld2MTX0Qs/ojo1U3SXm4tQPJWSvNnBos8W90o85GPSnpwrxj1VBXiE+ZCxnn+LGAnPMnRcijXIiIbprks6244Pfn+X+EyVTI+5sN0hy2uFtF5BfjSgSHy5DT7vNzdj7tSSHpsLg7btDcSoSwErAAGmSfld8R1In1rpXxjlQemFozlgV6jwOyXUtabSvX/AOf1iiJEERHsAAAAAElFTkSuQmCC"},f.getIcon=function(n,i){var e=[["0,160,16,16","0,180,16,16","0,80,16,16",t,t],["0,100,16,16","0,120,16,16","0,140,16,16",t,t],["0,900,16,16","0,920,16,16","0,880,16,16",t,t],["0,820,16,16","0,840,16,16","0,860,16,16",t,t],["0,780,16,16","0,1000,16,16","0,420,16,16",t,t],["0,680,16,16","0,940,16,16","0,400,16,16",t,t],["0,800,16,16","0,1020,16,16","0,440,16,16",t,t],["0,740,16,16","0,1040,16,16","0,400,16,16",t,t],["0,720,16,16","0,980,16,16","0,380,16,16",t,t],["0,700,16,16","0,960,16,16","0,360,16,16",t,t],["0,160,16,16","0,40,16,16","0,60,16,16","0,80,16,16",t],["0,100,16,16","0,0,16,16","0,20,16,16","0,140,16,16",t],["0,220,16,16","0,340,16,16","0,460,16,16","0,760,16,16",t],["0,600,16,16","0,620,16,16","0,640,16,16","0,660,16,16",t],["0,200,16,16","0,680,16,16","0,940,16,16","0,400,16,16",t],["0,160,16,16","0,40,16,16","0,180,16,16","0,60,16,16","0,80,16,16"],["0,100,16,16","0,0,16,16","0,120,16,16","0,20,16,16","0,140,16,16"],["0,580,16,16","0,600,16,16","0,620,16,16","0,640,16,16","0,660,16,16"],["0,480,16,16","0,500,16,16","0,520,16,16","0,540,16,16","0,560,16,16"],["0,240,16,16","0,260,16,16","0,280,16,16","0,300,16,16","0,320,16,16"]],o=f._getImageSrc(),u=e[n][i],r;return u?(r=u.split(","),{image:o,x:r[0],y:r[1],w:r[2],h:r[3]}):t},f}(v);n.IconSetRule=yt;kt=function(u){function f(t,i){u.call(this);this.ignoreBlank=!1;this.expected=typeof t=="string"?t:"";this.formula=typeof i=="string"?w(n.GC$.trim(i),"="):i}return __extends(f,u),f.prototype._concatArray=function(n,t){var i,r;if(t.length===1)if(i=t[0],i instanceof Array)for(r=0;r<i.length;r++)n.push(i[r]);else n.push(i);else for(r=0;r<t.length;r++)i=t[r],i instanceof Array?i.length>0&&n.push(i[0]):n.push(i)},f.prototype.getValidList=function(n,t,i){for(var u=[],f=this.getValidListImp(n,t,i),r=0,e=f.length;r<e;r++)u.push(f[r].value);return u},f.prototype.getValidListImp=function(r,u,f){var e=this,h=[],c,v,l,a,s,o;if(e.formula&&e.formula.length>0)c=e.getExpected(r,u,f),c instanceof Array?e._concatArray(h,c):h.push(c);else if(e.expected&&e.expected.length>0&&(v=e.expected,l=v.split(","),l))for(a=0;a<l.length;a++)(s=l[a],s!==i&&s!==t&&s!=="")&&(o=n.GC$.trim(s),o!==i&&o!==t&&o!==""&&h.push({text:o,value:o}));return h},f.prototype._equals=function(n,t){return n instanceof Date&&t instanceof Date?n.valueOf()===t.valueOf():n===t},f.prototype.evaluate=function(r,u,f,e){var s,h,o,c,l;if(e===i||e===t||e==="")return this.ignoreBlank===!0;if(s=this.getValidList(r,u,f),s)for(h=0;h<s.length;h++)if(o=s[h],(o===i||o===t)&&(e===i||e===t))return!0;else if(o!==i&&o!==t)if(this.formula){if(this._equals(o,e))return!0}else if(c=r.getActualStyle(u,f),l=n.util.parseText2Value(c,o,!0),this._equals(l,e))return!0;return!1},f.prototype.getExpected=function(n,t,i){var s=this,o=[],c,l,u,e,h,v,a,y,f;if(s.formula){if(a=n.getCalcService(),!a)return o;if(y=a.parse(n._getSheetSource(),s.formula,t-s.offsetRow,i-s.offsetCol),f=a.evaluateParsedFormula(n._getSheetSource(),y,t,i,!0),r.ref(f)){c=f.getRowCount(0);l=f.getColumnCount(0);var w=f.getRow(0),b=f.getColumn(0),p=f._sheetSource&&f._sheetSource._sheet;for(u=0;u<c;u++)for(o[u]=[],e=0;e<l;e++)h=f.getValue(0,u,e),v=p?p.getText(w+u,b+e):h,o[u][e]={value:h,text:v}}else if(r.arr(f))for(c=f.getRowCount(),l=f.getColumnCount(),u=0;u<c;u++)for(o[u]=[],e=0;e<l;e++)h=f.getValue(u,e),o[u][e]={value:h,text:h}}else o.push({value:s.expected,text:s.expected});return o},f.prototype._isDefaultValue=function(n,t){switch(n){case"ignoreBlank":return t===!1;default:return!1}},f.prototype.toJSON=function(){var n=this,r={expected:n.expected,formula:n.formula,conType:12,ignoreBlank:n.ignoreBlank},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},f.prototype.fromJSON=function(n,r){n&&(n.expected!==t&&n.expected!==i&&(this.expected=n.expected),n.formula!==t&&n.formula!==i&&(this.formula=n.formula),n.ignoreBlank!==t&&n.ignoreBlank!==i&&(this.ignoreBlank=n.ignoreBlank))},f.fromSource=function(n){return new f(n,t)},f.fromFormula=function(n){return new f("",n)},f.prototype.getFormulas=function(){return this.formula?[this.formula]:[]},f.prototype.setFormulas=function(n){this.formula=n[0]},f}(f);n.AreaCondition=kt;gt=function(){function r(n){this.rules=[];this._ruleTypes=t;this._cellRuleCache={};this.worksheet=n}return r.prototype.getRule=function(n){return this.rules[n]},r.prototype.count=function(){return this.rules.length},r.prototype._cloneToActualRanges=function(n){for(var r,i=[],u=this.worksheet,f=n.length,t=0;t<f;t++)r=u._getActualRange(n[t]),i.push(r);return i},r.prototype._cloneToRanges=function(t){for(var i,r,f=[],e=this.worksheet,u=0,o=t.length;u<o;u++)i=t[u],r=new n.Range(i.row,i.col,i.rowCount,i.colCount),i.row===0&&i.rowCount===e.getRowCount()&&(r.row=-1),i.col===0&&i.colCount===e.getColumnCount()&&(r.col=-1),f.push(r);return f},r.prototype._resetCache=function(){var t,n;if(this._cellRuleCache={},t=this._cellRuleCache,this.rules)for(n=0;n<this.rules.length;n++)this._addCache(this.rules[n])},r.prototype.clearCellRuleCache=function(){this._cellRuleCache={}},r.prototype._addCache=function(n){for(var u,f,e=this,y=e._cellRuleCache,t,i,o,s,p=e._cloneToActualRanges(n.ranges),w=e.worksheet,b=w.getRowCount(),k=w.getColumnCount(),h=0;h<p.length;h++){var r=p[h],c=r.row,l=r.col,a=r.rowCount,v=r.colCount;for(c+a-1>=b&&(a=b-c),l+v-1>=k&&(v=k-l),u=0;u<a;u++)for(o=u+c,t=y[o],t||(y[o]=t={}),f=0;f<v;f++)s=f+l,i=t[s],i||(t[s]=i=[]),i.push(n)}},r.prototype._removeCache=function(n){for(var r,o,s,u,f,v=this._cellRuleCache,e,t,l,h,a=this._cloneToActualRanges(n.ranges),c=0;c<a.length;c++)for(r=a[c],o=0;o<r.rowCount;o++)if(l=o+r.row,e=v[l],e)for(s=0;s<r.colCount;s++)if(h=s+r.col,t=e[h],t){for(u=[],f=0;f<t.length;f++)t[f]!==n&&u.push(t[f]);u.length===0&&(u=i);e[h]=u}},r.prototype._removeCacheByRange=function(n,t,r,u){for(var f,s,h,c=this._cellRuleCache,e,l,o=0;o<r;o++)if(s=o+n,e=c[s],e)for(f=0;f<u;f++)h=f+t,e[h]=i},r.prototype.addSpecificTextRule=function(n,t,i,r){var u=new nt(n,t,i);return u.ranges=r,this.addRule(u)},r.prototype.addCellValueRule=function(n,t,i,r,u){var f=new g(n,t,i,r);return f.ranges=u,this.addRule(f)},r.prototype.addDateOccurringRule=function(n,t,i){var r=new ut(n,t);return r.ranges=i,this.addRule(r)},r.prototype.addFormulaRule=function(n,t,i){var r=new it(n,t);return r.ranges=i,this.addRule(r)},r.prototype.addTop10Rule=function(n,t,i,r){var u=new et(n,t,i);return u.ranges=r,this.addRule(u)},r.prototype.addUniqueRule=function(n,t){var i=new ot(n);return i.ranges=t,this.addRule(i)},r.prototype.addDuplicateRule=function(n,t){var i=new st(n);return i.ranges=t,this.addRule(i)},r.prototype.addAverageRule=function(n,t,i){var r=new ht(n,t);return r.ranges=i,this.addRule(r)},r.prototype.add3ScaleRule=function(n,t,i,r,u,f,e,o,s,h){var c=new at(n,t,i,r,u,f,e,o,s);return c.ranges=h,this.addRule(c)},r.prototype.add2ScaleRule=function(n,t,i,r,u,f,e){var o=new lt(n,t,i,r,u,f);return o.ranges=e,this.addRule(o)},r.prototype.addDataBarRule=function(n,t,i,r,u,f){var e=new vt(n,t,i,r,u);return e.ranges=f,this.addRule(e)},r.prototype.addIconSetRule=function(n,t){var i=new yt(n);return i.ranges=t,this.addRule(i)},r.prototype.addRule=function(t){if(this.worksheet){var i=this;return this.worksheet._bindToAutoRefresh(function(t){if(!t)throw new Error(n.SR.Exp_RuleIsNull);for(var r=0;r<i.rules.length;r++)i.rules[r]._priority++;return t._priority=1,i.rules.push(t),i._addCache(t),t})(t)}},r.prototype.removeRule=function(t){if(this.worksheet){var i=this;this.worksheet._bindToAutoRefresh(function(t){t&&(i._removeCache(t),n.ArrayHelper.remove(i.rules,t))})(t)}},r.prototype._removeRange=function(i,r,u,f,s){var k,d,g,nt,tt,it,rt,ut;if(!i.intersect(r,u,f,s))return[i];var h=i.row,p=i.row+i.rowCount-1,c=i.col,w=i.col+i.colCount-1,l=r,a=r+f-1,v=u,y=u+s-1,b=[];return(h!==-1&&c!==-1&&l!==-1&&v!==-1&&(v-c>0&&l-h>0&&(k=new n.Range(h,c,l-h,v-c),b.push(k)),e(y,w)-o(v,c)>=0&&l-h>0&&(d=new n.Range(h,o(v,c),l-h,e(y,w)-o(v,c)+1),b.push(d)),w-y>0&&l-h>0&&(g=new n.Range(h,y+1,l-h,w-y),b.push(g)),v-c>0&&e(a,p)-o(l,h)>=0&&(nt=new n.Range(o(l,h),c,e(a,p)-o(l,h)+1,v-c),b.push(nt)),w-y>0&&e(a,p)-o(l,h)>=0&&(tt=new n.Range(o(l,h),y+1,e(a,p)-o(l,h)+1,w-y),b.push(tt)),v-c>0&&p-a>0&&(it=new n.Range(a+1,c,p-a,v-c),b.push(it)),e(y,w)-o(v,c)>=0&&p-a>0&&(rt=new n.Range(a+1,o(v,c),p-a,e(y,w)-o(v,c)+1),b.push(rt)),w-y>0&&p-a>0&&(ut=new n.Range(a+1,y+1,p-a,w-y),b.push(ut))),b.length>0)?b:t},r.prototype.removeRuleByRange=function(t,i,r,u){if(this.worksheet){var f=this;this.worksheet._bindToAutoRefresh(function(t,i,r,u){var l=[],s,y,e,o,a,h,p,v,c,w;if(f.rules)for(f._removeCacheByRange(t,i,r,u),s=0,y=f.rules.length;s<y;s++)if(e=f.rules[s],e&&e.ranges&&e.intersects(t,i,r,u)){for(o=[],a=f._cloneToActualRanges(e.ranges),h=0,p=a.length;h<p;h++)v=f._removeRange(a[h],t,i,r,u),v&&(o=o.concat(v));o.length>0?e.ranges=f._cloneToRanges(o):l.push(e)}for(c=0,w=l.length;c<w;c++)n.ArrayHelper.remove(f.rules,l[c])})(t,i,r,u)}},r.prototype.clearRule=function(){if(this.worksheet){var n=this;this.worksheet._bindToAutoRefresh(function(){n.rules.length=0;n._resetCache()})()}},r.prototype.getRules=function(n,t){var o=this.rules,f,e,s,u,h,r,i;if(arguments.length===0||o.length===0)return o;if(n=n===undefined?-1:n,t=t===undefined?-1:t,f=this._cellRuleCache,e=[],n!==-1&&t!==-1){if(u=f[n],u&&(r=u[t],r))for(i=0;i<r.length;i++)e.push(r[i])}else if(n===-1){for(s in f)if(r=f[s][t],r)for(i=0;i<r.length;i++)e.push(r[i])}else if(u=f[n],u)for(h in u)for(r=u[h],i=0;i<r.length;i++)e.push(r[i]);return e},r.prototype.containsRule=function(t,i,r){return t&&n.ArrayHelper.contains(this.rules,t)?t.contains(i,r):!1},r.prototype._clearNullRefRules=function(){var n=this,t,i;if(n.rules)for(t=n.count()-1;t>-1;t--)i=n.rules[t],i.hasNoReference()&&n.removeRule(i)},r.prototype._addRows=function(n,t){var i=this,f,r,u;if(i.rules&&i.worksheet)for(f=i.rules.length,r=0;r<f;r++)u=i.rules[r],u&&u._addRows(n,t);this._resetCache()},r.prototype._addColumns=function(n,t){var i=this,f,r,u;if(i.rules&&i.worksheet)for(f=i.rules.length,r=0;r<f;r++)u=i.rules[r],u&&u._addColumns(n,t);this._resetCache()},r.prototype._removeRows=function(n,t){var i=this,f,r,u;if(i.rules&&i.worksheet)for(f=i.rules.length,r=0;r<f;r++)u=i.rules[r],u&&u._removeRows(n,t);this._resetCache()},r.prototype._removeColumns=function(n,t){var i=this,f,r,u;if(i.rules&&i.worksheet)for(f=i.rules.length,r=0;r<f;r++)u=i.rules[r],u&&u._removeColumns(n,t);this._resetCache()},r.prototype._clearCache=function(){var n=this.rules,r,i,u;if(n!=t&&n.length>0)for(i=0,u=n.length;i<u;i++)r=n[i],r instanceof v&&r._clearCache()},r.prototype.toJSON=function(){for(var u,n=[],r=0;r<this.rules.length;r++)u=this.rules[r],n.push(u?u.toJSON():t);return n.length===0?i:{rules:n}},r.prototype.fromJSON=function(n,i){var u,f,r,o,e;if(n&&n.rules){for(this.rules=[],u=0;u<n.rules.length;u++)f=n.rules[u],r=t,f&&(o=this._getRuleTypes(),e=o[f.ruleType],e&&(r=new e,r.fromJSON(f,i))),r&&this.rules.push(r);this._resetCache()}},r.prototype._getRuleTypes=function(){if(!this._ruleTypes){var n={};n[0]=s;n[1]=g;n[2]=nt;n[3]=it;n[4]=ut;n[5]=et;n[6]=ot;n[7]=st;n[8]=ht;n[9]=v;n[10]=lt;n[11]=at;n[12]=vt;n[13]=yt;this._ruleTypes=n}return this._ruleTypes},r}();n.ConditionalFormats=gt})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){function e(n){if(n===r||n===i)return 0;else if(typeof n=="number")return n;else if(typeof n=="string"){var t=parseFloat(n);if(!isNaN(t)&&t.toString()===n.toString())return t}return i}function o(n){if(n instanceof Date)return n;else if(typeof n=="string")return new Date(n);return i}var f;t.feature("dataValidator",["core.common"]);var i=null,r=undefined,u=t.StringHelper.TrimStart;f=function(){function f(n){var t=this;t.id=f._validatorId++;t._init();n&&(t.condition=n,t.condition.ignoreBlank=t.ignoreBlank)}return f.prototype.IgnoreBlank=function(n){var t=this;return arguments.length<=0?t.ignoreBlank:(t.ignoreBlank=n,t.condition&&(t.condition.ignoreBlank=n),t)},f.prototype._init=function(){var n=this;n.errorStyle=0;n.ignoreBlank=!0;n.inCellDropdown=!0;n.showInputMessage=!0;n.showErrorMessage=!0;n.inputTitle="";n.errorTitle="";n.inputMessage="";n.errorMessage="";n.comparisonOperator=6;n.condition=i;n.type=0},f.prototype.value1=function(){var r=this,n=r.condition&&r.condition.item1?r.condition.item1:r.condition;return n?n.formula&&n.formula.length>0?"="+u(t.GC$.trim(n.formula.toString().toUpperCase()),"="):n.expected:i},f.prototype.value2=function(){var r=this,n=r.condition&&r.condition.item2?r.condition.item2:r.condition;return n?n.formula&&n.formula.length>0?"="+u(t.GC$.trim(n.formula.toString().toUpperCase()),"="):n.expected:i},f.prototype.isValid=function(n,t,u,f){var h=this,c,s;if(h.condition){if(h.IgnoreBlank(h.ignoreBlank),h.condition.ignoreBlank&&(f===r||f===i||f===""))return!0;if(c=f,f!==r&&f!==i)switch(h.type){case 0:return!0;case 2:case 1:s=e(f);s!==r&&s!==i&&(c=s);break;case 4:case 5:s=o(f);s!==r&&s!==i&&(c=s);break;case 7:case 3:case 6:break}return h.condition.evaluate(n,t,u,c,c)}return!0},f.prototype.reset=function(){this._init()},f.prototype.getValidList=function(n,r,u){if(!t.features.conditionalFormat)return i;var f=this;return f.condition!=i&&f.type===3&&f.condition instanceof t.AreaCondition?f.condition.getValidList(n,r,u):i},f.prototype._isDefaultValue=function(n,t){switch(n){case"errorStyle":return t===0;case"ignoreBlank":return t===!0;case"inCellDropdown":return t===!0;case"showInputMessage":return t===!0;case"showErrorMessage":return t===!0;case"inputTitle":return t==="";case"errorTitle":return t==="";case"inputMessage":return t==="";case"errorMessage":return t==="";case"comparisonOperator":return t===6;case"type":return t===0;case"condition":return t===i;default:return!1}},f.prototype.toJSON=function(){var n=this,e={errorStyle:n.errorStyle,ignoreBlank:n.ignoreBlank,inCellDropdown:n.inCellDropdown,showInputMessage:n.showInputMessage,showErrorMessage:n.showErrorMessage,inputTitle:n.inputTitle,errorTitle:n.errorTitle,inputMessage:n.inputMessage,errorMessage:n.errorMessage,comparisonOperator:n.comparisonOperator,type:n.type,condition:n.condition?n.condition.toJSON():n.condition},u={},i,f;for(i in e)f=e[i],n._isDefaultValue(i,f)||(u[i]=f);return t.GC$.isEmptyObject(u)?r:u},f.prototype.fromJSON=function(n,u){var f;if(n){if(f=this,t.features.conditionalFormat&&n.condition!==i&&n.condition!==r){var e=i,s=f._getConditionTypes(),o=s[n.condition.conType];o&&(e=new o,e.fromJSON(n.condition,u));f.condition=e}n.type!==i&&n.type!==r&&(f.type=n.type);n.comparisonOperator!==i&&n.comparisonOperator!==r&&(f.comparisonOperator=n.comparisonOperator);n.errorStyle!==i&&n.errorStyle!==r&&(f.errorStyle=n.errorStyle);n.ignoreBlank!==i&&n.ignoreBlank!==r&&(f.ignoreBlank=n.ignoreBlank);n.inCellDropdown!==i&&n.inCellDropdown!==r&&(f.inCellDropdown=n.inCellDropdown);n.showInputMessage!==i&&n.showInputMessage!==r&&(f.showInputMessage=n.showInputMessage);n.showErrorMessage!==i&&n.showErrorMessage!==r&&(f.showErrorMessage=n.showErrorMessage);n.inputTitle!==i&&n.inputTitle!==r&&(f.inputTitle=n.inputTitle);n.errorTitle!==i&&n.errorTitle!==r&&(f.errorTitle=n.errorTitle);n.inputMessage!==i&&n.inputMessage!==r&&(f.inputMessage=n.inputMessage);n.errorMessage!==i&&n.errorMessage!==r&&(f.errorMessage=n.errorMessage)}},f.prototype.clone=function(){var t=new n.Sheets.DefaultDataValidator;return t.fromJSON(this.toJSON()),t},f.prototype._getConditionTypes=function(){if(!this._dict){var n={};n[0]=t.RelationCondition;n[1]=t.NumberCondition;n[2]=t.TextCondition;n[3]=t.ColorCondition;n[4]=t.FormulaCondition;n[5]=t.DateCondition;n[6]=t.DateExCondition;n[7]=t.TextLengthCondition;n[8]=t.Top10Condition;n[9]=t.UniqueCondition;n[10]=t.AverageCondition;n[11]=t.CellValueCondition;n[12]=t.AreaCondition;this._dict=n}return this._dict},f.getImageSrc=function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMOSURBVHjaXJNdaJRHFIbfM7PfGremUTfkpxgpiheiBOmFtYUgRXNRqNnd75sEhBoIKhrwQpFUUSsihhIQ41+FNrUGqYhRY43STZqgARNRTIzRaFqz6xJTtals3K8xRQ3x7UV215+LB2bOxTNn3jMDs+mEIgmS+LwQiqSQ9JG03FHX54666pn7TLmJEZVIjCCRGMkYGxvNiI9FvaENZzLw/PmqtCDFV/4WkERw8TI03K6XqqrNWLBgPoafDmNwMCbd3TestpMDHpJAuIcWSZjSUrnS0SFOWamXJLpuDYAkAiYAkioYDCIej0+Lx12QrervFxOemjWfCvIyIcmTVeLVC1986OkUklhRtlgutLYrkpnOKlt1dl0BSfTHmnCnm5oTm0AS6I0xLaDLrK1PusTp/cb7/rUAyH8kSL+Vqt0ebpuGP699LCRROAdqf/suGforCpLi4DMpAOQQLAEgfE2sRDZIv5cknGxi74HDFnZ/32olk9f//vOTPIj05ZnKZpp14QlnfZgpTOXvNGsvjrvuH9MnOwAOYlhQ/UPYmxRkJVvzPHw8JF8EdrKoZEeapSt2cHDo4Sxn7R0hiV8/hEQe3Ad21jZNJQnbDklSBBas0ddvRj2Fi4qZIhaL+Q3ni8N0ZohGe4Dv6sKZfFP0kvkSWLZdGvLpiUTuTS9cVMxI5H5+fz+UfXyOto/Ns5bUL7dyjsBjTsKDbbVnM0iqYNHXYi9ZLiSlaRbFn089zlzvwN1IzkDlmDhfdiin5KgOBY5qO9iojX1K9+VRcOCXnlySsFkOkjj/WGschtR0Kt/Ga9D2aYj5DWKaIeYSxTlFMS2T66udBDbXHS94Z97ZUB8Ayt7+iVVddlkzl5LCvrklvQ9dr1fnF0IQbng5O/VQsmAJSfnxSLuqCG3Rxxpfz3xbXv0IEkzm5YR7lXOCGs6+PVNJYjaQnoKwSgBIDSqkjjPUuv3QLP9ImW+hG1/lKJtzp5jaCmW2nrNAUpOUkqrWrJUb23T5rhZf0eoWhbeEKX7O4eTPHe8DSTjF59T/AwCfnhbaDaIICgAAAABJRU5ErkJggg=="},f.isFormula=function(n){return n&&n[0]==="="},f.createNumberValidator=function(n,r,e,o){var v;if(!t.features.conditionalFormat)return i;var h=f.isFormula(r)?u(r,"="):i,c=f.isFormula(r)?i:r,y=f.isFormula(e)?u(e,"="):i,p=f.isFormula(e)?i:e,s=i,l,a,w=t.ComparisonOperator,b=t.GeneralCompareType,k=t.RelationCompareType;switch(n){case 6:l=new t.NumberCondition(3,c,h);l.integerValue=o;a=new t.NumberCondition(5,p,y);a.integerValue=o;s=new t.RelationCondition(1,l,a);break;case 7:l=new t.NumberCondition(4,c,h);l.integerValue=o;a=new t.NumberCondition(2,p,y);a.integerValue=o;s=new t.RelationCondition(0,l,a);break;case 0:s=new t.NumberCondition(0,c,h);s.integerValue=o;break;case 1:s=new t.NumberCondition(1,c,h);s.integerValue=o;break;case 2:s=new t.NumberCondition(2,c,h);s.integerValue=o;break;case 3:s=new t.NumberCondition(3,c,h);s.integerValue=o;break;case 4:s=new t.NumberCondition(4,c,h);s.integerValue=o;break;case 5:s=new t.NumberCondition(5,c,h);s.integerValue=o;break}return v=new f(s),v.type=o?1:2,v.comparisonOperator=n,v},f.createDateValidator=function(n,r,e){var a;if(!t.features.conditionalFormat)return i;var s=f.isFormula(r)?u(r,"="):i,h=f.isFormula(r)?i:r,v=f.isFormula(e)?u(e,"="):i,y=f.isFormula(e)?i:e,o=i,c,l,p=t.ComparisonOperator,w=t.DateCompareType,b=t.RelationCompareType;switch(n){case 6:c=new t.DateCondition(5,h,s);l=new t.DateCondition(3,y,v);o=new t.RelationCondition(1,c,l);break;case 7:c=new t.DateCondition(2,h,s);l=new t.DateCondition(4,y,v);o=new t.RelationCondition(0,c,l);break;case 0:o=new t.DateCondition(0,h,s);break;case 1:o=new t.DateCondition(1,h,s);break;case 2:o=new t.DateCondition(4,h,s);break;case 3:o=new t.DateCondition(5,h,s);break;case 4:o=new t.DateCondition(2,h,s);break;case 5:o=new t.DateCondition(3,h,s);break}return a=new f(o),a.type=4,a.comparisonOperator=n,a},f.createTextLengthValidator=function(n,r,e){var a;if(!t.features.conditionalFormat)return i;var s=f.isFormula(r)?u(r,"="):i,h=f.isFormula(r)?i:r,v=f.isFormula(e)?u(e,"="):i,y=f.isFormula(e)?i:e,o=i,c,l,p=t.ComparisonOperator,w=t.GeneralCompareType,b=t.RelationCompareType;switch(n){case 6:c=new t.TextLengthCondition(3,h,s);l=new t.TextLengthCondition(5,y,v);o=new t.RelationCondition(1,c,l);break;case 7:c=new t.TextLengthCondition(4,h,s);l=new t.TextLengthCondition(2,y,v);o=new t.RelationCondition(0,c,l);break;case 0:o=new t.TextLengthCondition(0,h,s);break;case 1:o=new t.TextLengthCondition(1,h,s);break;case 2:o=new t.TextLengthCondition(2,h,s);break;case 3:o=new t.TextLengthCondition(3,h,s);break;case 4:o=new t.TextLengthCondition(4,h,s);break;case 5:o=new t.TextLengthCondition(5,h,s);break}return a=new f(o),a.type=6,a.comparisonOperator=n,a},f.createFormulaValidator=function(n){if(!t.features.conditionalFormat)return i;var r=new f(new t.FormulaCondition(4,u(n,"=")));return r.type=7,r},f.createFormulaListValidator=function(n){if(!t.features.conditionalFormat)return i;var r=new f(t.AreaCondition.fromFormula(n));return r.type=3,r},f.createListValidator=function(n){if(!t.features.conditionalFormat)return i;var r=new f(t.AreaCondition.fromSource(n));return r.type=3,r},f._validatorId=1,f}();t.DefaultDataValidator=f})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var nr,tr,ir,ii,rr,ri,ui,fi;n.feature("celltype",["core.common","core.sheet_action","core.basecelltype"]);var cr="undefined",t=null,i=undefined,l=Math.max,bt=Math.min,ht=Math.floor,ci=Math.round,r=window.document,s="position",h="absolute",tt="margin",c="font",u="left",at="right",e="top",lr="bottom",vt="alphabetic",ar="middle",kt="center",d="gcUIElement",et="tabindex",a="none",w="0",li="#F6FAFB",ai="#D2DBEB",v=".gcEditingInput",dt="keydown"+v,gt="keyup"+v,ni="mousedown"+v,ti="mouseup"+v,vi="mouseout"+v,yi="mousemove"+v,pi="click"+v,b="width",y="height",ot="padding",it="hidden",vr="visibility",yr="word-wrap",rt="overflow",yt="resize",ut="border",ft="outline",pt="box-shadow",g="box-sizing",k="color",wi="border-width",bi="border-style",ki="border-color",ct="white-space",f="background-color",st="z-index",di="max-width",gi="max-height";(function(n){n[n.Text=0]="Text";n[n.Index=1]="Index";n[n.Value=2]="Value"})(n.EditorValueType||(n.EditorValueType={}));nr=n.EditorValueType,function(n){n[n.top=0]="top";n[n.bottom=1]="bottom";n[n.left=2]="left";n[n.right=3]="right"}(n.CheckBoxTextAlign||(n.CheckBoxTextAlign={}));tr=n.CheckBoxTextAlign,function(n){n[n.Blank=0]="Blank";n[n.Self=1]="Self";n[n.Parent=2]="Parent";n[n.Top=3]="Top"}(n.HyperLinkTargetType||(n.HyperLinkTargetType={}));ir=n.HyperLinkTargetType;ii=function(o){function v(){o.call(this);var n=this;n.allowOverflow=!1;n.typeName="5";n._checkboxSize=12;n._caption="";n._textTrue="";n._textIndeterminate="";n._textFalse="";n._textAlign=3;n._isThreeState=!1}return __extends(v,o),v.prototype.paintValue=function(r,f,e,o,s,h,c,l){var et,rt;if(r){r.save();r.rect(e,o,s,h);r.clip();r.beginPath();var y=this,d=this.getText(f,l),g=0,p=0,ft=l.sheet;ft&&(g=ft._getStringWidthByCanvas(d,c.font),p=ft._getFontHeight(c.font),d&&(et=d.split(/\r\n|\r|\n/),p*=et.length));var a=y._checkboxSize/2,ot=new n.Rect(++e,++o,--s,--h),w=parseInt((e+y._getCheckBoxLeft(c,ot,g)).toString()),v=parseInt((o+y._getCheckBoxTop(c,ot,p)).toString()),it=u,nt=w+1;c.hAlign===1?(it=kt,nt+=a):c.hAlign===2&&(it=at,nt+=a*2);rt=c.font;rt&&r.font!==rt&&(r.font=rt);c.foreColor&&(r.fillStyle=c.foreColor);var b=c.textDecoration,tt=l.fontInfo.fontSize,ut=tt>8?ht((tt-8)/5+2):1,k=p/2-tt/2+ut-1;r.textBaseline!==vt&&(r.textBaseline=vt);y._textAlign===2?(r.textAlign=at,r.fillText(d,w+1-2,v+a+p/2-k),b&&y._renderTextDecoration(r,b,w+1-2,v+a+p/2-k,g,tt,ut)):y._textAlign===0&&(r.textAlign=it,r.fillText(d,nt,v-2-k),b&&y._renderTextDecoration(r,b,nt,v-2-k,g,p));r.save();r.strokeStyle="black";r.strokeRect(w+.5,v+.5,a*2+.05,a*2+.05);r.fillStyle="white";r.fillRect(w+1,v+1,a*2-1,a*2-1);y._isThreeState&&(f===t||f===i)?(r.beginPath(),r.fillStyle="green",r.rect(w+3,v+3,(a-2.5)*2,(a-2.5)*2),r.fill()):!!f==!0&&(r.beginPath(),r.lineWidth=2.5,r.moveTo(w+3,v+a),r.lineTo(w+a,v+a*2-3.5),r.lineTo(w+a*2-1.5,v+3),r.stroke());r.restore();c.foreColor&&(r.fillStyle=c.foreColor);y._textAlign===3?(r.textAlign=u,r.fillText(d,w+1+a*2+2,v+a+p/2-k),b&&y._renderTextDecoration(r,b,w+1+a*2+2,v+a+p/2-k,g,tt,ut)):y._textAlign===1&&(r.textAlign=it,r.fillText(d,nt,v+a*2+2+p-k),b&&y._renderTextDecoration(r,b,nt,v+a*2+2+p-k,g,tt,ut));r.restore()}},v.prototype.getText=function(n,t){return this._getDisplayText(n)},v.prototype.focus=function(n,t){n&&n.focus()},v.prototype._formatEditorValue=function(n,t,i,r){return i},v.prototype._getCheckBoxLeft=function(t,i,r,u){var f=i.x-1,s=i.width+1,h=0,e=0,o=this,c;return o._textAlign===0||o._textAlign===1?(e=f+5,t.hAlign===1?e=f+s/2-o._checkboxSize/2:t.hAlign===2&&(e=f+s-5-o._checkboxSize)):o._textAlign===2?(h=o._checkboxSize+r,e=f+5+r,t.hAlign===1?e=f+s/2-h/2+r:t.hAlign===2&&(e=f+s-5-h+r)):(h=o._checkboxSize+r,e=f+5,t.hAlign===1?e=f+s/2-h/2:t.hAlign===2&&(e=f+s-5-h)),c=e-f,u&&n.util.browser.msie&&(c-=3),c},v.prototype._getCheckBoxTop=function(t,i,r,u){var f=i.y-1,o=i.height+1,s=0,e=0,h=this,c;return h._textAlign===0?(s=h._checkboxSize+r,e=f+5+r,t.vAlign===1?e=f+o/2-s/2+r:t.vAlign===2&&(e=f+o-5-s+r)):h._textAlign===1?(s=h._checkboxSize+r,e=f+5,t.vAlign===1?e=f+o/2-s/2:t.vAlign===2&&(e=f+o-5-s)):(e=f+5,t.vAlign===1?e=f+o/2-h._checkboxSize/2:t.vAlign===2&&(e=f+o-5-h._checkboxSize)),c=e-f,u&&n.util.browser.msie&&(c-=3),c},v.prototype.createEditorElement=function(t){var l=r.createElement("div"),v=t&&t.sheet&&t.sheet.parent&&t.sheet.parent._host,p=n.util.getPreferredZIndex(v)+1e3,i=n.GC$(l),u,e,o;return i.css(s,h).css(tt,w).css(ot,w).css(rt,it).css(yt,a).css(ut,"2px #5292f7 solid").css(ft,a).css(pt,"1px 2px 5px rgba(0,0,0,0.4)").css(g,"content-box").css(st,p).attr(et,1).attr(d,"gcEditingInput"),u=n.GC$(r.createElement("input")),u.attr("type","checkbox"),i.append(u),e=n.GC$(r.createElement("span")),e.css(s,h).css(c,"normal 11pt calibri").css("cursor","default").css(ct,"nowrap"),i.append(e),o=n.GC$(r.createElement("div")),o.css(s,h).css(f,"green").css(b,(this._checkboxSize/2-2.5)*2).css(y,(this._checkboxSize/2-2.5)*2),i.append(o),l},v.prototype._getNextState=function(n){return this._isThreeState?n===t||n===i?!1:!!n==!0?t:!0:!n},v.prototype.setEditorValue=function(r,u,f){if(r&&r.children[0]&&r.children[1]&&r.children[2]){var e=f&&f.sheet&&f.sheet._startEditByKeydown;e||(u=this._getNextState(u));this._isThreeState?u===t||u===i?(r.children[0].checked=!1,n.GC$(r.children[2]).show()):(r.children[0].checked=!!u,n.GC$(r.children[2]).hide()):r.children[0].checked=!!u;n.GC$(r.children[1]).text(this._getDisplayText(u))}},v.prototype.getEditorValue=function(i,r){return i&&i.children[0]&&i.children[1]&&i.children[2]?this._isThreeState?n.GC$(i.children[2]).isVisible()?t:i.children[0].checked:i.children[0].checked:t},v.prototype._triggerButtonClicked=function(n,t,i,r){var u=n.parent;u&&u.triggerButtonClicked({sheet:n,sheetName:n._name,row:t,col:i,sheetArea:r})},v.prototype.activateEditor=function(t,i,r,o){var h=t&&o&&o.sheet,s;if(h){var c=n.GC$(t),l=h._eventHandler._getCanvasPosition(),a=h.getBounds();c.css(e,l.top+a.y+r.y-2).css(u,l.left+a.x+r.x-2).css(f,i.backColor?i.backColor:"white");s=this;c.bind(ni,function(t){n.util.cancelDefault(t)});c.bind(ti,function(n){var u=s.getEditorValue(t,o);s.setEditorValue(t,u,o);s.updateEditor(t,i,r,o);s._triggerButtonClicked(h,h._activeRowIndex,h._activeColIndex,o.sheetArea)});c.bind(dt,function(t){if(t.keyCode!==32||t.ctrlKey||t.shiftKey||t.altKey)t.keyCode!==8||t.ctrlKey||t.shiftKey||t.altKey||n.util.cancelDefault(t);else return s._isKeyDown=!0,n.util.cancelDefault(t),!1});c.bind(gt,function(n){if(s._isKeyDown&&n.keyCode===32&&!n.ctrlKey&&!n.shiftKey&&!n.altKey){s._isKeyDown=!1;var u=s.getEditorValue(t,o);s.setEditorValue(t,u,o);s.updateEditor(t,i,r,o);s._triggerButtonClicked(h,h._activeRowIndex,h._activeColIndex,o.sheetArea)}});t.children[0]&&n.GC$(t.children[0]).bind("click",function(t){n.util.cancelDefault(t)})}},v.prototype.updateEditor=function(i,r,f,o){var a=i&&o&&o.sheet,w,g,v,y,b,ut,l,p,ft,et;if(a){n.GC$(i).width(f.width).height(f.height);var ot=n.GC$(i),nt=a._render,tt=a._eventHandler._getCanvasPosition(),it=a.getBounds();ot.css(e,tt.top+it.y+f.y-2).css(u,tt.left+it.x+f.x-2);var s=i.children[0],rt=i.children[1],d=i.children[2];if(s&&rt&&d){w=n.GC$(rt);g=w.text();r.foreColor&&w.css(k,r.foreColor);v=t;v=r.font?r.font:nt._getDefaultFont();a._zoomFactor>1&&(v=nt._getZoomFont(v));w.css(c,v);y=a._getStringWidth(g,v);b=a._getFontHeight(v);g&&(ut=g.split(/\r\n|\r|\n/),b*=ut.length);var h=this,st=h._getCheckBoxLeft(r,f,y,!0),ht=h._getCheckBoxTop(r,f,b,!0);n.GC$(s).css("margin-left",st).css("margin-top",ht);l=0;p=0;h._textAlign===0?(l=s.offsetLeft,r.hAlign===1?l=s.offsetLeft+h._checkboxSize/2-y/2:r.hAlign===2&&(l=s.offsetLeft+h._checkboxSize-y),p=s.offsetTop-b):h._textAlign===1?(l=s.offsetLeft,r.hAlign===1?l=s.offsetLeft+h._checkboxSize/2-y/2:r.hAlign===2&&(l=s.offsetLeft+h._checkboxSize-y),p=s.offsetTop+s.offsetHeight):h._textAlign===2?(l=s.offsetLeft-y-2,p=s.offsetTop+h._checkboxSize/2-b/2):(l=s.offsetLeft+s.offsetWidth+2,p=s.offsetTop+h._checkboxSize/2-b/2);n.util.browser.msie&&(l+=3,p+=3);w.css(u,l).css(e,p);h._isThreeState?(ft=s.offsetLeft+(s.offsetWidth-d.offsetWidth)/2,et=s.offsetTop+(s.offsetHeight-d.offsetHeight)/2,n.GC$(d).css(u,ft).css(e,et).toggle().toggle()):n.GC$(d).hide();r.textDecoration&&h._setEditStatusTextDecoration(w,r.textDecoration)}}},v.prototype.caption=function(n){return arguments.length===0?this._caption:(this._caption=n,this)},v.prototype.textTrue=function(n){return arguments.length===0?this._textTrue:(this._textTrue=n,this)},v.prototype.textIndeterminate=function(n){return arguments.length===0?this._textIndeterminate:(this._textIndeterminate=n,this)},v.prototype.textFalse=function(n){return arguments.length===0?this._textFalse:(this._textFalse=n,this)},v.prototype._getDisplayText=function(n){var r=this;return r._isThreeState&&(n===t||n===i)?r._textIndeterminate||r._caption:!!n==!0?r._textTrue||r._caption:r._textFalse||r._caption},v.prototype.textAlign=function(n){return arguments.length===0?this._textAlign:(this._textAlign=n,this)},v.prototype.isThreeState=function(n){return arguments.length===0?this._isThreeState:(this._isThreeState=n,this)},v.prototype.getHitInfo=function(n,r,u,f,e){if(e){var o=e.sheetArea;if(o===t||o===i||o===3)return{x:n,y:r,row:e.row,col:e.col,cellRect:f,sheetArea:o,isReservedLocation:!0,sheet:e.sheet}}return t},v.prototype.processMouseDown=function(n){if(!n)return!1;n.isReservedLocation&&(this._isMouseDownReservedLocation=!0)},v.prototype.processMouseUp=function(r){var e,f;if(!r)return!1;if(e=this,f=r.sheet,e._isMouseDownReservedLocation&&f&&r.isReservedLocation){e._isMouseDownReservedLocation=!1;var s=r.row,h=r.col,o=r.sheetArea,u=f._getModel(o).getNode(s,h,!0);if(u._isFirstMouseUp)delete u._isFirstMouseUp,u._mouseupToken&&(window.clearTimeout(u._mouseupToken),delete u._mouseupToken);else{if(o===t||o===i||o===3){var c=f.getValue(s,h,o),l=e._getNextState(c),a={row:s,col:h,newValue:l,autoFormat:!0},v=new n.UndoRedo.CellEditUndoAction(f,a);f._doCommand(v)}return e._triggerButtonClicked(f,s,h,r.sheetArea),u._isFirstMouseUp=!0,u._mouseupToken=window.setTimeout(function(){delete u._isFirstMouseUp;u._mouseupToken&&(window.clearTimeout(u._mouseupToken),delete u._mouseupToken)},250),!0}}return!1},v.prototype.processMouseLeave=function(n){if(!n)return!1;this._isMouseDownReservedLocation=!1},v.prototype.isReservedKey=function(n,t){return n.keyCode===32&&!n.ctrlKey&&!n.shiftKey&&!n.altKey?!0:!1},v.prototype.processKeyUp=function(t,i){var r=i.sheet;if(!r)return!1;var u=r.getActiveRowIndex(),f=r.getActiveColumnIndex(),e=r._getSheetArea(r.activeRowViewportIndex,r.activeColViewportIndex),o=r.getValue(u,f,e),s=this._getNextState(o),h={row:u,col:f,newValue:s,autoFormat:!0},c=new n.UndoRedo.CellEditUndoAction(r,h);return r._doCommand(c),this._triggerButtonClicked(r,u,f,i.sheetArea),!0},v.prototype.getAutoFitWidth=function(t,i,r,u,f){var e=this,o=n.CellTypeContext.getAutoFitWidth(t,e._getDisplayText(t),r,u,f);return e._textAlign===0||e._textAlign===1?o=l(o,e._checkboxSize):o+=e._checkboxSize,o+5+2},v.prototype.getAutoFitHeight=function(t,i,r,u,f){var e=this,o=n.CellTypeContext.getAutoFitHeight(t,e._getDisplayText(t),r,u,f);return e._textAlign===0||e._textAlign===1?o+=e._checkboxSize:o=l(o,e._checkboxSize),o+5},v.prototype._cancelDefaultKeydown=function(t){t.keyCode!==32||t.ctrlKey||t.shiftKey||t.altKey||n.util.cancelDefault(t)},v.prototype.isImeAware=function(n){return!1},v.prototype._isDefaultValue=function(n,t){switch(n){case"caption":return t==="";case"textTrue":return t==="";case"textIndeterminate":return t==="";case"textFalse":return t==="";case"textAlign":return t===3;case"isThreeState":return t===!1;default:return!1}},v.prototype.toJSON=function(){var n=this,r={typeName:n.typeName,caption:n.caption(),textTrue:n.textTrue(),textIndeterminate:n.textIndeterminate(),textFalse:n.textFalse(),textAlign:n.textAlign(),isThreeState:n.isThreeState()},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},v.prototype.fromJSON=function(n,r){if(n){var u=this;n.caption&&u.caption(n.caption);n.textTrue&&u.textTrue(n.textTrue);n.textIndeterminate&&u.textIndeterminate(n.textIndeterminate);n.textFalse&&u.textFalse(n.textFalse);n.textAlign!==t&&n.textAlign!==i&&u.textAlign(n.textAlign);n.isThreeState!==t&&n.isThreeState!==i&&u.isThreeState(n.isThreeState)}},v}(n.TextCellType);n.CheckBoxCellType=ii,function(n){n[n.Normal=0]="Normal";n[n.Hover=1]="Hover";n[n.Pressed=2]="Pressed"}(n.ButtonState||(n.ButtonState={}));rr=n.ButtonState;ri=function(o){function l(){o.call(this);var n=this;n.allowOverflow=!1;n.typeName="6";n._marginTop=2;n._marginRight=2;n._marginBottom=2;n._marginLeft=2;n._text="";n._buttonBackColor=t;n._buttonBorderColor="#707070";n._buttonHoverColor="#A6F4FF";n._buttonPressedColor="#34B4E3";n._buttonState=0;n._eventNameSpace=".buttonCellType"}return __extends(l,o),l.prototype.paintValue=function(n,t,i,r,u,f,e,s){var p,a,w;if(n){var h=this,c=i+h._marginLeft,l=r+h._marginTop,v=u-h._marginLeft-h._marginRight,y=f-h._marginTop-h._marginBottom,b=c+v>i&&c<i+u&&l+y>r&&l<r+f;v-2>0&&y-2>0&&b&&(n.save(),(c<i||c+v>i+u||l<r||l+y>r+f)&&(n.rect(i,r,u,f),n.clip()),n.beginPath(),p=h._buttonBorderColor,p&&n.strokeStyle!==p&&(n.strokeStyle=p),n.strokeRect(c+.5,l+.5,v-1,y-1),h._buttonState===2?a=h._buttonPressedColor:h._buttonState===1?a=h._buttonHoverColor:(a=h._buttonBackColor,a||(w=n.createLinearGradient(i+u/2,r,i+u/2,r+f),w.addColorStop(.125,li),w.addColorStop(1,ai),a=w)),n.fillStyle!==a&&(n.fillStyle=a),n.fillRect(c+1,l+1,v-2,y-2),n.restore(),h._text&&o.prototype.paintValue.call(this,n,h._text,c,l,v,y,e,s))}},l.prototype.focus=function(n,t){n&&n.focus()},l.prototype._formatEditorValue=function(n,t,i,r){return i},l.prototype.createEditorElement=function(t){var f=r.createElement("div"),o=t&&t.sheet&&t.sheet.parent&&t.sheet.parent._host,l=n.util.getPreferredZIndex(o)+1e3,e=n.GC$(f),i,u;return e.css(s,h).css(tt,w).css(ot,w).css(rt,it).css(yt,a).css(ut,"2px #5292f7 solid").css(ft,a).css(pt,"1px 2px 5px rgba(0,0,0,0.4)").css(g,"content-box").css("user-select",a).css(st,l).attr(et,1).attr(d,"gcEditingInput"),i=n.GC$(r.createElement("div")),i.css(s,h).css(rt,it).css(ut,"1px "+this._buttonBorderColor+" solid"),e.append(i),u=n.GC$(r.createElement("span")),u.css(s,h).css(ct,"nowrap").css(c,"normal 11pt calibri").css("cursor","default"),i.append(u),f},l.prototype.setEditorValue=function(t,i,r){var u=t&&t.children[0]&&t.children[0].children[0];u&&n.GC$(u).html(this._text)},l.prototype.getEditorValue=function(n,i){return n?n._oldValue:t},l.prototype._triggerButtonClicked=function(n,t,i,r){var u=n.parent;u&&u.triggerButtonClicked({sheet:n,sheetName:n._name,row:t,col:i,sheetArea:r})},l.prototype._setButtonBackgroundColor=function(n,t){n.removeClass("gradientButton");t?n.css(f,t):n.addClass("gradientButton")},l.prototype.activateEditor=function(t,i,r,o){var c=t&&o&&o.sheet,s,l,h;if(c){var a=n.GC$(t),v=c._eventHandler._getCanvasPosition(),y=c.getBounds();a.css(e,v.top+y.y+r.y-2).css(u,v.left+y.x+r.x-2).css(f,i.backColor?i.backColor:"white");s=this;l=t.children[0];l&&(h=n.GC$(l),a.bind(dt,function(t){if(t.keyCode!==32||t.ctrlKey||t.shiftKey||t.altKey)t.keyCode!==8||t.ctrlKey||t.shiftKey||t.altKey||n.util.cancelDefault(t);else return s._isKeyDown||s._setButtonBackgroundColor(h,s._buttonPressedColor),s._isKeyDown=!0,n.util.cancelDefault(t),!1}),a.bind(gt,function(n){!s._isKeyDown||n.keyCode!==32||n.ctrlKey||n.shiftKey||n.altKey||(s._isKeyDown=!1,s._setButtonBackgroundColor(h,s._buttonBackColor),s._triggerButtonClicked(c,c._activeRowIndex,c._activeColIndex,o.sheetArea))}),h.bind(ni,function(n){n.button!==2&&(s._isMouseDown=!0,s._setButtonBackgroundColor(h,s._buttonPressedColor))}),h.bind(ti,function(n){n.button!==2&&(s._isMouseDown=!1,s._setButtonBackgroundColor(h,s._buttonHoverColor))}),h.bind(pi,function(n){s._triggerButtonClicked(c,c._activeRowIndex,c._activeColIndex,o.sheetArea)}),h.bind(yi,function(n){s._isMouseDown?s._setButtonBackgroundColor(h,s._buttonPressedColor):s._setButtonBackgroundColor(h,s._buttonHoverColor)}),h.bind(vi,function(n){var t=n.relatedTarget;t!==l&&t!==l.children[0]&&s._setButtonBackgroundColor(h,s._buttonBackColor)}))}},l.prototype.updateEditor=function(i,r,f,o){var h=i&&o&&o.sheet,y,s,l,d,v,a,g,p,rt,w,b;if(h){var ut=n.GC$(i),nt=h._render,tt=h._eventHandler._getCanvasPosition(),it=h.getBounds();ut.css(e,tt.top+it.y+f.y-2).css(u,tt.left+it.x+f.x-2).width(f.width).height(f.height);y=i.children[0];y&&(s=this,l=n.GC$(y),l.width(f.width-s._marginLeft-s._marginRight).height(f.height-s._marginTop-s._marginBottom).css("margin-top",s._marginTop-1).css("margin-left",s._marginLeft-1),s._setButtonBackgroundColor(l,s._buttonBackColor),d=y.children[0],d&&(v=n.GC$(d),r.foreColor&&v.css(k,r.foreColor),a=t,a=r.font?r.font:nt._getDefaultFont(),h._zoomFactor>1&&(a=nt._getZoomFont(a)),v.css(c,a),g=h._getStringWidth(s._text,a),p=h._getFontHeight(a),s._text&&(rt=s._text.split(/\r\n|\r|\n/),p*=rt.length),w=0,r.vAlign===1?w=l.height()/2-p/2:r.vAlign===2&&(w=l.height()-p),b=0,r.hAlign===1?b=l.width()/2-g/2:r.hAlign===2&&(b=l.width()-g),v.css(e,w).css(u,b),r.textDecoration&&s._setEditStatusTextDecoration(v,r.textDecoration)))}},l.prototype.marginTop=function(n){return arguments.length===0?this._marginTop:(this._marginTop=n,this)},l.prototype.marginRight=function(n){return arguments.length===0?this._marginRight:(this._marginRight=n,this)},l.prototype.marginBottom=function(n){return arguments.length===0?this._marginBottom:(this._marginBottom=n,this)},l.prototype.marginLeft=function(n){return arguments.length===0?this._marginLeft:(this._marginLeft=n,this)},l.prototype.text=function(n){return arguments.length===0?this._text:(this._text=n,this)},l.prototype.buttonBackColor=function(n){return arguments.length===0?this._buttonBackColor:(this._buttonBackColor=n,this)},l.prototype.buttonState=function(n){return arguments.length===0?this._buttonState:(this._buttonState=n,this)},l.prototype.getHitInfo=function(n,r,u,f,e){var s=this,o;if(!e)return t;if(o=e.sheetArea,(o===t||o===i||o===3)&&f){var c=f.x+s._marginLeft,l=f.x+f.width-s._marginRight,a=f.y+s._marginTop,v=f.y+f.height-s._marginBottom,h={x:n,y:r,row:e.row,col:e.col,cellRect:f,sheetArea:o,sheet:e.sheet};return c<=n&&n<=l&&a<=r&&r<=v&&(h.isReservedLocation=!0),h}return t},l.prototype.processMouseDown=function(n){if(!n)return!1;var t=this,i=n.sheet;return i&&n.isReservedLocation&&!t._isMouseDownReservedLocation?(t._isMouseDownReservedLocation=!0,t._buttonState=2,i.repaint(n.cellRect),!0):!1},l.prototype.processMouseUp=function(n){var i,r;if(!n)return!1;if(i=this,r=n.sheet,i._isMouseDownReservedLocation&&r&&n.isReservedLocation){i._buttonState=0;r.repaint(n.cellRect);i._isMouseDownReservedLocation=!1;var u=n.row,f=n.col,e=n.sheetArea,t=r._getModel(e).getNode(u,f,!0);if(t._isFirstMouseUp)delete t._isFirstMouseUp,t._mouseupToken&&(window.clearTimeout(t._mouseupToken),delete t._mouseupToken);else return i._triggerButtonClicked(r,u,f,n.sheetArea),t._isFirstMouseUp=!0,t._mouseupToken=window.setTimeout(function(){delete t._isFirstMouseUp;t._mouseupToken&&(window.clearTimeout(t._mouseupToken),delete t._mouseupToken)},250),!0}return!1},l.prototype.processMouseLeave=function(n){if(!n)return!1;var t=this,i=n.sheet;i&&t._isMouseDownReservedLocation&&(t._buttonState=0,i.repaint(n.cellRect),t._isMouseDownReservedLocation=!1)},l.prototype.processKeyDown=function(t,i){var r=i&&i.sheet,u;if(!r)return!1;if(u=this,!u._isKeyPressed){var e=r.getActiveRowIndex(),o=r.getActiveColumnIndex(),f=r.getCellRect(e,o,r.activeRowViewportIndex,r.activeColViewportIndex);return u._buttonState=2,r.repaint(f),r._bind(n.Events.SelectionChanged+u._eventNameSpace,function(t,i){r._unbind(n.Events.SelectionChanged+u._eventNameSpace);u._isKeyPressed=!1;u._buttonState=0;r.repaint(f)}),u._isKeyPressed=!0,!0}return!1},l.prototype.processKeyUp=function(t,i){var r=i.sheet,u;if(!r)return!1;if(u=this,u._isKeyPressed){var f=r.getActiveRowIndex(),e=r.getActiveColumnIndex(),o=r.getCellRect(f,e,r.activeRowViewportIndex,r.activeColViewportIndex);return u._buttonState=0,r.repaint(o),r._unbind(n.Events.SelectionChanged+u._eventNameSpace),u._triggerButtonClicked(r,f,e,i.sheetArea),u._isKeyPressed=!1,!0}return!1},l.prototype.isReservedKey=function(n,t){return n.keyCode===32&&!n.ctrlKey&&!n.shiftKey&&!n.altKey?!0:!1},l.prototype.getAutoFitWidth=function(t,i,r,u,f){var e=this,o=n.CellTypeContext.getAutoFitWidth(t,e._text,r,u,f);return o+e._marginLeft+e._marginRight},l.prototype.getAutoFitHeight=function(t,i,r,u,f){var e=this,o=n.CellTypeContext.getAutoFitHeight(t,e._text,r,u,f);return o+e._marginTop+e._marginBottom},l.prototype._cancelDefaultKeydown=function(t){t.keyCode!==32||t.ctrlKey||t.shiftKey||t.altKey||n.util.cancelDefault(t)},l.prototype.isImeAware=function(n){return!1},l.prototype._isDefaultValue=function(n,i){switch(n){case"marginTop":return i===2;case"marginRight":return i===2;case"marginBottom":return i===2;case"marginLeft":return i===2;case"text":return i==="";case"buttonBackColor":return i===t;default:return!1}},l.prototype.toJSON=function(){var n=this,r={typeName:n.typeName,marginTop:n.marginTop(),marginRight:n.marginRight(),marginBottom:n.marginBottom(),marginLeft:n.marginLeft(),text:n.text(),buttonBackColor:n.buttonBackColor()},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},l.prototype.fromJSON=function(n,r){if(n){var u=this;n.marginTop!==t&&n.marginTop!==i&&u.marginTop(n.marginTop);n.marginRight!==t&&n.marginRight!==i&&u.marginRight(n.marginRight);n.marginBottom!==t&&n.marginBottom!==i&&u.marginBottom(n.marginBottom);n.marginLeft!==t&&n.marginLeft!==i&&u.marginLeft(n.marginLeft);n.text&&u.text(n.text);n.buttonBackColor&&u.buttonBackColor(n.buttonBackColor)}},l}(n.TextCellType);n.ButtonCellType=ri;ui=function(o){function v(){o.call(this);var n=this;n.allowOverflow=!1;n.typeName="8";n._link="";n._linkColor="#0066cc";n._visitedLinkColor="#3399ff";n._text="";n._linkToolTip="";n._id=v._getUniqueId();n._target=0}return __extends(v,o),v.prototype.paintValue=function(t,i,r,f,e,o,s,h){var v=this,p,tt,it,k,d,pt,g,et,c,dt,nt;if(t&&(p=v.getText(i,h),p)){p=p.replace(/\s+/g," ");var ot=!1,st=h.sheet._getModel().getNode(h.row,h.col),ct=st&&st.hyperlinkInfo;ct&&(v._id===ct.id?ot=ct.visited:delete st.hyperlinkInfo);t.save();t.beginPath();tt=ot?v._visitedLinkColor:v._linkColor;tt&&t.fillStyle!==tt&&(t.fillStyle=tt);it=s.font;it&&t.font!==it&&(t.font=it);var rt=s.hAlign,lt=s.vAlign,w=t.measureText(p).width,y=h.lineHeight,ut=v._calcPosition(new n.Rect(r,f,e,o),w,y,rt,lt),b={x:r,y:f,width:e,height:o};(ut.x+w>b.width||ut.y+y>b.height)&&(t.rect(b.x,b.y,b.width,b.height),t.clip(),t.beginPath());k=2;d=u;rt===1?w<e-3&&(k=e/2,d=kt):rt===2&&w<e-3&&(k=e-2,d=at);t.textAlign!==d&&(t.textAlign=d);var a=n.util.browser.mozilla?5:2,wt=vt,ft=h.fontInfo.fontSize,bt=ft>8?ht((ft-8)/5+2):1,yt=y/2-ft/2+bt-1;a+=y-yt;lt===1?y<o&&(a=n.util.browser.mozilla?o/2+1:n.util.browser.msie?o/2+.5:o/2,ht(a)!==a&&(a=a+.5),a+=y/2-yt):lt===2&&(a=o-2.5-yt);t.textBaseline!==wt&&(t.textBaseline=wt);t.fillText(p,r+k,f+a);pt=s.textDecoration;pt&&v._renderTextDecoration(t,pt,r+k,f+a,w,ft,bt);g=r+ut.x;et=g+w;rt===2||(g=g+1,et=et+1);c=f+ut.y+y;s.vAlign===2&&(c=c-.5);c=c-l(0,ci(y/9)-1);ht(c)===c&&(c=c+.5);dt=c;t.beginPath();nt=v._linkColor;ot&&(nt=v._visitedLinkColor);nt&&t.strokeStyle!==nt&&(t.strokeStyle=nt);t.lineWidth=1;t.moveTo(g,c);t.lineTo(et,dt);t.stroke();t.restore()}},v.prototype.getText=function(n,t){return this._text||n},v.prototype.createEditorElement=function(t){var u=r.createElement("div"),o=t&&t.sheet&&t.sheet.parent&&t.sheet.parent._host,c=n.util.getPreferredZIndex(o)+1e3,f=n.GC$(u),i,e;f.css(tt,w).css(ot,w).css(ut,a).css(s,h).css(rt,it).css(g,"content-box").css(ct,"nowrap").css(st,c).attr(d,"gcEditor").attr(et,1).css(ft,a);switch(this._target){case 0:i="_blank";break;case 1:i="_self";break;case 2:i="_parent";break;case 3:i="_top";break}return e=r.createElement("a"),n.GC$(e).css(tt,w).css(ft,a).css("display","block").attr("target",i).appendTo(f),u},v.prototype._triggerButtonClicked=function(n,t,i,r){var u=n.parent;u&&(n._startEditByKeydown||u.triggerButtonClicked({sheet:n,sheetName:n._name,row:t,col:i,sheetArea:r}))},v.prototype.activateEditor=function(i,o,c,l){var v,b,nt,y,ut;if(i&&c){var a=l&&l.sheet,p=n.GC$(i),ft=o&&o.backColor||"white";if(p.css(f,ft),a){var et=a._eventHandler._getCanvasPosition(),ot=a.getBounds(),st=et.top+ot.y+c.y,ht=et.left+ot.x+c.x;p.css(e,st).css(u,ht)}p.bind("keydown",function(t){t.keyCode!==8||t.ctrlKey||t.shiftKey||t.altKey||n.util.cancelDefault(t)});v=this;b=i.firstChild;b&&(nt=n.GC$(b),nt.bind("click",function(){if(nt.css(k,v._visitedLinkColor),a){var n=a._activeRowIndex,t=a._activeColIndex,i=a._getModel().getNode(n,t,!0);i.hyperlinkInfo={id:v._id,visited:!0};v._triggerButtonClicked(a,n,t,l.sheetArea)}}));y=r.createElement("div");n.GC$(y).css(tt,w).css(s,h).css(rt,it).css(g,"content-box").attr(d,"gcEditingInput").css(wi,"1px").css(bi,"solid").css(f,ft);ut=a&&a._getHost();ut&&ut.insertBefore(y,t);v._clip=y;v._actived=!0}},v.prototype.deactivateEditor=function(t,i){var r=i&&i.sheet,u,f;this._clip&&(u=r&&r._getHost(),u&&u.removeChild(this._clip));t&&(n.GC$(t).unbind("keydown"),f=t.firstChild,f&&n.GC$(f).unbind("click"));o.prototype.deactivateEditor.call(this,t,i);this._actived=!1;r&&r.repaint()},v.prototype.updateEditor=function(i,r,f,o){var l,w,b,y,a;if(i&&f){var s=this,h=o&&o.sheet,p=h&&h._render,ut=i,v=n.GC$(ut),d=i.firstChild;if(d&&(l=n.GC$(d),s._link&&l.attr("href",s._link),w=s._text||s._link,w&&l.text(w),l.attr("title",s._linkToolTip),b=!1,y=h?h._getModel().getNode(h._activeRowIndex,h._activeColIndex):t,y&&y.hyperlinkInfo&&(s._id===y.hyperlinkInfo.id?b=y.hyperlinkInfo.visited:delete y.hyperlinkInfo),b?l.css(k,s._visitedLinkColor):l.css(k,s._linkColor),a=r&&r.font?r.font:t,!a&&p&&(a=p._getDefaultFont()),p&&h._zoomFactor>1&&(a=p._getZoomFont(a)),a&&l.css(c,a)),r&&h){v.css(di,f.width-2);v.css(gi,f.height-2);var g=h._eventHandler._getCanvasPosition(),nt=h.getBounds(),tt=g.top+nt.y+f.y,it=g.left+nt.x+f.x,rt=s._calcPosition(f,v.width(),v.height(),r.hAlign,r.vAlign);v.css(e,tt+rt.y).css(u,it+rt.x);s._clip&&n.GC$(s._clip).css(e,tt).css(u,it).height(f.height-3).width(f.width-3).css(ki,r.backColor||"white");r.textDecoration&&s._setEditStatusTextDecoration(v,r.textDecoration)}}},v.prototype.getEditorValue=function(n,t){return this._link},v.prototype.setEditorValue=function(n,t,i){this._link=t},v.prototype._formatEditorValue=function(n,t,i,r){return i},v.prototype.getHitInfo=function(n,r,u,f,e){if(e){var o=e.sheetArea;if((o===t||o===i||o===3)&&u&&f)return{x:n,y:r,row:e.row,col:e.col,cellStyle:u,cellRect:f,sheetArea:o,isFocusAware:!0,sheet:e.sheet}}return t},v.prototype.processMouseDown=function(n){if(n){var t=n.sheet;t&&!t.isEditing()&&(n.isReservedLocation=this._isHitHyperlink(n,t)?!0:!1,n.isReservedLocation&&(this._isMouseDownLink=!0))}},v.prototype.processMouseUp=function(n){var t,i,r,u;if(n&&(t=n.sheet,t&&!t.isEditing())){if(i=this,n.isReservedLocation=i._isHitHyperlink(n,t)?!0:!1,n.isReservedLocation&&i._isMouseDownLink){if(r=t.getValue(n.row,n.col,n.sheetArea),r)switch(i._target){case 0:window.open(r,"_blank");break;case 1:window.open(r,"_self");break;case 2:window.open(r,"_parent");break;case 3:window.open(r,"_top");break}u=t._getModel(n.sheetArea).getNode(n.row,n.col,!0);u.hyperlinkInfo={id:i._id,visited:!0};t.repaint(n.cellRect);i._triggerButtonClicked(t,n.row,n.col,n.sheetArea)}i._isMouseDownLink=!1}},v.prototype.processMouseMove=function(n){var t,r,i;n&&(t=n.sheet,t)&&(t.isEditing()&&t.getActiveRowIndex()===n.row&&t.getActiveColumnIndex()===n.col||(n.isReservedLocation=this._isHitHyperlink(n,t)?!0:!1,n.isReservedLocation?(this._showLinkToolTip(t,n),i=t._getCanvas(),i&&(r=t.getValue(n.row,n.col,n.sheetArea),i.style.cursor=r?"pointer":"text")):(this._hideLinkToolTip(t),i=t._getCanvas(),i&&(i.style.cursor="default"))))},v.prototype.processMouseLeave=function(n){var t,i;this._isMouseDownLink=!1;t=n.sheet;this._hideLinkToolTip(t);t&&(i=t._getCanvas(),i&&(i.style.cursor="default"))},v.prototype._isHitHyperlink=function(n,t){var f=n.cellStyle,i=n.cellRect,o=t._render,s=n.x,h=n.y,r=this._text||this._link,e;if(r||(r=t.getValue(n.row,n.col,n.sheetArea)),!r)return!1;r=r.replace(/\s+/g," ");e=f&&f.font?f.font:o._getDefaultFont();t._zoomFactor>1&&(e=o._getZoomFont(e));var u=this._getLinkRect(r,f.hAlign,f.vAlign,e,i,t),c=i.x+u.x,l=bt(i.x+u.x+u.width,i.x+i.width),a=i.y+u.y,v=bt(i.y+u.y+u.height,i.y+i.height);return c<=s&&s<l&&a<=h&&h<v?!0:!1},v.prototype._showLinkToolTip=function(i,r){var o,f,s;if(this._linkToolTip){o=this._getLinkToolTipElement();f=n.GC$(o);f.text(this._linkToolTip);var h=i._eventHandler._getCanvasPosition(),c=h.left+r.x,l=h.top+r.y+20;f.parent().length()===0&&(s=i&&i._getHost(),s&&s.insertBefore(o,t),f.css(e,l).css(u,c))}},v.prototype._hideLinkToolTip=function(n){if(this._linkToolTipElement){var i=n&&n._getHost();i&&this._linkToolTipElement.parentElement===i&&i.removeChild(this._linkToolTipElement);this._linkToolTipElement=t}},v.prototype._getLinkToolTipElement=function(){if(!this._linkToolTipElement){var t=r.createElement("div");t.className="gcHyperLinkCellTypeToolTip";n.GC$(t).css(s,h).css(tt,w).css(ot,2).css(ut,"1px #c0c0c0 solid").css(pt,"1px 2px 5px rgba(0,0,0,0.4)").css(g,"content-box").css(f,"#ffffff").css(c,"9pt Arial");this._linkToolTipElement=t}return this._linkToolTipElement},v.prototype._getLinkRect=function(t,i,r,u,f,e){var l=v._getEditorElement(e),a=n.GC$(l),y=l.firstChild,o,h;y&&(o=n.GC$(y),o.text(t?t:""),u&&o.css(c,u));var p=a.width(),w=a.height(),s={x:0,y:0,width:p,height:w};return f&&(h=this._calcPosition(f,p,w,i,r),s.x=h.x,s.y=h.y),s},v.prototype._calcPosition=function(n,t,i,r,u){var f=1,e=1,o=n.width-3,s=n.height-3;return r===1?f=f+l(0,(o-t)/2):r===2&&(f=f+l(0,o-t)),u===1?e=e+l(0,(s-i)/2):u===2&&(e=e+l(0,s-i)),{x:f,y:e}},v.prototype.isReservedKey=function(n,t){return n.keyCode===32&&!n.ctrlKey&&!n.shiftKey&&!n.altKey?!0:!1},v.prototype.processKeyUp=function(n,t){var i=t.sheet,o;if(!i)return!1;var u=i.getActiveRowIndex(),f=i.getActiveColumnIndex(),e=i._getSheetArea(i.activeRowViewportIndex,i.activeColViewportIndex),r=i.getValue(u,f,e),s=i.getCellRect(u,f,i.activeRowViewportIndex,i.activeColViewportIndex);if(r){r=r.toString();switch(this._target){case 0:window.open(r,"_blank");break;case 1:window.open(r,"_self");break;case 2:window.open(r,"_parent");break;case 3:window.open(r,"_top");break}}return o=i._getModel(e).getNode(u,f,!0),o.hyperlinkInfo={id:this._id,visited:!0},i.repaint(s),this._triggerButtonClicked(i,u,f,t.sheetArea),!0},v.prototype.linkColor=function(n){return arguments.length===0?this._linkColor:(this._linkColor=n,this)},v.prototype.visitedLinkColor=function(n){return arguments.length===0?this._visitedLinkColor:(this._visitedLinkColor=n,this)},v.prototype.text=function(n){return arguments.length===0?this._text:(this._text=n,this)},v.prototype.linkToolTip=function(n){return arguments.length===0?this._linkToolTip:(this._linkToolTip=n,this)},v.prototype.target=function(n){return arguments.length===0?this._target:(this._target=n,this)},v.prototype.getAutoFitWidth=function(n,t,i,r,u){var f=u&&u.sheet;if(f){var e=this,o=f._render,s=e._text||n,h=i&&i.font?i.font:o._getZoomFont(o._getDefaultFont()),c=e._getLinkRect(s,i.hAlign,i.vAlign,h,null,f);return c.width}else return 0},v.prototype.getAutoFitHeight=function(n,t,i,r,u){var f=u&&u.sheet,s;if(f){var h=this._text||n,o=f._render,e=i&&i.font?i.font:o._getDefaultFont();return r>1&&(e=o._getZoomFont(e)),s=this._getLinkRect(h,i.hAlign,i.vAlign,e,null,f),s.height}else return 0},v.prototype.isImeAware=function(n){return!1},v.prototype._isDefaultValue=function(n,t){switch(n){case"linkColor":return t==="#0066cc";case"visitedLinkColor":return t==="#3399ff";case"text":return t==="";case"linkToolTip":return t==="";case"target":return t===0;default:return!1}},v.prototype.toJSON=function(){var n=this,r={typeName:n.typeName,linkColor:n._linkColor,visitedLinkColor:n._visitedLinkColor,text:n._text,linkToolTip:n._linkToolTip,target:n._target},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},v.prototype.fromJSON=function(n,r){if(n){var u=this;n.linkColor!==i&&n.linkColor!==t&&(u._linkColor=n.linkColor);n.visitedLinkColor!==i&&n.visitedLinkColor!==t&&(u._visitedLinkColor=n.visitedLinkColor);n.text!==i&&n.text!==t&&(u._text=n.text);n.linkToolTip!==i&&n.linkToolTip!==t&&(u._linkToolTip=n.linkToolTip);n.target!==i&&n.target!==t&&(u._target=n.target)}},v._getUniqueId=function(){var n=this;return(n._id===i||n._id===t)&&(n._id=0),"id_"+n._id++},v._getEditorElement=function(n){var f=this,i,u;return f._editorElement||(i=v.prototype.createEditorElement({sheet:n}),u=i.style,r.body.insertBefore(i,t),u.visibility=it,u.top="-10000px",u.left="-10000px",i.className="gcHyperLinkCellTypeEditor",f._editorElement=i),f._editorElement},v}(n.TextCellType);n.HyperLinkCellType=ui;fi=function(t){function r(){t.call(this);this.typeName=""}return __extends(r,t),r.prototype.paint=function(t,r,u,f,e,o,s,h){var l,v,a,p,y,w,c;t&&(n.CellTypeContext.paintBackground(t,u,f,e,o,s.backColor,s.backgroundImage,s.backgroundImageLayout,h.imageLoader),l=h.sheetArea,(l===2||l===1)&&(v=0,h.visualState!==i&&(v=h.visualState),a="columnHeader",l===2&&(a="rowHeader"),p=this.getThemeStyle(h.visualState,"gc-"+a+"-"+n.VisualState[v].toLowerCase()),n.HeaderCellType.prototype._paintGridline(t,u,f,e,o,s,a,p,l)),y=n.CellTypeContext.paintConditionalFormats(t,r,u,f,e,o,s,h),h.showBarIconOnly=y,n.CellTypeContext.paintSparkline(t,u,f,e,o,h.sparkline),w=n.CellTypeContext.paintSparklineEx(t,r,u,f,e,o,h.sheet),h.cellOverflowLayout||y||w||(c=new n.Rect(u,f,e,o),n.CellTypeContext.adjustRectForIconSet(s.hAlign,h.sheet,h.row,h.col,h.sheetArea,c),this.paintValue(t,r,c.x,c.y,c.width,c.height,s,h)))},r.prototype.createEditorElement=function(n){},r.prototype.getEditorValue=function(n,t){},r.prototype.setEditorValue=function(n,t,i){},r.prototype.activateEditor=function(t,i,r,u){var f=t&&u&&u.sheet,e;if(f){e=f._eventHandler;this.isImeAware(u)&&e._resetFocusHolder();var o=e._getCanvasPosition(),s=f.getBounds(),h=o.top+s.y+r.y-2,c=o.left+s.x+r.x-2;n.GC$(t).css("top",h).css("left",c)}},r.prototype.deactivateEditor=function(n,t){var i,r;n&&(i=n._editingLocator,i&&(r=t&&t.sheet&&t.sheet._getHost(),r&&r.removeChild(i)))},r.prototype.updateEditor=function(t,i,r,u){t&&n.GC$(t).width(r.width).height(r.height)},r.prototype.updateImeMode=function(n,i,r){t.prototype.updateImeMode.call(this,n,i,r)},r.prototype.getHitInfo=function(n,t,i,r,u){return null},r.prototype.processMouseDown=function(n){},r.prototype.processMouseMove=function(n){},r.prototype.processMouseUp=function(n){},r.prototype.processMouseEnter=function(n){},r.prototype.processMouseLeave=function(n){},r.prototype.isReservedKey=function(n,t){return!1},r.prototype.processKeyDown=function(n,t){return!1},r.prototype.processKeyUp=function(n,t){return!1},r.prototype.isEditingValueChanged=function(n,t,i){return n!==t},r.prototype.getAutoFitWidth=function(t,i,r,u,f){return n.CellTypeContext.getAutoFitWidth(t,i,r,u,f)},r.prototype.getAutoFitHeight=function(t,i,r,u,f){return n.CellTypeContext.getAutoFitHeight(t,i,r,u,f)},r.prototype.isImeAware=function(n){return!1},r.prototype.toJSON=function(){var t={};for(var n in this)this.hasOwnProperty(n)&&(t[n]=this[n]);return t},r.prototype.fromJSON=function(n){if(n)for(var t in n)n[t]!==i&&(this[t]=n[t])},r}(n.BaseCellType);n.CustomCellType=fi;var nt=17,ei=20,p=1,lt=4,oi=2,si=lt,ur=function(r){function u(){r.call(this);var n=this;n.typeName="7";n._editorValueType=0;n._items=[];n._itemHeight=22;n._maxDropDownItems=ei;n._editable=!1;n._autoFormatValue=!1;n._hasInPlaceEditor=!1}return __extends(u,r),u.prototype.editorValueType=function(n){return arguments.length===0?this._editorValueType:(this._editorValueType=n,this)},u.prototype.items=function(n){return arguments.length===0?this._items:(this._items=n,this)},u.prototype.itemHeight=function(n){return arguments.length===0?this._itemHeight:(this._itemHeight=n,this)},u.prototype.maxDropDownItems=function(n){return arguments.length===0?this._maxDropDownItems:(this._maxDropDownItems=n,this)},u.prototype.editable=function(n){return arguments.length===0?this._editable:(this._editable=n,this)},u.prototype.isReservedKey=function(n,t){return this._hasInPlaceEditor?!0:!1},u.prototype.paint=function(t,i,r,u,f,e,o,s){var c,l,h;t&&(n.CellTypeContext.paintBackground(t,r,u,f,e,o.backColor,o.backgroundImage,o.backgroundImageLayout,s.imageLoader),c=n.CellTypeContext.paintConditionalFormats(t,i,r,u,f,e,o,s),s.showBarIconOnly=c,n.CellTypeContext.paintSparkline(t,r,u,f,e,s.sparkline),l=n.CellTypeContext.paintSparklineEx(t,i,r,u,f,e,s.sheet),s.cellOverflowLayout||c||l||(h=new n.Rect(r,u,f,e),n.CellTypeContext.adjustRectForIconSet(o.hAlign,s.sheet,s.row,s.col,s.sheetArea,h),this.paintValue(t,i,h.x,h.y,h.width,h.height,o,s)))},u.prototype.paintValue=function(n,t,i,u,f,e,o,s){var h=nt,c=l(0,f-h-1);o.hAlign===3&&(o.hAlign=0);o.wordWrap&&(o.wordWrap=!1);c>0&&e>0&&r.prototype.paintValue.call(this,n,this.getText(t,s),i,u,c,e,o,s);n.save();(h>f||h>e)&&(n.rect(i,u,f,e),n.clip());n.beginPath();n.beginPath();n.lineWidth=2;n.fillStyle="#000000";n.moveTo(i+f-h+4,u+(e-2)/2-2.5);n.lineTo(i+f-h+7,u+(e-2)/2+3.5);n.lineTo(i+f-h+10,u+(e-2)/2-2.5);n.fill();n.restore()},u.prototype.getText=function(n,t){return n},u.prototype.createEditorElement=function(t){var f=t&&t.sheet&&t.sheet.parent&&t.sheet.parent._host,e=n.util.getPreferredZIndex(f)+1e3,u=t.sheet.defaults,i=new fr(0,0,u.colWidth,u.rowHeight,e),r;return i.editorValueType(this._editorValueType),i.items(this._items),i.itemHeight(this._itemHeight),i.maxDropDownItems(this._maxDropDownItems),i.editable(this._editable),r=i.getComboBox(),Object.defineProperty(r,"comboBox",{value:i,writable:!1}),r},u.prototype.getEditorValue=function(n,t){var i=n.comboBox;return i&&(this._autoFormatValue=!i._isEditorValueInItems),i&&i.editorValue()},u.prototype.setEditorValue=function(n,t,i){var r=n.comboBox;r&&r.editorValue(t)},u.prototype.focus=function(n,t){if(n){var i=n.comboBox;i&&i.focus()}},u.prototype.selectAll=function(n,t){if(n){var i=n.comboBox;i&&i.selectAll()}},u.prototype.activateEditor=function(t,i,r,u){var e=u.sheet,l=u.row,a=u.col,f=t.comboBox,s,h,c;f&&(f.editorValueType(this._editorValueType),f.items(this._items),f.itemHeight(this._itemHeight),f.maxDropDownItems(this._maxDropDownItems),f.editable(this._editable),s=f._dropDownList,s.bind(o,function(t,i){var u=e._getKeyAction(i.keyCode,!1,!1,!1,!1),r;u?(r=u.action,(r===n.SpreadActions.navigationLeft||r===n.SpreadActions.navigationRight)&&(e._editorStatus=1),r.apply(e)):i.isMouse===!0&&f._isDisplayMode===!0&&e.endEdit()}),h=f._comboBoxEditor,h.bind(o,function(n,t){t.isMouse===!0&&e.endEdit()}),c=f._dropDownButton,c.bind(o,function(n,t){t.isMouse===!0&&e.endEdit()}));this._hasInPlaceEditor=!0},u.prototype.deactivateEditor=function(n,t){var i,r,u;if(n&&(i=n.comboBox,i)){var f=i._dropDownList,e=i._comboBoxEditor,s=i._dropDownButton;f.unbind(o);e.unbind(o);s.unbind(o);i.closeDropDownList();i._isDisplayMode=!1;r=n._editingLocator;r&&(u=t&&t.sheet&&t.sheet._getHost(),u&&u.removeChild(r))}this._hasInPlaceEditor=!1},u.prototype.updateEditor=function(n,t,i,r){var f=n&&r&&r.sheet,u,e,o,s;f&&(u=n.comboBox,t&&u&&(e=f._render,u.updateStyle(t.backColor,t.foreColor,e._getZoomFont(t.font||e._getDefaultFont()))),i&&u&&(o=f._eventHandler._getCanvasPosition(),s=f.getBounds(),u.updateLocationAndSize(o.left+s.x+i.x-1,o.top+s.y+i.y-1,i.width+1,i.height+1)))},u.prototype.updateImeMode=function(n,t,i){if(this.isImeAware()){var r=n.comboBox,u=r&&r._comboBoxEditor;u&&u.updateImeMode(this._getImeModeString(t))}},u.prototype.format=function(n,u,f,e){var a,h,c,o;if(n===t||n===i)return"";var v=this,l=v._editorValueType,s=v._items;if(s&&(a=s.length,l!==0))if(l===1)h=parseInt(n),0<=h&&h<a&&(o=s[h],o!==i&&o!==t&&(n=o.hasOwnProperty("text")?o.text:o));else if(l===2)for(c=0;c<a;c++)if(o=s[c],o&&o.hasOwnProperty("value")&&o.value===n){n=o.text;break}return r.prototype.format.call(this,n,u,f)},u.prototype.parse=function(n,t,i){var c=this,s=c._editorValueType,o=c._items,e=r.prototype.parse.call(this,n,t),h,f,u;if(o)if(h=o.length,s===0)return e;else if(s===1){for(f=0;f<h;f++)if(u=o[f],u&&u.hasOwnProperty("text")&&u.text===e||u===e)return f}else if(s===2)for(f=0;f<h;f++)if(u=o[f],u&&u.hasOwnProperty("text")&&u.text===e)return u.value;return e},u.prototype.getHitInfo=function(n,r,u,f,e){var o,c,s,h;return e?(o=e.sheetArea,c=e.sheet,(o===t||o===i||o===3)&&f)?(s=f.x+f.width,h={x:n,y:r,row:e.row,col:e.col,cellStyle:u,cellRect:f,sheetArea:o,sheet:c},s-nt<=n&&n<s&&(h.isReservedLocation=!0),h):t:t},u.prototype.processMouseDown=function(r){var f=r.sheet,e=r.sheetArea,o,u,s;(e===t||e===i||e===3)&&r.isReservedLocation&&f&&(f.startEdit(),o=f._editor,u=o&&o.comboBox,u&&(s=n.util.browser&&n.util.browser.mozilla,s&&(u._dropDownButton._showTime=(new Date).valueOf()),u.showDropDownList(),u._isDisplayMode=!0))},u.prototype.getAutoFitWidth=function(t,i,r,u,f){var e=n.CellTypeContext.getAutoFitWidth(t,i,r,u,f);return e+nt},u.prototype.getAutoFitHeight=function(t,i,r,u,f){return n.CellTypeContext.getAutoFitHeight(t,i,r,u,f)},u.prototype.isImeAware=function(n){return!0},u.prototype._isDefaultValue=function(n,t){switch(n){case"editorValueType":return t===0;case"items":return t===[];case"itemHeight":return t===22;case"editable":return t===!1;default:return!1}},u.prototype.toJSON=function(){var n=this,r={typeName:n.typeName,editorValueType:n.editorValueType(),items:n.items(),itemHeight:n.itemHeight(),maxDropDownItems:n.maxDropDownItems(),editable:n.editable()},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},u.prototype.fromJSON=function(n,r){n&&(n.editorValueType!==t&&n.editorValueType!==i&&this.editorValueType(n.editorValueType),n.items!==t&&n.items!==i&&this.items(n.items),n.itemHeight!==t&&n.itemHeight!==i&&this.itemHeight(n.itemHeight),n.maxDropDownItems!==t&&n.maxDropDownItems!==i&&this.maxDropDownItems(n.maxDropDownItems),n.editable!==t&&n.editable!==i&&this.editable(n.editable))},u}(n.BaseCellType);n.ComboBoxCellType=ur;var hi="click",wt="keydown",pr="keyup",o="EndEdit"+v,fr=function(){function f(t,i,f,o,s){var h=this,a,c;h._DOMObject=r.createElement("div");h._DOMObject.className="gcComboBox";h._bindEvent();h._setDefaultCSS(s);n.GC$(h._DOMObject).css(u,t).css(e,i).css(b,f).css(y,o);a=l(0,f-nt);h._comboBoxEditor=new er(this,0,0,a,o);h._comboBoxEditor.appendTo(this._DOMObject);h._dropDownButton=new or(this,a,0,f-a,o);h._dropDownButton.appendTo(this._DOMObject);c=new hr(0,o-2*p,f-2*p,o,s);c.bind(c.CloseDropDown,function(){h._comboBoxEditor.focus()});c.bind(c.ShowDropDown,function(){h._comboBoxEditor.focus()});c.bind(c.SelectedIndexChanged,function(n){h.onSelectedIndexChanged(n)});c.appendTo(this._DOMObject);h._dropDownList=c;h._editorValueType=0;h._items=[]}return f.prototype._bindEvent=function(){var t=this,i=n.GC$(this._DOMObject);i.bind(wt,function(n){t._onKeydown.call(t,n)})},f.prototype._onKeydown=function(n){this._dropDownList&&this._dropDownList._onKeydown(n)},f.prototype._setDefaultCSS=function(t){n.GC$(this._DOMObject).css(s,h).css(st,t||0).attr(d,"gcComboBox")},f.prototype.getComboBox=function(){return this._DOMObject},f.prototype.updateLocationAndSize=function(t,i,r,f){var o,s;n.GC$(this._DOMObject).css(u,t).css(e,i).css(b,r).css(y,f);o=l(0,r-nt);this._comboBoxEditor.updateLocationAndSize(0,0,o,f);this._dropDownButton.updateLocationAndSize(o,0,r-o,f);s=this._dropDownList;s.updateLocation(0,f-2*p);s.width(r-2*p);s._updateItemWidth()},f.prototype.updateStyle=function(n,t,i){this._comboBoxEditor.updateStyle(n,t,i);this._dropDownButton.updateStyle(n,t,i);this._dropDownList.updateStyle(n,t,i)},f.prototype.isDropDownListShown=function(){return this._dropDownList.isShown()},f.prototype.showDropDownList=function(){this._dropDownList.show()},f.prototype.closeDropDownList=function(){this._dropDownList.close()},f.prototype.toggleDropDownListShow=function(){this._dropDownList.toggleShow()},f.prototype.items=function(n){return arguments.length===0?this._items:(this._items=n,this._dropDownList.items(n),this)},f.prototype.itemHeight=function(n){return arguments.length===0?this._dropDownList.itemHeight():(this._dropDownList.itemHeight(n),this)},f.prototype.maxDropDownItems=function(n){return arguments.length===0?this._dropDownList.itemCountPerPage():(this._dropDownList.itemCountPerPage(n),this)},f.prototype.editable=function(n){return arguments.length===0?this._comboBoxEditor.editable():(this._comboBoxEditor.editable(n),this)},f.prototype.editorValueType=function(n){return arguments.length===0?this._editorValueType:(this._editorValueType=n,this)},f.prototype.editorValue=function(n){return arguments.length===0?this._editorValue:(n!==this._editorValue&&(this._editorValue=n,this._updateEditorValue(n)),this)},f.prototype._updateEditorValue=function(n){var t=this,i=t.valueToText(n);t._comboBoxEditor.text(i);t._dropDownList.selectByText(i)},f.prototype.valueToText=function(n){var u,f=this,s=f._items,h=s.length,c=f._editorValueType,e,o,r;f._isEditorValueInItems=!0;switch(c){case 1:r=s[n];u=r&&r.hasOwnProperty("text")?r.text:r;u===i&&(u=n,f._isEditorValueInItems=!1);break;case 0:for(u=n,e=0;e<h;e++)if(r=s[e],r&&r.hasOwnProperty("text")&&r.text===n||r===n)break;e>=h&&(f._isEditorValueInItems=!1);break;case 2:for(o=0;o<h;o++)if(r=s[o],r&&r.hasOwnProperty("value")&&r.value===n){u=r.text;break}o>=h&&(u=n,f._isEditorValueInItems=!1);break;default:break}return(n===t||n===i)&&(u=""),u},f.prototype.textToValue=function(n){var s=this,e=s._items,h=e.length,o=s._editorValueType,u=n,r,f,t;if(o!==0)if(o===1)for(r=0;r<h;r++)t=e[r],(t&&t.hasOwnProperty("text")&&t.text===n||t===n)&&(u=r);else if(o===2)for(f=0;f<h;f++)t=e[f],t&&t.hasOwnProperty("text")&&t.text===n?u=t.value:t===n&&(u=i);return u},f.prototype.onSelectedIndexChanged=function(n){var r=this,f=r._dropDownList,e=f.selectedIndex(),u=f.getSelectedValue(e,r._items,r._editorValueType);u!==t&&u!==i&&r.editorValue(u)},f.prototype.autoSelectByText=function(n){var t,r,u,i;if(n){for(r=this._items,u=r.length,t=0;t<u;t++)if(i=r[t],i.hasOwnProperty("text")&&(i=i.text),i.toString().substr(0,n.length)===n)break;t>=u&&(t=-1)}else t=-1;this._dropDownList.setSelectedIndexInternal(t)},f.prototype.focus=function(){this._comboBoxEditor.focus()},f.prototype.selectAll=function(){this._comboBoxEditor.selectAll()},f}(),er=function(){function t(n,t,i,u,f){var e=this;e._comboBox=n;e._editable=!1;e._divObject=r.createElement("div");e._textareaObject=r.createElement("textarea");e._DOMObject=e._divObject;e._DOMObject.className="gcComboBoxEditor";e._setDefaultCSS();e._bindEvent();e.updateLocationAndSize(t,i,u,f)}return t.prototype._setDefaultCSS=function(){var t=p+"px solid black";n.GC$(this._DOMObject).css(tt,0).css(rt,"hidden").css(yt,a).css(s,h).css("border-bottom",t).css("border-left",t).css("border-top",t).css(ot,oi+"px 0px 0px "+lt+"px").css(ft,a).css(f,"white").css(ct,"nowrap").css(g,"content-box").attr(d,"gcComboBoxEditor").attr(et,-1)},t.prototype._bindEvent=function(){var t=this;n.GC$(this._textareaObject).bind("keyup",function(n){var i=t._DOMObject.value,r;t._text=i;r=t._comboBox.textToValue(i);t._comboBox.editorValue(r);t._comboBox.autoSelectByText(i);t._removeTip()}).bind("mouseover",function(){t._updateTip()}).bind("mouseout",function(){t._removeTip()});n.GC$(this._divObject).bind("click",function(n){t._comboBox._isDisplayMode?t._trigger(o,{isMouse:!0}):t._comboBox.toggleDropDownListShow()}).bind("mouseover",function(){t._updateTip()}).bind("mouseout",function(){t._removeTip()})},t.prototype._removeTip=function(){n.GC$(this._DOMObject).removeAttr("title")},t.prototype._updateTip=function(){if(this._comboBox&&this._comboBox._dropDownList){var i=this._comboBox._dropDownList.measureText(this._text),t=n.GC$(this._DOMObject),r=t.width();i>r+lt?t.attr("title",this._text):t.removeAttr("title")}},t.prototype.updateLocationAndSize=function(t,i,r,f){r-=p;f-=2*p;n.GC$(this._DOMObject).css(u,t).css(e,i).css(b,r-lt).css(y,f-oi)},t.prototype._getLocationAndSize=function(){var t=n.GC$(this._DOMObject);return{left:parseInt(t.css(u)),top:parseInt(t.css(e)),width:parseInt(t.css(b)),height:parseInt(t.css(y))}},t.prototype._getStyle=function(){var t=n.GC$(this._DOMObject);return{backColor:t.css(f),foreColor:t.css(k),font:t.css(c)}},t.prototype.updateStyle=function(t,i,r){n.GC$(this._DOMObject).css(f,t).css(k,i).css(c,r)},t.prototype.appendTo=function(n){n.appendChild(this._DOMObject)},t.prototype.editable=function(n){if(arguments.length===0)return this._editable;else if(this._editable!==n)return this._editable=n,this._changeEditor(n),this},t.prototype._changeEditor=function(t){var i=this,f=i._comboBox.getComboBox(),r=i._getLocationAndSize(),u=i._getStyle();f.removeChild(i._DOMObject);i._DOMObject=t?i._textareaObject:i._divObject;n.GC$(i._DOMObject).appendTo(f);i._setDefaultCSS();i.updateStyle(u.backColor,u.foreColor,u.font);i.updateLocationAndSize(r.left,r.top,r.width,r.height)},t.prototype.text=function(n){if(arguments.length===0)return this._text;else if(n!==this._text){this._text=n;var t=this._DOMObject.tagName.toUpperCase();t==="DIV"?this._DOMObject.textContent=n:this._DOMObject.value=n}},t.prototype.focus=function(){var n=this._DOMObject;n.focus();n.tagName.toUpperCase()==="TEXTAREA"&&(n.selectionStart=n.value.length)},t.prototype.updateImeMode=function(t){n.GC$(this._DOMObject).css("ime-mode",t)},t.prototype.selectAll=function(){var n=this._DOMObject;n.tagName.toUpperCase()==="TEXTAREA"&&n.select()},t.prototype.bind=function(t,i,r){n.GC$(this._DOMObject).bind(t,i,r)},t.prototype.unbind=function(t,i){n.GC$(this._DOMObject).unbind(t,i)},t.prototype._trigger=function(t,i){n.GC$(this._DOMObject).trigger(t,i)},t}(),or=function(){function t(n,t,i,u,f){this._comboBox=n;this._DOMObject=r.createElement("div");this._DOMObject.className="gcDropDownButton";this._setDefaultCSS();this._bindEvent();var e=r.createElement("canvas");e.className="gcDropDownButtonIcon";this._canvas=e;this.updateLocationAndSize(t,i,u,f);this._DOMObject.appendChild(e)}return t.prototype._setDefaultCSS=function(){var t=p+"px solid black";n.GC$(this._DOMObject).css("border-top",t).css("border-right",t).css("border-bottom",t).css(s,h).css(f,"white").css(g,"content-box").attr(d,"gcDropDownButton")},t.prototype._bindEvent=function(){var t=this;n.GC$(this._DOMObject).bind(hi,function(n){var r,u;t._showTime!==i&&(r=t._showTime,t._showTime=i,u=(new Date).valueOf(),u-r<100)||(t._comboBox._isDisplayMode?t._trigger(o,{isMouse:!0}):t._comboBox.toggleDropDownListShow())})},t.prototype._paintIcon=function(){var t=this._canvas;if(t){var i=t.width,r=t.height,n=t.getContext("2d");n.beginPath();n.lineWidth=2;n.fillStyle="#000000";n.moveTo(i-nt+4,(r-2)/2-2.5);n.lineTo(i-nt+7,(r-2)/2+3.5);n.lineTo(i-nt+10,(r-2)/2-2.5);n.fill()}},t.prototype.updateLocationAndSize=function(t,i,r,f){r-=p;f-=2*p;n.GC$(this._DOMObject).css(u,t).css(e,i).css(b,r).css(y,f);n.GC$(this._canvas).attr(b,r).attr(y,f);this._paintIcon()},t.prototype.updateStyle=function(t,i,r){n.GC$(this._DOMObject).css(f,t).css(k,i).css(c,r)},t.prototype.appendTo=function(n){n.appendChild(this._DOMObject)},t.prototype.bind=function(t,i,r){n.GC$(this._DOMObject).bind(t,i,r)},t.prototype.unbind=function(t,i){n.GC$(this._DOMObject).unbind(t,i)},t.prototype._trigger=function(t,i){n.GC$(this._DOMObject).trigger(t,i)},t}(),sr=function(){function t(t,i,u,f,e){this._DOMObject=r.createElement("div");this._isShown=!1;this._setDefaultCSS(e);this._width=u;this._height=f;n.GC$(this._DOMObject).css(b,u).css(y,f);this.updateLocation(t,i)}return t.prototype._setDefaultCSS=function(t){n.GC$(this._DOMObject).css(s,h).css(ut,"1px solid").css(f,"white").css(st,t||0).css(ft,a).css("display","none").css("cursor","default").css(g,"content-box").attr(d,"gcDropDownWindow").attr(et,-1)},t.prototype.show=function(){this.isShown(!0)},t.prototype.close=function(){this.isShown(!1)},t.prototype.toggleShow=function(){this.isShown(!this._isShown)},t.prototype.isShown=function(n){return arguments.length===0?this._isShown:(n!==this._isShown&&(this._isShown=n,this._updateIsShown()),this)},t.prototype._updateIsShown=function(){this._isShown?this._show():this._close()},t.prototype._show=function(){n.GC$(this._DOMObject).show()},t.prototype._close=function(){n.GC$(this._DOMObject).hide()},t.prototype.width=function(n){if(arguments.length===0)return this._width;else n>0&&(this._width=n,this._updateWidth())},t.prototype._updateWidth=function(){n.GC$(this._DOMObject).css(b,this._width)},t.prototype.height=function(n){if(arguments.length===0)return this._height;else n>0&&(this._height=n,this._updateHeight())},t.prototype._updateHeight=function(){n.GC$(this._DOMObject).css(y,this._height)},t.prototype.font=function(n){if(arguments.length===0)return this._font;else this._font=n,this._updateFont()},t.prototype._updateFont=function(){n.GC$(this._DOMObject).css(c,this._font)},t.prototype.updateLocation=function(t,i){n.GC$(this._DOMObject).css(u,t).css(e,i)},t.prototype.updateStyle=function(t,i,r){n.GC$(this._DOMObject).css(f,t).css(k,i);this.font(r)},t.prototype.appendTo=function(n){n.appendChild(this._DOMObject)},t}(),hr=function(u){function e(t,i,f,e,o){u.call(this,t,i,f,e,o);this._itemCount=0;this.SCROLLBAR_SIZE=18;this.HOVER_COLOR="lightgrey";this.SELECTED_COLOR="#1E90FF";this.ShowDropDown="ShowDropDown"+v;this.CloseDropDown="CloseDropDown"+v;this.SelectedIndexChanged="SelectedIndexChanged"+v;this._DOMObject.className="gcDropDownList";this._divList=r.createElement("div");this._divList.className="gcDivList";this._DOMObject.appendChild(this._divList);this._scrollablePanel=new n.ScrollablePanel(this._DOMObject,this._divList);this._itemHeight=22;this._itemCountPerPage=ei;this._selectedIndex=-1}return __extends(e,u),e.prototype._show=function(){u.prototype._show.call(this);this._bindEvent();this._isNeedVScrollbar=!1;this._updateItemHeight();this._updateItemWidth();this._isNeedVScrollbar&&(this._scrollablePanel.verticalSmallChange(n.GC$(this._divList.children).height()),this._scrollablePanel.refreshLayout(!1));this._addSelectedEffect();this._trigger(this.ShowDropDown,{})},e.prototype._close=function(){this._unbindEvent();this._removeSelectedEffect();u.prototype._close.call(this);this._trigger(this.CloseDropDown,{})},e.prototype.items=function(n){if(arguments.length===0)return this._items;else if(n)return this._items=n,this._updateItems(),this},e.prototype._updateItems=function(){this._removeDivListItems();this._addAllItems()},e.prototype._appendMeasureSpanToBody=function(){this._measureSpan=r.createElement("span");n.GC$(this._measureSpan).css("display","none").css(c,this.font());r.body.appendChild(this._measureSpan)},e.prototype._removeMeasureSpanFromBody=function(){r.body.removeChild(this._measureSpan)},e.prototype._measureTextWidth=function(t){return this._measureSpan.textContent=t,n.GC$(this._measureSpan).width()+2+si},e.prototype._measureTextHeight=function(t){return this._measureSpan.textContent=t,n.GC$(this._measureSpan).height()},e.prototype._addAllItems=function(){var i=this._items,n,r,t;if(i)for(n=0,r=i.length;n<r;n++)t=i[n],this._addItem(t.hasOwnProperty("text")?t.text:t)},e.prototype._addItem=function(t){var e="gcItem"+this._itemCount,i=r.createElement("div"),u,f;i.className=e;u=r.createElement("span");u.textContent=t.toString();u.style.paddingLeft=si+"px";i.appendChild(u);this._divList.appendChild(i);this._itemCount++;f=this;n.GC$(i).bind(hi,function(n){f._onMouseClickItem(this,n)}).bind("mouseover",function(n){f._onMouseEnterItem(this,n)}).bind("mouseout",function(n){f._onMouseLeaveItem(this,n)})},e.prototype._onMouseClickItem=function(t,i){var r=n.GC$(t).index();this.selectedIndex(r);this.close();this._trigger(o,{isMouse:!0})},e.prototype._onMouseEnterItem=function(t,i){var r=n.GC$(t);t.oldBackColor=r.css(f);r.css(f,this.HOVER_COLOR)},e.prototype._onMouseLeaveItem=function(t,i){n.GC$(t).css(f,t.oldBackColor||"")},e.prototype._addSelectedEffect=function(){var t=this._selectedIndex;0<=t&&t<this._itemCount&&(n.GC$(this._divList.children[t]).css(f,this.SELECTED_COLOR),this.scrollToIndex(t))},e.prototype._removeSelectedEffect=function(){var t=this._selectedIndex;0<=t&&t<this._itemCount&&n.GC$(this._divList.children[t]).css(f,"")},e.prototype._bindEvent=function(){var t=this;n.GC$(this._DOMObject).bind(wt,function(n){t._onKeydown.call(t,n)})},e.prototype._unbindEvent=function(){n.GC$(this._DOMObject).unbind(wt)},e.prototype._onKeydown=function(n){this._navigation(n)},e.prototype._navigation=function(t){if(!t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey){var f=this.isShown(),e=1,u=this._itemCount,r=this._selectedIndex,i=0;switch(t.which){case 38:r>=0&&r<u&&(i=r-e);i>=0&&i<u&&this.selectedIndex(i);f&&this.scrollToIndex(i);n.util.cancelDefault(t);break;case 40:r>=0&&r<u&&(i=r+e);i>=0&&i<u&&this.selectedIndex(i);f&&this.scrollToIndex(i);n.util.cancelDefault(t);break;case 13:this.selectedIndex(this._selectedIndex);this.close();this._trigger(o,{keyCode:t.keyCode});n.util.cancelDefault(t);break;case 27:this.close();this._trigger(o,{keyCode:t.keyCode});n.util.cancelDefault(t);break;case 37:this.selectedIndex(this._selectedIndex);this.close();this._trigger(o,{keyCode:t.keyCode});n.util.cancelDefault(t);break;case 39:this.selectedIndex(this._selectedIndex);this.close();this._trigger(o,{keyCode:t.keyCode});n.util.cancelDefault(t);break;case 9:this.selectedIndex(this._selectedIndex);this.close();this._trigger(o,{keyCode:t.keyCode});n.util.cancelDefault(t);break;default:break}}},e.prototype._removeDivListItems=function(){while(this._divList.firstChild)this._divList.removeChild(this._divList.firstChild);this._itemCount=0},e.prototype.getSelectedValue=function(n,r,u){var f=r[n],e;if(f!==t&&f!==i)switch(u){case 1:e=n;break;case 0:e=f.hasOwnProperty("text")?f.text:f;break;case 2:f.hasOwnProperty("value")&&(e=f.value);break;default:break}return e},e.prototype.setSelectedIndexInternal=function(n){this._removeSelectedEffect();this._selectedIndex=n;this._addSelectedEffect()},e.prototype.selectedIndex=function(n){if(arguments.length===0)return this._selectedIndex;else 0<=n&&n<this._itemCount&&(this.setSelectedIndexInternal(n),this._trigger(this.SelectedIndexChanged,{}))},e.prototype.selectByText=function(n){var r=this._items,t,i;if(r){for(t=0;t<r.length;t++)if(i=r[t],i.hasOwnProperty("text")&&(i=i.text),n===i)break;this.setSelectedIndexInternal(t)}},e.prototype.itemCountPerPage=function(n){if(arguments.length===0)return this._itemCountPerPage;else n>0&&(this._itemCountPerPage=n)},e.prototype._recalcHeight=function(n,t){var i,r=this._itemCount;r<=t?i=r*n:(i=t*n,this._isNeedVScrollbar=!0);this.height(i)},e.prototype.measureText=function(n){this._appendMeasureSpanToBody();var t=this._measureTextWidth(n);return this._removeMeasureSpanFromBody(),t},e.prototype.getLongestItemWidth=function(){var n,u,t,i,f,r;if(this._appendMeasureSpanToBody(),n=0,t=this._items,t)for(i=0,f=t.length;i<f;i++)r=t[i],u=this._measureTextWidth(r.hasOwnProperty("text")?r.text:r),u>n&&(n=u);return this._removeMeasureSpanFromBody(),n},e.prototype._updateWidth=function(){u.prototype._updateWidth.call(this);this._scrollablePanel.refreshLayout(!1)},e.prototype._updateHeight=function(){u.prototype._updateHeight.call(this);this._scrollablePanel.refreshLayout(!1)},e.prototype.itemHeight=function(n){if(arguments.length===0)return this._itemHeight;else n>0&&(this._itemHeight=n)},e.prototype._updateItemHeight=function(){var r,u;this._appendMeasureSpanToBody();r=this._items[0];(r===t||r===i)&&(r="");u=l(this._itemHeight,this._measureTextHeight(r));n.GC$(this._divList.children).css(y,u);this._recalcHeight(u,this._itemCountPerPage);this._removeMeasureSpanFromBody()},e.prototype._updateItemWidth=function(){var n=this.getLongestItemWidth(),t=this.SCROLLBAR_SIZE;this.width()<n+t&&this.width(n+t)},e.prototype.scrollToIndex=function(n){if(n>=0&&n<this._itemCount){var t=this._divList.childNodes[n];this._scrollablePanel.scrollChildIntoView(t)}},e.prototype.bind=function(t,i,r){n.GC$(this._DOMObject).bind(t,i,r)},e.prototype.unbind=function(t,i){n.GC$(this._DOMObject).unbind(t,i)},e.prototype._trigger=function(t,i){n.GC$(this._DOMObject).trigger(t,i)},e}(sr)})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){var bt,tt,it,rt;t.feature("filter_ui",["core.common","core.stringResource","core.spreadpanelex"]);var u=null,r="undefined",o="sortASC",a="sortDES",f="filterOK",v="filterCancel",s="filterSearch",y="filterCheckAll",h="filterUnCheckAll",c="filter-item",p="filter-item-container",ut="filter-item-wrapper",w="filter-item-input",b="filter-item-text",e="filter-button",l="filter-sort",ft="filter-check",et="filter-check-style",ot="filter-check-outerDiv",k=".ui-filter-dialog",st="keydown"+k,ht="keyup"+k,ct="layout-table",lt="filter-dialog-style",i="ui-state-hover",at="no-user-select",d="scroll",g=".gcScrollbar",vt=Math.floor,nt=Math.max,yt=Math.round,pt=Math.ceil,wt=Math.abs;(function(n){n[n.noSortFilter=0]="noSortFilter";n[n.ascend=1]="ascend";n[n.descend=2]="descend";n[n.filter=3]="filter";n[n.filterAscend=4]="filterAscend";n[n.filterDescend=5]="filterDescend";n[n.sortAscending=6]="sortAscending";n[n.sortDescending=7]="sortDescending";n[n.checkAll=8]="checkAll";n[n.unCheckAll=9]="unCheckAll"})(t._FilterButtonState||(t._FilterButtonState={}));bt=t._FilterButtonState;tt=function(){function n(n,t,i,r,u,f,e,o){var s=this;s.rowFilter=n;s.row=t;s.col=i;s.sheetArea=r;s.x=u;s.y=f;s.width=e;s.height=o}return n.prototype.getState=function(){var n=0,i=this.rowFilter,t;return i?(t=i.getSortState(this.col),i.isColumnFiltered(this.col)?t===0?n=3:t===1?n=4:t===2&&(n=5):t===0?n=0:t===1?n=1:t===2&&(n=2),n):n},n}();t._FilterButtonInfo=tt;it=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.find=function(n,t,i){for(var e=this.length,r,f=0;f<e;f++)if(r=this[f],r&&r.row===n&&r.col===t&&r.sheetArea===i)return r;return u},t}(t._XArray);t._FilterButtonInfoModel=it;rt=function(k){function tt(n,i,r){k.call(this,n,t.util.getPreferredZIndex(i&&i.parent&&i.parent._host));this._allValues=[];this._searchedValues=[];this._allCheckedValues=[];this._inputElements=[];this._spanElements=[];this._itemOuterDivs=[];var u=this;u.sheet=i;u.filterButtonInfo=r;u.init()}return __extends(tt,k),tt.prototype.init=function(){var n=this;n._containerWidth=237;n._containerHeight=318;n._itemContainerWidth=191;n._itemContainerHeight=150;n._itemDivMargin=2;n._itemDivBorder=1;n._itemDivHeight=20;n._itemHeight=n._itemDivHeight+n._itemDivBorder*2+n._itemDivMargin;n._touchContainerWidth=257;n._touchContainerHeight=355;n._defaultScrollbarSize=n.sheet.parent?n.sheet.parent._getScrollbarSize():18;n.rEscape=/[\-\[\]{}()+.,\\\^$|#\s]/g;n._itemValueCache=[];n._firstOpenCache=[];n.elementList=[];n.activeItemIndex=0;n.container=n.getContainer();n._createTableLayout();n._initFilterPanel()},tt.prototype.open=function(){var n=this,i=n.sheet,t=i.parent,r;i&&(r=t&&t.useTouchLayout?t.useTouchLayout():!1,n._useTouchLayout=r,n._initData(n.filterButtonInfo.col),n._initLayout(),n._updateItemCache(),n._attachEvent())},tt.prototype._initLayout=function(){var n=this,f=n.sheet;n._initFilterItemsLayout();n.container.appendTo(n.getHost());n.container.hide();n.show(function(){t.GC$("#"+o).focus()});n._useTouchLayout&&n._updateFilterPanel(n._touchContainerWidth,n._touchContainerHeight);var i=n.container.width(),e=n.container.height(),r=n.filterButtonInfo.x+n.filterButtonInfo.width-i-6,u=n.filterButtonInfo.y+n.filterButtonInfo.height;n.container.css({left:r,top:u});n.resetDialogPosition();n._initFirstOpenCache()},tt.prototype._updateFilterPanel=function(n,i){var o=this,r=n-o._containerWidth,u=i-o._containerHeight,p,a,w,y,b,k,d;if(!(r<=0)&&!(u<=0)){o.container.css({width:n+"px",height:i+"px"});p=parseFloat(t.GC$("."+l).css("padding-top"))+u/30;t.GC$("."+l).css("padding",p+"px 6px");var c=t.GC$("."+e),g=parseFloat(c.css("width"))+r/4,nt=parseFloat(c.css("height"))+u/8;c.css({width:g+"px",height:nt+"px"});a=t.GC$("#"+f);w=parseFloat(a.css("margin-left"))+r/2;a.css("margin-left",w+"px");var v=t.GC$("#"+s),tt=parseFloat(v.css("width"))+r,it=parseFloat(v.css("height"))+u/8;v.css({height:it+"px",width:tt+"px"});y=t.GC$("."+ot);b=parseFloat(y.css("margin-top"))+u/10;y.css("margin-top",b+"px");k=t.GC$("#"+h);d=parseFloat(k.css("margin-left"))+r;t.GC$("#"+h).css("margin-left",d+"px")}},tt.prototype.close=function(){k.prototype.close.call(this);var n=this;t.GC$(n._itemSpanElement).remove();t.GC$(n._itemInputElement).remove();n.sheet&&n.sheet.setFocus()},tt.prototype._initFilterPanel=function(){var n=this,i=n.table.getElement(0).children,c=i[0],l=i[1],g=i[2],nt=i[3],it=i[4],w=n._getSortLink(o,t.SR.SortAscending).css("margin-top","6px"),b=n._getSortLink(a,t.SR.SortDescending),k,d,r,u;t.GC$(c.children[0]).append(t.GC$(document.createElement("img")).attr("src",tt.getImageSrc(6)));t.GC$(l.children[0]).append(t.GC$(document.createElement("img")).attr("src",tt.getImageSrc(7)));t.GC$(c.children[1]).append(w);t.GC$(l.children[1]).append(b);n.elementList.push(w.getElement(0));n.elementList.push(b.getElement(0));n.searchOuterDiv=t.GC$(document.createElement("div")).css({margin:0,padding:0}).addClass("search-outer-div ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix");k=t.GC$(document.createElement("div")).appendTo(n.searchOuterDiv);d=t.GC$(document.createElement("input")).attr({type:"search",placeholder:t.SR.Search,id:s}).appendTo(k);n.elementList.push(d.getElement(0));var rt=t.GC$(document.createElement("div")).appendTo(n.searchOuterDiv).addClass("filter-check-outerDiv"),ut=n._getCheckLink(y,t.SR.CheckAll,"check-image ui-icon ui-icon-check"),ft=n._getCheckLink(h,t.SR.UncheckAll,"uncheck-image ui-icon ui-icon-closethick");rt.append(ut).append(ft);t.GC$(g.children[1]).append(n.searchOuterDiv);n.itemList=t.GC$(document.createElement("div")).addClass(p).css({width:n._itemContainerWidth,height:n._itemContainerHeight,"box-sizing":"content-box"});t.GC$(nt.children[1]).append(n.itemList);r=t.GC$(document.createElement("button")).text(t.SR.OK).css({"font-size":"1em"}).addClass(e+" filter-button-default ui-button ui-state-default ui-corner-all btn btn-default").attr({id:f});u=t.GC$(document.createElement("button")).text(t.SR.Cancel).css({"font-size":"1em"}).addClass(e+" filter-button-default ui-button ui-state-default ui-corner-all btn btn-default").attr({id:v});t.GC$(it.children[1]).append(r).append(u);n.elementList.push(r.getElement(0));n.elementList.push(u.getElement(0))},tt.prototype._createTableLayout=function(){var n=this,s=5,h=3,r,u,o,i,f,e;for(n.table=t.GC$(document.createElement("table")).css({padding:0,display:"table"}).attr({cellspacing:0,cellpadding:0}).addClass(ct),r=0;r<s;r++){for(u=document.createElement("tr"),u.style.border="0px",u.style.margin="0px",u.style.padding="0px",o=t.GC$(u),i=0;i<h;i++)f=document.createElement("td"),f.style.border="0px",f.style.margin="0px",f.style.padding="0px",e=t.GC$(f).appendTo(o),i===0?e.addClass("layout-table-first-column"):i===2?e.addClass("layout-table-last-column"):i===1&&(r===0?e.addClass("filter-sort-asc-container sort-container ui-menu-item"):r===1&&e.addClass("filter-sort-desc-container sort-container ui-menu-item"));o.appendTo(n.table)}n.table.appendTo(n.container);n.container.css({"box-shadow":"rgba(0, 0, 0, 0.4) 2px 4px 5px",padding:"2px",width:n._containerWidth+"px",height:n._containerHeight+"px","box-sizing":"content-box"}).addClass(lt+" "+at)},tt.prototype._updateItemCache=function(){for(var t=this,i=t._allValues,n=0,r=i.length;n<r;n++)t._itemValueCache.push(i[n])},tt.prototype._stopBubble=function(n){return n&&n.stopPropagation?n.stopPropagation():window.event.cancelBubble=!0,!1},tt.prototype._itemsWrapMouseWheel=function(n){var e=this,i,o,v,f;(typeof n.wheelDelta===r||n.wheelDelta===u)&&(typeof n.detail===r||n.detail===u)&&(n.wheelDelta=n.originalEvent.wheelDelta,n.detail=n.originalEvent.detail);i=n.detail?n.detail:n.wheelDelta/-40;t.util.isMacOS()&&(o=n.wheelDeltaY,typeof o!==r&&(i=o/-40,i=(i>=0?1:-1)*pt(wt(i))));var s=e._spanElements,h=s.length,c=e._searchedValues,l=c.length,a=0;s&&h>0&&(v=t.GC$(s[0]).text(),a=t.GC$.inArray(v,c));f=a+i;f>l-h&&(f=l-h);f<0&&(f=0);e._updateItemsLayout(f);t.util.cancelDefault(n)},tt.prototype._attachEvent=function(){var r=this,u,p,w;r._itemsWrap&&(r._itemsWrap.addEventListener("mousewheel",function(n){r._itemsWrapMouseWheel(n)},!1),r._itemsWrap.addEventListener("DOMMouseScroll",function(n){r._itemsWrapMouseWheel(n)},!1));u=!1;t.GC$("#"+o).bind("mouseup",function(n){u&&(u=!1,r._sortByUser(!0),r.close(),t.util.cancelDefault(n))}).bind("mousedown",function(n){t.util.cancelDefault(n);u=!0});p=!1;t.GC$("#"+a).bind("mouseup",function(n){p&&(p=!1,r._sortByUser(!1),r.close(),t.util.cancelDefault(n))}).bind("mousedown",function(n){t.util.cancelDefault(n);p=!0});t.GC$("."+l).bind("mouseover",function(){var n="filter-hover "+i+" form-control well filter-item-hover",r=t.GC$(".filter-hover");r.removeClass(i+" filter-item-hover");t.GC$(this).addClass(n)}).bind("mouseout",function(){var n="filter-hover "+i+" form-control well filter-item-hover";t.GC$(this).removeClass(n)});t.GC$("#"+y).bind("mousedown",function(n){t.util.cancelDefault(n)}).bind("mouseup",function(n){var i=r._getVisibleItems(),u=t.GC$(i).find("input");u.prop("checked",!0);r._allCheckedValues=r._searchedValues.concat([]);r._setButtonState();t.util.cancelDefault(n)});t.GC$("#"+h).bind("mousedown",function(n){t.util.cancelDefault(n)}).bind("mouseup",function(n){var i=r._getVisibleItems(),u=t.GC$(i).find("input");u.prop("checked",!1);r._allCheckedValues.length=0;r._setButtonState();t.util.cancelDefault(n)});t.GC$("."+c).bind("mouseover",function(){var n="filter-hover "+i+" form-control well filter-item-hover",r=t.GC$(".filter-hover");r.removeClass(i+" filter-item-hover");t.GC$(this).addClass(n)}).bind("mouseout",function(){var n="filter-hover "+i+" form-control well filter-item-hover";t.GC$(this).removeClass(n)}).bind("click",function(n){t.GC$(this).find("input").getElement(0).click()});t.GC$("."+c).find("input").bind("click",function(n){r._stopBubble(n);var i=t.GC$(this).parent().getElement(0);r._updateActiveItemIndex(i);r._setButtonState()});w=n.Sheets.Key;t.GC$("#"+s).bind("keydown",function(n){var t=n.which||n.keyCode;t===13&&n.preventDefault()}).bind("keyup",function(n){switch(n.keyCode){case 9:case 37:case 38:case 39:case 40:return;default:r._searchHandler(n);r._setButtonState()}}).bind("search",function(n){r._searchHandler(n);r._setButtonState()});t.GC$("."+e).bind("mouseover",function(){var n="filter-button-hover "+i;t.GC$(this).addClass(n)}).bind("mouseout",function(){var n="filter-button-hover "+i;t.GC$(this).removeClass(n)});t.GC$("."+e).bind("mousedown",function(){t.GC$(this).removeClass("filter-button-hover "+i).addClass("filter-button-active")}).bind("mouseout",function(){t.GC$(this).removeClass("filter-button-active")});t.GC$("#"+f).bind("click",function(){var n=r._allCheckedValues;r._updateData(n);r._filter(n);r.close()});t.GC$("#"+v).bind("click",function(){r.close()});r.container.bind("mousewheel",function(n){t.util.cancelDefault(n)}).bind("DOMMouseScroll",function(n){t.util.cancelDefault(n)}).bind(st,function(n){r._filterKeyDown(n)}).bind(ht,function(n){t.util.cancelDefault(n)})},tt.prototype._getVisibleItems=function(){var t=this,i=t._itemOuterDivs,n=[];return i.forEach(function(t){t.style&&t.style.display!=="none"&&n.push(t)}),n},tt.prototype._filterKeyDown=function(n){var u=this,l=n.which||n.keyCode,p,k,d,nt,tt,e,w,c,g,y,s,rt,ut,b,h,ft,it;if(l===27||l===13||l===38||l===40||l===9)if(p=t.GC$(".filter-item-hover"),k=p.getElement(0),l===27)u.close(),t.util.cancelDefault(n);else if(l===13){if(p.length()!==1)return;d=p.attr("id");d===o?(u._sortByUser(!0),u.close()):d===a?(u._sortByUser(!1),u.close()):d===f?(nt=u._allCheckedValues,u._updateData(nt),u._filter(nt),u.close()):d===v?u.close():(tt=p.find("input"),tt.length()>0&&tt.trigger("click"),u._updateActiveItemIndex(k))}else if(l===38||l===40||l===9){if(w=u._searchedValues,p.length()===0)e=u.elementList[0];else{for(p.removeClass(i+" filter-item-hover"),c=u.elementList.concat([]),g=0;g<w.length;g++)c.splice(-2,0,w[g]);if(l===9){if(y=u.elementList.concat([]),w[u.activeItemIndex]&&y.splice(-2,0,w[u.activeItemIndex]),s=t.GC$.inArray(k,u._itemOuterDivs),n.shiftKey){if(s>=0)e=u.elementList[2];else if(s=t.GC$.inArray(k,y),s>=0)for(e=y[s-1];s>0&&u._isElementDisabled(e);)e=y[s-1],s--;typeof e===r&&(e=y[y.length-1])}else if(s>=0)rt=u.elementList[3],e=u._isElementDisabled(rt)?u.elementList[4]:u.elementList[3];else if(s=t.GC$.inArray(k,y),s>=0)for(ut=y.length,e=y[s+1];u._isElementDisabled(e)&&s<ut;)e=y[s+1],s++;typeof e===r&&(e=y[0])}else if(b=k,t.GC$.inArray(b,u._itemOuterDivs)>=0&&(b=t.GC$(b).find("span.filter-item-text").text()),h=t.GC$.inArray(b,c),ft=c.length,h>=0){if(l===40)for(e=c[h+1],t.GC$.inArray(e,w)!==-1&&t.GC$.inArray(b,w)===-1&&(h=h+u.activeItemIndex,e=c[h+1]);h<ft&&u._isElementDisabled(e);)e=c[h+1],h++;else{for(e=c[h-1],t.GC$.inArray(e,w)!==-1&&t.GC$.inArray(b,w)===-1&&(h=u.activeItemIndex+3,e=c[h]);h>0&&u._isElementDisabled(e);)e=c[h-1],h--;typeof e===r&&(e=c[c.length-1])}typeof e===r&&(e=c[0])}}typeof e=="string"?(it=u._hoverToTargetFilterItem(e,w),it&&(p=it)):(p=t.GC$(e),p.focus());p.addClass("filter-hover "+i+" filter-item-hover");t.util.cancelDefault(n)}},tt.prototype._hoverToTargetFilterItem=function(n,i){var r=this,u=t.GC$.inArray(n,i),f=null;if(u>=0){r.activeItemIndex=u;var e=r._spanElements,s=t.GC$(e[0]).text(),o=t.GC$.inArray(s,i),h=o;u<o?(r._updateItemsLayout(u),f=t.GC$(e[0]).parent()):f=r._indexOfCurrentItemList(n,e)>=0?r._getVisibleHoverItem(n,o+1):r._getVisibleHoverItem(n,u-e.length+1);f.find("input").focus()}return f},tt.prototype._indexOfCurrentItemList=function(n,i){for(var r=0,u=i.length;r<u;r++)if(t.GC$(i[r]).text()===n)return r;return-1},tt.prototype._getVisibleHoverItem=function(n,i){for(var r=this,u=null,s=r._spanElements,h=r._searchedValues.length,f,e,o;;){if(f=r._indexOfCurrentItemList(n,s),f>=0){if(u=t.GC$(s[f]).parent(),e=r._scrollbarH,o=!0,r._showHorizontalScrollbar&&e&&u.length>0&&u.css("display")!=="none"){var c=u.offset().top+r._itemHeight,l=e.getScrollbar(),a=t.GC$(l).offset().top;c>a&&(o=!1)}if(o)break}if(r._updateItemsLayout(i),i++,i>h-1)break}return u},tt.prototype._updateActiveItemIndex=function(n){var r=this,s=r._searchedValues,u=r._allCheckedValues,o=t.GC$(n).find("span.filter-item-text"),i,f,e;o&&(i=o.text(),f=t.GC$.inArray(i,u),f>=0?u.splice(f,1):u.push(i),e=t.GC$.inArray(i,s),e>=0&&(r.activeItemIndex=e))},tt.prototype._isElementDisabled=function(n){return typeof n=="string"?!1:(n=t.GC$(n),n.length===0)?!1:n.hasClass("ui-button-disabled")||n.hasClass(" ui-state-disabled")||n.hasClass("filter-button-disable")?!0:!1},tt.prototype._filter=function(n){var f=this,t=f.sheet,e,r;if(t){e=t.isPaintSuspended();try{if(t.isPaintSuspended(!0),r=f.filterButtonInfo.rowFilter,!r)return;var u=f.filterButtonInfo.col,i=r.table&&r.table(),o=i?u-i.range().col:-1;n&&(i?t.triggerTableFiltering({sheet:t,sheetName:t._name,table:i,tableCol:o,filterValues:n}):t.triggerRangeFiltering({sheet:t,sheetName:t._name,col:u,filterValues:n}));r.filter(u);n&&(i?t.triggerTableFiltered({sheet:t,sheetName:t._name,table:i,tableCol:o,filterValues:n}):t.triggerRangeFiltered({sheet:t,sheetName:t._name,col:u,filterValues:n}))}finally{t.isPaintSuspended(e)}}},tt.prototype._updateData=function(n){var o=this.filterButtonInfo.col,f=this.filterButtonInfo.rowFilter,i,r,e;if(f&&t.features.conditionalFormat&&(f.removeFilterItems(o),n.length!==this._allValues.length))for(i=0;i<n.length;i++)r=n[i],r===t.SR.Blanks&&(r=""),e=new t.TextCondition(0,r,u),e.useWildCards=!1,f.addFilterItem(o,e)},tt.prototype._searchHandler=function(n){var i=this,h=t.GC$("#"+s),f=t.GC$.trim(h.val().toLowerCase()),c=t.GC$("."+p),u=c.find("input"),e=u.parent(),o,r;f?(e.hide(),u.prop("checked",!1),o=new RegExp(f.replace(this.rEscape,"\\$&").replace("*",".*").replace("?",".?").replace("~","\\~"),"gi"),r=[],t.GC$.map(this._itemValueCache,function(n,t){n.search(o)!==-1&&r.push(n)}),i._searchedValues=r.concat([]),i._allCheckedValues=r.concat([]),i.activeItemIndex=0,i._updateItemsLayout(0)):(e.show(),this._firstOpenCache&&this._firstOpenCache.length!==0?(u.prop("checked",!1),i._searchedValues=i._allValues.concat([]),i._allCheckedValues=i._firstOpenCache.concat([]),i._updateItemsLayout(0)):this._initFirstOpenCache())},tt.prototype._getSortLink=function(n,i){var r=t.GC$(document.createElement("a"));return r.attr({id:n,href:"javascript:void(0)"}).text(i).addClass(l+" ui-corner-all").css({display:"block",padding:"5px 6px",cursor:"default",margin:"2px 0px 1px 2px","text-decoration":"none","text-align":"left","font-size":"12px",outline:"none",height:"inherit"}),r},tt.prototype._getCheckLink=function(n,i,r){var f=t.GC$(document.createElement("span")).addClass("check-uncheck-all "+r),e=t.GC$(document.createElement("span")).text(i),u=t.GC$(document.createElement("a"));return u.attr({href:"javascript:void(0)",id:n}).css("float","left").css({"margin-left":"7px",padding:"0","font-size":"12px",height:"16px"}).addClass(ft+" "+et).append(f).append(e),u},tt.prototype._initData=function(n){var t=this,r=t.filterButtonInfo.rowFilter,i;r&&(t._getItemsData(r,n),i=t._allValues,i.sort(function(n,t){return n>t?1:n<t?-1:0}),t._allValues=i,t._searchedValues=i.concat([]),r.isColumnFiltered(n)||(t._allCheckedValues=i.concat([])))},tt.prototype._getItemsData=function(n,i){var e=this,o=e.sheet,s=[],h=[],c={},f=o._getActualRange(n.range),l,r,u;if(i<f.col||i>f.col+f.colCount-1){e._allValues=s;e._allCheckedValues=h;return}for(l=!1,r=f.row;r<f.row+f.rowCount;r++){if(u=o.getText(r,i),u===""){l||(l=!0,s.push(t.SR.Blanks),o.getRowHeight(r,3)>0&&h.push(t.SR.Blanks));continue}c[u]||o.getRowVisible(r,3,!0)&&(o.getRowHeight(r,3)>0?(s.push(u),c[u]=!0,h.push(u)):(!n.isFiltered()||n.isLastFilteredColumn(i)&&n._isRowfilteredOutByColumn(r,i))&&(s.push(u),c[u]=!0))}e._allValues=s;e._allCheckedValues=h},tt.prototype._initFilterItemsLayout=function(){var n=this,y=0,u=n._itemContainerWidth,f=n._itemContainerHeight,it,p,e,o,ot,h,r,i,s;n._useTouchLayout&&(it=n._touchContainerWidth-n._containerWidth,p=n._touchContainerHeight-n._containerHeight,y=p/4,u=u+it,f=f+p/2,n._itemContainerHeight=f,n._itemContainerWidth=u,n.itemList.css({width:u+"px",height:f+"px"}),n._itemHeight+=y);n.defaultItemWidth=u-n._itemDivMargin*2-n._itemDivBorder*2;e=document.createElement("div");n._itemsWrap=e;e.className=ut;var rt=n._allValues,ft=n._itemHeight,ht=yt(f/ft),et=0,k=0;for(o=0,ot=rt.length;o<ot;o++)(h=rt[o],et+=ft,o>=ht)||(k=nt(n._getItemWidthByText(h),k),r=document.createElement("div"),r.className=c+" ui-corner-all no-user-select",t.GC$(r).css({display:"block",padding:y/2,"border-width":n._itemDivBorder+"px",margin:n._itemDivMargin+"px",height:n._itemDivHeight+"px","box-sizing":"content-box"}).attr("unselectable","on"),e.appendChild(r),n._itemOuterDivs.push(r),i=document.createElement("input"),i.className=w,i.setAttribute("type","checkbox"),i.setAttribute("value",h),i.style.margin="3px",i.style.padding="0",r.appendChild(i),n._inputElements.push(i),s=document.createElement("span"),s.className=b,s.innerHTML=t.StringUtil.escapeHtml(h),n._spanElements.push(s),r.appendChild(s));n._maxItemWidth=k;n._totalItemsHeight=et;n.itemList.empty();var l=document.createElement("table"),a=document.createElement("tr"),v=document.createElement("tr"),d=document.createElement("td"),st=document.createElement("td"),g=document.createElement("td"),tt=document.createElement("td");n._hScrollbarTd=tt;n._vScrollbarTd=g;t.GC$(a).css({border:0,margin:0,padding:0});t.GC$(v).css({border:0,margin:0,padding:0});t.GC$(d).css({border:0,margin:0,padding:0});t.GC$(g).css({border:0,margin:0,padding:0});t.GC$(tt).css({border:0,margin:0,padding:0});t.GC$(st).css({border:0,margin:0,padding:0});a.appendChild(d);a.appendChild(g);v.appendChild(tt);v.appendChild(st);l.appendChild(a);l.appendChild(v);d.appendChild(e);t.GC$(l).css({width:u,height:f,border:0,margin:0,padding:0}).attr({cellspacing:0,cellpadding:0,border:0});n._refreshScrollbar();n.itemList.append(l);n._setItemWidth();n._setCheckedValues()},tt.prototype._updateItemsLayout=function(n){for(var o,i=this,s=i._searchedValues,h=i._spanElements,l=i._inputElements,e=0,a=i._itemHeight,v=n,f=0,y=h.length;f<y;f++){var r=h[f],c=l[f],u=s[n++];r&&u&&u!==""?(t.GC$(r).parent().show(),r.innerHTML=t.StringUtil.escapeHtml(u),c.setAttribute("value",u),e=nt(i._getItemWidthByText(u),e)):(r.innerHTML="",c.setAttribute("value",""),t.GC$(r).parent().hide())}i._maxItemWidth=e;i._totalItemsHeight=s.length*a;i._refreshScrollbar();o=i._scrollbarV;o&&o.value(v);i._setItemWidth();i._setCheckedValues()},tt.prototype._refreshScrollbar=function(){var n=this,a=n._maxItemWidth,p=n._totalItemsHeight,s=n._itemContainerWidth,h=n._itemContainerHeight,v=n._itemHeight,f=n._defaultScrollbarSize,u=s-f,e=h-f,w=n._searchedValues,y=n._isNeedScrollbars(a,p,s,h),c=y.isNeedVScroll,l=y.isNeedHScroll,o,i,r;c?(l||(e+=f),n._scrollbarV||n._createVerticalScrollbar(),o=vt(e/v),i=n._scrollbarV,i.width(f),i.height(e),i.minimum(0),i.maximum(w.length-o),i.pageValue(o),i.smallChange(1),i.largeChange(o-1),i.refreshLayout(),t.GC$(n._vScrollbarTd).show(),n._showVerticalScrollbar=!0):(t.GC$(n._vScrollbarTd).hide(),n._showVerticalScrollbar=!1);l?(c||(u+=f),n._scrollbarH||n._createHorizontalScrollbar(),r=n._scrollbarH,r.width(u),r.height(f),r.minimum(0),r.maximum(a-u),r.pageValue(u),r.smallChange(v),r.largeChange(u),r.refreshLayout(),t.GC$(n._hScrollbarTd).show(),n._showHorizontalScrollbar=!0):(t.GC$(n._hScrollbarTd).hide(),n._showHorizontalScrollbar=!1);l||c||(e=h,u=s);t.GC$(n._itemsWrap).css({width:u,height:e,overflow:"hidden"})},tt.prototype._vscrollDelegate=function(n){this._updateItemsLayout(n)},tt.prototype._hscrollDelegate=function(n){t.GC$("."+c).css("left",0-n)},tt.prototype._createVerticalScrollbar=function(){var n=this,i;n._scrollbarV=new t.Scrollbar(!1);i=n._scrollbarV.getScrollbar();n._vScrollbarTd.appendChild(i);t.GC$(i).bind(d+g,function(t,i){var f=i.scrollEventType,u=i.scrollOrientation,r;if(t.data=n,u===1){r=i.newValue;switch(i.scrollEventType){case 0:case 1:case 2:case 3:case 5:n._vscrollDelegate(r);break;default:break}}})},tt.prototype._createHorizontalScrollbar=function(){var n=this,i;n._scrollbarH=new t.Scrollbar(!0);i=n._scrollbarH.getScrollbar();n._hScrollbarTd.appendChild(i);t.GC$(i).bind(d+g,function(t,i){var f=i.scrollEventType,u=i.scrollOrientation,r;if(t.data=n,u===0){r=i.newValue;switch(i.scrollEventType){case 0:case 1:case 2:case 3:case 5:n._hscrollDelegate(r);break;default:break}}})},tt.prototype._isNeedScrollbars=function(n,t,i,r){var f=this._defaultScrollbarSize,e=i-f,o=r-f,u={isNeedHScroll:!1,isNeedVScroll:!1};return n>i&&(u.isNeedHScroll=!0,u.isNeedVScroll=t>o?!0:!1),t>r&&(u.isNeedVScroll=!0,u.isNeedHScroll=n>e?!0:!1),u},tt.prototype._getItemWidthByText=function(n){var r=this,i,f,e,o,s,h,c,l;return r._itemSpanElement||(i=document.createElement("input"),i.className=w,i.setAttribute("type","checkbox"),r._itemInputElement=i,f=document.createElement("span"),f.className=b,r._itemSpanElement=f,document.body.insertBefore(i,u),document.body.insertBefore(f,u),e=parseFloat(t.GC$(i).css("margin-left"))+parseFloat(t.GC$(i).css("margin-right")),isNaN(e)&&(e=0),o=parseFloat(t.GC$(i).css("padding-left"))+parseFloat(t.GC$(i).css("padding-right")),isNaN(o)&&(o=0),s=parseFloat(t.GC$(f).css("margin-left"))+parseFloat(t.GC$(f).css("margin-right")),isNaN(s)&&(s=0),h=parseFloat(t.GC$(f).css("spanPadding-left"))+parseFloat(t.GC$(f).css("spanPadding-right")),isNaN(h)&&(h=0),r._itemInputWidth=t.GC$(i).width()+e+o,r._itemSpanPartWidth=s+h,i.style.display="none",f.style.display="none"),c=r._itemSpanElement,c.innerHTML=t.StringUtil.escapeHtml(n),l=t.GC$(c).width(),l+r._itemInputWidth+r._itemSpanPartWidth+1+r._itemDivMargin*2+r._itemDivBorder*2},tt.prototype._setItemWidth=function(){var n=this,r=t.GC$(n._itemOuterDivs),u=n._showVerticalScrollbar,f=n._showHorizontalScrollbar,i;i=f?n._maxItemWidth:u?n.defaultItemWidth-n._defaultScrollbarSize:n.defaultItemWidth;r.css("width",i)},tt.prototype._ArrayToDic=function(n){var i={};return t.GC$.each(n,function(n,t){i[t]=t}),i},tt.prototype._setCheckedValues=function(){var i=this._allCheckedValues,n=this._ArrayToDic(i);this._inputElements.forEach(function(i){var f=t.GC$(i),e=f.val();n[e]!==u&&typeof n[e]!=r?f.prop("checked",!0):f.prop("checked",!1)})},tt.prototype._sortByUser=function(n){var u=this.filterButtonInfo.rowFilter,t,r,i,f;u&&(t=this.sheet,r=t._name,t)&&t.canDoSort()&&(i=this.filterButtonInfo.col,t.triggerRangeSorting({sheet:t,sheetName:r,col:i,ascending:n}),f=t.isPaintSuspended(),t.isPaintSuspended(!0),u.sortColumn(i,n),t.isPaintSuspended(f),t.triggerRangeSorted({sheet:t,sheetName:r,col:i,ascending:n}))},tt.prototype._setButtonState=function(){var u=this._allCheckedValues.length,n=t.GC$("#"+f),i="ui-button-disabled ui-state-disabled",r="filter-button-disable";u>0?n.prop("disabled",!1).removeClass(i+" "+r):n.prop("disabled",!0).addClass(i+" "+r)},tt.prototype._initFirstOpenCache=function(){this._firstOpenCache=this._allCheckedValues.concat([])},tt.getImageSrc=function(n){if(n===0)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMOSURBVHjaXJNdaJRHFIbfM7PfGremUTfkpxgpiheiBOmFtYUgRXNRqNnd75sEhBoIKhrwQpFUUSsihhIQ41+FNrUGqYhRY43STZqgARNRTIzRaFqz6xJTtals3K8xRQ3x7UV215+LB2bOxTNn3jMDs+mEIgmS+LwQiqSQ9JG03FHX54666pn7TLmJEZVIjCCRGMkYGxvNiI9FvaENZzLw/PmqtCDFV/4WkERw8TI03K6XqqrNWLBgPoafDmNwMCbd3TestpMDHpJAuIcWSZjSUrnS0SFOWamXJLpuDYAkAiYAkioYDCIej0+Lx12QrervFxOemjWfCvIyIcmTVeLVC1986OkUklhRtlgutLYrkpnOKlt1dl0BSfTHmnCnm5oTm0AS6I0xLaDLrK1PusTp/cb7/rUAyH8kSL+Vqt0ebpuGP699LCRROAdqf/suGforCpLi4DMpAOQQLAEgfE2sRDZIv5cknGxi74HDFnZ/32olk9f//vOTPIj05ZnKZpp14QlnfZgpTOXvNGsvjrvuH9MnOwAOYlhQ/UPYmxRkJVvzPHw8JF8EdrKoZEeapSt2cHDo4Sxn7R0hiV8/hEQe3Ad21jZNJQnbDklSBBas0ddvRj2Fi4qZIhaL+Q3ni8N0ZohGe4Dv6sKZfFP0kvkSWLZdGvLpiUTuTS9cVMxI5H5+fz+UfXyOto/Ns5bUL7dyjsBjTsKDbbVnM0iqYNHXYi9ZLiSlaRbFn089zlzvwN1IzkDlmDhfdiin5KgOBY5qO9iojX1K9+VRcOCXnlySsFkOkjj/WGschtR0Kt/Ga9D2aYj5DWKaIeYSxTlFMS2T66udBDbXHS94Z97ZUB8Ayt7+iVVddlkzl5LCvrklvQ9dr1fnF0IQbng5O/VQsmAJSfnxSLuqCG3Rxxpfz3xbXv0IEkzm5YR7lXOCGs6+PVNJYjaQnoKwSgBIDSqkjjPUuv3QLP9ImW+hG1/lKJtzp5jaCmW2nrNAUpOUkqrWrJUb23T5rhZf0eoWhbeEKX7O4eTPHe8DSTjF59T/AwCfnhbaDaIICgAAAABJRU5ErkJggg==";else if(n===1)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAALLSURBVHjadJNtaNVlGMav+/kfjy3GTDfcsQW1CMrhWSZ6AsmXmflFDts5/0eYA52i02M6tdBIRQQJBLX8Yg4xYlMEJaHphzxKzoiaZptN0MBtacyXoYIobUgT/fXhtOMS+vBw89wXXPfLdd0CLNxwyACF648YYH7tnuEYAeQbv3CA/EeHBcivazbAUo1fv6hwfYtJEjDy2XP//8vpGbA9ZiE7xQ6USs3S7sUx9YHNbMqYn1IerGmQ3pr8uYXsNUAqnZ+LvqHJAA2BeIoGT6DJbMqBbAwArR77vs4/uhOje9BxlXEcww13pXDvtwaoes1MB6iz8xfxGkIIiLCUIEXaDTxiFJOmKp5YxDcciS6jVpRi8g1H87PVgLYslwO0GYzf+x377ubwXoLKafXEE/WUTfC9tBIhwNTJdAPkw4R1fdkkOmJW1/LAYNBV54iDJK8HH7NPd+/9MTqeWER//62YHxrrJvCDydd99Z/tpjLboz7znQF2/vSfufwY9Ne1e9r9JtHKaUvxqWY3UgXX23dNbccOlhQUFxUN9GweVsaWIQNZRfkeByidrnDxRD19N29U5AnChkMO0BMYAwRA4GkPAKuZc/2F8JWTDlB716sCIm9PXcz1K9+/lCc4erstABQmP3U8LBvlV2VJr8yyIHMSv+LUk1QmCzADBjQnrB0dT9TT0/243NfqXx8szwaAzq6Q1bDJnWnrmlKV3EZVchvvJbfQ2nqmDLDqD0/YXFqs8t0l/Haxu3j+vOPDO9ifu4P9jwPAeSk6RE/RpHc+4KefL8waYWEDrOPX9ol/cycA1KH7pvCTsxFAPxZGXQ1YmDhlgNIHsoWQd5wONw4JxgfhwmeKXSUjXbq0Oi/j80el28UjqpdqK1ivcCB7KJwXTuHKcwWAPtPCoJkShy7kjKU3dIXLAvQyVdq1C3WVXNbE2RgUOphuqVXH3T8DAFTcPgRQEEuLAAAAAElFTkSuQmCC";else if(n===2)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAJKSURBVHjanJJfSJNhFMaf9/02R9MFCVZLUOgfpLMCmwrd7KIIm6X4fXoTY1oXltaN86oEi4xodtNNeNMHJZQ0gpDQmUKEyUAiyKCFW4PNtSFMoyKJSp4uputbJIUX5+K855zfe85zDkhiza4u2+HXn4M64dcBvw5BTotLtyDJ49KvI2fapK/Q/8qkwAjYiEHj4rrBG+ft4p+AB51f8pKazxxDY/djhLYj95bJLKG5fR+w5whUVxNUtR6qOiHUrmABNH3AkgcoqsBM11O56gvVUy2GV6CQNA/WjFdkMpnyhYV0NjZOAf6ksQMZCGQL3e526fUWm0kKrlAJRT7CUXeac+Gp3bRTaJpHXsReoLl3yGQAKPUtlaJh8yHxKI0s+C3xLHHXwjIqlbXtTKc/lKTScaRSFItMAWReB4WtdfdMJCVJTI18xihLNzFCyWXC4WxjMpksjiOK5BytjXIGUH0XCowjkFsESeF27BQLSy9F/2FK0ip6wa2VtV7OxxNF8XgciUQCKpMCZFoaRdQ6PXIHshvQDtACUJDARA/tVTVe6rHrSs97mMPh16j3vQECvpKc4iSLWzrGqXWMrahnx6h1jP5oPRf8Ho1FLA5nG/c7vayq8TIajdoikRi0nqCEdn9gDaCQLNVOXZOuk310nbhCV0Mvhx+OWlbhykGnh+Hou20sy2rUdLtbAJxUfs9PwW9PQM4qjuqjfDEd6ssX+VP56kdZ/+s80H9nZJcBYDxT6x8b+vspDw4Fbf+TuC7gpn7ZtoFCSdJE0vxrAN8Jcr/DWZzEAAAAAElFTkSuQmCC";else if(n===3)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMuSURBVHjaZJN/aNR1GMefz+f7/d6P3aZGDGVKERLDbXdMJAQhlr+ujWo62g5DpUBiEyJjpxi0ZRtyDSQvV0cDd2uw213b1EHiFjbGZq5bIbc5dTuyybRyK+ZCDrG0evWHdwfWHx8+PDwPz/vzeb2fR451DGvpQB2ODJvnP24zDkewD7Zct6h9qD1j4TzPWNgsip80isbCxuS7vzinGm5aZwcwbwVPGoAhgAIEsAAN2NKxSscmYKRvE1iRPrY3Vt7Ski4WQKaJOmbjyF3WS//3jfr4hVXGEA55J5aXc+ZMdF0yOZWbFtCAKtx5zCUQLQBk32svPFJ8eHN16u+fCn6fv+MErKWlRWdvPzr9QpUVnIroxravlYz0tTvWdi9XRFGA6ugKOMPh7qHu7u5Ue3s7ra2tBIMnaG4+Sl1dHTU1NZSXl7P42x39zRxKYl82mYD8Q0wA8bjFmv855Xqzdu/swsICDx78xfz8r0xMXKa+/iBer5fx8W+PDi22PjH43pKSoi2bzIS+reVlUYCVn18q11hl9vb2GIFAgFQqxczMDKFQCK/Xy8WLF4ozkN2e00o8O07YA1KpxCUCyKYSUX1fxDQgc3NzRjAY/DMej+Pz+ejpiTkzAAEpqfpEJHeP2PZJXO32VBsbKryydY3IPZB1a3IVIH6/n1AoREVFBWmQjzknK7aLHm4bWXs5cel48uq0ziQGolE9e/uG8vsPceDttygrK8s2cBfkZ9zQ8syGbeaVyQmp3v8VNXWDvFo3SPX+8/hqzxEPjqiD9X5eqqoiN8fFjzeu5wHidh9xZTjIgZr1BqAaWi6Zm3e8z/OVDZS90kBv74AdUH7/IbZu3oJps0h8N7N62IXpLt2VnVbZWfKc+jTx+aM/3bti85RuZ3RsvBjQxFgWO9VnTSebzB+SMyvhtMMTFsv9+l4r26Czq0sxcV9F+3eprnOJwumr14ozpMMfnLV/duQjPdeDmiTiaGrutLs3Nhjujc86sxD/uHs/DxCPjFrbXly0N7ZEbR9GcPb0jz4NS/q/1P/nwlOFlYpOrZ4UkeUiOt8nRk6xyGNzT3YXTGBZeqEcgP53ACxeTBjELwuFAAAAAElFTkSuQmCC";else if(n===4)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMNSURBVHjalJNfaFt1FMfP796bm9hublCwa93AVd3W5d67ddisFFw1lovUl7r0jx2rWWW6prpCkzfrUwjVFx0LwSrYPtiO0YJPDsuwIOJKq1PL0q43iZ3OuUp04p8owmbl40PXMgaCPnzhcPjCOef7PV8BxD6WETrKjXcviUbjTlW870/ta9mqfiqv1kuRQePjk68pkj4FSfX66HRA8ujfDPapvveWN4n1xKAC5H9CB3SRo767m9uhvRxQUGXAEXOt3uCodViWpT4Yi+tC1Rrhj99/luV8QQ43unrkxWaNVSqvXSNgHSeQSqU2A4Zt2xUdHR3bp6amwp8uTNU91jRgij2PAWg1da+sTwmeGTv768TExN8jIyOk0xlOnTpNMpkiFovR3t6O67rcuPHDJkCtr6U7zVH/gffPKrwravLzC75EIkGxWOTWrVWKxR+Zn79EPB7HdV3m5uYaAK12/xfmxm0P1uwW62D36p77nzdXVr4Txwn5h4aGVkqlEp6XJ5PJ4LouMzMzDYAGiPXkGwGJLGIAyqmPYod6sEM9vziRF0xALMvS0+n0zdnZWTo7O5mcnNwHaNevi27bqN0v+w1pWyj5AOUEjygn1I3VeLzaund/xfj4uAASi8WWM5kMLS0tAAYgV69+K5cvvyq/zZ7TpG1hzZaqbZbsDR3DPnSi2n6ka0uhUJB8Pt+QSCTo7++nqamJ204YXV1PG5aF2nFxUgn7PlGAWIefVXYoihVufcBWorLZrOTz+YMDAwN/tba2UlZWRi6Xq7itmQbb9JnU25qMvvmRAKrmoafEqY/edOqf2bljV/iebDYrgPT29q6Ew2FM06RQKFQMDw+L4ziabaP3nXwpIBy9oACVnBblHOh52N4Vqaxr7jYAFQwGty4uLm72PE/3PK8yt+QZuawnjgSN0TOiDj36nCmP9364pjiY1hJ67RX8F5dMBUjtW7Xav+Xh3PRnIiK6CF/qd/66886YHvW3Sfh8lQHfy11Z2MCegBgioknbCZQTPr1l71di/IcUqjsgLfHzvn8GACNDKumTxWELAAAAAElFTkSuQmCC";else if(n===5)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANBSURBVHjaXJNfSGR1HMXP73fvdcYdo7Vy1KRlZ9DdnOvv5uTODK0s1mxDyKIYSRYoUwQikkgzPUS0RuW6QRCEuIiM/XuxNdiH6m17WnZFCMSHtjuOszONf0ZnGgW1iLbw9DBl0sPhy3k5HDjfD0h6w/VvSJJC8a5sOPeUYQ1TIjAuPOc+kN6Kae2JthodGBCVrSEdpmXAd8pJUrb2julgiWgJ9MMXABIXYADApQA0ACLc8Jjg9bAkKbhbD5LimDTgNQn15sc6SZD1onyPZIAUSyQOSS124oLzDxL7hwRJjaTIFbYcUJ5xB0lYp29oZ8+OypZnPhfvkXiHdGz8nHHs7++6e+vede6UiiiVio69vR2v1+2S5slqQRJ4XvdXkBS7O+uuUv43bO79UvPZp4nfr8/N/Tk7O8urVz9cu3x5zH6x76Xvuru7f+zq6joIhUKFYrHYSBJA4yVBUm5sbWPm15nqH1bvOpRScnBwcL1QKPD+/b+4vV3k0tIy4/E4I5EIFxcXu0nKckDwWUlSV6peqGCUW/mvJUmoNr82MTHBg4MD2rbNqakpRiIR3r59a5ykzOc3QBJob5txkZSbuQ00h/q5ub7htZSJ9NYmlDLF5OQkFxYW2NfXx/n5+YskhWk2G0p9IV5BXgDBAZ1k5Z07tx6wAlHmcjlHjrUim13D8vIaYrEYr12bZmdnJ0k6ygvVHi0GOD2SpHGPhApGmclkKjKZ15HJpHHzJrV4PM6RkRF2dHQwm83WeTweMTw8cCwA1YKkUwWjVMEofaFXeS99w1CksKwWIxaLsaenh1VVVUyn0yf8fmBoKCpIoqeBAr3n50DywdXVlWorEGUqufp0imnpM8eEaZpaPB5nOBymrutMpVKuM2dGdQvjGh+icfFxCCA0YJB0tKC9Mpn8qTKZhLSS0BOJUWmaprBtu8K2bW1lZeVR27alUq3SwpDBh2t1fAUN/eepkYfCOvW26/grWxNB6XukvYJJwgKE+c1zUs270TQdkmq4WeKtTwS+hETiCgUJafrb/89CWTU9/8JT9k2UnP7HN1Ag+OQV8Ps6Yb78vigj/a08ahGCaGzql/zIrbmhy/9IzAmSztMvzJz8ewAvdf7cUVI5hQAAAABJRU5ErkJggg==";else if(n===6)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAABy0lEQVR42pyST2gTQRTGv9nEpCnqTasHES8VLCioiFDIYYum+I/ebFXQm1BbsdSDhKgoXhS8tLQSqAhexIInETwJIqJiexJEZXupwRJNbRsy2Z3dzHxesjGEChs/eMx7A+837817giQAYCD3cZuScqG8Wtj19tG5n/iHhBAkKcLYCh3fdSd04HXCq5xHG2oAdOAdNIG3qAJ5tW1A/9hrm8ZsV+7vDLTe2nsmP9AWwATuXe27330lLwvLkloHY5EBR0dexkB0xxKp9Ieno8MbOjYP1ZRMHz77YE8kAMk35V/fkpWSc6L3dL7Tl6uPAaAm155EAYhwjFHVOsY4AEwPXXkG7W+0EqmCodlRW17oCkrO5Pjc55lon7i2mBqenc7ETTmLFWdvaenLpijJDUBcywsAYFRwu/jja1dMWNfWKf2WEOJ43T8ihLgHACAJkpgZvNQ3kTnJG/u6Z8O7ZgNwAACbzCb5dxNVLPnQW3aKyY7EKABM2XZPcwUk5wG8qIfvSL5qtJAfHLnvF+Z2GsPr2fefipPH0luq5aXsOi3frJ+5xhSm+k/1VErOxRWlqgkrfujO/t191ZqxLeB5azbJeSFELnz9v/agVX8GAIjG5r9I9yjkAAAAAElFTkSuQmCC";else if(n===7)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsSAAALEgHS3X78AAAAGXRFWHRTb2Z0d2FyZQBQYWludC5ORVQgVjMuNS41Tib51gAAAXlJREFUOE9jYACCqRH5a6eGZu6cHl00d2pUwa6J7r4Xe4w1U0ByWMB/DLHJnoHbQIKzI1PEp3r6vKjVU72HQzNIGNOA6W5uYiCZmUHxM+v0Vf836KuHkWQASPGciGznSe6+/+v01Vbh0YzdBeBwiC560GWi+aLVXEccxJ/i6KhNdBjMCM/u7be3+99hpJEK0jTJ01a0y1hjKVEGTHH31e4w1vxSrqP0tVZPbXazodqKSl2VV9W6KnOJMoCAf4mLRpAq/+pTEh4F+79aJSwGxwjJseBZdHCVa/b2/1YR00vJMsAtd+c957T1D42De17iMKARKO4NTUiuQLoLrs694IAT0PbvNrFzNYwDOv9bRc4IwGKIMVQzKCWCsBNcDVDzaafUdbfMwiZNMwnq/mIeNvkgDldsgWo+hqyZ2TVr+0egIRIgQcuomb7G/h3/zaOmaeFxBcJ2l6xtx8xDJ/6wDJ+cYhU2g8vYv/M9yABj//aLOFxRTUbU49YCALt6h216b0oVAAAAAElFTkSuQmCC";else if(n===8)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NCNwAAAKBJREFUOE+l0cENwjAMBdCM0BEYhZG6AjdvwQhMUvXQI0KcKo6IY2/9v0qQnVilFoenJF+2q6RJRP7ihhFuGOGGO851Zg4/9PCGi8oOD+iAzQM8c7bRRTX9pStMmbnGd1Nhwz2vbOD+ATcwteagjPBSZuAVTmBqzUHhnTnkA2wkPmJT2wRKGbLk1avZHUAcwldv/n/hhhFuGOGGEW54nKQVV2qyDejeW7YAAAAASUVORK5CYII=";else if(n===9)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NCNwAAAHpJREFUOE+lz8ENgDAMA8COxEiMkxWYgkmYhCGgllpkUz8aeJyQrVQJJSJ+sWWGLTNsmWHLaq22amkZX2T0MiuB7ASPOMusBIKNh9Evekh4weaTDOfDUDTYdBnTF/AjbOYssxJIf9Q39ouG35DwhS0zbJlhywxbzotyAztMtZGgPPrJAAAAAElFTkSuQmCC";return""},tt}(t.BaseDialog);t._GcFilterDialog=rt})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var r,f,e;n.feature("filter",["core.common","core.stringResource","filter_ui"]);var t=null,i=undefined,u=function(){function r(n){this.range=n;this.reset();this.typeName=""}return r.prototype.filterButtonVisible=function(n,t){var r=this,f=r.sheet,e=r._getStartCol(),o=r._getEndCol(),h,s,u;switch(arguments.length){case 0:for(u=e;u<o;u++)if(h=r.filterButtonVisibleInfo[u],h===!0||h===undefined)return!0;return!1;case 1:if(s=arguments[0],typeof s=="number")return n>=e&&n<o&&r.filterButtonVisibleInfo[n]===i&&(r.filterButtonVisibleInfo[n]=!0),r.filterButtonVisibleInfo[n];else if(typeof s=="boolean"){for(u=e;u<o;u++)r.filterButtonVisibleInfo[u]=s;return f&&f.invalidate(),r}case 2:return n>=e&&n<o&&r.filterButtonVisibleInfo[n]!==t&&(r.filterButtonVisibleInfo[n]=t),f&&f.invalidate(),r}},r.prototype._getStartCol=function(){var t=this,n=t.range;return n.row<0?0:n.col},r.prototype._getEndCol=function(){var t=this,n=t.range,i=t.sheet;return n.row<0?i.getColumnCount():n.col+n.colCount},r.prototype.getShowFilterButton=function(){return this.filterButtonVisible()},r.prototype.setShowFilterButton=function(n){this.filterButtonVisible(n)},r.prototype.addFilterItem=function(r,u){var f=this,o,e;if(u===i||u===t)throw new Error(n.SR.Exp_FilterItemIsNull);if(r<-1||r>=f.sheet.getColumnCount())throw new Error(n.SR.Exp_InvalidColumnIndex);f.range&&((o=f.sheet._getActualRange(f.range),r<o.col||r>=o.col+o.colCount)||(e=f.filterItemMap[r],e||(e=[]),e.push(u),f.filterItemMap[r]=e))},r.prototype.addAverageFilter=function(t,i){if(n.features.conditionalFormat){var r=new n.AverageCondition(i);this.addFilterItem(t,r)}},r.prototype.addBackgroundFilter=function(t,i){if(n.features.conditionalFormat){var r=new n.ColorCondition(0,i);this.addFilterItem(t,r)}},r.prototype.addDateFilter=function(t,i,r){if(n.features.conditionalFormat){var u=new n.DateCondition(i,r);this.addFilterItem(t,u)}},r.prototype.addForegroundFilter=function(t,i){if(n.features.conditionalFormat){var r=new n.ColorCondition(1,i);this.addFilterItem(t,r)}},r.prototype.addNumberFilter=function(t,i,r){if(n.features.conditionalFormat){var u=new n.NumberCondition(i,r);this.addFilterItem(t,u)}},r.prototype.addTextFilter=function(t,i,r){if(n.features.conditionalFormat){var u=new n.TextCondition(i,r);this.addFilterItem(t,u)}},r.prototype.addTop10Filter=function(t,i,r){if(n.features.conditionalFormat){var u=new n.Top10Condition(i,r);this.addFilterItem(t,u)}},r.prototype.removeFilterItems=function(n){var t=this;t.removeFilterItemsInternal(n);t.unfilter(n)},r.prototype.removeFilterItemsInternal=function(n){var i=this;i._removeFilteredItems(n);i.filterItemMap[n]&&i.filterItemMap.splice(n,1,t)},r.prototype.unfilter=function(n){var r=this;r.sheet&&r.sheet._bindToAutoRefresh(function(n){var u,f,e;if(n!==t&&n!==i)r._unfilterColumn(n),r.reFilter();else if(u=r.filteredColumns,u)for(f=u.length-1;f>=0;f--)r._unfilterColumn(u[f]);r.sheet.refreshObjectsAboveSheet();e=r.getFilterArgs(1,n);r.filterHandler&&r.filterHandler(e);r.onFilter(e)})(n)},r.prototype._filterColumn=function(n){var t=this,i,r,f,e,u;if(t._unfilterColumn(n),t.filterItemMap[n]){if(!t.range)return;if(t.range&&t.range.col!==-1&&(n<t.range.col||n>t.range.col+t.range.colCount-1))return;for(i=t.range.row,r=t.range.rowCount,i===-1&&(i=0,r=t.sheet.getRowCount()),f={},f=t._getRowDataCache(n,i,r),e=t._FilterRowsWithTextEquals(i,r,n,f),u=i;u<i+r;u++)t.isRowFilteredOut(u)||t._filterRowByCell(e,u,n,f);t._setColumnFilteredState(n,!0)}},r.prototype._getRowDataCache=function(n,t,i){var h={},s=[],u,c,r,f,o,e;for(s=this._getItemType(n),c=s.length,r=t;r<t+i;r++){for(f={},o=0;o<c;o++){u=s[o];switch(u){case"T":f[u]=this.sheet.getText(r,n);break;case"BC":e=this.sheet.getActualStyle(r,n);e&&(f[u]=e.backColor);break;case"FC":e=this.sheet.getActualStyle(r,n);e&&(f[u]=e.foreColor);break;case"V":f[u]=this.sheet.getValue(r,n);break}}h[r]=f}return h},r.prototype._getItemType=function(t){for(var r,i=[],f=this.filterItemMap[t],e=f.length,u=0;u<e;u++)r=f[u],r.conditionType==="RelationCondition"||r instanceof n.RelationCondition?(r.item1&&(r.item1.conditionType==="TextCondition"||r.item1.conditionType==="TextLengthCondition"?n.ArrayHelper.indexOf(i,"T")===-1&&i.push("T"):r.item1.conditionType==="ColorCondition"?r.item1.compareType===0?n.ArrayHelper.indexOf(i,"BC")===-1&&i.push("BC"):r.item1.compareType===1&&n.ArrayHelper.indexOf(i,"FC")===-1&&i.push("FC"):n.ArrayHelper.indexOf(i,"V")===-1&&i.push("V")),r.item2&&(r.item2.conditionType==="TextCondition"||r.item2.conditionType==="TextLengthCondition"?n.ArrayHelper.indexOf(i,"T")===-1&&i.push("T"):r.item2.conditionType==="ColorCondition"?r.item2.compareType===0?n.ArrayHelper.indexOf(i,"BC")===-1&&i.push("BC"):r.item2.compareType===1&&n.ArrayHelper.indexOf(i,"FC")===-1&&i.push("FC"):n.ArrayHelper.indexOf(i,"V")===-1&&i.push("V"))):r.conditionType==="TextCondition"||r.conditionType==="TextLengthCondition"?n.ArrayHelper.indexOf(i,"T")===-1&&i.push("T"):r.conditionType==="ColorCondition"?r.compareType===0?n.ArrayHelper.indexOf(i,"BC")===-1&&i.push("BC"):r.compareType===1&&n.ArrayHelper.indexOf(i,"FC")===-1&&i.push("FC"):n.ArrayHelper.indexOf(i,"V")===-1&&i.push("V");return i},r.prototype.filter=function(n){var r=this,u=r.sheet;u&&u._bindToAutoRefresh(function(n){var e,f,o;if(n!==t&&n!==i)if(r.filterItemMap[n])r._filterColumn(n);else return;else if(e=r.filterItemMap,e)for(f=0;f<e.length;f++)e[f]&&e[f].length>0&&r._filterColumn(f);u.refreshObjectsAboveSheet();o=r.getFilterArgs(0,n);r.filterHandler&&r.filterHandler(o);r.onFilter(o)})(n)},r.prototype.getFilterArgs=function(n,t){var f=this,o=f.sheet,u=f.range,s=[],h=[],r,e,i,c;if(u)for(r=u.row,e=u.rowCount,r===-1&&(r=0,e=o.getRowCount()),i=r,c=r+e;i<c;i++)f.isRowFilteredOut(i)?h.push(i):s.push(i);return{action:n,sheet:o,range:u,filteredRows:s,filteredOutRows:h,column:t}},r.prototype.onFilter=function(n){},r.prototype.isHideRowFilter=function(){return!1},r.prototype.isFiltered=function(){return this.filteredColumns.length>0},r.prototype.isColumnFiltered=function(t){return n.ArrayHelper.contains(this.filteredColumns,t)},r.prototype.isRowFilteredOut=function(n){var i=this,t,r;return i.isFiltered()?(t=i.range,!t)?!1:t&&t.row!==-1&&(n<t.row||n>t.row+t.rowCount-1)?!1:i.filteredInRowsWithColIndexs&&(r=i.filteredInRowsWithColIndexs[n],r&&r.length>=i.filteredColumns.length)?!1:!0:!1},r.prototype.reset=function(){var n=this;n.unfilter();n.filterItemMap=[];n.filteredColumns=[];n.filteredItems=[];n.filteredInRowsWithColIndexs={};n.filterButtonVisibleInfo={};n.sortInfo=t},r.prototype.isFilterHeader=function(n,t,i){var u=this,f=!1,r;return u.range&&(r=u.sheet._getActualRange(u.range,i),i===1&&n===u.sheet.getRowCount(i)-1&&r.row-1<0?t>=r.col&&t<r.col+r.colCount&&(f=!0):i===3&&n===r.row-1&&t>=r.col&&t<r.col+r.colCount&&(f=!0)),f},r.prototype.isLastFilteredColumn=function(n){var t=this.filteredColumns.length;return t>0?this.filteredColumns[t-1]===n:!1},r.prototype.getFilterItems=function(n){var t=this.filterItemMap[n];return t||(t=[]),t},r.prototype.getFilteredItems=function(){return this.filteredItems},r.prototype.sortColumn=function(n,t){var r=this,i=r.sheet;i&&i._bindToAutoRefresh(function(n,t){var u=i._getActualRange(r.range),e=i.isPaintSuspended(),f;i.isPaintSuspended(!0);f=i.sortRange(u.row,u.col,u.rowCount,u.colCount,!0,[{index:n,ascending:t}]);i.isPaintSuspended(e);f&&(r.sortInfo={index:n,ascending:t},r.isColumnFiltered(n)&&r.reFilter())})(n,t)},r.prototype.getSortState=function(n){var t=0;return this.sortInfo&&this.sortInfo.index===n&&(t=this.sortInfo.ascending?1:2),t},r.prototype.reFilter=function(){var n=this,t,i;if(n.filteredInRowsWithColIndexs={},(n.filteredItems||n.filteredItems.length>0)&&(n.filteredItems.length=0),n.filteredColumns||n.filteredColumns.length>0)for(t=[],t=t.concat(n.filteredColumns),n.filteredColumns.length=0,i=0;i<t.length;i++)n.filter(t[i])},r.prototype.openFilterDialog=function(n){},r.prototype._addFilteredInRowsWithColumnIndex=function(r,u){var f=this.filteredInRowsWithColIndexs[r],e;f===i||f===t?f=[u]:(e=n.ArrayHelper,e.contains(f,u)&&e.remove(f,u),f.push(u));this.filteredInRowsWithColIndexs[r]=f},r.prototype._addFilteredItem=function(t){n.ArrayHelper.contains(this.filteredItems,t)||this.filteredItems.push(t)},r.prototype._unfilterColumn=function(n){var t=this,i=t.sheet,r,u;t.range&&(r=i._getActualRange(t.range),t.isColumnFiltered(n)&&(t._setColumnFilteredState(n,!1),t._removeFilteredInRowsWithColumnIndex(n),t._removeFilteredItems(n)))},r.prototype._setColumnFilteredState=function(t,i){var r=this;if(i){if(r.filteredColumns.length>0)if(r.filteredColumns[r.filteredColumns.length-1]===t)return;else n.ArrayHelper.remove(r.filteredColumns,t);r.filteredColumns.push(t)}else n.ArrayHelper.remove(r.filteredColumns,t)},r.prototype._removeFilteredItems=function(t){var r=this,u,f,i,e;if(r.filterItemMap[t]){for(u=[],f=[],i=0;i<r.filterItemMap.length;i++)i===t?u=u.concat(r.filterItemMap[i]):f=f.concat(r.filterItemMap[i]);for(i=0;i<u.length;i++)e=u[i],n.ArrayHelper.contains(f,e)||n.ArrayHelper.remove(r.filteredItems,e)}},r.prototype._removeFilteredInRowsWithColumnIndex=function(t){var u,r;for(u in this.filteredInRowsWithColIndexs)u&&(r=this.filteredInRowsWithColIndexs[u],r&&n.ArrayHelper.contains(r,t)&&(n.ArrayHelper.remove(r,t),r.length===0&&(this.filteredInRowsWithColIndexs[u]=i)))},r.prototype._FilterRowsWithTextEquals=function(t,i,r,u){for(var o,f,e,v,s=this,c={},l=s.filterItemMap[r],a=[],h=0;h<l.length;h++){if(o=l[h],o instanceof n.TextCondition&&(f=o,f.compareType===0&&f.forceValue2Text===!1&&f.useWildCards===!1&&f.ignoreCase===!1&&f.ignoreBlank===!1)){c[f.expected]=f;continue}a.push(o)}for(e=t;e<t+i;e++)s.isRowFilteredOut(e)||(v=u[e].T,c[v]&&(s._addFilteredInRowsWithColumnIndex(e,r),s._addFilteredItem(o)));return a},r.prototype._filterRowByCell=function(t,i,r,u){for(var f,s,h,e=this,o=0;o<t.length;o++)if(f=t[o],f.conditionType==="RelationCondition"||f instanceof n.RelationCondition?(f.item1&&(s=e._getActualValueFromCache(f.item1,i,r,u),f.item1.conditionType==="Top10Condition"||f.item1 instanceof n.Top10Condition?f.item1.ranges=e._getReviseRanges(r,e.range):(f.item1.conditionType==="AverageCondition"||f.item1 instanceof n.AverageCondition)&&(f.item1.ranges=e._getReviseRanges(r,e.range))),f.item2&&(h=e._getActualValueFromCache(f.item2,i,r,u),f.item2.conditionType==="Top10Condition"||f.item2 instanceof n.Top10Condition?f.item2.ranges=e._getReviseRanges(r,e.range):(f.item2.conditionType==="AverageCondition"||f.item2 instanceof n.AverageCondition)&&(f.item2.ranges=e._getReviseRanges(r,e.range)))):(s=e._getActualValueFromCache(f,i,r,u),f.conditionType==="Top10Condition"||f instanceof n.Top10Condition?f.ranges=e._getReviseRanges(r,e.range):(f.conditionType==="AverageCondition"||f instanceof n.AverageCondition)&&(f.ranges=e._getReviseRanges(r,e.range))),f.evaluate(e.sheet,i,r,s,h)){e._addFilteredInRowsWithColumnIndex(i,r);e._addFilteredItem(f);break}},r.prototype._getActualValueFromCache=function(n,i,r,u){var f=t;return n.conditionType==="TextCondition"||n.conditionType==="TextLengthCondition"?f=u[i].T:n.conditionType==="ColorCondition"?n.compareType===0?f=u[i].BC:n.compareType===1&&(f=u[i].FC):f=u[i].V,f},r.prototype._getReviseRanges=function(t,i){var u=[],r;return i&&(r=this.sheet._getActualRange(i),r.col<=t&&t<r.col+r.colCount&&u.push(new n.Range(r.row,t,r.rowCount,1))),u},r.prototype._getCandindateDataItems=function(n,t){var u=this,o=u.sheet,e=[],s={},f=o._getActualRange(u.range),h,r,i;if(n<f.col||n>f.col+f.colCount-1)return e;for(h=!1,r=f.row;r<f.row+f.rowCount;r++){if(i=o.getText(r,n),i===""){h=!0;continue}s[i]||(u.isRowFilteredOut(r)?!u.isFiltered()||u.isLastFilteredColumn(n)&&u._isRowfilteredOutByColumn(r,n)?(e.push(i),s[i]=!0):o.getRowHeight(r,3)>0&&(e.push(i),s[i]=!0):o.getRowHeight(r,3)>0&&(e.push(i),s[i]=!0))}return h&&t&&(t.hasBlank=!0),e},r.prototype._isRowfilteredOutByColumn=function(t,i){var u=this,f,e,r;return u.filteredColumns.length===0?!1:u.filteredInRowsWithColIndexs?(f=-1,e=n.ArrayHelper.indexOf(u.filteredColumns,i),e>0&&(f=u.filteredColumns[e-1]),r=u.filteredInRowsWithColIndexs[t],f>-1?r&&r.length!==0?f===r[r.length-1]:!1:r&&r.length!==0?!1:!0):!1},r.prototype._addRows=function(t,r){var f=this,c,u,e,s,l,h,a,o,v,y;if(f.range){if(c=f.sheet.getRowCount()-r-1,f.range.row>-1&&(u=f.range,c=u.row+u.rowCount-1,u.row>=t?f._setRangeInternal(new n.Range(u.row+r,u.col,u.rowCount,u.colCount)):u.row<t&&t<u.row+u.rowCount&&f._setRangeInternal(new n.Range(u.row,u.col,u.rowCount+r,u.colCount))),e=f.filteredInRowsWithColIndexs,f.isFiltered()&&e){s=[];for(l in e)e.hasOwnProperty(l)&&s.push(parseInt(l));for(s.sort(),h=0,a=s.length;h<a;h++)o=s[h],o>=t&&o<=c&&(v=e[o],y=o+r,e[y]=v,e[o]=i)}f.reFilter()}},r.prototype._addColumns=function(t,i){var r=this,f,c,o,l,a,h;if(r.range){if(t>=0&&r._isSortted()){for(c=0,o=0;o<i;o++)f=o+t,f<=r._sorttedColumn()&&c++;r._sorttedColumn(r._sorttedColumn()+c)}var e=-1,s=0,u=r.range;for(u.col>-1&&(u.col>=t?(e=r.range.col,r._setRangeInternal(new n.Range(u.row,u.col+i,u.rowCount,u.colCount)),s=r.range.colCount):u.col<t&&t<u.col+u.colCount&&(e=t,s=u.colCount-(t-u.col),r._setRangeInternal(new n.Range(u.row,u.col,u.rowCount,u.colCount+i)))),e<0&&(e=0,s=r.sheet.getColumnCount()-i),f=e+s-1;f>=e;f--)f>=t&&(l=f+i,a=n.ArrayHelper.indexOf(r.filteredColumns,f),a>=0&&(r.filteredColumns[a]=l),h=r.filterItemMap[f],h&&h.length>0&&(n.ArrayHelper.remove(r.filterItemMap,f),r.filterItemMap[l]=h));r.reFilter()}},r.prototype._removeRows=function(r,u){var e=this,c,l,f,s,o,h,a,v;if(e.range){if(c=0,l=e.sheet.getRowCount()+u-1,e.range.row>-1&&(f=e.range,c=f.row,l=f.row+f.rowCount-1,f.row>=r?f.row===r+1?e._setRangeInternal(t):f.row+f.rowCount<=r+u?e._setRangeInternal(t):f.row<r+u?e._setRangeInternal(new n.Range(r,f.col,f.row+f.rowCount-(r+u),f.colCount)):e._setRangeInternal(new n.Range(f.row-u,f.col,f.rowCount,f.colCount)):f.row<r&&r<f.row+f.rowCount&&e._setRangeInternal(new n.Range(f.row,f.col,f.rowCount-Math.min(f.row+f.rowCount-r,u),f.colCount))),s=e.filteredInRowsWithColIndexs,e.isFiltered()&&s)for(o=c;o<=l;o++)if(o<r)continue;else o<r+u?s[o]=i:(h=o,a=s[h],a&&(v=h-u,s[v]=a,s[h]=i));e.reFilter()}},r.prototype._setRangeInternal=function(n){this.range=n},r.prototype._updateRange=function(n){var r=this,s=r.sheet,f=r.range,c,u,a;if(f)if(n){if(!n.equals(f)){var h=f.col,v=f.colCount,e=n.col,y=n.colCount;if((!(h<0)||!(e<0))&&r.isFiltered())for(h<0&&(h=0,v=s.getColumnCount()),e<0&&(e=0,y=s.getColumnCount()),u=0;u<v;u++)c=h+u,e<=c&&c<e+y||r.removeFilterItems(c);var l=f.row,p=f.rowCount,o=n.row,w=n.rowCount;if((!(l<0)||!(o<0))&&r.isFiltered()&&r.filteredInRowsWithColIndexs)for(l<0&&(l=0,p=s.getRowCount()),o<0&&(o=0,w=s.getRowCount()),u=0;u<p;u++)a=l+u,o<=a&&a<o+w||(r.filteredInRowsWithColIndexs[a]=i)}}else r.reset();r._isSortted()&&(n&&n.contains(-1,r._sorttedColumn())||(r.sortInfo=t));r._setRangeInternal(n)},r.prototype._removeColumns=function(i,r){var f=this,o,e,l,a,h;if(f.range){i>=0&&f._isSortted()&&(i<=f._sorttedColumn()&&f._sorttedColumn()<i+r?f._sorttedColumn(-1):f._sorttedColumn()>=i&&f._sorttedColumn(f._sorttedColumn()-r));var u=f.range,s=u.col,c=u.colCount;for(s<0?(s=0,c=f.sheet.getColumnCount()+r):c=f.range.colCount,o=i+r,e=s;e<s+c;e++)e>=i&&(e<o?f.removeFilterItems(e):(l=e-r,a=n.ArrayHelper.indexOf(f.filteredColumns,e),a>=0&&(f.filteredColumns[a]=l),h=f.filterItemMap[e],h&&h.length>0&&(n.ArrayHelper.remove(f.filterItemMap,e),f.filterItemMap[l]=h)));u.col>=0&&(i<u.col?o<=u.col?f._setRangeInternal(new n.Range(u.row,u.col-r,u.rowCount,u.colCount)):o<=u.col+u.colCount?f._setRangeInternal(new n.Range(u.row,i,u.rowCount,u.col+u.colCount-o)):f._setRangeInternal(t):i<u.col+u.colCount&&(o<=u.col+u.colCount?f._setRangeInternal(new n.Range(u.row,u.col,u.rowCount,u.colCount-r)):f._setRangeInternal(new n.Range(u.row,u.col,u.rowCount,i-u.col))));f.reFilter()}},r.prototype._isSortted=function(){var n=this;return n.sortInfo?n.sortInfo.index>-1&&n.getSortState(n.sortInfo.index)!==0:!1},r.prototype._sorttedColumn=function(n){var t=this;return arguments.length===0?t.sortInfo?t.sortInfo.index:-1:(t.sortInfo?t.sortInfo.index=n:t.sortInfo={index:n,ascending:!1},t)},r.prototype._clear=function(t,i,r,u){var f=this,o,e,s;f.range&&(o=new n.Range(t,i,r,u),f.filterButtonVisible()?(e=f.range.row-1,s=f.range.rowCount+1,e<0&&(e=-1,s=-1),o.containsRange(new n.Range(e,f.range.col,s,f.range.colCount))&&f.unfilter()):o.containsRange(f.range)&&f.unfilter())},r.prototype._getConditionTypeDictionary=function(){if(!this._ruleTypeDictionary){var t={};t[0]=n.RelationCondition;t[1]=n.NumberCondition;t[2]=n.TextCondition;t[3]=n.ColorCondition;t[4]=n.FormulaCondition;t[5]=n.DateCondition;t[6]=n.DateExCondition;t[7]=n.TextLengthCondition;t[8]=n.Top10Condition;t[9]=n.UniqueCondition;t[10]=n.AverageCondition;t[11]=n.CellValueCondition;t[12]=n.AreaCondition;this._ruleTypeDictionary=t}return this._ruleTypeDictionary},r.prototype.fromJSON=function(r,u){var e,o,s,w,h,l,a,tt,b,k,d,v,c,y,p,g,nt,it,rt,ut,f;if(r){if(e=this,o=r.range,o&&(e.range=new n.Range(o.row,o.col,o.rowCount,o.colCount)),s=r.filterItemMap,w=e.filterItemMap,n.features.conditionalFormat&&s)for(f=0;f<s.length;f++)if(h=s[f].conditions,h&&h.length!==0)for(l=0;l<h.length;l++)(a=h[l],a)&&(tt=e._getConditionTypeDictionary(),b=tt[a.conType],b&&(k=new b,k.fromJSON(a,u),d=s[f].index,v=w[d],v||(v=w[d]=[]),v.push(k)));if(r.filteredColumns?c=r.filteredColumns:r.filteredColMap&&(c=r.filteredColMap),c)for(f=0;f<c.length;f++)y=c[f],y!==i&&y!==t&&e.filteredColumns.push(y);if(p=r.sortInfo,p&&(e.sortInfo={index:p.index,ascending:p.ascending}),g=r.showFilterButton,g!==i)if(nt=r.filterButtonVisibleInfo,nt!==i)e.filterButtonVisibleInfo=nt;else if(it=e.range,it)for(rt=e._getStartCol(),ut=e._getEndCol(),f=rt;f<ut;f++)e.filterButtonVisibleInfo[f]=g}},r.prototype.toJSON=function(){var i=this,n={},y=i.range,s,f,r,p,e,h,o,c,l,a,u,v,w;for(y&&(n.range=y),s=i.typeName,s&&(n.typeName=s),f=[],r=0,p=0;r<i.filterItemMap.length;r++)if(e=i.filterItemMap[r],e){for(h=[],o=0;o<e.length;o++)c=e[o],h.push(c?c.toJSON():t);f[p++]={index:r,conditions:h}}if(f.length>0&&(n.filterItemMap=f),l=i.filteredColumns,l.length>0&&(n.filteredColumns=l),a=i.sortInfo,a&&(n.sortInfo=a),u=i.filterButtonVisibleInfo,u){n.filterButtonVisibleInfo=u;v=!1;for(w in u)if(u[w]){v=!0;break}n.showFilterButton=v}return n},r.prototype.canDoFilter=function(){return!this.sheet||!this.sheet.isProtected||this.sheet.protectionOption().allowFilter},r}();n.RowFilterBase=u;r=function(t){function i(n){t.call(this,n)}return __extends(i,t),i.prototype.isHideRowFilter=function(){return!0},i.prototype.updateRowVisibleInfo=function(n,t){var u=this.sheet,f,e,o,i,s,r,h;if(u&&u.filterRowsVisibleInfo){for(f=[],o=u.filterRowsVisibleInfo,i=0,s=n.length;i<s;i++)e=o.setRowVisible(n[i],!0),e&&f.push(n[i]);for(r=0,h=t.length;r<h;r++)e=o.setRowVisible(t[r],!1),e&&f.push(t[r]);u.recalcRows(f)}},i.prototype.onFilter=function(n){this.updateRowVisibleInfo(n.filteredRows,n.filteredOutRows);this.sheet&&this.sheet._invalidateVScrollbar()},i.prototype.openFilterDialog=function(t){if(this.canDoFilter()){var i=this.sheet,r=new n._GcFilterDialog(i.parent._getContainerDiv(),i,t);i._filterDialiog=r;r.open()}},i}(u);n.HideRowFilter=r;f=function(){function n(){this.reset()}return n.prototype.getRowVisible=function(n){var u=!0,r=this.rowsVisibleInfo[n];return r!==i&&r!==t&&(u=r),u},n.prototype.setRowVisible=function(n,r){var u=this.rowsVisibleInfo[n];if(u!==i&&u!==t&&r)return delete this.rowsVisibleInfo[n],this.filterOutRowCount--,!0;else if(!r&&r!=u)return this.rowsVisibleInfo[n]=r,this.filterOutRowCount++,!0;return!1},n.prototype.reset=function(){this.rowsVisibleInfo={};this.filterOutRowCount=0},n.prototype.hasFilterOut=function(){return this.filterOutRowCount!==0},n}();n.FilterRowsVisibleInfo=f;e=function(n){function t(t){n.call(this);this._table=t;t&&(this.sheet=t._getSheet())}return __extends(t,n),t.prototype._getStartCol=function(){return 0},t.prototype._getEndCol=function(){return this.range.colCount},t.prototype.table=function(n){if(arguments.length===0)return this._table;this._table=n;n&&(this.sheet=n._getSheet())},t.prototype._addRows=function(t,i){n.prototype._addRows.call(this,t,i);this._table&&this._setRangeInternal(this._table.dataRange())},t.prototype._removeRows=function(t,i){n.prototype._removeRows.call(this,t,i);this._table&&this._setRangeInternal(this._table.dataRange())},t}(r);n._TableFilter=e})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){function i(t,i,r,u){return new n.Range(t,i,r,u)}function o(t){return new n._DateTimeHelper(t)}function e(t){return typeof t=="string"?!1:n.FormatConverter.IsNumber(t)}function s(t){return n._DateTimeHelper.fromOADate(t)}var a,v;n.feature("fill",["core.common","core.globalize","core.stringResource"]);var t=null,r=undefined,l=Math.abs,c=Math.min,u=Math.floor;(function(n){n[n.Direction=0]="Direction";n[n.Linear=1]="Linear";n[n.Growth=2]="Growth";n[n.Date=3]="Date";n[n.Auto=4]="Auto"})(n.FillType||(n.FillType={}));a=n.FillType,function(n){n[n.Day=0]="Day";n[n.Weekday=1]="Weekday";n[n.Month=2]="Month";n[n.Year=3]="Year"}(n.FillDateUnit||(n.FillDateUnit={}));v=n.FillDateUnit;var y=function(){function n(n){this._sheet=n}return n}(),h=function(){function i(n){this._indexes=[];this._innerValues=[];this._type=t;this._startIndex=n===r||n===t?-1:n}return i.prototype.dataCount=function(){return this._innerValues.length},i.prototype.values=function(){var n=this,i,t,r,u;if(n._innerValues.length>0){for(i=[],t=0;t<n._innerValues.length;t++)r=n._innerValues[t],u=n._type==="object"?n.toDateTime(r):r,i.push(u);return i}return[]},i.prototype.indexes2=function(){var r=this,u=r._indexes.length,f,e,i;if(u>0&&n.util.hasCalc()){for(f=r._startIndex,f===-1&&(f=r._indexes[0]),e=new Array(1),e[0]=new Array(u),i=0;i<u;i++)e[0][i]=r._indexes[i]-f+1;return new n.Calc._ConcreteArray(e,u)}return t},i.prototype.values2=function(){var i=this._innerValues.length,r;return i>0&&n.util.hasCalc()?(r=[this._innerValues],new n.Calc._ConcreteArray(r,i)):t},i.prototype.insert=function(i,u,f){if(!e(f))throw new Error(n.SR.Exp_NumberOnly);var o=this;(o._type===r||o._type===t)&&(o._type=f instanceof Date?"date":"number");n.ArrayHelper.insert(o._indexes,i,u);n.ArrayHelper.insert(o._innerValues,i,o.toDouble(f))},i.prototype.add=function(n,i){var u=this;(u._type===r||u._type===t)&&(u._type=i instanceof Date?"date":"number");u._indexes.push(n);u._innerValues.push(u.toDouble(i))},i.prototype.toActualValue=function(n){return this._type==="date"?this.toDateTime(n):n},i.prototype.toDouble=function(t){return n.FormatConverter.ToDouble(t)},i.prototype.toDateTime=function(i){var r=t;if(i instanceof Date)r=i;else if(n.util.hasCalc())try{r=n.Calc.Convert.DT(i)}catch(u){r=i}return r},i}(),f=function(){function i(){}return i.bindStandardFunction=function(i,r,u,f,e,o){return function(i,u,f,e){if(!n.util.hasCalc())return t;var s=n.Calc.Functions.findGlobalFunction(r),h=s.evaluate([u,f,e]),o=h.getValue(0,0);return typeof o=="number"&&o.toString().length>=13?+o.toPrecision(13):o}(u,f,e,o)},i.TREND=function(n,t,r,u){return i.bindStandardFunction(this,"Trend",n,t,r,u)},i.GROWTH=function(n,t,r,u){return i.bindStandardFunction(this,"Growth",n,t,r,u)},i}(),p=function(){function a(n){this._worksheet=n;this._fillCache=new y(n)}return a.prototype.fillLinear=function(n,i,u,f){(u===r||u===t)&&(f===r||f===t)?this.seriesTrendFillRange(n,i,1):this.seriesFillRange(n,i,1,u,f,t)},a.prototype.fillGrowth=function(n,i,u,f){(u===r||u===t)&&(f===r||f===t)?this.seriesTrendFillRange(n,i,2):this.seriesFillRange(n,i,2,u,f,t)},a.prototype.fillDate=function(n,t,i,r,u){this.seriesFillRange(n,t,3,r,u,i)},a.prototype.seriesTrendFillRange=function(t,i,r,u){var s=this,v=s.fixRange(t),l=v.row,a=v.col,y=v.rowCount,p=v.colCount,f,e,o,h,c;if(s._worksheet._getSpanModel().hasSpans(l,a,y,p))throw new Error(n.SR.Exp_RangeContainsMergedCell);if(i===1){for(h=l;h<l+y;h++)if(f=s.getSeriesSource(h,a,1,p,i),f&&f.dataCount()>0&&(e=s.calcSeriesTrendData(f,p,r),e&&e.length>0))for(o=0;o<e.length;o++)if(u)return f.toActualValue(e[o]);else s.copyCell(s._worksheet,h,f._indexes[0],h,a+o,f.toActualValue(e[o]),r)}else if(i===0)for(c=a;c<a+p;c++)if(f=s.getSeriesSource(l,c,y,1,i),f&&f.dataCount()>0&&(e=s.calcSeriesTrendData(f,y,r),e&&e.length>0))for(o=0;o<e.length;o++)if(u)return f.toActualValue(e[o]);else s.copyCell(s._worksheet,f._indexes[0],c,l+o,c,f.toActualValue(e[o]),r)},a.prototype.getSeriesSource=function(n,i,r,u,f){var o=t,s,c,l;if(f===1)for(c=i+u-1;c>=i;)s=this._worksheet.getValue(n,c),e(s)&&(o||(o=new h(i)),o.insert(0,c,s)),c--;else if(f===0)for(l=n+r-1;l>=n;)s=this._worksheet.getValue(l,i),e(s)&&(o||(o=new h(n)),o.insert(0,l,s)),l--;return o},a.prototype.calcSeriesTrendData=function(i,r,u){var o,e;if(i&&i.dataCount()>0&&n.util.hasCalc()&&(u===1||u===2)){for(o=[],i.dataCount()===1&&(u===1?i.add(i._indexes[0]+1,i.toActualValue(i._innerValues[0]+1)):u===2&&i.add(i._indexes[0]+1,i.values()[0])),e=0;e<r;e++)u===1?o.push(f.TREND(this._worksheet,i.values2(),i.indexes2(),e+1)):u===2&&o.push(f.GROWTH(this._worksheet,i.values2(),i.indexes2(),e+1));return o}return t},a.prototype.fillAuto=function(t,i,r){var f=this,a=f._worksheet,e=f.fixRange(t),s=e.row,h=e.col,c=e.rowCount,l=e.colCount,u=f.fixRange(a._eventHandler._dragFillStartRange),o;if(u){if(f._worksheet._getSpanModel().hasPartSpans(u.row,u.col,u.rowCount,u.colCount)||f._worksheet._getSpanModel().hasPartSpans(s,h,c,l))throw new Error(n.SR.Exp_ChangeMergedCell);return o=!0,(s<u.row||h<u.col)&&(o=!1),f.autoFillRange(u,c,l,i,r,o)}},a.prototype.fixRange=function(n){var t=n.row,r=n.col,u=n.rowCount,f=n.colCount;return t===-1&&(t=0,u=this._worksheet.getRowCount()),r===-1&&(r=0,f=this._worksheet.getColumnCount()),i(t,r,u,f)},a.prototype.autoFillRange=function(n,r,f,e,o,s){var v=this,h,c,l,a,y=s?1:-1;if(e===1){if(h=u(f/n.colCount),c=f%n.colCount,h>1&&!o)for(a=1;a<h;a++)l=i(n.row,n.col+a*y*n.colCount,n.rowCount,n.colCount),v.copyRange(n,l,e,4,o);if(o&&h>1&&c===0&&(h=h-1,c=n.colCount),h>0&&c>0)return l=s?i(n.row,n.col+h*n.colCount,n.rowCount,c):i(n.row,n.col-h*n.colCount+n.colCount-c,n.rowCount,c),v.copyRange(n,l,e,4,o,s,t,s?0:n.colCount-c)}else if(e===0){if(h=u(r/n.rowCount),c=r%n.rowCount,h>1&&!o)for(a=1;a<h;a++)l=i(n.row+a*y*n.rowCount,n.col,n.rowCount,n.colCount),v.copyRange(n,l,e,4,o,t,t,t,!0);if(o&&h>1&&c===0&&(h=h-1,c=n.rowCount),h>0&&c>0)return l=s?i(n.row+h*n.rowCount,n.col,c,n.colCount):i(n.row-h*n.rowCount+n.rowCount-c,n.col,c,n.colCount),v.copyRange(n,l,e,4,o,s,s?0:n.rowCount-c,t,!0)}},a.prototype.copyRange=function(n,i,r,u,f,o,s,c,l){var it=this,k=it._worksheet,d,g,p,w,y,b,a,ft,rt,ut,v=t,tt=t,nt;if(r===1)for(d=0;d<n.rowCount;d++){for(v=t,tt=t,w=n.row+d,y=i.row+d,c=c?c:0,g=0;g<n.colCount;){if(p=n.col+g,b=i.col+g-c,a=t,ft=k.getFormula(w,p),ft&&ft!==""||(a=k.getValue(w,p)),u===4&&e(a)&&(v||(v=new h),rt=t,rt=a instanceof Date?"date":"number",tt||(tt=rt),tt===rt)){v.add(p,a);g++;continue}if(a&&v&&v.dataCount()>0){if(nt=it.autoFillRowTrendValues(n,i,w,y,v,f,o,c),f&&nt!==t)return nt;v=t;tt=t;continue}if(ut=k._getSpanModel().find(w,p),ut){if(ut.row===w)if(f){if(b===i.col+i.colCount-1)return a}else b<i.col+i.colCount&&b>=i.col&&it.copyCell(k,w,p,y,b,a,u);g+=ut.colCount}else{if(f){if(o&&b===i.col+i.colCount-1)return a;else if(!o&&b===i.col)return a}else b<i.col+i.colCount&&b>=i.col&&it.copyCell(k,w,p,y,b,a,u);g++}}if(v&&v.dataCount()>0&&(nt=it.autoFillRowTrendValues(n,i,w,y,v,f,o,c),f&&nt!==t))return nt}else if(r===0)for(g=0;g<n.colCount;g++){for(v=t,tt=t,p=n.col+g,b=i.col+g,s=s?s:0,d=0;d<n.rowCount;){if(w=n.row+d,y=i.row+d-s,a=t,ft=k.getFormula(w,p),ft&&ft!==""||(a=k.getValue(w,p)),u===4&&e(a)&&(v||(v=new h),rt=t,rt=a instanceof Date?"date":"number",tt||(tt=rt),tt===rt)){v.add(w,a);d++;continue}if(a&&v&&v.dataCount()>0){if(nt=it.autoFillColumnTrendValues(n,i,p,b,v,f,o,s,l),f&&nt!==t)return nt;v=t;tt=t;continue}if(ut=k._getSpanModel().find(w,p),ut){if(ut.col===p)if(f){if(y===i.row+i.rowCount-1)return a}else y<i.row+i.rowCount&&y>=i.row&&(l&&k.isRowFilterOut(y)||it.copyCell(k,w,p,y,b,a,u));d+=ut.rowCount}else{if(f){if(o&&y===i.row+i.rowCount-1)return a;else if(!o&&y===i.row)return a}else y<i.row+i.rowCount&&y>=i.row&&(l&&k.isRowFilterOut(y)||it.copyCell(k,w,p,y,b,a,u));d++}}if(v&&v.dataCount()>0&&(nt=it.autoFillColumnTrendValues(n,i,p,b,v,f,o,s,l),f&&nt!==t))return nt}return t},a.prototype.autoFillRowTrendValues=function(i,r,u,e,o,s,h,c){var b=this,k=b._worksheet,v,l,y,p,a,w,nt,d,tt,g;if(o&&o.dataCount()>0&&n.util.hasCalc())if(w=(r.col-i.col)/i.colCount,b.isArithmeticProgression(o._indexes,o._innerValues)){for(nt=o.values2(),d=new Array(1),v=o.dataCount(),d[0]=new Array(v),l=0;l<v;l++)d[0][l]=l+1;for(tt=new n.Calc._ConcreteArray(d,v),l=0;l<v;l++)if(y=f.TREND(k,nt,tt,v*w+l+1),p=o._indexes[l],a=p+w*i.colCount,s){if(h&&a===r.col+r.colCount-1)return o.toActualValue(y);else if(!h&&a===r.col)return o.toActualValue(y)}else a<r.col+r.colCount&&a>=r.col&&b.copyCell(k,u,p,e,a,o.toActualValue(y),4)}else for(g=o._indexes[0],v=o._indexes[o.dataCount()-1]-g+1,o.dataCount()===1&&o.add(o._indexes[0]+1,o.toActualValue(o._innerValues[0]+1)),l=0;l<v;l++)if(y=f.TREND(k,o.values2(),o.indexes2(),v*w+l+1),p=g+l,a=p+w*i.colCount,s){if(a===r.col+r.colCount-1)return o.toActualValue(y)}else a<r.col+r.colCount&&a>=r.col&&b.copyCell(k,u,p,e,a,o.toActualValue(y),4);return t},a.prototype.copyCell=function(i,r,u,f,e,o,s){var a,c,l,h;(i.hasFormula(r,u)||i.hasFormula(f,e))&&(i.setFormula(f,e,t),(s===0||s===4)&&(a=i.getFormula(r,u),a&&i._copyFormula(r,u,f,e,1,1)));i.setValue(f,e,o);c=i.getCompositeStyle(r,u);c?(l=new n.Style,l.copyFrom(c),i.setStyleWithoutLocked(f,e,l,3)):i.setStyleWithoutLocked(f,e,t,3);i._getSpanModel().isEmpty()||(i.removeSpan(f,e,3),h=i._getSpanModel().find(r,u),h&&i._addSpanImp(f,e,h.rowCount,h.colCount,3))},a.prototype.autoFillColumnTrendValues=function(i,r,u,e,o,s,h,c,l){var d=this,p=d._worksheet,y,a,w,b,v,k,tt,g,it,nt;if(o&&o.dataCount()>0&&n.util.hasCalc())if(k=(r.row-i.row-c)/i.rowCount,d.isArithmeticProgression(o._indexes,o._innerValues)){for(tt=o.values2(),g=new Array(1),y=o.dataCount(),g[0]=new Array(y),a=0;a<y;a++)g[0][a]=a+1;for(it=new n.Calc._ConcreteArray(g,y),a=0;a<y;a++)if(w=f.TREND(p,tt,it,y*k+a+1),b=o._indexes[a],v=b+k*i.rowCount,s){if(h&&v===r.row+r.rowCount-1||!h&&v===r.row)return o.toActualValue(w)}else v<r.row+r.rowCount&&v>=r.row&&(l&&p.isRowFilterOut(v)||d.copyCell(p,b,u,v,e,o.toActualValue(w),4))}else for(nt=o._indexes[0],y=o._indexes[o.dataCount()-1]-nt+1,o.dataCount()===1&&o.add(o._indexes[0]+1,o.toActualValue(o._innerValues[0]+1)),a=0;a<y;a++)if(w=f.TREND(p,o.values2(),o.indexes2(),y*k+a+1),b=nt+a,v=b+k*i.rowCount,s){if(v+c===r.row+r.rowCount-1)return o.toActualValue(w)}else v<r.row+r.rowCount&&v>=r.row&&(l&&p.isRowFilterOut(v)||d.copyCell(p,nt,u,v,e,o.toActualValue(w),4));return t},a.prototype.isArithmeticProgression=function(n,t){var r,u,f,i;if(n.length!==t.length)return!1;if(r=t.length,r<=1)return!1;else if(r===2)return!0;else{for(u=n[1]-n[0],f=t[1]-t[0],i=2;i<r;i++)if(n[i]-n[i-1]!==u||t[i]-t[i-1]!==f)return!1;return!0}},a.prototype.fillAutobyDirection=function(n,t){var i=this.fixRange(n),r=i.row,u=i.col,f=i.rowCount,e=i.colCount,o=this.getDirectionFillSourceRange(r,u,f,e,t);o&&this.directionFillRange(o,r,u,f,e,t)},a.prototype.directionFillRange=function(t,r,f,e,o,s){var l=this,y=n.SR.Exp_TargetContainsMergedCells,p=n.SR.Exp_MergedCellsIdentical,c,a,v,h;if(s===0){if(l._worksheet._getSpanModel().hasSpans(r,f,e,o-t.colCount))throw new Error(y);if(c=u(o/t.colCount),a=o%t.colCount,a!==0)throw new Error(p);if(c>1)for(h=1;h<c;h++)v=i(t.row,t.col-h*t.colCount,t.rowCount,t.colCount),l.copyRange(t,v,1,0)}else if(s===1){if(l._worksheet._getSpanModel().hasSpans(r,f+t.colCount,e,o-t.colCount))throw new Error(y);if(c=u(o/t.colCount),a=o%t.colCount,a!==0)throw new Error(p);if(c>1)for(h=1;h<c;h++)v=i(t.row,t.col+h*t.colCount,t.rowCount,t.colCount),l.copyRange(t,v,1,0)}else if(s===2){if(l._worksheet._getSpanModel().hasSpans(r,f,e-t.rowCount,o))throw new Error(y);if(c=u(e/t.rowCount),a=e%t.rowCount,a!==0)throw new Error(p);if(c>1)for(h=1;h<c;h++)v=i(t.row-h*t.rowCount,t.col,t.rowCount,t.colCount),l.copyRange(t,v,0,0)}else if(s===3){if(l._worksheet._getSpanModel().hasSpans(r+t.rowCount,f,e-t.rowCount,o))throw new Error(y);if(c=u(e/t.rowCount),a=e%t.rowCount,a!==0)throw new Error(p);if(c>1)for(h=1;h<c;h++)v=i(t.row+h*t.rowCount,t.col,t.rowCount,t.colCount),l.copyRange(t,v,0,0)}},a.prototype.getDirectionFillSourceRange=function(n,r,u,f,e){var o=t;return e===0?o=i(n,r+f-1,u,1):e===1?o=i(n,r,u,1):e===2?o=i(n+u-1,r,1,f):e===3&&(o=i(n,r,1,f)),this.inflateCellRange(o)},a.prototype.inflateCellRange=function(n){var t=this._worksheet.getSpans();return t&&n&&(n=this._worksheet._cellRangeInflate(t,n)),n},a.prototype.seriesFillRange=function(t,i,r,u,f,e){var s=this,p=s.fixRange(t),v=p.row,y=p.col,w=p.rowCount,b=p.colCount,o,h,c,l,a;if(s._worksheet._getSpanModel().hasSpans(v,y,w,b))throw new Error(n.SR.Exp_RangeContainsMergedCell);if(i===1){for(l=v;l<v+w;l++)if(o=s.getSeriesSource(l,y,1,1,i),o&&o.dataCount()>0&&(h=s.calcSeriesData(o,b,r,u,f,e),h&&h.length>0))for(c=0;c<h.length;c++)s.copyCell(s._worksheet,l,o._indexes[0],l,y+c,o.toActualValue(h[c]),r)}else if(i===0)for(a=y;a<y+b;a++)if(o=s.getSeriesSource(v,a,1,1,i),o&&o.dataCount()>0&&(h=s.calcSeriesData(o,w,r,u,f,e),h&&h.length>0))for(c=0;c<h.length;c++)s.copyCell(s._worksheet,o._indexes[0],a,v+c,a,o.toActualValue(h[c]),r)},a.prototype.calcSeriesData=function(n,i,u,f,e,o){var h;if(n&&n.dataCount()>0){var c=[],l=n._innerValues[0],s=l;for(h=0;h<i;h++)(e===r||e===t||s<=e)&&(c.push(s),u===1?s+=f:u===2?s*=f:u===3&&o!==r&&o!==t&&(s=this.getNextDateValue(o,l,s,f,h+1)));return c}return t},a.prototype.getNextDateValue=function(n,t,i,r,f){var h=i,e,a;if(n===0)e=s(i),h=o(e.setDate(e.getDate()+r)).toOADate();else if(n===1){for(e=s(i),a=l(r);a>0;)r>0?e.setDate(e.getDate()+c(1,a)):e.setDate(e.getDate()-c(1,a)),e.getDay()!==6&&e.getDay()!==0&&(a-=1);h=o(e).toOADate()}else n===2?(e=s(t),h=o(e.setMonth(e.getMonth()+u(f*r))).toOADate()):n===3&&(e=s(t),h=o(e.setFullYear(e.getFullYear()+u(f*r))).toOADate());return h},a}();n.FillImp=p})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var r,t,i;n.feature("fill_ui",["core.common","core.sheet_action","core.stringResource"]),function(n){n[n.Tag=0]="Tag";n[n.Down=1]="Down"}(n._FillSmartTag||(n._FillSmartTag={}));r=n._FillSmartTag;t=function(t){function r(i,r,u){t.call(this,i,n.util.getPreferredZIndex(r&&r.parent&&r.parent._host));var f=this;f.eventNameSpace=".ui-fill";f.fillKeyDown="keydown"+f.eventNameSpace;f.sheet=r;f.fillInfo=u;f._initTagDialog()}return __extends(r,t),r.prototype._initTagDialog=function(){var t=this;t.tagContainer=t.getContainer().addClass("smart-tag-default tag-container no-user-select ui-widget-header btn btn-default");t.smartTag=n.GC$(document.createElement("img")).attr("src",r.getImageSrc(0)).css("float","left").appendTo(t.tagContainer);t.smartTagDown=n.GC$(document.createElement("img")).attr("src",r.getImageSrc(1)).css("float","left").css("display","none").appendTo(t.tagContainer)},r.prototype._registerEvent=function(){var t=this,r=n.util.device(),i=n.util.browser.safari&&(r.ipad||r.iphone),u;t.tagContainer.bind("mouseover",function(){var f="ui-state-hover smart-tag-hover",r=t.sheet._isTouchMode,e=r?"38px":"32px",o=r?"24px":"18px",u;t.menuDialog&&(u=t.menuDialog.isOpen(),u)||(n.GC$(this).addClass(f),n.GC$(this).css({width:e,height:o}),i||t.smartTagDown.show())}).bind("mouseout",function(){var f="ui-state-hover smart-tag-hover",r=t.sheet._isTouchMode,e=r?"24px":"18px",o=r?"24px":"18px",u;t.menuDialog&&(u=t.menuDialog.isOpen(),u)||(n.GC$(this).removeClass(f),n.GC$(this).css({width:e,height:o}),i||t.smartTagDown.hide())});u=function(){var r="ui-state-active smart-tag-active",u=t.menuDialog&&t.menuDialog.isOpen();u?(i&&t.smartTagDown.hide(),n.GC$(this).removeClass(r),t._closeMenu()):(i&&t.smartTagDown.show(),n.GC$(this).addClass(r),t._openMenu(),t._initData())};t.tagContainer.bind("click",u);n.GC$(document).bind(t.fillKeyDown,function(i){i.keyCode===27&&(t.menuDialog&&t.menuDialog.isOpen()?t._closeMenu():t.close(),n.util.cancelDefault(i))})},r.prototype.open=function(){var n=this,t=n.sheet,i,r,o;if(n.tagContainer){i=n.fillInfo.x;r=n.fillInfo.y;n.tagContainer.css({left:i,top:r});n.show();n._registerEvent();var u=t._isTouchMode,f=u?"3px":"0px",e=u?"24px":"18px";n.smartTag.css("margin",f);n.smartTagDown.css("height",e);n._reset();o=t.parent}},r.prototype._initData=function(){var i=this.fillInfo.fillType,t;this.menuContainer&&(t=this.menuContainer.find("input[type=radio]").getElement(i),t&&t.checked===!1&&(t.checked=!0,n.GC$(t).trigger("change")))},r.prototype._openMenu=function(){var n=this;n.menuDialog||(n.menuDialog=new i(n.sheet.parent._getContainerDiv(),n.sheet),n.menuContainer=n.menuDialog.getContainer());n.menuDialog.fillType=this.fillInfo.fillType;var t=n.tagContainer,f=t.css("left"),r=t.css("top"),u=parseFloat(r);isNaN(u)||(r=u+t.height()+2);n.menuContainer.css({left:f,top:r});n.menuDialog.show();n.menuDialog._attachEvent();n.menuDialog.smartTagContainer.unbind("fillTypeChanged").bind("fillTypeChanged",function(t,i){n.fillInfo.fillType=i})},r.prototype._closeMenu=function(){this.menuDialog&&(this.menuDialog._dettachEvent(),this.menuDialog.close())},r.prototype._reset=function(){var n=this,t;n.menuDialog&&(t=n.menuDialog.isOpen(),t&&n.tagContainer.trigger("click"),n.tagContainer.trigger("mouseout"))},r.prototype.close=function(){var i=this;i._reset();n.GC$(document).unbind(i.fillKeyDown);t.prototype.close.call(this);i.sheet&&i.sheet.setFocus()},r.getImageSrc=function(n){if(n===0)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFJJREFUeNrclEEKACAIBOfp/Xy7i4WSRnRYBIVRVhFJVIhyEAxllQa5E/wBSnsU6Rza2nugqNmASi57C/KKNg/Iqn+iVWzx6M4bOdUEAAD//wMAAYRMfiNaiqEAAAAASUVORK5CYII=";else if(n===1)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAASCAYAAACXScT7AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAGCSURBVHjafNFPKKRxHAbw5/v7GYdBYUQjLm5SkoNykCQHtcx431/KgdKumJvSrAO7Nwc3RQ5kd3OkHJC/hUJREluonVcToqRh3sRFPA6M1Mbhc3z6Pj1fkMRHQNJL0uPeul731lU37o1y49cqHr8GvvgWQRLBsmpM/P0j4XAXiooKcXl1CZDEzl4EJBEwAZBUwWAQsVgsFSRR11gmM8trimSa3WypzZ31l5v2/vfk/4oAcv9aSGyUSz4gg/AIAOET0YQswIQWaNrnH+2OeSaY0BJN2+wDTi/OpCrwkxX1vW8q63p5cnaaB+Z/09u7x0nFJTVMiEajPsNCQaC6Ryb8THKcw/Tikho6zj//0RGUNV6gMZ1H8fmpH5iTHDlwsiOhO7FrN5RdP6aBIUj/pvJ2bkFbkxAzBzELELNCQQqgrJ5ST1/jqmYOJcHa7dYYGV5TrQ3d+vfUU+b7IfrOIRCGBYD0o1VGmaHaB6DZkqvMD2hUfF1UAISkvE/+yqbCZ89+HgBtwgFOrBUzJgAAAABJRU5ErkJggg==";return""},r}(n.BaseDialog);n._GcFillDialog=t;i=function(t){function i(i,r){t.call(this,i,n.util.getPreferredZIndex(r&&r.parent&&r.parent._host));this.sheet=r;this.init()}return __extends(i,t),i.prototype.init=function(){var t=this;t.itemClass="fill-type-item";t.menuClass="wijspread-fill-menu-container";t.smartTagContainer=n.GC$(".tag-container");t._initMenuDialog()},i.prototype.show=function(){t.prototype.show.call(this)},i.prototype._initMenuDialog=function(){var t=this;t.menuContainer=t.getContainer();t.menuContainer.addClass(t.menuClass);t.copyCells=t._createMenuItem("smartMenuCopyCells",t.itemClass,n.SR.CopyCells,"0",!0).appendTo(t.menuContainer);t.fillSeries=t._createMenuItem("smartMenuFillSeries",t.itemClass,n.SR.FillSeries,"1").appendTo(t.menuContainer);t.fillFormattingOnly=t._createMenuItem("smartMenuFillFormattingOnly",t.itemClass,n.SR.FillFormattingOnly,"2").appendTo(t.menuContainer);t.fillWithoutFormatting=t._createMenuItem("smartMenuFillWithoutFormatting",t.itemClass,n.SR.FillWithoutFormatting,"3").appendTo(t.menuContainer)},i.prototype._createMenuItem=function(t,i,r,u,f){var o=this.sheet._isTouchMode,c=o?"160px":"150px",l=o?"25px":"20px",e=n.GC$(document.createElement("div")).css({display:"block",width:c,height:l,padding:0,margin:0}).addClass("smartMenu-item-default "+i+" ui-state-default btn btn-default"),s=n.GC$(document.createElement("div")).addClass("menu-item-input").appendTo(e),a=n.GC$(document.createElement("div")).addClass("menu-item-text").appendTo(e),h=n.GC$(document.createElement("input")).attr({id:t,value:u,type:"radio",name:"fill-group",style:"display:none"}).appendTo(s),v=n.GC$(document.createElement("span")).text(r).appendTo(a);return f?(s.addClass("check-image ui-icon ui-icon-check"),h.prop("checked","checked")):h.prop("checked",""),e},i.prototype._attachEvent=function(){var t=this,r=n.GC$("."+t.itemClass),i;r.bind("mouseover",function(){var t="ui-state-hover smartMenu-item-hover";n.GC$(this).addClass(t)}).bind("mouseout",function(){var t="ui-state-hover smartMenu-item-hover";n.GC$(this).removeClass(t)}).bind("click",function(){var f="ui-state-hover smartMenu-item-hover",i=n.GC$(this).find("input[type=radio]"),r=i.getElement(0),u;r.checked=!0;i.trigger("change");t.smartTagContainer.trigger("click");t.smartTagContainer.trigger("mouseout");n.GC$(this).removeClass(f);u=parseInt(r.getAttribute("value"),10);t._changeFill(u)});i=t.menuContainer.find("input[type=radio]");i.bind("change",function(){var t="ui-icon ui-icon-check check-image";n.GC$(".menu-item-input").removeClass(t);n.GC$(this).parent().addClass(t)})},i.prototype._dettachEvent=function(){var t=this,r=n.GC$("."+t.itemClass),i;r.unbind("mouseover").unbind("mouseout").unbind("click");i=t.menuContainer.find("input[type=radio]");i.unbind("change")},i.prototype._changeFill=function(t){var i,r;if(this.fillType!==t){this.fillType=t;i=this.sheet;i._skipCloseDragFillSmartTag=!0;i.suspendEvent();try{n.SpreadActions.undo.call(i)}finally{i.resumeEvent()}i._skipCloseDragFillSmartTag=!1;r=new n.UndoRedo.FillUndoAction(i,t,i._eventHandler._currentFillRange);i._doCommand(r);this.smartTagContainer.trigger("fillTypeChanged",t)}},i.prototype.isOpen=function(){return n.GC$("."+this.menuClass).length()>0?!0:!1},i}(n.BaseDialog)})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){var s,f,e,o,h,c,l;t.feature("search",["core.common","core.sheet_ui","core.stringResource"]);var i=null,r=Math.max,u=Math.min;(function(n){n[n.All=0]="All";n[n.HasValue=1]="HasValue";n[n.HasStyle=2]="HasStyle"})(t.EnumeratorOption||(t.EnumeratorOption={}));s=t.EnumeratorOption;f=function(){function f(t,i){if(this.actualEndRow=-1,this.isActualEndRowSet=!1,this.isBlockRange=!1,this.options=1,!t)throw new Error(n.Sheets.SR.Exp_SheetIsNull);var r=this;r.worksheet=t;r.sheetArea=i.sheetArea;r.searchOrder=i.searchOrder;r.rowStart=i.rowStart;r.columnStart=i.columnStart;r.rowEnd=i.rowEnd;r.columnEnd=i.columnEnd;r.findBeginRow=i.findBeginRow;r.findBeginColumn=i.findBeginColumn;r.init();r.block=r.worksheet}return f.prototype.init=function(){this.currentRow=-1;this.currentColumn=-1},f.prototype.moveNext=function(){var n=this;if(n.currentRow===-1&&n.currentColumn===-1&&n.rowStart<=n.rowEnd&&n.columnStart<=n.columnEnd&&(n.currentRow=n.findBeginRow,n.currentColumn=n.findBeginColumn,n.isIndexAcceptable(n.currentRow,n.currentColumn)&&!n.skipCurrent()))return!0;if(n.rowStart<=n.rowEnd&&n.columnStart<=n.columnEnd)while(n.tryMoveNext())if(!n.skipCurrent())return!0;return n.currentRow=-1,n.currentColumn=-1,!1},f.prototype.isIndexAcceptable=function(n,t){var r=this;return(r.options&1)>0&&r.block&&(r.block.getValue(n,t,r.sheetArea)!==i||r.block.getFormula(n,t,r.sheetArea)!==i||r.block.getTag(n,t,r.sheetArea)!==i)?!0:r.options===0},f.prototype.skipCurrent=function(){return!1},f.prototype.tryMoveNext=function(){var n=this,t=n.currentRow,i=n.currentColumn,f=!1,r,u;return(n.options&1)>0&&(r={value:t},u={value:i},n.nextValue(r,u)&&(t=r.value,i=u.value,f=!0)),n.options===1&&(f?(n.currentRow=t,n.currentColumn=i):(n.currentRow=-1,n.currentColumn=-1)),!(n.currentRow===-1&&n.currentColumn===-1)},f.prototype.nextValue=function(n,t){while(this.next(n,t))if(this.isIndexAcceptable(n.value,t.value))return!0;return!1},f.prototype.nextZOrder=function(n,t,i){var r=this,e,u,f;if(n){if(e=r.getNextNonEmptyColumnInRow(n,t.value,i.value+1),e!==-1&&(i.value=e,r.isZOrderOver(t.value,i.value)))return!0;do if(u=n.nextNonNullRow(t.value),u===-1||u>r.rowEnd?t.value=-1:(u!==-1&&(t.value=u),u!==-1&&u<t.value&&(t.value=u)),t.value!==-1){i.value=t.value===r.rowStart||r.isBlockRange?r.columnStart-1:-1;do if(f=r.getNextNonEmptyColumnInRow(n,t.value,i.value+1),f===-1||f>r.columnEnd?i.value=-1:(f!==-1&&(i.value=f),f!==-1&&f<i.value&&(i.value=f)),i.value!==-1)return r.isZOrderOver(t.value,i.value);while(i.value!==-1)}while(t.value!==-1)}return!1},f.prototype.getNextNonEmptyColumnInRow=function(n,t,r){for(var u=r;u<=this.columnEnd;u++)if(n.getValue(t,u)!==i)return u;return-1},f.prototype.isZOrderOver=function(n,t){var i=this;if(i.isBlockRange)return n>=i.rowStart&&n<=i.getActualEndRow()&&t>=i.columnStart&&t<=i.actualEndColumn();else if(n>i.getActualEndRow()||n===i.getActualEndRow()&&(t<0||t>i.actualEndColumn())||n<i.rowStart||n===i.rowStart&&t<i.columnStart)return!1;return!0},f.prototype.getActualEndRow=function(){var n=this,t,i,f;return n.isActualEndRowSet?n.actualEndRow:(t=-1,i=!1,(n.options&1)>0&&n.block&&(f=n.block.getRowCount(n.sheetArea)-1,t=r(t,f),i=!0),t=i?u(t,n.rowEnd):n.rowEnd,n.actualEndRow=t,n.isActualEndRowSet=!0,n.actualEndRow)},f.prototype.actualEndColumn=function(){return this.columnEnd},f.prototype.next=function(n,t){var i=this,r,u;if(i.searchOrder===0)return r=i.getActualEndColumnZOrder(n.value),t.value+1<=r?(t.value+=1,i.isZOrderOver(n.value,t.value)):n.value+1<=i.getActualEndRow()?(n.value+=1,t.value=i.isBlockRange?i.columnStart:0,i.isZOrderOver(n.value,t.value)):!1;else if(i.searchOrder===1)return u=i.getActualEndRowNOrder(t.value),n.value+1<=u?(n.value+=1,i.isNOrderOver(n.value,t.value)):t.value+1<=i.actualEndColumn()?(t.value+=1,n.value=i.isBlockRange?i.rowStart:0,i.isNOrderOver(n.value,t.value)):!1;return!1},f.prototype.getActualEndColumnZOrder=function(n){var t=this,i,f;return n>=t.rowStart&&n<=t.rowEnd?(i=-1,f=!1,(t.options&1)>0&&t.block&&(i=r(i,t.block.getColumnCount(t.sheetArea)-1),f=!0),n===t.rowEnd||t.isBlockRange?f?u(i,t.columnEnd):t.columnEnd:f?r(i,t.worksheet.getColumnCount(t.sheetArea)-1):t.worksheet.getColumnCount(t.sheetArea)-1):-1},f.prototype.getActualEndRowNOrder=function(n){var t=this,i,f;return n>=t.columnStart&&n<=t.columnEnd?(i=-1,f=!1,(t.options&1)>0&&t.block&&(i=r(i,t.rowEnd),f=!0),n===t.columnEnd||t.isBlockRange?f?u(i,t.rowEnd):t.rowEnd:f?r(i,t.worksheet.getRowCount(t.sheetArea)-1):t.worksheet.getRowCount(t.sheetArea)-1):-1},f.prototype.isNOrderOver=function(n,t){var i=this;if(i.isBlockRange)return n>=i.rowStart&&n<=i.getActualEndRow()&&t>=i.columnStart&&t<=i.actualEndColumn();else if(t>i.actualEndColumn()||t===i.actualEndColumn()&&(n<0||n>i.getActualEndRow())||t<i.columnStart||t===i.columnStart&&n<i.rowStart)return!1;return!0},f.prototype.current=function(){var n=this;return 0<=n.currentRow&&n.currentRow<n.worksheet.getRowCount(n.sheetArea)&&0<=n.currentColumn&&n.currentColumn<n.worksheet.getColumnCount(n.sheetArea)?new t.Cell(n.worksheet,n.currentRow,n.currentColumn,n.sheetArea):i},f}();t.CellsEnumerator=f;e=function(){function n(){var n=this;n.startSheetIndex=-1;n.endSheetIndex=-1;n.searchString=i;n.searchFlags=0;n.searchOrder=0;n.searchTarget=1;n.sheetArea=3;n.rowStart=-1;n.columnStart=-1;n.rowEnd=-1;n.columnEnd=-1;n.findBeginRow=-1;n.findBeginColumn=-1}return n}();t.SearchCondition=e;o=function(){function n(){var n=this;n.searchFoundFlag=0;n.foundSheetIndex=-1;n.foundRowIndex=-1;n.foundColumnIndex=-1;n.foundString=i}return n}();t.SearchResult=o,function(n){n[n.None=0]="None";n[n.IgnoreCase=1]="IgnoreCase";n[n.ExactMatch=2]="ExactMatch";n[n.UseWildCards=4]="UseWildCards";n[n.BlockRange=8]="BlockRange"}(t.SearchFlags||(t.SearchFlags={}));h=t.SearchFlags,function(n){n[n.ZOrder=0]="ZOrder";n[n.NOrder=1]="NOrder"}(t.SearchOrder||(t.SearchOrder={}));c=t.SearchOrder,function(n){n[n.None=0]="None";n[n.CellText=1]="CellText";n[n.CellTag=4]="CellTag";n[n.CellFormula=8]="CellFormula"}(t.SearchFoundFlags||(t.SearchFoundFlags={}));l=t.SearchFoundFlags})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){var s,r;n.feature("binding",["core.common"]);var t=null,e=undefined,i="undefined",f="function",o="string",u=function(){function n(n){this._source=n;this.__cellBindingSource__=!0}return n.prototype.setValue=function(n,t){this._source&&n&&r.setValueByPath(this._source,n,t)},n.prototype.getValue=function(n){return this._source&&n?r.getValueByPath(this._source,n):t},n.prototype.getSource=function(){return this._source},n}();n.CellBindingSource=u;s=function(){function s(n){this._init();this._sheet=n}return s.prototype.bind=function(t){var i=this,r=i._dataSource;r&&n.GC$.isFunction(r.dispose)&&r.dispose();i._unSubscribeHandlers(i._dataSourceSubscriptions);i._unSubscribeHandlers(i._dataItemSubscriptions);i._init();i._dataSource=t;t&&(i._dataSourceType=i._getDataSourceType(t),i._dataItemType=i.getDataItemType(),i._sheet&&(t.subscribe&&i._dataSourceSubscriptions.push(t.subscribe(i._dataChangedhandler,i)),t.currentPosition&&t.currentPosition.subscribe&&i._dataSourceSubscriptions.push(t.currentPosition.subscribe(i._currentPositionChangedhandler,i)),i.doDataItemChanged()),i._fields=i._getFieldsInfo())},s.prototype.doDataItemChanged=function(){var r=this,u,e,o;if(r._sheet&&r._dataSource){var s=r._sheet,f=r._dataSource,h=r._dataSourceType;if(f&&n.GC$.getType(window.ko)!==i&&(r._unSubscribeHandlers(r._dataItemSubscriptions),u=t,h===3?(f.currentPosition&&(e=s.getActiveRowIndex(),-1<=e&&e<f.count()&&f.currentPosition(e)),u=f.currentItem()):h===4||(u=f[s.getActiveColumnIndex()]),u))for(o in u)u[o]&&n.GC$.isFunction(u[o].subscribe)&&r._dataItemSubscriptions.push(u[o].subscribe(r._activeDataItemChangedhandler,t,t))}},s.prototype._activeDataItemChangedhandler=function(){this._sheet&&this._sheet.repaint()},s.prototype._unSubscribeHandlers=function(t){var r,i;if(t)for(r in t)i=t[r],i&&n.GC$.isFunction(i.dispose)&&i.dispose()},s.prototype.getRowCount=function(){return this._getDataLength()},s.prototype.getColumnCount=function(){var i,r,t;return this._fields?this._fields.length:(i=this._dataSource,i&&(r=i[0],t=n.GC$.getType(r),t==="null"||t==="string"||t==="number"))?1:0},s.prototype.getSource=function(){return this._dataSource},s.prototype.getFields=function(){return this._fields},s.prototype.getDataItem=function(n){if(!this._dataSource)return t;var r=this._dataSource,i=this._dataSourceType;if(i===1)return r[n];else if(i===4)return t;else if(i===2)return r()[n];else if(i===3)return r.item(n);return t},s.prototype.getDataItemType=function(){var i,t,n;if(!this._dataItemType)for(i=this.getRowCount(),t=0;t<i;t++)if(n=this.getDataItem(t),n){n.entityAspect&&n.entityType&&(this._dataItemType=n.entityType);this._dataItemType=n.constructor;break}return this._dataItemType},s.prototype.getValue=function(u,f){var s=this,c={value:t,hasBinding:!1},b,p,e;if(!s._dataSource)return c;var l=s._sheet,y="function",w="string",a=s._dataSource,v=s._dataSourceType,o,h;if(v!==4){if(u<0||s.getRowCount()<=u||(b=l?l.getColumnCount():s.getColumnCount(),f<0||b<=f))return c;l?(o=l._sheetModelManager.getColInfos()._getItems()[f],o&&(h=o.name)):s._fields&&(h=s._fields[f])}if(v===1){if(e=a[u],typeof e===i||e===t)return c;if(o&&typeof o.value===y)return{value:o.value(e),hasBinding:!0};else if(h)return{value:r.getValueByPath(e,h),hasBinding:!0};else if((n.GC$.getType(e)===w||n.GC$.isNumeric(e))&&f===0)return{value:e,hasBinding:!0}}else if(v===2){if(e=a()[u],typeof e===i||e===t)return c;if(o&&typeof o.value===y)return{value:o.value(e),hasBinding:!0};else if(h)return{value:r.getValueByPath(e,h),hasBinding:!0};else if((n.GC$.getType(e)===w||n.GC$.isNumeric(e))&&f===0)return{value:e,hasBinding:!0}}else if(v===4){if(p=l?l.getBindingPath(u,f):t,p)return{value:a.getValue(p),hasBinding:!0}}else if(v===3){if(e=a.item(u),typeof e===i||e===t)return c;if(o&&typeof o.value===y)return{value:o.value(e),hasBinding:!0};else if(h)return{value:a.getProperty(e,h),hasBinding:!0}}return c},s.prototype.setValue=function(u,e,s){var a=this,k,l,b,h;if(!a._dataSource)return!1;var p=a._sheet,y=a._dataSource,w=a._dataSourceType,d=n._DataSourceType,c,v;if(w!==4){if(u<0||a.getRowCount()<=u||(k=p?p.getColumnCount():a.getColumnCount(),e<0||k<=e))return!1;p?(c=p._sheetModelManager.getColInfos()._getItems()[e],c&&(v=c.name)):a._fields&&(v=a._fields[e])}return l=!1,w===1?(h=y[u],h!==t&&typeof h!==i&&(c&&typeof c.value===f?(c.value(h,s),l=!0):v?(r.setValueByPath(h,v,s),l=!0):(n.GC$.getType(h)===o||n.GC$.isNumeric(h))&&e===0&&(y[u]=s,l=!0))):w===2?(h=y()[u],h!==t&&typeof h!==i&&(c&&typeof c.value===f?(c.value(h,s),l=!0):v?(r.setValueByPath(h,v,s),l=!0):(n.GC$.getType(h)===o||n.GC$.isNumeric(h))&&e===0&&(y()[u]=s,l=!0))):w===4?(b=p?p.getBindingPath(u,e):t,b&&(y.setValue(b,s),l=!0)):w===3&&(h=y.item(u),h!==t&&typeof h!==i&&(c&&typeof c.value===f?(c.value(h,s),l=!0):v&&(y.setProperty(h,v,s),l=!0))),l},s.prototype.addItems=function(n,i){var r=this,f,o;if(r._dataSource&&!(n>r.getRowCount())){var e=r._dataSource,s=r._dataSourceType,u=r.getDataItemType();if(s===3){if(!r._dataViewUpdating){if(r._updatingDataView=!0,u){for(f=0;f<i;f++)o=u.createEntity?u.createEntity():new u,e.add(o);e.commitEdit()}r._updatingDataView=!1}}else if(s!==4)for(f=0;f<i;f++)u?(o=u.createEntity?u.createEntity():new u,e.splice(n,0,o)):e.splice(n,0,t)}},s.prototype.removeItems=function(n,t){var i=this,r=i.getRowCount(),f;if(i._dataSource&&!(n>=r)){var u=i._dataSource,e=i._dataSourceType,o=Math.min(t,r-n);if(e===3){if(!i._dataViewUpdating){for(i._updatingDataView=!0,f=0;f<o;f++)u.remove(u.item(n));i._updatingDataView=!1}}else e===4||n<r&&u.splice(n,o)}},s.isDataViewSource=function(n){var t=window.wijmo;return t&&t.data&&t.data.isDataView&&t.data.isDataView(n)},s.isCellBindingSource=function(n){return u&&n instanceof u||n&&n.hasOwnProperty("__cellBindingSource__")},s.prototype._init=function(){var n=this;n._dataSource=t;n._dataSourceType=0;n._dataItemType=t;n._fields=t;n._dataSourceSubscriptions=[];n._dataItemSubscriptions=[]},s.prototype._getDataSourceType=function(n){if(n){var t=window.ko;if(s.isDataViewSource(n))return 3;else if(t&&t.isObservable(n))return 2;else if(s.isCellBindingSource(n))return 4;else if(n&&!isNaN(n.length))return 1}return 0},s.prototype._getDataLength=function(){var t=this._dataSource,i=this._dataSourceType,n;return t?(n=0,i===1?n=t.length:i===2?n=t().length:i===4||i===3&&(n=t.count()),n):0},s.prototype._getFieldsInfo=function(){var o=this,u=o._dataSource,s=o._dataSourceType,e=0,f=0,r=t,n,i;if(s===1){if(e=u.length,e>0&&(n=o._getProperties(u[0]),n&&n.length>0))for(f=n.length,r=[],i=0;i<f;i++)r.push(n[i])}else if(s===2){if(e=u().length,e>0&&(n=o._getProperties(u()[0]),n&&n.length>0))for(f=n.length,r=[],i=0;i<f;i++)r.push(n[i])}else if(s!==4&&s===3&&(e=u.count(),n=u.getProperties(),n&&n.length>0))for(f=n.length,r=[],i=0;i<f;i++)r.push(n[i].name);return r},s.prototype._getProperties=function(t){var f=window.ko,u=[];for(var r in t)n.GC$.isFunction(t[r])?typeof f!==i&&f.isObservable(t[r])&&u.push(r):u.push(r);return u},s.prototype._dataChangedhandler=function(n){var i=this,r;i._updatingDataView||i._sheet&&(r=i._sheet,r._bindToAutoRefresh(function(n){var e,f,u,o;if(n){if(i._dataViewUpdating=!0,!isNaN(n.length)&&(r._setRowCountInternal(n.length),(i._fields===t||i._fields===undefined)&&r._sheetModelManager.getColInfos()._getItems().length===0&&(i._fields=i._getFieldsInfo(),r.setColumnCount(i.getColumnCount()),e=r._sheetModelManager.getColInfos(),f=i.getFields(),f)))for(u=0,o=f.length;u<o;u++)e._setItem(u,{name:f[u]});i._dataViewUpdating=!1}})(n))},s.prototype._currentPositionChangedhandler=function(n){var i=this,t,r;i._dataSource&&i._sheet&&(t=i._sheet,r=i._dataSource,t._bindToAutoRefresh(function(n){if(r.currentPosition){var i=r.currentPosition();t._activeRowIndex!==i&&t._setActiveCellAndSelection(i,t._activeColIndex,e,e,2)}})(n))},s.prototype.toJSON=function(){var n=this._dataSource,i;return n?(i=this._dataSourceType,i===2?n=n():i===4?n=n.getSource():i===3&&(n=n.local),{type:i,source:n}):t},s.prototype.fromJSON=function(n,t){var i=n&&n.source,f,r;i&&(f=n.type,f===2?(r=window.ko,r&&r.observableArray&&this.bind(r.observableArray(i))):f===4?this.bind(new u(i)):this.bind(i))},s}();n._BindingManager=s;r=function(){function n(){}return n.setValueByPath=function(n,t,r){var f,u;if(n&&t){var e=window.ko,o="function",s=t.split("."),h=s.length;for(f=0;f<h;f++){if(u=s[f],!n)break;f===h-1?typeof n[u]===o?(typeof e===i||!e.isObservable(n[u])||e.isWriteableObservable(n[u]))&&n[u](r):n[u]=r:n=typeof n[u]===o?n[u]():n[u]}}},n.getValueByPath=function(n,r){var u;if(!n||!r)return t;var f=r.split("."),o=f.length,e=0;do if(u=f[e],n=typeof n[u]=="function"?n[u]():n[u],n===t||typeof n===i)return t;while(++e<o);return n},n}();n._BindingHelper=r})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(t){var h,r,o,a,y;t.feature("table",["core.common","core.stringResource"]);var i=null,e=undefined,s=Math.min,c=Math.floor,f="bold 11pt calibri",p="function",u="undefined",l="Column",v=function(){function r(n,t,r,u,f,o){var s=this,s=this,c,l;for(s._name=i,s._row=-1,s._col=-1,s._rowCount=-1,s._colCount=-1,s._style=i,s._showHeader=!0,s._showFooter=!1,s._highlightFirstColumn=!1,s._highlightLastColumn=!1,s._bandRows=!0,s._bandColumns=!1,s._bindingManager=i,s._columns=i,s._rowFilter=i,s._owner=i,s._slicerData=i,n!==e&&(s._name=n),t!==e&&(s._row=t),r!==e&&(s._col=r),u!==e&&(s._rowCount=u),f!==e&&(s._colCount=f),o!==e&&(s._style=o),s._autoGenerateColumns=!0,s._columns=[],c=0;c<s._colCount;c++)l=new h(c+1),s._columns.push(l)}return r.prototype.range=function(){var n=this;return new t.Range(n._row,n._col,n._rowCount,n._colCount)},r.prototype.dataRange=function(){var n=this,r=n._showHeader?n._row+1:n._row,i=n._showHeader?n._rowCount-1:n._rowCount;return n._showFooter&&i--,new t.Range(r,n._col,i,n._colCount)},r.prototype.name=function(n){return arguments.length===0?this._name:(this._name=n,this)},r.prototype.headerIndex=function(){return this._showHeader?this._row:-1},r.prototype.footerIndex=function(){return this._showFooter?this._row+this._rowCount-1:-1},r.prototype.showHeader=function(n){var t=this,r,u,i;return arguments.length===0?t._showHeader:t._showHeader===n?t:(r=t._showHeader=n,r?(t._row>0&&(t._row=t._row-1,t._rowCount=t._rowCount+1),t._syncHeader(),t._getSheet().invalidate()):(u=t._row,t._row=t._row+1,t._rowCount=t._rowCount-1,t._clearSheetRow(u),t._resetFilter()),i=t._getSheet(),i&&i.recalcRange(t._row+(n?0:-1),t._col,1,t._colCount),t)},r.prototype.showFooter=function(n){var t=this,i,r,u;return arguments.length===0?t._showFooter:t._showFooter===n?t:(i=t._getSheet(),r=t._showFooter=n,r?((!i||t._row+t._rowCount<i.getRowCount())&&(t._rowCount=t._rowCount+1),t._syncFooter()):(u=t._row+t._rowCount-1,t._rowCount=t._rowCount-1,t._clearSheetRow(u)),i&&i.recalcRange(t._row+t._rowCount+(n?-1:0),t._col,1,t._colCount),t)},r.prototype.bandRows=function(n){return arguments.length===0?this._bandRows:(this._bandRows=n,this)},r.prototype.bandColumns=function(n){return arguments.length===0?this._bandColumns:(this._bandColumns=n,this)},r.prototype.highlightFirstColumn=function(n){return arguments.length===0?this._highlightFirstColumn:(this._highlightFirstColumn=n,this)},r.prototype.highlightLastColumn=function(n){return arguments.length===0?this._highlightLastColumn:(this._highlightLastColumn=n,this)},r.prototype.style=function(n){return arguments.length===0?this._style:(this._style=n,this)},r.prototype.rowFilter=function(){var n=this;return!n._rowFilter&&t.features.filter&&(n._rowFilter=new t._TableFilter(n),n._rowFilter._updateRange(n.dataRange())),n._rowFilter},r.prototype.autoGenerateColumns=function(n){return arguments.length===0?this._autoGenerateColumns:(this._autoGenerateColumns=n,this)},r.prototype.bindColumns=function(n){var r=this,u,t,i;if(n)for(u=s(r._colCount,n.length),t=0;t<u;t++)i=r._columns[t],i||(i=new h(r._newAutoId()),r._columns[t]=i),i.name(n[t].name()),i.dataField(n[t].dataField())},r.prototype.bindingPath=function(n){var t=this;return arguments.length===0?t._bindingPath:(t._bindingPath=n,t._applyBindingPath(),t)},r.prototype.refresh=function(){},r.prototype.getColumnName=function(n){var u=this._columns,f,r;return u&&0<=n&&n<u.length&&(f=u[n],f)?(r=f.name(),r!==i&&(r=t.util.toString(r)),r):i},r.prototype.setColumnName=function(n,t){var i=this,u,r,e,f;if(i._hasColumnName(t))return i;if(u=i._columns,u&&0<=n&&n<u.length&&(r=u[n],r||(r=i._columns[n]=new h(i._newAutoId())),e=r.name(),r.name(t),i._showHeader&&(f=i._getSheet(),f&&f.setText(i.headerIndex(),i._col+n,t)),i._slicerData))i._slicerData.onColumnNameChanged(e,r.name());return i},r.prototype.getColumnFormula=function(n){var r=this._columns,u,t;return r&&0<=n&&n<r.length&&(u=r[n],u)?(t=u.formula(),t?t.toUpperCase():t):i},r.prototype.setColumnFormula=function(n,t){var i=this,r=i._columns,u,f;return r&&0<=n&&n<r.length&&(t&&t[0]==="="&&(t=t.substring(1)),u=r[n],u&&u.formula(t),i._showFooter&&(f=i._getSheet(),f&&f.setFormula(i.footerIndex(),i._col+n,t))),i},r.prototype.setColumnDataFormula=function(n,t){var i=this._columns,r;return i&&0<=n&&n<i.length&&(t&&t[0]==="="&&(t=t.substring(1)),r=i[n],r&&this._setColumnDataAreaFormulaCore(r,t)),this},r.prototype.getColumnValue=function(n){var t=this,u=t._columns,r,f;return u&&0<=n&&n<u.length&&(r=u[n],r)?t._showFooter&&r.formula()&&(f=t._getSheet(),f)?f.getValue(t.footerIndex(),t._col+n):r.value():i},r.prototype.setColumnValue=function(n,t){var i=this,r=i._columns,u,f;return r&&0<=n&&n<r.length&&(u=r[n],u&&u.value(t),i._showFooter&&(f=i._getSheet(),f&&f.setValue(i.footerIndex(),i._col+n,t))),i},r.prototype.filterButtonVisible=function(n,t){var i=this,e=i._owner.getSheet(),u=i.rowFilter(),r,o,f;if(!(n<0)&&!(n>=i._colCount))switch(arguments.length){case 0:return u.filterButtonVisible();case 1:if(r=arguments[0],typeof r=="number")return u.filterButtonVisible(r);else if(typeof r=="boolean"){for(o=e.isPaintSuspended(),e.isPaintSuspended(!0),f=0;f<i._colCount;f++)u.filterButtonVisible(f,r);return e.isPaintSuspended(o),i}case 2:return u.filterButtonVisible(n,t),i}},r.prototype.getSlicerData=function(){var t=this,i=n.Sheets.TableSlicerData;return!t._slicerData&&i&&(t._slicerData=new i(t)),t._slicerData},r.prototype.hasSlicerData=function(){return this._slicerData?!0:!1},r.prototype._setColumnDataAreaFormulaCore=function(n,t,i){var r,u,s,f;if(typeof i=="undefined"&&(i=!1),i||n.dataAreaFormula()!==t){r=this;n.dataAreaFormula(t);u=r._owner.getSheet();s=!1;u.suspendCalcService();var h=r._getColumnIndex(n)+r._col,e=r._row,o=r._rowCount;for(r.showHeader()&&(e++,o--),r.showFooter()&&o--,f=e;f<e+o;f++)u.setFormula(f,h,t);u.resumeCalcService(!1)}},r.prototype._getColumnIndex=function(n){for(var t=0;t<this._columns.length;t++)if(this._columns[t]===n)return t;return-1},r.prototype._setOwner=function(n){this._owner=n},r.prototype._getSheet=function(){return this._owner?this._owner.getSheet():i},r.prototype._bind=function(n){var t=this,l=t._autoGenerateColumns,e,i,a,u,w,v,o,b,f,s,r,c;if(t._resetFilter(),e=t._getSheet(),e&&(i=t.dataRange(),e.clear(i.row,i.col,i.rowCount,i.colCount,3,17),!l))for(a=t._columns,u=0,w=a.length;u<w;u++)if(v=a[u].dataAreaFormula(),v)for(o=0,b=i.rowCount;o<b;o++)e.setFormula(i.row+o,i.col+u,v);if(l&&(f=t.range(),t._clear(f.row,f.col,f.rowCount,f.colCount)),t._bindingManager=n,n){var y=t._bindingManager,p=y.getRowCount(),k=y.getColumnCount();if(t._showHeader&&p++,t._showFooter&&p++,t._rowCount=p,l)for(t._colCount=k,t._columns=[],s=y.getFields(),r=0;r<t._colCount;r++)c=new h(r+1),t._columns[r]=c,s&&(c.name(s[r]),c.dataField(s[r]))}t._rowFilter&&t._rowFilter._updateRange(t.dataRange())},r.prototype._getDataSourceCol=function(n){var r=this,f=r._bindingManager,i,u,e,t,o;if(f&&(i=f.getFields(),i))for(u=r._columns[n-r.startColumn()],e=u&&u.dataField(),t=0,o=i.length;t<o;t++)if(i[t]===e)return t;return-1},r.prototype.hasBinding=function(){return!!this._bindingManager},r.prototype._getValue=function(n,t){var i=this,r=i._bindingManager,u=n-i.dataRange().row,f;return r&&u<r.getRowCount()&&(f=i._getDataSourceCol(t))>=0?{hasBinding:!0,value:r.getValue(u,f).value}:{hasBinding:!1,value:undefined}},r.prototype._setValue=function(n,t,i){var r=this,s=r._bindingManager,c=n-r.dataRange().row,u,l=!1,h,f,o;return s&&(u=r._getDataSourceCol(t))>=0?(h=r._getSheet(),h&&(f=h._sheetModelManager.getDataModel(),f&&(o=s.getValue(c,u),o.hasBinding&&o.value!==i&&f._updateDirty(n,t,{oldValue:o.value}),f.setValue(n,t,e))),s.setValue(c,u,i),l=!0):u=t-r._col,l},r.prototype._compose=function(n,i,r){var u=this,f=u._style,l,ft,et,ot,st,ht,ct,b,lt,k,at,vt,h,d,y,g,nt,p,c,tt,it,yt;if(f&&(l=u._getSheet(),!l||!(l.getRowHeight(n)<=0))){var pt=u.headerIndex(),wt=u.footerIndex(),bt=u._showHeader?n===u._row+1:n===u._row,w=u._showFooter?n===u._row+u._rowCount-2:n===u._row+u._rowCount-1,s=i===u._col,e=i===u._col+u._colCount-1,rt=u._showHeader?n===pt:n===u._row,ut=u._showFooter?n===wt:n===u._row+u._rowCount-1,a=f.highlightLastColumnStyle(),v=f.highlightFirstColumnStyle();if(pt===n)ft=f.lastHeaderCellStyle(),e&&u._highlightLastColumn&&ft&&ft._compose(r,!0,!0,!0,!0),et=f.firstHeaderCellStyle(),s&&u._highlightFirstColumn&&et&&et._compose(r,!0,!0,!0,!0),ot=f.headerRowStyle(),ot&&ot._compose(r,!0,s,!0,e),e&&u._highlightLastColumn&&a&&a._compose(r,!0,!0,!1,!0),s&&u._highlightFirstColumn&&v&&v._compose(r,!0,!0,!1,!0);else if(wt===n)st=f.lastFooterCellStyle(),e&&u._highlightLastColumn&&st&&st._compose(r,!0,!0,!0,!0),ht=f.firstFooterCellStyle(),s&&u._highlightFirstColumn&&ht&&ht._compose(r,!0,!0,!0,!0),ct=f.footerRowStyle(),ct&&ct._compose(r,!0,s,!0,e),e&&u._highlightLastColumn&&a&&a._compose(r,!1,!0,!0,!0),s&&u._highlightFirstColumn&&v&&v._compose(r,!1,!0,!0,!0);else{if(e&&u._highlightLastColumn&&a&&a._compose(r,rt,!0,ut,!0),s&&u._highlightFirstColumn&&v&&v._compose(r,rt,!0,ut,!0),b=u._showHeader?n-u._row-1:n-u._row,lt=i-u._col,t._CacheMgr._cached&&t._CacheMgr._visibleRowIndexCache){for(k=t._CacheMgr._visibleRowIndexCache,h=u.dataRange().row;k[h]===-1;)h++;if(h>n)return;b=k[n]-k[h]}else if(l){for(at=0,vt=0,h=u.dataRange().row;h<n;h++)l.getRowHeight(h)>0&&at++;for(d=u._col;d<i;d++)l.getColumnWidth(d)>0&&vt++;b=at;lt=vt}if(u.bandRows()&&(y=f.firstRowStripSize(),c=y+f.secondRowStripSize(),c>0)){var o=b%c,kt=f.firstRowStripStyle(),dt=f.secondRowStripStyle();o<y&&kt?(g=o===0,nt=w||o===y-1,kt._compose(r,g,s,nt,e)):o>=y&&dt&&(g=o===y,nt=w||o===c-1,dt._compose(r,g,s,nt,e))}if(u.bandColumns()&&(p=f.firstColumnStripSize(),c=p+f.secondColumnStripSize(),c>0)){var o=lt%c,gt=f.firstColumnStripStyle(),ni=f.secondColumnStripStyle();o<p&>?(tt=o===0,it=e||o===p-1,gt._compose(r,bt,tt,w,it)):o>=p&&ni&&(tt=o===p,it=e||o===c-1,ni._compose(r,bt,tt,w,it))}}yt=f.wholeTableStyle();yt&&yt._compose(r,rt,s,ut,e)}},r.prototype._moveTo=function(n,i){var r=this,e,o,f,u,s;if((n!==r._row||i!==r._col)&&(e=r._getSheet(),e)){if(n<0||e.getRowCount()<n+r._rowCount)throw new Error(t.SR.Exp_TableMoveOutOfRange);if(i<0||e.getColumnCount()<i+r._colCount)throw new Error(t.SR.Exp_TableMoveOutOfRange);if(o=r._owner,o)for(f=o.getTables(),u=0,s=f.length;u<s;u++)if(f[u]===r){f.splice(u,1);r._clearSheetModelFormula();break}e.moveTo(r._row,r._col,n,i,r._rowCount,r._colCount,3);f&&u<=s&&(r._moveToCore(n,i),f.splice(u,0,r),r._syncSheetModelFormula())}},r.prototype._moveToCore=function(n,t){var i=this;i._row=n;i._col=t;i._updateFilter()},r.prototype._clearSheetModelFormula=function(n,t){var r=this,u=r._getSheet(),f,o,s,a;if(u){var l=r._columns,h=r.footerIndex(),v=r.range(),c=r.dataRange();for((n===i||n===e)&&(n=0,t=l.length);n<t;n++)if(f=l[n],o=v.col+n,f&&f.formula()&&h>=0&&(u.setFormula(h,o,i),u.setValue(h,o,i)),f&&f.dataAreaFormula())for(s=0,a=c.rowCount;s<a;s++)u.setFormula(c.row+s,o,i),u.setValue(c.row+s,o,i)}},r.prototype._syncSheetModelFormula=function(){var n=this,u=n._getSheet(),t,h,i,f,r,c;if(u){var e=n._columns,o=n.footerIndex(),l=n.range(),s=n.dataRange();for(t=0,h=e.length;t<h;t++)if(i=e[t],f=l.col+t,i.formula()&&o>=0&&u.setFormula(o,f,i.formula()),i.dataAreaFormula())for(r=0,c=s.rowCount;r<c;r++)u.setFormula(s.row+r,f,i.dataAreaFormula())}},r.prototype._resize=function(n,i){var r=this,et=r.dataRange(),o,rt,a,k,ut,p,d,g,tt,ft;if(!n.equals(r.range())){var it=n.row,w=n.col,e=n.rowCount,b=n.colCount,nt=r._showHeader,l=r._showFooter,v=0,ot=1;if(nt&&(v=v+1),l&&(v=v+1),e<v||b<ot)throw new Error(t.SR.Exp_TableResizeOutOfRange);if(o=r._getSheet(),o&&(it+e>o.getRowCount()||w+b>o.getColumnCount()))throw new Error(t.SR.Exp_TableResizeOutOfRange);if(it!==r._row)throw new Error(t.SR.Exp_TableResizeInvalidRange);if(!n.intersect(r._row,r._col,r._rowCount,r._colCount))throw new Error(t.SR.Exp_TableResizeInvalidRange);var y=r._columns,f=w,s=w+b-1,c=r._col,u=r._col+r._colCount-1;if(r._col=w,r._colCount=b,f<c){for(rt=0,a=f;a<c;a++)k=new h(r._newAutoId()),y.splice(rt++,0,k);nt&&r._syncHeader(f,c-f);l&&r._syncFooter(f,c-f)}else f<=u&&(r._clearSheetModelFormula(c,f),y.splice(0,f-c));if(s>u){for(a=u+1;a<=s;a++)k=new h(r._newAutoId()),y.push(k);nt&&r._syncHeader(u+1,s-u);l&&r._syncFooter(u+1,s-u)}else s>=c&&(r._clearSheetModelFormula(s,u),y.splice(y.length-(u-s),u-s));e!==r._rowCount&&(ut=r._bindingManager,p=r.dataRange(),ut?e>r._rowCount?(d=p.row+p.rowCount,g=e-r._rowCount,o&&o.addRows(d,g),l||(i||r._updateDataSourceOnAddRows(d,g),r._rowCount=e,r._updateFormulaOnAddRows(d,g))):o&&(tt=r._rowCount-e,o.deleteRows(p.row+p.rowCount-tt,tt)):(l&&(r._syncFooter(),ft=r.footerIndex()),r._rowCount=e,l&&(r._syncSheetByFooter(),r._clearSheetRow(ft))));r._updateFilter();r.onTableResized(et,r.dataRange())}},r.prototype.onTableResized=function(n,t){var o=this,i=o._slicerData;if(i){var r=n.row+n.rowCount,u=n.col+n.colCount,f=t.row+t.rowCount,e=t.col+t.colCount;if(f<r)i.onRowsDeleted(t.rowCount,r-f);if(f>r)i.onRowsAdded(n.rowCount,f-r);if(t.col>n.col)i.onColumnsDeleted(0,t.col-n.col);if(e<u)i.onColumnsDeleted(t.colCount,u-e);if(t.col<n.col)i.onColumnsAdded(0,n.col-t.col);if(e>u)i.onColumnsAdded(n.col+n.colCount-t.col,e-u)}},r.prototype._updateFilter=function(){var t=this,n=t._rowFilter;n&&(n._updateRange(t.dataRange()),n.reFilter())},r.prototype._resetFilter=function(){var n=this._rowFilter;n&&(n.unfilter(),n.reset())},r.prototype._hasColumnName=function(n){var r,u;for(n!==i&&(n=t.util.toString(n)),r=0;r<this._colCount;r++)if(u=this.getColumnName(r),n===u)return!0;return!1},r.prototype._getHeaderName=function(n){var u=this,f,o,s,r;return!u._showHeader||!u._columns?i:(f=n-u._col,o=u._columns,0<=f&&f<o.length&&(s=o[f],s))?(r=s.name(),r!==e&&r!==i&&(r=t.util.toString(r)),r):i},r.prototype._setHeaderName=function(n,t){var i=this,f,u,r,c,l,e,o,a,s,h;if(i._showHeader&&i._columns&&(f=n-i._col,u=i._columns,0<=f&&f<u.length&&(r=u[f],r))){for(c=i._getSheet(),c&&(l=c._sheetModelManager.getDataModel(),l&&l._updateDirty(i._row,n,{oldValue:r.name()})),e=r.name(),r.name(t),o=0,a=u.length;o<a;o++)s=u[o],h=s&&s.dataAreaFormula(),h&&h.indexOf(e)>=0&&s.dataAreaFormula(h.replace(new RegExp(e,"g"),r.name()));if(i._slicerData)i._slicerData.onColumnNameChanged(e,r.name())}},r.prototype._setFooterFormula=function(n,t){var i=this,r,u,f;i._showFooter&&i._columns&&(r=n-i._col,u=i._columns,0<=r&&r<u.length&&(f=u[r],f&&f.formula(t)))},r.prototype._setFooterValue=function(n,t){var i=this,u,f,r,s,e,o;i._showFooter&&i._columns&&(u=n-i._col,f=i._columns,0<=u&&u<f.length&&(r=f[u],r&&(s=r.value(),t!==s&&(e=i._getSheet(),e&&(o=e._sheetModelManager.getDataModel(),o&&o._updateDirty(i._row+i._rowCount-1,n,{oldValue:r.value()}))),r.value(t))))},r.prototype._newAutoId=function(){var n;if(!this._columns||this._columns.length===0)return-1;var u=this._columns,i=[],r,t=u.length;for(n=0;n<t;n++)r=u[n],r&&r.isAutoId()&&i.push(r.id());if(i.sort(function(n,t){return n-t}),t=i.length,t>0){for(n=0;n<t;n++)if(i[n]!==n+1)return n+1;return t+1}return 1},r.prototype._syncHeader=function(n,r){var u=this,o,p,f,v,h;if(u._showHeader&&u._columns&&(o=u._getSheet())){var c=u.headerIndex(),l=u._col,y=u._columns,a;(n===e||n===i)&&(n=0);(r===e||r===i)&&(r=y.length);var b=s(y.length,n+r),k=3,w=o._getModel(k);if(w)for(f=n;f<b;f++)a=y[f],a&&(v=u._owner._tableList,h=t.util.inArray(u,v),h>-1&&v.splice(h,1),p=o.getText(c,l+f),h>-1&&v.splice(h,0,u),o.setFormula(c,l+f,i),p?(o._recalcCell(w,c,l+f),a.name(p)):o.setText(c,l+f,a.name()))}},r.prototype._syncFooter=function(n,t){var u=this,o,y,v,l,r;if(u._showFooter&&u._columns&&(o=u._getSheet())){var h=u.footerIndex(),c=u._col,a=u._columns,f;for((n===e||n===i)&&(n=0),(t===e||t===i)&&(t=a.length),y=s(a.length,n+t),r=n;r<y;r++)f=a[r],f&&(v=o.getFormula(h,c+r),v?f.formula(v):o.setFormula(h,c+r,f.formula()),l=o.getValue(h,c+r),l!==e&&l!==i?f.value(l):o.setValue(h,c+r,f.value()))}},r.prototype._clearHeader=function(n,t){var u,r,o,f,h;if(this._showHeader&&this._columns)for(u=this._columns,(n===e||n===i)&&(n=0),(t===e||t===i)&&(t=u.length),o=s(u.length,n+t),f=n;f<o;f++)if(r=u[f],r&&(h=r.name(),r.name(i),this._slicerData))this._slicerData.onColumnNameChanged(h,r.name())},r.prototype._clearDataRange=function(n){var t=this,c=t._getSheet(),f=t.dataRange(),r,u;if(f.containsRange(n)){var e=n.row,o=n.col,s=n.rowCount,h=n.colCount;for(r=0;r<s;r++)for(u=0;u<h;u++)if(t._setValue(e+r,o+u,i),t._slicerData)t._slicerData.onDataChanged(e+r-f.row,o+u-f.col,"")}},r.prototype._clearFooter=function(n,t){var r,u,o,f;if(this._showFooter&&this._columns)for(r=this._columns,(n===e||n===i)&&(n=0),(t===e||t===i)&&(t=r.length),o=s(r.length,n+t),f=n;f<o;f++)u=r[f],u&&(u.formula(i),u.value(i))},r.prototype._syncSheetByFooter=function(){var n=this,i,t;if(n._showFooter&&n._columns&&(i=n._getSheet(),i)){var f=n._columns,o=f.length,r,s=n._col,u,e=n.footerIndex();for(t=0;t<o;t++)r=f[t],r&&(u=s+t,i.setValue(e,u,r.value()),i.setFormula(e,u,r.formula()))}},r.prototype._clearSheetRow=function(n){var t=this._getSheet(),f,e,u,r;if(t&&!(n<0)&&!(t.getRowCount()<=n))for(f=this._col,e=this._colCount,r=0;r<e;r++)u=f+r,t.setFormula(n,u,i),t.setValue(n,u,i)},r.prototype._addRows=function(n,t,i){var r=this,u=!1;if(n>=r._row+r._rowCount)return u;var e=r.dataRange(),f=e.row,o=r.endRow(),c=r._columns,s=r._row,h=r._row+r._rowCount-1;if(n<=s?r._row+=t:n<=h&&(i||(u=r._updateDataSourceOnAddRows(n,t)),r._rowCount+=t,r._updateFormulaOnAddRows(n,t)),n>=f&&n<=o&&r._slicerData)r._slicerData.onRowsAdded(n-f,t);return r._rowFilter&&r._rowFilter._addRows(n,t),u},r.prototype._updateDataSourceOnAddRows=function(n,t){var i=this,r=i._row,u=i._bindingManager;return u?(u.addItems(n-(i.showHeader()?r+1:r),t),!0):!1},r.prototype._updateFormulaOnAddRows=function(n,t){var u=this,o=u._columns,f=u._owner.getSheet(),i,s,e,h,r;for(f.suspendCalcService(),i=0;i<o.length;i++)if(s=o[i],e=s.dataAreaFormula(),e)for(h=i+u._col,r=n;r<n+t;r++)f.setFormula(r,h,e);f.resumeCalcService(!1)},r.prototype._addColumns=function(n,t){var i=this,u,f,r,e;if(!(n>=i._col+i._colCount)){if(u=i._col,n<=i._col)i._col+=t;else if(n<i._col+i._colCount&&(i._colCount+=t,f=i._columns,f))for(r=0;r<t;r++)e=new h(i._newAutoId()),f.splice(n+r-i._col,0,e);if(i._rowFilter&&i._rowFilter._addColumns(n,t),n>=u&&i._slicerData)i._slicerData.onColumnsAdded(n-u,t)}},r.prototype._removeRows=function(n,t,i){var r=this,o=!1,e;if(n>=r._row+r._rowCount)return o;var c=r.dataRange(),h=c.row,l=c.rowCount,u=r._row,f=r._row+r._rowCount-1;if(n<u?n+t>u||(r._row-=t):n===u?r._showHeader||(r._rowCount-=s(f-n+1,t),i||(e=r._bindingManager,e&&(e.removeItems(n-(r.showHeader()?u+1:u),s(f-n+1,t)),o=!0))):n<=f&&(r._rowCount-=s(f-n+1,t),i||(e=r._bindingManager,e&&(e.removeItems(n-(r.showHeader()?u+1:u),s(f-n+1,t)),o=!0)),n===f&&r._showFooter&&(r._showFooter=!1)),r._rowFilter&&r._rowFilter._removeRows(n,t),n>=h&&n<h+l&&r._slicerData)r._slicerData.onRowsDeleted(n-h,t);return o},r.prototype._removeColumns=function(n,t){var i=this,r;if(!(n>=i._col+i._colCount)){var f=i._col,u=i._col,e=i._col+i._colCount-1;if(n<u?n+t<=u?i._col-=t:(i._col=n,i._colCount-=n+t-u,r=i._columns,r&&r.splice(0,n+t-u)):(i._colCount-=s(e-n+1,t),r=i._columns,r&&r.splice(n-u,s(e-n+1,t))),i._rowFilter&&i._rowFilter._removeColumns(n,t),n>=f&&i._slicerData)i._slicerData.onColumnsDeleted(n-f,t)}},r.prototype._clear=function(n,i,r,u){var f=this,o=r,s=u,l=f._getSheet(),w,b,p,c,k,e;l&&(o=l.getRowCount(),s=l.getColumnCount());var h=n<0?0:n,d=i<0?0:i,a=n<0?o:r,g=i<0?s:u,v=new t.Range(h,d,a,g),y=f.headerIndex();f._showHeader&&h<=y&&y<h+a&&(w=new t.Range(y,f._col,1,f._colCount),e=v.getIntersect(w,o,s),e&&f._clearHeader(e.col-f._col,e.colCount));b=f.dataRange();p=v.getIntersect(b,o,s);p&&f._clearDataRange(p);c=f.footerIndex();f._showFooter&&h<=c&&c<h+a&&(k=new t.Range(c,f._col,1,f._colCount),e=v.getIntersect(k,o,s),e&&f._clearFooter(e.col-f._col,e.colCount));f._rowFilter&&f._rowFilter._clear(n,i,r,u)},r.prototype._copy=function(n,t,i,r,u,f){},r.prototype._move=function(n,t,i,r,u,f){},r.prototype._isDefaultValue=function(n,t){switch(n){case"name":return t===i;case"row":return t===-1;case"col":return t===-1;case"rowCount":return t===-1;case"colCount":return t===-1;case"showHeader":return t===!0;case"showFooter":return t===!1;case"highlightFirstColumn":return t===!1;case"highlightLastColumn":return t===!1;case"bandRows":return t===!0;case"bandColumns":return t===!1;case"style":return t===i;case"columns":return t===i;case"rowFilter":return t===i;case"autoGenerateColumns":return t===!0;default:return!1}},r.prototype.toJSON=function(){var n=this,o={name:n._name,row:n._row,col:n._col,rowCount:n._rowCount,colCount:n._colCount,showHeader:n._showHeader,showFooter:n._showFooter,highlightFirstColumn:n._highlightFirstColumn,highlightLastColumn:n._highlightLastColumn,bandRows:n._bandRows,bandColumns:n._bandColumns,style:n._style?n._style.toJSON():i,columns:n._columns,autoGenerateColumns:n._autoGenerateColumns,bindingPath:n._bindingPath,rowFilter:n._rowFilter?n._rowFilter.toJSON():i},u={},r,f;for(r in o)f=o[r],n._isDefaultValue(r,f)||(u[r]=f);return t.GC$.isEmptyObject(u)?e:u},r.prototype.fromJSON=function(n,i){var r,c,l,a,v,f,k,s;if(n){if(r=this,typeof n.name!==u&&(r._name=n.name),typeof n.row!==u&&(r._row=n.row),typeof n.col!==u&&(r._col=n.col),typeof n.rowCount!==u&&(r._rowCount=n.rowCount),typeof n.colCount!==u&&(r._colCount=n.colCount),typeof n.showHeader!==u&&(r._showHeader=n.showHeader),typeof n.showFooter!==u&&(r._showFooter=n.showFooter),typeof n.highlightFirstColumn!==u&&(r._highlightFirstColumn=n.highlightFirstColumn),typeof n.highlightLastColumn!==u&&(r._highlightLastColumn=n.highlightLastColumn),typeof n.bandRows!==u&&(r._bandRows=n.bandRows),typeof n.bandColumns!==u&&(r._bandColumns=n.bandColumns),n.style&&(c=new o,c.fromJSON(n.style,i),r._style=c),typeof n.autoGenerateColumns!==u&&(r._autoGenerateColumns=n.autoGenerateColumns),i?(n.dataSource&&t.features.binding&&(r._bindingManager=new t._BindingManager,r._bindingManager.bind(n.dataSource)),n.dataBinding&&t.features.binding&&(r._bindingManager=new t._BindingManager,r._bindingManager.fromJSON(n.dataBinding,i))):n.bindingPath&&(r._bindingPath=n.bindingPath,l=r._getSheet(),a=l&&l.getDataSource(),t.CellBindingSource&&a instanceof t.CellBindingSource&&(v=t._BindingHelper.getValueByPath(a.getSource(),n.bindingPath),v&&(r._bindingManager=new t._BindingManager,r._bindingManager.bind(v)))),n.columns){var p=n.columns,w=p.length,y=[],e,b;for(f=0;f<w;f++)b=p[f],e=new h(r._newAutoId()),e.fromJSON(b,i),y.push(e);for(r._columns=y,f=0;f<w;f++)e=y[f],e.isAutoId()||e.id(r._newAutoId())}n.rowFilter&&t.features.filter&&(k=n.rowFilter,s=new t._TableFilter,s.table(r),s.fromJSON(k,i),r._rowFilter=s,r._rowFilter.reFilter())}},r.prototype.startRow=function(){return this._row},r.prototype.startColumn=function(){return this._col},r.prototype.endRow=function(){return this._row+this._rowCount-1},r.prototype.endColumn=function(){return this._col+this._colCount-1},r.prototype.hasHeadersRow=function(){return this._showHeader},r.prototype.hasTotalsRow=function(){return this._showFooter},r.prototype.tableName=function(){return this._name},r.prototype.getColumnIndexInTable=function(n){for(var i,t=0;t<this._columns.length;t++)if(i=this._columns[t],i.name()===n||i.name().toString().toLowerCase()===n.toLowerCase())return t;return-1},r.prototype.source=function(){return this._owner.getSheet()._getSheetSource()},r.prototype._applyBindingPath=function(){var u=this,n=u._getSheet(),s,h,c,r,y,v,l;if(n&&(s=u._bindingPath,h=n.getDataSource(),s&&t.CellBindingSource&&h instanceof t.CellBindingSource&&(c=t._BindingHelper.getValueByPath(h.getSource(),s),c))){var e=u.dataRange(),a=e.row,p=e.col,f=e.rowCount,w=e.colCount,o=new t._BindingManager;o.bind(c);r=o.getRowCount();y=o.getColumnCount();try{v=n.isPaintSuspended();n.isPaintSuspended(!0);u._bindingManager=i;r>f?n.addRows(a+f,r-f):r<f&&n.deleteRows(a+r,f-r);u._bind(o);l=n.getCalcService();l&&!l.IsSuspended()&&n.recalcAll()}finally{n.isPaintSuspended(v)}}},r.prototype.clone=function(){var n=new r,t=JSON.stringify(this.toJSON());return n._setOwner(this._owner),n.fromJSON(JSON.parse(t)),n},r.prototype.copyDataSourceImp=function(n){var i=new t._BindingManager;i.bind(n);this._bindingManager=i},r.prototype.copyDataSource=function(n){if(!n.bindingPath()){var t=n._bindingManager;t&&this.copyDataSourceImp(t.getSource())}},r.prototype.resetBindingManager=function(){this._bindingManager=i},r.prototype.getSource=function(){var n=this._bindingManager;return n?n.getSource():i},r.prototype.getSourceRowCount=function(){var n=this._bindingManager;return n?n.getRowCount():0},r.prototype.sort=function(n,t){var u=this,r=u._getSheet(),i=u.dataRange(),f=u.rowFilter(),e;r&&0<=n&&n<i.colCount&&(e=r.isPaintSuspended(),r.isPaintSuspended(!0),r.sortRange(i.row,i.col,i.rowCount,i.colCount,!0,[{index:n+i.col,ascending:t}]),f&&(f.sortInfo={index:n+i.col,ascending:t}),r.isPaintSuspended(e))},r}();t.SheetTable=v;h=function(){function n(n){var t=this;t._id=n;t._name=l+t._id;t._dataField=i;t._fformula=i;t._fvalue=i}return n.prototype.id=function(n){var t=this;return arguments.length===0?t._id:(t._id=n,t._name||(t._name=l+t._id),t)},n.prototype.isAutoId=function(){return this._id>0?!0:!1},n.prototype.name=function(n){var t=this;return arguments.length===0?t._name:(t._name=n||l+t._id,t)},n.prototype.dataField=function(n){return arguments.length===0?this._dataField:(this._dataField=n,this)},n.prototype.value=function(n){return arguments.length===0?this._fvalue:(this._fvalue=n,this)},n.prototype.dataAreaFormula=function(n){return arguments.length===0?this._dataAreaFormula:(this._dataAreaFormula=n,this)},n.prototype.formula=function(n){return arguments.length===0?this._fformula:(this._fformula=n,this)},n.prototype._isDefaultValue=function(n,t){switch(n){case"name":return t===i;case"dataField":return t===i;case"footerFormula":return t===i;case"footerValue":return t===i;default:return!1}},n.prototype.toJSON=function(){var n=this,f={id:n._id,name:n._name,dataField:n._dataField,footerFormula:n._fformula,dataAreaFormula:n._dataAreaFormula,footerValue:n._fvalue},r={},i,u;for(i in f)u=f[i],n._isDefaultValue(i,u)||(r[i]=u);return t.GC$.isEmptyObject(r)?e:r},n.prototype.fromJSON=function(n,t){var i,r,u,f,o,s;n&&(i=this,r=n.id?n.id:n._id,r!==e&&(i._id=r),u=n.name?n.name:n._name,u!==e&&(i._name=u),n.dataField!==e&&(i._dataField=n.dataField),f=t?n.fformula?n.fformula:n._fformula:n.footerFormula,f!==e&&(i._fformula=f),o=n.dataAreaFormula?n.dataAreaFormula:n._dataAreaFormula,o!==e&&(i._dataAreaFormula=o),s=t?n.fvalue?n.fvalue:n._fvalue:n.footerValue,s!==e&&(i._fvalue=s))},n}();t.TableColumnInfo=h;r=function(){function n(n,t,i,r,u,f,e,o,s,h){var c=this;c.backColor=n;c.foreColor=t;c.font=i;c.borderLeft=r;c.borderTop=u;c.borderRight=f;c.borderBottom=e;c.borderHorizontal=o;c.borderVertical=s;c.textDecoration=h}return n.prototype._compose=function(n,t,i,r,f){var e=this;typeof e.backColor!==u&&typeof n.backColor===u&&(n.backColor=e.backColor);typeof e.foreColor!==u&&typeof n.foreColor===u&&(n.foreColor=e.foreColor);typeof e.font!==u&&typeof n.font===u&&(n.font=e.font);i&&typeof e.borderLeft!==u&&typeof n.borderLeft===u&&(n.borderLeft=e.borderLeft);t&&typeof e.borderTop!==u&&typeof n.borderTop===u&&(n.borderTop=e.borderTop);f&&typeof e.borderRight!==u&&typeof n.borderRight===u&&(n.borderRight=e.borderRight);r&&typeof e.borderBottom!==u&&typeof n.borderBottom===u&&(n.borderBottom=e.borderBottom);r||typeof e.borderHorizontal===u||typeof n.borderBottom!==u||(n.borderBottom=e.borderHorizontal);f||typeof e.borderVertical===u||typeof n.borderRight!==u||(n.borderRight=e.borderVertical);typeof e.textDecoration!==u&&typeof n.textDecoration===u&&(n.textDecoration=e.textDecoration)},n.prototype.toJSON=function(){var n=this,u={backColor:n.backColor,foreColor:n.foreColor,font:n.font,borderLeft:n.borderLeft&&n.borderLeft.toJSON(),borderTop:n.borderTop&&n.borderTop.toJSON(),borderRight:n.borderRight&&n.borderRight.toJSON(),borderBottom:n.borderBottom&&n.borderBottom.toJSON(),borderHorizontal:n.borderHorizontal&&n.borderHorizontal.toJSON(),borderVertical:n.borderVertical&&n.borderVertical.toJSON(),textDecoration:n.textDecoration},f={},r,i;for(r in u)i=u[r],i===e||typeof i=="object"&&t.GC$.isEmptyObject(i)||(f[r]=i);return f},n.prototype.fromJSON=function(n,i){var r,f,e,o,s,h,c;n&&(r=this,typeof n.backColor!==u&&(r.backColor=n.backColor),typeof n.foreColor!==u&&(r.foreColor=n.foreColor),typeof n.font!==u&&(r.font=n.font),typeof n.borderLeft!==u&&(f=new t.LineBorder,f.fromJSON(n.borderLeft,i),r.borderLeft=f),typeof n.borderTop!==u&&(e=new t.LineBorder,e.fromJSON(n.borderTop,i),r.borderTop=e),typeof n.borderRight!==u&&(o=new t.LineBorder,o.fromJSON(n.borderRight,i),r.borderRight=o),typeof n.borderBottom!==u&&(s=new t.LineBorder,s.fromJSON(n.borderBottom,i),r.borderBottom=s),typeof n.borderHorizontal!==u&&(h=new t.LineBorder,h.fromJSON(n.borderHorizontal,i),r.borderHorizontal=h),typeof n.borderVertical!==u&&(c=new t.LineBorder,c.fromJSON(n.borderVertical,i),r.borderVertical=c),typeof n.textDecoration!==u&&(r.textDecoration=n.textDecoration))},n}();t.TableStyleInfo=r;o=function(){function n(){this._lastFooterCellStyle=i;this._init()}return n.prototype.name=function(n){return arguments.length===0?this._name:(this._name=n,this)},n.prototype.wholeTableStyle=function(n){return arguments.length===0?this._wholeTableStyle:(this._wholeTableStyle=n,this)},n.prototype.headerRowStyle=function(n){return arguments.length===0?this._headerRowStyle:(this._headerRowStyle=n,this)},n.prototype.footerRowStyle=function(n){return arguments.length===0?this._footerRowStyle:(this._footerRowStyle=n,this)},n.prototype.firstRowStripStyle=function(n){return arguments.length===0?this._firstRowStripStyle:(this._firstRowStripStyle=n,this)},n.prototype.secondRowStripStyle=function(n){return arguments.length===0?this._secondRowStripStyle:(this._secondRowStripStyle=n,this)},n.prototype.firstRowStripSize=function(n){return arguments.length===0?this._firstRowStripSize:(this._firstRowStripSize=n,this)},n.prototype.secondRowStripSize=function(n){return arguments.length===0?this._secondRowStripSize:(this._secondRowStripSize=n,this)},n.prototype.firstColumnStripStyle=function(n){return arguments.length===0?this._firstColumnStripStyle:(this._firstColumnStripStyle=n,this)},n.prototype.secondColumnStripStyle=function(n){return arguments.length===0?this._secondColumnStripStyle:(this._secondColumnStripStyle=n,this)},n.prototype.firstColumnStripSize=function(n){return arguments.length===0?this._firstColumnStripSize:(this._firstColumnStripSize=n,this)},n.prototype.secondColumnStripSize=function(n){return arguments.length===0?this._secondColumnStripSize:(this._secondColumnStripSize=n,this)},n.prototype.highlightFirstColumnStyle=function(n){return arguments.length===0?this._highlightFirstColumnStyle:(this._highlightFirstColumnStyle=n,this)},n.prototype.highlightLastColumnStyle=function(n){return arguments.length===0?this._highlightLastColumnStyle:(this._highlightLastColumnStyle=n,this)},n.prototype.firstHeaderCellStyle=function(n){return arguments.length===0?this._firstHeaderCellStyle:(this._firstHeaderCellStyle=n,this)},n.prototype.lastHeaderCellStyle=function(n){return arguments.length===0?this._lastHeaderCellStyle:(this._lastHeaderCellStyle=n,this)},n.prototype.firstFooterCellStyle=function(n){return arguments.length===0?this._firstFooterCellStyle:(this._firstFooterCellStyle=n,this)},n.prototype.lastFooterCellStyle=function(n){return arguments.length===0?this._lastFooterCellStyle:(this._lastFooterCellStyle=n,this)},n.prototype.buildInName=function(n){return arguments.length===0?this._buildInName:(this._buildInName=n,this)},n.prototype._init=function(){var n=this;n._name=i;n._headerRowStyle=i;n._footerRowStyle=i;n._wholeTableStyle=i;n._highlightLastColumnStyle=i;n._highlightFirstColumnStyle=i;n._firstRowStripStyle=i;n._secondRowStripStyle=i;n._firstColumnStripStyle=i;n._secondColumnStripStyle=i;n._firstHeaderCellStyle=i;n._lastHeaderCellStyle=i;n._firstFooterCellStyle=i;n._lastFooterCellStyle=i;n._firstRowStripSize=1;n._secondRowStripSize=1;n._firstColumnStripSize=1;n._secondColumnStripSize=1},n.prototype._cloneTableStyleInfo=function(n){if(n){var t=new r,u=JSON.stringify(n.toJSON());return t.fromJSON(JSON.parse(u)),t}return i},n.prototype._copyFrom=function(n){var t=this;t._name=n._name;t._headerRowStyle=t._cloneTableStyleInfo(n._headerRowStyle);t._footerRowStyle=t._cloneTableStyleInfo(n._footerRowStyle);t._wholeTableStyle=t._cloneTableStyleInfo(n._wholeTableStyle);t._highlightLastColumnStyle=t._cloneTableStyleInfo(n._highlightLastColumnStyle);t._highlightFirstColumnStyle=t._cloneTableStyleInfo(n._highlightFirstColumnStyle);t._firstRowStripStyle=t._cloneTableStyleInfo(n._firstRowStripStyle);t._secondRowStripStyle=t._cloneTableStyleInfo(n._secondRowStripStyle);t._firstColumnStripStyle=t._cloneTableStyleInfo(n._firstColumnStripStyle);t._secondColumnStripStyle=t._cloneTableStyleInfo(n._secondColumnStripStyle);t._firstHeaderCellStyle=t._cloneTableStyleInfo(n._firstHeaderCellStyle);t._lastHeaderCellStyle=t._cloneTableStyleInfo(n._lastHeaderCellStyle);t._firstFooterCellStyle=t._cloneTableStyleInfo(n._firstFooterCellStyle);t._lastFooterCellStyle=t._cloneTableStyleInfo(n._lastFooterCellStyle);t._firstRowStripSize=n._firstRowStripSize;t._secondRowStripSize=n._secondRowStripSize;t._firstColumnStripSize=n._firstColumnStripSize;t._secondColumnStripSize=n._secondColumnStripSize;t._buildInName=n._buildInName},n.prototype._isDefaultValue=function(n,t){switch(n){case"name":return t===i;case"headerRowStyle":return t===i;case"footerRowStyle":return t===i;case"wholeTableStyle":return t===i;case"highlightLastColumnStyle":return t===i;case"highlightFirstColumnStyle":return t===i;case"firstRowStripStyle":return t===i;case"secondRowStripStyle":return t===i;case"firstColumnStripStyle":return t===i;case"secondColumnStripStyle":return t===i;case"firstHeaderCellStyle":return t===i;case"lastHeaderCellStyle":return t===i;case"firstFooterCellStyle":return t===i;case"lastFooterCellStyle":return t===i;case"firstRowStripSize":return t===1;case"secondRowStripSize":return t===1;case"firstColumnStripSize":return t===1;case"secondColumnStripSize":return t===1;default:return!1}},n.prototype.toJSON=function(){var i=this,r,n,u,f,o;if(i._buildInName)return{buildInName:i._buildInName};r={name:i._name,firstRowStripSize:i._firstRowStripSize,secondRowStripSize:i._secondRowStripSize,firstColumnStripSize:i._firstColumnStripSize,secondColumnStripSize:i._secondColumnStripSize};n=i._headerRowStyle;r.headerRowStyle=n?n.toJSON():n;n=i._footerRowStyle;r.footerRowStyle=n?n.toJSON():n;n=i._wholeTableStyle;r.wholeTableStyle=n?n.toJSON():n;n=i._highlightLastColumnStyle;r.highlightLastColumnStyle=n?n.toJSON():n;n=i._highlightFirstColumnStyle;r.highlightFirstColumnStyle=n?n.toJSON():n;n=i._firstRowStripStyle;r.firstRowStripStyle=n?n.toJSON():n;n=i._secondRowStripStyle;r.secondRowStripStyle=n?n.toJSON():n;n=i._firstColumnStripStyle;r.firstColumnStripStyle=n?n.toJSON():n;n=i._secondColumnStripStyle;r.secondColumnStripStyle=n?n.toJSON():n;n=i._firstHeaderCellStyle;r.firstHeaderCellStyle=n?n.toJSON():n;n=i._lastHeaderCellStyle;r.lastHeaderCellStyle=n?n.toJSON():n;n=i._firstFooterCellStyle;r.firstFooterCellStyle=n?n.toJSON():n;n=i._lastFooterCellStyle;r.lastFooterCellStyle=n?n.toJSON():n;u={};for(f in r)o=r[f],i._isDefaultValue(f,o)||(u[f]=o);return t.GC$.isEmptyObject(u)?e:u},n.prototype.fromJSON=function(n,t){var f,e,o,s,h,c,l,v,y,p,w,b,k,d,g,nt,tt,it,rt,i;if(n){if(f=this,n.buildInName){f._copyFrom(a.getBuildInStyle(n.buildInName));return}e=typeof n.name!==u?n.name:n._name;typeof e!==u&&(f._name=e);o=typeof n.firstRowStripSize!==u?n.firstRowStripSize:n._firstRowStripSize;typeof o!==u&&(f._firstRowStripSize=o);s=typeof n.secondRowStripSize!==u?n.secondRowStripSize:n._secondRowStripSize;typeof s!==u&&(f._secondRowStripSize=s);h=typeof n.firstColumnStripSize!==u?n.firstColumnStripSize:n._firstColumnStripSize;typeof h!==u&&(f._firstColumnStripSize=h);c=typeof n.secondColumnStripSize!==u?n.secondColumnStripSize:n._secondColumnStripSize;typeof c!==u&&(f._secondColumnStripSize=c);l=typeof n.headerRowStyle!==u?n.headerRowStyle:n._headerRowStyle;typeof l!==u&&(i=new r,i.fromJSON(l,t),f._headerRowStyle=i);v=typeof n.footerRowStyle!==u?n.footerRowStyle:n._footerRowStyle;typeof v!==u&&(i=new r,i.fromJSON(v,t),f._footerRowStyle=i);y=typeof n.wholeTableStyle!==u?n.wholeTableStyle:n._wholeTableStyle;typeof y!==u&&(i=new r,i.fromJSON(y,t),f._wholeTableStyle=i);p=typeof n.highlightLastColumnStyle!==u?n.highlightLastColumnStyle:n._highlightLastColumnStyle;typeof p!==u&&(i=new r,i.fromJSON(p,t),f._highlightLastColumnStyle=i);w=typeof n.highlightFirstColumnStyle!==u?n.highlightFirstColumnStyle:n._highlightFirstColumnStyle;typeof w!==u&&(i=new r,i.fromJSON(w,t),f._highlightFirstColumnStyle=i);b=typeof n.firstRowStripStyle!==u?n.firstRowStripStyle:n._firstRowStripStyle;typeof b!==u&&(i=new r,i.fromJSON(b,t),f._firstRowStripStyle=i);k=typeof n.secondRowStripStyle!==u?n.secondRowStripStyle:n._secondRowStripStyle;typeof k!==u&&(i=new r,i.fromJSON(k,t),f._secondRowStripStyle=i);d=typeof n.firstColumnStripStyle!==u?n.firstColumnStripStyle:n._firstColumnStripStyle;typeof d!==u&&(i=new r,i.fromJSON(d,t),f._firstColumnStripStyle=i);g=typeof n.secondColumnStripStyle!==u?n.secondColumnStripStyle:n._secondColumnStripStyle;typeof g!==u&&(i=new r,i.fromJSON(g,t),f._secondColumnStripStyle=i);nt=typeof n.firstHeaderCellStyle!==u?n.firstHeaderCellStyle:n._firstHeaderCellStyle;typeof nt!==u&&(i=new r,i.fromJSON(nt,t),f._firstHeaderCellStyle=i);tt=typeof n.lastHeaderCellStyle!==u?n.lastHeaderCellStyle:n._lastHeaderCellStyle;typeof tt!==u&&(i=new r,i.fromJSON(tt,t),f._lastHeaderCellStyle=i);it=typeof n.firstFooterCellStyle!==u?n.firstFooterCellStyle:n._firstFooterCellStyle;typeof it!==u&&(i=new r,i.fromJSON(it,t),f._firstFooterCellStyle=i);rt=typeof n.lastFooterCellStyle!==u?n.lastFooterCellStyle:n._lastFooterCellStyle;typeof rt!==u&&(i=new r,i.fromJSON(rt,t),f._lastFooterCellStyle=i)}},n}();t.TableStyle=o;a=function(){function n(){}return n.light1=function(){return n._getLightStyle(1)},n.light2=function(){return n._getLightStyle(2)},n.light3=function(){return n._getLightStyle(3)},n.light4=function(){return n._getLightStyle(4)},n.light5=function(){return n._getLightStyle(5)},n.light6=function(){return n._getLightStyle(6)},n.light7=function(){return n._getLightStyle(7)},n.light8=function(){return n._getLightStyle(8)},n.light9=function(){return n._getLightStyle(9)},n.light10=function(){return n._getLightStyle(10)},n.light11=function(){return n._getLightStyle(11)},n.light12=function(){return n._getLightStyle(12)},n.light13=function(){return n._getLightStyle(13)},n.light14=function(){return n._getLightStyle(14)},n.light15=function(){return n._getLightStyle(15)},n.light16=function(){return n._getLightStyle(16)},n.light17=function(){return n._getLightStyle(17)},n.light18=function(){return n._getLightStyle(18)},n.light19=function(){return n._getLightStyle(19)},n.light20=function(){return n._getLightStyle(20)},n.light21=function(){return n._getLightStyle(21)},n.medium1=function(){return n._getMediumStyle(1)},n.medium2=function(){return n._getMediumStyle(2)},n.medium3=function(){return n._getMediumStyle(3)},n.medium4=function(){return n._getMediumStyle(4)},n.medium5=function(){return n._getMediumStyle(5)},n.medium6=function(){return n._getMediumStyle(6)},n.medium7=function(){return n._getMediumStyle(7)},n.medium8=function(){return n._getMediumStyle(8)},n.medium9=function(){return n._getMediumStyle(9)},n.medium10=function(){return n._getMediumStyle(10)},n.medium11=function(){return n._getMediumStyle(11)},n.medium12=function(){return n._getMediumStyle(12)},n.medium13=function(){return n._getMediumStyle(13)},n.medium14=function(){return n._getMediumStyle(14)},n.medium15=function(){return n._getMediumStyle(15)},n.medium16=function(){return n._getMediumStyle(16)},n.medium17=function(){return n._getMediumStyle(17)},n.medium18=function(){return n._getMediumStyle(18)},n.medium19=function(){return n._getMediumStyle(19)},n.medium20=function(){return n._getMediumStyle(20)},n.medium21=function(){return n._getMediumStyle(21)},n.medium22=function(){return n._getMediumStyle(22)},n.medium23=function(){return n._getMediumStyle(23)},n.medium24=function(){return n._getMediumStyle(24)},n.medium25=function(){return n._getMediumStyle(25)},n.medium26=function(){return n._getMediumStyle(26)},n.medium27=function(){return n._getMediumStyle(27)},n.medium28=function(){return n._getMediumStyle(28)},n.dark1=function(){return n._getDarkStyle(1)},n.dark2=function(){return n._getDarkStyle(2)},n.dark3=function(){return n._getDarkStyle(3)},n.dark4=function(){return n._getDarkStyle(4)},n.dark5=function(){return n._getDarkStyle(5)},n.dark6=function(){return n._getDarkStyle(6)},n.dark7=function(){return n._getDarkStyle(7)},n.dark8=function(){return n._getDarkStyle(8)},n.dark9=function(){return n._getDarkStyle(9)},n.dark10=function(){return n._getDarkStyle(10)},n.dark11=function(){return n._getDarkStyle(11)},n.customStyles=function(){var t=n._customStyles;return!t?i:t},n.addCustomStyles=function(i){var r,f,e,u;if(i){for(n._customStyles||(n._customStyles=[]),r=n._customStyles,f=r.length,u=0;u<f;u++)if(e=r[u],e.name()===i.name())throw new Error(t.SR.Exp_TableStyleAddCustomStyleError);r.push(i)}},n.removeCustomStyle=function(i){var r,u;return i?(r=n._customStyles,r&&(u=t.util.inArray(i,r),u>-1))?(r.splice(u,1),!0):!1:!1},n.removeCustomStyleByName=function(t){var r=n._customStyles,u,f,i;if(r)for(u=r.length,i=0;i<u;i++)if(f=r[i],f.name()===t)return r.splice(i,1),!0;return!1},n.getBuildInStyle=function(t){var i=n[t.toLowerCase()];return i?i():new o},n._getLightStyle=function(t){var f=t-1,r,e;if(typeof n._lights===u&&(n._lights={}),n._lights[f])return n._lights[f];r=i;switch(c(f/7)){case 0:r=n._createLightA(f%7);break;case 1:r=n._createLightB(f%7);break;case 2:r=n._createLightC(f%7);break}return r?(e="Light"+t,r.name(e),r.buildInName(e),n._lights[f]=r,r):i},n._createLightA=function(i){var p=n._getTheme(i),w=p+" 80",u=p,e=new o,c=new r,s,v,l,a,y,h;return c.borderBottom=new t.LineBorder(u,1),c.font=f,c.foreColor=u,e.headerRowStyle(c),s=new r,s.borderTop=new t.LineBorder(u,1),s.borderBottom=new t.LineBorder(u,1),s.foreColor=u,e.wholeTableStyle(s),v=new r,v.backColor=w,e.firstRowStripStyle(v),l=new r,l.font=f,l.foreColor=u,e.highlightFirstColumnStyle(l),a=new r,a.font=f,a.foreColor=u,e.highlightLastColumnStyle(a),y=new r,y.backColor=w,e.firstColumnStripStyle(y),h=new r,h.borderTop=new t.LineBorder(u,1),h.font=f,h.foreColor=u,e.footerRowStyle(h),e},n._createLightB=function(i){var b=n._getTheme(i),u=b,e=new o,h=new r,s,l,a,v,y,p,w,c;return h.backColor=u,h.font=f,h.foreColor="white",e.headerRowStyle(h),s=new r,s.borderLeft=new t.LineBorder(u,1),s.borderTop=new t.LineBorder(u,1),s.borderBottom=new t.LineBorder(u,1),s.borderRight=new t.LineBorder(u,1),e.wholeTableStyle(s),l=new r,l.borderTop=new t.LineBorder(u,1),e.firstRowStripStyle(l),a=new r,a.borderTop=new t.LineBorder(u,1),e.secondRowStripStyle(a),v=new r,v.borderLeft=new t.LineBorder(u,1),e.firstColumnStripStyle(v),y=new r,y.borderLeft=new t.LineBorder(u,1),e.secondColumnStripStyle(y),p=new r,p.font=f,e.highlightFirstColumnStyle(p),w=new r,w.font=f,e.highlightLastColumnStyle(w),c=new r,c.borderTop=new t.LineBorder(u,6),c.font=f,e.footerRowStyle(c),e},n._createLightC=function(i){var p=n._getTheme(i),w=p+" 80",u=p,e=new o,c=new r,s,l,a,v,y,h;return c.borderBottom=new t.LineBorder(u,2),c.font=f,e.headerRowStyle(c),s=new r,s.borderLeft=new t.LineBorder(u,1),s.borderTop=new t.LineBorder(u,1),s.borderRight=new t.LineBorder(u,1),s.borderBottom=new t.LineBorder(u,1),s.borderHorizontal=new t.LineBorder(u,1),s.borderVertical=new t.LineBorder(u,1),e.wholeTableStyle(s),l=new r,l.backColor=w,e.firstRowStripStyle(l),a=new r,a.backColor=w,e.firstColumnStripStyle(a),v=new r,v.font=f,e.highlightFirstColumnStyle(v),y=new r,y.font=f,e.highlightLastColumnStyle(y),h=new r,h.borderTop=new t.LineBorder(u,6),h.font=f,e.footerRowStyle(h),e},n._getMediumStyle=function(t){var f=t-1,r,e;if(typeof n._mediums===u&&(n._mediums={}),n._mediums[f])return n._mediums[f];r=i;switch(c(f/7)){case 0:r=n._createMediumA(f%7);break;case 1:r=n._createMediumB(f%7);break;case 2:r=n._createMediumC(f%7);break;case 3:r=n._createMediumD(f%7);break}return r?(e="Medium"+t,r.name(e),r.buildInName(e),n._mediums[f]=r,r):i},n._createMediumA=function(i){var l=n._getTheme(i),s=l+" 20",b=l,w=l+" 80",u=new o,c=new r,e,a,v,y,p,h;return c.backColor=b,c.font=f,c.foreColor="white",u.headerRowStyle(c),e=new r,e.borderHorizontal=new t.LineBorder(s,1),e.borderLeft=new t.LineBorder(s,1),e.borderRight=new t.LineBorder(s,1),e.borderBottom=new t.LineBorder(s,1),e.borderTop=new t.LineBorder(s,1),u.wholeTableStyle(e),a=new r,a.backColor=w,u.firstRowStripStyle(a),v=new r,v.backColor=w,u.firstColumnStripStyle(v),y=new r,y.font=f,u.highlightFirstColumnStyle(y),p=new r,p.font=f,u.highlightLastColumnStyle(p),h=new r,h.borderTop=new t.LineBorder(s,6),h.font=f,h.foreColor="black",u.footerRowStyle(h),u},n._createMediumB=function(i){var y=n._getTheme(i),s="white",v=y,b=y+" 60",k=y+" 80",u=new o,h=new r,c,p,w,l,a,e;return h.backColor=v,h.borderBottom=new t.LineBorder(s,2),h.borderVertical=new t.LineBorder(s,1),h.font=f,h.foreColor="white",u.headerRowStyle(h),c=new r,c.borderHorizontal=new t.LineBorder(s,1),c.borderVertical=new t.LineBorder(s,1),c.backColor=k,u.wholeTableStyle(c),p=new r,p.backColor=b,u.firstRowStripStyle(p),w=new r,w.backColor=b,u.firstColumnStripStyle(w),l=new r,l.backColor=v,l.foreColor="white",l.font=f,u.highlightFirstColumnStyle(l),a=new r,a.backColor=v,a.foreColor="white",a.font=f,u.highlightLastColumnStyle(a),e=new r,e.borderTop=new t.LineBorder(s,2),e.borderVertical=new t.LineBorder(s,1),e.backColor=v,e.foreColor="white",e.font=f,u.footerRowStyle(e),u},n._createMediumC=function(i){var d=n._getTheme(i),h=d,k="#D3D3D3",g="white",a=i===0?"black":"#D3D3D3",u=new o,s=new r,e,w,b,v,y,c,l,p;return s.backColor=h,s.borderTop=new t.LineBorder("black",2),s.borderBottom=new t.LineBorder("black",2),s.font=f,s.foreColor="white",u.headerRowStyle(s),e=new r,e.borderLeft=new t.LineBorder(a,1),e.borderRight=new t.LineBorder(a,1),e.borderTop=new t.LineBorder("black",2),e.borderVertical=new t.LineBorder(a,1),i===0&&(e.borderHorizontal=new t.LineBorder(a,1)),e.borderBottom=new t.LineBorder("black",2),u.wholeTableStyle(e),w=new r,w.backColor=k,u.firstRowStripStyle(w),b=new r,b.backColor=k,u.firstColumnStripStyle(b),v=new r,v.backColor=h,v.foreColor="white",u.highlightFirstColumnStyle(v),y=new r,y.backColor=h,y.foreColor="white",u.highlightLastColumnStyle(y),c=new r,c.backColor=h,c.font=f,c.foreColor="white",u.firstFooterCellStyle(c),l=new r,l.backColor=h,l.font=f,l.foreColor="white",u.lastFooterCellStyle(l),p=new r,p.foreColor="black",p.borderTop=new t.LineBorder("black",6),u.footerRowStyle(p),u},n._createMediumD=function(i){var l=n._getTheme(i),k=l,u=l+" 40",w=l+" 80",b=l+" 60",d=l+" 80",c=new o,s=new r,h,a,v,y,p,e;return s.backColor=w,s.borderVertical=new t.LineBorder(u,1),s.borderLeft=new t.LineBorder(u,1),s.borderTop=new t.LineBorder(u,1),s.borderRight=new t.LineBorder(u,1),s.borderBottom=new t.LineBorder(u,1),s.font=f,s.foreColor="black",c.headerRowStyle(s),h=new r,h.borderVertical=new t.LineBorder(u,1),h.borderHorizontal=new t.LineBorder(u,1),h.borderLeft=new t.LineBorder(u,1),h.borderTop=new t.LineBorder(u,1),h.borderRight=new t.LineBorder(u,1),h.borderBottom=new t.LineBorder(u,1),h.backColor=w,c.wholeTableStyle(h),a=new r,a.backColor=b,c.firstRowStripStyle(a),v=new r,v.backColor=b,c.firstColumnStripStyle(v),y=new r,y.font=f,c.highlightFirstColumnStyle(y),p=new r,p.font=f,c.highlightLastColumnStyle(p),e=new r,e.backColor=d,e.foreColor="black",e.font=f,e.borderLeft=new t.LineBorder(u,1),e.borderTop=new t.LineBorder(k,2),e.borderRight=new t.LineBorder(u,1),e.borderBottom=new t.LineBorder(u,1),e.borderVertical=new t.LineBorder(u,1),c.footerRowStyle(e),c},n._getDarkStyle=function(t){var f=t-1,r,e;if(typeof n._darks===u&&(n._darks={}),n._darks[f])return n._darks[f];r=i;switch(c(f/7)){case 0:r=n._createDarkA(f%7);break;case 1:r=n._createDarkB(f%7);break}return r!=i?(e="Dark"+t,r.name(e),r.buildInName(e),n._darks[f]=r,r):i},n._createDarkA=function(i){var e=n._getTheme(i),w="black",a=i===0?e+" 25":e+" -25",b=i===0?e+" 50":e,k=i===0?e:e+" -50",u=new o,l=new r,v,y,p,s,h,c;return l.backColor=w,l.font=f,l.foreColor="white",l.borderBottom=new t.LineBorder("white",2),u.headerRowStyle(l),v=new r,v.backColor=b,v.foreColor="white",u.wholeTableStyle(v),y=new r,y.backColor=a,u.firstRowStripStyle(y),p=new r,p.backColor=a,u.firstColumnStripStyle(p),s=new r,s.font=f,s.borderRight=new t.LineBorder("white",2),s.backColor=a,s.foreColor="white",u.highlightFirstColumnStyle(s),h=new r,h.font=f,h.borderLeft=new t.LineBorder("white",2),h.backColor=a,h.foreColor="white",u.highlightLastColumnStyle(h),c=new r,c.backColor=k,c.font=f,c.foreColor="white",c.borderTop=new t.LineBorder("white",2),u.footerRowStyle(c),u},n._createDarkB=function(i){var k=n._getTheme(i),w=n._getHeaderColor(i),y=n._getStripColor(i),p=n._getTableBackground(i),b=p,u=new o,s=new r,h,c,l,a,v,e;return s.backColor=w,s.foreColor="white",u.headerRowStyle(s),h=new r,h.backColor=p,u.wholeTableStyle(h),c=new r,c.backColor=y,u.firstRowStripStyle(c),l=new r,l.backColor=y,u.firstColumnStripStyle(l),a=new r,a.font=f,u.highlightFirstColumnStyle(a),v=new r,v.font=f,u.highlightLastColumnStyle(v),e=new r,e.backColor=b,e.font=f,e.borderTop=new t.LineBorder("black",6),u.footerRowStyle(e),u},n._getTableBackground=function(n){if(n===0)return"Background 1 -15";else if(n===1)return"Accent 1 80";else if(n===2)return"Accent 3 80";else if(n===3)return"Accent 5 80";return""},n._getStripColor=function(n){if(n===0)return"Background 1 -35";else if(n===1)return"Accent 1 60";else if(n===2)return"Accent 3 60";else if(n===3)return"Accent 5 60";return""},n._getHeaderColor=function(n){if(n===0)return"Text 1";else if(n===1)return"Accent 2";else if(n===2)return"Accent 4";else if(n===3)return"Accent 6";return""},n._getTheme=function(n){return n===0?"Text 1":"Accent "+n},n}();t.TableStyles=a;y=function(){function n(n){this._sheet=n;this._tableList=[];this._updateDataSourceSuspended=!1}return n.prototype.suspendUpdateDataSource=function(){this._updateDataSourceSuspended=!0},n.prototype.resumeUpdateDataSource=function(){this._updateDataSourceSuspended=!1},n.prototype.isUpdateDataSourceSuspended=function(){return this._updateDataSourceSuspended},n.prototype.resetTablesBindingManager=function(){for(var t,i=this.getTables(),n=0,r=i.length;n<r;n++)t=i[n],t.bindingPath()&&t.resetBindingManager()},n.prototype.getSheet=function(){return this._sheet},n.prototype.getCount=function(){return this._tableList.length},n.prototype.getTables=function(){return this._tableList},n.prototype.clearTables=function(){var t=this._tableList,i=this._sheet,u=i.isPaintSuspended(),n,r;i.isPaintSuspended(!0);try{for(n=0,r=t.length;n<r;n++){this.remove(t[n],!0);this.onTableRemoved(t[n])}}finally{i.isPaintSuspended(u)}},n.prototype.add=function(n){var i,f,u,r;if(n){for(i=this,f=i._tableList.length,r=0;r<f;r++)if(u=i._tableList[r],u&&u.name()===n.name())throw new Error(t.SR.Exp_TableHasSameNameError);n._setOwner(i);n._applyBindingPath();i._tableList.push(n);n.showHeader()&&n._syncHeader();n.showFooter()&&n._syncFooter();this.onTableAdded(n);return n}},n.prototype.remove=function(n,r){var s,e,o;if(n){if(s=t.util.inArray(n,this._tableList),s>-1){if(this._tableList.splice(s,1),r!==!1){var u=n.range(),f=this._sheet,h=f.isPaintSuspended();f.isPaintSuspended(!0);try{var c=u.row,l=u.row+u.rowCount,a=u.col,v=u.col+u.colCount;for(e=c;e<l;e++)for(o=a;o<v;o++)f.setFormula(e,o,i),f.setValue(e,o,i)}finally{f.isPaintSuspended(h)}}this.onTableRemoved(n);return n}return i}},n.prototype.find=function(n,t){var e=this._tableList.length,f,u,r;if(e===0)return i;for(u=0;u<e;u++)if(f=this._tableList[u],r=f.range(),r.row<=n&&n<r.row+r.rowCount&&r.col<=t&&t<r.col+r.colCount)return f;return i},n.prototype.findByRange=function(n,t,r,u){var s=this._tableList.length,e,o,f;if(s===0)return i;for(e=[],f=0;f<s;f++)o=this._tableList[f],o.range().intersect(n,t,r,u)&&e.push(o);return e},n.prototype.findByName=function(n){for(var u=this._tableList.length,t,r=0;r<u;r++)if(t=this._tableList[r],t.name().toLowerCase()===n.toLowerCase())return t;return i},n.prototype.has=function(n,t,i,r){for(var e=this._tableList.length,f,u=0;u<e;u++)if(f=this._tableList[u],f.range().intersect(n,t,i,r))return!0;return!1},n.prototype.addRows=function(n,i){for(var r,h,v,e,y,o,l,w,f=this._tableList,a=[],u=0,s=f.length;u<s;u++)r=f[u],h=r.getSource(),t.ArrayHelper.contains(a,h)?r._addRows(n,i,!0):(v=r._addRows(n,i,this.isUpdateDataSourceSuspended()),v&&a.push(h));if(!this.isUpdateDataSourceSuspended())try{for(e=this._sheet,y=e.isPaintSuspended(),e.isPaintSuspended(!0),this.suspendUpdateDataSource(),u=0,s=f.length;u<s;u++){var r=f[u],c=r.getSourceRowCount(),p=r.dataRange();c>0&&c!==p.rowCount&&(o=c,r.showHeader()&&(o+=1),r.showFooter()&&(o+=1),l=r.range(),w=new t.Range(l.row,l.col,o,p.colCount),r._resize(w,this.isUpdateDataSourceSuspended()))}}finally{this.resumeUpdateDataSource();e.isPaintSuspended(y)}},n.prototype.addColumns=function(n,t){for(var u=this._tableList.length,r,i=0;i<u;i++)r=this._tableList[i],r._addColumns(n,t)},n.prototype.removeRows=function(n,i){for(var p,e,w,o,l,k,f=this._tableList,a=[],v=[],u=0,s=f.length;u<s;u++){var r=f[u],y=r.getSource(),h=r.range(),d=n<=h.row&&h.row+h.rowCount<=n+i;d||(t.ArrayHelper.contains(a,y)?r._removeRows(n,i,!0):(p=r._removeRows(n,i,this.isUpdateDataSourceSuspended()),p&&a.push(y)),v.push(r))}if(this._tableList=v,!this.isUpdateDataSourceSuspended())try{for(e=this._sheet,w=e.isPaintSuspended(),e.isPaintSuspended(!0),this.suspendUpdateDataSource(),f=this._tableList,u=0,s=f.length;u<s;u++){var r=f[u],c=r.getSourceRowCount(),b=r.dataRange();c>0&&c!==b.rowCount&&(o=c,r.showHeader()&&(o+=1),r.showFooter()&&(o+=1),l=r.range(),k=new t.Range(l.row,l.col,o,b.colCount),r._resize(k,this.isUpdateDataSourceSuspended()))}}finally{this.resumeUpdateDataSource();e.isPaintSuspended(w)}},n.prototype.removeColumns=function(n,t){for(var r,e,f=[],o=this._tableList.length,i,u=0;u<o;u++)i=this._tableList[u],r=i.range(),e=n<=r.col&&r.col+r.colCount<=n+t,e||(i._removeColumns(n,t),f.push(i));this._tableList=f},n.prototype.clear=function(n,r,u,f,e){var h=this,v=new t.Range(n,r,u,f),c,s,a=[],l,o;if((e&1)==1){for(l=[],c=h._tableList.length,o=0;o<c;o++)s=h._tableList[o],v.containsRange(s.range())?a.push(s):l.push(s);for(c=l.length,o=0;o<c;o++)s=l[o],s._clear(n,r,u,f);h._tableList=l}if((e&2)==2)for(c=h._tableList.length,o=0;o<c;o++)s=h._tableList[o],v.containsRange(s.range())&&s.style(i);for(o=0;o<a.length;o++)h.onTableRemoved(a[o]);return a},n.prototype.onTableRemoved=function(n){if(n&&n.hasSlicerData()){var t=n.getSlicerData();t.onTableRemoved(n)}},n.prototype.onTableAdded=function(n){if(n&&n.hasSlicerData()){var t=n.getSlicerData();t.onTableAdded(n)}},n.prototype.copy=function(n,t,i,r,u,f){for(var s=this._tableList.length,o,e=0;e<s;e++)o=this._tableList[e],o._copy(n,t,i,r,u,f)},n.prototype.move=function(n,t,i,r,u,f){for(var s=this._tableList.length,o,e=0;e<s;e++)o=this._tableList[e],o._move(n,t,i,r,u,f)},n.prototype.getNoConflictTableName=function(n){for(var t=1;this.findByName(n);)n="table"+t,t++;return n},n.prototype.toJSON=function(){var n=this._tableList,t,i;if(!n||n.length===0)return e;for(t=[],i=0;i<n.length;i++)t.push(n[i].toJSON());return t.length===0?e:t},n.prototype.fromJSON=function(n,t){var i,u,r;if(n&&n.length!==0)for(i=0;i<n.length;i++)u=n[i],r=new v,r._setOwner(this),r.fromJSON(u,t),this._tableList.push(r)},n}();t._SheetTableManager=y})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){var p,e,l,a,r,o,v,y;n.feature("group",["core.common","core.stringResource"]);var t=null,f=undefined,i=Math.max,u=Math.min,s="undefined",h="gc-group",c="gc-group-box";(function(n){n[n.Expanded=0]="Expanded";n[n.Collapsed=1]="Collapsed"})(n.GroupState||(n.GroupState={}));p=n.GroupState;e=function(){function n(n,i,r,u){var f=this;f.model=t;f.children=t;f.parent=t;f.start=0;f.end=0;f.level=0;f.model=n;f.start=i;f.end=r;f.level=u}return n.prototype.getState=function(){return this.model?this.model.getState(this):0},n.prototype.setState=function(n){this.model&&this.model.expand(this.level,n===0)},n.prototype.contains=function(n){return this.start<=n&&n<=this.end},n.prototype.addChild=function(n){var t=this;n&&(t.children||(t.children=[]),t.children.push(n),n.parent=t)},n}();n.RangeGroupInfo=e;l=function(){function n(){this.count=0}return n.prototype.addRef=function(){this.count++},n.prototype.release=function(){this.count--},n.prototype.isWorking=function(){return this.count>0},n}();n.WorkingState=l;a=function(){function i(n){var i=this;i.head=t;i.tail=t;i.items=t;i._rootCached=t;i.direction=1;i.suspendAddingGroup=new l;i.items=new Array(n);i._empty=!0}return i.prototype.setDirection=function(n){this.direction=n},i.prototype.getDirection=function(){return this.direction},i.prototype._getCount=function(){var n=this.items;return n?n.length:0},i.prototype.group=function(i,u){var f=this,e,s,o;if(!f._isIndexValid(i))throw new Error(n.SR.Exp_InvalidIndex);if(!f._isIndexValid(i+u-1))throw new Error(n.SR.Exp_InvalidCount);for(f._rootCached=t,e=0;e<u;e++)s=i+e,o=f._getModelIndexFromViewIndex(s),f.items[o]?f.items[o].level++:f.items[o]=new r;f._rootCached=f.createRangeGroup();f._empty=!1;f.groupChangeHandler&&f.groupChangeHandler()},i.prototype.ungroupRange=function(i,r){var u=this,k,g,v,nt,y,p,w;if(!u._isIndexValid(i))throw new Error(n.SR.Exp_InvalidIndex);if(!u._isIndexValid(i+r-1))throw new Error(n.SR.Exp_InvalidCount);var h=!1,e=t,c=-1;if(u.direction===1){if(c=i+r,h=u._isIndexValid(c),h){var l=i+r-1,b=l,o=t;do k=u._getModelIndexFromViewIndex(l),o=u.items[k],o!==f&&o!==t&&(b=l),l--;while((o===f||o===t)&&l>=i);o!==f&&o!==t&&(e=u._findImp(u._rootCached,b,o.level),e&&(c=e.end+1),h=e&&(e.end===i+r-1||u.getState(e)===1))}}else if(u.direction===0&&(c=i-1,h=u._isIndexValid(c),h)){var a=i,d=a,s=t;do g=u._getModelIndexFromViewIndex(a),s=u.items[g],s!==f&&s!==t&&(d=a),a++;while((s===f||s===t)&&a<i+r);s!==f&&s!==t&&(e=u._findImp(u._rootCached,d,s.level),e&&(c=e.start-1),h=e&&(e.start===i||u.getState(e)===1))}for(u._rootCached=t,v=0;v<r;v++)nt=i+v,y=u._getModelIndexFromViewIndex(nt),u.items[y]&&u.items[y].level>-1&&u.items[y].level--;h&&(p=u._getModelIndexFromViewIndex(c),w=u.items[p],w&&w.level===e.level&&(u.items[p]=t));u._rootCached=u.createRangeGroup();u.groupChangeHandler&&u.groupChangeHandler()},i.prototype.ungroup=function(){var n=this,i;n._rootCached=t;i=n._getCount();n.items=new Array(i);n._rootCached=n.createRangeGroup();n._empty=!0;n.groupChangeHandler&&n.groupChangeHandler()},i.prototype._expand=function(t,i,r){if(!this._isIndexValid(t))throw new Error(n.SR.Exp_InvalidIndex);if(i<-1)throw new Error(n.SR.Exp_InvalidLevel);var u=this.find(t,i);u&&this.expandGroup(u,r)},i.prototype.expand=function(t,i){if(t<-1)throw new Error(n.SR.Exp_InvalidLevel);for(var r=new o(this);r.moveNext();)this._expand(r.current,t,i)},i.prototype.expandGroup=function(t,i){if(!t)throw new Error(n.SR.Exp_GroupInfoIsNull);var r=-1;switch(this.direction){case 0:r=t.start-1;break;case 1:r=t.end+1;break}this.setCollapsed(r,!i)},i.prototype.isCollapsed=function(n){var i=this.getLevel(n),t;if(i>-1)for(t=this._findImp(this._rootCached,n,i);t;){if(t.getState()===1)return!0;t=t.parent}return!1},i.prototype.find=function(i,r){var u=this._rootCached;if(u){if(r===-1)return u;if(!this._isIndexValid(i))throw new Error(n.SR.Exp_InvalidIndex);return this._findImp(u,i,r)}return t},i.prototype.getLevel=function(t){if(!this._isIndexValid(t))throw new Error(n.SR.Exp_InvalidIndex);var r=this._getModelIndexFromViewIndex(t),i=this.items[r];return i?i.level:-1},i.prototype.getCollapsed=function(n){var i=this._getModelIndexFromViewIndex(n),t=this.items[i];return t?!!t.collapsed:!1},i.prototype.setCollapsed=function(n,i){var u=this,s=!1,f,o;if(n<0)f=u.head,f||(f=u.head=new r),f.collapsed!==i&&(f.collapsed=i,s=!0);else if(n>-1&&n<u._getCount()){var h=u._getModelIndexFromViewIndex(n),c=u.items,e=c[h];e||(e=c[h]=new r,e.level=-1);e.collapsed!==i&&(e.collapsed=i,s=!0)}else n>=u._getCount()&&(o=u.tail,o||(o=u.tail=new r),o.collapsed!==i&&(o.collapsed=i,s=!0));s&&(u._rootCached=t,u.refresh(),u.groupChangeHandler&&u.groupChangeHandler())},i.prototype.getMaxLevel=function(){for(var t=-1,u=this.items,f=u.length,i,n,r=0;r<f;r++)i=u[r],n=i&&i.level,typeof n!==s&&n>t&&(t=n);return t},i.prototype._move=function(i,u,f){var e=this,s,o,l,h,c;if(f>0){if(i<0&&(i=0),u<0&&(u=0),i===u)return;for(s=[],o=n.ArrayHelper.nextNonEmptyIndex(e.items,i-1);o>=0&&o<i+f;)l=new r(e.items[o]),s.push({index:o-i,value:l}),o=n.ArrayHelper.nextNonEmptyIndex(e.items,o);if(n.ArrayHelper.clear(e.items,i,f),n.ArrayHelper.clear(e.items,u,f),s.length>0)for(h=0;h<s.length;h++)c=s[h],e.items[u+c.index]=c.value;e._rootCached=t;e.refresh()}},i.prototype._copy=function(i,u,f){var e=this,s,o,l,h,c;if(f>0){if(i<0&&(i=0),u<0&&(u=0),i===u)return;for(s=[],o=n.ArrayHelper.nextNonEmptyIndex(e.items,i-1);o>=0&&o<i+f;)l=new r(e.items[o]),s.push({index:o-i,value:l}),o=n.ArrayHelper.nextNonEmptyIndex(e.items,o);if(n.ArrayHelper.clear(e.items,u,f),s.length>0)for(h=0;h<s.length;h++)c=s[h],e.items[u+c.index]=c.value;e._rootCached=t;e.refresh()}},i.prototype._add=function(n,i){var u=this,e,s,h,c,f,o;if(i>0){for(e=u._getModelIndexFromViewIndex(n),s=e>1?u.items[e-1]:t,h=0;h<i;h++)u.items.splice(e,0,!s?t:new r(s));if(!u.suspendAddingGroup.isWorking()&&n>0&&(c=u._getModelIndexFromViewIndex(n-1),f=t,f=c<0?u.head:u.items[c],f))for(o=0;o<i;o++)u.items[n+o]=new r({collapsed:f.collapsed,level:f.level});u._rootCached=t;u.refresh()}},i.prototype._remove=function(n,i){i>0&&(this.items.splice(n,i),this._rootCached=t,this.refresh())},i.prototype.equals=function(n){var t=this,i=n,r;if(i){if(!t.items&&i.items&&i.items.length>0||!i.items&&t.items&&t.items.length>0||!t.rangeGroupItemInfoEquals(t.head,i.head)||!t.rangeGroupItemInfoEquals(t.tail,i.tail))return!1;if(t.items&&i.items){if(t.direction!==i.direction||t.items.length!==i.items.length)return!1;for(r=0;r<t.items.length;r++)if(!t.items[r]&&i.items[r]||t.items[r]&&!i.items[r])return!1}return!0}return!1},i.prototype._isEmpty=function(){return this._empty},i.prototype.refresh=function(){this._isEmpty()||(this._rootCached=this.createRangeGroup())},i.prototype._setCount=function(n){var i=this,u,f,e;if(i.items||(i.items=new Array(n)),i._rootCached=t,u=i._getCount(),n<u)i.items.splice(n,u-n);else if(n>u)if(f=i.items[i.items.length-1],f)for(e=0;e<n-u;e++)i.items.push(new r(f));else i.items=i.items.concat(new Array(n-u));i.refresh()},i.prototype.getState=function(n){var r=this,i=-1,u,f,e;switch(r.direction){case 1:i=n.end+1;break;case 0:i=n.start-1;break}return u=t,f=r._getCount(),i<0&&(u=r.head),i>-1&&i<f?(e=r._getViewIndexFromModelIndex(i),u=r.items[e]):i>=f&&(u=r.tail),u&&u.collapsed?1:0},i.prototype._setLevel=function(n,i){var u=this,f;n<0?(u.head||(u.head=new r),u.head.level=i):n>-1&&n<u._getCount()?(f=u._getModelIndexFromViewIndex(n),u.items[f]||(u.items[f]=new r,u.items[f].level=-1),u.items[f].level=i):n>=u._getCount()&&(u.tail||(u.tail=new r),u.tail.level=i);u._rootCached=t;u.refresh()},i.prototype.suspendAdding=function(){this.suspendAddingGroup.addRef()},i.prototype.resumeAdding=function(){this.suspendAddingGroup.release()},i.prototype._getViewIndexFromModelIndex=function(n){return n},i.prototype._getModelIndexFromViewIndex=function(n){return n},i.prototype.rangeGroupItemInfoEquals=function(n,t){return n?t?n.level===t.level&&n.collapsed===t.collapsed:!1:!t},i.prototype.createRangeGroup=function(){for(var n=this,i=new e(n,0,n._getCount()-1,-1),r=new o(n),t;r.moveNext();)t=n._createRangeGroup(r,0),t&&t.level>-1&&i.addChild(t);return i},i.prototype._createRangeGroup=function(n,i){var f=this,u=t,h;do{var r=n.current,c=f._getModelIndexFromViewIndex(r),o=f.items[c],s=n.nextToCurrent();if(o.level<i)continue;else o.level>=i&&(u||(u=new e(f,r,r,i)));if(o.level>i&&(h=f._createRangeGroup(n,i+1),n.current>-1?(r=n.current,s=n.nextToCurrent()):(r=h.end,s=-1),u.addChild(h)),r>u.end&&(u.end=r),f.isGroupEnd(r,s,i))return u}while(n.moveNext());return u},i.prototype.isGroupEnd=function(n,t,i){var r=this,h=r._getModelIndexFromViewIndex(n),e=r.items[h],s,u,o,f;if(!r._isIndexValid(t)||(s=r._getModelIndexFromViewIndex(t),u=r.items[s],!u))return!0;if(u.level<e.level){if(o=e.level-u.level,f=e.level-i,o===f)return!1;if(f>=0&&f<o)return!0}return!1},i.prototype._isIndexValid=function(n){return n>=-1&&n<this._getCount()},i.prototype._findImp=function(n,i,r){var u,f,o,e;if(n)for(u=[],u.unshift(n);u.length>0;){if(n=u.pop(),n.level===r&&n.contains(i))return n;if(f=n.children,o=f&&f.length,o>0)for(e=0;e<o;e++)u.unshift(f[e])}return t},i.prototype.fromJSON=function(n,i){var u,h,c,s,e,o;if(n){if(u=this,h=u.items,n.itemsData)for(c=n.itemsData.length,s=0;s<c;s++)if(e=n.itemsData[s],e.count>0&&e.index>=0&&e.info){for(o=0;o<e.count;o++){if(e.index+o>=h.length)break;h[e.index+o]=new r(e.info)}u._empty=!1}n.direction!==t&&n.direction!==f&&(u.direction=n.direction);n.head&&(u.head=n.head);n.tail&&(u.tail=n.tail);u._rootCached=t;u.refresh()}},i.prototype.toJSON=function(){for(var h,o,s,c,u=this,r=[],t=-1,e=u.items,i=0;i<e.length;i++)e[i]&&(t>=0&&i===r[t].count+r[t].index&&e[i].level===r[t].info.level&&e[i].collapsed===r[t].info.collapsed?r[t].count++:(t++,r[t]={index:i,count:1,info:e[i]}));h={itemsData:r,direction:u.direction,head:u.head,tail:u.tail};o={};for(s in h)c=h[s],u._isDefaultValue(s,c)||(o[s]=c);return n.GC$.isEmptyObject(o)?f:o},i.prototype._isDefaultValue=function(n,i){switch(n){case"head":return i===t;case"tail":return i===t;case"direction":return i===1;case"itemsData":return i.length===0;default:return!1}},i}();n.RangeGroup=a;r=function(){function n(n){var t=this;t!==n&&n&&(t.level=n.level,t.collapsed=n.collapsed);n||(t.level=0,t.collapsed=!1)}return n}();n.RangeGroupItemInfo=r;o=function(){function n(n){this.isEOF=!1;this.rangeGroup=t;this.current=-1;this.rangeGroup=n}return n.prototype.nextToCurrent=function(){return this.current+1},n.prototype.moveNext=function(){var n=this,i,t,r;if(n.isEOF||!n.rangeGroup||!n.rangeGroup.items)return!1;for(i=!1,t=n.current+1;t<n.rangeGroup.items.length;t++)if(r=n.rangeGroup._getModelIndexFromViewIndex(t),n.rangeGroup.items[r]){i=!0;n.current=t;break}return i||(n.current=-1),n.current>-1?!0:(n.isEOF=!0,!1)},n.prototype.reset=function(){this.isEOF=!1;this.current=-1},n}();n.GroupedItemIndexEnumerator=o;v=function(){function r(n,i,r,u){var f=this;f.PADDING=2;f.LINE_SIZE=2;f.STARTLINE_SIZE=6;f._groupLineInfos=t;f._groupDotInfos=t;f._groupButtonInfos=t;f._sheet=n;f._rowGroup=i;f._viewportIndex=r;f._maxLevel=typeof u===s?i?n.rowRangeGroup.getMaxLevel():n.colRangeGroup.getMaxLevel():u}return r.prototype.createGroupInfo=function(){var n=this,i,r,t;if(n._groupLineInfos=[],n._groupDotInfos=[],n._groupButtonInfos=[],i=n._rowGroup,r=n._maxLevel,r!==-1){var u=n._sheet._getGroupLayout(),s=n._calcMinWidthOrHeight({width:u.width,height:u.height},i),f=n.getGroupsByLevel(0,i),e=f.length,o;if(e>0)for(t=0;t<e;t++)o=f[t],n._measureGroups(o,s)}},r.prototype.paintGroups=function(n){this._rowGroup?this._paintRowGroups(n):this._paintColumnGroups(n)},r.prototype._calcMinWidthOrHeight=function(n,t){var r=0,u=this._maxLevel;return r=t?(n.width-this.PADDING*2)/(u+2):(n.height-this.PADDING*2)/(u+2),i(0,r)},r.prototype._measureGroups=function(r,f){var c=this,st=c._rowGroup,s=c.getGroupDirection(st),y=c.getViewportStartIndex(st),p=c.getViewportEndIndex(st),a=r.start,v=r.end,o,e,h,k,d,g,nt,ht,l,w,b,it,ct,rt,ut,ft,et,ot,vt,yt;if(r.getState()===0){if(k=!0,d=r.parent,d&&(s===0&&a===d.start||s===1&&v===d.end)&&(k=!1),k&&(o={isExpanded:!0,level:r.level,paintLine:!0},s===1?(e=v+1,e>=y&&e<=p&&(o.index=e,o.lineDirection=1,c._groupButtonInfos.push(o))):s===0&&(e=a-1,e>=y&&e<=p&&(o.index=e,o.lineDirection=0,c._groupButtonInfos.push(o)))),a<=p&&v>=y){for(g=i(y,a),nt=u(p,v),k&&(ht={start:g,end:nt,level:r.level,startLine:t},(s===1&&g===a||s===0&&nt===v)&&(ht.startLine=!0),c._groupLineInfos.push(ht)),l=[],h=g;h<=nt;h++)l.push(h);if(w=r.children,b=w&&w.length,b>0)for(h=0;h<b;h++){var tt=w[h],lt=tt.start,at=tt.end;if(tt.getState()===1)for(it=lt;it<=at;it++)n.ArrayHelper.remove(l,it);s===1?n.ArrayHelper.remove(l,at+1):s===0&&n.ArrayHelper.remove(l,lt-1);c._measureGroups(tt,f)}if(ct=!0,b>0)for(rt=0;rt<b;rt++)if(ut=w[rt],ut)if(ft=ut.start,et=ut.end,ft===a&&et===v){ct=!1;break}else if(s===1&&et===v||s===0&&ft===a)for(ot=ft;ot<=et;ot++)n.ArrayHelper.remove(l,ot);if(ct&&l.length>0)for(h=0;h<l.length;h++)vt=l[h],yt={index:vt,level:r.level+1},c._groupDotInfos.push(yt)}}else r.getState()===1&&(o={isExpanded:!1,level:r.level},s===1?(e=v+1,e>=y&&e<=p&&(o.index=e,o.lineDirection=1,c._groupButtonInfos.push(o))):s===0&&(e=a-1,e>=y&&e<=p&&(o.index=e,o.lineDirection=0,c._groupButtonInfos.push(o))))},r.prototype._paintRowGroups=function(r){var v=this,ei=v._maxLevel,tt,st,ht,dt,gt,ii,lt,ri,at,ft,vt,k,d,g,b,ui,fi,yt;if(ei!==-1){var et=v._sheet,f=et._getGroupLayout(),y=v._calcMinWidthOrHeight({width:f.width,height:f.height},!0);if(y!==0){r.save();var pt=v.STARTLINE_SIZE,wt=v.PADDING,w=v.LINE_SIZE,ot=i(0,(y-pt)/2)+wt,s,e,l,o,nt=et._getRowLayout(v._viewportIndex,3),oi=n.ThemeStyleHelper.getCssClassThemeStyle(h),bt=oi.color,kt=n.ThemeStyleHelper.getCssClassThemeStyle(c);if(r.fillStyle=bt,tt=v._groupDotInfos,st=tt&&tt.length,st>0)for(l=0;l<st;l++)ht=tt[l],o=nt.findRow(ht.index),o&&o.height>=w&&(s=ht.level*y+ot,e=o.y+i(0,(o.height-w)/2),dt=w,gt=w,r.fillRect(f.x+s+.5,f.y+e,dt,gt));var ni=et.rowRangeGroup.direction,ct=v._groupLineInfos,ti=ct&&ct.length;if(ti>0)for(l=0;l<ti;l++){var it=ct[l],rt=it.start,ut=it.end,p=t,a=t;do p=nt.findRow(rt),rt++;while(!p&&rt<=ut);do a=nt.findRow(ut),ut--;while(!a&&ut>=rt);if(p||a)!p&&a?p=a:p&&!a&&(a=p);else continue;s=it.level*y+ot;e=p.y;ni===1&&(e+=1);ii=w;lt=i(0,a.y+a.height-p.y);r.fillRect(f.x+s+.5,f.y+e,ii,lt);ri=it.startLine;ri&&(at=u(pt,y-w),at>0&&(ni===0&&(e=e+lt-w),e>=p.y&&e<a.y+a.height&&r.fillRect(f.x+s+.5,f.y+e,at,w)))}if(ft=v._groupButtonInfos,vt=ft&&ft.length,vt>0)for(l=0;l<vt;l++)(k=ft[l],o=nt.findRow(k.index),!o||o&&o.height<=0)||(d=i(0,(o.height-y)/2),s=k.level*y+wt,e=o.y+d,g=y,b=u(y,o.height),r.strokeStyle=kt.borderTopColor,r.lineWidth=1,r.fillStyle=kt.backgroundColor,r.fillRect(f.x+s,f.y+e,g,b),r.strokeRect(f.x+s+.5,f.y+e,g,b),r.fillStyle=bt,k.isExpanded||r.fillRect(f.x+s+g/2-1+.5,f.y+e+4,2,b-8),r.fillRect(f.x+s+4+.5,f.y+e+b/2-1,g-8,2),ui=k.paintLine,ui&&b<o.height&&(s=k.level*y+ot,e=o.y,fi=w,yt=d,k.lineDirection===0&&(e+=d+b,yt=o.height-b-d),r.fillRect(f.x+s+.5,f.y+e,fi,yt)));r.stroke();r.beginPath();r.restore()}}},r.prototype._paintColumnGroups=function(r){var v=this,fi=v._maxLevel,et,wt,ot,bt,kt,st,ni,ti,ht,ct,ii,k,d,b,g,ri,lt,ui;if(fi!==-1){var ut=v._sheet,f=ut._getGroupLayout(),y=v._calcMinWidthOrHeight({width:f.width,height:f.height},!1);if(y!==0){var at=v.STARTLINE_SIZE,vt=v.PADDING,w=v.LINE_SIZE,ft=i(0,(y-at)/2)+vt,e,s,l,o,nt=ut._getColumnLayout(v._viewportIndex,3),ei=n.ThemeStyleHelper.getCssClassThemeStyle(h),yt=ei.color,pt=n.ThemeStyleHelper.getCssClassThemeStyle(c);for(r.save(),r.fillStyle=yt,et=v._groupDotInfos,wt=et.length,l=0;l<wt;l++)ot=et[l],o=nt.findCol(ot.index),o&&o.width>=w&&(e=o.x+i(0,(o.width-w)/2),s=ot.level*y+ft,bt=w,kt=w,r.fillRect(f.x+e,f.y+s+.5,bt,kt));var dt=ut.colRangeGroup.direction,gt=v._groupLineInfos,oi=gt.length;for(l=0;l<oi;l++){var tt=gt[l],it=tt.start,rt=tt.end,p=t,a=t;do p=nt.findCol(it),it++;while(!p&&it<=rt);do a=nt.findCol(rt),rt--;while(!a&&rt>=it);if(p||a)!p&&a?p=a:p&&!a&&(a=p);else continue;e=p.x;dt===1&&(e+=1);s=tt.level*y+ft;st=i(0,a.x+a.width-p.x);ni=w;r.fillRect(f.x+e,f.y+s+.5,st,ni);ti=tt.startLine;ti&&(ht=u(at,y-w),ht>0&&(dt===0&&(e=e+st-w),e>=p.x&&e<a.x+a.width&&r.fillRect(f.x+e,f.y+s+.5,w,ht)))}for(ct=v._groupButtonInfos,ii=ct.length,l=0;l<ii;l++)(k=ct[l],o=nt.findCol(k.index),!o||o&&o.width<=0)||(d=i(0,(o.width-y)/2),e=o.x+d,s=k.level*y+vt,b=u(y,o.width),g=y,r.strokeStyle=pt.borderTopColor,r.lineWidth=1,r.fillStyle=pt.backgroundColor,r.fillRect(f.x+e,f.y+s,b,g),r.strokeRect(f.x+e,f.y+s+.5,b,g),r.fillStyle=yt,k.isExpanded||r.fillRect(f.x+e+b/2-1,f.y+s+4.5,2,g-8),r.fillRect(f.x+e+4,f.y+s+g/2-.5,b-8,2),ri=k.paintLine,ri&&b<o.width&&(e=o.x,s=k.level*y+ft,lt=d,ui=w,k.lineDirection===0&&(e+=d+b,lt=o.width-b-d),r.fillRect(f.x+e,f.y+s+.5,lt,ui)));r.beginPath();r.restore()}}},r.prototype.getRowOrColumnStartIndex=function(n){var f=this._sheet,e=this._viewportIndex,t,o,r,s;if(n){if(t=f._getRowLayout(e),t&&t.length>0)return o=t[0].row,i(0,o-1)}else if(r=f._getColumnLayout(e),r&&r.length>0)return s=r[0].col,u(0,s-1);return-1},r.prototype.getRowOrColumnCount=function(n){var r=this._sheet,f=this._viewportIndex,t,e,i,o;if(n){if(t=r._getRowLayout(f),t&&t.length>0)return e=t[t.length-1].row,u(r.getRowCount(),e+2)}else if(i=r._getColumnLayout(f),i&&i.length>0)return o=i[i.length-1].col,u(r.getColumnCount(),o+2);return-1},r.prototype.getGroupsByLevel=function(n,t){for(var i=this,f=[],r=i.getRowOrColumnStartIndex(t),e=i.getRowOrColumnCount(t),o=t?i._sheet.rowRangeGroup:i._sheet.colRangeGroup,u;r<e;)u=o.find(r,n),u?(r=u.end+1,f.push(u)):r++;return f},r.prototype.getGroupDirection=function(n){return n?this._sheet.rowRangeGroup.direction:this._sheet.colRangeGroup.direction},r.prototype.getViewportStartIndex=function(n){var t=this._sheet,i=this._viewportIndex;if(n){if(i===0)return 0;else if(i===1)return t.getFrozenRowCount();else if(i===2)return t.getRowCount()-t.getFrozenTrailingRowCount()}else if(i===0)return 0;else if(i===1)return t.getFrozenColumnCount();else if(i===2)return t.getColumnCount()-t.getFrozenTrailingColumnCount();return-1},r.prototype.getViewportEndIndex=function(n){var t=this._sheet,i=this._viewportIndex;if(n){if(i===0)return t.getFrozenRowCount()-1;else if(i===1)return t.getRowCount()-t.getFrozenTrailingRowCount()-1;else if(i===2)return t.getRowCount()-1}else if(i===0)return t.getFrozenColumnCount()-1;else if(i===1)return t.getColumnCount()-t.getFrozenTrailingColumnCount()-1;else if(i===2)return t.getColumnCount()-1;return-1},r.prototype._processTouch=function(n){n&&this._sheet._isTouchMode&&(n.x-=2,n.y-=2,n.width+=4,n.height+=4)},r.prototype.getRowGroupButton=function(r,f){var e=this,g=e._maxLevel,c,l,o,b;if(g===-1)return t;var v=e._sheet,s=v._getGroupLayout(),h=e._calcMinWidthOrHeight({width:s.width,height:s.height},!0);if(h===0)return t;var y,p,nt=v._getRowLayout(e._viewportIndex,3),a=e._groupButtonInfos,w=a&&a.length;if(w>0)for(c=0;c<w;c++)if(l=a[c],o=nt.findRow(l.index),o&&(!o||!(o.height<=0))){b=i(0,(o.height-h)/2);y=l.level*h+e.PADDING;p=o.y+b;var k=h,tt=u(k,o.height),d=new n.Rect(s.x+y+.5,s.y+p+.5,k,tt);if(e._processTouch(d),d.contains(r,f))return l}return t},r.prototype.getColGroupButton=function(r,f){var e=this,g=e._maxLevel,c,l,o,b;if(g===-1)return t;var v=e._sheet,s=v._getGroupLayout(),h=e._calcMinWidthOrHeight({width:s.width,height:s.height},!1);if(h===0)return t;var y,p,nt=v._getColumnLayout(e._viewportIndex,3),a=e._groupButtonInfos,w=a&&a.length;if(w>0)for(c=0;c<w;c++)if(l=a[c],o=nt.findCol(l.index),o&&(!o||!(o.width<=0))){b=i(0,(o.width-h)/2);y=o.x+b;p=l.level*h+e.PADDING;var k=h,tt=u(k,o.width),d=new n.Rect(s.x+y+.5,s.y+p+.5,tt,k);if(e._processTouch(d),d.contains(r,f))return l}return t},r}();n._RangeGroupPresenter=v;y=function(){function r(n,i,r){var u=this;u._sheet=t;u._rowGroup=t;u._maxLevel=-1;u.PADDING=2;u._sheet=n;u._rowGroup=i;u._maxLevel=typeof r===s?i?n.rowRangeGroup.getMaxLevel():n.colRangeGroup.getMaxLevel():r}return r.prototype.paintGroupHeader=function(t){var v=this,a=v._sheet,g=v._maxLevel;if(a&&!(g<0)){var nt=v._rowGroup,r=a._getGroupLayout(),e=v._calcMinWidthOrHeight({width:r.width,height:r.height},nt);if(e!==0){var tt=g+2,w,b,o,u,s,l,y,p,d,f=a._getSheetLayout(),it=n.ThemeStyleHelper.getCssClassThemeStyle(h),k=n.ThemeStyleHelper.getCssClassThemeStyle(c);if(t.fillStyle=it.backgroundColor,t.strokeStyle=k.borderTopColor,t.font="8.25pt Arial",t.lineWidth=1,nt){if(t.fillRect(r.x,r.y,r.width,f.height),t.strokeRect(r.x-.5,r.y-.5,r.width,f.height+1),t.strokeRect(r.x-.5,f.headerY-.5,r.width,f.colHeaderHeight),a.colHeaderVisible&&f.colHeaderHeight>=e)for(w=v.PADDING,b=i(0,f.headerY+(f.colHeaderHeight-e)/2),o=0;o<tt;o++)u=e-1,s=r.x+w+.5,l=r.y+b,t.fillStyle=k.backgroundColor,t.fillRect(s,l,u,u),t.strokeRect(s,l,u,u),t.fillStyle=k.color,y=""+(o+1),p=t.measureText(y).width,d=a._getFontHeight(t.font),u>=p&&e>=d&&(t.textBaseline="middle",t.fillText(y,s+(u-p)/2,l+u/2)),w+=e}else if(t.fillRect(r.x,r.y,f.width,r.height),t.strokeRect(r.x-.5,r.y-.5,f.width+1,r.height),t.strokeRect(f.headerX-.5,r.y-.5,f.rowHeaderWidth,r.height),a.rowHeaderVisible&&f.rowHeaderWidth>=e)for(w=i(0,f.headerX+(f.rowHeaderWidth-e)/2),b=v.PADDING,o=0;o<tt;o++)u=e-1,s=r.x+w,l=r.y+b+.5,t.fillStyle=k.backgroundColor,t.fillRect(s,l,u,u),t.strokeRect(s,l,u,u),t.fillStyle=k.color,y=""+(o+1),p=t.measureText(y).width,d=a._getFontHeight(t.font),u>=p&&e>=d&&(t.textBaseline="middle",t.fillText(y,s+(u-p)/2,l+u/2)),b+=e}}},r.prototype.getGroupButton=function(r,u){var s=this,c=s._sheet,p=s._maxLevel,y,l,a,e,v,o;if(!c||p<0)return t;var w=s._rowGroup,h=c._getGroupLayout(),f=s._calcMinWidthOrHeight({width:h.width,height:h.height},w);if(f===0)return t;if(y=p+2,o=c._getSheetLayout(),w){if(c.colHeaderVisible&&o.colHeaderHeight>=f)for(l=s.PADDING,a=i(0,o.headerY+(o.colHeaderHeight-f)/2),e=0;e<y;e++){if(v=new n.Rect(h.x+l,h.y+a,f,f),v.contains(r,u))return{index:e};l+=f}}else if(c.rowHeaderVisible&&o.rowHeaderWidth>=f)for(l=i(0,o.headerX+(o.rowHeaderWidth-f)/2),a=s.PADDING,e=0;e<y;e++){if(v=new n.Rect(h.x+l,h.y+a,f,f),v.contains(r,u))return{index:e};a+=f}return t},r.prototype._calcMinWidthOrHeight=function(n,t){var r=0,u=this._maxLevel;return r=t?(n.width-this.PADDING*2)/(u+2):(n.height-this.PADDING*2)/(u+2),i(0,r)},r}();n._RangeGroupHeaderPresenter=y})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){function u(n,t,i,r,u){if(n)return u?u.call(t,t[i]):t[i];var f=t[i];return t[i]=r,u&&u.call(t,f!==r),t}function d(t,i){if(i&&t){var r=n._ThemeContext.getColor(i,t);if(r)return r}return t}function rt(n,t){return t===1?n.colCount:n.rowCount}function ut(n,t,i,r){return r===1?n.getValue(i.row,i.col+t):n.getValue(i.row+t,i.col)}function ft(n,t,i,r){return r===1?n.getColumnWidth(i.col+t)<=0||n.getRowHeight(i.row)<=0:n.getRowHeight(i.row+t)<=0||n.getColumnWidth(i.col)<=0}var g,nt,a,tt,it,s,h,v,c,p,w;n.feature("sparkline",["core.common","core.theme","core.sheet_model"]);var t=null,r=undefined,b=Math.min,o=Math.floor,l=Math.max,y=Math.abs,k=Math.PI,i="undefined",f={Black:"black",Blue:"Blue",Brown:"Brown"},e={FromArgb:function(t,i,r,u){return new n._Color(t,i,r,u).toString()}};n.__invalidValuePlaceHolder={},function(n){n[n.Gaps=0]="Gaps";n[n.Zero=1]="Zero";n[n.Connect=2]="Connect"}(n.EmptyValueStyle||(n.EmptyValueStyle={}));g=n.EmptyValueStyle,function(n){n[n.individual=0]="individual";n[n.group=1]="group";n[n.custom=2]="custom"}(n.SparklineAxisMinMax||(n.SparklineAxisMinMax={}));nt=n.SparklineAxisMinMax;a=function(){function i(n){var i=this,r;if(n)for(r in n)r&&(i[r]=n[r]);else i._axisColor=f.Black,i._firstMarkerColor=e.FromArgb(255,149,179,215),i._highMarkerColor=f.Blue,i._lastMarkerColor=e.FromArgb(255,149,179,215),i._lowMarkerColor=f.Blue,i._markersColor=e.FromArgb(255,36,64,98),i._negativeColor=f.Brown,i._seriesColor=e.FromArgb(255,36,64,98),i.displayEmptyCellsAs=0,i.rightToLeft=!1,i.displayHidden=!1,i.displayXAxis=!1,i._showFirst=!1,i._showHigh=!1,i._showLast=!1,i._showLow=!1,i._showNegative=!1,i._showMarkers=!1,i.manualMax=0,i.manualMin=0,i.maxAxisType=0,i.minAxisType=0,i.groupMaxValue=0,i.groupMinValue=0,i.lineWeight=1;i._worksheet=t}return i.prototype.axisColor=function(n){return u(arguments.length===0,this,"_axisColor",n)},i.prototype.firstMarkerColor=function(n){return u(arguments.length===0,this,"_firstMarkerColor",n)},i.prototype.highMarkerColor=function(n){return u(arguments.length===0,this,"_highMarkerColor",n)},i.prototype.lastMarkerColor=function(n){return u(arguments.length===0,this,"_lastMarkerColor",n)},i.prototype.lowMarkerColor=function(n){return u(arguments.length===0,this,"_lowMarkerColor",n)},i.prototype.markersColor=function(n){return u(arguments.length===0,this,"_markersColor",n)},i.prototype.negativeColor=function(n){return u(arguments.length===0,this,"_negativeColor",n)},i.prototype.seriesColor=function(n){return u(arguments.length===0,this,"_seriesColor",n)},i.prototype.showFirst=function(n){return u(arguments.length===0,this,"_showFirst",n)},i.prototype.showHigh=function(n){return u(arguments.length===0,this,"_showHigh",n)},i.prototype.showLast=function(n){return u(arguments.length===0,this,"_showLast",n)},i.prototype.showLow=function(n){return u(arguments.length===0,this,"_showLow",n)},i.prototype.showNegative=function(n){return u(arguments.length===0,this,"_showNegative",n)},i.prototype.showMarkers=function(n){return u(arguments.length===0,this,"_showMarkers",n)},i.prototype.clone=function(){var t=this,n=new i;return n._axisColor=t._axisColor,n._firstMarkerColor=t._firstMarkerColor,n._highMarkerColor=t._highMarkerColor,n._lastMarkerColor=t._lastMarkerColor,n._lowMarkerColor=t._lowMarkerColor,n._markersColor=t._markersColor,n._negativeColor=t._negativeColor,n._seriesColor=t._seriesColor,n.displayEmptyCellsAs=t.displayEmptyCellsAs,n.rightToLeft=t.rightToLeft,n.displayHidden=t.displayHidden,n.displayXAxis=t.displayXAxis,n._showFirst=t._showFirst,n._showHigh=t._showHigh,n._showLast=t._showLast,n._showLow=t._showLow,n._showNegative=t._showNegative,n._showMarkers=t._showMarkers,n.manualMax=t.manualMax,n.manualMin=t.manualMin,n.maxAxisType=t.maxAxisType,n.minAxisType=t.minAxisType,n.groupMaxValue=t.groupMaxValue,n.groupMinValue=t.groupMinValue,n.lineWeight=t.lineWeight,n},i.prototype._setThemeContext=function(n){this._worksheet=n},i.prototype._getActualColor=function(n){var i=this._worksheet;return i?d(this[n](),i):t},i.prototype._isDefaultValue=function(n,t){switch(n){case"axisColor":return t===f.Black;case"firstMarkerColor":return t===e.FromArgb(255,149,179,215);case"highMarkerColor":return t===f.Blue;case"lastMarkerColor":return t===e.FromArgb(255,149,179,215);case"lowMarkerColor":return t===f.Blue;case"markersColor":return t===e.FromArgb(255,36,64,98);case"negativeColor":return t===f.Brown;case"seriesColor":return t===e.FromArgb(255,36,64,98);case"displayEmptyCellsAs":return t===0;case"rightToLeft":return t===!1;case"displayHidden":return t===!1;case"displayXAxis":return t===!1;case"showFirst":return t===!1;case"showHigh":return t===!1;case"showLast":return t===!1;case"showLow":return t===!1;case"showNegative":return t===!1;case"showMarkers":return t===!1;case"manualMax":return t===0;case"manualMin":return t===0;case"maxAxisType":return t===0;case"minAxisType":return t===0;case"lineWeight":return t===1;default:return!1}},i.prototype.toJSON=function(){var t=this,e={axisColor:t._axisColor,firstMarkerColor:t._firstMarkerColor,highMarkerColor:t._highMarkerColor,lastMarkerColor:t._lastMarkerColor,lowMarkerColor:t._lowMarkerColor,markersColor:t._markersColor,negativeColor:t._negativeColor,seriesColor:t._seriesColor,displayEmptyCellsAs:t.displayEmptyCellsAs,rightToLeft:t.rightToLeft,displayHidden:t.displayHidden,displayXAxis:t.displayXAxis,showFirst:t._showFirst,showHigh:t._showHigh,showLast:t._showLast,showLow:t._showLow,showNegative:t._showNegative,showMarkers:t._showMarkers,manualMax:t.manualMax,manualMin:t.manualMin,maxAxisType:t.maxAxisType,minAxisType:t.minAxisType,lineWeight:t.lineWeight},u={},i,f;for(i in e)f=e[i],t._isDefaultValue(i,f)||(u[i]=f);return n.GC$.isEmptyObject(u)?r:u},i}();n.SparklineSetting=a,function(n){n[n.line=0]="line";n[n.column=1]="column";n[n.winloss=2]="winloss"}(n.SparklineType||(n.SparklineType={}));tt=n.SparklineType,function(n){n[n.Vertical=0]="Vertical";n[n.Horizontal=1]="Horizontal"}(n.DataOrientation||(n.DataOrientation={}));it=n.DataOrientation;s=function(){function i(n,i){var r=this;r.displayDateAxis=!1;r._sparklineGroupManager=t;r._innerList=[];r._axisReference=t;r._axisOrientation=1;r.setting=i;r.sparklineType=n}return i.prototype.add=function(n){var t=this;n&&(t._innerList.push(n),n.group(t),t._adjustGroupMaxMinValue(),t.onGroupChanged())},i.prototype.clear=function(){var n=this;n._innerList&&n._innerList.length!==0&&(n._innerList=[])},i.prototype.remove=function(t){var i=this;return n.ArrayHelper.remove(i._innerList,t),t.onSparklineChanged(),t._group=i.clone(),i._adjustGroupMaxMinValue(),i.onGroupChanged(),i._innerList},i.prototype.contains=function(t){return n.ArrayHelper.contains(this._innerList,t)},i.prototype.onGroupChanged=function(){var n,t;if(this._innerList)for(n=0;n<this._innerList.length;n++)t=this._innerList[n],t&&t.onSparklineChanged()},i.prototype.clone=function(){var n=this,u=n.setting?n.setting.clone():t,r=new i(n.sparklineType,u);return r.displayDateAxis=n.displayDateAxis,r._axisReference=n._axisReference,r._axisOrientation=n._axisOrientation,r},i.prototype.dateAxisData=function(n){return arguments.length===0?u(!0,this,"_axisReference",n):u(!1,this,"_axisReference",n,function(n){n&&this.onGroupChanged()})},i.prototype.dateAxisOrientation=function(n){return arguments.length===0?u(!0,this,"_axisOrientation",n):u(!1,this,"_axisOrientation",n,function(n){n&&this.onGroupChanged()})},i.prototype.count=function(){return this._innerList.length},i.prototype._adjustGroupMaxMinValue=function(){var n=this,t;if(n.setting){n.setting.groupMaxValue=-Number.MAX_VALUE;n.setting.groupMinValue=Number.MAX_VALUE;var r=n.setting.maxAxisType===1,u=n.setting.minAxisType===1,i=!1;if(r||u)for(t=0;t<n._innerList.length;t++){var s=n._innerList[t],f=n._getMaxMinValues(s),e=f.min,o=f.max;r&&n.setting.groupMaxValue<o&&(n.setting.groupMaxValue=o,i=!0);u&&n.setting.groupMinValue>e&&(n.setting.groupMinValue=e,i=!0)}return i}},i.prototype._getMaxMinValues=function(t){var u=-Number.MAX_VALUE,f=Number.MAX_VALUE,s=t.data(),o,e,i,r;if(s)for(o=t._provideValues(s,t.dataOrientation(),!1),e=0;e<o.length;e++)i=o[e],i===n.__invalidValuePlaceHolder&&(i=0),typeof i=="number"&&(r=i,u=u<r?r:u,f=f>r?r:f);return{min:f,max:u}},i.prototype._isDefaultValue=function(n,i){switch(n){case"setting":return i===t;case"displayDateAxis":return i===!1;case"axisReference":return i===t;case"axisOrientation":return i===1;case"sparklines":return i.length===0;default:return!1}},i.prototype.toJSON=function(){var i=this,o={setting:i.setting?i.setting.toJSON():t,displayDateAxis:i.displayDateAxis,sparklineType:i.sparklineType,axisReference:i._axisReference,axisOrientation:i._axisOrientation,sparklines:i._innerList},f={},u,e;for(u in o)e=o[u],i._isDefaultValue(u,e)||(f[u]=e);return n.GC$.isEmptyObject(f)?r:f},i.prototype.fromJSON=function(n,i){var u,e,f,s,h,v,o,l;if(n){if(u=this,u.setting=new a,n.setting){e=n.setting;for(f in u.setting)u.setting.hasOwnProperty(f)&&(e.hasOwnProperty(f)?u.setting[f]=e[f]:f.substr(0,1)==="_"&&(s=f.substr(1),e.hasOwnProperty(s)&&(u.setting[f]=e[s])))}if(n.displayDateAxis!==r&&n.displayDateAxis!==t&&(u.displayDateAxis=n.displayDateAxis),n.sparklineType!==r&&n.sparklineType!==t&&(u.sparklineType=n.sparklineType),n.axisReference!==r&&n.axisReference!==t&&(u._axisReference=n.axisReference),n.axisOrientation!==r&&n.axisOrientation!==t&&(u._axisOrientation=n.axisOrientation),n.sparklines)for(u._innerList=[],h=n.sparklines,v=h.length,o=0;o<v;o++)l=new c,l.fromJSON(h[o],i),u.add(l)}},i}();n.SparklineGroup=s;h=function(){function n(n,t,i,r){var u=this;u.X=n;u.Y=t;u.Width=i;u.Height=r;u.Left=u.X;u.Right=u.Left+u.Width;u.Top=u.Y;u.Bottom=u.Y+u.Height}return n}();n._PositionRect=h;v=function(){function f(n){this._minItemHeight=2;this.info=n;this._clearCache()}return f.prototype.sparklineInfo=function(n){return u(arguments.length===0,this,"info")},f.prototype.paint=function(n,t,i,r,u){var f=this;f._clearCache();var e=f._getWorksheet(),o=f.info,s=f._getCachedValues(),h=o.dateAxisData()?f._getCachedDatetimes():[],c=e._zoomFactor;o.setting()._setThemeContext(e);f._paintCore(n,t,i,r,u,s,h,c)},f.prototype._paintCore=function(n,t,i,r,u,f,e,o){n.save();n.rect(t,i,r,u);n.clip();n.beginPath();var s=this;s.info.sparklineType()===0&&s._paintLines(n,t,i,r,u,f,e,o);s._paintDataPoints(n,t,i,r,u,f,e,o);s._paintAxis(n,t,i,r,u,f,e,o);n.restore()},f.prototype._clearCache=function(){var n=this;n._cachedMinDatetime=Number.MAX_VALUE;n._cachedMaxDatetime=-Number.MAX_VALUE;n._cachedMinValue=Number.MAX_VALUE;n._cachedMaxValue=-Number.MAX_VALUE;n._cachedIndexMapping=t;n._cachedValues=t;n._cachedDatetimes=t},f.prototype._getWorksheet=function(){var n=this.info,t=n&&n.group(),i=t&&t._sparklineGroupManager;if(i)return i._sheet},f.prototype._getSpace=function(n,t){return this.info.sparklineType()===0?3+this._getLineWeight(t)+1:3},f.prototype._leftSpace=function(n){return this._getSpace("left",n)},f.prototype._rightSpace=function(n){return this._getSpace("right",n)},f.prototype._topSpace=function(n){return this._getSpace("top",n)},f.prototype._bottomSpace=function(n){return this._getSpace("bottom",n)},f.prototype._getCachedValues=function(){var n=this._cachedValues;if(!n){var t=this.info,i=t.data(),r=t.dataOrientation();n=this._cachedValues=t._provideValues(i,r)}return n},f.prototype._getCachedDatetimes=function(){var n=this._cachedDatetimes;if(!n){var t=this.info,i=t.group(),r=i.dateAxisData(),u=i.dateAxisOrientation();n=this._cachedDatetimes=t._provideValues(r,u,!0)}return n},f.prototype._getCachedIndexMaping=function(u,f){var s=this._cachedIndexMapping,l,v,o,e,p,h,c;if(s)return s;if(s=this._cachedIndexMapping=[],l=n.__invalidValuePlaceHolder,v=u.length,this.sparklineInfo().displayDateAxis()){var w=f.length,y=b(v,w),a=[];for(y>0&&(a=f.slice(0,y)),a.sort(function(n,t){return n===t?0:(n===l&&(n=0),t===l&&(t=0),n-t)}),p=a.length,o=0;o<p;o++)if(h=a[o],typeof h!==i&&h!==t){for(c=n.ArrayHelper.indexOf(f,h);n.ArrayHelper.contains(s,c);)c=n.ArrayHelper.indexOf(f,h,c+1);isNaN(h)||(e=u[c],e!==r&&e!==t&&isNaN(e)&&e!==l||s.push(c))}}else for(o=0;o<v;o++)e=u[o],typeof e!==i&&e!==t&&isNaN(e)&&e!==l||s.push(o);return s},f.prototype._getValue=function(r,u){var f=u[r];return typeof f===i||f===t?this.sparklineInfo().setting().displayEmptyCellsAs===1&&(f=0):f===n.__invalidValuePlaceHolder&&(f=0),f},f.prototype._paintLines=function(n,r,u,f,e,o,s,h){var l=this,y=l._getCachedIndexMaping(o,s),c,p,w,k=y.length-1,d,it,a,v,g,rt,ut,nt,b,ft,tt;for(k<0&&(k=0),d=l.linePos=[],ut=l.sparklineInfo().setting().displayEmptyCellsAs,c=0;c<k;c++)if(it=l._getValue(y[c],o),typeof it!==i&&it!==t){if(v=c+1,a=l._getValue(y[v],o),typeof a===i||a===t)if(ut===1)a=0;else if(ut===2)for(v=c+2;v<=k;v++)if(nt=o[y[v]],typeof nt!==i&&nt!==t){a=nt;break}typeof a!==i&&a!==t?(g=l._getDataPointPosition(y[c],{Width:f,Height:e},o,s,h),rt=l._getDataPointPosition(y[v],{Width:f,Height:e},o,s,h),b=g.Width/2,p={X:g.X+b,Y:g.Y+b},w={X:rt.X+b,Y:rt.Y+b},d[c]={P1:p,P2:w}):c++}if(ft=d.length,ft>0)for(n.strokeStyle=l.info.setting()._getActualColor("seriesColor"),n.lineCap="round",n.lineWidth=l._getLineWeight(h),c=0;c<ft;c++)(tt=d[c],tt)&&(n.beginPath(),p=tt.P1,w=tt.P2,n.moveTo(r+p.X,u+p.Y),n.lineTo(r+w.X,u+w.Y),n.stroke(),n.closePath())},f.prototype._getDataPointColor=function(u,f,e){var h=this,o=t,tt=Number.MAX_VALUE,it=-Number.MAX_VALUE,c=h._getValue(u,f),s=h.info.setting(),v=h._cachedMinValue,y=h._cachedMaxValue,a=h._getCachedIndexMaping(f,e),p=a.length,w=h.info,b=w.group(),k,d,g,nt,l;return typeof c!==i&&c!==t&&((v===Number.MAX_VALUE||y===-Number.MAX_VALUE)&&h._getMaxMinValue(f),k=v,c===k&&s.showLow()&&(o=s._getActualColor("lowMarkerColor")),(typeof o===i||o===t)&&(d=y,c===d&&s.showHigh()&&(o=s._getActualColor("highMarkerColor"))),(typeof o===i||o===t)&&(b.displayDateAxis?(g=n.ArrayHelper.indexOf(a,u),g===0&&s.showFirst()&&(o=s._getActualColor("firstMarkerColor"))):u===0&&s.showFirst()&&(o=s._getActualColor("firstMarkerColor"))),(typeof o===i||o===t)&&(b.displayDateAxis?(nt=n.ArrayHelper.indexOf(a,u),nt===p-1&&s.showLast()&&(o=s._getActualColor("lastMarkerColor"))):u===p-1&&s.showLast()&&(o=s._getActualColor("lastMarkerColor"))),(typeof o===i||o===t)&&c<0&&s.showNegative()&&(o=s._getActualColor("negativeColor")),(typeof o===i||o===t)&&(l=w.sparklineType(),l===0?s.showMarkers()&&(o=s._getActualColor("markersColor")):l===1?o=s._getActualColor("seriesColor"):l===2&&(o=s._getActualColor("seriesColor")))),o===r||o===t?"Transparent":o},f.prototype._paintDataPoints=function(n,t,i,r,u,f,e,s){for(var c=this,tt={Width:r,Height:u},p=c._getCachedIndexMaping(f,e),it=p.length,rt=c.info.sparklineType(),a,v,h,w,b,l,d,g,nt,y=0;y<it;y++)a=p[y],v=c._getDataPointColor(a,f,e),h=c._getDataPointPosition(a,tt,f,e,s),n.fillStyle!==v&&(n.fillStyle=v),rt===0?(n.save(),w=t+h.X+h.Width/2,b=i+h.Y+h.Height/2,n.translate(w,b),n.rotate(k/4),n.fillRect(0-h.Width/2,0-h.Height/2,h.Width,h.Height),n.restore()):(l=t+h.X+h.Width/4,l=o(l),d=i+h.Y,g=h.Width/2,nt=h.Height,n.fillRect(l,d,g,nt))},f.prototype._paintAxis=function(n,t,i,r,u,f,e,s){var h=this,l=h.info.setting();if(l.displayXAxis&&h._hasAxis(f,e)){var a={Width:r,Height:u},p=h._leftSpace(s),w=a.Width-h._rightSpace(s),v=o(h._getAxisY(a,f,s))+.5,b=v,y=l._getActualColor("axisColor"),c=s;c<1&&(c=1);n.strokeStyle!==y&&(n.strokeStyle=y);n.lineWidth!==c&&(n.lineWidth=c);n.beginPath();n.moveTo(t+p,i+v);n.lineTo(t+w,i+b);n.stroke()}},f.prototype._hasAxisNormal=function(n){var i=this._getActualMaxValue(n),t;return i!==-Number.MAX_VALUE&&(t=this._getActualMinValue(n),t!==Number.MAX_VALUE)?i===t||i*t<=0:!0},f.prototype._hasAxis=function(n,r){var f=this._hasAxisNormal(n),e,o,h,s,u;if(this.info.sparklineType()!==2)return f;if(e=this._getCachedIndexMaping(n,r),o=e.length,!f&&o>0)for(u=0;u<o;u++)if(h=e[u],s=n[h],typeof s!==i&&s!==t)return!0;return f},f.prototype._getMinDatetime=function(n,t){var i=this._cachedMinDatetime;return(isNaN(i)||i===Number.MAX_VALUE)&&this._getMaxMindatetimes(n,t),this._cachedMinDatetime},f.prototype._getMaxDatetime=function(n,t){var i=this._cachedMaxDatetime;return(isNaN(i)||i===-Number.MAX_VALUE)&&this._getMaxMindatetimes(n,t),this._cachedMaxDatetime},f.prototype._getMaxMindatetimes=function(n,r){for(var f=this,o=new Date(0,0,0),s=Number.MAX_VALUE,l=f._getCachedIndexMaping(n,r),a=l.length,h,u,e,c=0;c<a;c++)(h=l[c],u=r[h],isNaN(u))||(e=f._getValue(h,n),e!==t&&typeof e===i||isNaN(e))||typeof u!==i&&u!==t&&(u>o&&(o=u),u<s&&(s=u));f._cachedMaxDatetime=o;f._cachedMinDatetime=s},f.prototype._calcItemWidth=function(n,r,u,f){for(var s=this,b=s._getMinDatetime(r,u),k=s._getMaxDatetime(r,u),h=[],e,y,p=s._getCachedIndexMaping(r,u),d=p.length,a,c,v,w,l,o=0;o<d;o++)(y=p[o],e=u[y],typeof e===i||e===t||isNaN(e))||e&&h.push(e);if(h.sort(function(n,t){return n-t}),a=h.length,a>1&&b!==k){for(c=Number.MAX_VALUE,v=0,o=1;o<a;o++)w=h[o],e=w-h[o-1],e<c&&e>0&&(c=e),v+=e;return l=(n.Width-s._leftSpace(f)-s._rightSpace(f))*c/v/2,l<2&&(l=2),l}else return(n.Width-s._leftSpace(f)-s._rightSpace(f))/2},f.prototype._getItemWidth=function(n,t,i,r){var u=this,f;return u.info.displayDateAxis()?u._calcItemWidth(n,t,i,r):(f=u._getCachedIndexMaping(t,i).length,(n.Width-u._leftSpace(r)-u._rightSpace(r))/f)},f.prototype._getItemX=function(t,i,r,u,f){var e=this,s,h=e._leftSpace(f),l,c,a,v,y,p,w;return e.sparklineInfo().displayDateAxis()?(s=e._getItemWidth(t,r,u,f),l=e._getMaxDatetime(r,u),c=e._getMinDatetime(r,u),l===c)?h+s/2:(a=u[i],!a)?0:(v=t.Width-h-e._rightSpace(f),v-=s,y=l-c,h+o((a-c)/y*v)):(s=e._getItemWidth(t,r,u,f),p=n.ArrayHelper.indexOf(e._getCachedIndexMaping(r,u),i),w=h+s*p,o(w))},f.prototype._getCanvasSize=function(n,t){var i=this,u=n.Width-i._leftSpace(t)-i._rightSpace(t),r;return u=l(u,0),r=n.Height-i._topSpace(t)-i._bottomSpace(t),r=l(r,0),{Width:u,Height:r}},f.prototype._getMaxMinValue=function(n){for(var u=this,e=n.length,r,f=0;f<e;f++)r=n[f],typeof r!==i&&r!==t&&(typeof r!="number"&&(r=0),r<u._cachedMinValue&&(u._cachedMinValue=r),r>u._cachedMaxValue&&(u._cachedMaxValue=r))},f.prototype._getActualMaxValue=function(n){var t=this,i,r;if(t._cachedMaxValue!==-Number.MAX_VALUE&&t._cachedMaxValue||t._getMaxMinValue(n),i=t.info.setting(),r=i.maxAxisType,r===0)return t._cachedMaxValue;else if(r===1)return i.groupMaxValue;else if(r===2)return i.manualMax;return t._cachedMaxValue},f.prototype._getActualMinValue=function(n){var t=this,i,r;if(t._cachedMinValue!==Number.MAX_VALUE&&t._cachedMinValue||t._getMaxMinValue(n),i=t.info.setting(),r=i.minAxisType,r===0)return t._cachedMinValue;else if(r===1)return i.groupMinValue;else if(r===2)return i.manualMin},f.prototype._getItemHeightNormal=function(n,t,i,r){var h=this._getCanvasSize(n,r),u=this._getActualMaxValue(i),e=this._getActualMinValue(i),o=u-e,f,s;if(u===e){if(u===0)return 0;o=y(u)}return f=i[t],f||(f=0),s=h.Height/o,f*s},f.prototype._getItemHeight=function(n,r,u,f){var o=this,l=o.info,h=l.sparklineType(),e,s,c;if(h===0)return o._getItemHeightNormal(n,r,u,f);else if(h===1){if(e=u[r],(typeof e===i||e===t)&&l.setting().displayEmptyCellsAs===1)return 0;if(s=o._getItemHeightNormal(n,r,u,f),s>-o._minItemHeight&&s<o._minItemHeight)if(e>0)return s+o._minItemHeight;else if(e<0)return s-o._minItemHeight;return s}else if(h===2)return(e=u[r],typeof e===i||e===t||e===0||isNaN(e))?0:(c=o._getCanvasSize(n,f),e>=0?c.Height/2:-c.Height/2)},f.prototype._getAxisYNormal=function(n,t,i){var u=this,s=u._getCanvasSize(n,i),r=u._getActualMaxValue(t),f=u._getActualMinValue(t),e,o;if(r===-Number.MAX_VALUE||f===Number.MAX_VALUE)return n.Height/2;if(e=r-f,r===f){if(r===0)return n.Height/2;e=r;r<0&&(r=0)}return o=s.Height/e,u._topSpace(i)+r*o},f.prototype._getAxisY=function(n,t,i){return this.info.sparklineType()===2?n.Height/2:this._getAxisYNormal(n,t,i)},f.prototype._getItemVisibleHeightNormal=function(n,r,u,f){var h=this,a=h._getCanvasSize(n,f),o=h._getActualMaxValue(u),s=h._getActualMinValue(u),l=o-s,c,e,v;if(o===s){if(o===0)return 0;l=o}return c=a.Height/l,e=h._getValue(r,u),(typeof e===i||e===t)&&(e=0),o!==s&&o*s>0?(v=0,e>=0?(e-s)*c:(e-o)*c):e*c},f.prototype._getItemVisibleHeight=function(n,r,u,f){var e=this,c=e.info.sparklineType(),o,h,s;if(c===0)return e._getItemVisibleHeightNormal(n,r,u,f);else if(c===1)return(o=e._getItemVisibleHeightNormal(n,r,u,f),h=e._minItemHeight,o>-h&&o<h&&(s=e._getValue(r,u),(typeof s===i||s===t)&&(s=0),s!==0))?s>0?o+h:o-h:o;else if(c===2)return e._getItemHeight(n,r,u,f)},f.prototype._getDataPointPositionNormal=function(n,t,i,r,u){var f=this,s=f._getItemWidth(t,i,r,u),k=f._getItemX(t,n,i,r,u),a,e,b,v;s<0&&(s=0);s=o(s);s%2==1&&(s+=1);var p=f._getItemHeight(t,n,i,u),w=f._getAxisY(t,i,u),d=f._getActualMaxValue(i),g=f._getActualMinValue(i),c=0;return d<0&&g<0?c=l(f._topSpace(u),w):(c=w,p>=0&&(c=w-p)),a=f._getItemVisibleHeight(t,n,i,u),e=new h(k,c,s,y(a)),p!==0&&(b=f._topSpace(u),e.Y<b&&e.Bottom<b+1?e.Height=o(e.Height+1):(v=t.Height-f._bottomSpace(u),e.Bottom>v&&e.Y>v-1&&(e.Y=v-a,e.Height=a))),e},f.prototype._getLineWeight=function(n){var t=this.info.setting().lineWeight*n;return t<1&&(t=1),t},f.prototype._getDataPointPosition=function(n,r,u,f,e){var c=this,s=c._getLineWeight(e),o,l;if(s++,s<2&&(s=2),o=c._getDataPointPositionNormal(n,r,u,f,e),c.info.sparklineType()===0&&(o.X=o.X+(o.Width-s)/2,l=c._getValue(n,u),typeof l!==i&&l!==t?(l>=0?o.Y-=s/2:o.Y=o.Bottom-s/2,o.Width=s,o.Height=s):(o.Width=0,o.Height=0)),c.info.group().setting.rightToLeft){var a=o.X,v=r.Width-a,y=v-o.Width;o=new h(y,o.Y,o.Width,o.Height)}return o},f}();n.SparklineRender=v;c=function(){function i(n,t,i,r,u,f){var e=this;e.row=n;e.column=t;e._dataOrientation=r;e._data=i;e._group=new s(u,f);e._group.add(e);e._renderer=new v(e)}return i.prototype.group=function(n){var t=this,i;return arguments.length===0?(i=t._group,i||(i=new s,i.add(t),t._group=i),i):(n!==t._group&&(t._group&&t._group.remove(t),t._group=n,t._group&&(t._group.contains(t)||t._group.add(t)),t.onSparklineChanged()),t)},i.prototype.sparklineType=function(n){var t=this;return arguments.length===0?t.group().sparklineType:(t.group().sparklineType!==n&&(t.group().sparklineType=n,t.onSparklineChanged()),t)},i.prototype.onSparklineChanged=function(){var n=this._getWorksheet(),t;n&&(t=this,n.triggerSparklineChanged({sheet:n,sheetName:n._name,sparkline:t}))},i.prototype.setting=function(n){return arguments.length===0?this.group().setting:(this.group().setting=n,this)},i.prototype.data=function(n){var t=this;return arguments.length===0?t._data:(t._data!==n&&(t._data=n,t.onSparklineChanged()),t)},i.prototype.dataOrientation=function(n){var t=this;return arguments.length===0?t._dataOrientation:(t._dataOrientation!==n&&(t._dataOrientation=n,t.onSparklineChanged()),t)},i.prototype.dateAxisData=function(n){return arguments.length===0?this.group().dateAxisData():(this.group().dateAxisData(n),this)},i.prototype.dateAxisOrientation=function(n){return arguments.length===0?this.group().dateAxisOrientation():(this.group().dateAxisOrientation(n),this)},i.prototype.displayDateAxis=function(n){return arguments.length===0?this.group().displayDateAxis:(this.group().displayDateAxis=n,this)},i.prototype.clone=function(){var t=this,n=new i;return n.row=t.row,n.column=t.column,n.data(t.data()),n.dataOrientation(t.dataOrientation()),n.group(t.group().clone()),n},i.prototype.paintSparkline=function(n,t,i,r,u){this._renderer.paint(n,t,i,r,u)},i.prototype._provideValues=function(i,u,f){var s=this._getWorksheet(),h=[],c,o,e;if(!s)return h;for(c=rt(i,u),o=0;o<c;o++)e=ut(s,o,i,u),!this.setting().displayHidden&&ft(s,o,i,u)?e=NaN:e!==t&&e!==r&&(f?e=typeof e=="number"?n._DateTimeHelper.fromOADate(e):Date.parse(e):typeof e!="number"&&(e=n.__invalidValuePlaceHolder)),h.push(e);return h},i.prototype._getWorksheet=function(){return this.group()&&this.group()._sparklineGroupManager?this.group()._sparklineGroupManager._sheet:t},i.prototype._isDefaultValue=function(n,i){switch(n){case"axisReference":return i===t;case"axisOrientation":return i===1;default:return!1}},i.prototype.toJSON=function(){var n=this,r={row:n.row,col:n.column,orientation:n._dataOrientation,data:n._data,type:n._group.sparklineType,setting:n._group.setting,axisReference:n._group._axisReference,axisOrientation:n._group._axisOrientation},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},i.prototype.fromJSON=function(i,u){var f,e;i&&(f=this,i.row!==r&&i.row!==t&&(f.row=i.row),i.col!==r&&i.col!==t&&(f.column=i.col),i.orientation!==r&&i.orientation!==t&&(f._dataOrientation=i.orientation),i.data&&(e=i.data,f._data=new n.Range(e.row,e.col,e.rowCount,e.colCount)))},i}();n.Sparkline=c;p=function(){function i(n,t){this._groups=[];this._sheet=n;this.evaluator=t}return i.prototype.groups=function(n){return u(arguments.length===0,this,"_groups")},i.prototype.add=function(n){this.groups().push(n);n._sparklineGroupManager=this;n._adjustGroupMaxMinValue()},i.prototype.remove=function(t){n.ArrayHelper.remove(this.groups(),t)},i.prototype.contains=function(t){return n.ArrayHelper.contains(this.groups(),t)},i.prototype.count=function(){return this.groups().length},i.prototype._addRows=function(n,t){for(var i,o,f,r,s,u=this,e=0;e<u._groups.length;e++)for(i=u._groups[e],i.displayDateAxis&&(o=u._addRowRange(n,t,i.dateAxisData()),i.dateAxisData(o)),f=0;f<i._innerList.length;f++)r=i._innerList[f],n<=r.row&&(r.row+=t),s=u._addRowRange(n,t,r.data()),r.data(s)},i.prototype._addColumns=function(n,t){for(var i,o,f,r,s,u=this,e=0;e<u._groups.length;e++)for(i=u._groups[e],i.displayDateAxis&&(o=u._addColumnRange(n,t,i.dateAxisData()),i.dateAxisData(o)),f=0;f<i._innerList.length;f++)r=i._innerList[f],n<=r.column&&(r.column+=t),s=u._addColumnRange(n,t,r.data()),r.data(s)},i.prototype._removeRows=function(n,i){for(var u,s,o,h,f,c,e=this,l=0;l<e._groups.length;l++){if(u=e._groups[l],u.displayDateAxis)if(s=e._removeRowRange(n,i,u.dateAxisData()),s!==t&&s!==r)u.dateAxisData(s);else{u.clear();e.remove(u);continue}for(o=[],o=o.concat(u._innerList),h=0;h<o.length;h++)f=o[h],f.row>=n&&f.row<n+i?u.remove(f):(n<=f.row&&(f.row-=i),c=e._removeRowRange(n,i,f.data()),c!==t&&c!==r?f.data(c):u.remove(f));u.count()<=0&&e.remove(u)}},i.prototype._removeColumns=function(n,i){for(var u,s,o,h,f,c,e=this,l=0;l<e._groups.length;l++){if(u=e._groups[l],u.displayDateAxis)if(s=e._removeColumnRange(n,i,u.dateAxisData()),s!==t&&s!==r)u.dateAxisData(s);else{u.clear();e.remove(u);continue}for(o=[],o=o.concat(u._innerList),h=0;h<o.length;h++)f=o[h],f.column>=n&&f.column<n+i?u.remove(f):(n<=f.column&&(f.column-=i),c=e._removeColumnRange(n,i,f.data()),c!==t&&c!==r?f.data(c):u.remove(f));u.count()<=0&&e.remove(u)}},i.prototype.clear=function(n,i,r,u){var f=this,e,l,o,s,h,c;if(arguments.length===0){for(e=0;e<f._groups.length;e++)l=f._groups[e],l&&(l.SparklineGroupManager=t);f._groups=[];return}for(o=n;o<n+r;o++)for(s=i;s<i+u;s++)h=f._find(o,s),h&&(c=h.group(),c.remove(h),c.count()===0&&f.remove(c))},i.prototype._find=function(n,i){for(var e,f,r,u=0;u<this._groups.length;u++)for(e=this._groups[u],f=0;f<e.count();f++)if(r=e[f],r&&r.row===n&&r.column===i)return r;return t},i.prototype._copy=function(i,u,f,e,o,s,h){var w=this,v=w._sheet,d,a,y,p;if(v){for(var g=new n._GcSheetModel(o,s,t),b=f-i,k=e-u,nt=v._getModel(),l,tt=v.getRowCount(),it=v.getColumnCount(),c=0;c<o;c++)if(!h||!v.isRowFilterOut(f+c))for(l=0;l<s;l++)d=nt.getSparkline(i+c,u+l),d&&(a=d.clone(),a.row=f+c,a.column=e+l,y=a.dateAxisData(),y!==t&&y!==r&&w._canOffset(y,b,k,tt,it)&&a.dateAxisData(y.offset(k,b)),p=a.data(),p!==r&&p!==t&&w._canOffset(p,b,k,tt,it)&&a.data(p.offset(k,b)),w.add(a.group()),g.setValue(c,l,a));for(c=0;c<o;c++)if(!h||!v.isRowFilterOut(f+c))for(l=0;l<s;l++)nt.setSparkline(f+c,e+l,g.getValue(c,l))}},i.prototype._canOffset=function(n,t,i,r,u){var f=this._getExpressionRange(n);if(f){var e=f.row<0?0:f.row,o=f.col<0?0:f.col,s=f.row<0?r:f.rowCount,h=f.col<0?u:f.colCount;return!(e+t<0||o+i<0||e+s+t>r||o+h+i>u)}return!1},i.prototype._move=function(i,r,u,f,e,o){var v=this._sheet,l,a,s,h,c;if(v){for(this._moveDataRange(i,r,u,f,e,o),l=v._getModel(),a=new n._GcSheetModel(e,o,t),s=0;s<e;s++)for(h=0;h<o;h++)c=l.getSparkline(i+s,r+h),c&&(c.row=u+s,c.column=f+h,a.setValue(s,h,c)),l.setSparkline(i+s,r+h,t);for(s=0;s<e;s++)for(h=0;h<o;h++)l.setSparkline(u+s,f+h,a.getValue(s,h))}},i.prototype._moveDataRange=function(t,i,r,u,f,e){var s=this,h=new n.Range(t,i,f,e),k=r-t,a,c,v,l,o,y,p,w,b;for(t,a=u-i,c=0;c<s._groups.length;c++)for(v=s._groups[c],l=0;l<v._innerList.length;l++)(o=v._innerList[l],o)&&(y=o.dateAxisData(),p=s._getExpressionRange(y),p&&h.containsRange(p)&&h.contains(o.row,o.column)&&o.dateAxisData(y.offset(a,k)),w=o.data(),b=s._getExpressionRange(w),b&&h.containsRange(b)&&h.contains(o.row,o.column)&&o.data(w.offset(a,k)))},i.prototype._getExpressionRange=function(n){return n},i.prototype._swap=function(n,t,i,r,u,f){},i.prototype._exCopy=function(n,i,u,f,e,o,s,h){var y=this,v=y._sheet,l,a,d,c,p,w;if(v){if(n===v){y._copy(i,u,f,e,o,s);return}var b=f-i,k=e-u,it=n._getModel(),g=v._getModel(),nt=v.getRowCount(),tt=v.getColumnCount();for(l=0;l<o;l++)if(!h||!v.isRowFilterOut(f+l))for(a=0;a<s;a++)d=it.getSparkline(i+l,u+a),d?(c=d.clone(),c.row=f+l,c.column=e+a,p=c.dateAxisData(),p!==r&&p!==t&&y._canOffset(p,b,k,nt,tt)&&c.dateAxisData(p.offset(k,b)),w=c.data(),w!==r&&w!==t&&y._canOffset(w,b,k,nt,tt)&&c.data(w.offset(k,b)),y.add(c.group()),g.setSparkline(f+l,e+a,c)):g.setSparkline(f+l,e+a,t)}},i.prototype._exMove=function(n,i,r,u,f,e,o){var a=this,v=a._sheet,y,p,s,h,c,l,w;if(v){if(n===v){a._move(i,r,u,f,e,o);return}for(y=n._getModel(),p=v._getModel(),a._exMoveDataRange(n,i,r,u,f,e,o),s=0;s<e;s++)for(h=0;h<o;h++)c=y.getSparkline(i+s,r+h),c?(c.row=u+s,c.column=f+h,l=c.group(),w=l.clone(),l.remove(c),l.count()<=0&&n._sparklineGroupManager.remove(l),w.add(c),a.add(w),p.setSparkline(u+s,f+h,c)):p.setSparkline(u+s,f+h,t),y.setSparkline(i+s,r+h,t)}},i.prototype._exMoveDataRange=function(t,i,r,u,f,e,o){var h=this,k=h._sheet,l,p,a,s,v,w,y,b;if(t&&k){if(t===k){h._moveDataRange(i,r,u,f,e,o);return}var c=new n.Range(i,r,e,o),d=u-i,g=f-r;for(l=0;l<t._sparklineGroupManager._groups.length;l++)for(p=t._sparklineGroupManager._groups[l],a=0;a<p._innerList.length;a++)(s=p._innerList[a],s)&&(v=s.dateAxisData(),w=h._getExpressionRange(v),w&&h._sameSource(t,v)&&c.containsRange(w)&&c.contains(s.row,s.column)&&s.dateAxisData(v.offset(g,d)),y=s.data(),b=h._getExpressionRange(y),b&&h._sameSource(t,y)&&c.containsRange(b)&&c.contains(s.row,s.column)&&s.data(y.offset(g,d)))}},i.prototype._sameSource=function(n,t){return!0},i.prototype._addRowRange=function(i,r,u){return u?i>u.row+u.rowCount-1?u:i>u.row?new n.Range(u.row,u.col,u.rowCount+r,u.colCount):new n.Range(u.row+r,u.col,u.rowCount,u.colCount):t},i.prototype._addColumnRange=function(i,r,u){return u?i>u.col+u.colCount-1?u:i>u.col?new n.Range(u.row,u.col,u.rowCount,u.colCount+r):new n.Range(u.row,u.col+r,u.rowCount,u.colCount):t},i.prototype._removeColumnRange=function(i,r,u){var f=this._rangeSubCat(u.col,u.col+u.colCount-1,i,i+r-1);return f?new n.Range(u.row,f.start,u.rowCount,f.end-f.start+1):t},i.prototype._removeRowRange=function(i,r,u){var f=this._rangeSubCat(u.row,u.row+u.rowCount-1,i,i+r-1);return f?new n.Range(f.start,u.col,f.end-f.start+1,u.colCount):t},i.prototype._rangeSubCat=function(n,i,r,u){var f=-1,o,e,h,l,c,s;if(u<n)return h=u-r+1,f=n-h,o=i-h,{start:f,end:o};if(r>i)return f=n,o=i,{start:f,end:o};if(r<=n){for(l=i-n+1,c=0,e=n;e<=u;e++)if(e<=i)c++;else break;return f=r,o=f+l-c-1,{start:f,end:o}}for(s=0,e=n;e<=i;e++)f===-1&&(e<r||e>u)&&(f=e),(e<r||e>u)&&s++;return f!==-1&&s>0?(o=f+s-1,{start:f,end:o}):t},i.prototype.toJSON=function(){var n=this._groups,t,i;if(!n||n.length===0)return r;for(t=[],i=0;i<n.length;i++)t.push(n[i].toJSON());return t.length===0?r:t},i.prototype.fromJSON=function(n,t){var i,u,r;if(n&&n.length!==0)for(i=0;i<n.length;i++)u=n[i],r=new s,r.fromJSON(u,t),this.add(r)},i}();n.WorksheetSparklineGroupManager=p;w=function(n){function t(){n.apply(this,arguments)}return __extends(t,n),t}(c);n.SparklineValue=w})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var i,ht,ct,lt,b,at,vt,yt,s,k,h,pt,wt,bt,kt,dt,c,gt,ni,d,ti,ii;n.feature("touch",["core.common","core.sheet_action","core.sheet_model","core.sheet_border"]);var t=null,u=undefined,r=Math.abs,v=Math.min,g=Math.max,nt=Math.pow,tt=Math.atan2,o=Math.PI,p=Math.round,w=Math.sqrt,it=Math.atan,rt=Math.log,ut=Math.floor,f="undefined",ri=100,ui=function(){function r(){var n=this;n._elements=[];n._pressedPointers={length:0};n._checkPointerIntervalId=-1;n._manipulationProcessor=new fi;n._tapEventProcesser=new ei}return r.prototype.ManipulationStarting=function(n){var t=this._manipulationProcessor;t&&(t.ManipulationStarting=n)},r.prototype.ManipulationStarted=function(n){var t=this._manipulationProcessor;t&&(t.ManipulationStarted=n)},r.prototype.ManipulationCompleted=function(n){var t=this,i=t._manipulationProcessor;i&&(i.ManipulationCompleted=function(i){if(n){n(i);var r=t._touchMouseMessageFilter;r&&r.postProcessManipulationComplete()}})},r.prototype.ManipulationInertiaStarting=function(n){var t=this._manipulationProcessor;t&&(t.ManipulationInertiaStarting=n)},r.prototype.ManipulationDelta=function(n){var t=this._manipulationProcessor;t&&(t.ManipulationDelta=n)},r.prototype.Tapped=function(n){var t=this._tapEventProcesser;t&&(t.Tapped=n)},r.prototype.DoubleTapped=function(n){var t=this._tapEventProcesser;t&&(t.DoubleTapped=n)},r.prototype.RightTapped=function(n){var t=this._tapEventProcesser;t&&(t.RightTapped=n)},r.prototype.TouchOperatorStart=function(n){this.touchOperatorStart=n},r.prototype.TouchOperatorEnd=function(n){this.touchOperatorEnd=n},r.prototype._getOffsetRelativeToDownElement=function(t,i){var r={left:0,top:0},u,f,e;return u=i?i.element:this._downElement.element,t!==u&&(f=n.GC$(t).offset(),e=n.GC$(u).offset(),r.left=f.left-e.left,r.top=f.top-e.top),r},r.prototype.msPointerDown=function(t,r){var u,f,e,o;(r.pointerType===r.MSPOINTER_TYPE_TOUCH||r.pointerType==="touch")&&(u=this._getOffsetRelativeToDownElement(r.target,t),f=this._down(t,r.target,r.pointerId,new i(r.offsetX+u.left,r.offsetY+u.top),r.timeStamp),f&&n.util.cancelDefault(r),this._downElement.eventFlag==="sheet"&&(e=r.pageX-(r.offsetX+u.left),o=r.pageY-(r.offsetY+u.top),window.gcGlobal.canvasOffset={top:o,left:e}))},r.prototype.msPointerMove=function(t){if(t.pointerType===t.MSPOINTER_TYPE_TOUCH||t.pointerType==="touch"){if(this._pressedPointers[t.pointerId]===u)return!1;var r=this._getOffsetRelativeToDownElement(t.target),f=this._move(t.pointerId,new i(t.offsetX+r.left,t.offsetY+r.top),t.timeStamp);f&&n.util.cancelDefault(t)}},r.prototype.msPointerUp=function(t){if(t.pointerType===t.MSPOINTER_TYPE_TOUCH||t.pointerType==="touch"){if(this._pressedPointers[t.pointerId]===u)return!1;var r=this._getOffsetRelativeToDownElement(t.target),f=this._up(t.pointerId,new i(t.offsetX+r.left,t.offsetY+r.top));f&&n.util.cancelDefault(t)}},r.prototype.msPointerCancel=function(t){if(t.pointerType===t.MSPOINTER_TYPE_TOUCH||t.pointerType==="touch"){if(this._pressedPointers[t.pointerId]===u)return!1;var r=this._getOffsetRelativeToDownElement(t.target),f=this._cancel(t.pointerId,new i(t.offsetX+r.left,t.offsetY+r.top));f&&n.util.cancelDefault(t)}},r.prototype._getElementOffset=function(t){var i=n.GC$(t).offset();return i?(isNaN(document.body.clientTop)||(i.top+=document.body.clientTop),isNaN(document.body.clientLeft)||(i.left+=document.body.clientLeft)):i={top:0,left:0},i},r.prototype.touchStart=function(t,r){for(var u,s,o=this._getElementOffset(t.element),f=!1,e=0;e<r.changedTouches.length;e++)u=r.changedTouches[e],s=n.util.browser.mozilla?(new Date).valueOf():r.timeStamp,f=this._down(t,r.target,u.identifier,new i(u.pageX-o.left,u.pageY-o.top),s)||f;f&&n.util.cancelDefault(r)},r.prototype.touchMove=function(t){for(var r,o,e=this._getElementOffset(this._downElement.element),u=!1,f=0;f<t.changedTouches.length;f++)r=t.changedTouches[f],o=n.util.browser.mozilla?(new Date).valueOf():t.timeStamp,u=this._move(r.identifier,new i(r.pageX-e.left,r.pageY-e.top),o)||u;u&&n.util.cancelDefault(t)},r.prototype.touchEnd=function(t){for(var r,e=this._getElementOffset(this._downElement.element),u=!1,f=0;f<t.changedTouches.length;f++)r=t.changedTouches[f],u=this._up(r.identifier,new i(r.pageX-e.left,r.pageY-e.top))||u;u&&n.util.cancelDefault(t)},r.prototype.touchCancel=function(t){for(var r,e=this._getElementOffset(this._downElement.element),u=!1,f=0;f<t.changedTouches.length;f++)r=t.changedTouches[f],u=this._cancel(r.identifier,new i(r.pageX-e.left,r.pageY-e.top))||u;u&&n.util.cancelDefault(t)},r.prototype._startCheckPointer=function(){this._checkPointerIntervalId===-1&&(this._checkPointerIntervalId=setInterval(this._checkCancelPointer,200))},r.prototype._endCheckPointer=function(){this._checkPointerIntervalId!==-1&&(clearInterval(this._checkPointerIntervalId),this._checkPointerIntervalId=-1)},r.prototype._checkCancelPointer=function(){var i=this,u,t;if(!i._manipulationProcessor||i._manipulationProcessor._process!==3){var e=(new Date).valueOf(),n=[],r=i._pressedPointers,f=0;for(u in r)e-r[u].time>200&&n.push(r[u]),f++;for(t=0;t<n.length;t++)i._cancel(n[t].id,n[t].position),delete r[n[t].id];f===n.length&&i._endCheckPointer()}},r.prototype._fixPosition=function(t){var i=this,r,u;if(i._downElement===i._manipulationElement)return t;r=n.GC$(i._downElement.element).offset();u=n.GC$(i._manipulationElement.element).offset();t.X+=r.left-u.left;t.Y+=r.top-u.top},r.prototype._setCaptureElement=function(n,i){var r=this,h=r._elements,f,u;for(r._manipulationElement=t,r._touchMouseMessageFilter=t,f=0;f<h.length;f++)if(h[f]===n){var o=h[f],e=t,s=t;if(o.canDoManipulation&&!o.canDoManipulation()){for(f=0;f<h.length;f++)if(u=h[f],u!==o&&u.level>=0&&u.level<o.level&&(!u.canDoManipulation||u.canDoManipulation())){e=u;break}if(e===t)return!1}if(o.canDoTap&&!o.canDoTap()){for(f=0;f<h.length;f++)if(u=h[f],u!==o&&u.level>=0&&u.level<o.level&&(!u.canDoTap||u.canDoTap())){s=u;break}if(s===t)return!1}e===t&&(e=o);s===t&&(s=o);r._downElement=o;r._manipulationElement=e;r._tapElement=s;r.ManipulationStarting(e.manipulationStarting||t);r.ManipulationStarted(e.manipulationStarted||t);r.ManipulationDelta(e.manipulationDelta||t);r.ManipulationInertiaStarting(e.manipulationInertiaStarting||t);r.ManipulationCompleted(e.manipulationCompleted||t);r.Tapped(s.tapped||t);r.DoubleTapped(s.doubleTapped||t);r.RightTapped(s.rightTapped||t);r.TouchOperatorStart(e.touchOperatorStart||t);r.TouchOperatorEnd(e.touchOperatorEnd||t);e.messageFilter&&(r._touchMouseMessageFilter=o.messageFilter);break}return!0},r.prototype._down=function(n,i,r,e,o){var s=this;return s._pressedPointers[r]!==u?!1:s._pressedPointers.length===0&&!s._setCaptureElement(n,i)?!1:s._manipulationElement===t||typeof s._manipulationElement===f?!1:s._pressedPointers.length>=s._manipulationElement.maxPointer?!0:s._touchMouseMessageFilter&&s._touchMouseMessageFilter.preProcessPointerDown()?!1:(s._fixPosition(e),s._touchMouseMessageFilter&&s._pressedPointers.length===0&&s._touchMouseMessageFilter.preProcessManipulationStarting(),s._pressedPointers[r]={id:r,time:(new Date).valueOf(),position:e},s._pressedPointers.length++,s._manipulationProcessor&&(s._manipulationProcessor.PreviewPointerDown(i,r,e,o),s._manipulationProcessor.PointerDown(r,e,s._pressedPointers.length,o)),s._pressedPointers.length===1&&s._tapEventProcesser&&s._tapEventProcesser.PointerDown(e),s._pressedPointers.length===1&&s.touchOperatorStart&&s.touchOperatorStart({Position:e}),!0)},r.prototype._move=function(n,t,i){var r=this;return r._pressedPointers[n]===u?!1:r._touchMouseMessageFilter&&r._touchMouseMessageFilter.preProcessPointerMove()?!1:(r._fixPosition(t),r._pressedPointers[n]={id:n,time:(new Date).valueOf(),position:t},r._manipulationProcessor&&r._manipulationProcessor.PointerMove(n,t,i),!0)},r.prototype._up=function(n,t){var i=this;return i._pressedPointers[n]===u?!1:(delete i._pressedPointers[n],i._pressedPointers.length--,i._touchMouseMessageFilter&&i._touchMouseMessageFilter.preProcessPointerUp())?!1:(i._fixPosition(t),i._manipulationProcessor&&(i._manipulationProcessor.PreviewPointerUp(n),i._manipulationProcessor.PointerUp(n)),i._pressedPointers.length===0&&i._tapEventProcesser&&(i._tapEventProcesser.PreviewPointerUp(t),i._tapEventProcesser.PointerUp(t)),i._pressedPointers.length===0&&i.touchOperatorEnd&&i.touchOperatorEnd({Position:t}),i._touchMouseMessageFilter&&i._pressedPointers.length===0&&i._manipulationProcessor._process===0&&i._touchMouseMessageFilter.postProcessManipulationComplete(),!0)},r.prototype._cancel=function(n,t){return this._up(n,t)},r.prototype.attachDettach=function(i,r){var u=this,o=i.element,h=u._elements,c=n.ArrayHelper.indexOf(h,i);if((!(c>=0)||!r)&&(!(c<0)||r)){var s="."+i.eventFlag,e=".gcSheet",l="MSPointerDown"+e,a="MSPointerMove"+e+s,v="MSPointerUp"+e+s,y="MSPointerCancel"+e+s,p="MSLostPointerCapture"+e+s,w="pointerdown"+e,b="pointermove"+e+s,k="pointerup"+e+s,d="LostPointerCapture"+e+s,g="pointercancel"+e+s,nt="touchstart"+e,tt="touchmove"+e,it="touchend"+e,rt="touchcancel"+e,ut=window.navigator.msPointerEnabled||window.navigator.pointerEnabled;r?ut?(o.style.msTouchAction!==t&&typeof o.style.msTouchAction!==f&&(o.style.msTouchAction="none"),o.style.touchAction!==t&&typeof o.style.touchAction!==f&&(o.style.touchAction="none"),function(t,i){n.GC$(o).bind(l,function(n){u.msPointerDown(t,n)}).bind(w,function(n){u.msPointerDown(t,n)})}.call(u,i),n.GC$(document).bind(a,function(n){u.msPointerMove(n)}).bind(v,function(n){u.msPointerUp(n)}).bind(b,function(n){u.msPointerMove(n)}).bind(k,function(n){u.msPointerUp(n)}).bind(y,function(n){u.msPointerCancel(n)}).bind(p,function(n){u.msPointerCancel(n)}).bind(d,function(n){u.msPointerCancel(n)}).bind(g,function(n){u.msPointerCancel(n)})):(function(t,i){n.GC$(o).bind(nt,function(n){u.touchStart(t,n)})}.call(u,i),n.GC$(o).bind(tt,function(n){u.touchMove(n)}).bind(it,function(n){u.touchEnd(n)}).bind(rt,function(n){u.touchCancel(n)})):ut?(n.GC$(o).unbind(l).unbind(w),n.GC$(document).unbind(a).unbind(b).unbind(v).unbind(k).unbind(y).unbind(g).unbind(p).unbind(d)):n.GC$(o).unbind(nt).unbind(tt).unbind(it).unbind(rt);r?h.push(i):h.splice(c,1)}},r.prototype.dispose=function(){for(var t=this._elements,n=t.length-1;n>=0;n--)this.attachDettach(t[n],!1)},r}();n.TouchEventProvider=ui;var fi=function(){function n(){var n=this;n._totalTranslateX=0;n._totalTranslateY=0;n._totalScale=1;n._totalRotation=0;n._totalExpansion=0;n._process=0;n._workingModes=511;n._manipulatorPointers=new pi;n._minimumScaleRotateRadius=20;n._deltaHistory=new hi}return n.prototype.PreviewPointerDown=function(n,t,i,r){var u=this,f;u._process===3&&u.Complete(!0);u._isScroll=u._process===2?u._manipulatorPointers.Count()===1:!1;u._originalSource=n;f=new yi(t);f.PreviousPoint=i;f.InitialPoint=i;u._manipulatorPointers.Add(f);u._lastTime=r;u._manipulatorPointers.Count()>1&&(u.TranslateXLocked=!1,u.TranslateYLocked=!1,u._process===1&&u.StartManipulation())},n.prototype.PointerDown=function(n,t,i,r){this._process===0&&i===1&&this.Starting(this._manipulatorPointers.ItemAt(0).InitialPoint)},n.prototype.PointerMove=function(n,i,u){var f=this,c,l,a,h,o,s;if(f._workingModes!==0&&f._manipulatorPointers.Contains(n)){if(f._process===1&&f._manipulatorPointers.Count()===1){if(c=f.IsPinned(),!f.SupportsMode(1)&&!f.SupportsMode(2)&&!c)return;if(e.AreClose(i,f._manipulatorPointers.Find(n).InitialPoint))return;else l=r(i.X-f._manipulatorPointers.Find(n).InitialPoint.X),a=r(i.Y-f._manipulatorPointers.Find(n).InitialPoint.Y),f.SetTranslateRails(l,a)}if(!(u-f._lastTime<e.ManipulationDeltaInterval)){if(f._manipulatorPointers.Find(n).CurrentPoint=i,h=f._manipulatorPointers.Count(),h>1)for(o=0;o<h;o++)if(s=f._manipulatorPointers.ItemAt(o),!s.CurrentPoint)return;for(f.PointerMoveCore(u),f._lastTime=u,h=f._manipulatorPointers.Count(),o=0;o<h;o++)s=f._manipulatorPointers.ItemAt(o),s.PreviousPoint=s.CurrentPoint,s.CurrentPoint=t}}},n.prototype.PointerUp=function(n){var i=this;i._needFireEvents&&(i.OnManipulationCompleted(i._needFireEvents),i._needFireEvents=t)},n.prototype.PreviewPointerUp=function(n){var t=this;t._manipulatorPointers.Contains(n)&&(t._manipulatorPointers.Remove(n),t._process===2?t._manipulatorPointers.Count()===0&&(t.SupportsMode(64)||t.SupportsMode(256)||t.SupportsMode(128)?t.StartInertia():t.Complete(!0)):t._process===2||t._process===3?t.Complete(!0):t._process===1&&t.Complete(!1))},n.prototype.PointerMoveCore=function(n){var t=this,f,e,o,c,s,v,y=t.CalculateTranslate(),h,r,w,u,b,p;if(f=y.translateX,e=y.translateY,v=y.position,h=t.CalculateRotationAndScale(),s=h.rotation,c=h.scale,o=h.expansion,t._totalTranslateX+=f,t._totalTranslateY+=e,t._totalScale*=c,t._totalRotation+=s,t._totalExpansion+=o,r=new si,r.expansion=o,r.rotation=s,r.timeStamp=n-t._lastTime,r.translateX=f,r.translateY=e,t._deltaHistory.Enqueue(r),t._lastPosition=v,t._process===1||t._process===2){if(t._process===1&&(w=t.StartManipulation(),w))return;if(u=new a,u.Expansion=o,u.Rotation=s,u.Scale=c,u.Translation=new i(f,e),b=new l(t._deltaHistory),p=new ft(t._originalSource,t.GetCumulative(),u,!1,v,b),t.OnManipulationDelta(p),p.IsComplete){t.Complete(!0);return}}},n.prototype.StartManipulation=function(){var n=this,t;return(n._process=2,t=new di(n._originalSource,n._manipulatorPointers.Count(),n.GetCumulative(),n._manipulatorPointers.ItemAt(0).InitialPoint),n.OnManipulationStarted(t),t.IsComplete)?(n.Complete(!0),!0):!1},n.prototype.SetTranslateRails=function(n,t){var i=oi.GetTranslateLocked(n,t);this.TranslateXLocked=i.translateXLocked;this.TranslateYLocked=i.translateYLocked},n.prototype.CalculateTranslate=function(){var t=0,r=0,u=this.GetAveragePoint(),n=u.currentAveragePoint,f=u.previousAveragePoint,e=new i(n.X,n.Y);return t=n.X-f.X,r=n.Y-f.Y,{translateX:t,translateY:r,position:e}},n.prototype.CalculateRotationAndScale=function(){var n=this,t=0,r=1,u=0,i;return n.SupportsMode(16)&&n._manipulatorPointers.Count()===1&&n.IsPinned()&&(t=n.CalculateSingleManipulatorRotation(n._manipulatorPointers.ItemAt(0).CurrentPoint,n._manipulatorPointers.ItemAt(0).PreviousPoint,n._pivot)),n._manipulatorPointers.Count()>1&&(i=n.CalculateMultiManipulatorRotationAndScale(),t=i.rotation,r=i.scale,u=i.expansion),t=t/o*180,{rotation:t,scale:r,expansion:u}},n.prototype.CalculateMultiManipulatorRotationAndScale=function(){for(var d,n=this,y=n.GetAveragePoint(),c=y.currentAveragePoint,l=y.previousAveragePoint,f=n.IsPinned(),t=f?n._pivot.Center:new i(0,0),e=0,p=1,w=0,a=0,o=0,s=0,v=0,g=n._manipulatorPointers.Count(),h=0;h<g;h++){var r=n._manipulatorPointers.ItemAt(h).CurrentPoint,u=n._manipulatorPointers.ItemAt(h).PreviousPoint,b=n.GetLength(r,c),k=n.GetLength(u,l),nt=f?new i(u.X-t.X,u.Y-t.Y):new i(u.X-l.X,u.Y-l.Y),tt=f?new i(r.X-t.X,r.Y-t.Y):new i(r.X-c.X,r.Y-c.Y),it=n.GetLength(u,t),rt=n.GetLength(r,t);k>=n._minimumScaleRotateRadius&&b>=n._minimumScaleRotateRadius&&(o++,s+=b,v+=k,(!f||it>=n._minimumScaleRotateRadius)&&rt>=n._minimumScaleRotateRadius&&(d=n.AngleBetween(nt,tt),e+=d,a++))}return e=a>0&&n.SupportsMode(16)?e/a:0,o>0&&n.SupportsMode(32)?(n._isScroll||(p=s/v),w=(s-v)/o,n._lastDistance=s/o):n._lastDistance=0,{rotation:e,scale:p,expansion:w}},n.prototype.CalculateSingleManipulatorRotation=function(n,t,r){var u=new i(r.Center.X,r.Center.Y),e=new i(t.X-u.X,t.Y-u.Y),o=new i(n.X-u.X,n.Y-u.Y),s=v(1,nt(this.GetLength(t,u)/r.Radius,4)),f=this.AngleBetween(e,o);return isNaN(f)?0:f*s},n.prototype.AngleBetween=function(n,t){var i=tt(t.Y,t.X)-tt(n.Y,n.X);return i>o?i-=o*2:i<-o&&(i+=o*2),i},n.prototype.SupportsMode=function(n){return(this._workingModes&n)!=0},n.prototype.GetLength=function(n,t){return w((t.X-n.X)*(t.X-n.X)+(t.Y-n.Y)*(t.Y-n.Y))},n.prototype.GetAveragePoint=function(){for(var t,s,h,u=0,f=0,e=0,o=0,n=this._manipulatorPointers.Count(),r=0;r<n;r++)t=this._manipulatorPointers.ItemAt(r),u+=t.PreviousPoint.X,f+=t.PreviousPoint.Y,e+=t.CurrentPoint.X,o+=t.CurrentPoint.Y;return s=new i(u/n,f/n),h=new i(e/n,o/n),{currentAveragePoint:h,previousAveragePoint:s}},n.prototype.IsPinned=function(){return this._pivot&&!isNaN(this._pivot.Radius)},n.prototype.Starting=function(n){var i=this,r=new gi(i._originalSource,i._workingModes,t,n);return r.Mode=511,i.OnManipulationStarting(r),i.ManipulationMode=r.Mode,r.Mode===0?(i.Complete(!1),!1):(i._workingModes=r.Mode,i._pivot=r.Pivot,i._process=1,!0)},n.prototype.Complete=function(n){var r=this,f=r._process===3,u;r._process=0;r._inertiaTimer&&(clearInterval(r._inertiaTimer),r._inertiaTimer=t);n&&(u=new bi(r._originalSource,r.GetCumulative(),f,i.Round(r._lastPosition),new l(r._deltaHistory)),r._process===3?r._needFireEvents=u:r.OnManipulationCompleted(u));r._deltaHistory.Clear();r._manipulatorPointers.Clear();r._pivot=t;r._totalTranslateX=0;r._totalTranslateY=0;r._totalScale=1;r._totalRotation=0;r._totalExpansion=0;r.TranslateXLocked=!1;r.TranslateYLocked=!1;r._workingModes=0},n.prototype.StartInertia=function(){var i=this,n=new vi,r=new l(i._deltaHistory),u,f;if(n.CurrentTranslateXVelocity=i.SupportsMode(64)?r.Linear().X:0,n.CurrentTranslateYVelocity=i.SupportsMode(64)?r.Linear().Y:0,n.CurrentExpansionVelocity=i.SupportsMode(256)?r.Expansion():0,n.CurrentRotationVelocity=i.SupportsMode(128)?r.Angular():0,n.CurrentTranslateXVelocity===0&&n.CurrentTranslateYVelocity===0&&n.CurrentExpansionVelocity===0&&n.CurrentRotationVelocity===0){i.Complete(!0);return}n.TranslateBehavior=new ai(n.CurrentTranslateXVelocity,n.CurrentTranslateYVelocity);n.ExpansionBehavior=new ci(n.CurrentExpansionVelocity);n.RotationBehavior=new li(n.CurrentRotationVelocity);r=new l(t,n.CurrentTranslateXVelocity,n.CurrentTranslateYVelocity,n.CurrentRotationVelocity,n.CurrentExpansionVelocity);u=new ki(i._originalSource,i.GetCumulative(),new a,r,n.ExpansionBehavior,n.RotationBehavior,n.TranslateBehavior);i.OnManipulationInertiaStarting(u);n.TranslateBehavior=u.TranslationBehavior;n.ExpansionBehavior=u.ExpansionBehavior;n.RotationBehavior=u.RotationBehavior;n.TranslateBehavior.XDeceleration<=0&&n.TranslateBehavior.YDeceleration<=0&&n.TranslateBehavior.SetDecelerationInternal(.003);n.ExpansionBehavior.DecelerationInternal()<=0&&n.ExpansionBehavior.SetDecelerationInternal(.002);n.RotationBehavior.DecelerationInternal()<=0&&n.RotationBehavior.SetDecelerationInternal(.003);f=(new Date).valueOf();n.StartTime=f;n.LastTime=f;n.DeltaXRemainder=0;n.DeltaYRemainder=0;i._process=3;i._inertiaTimer=setInterval(function(){try{i.InertiaTick(n)}catch(t){}},20)},n.prototype.InertiaTick=function(n){var u=this,k=(new Date).valueOf(),it=k-n.StartTime,f=k-n.LastTime,b,h,tt,g;if(f!==0){var c=n.CurrentTranslateXVelocity,v=n.CurrentTranslateYVelocity,y=n.CurrentExpansionVelocity,w=n.CurrentRotationVelocity;n.CurrentTranslateXVelocity=u.GetInertiaCurrentVelocity(f,n.TranslateBehavior.XDeceleration,n.CurrentTranslateXVelocity);n.CurrentTranslateYVelocity=u.GetInertiaCurrentVelocity(f,n.TranslateBehavior.YDeceleration,n.CurrentTranslateYVelocity);n.CurrentExpansionVelocity=u.GetInertiaCurrentVelocity(f,n.ExpansionBehavior.DecelerationInternal(),n.CurrentExpansionVelocity);n.CurrentRotationVelocity=u.GetInertiaCurrentVelocity(f,n.RotationBehavior.DecelerationInternal(),n.CurrentRotationVelocity);c=(c+n.CurrentTranslateXVelocity)/2;v=(v+n.CurrentTranslateYVelocity)/2;y=(y+n.CurrentExpansionVelocity)/2;w=(w+n.CurrentRotationVelocity)/2;n.LastTime=k;b=!1;u.IsZero(c)&&u.IsZero(v)&&u.IsZero(y)&&u.IsZero(w)&&(b=!0);var e=f*c,o=f*v,s=f*y,nt=f*w,d=1;if(u._lastDistance>0&&(u._lastDistance+s*2<0&&(s=-u._lastDistance/2+1),u._lastDistance!==0&&(d=(u._lastDistance+s*2)/u._lastDistance)),u._totalExpansion+=s,u._totalRotation+=nt,u._totalTranslateX+=e,u._totalTranslateY+=o,u._totalScale*=d,u._lastDistance+=s,u._lastPosition=new i(u._lastPosition.X+e,u._lastPosition.Y+o),n.DeltaXRemainder+=e,n.DeltaYRemainder+=o,b){if(e=p(n.DeltaXRemainder),o=p(n.DeltaYRemainder),u.IsZero(e)&&u.IsZero(o)){u.Complete(!0);return}}else r(n.DeltaXRemainder)>=1&&(e=n.DeltaXRemainder,n.DeltaXRemainder-=e),r(n.DeltaYRemainder)>=1&&(o=n.DeltaYRemainder,n.DeltaYRemainder-=o);if(h=new a,h.Translation=new i(e,o),h.Scale=d,h.Expansion=s,h.Rotation=nt,tt=new l(t,n.CurrentTranslateXVelocity,n.CurrentTranslateYVelocity,n.CurrentRotationVelocity,n.CurrentExpansionVelocity),g=new ft(u._originalSource,u.GetCumulative(),h,!0,i.Round(u._lastPosition),tt),u.OnManipulationDelta(g),g.IsComplete){u.Complete(!0);return}b&&u.Complete(!0)}},n.prototype.GetInertiaCurrentVelocity=function(n,t,i){if(this.IsZero(i))return 0;var r;return r=i<0?i+t*n:i-t*n,(r<0&&i>0||r>0&&i<0)&&(r=0),r},n.prototype.GetCumulative=function(){var n=this,t=new a;return t.Expansion=n._totalExpansion,t.Rotation=n._totalRotation,t.Scale=n._totalScale,t.Translation=new i(n._totalTranslateX,n._totalTranslateY),t},n.prototype.IsZero=function(n){return r(n)<=22204460492503131e-32},n.prototype.GetManipulationData=function(n,i,r,u){var f=this,e=new a,o=new a,s=0,h=0,c=0,v=0,p=f.SupportsMode(4)&&f.TranslateXLocked,w=f.SupportsMode(8)&&f.TranslateYLocked,y;return f.SupportsMode(1)&&!w&&(!n||f.SupportsMode(64))&&(e.Translation.X=i.Translation.X,o.Translation.X=r.Translation.X,s=u.Linear().X),f.SupportsMode(2)&&!p&&(!n||f.SupportsMode(64))&&(e.Translation.Y=i.Translation.Y,o.Translation.Y=r.Translation.Y,h=u.Linear().Y),f.SupportsMode(32)&&(!n||f.SupportsMode(256))?(e.Scale=i.Scale,e.Expansion=i.Expansion,o.Scale=r.Scale,o.Expansion=r.Expansion,v=u.Expansion()):(e.Scale=i.Scale,o.Scale=1),f.SupportsMode(16)&&(!n||f.SupportsMode(128))&&(e.Rotation=i.Rotation,o.Rotation=r.Rotation,c=u.Angular()),y=new l(t,s,h,c,v),new wi(e,o,y)},n.prototype.OnManipulationStarting=function(n){this.ManipulationStarting&&n&&this.ManipulationStarting(n)},n.prototype.OnManipulationStarted=function(n){this.ManipulationStarted&&n&&this.ManipulationStarted(n)},n.prototype.OnManipulationCompleted=function(n){if(this.ManipulationCompleted&&n){var t=this.GetManipulationData(!1,n.Cumulative,n.Cumulative,n.Velocities);n.Cumulative=t.Cumulative;n.Velocities=t.Velocities;this.ManipulationCompleted(n)}},n.prototype.OnManipulationInertiaStarting=function(n){if(this.ManipulationInertiaStarting&&n){var t=this.GetManipulationData(!1,n.Cumulative,n.Delta,n.Velocities);n.Cumulative=t.Cumulative;n.Delta=t.Delta;n.Velocities=t.Velocities;this.ManipulationInertiaStarting(n)}},n.prototype.OnManipulationDelta=function(n){if(this.ManipulationDelta&&n){var t=this.GetManipulationData(n.IsInertia,n.Cumulative,n.Delta,n.Velocities);n.Cumulative=t.Cumulative;n.Delta=t.Delta;n.Velocities=t.Velocities;this.ManipulationDelta(n)}},n}(),ei=function(){function n(){}return n.prototype.PointerDown=function(n){var t=this,i;(t._pointerCount++,t._pointerCount>1)||(i=(new Date).valueOf(),t._firstDownPosition&&e.DoubleTappedAreClose(n,t._firstDownPosition)&&i-t._lastDownTimestamp<e.DoubleTappedTimeOffset?t._count++:(t._firstDownPosition=n,t._count=1),t._lastDownPosition=n,t._lastDownTimestamp=i)},n.prototype.PointerUp=function(n){var i=this;i._needFireEvents&&(i._needFireEvents instanceof et?i.OnTapped(i._needFireEvents):i._needFireEvents instanceof ot&&i.OnRightTapped(i._needFireEvents),i._needFireEvents=t)},n.prototype.PreviewPointerUp=function(n){var i=this,r;(i._pointerCount--,i._pointerCount>0)||(r=(new Date).valueOf(),e.AreClose(n,i._lastDownPosition)?r-i._lastDownTimestamp>e.RightTappedTimeOffset?i._needFireEvents=new ot(i._lastDownPosition):i._count>1?(i._count=0,i.OnDoubleTapped(new nr(i._firstDownPosition)),i._firstDownPosition=t):i._needFireEvents=new et(i._lastDownPosition):i._firstDownPosition=t)},n.prototype.PointerCancel=function(){this._firstDownPosition=t},n.prototype.OnTapped=function(n){this.Tapped&&n&&this.Tapped(n)},n.prototype.OnDoubleTapped=function(n){this.DoubleTapped&&n&&this.DoubleTapped(n)},n.prototype.OnRightTapped=function(n){this.RightTapped&&n&&this.RightTapped(n)},n}(),oi=function(){function n(){}return n.GetTranslateLocked=function(n,t){var u=!1,r=!1,i;return n!==0&&(i=it(t/n)/o*180,i<20&&(u=!0)),n===0?r=!0:(i=it(t/n)/o*180,i>75&&i<105&&(r=!0)),{translateXLocked:u,translateYLocked:r}},n}(),e=function(){function n(){}return n.AreClose=function(t,i){if(!t||!i)return!1;var e=n.TappedMaxOffset,o=n.TappedMaxOffset,s=n.TappedMaxDistance,h=n.TappedMaxDistance,u=t.X-i.X,f=t.Y-i.Y;return r(u)<e&&r(f)<o&&w(u*u+f*f)<v(s,h)},n.DoubleTappedAreClose=function(t,i){if(!t||!i)return!1;var e=n.DoubleTappedMaxOffset,o=n.DoubleTappedMaxOffset,s=n.DoubleTappedMaxDistance,h=n.DoubleTappedMaxDistance,u=t.X-i.X,f=t.Y-i.Y;return r(u)<e&&r(f)<o&&w(u*u+f*f)<v(s,h)},n.TouchScrollOnRails=function(t){t?(n.TappedMaxOffset=13,n.TappedMaxDistance=15):(n.TappedMaxOffset=3,n.TappedMaxDistance=4)},n.TappedMaxOffset=13,n.TappedMaxDistance=15,n.DoubleTappedMaxOffset=13,n.DoubleTappedMaxDistance=15,n.DoubleTappedTimeOffset=400,n.RightTappedTimeOffset=1e3,n.ManipulationDeltaInterval=20,n}();n.TouchHelper=e;i=function(){function n(n,t){this.X=n;this.Y=t}return n.Round=function(t){return t?new n(p(t.X),p(t.Y)):new n(-1,-1)},n}();n.TouchPoint=i;var si=function(){function n(){}return n}(),hi=function(){function n(){var n=this;n._count=0;n._start=0;n._maxCount=10;n._history=new Array(n._maxCount)}return n.prototype.GetVelocity=function(n){var t=this,i,r,u;if(t._count===0)return 0;var o=t.Item(t._count-1).timeStamp,f=0,e=(1+t._count)*t._count/2;for(i=t._count-1;i>=0;i--)r=0,n===0?r=t.Item(i).translateX:n===1?r=t.Item(i).translateY:n===2?r=t.Item(i).expansion:n===3&&(r=t.Item(i).rotation),u=t.GetSingleVelocity(r,t.Item(i).timeStamp),u*=i+1,f+=u;return f/e},n.prototype.GetSingleVelocity=function(n,t){return n/t},n.prototype.Item=function(n){return this._history[this.GetInnerListIndex(n)]},n.prototype.Last=function(){return this._history[this._count-1]},n.prototype.Enqueue=function(n){var t=this,r,i;for(t._count===10&&t.Dequeue(),t._count++,t._history[t.GetInnerListIndex(t._count-1)]=n,r=e.ManipulationDeltaInterval*t._maxCount,i=0;i<t._count;i++)n.timeStamp-t._history[i].timeStamp>r&&(t.Dequeue(),i--)},n.prototype.Dequeue=function(){var n=this;n._start++;n._start===n._maxCount&&(n._start=0);n._count--},n.prototype.Clear=function(){this._count=0},n.prototype.GetInnerListIndex=function(n){return(this._start+n)%this._maxCount},n}(),l=function(){function n(n,t,r,u,f){var e=this;n?e._history=n:(e._linear=new i(t,r),e._angular=u,e._expansion=f)}return n.prototype.Linear=function(){var n=this;return n._linear||(n._linear=new i(n._history.GetVelocity(0),n._history.GetVelocity(1))),n._linear},n.prototype.Angular=function(){var n=this;return(n._angular===t||typeof n._angular===f)&&(n._angular=n._history.GetVelocity(3)),n._angular},n.prototype.Expansion=function(){var n=this;return(n._expansion===t||typeof n._expansion===f)&&(n._expansion=n._history.GetVelocity(2)),n._expansion},n}(),ci=function(){function n(n){this._initialVelocity=n;this._decelerationInternal=0}return n.prototype.DecelerationInternal=function(){var n=this;return isNaN(n.DesiredExpansion)||n.DesiredExpansion===0?isNaN(n.DesiredDeceleration)?n._decelerationInternal:n.DesiredDeceleration:.5*n._initialVelocity*n._initialVelocity/n.DesiredExpansion},n.prototype.SetDecelerationInternal=function(n){this._decelerationInternal=n},n}(),li=function(){function n(n){this._initialVelocity=n;this._decelerationInternal=0}return n.prototype.DecelerationInternal=function(){var n=this;return isNaN(n.DesiredRotation)||n.DesiredRotation===0?isNaN(n.DesiredDeceleration)?n._decelerationInternal:n.DesiredDeceleration:.5*n._initialVelocity*n._initialVelocity/n.DesiredRotation},n.prototype.SetDecelerationInternal=function(n){this._decelerationInternal=n},n}(),ai=function(){function n(n,t){var i=this;i._initialXVelocity=n;i._initialYVelocity=t;i.XDeceleration=0;i.YDeceleration=0;i._decelerationInternal=0;i._velocity=w(i._initialXVelocity*i._initialXVelocity+i._initialYVelocity*i._initialYVelocity)}return n.prototype.UpdateXYDecelerations=function(){var n=this;isNaN(n.DesiredDisplacement)||n.DesiredDisplacement===0?isNaN(n.DecelerationInternal())||n.DecelerationInternal()===0?(n.XDeceleration=0,n.YDeceleration=0):(n.XDeceleration=n.DecelerationInternal()*r(n._initialXVelocity)/n._velocity,n.YDeceleration=n.DecelerationInternal()*r(n._initialYVelocity)/n._velocity):(n.XDeceleration=.5*n._velocity*r(n._initialXVelocity)/n.DesiredDisplacement,n.YDeceleration=.5*n._velocity*r(n._initialYVelocity)/n.DesiredDisplacement)},n.prototype.SetDesiredDeceleration=function(n){this.DesiredDeceleration=n;this.UpdateXYDecelerations()},n.prototype.SetDesiredDisplacement=function(n){this.DesiredDisplacement=n;this.UpdateXYDecelerations()},n.prototype.DecelerationInternal=function(){return this.IsDefault()?this._decelerationInternal:this.DesiredDeceleration},n.prototype.SetDecelerationInternal=function(n){this._decelerationInternal=n;this.UpdateXYDecelerations()},n.prototype.IsDefault=function(){return isNaN(this.DesiredDeceleration)&&isNaN(this.DesiredDisplacement)},n}(),vi=function(){function n(){}return n}(),a=function(){function n(){var n=this;n.Translation=new i(0,0);n.Scale=0;n.Rotation=0;n.Expansion=0}return n}(),ur=function(){function n(n,t){this.Center=n;this.Radius=t}return n}(),yi=function(){function n(n){this.ID=n}return n}(),pi=function(){function n(){this._list=[]}return n.prototype.Contains=function(n){for(var i,t=0;t<this._list.length;t++)if(i=this._list[t],i.ID===n)return!0;return!1},n.prototype.Add=function(n){this._list.push(n)},n.prototype.Remove=function(n){for(var t=0;t<this._list.length;t++)if(this._list[t].ID===n){this._list.splice(t,1);break}},n.prototype.Count=function(){return this._list.length},n.prototype.ItemAt=function(n){return this._list[n]},n.prototype.Find=function(n){for(var r,i=0;i<this._list.length;i++)if(r=this._list[i],r.ID===n)return r;return t},n.prototype.Clear=function(){this._list.splice(0,this._list.length)},n}(),wi=function(){function n(n,t,i){this.Cumulative=n;this.Delta=t;this.Velocities=i}return n}(),y=function(){function n(n){this.OriginalSource=n}return n}(),bi=function(n){function t(t,i,r,u,f){n.call(this,t);var e=this;e.Cumulative=i;e.IsInertia=r;e.Position=u;e.Velocities=f}return __extends(t,n),t}(y),ft=function(n){function t(t,i,r,u,f,e){n.call(this,t);var o=this;o.Cumulative=i;o.Delta=r;o.IsInertia=u;o.Position=f;o.Velocities=e}return __extends(t,n),t}(y),ki=function(n){function t(t,i,r,u,f,e,o){n.call(this,t);var s=this;s.Cumulative=i;s.Delta=r;s.Velocities=u;s.ExpansionBehavior=f;s.RotationBehavior=e;s.TranslationBehavior=o}return __extends(t,n),t}(y),di=function(n){function t(t,i,r,u){n.call(this,t);this.PointerCount=i;this.Cumulative=r;this.Position=u}return __extends(t,n),t}(y),gi=function(n){function t(t,i,r,u){n.call(this,t);this.Mode=i;this.Pivot=r;this.Position=u}return __extends(t,n),t}(y),et=function(){function n(n){this.Position=n}return n}(),ot=function(){function n(n){this.Position=n}return n}(),nr=function(){function n(n){this.Position=n}return n}(),st;(function(n){n[n.All=511]="All";n[n.None=0]="None";n[n.TranslateX=1]="TranslateX";n[n.TranslateY=2]="TranslateY";n[n.TranslateRailsX=4]="TranslateRailsX";n[n.TranslateRailsY=8]="TranslateRailsY";n[n.Rotate=16]="Rotate";n[n.Scale=32]="Scale";n[n.TranslateInertia=64]="TranslateInertia";n[n.RotateInertia=128]="RotateInertia";n[n.ScaleInertia=256]="ScaleInertia"})(st||(st={})),function(n){n[n.NotStart=0]="NotStart";n[n.Starting=1]="Starting";n[n.Started=2]="Started";n[n.InertiaStarted=3]="InertiaStarted"}(ht||(ht={})),function(n){n[n.TranslateX=0]="TranslateX";n[n.TranslateY=1]="TranslateY";n[n.Expansion=2]="Expansion";n[n.Rotation=3]="Rotation"}(ct||(ct={})),function(n){n[n.column=1]="column";n[n.row=2]="row";n[n.range=3]="range"}(lt||(lt={}));b=function(){function i(n){this._sheet=n}return i.prototype._getTouchCanvas=function(t,i){var r=this._canvas;return r?(t!==n.DPIHelper.getLogicWidth(r)||i!==n.DPIHelper.getLogicHeight(r))&&n.DPIHelper.setSize(r,t,i):(r=document.createElement("canvas"),n.DPIHelper.adjustDevicePixel(r,null,this._sheet),n.DPIHelper.setSize(r,t,i)),r},i.prototype._getNewZoomFactor=function(n,t){var i=n*t;return i>4?i=4:i<.5&&(i=.5),i},i.prototype._saveCanvas=function(t,i,r,u){var e=this,c=n.DPIHelper.getLogicWidth(t),l=n.DPIHelper.getLogicHeight(t),f=e._getTouchCanvas(c,l),o=f.getContext("2d"),s=n.DPIHelper.getScaleX(f),h=n.DPIHelper.getScaleY(f);o.scale(1/s,1/h);o.drawImage(t,0,0,f.width,f.height,0,0,f.width,f.height);o.scale(s,h);e._canvas=f;e._oldSheetLayout=i;e._oldGroupLayout=r;e._oldZoomFactor=u},i.prototype._restoreCanvas=function(t,i,r){var nt=this,tt=nt._sheet,e,o,s,h,c,l,a,v,et=n.DPIHelper.getLogicWidth(t),ot=n.DPIHelper.getLogicHeight(t),ut=tt.getFrozenTrailingColumnCount(),ft=tt.getFrozenTrailingRowCount(),w=ut>0?1:0,b=ft>0?1:0,k=nt._oldGroupLayout,d=tt._getGroupLayout(),y=nt._oldSheetLayout,g=tt._getSheetLayout(),it=i/nt._oldZoomFactor,p=t.getContext("2d"),u=n.DPIHelper.getScaleX(t),f=n.DPIHelper.getScaleY(t),rt=nt._canvas;p.save();p.fillStyle=r;p.fillRect(0,0,et,ot);tt._render.paintGroup(p,null);e=k.x+k.width;o=k.y+k.height;s=y.frozenTrailingX-e-w;h=y.frozenTrailingY-o-b;c=d.x+d.width;l=d.y+d.height;a=s*it;v=h*it;e*=u;o*=f;s*=u;h*=f;c*=u;l*=f;a*=u;v*=f;p.scale(1/u,1/f);p.drawImage(rt,e,o,s,h,c,l,a,v);ut>0&&(e=y.frozenTrailingX-w,o=k.y+k.height,s=y.frozenTrailingWidth+w,h=y.frozenTrailingY-o-b,c=g.frozenTrailingX-w,l=d.y+d.height,a=g.frozenTrailingWidth+w,v=h*it,e*=u,o*=f,s*=u,h*=f,c*=u,l*=f,a*=u,v*=f,p.drawImage(rt,e,o,s,h,c,l,a,v));ft>0&&(e=k.x+k.width,o=y.frozenTrailingY-b,s=y.frozenTrailingX-e-w,h=y.frozenTrailingHeight+b,c=d.x+d.width,l=g.frozenTrailingY-b,a=s*it,v=g.frozenTrailingHeight+b,e*=u,o*=f,s*=u,h*=f,c*=u,l*=f,a*=u,v*=f,p.drawImage(rt,e,o,s,h,c,l,a,v));ut>0&&ft>0&&(e=y.frozenTrailingX-w,o=y.frozenTrailingY-b,s=y.frozenTrailingWidth+w,h=y.frozenTrailingHeight+b,c=g.frozenTrailingX-w,l=g.frozenTrailingY-b,a=g.frozenTrailingWidth+w,v=g.frozenTrailingHeight+b,e*=u,o*=f,s*=u,h*=f,c*=u,l*=f,a*=u,v*=f,p.drawImage(rt,e,o,s,h,c,l,a,v));p.scale(u,f);p.restore()},i.prototype.startZoom=function(){var t=this,n=t._sheet,r=n._zoomFactor,i=n._render._getBufferCtx();i&&t._saveCanvas(i.canvas,n._getSheetLayout(),n._getGroupLayout(),r)},i.prototype.continueZoom=function(n){var f=this,i=f._sheet,r,u,e;i.endEdit()&&(r=f._getNewZoomFactor(n,f._oldZoomFactor),i._zoomFactor!==r&&(i.triggerUserZooming({sheet:i,sheetName:i._name,oldZoomFactor:i._zoomFactor,newZoomFactor:r}),i._zoomFactor=r,i.invalidateLayout(),u=i._render,e=u._getCtx(),e&&f._restoreCanvas(e.canvas,r,u._getGrayAreaBackColor(!1)),u._paintFloatingObject(t,r),u._paintComment(t)))},i.prototype.endZoom=function(n){var i=this,t=i._sheet;t._zoomFactor=i._getNewZoomFactor(n,i._oldZoomFactor);t._needSyncHScrollbarSize=!0;t._needSyncVScrollbarSize=!0;t.invalidateLayout();t.repaint()},i}(),function(n){n[n.NotStarted=0]="NotStarted";n[n.HorizontalOnly=1]="HorizontalOnly";n[n.VecticalOnly=2]="VecticalOnly";n[n.Free=3]="Free"}(at||(at={}));var tr=function(){function i(n){this.BOUNDARY_SCOPE=200;this.INERTIA_BOUNDARY_SCOPE=20;this.sheet=n}return i.prototype._getNewTopRowInfo=function(n,t){var i=t,r=0,e=0,u=this.sheet,o=u._cachePool,s,h,c=u._getSheetLayout().viewportY,f=u._getViewportRowLayout(1).findRow(i);if(f)if(n>0){for(s=u._getScrollableRow(-1),r=c-f.y;i>s&&r<n;)i--,r+=o.getZoomRowHeight(i);e=n-r}else if(n<0){for(h=u._getLastVisualScrollRow(),r=-(f.y+f.height-c);i<h&&r>n;)i++,r-=o.getZoomRowHeight(i);e=n-r}return{row:i,offset:e}},i.prototype._getNewLeftColumnInfo=function(n,t){var i=t,r=0,e=0,u=this.sheet,o,s,h=u._cachePool,c=u._getSheetLayout().viewportX,f=u._getViewportColumnLayout(1).findCol(i);if(f)if(n>0){for(o=u._getScrollableColumn(-1),r=c-f.x;i>o&&r<n;)i--,r+=h.getZoomColWidth(i);e=n-r}else if(n<0){for(s=u._getLastVisualScrollColumn(),r=-(f.x+f.width-c);i<s&&r>n;)i++,r-=h.getZoomColWidth(i);e=n-r}return{col:i,offset:e}},i.prototype._createTouchViewportColumnLayout=function(t){for(var f=new n._LayoutModel,i=this.sheet,h=i._cachePool,e=i._getSheetLayout(),r=g(i.frozenColCount,i._scrollLeftCol),c=i.getColumnCount()-i._frozenTrailingColCount,o=e.viewportX+t,u,s=e.viewportWidth-t;s>0&&r<c;r++)u=h.getZoomColWidth(r),f.push(new n._Layout(-1,r,o,-1,u,-1)),o+=u,s-=u;return f},i.prototype._updateTouchViewportColumnLayout=function(n){var t=this.sheet._colLayoutCache;t.viewport||(t.viewport={});t.viewport[1]=this._createTouchViewportColumnLayout(n)},i.prototype._createTouchViewportRowLayout=function(t){for(var f=new n._LayoutModel,i=this.sheet,h=i._cachePool,e=i._getSheetLayout(),r=g(i.frozenRowCount,i._scrollTopRow),c=i.getRowCount()-i._frozenTrailingRowCount,o=e.viewportY+t,u,s=e.viewportHeight-t;s>0&&r<c;r++)u=h.getZoomRowHeight(r),f.push(new n._Layout(r,-1,-1,o,-1,u)),o+=u,s-=u;return f},i.prototype._updateTouchViewportRowLayout=function(n){var t=this.sheet._rowLayoutCache;t.viewport||(t.viewport={});t.viewport[1]=this._createTouchViewportRowLayout(n)},i.prototype._invalidateLayout=function(){var n=this.sheet,t=n._colLayoutCache.viewport,i=n._rowLayoutCache.viewport;n.invalidateLayout();n._colLayoutCache.viewport=t;n._rowLayoutCache.viewport=i},i.prototype._paintAdornment=function(n,t){var o=this,i=o.sheet,s=i._render,e,r,u,f;if(n&&!i._paintSuspended&&!(i._layoutSuspended>0)&&(e=i._getSheetLayout(),!i._hoverCell))for(u=0;u<=2;u++)for(f=0;f<=2;f++)(r=e.viewportRect(u,f),r&&r.width!==0&&r.height!==0)&&(!t||r.intersectRect(t))&&s.paintSelection(n,u,f,t)},i.prototype._getBoundaryFactor=function(n,t){return parseInt(-t/(n/t+1)+t)},i.prototype._getDistance=function(n,t){return parseInt(t*(-t/(n-t)-1))},i.prototype._triggerTopRowChanged=function(n,t,i){n.triggerTopRowChanged({sheet:n,sheetName:n._name,oldTopRow:t,newTopRow:i})},i.prototype._triggerLeftColChanged=function(n,t,i){n.triggerLeftColumnChanged({sheet:n,sheetName:n._name,oldLeftCol:t,newLeftCol:i})},i.prototype._vScrollTo=function(t,i,u,f){var e=this,o=e.sheet,et=o._scrollTopRow,it=e._getNewTopRowInfo(t,et),b=it.row,s=it.offset,tt,nt,a,ft,w,h;if(o._scrollTopRow=b,o._paintSuspended||o._layoutSuspended>0)return!1;if(n.util._useDoubleBuffer()){var rt=o.getBounds(),k=o._getSheetLayout(),y=k.viewportY,d=k.viewportHeight,l=rt?rt.x:k.x,g=k.width,ot=o._render,st=ot._getCtx();if(t<0){if(e.cachedOffsetY=0,e.cachedAvailableOffsetY=0,a=o._getViewportRowLayout(1),a&&a.length>0&&(tt=a.findRow(b)),tt&&(nt=a[a.length-1],nt.row>=b)){var ut=2,p=y+r(t),c=v(y+d,nt.y+nt.height)-p;c>=0&&(c-=ut,e._updateTouchViewportRowLayout(s-tt.height),u.x=l,u.y=p,u.width=g,u.height=c,u.tx=l,u.ty=y,f.x=l,f.y=y+c,f.width=g,f.height=d-c)}}else if(t>0){if(ft=o._getScrollableRow(-1),b===ft&&s>0)if(e.cachedOffsetY>0&&e.cachedAvailableOffsetY>0){if(w=e.cachedOffsetY+t,h=e._getBoundaryFactor(w,e.BOUNDARY_SCOPE),t=h-e.cachedAvailableOffsetY,s=h,t<=0)return i;if(i&&h>=e.INERTIA_BOUNDARY_SCOPE)return!0;e.cachedOffsetY=w;e.cachedAvailableOffsetY=h}else{if(s>=e.BOUNDARY_SCOPE&&(t-=s-(e.BOUNDARY_SCOPE-1),s=e.BOUNDARY_SCOPE-1,t<=0))return i;if(w=e._getDistance(s,e.BOUNDARY_SCOPE),h=s,i&&h>=e.INERTIA_BOUNDARY_SCOPE)return!0;e.cachedOffsetY=w;e.cachedAvailableOffsetY=h}else e.cachedOffsetY=0,e.cachedAvailableOffsetY=0;if(t<d){var ut=2,p=y,c=d-t;o.getFrozenTrailingRowCount()>0&&(c-=1);e._updateTouchViewportRowLayout(s);u.x=l;u.y=p;u.width=g;u.height=c;u.tx=l;u.ty=p+t;f.x=l;f.y=p;f.width=g;f.height=t+ut}}}return!1},i.prototype._hScrollTo=function(t,i,u,f){var e=this,o=e.sheet,et=o._scrollLeftCol,it=e._getNewLeftColumnInfo(t,et),b=it.col,s=it.offset,tt,nt,a,ft,w,h;if(o._scrollLeftCol=b,o._paintSuspended||o._layoutSuspended>0)return!1;if(n.util._useDoubleBuffer()){var rt=o.getBounds(),k=o._getSheetLayout(),y=k.viewportX,d=k.viewportWidth,l=rt?rt.y:k.y,g=k.height,ot=o._render,st=ot._getCtx();if(t<0){if(e.cachedOffsetX=0,e.cachedAvailableOffsetX=0,a=o._getViewportColumnLayout(1),a&&a.length>0&&(tt=a.findCol(b)),tt&&(nt=a[a.length-1],nt.col>=b)){var ut=2,p=y+r(t),c=v(y+d,nt.x+nt.width)-p;c>=0&&(c-=ut,e._updateTouchViewportColumnLayout(s-tt.width),u.x=p,u.y=l,u.width=c,u.height=g,u.tx=y,u.ty=l,f.x=y+c,f.y=l,f.width=d-c,f.height=g)}}else if(t>0){if(ft=o._getScrollableColumn(-1),b===ft&&s>0)if(e.cachedOffsetX>0&&e.cachedAvailableOffsetX>0){if(w=e.cachedOffsetX+t,h=e._getBoundaryFactor(w,e.BOUNDARY_SCOPE),t=h-e.cachedAvailableOffsetX,s=h,t<=0)return i;if(i&&h>=e.INERTIA_BOUNDARY_SCOPE)return!0;e.cachedOffsetX=w;e.cachedAvailableOffsetX=h}else{if(s>=e.BOUNDARY_SCOPE&&(t-=s-(e.BOUNDARY_SCOPE-1),s=e.BOUNDARY_SCOPE-1,t<=0))return i;if(w=e._getDistance(s,e.BOUNDARY_SCOPE),h=s,i&&h>=e.INERTIA_BOUNDARY_SCOPE)return!0;e.cachedOffsetX=w;e.cachedAvailableOffsetX=h}else e.cachedOffsetX=0,e.cachedAvailableOffsetX=0;if(t<d){var ut=2,p=y,c=d-t;o.getFrozenTrailingColumnCount()>0&&(c-=1);e._updateTouchViewportColumnLayout(s);u.x=p;u.y=l;u.width=c;u.height=g;u.tx=p+t;u.ty=l;f.x=p;f.y=l;f.width=t+ut;f.height=g}}}return!1},i.prototype._fillRect=function(n,t,i,r,u,f){n.fillStyle=t;n.fillRect(i,r,u,f)},i.prototype._getColHeaderFillStyle=function(t,i,r,u,f){var e,o=n.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-columnHeader-normal"),h=o&&o.backgroundImage,a=o&&o.backgroundColor,c,s,v,l;if(h&&h.indexOf("linear-gradient")!==-1)for(c=n.util.getLinearGradientColors(h),e=t.createLinearGradient(i+u/2,r,i+u/2,r+f),s=0,v=c.length;s<v;s++)l=c[s],e.addColorStop(l.point,l.color);else a&&(e=a);return e},i.prototype._getRowHeaderFillStyle=function(t,i,r,u,f){var e=n.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-rowHeader-normal");return e&&e.backgroundColor},i.prototype._fillGrayArea=function(n){var f=this,o=f.sheet,ft=o.getBounds(),s=o._getSheetLayout(),p=o._render,e=p._getGrayAreaBackColor(!1),h=p._getCtx(),c=p._getBufferCtx(),t,i,r,u,nt=o._getViewportRowLayout(1),tt,w,l,b,it,v,k,rt,d,a,g,ut,y;t=s.headerX;r=s.width;tt=o._getScrollableRow(-1);w=nt.findRow(tt);w&&(i=s.viewportY,u=w.y-i-1,u>0&&(n?(l=s.rowHeaderWidth,b=f._getRowHeaderFillStyle(h,t,i,l-1,u+1),f._fillRect(h,b,t,i,l-1,u+1),f._fillRect(c,b,t,i,l-1,u+1),f._fillRect(h,e,t+l,i,r-l,u),f._fillRect(c,e,t+l,i,r-l,u)):(f._fillRect(h,e,t,i,r,u),f._fillRect(c,e,t,i,r,u))));it=o._getScrollableRow(o.getRowCount(),!0);v=nt.findRow(it);v&&(i=v.y+v.height,u=s.frozenTrailingY-i-1,u>0&&(f._fillRect(h,e,t,i,r,u),f._fillRect(c,e,t,i,r,u)));k=o._getViewportColumnLayout(1);i=s.headerY;u=s.height;rt=o._getScrollableColumn(-1);d=k.findCol(rt);d&&(t=s.viewportX,r=d.x-t-1,r>0&&(n?(a=s.colHeaderHeight,g=f._getColHeaderFillStyle(h,t,i,r+1,a-1),f._fillRect(h,g,t,i,r+1,a-1),f._fillRect(c,g,t,i,r+1,a-1),f._fillRect(h,e,t,i+a,r,u-a),f._fillRect(c,e,t,i+a,r,u-a)):(f._fillRect(h,e,t,i,r,u),f._fillRect(c,e,t,i,r,u))));ut=o._getScrollableColumn(o.getColumnCount(),!0);y=k.findCol(ut);y&&(t=y.x+y.width,r=s.frozenTrailingX-t-1,r>0&&(f._fillRect(h,e,t,i,r,u),f._fillRect(c,e,t,i,r,u)))},i.prototype._strokeLine=function(n,t,i,r,u,f){n.beginPath();n.strokeStyle=t;n.moveTo(i,r);n.lineTo(u,f);n.stroke()},i.prototype._makeUpGridline=function(t){var s=this,r=s.sheet,g=r.getBounds(),i=r._getSheetLayout(),k=r._render,a=r.gridline.color,v=n.ThemeStyleHelper.getVisualStateThemeStyle(0,"gc-columnHeader-normal"),y=v&&v.borderBottomColor,h=k._getCtx(),u,f,c,l,d=r._getViewportRowLayout(1),p,e,w,b,o;u=i.headerX;c=i.width;p=r._getScrollableRow(-1);e=d.findRow(p);e&&(f=i.viewportY,l=e.y-f,l>0&&(s._strokeLine(h,a,u,e.y-.5,u+c,e.y-.5),t&&s._strokeLine(h,y,i.frozenX-.5,f,i.frozenX-.5,e.y)));w=r._getViewportColumnLayout(1);f=i.headerY;l=i.height;b=r._getScrollableColumn(-1);o=w.findCol(b);o&&(u=i.viewportX,c=o.x-u,c>0&&(s._strokeLine(h,a,o.x-.5,f,o.x-.5,f+l),t&&s._strokeLine(h,y,u,i.frozenY-.5,o.x,i.frozenY-.5)))},i.prototype._getScrollDirection=function(n,t){var i=0;return this.sheet.parent&&this.sheet.parent.touchScrollOnRails()?(i|=n!==0?1:0,i|=t!==0?2:0):i=3,i},i.prototype._continueScrollCore=function(t,i,r,u){var s=this,c=s.sheet,k=!0,d=!0,a=c._render,w=a._getCtx(),e,f,o,h,l=(r&2)!=0,v=(r&1)!=0,b;if(v||l){var y=c.getBounds(),p=c._getSheetLayout(),g=y?y.y:p.y,nt=p.height,tt=y?y.x:p.x,it=p.width;l&&(f={},e={},k=s._vScrollTo(i,u,e,f),a.copyScreen(e.x,e.y,e.width,e.height,e.tx,e.ty));v&&(o={},h={},d=s._hScrollTo(t,u,o,h),a.copyScreen(o.x,o.y,o.width,o.height,o.tx,o.ty),l||(e=o,f=h));b=c.parent;b&&!b._scrollbarShowMax&&(v&&(c._needSyncHScrollbarSize=!0),l&&(c._needSyncVScrollbarSize=!0));s._invalidateLayout();v&&l?a.paintBody(w,new n.Rect(f.x,f.y,f.width,f.height),new n.Rect(h.x,h.y,h.width,h.height)):a.paintBody(w,new n.Rect(f.x,f.y,f.width,f.height));s._paintAdornment(w,new n.Rect(tt,g,it,nt));s._makeUpGridline(!0);s._fillGrayArea(!0);this.onSheetScroll(v,l);return k&&d}},i.prototype.onSheetScroll=function(n,t){var i=this.sheet,r;t&&i._syncVScrollbarPosition();n&&i._syncHScollbarPosition();i._eventHandler.updateEditingEditor();r=i._commentManager;r&&r.updateCommentsLayoutWhenSheetScroll()},i.prototype._getCurrentPositionByTime=function(n,t,i,r){return n/=i,nt(.75,n)*r*(t?1:-1)},i.prototype._getCurrentTimeByPosition=function(n,t,i){return n=r(n),n/=i,rt(n)/rt(.75)*t},i.prototype._buildScrollDirection=function(n,t){var i=0;return n||(i|=1),t||(i|=2),i},i.prototype._endScrollWithAnimation=function(n,i,r){var u=this,f=u.sheet,s=u.BOUNDARY_SCOPE,h=10,v=20,c=100,l=u._getCurrentTimeByPosition(n,h,s),a=u._getCurrentTimeByPosition(i,h,s),w=n,b=i,y=0,p=0,e=!1,o=!1;u.interval=setInterval(function(){var k;if(e&&o){f._cachePool.endCache();k=f.parent;k&&!k._scrollbarShowMax&&(f._needSyncHScrollbarSize=!0,f._needSyncVScrollbarSize=!0);f._cachePool.clearCacheEndPan();f.invalidateLayout();f.repaint();f._syncHScollbarPosition();f._syncVScrollbarPosition();clearInterval(u.interval);u.interval=t;return}if(l+=v,a+=v,l>c&&a>c)u._continueScrollCore(n-y,i-p,u._buildScrollDirection(e,o),r),e=!0,o=!0;else{l>c&&!e&&(u._continueScrollCore(n-y,0,1,r),e=!0);a>c&&!o&&(u._continueScrollCore(0,i-p,2,r),o=!0);var d=u._getCurrentPositionByTime(l,n>0,h,s),g=u._getCurrentPositionByTime(a,i>0,h,s),nt=ut(w-d),tt=ut(b-g);u._continueScrollCore(nt,tt,u._buildScrollDirection(e,o),r);w=d;b=g;y+=nt;p+=tt}},v)},i.prototype.startScroll=function(n){var i=this;i.interval&&(i.sheet._cachePool.clearCacheEndPan(),clearInterval(this.interval),i.interval=t);i.cachedOffsetX=0;i.cachedAvailableOffsetX=0;i.cachedOffsetY=0;i.cachedAvailableOffsetY=0;i.oldScrollTopRow=i.sheet._scrollTopRow;i.oldScrollLeftCol=i.sheet._scrollLeftCol;n&&i.sheet._cachePool.startCacheBeforPan()},i.prototype.continueScroll=function(n,t){var i=parseInt(n.X),r=parseInt(n.Y),u=this._getScrollDirection(i,r);return this._continueScrollCore(i,r,u,t)},i.prototype.endScroll=function(n){var f=this,t=f.sheet,p=t._getSheetLayout(),w=p.viewportX,b=p.viewportY,e=t._getViewportColumnLayout(1),i,d=t._getLastVisualScrollColumn(),o,r,u,k,s,h,c,l,a,v,y;e&&e.length>0&&(o=t._scrollLeftCol,i=e.findCol(o),o<d&&i&&i.x+i.width-w<i.width/2&&t._scrollLeftCol++);r=t._getViewportRowLayout(1);k=t._getLastVisualScrollRow();r&&r.length>0&&(s=t._scrollTopRow,u=r.findRow(s),s<k&&u&&u.y+u.height-b<u.height/2&&t._scrollTopRow++);h=0;c=0;e&&e.length>0&&(i=e.findCol(t._scrollLeftCol),h=w-i.x);r&&r.length>0&&(u=r.findRow(t._scrollTopRow),c=b-u.y);l=t._scrollTopRow;a=f.oldScrollTopRow;l!==a&&f._triggerTopRowChanged(t,a,l);v=t._scrollLeftCol;y=f.oldScrollLeftCol;v!==y&&f._triggerLeftColChanged(t,y,v);f._endScrollWithAnimation(h,c,n)},i}(),ir=function(){function i(n){this._isScroll=!1;this._touchZoomManager=new b(n);this._touchScrollManager=new tr(n);this.sheet=n}return i.prototype.doManipulationStarting=function(n){var r=this.sheet,i=r._getSheetLayout(),t;n.Mode=0;t=this._touchHitTest(n.Position.X,n.Position.Y);t&&(t.resizeInfo||t.dragInfo&&t.dragInfo.side==="corner"||t.selectionHitInfo)?(i.viewportY<=t.y&&t.y<i.frozenTrailingY&&(n.Mode|=2),i.viewportX<=t.x&&t.x<i.frozenTrailingX&&(n.Mode|=1)):(i.viewportY<=t.y&&t.y<i.frozenTrailingY&&(n.Mode|=2),i.viewportX<=t.x&&t.x<i.frozenTrailingX&&(n.Mode|=1),n.Mode|=96,this.sheet.parent&&this.sheet.parent.touchScrollOnRails()&&(n.Mode|=12))},i.prototype.doManipulationStarted=function(n){var r=this,i=r.sheet,u=i._eventHandler,f=i._render,t=r._touchHitTest(n.Position.X,n.Position.Y),h,o;if(i._currentTarget=t,t.resizeInfo){if(!i.endEdit())return;u.startResizing(t)}else if(t.dragInfo&&t.dragInfo.side==="corner")u.startDragFill(t);else if(t.selectionHitInfo){if(!i.endEdit())return;var e=t.selectionHitInfo,s=e.isHeader,c=e.isFirstIndicator,l=e.type;s&&u._startSelectingCore(t,!0);h=t.hitTestType;t.hitTestType=t.selectionHitInfo.type;u._startSelectingScroll(t);t.hitTestType=h;r._changeActiveCellBeforeSelect(s,c,l);f._showTouchSelectionIndicator=!1;f.refreshTouchSelectionIndicator()}else o=i._commentRender,o&&(o.showWhenTouchMoveOrScroll=!1),f._showTouchSelectionIndicator=!1,f.refreshTouchSelectionIndicator(),n.PointerCount>1&&i.parent&&i.parent._allowUserZoom?(r._isScroll=!1,r._touchZoomManager.startZoom()):(r._isScroll=!0,r._touchScrollManager.startScroll(n.PointerCount===1))},i.prototype.doManipulationDelta=function(n){var r=this,f=r.sheet,t=f._eventHandler,e=n.Position.X,o=n.Position.Y,i,s,u,h;if(f._currentTarget)if(i=f._currentTarget,i.resizeInfo)t.mousePosition={e:n,x:e,y:o},t.continueResizing();else if(i.dragInfo&&i.dragInfo.side==="corner")t.mousePosition={e:n,x:e,y:o},t.continueDragFill();else if(i.selectionHitInfo||t.isSelecting){if(s=i.selectionHitInfo,s){if(!t.startHitInfo||!t.isWorking)return;if(t._forceCancelSelectiong===!0)return;u=s.type;t.mousePosition={e:n,x:e,y:o};u===3?t.continueCellSelecting():u===2?t.continueRowSelecting():u===1&&t.continueColumnSelecting()}}else r._isScroll?n.IsComplete=r._touchScrollManager.continueScroll(n.Delta.Translation,n.IsInertia):(h=n.Cumulative.Scale,r._touchZoomManager.continueZoom(h))},i.prototype.doManipulationInertiaStarting=function(n){},i.prototype.doManipulationCompleted=function(n){var t=this,i=t.sheet,r=i._eventHandler,o=i._render,u,f,e,s;if(o._showTouchSelectionIndicator=!0,u=i._currentTarget,u.resizeInfo)r.stopResizing();else if(u.dragInfo&&r.isDraggingFill)r.endDragFill(),i.parent.touchToolStrip._closeAutoFillIndicator();else if(u.selectionHitInfo||r.isSelecting){if(r.stopSelecting(),f=u.selectionHitInfo,f){var h=f.isHeader,c=f.isFirstIndicator,l=f.type;t._changeActiveCellAfterSelect(h,c,l)}o.repaintSelection()}else e=i._commentRender,e&&(e.showWhenTouchMoveOrScroll=!0),t._isScroll?t._touchScrollManager.endScroll(n.IsInertia):(s=n.Cumulative.Scale,t._touchZoomManager.endZoom(s))},i.prototype.doTapped=function(i){var l=this,r=l.sheet,it=!1,w,v,b,y,ut,p,et,g,nt,tt;l._clearTouchToolStripTimeout();typeof r.unSelectAllFloatingObjects=="function"&&r.unSelectAllFloatingObjects();w=r._commentManager;w&&w.deactivateComment();var c=r._eventHandler,f=l._touchHitTest(i.Position.X,i.Position.Y,!0),o=f.row,s=f.col,rt=f.groupHitInfo;if(rt)r.isEditing()||c._doClickRangeGroup(rt);else if(r._currentTarget=f,f.filterButtonHitInfo){if(!r.endEdit())return;v=f.filterButtonHitInfo;v.rowFilter&&v.rowFilter.openFilterDialog(v)}else if(!f.resizeInfo&&r.canSelect(f.rowViewportIndex<0?-1:o,f.colViewportIndex<0?-1:s)){b=r._render;b._existTouchDragFillIndicator&&!c.isDraggingFill&&r.parent.touchToolStrip._closeAutoFillIndicator();var k=r.getActiveRowIndex(),d=r.getActiveColumnIndex(),h=f.cellTypeHitInfo;if(h){if(y=h.sheetArea,(y===t||y===u||y===3)&&(o!==k||s!==d)){if(ut=r.isPaintSuspended(),r.isPaintSuspended(!0),!r.endEdit())return;if(p={sheet:r,sheetName:r._name,row:k,col:d,cancel:!1},r.triggerLeaveCell(p),p&&p.cancel===!0)return;var ot=r._selectionModel.toArray(),ft=t,a=r._getSpanModel().find(o,s);ft=a?[new n.Range(a.row,a.col,a.rowCount,a.colCount)]:[new n.Range(o,s,1,1)];r.triggerSelectionChanging({sheet:r,sheetName:r._name,oldSelections:ot,newSelections:ft});et=h.isReservedLocation&&h.isFocusAware;r._setActiveCellAndSelection(o,s,u,u,et?0:1);r.triggerEnterCell({sheet:r,sheetName:r._name,row:o,col:s});r.triggerSelectionChanged({sheet:r,sheetName:r._name});c._updateValidationUI(o,s);r.isPaintSuspended(ut);it=!0}else b.refreshTouchSelectionIndicator();g=r.getCellType(o,s,f.hitTestType);h.sheet||(h.sheet=r);g.processMouseDown(h);g.processMouseUp(h)}if(h&&h.isReservedLocation)return!0;else{r.triggerCellClick({sheet:r,sheetName:r._name,sheetArea:f.hitTestType,row:f.row,col:f.col});try{if(c._hitTestResult=f,r.isEditing()&&k===r.getActiveRowIndex()&&d===r.getActiveColumnIndex()&&!r.endEdit())return}finally{c._hitTestResult=t}if(o===u||o===t||s===u||s===t)return;f.hitTestType===3&&c._updateValidationUI(o,s);l._isTouchSelected(o,s,f.hitTestType)&&!it?l._touchToolStripTimeout=setTimeout(function(){var n={x:f.x,y:f.y,handled:!1},t=r.parent.touchToolStrip;r.triggerTouchToolStripOpening(n);n.handled||t.open(f.x,f.y-ri);l._clearTouchToolStripTimeout()},e.DoubleTappedTimeOffset+20):(nt=r._selectionModel.toArray(),c._startSelectingCore(f),tt=r._selectionModel.toArray(),c._notEqualSelecions(nt,tt)&&r.triggerSelectionChanging({sheet:r,sheetName:r._name,oldSelections:nt,newSelections:tt}),c.stopSelecting())}}},i.prototype.doDoubleTapped=function(t){var i=this.sheet,e,u,s,o,f,h,c,l,a,r,v;if(this._clearTouchToolStripTimeout(),o=i._currentTarget,o&&(i.triggerCellDoubleClick({sheet:i,sheetName:i._name,sheetArea:o.hitTestType,row:o.row,col:o.col}),f=o.resizeInfo,f)){if(f.action==="sizeRow"||f.action==="sizeHiddenRow"){if(h=[],i._isRowSelected(f.index)){for(e=0;e<i._selectionModel.length;e++)if(u=i._selectionModel[e],u.col===-1)for(u=i._getActualRange(u),c=0;c<u.rowCount;c++)h.push({row:u.row+c})}else h.push({row:f.index});s=new n.UndoRedo.RowAutoFitUndoAction(i,h,f.sheetArea===1);i._doCommand(s)}else{if(l=[],i._isColumnSelected(f.index)){for(e=0;e<i._selectionModel.length;e++)if(u=i._selectionModel[e],u.row===-1)for(u=i._getActualRange(u),a=0;a<u.colCount;a++)l.push({col:u.col+a})}else l.push({col:f.index});s=new n.UndoRedo.ColumnAutoFitUndoAction(i,l,f.sheetArea===2);i._doCommand(s)}return}if(r=this._touchHitTest(t.Position.X,t.Position.Y,!0),r&&r.row>=0&&r.col>=0&&r.rowViewportIndex>=0&&r.colViewportIndex>=0&&!r.resizeInfo&&(!i.isProtected||!i.getStyleProperty(r.row,r.col,"locked"))){i._clearSelectionImp();var p=i.getRowCount(),w=i.getColumnCount(),y=1;r.row<i.frozenRowCount?y=0:r.row>=p-i._frozenTrailingRowCount&&(y=2);v=1;r.col<i.frozenColCount?v=0:r.col>=w-i._frozenTrailingColCount&&(v=2);i._setActiveCellImp(r.row,r.col,y,v,!0);i.addSelection(r.row,r.col,1,1);i._eventHandler.resumeFocus(!1);i._startEditImp(i._getCanvas(),r.row,r.col)}},i.prototype.doRightTapped=function(n){},i.prototype.doTouchOperatorStart=function(n){var t=this.sheet,r=this._touchHitTest(n.Position.X,n.Position.Y),i;t.isEditing()?(r.row!==t._activeRowIndex||r.col!==t._activeColIndex)&&t._eventHandler.releaseFocus(r):(this._target=r,i=this._touchHitTest(n.Position.X,n.Position.Y,!0),i&&i.cellTypeHitInfo&&i.cellTypeHitInfo.isEditting||t._eventHandler.releaseFocus(i))},i.prototype.doTouchOperatorEnd=function(n){var r=this.sheet,t,i,u;r.isEditing()||(t=this._target,i=!0,t&&(t.cellTypeHitInfo&&t.cellTypeHitInfo.isReservedLocation?i=!1:(u=r.getCellType(t.row,t.col),u&&u.isEditting()&&(i=!1))),i&&r._eventHandler.resumeFocus())},i.prototype._touchHitTest=function(n,i,r){var h=this,e=h.sheet,a=e._render,f,l,o,s,c,v,y,p,w,b;return e._getSheetLayout(),f={x:n,y:i,rowViewportIndex:t,colViewportIndex:t,row:-1,col:-1,resizeInfo:t,hitTestType:t,groupHitInfo:t,filterButtonHitInfo:t,dragInfo:t,cellTypeHitInfo:t,selectionHitInfo:t,formulaRangeHitInfo:t},l=a.groupHitTest(n,i),l?f.groupHitInfo=l:(o=e._getRowViewportIndexFromY(i),s=e._getColumnViewportIndexFromX(n),f.rowViewportIndex=o,f.colViewportIndex=s,f.row=e._getRowIndexFromY(i,o),f.col=e._getColumnIndexFromX(n,s),o>=0&&o<=2&&s>=0&&(c=e._getCellLayoutByCell(o,s,u,f.row,f.col),c&&(f.row=c.row,f.col=c.col)),f.hitTestType=e._getSheetArea(o,s),a._existTouchDragFillIndicator&&(y=h._getDragFillInfo(f,n,i))?f.dragInfo=y:(v=h._getTouchResizeInfo(f,n,i,10))?f.resizeInfo=v:(p=e._getFilterButtonHitInfo(f,n,i))?f.filterButtonHitInfo=p:!r&&(w=h._getSelectionHitInfo(f,n,i))?f.selectionHitInfo=w:f.cellTypeHitInfo=e._getCellTypeHitInfo(f,n,i)),f},i.prototype._getTouchResizeInfo=function(n,i,r,u){var e=this.sheet,h=e._eventHandler,s=e.getSelections(),f=t;if(e._isTouchMode&&s.length>0){var o=s[s.length-1],c=o.row,a=o.row+o.rowCount-1,l=o.col,v=o.col+o.colCount-1;(!e.parent||e.parent._allowUserResize)&&(c!==-1&&l===-1&&n.rowViewportIndex>=0&&n.colViewportIndex<0&&e.rowHeaderVisible?(f=h._getResizeRowInfo(e,n,u,2,r),f&&(f.action==="sizeRow"||f.action==="sizeHiddenRow")&&f.sheetArea===2&&f.index!==a&&(f=t)):c===-1&&l!==-1&&n.rowViewportIndex<0&&n.colViewportIndex>=0&&e.colHeaderVisible&&(f=h._getResizeColInfo(e,n,u,1,i),f&&(f.action==="sizeCol"||f.action==="sizeHiddenCol")&&f.sheetArea===1&&f.index!==v&&(f=t)))}return f},i.prototype._getSelectionHitInfo=function(n,i,r){var s=this.sheet,c=s._render.getSelectionIndicatorRects(),h=s.getSelections(),o=3,f,e,u;for(s._isTouchMode&&h.length>0&&(f=h[h.length-1],f.row!==-1&&f.col!==-1?o=3:f.row!==-1?o=2:f.col!==-1&&(o=1)),e=0;e<c.length;e++)if(u=c[e],u.x-=u.width,u.y-=u.height,u.width*=3,u.height*=3,u.contains(i,r))return{x:i,y:r,type:o,isHeader:!1,isFirstIndicator:e===0};if(n.hitTestType===1)return{x:i,y:r,type:1,isHeader:!0};else if(n.hitTestType===2)return{x:i,y:r,type:2,isHeader:!0};return t},i.prototype._getDragFillInfo=function(n,i,r){var o=t,h=n.rowViewportIndex,c=n.colViewportIndex,u,p,l,v,a,y,e;if(typeof h===f||h===t||typeof c===f||c===t)return o;if(u=this.sheet,p=u._getActiveSelectedRange(),h>=0&&c>=0&&u._selectionModel.length===1){var s=u._getActualRange(p),w=u._frozenTrailingColCount,b=u._frozenTrailingRowCount,k=u.getColumnCount()-w,d=u.getRowCount()-b;if(c===1&&w>0&&s.col<k&&s.col+s.colCount>k&&(l=u._getColumnLayout(c),l&&l.length>0&&(v=l[l.length-1],i>v.x+v.width))||h===1&&b>0&&s.row<d&&s.row+s.rowCount>d&&(a=u._getRowLayout(h),a&&a.length>0&&(y=a[a.length-1],r>y.y+y.height)))return o}return e=u._render.getTouchDragFillIndicatorRect(),e&&(o||(e.x-=e.width,e.y-=e.height,e.width*=3,e.height*=3,e.contains(i,r)&&(o={action:"drag",side:"corner"})),u.canUserDragFill()||o&&o.side==="corner"&&(o.side=t)),o},i.prototype._clearTouchToolStripTimeout=function(){this._touchToolStripTimeout&&(clearTimeout(this._touchToolStripTimeout),this._touchToolStripTimeout=t)},i.prototype._isTouchSelected=function(n,i,r){for(var f,e=!1,s=this.sheet,h=s._selectionModel,o=0,c=h.length;o<c;o++){if(f=h[o],r===3||typeof r===u||r===t)f=s._getActualRange(f),e=f.row<=n&&n<f.row+f.rowCount&&f.col<=i&&i<f.col+f.colCount;else if(r===2)e=f.col===-1&&f.row<=n&&n<f.row+f.rowCount;else if(r===1)e=f.row===-1&&f.col<=i&&i<f.col+f.colCount;else if(r===0)return e;if(e)return e}return e},i.prototype._changeActiveCellBeforeSelect=function(n,t,i){if(!n){var r=this.sheet,f=r.getSelections(),u=f[f.length-1];t?i===3?(r._activeRowIndex=u.row+u.rowCount-1,r._activeColIndex=u.col+u.colCount-1):i===2?(r._activeRowIndex=u.row+u.rowCount-1,r._activeColIndex=0):i===1&&(r._activeRowIndex=0,r._activeColIndex=u.col+u.colCount-1):i===3?(r._activeRowIndex=u.row,r._activeColIndex=u.col):i===2?(r._activeRowIndex=u.row,r._activeColIndex=0):i===1&&(r._activeRowIndex=0,r._activeColIndex=u.col)}},i.prototype._changeActiveCellAfterSelect=function(n,t,i){var r=this.sheet,f=r.getSelections(),u=f[f.length-1];(n||t)&&(i===3?(r._activeRowIndex=u.row,r._activeColIndex=u.col):i===2?(r._activeRowIndex=u.row,r._activeColIndex=0):i===1&&(r._activeRowIndex=0,r._activeColIndex=u.col))},i}(),rr=function(){function n(n,t,i){var r=this;r._touchEventProvider=i;r._touchMouseMessageFilter=new h(t);r._touchEventHandler=new ir(t);r._touchTarget=new c(n,"sheet",r._touchMouseMessageFilter,100,100);r._touchTarget.level=10;r._touchEventProvider.attachDettach(r._touchTarget,!0)}return n.prototype.attach=function(){var i=this._touchEventProvider,n=this._touchEventHandler,t=this._touchTarget;t.manipulationStarting=function(t){return n.doManipulationStarting(t)};t.manipulationStarted=function(t){return n.doManipulationStarted(t)};t.manipulationDelta=function(t){return n.doManipulationDelta(t)};t.manipulationInertiaStarting=function(t){return n.doManipulationInertiaStarting(t)};t.manipulationCompleted=function(t){return n.doManipulationCompleted(t)};t.tapped=function(t){return n.doTapped(t)};t.doubleTapped=function(t){return n.doDoubleTapped(t)};t.rightTapped=function(t){return n.doRightTapped(t)};t.touchOperatorStart=function(t){return n.doTouchOperatorStart(t)};t.touchOperatorEnd=function(t){return n.doTouchOperatorEnd(t)}},n.prototype.detach=function(){var n=this._touchTarget;n&&(this._touchEventProvider.attachDettach(n,!1),n.manipulationStarting=t,n.manipulationStarted=t,n.manipulationDelta=t,n.manipulationInertiaStarting=t,n.manipulationCompleted=t,n.tapped=t,n.doubleTapped=t,n.rightTapped=t,n.touchOperatorStart=t,n.touchOperatorEnd=t,this._touchTarget=t)},n.prototype.preProcessMouseDown=function(n){return this._touchMouseMessageFilter.preProcessMouseDown(n)},n.prototype.preProcessMouseUp=function(n){return this._touchMouseMessageFilter.preProcessMouseUp(n)},n.prototype.preProcessMouseMove=function(n){return this._touchMouseMessageFilter.preProcessMouseMove(n)},n}();n.TouchManager=rr,function(n){n[n.paste=0]="paste";n[n.cut=1]="cut";n[n.copy=2]="copy";n[n.autoFill=3]="autoFill"}(vt||(vt={}));yt=function(i){function r(t,r){i.call(this,r,n.util.getPreferredZIndex(t._host));var u=this;u._touchEventNamespace=".touchToolStrip";u._buttonClass="toolstrip-button";u._textClass="toolstrip-text";u._imageClass="wijspread-toolstrip-image";u._itemClass="toolstrip-item";u._seprateLineClass="touch-sperate-line";u._imageAreaHeight=32;u._separatorHeight=45;u.menuItems={};u.pasteName="wijspread_toolstrip_paste";u.copyName="wijspread_toolstrip_copy";u.cutName="wijspread_toolstrip_cut";u.autoFillName="wijspread_toolstrip_autofill";u._isOpen=!1;u.spreadHost=t;u._initDialog()}return __extends(r,i),r.prototype.open=function(i,r){var u=this,h=u.spreadHost.getActiveSheet(),e,f,o,s;if(h&&(n.FocusHelper.setActiveElement(t,!0),u._toolStripDialog.css({left:i,top:r}),u.show(),u._isOpen=!0,u.resetDialogPosition(),!n.GC$.isEmptyObject(u.menuItems))){e=u.menuItems;for(f in e)o=e[f],s=o.canExecute?o.canExecute.call(u):!0,s?n.GC$("#"+f).show():n.GC$("#"+f).hide()}},r.prototype.add=function(n){var t,i,r,u;n&&(t=this,i=t.menuItems,n instanceof k?(r=n.name(),r&&(i[r]=n,t._addDom(n.getDOM(t._seprateLineClass,t._separatorHeight+"px")))):n instanceof s&&(u=n.name(),t.getItem(u)||(i[u]=n,t._addDom(n.getDOM(t._imageClass,t._imageAreaHeight+"px",t._textClass,t._buttonClass)))))},r.prototype.getItem=function(n){return this.menuItems[n]},r.prototype.getItems=function(){var i=this,r=[],u;if(!n.GC$.isEmptyObject(i.menuItems)){for(u in i.menuItems)r.push(i.menuItems[u]);return r}return t},r.prototype.remove=function(i){if(this.getItem(i)){n.GC$("#"+i).parent().remove();var r=this.menuItems[i];return delete this.menuItems[i],r}return t},r.prototype.clear=function(){this._toolStripDialog&&(this._toolStripDialog.find("td."+this._itemClass).remove(),this.menuItems={})},r.prototype.close=function(){var t=this,n,i,r;(window.gcGlobal.resumeEvent(),t._toolStripDialog&&t._toolStripDialog.hide(),t._isOpen=!1,t.closeOverlay(),n=t.spreadHost.getActiveSheet(),n)&&(i=n._render,n.setFocus(),r=n.getSelections(),i&&!i._existTouchDragFillIndicator&&r[0].row===-1&&r[0].col===-1&&n._clearSelectionImp())},r.prototype.imageAreaHeight=function(n){var t=this;return arguments.length===0?t._imageAreaHeight:n<=0?void 0:(t._imageAreaHeight=n,t._toolStripDialog.find("span."+t._imageClass).css("height",n+"px"),t)},r.prototype.itemHeight=function(n){var t=this._toolStripDialog.find("button."+this._buttonClass);return arguments.length===0?parseFloat(t.css("height")):n<=0?void 0:(t.css("height",n+"px"),this)},r.prototype.itemWidth=function(n){var t=this._toolStripDialog.find("button."+this._buttonClass),i;return arguments.length===0?parseFloat(t.css("width")):n<0?void 0:(i=parseFloat(t.css("min-width")),i>n&&t.css("min-width",n+"px"),t.css("width",n+"px"),this)},r.prototype.separatorHeight=function(n){var t=this;return arguments.length===0?t._separatorHeight:n<=0?void 0:(t._separatorHeight=n,t._toolStripDialog.find("div."+t._seprateLineClass).css("height",n+"px"),t)},r.prototype._createLayoutTable=function(){var t=n.GC$(document.createElement("table")).css({padding:0,display:"table"}).attr({cellspacing:0,cellpadding:0});this._tableRow=n.GC$(document.createElement("tr")).appendTo(t);t.appendTo(this._toolStripDialog)},r.prototype._dispose=function(){var n=this,i=n._toolStripDialog;i&&(n._isOpen&&window.gcGlobal.resumeEvent(),i.remove(),n.closeOverlay(),i=t)},r.prototype._initDialog=function(){var n=this,t;n._toolStripDialog||(t=n.getContainer(),n._toolStripDialog=t,t.addClass("toolstrip-default ui-state-default well"),t.appendTo(n.getHost()),t.hide(),n._createLayoutTable(),n._setDefaultCellDomString(),n._attachEvent())},r.prototype._attachEvent=function(){var n=this;this._toolStripDialog.bind("click",function(t){var u=t.target,e=u.tagName.toLowerCase(),i,r,f;e==="button"?i=u.id:(r=u.parentElement,r&&r.tagName.toLowerCase()==="button"&&(i=r.id));f=n.menuItems[i];i&&f&&f.command.call(n)})},r.prototype._addDom=function(t){this._toolStripDialog&&t&&n.GC$(document.createElement("td")).append(t).appendTo(this._tableRow).addClass(this._itemClass)},r.prototype._setDefaultCellDomString=function(){var t=this,i=r._getImageSrc(0),u=r._getImageSrc(1),f=r._getImageSrc(2),e=r._getImageSrc(3);t._pasteItem=new s(t._getItemName(t.pasteName),n.SR.ToolStrip_PasteText,i,t._doTapPaste);t._cutItem=new s(t._getItemName(t.cutName),n.SR.ToolStrip_CutText,u,t._doTapCut);t._copyItem=new s(t._getItemName(t.copyName),n.SR.ToolStrip_CopyText,f,t._doTapCopy);t._autoFillItem=new s(t._getItemName(t.autoFillName),n.SR.ToolStrip_AutoFillText,e,t._showAutoFillIndicator,t._hideAutoFill);t.add(t._pasteItem);t.add(t._cutItem);t.add(t._copyItem);t.add(new k(t._hideAutoFill));t.add(t._autoFillItem)},r.prototype._hideAutoFill=function(){var r=this.spreadHost.getActiveSheet(),t,n,i;if(!r)return!1;for(t=r.getSelections(),n=0;n<t.length;n++)if(i=t[n],i.row===-1&&i.col===-1)return!1;return!0},r.prototype._showAutoFillIndicator=function(){var n,i,t;(this.close(),n=this.spreadHost.getActiveSheet(),n)&&((i=n.getSelections().length,i>1)||(t=n._render,t._existTouchDragFillIndicator=!0,t.repaintSelection()))},r.prototype._closeAutoFillIndicator=function(){var t=this.spreadHost.getActiveSheet(),n;t&&(n=t._render,n._existTouchDragFillIndicator=!1,n.repaintSelection())},r.prototype._doTapCopy=function(){var n=this.spreadHost.getActiveSheet();n&&(this._clipboardTouchData=n._doCopy(!0));this.close()},r.prototype._doTapCut=function(){var n=this.spreadHost.getActiveSheet();n&&(this._clipboardTouchData=n._doCut(!0));this.close()},r.prototype._doTapPaste=function(){var n=this,t=n.spreadHost.getActiveSheet();t&&typeof n._clipboardTouchData!==f&&t._doPaste(n._clipboardTouchData);n.close()},r.prototype._getItemName=function(n){for(var t=0,i=n+t;document.getElementById(i);)t++,i=n+t;return i},r.prototype._updateResource=function(){var t=this,i=t._textClass;n.GC$("#"+t._pasteItem._name).find("span."+i).text(n.SR.ToolStrip_PasteText);n.GC$("#"+t._cutItem._name).find("span."+i).text(n.SR.ToolStrip_CutText);n.GC$("#"+t._copyItem._name).find("span."+i).text(n.SR.ToolStrip_CopyText);n.GC$("#"+t._autoFillItem._name).find("span."+i).text(n.SR.ToolStrip_AutoFillText)},r._getImageSrc=function(n){switch(n){case 0:return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA8ElEQVRIS92VwQ3CMAxFe+qZERiHY8dgDI4cYYNOhDhwY4ayQviW4q/Eddu0KRe+9CQ72P8rEpAmhPBT3ENLd76EiPv5HO5hSmK+KYTFsz+04A4G9NZ0hAizn7jTos2MFRYYugFZQlscoFzRZsYKCwwNulAqnZddtJmxwiIZ3oT6WFh4S2tQHwsLb2kN6mNh4S2tQX0sLLwly4IyY4WFZ2gReV/ZhBOQH2ddgKcYwBAc7R/weL0ZgqO6gGPXE1E0JlBdwJx2CUhvkCL63xvw33QKUc0N+B5MIaq5gb5o8kotBszJDShFlkvQ+ZHBvoTmC+fiVfoq/m86AAAAAElFTkSuQmCC";case 1:return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAABkklEQVRIS7WTUXECQRBEcYCFOIiESAAH/OYPCcQBEogDJCABCUhAwqXf1QzVM0cojko+Xt3ObG/33t7eYhiGf6UU68+vneD5Mu4HpZDgKja+YCYH94NSSHAUg3glZC9k8zgAYwLmhuS6o/tBKUJ8CTGsoveIsin3g1LEAkxzAd/kXbihwxwatGys+EEpEAT5LR6FuDmMb+t+UAoEwVL44h7CvB8lGxrn3A9KkaLAj8pDMD9HL/v0ZgfAQfSAk/WgXAT3g1K4MPCj2AoPhNvRJO4HpejigF1jxtjNy9Ek7gel6GIjfzoP+Ihewf2gFPcWNNL817/c/aAUKXpbfy/FXlzFIM6gOYy3Gp+iz/xBPHeLQGLAMI2PNmYOw1uojZfdCyYNCXexiGcGpiljdp9hsBGjvnvBpCHhRbgBZChjAgj0eXrX7gWThoR992lAMGOOLMfJuIHuBZMGQuE75KN66Cpq14xH2L1g0kixyLNm3I8sNbwJulHfvWDSkJArmou4hlxXeh4AvBEBuZnnbtHfMix+AHqkr6wgQ4Q7AAAAAElFTkSuQmCC";case 2:return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA3UlEQVRIS72PwQ3CMAxFOwrjcOyZCTgyAjfWYCJO3JiCCVL/iFSO9W0MDTzpqYob+ztTKeWn0uJIadE6H8/ljXsR96q6tzt4YogH/olPcQ2R8mp3CHRBwO3+6EKkvNodcDkSgyyoAx0iRz/AA/8Op0sdtJuv1Va3Ct8FYHgL8dgUAGxIe41+kRAH6CbdaGW86nFAhnaXLSLEAbqJCbxlUgEZ2DIgFaCbmMBbJhWQgS0DUgG6iQm8ZVIBGTYFsK21oN3F1yrEARnsIM/u8JeAT9S9nrQ4UlocKS2Os0wLtkPMdu9POt0AAAAASUVORK5CYII=";case 3:return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAIAAABrvZPKAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAIdJREFUOE/tzEEKgCAQheEOWLdx351adYc8Qgs3rbuAUC9nkkF0BKNN9CMy0Xx25llf8Edr7d57j/tlP4wTHf4W/b7gsT0vLs7Sz9bFWfM9nrDXE9ITphlVPO512wkkM++FNF86vBfKeKR43rjLe5QwOvxPVPSoipHmkY5RxSMFo7rXY9+eMSdet07b6c/bnwAAAABJRU5ErkJggg=="}},r}(n.BaseDialog);n.TouchToolStrip=yt;s=function(){function i(n,t,i,r,u){this._font="normal 12px Arial";var f=this;f._name=n;f._text=t;f._image=i;r&&(f.command=r);u&&(f.canExecute=u)}return i.prototype.name=function(t){var i=this;return arguments.length===0?i._name:(n.GC$("#"+i._name).attr("id",t),n.GC$("#"+i._name+"Text").attr("id",t+"Text"),n.GC$("#"+i._name+"Image").attr("id",t+"Image"),i._name=t,i)},i.prototype.text=function(t){var i=this;return arguments.length===0?i._text:(i._text=t,n.GC$("#"+i.name()+"Text").text(t),i)},i.prototype.font=function(t){var i=this,r=n.GC$("#"+i.name()+"Text");return arguments.length===0?i._font:(i._font=t,r.css("font",t),i)},i.prototype.foreColor=function(t){var i=this,r=n.GC$("#"+i.name()+"Text");return arguments.length===0?i._foreColor?i._foreColor:r.css("color"):(r.css("color",t),i)},i.prototype.image=function(t){var i=this;return arguments.length===0?i._image:(i._image=t,n.GC$("#"+i.name()+"Image").css("background-image","url("+t+")"),i)},i.prototype.getDOM=function(t,i,r,u){var o=this,c=o.name(),s=n.GC$(document.createElement("span")),e,l,h,f;return s.attr("id",c+"Image"),s.addClass(t),s.css({"background-image":"url("+o.image()+")","background-repeat":"no-repeat",display:"block",height:i,"background-position-x":"50%"}),e=n.GC$(document.createElement("span")),e.attr("id",c+"Text"),e.addClass(r),e.css("font",o.font()),e.text(o.text()),l=o.getTextSpanWidth(r),h=60,l>h&&(h=l),f=n.GC$(document.createElement("button")),f.attr("type","button"),f.attr("id",c),f.addClass(u+" toolstrip-button-style ui-state-default ui-widget btn btn-default"),f.css({"box-sizing":"content-box",border:"0px",padding:"4px",margin:"3px",width:h+"px"}),f.append(s),f.append(e),f.getElement(0)},i.prototype.getTextSpanWidth=function(i){var u=this,r=document.createElement("span"),f;return r.className=i,r.style.font=u.font(),r.style.cssFloat="left",r.textContent=u.text(),document.body.insertBefore(r,t),f=n.GC$(r).width(),document.body.removeChild(r),f},i}();n.TouchToolStripItem=s;k=function(){function t(n){this._name=this._getSeparatorName();n&&(this.canExecute=n)}return t.prototype.name=function(){return this._name},t.prototype._getSeparatorName=function(){for(var n=0,t="separator"+n;document.getElementById(t);)n++,t="separator"+n;return t},t.prototype.getDOM=function(t,i){var r=n.GC$(document.createElement("div"));return r.attr("id",this.name()),r.addClass(t),r.css({width:"1px",height:i,display:"inline-block;","background-color":"#CCC","margin-left":"5px","margin-right":"5px",opacity:.6}),r.getElement(0)},t}();n.TouchToolStripSeparator=k;h=function(){function n(n){this.owner=n}return n.prototype.preProcessManipulationStarting=function(){this.eventMode=2;this.owner._isTouchMode=!0},n.prototype.postProcessManipulationComplete=function(){this.eventMode=0;this.touchCompleteTimestamp=(new Date).valueOf()},n.prototype.preProcessPointerDown=function(){return this.eventMode===1},n.prototype.preProcessPointerUp=function(){return this.eventMode===1},n.prototype.preProcessPointerMove=function(){return this.eventMode===1},n.prototype.preProcessMouseDown=function(n){var t=this;if(t.eventMode===2)return!0;else if(t.touchCompleteTimestamp)if((new Date).valueOf()-t.touchCompleteTimestamp<=200)return t.mouseDownHandled++,!0;else t.touchCompleteTimestamp=0,t.mouseDownHandled=0,t.eventMode=1;else t.eventMode=1;return t.owner._isTouchMode=!1,!1},n.prototype.preProcessMouseUp=function(n){var t=this;return t.mouseDownHandled?(t.mouseDownHandled--,!0):t.eventMode===2?!0:(t.eventMode=0,!1)},n.prototype.preProcessMouseMove=function(n){return this.eventMode===2},n}();n.TouchMouseMessageFilter=h,function(n){n[n.None=0]="None";n[n.MouseMode=1]="MouseMode";n[n.TouchMode=2]="TouchMode"}(pt||(pt={}));wt=function(){function i(n){this._tab=n}return i.prototype.doManipulationStarting=function(n){},i.prototype.doManipulationStarted=function(t){var r=this,i=r._tab,c=i._spread.getActiveSheet();i._tabNameEditor&&i.endSheetTabEditing(c,!1);var l="resizeBar",a="tab",v="newTab",f=i.hitTest(t.Position.X,t.Position.Y);if(f.element===l)i.resizeTab=!0,i.activeX=t.Position.X;else if(f.element===a||f.element===v||f.element===""){var e=i.canvas,y=n.DPIHelper.getLogicWidth(e),p=n.DPIHelper.getLogicHeight(e),u=r._getTouchCanvas(y,p),o=u.getContext("2d"),s=n.DPIHelper.getScaleX(u),h=n.DPIHelper.getScaleY(u);o.scale(1/s,1/h);o.drawImage(e,0,0,u.width,u.height,0,0,u.width,u.height);o.scale(s,h);r._canvas=u;r._oldFirstTab=i._firstTab;r._tabStartPosition=i.getTabStartPosition();r._tabEndPosition=i.getTabEndPosition();r._newTabSize=i.getNewTabSize();i._hideNewTabSecondMoreTab=!0}r._minFirstTabIndex=i._getNextVisibleIndex(-1);r._maxFirstTabIndex=i._reCalculateFirstTabIndex(i._getVisibleTabs())},i.prototype.doManipulationDelta=function(i){var p=this,h=p._tab,et,ot,k,d,y,tt,s,a,e,v,it,w,lt,at;if(h.resizeTab){var vt=i.Position.X-h.activeX,b=h._spread,ft=b._vp.clientWidth;b.setTabStripRatio(b._getActualTabStripRatio()+vt/ft,!0);et=h._resizeBarWidth/ft;ot=1;b._getActualTabStripRatio()<et?(b.setTabStripRatio(et,!0),h.activeX=h._resizeBarWidth):b._getActualTabStripRatio()>=ot?(b.setTabStripRatio(ot,!0),h.activeX=ft):h.activeX=i.Position.X}else{if(k=p._canvas,d=p._oldFirstTab,!k||typeof d===f||d===t)return;var st=p._minFirstTabIndex,ht=p._maxFirstTabIndex,ut=p._newTabSize,g=p._tabStartPosition,nt=p._tabEndPosition,c=i.Cumulative.Translation.X,ct=p._getNewFirstTabInfo(c,d);if(h._firstTab=ct.firstTab,y=ct.width,c>0&&d===st&&h._firstTab===st?y=0:c<0&&d===ht&&h._firstTab===ht&&(y=0),c>0&&c>y+ut?c=y+ut:c<0&&c<y-ut&&(c=y-ut),c!==0){var rt=h.canvas,o=rt.getContext("2d"),u=n.DPIHelper.getScaleX(rt),l=n.DPIHelper.getScaleY(rt);o.save();o.clearRect(0,0,n.DPIHelper.getLogicWidth(rt),n.DPIHelper.getLogicHeight(rt));tt=h.getBounds();h.paintBackground(o,tt);a=0;v=tt.height;c>0?(s=g,it=s+c,e=nt-it,e>0&&(o.scale(1/u,1/l),o.drawImage(k,s*u,a,e*u,v*l,it*u,a,e*u,v*l),o.scale(u,l)),w=c-y,nt-g<=c&&(w=0),e=y,s=g,e>0&&(o.translate(w,0),h.paintTabs(o,new n.Rect(s,a,e,v)),o.translate(-w,0))):c<0&&(it=g,s=it+r(c),e=nt-s,e>0&&(o.scale(1/u,1/l),o.drawImage(k,s*u,a,e*u,v*l,it*u,a,e*u,v*l),o.scale(u,l)),w=c-y,nt-g<=r(c)&&(w=0),e=r(y),s=nt-e,e>0&&(o.translate(w,0),h.paintTabs(o,new n.Rect(s,a,e,v)),o.translate(-w,0)));o.scale(1/u,1/l);s=0;e=g;o.drawImage(k,s*u,a,e*u,v*l,s*u,a,e*u,v*l);lt=n.ThemeStyleHelper.getCssClassThemeStyle("");at=parseInt(lt.zIndex);at>2007&&(s=nt,e=tt.x+tt.width-h._resizeBarWidth-s,o.drawImage(k,s*u,a,e*u,v*l,s*u,a,e*u,v*l));s=tt.width-h._resizeBarWidth;e=h._resizeBarWidth;o.drawImage(k,s*u,a,e*u,v*l,s*u,a,e*u,v*l);o.scale(u,l);o.restore()}}},i.prototype.doManipulationInertiaStarting=function(n){},i.prototype.doManipulationCompleted=function(n){var t=this._tab;t.resizeTab?(t.resizeTab=!1,t._spread._doTabHSResize()):(t._hideNewTabSecondMoreTab=u,t.repaint())},i.prototype.doTapped=function(n){var t=this._tab,r=t._spread,f=r.getActiveSheet(),u;t._tabNameEditor&&t.endSheetTabEditing(f,!1);var e="navButton",o="tab",s="newTab",i=t.hitTest(n.Position.X,n.Position.Y);r._suspendSetFocus=!0;try{i.element===e?t.doNavButtonClick(i.index,!0):i.element===o?t.doSheetTabClick(i.index,i.position):i.element===s&&t.doNewTabClick(i.position)}finally{r._suspendSetFocus=!1;u=r.getActiveSheet();u!==f&&(u._isTouchMode=!0,u.setFocus())}},i.prototype.doDoubleTapped=function(n){return this._tab._doMouseDbClickImp(n.Position.X,n.Position.Y)},i.prototype.doRightTapped=function(n){},i.prototype._getTouchCanvas=function(t,i){var r=this._canvas;return r?(t!==n.DPIHelper.getLogicWidth(r)||i!==n.DPIHelper.getLogicHeight(r))&&n.DPIHelper.setSize(r,t,i):(r=document.createElement("canvas"),n.DPIHelper.adjustDevicePixel(r,this._tab._spread),n.DPIHelper.setSize(r,t,i)),r},i.prototype._getNewFirstTabInfo=function(n,t){var o=this._tab,e=o._tabSizes,f=this._minFirstTabIndex,u=this._maxFirstTabIndex,i=t,r=0;if(n>0){while(i>=f){if(r>n)break;r+=e[i];i--}i<f&&(i=f)}else if(n<0&&u!==-1){while(i<=u){if(r<n)break;r-=e[i];i++}i>u&&(i=u)}return{firstTab:i,width:r}},i}();bt=function(){function n(n,t,i){var f=this,r,u;f._touchMouseMessageFilter=new h(f);f._touchTarget=new c(n,"tabStrip",f._touchMouseMessageFilter,1,-1);f._touchEventProvider=i;f._touchEventHandler=new wt(t);r=f._touchEventHandler;u=f._touchTarget;u.manipulationStarting=function(n){return r.doManipulationStarting(n)};u.manipulationStarted=function(n){return r.doManipulationStarted(n)};u.manipulationDelta=function(n){return r.doManipulationDelta(n)};u.manipulationInertiaStarting=function(n){return r.doManipulationInertiaStarting(n)};u.manipulationCompleted=function(n){return r.doManipulationCompleted(n)};u.tapped=function(n){return r.doTapped(n)};u.doubleTapped=function(n){return r.doDoubleTapped(n)};u.rightTapped=function(n){return r.doRightTapped(n)}}return n.prototype.bindTouchEvents=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!0)},n.prototype.unbindTouchEvents=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!1)},n.prototype.preProcessMouseDown=function(n){return this._touchMouseMessageFilter.preProcessMouseDown(n)},n.prototype.preProcessMouseUp=function(n){return this._touchMouseMessageFilter.preProcessMouseUp(n)},n.prototype.preProcessMouseMove=function(n){return this._touchMouseMessageFilter.preProcessMouseMove(n)},n}();n.TabStripTouchManager=bt;kt=function(){function n(n,t,i){var f=this,u,r;f._touchMouseMessageFilter=new h(f);f._touchTarget=new c(n,"FL_"+t.name,f._touchMouseMessageFilter,2,200);f._touchEventProvider=i;f._touchEventHandler=new dt(n,t);u=f._touchEventHandler;r=f._touchTarget;r.canDoManipulation=function(){return t.floatingObject().isSelected()};r.canDoTap=function(){return!0};r.manipulationStarting=function(n){return u.doManipulationStarting(n)};r.manipulationStarted=function(n){return u.doManipulationStarted(n)};r.manipulationDelta=function(n){return u.doManipulationDelta(n)};r.manipulationInertiaStarting=function(n){return u.doManipulationInertiaStarting(n)};r.manipulationCompleted=function(n){return u.doManipulationCompleted(n)};r.tapped=function(n){return u.doTapped(n)};r.doubleTapped=function(n){return u.doDoubleTapped(n)};r.rightTapped=function(n){return u.doRightTapped(n)}}return n.prototype.attach=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!0)},n.prototype.detach=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!1)},n.prototype.preProcessMouseDown=function(n){return this._touchMouseMessageFilter.preProcessMouseDown(n)},n.prototype.preProcessMouseUp=function(n){return this._touchMouseMessageFilter.preProcessMouseUp(n)},n.prototype.preProcessMouseMove=function(n){return this._touchMouseMessageFilter.preProcessMouseMove(n)},n}();n.FloatingObjectTouchManager=kt;dt=function(){function t(n,t){this._floatingObjectRender=t;this._floatingObject=t.floatingObject();this._containerElement=n;this._touchZoomManager=new b(t._sheet)}return t.prototype._positionToPage=function(t,r){var f=new i(r.X,r.Y),u=n.GC$(this._containerElement).offset();return u&&(isNaN(document.body.clientTop)||(u.top+=document.body.clientTop),isNaN(document.body.clientLeft)||(u.left+=document.body.clientLeft),f.X+=u.left,f.Y+=u.top),f},t.prototype.doManipulationStarting=function(n){n.Mode=35},t.prototype.doManipulationStarted=function(n){var t=this,i=t._positionToPage(n.OriginalSource,n.Position);t._floatingObjectRender._doMouseDown({isTouch:!0,button:0,pageX:i.X,pageY:i.Y,stopPropagation:function(){}});t._touchZoomManager.startZoom()},t.prototype.doManipulationDelta=function(n){var t=this,u=n.Cumulative.Scale,i=t._floatingObjectRender._sheet,r;u!==1&&i.parent&&i.parent._allowUserZoom?(i._eventHandler.isFloatingObjectWorking=!1,t._floatingObjectRender._resetStatusOnMouseUp(),t._touchZoomManager.continueZoom(u)):(r=t._positionToPage(n.OriginalSource,n.Position),t._floatingObjectRender._doMouseMove({isTouch:!0,button:0,pageX:r.X,pageY:r.Y,stopPropagation:function(){}}))},t.prototype.doManipulationInertiaStarting=function(n){},t.prototype.doManipulationCompleted=function(n){var t=this,r=n.Cumulative.Scale,u=t._floatingObjectRender._sheet,i;r!==1&&u.parent&&u.parent._allowUserZoom?t._touchZoomManager.endZoom(r):(i=t._positionToPage(n.OriginalSource,n.Position),this._floatingObjectRender._doMouseUp({isTouch:!0,button:0,pageX:i.X,pageY:i.Y,stopPropagation:function(){}}))},t.prototype.doTapped=function(t){try{var i=this._floatingObjectRender._sheet,r=i.isPaintSuspended();i.isPaintSuspended(!0);this._floatingObject.isSelected()||(i.unSelectAllFloatingObjects(),this._floatingObject.isSelected(!0),n.FocusHelper.setActiveElement(i));i.clearSelection()}finally{i.isPaintSuspended(r)}},t.prototype.doDoubleTapped=function(n){},t.prototype.doRightTapped=function(n){},t}();c=function(){function n(n,t,i,r,u){var f=this;f.element=n;f.messageFilter=i;f.eventFlag=t;f.maxPointer=r;f.level=u}return n}();n.TouchTargetElement=c;gt=function(){function i(){}return i.prototype.simulateMouseEvent=function(i,r){var u=i,e,o;u.isPrimary!==!1&&(u.touches&&u.touches.length>=1&&u.targetTouches&&u.targetTouches.length>=1&&(u.touches[0].clientX!==u.targetTouches[0].clientX||u.touches[0].clientY!==u.targetTouches[0].clientY)||(n.util.cancelDefault(i),e=typeof u.changedTouches!==f?u.changedTouches[0]:u,o=document.createEvent("MouseEvents"),o.initMouseEvent(r,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,t),i.target.dispatchEvent(o)))},i.prototype.down=function(n){if(!n.pointerType||n.pointerType===n.MSPOINTER_TYPE_TOUCH||n.pointerType==="touch"){var t=n.data;if(t.touchHandled)return;t.touchHandled=!0;t._touchMoved=!1;t.simulateMouseEvent(n,"mouseover");t.simulateMouseEvent(n,"mousemove");t.simulateMouseEvent(n,"mousedown")}},i.prototype.move=function(n){if(!n.pointerType||n.pointerType===n.MSPOINTER_TYPE_TOUCH||n.pointerType==="touch"){var t=n.data;if(!t.touchHandled)return;t._touchMoved=!0;t.simulateMouseEvent(n,"mousemove")}},i.prototype.up=function(n){if(!n.pointerType||n.pointerType===n.MSPOINTER_TYPE_TOUCH||n.pointerType==="touch"){var t=n.data;if(!t.touchHandled)return;t.simulateMouseEvent(n,"mouseup");t.simulateMouseEvent(n,"mouseout");t._touchMoved||t.simulateMouseEvent(n,"click");t.touchHandled=!1}},i.prototype.bindUnBindTouchEvents=function(i,r,u){var e=this,b=u.charAt(0);b!=="."&&(u="."+u);var o="MSPointerDown"+u,s="MSPointerMove"+u,h="MSPointerUp"+u,c="pointerdown"+u,l="pointermove"+u,a="pointerup"+u,v="touchstart"+u,y="touchmove"+u,p="touchend"+u,w=window.navigator.msPointerEnabled||window.navigator.pointerEnabled;r?w?(i.style.msTouchAction!==t&&typeof i.style.msTouchAction!==f&&(i.style.msTouchAction="none"),i.style.touchAction!==t&&typeof i.style.touchAction!==f&&(i.style.touchAction="none"),n.GC$(i).bind(o,e,e.down).bind(c,e,e.down),n.GC$(document).bind(s,e,e.move).bind(l,e,e.move).bind(h,e,e.up).bind(a,e,e.up)):n.GC$(i).bind(v,e,e.down).bind(y,e,e.move).bind(p,e,e.up):w?(n.GC$(i).unbind(o).unbind(c),n.GC$(document).unbind(s).unbind(l).unbind(h).unbind(a)):n.GC$(i).unbind(v).unbind(y).unbind(p)},i}();n._SimulateMouseEvents=gt;ni=function(){function n(n,t,i){var u=this,e=u._comment=t._comment,f,r;u._touchMouseMessageFilter=new h(u);u._touchTarget=new c(n,"Comment"+e._rowIndex+e._colIndex,u._touchMouseMessageFilter,2,200);u._touchEventProvider=i;u._touchEventHandler=new d(n,t);f=u._touchEventHandler;r=u._touchTarget;r.canDoManipulation=function(){return u._comment.commentState()!==3};r.canDoTap=function(){return!0};r.manipulationStarting=function(n){return f.doManipulationStarting(n)};r.manipulationStarted=function(n){return f.doManipulationStarted(n)};r.manipulationDelta=function(n){return f.doManipulationDelta(n)};r.manipulationInertiaStarting=function(n){return f.doManipulationInertiaStarting(n)};r.manipulationCompleted=function(n){return f.doManipulationCompleted(n)};r.tapped=function(n){return f.doTapped(n)};r.doubleTapped=function(n){return f.doDoubleTapped(n)};r.rightTapped=function(n){return f.doRightTapped(n)}}return n.prototype.attach=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!0)},n.prototype.detach=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!1)},n.prototype.preProcessMouseDown=function(n){return this._touchMouseMessageFilter.preProcessMouseDown(n)},n.prototype.preProcessMouseUp=function(n){return this._touchMouseMessageFilter.preProcessMouseUp(n)},n.prototype.preProcessMouseMove=function(n){return this._touchMouseMessageFilter.preProcessMouseMove(n)},n}();n.CommentTouchManager=ni;d=function(){function t(n,t){var i=this;i._containerElement=n;i._commentView=t;i._comment=t._comment;i._sheet=i._comment._sheet;i._touchZoomManager=new b(i._sheet)}return t.prototype._positionToPage=function(t){var u=new i(t.X,t.Y),r=n.GC$(this._containerElement).offset();return r&&(isNaN(document.body.clientTop)||(r.top+=document.body.clientTop),isNaN(document.body.clientLeft)||(r.left+=document.body.clientLeft),u.X+=r.left,u.Y+=r.top),u},t.prototype.doManipulationStarting=function(n){n.Mode=35},t.prototype.doManipulationStarted=function(n){var t=this,i=t._positionToPage(n.Position);t._commentView._doMouseDownToDragOrResize({target:n.OriginalSource,isTouch:!0,button:0,pageX:i.X,pageY:i.Y,stopPropagation:function(){}});t._touchZoomManager.startZoom()},t.prototype.doManipulationDelta=function(t){var i=this,f=t.Cumulative.Scale,r=i._sheet,e,u;f!=1&&r.parent&&r.parent._allowUserZoom?(r._eventHandler.isCommentWorking=!1,e=i._commentView,n.GC$(e._moveResizeContainerDom).remove(),i._touchZoomManager.continueZoom(f)):(u=i._positionToPage(t.Position),i._commentView._doMouseMove({target:t.OriginalSource,isTouch:!0,button:0,pageX:u.X,pageY:u.Y,stopPropagation:function(){}}))},t.prototype.doManipulationInertiaStarting=function(n){},t.prototype.doManipulationCompleted=function(n){var t=this,r=n.Cumulative.Scale,u=t._sheet,i;r!==1&&u.parent&&u.parent._allowuserZoom?t._touchZoomManager.endZoom(r):(i=t._positionToPage(n.Position),this._commentView._doMouseUp({target:n.OriginalSource,isTouch:!0,button:0,pageX:i.X,pageY:i.Y,stopPropagation:function(){}}))},t.prototype.doTapped=function(n){var r=this,t=r._comment,i=r._sheet,u;try{u=i.isPaintSuspended();i.isPaintSuspended(!0);t.commentState()===3?t.commentState(1):t.commentState()===1&&t.commentState(2)}finally{i.isPaintSuspended(u)}},t.prototype.doDoubleTapped=function(n){},t.prototype.doRightTapped=function(n){},t}();ti=function(){function n(n,t,i){var u=this,e=u._comment=t._comment,f,r;u._touchMouseMessageFilter=new h(u);u._touchTarget=new c(n,"Comment"+e._rowIndex+e._colIndex,u._touchMouseMessageFilter,2,200);u._touchEventProvider=i;u._touchEventHandler=new ii(n,t);f=u._touchEventHandler;r=u._touchTarget;r.canDoManipulation=function(){return u._comment.commentState()!==3};r.canDoTap=function(){return!0};r.manipulationStarting=function(n){return f.doManipulationStarting(n)};r.manipulationStarted=function(n){return f.doManipulationStarted(n)};r.manipulationDelta=function(n){return f.doManipulationDelta(n)};r.manipulationInertiaStarting=function(n){return f.doManipulationInertiaStarting(n)};r.manipulationCompleted=function(n){return f.doManipulationCompleted(n)};r.tapped=function(n){return f.doTapped(n)};r.doubleTapped=function(n){return f.doDoubleTapped(n)};r.rightTapped=function(n){return f.doRightTapped(n)}}return n.prototype.attach=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!0)},n.prototype.detach=function(){this._touchEventProvider&&this._touchEventProvider.attachDettach(this._touchTarget,!1)},n.prototype.preProcessMouseDown=function(n){return this._touchMouseMessageFilter.preProcessMouseDown(n)},n.prototype.preProcessMouseUp=function(n){return this._touchMouseMessageFilter.preProcessMouseUp(n)},n.prototype.preProcessMouseMove=function(n){return this._touchMouseMessageFilter.preProcessMouseMove(n)},n}();n.CommentContentTouchManager=ti;ii=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.doManipulationStarted=function(n){var t=this,i=t._positionToPage(n.Position);t._commentView._doMouseDownToEdit({target:n.OriginalSource,isTouch:!0,button:0,pageX:i.X,pageY:i.Y,stopPropagation:function(){}});t._touchZoomManager.startZoom()},t}(d)})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var ri,bt,w,b,st,l,kt,ht,k;n.feature("floatingObject",["core.common","core.stringResource","core.sheet_action","core.imageLoader"]);var i=null,t=undefined,ui="string",fi="number",o=Math.ceil,h=Math.floor,a=Math.max,r=Math.min,f=Math.abs,d="#044062",ei=0,c=1,oi=2,ct=9007199254740992,dt=700,gt=701,g="position",nt="absolute",v="100%",y="background",si="background-image",lt="floatingobject-selected",at="floatingobject-unselected",e="floatingobject-resize-indicator-select",tt="floatingobject-resize-indicator-unSelect",s="no-user-select",p="floatingobject-content-container",ni="floatingobject-container",ti="floatingobject-moving-container",ii="floatingobject-moving-div",vt="floatingobject-background-cover",yt=".floatingobject-resize-indicator",it="div.floatingobject-resize-indicator.floatingobject-top.floatingobject-left",rt="div.floatingobject-resize-indicator.floatingobject-middle.floatingobject-left",ut="div.floatingobject-resize-indicator.floatingobject-bottom.floatingobject-left",pt="div.floatingobject-resize-indicator.floatingobject-top.floatingobject-center",wt="div.floatingobject-resize-indicator.floatingobject-bottom.floatingobject-center",ft="div.floatingobject-resize-indicator.floatingobject-top.floatingobject-right",et="div.floatingobject-resize-indicator.floatingobject-middle.floatingobject-right",ot="div.floatingobject-resize-indicator.floatingobject-bottom.floatingobject-right",hi="input",u=".gcFloatingObject";(function(n){n[n.CustomFloatingObject=0]="CustomFloatingObject";n[n.Picture=1]="Picture"})(n.FloatingObjectType||(n.FloatingObjectType={}));ri=n.FloatingObjectType;bt=function(r){function f(n){r.call(this);this._floatingObjectType=i;var t=this;t._sheet=n;t._bindEventsOnSheet()}return __extends(f,r),f.prototype.ownerSheet=function(n){return arguments.length===0?this._sheet:(this._sheet=n,this)},f.prototype.find=function(n){var t=this._findItemIndex(n);return t>=0?this[t]:i},f.prototype.replace=function(r,u){if(u===i||u===t)throw new Error(n.SR.Exp_ValueIsNull);var f=this._findItemIndex(r);f>=0&&this.splice(f,1,u)},f.prototype.add=function(r){var u=r.name();if(u===i||u===t)throw new Error(n.SR.Exp_FloatingObjectNameEmptyError);this._checkObjectExists(u);r.owner(this._sheet);this.push(r)},f.prototype.remove=function(n){if(n!==i&&n!==t){var r=this._findItemIndex(n.name());return r>=0&&n.owner(i),this.splice(r,1),!0}return!1},f.prototype.addRows=function(n,t){for(var i=0,r=this.length;i<r;i++)this[i].addRows(n,t)},f.prototype.removeRows=function(n,t){for(var u=this,e=[],r,i=0,f=u.length;i<f;i++)r=u[i],u._isCoverRange(n,-1,n+t-1,u._sheet.getColumnCount(),r)&&(r.dynamicMove()||r.dynamicSize())?e.push(r):r.removeRows(n,t);for(i=0,f=e.length;i<f;i++)u.remove(e[i])},f.prototype.addColumns=function(n,t){for(var i=0,r=this.length;i<r;i++)this[i].addColumns(n,t)},f.prototype.removeColumns=function(n,t){for(var u=this,e=[],r,i=0,f=u.length;i<f;i++)r=u[i],u._isCoverRange(-1,n,u._sheet.getRowCount(),n+t-1,r)&&(r.dynamicMove()||r.dynamicSize())?e.push(r):r.removeColumns(n,t);for(i=0,f=e.length;i<f;i++)u.remove(e[i])},f.prototype._isCoverRange=function(n,t,i,r,u){var f=u.startRow(),e=u.startColumn(),o=u.endRow(),s=u.endColumn();return n<=f&&t<=e&&i>=o&&r>=s},f.prototype._checkObjectExists=function(t){if(this._sheet._findFloatingObjectInternal(t))throw new Error(n.SR.Exp_FloatingObjectHasSameNameError);},f.prototype._findItemIndex=function(n){for(var i=this.length,t=0;t<i;t++)if(this[t].name()===n)return t;return-1},f.prototype._updateFloatingsObjectlayoutOnColumnRowChanged=function(){for(var n,t=0,i=this.length;t<i;t++)n=this[t],n.dynamicMove()?n._updateFloatingObjectLocation():n._updateStartPosition(),n.dynamicSize()?n._updateFloatingObjectSize():n._updateEndPosition()},f.prototype._bindEventsOnSheet=function(){var i=this,t=i._sheet;t&&(n.GC$(window.document.body).bind("scroll"+u,function(){var n=t.parent.getActiveSheet(),i=n._render,r=n._floatingObjectArray;r&&r.length>0&&i&&i._paintFloatingObject(n.getBounds())}),t._bind(n.Events.ColumnChanged+u,function(n,t){var r=t.propertyName;(r==="width"||r==="isVisible")&&i._updateFloatingObjectsLayout()}),t._bind(n.Events.RowChanged+u,function(n,t){var r=t.propertyName;(r==="height"||r==="isVisible")&&i._updateFloatingObjectsLayout()}),t._bind(n.Events.ColumnWidthChanged+u,function(n,t){i._updateFloatingObjectsLayout()}),t._bind(n.Events.RowHeightChanged+u,function(n,t){i._updateFloatingObjectsLayout()}))},f.prototype.dispose=function(){n.GC$(window.document.body).unbind("scroll"+u);var t=this._sheet;t&&(t._unbind(n.Events.ColumnChanged+u),t._unbind(n.Events.RowChanged+u),t._unbind(n.Events.ColumnWidthChanged+u),t._unbind(n.Events.RowHeightChanged+u))},f.prototype._updateFloatingObjectsLayout=function(){var n=this,t=n._sheet,i=t._render;n.length>0&&(n.isNeedToUpdateLayout=!0,i&&i._paintFloatingObject(t.getBounds()))},f.prototype.toJSON=function(){var n=this,r,i;if(!n||n.length===0)return t;for(r=[],i=0;i<n.length;i++)n[i].typeName==="FloatingObject"&&r.push(n[i].toJSON());return r.length===0?t:r},f.prototype.fromJSON=function(n,t){var e=this,u,f,r,s,o;if(n&&n.length!==0)for(u=0;u<n.length;u++)f=n[u],r=i,f&&(s=e._getFloatingObjectTypes(),o=s[f.floatingObjectType],o&&(r=new o,r.owner(e._sheet),r.fromJSON(f,t),e.push(r)))},f.prototype._getFloatingObjectTypes=function(){if(!this._floatingObjectType){var n={};n[0]=b;n[1]=st;this._floatingObjectType=n}return this._floatingObjectType},f}(n._XArray);n._FloatingObjectArray=bt;w=function(){function r(i,r,u,f,e){this._cacheOffset={startRowOffset:t,startColumnOffset:t,endRowOffset:t,endColumnOffset:t};this._isFOColumnsOrRowsVisible=!0;var o=this;o.typeName="FloatingObject";o._name=i;o._location=new n.Rect(typeof r=="number"?r:0,typeof u=="number"?u:0,typeof f=="number"?f:0,typeof e=="number"?e:0);o._canPrint=!0;o._isLocked=!0;o._isVisible=!0;o._isSelected=!1;o._dynamicMove=!0;o._dynamicSize=!0;o._fixedPosition=!1;o._allowMove=!0;o._allowResize=!0}return r.prototype.name=function(t){var i=this;if(arguments.length===0)return i._name;if(typeof t!="string"||t==="")throw new Error(n.SR.Exp_FloatingObjectNameEmptyError);if(i._name!==t){i._name=t;i.onPropertyChanged("name",t)}return i},r.prototype.owner=function(n){var t=this;return arguments.length===0?t._sheet:(t._sheet=n,t._updateFloatingObjectCoorinates(),t)},r.prototype.isSelected=function(n){var t=this,i=t._sheet;if(arguments.length===0)return t._isSelected;if(typeof n=="boolean"&&t._isSelected!==n){i?i._bindToAutoRefresh(function(n){t._isSelected=n})(n):t._isSelected=n;t.onPropertyChanged("isSelected",n)}return t},r.prototype.isLocked=function(n){var t=this;if(arguments.length===0)return t._isLocked;if(typeof n=="boolean"&&t._isLocked!==n){t._isLocked=n;t.onPropertyChanged("isLocked",n)}return t},r.prototype.canPrint=function(n){var t=this;if(arguments.length===0)return t._canPrint;if(typeof n=="boolean"&&t._canPrint!==n){t._canPrint=n;t.onPropertyChanged("canPrint",n)}return t},r.prototype.isVisible=function(n){var t=this,i=t._sheet;if(arguments.length===0)return t._isVisible;if(typeof n=="boolean"&&t._isVisible!==n){i?i._bindToAutoRefresh(function(n){t._isVisible=n})(n):t._isVisible=n;t.onPropertyChanged("visible",n)}return t},r.prototype.position=function(t){var i=this,r=i._sheet;if(arguments.length===0)return new n.Point(i._location.x,i._location.y);if(t instanceof n.Point&&(i._location.x!==t.x||i._location.y!==t.y)){r?r._bindToAutoRefresh(function(n){i._location.x=n.x;i._location.y=n.y;i._adjustPosition();i._updateCoverRange()})(t):(i._location.x=t.x,i._location.y=t.y);i.onPropertyChanged("position",t)}return i},r.prototype.height=function(n){var t=this,i=t._sheet;if(arguments.length===0)return t._location.height;if(typeof n=="number"&&t._location.height!==n){i?i._bindToAutoRefresh(function(n){t._location.height=n;t._adjustSize();t._adjustPosition();t._updateCoverRange()})(n):t._location.height=n;t.onPropertyChanged("height",n)}return t},r.prototype.width=function(n){var t=this,i=t._sheet;if(arguments.length===0)return t._location.width;if(typeof n=="number"&&t._location.width!==n){i?i._bindToAutoRefresh(function(n){t._location.width=n;t._adjustSize();t._adjustPosition();t._updateCoverRange()})(n):t._location.width=n;t.onPropertyChanged("width",n)}return t},r.prototype.startRow=function(n){var t=this;return arguments.length===0?t._startRow:(typeof n=="number"&&t._startRow!==n&&(n=o(n),t._sheet?t._sheet._bindToAutoRefresh(function(n){t._startRow=n;t._updateFloatingObjectLocation()})(n):t._startRow=n),t)},r.prototype.startRowOffset=function(n){var t=this;return arguments.length===0?t._startRowOffset:(typeof n=="number"&&t._startRowOffset!==n&&(t._sheet?t._sheet._bindToAutoRefresh(function(n){t._startRowOffset=n;t._updateFloatingObjectLocation()})(n):t._startRowOffset=n),t)},r.prototype.startColumn=function(n){var t=this;return arguments.length===0?t._startColumn:(typeof n=="number"&&t._startColumn!==n&&(n=o(n),t._sheet?t._sheet._bindToAutoRefresh(function(n){t._startColumn=n;t._updateFloatingObjectLocation()})(n):t._startColumn=n),t)},r.prototype.startColumnOffset=function(n){var t=this;return arguments.length===0?t._startColumnOffset:(typeof n=="number"&&t._startColumnOffset!==n&&(t._sheet?t._sheet._bindToAutoRefresh(function(n){t._startColumnOffset=n;t._updateFloatingObjectLocation()})(n):t._startColumnOffset=n),t)},r.prototype.endRow=function(n){var t=this;return arguments.length===0?t._endRow:(typeof n=="number"&&t._endRow!==n&&(t._sheet?t._sheet._bindToAutoRefresh(function(n){t._endRow=n;t._updateFloatingObjectSize()})(n):t._endRow=n),t)},r.prototype.endRowOffset=function(n){var t=this;return arguments.length===0?t._endRowOffset:(typeof n=="number"&&t._endRowOffset!==n&&(t._sheet?t._sheet._bindToAutoRefresh(function(n){t._endRowOffset=n;t._updateFloatingObjectSize()})(n):t._endRowOffset=n),t)},r.prototype.endColumn=function(n){var t=this;return arguments.length===0?t._endColumn:(typeof n=="number"&&t._endColumn!==n&&(n=o(n),t._sheet?t._sheet._bindToAutoRefresh(function(n){t._endColumn=n;t._updateFloatingObjectSize()})(n):t._endColumn=n),t)},r.prototype.endColumnOffset=function(n){var t=this;return arguments.length===0?t._endColumnOffset:(typeof n=="number"&&t._endColumnOffset!==n&&(t._sheet?t._sheet._bindToAutoRefresh(function(n){t._endColumnOffset=n;t._updateFloatingObjectSize()})(n):t._endColumnOffset=n),t)},r.prototype.dynamicMove=function(n){var t=this;if(arguments.length===0)return t._dynamicMove;if(typeof n=="boolean"&&t._dynamicMove!==n&&!t._fixedPosition){t._dynamicMove=n;n||(t._dynamicSize=!1);t.onPropertyChanged("dynamicMove",n)}return t},r.prototype.dynamicSize=function(n){var t=this;if(arguments.length===0)return t._dynamicSize;if(typeof n=="boolean"&&t._dynamicSize!==n&&!t._fixedPosition){n&&!t._dynamicMove&&(n=!1);t._dynamicSize=n;t.onPropertyChanged("dynamicSize",n)}return t},r.prototype.fixedPosition=function(n){var t=this;if(arguments.length===0)return t._fixedPosition;if(typeof n=="boolean"&&t._fixedPosition!==n){t._fixedPosition=n;n&&(t._dynamicMove=!1,t._dynamicSize=!1);t.onPropertyChanged("fixedPosition",n)}return t},r.prototype.allowResize=function(n){var t=this,i=t._sheet;if(arguments.length===0)return t._allowResize;else n!==t._allowResize&&(i?i._bindToAutoRefresh(function(n){t._allowResize=n})(n):t._allowResize=n)},r.prototype.allowMove=function(n){var t=this,i=t._sheet;if(arguments.length===0)return t._allowMove;else n!==t._allowMove&&(i?i._bindToAutoRefresh(function(n){t._allowMove=n})(n):t._allowMove=n)},r.prototype.onPropertyChanged=function(n,t){var i=this._sheet;this._trigger({sheet:i,sheetName:i?i._name:"",floatingObject:this,propertyName:n})},r.prototype.addRows=function(n,t){var i=this;n=o(n);t=o(t);n<=i.startRow()?i.dynamicMove()&&(i.startRow(i.startRow()+t),i.endRow(i.endRow()+t)):n>i.startRow()&&n<i.endRow()&&i.dynamicSize()&&i.endRow(i.endRow()+t)},r.prototype.removeRows=function(n,t){var i=this,r=n+t-1,u,f;n<=i.startRow()?r<i.startRow()?i.dynamicMove()&&(i.startRow(i.startRow()-t),i.endRow(i.endRow()-t)):r<i.endRow()&&(u=r-i.startRow()+1,f=i.endRow()-i.startRow()+1-u,i.dynamicMove()&&(i.startRow(n),i.startRowOffset(0)),i.dynamicSize()&&i.endRow(n+f-1)):n<=i.endRow()&&(r<i.endRow()?i.dynamicSize()&&i.endRow(i.endRow()-t):i.dynamicSize()&&(i.endRow(n),i.endRowOffset(0)))},r.prototype.addColumns=function(n,t){var i=this;n=o(n);t=o(t);n<=i.startColumn()?i.dynamicMove()&&(i.startColumn(i.startColumn()+t),i.endColumn(i.endColumn()+t)):n>i.startColumn()&&n<i.endColumn()&&i.dynamicSize()&&i.endColumn(i.endColumn()+t)},r.prototype.removeColumns=function(n,t){var i=this,r,u,f;n=o(n);t=o(t);r=n+t-1;n<=i.startColumn()?r<i.startColumn()?i.dynamicMove()&&(i.startColumn(i.startColumn()-t),i.endColumn(i.endColumn()-t)):r<i.endColumn()&&(u=r-i.startColumn()+1,f=i.endColumn()-i.startColumn()+1-u,i.dynamicMove()&&(i.startColumn(n),i.startColumnOffset(0)),i.dynamicSize()&&i.endColumn(n+f-1)):n<=i.endColumn()&&(r<i.endColumn()?i.dynamicSize()&&i.endColumn(i.endColumn()-t):i.dynamicSize()&&(i.endColumn(n),i.endColumnOffset(0)))},r.prototype._isDefaultValue=function(n,t){switch(n){case"x":return t===0;case"y":return t===0;case"width":return t===0;case"height":return t===0;case"canPrint":return t===!0;case"isSelected":return t===!1;case"isLocked":return t==!0;case"isVisible":return t===!0;case"dynamicMove":return t===!0;case"dynamicSize":return t===!0;case"fixedPosition":return t===!1;case"allowMove":return t===!0;case"allowResize":return t===!0;default:return!1}},r.prototype.toJSON=function(){var n=this,r={name:n._name,x:n._location.x,y:n._location.y,width:n._location.width,height:n._location.height,canPrint:n._canPrint,isSelected:n._isSelected,isLocked:n._isLocked,isVisible:n._isVisible,dynamicMove:n._dynamicMove,dynamicSize:n._dynamicSize,fixedPosition:n._fixedPosition,allowMove:n._allowMove,allowResize:n._allowResize},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},r.prototype.fromJSON=function(i,r){var u;if(i){u=this;u._name=i.name;var f=i.x!==t?i.x:0,e=i.y!==t?i.y:0,o=i.width!==t?i.width:0,s=i.height!==t?i.height:0;u._location=new n.Rect(f,e,o,s);i.canPrint!==t&&(u._canPrint=i.canPrint);i.isSelected!==t&&(u._isSelected=i.isSelected);i.isLocked!==t&&(u._isLocked=i.isLocked);i.isVisible!==t&&(u._isVisible=i.isVisible);i.dynamicMove!==t&&(u._dynamicMove=i.dynamicMove);i.dynamicSize!==t&&(u._dynamicSize=i.dynamicSize);i.fixedPosition!==t&&(u._fixedPosition=i.fixedPosition);i.allowMove!==t&&(u._allowMove=i.allowMove);i.allowResize!==t&&(u._allowResize=i.allowResize);u._updateCoverRange()}},r.prototype.clone=function(){var n=new r,t=JSON.stringify(this.toJSON());return n.fromJSON(JSON.parse(t)),n},r.prototype._adjustSize=function(){var n=this,t=n._getSheetHeight(n._location.height),i=n._getSheetWidth(n._location.width);n._location.width>i&&(n._location.width=i);n._location.height>t&&(n._location.height=t)},r.prototype._adjustPosition=function(){var n=this,r=n._location.x+n._location.width,u=n._getSheetWidth(r),t,i;r>u&&(n._location.x=u-n._location.width);n._location.x<0&&(n._location.x=0);t=n._location.y+n._location.height;i=n._getSheetHeight(t);t>i&&(n._location.y=i-n._location.height);n._location.y<0&&(n._location.y=0)},r.prototype._updateFloatingObjectCoorinates=function(){var n=this;n._adjustSize();n._adjustPosition();n._startRow!==i&&n._startRow!==t&&n._startColumn!==i&&n._startColumn!==t?(n._startRowOffset||(n._startRowOffset=0),n._startColumnOffset||(n._startColumnOffset=0),n._updateFloatingObjectLocation()):n._updateStartPosition();n._endColumn!==i&&n._endColumn!==t&&n._endRow!==i&&n._endRow!==t?(n._endRowOffset||(n._endRowOffset=0),n._endColumnOffset||(n._endColumnOffset=0),n._updateFloatingObjectSize()):n._updateEndPosition()},r.prototype._getSheetHeight=function(n){var o=this,r=o._sheet,u,e,f;if(r===i||r===t)return ct;for(u=0,e=r.getRowCount(),f=0;f<e;f++)if(u+=r.getRowHeight(f,3),u>n)break;return u},r.prototype._getSheetWidth=function(n){var o=this,r=o._sheet,u,e,f;if(r===i||r===t)return ct;for(u=0,e=r.getColumnCount(),f=0;f<e;f++)if(u+=r.getColumnWidth(f,3),u>n)break;return u},r.prototype._updateStartRowOffset=function(){var n=this,u=n._startRowOffset,i=n._sheet.getRowHeight(n.startRow(),3),r=n._cacheOffset;i>0&&i--;u>i?(r.startRowOffset||(r.startRowOffset=u),n._startRowOffset=i):r.startRowOffset&&(r.startRowOffset<i?(n._startRowOffset=r.startRowOffset,r.startRowOffset=t):i<r.startRowOffset&&(n._startRowOffset=i))},r.prototype._updateStartColumnOffset=function(){var n=this,u=n._startColumnOffset,r=n._sheet.getColumnWidth(n.startColumn(),3),i=n._cacheOffset;r>0&&r--;u>r?(i.startColumnOffset||(i.startColumnOffset=u),n._startColumnOffset=r):i.startColumnOffset&&(i.startColumnOffset<r?(n._startColumnOffset=i.startColumnOffset,i.startColumnOffset=t):u<i.startColumnOffset&&(n._startColumnOffset=r))},r.prototype._updateEndRowOffset=function(){var n=this,u=n._endRowOffset,r=n._sheet.getRowHeight(n.endRow(),3),i=n._cacheOffset;r>0&&r--;u>r?(i.endRowOffset||(i.endRowOffset=u),n._endRowOffset=r):i.endRowOffset&&(i.endRowOffset<r?(n._endRowOffset=i.endRowOffset,i.endRowOffset=t):u<i.endRowOffset&&(n._endRowOffset=r))},r.prototype._updateEndColumnOffset=function(){var n=this,u=n._endColumnOffset,r=n._sheet.getColumnWidth(n.endColumn(),3),i=n._cacheOffset;r>0&&r--;u>r?(i.endColumnOffset||(i.endColumnOffset=u),n._endColumnOffset=r):i.endColumnOffset&&(i.endColumnOffset<r?(n._endColumnOffset=i.endColumnOffset,i.endColumnOffset=t):u<i.endColumnOffset&&(n._endColumnOffset=r))},r.prototype._updateFloatingObjectLocation=function(){var r=this,e=r._sheet,u,h,o,f,c,s;if(e!==i&&e!==t){for(u=0,h=r.startRow(),o=0;o<h;o++)u+=e.getRowHeight(o,3);for(r._updateStartRowOffset(),u+=r._startRowOffset,f=0,c=r.startColumn(),s=0;s<c;s++)f+=e.getColumnWidth(s,3);if(r._updateStartColumnOffset(),f+=r._startColumnOffset,r._location.x!==f||r._location.y!==u){r._location.x=f;r._location.y=u;r.onPropertyChanged("location",new n.Rect(f,u,r._location.width,r._location.height))}}},r.prototype._updateFloatingObjectSize=function(){var n=this,f=n._sheet,e,a,v,o,y,p;if(f!==i&&f!==t){n._isFOColumnsOrRowsVisible===!1&&(n._isVisible=!0,n._isFOColumnsOrRowsVisible=!0);var r=0,s=n.startRow(),h=n.endRow();for(e=s;e<h;e++)r+=f.getRowHeight(e,3);a=r+f.getRowHeight(h,3);a===0&&n._isVisible===!0&&(n._isVisible=!1,n._isFOColumnsOrRowsVisible=!1);s===h?(n._updateEndRowOffset(),r=n.endRowOffset()-n.startRowOffset()):(v=f.getRowHeight(s,3),v>0&&(r-=n._startRowOffset),n._updateEndRowOffset(),r+=n._endRowOffset);var u=0,c=n.startColumn(),l=n.endColumn();for(o=c;o<l;o++)u+=f.getColumnWidth(o,3);if(y=u+f.getColumnWidth(l,3),y===0&&n._isVisible===!0&&(n._isVisible=!1,n._isFOColumnsOrRowsVisible=!1),c===l?(n._updateEndColumnOffset(),u=n.endColumnOffset()-n.startColumnOffset()):(p=f.getColumnWidth(c,3),p>0&&(u-=n._startColumnOffset),n._updateEndColumnOffset(),u+=n._endColumnOffset),u<0&&(u=0),r<0&&(r=0),n._location.width!==u){n._location.width=u;n.onPropertyChanged("width",u)}if(n._location.height!==r){n._location.height=r;n.onPropertyChanged("height",r)}}},r.prototype._updateStartPosition=function(){var n=this,r=n._sheet,u,f,e,o;r!==i&&r!==t&&(u=n._calcAnchorRow(n._location.y),n._startRow=u.row,n._startRowOffset=u.offsetY,n._startRowOffset===-1&&(n._startRow+=1,n._startRowOffset=0,f=r.getRowCount(),n._startRow===f&&(n._startRow=f-1)),e=n._calcAnchorColumn(n._location.x),n._startColumn=e.column,n._startColumnOffset=e.offsetX,n._startColumnOffset===-1&&(n._startColumn+=1,n._startColumnOffset=0,o=r.getColumnCount(),n._startColumn===o&&(n._startColumn=o-1)))},r.prototype._updateEndPosition=function(){var n=this,r,u;n._sheet!==i&&n._sheet!==t&&(r=n._calcAnchorRow(n._location.y+n._location.height),n._endRow=r.row,n._endRowOffset=r.offsetY,u=n._calcAnchorColumn(n._location.x+n._location.width),n._endColumn=u.column,n._endColumnOffset=u.offsetX)},r.prototype._updateCoverRange=function(){this._updateStartPosition();this._updateEndPosition()},r.prototype._calcAnchorRow=function(n){for(var u,i,f=0,r=0,e=this._sheet.getRowCount(),t=0;t<e;t++)if(u=this._sheet.getRowHeight(t,3),f+=u,i=f-n,i>0)return r=i>0?u-i:-1,{row:t,offsetY:r};else if(i===0)return r=0,{row:t+1,offsetY:0};return{row:e-1,offsetY:0}},r.prototype._calcAnchorColumn=function(n){for(var u,i,f=0,r=0,e=this._sheet.getColumnCount(),t=0;t<e;t++)if(u=this._sheet.getColumnWidth(t,3),f+=u,i=f-n,i>0)return r=i>0?u-i:-1,{column:t,offsetX:r};else if(i===0)return r=0,{column:t+1,offsetX:0};return{column:e-1,offsetX:0}},r.prototype._trigger=function(n){if(this._sheet&&(this._sheet.triggerFloatingObjectChanged(n),n.propertyName==="isSelected")){var t={sheet:n.sheet,sheetName:n.sheetName,floatingObject:n.floatingObject};this._sheet.triggerFloatingObjectSelectionChanged(t)}},r.prototype._createContentContainer=function(){var t=document.createElement("div"),i=n.GC$(t).addClass(p).addClass(s).attr("unselectable","on").css(g,nt);return i.css(y,d),t},r}();n.FloatingObject=w;b=function(t){function r(n,r,u,f,e){t.call(this,n,r,u,f,e);this._content=i;this._needRefresh=!1}return __extends(r,t),r.prototype.Content=function(n){var t=this;if(arguments.length===0)return t._content;t.owner()?t.owner()._bindToAutoRefresh(function(n){t._content=n;t._needRefresh=!0})(n):t._content=n;t.onPropertyChanged("content",n)},r.prototype.onPropertyChanged=function(n,t){var i=this.owner();this._trigger({sheet:i,sheetName:i?i._name:"",floatingObject:this,customFloatingObject:this,propertyName:n})},r.prototype.toJSON=function(){var i=t.prototype.toJSON.call(this),r;return i.floatingObjectType=0,r=n.GC$(document.createElement("div")).append(this.cloneContent()).html(),i.content=r,i},r.prototype.fromJSON=function(i,r){if(i&&(t.prototype.fromJSON.call(this,i,r),i.content)){var u=document.createElement("div");u.innerHTML=i.content;this._content=n.GC$(u.firstChild).getElement(0)}},r.prototype.clone=function(n){var t=new r,i=JSON.stringify(this.toJSON());return t.fromJSON(JSON.parse(i)),t._content=this.cloneContent(),t},r.prototype.cloneContent=function(){var t=this._content,r,u;return t?(t.cloneNode?r=t.cloneNode(!0):(u=document.createElement("div"),u.innerHTML=t.outerHTML,r=u.firstChild),n.GC$(r).removeAttr("id").getElement(0)):i},r.prototype._createContentContainer=function(){var r=document.createElement("div"),h=n.GC$(r).addClass(p).addClass(s).attr("unselectable","on").css(g,nt),t=this.cloneContent(),e=v,o=v,u="",f="",c;return t&&t.style&&(u=t.style.width,f=t.style.height),u!==""&&(e=u),f!==""&&(o=f),t!==i?c=n.GC$(t).css({width:e,height:o}).addClass(vt).addClass(s).attr("unselectable","on").appendTo(r):h.css(y,d),r},r.prototype.refreshContent=function(t){var o=this,u,l;if(o._needRefresh&&t){u=n.GC$(t);u.empty();var r=this.cloneContent(),h=v,c=v,f="",e="";r&&r.style&&(f=r.style.width,e=r.style.height);f!==""&&(h=f);e!==""&&(c=e);r!==i?(l=n.GC$(r).css({width:h,height:c}).addClass(vt).addClass(s).attr("unselectable","on").appendTo(t),u.css(y,"")):u.css(y,d);o._needRefresh=!1}},r}(w);n.CustomFloatingObject=b;st=function(r){function u(n,t,u,f,e,o){r.call(this,n,u,f,e,o);var s=this;s._pictureStretch=0;s._borderWidth=1;s._borderStyle="none";s._borderColor=i;s._borderRadius=-1;s._backColor=i;s._imageLoader=i;s._isImageLoaded=!1;s._isTakeOriginalSize=!1;typeof t=="string"&&s.src(t)}return __extends(u,r),u.prototype._trigger=function(n){if(this.owner()&&(n&&n.floatingObject&&(n.picture=n.floatingObject,delete n.floatingObject),this.owner().triggerPictureChanged(n),n.propertyName==="isSelected")){var t={sheet:n.sheet,sheetName:n.sheetName,picture:n.picture};this.owner().triggerPictureSelectionChanged(t)}},u.prototype.backColor=function(n){var t=this,i;if(arguments.length===0)return t._backColor;if(typeof n=="string"&&t._backColor!==n){i=t.owner();i?i._bindToAutoRefresh(function(n){t._backColor=n})(n):t._backColor=n;t.onPropertyChanged("backColor",n)}return t},u.prototype.borderRadius=function(n){var t=this,i;if(arguments.length===0)return t._borderRadius;if(typeof n=="number"&&!isNaN(n)&&t._borderRadius!==n){i=t.owner();i?i._bindToAutoRefresh(function(n){t._borderRadius=n})(n):t._borderRadius=n;t.onPropertyChanged("borderRadius",n)}return t},u.prototype.borderWidth=function(n){var t=this,i;if(arguments.length===0)return t._borderWidth;if(typeof n=="number"&&!isNaN(n)&&t._borderWidth!==n){i=t.owner();i?i._bindToAutoRefresh(function(n){t._borderWidth=n})(n):t._borderWidth=n;t.onPropertyChanged("borderWidth",n)}return t},u.prototype.borderStyle=function(n){var t=this,i;if(arguments.length===0)return t._borderStyle;if(typeof n=="string"&&t._borderStyle!==n){i=t.owner();i?i._bindToAutoRefresh(function(n){t._borderStyle=n})(n):t._borderStyle=n;t._isBorderStyleWork(n)||(t._borderWidth=0);t.onPropertyChanged("borderStyle",n)}return t},u.prototype.borderColor=function(n){var t=this,i;if(arguments.length===0)return t._borderColor;if(typeof n=="string"&&t._borderColor!==n){i=t.owner();i?i._bindToAutoRefresh(function(n){t._borderColor=n})(n):t._borderColor=n;t.onPropertyChanged("borderColor",n)}return t},u.prototype.pictureStretch=function(i){var r=this,u;if(arguments.length===0)return r._pictureStretch;if(r._pictureStretch!==i&&n.ImageLayout[i]!==t){u=r.owner();u?u._bindToAutoRefresh(function(n){r._pictureStretch=n})(i):r._pictureStretch=i;r.onPropertyChanged("pictureStretch",i)}return r},u.prototype.getOriginalWidth=function(){return this._originalWidth},u.prototype.getOriginalHeight=function(){return this._originalHeight},u.prototype.src=function(n){var t=this,i;if(arguments.length===0)return t._src;if(typeof n=="string"&&t._src!==n){i=t.owner();i?i._bindToAutoRefresh(function(n){t._src=n})(n):t._src=n;t.onPropertyChanged("src",n);t._isImageLoaded=!1;t._loadImage()}return t},u.prototype.onPropertyChanged=function(n,t){var i=this.owner();this._trigger({sheet:i,sheetName:i?i._name:"",floatingObject:this,picture:this,propertyName:n})},u.prototype._isDefaultValue=function(n,t){switch(n){case"backColor":return t===i;case"borderRadius":return t===-1;case"borderWidth":return t===1;case"borderStyle":return t==="none";case"borderColor":return t===i;case"pictureStretch":return t===0}return r.prototype._isDefaultValue.call(this,n,t)},u.prototype.toJSON=function(){var u=this,i=r.prototype.toJSON.call(this),f,e,o;i.src=u._src;i.floatingObjectType=1;i.backColor=u._backColor;i.borderRadius=u._borderRadius;i.borderWidth=u._borderWidth;i.borderStyle=u._borderStyle;i.borderColor=u._borderColor;i.pictureStretch=u._pictureStretch;f={};for(e in i)o=i[e],u._isDefaultValue(e,o)||(f[e]=o);return n.GC$.isEmptyObject(f)?t:f},u.prototype.fromJSON=function(n,i){if(n){var u=this;r.prototype.fromJSON.call(this,n,i);n.src&&(u._src=n.src,u._isImageLoaded=!1,u._loadImage(),n.backColor!==t&&(u._backColor=n.backColor),n.borderRadius!==t&&(u._borderRadius=n.borderRadius),n.borderWidth!==t&&(u._borderWidth=n.borderWidth),n.borderStyle!==t&&(u._borderStyle=n.borderStyle),n.borderColor!==t&&(u._borderColor=n.borderColor),n.pictureStretch!==t&&(u._pictureStretch=n.pictureStretch))}},u.prototype.clone=function(){var n=new u,t=JSON.stringify(this.toJSON());return n.fromJSON(JSON.parse(t)),n},u.prototype._isBorderStyleWork=function(n){switch(n){case"dotted":case"dashed":case"solid":case"double":case"groove":case"ridge":case"inset":case"outset":return!0;default:return!1}},u.prototype._loadImage=function(){var t=this,i=t._src,r,u;t._imageLoader||(t._imageLoader=new n._GcImageLoader(function(){t._loadImage()}));try{t._imageLoader.getState(i)?(t._isImageLoaded=!0,r=t._imageLoader.getImage(i),t._originalWidth=r.width,t._originalHeight=r.height,t._isTakeOriginalSize&&(t.width(t._originalWidth),t.height(t._originalHeight),t._isTakeOriginalSize=!1),u=t.owner(),u&&u.repaint()):t._imageLoader.addImage(i)}catch(f){}},u.prototype._createContentContainer=function(){var t=document.createElement("div"),i=n.GC$(t).addClass(p).addClass(s).attr("unselectable","on").css(g,nt);return t},u}(w);n.Picture=st;l=function(){function o(n,t){this._srcCache="";var i=this;i._floatingObject=n;i.name=i._floatingObject.name();i._sheet=t;i._isMouseCapture=!1;i._isResizeIndicatorDisplayed=!1}return o.prototype.floatingObject=function(){return this._floatingObject},o.prototype.render=function(t,i){var r=this,c=!1,o,h,u,f,e,l;r._rect=t;r._floatingObjectContainerDiv||(r._floatingObjectContainerDiv=r._createFloatingObjectContainer(r._floatingObject.name()),o=r._sheet.parent,o&&(r._containerDiv=o._getContainerDiv(),r._containerDiv&&n.GC$(r._containerDiv).append(r._floatingObjectContainerDiv)));r._floatingObjectContentDiv||(r._floatingObjectContentDiv=r._floatingObject._createContentContainer(),typeof r._floatingObject.borderWidth=="function"?(r._borderDiv=document.createElement("div"),n.GC$(r._borderDiv).addClass(s+" "+p).attr("unselectable","on"),r._floatingObjectContainerDiv.appendChild(r._borderDiv),r._borderDiv.appendChild(r._floatingObjectContentDiv)):(r._floatingObjectContainerDiv.appendChild(r._floatingObjectContentDiv),c=!0));r._borderDiv&&(r._applyBorderStyle(i,t),i.x=0,i.y=0);h=n.GC$(r._floatingObjectContainerDiv);u=n.GC$(r._floatingObjectContentDiv);h.css({top:t.y,left:t.x,width:t.width,height:t.height});u.css({top:i.y,left:i.x,width:i.width,height:i.height});r._floatingObject instanceof b&&r._floatingObject.refreshContent(r._floatingObjectContentDiv);r._borderDiv&&r._paintImage();f=h.getElement(0);r._floatingObject.isSelected()?(u.removeClass(at).addClass(lt),r._floatingObject.allowResize()?r._showResizeIndicator(f):r._isResizeIndicatorDisplayed&&r._hideResizeIndicator(f)):(u.removeClass(lt).addClass(at),r._hideResizeIndicator(f));c&&(e=r._sheet,l=r._floatingObjectContentDiv.firstChild,e.triggerCustomFloatingObjectLoaded({sheet:e,sheetName:e._name,customFloatingObject:r._floatingObject,element:l}))},o.prototype.setFloatingObjectZIndex=function(t){n.GC$(this._floatingObjectContainerDiv).css("z-index",t)},o.prototype.getFloatingObjectZIndex=function(){var i=this._floatingObjectContainerDiv,t;return i&&(t=parseInt(n.GC$(i).css("z-index")),!isNaN(t))?t:-1},o.prototype._paintImage=function(){var u=this,r=u._floatingObject,e=r.src(),o=r.pictureStretch(),s=n._ThemeContext.getColor(r.owner(),r.backColor()),f;if(e&&u._floatingObjectContentDiv&&(f=n.GC$(u._floatingObjectContentDiv),u._srcCache!==e&&(u._srcCache=e,f.css("background-image","url('"+e+"')").css("background-repeat","no-repeat")),f.css("background-color",s),o!==i&&o!==t)&&r._isImageLoaded){var h=r.getOriginalWidth(),c=r.getOriginalHeight(),l=f.width(),a=f.height();n.util._applyBackgroundImageLayout(u._floatingObjectContentDiv,l,a,h,c,o)}},o.prototype._applyBorderStyle=function(t,i){var p=this._borderDiv,f=this._floatingObject,u=f.borderWidth(),l=f.borderStyle(),w=n._ThemeContext.getColor(f.owner(),f.borderColor()),b=f.borderRadius(),e=0,r=h(o._resizeIndicatorSize/2+1);f._isBorderStyleWork(l)||(u=0);u<r&&(e=r-u);var s=e,c=e,v=e,y=e;r=a(u,r);t.x<0?s+=t.x-r:(s+=t.x<r?t.x-r:0,y=i.width-s-t.width-2-2*u);t.y<0?c+=t.y-r:(c+=t.y<r?t.y-r:0,v=i.height-c-t.height-2-2*u);n.GC$(p).css({position:"absolute",left:s,top:c,bottom:v,right:y,"border-width":u,"border-style":l,"border-color":w,"border-radius":b})},o.prototype._dispose=function(){var t=this;t._touchManager&&t._touchManager.detach();t._floatingObjectContainerDiv&&(n.GC$(t._floatingObjectContainerDiv).remove(),t._floatingObjectContainerDiv=i);t._moveResizeContainerDiv&&(n.GC$(t._moveResizeContainerDiv).remove(),t._moveResizeContainerDiv=i)},o.prototype._showResizeIndicator=function(t){var g=n.GC$(yt,t),s,d;g.removeClass(tt);var i=this,l=i._getHTMLElementBounds(i._floatingObjectContainerDiv),w=i._floatingObjectContentDiv,v=i._floatingObject;i._borderDiv&&(w=i._borderDiv);var f=i._getHTMLElementBounds(w),a=f.x,c=f.y,y=l.height-f.y-f.height,b=l.width-f.x-f.width,u=0,r=o._resizeIndicatorSize,p=r+2,k=h(r/2+1);typeof v.borderWidth=="function"&&(s=v.borderWidth(),d=v.borderStyle(),v._isBorderStyleWork(d)||(s=0),s>=k&&(u=s-k),y=l.height-c-f.height-s,b=l.width-a-f.width-s,a+=s,c+=s);a>0?(c>0?n.GC$(it,i._floatingObjectContainerDiv).css({top:u,left:u,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(it),l.height>0?n.GC$(rt,i._floatingObjectContainerDiv).css({left:u,top:(f.height-p)/2+c,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(rt),y>0?n.GC$(ut,i._floatingObjectContainerDiv).css({left:u,bottom:u,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(ut)):(i._resizeIndicatorUnselect(it),i._resizeIndicatorUnselect(rt),i._resizeIndicatorUnselect(ut));c>0?n.GC$(pt,i._floatingObjectContainerDiv).css({top:u,left:(f.width-p)/2+a,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(pt);y>0?n.GC$(wt,i._floatingObjectContainerDiv).css({left:(f.width-p)/2+a,bottom:u,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(wt);b>0?(c>0?n.GC$(ft,i._floatingObjectContainerDiv).css({right:u,top:u,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(ft),l.height>0?n.GC$(et,i._floatingObjectContainerDiv).css({top:(f.height-p)/2+c,right:u,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(et),y>0?n.GC$(ot,i._floatingObjectContainerDiv).css({right:u,bottom:u,width:r,height:r}).addClass(e):i._resizeIndicatorUnselect(ot)):(i._resizeIndicatorUnselect(ft),i._resizeIndicatorUnselect(et),i._resizeIndicatorUnselect(ot));i._isResizeIndicatorDisplayed=!0},o.prototype._resizeIndicatorUnselect=function(t){n.GC$(t,this._floatingObjectContainerDiv).removeClass(e).addClass(tt)},o.prototype._hideResizeIndicator=function(t){n.GC$(yt,t).removeClass(e).addClass(tt);this._isResizeIndicatorDisplayed=!1},o.prototype._createFloatingObjectContainer=function(t){var r=document.createElement("div"),u=n.GC$(r),i=this;i._renderManager.reduceZIndex();u.addClass(ni).addClass(s).attr("unselectable","on").css("z-index",dt).bind("mousedown",function(n){i._doMouseDown(n)}).bind("mousemove",function(n){i._doMouseMove(n)}).bind("mouseup",function(n){i._doMouseUp(n)});r.addEventListener("mousewheel",function(n){i._doMouseWheel(n)},!1);r.addEventListener("DOMMouseScroll",function(n){i._doMouseWheel(n)},!1);var f=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-top floatingobject-left floatingobject-absolute"),e=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-top floatingobject-center floatingobject-absolute"),o=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-top floatingobject-right floatingobject-absolute"),h=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-middle floatingobject-left floatingobject-absolute"),c=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-middle floatingobject-right floatingobject-absolute"),l=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-bottom floatingobject-left floatingobject-absolute"),a=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-bottom floatingobject-center floatingobject-absolute"),v=n.GC$(document.createElement("div")).addClass("floatingobject-resize-indicator floatingobject-bottom floatingobject-right floatingobject-absolute");return u.append(f).append(e).append(o).append(h).append(c).append(l).append(a).append(v),n.features.touch&&(i._touchManager=new n.FloatingObjectTouchManager(r,i,i._sheet.parent._touchEventProvider),i._touchManager.attach()),r},o.prototype._createMoveResizeContainer=function(){var t=this,h,e,r,u,i,c,o,s,l,f;if(t._floatingObjectContainerDiv&&t._layout&&!t._moveResizeDiv){for(t._moveResizeContainerDiv=document.createElement("div"),t._moveResizeDiv=document.createElement("div"),t._attachedMoveResizeDivDict={},h=t._renderManager._containerArray.length,e=0;e<h;e++)r=t._renderManager._containerArray[e],u=r._floatingObject,u&&u.name()!==t._floatingObject.name()&&u.isSelected()&&!t._attachedMoveResizeDivDict[u.name()]&&(t._attachedMoveResizeDivDict[u.name()]={offsetX:r._layout.x-t._layout.x,offsetY:r._layout.y-t._layout.y,height:r._layout.height,width:r._layout.width,moveResizeDiv:document.createElement("div")});i=t._getViewportRect(t._rowViewportIndex,t._columnViewportIndex);c=n.GC$(t._moveResizeContainerDiv);c.addClass(ti).css("z-index",gt).css({top:i.y,left:i.x,width:i.width,height:i.height,background:"rgba(255,255,255,0.01)"}).bind("mousemove",function(n){t._doMouseMove(n)}).bind("mouseup",function(n){t._doMouseUp(n)});o=t._layout.y-i.y;s=t._layout.x-i.x;t._attachMoveResizeDivToContainer(t._moveResizeDiv,t._moveResizeContainerDiv,s,o,t._layout.width,t._layout.height);for(l in t._attachedMoveResizeDivDict)f=t._attachedMoveResizeDivDict[l],t._attachMoveResizeDivToContainer(f.moveResizeDiv,t._moveResizeContainerDiv,s+f.offsetX,o+f.offsetY,f.width,f.height);t._containerDiv&&n.GC$(t._containerDiv).append(t._moveResizeContainerDiv)}},o.prototype._handleDocumentMouseMove=function(){var t=this;t._isMouseCapture||(n.GC$(document).bind("mousemove"+u,function(n){t._doMouseMove(n)}).bind("mouseup"+u,function(n){t._doMouseUp(n)}),t._isMouseCapture=!0)},o.prototype._unhandleDocumentMouseMove=function(){this._isMouseCapture&&(this._isMouseCapture=!1,n.GC$(document).unbind("mousemove"+u).unbind("mouseup"+u))},o.prototype._doMouseDown=function(t){var i=this,r=i._sheet,c,f,e;if(r.canEditFloatingObject(i._floatingObject)&&r.endEdit()){if(i._touchManager&&!t.isTouch&&i._touchManager.preProcessMouseDown(t)){n.util.cancelDefault(t);return}if(t.button===0||t.button===2){if(t.ctrlKey||t.shiftKey?i._floatingObject.isSelected()?i._floatingObject.isSelected(!1):(i._floatingObject.isSelected(!0),n.FocusHelper.setActiveElement(r)):i._floatingObject.isSelected()||(r.unSelectAllFloatingObjects(),i._floatingObject.isSelected(!0),n.FocusHelper.setActiveElement(r)),r._commentManager&&r._commentManager.deactivateComment(),r._saveAndClearSheetSelections(),t.button===2)return;var u=r._eventHandler,s=u._getCanvasOffset(),o=new n.Point(t.pageX-s.left,t.pageY-s.top),h=i._hitTest(o.x,o.y);if(!i._floatingObject.allowMove()&&!(i._floatingObject.allowResize()&&!h.inMoving))return;i._mousePosition=o;i._isMouseLeftButtonDown=!0;i._mouseDownHittestInfo=h;i._mouseDownHittestInfo.inMoving?(i._moveInfo={},i._moveInfo.startTopRow=r.getViewportTopRow(i._rowViewportIndex),i._moveInfo.startLeftColumn=r.getViewportLeftColumn(i._columnViewportIndex),i._moveInfo.startX=i._mousePosition.x,i._moveInfo.startY=i._mousePosition.y):(i._createMoveResizeContainer(),c=n.GC$(i._moveResizeDiv),i._resizeInfo={},f=i._getHTMLElementBounds(i._moveResizeDiv),i._resizeInfo.startX=f.x,i._resizeInfo.startY=f.y,i._resizeInfo.startWidth=f.width,i._resizeInfo.startHeight=f.height,i._resizeInfo.startTopRow=r.getViewportTopRow(i._rowViewportIndex),i._resizeInfo.startLeftColumn=r.getViewportLeftColumn(i._columnViewportIndex));i._handleDocumentMouseMove();e=r.hitTest(i._mousePosition.x,i._mousePosition.y);u.startHitInfo={scrollRowViewportIndex:e.rowViewportIndex,scrollColViewportIndex:e.colViewportIndex,hitTestType:e.hitTestType};u.mousePosition=i._mousePosition;u.startScroll();u.isFloatingObjectWorking=!0}return!1}},o.prototype._doMouseMove=function(t){var i=this,u=i._sheet,e;if(u.canEditFloatingObject(i._floatingObject)){if(i._touchManager&&!t.isTouch&&i._touchManager.preProcessMouseMove(t)){n.util.cancelDefault(t);return}if(u._isMouseDownInSheet)return i._floatingObjectContainerDiv&&(e=n.GC$(i._floatingObjectContainerDiv),e.css("cursor","default")),!0;var f=u._eventHandler,o=f._getCanvasOffset(),r=new n.Point(t.pageX-o.left,t.pageY-o.top);return i._isMouseLeftButtonDown?(n.GC$(i._moveResizeContainerDiv).css("cursor",n.GC$(i._floatingObjectContainerDiv).css("cursor")),i._mouseDownHittestInfo.inMoving?(i._isMoving=!0,i._createMoveResizeContainer(),i._doMoveContainer(i._mousePosition,r)):i._floatingObject.allowResize()&&(i._isResizing=!0,i._doResizeContainer(i._mousePosition,i._mouseDownHittestInfo)),(i._isMoving||i._isResizing)&&(i._mousePosition=r,f.mousePosition=r,f.continueScroll(),n.GC$(document.body).addClass(s).attr("unselectable","on"))):i._updateCursor(r),!1}},o.prototype._doMouseUp=function(t){var i=this,r=i._sheet,u=r._eventHandler,h,f,e,o;if(r.canEditFloatingObject(i._floatingObject)){if(i._touchManager&&!t.isTouch&&i._touchManager.preProcessMouseUp(t)){n.util.cancelDefault(t);return}return r._isMouseDownInSheet?(i._floatingObjectContainerDiv&&(h=n.GC$(i._floatingObjectContainerDiv),h.css("cursor","move")),!0):(u.isFloatingObjectWorking=!1,u.stopScroll(),f=u._getCanvasOffset(),e=new n.Point(t.pageX-f.left,t.pageY-f.top),i._moveInfo&&(i._moveInfo.endX=e.x,i._moveInfo.endY=e.y),i._mouseDownHittestInfo&&(o=i._floatingObject.fixedPosition(),i._mouseDownHittestInfo.inMoving&&i._isMoving?(o&&i._adjustMoveInfo(),t.ctrlKey?i._doCopyFloatingObject():i._doMoveFloatingObject()):i._isResizing&&(o&&i._adjustResizeInfo(),i._doResizeFloatingObject()),n.GC$(document.body).removeClass(s)),i._resetStatusOnMouseUp(),!1)}},o.prototype._adjustMoveInfo=function(){var n=this;if(n._moveInfo){var i=n._floatingObject,o=n._sheet,t=o._getSheetLayout(),s=t.width-t.rowHeaderWidth-t.headerX,h=t.height-t.colHeaderHeight-t.headerY,r=n._moveInfo.startX,u=n._moveInfo.startY,f=i.position().x,e=i.position().y,c=i.width(),l=i.height();f+n._moveInfo.endX-r<0&&(n._moveInfo.endX=r-f);e+n._moveInfo.endY-u<0&&(n._moveInfo.endY=u-e);f+c+n._moveInfo.endX-r>s&&(n._moveInfo.endX=s+r-f-c);e+l+n._moveInfo.endY-u>h&&(n._moveInfo.endY=h+u-e-l);n._moveInfo.startTopRow=o.getViewportTopRow(n._rowViewportIndex);n._moveInfo.startLeftColumn=o.getViewportLeftColumn(n._columnViewportIndex)}},o.prototype._adjustResizeInfo=function(){var t=this;if(t._resizeInfo){var u=t._sheet,i=u._getSheetLayout(),f=i.width-i.rowHeaderWidth-i.headerX,e=i.height-i.colHeaderHeight-i.headerY,r=new n.Rect(t._resizeInfo.endX,t._resizeInfo.endY,t._resizeInfo.endWidth,t._resizeInfo.endHeight);r=r.getIntersect(0,0,f,e);t._resizeInfo.endX=r.x;t._resizeInfo.endY=r.y;t._resizeInfo.endWidth=r.width;t._resizeInfo.endHeight=r.height;t._resizeInfo.startTopRow=u.getViewportTopRow(t._rowViewportIndex);t._resizeInfo.startLeftColumn=u.getViewportLeftColumn(t._columnViewportIndex)}},o.prototype._resetStatusOnMouseUp=function(){var t=this;t._resizeInfo=i;t._moveInfo=i;t._attachedMoveResizeDivDict=i;n.GC$(t._moveResizeContainerDiv).remove();t._moveResizeDiv=i;t._isMouseLeftButtonDown=!1;t._unhandleDocumentMouseMove();t._isMoving=!1;t._isResizing=!1},o.prototype._doMouseWheel=function(t){var i=this._sheet,r;if(i)return t=t?t:window.event,r=t.detail?t.detail:t.wheelDelta/-40,i._eventHandler.doMouseWheel(t,parseInt(r,10),0),n.util.cancelDefault(t),!1},o.prototype._doCopyFloatingObject=function(){var t=this,i=t._sheet,r,s,h;if(t._moveInfo){var u=t._getTwoRowDistance(t._moveInfo.startTopRow,i.getViewportTopRow(t._rowViewportIndex)),f=t._getTwoColumnDistance(t._moveInfo.startLeftColumn,i.getViewportLeftColumn(t._columnViewportIndex)),e=t._moveInfo.endX-t._moveInfo.startX+(t._moveInfo.endX>t._moveInfo.startX?f:-1*f),o=t._moveInfo.endY-t._moveInfo.startY+(t._moveInfo.endY>t._moveInfo.startY?u:-1*u);if(e===0&&o===0)return;r=[];r.push(t._floatingObject.name());for(s in t._attachedMoveResizeDivDict)r.push(s);h=new n.UndoRedo.DragCopyFloatingObjectUndoAction(i,{names:r},{offsetX:e,offsetY:o});i._doCommand(h)}},o.prototype._doMoveFloatingObject=function(){var t=this,i=t._sheet,r,s,h;if(t._moveInfo){var e=t._getTwoRowDistance(t._moveInfo.startTopRow,i.getViewportTopRow(t._rowViewportIndex)),o=t._getTwoColumnDistance(t._moveInfo.startLeftColumn,i.getViewportLeftColumn(t._columnViewportIndex)),u=t._moveInfo.endX-t._moveInfo.startX+(t._moveInfo.endX>t._moveInfo.startX?o:-1*o),f=t._moveInfo.endY-t._moveInfo.startY+(t._moveInfo.endY>t._moveInfo.startY?e:-1*e);u=u/i._zoomFactor;f=f/i._zoomFactor;r=[];r.push(t._floatingObject.name());for(s in t._attachedMoveResizeDivDict)r.push(s);h=new n.UndoRedo.MovingFloatingObjectUndoAction(i,{names:r},{offsetX:u,offsetY:f});i._doCommand(h)}},o.prototype._doResizeFloatingObject=function(){var t=this,i=t._sheet,r=i._zoomFactor,u,h,c;if(t._resizeInfo){var f=t._getTwoRowDistance(t._resizeInfo.startTopRow,i.getViewportTopRow(t._rowViewportIndex)),e=t._getTwoColumnDistance(t._resizeInfo.startLeftColumn,i.getViewportLeftColumn(t._columnViewportIndex)),o=t._resizeInfo.endX-t._resizeInfo.startX+(t._resizeInfo.endX>t._resizeInfo.startX?e:-1*e);o=o/r;u=t._resizeInfo.endY-t._resizeInfo.startY+(t._resizeInfo.endY>t._resizeInfo.startY?f:-1*f);u=u/r;var l=(t._resizeInfo.endWidth+e)/r-t._floatingObject.width(),a=(t._resizeInfo.endHeight+f)/r-t._floatingObject.height(),s=[];s.push(t._floatingObject.name());for(h in t._attachedMoveResizeDivDict)s.push(h);c=new n.UndoRedo.ResizingFloatingObjectUndoAction(i,{names:s},{offsetX:o,offsetY:u,offsetWidth:l,offsetHeight:a});i._doCommand(c)}},o.prototype._doMoveContainer=function(t,i){var r=this,e,o;if(r._moveResizeDiv){var s=n.GC$(r._moveResizeDiv),u=i.x-t.x,f=i.y-t.y;r._doMoveContainerImp(r._moveResizeDiv,u,f);for(e in r._attachedMoveResizeDivDict)o=r._attachedMoveResizeDivDict[e],r._doMoveContainerImp(o.moveResizeDiv,u,f)}},o.prototype._doMoveContainerImp=function(t,i,r){var u=n.GC$(t),f=u.position();u.css({top:f.top+r,left:f.left+i})},o.prototype._doResizeContainer=function(t,i){var r,u,e,l,a;if(i){r=this;e=r._getViewportRect(r._rowViewportIndex,r._columnViewportIndex);t=new n.Point(t.x-e.x,t.y-e.y);i.inTopNWSEResizing?u=r._getFloatingObjectTopLeftResizingRect(t):i.inTopNSResizing?u=r._getFloatingObjectTopCenterResizingRect(t):i.inTopNESWResizing?u=r._getFloatingObjectTopRightResizingRect(t):i.inLeftWEResizing?u=r._getFloatingObjectMiddleLeftResizingRect(t):i.inRightWEResizing?u=r._getFloatingObjectMiddleRightResizingRect(t):i.inBottomNESWResizing?u=r._getFloatingObjectBottomLeftResizingRect(t):i.inBottomNSReszing?u=r._getFloatingObjectBottomCenterResizingRect(t):i.inBottomNWSEReszing&&(u=r._getFloatingObjectBottomRightResizingRect(t));r._resizeInfo.endX=u.x;r._resizeInfo.endY=u.y;r._resizeInfo.endWidth=u.width;r._resizeInfo.endHeight=u.height;var v=n.GC$(r._moveResizeDiv),f=r._getHTMLElementBounds(r._moveResizeDiv),o=u.y-f.y,s=u.x-f.x,h=u.width-f.width,c=u.height-f.height;r._doResizeContainerImp(r._moveResizeDiv,s,o,h,c);for(l in r._attachedMoveResizeDivDict)a=r._attachedMoveResizeDivDict[l],r._doResizeContainerImp(a.moveResizeDiv,s,o,h,c)}},o.prototype._doResizeContainerImp=function(t,i,r,u,f){var o=n.GC$(t),e=this._getHTMLElementBounds(t);o.css({top:e.y+r,left:e.x+i,width:e.width+u,height:e.height+f})},o.prototype._attachMoveResizeDivToContainer=function(t,i,r,u,f,e){n.GC$(t).addClass(ii).css({top:u-1,left:r-1,width:f,height:e}).appendTo(i)},o.prototype._getHTMLElementBounds=function(t){var i=n.GC$(t),r=i.position();return new n.Rect(r.left,r.top,i.width(),i.height())},o.prototype._updateCursor=function(t){var f=this;if(f._floatingObjectContainerDiv){var o=n.GC$(f._floatingObjectContainerDiv),r=f._hitTest(t.x,t.y),u=f._floatingObject.allowResize(),s=f._floatingObject.allowMove(),e;r!==i&&(e=r.inTopNWSEResizing?u?"nw-resize":"default":r.inTopNSResizing?u?"n-resize":"default":r.inTopNESWResizing?u?"ne-resize":"default":r.inLeftWEResizing?u?"w-resize":"default":r.inRightWEResizing?u?"w-resize":"default":r.inBottomNESWResizing?u?"sw-resize":"default":r.inBottomNSReszing?u?"n-resize":"default":r.inBottomNWSEReszing?u?"se-resize":"default":s?"move":"default",o.css("cursor",e))}},o.prototype._getFloatingObjectTopLeftResizingRect=function(t){var i=this,u=r(i._resizeInfo.startX+i._resizeInfo.startWidth,t.x),e=r(i._resizeInfo.startY+i._resizeInfo.startHeight,t.y),o=f(t.x-i._resizeInfo.startX-i._resizeInfo.startWidth),s=f(t.y-i._resizeInfo.startY-i._resizeInfo.startHeight);return new n.Rect(u,e,o,s)},o.prototype._getFloatingObjectTopCenterResizingRect=function(t){var i=this,u=i._resizeInfo.startX,e=r(i._resizeInfo.startY+i._resizeInfo.startHeight,t.y),o=f(t.y-i._resizeInfo.startY-i._resizeInfo.startHeight),s=i._resizeInfo.startWidth;return new n.Rect(u,e,s,o)},o.prototype._getFloatingObjectTopRightResizingRect=function(t){var i=this,u=r(i._resizeInfo.startX,t.x),e=r(i._resizeInfo.startY+i._resizeInfo.startHeight,t.y),o=f(t.x-i._resizeInfo.startX),s=f(t.y-i._resizeInfo.startY-i._resizeInfo.startHeight);return new n.Rect(u,e,o,s)},o.prototype._getFloatingObjectMiddleLeftResizingRect=function(t){var i=this,u=r(i._resizeInfo.startX+i._resizeInfo.startWidth,t.x),e=i._resizeInfo.startY,o=f(t.x-i._resizeInfo.startX-i._resizeInfo.startWidth),s=i._resizeInfo.startHeight;return new n.Rect(u,e,o,s)},o.prototype._getFloatingObjectMiddleRightResizingRect=function(t){var i=this,u=r(i._resizeInfo.startX,t.x),e=i._resizeInfo.startY,o=f(t.x-i._resizeInfo.startX),s=i._resizeInfo.startHeight;return new n.Rect(u,e,o,s)},o.prototype._getFloatingObjectBottomLeftResizingRect=function(t){var i=this,u=r(i._resizeInfo.startX+i._resizeInfo.startWidth,t.x),e=r(i._resizeInfo.startY,t.y),o=f(t.x-i._resizeInfo.startX-i._resizeInfo.startWidth),s=f(t.y-i._resizeInfo.startY);return new n.Rect(u,e,o,s)},o.prototype._getFloatingObjectBottomCenterResizingRect=function(t){var i=this,u=i._resizeInfo.startX,e=r(i._resizeInfo.startY,t.y),o=f(t.y-i._resizeInfo.startY),s=i._resizeInfo.startWidth;return new n.Rect(u,e,s,o)},o.prototype._getFloatingObjectBottomRightResizingRect=function(t){var i=this,u=r(i._resizeInfo.startX,t.x),e=r(i._resizeInfo.startY,t.y),o=f(t.x-i._resizeInfo.startX),s=f(t.y-i._resizeInfo.startY);return new n.Rect(u,e,o,s)},o.prototype._getViewportRect=function(n,t){var w=this,i=w._sheet,u=i._getSheetLayout(),r=u.viewportRect(n,t),e,o,s,h,f,l=w._floatingObject,b=l.startRow(),k=l.startColumn(),d=l.endRow(),g=l.endColumn(),a=i.frozenRowCount,v=i.frozenColCount,y=i.getRowCount(3)-i.getFrozenTrailingRowCount()-1,p=i.getColumnCount(3)-i.getFrozenTrailingColumnCount()-1;return n===c?(a>0&&(e=i.getViewportTopRow(n),(b<a||e===a)&&(r.y-=u.frozenHeight,r.height+=u.frozenHeight)),i._frozenTrailingRowCount>0&&(o=i.getViewportBottomRow(n),d>y&&o===y&&(r.height+=u.frozenTrailingHeight))):n===c-1?(e=i.getViewportTopRow(n+1),(d>=e||e===a)&&(f=u.viewportRect(n+1,t),r.height+=f.height)):n===c+1&&(o=i.getViewportBottomRow(n-1),(b<=o||o===y)&&(f=u.viewportRect(n-1,t),r.y=f.y,r.height+=f.height)),t===c?(v>0&&(s=i.getViewportLeftColumn(t),(k<v||s===v)&&(r.x-=u.frozenWidth,r.width+=u.frozenWidth)),i._frozenTrailingColCount>0&&(h=i.getViewportRightColumn(t),(g>p||h===p)&&(r.width+=u.frozenTrailingWidth))):t===c-1?(s=i.getViewportLeftColumn(t+1),(g>=s||s===v)&&(f=u.viewportRect(n,t+1),r.width+=f.width)):t===c+1&&(h=i.getViewportRightColumn(t-1),(k<=h||h===p)&&(f=u.viewportRect(n,t-1),r.x=f.x,r.width+=f.width)),r},o.prototype._getTwoColumnDistance=function(n,t){for(var f=r(n,t),e=a(n,t),u=0,i=f;i<e;i++)u+=this._sheet.getColumnWidth(i,3);return u},o.prototype._getTwoRowDistance=function(n,t){for(var f=r(n,t),e=a(n,t),u=0,i=f;i<e;i++)u+=this._sheet.getRowHeight(i,3);return u},o.prototype._hitTest=function(t,r){var e=this,f,y,p,w,b,k,d,g,nt;if(!e._layout)return i;if(f={inMoving:!1,inTopNWSEResizing:!1,inTopNSResizing:!1,inTopNESWResizing:!1,inLeftWEResizing:!1,inRightWEResizing:!1,inBottomNESWResizing:!1,inBottomNSReszing:!1,inBottomNWSEReszing:!1},!e._floatingObject.isSelected())return f.inMoving=!0,f;var u=h(o._resizeIndicatorSize/2+1),l=10,s=e._layout.x,c=e._layout.y,a=e._layout.width,v=e._layout.height;return(e._floatingObject&&e._floatingObject.isSelected()&&(s-=u,c-=u,a+=2*u,v+=2*u),y=e._inflateRect(new n.Rect(s,c,u,u),l),y.contains(t,r))?(f.inTopNWSEResizing=!0,f):(p=e._inflateRect(new n.Rect(s+a/2-u,c,2*u,u),l),p.contains(t,r))?(f.inTopNSResizing=!0,f):(w=e._inflateRect(new n.Rect(s+a-u,c,u,u),l),w.contains(t,r))?(f.inTopNESWResizing=!0,f):(b=e._inflateRect(new n.Rect(s,c+v/2-u,u,2*u),l),b.contains(t,r))?(f.inLeftWEResizing=!0,f):(k=e._inflateRect(new n.Rect(s+a-u,c+v/2-u,u,2*u),l),k.contains(t,r))?(f.inRightWEResizing=!0,f):(d=e._inflateRect(new n.Rect(s,c+v-u,u,u),l),d.contains(t,r))?(f.inBottomNESWResizing=!0,f):(g=e._inflateRect(new n.Rect(s+a/2-u,c+v-u,2*u,u),l),g.contains(t,r))?(f.inBottomNSReszing=!0,f):(nt=e._inflateRect(new n.Rect(s+a-u,c+v-u,u,u),l),nt.contains(t,r))?(f.inBottomNWSEReszing=!0,f):(f.inMoving=!0,f)},o.prototype._inflateRect=function(t,i){var f=t.x-i,e=t.y-i,r=t.width+2*i,u=t.height+2*i;return new n.Rect(f,e,r>=0?r:0,u>=0?u:0)},o._resizeIndicatorSize=7,o}();n._FloatingObjectRender=l;kt=function(){function t(n){this._sheet=n;this._containerArray=new k}return t.prototype.getFloatingObjectRenderCount=function(){return this._containerArray.length},t.prototype._dispose=function(){for(var t=this._containerArray.length,n=0;n<t;n++)this._containerArray[n]._dispose();this._containerArray.length=0},t.prototype._render=function(t,r,u){var g,ft,st,nt,ht,c,vt;if(!(t<0)&&!(r<0)){for(var o=this,w=o._sheet,rt=o._createViewportFloatingObjectLayoutModel(t,r,u),ut=[],f=0,d=o._containerArray.length;f<d;f++)rt.find(o._containerArray[f].name)||ut.push(o._containerArray[f]);for(f=0,d=ut.length;f<d;f++)g=ut[f],g._renderManager=i,o._containerArray.remove(g.name),g._dispose();if(ft=rt.length,!(ft<=0))for(st=w.parent&&w.parent.useTouchLayout(),l._resizeIndicatorSize=st?11:7,f=0;f<ft;f++){var s=rt[f],b=w._findFloatingObjectInternal(s.name),e=h(l._resizeIndicatorSize/2+1);b&&typeof b.borderWidth=="function"&&(nt=b.borderWidth(),ht=b.borderStyle(),b._isBorderStyleWork(ht)||(nt=0),nt>e&&(e=nt));var p=o._getViewportRect(t,r),k=1,ct=s.x-e-k,lt=s.y-e-k,yt=s.width+2*e+2*k,pt=s.height+2*e+2*k,et=a(p.y,lt),ot=a(p.x,ct),tt=pt,it=yt,v=e,y=e,at=-1*e-k;v=lt-et+v;y=ct-ot+y;v<=0?(tt+=v,tt+=at):v<e&&v>0&&(tt-=e-v);y<=0?(it+=y,it+=at):y<e&&y>0&&(it-=e-y);c=o._containerArray.find(s.name);c||(c=new l(w._findFloatingObjectInternal(s.name),w),c._renderManager=o,o._containerArray.push(c));c._layout=s;c._rowViewportIndex=t;c._columnViewportIndex=r;vt=new n.Rect(p.x,p.y,p.width,p.height);c.render(new n.Rect(ot,et,it,tt).getIntersectRect(vt)||new n.Rect(ot,et,0,0),new n.Rect(y,v,s.width,s.height))}}},t.prototype.setFloatingObjectZIndex=function(n,t){var i=this._containerArray.find(n);i&&i.setFloatingObjectZIndex(t)},t.prototype.getFloatingObjectZIndex=function(n){var t=this._containerArray.find(n);return t?t.getFloatingObjectZIndex():-1},t.prototype.reduceZIndex=function(){for(var t,i,r=this._containerArray,n=0,u=r.length;n<u;n++)t=r[n],i=t.getFloatingObjectZIndex(),i!==-1&&t.setFloatingObjectZIndex(i-1)},t.prototype._getViewportRect=function(t,i){var f=this._sheet,u=f._getViewportColumnLayout(i),e=0,o=0,c=0,l=0,a,s,r,v,h,y,p;return u&&u.length>0&&(a=u[0],s=u[u.length-1],e=a.x,c=s.x+s.width-e),r=f._getViewportRowLayout(t),r&&r.length>0&&(v=r[0],h=r[r.length-1],o=v.y,l=h.y+h.height-o),y=f._getSheetLayout(),p=y.viewportRect(t,i),p.getIntersect(e,o,c,l)||new n.Rect(0,0,0,0)},t.prototype._createViewportFloatingObjectLayoutModel=function(n,t,i){var lt=this,o=lt._sheet,v=new k,e=o._floatingObjectArray,at=e.length,p,r,u,f,ut,l,ft,w,b,a,et,d,g,st,ct;if(e.length===0)return v;e.isNeedToUpdateLayout&&(e._updateFloatingsObjectlayoutOnColumnRowChanged(),e.isNeedToUpdateLayout=!1);var ot=o._getSheetLayout(),y=o._cachePool,s=o._getViewportColumnLayout(t),c=o._getViewportRowLayout(n);if(s.length<=0||c.length<=0)return v;var nt=s[0],tt=s[s.length-1],it=c[0],rt=c[c.length-1];for(p=0;p<at;p++)if(r=e[p],r.isVisible()){if(r.fixedPosition())ut=r.position(),u=ut.x*i+ot.frozenX,f=ut.y*i+ot.frozenY;else{if(u=0,l=r.startColumn(),ft=s.findCol(l),ft)u=ft.x;else if(l<nt.col)for(u=nt.x,w=nt.col-1;w>=l;w--)u-=y.getZoomColWidth(w);else for(u=tt.x+tt.width,b=tt.col+1;b<=l;b++)u+=y.getZoomColWidth(b);if(u+=r.startColumnOffset()*i,f=0,a=r.startRow(),et=c.findRow(a),et)f=et.y;else if(a<it.row)for(f=it.y,d=it.row-1;d>=a;d--)f-=y.getZoomRowHeight(d);else for(f=rt.y+rt.height,g=rt.row+1;g<=a;g++)f+=y.getZoomRowHeight(g);f+=r.startRowOffset()*i}st=h(r.width()*i);ct=h(r.height()*i);v.push(new ht(r.name(),u,f,st,ct))}return v},t}();n._FloatingObjectRenderManager=kt;ht=function(){function n(n,t,i,r,u){var f=this;f.name=n;f.x=t;f.y=i;f.height=u;f.width=r}return n}();n._FloatingObjectLayout=ht;k=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.remove=function(n){for(var t=0;t<this.length;t++)if(this[t].name===n){this.splice(t,1);return}},t.prototype.find=function(n){for(var t=0;t<this.length;t++)if(this[t].name===n)return this[t];return i},t.prototype.findByPropertyName=function(n){for(var t=0;t<this.length;t++)if(this[t]._name===n)return this[t];return i},t}(n._XArray);n.NamedObjectArray=k})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(n){var e,d,pt,y,g,wt,s,nt,bt,p,kt,dt,gt,tt,ni,it,li,rt,ti,ai,ut,ii,vi,yi,ft,w,ri,ui,fi,et,ei,ot,oi,k,st,si,ht,hi;n.feature("sparklineEx",["core.theme"]);var t=null,h=undefined,o=n.Calc.Convert,l=Math.floor,c=Math.PI,ct=Math.sin,lt=Math.cos,b=Math.min,a=Math.max,r=Math.round,at=Math.pow,f=Math.sqrt,ci=Math.random,u=Math.abs,vt=Math.ceil,i="undefined",v="string",yt=function(){function n(n,t){this.name=n;this.value=t}return n}();n.SparklineExValue=yt;e=function(){function r(){var r=this.createFunction(),i,u;r&&(i=r.name,u=r.evaluate,r.evaluate=function(n){var r=u.call(this,n);return r?new yt(i,r):t},this._name=i,i&&!n.Calc.Functions.findGlobalFunction(i)&&(n.Calc.Functions._customFunctions[i]=r));this.typeName=""}return r.prototype.name=function(){return this._name},r.prototype.createFunction=function(){return t},r.prototype.getAllValuesFromReference=function(n){var u=[],f,t,e,s,i,r;if(o.ref(n))for(f=n.getRangeCount(),t=0;t<f;t++)for(e=n.getRowCount(t),s=n.getColumnCount(t),i=0;i<e;i++)for(r=0;r<s;r++)u.push(n.getValue(t,i,r));return u},r.prototype.getRangeValuesFromReference=function(n,t){var u=[],f,e,s,i,r;if(o.ref(n)&&(f=n.getRangeCount(),f>t))for(e=n.getRowCount(t),s=n.getColumnCount(t),i=0;i<e;i++)for(u[i]=[],r=0;r<s;r++)u[i].push(n.getValue(t,i,r));return u},r.prototype.getFirstValueFromReference=function(n){var r;return o.ref(n)?r=n.getValue(0,0,0):n!==t&&typeof n!==i&&(r=n),r},r.prototype._paintSparkline=function(n,t,i,r,u,f,e){this.paint(n,t,i,r,u,f)},r.prototype.paint=function(n,t,i,r,u,f){},r.prototype.toJSON=function(){var t={};for(var n in this)this.hasOwnProperty(n)&&(t[n]=this[n]);return t},r.prototype.fromJSON=function(n){if(n)for(var t in n)n[t]!==h&&(this[t]=n[t])},r}();n.SparklineEx=e;d=function(){function n(n,t){this.values=n;this.colors=t}return n}();n.PieSparklineValue=d;pt=function(r){function u(){r.call(this)}return __extends(u,r),u.prototype._getValues=function(n){var r=this.getAllValuesFromReference(n);return r.length<=0&&n!==t&&typeof n!==i&&r.push(n),r},u.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var i=new n.Calc.Functions.Function("PIESPARKLINE",1,255),r=this;return i.evaluate=function(n){var t=r._getValues(n[0]),i=Array.prototype.slice.call(n,1);return new d(t,i)},i.acceptsReference=function(n){return n===0},i},u.prototype._fixValues=function(n){for(var u=[],r,f=0,e=0,o=n.length;f<o;f++)r=n[f],r!==t&&typeof r!==i&&!isNaN(r)&&isFinite(r)?(r<0&&(r=-r),u[e++]=r):u[e++]=0;return n.length===1&&u.length===1&&(u[1]=1-u[0]),u},u.prototype._fixColors=function(t,i){var f=[],u=i.length,a,e,o,s,h,c,r;if(t<=u)f=i.slice(0,t);else{for(u===0?(f.push("darkgray"),u=1):f=i.slice(0),a=[],c=t-u+1,r=0;r<u;r++)a[r]=n._Color.parse(f[r]);for(r=u;r<t;r++)e=a[r%u],o=e.r,s=e.g,h=e.b,o-=o/c*(r/u),s-=s/c*(r/u),h-=h/c*(r/u),f[r]=new n._Color(255,l(o),l(s),l(h)).toString()}return f},u.prototype.paint=function(n,t,i,r,u,f){var s=i+u/2,h=r+f/2,nt=5,l=b(u,f)/2-nt,o=-.5*c,v,y=s+l*lt(o),p=h+l*ct(o),k=[],d=[],e;if(!(l<=0)){var w=this._fixValues(t.values),a=w.length,tt=this._fixColors(a,t.colors),g=0;for(e=0;e<a;e++)g+=w[e];for(n.save(),e=0;e<a;e++)v=o+w[e]/g*2*c,n.beginPath(),n.moveTo(s,h),n.lineTo(y,p),n.arc(s,h,l,o,v,!1),n.lineTo(s,h),n.fillStyle=tt[e],n.fill(),k.push(y),d.push(p),o=v,y=s+l*lt(o),p=h+l*ct(o);for(n.strokeStyle="white",e=0;e<a;e++)n.beginPath(),n.moveTo(s,h),n.lineTo(k[e],d[e]),n.stroke();n.restore()}},u}(e);n.PieSparkline=pt;y=function(){function n(n,t,i){this.x=n;this.y=t;this.value=i}return n}();g=function(){function n(n,t,i,r,u,f,e){var o=this;o.points=n;o.mini=t;o.maxi=i;o.line1=r;o.line2=u;o.colorPositive=f;o.colorNegative=e}return n}();n.AreaSparklineValue=g;wt=function(u){function f(){u.call(this)}return __extends(f,u),f.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var i=new n.Calc.Functions.Function("AREASPARKLINE",1,7),r=this;return i.evaluate=function(n){var t=r.getAllValuesFromReference(n[0]),i=n[1],u=n[2],f=n[3],e=n[4],o=n[5],s=n[6];return new g(t,i,u,f,e,o,s)},i.acceptsReference=function(n){return n===0},i},f.prototype._fixValues=function(n){for(var f=[],r,u=0,e=0,o=n.length;u<o;u++)r=n[u],f[e++]=r!==t&&typeof r!==i&&!isNaN(r)&&isFinite(r)?r:0;return f},f.prototype._rangeMin=function(n){for(var t=n[0],i,r=1,u=n.length;r<u;r++)i=n[r],t>i&&(t=i);return t},f.prototype._rangeMax=function(n){for(var t=n[0],i,r=1,u=n.length;r<u;r++)i=n[r],t<i&&(t=i);return t},f.prototype._getXInStraightLine=function(n,t,i,r,u){return((t-u)*i+(u-r)*n)/(t-r)},f.prototype.paint=function(n,u,f,e,o,s){var v,bt,d,g,ei,ft,et,ri,p,rt,ui;n.save();var ot=this,w=u.points,st=u.mini,ht=u.maxi,kt=u.line1,dt=u.line2,ct=u.colorPositive,lt=u.colorNegative,at=5,gt,ni,ti,ii,l,h,nt,tt,c,vt,it,ut,yt,pt,fi,k,wt;for(w=ot._fixValues(w),(ct===t||typeof ct===i)&&(ct="#787878"),(lt===t||typeof lt==i)&&(lt="#CB0000"),ti=ot._rangeMin(w),(st===t||typeof st===i)&&(st=ti),l=b(st,ti),ii=ot._rangeMax(w),(ht===t||typeof ht===i)&&(ht=ii),h=a(ht,ii),c=0,l>0&&(l=0),h<0&&(h=0),c>h&&(c=h),c<l&&(c=l-1),vt=w.length,it=f+at,ut=e+at,yt=o-2*at,pt=s-2*at,fi=yt/(vt-1),k=(h-l)/pt,v=[],ft=ut+(h-c)/k,p=0;p<vt;p++)bt=w[p],et=it+fi*p,ri=ut+(h-bt)/k,p===0&&v.push(new y(et,ft,c)),p>0&&bt*w[p-1]<0&&(g=v[v.length-1],g&&(ei=ot._getXInStraightLine(g.x,g.y,et,ri,ft),v.push(new y(ei,ft,c)))),v.push(new y(et,ri,bt)),p===vt-1&&v.push(new y(et,ft,c));for(n.beginPath(),rt=0,ui=v.length;rt<ui;rt++)d=v[rt],d&&(n.lineTo(d.x,d.y),g=v[rt-1],d.value===c&&g&&(n.fillStyle=g.value>c?ct:lt,n.fill(),rt!==ui-1&&(n.beginPath(),n.lineTo(d.x,d.y))));(kt!==t||typeof kt===i)&&(nt=kt,nt>h&&(nt=h),nt<l&&(nt=l),wt=k!==0?(h-nt)/k:pt/2,gt=r(ut+wt)-.5,n.beginPath(),n.moveTo(it,gt),n.lineTo(it+yt,gt),n.strokeStyle="blue",n.stroke());(dt!==t||typeof dt===i)&&(tt=dt,tt>h&&(tt=h),tt<l&&(tt=l),wt=k!==0?(h-tt)/k:pt/2,ni=r(ut+wt)-.5,n.beginPath(),n.moveTo(it,ni),n.lineTo(it+yt,ni),n.strokeStyle="blue",n.stroke());n.restore()},f}(e);n.AreaSparkline=wt;s=function(){function n(n,t){this.x=n;this.y=t}return n}();nt=function(){function n(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b){var k=this;k.points1=n;k.points2=t;k.minX=i;k.maxX=r;k.minY=u;k.maxY=f;k.hLine=e;k.vLine=o;k.xMinZone=s;k.xMaxZone=h;k.yMinZone=c;k.yMaxZone=l;k.tags=a;k.drawSymbol=v;k.drawLines=y;k.color1=p;k.color2=w;k.dash=b}return n}();n.ScatterSparklineValue=nt;bt=function(u){function e(){u.call(this)}return __extends(e,u),e.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var i=new n.Calc.Functions.Function("SCATTERSPARKLINE",1,18),r=this;return i.evaluate=function(n){var t=r.getRangeValuesFromReference(n[0],0),i=r.getRangeValuesFromReference(n[1],0),u=n[2],f=n[3],e=n[4],o=n[5],s=n[6],h=n[7],c=n[8],l=n[9],a=n[10],v=n[11],y=n[12],p=n[13],w=n[14],b=n[15],k=n[16],d=n[17];return new nt(t,i,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d)},i.acceptsReference=function(n){return n===0||n===1},i},e.prototype._getScatterPoints=function(n){var f=[],t,u,i,r;if(t=n.length,t>0)if(u=n[0].length,t<u){if(t>=2)for(i=0;i<u;i++)f.push(new s(n[0][i],n[1][i]))}else if(u>=2)for(r=0;r<t;r++)f.push(new s(n[r][0],n[r][1]));return f},e.prototype._getMinScatterPoint=function(n){for(var t=new s(Number.MAX_VALUE,Number.MAX_VALUE),u=n.length,i,r=0;r<u;r++)i=n[r],t.x>i.x&&(t.x=i.x),t.y>i.y&&(t.y=i.y);return t},e.prototype._getMaxScatterPoint=function(n){for(var t=new s(-Number.MAX_VALUE,-Number.MAX_VALUE),u=n.length,i,r=0;r<u;r++)i=n[r],t.x<i.x&&(t.x=i.x),t.y<i.y&&(t.y=i.y);return t},e.prototype._getXInStraightLine=function(n,t,i,r){return i/r*(t-n)+n},e.prototype._paintLine=function(n,t,i,r,u,e,o){var w,k,d,b,tt;if(o){var g=this,a=f(at(r-t,2)+at(u-i,2)),c=0,it=6,rt=2,nt=4,v=[],y,p,h,l;for(t<=r?(y=t,p=r,h=t,l=i):(y=r,p=t,h=r,l=u),w=(u-i)/(r-t),k=i-w*t,v.push(new s(h,l));c<a;)c+=it,c<=a&&(h=g._getXInStraightLine(y,p,c,a),l=w*h+k,v.push(new s(h,l))),c+=nt,c<=a&&(h=g._getXInStraightLine(y,p,c,a),l=w*h+k,v.push(new s(h,l))),c+=rt,c<=a&&(h=g._getXInStraightLine(y,p,c,a),l=w*h+k,v.push(new s(h,l))),c+=nt,c<=a&&(h=g._getXInStraightLine(y,p,c,a),l=w*h+k,v.push(new s(h,l)));for(n.strokeStyle=e,d=0,tt=v.length;d<tt-1;d+=2)n.beginPath(),b=v[d],n.moveTo(b.x,b.y),b=v[d+1],n.lineTo(b.x,b.y),n.stroke()}else n.beginPath(),n.moveTo(t,i),n.lineTo(r,u),n.strokeStyle=e,n.stroke()},e.prototype.paint=function(n,u,f,e,o,s){var w=this,pi=u.points1,yt=u.points2,pt=u.minX,wt=u.maxX,bt=u.minY,kt=u.maxY,dt=u.hLine,gt=u.vLine,ni=u.xMinZone,ti=u.xMaxZone,ii=u.yMinZone,ri=u.yMaxZone,ki=u.tags,ui=u.drawSymbol,di=u.drawLines,ht=u.color1,ct=u.color2,gi=u.dash,v=4,fi=5,rt=f+fi,ut=e+fi,ft=o-2*fi,et=s-2*fi,tt,it,y,h,l,p,k,d,ei,oi,si,hi,ci,ot,g,st,nt,li,lt,ai,at,vt;if(pi&&!(pi.length<=0)&&(tt=w._getScatterPoints(pi),!(tt.length<=0))&&(!yt||!(yt.length>0)||(it=w._getScatterPoints(yt),!(it.length<=0)))){if(n.save(),n.rect(f,e,o,s),n.clip(),n.beginPath(),(ui===t||typeof ui===i)&&(ui=!0),(ht===t||typeof ht===i)&&(ht="#969696"),(ct===t||typeof ct===i)&&(ct="#CB0000"),y=bt!==t&&typeof bt!==i?bt:w._getMinScatterPoint(tt).y,h=kt!==t&&typeof kt!==i?kt:w._getMaxScatterPoint(tt).y,l=pt!==t&&typeof pt!==i?pt:w._getMinScatterPoint(tt).x,p=wt!==t&&typeof wt!==i?wt:w._getMaxScatterPoint(tt).x,l>=p&&(p=l+1),y>=h&&(h=y+1),ni!==t&&typeof ni!==i&&ti!==t&&typeof ti!==i&&ii!==t&&typeof ii!==i&&ri!==t&&typeof ri!==i&&l<=ni&&ni<=p&&l<=ti&&ti<=p&&y<=ii&&ii<=h&&y<=ri&&ri<=h){var vi=a(l,ni),wi=b(p,ti),bi=a(y,ii),yi=b(h,ri);vi>=wi&&(wi=vi+1);bi>=yi&&(yi=bi+1);n.beginPath();n.fillStyle="#DCDCDC";n.fillRect(rt+(vi-l)*ft/(p-l),ut+(h-yi)*et/(h-y),(wi-vi)*ft/(p-l),(yi-bi)*et/(h-y))}for(li=-Number.MAX_VALUE,lt=-Number.MAX_VALUE,ai=Number.MAX_VALUE,at=Number.MAX_VALUE,k=0,ei=tt.length;k<ei-1;k++)d=tt[k],oi=d.x,si=d.y,d=tt[k+1],hi=d.x,ci=d.y,ot=rt+(oi-l)*ft/(p-l),st=rt+(hi-l)*ft/(p-l),g=ut+(h-si)*et/(h-y),nt=ut+(h-ci)*et/(h-y),di&&w._paintLine(n,ot,g,st,nt,ht,gi),ui&&(k===0&&(n.beginPath(),n.strokeStyle=ht,n.arc(ot-v/2,g-v/2,v/2,0,c*2,!1),n.stroke()),n.beginPath(),n.strokeStyle=ht,n.arc(st-v/2,nt-v/2,v/2,0,c*2,!1),n.stroke()),ki&&(k===0&&(g>lt&&(li=ot,lt=g),g<at&&(ai=ot,at=g)),nt>lt&&(li=st,lt=nt),nt<at&&(ai=st,at=nt));if(yt&&yt.length>0)for((bt===t||typeof bt===i)&&(y=w._getMinScatterPoint(it).y),(kt===t||typeof kt===i)&&(h=w._getMaxScatterPoint(it).y),(pt===t||typeof pt===i)&&(l=w._getMinScatterPoint(it).x),(wt===t||typeof wt===i)&&(p=w._getMaxScatterPoint(it).x),l>=p&&(p=l+1),y>=h&&(h=y+1),k=0,ei=it.length;k<ei-1;k++)d=it[k],oi=d.x,si=d.y,d=it[k+1],hi=d.x,ci=d.y,ot=rt+(oi-l)*ft/(p-l),st=rt+(hi-l)*ft/(p-l),g=ut+(h-si)*et/(h-y),nt=ut+(h-ci)*et/(h-y),di&&w._paintLine(n,ot,g,st,nt,ct,gi),ui&&(k===0&&(n.beginPath(),n.strokeStyle=ct,n.strokeRect(ot-v/2,g-v/2,v,v)),n.beginPath(),n.strokeStyle=ct,n.strokeRect(st-v/2,nt-v/2,v,v));ki&&(n.beginPath(),n.arc(li-v/2,lt-v/2,v/2,0,c*2,!1),n.fillStyle="#CB0000",n.fill(),n.beginPath(),n.arc(ai-v/2,at-v/2,v/2,0,c*2,!1),n.fillStyle="#0000FF",n.fill());dt!==t&&typeof dt!==i&&y<=dt&&dt<=h&&(vt=r(ut+(h-dt)*et/(h-y))-.5,w._paintLine(n,rt,vt,rt+ft,vt,"#CB0000"));gt!==t&&typeof gt!==i&&l<=gt&><=p&&(vt=r(rt+(gt-l)*ft/(p-l))-.5,w._paintLine(n,vt,ut,vt,ut+et,"#CB0000"));n.restore()}},e}(e);n.ScatterSparkline=bt;p=function(r){function u(){r.call(this)}return __extends(u,r),u.prototype._parseSetting=function(n){var u={},c=!1,l=!0,e="",s="",h,a,r,o,f;if(n){for(n=n.substr(1,n.length-2),h=0,a=n.length;h<a;h++)r=n.charAt(h),r===":"?l=!1:r!==","||c?r==="'"||r==='"'||(r==="("?c=!0:r===")"&&(c=!1),l?e+=r:s+=r):(u[e]=s,e="",s="",l=!0);e&&(u[e]=s);for(o in u)f=u[o],f!==t&&typeof f!==i&&(f.toUpperCase()==="TRUE"?u[o]=!0:f.toUpperCase()==="FALSE"?u[o]=!1:!isNaN(f)&&isFinite(f)&&(u[o]=parseFloat(f)))}return u},u.prototype._createCustomFunction=function(r,u){var f=new n.Calc.Functions.Function(r,2,5),e=this;return f.evaluate=function(r){var h=r[0],y,f,b,v,a,k,d,s,l;if(o.ref(h)&&(y=h.getRangeCount(),y>0)){var g=new n.Range(h.getRow(0),h.getColumn(0),h.getRowCount(0),h.getColumnCount(0)),nt=r[1],c=r[2],w,p;if(o.ref(c)&&(y=c.getRangeCount(),y>0&&(w=new n.Range(c.getRow(0),c.getColumn(0),c.getRowCount(0),c.getColumnCount(0)),p=r[3])),f=new n.SparklineSetting,b=r[4],b){v=e._parseSetting(b);k={AXISCOLOR:"_axisColor",FIRSTMARKERCOLOR:"_firstMarkerColor",HIGHMARKERCOLOR:"_highMarkerColor",LASTMARKERCOLOR:"_lastMarkerColor",LOWMARKERCOLOR:"_lowMarkerColor",MARKERSCOLOR:"_markersColor",NEGATIVECOLOR:"_negativeColor",SERIESCOLOR:"_seriesColor",DISPLAYEMPTYCELLSAS:"displayEmptyCellsAs",RIGHTTOLEFT:"rightToLeft",DISPLAYHIDDEN:"displayHidden",DISPLAYXAXIS:"displayXAxis",SHOWFIRST:"_showFirst",SHOWHIGH:"_showHigh",SHOWLAST:"_showLast",SHOWLOW:"_showLow",SHOWNEGATIVE:"_showNegative",SHOWMARKERS:"_showMarkers",MANUALMAX:"manualMax",MANUALMIN:"manualMin",MAXAXISTYPE:"maxAxisType",MINAXISTYPE:"minAxisType",LINEWEIGHT:"lineWeight"};for(s in v)s&&(a=k[s.toUpperCase()],a&&(f[a]=v[s]));d={AC:"_axisColor",FMC:"_firstMarkerColor",HMC:"_highMarkerColor",LASTMC:"_lastMarkerColor",LOWMC:"_lowMarkerColor",MC:"_markersColor",NC:"_negativeColor",SC:"_seriesColor",DECA:"displayEmptyCellsAs",RTL:"rightToLeft",DH:"displayHidden",DXA:"displayXAxis",SF:"_showFirst",SH:"_showHigh",SLAST:"_showLast",SLOW:"_showLow",SN:"_showNegative",SM:"_showMarkers",MMAX:"manualMax",MMIN:"manualMin",MAXAT:"maxAxisType",MINAT:"minAxisType",LW:"lineWeight"};for(s in v)s&&(a=d[s.toUpperCase()],a&&(f[a]=v[s]));f.maxAxisType===1&&(f.maxAxisType=0);f.minAxisType===1&&(f.minAxisType=0);f.rightToLeft=!!f.rightToLeft;f.displayHidden=!!f.displayHidden;f.displayXAxis=!!f.displayXAxis;f._showFirst=!!f._showFirst;f._showHigh=!!f._showHigh;f._showLast=!!f._showLast;f._showLow=!!f._showLow;f._showNegative=!!f._showNegative;f._showMarkers=!!f._showMarkers}return l=new n.SparklineValue(-1,-1,g,nt,u,f),w&&typeof p!==i&&p!==t&&(l.dateAxisData(w),l.dateAxisOrientation(p),l.group().displayDateAxis=!0),l.cachedValues=e.getRangeValuesFromReference(h,0),l.cachedDatetimes=e.getRangeValuesFromReference(c,0),l}},f.acceptsReference=function(n){return n===0||n===2},f},u.prototype._fixValues=function(r,u,f,e,o,s){var a=[],l=o===1,c,v;if(e)for(c=0,v=l?e.colCount:e.rowCount;c<v;c++){var y=l?0:c,p=l?c:0,h=r[y][p];!f&&(u.getRowHeight(e.row+y)<=0||u.getColumnWidth(e.col+p)<=0)?h=NaN:h!==t&&typeof h!==i&&(s?h=typeof h=="number"?n._DateTimeHelper.fromOADate(h):Date.parse(h):typeof h!="number"&&(h=n.__invalidValuePlaceHolder));a.push(h)}return a},u.prototype._paintSparkline=function(t,i,r,u,f,e,o){if(n.features.sparkline){var s=i,h=s.cachedValues,c=s.cachedDatetimes,v=o._zoomFactor,y=new n.SparklineRender(s),l=s.setting(),a=l.displayHidden;h=this._fixValues(h,o,a,s.data(),s.dataOrientation());c=this._fixValues(c,o,a,s.dateAxisData(),s.dateAxisOrientation(),!0);l._setThemeContext(o);y._paintCore(t,r,u,f,e,h,c,v)}},u}(e);n.CompatibleSparkline=p;kt=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),r.prototype.createFunction=function(){return!n.util.hasCalc()||!n.features.sparkline?t:i.prototype._createCustomFunction.call(this,"LINESPARKLINE",0)},r}(p);n.LineSparkline=kt;dt=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),r.prototype.createFunction=function(){return!n.util.hasCalc()||!n.features.sparkline?t:i.prototype._createCustomFunction.call(this,"COLUMNSPARKLINE",1)},r}(p);n.ColumnSparkline=dt;gt=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),r.prototype.createFunction=function(){return!n.util.hasCalc()||!n.features.sparkline?t:i.prototype._createCustomFunction.call(this,"WINLOSSSPARKLINE",2)},r}(p);n.WinlossSparkline=gt;tt=function(){function n(n,t,i,r,u,f,e,o,s){var h=this;h.measure=n;h.target=t;h.maxi=i;h.good=r;h.bad=u;h.forecast=f;h.tickUnit=e;h.colorScheme=o;h.vertical=s}return n}();n.BulletSparklineValue=tt;ni=function(u){function f(){u.call(this)}return __extends(f,u),f.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var r=new n.Calc.Functions.Function("BULLETSPARKLINE",3,9),i=this;return r.evaluate=function(n){var t=i.getFirstValueFromReference(n[0]),r=i.getFirstValueFromReference(n[1]),u=i.getFirstValueFromReference(n[2]),f=i.getFirstValueFromReference(n[3]),e=i.getFirstValueFromReference(n[4]),o=i.getFirstValueFromReference(n[5]),s=i.getFirstValueFromReference(n[6]),h=n[7],c=n[8];return new tt(t,r,u,f,e,o,s,h,c)},r.acceptsReference=function(n){return 0<=n&&n<=6},r},f.prototype._lightenColor=function(t,i){var r=n._Color.parse(t),u=new n.HLSColor(r),f=u.getLighterColor(i);return f.toString()},f.prototype.paint=function(n,u,f,e,o,s){var vt=this,p=u.measure,v=u.target,h=u.maxi,w=u.good,b=u.bad,k=u.forecast,d=u.tickUnit,nt=u.colorScheme,y=u.vertical,ht=5,g,a,c,ct,tt,lt,it,at,rt,et,ot,ut,yt,ft,st;if(h!==t&&typeof h!==i&&!(h<0)){if((p===t||typeof p===i||p<0)&&(p=0),(w===t||typeof w===i||w<0)&&(w=0),(b===t||typeof b===i||b<0)&&(b=0),(v===t||typeof v===i)&&(v=0),(k===t||typeof k===i)&&(k=0),(d===t||typeof d===i)&&(d=0),(nt===t||typeof nt===i)&&(nt="#A0A0A0"),g="#252525",p>h&&(p=h,g="#CB0000"),w>h&&(w=h,g="#CB0000"),b>h&&(b=h,g="#CB0000"),v>h&&(v=0,g="#CB0000"),k>h&&(k=h,g="#CB0000"),y?(a=e+s-ht,c=s-2*ht):(a=f+ht,c=o-2*ht),n.save(),n.fillStyle=vt._lightenColor(nt,1.66),y?n.fillRect(f+o*.2,a-c,o*.6,c):n.fillRect(a,e+s*.2,c,s*.6),ct=a,tt=c*(w/h),tt>c&&(tt=c),n.fillStyle=vt._lightenColor(nt,1.33),y?n.fillRect(f+o*.2,ct-tt,o*.6,tt):n.fillRect(ct,e+s*.2,tt,s*.6),lt=a,it=c*(b/h),it>c&&(it=c),n.fillStyle=nt,y?n.fillRect(f+o*.2,lt-it,o*.6,it):n.fillRect(lt,e+s*.2,it,s*.6),at=a,rt=c*(p/h),rt>c&&(rt=c),n.fillStyle=g,y?n.fillRect(f+o*.375,at-rt,o*.25,rt):n.fillRect(at,e+s*.375,rt,s*.25),k>0&&(et=a,ot=c*(k/h),ot>c&&(ot=c),n.strokeStyle="#3690BF",n.lineWidth=3,n.beginPath(),y?(n.moveTo(f+o*.5,et),n.lineTo(f+o*.5,et-ot)):(n.moveTo(et,e+s*.5),n.lineTo(et+ot,e+s*.5)),n.stroke()),v>0&&(n.strokeStyle="#CB0000",n.lineWidth=1,n.beginPath(),y?(ut=r(a-c*(v/h))-.5,n.moveTo(f+o*.2,ut),n.lineTo(f+o*.8,ut)):(ut=r(a+c*(v/h))-.5,n.moveTo(ut,e+s*.2),n.lineTo(ut,e+s*.8)),n.stroke()),d>0)for(yt=l(h/d),n.strokeStyle="#646464",n.lineWidth=1,st=0;st<=yt;st++)n.beginPath(),y?(ft=r(a-c/h*d*st)-.5,n.moveTo(f,ft),n.lineTo(f+o*.05,ft)):(ft=r(a+c/h*d*st)-.5,n.moveTo(ft,e+s),n.lineTo(ft,e+s*.95)),n.stroke();n.restore()}},f}(e);n.BulletSparkline=ni;it=function(){function n(n,t){this.key=n;this.value=t}return n}();n.SpreadSparklineData=it,function(n){n[n.Stacked=1]="Stacked";n[n.Spread=2]="Spread";n[n.Jitter=3]="Jitter";n[n.Poles=4]="Poles";n[n.StackedDots=5]="StackedDots";n[n.Stripe=6]="Stripe"}(n.SpreadSparklineStyle||(n.SpreadSparklineStyle={}));li=n.SpreadSparklineStyle;rt=function(){function n(n,t,i,r,u,f,e){var o=this;o.spreadData=n;o.showAverage=t;o.scaleStart=i;o.scaleEnd=r;o.style=u;o.colorScheme=f;o.vertical=e}return n}();n.SpreadSparklineValue=rt;ti=function(u){function f(){u.call(this)}return __extends(f,u),f.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var r=new n.Calc.Functions.Function("SPREADSPARKLINE",1,7),u=this;return r.evaluate=function(n){var r=u.getAllValuesFromReference(n[0]),y=n[1],p=n[2],w=n[3],s=n[4],b=n[5],k=n[6],f=[],e,h,o;if(r!==t&&typeof r!==i&&(r=u._fixValues(r),f=u._toArray(r),s===3))for(e=0,h=f.length;e<h;e++){var c=f[e],l=c.value,v=[],d=a(100,l*10);for(o=0;o<d+l-1;o++)v.push(ci());c.randomNumbers=v}return new rt(f,y,p,w,s,b,k)},r.acceptsReference=function(n){return n===0},r},f.prototype._fixValues=function(n){for(var r=[],t,i=0,u=0,f=n.length;i<f;i++)t=parseFloat(n[i]),!isNaN(t)&&isFinite(t)&&(r[u++]=t);return r},f.prototype._getAverage=function(n){for(var t,u=0,i=0,r=0,f=n.length;r<f;r++)t=n[r],i+=t.value,u+=t.key*t.value;return i===0?0:u/i},f.prototype._getMaxValue=function(n){for(var t=-Number.MAX_VALUE,i,r=0,u=n.length;r<u;r++)i=n[r].value,i>t&&(t=i);return t},f.prototype._toArray=function(n){for(var u,f,t={},r=0,i,e=n.length;r<e;r++)i=n[r],t[i]?t[i]++:t[i]=1;u=[];for(f in t)u.push(new it(parseFloat(f),t[f]));return u.sort(function(n,t){return n.key-t.key})},f.prototype._isValid=function(n,t){for(var r,i=0,u=t.length;i<u;i++)if(r=t[i],r[0]<=n&&n<=r[1])return!1;return!0},f.prototype._getRandomOffsetArray=function(n,t,i,r){for(var f=[],s=a(100,n*10),e=0,o=[],h=0,u;f.length<n;)u=l(r[h++]*t),(e>s||this._isValid(u,o))&&(f.push(u),o.push([u-i,u+i])),e++;return f},f.prototype.paint=function(n,u,f,e,o,s){var ot=this,k=u.spreadData,kt=u.showAverage,y=u.scaleStart,d=u.scaleEnd,b=u.style,rt=u.colorScheme,g=u.vertical,a=5,at=k.length,vt,yt,v,p,c,l,h,nt,ut,et,pt,ht,ct,w,tt,bt,it,lt;if(!(at<=0)){for(vt=k[0].key,yt=k[at-1].key,(y===t||typeof y===i)&&(y=vt),(d===t||typeof d===i)&&(d=yt),(b===t||typeof b===i)&&(b=4),(rt===t||typeof rt===i)&&(rt="#646464"),g?(v=e+s-a,p=s-2*a,c=f+a,l=o-2*a):(v=f+a,p=o-2*a,c=e+a,l=s-2*a),n.save(),n.rect(f,e,o,s),n.clip(),n.beginPath(),n.strokeStyle=rt,n.fillStyle=rt,n.lineWidth=2,ut=ot._getMaxValue(k),et=0,pt=k.length;et<pt;et++){var st=k[et],wt=st.key,ft=st.value;if(g?(h=v-p*(wt-y)/(d-y),h>v&&(h=v),h<v-p&&(h=v-p)):(h=v+p*(wt-y)/(d-y),h<v&&(h=v),h>v+p&&(h=v+p)),h=r(h),b===1)w=ft/2*l/ut,w<.5&&(w=.5),ht=c+l/2-w,ct=c+l/2+w,n.beginPath(),g?(n.moveTo(ht,h),n.lineTo(ct,h)):(n.moveTo(h,ht),n.lineTo(h,ct)),n.stroke();else if(b===4)w=ft*l/ut,w<1&&(w=1),n.beginPath(),g?(n.moveTo(c,h),n.lineTo(c+w,h)):(n.moveTo(h,c+l),n.lineTo(h,c+l-w)),n.stroke();else if(b===6)n.beginPath(),g?(n.moveTo(c,h),n.lineTo(c+l,h)):(n.moveTo(h,c),n.lineTo(h,c+l)),n.stroke();else for(tt=2,b===3&&(bt=ot._getRandomOffsetArray(ft,l,tt+1,st.randomNumbers)),it=1;it<=ft;it++){switch(b){case 2:nt=c+l/2-a-(ft/2-it)*l/ut;break;case 3:nt=c+l-a-bt[it-1];break;case 5:default:nt=c+l-it*l/ut;break}nt=r(nt);n.beginPath();g?n.fillRect(nt,h,tt,tt):n.fillRect(h,nt,tt,tt)}}kt&&(lt=ot._getAverage(k),n.strokeStyle="#CB0000",n.beginPath(),g?(h=r(v-p*(lt-y)/(d-y)),n.moveTo(c-a,h),n.lineTo(c+l+a,h)):(h=r(v+p*(lt-y)/(d-y)),n.moveTo(h,c-a),n.lineTo(h,c+l+a)),n.stroke());n.restore()}},f}(e);n.SpreadSparkline=ti,function(n){n[n.Horizontal=0]="Horizontal";n[n.Vertical=1]="Vertical"}(n.TextOrientation||(n.TextOrientation={}));ai=n.TextOrientation;ut=function(){function n(n,t,i,r,u,f,e,o,s,h,c,l,a){var v=this;v.points=n;v.colorRange=t;v.labelRange=i;v.maximum=r;v.targetRed=u;v.targetGreen=f;v.targetBlue=e;v.targetYellow=o;v.color=s;v.highlightPosition=h;v.vertical=c;v.textOrientation=l;v.textSize=a}return n}();n.StackedSparklineValue=ut;ii=function(u){function f(){u.call(this)}return __extends(f,u),f.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var i=new n.Calc.Functions.Function("STACKEDSPARKLINE",1,13),r=this;return i.evaluate=function(n){var t=r.getAllValuesFromReference(n[0]),i=r.getAllValuesFromReference(n[1]),u=r.getAllValuesFromReference(n[2]),f=n[3],e=n[4],o=n[5],s=n[6],h=n[7],c=n[8],l=n[9],a=n[10],v=n[11],y=n[12];return new ut(t,i,u,f,e,o,s,h,c,l,a,v,y)},i.acceptsReference=function(n){return 0<=n&&n<=2},i},f.prototype._hasNullOrUndefined=function(n){for(var r,u=0,f=n.length;u<f;u++)if(r=n[u],r===t||typeof r===i)return!0;return!1},f.prototype._lightenColor=function(t,i){var r=n._Color.parse(t),u=new n.HLSColor(r),f=u.getLighterColor(i);return f.toString()},f.prototype._getDefaultColorRange=function(n,t){for(var r=[],i=0;i<t;i++)r.push(this._lightenColor(n,1+i/t));return r},f.prototype._sumPositive=function(n){for(var r=0,t,i=0,u=n.length;i<u;i++)t=n[i],t>0&&(r+=t);return r},f.prototype._getTextColor=function(t){var i=n._Color.parse(t);return i&&i.getBrightness()<255/2?"white":"black"},f.prototype._paintSparkline=function(n,u,f,e,o,s,h){var at=this,ht=u.points,rt=u.colorRange,dt=u.labelRange,l=u.maximum,nt=u.targetRed,w=u.targetGreen,b=u.targetBlue,k=u.targetYellow,vt=u.color,ni=u.highlightPosition,tt=u.vertical,yt=u.textOrientation,d=u.textSize,g=5,ct,wt,v,y,a,p,lt,ut,ft,et,ot,st,bt,it,gt,kt,pt,c;if(ht!==t&&typeof ht!==i&&(ct=ht.length,!(ct<=0))){for((vt===t||typeof vt===i)&&(vt="#646464"),(rt===t||typeof rt===i||rt.length!==ct||at._hasNullOrUndefined(rt))&&(rt=at._getDefaultColorRange(vt,ct)),wt=at._sumPositive(ht),(l===t||typeof l===i||l<wt)&&(l=wt),(yt===t||typeof yt===i)&&(yt=0),(d===t||typeof d===i||d<=0)&&(d=10),isNaN(d)||(d=d*h._zoomFactor),tt?(v=e+s-g,y=s-2*g,a=f+g,p=o-2*g):(v=f+g,y=o-2*g,a=e+g,p=s-2*g),n.save(),lt=v,it=0,gt=ct;it<gt;it++)(bt=ht[it],bt<=0)||(ut=bt/l*y,tt?(ft=f+o*.15,ot=o*.7,et=lt-ut,st=ut):(ft=lt,ot=ut,et=e+s*.15,st=s*.7),kt=it+1===ni?"#CB0000":rt[it],n.fillStyle=kt,n.beginPath(),n.fillRect(ft,et,ot,st),pt=dt&&dt[it],pt&&(n.save(),n.fillStyle=at._getTextColor(kt),n.textBaseline="middle",n.textAlign="center",n.font=d+"px Arial",n.rect(ft,et,ot,st),n.clip(),n.beginPath(),yt===1?(n.translate(ft+ot/2,et),n.rotate(Math.PI/2),n.fillText(pt,st/2,0)):n.fillText(pt,ft+ot/2,et+st/2),n.restore()),tt?lt-=ut:lt+=ut);nt!==t&&typeof nt!==i&&(nt>l&&(nt=l),nt>0&&(n.beginPath(),tt?(c=r(v-nt/l*y)-.5,n.moveTo(a,c),n.lineTo(a+p,c)):(c=r(v+nt/l*y)-.5,n.moveTo(c,a),n.lineTo(c,a+p)),n.strokeStyle="red",n.stroke()));w!==t&&typeof w!==i&&(w>l&&(w=l),w<0&&(w=0),n.beginPath(),tt?(c=r(v-w/l*y)-.5,n.moveTo(a,c),n.lineTo(a+p,c)):(c=r(v+w/l*y)-.5,n.moveTo(c,a),n.lineTo(c,a+p)),n.strokeStyle="green",n.stroke());b!==t&&typeof b!==i&&(b>l&&(b=l),b<0&&(b=0),n.beginPath(),tt?(c=r(v-b/l*y)-.5,n.moveTo(a,c),n.lineTo(a+p,c)):(c=r(v+b/l*y)-.5,n.moveTo(c,a),n.lineTo(c,a+p)),n.strokeStyle="blue",n.stroke());k!==t&&typeof k!==i&&(k>l&&(k=l),k<0&&(k=0),n.beginPath(),tt?(c=r(v-k/l*y)-.5,n.moveTo(a,c),n.lineTo(a+p,c)):(c=r(v+k/l*y)-.5,n.moveTo(c,a),n.lineTo(c,a+p)),n.strokeStyle="yellow",n.stroke());n.restore()}},f}(e);n.StackedSparkline=ii,function(n){n[n.Top=0]="Top";n[n.Right=1]="Right";n[n.Down=2]="Down";n[n.Left=3]="Left"}(n.ArrowDirection||(n.ArrowDirection={}));vi=n.ArrowDirection,function(n){n[n.Horizontal=0]="Horizontal";n[n.Vertical=1]="Vertical"}(n.BarSparklineType||(n.BarSparklineType={}));yi=n.BarSparklineType;ft=function(){function n(n,t,i){this.value=n;this.colorScheme=t;this.type=i}return n}();n.BarSparklineBaseValue=ft;w=function(e){function s(){e.call(this)}return __extends(s,e),s.prototype.createCustomFunction=function(i,r){if(!n.util.hasCalc())return t;var u=new n.Calc.Functions.Function(i,1,2),f=this;return u.evaluate=function(n){var t=f.getFirstValueFromReference(n[0]),i=n[1];return new ft(t,i,r)},u.acceptsReference=function(n){return n===0},u},s.prototype.getTextColor=function(t){var i=n._Color.parse(t);return i&&i.getBrightness()<255/2?"white":"black"},s.prototype._fixValue=function(n){return n=Math.round(n),n-.5},s.prototype.paintLine=function(n,r,u,f,e,o){var s=this;r=s._fixValue(r);u=s._fixValue(u);f=s._fixValue(f);e=s._fixValue(e);n.beginPath();n.moveTo(r,u);n.lineTo(f,e);n.lineWidth=1;n.strokeStyle=o===t||typeof o===i?"black":o;n.stroke()},s.prototype.paintArrow=function(n,t,i,r,u){var e=this,o=r*.4,t=e._fixValue(t);i=e._fixValue(i);n.beginPath();n.moveTo(t,i);switch(u){case 0:n.lineTo(e._fixValue(t-o/2),e._fixValue(i+f(3)*o/2));n.lineTo(e._fixValue(t),e._fixValue(i+o/f(3)));n.lineTo(e._fixValue(t+o/2),e._fixValue(i+f(3)*o/2));break;case 2:n.lineTo(e._fixValue(t-o/2),e._fixValue(i-f(3)*o/2));n.lineTo(e._fixValue(t),e._fixValue(i-o/f(3)));n.lineTo(e._fixValue(t+o/2),e._fixValue(i-f(3)*o/2));break;case 3:n.lineTo(e._fixValue(t+f(3)*o/2),e._fixValue(i-o/2));n.lineTo(e._fixValue(t+o/f(3)),e._fixValue(i));n.lineTo(e._fixValue(t+f(3)*o/2),e._fixValue(i+o/2));break;case 1:n.lineTo(e._fixValue(t-f(3)*o/2),e._fixValue(i-o/2));n.lineTo(e._fixValue(t-o/f(3)),e._fixValue(i));n.lineTo(e._fixValue(t-f(3)*o/2),e._fixValue(i+o/2));break;default:break}n.lineTo(t,i);n.closePath();n.fillStyle="white";n.fill()},s.prototype.paintRect=function(n,t,i,u,f,e){n.beginPath();n.rect(r(t),r(i),r(u),r(f));n.fillStyle=e;n.fill()},s.prototype.paint=function(r,f,e,s,h,c){var ht=f.type,a=f.value,g=f.colorScheme,l=5,nt=5,p=.7,w=!1,ut=this,y,v,b,k,d,ft,tt,et,ot,it,st,rt;try{a=o.D(a)}catch(ct){return}a>1?(a=1,w=!0):a<-1&&(a=-1,w=!0);(g===t||typeof g===i)&&(g="grey");r.save();ht===0?(tt=h-l*2,et=c*p,a>=0?(w&&(y=new n.Point(e+l+tt-nt,s+c/2)),v=new n.Rect(e+l,s+c*(1-p)/2,tt*a,et),b=new n.Point(e+l,s+1),k=new n.Point(e+l,s+c),d=1):(ot=u(tt*a),w&&(y=new n.Point(e+l+nt,s+c/2)),v=new n.Rect(e+h-l-ot,s+c*(1-p)/2,ot,et),b=new n.Point(e+h-l,s+1),k=new n.Point(e+h-l,s+c),d=3),ft=c):ht===1&&(it=c-l*2,st=h*p,a>=0?(rt=it*a,v=new n.Rect(e+(1-p)/2*h,s+c-l-rt,st,rt),w&&(y=new n.Point(e+h/2,s+c-l-rt+nt),d=0),b=new n.Point(e+1,s+c-l),k=new n.Point(e+h,s+c-l)):(a=u(a),v=new n.Rect(e+(1-p)/2*h,s+l,st,it*a),w&&(y=new n.Point(e+h/2,s+l+it-nt),d=2),b=new n.Point(e+1,s+l),k=new n.Point(e+h,s+l)),ft=h);r.beginPath();ut.paintRect(r,v.x,v.y,v.width,v.height,g);r.save();r.rect(v.x,v.y,v.width,v.height);r.clip();y&&ut.paintArrow(r,y.x,y.y,ft,d);r.restore();ut.paintLine(r,b.x,b.y,k.x,k.y);r.restore()},s}(e);n.BarSparklineBase=w;ri=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.createFunction=function(){return this.createCustomFunction("HBARSPARKLINE",0)},t}(w);n.HBarSparkline=ri;ui=function(n){function t(){n.call(this)}return __extends(t,n),t.prototype.createFunction=function(){return this.createCustomFunction("VBARSPARKLINE",1)},t}(w);n.VBarSparkline=ui,function(n){n[n.Classical=0]="Classical";n[n.Neo=1]="Neo"}(n.BoxPlotStyle||(n.BoxPlotStyle={}));fi=n.BoxPlotStyle;et=function(){function n(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d){var g=this;g.points=n;g.boxPlotClass=t;g.showAverage=i;g.scaleStart=r;g.scaleEnd=u;g.acceptableStart=f;g.acceptableEnd=e;g.colorScheme=o;g.style=s;g.vertical=h;g.perc02=c;g.perc09=l;g.perc10=a;g.perc90=v;g.perc91=y;g.perc98=p;g.q1=w;g.q3=b;g.median=k;g.stDev=d}return n}();n.BoxPlotSparklineValue=et;ei=function(f){function e(){f.call(this)}return __extends(e,f),e.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var r=new n.Calc.Functions.Function("BOXPLOTSPARKLINE",1,10),i=this;return r.evaluate=function(n){var t=n[0],r=i.getAllValuesFromReference(t),u=n[1],f=n[2],e=i.getFirstValueFromReference(n[3]),o=i.getFirstValueFromReference(n[4]),s=i.getFirstValueFromReference(n[5]),h=i.getFirstValueFromReference(n[6]),c=n[7],l=n[8],a=n[9],v=i._getPercentitleValue(t,2),y=i._getPercentitleValue(t,9),p=i._getPercentitleValue(t,10),w=i._getPercentitleValue(t,90),b=i._getPercentitleValue(t,91),k=i._getPercentitleValue(t,98),d=i._getPercentitleValue(t,25),g=i._getPercentitleValue(t,75),nt=i._getPercentitleValue(t,50),tt=i._getStDevpValue(t);return new et(r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt)},r.acceptsReference=function(n){return n===0},r},e.prototype._fixValues=function(n){for(var r=[],t,i=0,u=0,f=n.length;i<f;i++)t=parseFloat(n[i]),!isNaN(t)&&isFinite(t)&&(r[u++]=t);return r},e.prototype._getPercentitleValue=function(t,i){if(o.ref(t)&&!isNaN(i)&&0<=i&&i<=100){var r=n.Calc.Functions._builtInFunctions.PERCENTILE;return r.evaluate([t,i/100])}return NaN},e.prototype._getStDevpValue=function(t){if(o.ref(o.ref(t))){var i=n.Calc.Functions._builtInFunctions.STDEVP;return i.evaluate([t])}return NaN},e.prototype._getAverage=function(n){for(var r=0,t=0,i=n.length;t<i;t++)r+=n[t];return i===0?0:r/i},e.prototype._getMaxValue=function(n){for(var t=-Number.MAX_VALUE,i,r=0,u=n.length;r<u;r++)i=n[r],i>t&&(t=i);return t},e.prototype._getMinValue=function(n){for(var t=Number.MAX_VALUE,i,r=0,u=n.length;r<u;r++)i=n[r],i<t&&(t=i);return t},e.prototype._paintLine=function(n,t,i,u,f){n.moveTo(r(t),r(i));n.lineTo(r(u),r(f))},e.prototype._paintRect=function(n,t,i,u,f){n.fillRect(r(t),r(i),r(u),r(f))},e.prototype.paint=function(n,r,f,e,o,s){var p=this,ot=r.points,g=r.boxPlotClass,wi=r.showAverage,c=r.scaleStart,et=r.scaleEnd,ht=r.acceptableStart,ct=r.acceptableEnd,bt=r.style,at=r.colorScheme,tt=r.vertical,vt=5,kt=p._getMaxValue(ot),dt=p._getMinValue(ot),ti,w,y,wt,lt,b,li,ir,d,ii,vi,ri,yi,pi,ui,si,hi,gt,ni;if(ot!==t&&typeof ot!==i&&(ot=p._fixValues(ot),!(ot.length<=0))){g===t||typeof g!==v?g="5ns":(g=g.toLocaleLowerCase(),g!=="5ns"&&g!=="7ns"&&g!=="tukey"&&g!=="bowley"&&g!=="sigma3"&&(g="5ns"));c=parseFloat(c);isNaN(c)&&(c=dt);et=parseFloat(et);isNaN(et)&&(et=kt);ht=parseFloat(ht);ct=parseFloat(ct);(at===t||typeof at!==v)&&(at="#D2D2D2");(bt===t||fi[bt]===h)&&(bt=0);ti="#CB0000";c>dt&&(at=ti,c=dt);et<kt&&(at=ti,et=kt);n.save();n.rect(f,e,o,s);n.clip();n.lineWidth=2;tt?(b=-1,wt=f+vt,lt=o-2*vt,y=s-2*vt,w=e+vt+y):(b=1,w=f+vt,wt=e+vt,y=o-2*vt,lt=s-2*vt);var bi=r.perc02,rr=r.perc09,ur=r.perc10,fr=r.perc90,er=r.perc91,ki=r.perc98,yt=r.q1,pt=r.q3,or=r.median,ut=pt-yt,di=dt,gi=kt,nr=1.5*ut,tr=1.5*ut,st=r.stDev,ft=p._getAverage(ot),nt=0,ci=0,l=wt+lt*.1,a=lt*.7,k=u(et-c);for(li=0,ir=ot.length;li<ir;li++)d=ot[li],d<yt&&d>=yt-1.5*ut&&d-(yt-1.5*ut)<nr&&(nr=d-(yt-1.5*ut),di=d),d>pt&&d<=pt+1.5*ut&&pt+1.5*ut-d<tr&&(tr=pt+1.5*ut-d,gi=d),ii=!1,g==="tukey"&&(d<=yt-1.5*ut||d>=pt+1.5*ut)&&(ii=!0,nt=w+b*y*((d-c)/k),ci=d<=yt-3*ut||d>=pt+3*ut?0:1),g==="7ns"&&(d<=bi||d>=ki)&&(ii=!0,nt=w+b*y*((d-c)/k),ci=1),g==="sigma3"&&(d<=ft-2*st||d>=ft+2*st)&&(ii=!0,nt=w+b*y*((d-c)/k),ci=d<=ft-3*st||d>=ft+3*st?0:1),vi="#969696",ii&&(bt===1?(n.beginPath(),n.strokeStyle=vi,ci===1?tt?p._paintLine(n,l+a*.2,nt,l+a*.8,nt):p._paintLine(n,nt,l+a*.2,nt,l+a*.8):tt?p._paintLine(n,l+a*.3,nt,l+a*.7,nt):p._paintLine(n,nt,l+a*.3,nt,l+a*.7),n.stroke()):(ri=.1*lt,ri<2&&(ri=2),n.beginPath(),n.strokeStyle=vi,tt?n.arc(wt+lt*.45,nt,ri/2,0,2*Math.PI):n.arc(nt,wt+lt*.45,ri/2,0,2*Math.PI),n.stroke()));(c>ht||et<ct)&&(at="#C0FF00");c>ht&&(ht=c);et<ct&&(ct=et);ht!==ct&&(ht>ct&&(at=ti),ht<ct&&(yi=w+b*y*((ht-c)/k),pi=w+b*y*((ct-c)/k),n.beginPath(),n.strokeStyle="#646464",ui=wt+lt*.9,tt?p._paintLine(n,ui,yi,ui,pi):p._paintLine(n,yi,ui,pi,ui),n.stroke()));var ei=w+b*y*((yt-c)/k),ai=u(w+b*y*((pt-c)/k)-ei),or=r.median,oi=w+b*y*((or-c)/k),it,rt;switch(g){case"7ns":it=w+b*y*((bi-c)/k);rt=w+b*y*((ki-c)/k);break;case"tukey":it=w+b*y*((di-c)/k);rt=w+b*y*((gi-c)/k);break;case"sigma3":ei=w+b*y*((ft-st-c)/k);ai=u(w+b*y*((ft+st-c)/k)-ei);oi=w+b*y*((ft-c)/k);it=ft-2*st>c?w+b*y*((ft-2*st-c)/k):w+b*y*((dt-c)/k);rt=ft+2*st<et?w+b*y*((ft+2*st-c)/k):w+b*y*((kt-c)/k);wi=!1;break;case"5ns":case"bowley":default:it=w+b*y*((dt-c)/k);rt=w+b*y*((kt-c)/k);break}si="#969696";bt===1?(n.fillStyle="#F2F2F2",tt?p._paintRect(n,l,rt,a,it-rt):p._paintRect(n,it,l,rt-it,a)):(hi=wt+lt*.45,n.beginPath(),n.strokeStyle=si,tt?p._paintLine(n,hi,it,hi,rt):p._paintLine(n,it,hi,rt,hi),n.stroke());n.fillStyle=at;tt?p._paintRect(n,l,ei-ai,a,ai):p._paintRect(n,ei,l,ai,a);n.beginPath();n.strokeStyle=si;tt?p._paintLine(n,l,oi,l+a,oi):p._paintLine(n,oi,l,oi,l+a);n.stroke();bt===0&&(n.beginPath(),n.strokeStyle=si,tt?p._paintLine(n,l+a*.3,rt,l+a*.7,rt):p._paintLine(n,rt,l+a*.3,rt,l+a*.7),n.stroke(),n.beginPath(),tt?p._paintLine(n,l+a*.3,it,l+a*.7,it):p._paintLine(n,it,l+a*.3,it,l+a*.7),n.stroke());(g==="7ns"||g==="bowley")&&(g==="7ns"?(gt=w+b*y*((rr-c)/k),ni=w+b*y*((er-c)/k)):(gt=w+b*y*((ur-c)/k),ni=w+b*y*((fr-c)/k)),n.beginPath(),n.strokeStyle=si,tt?p._paintLine(n,l+a*.3,ni,l+a*.7,ni):p._paintLine(n,ni,l+a*.3,ni,l+a*.7),n.stroke(),n.beginPath(),tt?p._paintLine(n,l+a*.3,gt,l+a*.7,gt):p._paintLine(n,gt,l+a*.3,gt,l+a*.7),n.stroke());wi&&(nt=w+b*y*((ft-c)/k),n.beginPath(),n.strokeStyle=ti,tt?p._paintLine(n,l+a*.2,nt,l+a*.8,nt):p._paintLine(n,nt,l+a*.2,nt,l+a*.8),n.stroke());n.restore()}},e}(e);n.BoxPlotSparkline=ei;ot=function(){function n(n,t,i,r,u,f,e,o,s,h){this.variance=n;this.reference=t;this.mini=i;this.maxi=r;this.mark=u;this.tickUnit=f;this.legend=e;this.colorPositive=o;this.colorNegative=s;this.vertical=h}return n}();n.VariSparklineValue=ot;oi=function(r){function e(){r.call(this)}return __extends(e,r),e.prototype._getPercentage=function(n){var t=parseFloat(n),i,r;if(!isNaN(t))return i=t.toString(),r=i.substr(i.indexOf(".")+1).length,r>=2?(t*100).toFixed(r-2)+"%":(t*100).toFixed(0)+"%"},e.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var r=new n.Calc.Functions.Function("VARISPARKLINE",1,10),i=this;return r.evaluate=function(n){var t=i.getFirstValueFromReference(n[0]),r=i.getFirstValueFromReference(n[1]),u=i.getFirstValueFromReference(n[2]),f=i.getFirstValueFromReference(n[3]),e=i.getFirstValueFromReference(n[4]),o=i.getFirstValueFromReference(n[5]),s=n[6],h=n[7],c=n[8],l=n[9];return new ot(t,r,u,f,e,o,s,h,c,l)},r.acceptsReference=function(n){return n>=0&&n<=5},r},e.prototype._paintSparkline=function(n,r,e,s,h,c,l){var v=this,ut=r.variance,it=r.reference,y=r.mini,ft=r.maxi,pt=r.mark,dt=r.tickUnit,hi=r.legend,st=r.colorPositive,ht=r.colorNegative,tt=r.vertical,vi,nt,ct,gt,wt,lt,at,ci,ni=.5,ri=.5-ni/2,vt=!1,yi=!1,w=5,pi="#CB0000",wi="#969696",ui=13*l._zoomFactor,li,b,k,d,g,et,fi,ei,ot,kt,oi,ti,ai,si,ii,yt;try{ut=o.D(ut)}catch(bi){return}(ht===t||typeof ht===i)&&(ht="red");(st===t||typeof st===i)&&(st="green");(dt===t||typeof dt===i)&&(dt=0);yi=pt===t||typeof pt===i?!1:!0;(ft===t||typeof ft===i)&&(ft=1);(y===t||typeof y===i)&&(y=-1);it===t||typeof it===i?(it=0,ci=!1):ci=!0;tt?(nt=s+c-w,vi=e+2*w,gt=h-4*w,ct=c-2*w,wt=-1):(nt=e+w,vi=s+2*w,ct=h-2*w,gt=c-4*w,wt=1);hi&&(lt=v._getPercentage(r.variance));ut>ft&&(ut=ft,vt=!0);ut<y&&(ut=y,vt=!0);it>ft&&(it=ft);it<y&&(it=y);vt&&(at=gt<15?15:gt>60?60:gt);var bt=u(ft-y),rt=ct/bt,p=nt+wt*u(y-it)*rt,a=u(ut-it)*rt;if(a>u(bt)*rt&&(a=u(bt+y)*rt),li=nt+wt*ct,(!tt||!(p<li))&&(tt||!(p>li))){if(n.save(),n.rect(e,s,h,c),n.clip(),ut>it?(tt?(b=e+ri*h,k=p-a,d=h*ni,g=a,v.paintRect(n,b,k,d,g,st)):(b=p,k=s+ri*c,d=a,g=c*ni,v.paintRect(n,b,k,d,g,st)),vt&&(n.save(),n.rect(b,k,d,g),n.clip(),tt?v.paintArrow(n,e+h/2,nt-ct+w,at,0):v.paintArrow(n,nt+ct-w,s+c/2,at,1),n.restore()),hi&&(et=0,kt=u(ft-ut)*rt,vt&&(et=.4*at*f(3)/2+w+2),n.save(),n.beginPath(),n.font=ui+"px Arial",n.fillStyle="black",tt?(n.textAlign="center",ot=ui+a-(p-s),ot>0?kt>=a?n.textBaseline="bottom":(n.rect(b,k,d,g),n.clip(),n.textBaseline="top",n.fillStyle=v.getTextColor(st)):n.textBaseline="bottom",ei=p-a+et,n.fillText(lt,e+h/2,ei)):(n.textBaseline="middle",oi=n.measureText(lt),ot=oi.width+a-(e+h-p),ot>0?kt>=a?n.textAlign="left":(n.rect(b,k,d,g),n.clip(),n.textAlign="right",n.fillStyle=v.getTextColor(st)):n.textAlign="left",fi=p+a-et,n.fillText(lt,fi,s+c/2)),n.restore())):(a>u(bt)*rt&&(a=u(bt+y)*rt,p=nt),tt?(b=e+h*ri,k=p,d=h*ni,g=a,v.paintRect(n,b,k,d,g,ht)):(b=p-a,k=s+ri*c,d=a,g=c*ni,v.paintRect(n,b,k,d,g,ht)),vt&&(n.save(),n.rect(b,k,d,g),n.clip(),tt?v.paintArrow(n,e+h/2,nt-w,at,2):v.paintArrow(n,nt+w,s+c/2,at,3),n.restore()),hi&&(et=0,kt=u(y-ut)*rt,vt&&(et=.4*at*f(3)/2+w+2),n.save(),n.beginPath(),n.font=ui+"px Arial",n.fillStyle="black",tt?(n.textAlign="center",ot=ui+a-(s+c-p),ot>0?kt>=a?n.textBaseline="top":(n.rect(b,k,d,g),n.clip(),n.textBaseline="bottom",n.fillStyle=v.getTextColor(ht)):n.textBaseline="top",ei=p+a-et,n.fillText(lt,e+h/2,ei)):(n.textBaseline="middle",oi=n.measureText(lt),ot=oi.width+a-(p-e),ot>0?kt>=a?n.textAlign="right":(n.rect(b,k,d,g),n.clip(),n.textAlign="left",n.fillStyle=v.getTextColor(ht)):n.textAlign="right",fi=p-a+et,n.fillText(lt,fi,s+c/2)),n.restore())),ci&&(ti=nt+wt*Math.abs(y-it)*rt,tt?v.paintLine(n,e,ti,e+h,ti):v.paintLine(n,ti,s,ti,s+c)),dt>0)for(n.beginPath(),ai=bt/dt,si=0;si<=ai;si++)ii=nt+ct/ai*si*wt,tt?v.paintLine(n,e,ii,e+.1*h,ii,wi):v.paintLine(n,ii,s+.9*c,ii,s+c,wi);yi&&y<=pt&&pt<=ft&&(n.beginPath(),yt=0,tt?(yt=nt-u(y-pt)*rt,v.paintLine(n,e,yt,e+.33*h,yt,pi)):(yt=nt+u(y-pt)*rt,v.paintLine(n,yt,s+.66*c,yt,s+c,pi)),n.fill());n.restore()}},e}(w);n.VariSparkline=oi;k=function(t){function i(){t.call(this)}return __extends(i,t),i.prototype.lightenColor=function(t,i){var r=n._Color.parse(t),u=new n.HLSColor(r),f=u.getLighterColor(i);return f.toString()},i.prototype.paintLine=function(n,t,i,u,f){t=r(t);i=r(i);u=r(u);f=r(f);t===u&&(u=u-.5,t=u);i===f&&(f=f-.5,i=f);n.moveTo(t,i);n.lineTo(u,f)},i.prototype.paintRect=function(n,t,i,u,f){var e=r(t+u),o=r(i+f);t=r(t);i=r(i);u=r(e-t);f=r(o-i);n.fillRect(t,i,u,f)},i.prototype._getTextColor=function(t){var i=n._Color.parse(t);return i&&i.getBrightness()<255/2?"white":"black"},i.prototype.paintLabel=function(n,t,i,r,u,f){var a=this,y=f.labelText,p=f.fontSize,e=f.startBox,o=f.endBox,v=f.boxColor,b=f.isInRightOrTopOfBox,h,c,l,s,w;n.save();n.beginPath();n.font=p+"px Arial";n.fillStyle="black";s=1;f.vertical?(n.textAlign="center",b?(h=p+o-(e-i),h>0&&e-o-i<o?(n.textBaseline="top",n.fillStyle=a._getTextColor(v),l=e-o+s,n.rect(t,e-o,r,o),n.clip()):(n.textBaseline="bottom",l=e-o-s)):(h=p-(i+u-e),h>0&&i+u-e<o?(n.textBaseline="bottom",n.fillStyle=a._getTextColor(v),l=e-s,n.rect(t,e-o,r,o),n.clip()):(n.textBaseline="top",l=e+s)),n.fillText(y,t+r/2,l)):(n.textBaseline="middle",w=n.measureText(y),b?(h=w.width+o-(t+r-e),h>0&&t+r-(e+o)<o?(n.textAlign="right",n.fillStyle=a._getTextColor(v),c=e+o-s,n.rect(e,i,o,u),n.clip()):(n.textAlign="left",c=e+o+s)):(h=w.width-(e-t),h>0&&e-t<o?(n.textAlign="left",n.fillStyle=a._getTextColor(v),c=e+s,n.rect(e,i,o,u),n.clip()):(n.textAlign="right",c=e-s)),n.fillText(y,c,i+u/2));n.restore()},i}(e);n.AccumulateSparklineBase=k;st=function(){function n(n,t,i,r,u,f,e,o){var s=this;s.points=n;s.labels=i;s.pointIndex=t;s.minimum=r;s.maximum=u;s.colorPositive=f;s.colorNegative=e;s.vertical=o}return n}();n.CascadeSparklineValue=st;si=function(i){function r(){i.call(this)}return __extends(r,i),r.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var r=new n.Calc.Functions.Function("CASCADESPARKLINE",1,8),i=this;return r.evaluate=function(n){var t=i.getAllValuesFromReference(n[0]),r=i.getFirstValueFromReference(n[1]),u=i.getAllValuesFromReference(n[2]),f=i.getFirstValueFromReference(n[3]),e=i.getFirstValueFromReference(n[4]),o=n[5],s=n[6],h=n[7];return new st(t,r,u,f,e,o,s,h)},r.acceptsReference=function(n){return n===0||n===2},r.acceptsArray=function(n){return n===0||n===2},r},r.prototype._paintSparkline=function(n,i,r,f,e,o,s){var l=this,ct=i.points,lt=i.labels,a=i.pointIndex,nt=i.minimum,ft=i.maximum,at=i.colorPositive,vt=i.colorNegative,yt=i.vertical,rt=5,hi=13*s._zoomFactor,k,bt,ei,b,p,gt,ni,tt,kt,y,g,ti,oi,it,ui,fi,wt,si;if(ct!==t&&ct!==h&&(k=ct.length,!(k<=0))&&((lt===t||lt===h)&&(lt=[]),a=parseInt(a),!isNaN(a)&&!(a<=0)&&!(a>k))){(at===t||typeof at!==v)&&(at="#8CBF64");(vt===t||typeof vt!==v)&&(vt="#D6604D");var ci=at,li=l.lightenColor(at,1.3),ai=vt,vi=l.lightenColor(vt,1.3),et=1,ut=0,ot=0,st=0,pt=0,dt=[],d=0;for(bt=0,ei=ct.length;bt<ei;bt++)b=ct[bt],dt[et]=[],p=dt[et],isNaN(b)?(p[0]=0,p[1]=ut,p[2]=0,p[3]=et):(p[0]=u(b),ut=b+ut,b>0?(p[1]=ot,p[2]=b,p[3]=et):(p[1]=ut,p[2]=b,p[3]=et)),ot<st&&(st=ot),ot>pt&&(pt=ot),et===k&&(d=st<0?-st:0,p[1]=b>0?0:b),ot=b+ot,et++;ut=ut-b;nt=parseFloat(nt);isNaN(nt)||nt>0||nt>st?(gt=st,nt=st):(gt=nt,d=-nt);ft=parseFloat(ft);isNaN(ft)||ft<0||ft<pt?(ni=pt,ft=pt):(ni=ft,d=-nt);yt?(ti=-1,y=r+rt,g=e-2*rt,kt=o-2*rt,tt=f+rt+kt):(ti=1,tt=r+rt,y=f+rt,kt=e-2*rt,g=o-2*rt);oi=ni-gt;it=kt/oi;n.save();n.rect(r,f,e,o);n.clip();n.beginPath();n.lineWidth=1;var ii=dt[a],ht=ii[2],c=tt+ti*(ii[1]+d)*it,w=ii[0]*it,ri;ri=ht>=0?a===1||a===k?ci:li:a===1||a===k?ai:vi;n.beginPath();n.fillStyle=ri;yt?l.paintRect(n,y,c-w,g,w):l.paintRect(n,c,y,w,g);n.beginPath();n.strokeStyle="#DCDCDC";yt?(a!==1&&(a!==k?ht>0?l.paintLine(n,r,c,y+g,c):l.paintLine(n,r,c-w,y+g,c-w):(ui=tt-(ut+d)*it,l.paintLine(n,r,ui,y+g,ui)),n.stroke()),a!==k&&(ht>0?l.paintLine(n,y,c-w,r+e,c-w):l.paintLine(n,y,c,r+e,c),n.stroke())):(a!==1&&(a!==k?ht>0?l.paintLine(n,c,f,c,y+g):l.paintLine(n,c+w,f,c+w,y+g):(fi=tt+(ut+d)*it,l.paintLine(n,fi,f,fi,y+g)),n.stroke()),a!==k&&(ht>0?l.paintLine(n,c+w,y,c+w,f+o):l.paintLine(n,c,y,c,f+o),n.stroke()));wt=lt[a-1];lt.length>0&&wt!==t&&wt!==h&&wt!==""&&(si={labelText:wt,vertical:yt,isInRightOrTopOfBox:ht>0,fontSize:hi,startBox:c,endBox:w,boxColor:ri},l.paintLabel(n,r,f,e,o,si));n.beginPath();n.strokeStyle="black";yt?l.paintLine(n,r,tt-d*it,r+e,tt-d*it):l.paintLine(n,tt+d*it,f,tt+d*it,f+o);n.stroke();n.restore()}},r}(k);n.CascadeSparkline=si;ht=function(){function n(n,t,i,r,u,f,e,o){var s=this;s.points=n;s.pointIndex=t;s.colorRange=i;s.target=r;s.target2=u;s.highlightPosition=f;s.label=e;s.vertical=o}return n}();n.ParetoSparklineValue=ht;hi=function(i){function u(){i.call(this)}return __extends(u,i),u.prototype.createFunction=function(){if(!n.util.hasCalc())return t;var r=new n.Calc.Functions.Function("PARETOSPARKLINE",1,8),i=this;return r.evaluate=function(n){var t=i.getAllValuesFromReference(n[0]),r=i.getFirstValueFromReference(n[1]),u=i.getAllValuesFromReference(n[2]),f=i.getFirstValueFromReference(n[3]),e=i.getFirstValueFromReference(n[4]),o=i.getFirstValueFromReference(n[5]),s=n[6],h=n[7];return new ht(t,r,u,f,e,o,s,h)},r.acceptsReference=function(n){return n===0||n===2},r.acceptsArray=function(n){return n===0||n===2},r},u.prototype._paintSparkline=function(n,i,u,f,e,o,s){var k=this,it=i.points,a=i.pointIndex,nt=i.colorRange,c=i.target,l=i.target2,ui=i.highlightPosition,w=i.label,rt=i.vertical,b=5,fi=13*s._zoomFactor,pt,ht,ni,y,p,ft,g,ct,lt,et,at,dt,gt,ii,ri,ot,st;if(it!==t&&it!==h&&(pt=it.length,!(pt<=0))&&((nt===t||nt===h)&&(nt=[]),a=parseInt(a),!isNaN(a)&&!(a<=0)&&!(a>pt))){c=parseFloat(c);isNaN(c)&&(c=0);c<0&&(c=0);c>1&&(c=1);l=parseFloat(l);isNaN(l)&&(l=0);l<0&&(l=0);l>1&&(l=1);w=parseInt(w);isNaN(w)&&(w=0);var ut=1,d=0,wt=[];for(ht=0,ni=it.length;ht<ni;ht++)y=it[ht],wt[ut]=[],p=wt[ut],y<0||isNaN(y)||y===t||y===h?ut===1?(p[0]=0,p[1]=0):(p[0]=d,p[1]=0):(d=d+y,ut===1?(p[0]=0,p[1]=y):(p[0]=d-y,p[1]=y)),ut++;rt?(et=-1,ct=u+b,lt=e-2*b,g=o-2*b,ft=f+b+g):(et=1,ft=u+b,ct=f+b,g=e-2*b,lt=o-2*b);at=g/d;n.save();n.rect(u,f,e,o);n.clip();n.beginPath();n.lineWidth=1;var tt=wt[a],ti=tt[1],bt=ft+et*tt[0]*at,yt=tt[1]*at,kt;kt=a===ui?"#CB0000":nt.length===0||typeof nt[a-1]!==v?"#969696":nt[a-1];n.beginPath();n.fillStyle=kt;rt?k.paintRect(n,ct,bt-yt,lt,yt):k.paintRect(n,bt,ct,yt,lt);w===1?dt=(tt[0]+ti)/d*1e3:w===2&&(dt=ti/d*1e3);gt=r(dt)/10+"%";ii=(tt[0]+tt[1])*at<g/2?!0:!1;(w===1||w===2)&>!==""&&(ri={labelText:gt,vertical:rt,isInRightOrTopOfBox:ii,fontSize:fi,startBox:bt,endBox:yt,boxColor:kt},k.paintLabel(n,u,f,e,o,ri));c!==0&&(n.beginPath(),n.strokeStyle="#8CBF64",ot=vt(ft+et*g*c),rt?k.paintLine(n,u,ot,u+e,ot):k.paintLine(n,ot,f,ot,f+o),n.stroke());l!==0&&(n.beginPath(),n.strokeStyle="#EE5D5D",st=vt(ft+et*g*l),rt?k.paintLine(n,u,st,u+e,st):k.paintLine(n,st,f,st,f+o),n.stroke());n.restore()}},u}(k);n.ParetoSparkline=hi})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){var a,o,w,c,l,v,y;n.feature("comment",["core.common","core.sheet_action"]);var t=null,i=undefined,f="mousewheel",e="DOMMouseScroll",r=Math.max,u=Math.min,s=Math.floor,p=Math.atan2,h=Math.abs;(function(n){n[n.AlwaysShown=1]="AlwaysShown";n[n.HoverShown=2]="HoverShown"})(n.DisplayMode||(n.DisplayMode={}));a=n.DisplayMode;o=function(){function n(n,t,i,r){this.left=0;this.top=0;this.right=0;this.bottom=0;var u=this;arguments.length===1?u.top=u.right=u.bottom=u.left=n:arguments.length===4&&(u.top=n,u.right=t,u.bottom=i,u.left=r)}return n.prototype.toString=function(){var n=this;return n.top+"px "+n.right+"px "+n.bottom+"px "+n.left+"px"},n}();n.Padding=o,function(n){n[n.TopLeft=0]="TopLeft";n[n.TopRight=1]="TopRight";n[n.BottomLeft=2]="BottomLeft";n[n.BottomRight=3]="BottomRight";n[n.MiddleLeft=4]="MiddleLeft";n[n.MiddleRight=5]="MiddleRight";n[n.TopCenter=6]="TopCenter";n[n.BottomCenter=7]="BottomCenter"}(n.ResizeDirection||(n.ResizeDirection={}));w=n.ResizeDirection;c=function(){function r(){var i=this;i._defaultLocation=new n.Point(9,-18);i._text="";i._location=i._defaultLocation.clone();i._displayMode=2;i._commentState=3;i._width=160;i._height=100;i._fontFamily="Arial";i._fontStyle="normal";i._fontSize="9pt";i._fontWeight="normal";i._textDecoration=0;i._foreColor="black";i._backColor="#FFFFE1";i._opacity=1;i._locked=!0;i._lockText=!0;i._dynamicMove=!0;i._dynamicSize=!0;i._horizontalAlign=0;i._autoSize=!1;i._borderWidth=1;i._borderStyle="solid";i._borderColor="black";i._padding=t;i._zIndex=-1;i._showShadow=!1;i._timeout=t;i._rowIndex=-1;i._colIndex=-1;i._sheet=t;i._ignoreDefaultLocation=!1}return r.prototype.text=function(n){var t=this;return arguments.length===0?t._text:(typeof n=="string"&&t._text!==n&&t._changeProperty("text",n),t)},r.prototype.location=function(t){var i=this;return arguments.length===0?i._location:(t instanceof n.Point&&i._location!==t&&i._changeProperty("location",t),i)},r.prototype.width=function(n){var t=this;return arguments.length===0?t._width:(typeof n=="number"&&n>0&&t._width!==n&&(t._autoSize=!1,t._changeProperty("width",n)),t)},r.prototype.height=function(n){var t=this;return arguments.length===0?t._height:(typeof n=="number"&&n>0&&t._height!==n&&(t._autoSize=!1,t._changeProperty("height",n)),t)},r.prototype.fontFamily=function(n){var t=this;return arguments.length===0?t._fontFamily:(typeof n=="string"&&t._fontFamily!==n&&t._changeProperty("fontFamily",n),t)},r.prototype.fontStyle=function(n){var t=this;return arguments.length===0?t._fontStyle:(typeof n=="string"&&t._fontStyle!==n&&t._changeProperty("fontStyle",n),t)},r.prototype.fontSize=function(n){var t=this;return arguments.length===0?t._fontSize:(typeof n=="string"&&t._fontSize!==n&&t._changeProperty("fontSize",n),t)},r.prototype.fontWeight=function(n){var t=this;return arguments.length===0?t._fontWeight:(typeof n=="string"&&t._fontWeight!==n&&t._changeProperty("fontWeight",n),t)},r.prototype.textDecoration=function(n){var t=this;return arguments.length===0?t._textDecoration:(t._textDecoration!==n&&t._changeProperty("textDecoration",n),t)},r.prototype.foreColor=function(n){var t=this;return arguments.length===0?t._foreColor:(typeof n=="string"&&t._foreColor!==n&&t._changeProperty("foreColor",n),t)},r.prototype.locked=function(n){var t=this;return arguments.length===0?t._locked:(typeof n=="boolean"&&t._locked!==n&&t._changeProperty("locked",n),t)},r.prototype.lockText=function(n){var t=this;return arguments.length===0?t._lockText:(typeof n=="boolean"&&t._lockText!==n&&t._changeProperty("lockText",n),t)},r.prototype.horizontalAlign=function(t){var r=this;return arguments.length===0?r._horizontalAlign:(n.HorizontalAlign[t]!==i&&r._horizontalAlign!==t&&r._changeProperty("horizontalAlign",t),r)},r.prototype.autoSize=function(n){var t=this;return arguments.length===0?t._autoSize:(typeof n=="boolean"&&t._autoSize!==n&&t._changeProperty("autoSize",n),t)},r.prototype.dynamicSize=function(n){var t=this;if(arguments.length===0)return t._dynamicSize;else{if(typeof n=="boolean"&&t._dynamicSize!==n){if(n===!0&&t._dynamicMove===!1)return t;t._changeProperty("dynamicSize",n)}return t}},r.prototype.dynamicMove=function(n){var t=this;return arguments.length===0?t._dynamicMove:(typeof n=="boolean"&&t._dynamicMove!==n&&(n===!1&&t._dynamicSize===!0&&(t._dynamicSize=!1),t._changeProperty("dynamicMove",n)),t)},r.prototype.backColor=function(n){var t=this;return arguments.length===0?t._backColor:(typeof n=="string"&&t._backColor!==n&&t._changeProperty("backColor",n),t)},r.prototype.opacity=function(n){var t=this;return arguments.length===0?t._opacity:(typeof n=="number"&&n>=0&&n<=1&&t._opacity!==n&&t._changeProperty("opacity",n),t)},r.prototype.borderWidth=function(n){var t=this;return arguments.length===0?t._borderWidth:(typeof n=="number"&&n>0&&t._borderWidth!==n&&t._changeProperty("borderWidth",n),t)},r.prototype.borderStyle=function(n){var t=this;return arguments.length===0?t._borderStyle:(typeof n=="string"&&t._borderStyle!==n&&t._changeProperty("borderStyle",n),t)},r.prototype.borderColor=function(n){var t=this;return arguments.length===0?t._borderColor:(typeof n=="string"&&t._borderColor!==n&&t._changeProperty("borderColor",n),t)},r.prototype.padding=function(n){var i=this;return arguments.length===0?i._padding:((n===t||n instanceof o)&&i._padding!==n&&i._changeProperty("padding",n),i)},r.prototype.showShadow=function(n){var t=this;return arguments.length===0?t._showShadow:(typeof n=="boolean"&&t._showShadow!==n&&t._changeProperty("showShadow",n),t)},r.prototype.displayMode=function(n){var t=this;return arguments.length===0?t._displayMode:(a[n]!==i&&t._displayMode!==n&&t._changeProperty("displayMode",n),t)},r.prototype.commentState=function(t){var r=this;return arguments.length===0?r._commentState:(n.CommentState[t]!==i&&r._commentState!==t&&r._changeProperty("commentState",t),r)},r.prototype.zIndex=function(n){var t=this;return arguments.length===0?t._zIndex:(typeof n=="number"&&t._zIndex!==n&&t._changeProperty("zIndex",n),t)},r.prototype.ignoreDefaultLocation=function(n){var t=this;return arguments.length===0?t._ignoreDefaultLocation:(typeof n=="boolean"&&t._ignoreDefaultLocation!==n&&(t._ignoreDefaultLocation=n),t)},r.prototype._changeProperty=function(n,t){var i=this,r=i._sheet,u="_"+n;r?r._bindToAutoRefresh(function(n){i.hasOwnProperty(u)&&(i[u]=n)})(t):i.hasOwnProperty(u)&&(i[u]=t);this._sheet&&this._sheet.triggerCommentChanged({sheet:r,sheetName:r?r._name:"",comment:i,propertyName:n})},r.prototype.clone=function(){var t=this,i=new r;return i._text=t._text,i._location=new n.Point(t._location.x,t._location.y),t._defaultLocation&&(i._defaultLocation=new n.Point(t._defaultLocation.x,t._defaultLocation.y)),i._width=t._width,i._height=t._height,i._fontFamily=t._fontFamily,i._fontStyle=t._fontStyle,i._fontSize=t._fontSize,i._fontWeight=t._fontWeight,i._textDecoration=t._textDecoration,i._foreColor=t._foreColor,i._locked=t._locked,i._lockText=t._lockText,i._horizontalAlign=t._horizontalAlign,i._autoSize=t._autoSize,i._dynamicMove=t._dynamicMove,i._dynamicSize=t._dynamicSize,i._backColor=t._backColor,i._opacity=t._opacity,i._borderWidth=t._borderWidth,i._borderStyle=t._borderStyle,i._borderColor=t._borderColor,t._padding&&(i._padding=new o(t._padding.top,t._padding.right,t._padding.bottom,t._padding.left)),i._showShadow=t._showShadow,i._displayMode=t._displayMode,i._commentState=t._commentState,i._sheet=t._sheet,i._rowIndex=t._rowIndex,i._colIndex=t._colIndex,i._zIndex=t._zIndex,i._ignoreDefaultLocation=t._ignoreDefaultLocation,i},r.prototype.toJSON=function(){var n=this,r={text:n._text,location:n._location,displayMode:n._displayMode,commentState:n._commentState,width:n._width,height:n._height,fontFamily:n._fontFamily,fontStyle:n._fontStyle,fontSize:n._fontSize,fontWeight:n._fontWeight,textDecoration:n._textDecoration,foreColor:n._foreColor,backColor:n._backColor,opacity:n._opacity,locked:n._locked,lockText:n._lockText,dynamicMove:n._dynamicMove,dynamicSize:n._dynamicSize,horizontalAlign:n._horizontalAlign,autoSize:n._autoSize,borderWidth:n._borderWidth,borderStyle:n._borderStyle,borderColor:n._borderColor,padding:n._padding,zIndex:n._zIndex,showShadow:n._showShadow,rowIndex:n._rowIndex,colIndex:n._colIndex,ignoreDefaultLocation:n._ignoreDefaultLocation},u={},t,i;for(t in r)i=r[t],n._isDefaultValue(t,i)||(u[t]=i);return u},r.prototype._isDefaultValue=function(n,t){switch(n){case"text":return t==="";case"location":return t.x===9&&t.y===-18;case"displayMode":return t===2;case"commentState":return t===3;case"width":return t===160;case"height":return t===100;case"fontFamily":return t==="Arial";case"fontStyle":return t==="normal";case"fontSize":return t==="9pt";case"fontWeight":return t==="normal";case"textDecoration":return t===0;case"foreColor":return t==="black";case"backColor":return t==="#FFFFE1";case"opacity":return t===1;case"locked":return t===!0;case"lockText":return t===!0;case"dynamicMove":return t===!0;case"dynamicSize":return t===!0;case"horizontalAlign":return t===0;case"autoSize":return t===!1;case"borderWidth":return t===1;case"borderStyle":return t==="solid";case"borderColor":return t==="black";case"padding":return t===null;case"zIndex":return t===-1;case"showShadow":return t===!1;case"rowIndex":return t===-1;case"colIndex":return t===-1;case"ignoreDefaultLocation":return t===!1;default:return!1}},r.prototype.fromJSON=function(t,r){var u,e,f;t&&(u=this,t.text!==i&&(u._text=t.text),e=t.location,e!==i&&(u._location=new n.Point(e.x,e.y)),t.displayMode!==i&&(u._displayMode=t.displayMode),t.commentState!==i&&(u._commentState=t.commentState),t.width!==i&&(u._width=t.width),t.height!==i&&(u._height=t.height),t.fontFamily!==i&&(u._fontFamily=t.fontFamily),t.fontStyle!==i&&(u._fontStyle=t.fontStyle),t.fontSize!==i&&(u._fontSize=t.fontSize),t.fontWeight!==i&&(u._fontWeight=t.fontWeight),t.textDecoration!==i&&(u._textDecoration=t.textDecoration),t.foreColor!==i&&(u._foreColor=t.foreColor),t.backColor!==i&&(u._backColor=t.backColor),t.opacity!==i&&(u._opacity=t.opacity),t.locked!==i&&(u._locked=t.locked),t.lockText!==i&&(u._lockText=t.lockText),t.dynamicMove!==i&&(u._dynamicMove=t.dynamicMove),t.dynamicSize!==i&&(u._dynamicSize=t.dynamicSize),t.horizontalAlign!==i&&(u._horizontalAlign=t.horizontalAlign),t.autoSize!==i&&(u._autoSize=t.autoSize),t.borderWidth!==i&&(u._borderWidth=t.borderWidth),t.borderStyle!==i&&(u._borderStyle=t.borderStyle),t.borderColor!==i&&(u._borderColor=t.borderColor),f=t.padding,f!==i&&(u._padding=new o(f.top,f.right,f.bottom,f.left)),t.zIndex!==i&&(u._zIndex=t.zIndex),t.showShadow!==i&&(u._showShadow=t.showShadow),t.rowIndex!==i&&(u._rowIndex=t.rowIndex),t.colIndex!==i&&(u._colIndex=t.colIndex),t.ignoreDefaultLocation!==i&&(u._ignoreDefaultLocation=t.ignoreDefaultLocation))},r}();n.Comment=c;l=function(){function o(t,i){var r,f,u;this._rowViewportIndex=1;this._columnViewportIndex=1;r=this;f=t&&t._sheet;r._comment=t;r._updateCommentViewportIndex();r._zoomFactor=f._zoomFactor;r._commentManager=i;r._editor=i._editorDom;r._init();u=r._getAdjustedCommentRect(r._getAbsLocation(),t.width(),t.height());r._absLocation=new n.Point(u.x,u.y);r._updateStartCoordinate();r._updateEndCoordinate()}return o.prototype._init=function(){var i=this,r;i._commentLayoutPanel=t;i._floatBlockCanvasContainer=t;i._floatBlockCanvas=t;i._hostContainer=t;i._host=t;i._lineCanvasContainer=t;i._lineCanvas=t;i._floatBlockCanvasContainerClassName="gc-spread-floatBlockCanvas-container";i._floatBlockCanvasClassName="gc-spread-floatBlockCanvas";i._hostContainerClassName="gc-spread-host-container";i._hostClassName="gc-spread-host";i._lineCanvasContainerClassName="gc-spread-lineCanvas-container";i._lineCanvasClassName="gc-spread-lineCanvas";i._floatBlockCanvasContainer=document.createElement("div");n.GC$(i._floatBlockCanvasContainer).addClass(i._floatBlockCanvasContainerClassName).css("position","absolute").css("overflow","hidden").css("box-sizing","content-box");i._floatBlockCanvas=document.createElement("canvas");n.DPIHelper.adjustDevicePixel(i._floatBlockCanvas,null,i._commentManager._sheet);n.GC$(i._floatBlockCanvas).addClass(i._floatBlockCanvasClassName).css("left",0).css("top",0).css("position","absolute");i._hostContainer=document.createElement("div");n.GC$(i._hostContainer).addClass(i._hostContainerClassName).css("position","absolute").css("overflow","hidden").css("box-sizing","content-box");i._host=document.createElement("div");n.GC$(i._host).addClass(i._hostClassName+" no-user-select").css("left",0).css("top",0).css("width","100%").css("height","100%").css("position","absolute").css("word-wrap","break-word").css("word-break","normal").css("white-space","pre-wrap").css("overflow","hidden").css("box-sizing","content-box").attr("unselectable","on");n.GC$(i._hostContainer).append(i._host);n.GC$(i._floatBlockCanvasContainer).append(i._floatBlockCanvas).append(i._hostContainer);i._lineCanvasContainer=document.createElement("div");n.GC$(i._lineCanvasContainer).addClass(i._lineCanvasContainerClassName).css("position","absolute").css("overflow","hidden");i._lineCanvas=document.createElement("canvas");n.DPIHelper.adjustDevicePixel(i._lineCanvas,null,i._commentManager._sheet);n.GC$(i._lineCanvas).addClass(i._lineCanvasClassName).css("left",0).css("right",0).css("position","absolute");n.GC$(i._lineCanvasContainer).append(i._lineCanvas);i._adornerDrawState=t;i._resizeHitRects=[];i._hostMargin=7;i._isMoving=!1;i._isResizing=!1;r=i._comment._sheet;n.features.touch&&(i._touchManager=new n.CommentTouchManager(i._floatBlockCanvas,i,r.parent._touchEventProvider),i._touchManager.attach(),i._touchContentManager=new n.CommentContentTouchManager(i._host,i,r.parent._touchEventProvider),i._touchContentManager.attach())},o.prototype.open=function(){var n=this,t=n._comment._sheet;(n._commentLayoutPanel||(t&&(n._commentLayoutPanel=t._commentRender._commentLayoutPanel),n._commentLayoutPanel))&&(n._commentLayoutPanel.appendChild(n._lineCanvasContainer),n._attachLineCanvasEventHandler(),n._commentLayoutPanel.appendChild(n._floatBlockCanvasContainer),n._attachFloatBlockCanvasEventHandler(),n._attachHostContainerEventHandler(),n.isEditing()?n._attachEditorEventHandler():n._attachHostEventHandler(),n._absLocation=n._getAbsLocation(),n.updateLayout())},o.prototype.close=function(){var t=this;t._floatBlockCanvasContainer&&t._lineCanvasContainer&&t._commentLayoutPanel&&(t._detachFloatBlockCanvasEventHandler(),t._detachHostContainerEventHandler(),t._detachHostEventHandler(),t._detachLineCanvasEventHandler(),t._detachEditorEventHandler(),n.GC$(t._floatBlockCanvasContainer).remove(),n.GC$(t._lineCanvasContainer).remove())},o.prototype.getComment=function(){return this._comment},o.prototype._getActualWidth=function(){return this._comment.width()*this._zoomFactor},o.prototype._getActualHeight=function(){return this._comment.height()*this._zoomFactor},o.prototype._getAbsLocation=function(){var t=this,n=t._comment;return n!==t._commentManager.getHoverShownComment()||n.commentState()!==3||n.ignoreDefaultLocation()?t._convertRelLocationToAbsLocation(n.location()):t._convertRelLocationToAbsLocation(n._defaultLocation)},o.prototype._convertRelLocationToAbsLocation=function(t){var r=this,u=r._comment,f=u&&u._sheet,s=r._zoomFactor,e=new n.Point(0,0),i,o;return f&&(i=r._getCellRect(f,u._rowIndex,u._colIndex,r._rowViewportIndex,r._columnViewportIndex),i.x!==null&&i.x!==undefined&&i.y!==null&&i.y!==undefined&&i.width&&i.height&&(o=f._getSheetLayout(),e.x=i.x+i.width+t.x*s-o.rowHeaderWidth,e.y=i.y+t.y*s-o.colHeaderHeight)),e},o.prototype._getCellRect=function(f,e,o,s,h){for(var p,a,g=this,c=new n.Rect(0,0,0,0),l=f._getSheetLayout(),w=f.getViewportTopRow(s),b=f.getViewportLeftColumn(h),nt=u(w,e),tt=r(w,e),it=u(b,o),rt=r(b,o),k=0,d=0,y=g._zoomFactor,v=nt;v<tt;v++)d+=f.getRowHeight(v,3)*y;for(a=it;a<rt;a++)k+=f.getColumnWidth(a,3)*y;if(c.y=e>=w?d:-d,c.x=o>=b?k:-k,p=f.getSpan(e,o),p!=i&&p!=t){for(v=0;v<p.rowCount;v++)c.height+=f.getRowHeight(e+v)*y;for(a=0;a<p.colCount;a++)c.width+=f.getColumnWidth(o+a)*y}else c.height=f.getRowHeight(e)*y,c.width=f.getColumnWidth(o)*y;return c.x+=l.rowHeaderWidth,c.y+=l.colHeaderHeight,s===1?c.y+=l.frozenHeight:s===2&&(c.y+=l.frozenHeight+l.viewportHeight),h===1?c.x+=l.frozenWidth:h===2&&(c.x+=l.frozenWidth+l.viewportWidth),c},o.prototype._convertAbsLocationToRelLocation=function(t){var r=this,u=r._comment,f=u&&u._sheet,s=r._zoomFactor,e=new n.Point(0,0),i,o;return f&&(i=r._getCellRect(f,u._rowIndex,u._colIndex,r._rowViewportIndex,r._columnViewportIndex),i.x!==null&&i.x!==undefined&&i.y!==null&&i.y!==undefined&&i.width&&i.height&&(o=f._getSheetLayout(),e.x=(t.x-(i.x+i.width-o.rowHeaderWidth))/s,e.y=(t.y-(i.y-o.colHeaderHeight))/s)),e},o.prototype.updateLayoutWhenLocationChanged=function(){var n=this;n._absLocation=n._getAbsLocation();n._updateStartCoordinate();n._updateEndCoordinate();n.updateLayout()},o.prototype.updateLayoutWhenWidthHeightChanged=function(){var n=this;n._absLocation=n._getAbsLocation();n._updateEndCoordinate()},o.prototype.updateLayoutWhenRowColumnChanged=function(){var n=this,t=n._comment,i;t.dynamicMove()?t.dynamicSize()?(n._updateSizeByCoordinate(),n._updateLocationByCoordinate()):(n._updateLocationByCoordinate(),n._updateEndCoordinate()):(n._updateStartCoordinate(),n._updateEndCoordinate(),i=n._convertAbsLocationToRelLocation(n._absLocation),t.location(i))},o.prototype.updateLayoutWhenCellSpanChanged=function(){var n=this;n._absLocation=n._getAbsLocation();n.updateLayout()},o.prototype.updateLayoutWhenSheetScroll=function(){var n=this;n._absLocation=n._getAbsLocation();n.updateLayout()},o.prototype._updateLocationByCoordinate=function(){var n=this,t=n._comment,r=t&&t._sheet,i=n._getLocationByCoordinate();n._absLocation=i;t._location=n._convertAbsLocationToRelLocation(i);n.updateLayout()},o.prototype._getLocationByCoordinate=function(){var t=this,a=t._comment,i=a&&a._sheet,o=t._zoomFactor,s=i.getViewportLeftColumn(t._columnViewportIndex),h=i.getViewportTopRow(t._rowViewportIndex),v=t._getViewportRect(t._rowViewportIndex,t._columnViewportIndex),r,u,c,f,e,l;if(t._columnViewportIndex===0?r=0:t._columnViewportIndex===1?r=i.getViewportWidth(0):t._columnViewportIndex===2&&(r=i.getViewportWidth(0)+i.getViewportWidth(1)),s<t._startColumn)for(u=s;u<t._startColumn;u++)r+=i.getColumnWidth(u,3)*o;else for(u=t._startColumn;u<s;u++)r-=i.getColumnWidth(u,3)*o;if(c=i.getColumnWidth(t._startColumn,3),c<t._startColumnOffset&&(t._startColumnOffset=c),r=r+t._startColumnOffset*o,t._rowViewportIndex===0?f=0:t._rowViewportIndex===1?f=i.getViewportHeight(0):t._rowViewportIndex===2&&(f=i.getViewportHeight(0)+i.getViewportHeight(1)),h<t._startRow)for(e=h;e<t._startRow;e++)f+=i.getRowHeight(e,3)*o;else for(e=t._startRow;e<h;e++)f-=i.getRowHeight(e,3)*o;return l=i.getRowHeight(t._startRow,3),l<t._startRowOffset&&(t._startRowOffset=l),f=f+t._startRowOffset*o,new n.Point(r,f)},o.prototype._updateSizeByCoordinate=function(){for(var o,s,i,f,h,c,n=this,r=n._comment,t=r&&r._sheet,l=n._zoomFactor,u=0,e=n._startColumn;e<n._endColumn;e++)u+=t.getColumnWidth(e,3);for(o=t.getColumnWidth(n._startColumn,3),o<n._startColumnOffset&&(n._startColumnOffset=o),s=t.getColumnWidth(n._endColumn,3),s<n._endColumnOffset&&(n._endColumnOffset=s),u=u-n._startColumnOffset+n._endColumnOffset,i=0,f=n._startRow;f<n._endRow;f++)i+=t.getRowHeight(f,3);h=t.getRowHeight(n._startRow,3);h<n._startRowOffset&&(n._startRowOffset=h);c=t.getRowHeight(n._endRow,3);c<n._endRowOffset&&(n._endRowOffset=c);i=i-n._startRowOffset+n._endRowOffset;r.width(u);r.height(i)},o.prototype._updateStartCoordinate=function(){var t=this,v=t._comment,i=v&&v._sheet,f=t._zoomFactor,o,r,l,u,a;if(t._absLocation){var w=t._getViewportRect(t._rowViewportIndex,t._columnViewportIndex),y=i.getViewportLeftColumn(t._columnViewportIndex),p=i.getViewportTopRow(t._rowViewportIndex),e;t._columnViewportIndex===0?e=t._absLocation.x:t._columnViewportIndex===1?e=t._absLocation.x-i.getViewportWidth(0):t._columnViewportIndex===2&&(e=t._absLocation.x-(i.getViewportWidth(0)+i.getViewportWidth(1)));t._rowViewportIndex===0?o=t._absLocation.y:t._rowViewportIndex===1?o=t._absLocation.y-i.getViewportHeight(0):t._rowViewportIndex===2&&(o=t._absLocation.y-(i.getViewportHeight(0)+i.getViewportHeight(1)));var s=new n.Point(e,o),h=0,c=0;for(r=y;r<i.getColumnCount();r++)if(l=i.getColumnWidth(r,3)*f,h+l<s.x)h+=l;else{t._startColumn=r;t._startColumnOffset=(s.x-h)/f;break}for(u=p;u<i.getRowCount();u++)if(a=i.getRowHeight(u,3)*f,c+a<s.y)c+=a;else{t._startRow=u;t._startRowOffset=(s.y-c)/f;break}}},o.prototype._updateEndCoordinate=function(){var t=this,v=t._comment,i=v&&v._sheet,f=t._zoomFactor,o,r,l,u,a;if(t._absLocation){var w=t._getViewportRect(t._rowViewportIndex,t._columnViewportIndex),y=i.getViewportLeftColumn(t._columnViewportIndex),p=i.getViewportTopRow(t._rowViewportIndex),e;t._columnViewportIndex===0?e=t._absLocation.x+t._getActualWidth():t._columnViewportIndex===1?e=t._absLocation.x+t._getActualWidth()-i.getViewportWidth(0):t._columnViewportIndex===2&&(e=t._absLocation.x+t._getActualWidth()-(i.getViewportWidth(0)+i.getViewportWidth(1)));t._rowViewportIndex===0?o=t._absLocation.y+t._getActualHeight():t._rowViewportIndex===1?o=t._absLocation.y+t._getActualHeight()-i.getViewportHeight(0):t._rowViewportIndex===2&&(o=t._absLocation.y+t._getActualHeight()-(i.getViewportHeight(0)+i.getViewportHeight(1)));var s=new n.Point(e,o),h=0,c=0;for(r=y;r<i.getColumnCount();r++)if(l=i.getColumnWidth(r,3)*f,h+l<s.x)h+=l;else{t._endColumn=r;t._endColumnOffset=(s.x-h)/f;break}for(u=p;u<i.getRowCount();u++)if(a=i.getRowHeight(u,3)*f,c+a<s.y)c+=a;else{t._endRow=u;t._endRowOffset=(s.y-c)/f;break}}},o.prototype.addRows=function(n,t){var i=this,r=i._comment;n<=i._startRow?r.dynamicMove()&&(i._startRow+=t,i._endRow+=t):n>i._startRow&&n<=i._endRow&&r.dynamicSize()&&(i._endRow+=t);i._updateSizeByCoordinate();i._updateLocationByCoordinate()},o.prototype.addColumns=function(n,t){var i=this,r=i._comment;n<=i._startColumn?r.dynamicMove()&&(i._startColumn+=t,i._endColumn+=t):n>i._startColumn&&n<=i._endColumn&&r.dynamicSize()&&(i._endColumn+=t);i._updateSizeByCoordinate();i._updateLocationByCoordinate()},o.prototype.removeRows=function(n,t){var i=this,r=i._comment,u=n+t-1;n<i._startRow?u<i._startRow?r.dynamicMove()&&(i._startRow-=t,i._endRow-=t):u<i._endRow&&r.dynamicMove()&&(i._endRow-=r.dynamicSize()?t:i._startRow-n+1,i._startRow=n,i._startRowOffset=0):n<=i._endRow&&(u<i._endRow?r.dynamicSize()&&(i._endRow-=t):r.dynamicSize()&&(i._endRow=n,i._endRowOffset=0));i._updateSizeByCoordinate();i._updateLocationByCoordinate()},o.prototype.removeColumns=function(n,t){var i=this,r=i._comment,u=n+t-1;n<i._startColumn?u<i._startColumn?r.dynamicMove()&&(i._startColumn-=t,i._endColumn-=t):u<i._endColumn&&r.dynamicMove()&&(i._endColumn-=r.dynamicSize()?t:i._startColumn-n+1,i._startColumn=n,i._startColumnOffset=0):n<=i._endColumn&&(u<i._endColumn?r.dynamicSize()&&(i._endColumn-=t):r.dynamicSize()&&(i._endColumn=n,i._endColumnOffset=0));i._updateSizeByCoordinate();i._updateLocationByCoordinate()},o.prototype.updateLayout=function(){var t=this,r=t._comment,i=r._sheet;t.isOpen()&&(t._zoomFactor!==i._zoomFactor?(t._zoomFactor=i._zoomFactor,t._absLocation=t._getLocationByCoordinate()):t._zoomFactor=i._zoomFactor,t._updateCommentViewportIndex(),t._updateIndicatorSize(),t._formatComment(),t._updateLineContainerLayout(),t._updateAdornerLayout(),n.util.browser.chrome&&t._offsetCommentLayoutInChrome())},o.prototype._updateIndicatorSize=function(){var n=this,t=n._comment._sheet,i=t.parent&&t.parent.useTouchLayout();n._hostMargin=i?11:7},o.prototype._updateCommentViewportIndex=function(){var e=this,t=e._comment,n=t&&t._sheet,i=t._rowIndex,r=t._colIndex,u=1,f=1,o=n.frozenRowCount,s=n.frozenColCount,h=n._frozenTrailingRowCount,c=n._frozenTrailingColCount,l=n.getRowCount(),a=n.getColumnCount();i<o?u=0:i>=o&&i<=l-h-1?u=1:i>l-h-1&&(u=2);r<s?f=0:r>=s&&r<=a-c-1?f=1:r>a-c-1&&(f=2);e._rowViewportIndex=u;e._columnViewportIndex=f},o.prototype._formatComment=function(){var n=this,i=n._comment,t=i.commentState()===2?n._editor:n._host;n._formatCommentState();n._formatCommentStyle(t);n._formatCommentText(t);n._formatCommentRect(t);n._formatCommentProtection()},o.prototype._formatCommentText=function(t){var i=this,r=i._comment;t===i._host&&(t.innerHTML=n.StringUtil.escapeHtml(r.text()))},o.prototype._formatCommentRect=function(t){var i=this,e=i._comment,it=e&&e._sheet,v=e.commentState()===2||e.displayMode()===1?i._getAbsLocation():i._absLocation,g=i._zoomFactor,l,y,p,w,b,k,d;if(v){l=i._isResizing?i._getAdjustedCommentRect(v,e.width(),e.height()):i._getAdjustedCommentRect(v);i._adjustCommentRect(l);var o=l.width*g,s=l.height*g,h=l.x,c=l.y,nt=h+o,tt=c+s,a=i._hostMargin,f=i._getViewportRect(i._rowViewportIndex,i._columnViewportIndex);h<f.x?(n.GC$(i._floatBlockCanvas).css("left",h-f.x),n.GC$(i._hostContainer).css("left",h+a-f.x),o+=h-f.x,h=f.x):(n.GC$(i._floatBlockCanvas).css("left",0),n.GC$(i._hostContainer).css("left",a),nt>f.x+f.width&&(o+=f.x+f.width-1-nt));o=u(f.width-1,o);c<f.y?(n.GC$(i._floatBlockCanvas).css("top",c-f.y),n.GC$(i._hostContainer).css("top",c+a-f.y),s+=c-f.y,c=f.y):(n.GC$(i._floatBlockCanvas).css("top",0),n.GC$(i._hostContainer).css("top",a),tt>f.y+f.height&&(s+=f.y+f.height-1-tt));s=u(f.height-1,s);n.GC$(i._floatBlockCanvasContainer).css({left:h,top:c,width:o,height:s});y=o;p=s;n.DPIHelper.setSize(i._floatBlockCanvas,y,p);w=r(0,y-2*(a+e.borderWidth()));b=r(0,p-2*(a+e.borderWidth()));n.GC$(i._hostContainer).css({width:w,height:b});k=w;d=b;e.padding()&&(k-=Math.ceil(parseFloat(e.padding().left)+parseFloat(e.padding().right)),d-=Math.ceil(parseFloat(e.padding().top)+parseFloat(e.padding().bottom)));n.GC$(t).css({width:r(0,k),height:r(0,d)})}},o.prototype._adjustCommentRect=function(t){var r=this,i=r._comment,f=r._absLocation;if(t.x!==f.x||t.y!==f.y||t.width!==i.width()||t.height!==i.height()){var u=r._convertAbsLocationToRelLocation(new n.Point(t.x,t.y)),e=t.width,o=t.height;(u.x!==i.location().x||u.y!==i.location().y)&&(i._location=u);e!==i.width()&&(i._width=e);o!==i.height()&&(i._height=o);r._absLocation=new n.Point(t.x,t.y)}},o.prototype._formatCommentProtection=function(){var n=this,t=n._comment,i=t&&t._sheet;i.canEditComment()?(n._attachFloatBlockCanvasEventHandler(),n._attachHostContainerEventHandler(),n._attachLineCanvasEventHandler(),n._attachHostEventHandler(),n._attachEditorEventHandler()):(t.locked()?(n._detachFloatBlockCanvasEventHandler(),n._attachMouseWheelEvent(n._floatBlockCanvas),n._detachHostContainerEventHandler(),n._attachMouseWheelEvent(n._hostContainer),n._floatBlockCanvas.style.cursor="default",n._hostContainer.style.cursor="default"):(n._attachFloatBlockCanvasEventHandler(),n._attachHostContainerEventHandler()),t.lockText()?(n._detachHostEventHandler(),n._attachMouseWheelEvent(n._host),n._detachEditorEventHandler(),n._attachMouseWheelEvent(n._editor),(t.locked()||t.commentState()!==1)&&t.commentState(3),n._host.style.cursor=t.locked()?"default":"move"):(n._attachHostEventHandler(),n._attachEditorEventHandler()),n._attachLineCanvasEventHandler())},o.prototype._formatCommentState=function(){var r=this,u=r._comment,f=r._commentManager,i=u&&u._sheet;switch(u.commentState()){case 1:f.activateComment(u);r.isEditing()&&r.detachEditor();i.getSelections().length>0&&i._saveAndClearSheetSelections();n.FocusHelper.setActiveElement(i);break;case 2:f.activateComment(u);r.isEditing()||r._attachEditor();i.getSelections().length>0&&i._saveAndClearSheetSelections();n.FocusHelper.setActiveElement(t);break;case 3:u===f.getActiveComment()&&(f.deactivateComment(),i.getSelections().length===0&&i._loadAndSetSheetSelections());break}},o.prototype._formatCommentStyle=function(t){var r=this,i=r._comment,u=n.GC$(t),f;u.css("font-family",i.fontFamily()).css("font-style",i.fontStyle()).css("font-size",parseInt(i.fontSize())*r._zoomFactor+"pt").css("font-weight",i.fontWeight());u.css("text-decoration",n.StyleHelper.composeTextDecoration(i.textDecoration()));u.css("text-align",n.HorizontalAlign[i.horizontalAlign()]);i.padding()?u.css("padding",i.padding().toString()):u.css("padding","0px");u.css("background-color",i.backColor()).css("color",i.foreColor()).css("opacity",i.opacity());n.GC$(r._hostContainer).css("border-width",i.borderWidth()).css("border-style",i.borderStyle()).css("border-color",i.borderColor());f=r._commentManager.getCommentActualZIndex(i);n.GC$(r._lineCanvasContainer).css("z-index",f);n.GC$(r._floatBlockCanvasContainer).css("z-index",f)},o.prototype._offsetCommentLayoutInChrome=function(){var u=this,r=this._comment._sheet,t=n.GC$(u._hostContainer);if(r&&t){var i=r._eventHandler._getCanvasOffset(),f=i.left-Math.floor(i.left)>=.5?.5:0,e=i.top-Math.floor(i.top)>=.5?.5:0;t.css("left",parseFloat(t.css("left"))+f);t.css("top",parseFloat(t.css("top"))+e)}},o.prototype._updateLineContainerLayout=function(){var r=this,w=r._comment,k=w._sheet,b=r._getCellRect(k,w._rowIndex,w._colIndex,r._rowViewportIndex,r._columnViewportIndex),d=k._getSheetLayout(),f=t,tt=b.x+b.width-d.rowHeaderWidth,it=b.y-d.colHeaderHeight;f=new n.Point(tt,it);var e=t,o=n.GC$(r._floatBlockCanvasContainer).position(),s=n.GC$(r._hostContainer).position(),y=n.GC$(r._hostContainer);e=o.left+s.left>f.x?new n.Point(o.left+s.left,o.top+s.top):o.top+s.top+y.height()<f.y?new n.Point(o.left+s.left+y.width(),o.top+s.top+y.height()):new n.Point(o.left+s.left+y.width(),o.top+s.top);var p=r._hostMargin,c=h(f.x-e.x)+2*p,l=h(f.y-e.y)+2*p,a=u(f.x,e.x)-p,v=u(f.y,e.y)-p,g=a+c,nt=v+l,i=r._getViewportRect(r._rowViewportIndex,r._columnViewportIndex);a<i.x&&(c-=i.x-a,a=i.x);g>i.x+i.width&&(c-=g-(i.x+i.width));c=u(i.width,c);v<i.y&&(l-=i.y-v,v=i.y);nt>i.y+i.height&&(l-=nt-(i.y+i.height));l=u(i.height,l);n.GC$(r._lineCanvasContainer).css("left",a).css("top",v).css("width",c).css("height",l);n.DPIHelper.setSize(r._lineCanvas,c,l);f.x=f.x-a;f.y=f.y-v;e.x=e.x-a;e.y=e.y-v;r._drawLine(f,e)},o.prototype._drawLine=function(t,i){var u=this,r,f,e;u._lineCtx||(u._lineCtx=u._lineCanvas.getContext("2d"));r=u._lineCtx;f=u._comment.borderColor();r.strokeStyle=f;r.clearRect(0,0,n.DPIHelper.getLogicWidth(u._lineCanvas),n.DPIHelper.getLogicHeight(u._lineCanvas));r.beginPath();r.moveTo(t.x,t.y);r.lineTo(i.x,i.y);r.stroke();r.save();r.translate(t.x,t.y);r.fillStyle=f;r.beginPath();e=p(i.y-t.y,i.x-t.x);r.rotate(e);r.moveTo(0,0);r.lineTo(7,-4);r.lineTo(7,4);r.lineTo(0,0);r.fill();r.closePath();r.restore()},o.prototype._updateAdornerLayout=function(){var t=this,f=t._comment,h=f._sheet;t._adornerDrawState=t._comment.commentState();t._adornerCtx||(t._adornerCtx=t._floatBlockCanvas.getContext("2d"));var i=t._adornerCtx,r=n.DPIHelper.getLogicWidth(t._floatBlockCanvas),u=n.DPIHelper.getLogicHeight(t._floatBlockCanvas),e=n.GC$(t._hostContainer).outerWidth(),o=n.GC$(t._hostContainer).outerHeight(),s=t._hostMargin;i.clearRect(0,0,r,u);t._comment.showShadow()&&(t._drawShadowAdorner(i,s,e,o),t._drawStateAdorner(i,r,u));h.canEditComment(f)&&t._drawResizeAdorner(i,s,r,u,e,o);i.restore()},o.prototype._drawShadowAdorner=function(n,t,i,r){n.fillRect(t+2,t+2,i,r)},o.prototype._drawStateAdorner=function(n,t,i){var u,r;switch(this._adornerDrawState){case 1:for(n.beginPath(),u=0;u<i;u++)for(r=u%2==0?1:3;r<t;)n.moveTo(r,u),n.lineTo(r+1,u+1),r=r+4;n.stroke();n.closePath();break;case 2:n.beginPath();for(var r=0,u=0,f=4;r<t+i;)n.moveTo(r+f,0),n.lineTo(0,u+f),r=r+f,u=u+f;n.stroke();n.closePath();break;default:}},o.prototype._drawResizeAdorner=function(i,r,u,f,e,o){var h=this,c,l,a,v,y,p,w,b;(h._adornerDrawState===1||h._adornerDrawState===2)&&(h._resizeHitRects.splice(0,h._resizeHitRects.length),c=new n.Rect(0,0,r,r),h._resizeHitRects.push(c),l=new n.Rect(u-r,0,r,r),h._resizeHitRects.push(l),a=new n.Rect(0,f-r,r,r),h._resizeHitRects.push(a),v=new n.Rect(u-r,f-r,r,r),h._resizeHitRects.push(v),o>=3*r?(y=new n.Rect(0,s(f/2-r/2),r,r),h._resizeHitRects.push(y),p=new n.Rect(u-r,s(f/2-r/2),r,r),h._resizeHitRects.push(p)):(h._resizeHitRects.push(t),h._resizeHitRects.push(t)),e>=3*r?(w=new n.Rect(s(u/2-r/2),0,r,r),h._resizeHitRects.push(w),b=new n.Rect(s(u/2-r/2),f-r,r,r),h._resizeHitRects.push(b)):(h._resizeHitRects.push(t),h._resizeHitRects.push(t)),i.save(),i.fillStyle="white",i.strokeStyle="#939393",i.linewidth=1,i.translate(.5,.5),n.GC$.each(h._resizeHitRects,function(){if(h){var n=this,t=n.x,r=n.y,u=n.width,f=n.height;i.beginPath();i.fillRect(t,r,u-1,f-1);i.strokeRect(t,r,u-1,f-1);i.stroke();i.closePath()}}))},o.prototype._drawMoveResizeContainer=function(){var t=this,f=t._commentManager;t._moveResizeContainerDom?n.GC$(t._moveResizeContainerDom).remove():t._moveResizeContainerDom=document.createElement("div");t._moveResizePanelDom?n.GC$(t._moveResizePanelDom).remove():t._moveResizePanelDom=document.createElement("div");var r=n.GC$(t._moveResizePanelDom),e=n.GC$(t._moveResizeContainerDom),o=f._mouseCapture,u=n.GC$(t._hostContainer),i=t._getViewportRect(t._rowViewportIndex,t._columnViewportIndex);r.css({position:"absolute",overflow:"hidden",top:i.y,left:i.x,width:i.width,height:i.height,background:"rgba(255,255,255,0.01)"}).css("z-index",901).bind("mousemove",function(n){t._doMouseMove(n)}).bind("mouseup",function(n){t._doMouseUp(n)});e.addClass("gc-spread-moveResizeContainer").css("position","absolute").css("left",t._absLocation.x+t._hostMargin-i.x).css("top",t._absLocation.y+t._hostMargin-i.y).css("width",u.outerWidth()-2).css("height",u.outerHeight()-2).css("border","gray solid thin");r.append(t._moveResizeContainerDom);t._commentLayoutPanel&&t._commentLayoutPanel.appendChild(t._moveResizePanelDom)},o.prototype._doMoveResizeContainer=function(t){var i=this,a=i._comment,y=a&&a._sheet,k=i._absLocation,o=i._hostMargin,c=i._zoomFactor,p=y._commentManager,e=p._mouseCapture,s,l,r,h;if(e.capture){var v=i._getViewportScrollOffset(),u=t.pageX/c-e.x+v.x,f=t.pageY/c-e.y+v.y;if(u===0&&f===0)return;if(s=i._getViewportRect(i._rowViewportIndex,i._columnViewportIndex),l=n.GC$(i._moveResizeContainerDom),e.resizeDirct==-100){var w=e.cachedRect.x+u,b=e.cachedRect.y+f,h=i._convertRelLocationToAbsLocation(new n.Point(w,b));l.css("left",h.x+o-s.x).css("top",h.y+o-s.y)}else{switch(e.resizeDirct){case 0:r=i._getCommentTopLeftResizeRect(u,f);break;case 1:r=i._getCommentTopRightResizeRect(u,f);break;case 2:r=i._getCommentBottomLeftResizeRect(u,f);break;case 3:r=i._getCommentBottomRightResizeRect(u,f);break;case 4:r=i._getCommentMiddleLeftResizeRect(u);break;case 5:r=i._getCommentMiddleRightResizeRect(u);break;case 6:r=i._getCommentTopCenterResizeRect(f);break;case 7:r=i._getCommentBottomCenterResizeRect(f);break}h=i._convertRelLocationToAbsLocation(new n.Point(r.x,r.y));l.css("left",h.x+o-s.x).css("top",h.y+o-s.y).css("width",r.width*c-2*o-2).css("height",r.height*c-2*o-2)}}},o.prototype._attachEditor=function(){var t=this,r=t._comment,i;t.isEditing()||(i=t._commentManager._editorDom,n.GC$(t._host).remove(),t._detachHostEventHandler(),n.GC$(i).remove(),n.GC$(t._hostContainer).append(i),t._setDomStyle(i),t._formatCommentRect(i),n.GC$(i).focus(),i.selectionStart=i.value.length,t._attachEditorEventHandler(),r.commentState()!==2&&r.commentState(2))},o.prototype.detachEditor=function(){var t=this,i=t._comment,u=i._sheet,r,f;t.isEditing()&&(r=t._commentManager._editorDom,n.GC$(r).remove(),t._detachEditorEventHandler(),n.GC$(t._hostContainer).append(t._host),t._setDomStyle(t._host),t._attachHostEventHandler(),n.features.touch&&(t._touchContentManager=new n.CommentContentTouchManager(t._host,t,u.parent._touchEventProvider),t._touchContentManager.attach()),i.commentState()===2&&i.commentState(3),n.GC$(r).val()!==i.text()&&(f=new n.UndoRedo.CommentPropertyUndoAction(u,i,i.text(),n.GC$(r).val(),"text"),u._doCommand(f)))},o.prototype._getSheetHeight=function(n,r){var o=this,u,e,f;if(n===t||n===i)return-1;for(u=0,e=n.getRowCount(),f=0;f<e;f++)if(u+=n.getRowHeight(f,3),u>r)break;return u},o.prototype._getSheetWidth=function(n,r){var u,e,f;if(n===t||n===i)return-1;for(u=0,e=n.getColumnCount(),f=0;f<e;f++)if(u+=n.getColumnWidth(f,3),u>r)break;return u},o.prototype._getViewportHeight=function(n){var r=this,u=r._comment,t=u&&u._sheet,i;if(n===0||n===2)return t.getViewportHeight(n);else if(n===1){var e=t.getViewportBottomRow(0)+1,o=t.getViewportTopRow(2),f=0;for(i=e;i<=o;i++)f+=t.getRowHeight(i,3)*r._zoomFactor;return f}return-1},o.prototype._getViewportWidth=function(n){var r=this,u=r._comment,t=u&&u._sheet,i;if(n===0||n===2)return t.getViewportWidth(n);else if(n===1){var e=t.getViewportRightColumn(0)+1,o=t.getViewportLeftColumn(2),f=0;for(i=e;i<=o;i++)f+=t.getColumnWidth(i,3)*r._zoomFactor;return f}return-1},o.prototype._getTwoColumnDistance=function(n,t,i){for(var o=u(t,i),s=r(t,i),e=0,f=o;f<s;f++)e+=n.getColumnWidth(f,3)*this._zoomFactor;return e},o.prototype._getTwoRowDistance=function(n,t,i){for(var o=u(t,i),s=r(t,i),e=0,f=o;f<s;f++)e+=n.getRowHeight(f,3)*this._zoomFactor;return e},o.prototype._getViewportRect=function(t,i){var f=this,e=f._comment,o=e._sheet,s=f._commentManager,h=s.getCommentView(e),r=o._getSheetLayout(),u=new n.Rect(0,0,0,0);return u=r.viewportRect(t,i),t===0&&i===0||t===0&&i===2||t===2&&i===0||t===2&&i===2?(u.x=0,u.y=0,u.width=r.frozenWidth+r.viewportWidth+r.frozenTrailingWidth,u.height=r.frozenHeight+r.viewportHeight+r.frozenTrailingHeight):t===0&&i===1||t===2&&i===1?(u.x=r.frozenWidth,u.y=0,u.width=r.viewportWidth,u.height=r.frozenHeight+r.viewportHeight+r.frozenTrailingHeight):t===1&&i===0||t===1&&i===2?(u.x=0,u.y=r.frozenHeight,u.width=r.frozenWidth+r.viewportWidth+r.frozenTrailingWidth,u.height=r.viewportHeight):t===1&&i===1&&(u.x=r.frozenWidth,u.y=r.frozenHeight,u.width=r.viewportWidth,u.height=r.viewportHeight),u},o.prototype._setDomStyle=function(t){var r=this,i=r._comment,u=n.GC$(t);(t===r._editor||t===r._host)&&(t===r._editor?t.value=i.text():t.innerHTML=n.StringUtil.escapeHtml(i.text()),u.css("font-family",i.fontFamily()).css("font-style",i.fontStyle()).css("font-size",i.fontSize()).css("font-weight",i.fontWeight()).css("color",i.foreColor()).css("background-color",i.backColor()).css("text-align",i.horizontalAlign()).css("text-decoration",i.textDecoration()),i.padding()?u.css("padding",i.padding().toString()):u.css("padding","0px"))},o.prototype.isOpen=function(){var n=this;return n._floatBlockCanvasContainer&&n._floatBlockCanvasContainer.parentNode?!0:!1},o.prototype.isActive=function(){var n=this;return n.isOpen()&&n._comment===n._commentManager.getActiveComment()?!0:!1},o.prototype.isEditing=function(){var t=this;return t.isActive()?n.GC$(t._hostContainer).find("textarea").length()>0:!1},o.prototype.getCommentRect=function(){var i=this,u=i._comment,e=u&&u._sheet,o=i._zoomFactor,f=t,r;return i.isOpen()&&(r=i._comment._sheet._getSheetLayout(),f=new n.Rect(i._absLocation.x+r.headerX+r.rowHeaderWidth,i._absLocation.y+r.headerY+r.colHeaderHeight,i._getActualWidth(),i._getActualHeight())),f},o.prototype.getCommentEditAreaRect=function(){var i=this,u=i._comment,a=u&&u._sheet,o=i._zoomFactor,r,s,h,c,l,f,e;return i.isOpen()&&(r=i.getCommentRect(),r)?(f=(i._hostMargin+u.borderWidth())*o,e=(i._hostMargin+u.borderWidth())*o,s=r.x+f,h=r.y+e,c=r.width-2*f,l=r.height-2*e,new n.Rect(s,h,c,l)):t},o.prototype._setCursorState=function(n){var i=this,r=i._comment,u=r._sheet,t=n.target,f=i._commentManager._mouseCapture,e;if(f.capture){(t.className===i._hostClassName||t.className===i._floatBlockCanvasClassName||t.className===i._lineCanvasClassName||t.className==="gc-spread-floatPanel")&&(t.style.cursor=f.resizeDirct>=0?"crosshair":"move");return}else{if(t.className===i._hostClassName)if(!u.canEditComment()&&r.lockText()){t.style.cursor=r.locked()?"default":"move";return}else{t.style.cursor="text";return}if(t.className===i._floatBlockCanvasClassName||t.className===i._hostContainerClassName)if(u.canEditComment(r)){e=i._getResizeDirection(n);switch(e){case 0:t.style.cursor="nw-resize";return;case 1:t.style.cursor="ne-resize";return;case 2:t.style.cursor="sw-resize";return;case 3:t.style.cursor="se-resize";return;case 4:t.style.cursor="w-resize";return;case 5:t.style.cursor="e-resize";return;case 6:t.style.cursor="n-resize";return;case 7:t.style.cursor="s-resize";return;default:t.style.cursor="move";return}}else{t.style.cursor="default";return}}t.style.cursor="default"},o.prototype._doMouseDownToEdit=function(t){var i=this,r=i._comment,u=r&&r._sheet;if(u.endEdit()){if(u.unSelectAllFloatingObjects(),i._touchContentManager&&!t.isTouch&&i._touchContentManager.preProcessMouseDown(t)){n.util.cancelDefault(t);return}return i._commentManager.activateComment(r),r.commentState(2),i._doMouseUp(t),n.util.cancelDefault(t)}},o.prototype._doMouseDownToDragOrResize=function(t){var i=this,r=i._comment,u=r&&r._sheet,h=i._zoomFactor,c=i._commentManager,f=c._mouseCapture;if(u.endEdit()){if(u.unSelectAllFloatingObjects(),i._touchManager&&!t.isTouch&&i._touchManager.preProcessMouseDown(t)){n.util.cancelDefault(t);return}f.x=t.pageX/h;f.y=t.pageY/h;f.cachedRect=new n.Rect(r.location().x,r.location().y,r.width(),r.height());f.resizeDirct=i._getResizeDirection(t);i._handleDocumentMouseMove();f.capture=!0;i._setCursorState(t);c.activateComment(r);r.commentState(1);u.canEditComment(r)&&(i._moveInfo={},i._moveInfo.startTopRow=u.getViewportTopRow(i._rowViewportIndex),i._moveInfo.startLeftColumn=u.getViewportLeftColumn(i._columnViewportIndex),i._drawMoveResizeContainer(),f.resizeDirct===-100?i._isMoving=!0:i._isResizing=!0);var e=u._eventHandler,l=e._getCanvasOffset(),o=new n.Point(t.pageX-l.left,t.pageY-l.top),s=u.hitTest(o.x,o.y);e.startHitInfo={scrollRowViewportIndex:s.rowViewportIndex,scrollColViewportIndex:s.colViewportIndex,hitTestType:s.hitTestType};e.mousePosition=o;e.startScroll();e.isCommentWorking=!0;t.stopPropagation()}},o.prototype._getAdjustedCommentRect=function(t,i,r){var u=this,p=u._comment,o=p&&p._sheet,w=u._hostMargin,vt=u._commentManager,it=u._zoomFactor,k=u._columnViewportIndex,d=u._rowViewportIndex,ft=u._getViewportRect(d,k),a,g,ot,st,ht,ct,lt,at,rt;arguments.length===1?(a=u._getActualWidth(),g=u._getActualHeight()):arguments.length===3&&(a=i*it,g=r*it);var f=t.x,v=t.y,tt=o._getSheetLayout(),et=u._getCellRect(o,0,0,d,k),b=t.x+(0-(et.x-tt.rowHeaderWidth))+a-w,nt=t.y+(0-(et.y-tt.colHeaderHeight))+g-w,e,c,l,y;if(k===0?(e=0-w,l=tt.width-tt.rowHeaderWidth):k===1?(ot=u._getTwoColumnDistance(o,o.getViewportRightColumn(0)+1,o.getViewportLeftColumn(1)),e=ft.x-w-ot,st=u._getViewportWidth(2),l=-st):k===2&&(e=0-w,l=0),f<e&&(u._isResizing?a-=e-f:b+=e-f,f=e),(k===1||k===2)&&(l+=u._getSheetWidth(o,b)),b>l)if(u._isResizing)a-=b-l;else if(u._isMoving)f-=b-l;else{var s=0,yt=p===vt.getHoverShownComment()&&!p.ignoreDefaultLocation()?p._defaultLocation.x:p.location().x,ut=2*h(yt)+o.getColumnWidth(p._colIndex)+p.width();s=f-ut;s>e?f=s:f<l?a-=b-l:(s=f-ut,ht=b-ut,ht>e?s<e?(a-=e-s,f=e):f=s:(s=f-(b-l),s<e?(a-=e-s,f=e):f=s))}return d===0?(c=0-w,y=tt.height-tt.colHeaderHeight):d===1?(ct=u._getTwoRowDistance(o,o.getViewportBottomRow(0)+1,o.getViewportTopRow(1)),c=ft.y-w-ct,lt=u._getViewportHeight(2),y=lt):d===2&&(c=0-w,y=0),v<c&&(u._isResizing?g-=c-v:nt+=c-v,v=c),(d===1||d===2)&&(y+=u._getSheetHeight(o,nt)),nt>y&&(u._isResizing?g-=nt-y:u._isMoving?v-=nt-y:nt>y&&(at=nt-y,rt=v-at,rt<c?(g-=c-rt,v=c):v=rt)),new n.Rect(f,v,a/it,g/it)},o.prototype._getViewportScrollOffset=function(){var t=this,i=t._comment._sheet,r,u,f=t._moveInfo.startTopRow,e=t._moveInfo.startLeftColumn,o=i.getViewportTopRow(t._rowViewportIndex),s=i.getViewportLeftColumn(t._columnViewportIndex),h=t._getTwoRowDistance(i,f,o),c=t._getTwoColumnDistance(i,e,s);return r=e<s?c:-c,u=f<o?h:-h,new n.Point(r,u)},o.prototype._doMoveResizeComment=function(t){var i=this,r=i._comment,s=r&&r._sheet,a=i._zoomFactor,p=s._commentManager,h=p._mouseCapture,u;if(h.capture){var v=i._getViewportScrollOffset(),f=t.pageX/a-h.x+v.x,e=t.pageY/a-h.y+v.y;if(f===0&&e===0)return;if(h.resizeDirct==-100){var w=h.cachedRect.x+f,b=h.cachedRect.y+e,y=i._convertRelLocationToAbsLocation(new n.Point(w,b)),o=i._getAdjustedCommentRect(y),c=i._convertAbsLocationToRelLocation(new n.Point(o.x,o.y));(c.x!==r.location().x||c.x!==r.location().y)&&s._doCommand(new n.UndoRedo.CommentPropertyUndoAction(s,r,r.location().clone(),c,"location"))}else{r._autoSize=!1;switch(h.resizeDirct){case 0:u=i._getCommentTopLeftResizeRect(f,e);break;case 1:u=i._getCommentTopRightResizeRect(f,e);break;case 2:u=i._getCommentBottomLeftResizeRect(f,e);break;case 3:u=i._getCommentBottomRightResizeRect(f,e);break;case 4:u=i._getCommentMiddleLeftResizeRect(f);break;case 5:u=i._getCommentMiddleRightResizeRect(f);break;case 6:u=i._getCommentTopCenterResizeRect(e);break;case 7:u=i._getCommentBottomCenterResizeRect(e);break}var y=i._convertRelLocationToAbsLocation(new n.Point(u.x,u.y)),o=i._getAdjustedCommentRect(y,u.width,u.height),c=i._convertAbsLocationToRelLocation(new n.Point(o.x,o.y)),l=new n.UndoRedo.CommentUndoTransaction;(c.x!==r.location().x||c.y!==r.location().y)&&l.add(new n.UndoRedo.CommentPropertyUndoAction(s,r,r.location().clone(),c,"location"));o.width!==r.width()&&l.add(new n.UndoRedo.CommentPropertyUndoAction(s,r,r.width(),o.width,"width"));o.height!==r.height()&&l.add(new n.UndoRedo.CommentPropertyUndoAction(s,r,r.height(),o.height,"height"));s._doCommand(l)}}},o.prototype._doMouseMove=function(t){var i=this,u=i._comment._sheet;if(this._setCursorState(t),!u.getSelections()||!(u.getSelections().length>0)){if(i._touchManager&&!t.isTouch&&i._touchManager.preProcessMouseMove(t)){n.util.cancelDefault(t);return}if(i._touchContentManager&&!t.isTouch&&i._touchContentManager.preProcessMouseMove(t)){n.util.cancelDefault(t);return}var o=i._commentManager,s=t.target,r=u._eventHandler,f=r._getCanvasOffset(),e=new n.Point(t.pageX-f.left,t.pageY-f.top);return s&&o._mouseCapture.capture&&(i._moveResizeContainerDom&&i._doMoveResizeContainer(t),i._rowViewportIndex===1&&(r.mousePosition.y=e.y),i._columnViewportIndex===1&&(r.mousePosition.x=e.x),r.continueScroll()),n.util.cancelDefault(t)}},o.prototype._doMouseUp=function(t){var i=this,r=i._comment._sheet;if(!r.getSelections()||!(r.getSelections().length>0)){if(i._touchManager&&!t.isTouch&&i._touchManager.preProcessMouseUp(t)){n.util.cancelDefault(t);return}if(i._touchContentManager&&!t.isTouch&&i._touchContentManager.preProcessMouseUp(t)){n.util.cancelDefault(t);return}var f=t.target,e=i._commentManager,u=r._eventHandler;return u.isCommentWorking=!1,u.stopScroll(),f&&(i._doMoveResizeComment(t),i._moveResizePanelDom&&(n.GC$(i._moveResizePanelDom).remove(),i._moveResizePanelDom=null,i._isMoving=!1,i._isResizing=!1),i._unhandleDocumentMouseMove(),e._mouseCapture.capture=!1,i._setCursorState(t)),n.util.cancelDefault(t)}},o.prototype._getResizeDirection=function(t){var r=this;if(r._resizeHitRects.length>0&&(r._adornerDrawState===1||r._adornerDrawState===2)){var e=t.target,u=t.pageX-n.GC$(e).offset().left,f=t.pageY-n.GC$(e).offset().top,i=r._resizeHitRects[0];if(i&&i.contains(u,f))return 0;if(i=r._resizeHitRects[1],i&&i.contains(u,f))return 1;if(i=r._resizeHitRects[2],i&&i.contains(u,f))return 2;if(i=r._resizeHitRects[3],i&&i.contains(u,f))return 3;if(i=r._resizeHitRects[4],i&&i.contains(u,f))return 4;if(i=r._resizeHitRects[5],i&&i.contains(u,f))return 5;if(i=r._resizeHitRects[6],i&&i.contains(u,f))return 6;if(i=r._resizeHitRects[7],i&&i.contains(u,f))return 7}return-100},o.prototype._getCommentTopLeftResizeRect=function(t,i){var r=this,f,e,o,s,u=r._commentManager._mouseCapture,h=u.cachedRect.width-2*r._hostMargin-t,c=u.cachedRect.height-2*r._hostMargin-i;return h>=0?(f=u.cachedRect.x+t,o=h+2*r._hostMargin):(f=u.cachedRect.x+u.cachedRect.width-2*r._hostMargin,o=-h+2*r._hostMargin),c>=0?(e=u.cachedRect.y+i,s=c+2*r._hostMargin):(e=u.cachedRect.y+u.cachedRect.height-2*r._hostMargin,s=-c+2*r._hostMargin),new n.Rect(f,e,o,s)},o.prototype._getCommentTopRightResizeRect=function(t,i){var r=this,e,o,s,h,u=r._commentManager._mouseCapture,f=u.cachedRect.width-2*r._hostMargin+t,c=u.cachedRect.height-2*r._hostMargin-i;return f>=0?(e=u.cachedRect.x,s=f+2*r._hostMargin):(e=u.cachedRect.x+f,s=-f+2*r._hostMargin),c>=0?(o=u.cachedRect.y+i,h=c+2*r._hostMargin):(o=u.cachedRect.y+u.cachedRect.height-2*r._hostMargin,h=-c+2*r._hostMargin),new n.Rect(e,o,s,h)},o.prototype._getCommentBottomLeftResizeRect=function(t,i){var r=this,e,o,s,h,u=r._commentManager._mouseCapture,c=u.cachedRect.width-2*r._hostMargin-t,f=u.cachedRect.height-2*r._hostMargin+i;return c>=0?(e=u.cachedRect.x+t,s=c+2*r._hostMargin):(e=u.cachedRect.x+u.cachedRect.width-2*r._hostMargin,s=-c+2*r._hostMargin),f>=0?(o=u.cachedRect.y,h=f+2*r._hostMargin):(o=u.cachedRect.y+f,h=-f+2*r._hostMargin),new n.Rect(e,o,s,h)},o.prototype._getCommentBottomRightResizeRect=function(t,i){var r=this,o,s,h,c,u=r._commentManager._mouseCapture,f=u.cachedRect.width-2*r._hostMargin+t,e=u.cachedRect.height-2*r._hostMargin+i;return f>=0?(o=u.cachedRect.x,h=f+2*r._hostMargin):(o=u.cachedRect.x+f,h=-f+2*r._hostMargin),e>=0?(s=u.cachedRect.y,c=e+2*r._hostMargin):(s=u.cachedRect.y+e,c=-e+2*r._hostMargin),new n.Rect(o,s,h,c)},o.prototype._getCommentMiddleLeftResizeRect=function(t){var r=this,u,o,f,s,i=r._commentManager._mouseCapture,e=i.cachedRect.width-2*r._hostMargin-t;return e>=0?(u=i.cachedRect.x+t,f=e+2*r._hostMargin):(u=i.cachedRect.x+i.cachedRect.width-2*r._hostMargin,f=-e+2*r._hostMargin),o=i.cachedRect.y,s=i.cachedRect.height,new n.Rect(u,o,f,s)},o.prototype._getCommentMiddleRightResizeRect=function(t){var r=this,f,o,e,s,i=r._commentManager._mouseCapture,u=i.cachedRect.width-2*r._hostMargin+t;return u>=0?(f=i.cachedRect.x,e=u+2*r._hostMargin):(f=i.cachedRect.x+u,e=-u+2*r._hostMargin),o=i.cachedRect.y,s=i.cachedRect.height,new n.Rect(f,o,e,s)},o.prototype._getCommentTopCenterResizeRect=function(t){var r=this,o,u,s,f,i=r._commentManager._mouseCapture,e=i.cachedRect.height-2*r._hostMargin-t;return o=i.cachedRect.x,s=i.cachedRect.width,e>=0?(u=i.cachedRect.y+t,f=e+2*r._hostMargin):(u=i.cachedRect.y+i.cachedRect.height-2*r._hostMargin,f=-e+2*r._hostMargin),new n.Rect(o,u,s,f)},o.prototype._getCommentBottomCenterResizeRect=function(t){var r=this,o,f,s,e,i=r._commentManager._mouseCapture,u=i.cachedRect.height-2*r._hostMargin+t;return o=i.cachedRect.x,s=i.cachedRect.width,u>=0?(f=i.cachedRect.y,e=u+2*r._hostMargin):(f=i.cachedRect.y+u,e=-u+2*r._hostMargin),new n.Rect(o,f,s,e)},o.prototype._attachMouseWheelEvent=function(t){var r=this,o=this._comment._sheet,i,u;if(t){i="";switch(t){case r._floatBlockCanvas:i=".floatBlockCanvas";case r._hostContainer:i=".hostContainer";case r._lineCanvasContainer:i=".lineCanvasContainer";case r._host:i=".host";case r._editor:i=".editor"}i&&(n.GC$(t).unbind(f+i).unbind(e+i),u=function(t){o._mouseWheelDelegate(t);n.util.cancelDefault(t)},n.GC$(t).bind(f+i,u).bind(e+i,u))}},o.prototype._attachFloatBlockCanvasEventHandler=function(){var t=this,r=t._comment,o=r&&r&&r._sheet,i,u;t._detachFloatBlockCanvasEventHandler();i=".floatBlockCanvas";u=function(n){o&&o._mouseWheelDelegate(n)};n.GC$(t._floatBlockCanvas).bind("mousedown"+i,function(n){t._doMouseDownToDragOrResize(n)}).bind("mousemove"+i,function(n){t._doMouseMove(n)}).bind("mouseup"+i,function(n){t._doMouseUp(n)}).bind(f+i,u).bind(e+i,u)},o.prototype._detachFloatBlockCanvasEventHandler=function(){var t=this;n.GC$(t._floatBlockCanvas).unbind(".floatBlockCanvas")},o.prototype._attachHostContainerEventHandler=function(){var t=this,u=t._comment,o=u&&u._sheet,i,r;t._detachHostContainerEventHandler();i=".hostContainer";r=function(n){o&&o._mouseWheelDelegate(n)};n.GC$(t._hostContainer).bind("mousedown"+i,function(n){t._doMouseDownToDragOrResize(n)}).bind("mousemove"+i,function(n){t._doMouseMove(n)}).bind("mouseup"+i,function(n){t._doMouseUp(n)}).bind(f+i,r).bind(e+i,r)},o.prototype._detachHostContainerEventHandler=function(){var t=this;n.GC$(t._hostContainer).unbind(".hostContainer")},o.prototype._attachLineCanvasEventHandler=function(){var i=this,s=i._comment,t=s&&s._sheet,o=t._commentManager;if(i._detachLineCanvasEventHandler(),t){var r=t._eventHandler._getCanvasOffset(),u=".lineCanvas",h=function(n){t._mouseWheelDelegate(n)};n.GC$(i._lineCanvas).bind("mousedown"+u,function(u){var h=t.hitTest(u.pageX-r.left,u.pageY-r.top),f=h.commentHitInfo,s,e;f?(s=f.comment,e=o.getCommentView(s),f.area==="editArea"?e._doMouseDownToEdit(u):f.area==="moveResizeArea"&&e._doMouseDownToDragOrResize(u),n.GC$(e._floatBlockCanvasContainer).css("z-index",parseInt(n.GC$(i._lineCanvasContainer).css("z-index")+1))):t._mouseDownDelegate(u)}).bind("mousemove"+u,function(n){var h=t.hitTest(n.pageX-r.left,n.pageY-r.top),u=h.commentHitInfo,e,s,f;u?(e=u.comment,s=o.getCommentView(e),s._doMouseMove(n),u.area==="editArea"?i._lineCanvas.style.cursor="text":u.area==="moveResizeArea"&&(i._lineCanvas.style.cursor="move")):(t._mouseMoveDelegate(n),f=t._getCanvas(),f&&(i._lineCanvas.style.cursor=f.style.cursor))}).bind("mouseup"+u,function(n){var e=t.hitTest(n.pageX-r.left,n.pageY-r.top),i=e.commentHitInfo,u,f;i?(u=i.comment,f=o.getCommentView(u),f._doMouseUp(n)):t._mouseUpDelegate(n)}).bind("dblclick"+u,function(n){t._dblClickDelegate(n)}).bind(f+u,h).bind(e+u,h)}},o.prototype._detachLineCanvasEventHandler=function(){var t=this;n.GC$(t._lineCanvas).unbind(".lineCanvas")},o.prototype._attachHostEventHandler=function(){var t=this,r=t._comment,o=r&&r._sheet,i,u;r.commentState()!==2&&t._host&&(t._detachHostEventHandler(),i=".host",u=function(n){o&&o._mouseWheelDelegate(n)},n.GC$(t._host).bind("mousedown"+i,function(n){t._doMouseDownToEdit(n)}).bind("mousemove"+i,function(n){t._doMouseMove(n)}).bind("mouseup"+i,function(n){t._doMouseUp(n)}).bind(f+i,u).bind(e+i,u))},o.prototype._detachHostEventHandler=function(){var t=this,i=t._comment;i.commentState()!==2&&t._host&&n.GC$(t._host).unbind(".host")},o.prototype._attachEditorEventHandler=function(){var r=this,i=r._comment,u=i&&i._sheet,s=r._editor,t,o;i.commentState()===2&&s&&(this._detachEditorEventHandler(),t=".editor",o=function(n){u&&u._mouseWheelDelegate(n)},n.GC$(s).bind("mousedown"+t,function(n){n.stopPropagation()}).bind("mousemove"+t,function(n){n.stopPropagation()}).bind("mouseup"+t,function(n){n.stopPropagation()}).bind(f+t,o).bind(e+t,o).bind("input"+t,function(n){i.autoSize()&&r._doAutosize()}).bind("keydown"+t,function(t){(t.keyCode===27||t.keyCode===9)&&(i.commentState(1),n.util.cancelDefault(t),n.FocusHelper.setActiveElement(u))}))},o.prototype._doAutosize=function(){var e=this,t=e._comment,a=t&&t._sheet,i,u,y,p,c,l,w,b,k;t.commentState()===2?(i=e._editor,u=i.value.split("\n")):(i=e._host,u=n.StringUtil.unescapeHtml(i.innerHTML).split("\n"));var d=n.GC$(i).height(),g=n.GC$(i).width(),o,s,h=0,v=i.style,f="";if(v.font?(h=a._getFontHeight(v.font),f+=v.font):(t.fontStyle()&&(f+=" "+t.fontStyle()),t.fontWeight()&&(f+=" "+t.fontWeight()),t.fontSize()&&(f+=" "+t.fontSize()),t.fontFamily()&&(f+=" "+t.fontFamily()),h=a._getFontHeight(f)),y=h,p=5,u&&u.length>0){for(o=r(u.length*h,y),c=0,l=0;l<u.length;l++)w=a._getStringWidth(u[l],f),c<w&&(c=w);s=r(c,p)}else o=y,s=p;n.GC$(i).css("height",o).css("width",s);t.commentState()===2&&(t._text=i.value);e._isAutosizing=!0;b=o-d;b!==0&&t._changeProperty("height",t.height()+b);k=s-g;k!==0&&t._changeProperty("width",t.width()+k);e._isAutosizing=!1},o.prototype._detachEditorEventHandler=function(){var t=this,r=t._comment,i=t._editor;r.commentState()===2&&i&&n.GC$(i).unbind(".editor")},o.prototype._handleDocumentMouseMove=function(){var i=this,r=this._commentManager._mouseCapture,t;r.capture||(t=".gcComment",n.GC$(document).bind("mousemove"+t,function(n){i._doMouseMove(n)}).bind("mouseup"+t,function(n){i._doMouseUp(n)}),r.capture=!0)},o.prototype._unhandleDocumentMouseMove=function(){var t=this._commentManager._mouseCapture;t.capture&&(t.capture=!1,n.GC$(document).unbind(".gcComment"))},o}();n.CommentView=l;v=function(){function r(n){var i=this;i._sheet=n;i._mouseCapture={capture:!1,x:0,y:0,cachedRect:t,resizeDirct:-100};i._editorDom=t;i._hoverShowComment=t;i._activeComment=t;i._commentList=[];i._commentViewList=[];i.createEditDom();i._bindEventsOnSheet()}return r.prototype.createEditDom=function(){var t=document.createElement("textarea");n.GC$(t).addClass("gc-comment-editor").css("left",0).css("top",0).css("position","absolute").css("margin",0).css("padding",0).css("word-wrap","break-word").css("word-break","normal").css("overflow","hidden").css("resize","none").css("outline","none").css("border","0px").css("box-sizing","content-box").attr("autocomplete","off").attr("gcUIElement","gcEditingInput");this._editorDom=t},r.prototype.getCommentList=function(){for(var t=this,i=[],n=0;n<t._commentList.length;n++)i.push(t._commentList[n]);return i},r.prototype.getHoverShownComment=function(){return this._hoverShowComment},r.prototype._bindEventsOnSheet=function(){var t=this,i=t._sheet;i&&(i._bind(n.Events.ColumnChanged,function(n,i){var r=i.propertyName;(r==="width"||r==="isVisible")&&t._updateCommentsLayoutWhenRowColumnChanged()}),i._bind(n.Events.RowChanged,function(n,i){var r=i.propertyName;(r==="height"||r==="isVisible")&&t._updateCommentsLayoutWhenRowColumnChanged()}),i._bind(n.Events.ColumnWidthChanged,function(n,i){t._updateCommentsLayoutWhenRowColumnChanged()}),i._bind(n.Events.RowHeightChanged,function(n,i){t._updateCommentsLayoutWhenRowColumnChanged()}),i._bind(n.Events.CommentChanged,function(n,i){var e;if(i){var u=i.propertyName,f=i.comment,r=t.getCommentView(f);r&&(e=["autoSize","text","fontFamily","fontStyle","fontSize","fontWeight","padding"],u==="location"?r.updateLayoutWhenLocationChanged():u==="width"||u==="height"?r.updateLayoutWhenWidthHeightChanged():e.indexOf(u)>=0&&f.autoSize()&&!r._isAutosizing&&r._doAutosize())}}))},r.prototype._addCommentView=function(t){var i=this;t&&n.ArrayHelper.indexOf(i._commentViewList,t)===-1&&this._commentViewList.push(t)},r.prototype._removeCommentView=function(t){this._commentViewList.splice(n.ArrayHelper.indexOf(this._commentViewList,t),1)},r.prototype.getCommentView=function(n){var i,r;if(!n)return t;for(i=0;i<this._commentViewList.length;i++)if(r=this._commentViewList[i],r.getComment()===n)return r;return t},r.prototype.hasComment=function(){return this._commentList.length>0},r.prototype.addComment=function(n,t,i){var r=this;i&&!r.containsComment(i)&&(i._sheet=r._sheet,i._rowIndex=n,i._colIndex=t,i._zIndex=898,r._updateCommentZIndex(),r._commentList.push(i),r._sheet.invalidate())},r.prototype._updateCommentZIndex=function(){for(var i=this,t=i._commentList,n=0;n<t.length;n++)t[n]._zIndex--},r.prototype._getTopCommentZIndex=function(){var n=this,t,i,r;if(n._commentList.length>0){for(t=n._commentList[0].zIndex(),i=1;i<n._commentList.length;i++)r=n._commentList[i],t<r.zIndex()&&(t=r.zIndex());return t}return 0},r.prototype.removeComment=function(t){var i=this,u=i._commentList,r;t&&(i.hideComment(t),u.splice(n.ArrayHelper.indexOf(u,t),1),r=i.getCommentView(t),r&&i._removeCommentView(r))},r.prototype.containsComment=function(t){var i=this;return n.ArrayHelper.indexOf(i._commentList,t)!==-1?!0:!1},r.prototype.clear=function(n,i,r,u){var h=this,f=h._sheet,c=f.isPaintSuspended(),e,o,s;for(f.isPaintSuspended(!0),e=0;e<r;e++)for(o=0;o<u;o++)s=f.getComment(e+n,o+i),s&&(h.removeComment(s),f.setComment(e+n,o+i,t));f.isPaintSuspended(c)},r.prototype.addRows=function(n,t){for(var r,u,f=this,e=f._commentList,o=f._commentViewList,i=0;i<e.length;i++)r=e[i],n<=r._rowIndex&&(r._rowIndex+=t);for(i=0;i<o.length;i++)u=o[i],u.isOpen()&&u.addRows(n,t)},r.prototype.addColumns=function(n,t){for(var r,u,f=this,e=f._commentList,o=f._commentViewList,i=0;i<e.length;i++)r=e[i],n<=r._colIndex&&(r._colIndex+=t);for(i=0;i<o.length;i++)u=o[i],u.isOpen()&&u.addColumns(n,t)},r.prototype.removeRows=function(n,t){for(var r,e,f=this,u=f._commentList,o=f._commentViewList,i=0;i<u.length;i++)r=u[i],r._rowIndex>=n&&r._rowIndex<n+t&&(f.removeComment(r),i--);for(i=0;i<u.length;i++)r=u[i],n<r._rowIndex&&(r._rowIndex-=t);for(i=0;i<o.length;i++)e=o[i],e.isOpen()&&e.removeRows(n,t)},r.prototype.removeColumns=function(n,t){for(var r,e,f=this,u=f._commentList,o=f._commentViewList,i=0;i<u.length;i++)r=u[i],r._colIndex>=n&&r._colIndex<n+t&&(f.removeComment(r),i--);for(i=0;i<u.length;i++)r=u[i],n<r._colIndex&&(r._colIndex-=t);for(i=0;i<o.length;i++)e=o[i],e.isOpen()&&e.removeColumns(n,t)},r.prototype.getActiveComment=function(){return this._activeComment},r.prototype.activateComment=function(n){var t=this;n&&n!==t._activeComment&&(t.deactivateComment(),t._activeComment=n)},r.prototype.deactivateComment=function(){var i=this,r=i._activeComment,n;r&&(n=i.getCommentView(r),!n||n._isMoving||n._isResizing||(n.isEditing()&&n.detachEditor(),r.commentState(3),i._activeComment=t))},r.prototype.showComment=function(n){var i=this,t,r;n&&(t=i.getCommentView(n),r=!1,t||(r=!0,t=new l(n,i),i._addCommentView(t)),t.open(),r&&n.autoSize()&&!t._isAutosizing&&t._doAutosize())},r.prototype.showAllComments=function(){for(var n=0;n<this._commentList.length;n++)this.showComment(this._commentList[n])},r.prototype.showCommentLayoutPanel=function(){var t=this._sheet;n.GC$(t._commentRender._commentLayoutPanel).show()},r.prototype.hideComment=function(n){var i=this,r=i.getCommentView(n);r&&r.isOpen()&&(r.close(),n===i._activeComment&&i._sheet._loadAndSetSheetSelections());clearTimeout(n._timeout);n._timeout=t},r.prototype.hideAllComments=function(){for(var n=0;n<this._commentList.length;n++)this.hideComment(this._commentList[n])},r.prototype.hideCommentLayoutPanel=function(){var t=this._sheet;n.GC$(t._commentRender._commentLayoutPanel).hide()},r.prototype.hoverShowComment=function(n){var i=this,r=i._activeComment;if(r)if(r.displayMode()===1){if(r.commentState()===2)return}else if(r.commentState()===2||r.commentState()===1)return;n!==i._hoverShowComment&&(i._hoverShowComment&&i.hideComment(i._hoverShowComment),n&&n.displayMode()==2?i._mouseCapture.capture||n._timeout||(i._hoverShowComment=n,n._timeout=setTimeout(function(){i.showComment(n)},200)):i._hoverShowComment=t)},r.prototype._isHitTestComment=function(n,t,i){var u=this.getCommentView(n),r;return u&&(r=u.getCommentRect(),r)?r.contains(t,i):!1},r.prototype._isHitTestCommentEditArea=function(n,t,i){var u=this.getCommentView(n),r;return u&&(r=u.getCommentEditAreaRect(),r)?r.contains(t,i):!1},r.prototype.getCommentHitInfo=function(n,i){for(var u,f=this,r=t,e=0;e<f._commentList.length;e++)(u=f._commentList[e],f._sheet.canEditComment(u))&&f._isHitTestComment(u,n,i)&&(r?u.zIndex()>r.zIndex()&&(r=u):r=u);return r?f._isHitTestCommentEditArea(r,n,i)?{x:n,y:i,comment:r,area:"editArea"}:{x:n,y:i,comment:r,area:"moveResizeArea"}:t},r.prototype.getCommentActualZIndex=function(n){var t=this,r=t._sheet,i=t._getTopCommentZIndex();if(n===t._hoverShowComment)return i+2;else if(n===t._activeComment)return i+1;return n.zIndex()},r.prototype._updateCommentsLayoutWhenRowColumnChanged=function(){for(var i,t=this._commentViewList,n=0;n<t.length;n++)i=t[n],i.updateLayoutWhenRowColumnChanged()},r.prototype.updateCommentsLayoutWhenSheetScroll=function(){for(var i,t=this._commentViewList,n=0;n<t.length;n++)i=t[n],i.updateLayoutWhenSheetScroll()},r.prototype.fromJSON=function(n,t){var r,u,i;if(n&&n.length!==0)for(r=0;r<n.length;r++)u=n[r],i=new c,i.fromJSON(u,t),i.commentState()!==3&&(this._activeComment=i),this._sheet.setComment(i._rowIndex,i._colIndex,i)},r.prototype.toJSON=function(){var n=this._commentList,t,r;if(!n||n.length===0)return i;for(t=[],r=0;r<n.length;r++)t.push(n[r].toJSON());return t.length===0?i:t},r}();n.CommentManager=v;y=function(){function i(n){this._sheet=t;this.showWhenTouchMoveOrScroll=!0;var i=this;i._commentLayoutPanel=i._createCommentLayoutPanel();n.appendChild(i._commentLayoutPanel)}return i.prototype._createCommentLayoutPanel=function(){var i=this,t=document.createElement("div");return n.GC$(t).addClass("comment-layoutPanel no-user-select").css("position","absolute").css("left",0).css("top",0).css("height",0).css("width",0).css("overflow","visible").css("z-index",701).attr("unselectable","on"),t},i.prototype.renderCommentFloatPanel=function(t){var i=this,r,f,u;t._commentManager.hasComment()&&(r=t._getSheetLayout(),n.GC$(i._commentLayoutPanel).css("left",r.x+r.rowHeaderWidth).css("top",r.y+r.colHeaderHeight),i._sheet!==t&&(i._sheet&&(f=i._sheet._commentManager,f&&(u=f.getActiveComment(),u&&u.commentState()===2&&u._changeProperty("commentState",1))),i._sheet=t))},i.prototype.renderCommentCellAdorner=function(n,t,i){var c=i.row,l=i.col,u=i.x,f=i.y,r=i.width,o=i.height,s=this,h,e;t===3&&s._sheet&&(h=s._sheet.getComment(c,l),h&&(e=6,n&&r>0&&o>0&&(n.save(),n.rect(u,f,r,o),n.clip(),n.fillStyle="red",n.beginPath(),n.moveTo(u+r-e,f),n.lineTo(u+r,f),n.lineTo(u+r,f+e),n.lineTo(u+r-e,f),n.fill(),n.restore())))},i.prototype.renderComment=function(n){var f,e,u,i,r,o,s;if(this.showWhenTouchMoveOrScroll)n.showCommentLayoutPanel();else{n.hideCommentLayoutPanel();return}for(f=this._sheet,e=n.getCommentList(),u=0;u<e.length;u++)i=e[u],r=n.getCommentView(i),this._canShowComment(n,i)?(i.displayMode()===1&&i===n.getHoverShownComment()&&(n._hoverShowComment=t),r&&r.isOpen()?r.updateLayout():n.showComment(i)):r&&r.isOpen()&&n.hideComment(i);o=n.getActiveComment();o&&(s=n.getCommentView(o),s&&s.isOpen()&&f.getSelections().length>0&&f._selectionModel.clear())},i.prototype._canShowComment=function(n,t){var i=this._sheet;if(i.getColumnWidth(t._colIndex)&&i.getRowHeight(t._rowIndex))switch(t.displayMode()){case 1:return!0;case 2:if(t.commentState()===3){if(t===n.getHoverShownComment())return!0}else return n&&t!==n.getHoverShownComment()&&(n._hoverShowComment=t),!0}return!1},i}();n.CommentRender=y})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){var v,y,l,o;t.feature("formulatextbox",["core.common"]);var i=null,f=undefined,c=Math.max,a=Math.min,s=".gcFormulaTextBoxInternal",h=".gcFormulaTextBox",u="TextChanged",e="CaretChanged",p="AppendStarted",w="AppendEnded",r={left:37,right:39,up:38,down:40,tab:9,enter:13,pup:33,pdn:34,end:35,home:36,esc:27},b=function(){function l(n,i){var r=this,u;r._init(i&&i.getHost()||document.body);n&&r._attachHost(n);i&&(r._isInSpread=!0,r.setSpread(i),r._spread._unbind(t.Events.ActiveSheetChanging,o.handleFormulatextboxAcrossSheetBeforeTabChange),r._spread._bind(t.Events.ActiveSheetChanging,o.handleFormulatextboxAcrossSheetBeforeTabChange),r._spread._unbind(t.Events.ActiveSheetChanged,o.handleFormulatextboxAcrossSheetAfterTabChange),r._spread._bind(t.Events.ActiveSheetChanged,o.handleFormulatextboxAcrossSheetAfterTabChange));r._tokens=r._parse(r.text());u=r._isEditableElement(n);u&&r._colorText(r._tokens)}return l.prototype.destroy=function(){var n=this;n._isAppending=!1;n._appendingStart=-1;n._detachHost();n._detachSpread();t.GC$(n._funcsPopup).remove();t.GC$(n._funcHelpPopup).remove();t.GC$(n._helpDiv).remove()},l.prototype.bind=function(n,i,r){var u=this._host;u&&n&&(n=n.split(/\s+/).join(h+" "),t.GC$(u).bind(n+h,i,r))},l.prototype.unbind=function(n,i){var r=this._host;r&&n&&(n=n.split(/\s+/).join(h+" "),t.GC$(r).unbind(n+h,i))},l.prototype.unbindAll=function(){var n=this._host;n&&t.GC$(n).unbind(h)},l.prototype.caret=function(n){var i=this,r=i._host;if(r){var o=document.activeElement,f=document.activeElement===r,u=t.GC$(r);if(arguments.length===0)return f?i._getCaret(r).end:u.data("caret-before");n!==i.caret()&&(f?(i._setCaret(r,n),u.data("caret-before",i._getCaret(r).end)):u.data("caret-before",n),i._trigger(e,{}))}},l.prototype._getCaret=function(n){var r=-1,u=-1,e=this._isInputElement(n),o=this._isEditableElement(n),f,i,t;return e?(r=n.selectionStart,u=n.selectionEnd):o&&(f=window.getSelection(),f.rangeCount>0&&(i=f.getRangeAt(0),t=i.cloneRange(),t.selectNodeContents(n),t.setEnd(i.endContainer,i.endOffset),u=t.toString().length,t=i.cloneRange(),t.selectNodeContents(n),t.setEnd(i.startContainer,i.startOffset),r=t.toString().length,t.detach())),{start:r,end:u}},l.prototype._setCaret=function(n,t){var f=this._isInputElement(n),e=this._isEditableElement(n),i,u,r;f?n.setSelectionRange(t,t):e&&(i=this._getColorNode(n,t),i&&(u=window.getSelection(),r=document.createRange(),r.setStart(i.node.firstChild,i.offset),r.collapse(!0),u.removeAllRanges(),u.addRange(r)))},l.prototype.text=function(n){var i=this,r=i._host,o,s,e,h,f;if(r&&(!i._activeSheet()||!i._activeSheet().disposed)){if(o=i._isInputElement(r),s=i._isEditableElement(r),arguments.length===0)return e="",o?e=r.value:s&&(e=r.textContent),e;(n===null||typeof n=="undefined")&&(n="");n!==i.text()&&(i._tokens=i._parse(n),o?r.value=n:s&&i._colorText(i._tokens),h={},f=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance,f&&f.text&&(h={sheet:f.sheet,editor:f.dom,canvasOffset:f.canvasOffset}),i._trigger(u,h))}},l.prototype.autoComplete=function(n){if(arguments.length===0)return this._autoComplete;this._autoComplete=n},l.prototype.showHelp=function(n){if(arguments.length===0)return this._showHelp;this._showHelp=n},l.prototype.add=function(n){var r,i;if(n)if(t.GC$.isArray(n))for(r=n.length,i=0;i<r;i++)this._add(n[i]);else this._add(n)},l.prototype._add=function(n){var r=n&&n.name&&n.name.toUpperCase(),i,f,t,u;if(r){for(i=this._funcs,f=i.length,t=0;t<f;t++)if(u=i[t].name.toUpperCase(),u===r)return;else if(u>r)break;i.splice(t,0,n)}},l.prototype.remove=function(n){var i,r,t;if(n)for(n=n.toUpperCase(),i=this._funcs,r=i.length,t=0;t<r;t++)if(i[t].name.toUpperCase()===n){i.splice(t,1);break}},l.prototype.spread=function(n){var t=this;if(arguments.length===0)return t._spread;t.setSpread(n);t._attachSpread()},l.prototype.setSpread=function(n){var t,i;n&&(t=this,t._spread&&t._detachSpread(),i=t._host,n&&i&&(t._spread=n),t._parse=t.parseByCalc)},l.prototype.getRanges=function(){var u=[],i=this._tokens,f=i&&i.length,n,r,e=0,o=0,t;if(f>0)for(t=0;t<f;t++)n=i[t],r=n.text,n.type===11&&u.push({textOffset:e,text:r,ranges:n.ranges,index:o++,allowDrag:n.allowDrag}),e+=r.length;return u},l.prototype.getActiveRange=function(){var o=this._host,n=this.getRanges(),t,e,r,u,f;if(o&&n&&n.length>0)for(t=this.caret(),e=n.length,f=0;f<e;f++)if(r=n[f],u=r.textOffset,u<t&&t<=u+r.text.length)return r;else if(u>=t)break;return i},l.prototype.isActiveRange=function(n){if(!n)return!1;var t=this.caret(),r=n.text,i=n.textOffset;return i<t&&t<=i+r.length?!0:!1},l.prototype.getRangeColor=function(n){var s=this.getRanges(),h=s.length,i,f,u,t,e,r,o;if(n<0||h<=n)return"";for(i=[],u=0,t=0;t<h;t++){for(f=s[t],e=!1,r=0;r<i.length;r++)if(i[r].text.replace(/\s+/g,"").toUpperCase()===f.text.replace(/\s+/g,"").toUpperCase()){e=!0;break}if(e){if(n===t){u=r;break}}else if(i.push(f),n===t){u=i.length-1;break}}return o=l.DEFAULT_RANGE_COLORS,o[u%o.length]},l.prototype.canAppendRange=function(){var t,n,i;return this._isAppending?!0:(t=this._getToken(this.caret()),t)?(n=t.type,i=t.text,n===1||n===8||n===7&&i!=="%"||n===5||n===9||n===15):!1},l.prototype.isAppending=function(){return this._isAppending},l.prototype.isAppendingRange=function(n){if(!n||!this._isAppending)return!1;var i=this._appendingStart,r=this.caret(),t=n.textOffset;return i<=t&&t<r?!0:!1},l.prototype.getAppendingRanges=function(){var i=[],r=this.getRanges(),u=r.length,t,n;if(u>0)for(n=0;n<u;n++)t=r[n],this.isAppendingRange(t)&&i.push(t);return i},l.prototype.appendRange=function(n,i,r){var f=this,b=f._host,v,o,c,y,w,s;if(n&&b){if(!f._isAppending){if(!f.canAppendRange())return;i=!1;f._isAppending=!0;f._appendingStart=f.caret();f._trigger(p,{})}var l=f._appendingStart,h=f.text(),e=f.caret(),a=e;r&&(i=!1,h=h.substr(0,l)+h.substr(e),f._tokens=f._parse(h),e=l,a=e);v=f._getToken(e);i?(o=h.substr(0,e),o=o.substr(0,o.length-v.text.length),o.length>=l&&(v.text=n,a=o.length+n.length)):(c=f._tokens,y=t.ArrayHelper.indexOf(c,v),e>l?(c.splice(y+1,0,{text:this.listSeparator(),type:8}),c.splice(y+2,0,{text:n,type:11}),n=","+n):c.splice(y+1,0,{text:n,type:11}),a=e+n.length);f._updateHostValue();w={};s=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance;s&&s.text&&(w={sheet:s.sheet,editor:s.dom,canvasOffset:s.canvasOffset});f._trigger(u,w);f.caret(a)}},l.prototype.stopAppending=function(){var n=this;n._isAppending&&(n._isAppending=!1,n._appendingStart=-1,n._trigger(w,{}))},l.prototype.startAppending=function(){this._isAppending=!0;this._appendingStart=this.caret()},l.prototype.appendingStartIndex=function(n){return arguments.length==0?this._appendingStart:this._appendingStart=n},l.prototype.repalceRange=function(n,t){var i=this,s=i._host,r;if(s&&!(n<0)&&t){var o=!1,h="",f=i._tokens,c=f&&f.length,e,l=0;for(r=0;r<c;r++){if(e=f[r],e.type===11&&l++===n){f[r]={text:t,type:11};o=!0;break}h+=e.text}o&&(i._updateHostValue(),i._trigger(u,{}),i.caret(i.text().length))}},l.prototype._attachSpread=function(){var t=this,f,i,r;t._spread&&(f=t._host,t._spread&&f&&(i=n.Sheets.Events,f.setAttribute("gcUIElement","gcAttachedFormulaTextBox"),t._spread._attachedFormulaTextBox=t,t._spread._bind(i.EditStarted,t,t._onSpreadEditStarted),t._spread._bind(i.EnterCell,t,t._onSpreadEnterCell),t._spread._bind(i.EditEnded,t,t._onSpreadEditEnded),t._spread._bind(i.ActiveSheetChanged,t,t._onSpreadActiveSheetChanged),t._spread._bind(i.RangeChanged,t,t._onSpreadRangeChanged),t._spread._bind("FormulaTextBoxTextChanged",t,t._onSpreadFormulaTextBoxTextChanged),t._spread._bind("FormulaTextBoxCaretChanged",t,t._onSpreadFormulaTextBoxCaretChanged),r=t._spread.getActiveSheet(),r&&t.text(t._getEditText(r,r._activeRowIndex,r._activeColIndex)),t._bind(u,t,t._onFormulaTextBoxTextChanged),t._bind(e,t,t._onFormulaTextBoxCaretChanged)))},l.prototype._detachSpread=function(){var t=this,i=t._spread,r;!t._isInSpread&&i&&(r=n.Sheets.Events,i._attachedFormulaTextBox=null,i._unbind(r.EditStarted,t._onSpreadEditStarted),i._unbind(r.EnterCell,t._onSpreadEnterCell),i._unbind(r.EditEnded,t._onSpreadEditEnded),i._unbind(r.ActiveSheetChanged,t._onSpreadActiveSheetChanged),i._unbind(r.RangeChanged,t._onSpreadRangeChanged),i._unbind("FormulaTextBoxTextChanged",t._onSpreadFormulaTextBoxTextChanged),i._unbind("FormulaTextBoxCaretChanged",t._onSpreadFormulaTextBoxCaretChanged),t._unbind(u,t._onFormulaTextBoxTextChanged),t._unbind(e,t._onFormulaTextBoxCaretChanged),t.text(""));t._spread=null},l.prototype._startingSpreadEdit=function(){var n=this,i,t;n._isWorking||(n._isWorking=!0,i=this._spread,t=i&&i.getActiveSheet(),t&&!t.isEditing()?(t._startEditImp(null,t._activeRowIndex,t._activeColIndex,null,null,!1,null),n._spreadEditStarting=!0):n._spreadEditStarting=!1,n._isWorking=!1,n._isFuncsShown||n._openFuncHelp())},l.prototype._startSpreadEdit=function(){var r=this,f=r._spread,t=f&&f.getActiveSheet(),i,s,l,u;if(t){if(r._spreadEditStarting&&t._formulaTextBox){var h=t._formulaTextBox,e=h.text(),o=r.text();o!==e&&(i=r.caret(),s=t.getFormulaInformation(t.getActiveRowIndex(),t.getActiveColumnIndex()),r.text(e),s.isArrayFormula&&(i>=o.length&&(i=i-1),i=c(0,i-1)),r.caret(i))}l=n.Sheets.EditorStatus;u=t._editorStatus;u!==2&&(t._editorStatus=2,t.triggerEditorStatusChanged({sheet:t,sheetName:t._name,oldStatus:u,newStatus:2}))}},l.prototype._getEditText=function(n,i,r){var u="",f,e,o,s;return n&&(f=n.getFormulaInformation(i,r),f&&f.hasFormula?(u="="+f.formula,f.isArrayFormula&&(u="{"+u+"}")):(e=n.getActualStyle(i,r),o=n.getValue(i,r),u=t.util.formatValue2Text(e,o,n)||"",s=n.parent?n.parent.canUserEditFormula():!0,u[0]==="="&&s&&(u="'"+u))),u},l.prototype._onSpreadActiveSheetChanged=function(n,t){var i=n.data,r;i._isWorking||(i._isWorking=!0,i.close(),t&&(r=t.newSheet,i.text(i._getEditText(r,r._activeRowIndex,r._activeColIndex))),i._isWorking=!1)},l.prototype._onSpreadEditStarted=function(n,t){var i=n.data;if(!i._isWorking){var r=i._spread,u=r&&r.getActiveSheet(),f=u&&u._formulaTextBox;f&&(i._isWorking=!0,i.text(f.text()),i._isWorking=!1)}},l.prototype._onSpreadEnterCell=function(n,t){var i=n.data;i._isWorking||(i._isWorking=!0,t&&i.text(i._getEditText(t.sheet,t.row,t.col)),i._isWorking=!1)},l.prototype._onSpreadRangeChanged=function(t,i){var r=t.data;if(!r._isWorking){if(r._isWorking=!0,i){var u=i.sheet,f=i.row,e=i.column,o=i.rowCount,s=i.columnCount;new n.Sheets.Range(f,e,o,s).contains(u._activeRowIndex,u._activeColIndex)&&r.text(r._getEditText(u,u._activeRowIndex,u._activeColIndex))}r._isWorking=!1}},l.prototype._onSpreadEditEnded=function(n,t){var i=n.data;i._isWorking||(i._isWorking=!0,i.close(),t&&i.text(i._getEditText(t.sheet,t.row,t.col)),i._isWorking=!1)},l.prototype._onSpreadFormulaTextBoxTextChanged=function(n,t){var i=n.data,r;i._isWorking||(i._isWorking=!0,t&&(r=i.caret(),i.text(t.text),i.caret(r)),i._isWorking=!1)},l.prototype._onSpreadFormulaTextBoxCaretChanged=function(n,t){var i=n.data;i._isWorking||(i._isWorking=!0,t&&i.caret(t.caret),i._isWorking=!1)},l.prototype._onFormulaTextBoxTextChanged=function(n){var t=n.data,u,i,r,f,e,o;t._isWorking||(u=t._spread,i=u&&u.getActiveSheet(),i)&&(t._isWorking=!0,r=i._formulaTextBox,f=i.getCellType(t.rowIndex,t.columnIndex),r?(e=r.caret(),r.text(t.text()),r.caret(e)):(o={sheet:i,row:t.rowIndex,col:t.columnIndex,sheetArea:3},f.setEditorValue(i._editor,t.text(),o)),t._isWorking=!1)},l.prototype._onFormulaTextBoxCaretChanged=function(n){var t=n.data,r,i,u;t._isWorking||(r=t._spread,i=r&&r.getActiveSheet(),i&&i.isEditing())&&(t._isWorking=!0,u=i._formulaTextBox,u&&(u.caret(t.caret()),t._openFuncHelp()),t._isWorking=!1)},l.prototype._init=function(n){var r=this,u,f,e;r._isImeInputting=!1;r._isInputKey=!1;r._isAppending=!1;r._appendingStart=-1;r._funcs=[];r._autoComplete=!0;r._showHelp=!0;r._autoClose=!0;u=document.createElement("div");u.className="gcsj-func-ac-popup";u.style.display="none";u.setAttribute("gcUIElement","gcFuncACPopup");n.insertBefore(u,i);r._funcsPopup=u;r._isFuncsShown=!1;f=document.createElement("div");f.className="gcsj-func-help-popup";f.style.display="none";f.setAttribute("gcUIElement","gcFuncHelpPopup");n.insertBefore(f,i);r._funcHelpPopup=f;r._isFuncHelpShown=!1;t.GC$(u).bind("mouseover",function(){r._autoClose=!1}).bind("mouseout",function(){r._autoClose=!0});t.GC$(f).bind("mouseover",function(){r._autoClose=!1}).bind("mouseout",function(){r._autoClose=!0});t.GC$(u).bind("scroll",function(){r._funcsScrollingTimer&&window.clearTimeout(r._funcsScrollingTimer);r._funcsScrollingTimer=window.setTimeout(function(){r._host&&r._host.focus()},100)});e=document.createElement("div");e.style.display="none";e.setAttribute("gcUIElement","gcFuncHelpDiv");n.insertBefore(e,i);r._helpDiv=e;r._spread=null;r._isWorking=!1;r._spreadEditStarting=!1;r._isInSpread=!1;r._parse=r.parseDefault},l.prototype._attachHost=function(n){var i,u,f;n&&(i=this,i._isInputElement(n)||i._isEditableElement(n))&&(u=t.GC$(n),i._host&&i._detachHost(),i._host=n,t.util.browser&&t.util.browser.msie?(f=parseInt(t.util.browser.version,10)<10,i._isEditableElement(n)||f?(i._bind("focus",function(){u.data("text-before",i.text())}),i._bind("click",function(){u.focus()}),"input keydown keyup cut paste".split(" ").forEach(function(n,t){i._bind(n,function(){i._checkInput()})})):i._bind("input",function(){i._onInput()})):i._bind("input",function(){i._onInput()}),i._bind("keydown",function(n){var u=n.ctrlKey,f=n.shiftKey,e=n.altKey,o=n.metaKey,s=u||f||e||o,t=n.keyCode;i._isInputKey=!1;!s&&i._isFuncsShown&&(t===r.down?(i._selectFunc(1),n.preventDefault(),n.stopPropagation()):t===r.up?(i._selectFunc(-1),n.preventDefault(),n.stopPropagation()):t===r.tab&&(i._completeFunc(),n.preventDefault(),n.stopPropagation()));t===r.esc&&i.close();i._checkCaret(n)}),i._bind("keyup",function(n){if(i._isInputKey&&t.util.browser&&t.util.browser.qtMode){var r=i.caret();u.data("caret-before")!==r&&(u.data("caret-before",r),i._trigger(e,{}),i._openFuncs(),i._isFuncsShown||i._openFuncHelp())}i._checkCaret(n)}),i._bind("focus",function(n){i._checkCaret(n)}),i._bind("blur",function(n){i._autoClose&&i.close()}),i._bind("mousedown",function(n){i._startingSpreadEdit()}),i._bind("mouseup",function(n){i._startSpreadEdit()}),i._bind("click",function(n){i._isAppending&&i.stopAppending();var r=i._spread,u=r&&r.getActiveSheet(),t=u&&u._formulaTextBox;t&&t.isAppending()&&t.stopAppending();i._checkCaret(n)}),i._bind("compositionstart",function(n){i._isImeInputting=!0}),i._bind("compositionend",function(n){i._isImeInputting=!1}))},l.prototype._detachHost=function(){var n=this,u=n._host,r;u&&(r=t.GC$(u),r.removeData("text-before"),r.removeData("caret-before"),n._unbindAll(),n.unbindAll(),n._host=i)},l.prototype._checkInput=function(){var n=this,i=t.GC$(n._host),r=n.text();i.data("text-before")!==r&&(n._isImeInputting||i.data("text-before",r),n._onInput())},l.prototype._checkCaret=function(n){if(t.util.browser&&t.util.browser.msie){var i=function(n,t){return function(){n._checkCaretCore(n,t)}};setTimeout(i(this,n),10)}else this._checkCaretCore(this,n)},l.prototype._checkCaretCore=function(n,i){var u=i.keyCode,f=u===r.left||u===r.right||u===r.home||u===r.end||u===r.pdn||u===r.pup||u===r.tab||u===r.enter,h,s;if(n._autoComplete||(f=f||u===r.up||u===r.down),h=typeof i.button!="undefined",f||h){var c=n._host,l=t.GC$(c),o=n._getCaret(c);if(o.start!==o.end)return;s=o.end;l.data("caret-before")!==s&&(l.data("caret-before",s),n._trigger(e,{}),n._openFuncHelp())}},l.prototype._activeRow=function(){return this._spread?this._spread.getActiveSheet()._activeRowIndex:f},l.prototype._activeCol=function(){return this._spread?this._spread.getActiveSheet()._activeColIndex:f},l.prototype._activeSheet=function(){if(this._spread)return this._spread.getActiveSheet()},l.prototype.parseDefault=function(n){return y.parse(n)},l.prototype.parseByCalc=function(i){var r,u,e,o,s,h;if(t.Calc)return(r=this,u=[],!i||i[0]!=="=")?(u.push({text:i,type:17}),u):(e=n.Sheets.Calc.Parser.getParserOption(),o={numberDecimalSeparator:r.numberDecimalSeparator(),arrayGroupSeparator:r.arrayGroupSeperator(),listSeparator:r.listSeparator()},t.Calc.Parser.setParserOption(o),s=new t.Calc.Parser,h=s.parseReferenceExpressionInfos(i,r._activeSheet(),r._activeRow(),r._activeCol()),n.Sheets.Calc.Parser.setParserOption(e),r._convertToTextboxToken(h));else this.parseDefault(i);return f},l.prototype._onInput=function(){var n=this,r=n._host,f=t.GC$(r),i;n._isInputKey=!0;n._tokens=n._parse(n.text());n._isEditableElement(r)?n._isImeInputting||(i=n.caret(),n._colorText(n._tokens),n._trigger(u,{type:"input"}),n.caret(i)):n._trigger(u,{type:"input"});i=n.caret();f.data("caret-before")!==i&&(f.data("caret-before",i),n._trigger(e,{}));n._openFuncs();n._isFuncsShown||n._openFuncHelp()},l.prototype.trigerTextChanged=function(){this._trigger(u,{type:"input"})},l.prototype.arrayGroupSeperator=function(){return t.CR&&t.CR.arrayGroupSeperator||";"},l.prototype.arrayListSeparator=function(){return t.CR&&t.CR.arrayListSeparator||","},l.prototype.listSeparator=function(){return t.CR&&t.CR.listSeparator||","},l.prototype.numberDecimalSeparator=function(){return t.CR&&t.CR.numberDecimalSeparator||"."},l.prototype._convertToTextboxToken=function(n){for(var i=[],c=[],l=this.arrayGroupSeperator(),a=this.listSeparator(),v=this.arrayListSeparator(),o=!1,s=!1,h=0,f=0;f<n.length;f++)if(!(f>0)||!(f<n.length-1)||n[f-1].text!==";"||n[f].text!==","||n[f+1].text!=="ARRAYROW"){var e=n[f],r=this._getCalcType(e,c),u=e.text;if(r===2)i.push({text:u,type:r});else if(r===8)i.push({text:a,type:r});else if(r===3){if(u==="ARRAYROW"){h++;s=!0;continue}u==="ARRAY"&&(o=!0);i.push({text:"{",type:3})}else if(r===4)if(u==="ARRAYROW"){s=!1;i.push({text:"}",type:4});continue}else u==="ARRAY"?(o=!1,h=0,i.push({text:"}",type:4})):i.push({text:u,type:4});else r===6?i.push({text:")",type:r}):o&&!s&&u==","?i.push({text:l,type:10}):o&&u==";"?i.push({text:v,type:9}):r===13?i.push({text:t._NumberHelper.replaceNormalToCultureSymble(u),type:r,ranges:e.ranges,allowDrag:e.canDrag}):r!==null&&i.push({text:u,type:r,ranges:e.ranges,allowDrag:e.canDrag})}return i},l.prototype._getCalcType=function(n,i){var s=t.Calc.ExcelFormulaTokenType,h=t.Calc.ExcelFormulaTokenSubtype,r=n.type,u=n.subType,o=n.text,f=n.value,e;if(r===1){if(u===1)return o==="ARRAY"||o==="ARRAYROW"?(i.push(3),3):(i.push(5),f.trim()==="(")?5:2;if(u===2){if(f.trim()===")")return 6;if(i.length>0)if(e=i[i.length-1],e===3)return i.pop(),4;else if(e===5)return i.pop(),6}if(f.trim()==="=")return 1}else if(r===3){if(u===0)return 8}else if(r===5||r===6||r===4)return 7;else if(r===0){if(u===7)return 11;else if(u===5)return 12;else if(u===4)return 13;else if(u===3)return 14;else if(u===6)return 16;return 14}else if(r===7)return 15;else if(r===8)return 17;return 17},l.prototype._updateHostValue=function(){var n=this,r=n._host,t=n._tokens,u,f,i;if(n._isInputElement(r)){for(u="",f=t&&t.length,i=0;i<f;i++)u+=t[i].text;r.value=u}else n._isEditableElement(r)&&n._colorText(t)},l.prototype._isInputElement=function(n){var t=n&&n.tagName;return t==="TEXTAREA"||t==="INPUT"},l.prototype._isEditableElement=function(n){return n&&n.tagName==="DIV"&&n.contentEditable==="true"},l.prototype._isFormula=function(n){return n&&n[0]==="="?!0:!1},l.prototype._bind=function(n,i,r){var u=this._host;u&&n&&(n=n.split(/\s+/).join(s+" "),t.GC$(u).bind(n+s,i,r))},l.prototype._unbind=function(n,i){var r=this._host;r&&n&&(n=n.split(/\s+/).join(s+" "),t.GC$(r).unbind(n+s,i))},l.prototype._unbindAll=function(){var n=this._host;n&&t.GC$(n).unbind(s)},l.prototype._trigger=function(n,i){var r=this._host;r&&t.GC$(r).trigger(n,i)},l.prototype._getToken=function(n){var t,u,f,e,r;if(n<=0)return i;if(t=this._tokens,u=t&&t.length,u>0)for(f=0,r=0;r<u;r++)if(e=t[r],f+=e.text.length,f>=n)return e;return i},l.prototype._getFuncs=function(){var r=this._spread,n=r&&r.getActiveSheet(),u=n&&n._formulaTextBox,t,i;if(u){for(t=u._funcs,i=0;i<t.length;i++)t[i].isFunc=!0;return t.concat(this._getCustomNames(r,n)).concat(this._getTableNames(n))}else return this._funcs},l.prototype._getCustomNames=function(n,i){for(var f=[],u=i.getCustomNames().concat(n.getCustomNames()),r=0;r<u.length;r++)f.push({name:u[r].getName(),description:t.SR.Fbx_CustomName_Description+u[r].getName()});return f},l.prototype._getTableNames=function(n){var u=[],r=n.getTables(),i;if(r)for(i=0;i<r.length;i++)u.push({name:r[i].name(),description:t.SR.Fbx_TableName_Description+r[i].name()});return u},l.prototype._getFuncsStartWith=function(n,i){var r;n=n.toUpperCase();t.StringUtil.contains(n,"[")&&(n=n.substr(n.lastIndexOf("[")+1),n=t.StringUtil.replace(n,"@",""));var f=[],e=i&&i.length,o=!1,u;for(r=0;r<e;r++)u=i[r],u.name.toUpperCase().indexOf(n)===0&&(f.push(u),o=!0);return f},l.prototype._getTextInTokenBeforeCaret=function(){var u=this.caret(),n,f,t,i,r;if(u<=0)return"";if(n=this._tokens,f=n&&n.length,f>0)for(t=0,r=0;r<f;r++){if(i=n[r],t+i.text.length>=u)return i.text.substring(0,u-t);t+=i.text.length}return""},l.prototype._getActiveFuncInfo=function(){for(var f,u,s,l=this.caret(),o=this._tokens,a=o&&o.length,n=[],c=0,t,r=0;r<a;r++){if(t=o[r],n.push(t),t.type===6)for(f=0;n.length>0;)if(u=n.pop(),u.type===6&&f++,u.type===5&&f--,f===0){n.length>0&&(u=n[n.length-1])&&u.type===2&&n.pop();break}if(c+=t.text.length,c>=l)break}if(n.length>0){for(s=0;n.length>0;)if(t=n.pop(),t.type===8)s++;else if(t.type===2)break;if(t.type===2){var v=t.text.toUpperCase(),h=this._getFuncs(),y=h&&h.length,e;for(r=0;r<y;r++)if(e=h[r],e.name.toUpperCase()===v)return{func:e,activeParamterIndex:s,isFunc:e.isFunc}}}return i},l.prototype._openFuncs=function(){var n=this,r=n._getFuncsForInput(),l=n._autoComplete&&n._isFormula(n.text())&&r&&r.length>0&&!n._isAppending&&!n._isImeInputting,u,s,c,f,e,h,i,o;if(l){for(n._closeFuncHelp(),u=n._funcsPopup,r.length>8?(u.style.height="204px",u.style.overflowY="scroll"):(u.style.height="auto",u.style.overflowY=""),s="",c=r.length,e=0;e<c;e++)f=r[e],s+="<div class='gcsj-func-ac-row'><div class='gcsj-func-ac-row-name' isFunc="+f.isFunc+">"+f.name+"<\/div><div class='gcsj-func-ac-row-description'>"+(f.shortDescription||f.description)+"<\/div><\/div>";h=t.GC$(n._funcsPopup);h.html(s).show();n._isFuncsShown=!0;i=h.find(".gcsj-func-ac-row");i.length()>0&&(o="gcsj-ac-row-active",t.GC$(i.getElement(0)).addClass(o),i.bind("mouseover",function(){i.removeClass(o);t.GC$(this).addClass(o)}),i.bind("click",function(){n._completeFunc()}));n.position()}else n._closeFuncs()},l.prototype._getFuncsForInput=function(){var n=this,r=n._getToken(n.caret()),u=r&&r.text,i=[],o=n._tokens.indexOf(r),f,e;if(r&&r.type===14)return i;if(f=n._getTableColumnNames(o),f.length>0){if(i=i.concat(f).concat(t.SR.getHelpTableFuncs()),t.StringUtil.endsWith(u,"[")||t.StringUtil.endsWith(u,"[@"))return i}else i=this._getFuncs();return u=n._getTextInTokenBeforeCaret(),e=[],u&&(e=n._getFuncsStartWith(u,i)),e},l.prototype._getTableColumnNames=function(n){var r=[],e=this._tokens,a=e&&e.length,c,u,l,f;if(n<0||n>=e.length)return r;var o=this._spread,s=o&&o.getActiveSheet(),h={};if((typeof n=="undefined"||n===i)&&(n=a),s&&(c=e[n],u=s.findTableByName(t.StringUtil.leftBefore(c.text,"[")),u!==i&&!h[u])){for(h[u]=!0,l=0,f="";f!==i;)f=u.getColumnName(l++),f!==i&&r.push({name:f,description:""});if(r.length>0)return r}return r},l.prototype._closeFuncs=function(){t.GC$(this._funcsPopup).hide();this._isFuncsShown=!1},l.prototype._selectFunc=function(n){var u=t.GC$(this._funcsPopup).find(".gcsj-func-ac-row"),e=u.length(),o,i,f,h,s,r;if(e!==0){if(o="gcsj-ac-row-active",i=0,n)for(f=0;f<e;f++)if(t.GC$(u.getElement(f)).hasClass(o)){i=f+n;break}h=t.GC$(this._funcsPopup).scrollTop();u.removeClass(o);s=0;e>0&&(s=u.getElement(0).offsetHeight);i=c(i,0);i=a(i,e-1);r=u.getElement(i);t.GC$(r).addClass(o);r.offsetTop+r.offsetHeight>t.GC$(this._funcsPopup).scrollTop()+t.GC$(this._funcsPopup).height()?t.GC$(this._funcsPopup).scrollTop(t.GC$(this._funcsPopup).scrollTop()+s):r.offsetTop<t.GC$(this._funcsPopup).scrollTop()?t.GC$(this._funcsPopup).scrollTop(r.offsetTop):t.GC$(this._funcsPopup).scrollTop(h)}},l.prototype._completeFunc=function(){var n=this,y=t.GC$(n._funcsPopup).find(".gcsj-ac-row-active .gcsj-func-ac-row-name"),o=y.text(),a=y.attr("isFunc")==="true";if(o){for(var p=n.caret(),s=n._tokens,d=s&&s.length,c=0,v=0,h=0,e=i;h<d;){if(e=s[h],v=e.text.length,c+v>=p)break;h++;c+=v}var w=p-c,f=e.text,r=0,l=0;t.StringUtil.contains(f,"[")?(r=f.lastIndexOf("[",w-1),r===-1?(r=f.indexOf("["),e.text=r===-1?o:o+f.substr(r),r=0):(r++,f.charAt(r)==="@"&&(r=r+1),l=f.indexOf("]",w),l===-1&&(l=f.length),e.text=f.substring(0,r)+o+f.substr(l))):e.text=o;e.type=a?2:11;var b=h+1,k=s[b],g=s[h];a&&(!k||k.type!==5)&&s.splice(b,0,{text:"(",type:5});n._closeFuncs();n._host.focus();n._updateHostValue();n.caret(c+o.length+r+(a?1:0));n._openFuncHelp();n._tokens=n._parse(n.text());n._trigger(u,{})}},l.prototype._openFuncHelp=function(){var n=this,u,o,v,f,r,l;if(n._isFuncsShown&&n._closeFuncs(),u=n._getActiveFuncInfo(),u===i||u.isFunc!==!0){n._closeFuncHelp();return}if(o=n.listSeparator(),v=n._showHelp&&n._isFormula(n.text())&&u&&!n._isAppending&&!n._isImeInputting,v){var s=u.func,h=s.parameters,c=h&&h.length,p=a(c-1,u.activeParamterIndex),e,y="";for(f=0;f<c;f++)e=h[f],r=e.name,e.repeatable&&(r+=o+"..."),e.optional&&(r="["+r+"]"),l=f===c-1?"":o+" ",r=f===p?"<span class='gcsj-func-help-paramter gcsj-func-help-paramter-active'>"+r+"<\/span>"+l:"<span class='gcsj-func-help-paramter'>"+r+"<\/span>"+l,y+=r;var w="<div class='gcsj-func-help-title'><div class='gcsj-func-help-formula'><span class='gcsj-func-help-formula-name'>"+s.name+"<\/span><span class='gcsj-func-help-paramter-paren'>(<\/span>"+y+"<span class='gcsj-func-help-paramter-paren'>)<\/span><\/div><\/div>",b="<div class='gcsj-func-help-section'><div class='gcsj-func-help-section-title'>"+t.SR.Fbx_Summary+"<\/div><div class='gcsj-func-help-section-content'>"+s.description+"<\/div><\/div>",k="<div class='gcsj-func-help-section-content'>"+b+"<\/div>",d="<div class='gcsj-func-help-body'>"+k+"<\/div>",g=w+d;t.GC$(n._funcHelpPopup).html(g).show();n._isFuncHelpShown=!0;n.position()}else n._closeFuncHelp()},l.prototype._closeFuncHelp=function(){t.GC$(this._funcHelpPopup).hide();this._isFuncHelpShown=!1},l.prototype.close=function(){this._closeFuncs();this._closeFuncHelp()},l.prototype.isReservedKey=function(n){if(this._isAppending)return!1;var i=n.ctrlKey||n.shiftKey||n.altKey||n.metaKey,t=n.keyCode;return this._isFuncsShown&&!i&&(t===r.down||t===r.up||t===r.tab)?!0:!1},l.prototype.position=function(){var u=this,e=i,r,h,c,a;if(u._isFuncsShown?e=u._funcsPopup:u._isFuncHelpShown&&(e=u._funcHelpPopup),e){var f=t.GC$(u._host),o=t.GC$(e),n=t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance;if(n&&n.sheet){var s=n.sheet.getCellRect(n.rowIndex,n.columnIndex),b=n.sheet._eventHandler,v=n.canvasOffset;o.css("top",s.y+s.height+v.top).css("left",s.x+v.left);return}r=f.parent().css("top");h=parseFloat(r);isNaN(h)||(r=h);c=f.parent().css("left");r==="auto"&&(r=f.offset().top,c=f.offset().left);var l=r+f.outerHeight(),p=t.GC$(document.body).outerHeight(),y=o.outerHeight(),w=l+y;w>p&&(a=r-y,a>=0&&(l=a));o.css("top",l).css("left",c)}},l.prototype.focus=function(){t.GC$(this._host).focus()},l.prototype._colorText=function(n){for(var o,i,r=this,f="",s="",h=n&&n.length,c=0,u,e=0;e<h;e++)u=n[e],o="",u.type===11&&(o=" style='color: "+r.getRangeColor(c++)+"'"),f+="<span"+o+" class='gcsj-func-color-text'>"+t.GC$(r._helpDiv).text(u.text).html()+"<\/span>",s+=u.text;if(s||r.text())if(i=r._host,f)i.innerHTML="<span class='gcsj-func-color-content'>"+f+"<\/span>";else while(i.firstChild)i.removeChild(i.firstChild)},l.prototype._getColorNode=function(n,r){var o=t.GC$(n).find(".gcsj-func-color-content .gcsj-func-color-text"),s=o.length(),u,f,e;if(s>0){for(r=c(0,r),e=0;e<s;e++)if(u=o.getElement(e),f=u.textContent,r-=f.length,r<=0)return{node:u,offset:f.length+r};return{node:u,offset:f.length}}return i},l.DEFAULT_RANGE_COLORS=["#0000ff","#008000","#9900cc","#800000","#00cc33","#cc6600","#cc0099"],l}();t.FormulaTextBox=b,function(n){n[n.FormulaStart=1]="FormulaStart";n[n.FunctionName=2]="FunctionName";n[n.BraceOpen=3]="BraceOpen";n[n.BraceClose=4]="BraceClose";n[n.ParenOpen=5]="ParenOpen";n[n.ParenClose=6]="ParenClose";n[n.Operator=7]="Operator";n[n.ArgumentSeparator=8]="ArgumentSeparator";n[n.ArrayListSeparator=9]="ArrayListSeparator";n[n.ArrayGroupSeparator=10]="ArrayGroupSeparator";n[n.Range=11]="Range";n[n.Boolean=12]="Boolean";n[n.Number=13]="Number";n[n.String=14]="String";n[n.Whitespace=15]="Whitespace";n[n.Error=16]="Error";n[n.Literal=17]="Literal"}(v||(v={}));y=function(){function t(){}return t.parse=function(t){var r=[],e=this,o,l,v,y,h;if(t&&t[0]!=="=")return e.addToken(r,t,17),r;var s=t&&t.length,a=0,u,i="",b=n.Sheets.CR.listSeparator===n.Sheets.CR.arrayGroupSeparator?"\\":n.Sheets.CR.listSeparator,k=n.Sheets.CR.listSeparator,d=n.Sheets.CR.arrayGroupSeparator,g=n.Sheets.CR.arrayListSeparator;for(o=0;o<s;o++){u=t[o];switch(u){case"'":i=e.addToken(r,i);l=!0;do i+=u,u=t[++o],u==="'"&&t[o+1]==="'"?(i+=u,u=t[++o]):l=u!=="'";while(l&&o<s-1);u!==f&&(i+=u);break;case'"':i=e.addToken(r,i);l=!0;do i+=u,u=t[++o],u==='"'&&t[o+1]==='"'?(i+=u,u=t[++o]):l=u!=='"';while(l&&o<s-1);u!==f&&(i+=u);i=e.addToken(r,i,14);break;case"\\":e.addToken(r,i);i=e.addToken(r,u,9);break;case b:e.addToken(r,i);i=e.addToken(r,u,a>0?9:8);break;case k:case g:e.addToken(r,i);i=e.addToken(r,u,a>0?9:8);break;case d:e.addToken(r,i);i=e.addToken(r,u,10);break;case"{":e.addToken(r,i);i=e.addToken(r,u,3);a++;break;case"}":e.addToken(r,i);i=e.addToken(r,u,4);a--;break;case"(":e.addToken(r,i,2);i=e.addToken(r,u,5);break;case")":e.addToken(r,i);i=e.addToken(r,u,6);break;case"=":e.addToken(r,i);i=o===0?e.addToken(r,u,1):e.addToken(r,u,7);break;case"/":var p=i.toUpperCase(),h=o+1<s?t[o+1]:"",w=o+2<s?t[o+2]:"";p==="#DIV"&&h==="0"&&w==="!"||p==="#N"&&h.toUpperCase()==="A"?(i+=u+h,o++,"#DIV"===i&&(i+=w,o++),i=e.addToken(r,i)):(e.addToken(r,i),i=e.addToken(r,u,7));break;case"+":case"-":v=i.replace(/\s/g,"").toUpperCase();y=c(0,v.length-2);v.lastIndexOf("R[")>=y||v.lastIndexOf("C[")>=y?i+=u:(e.addToken(r,i),i=e.addToken(r,u,7));break;case"&":case"^":case"*":case"%":e.addToken(r,i);i=e.addToken(r,u,7);break;case"<":case">":i=e.addToken(r,i);i+=u;h=o+1<s?t[o+1]:"";(h==="="||u==="<"&&h===">")&&(i+=h,o++);i=e.addToken(r,i,7);break;case" ":case"\u00a0":case"\r":case"\n":case"\t":for(i=e.addToken(r,i),i+=u;o<s-1&&/^[\s]*$/.test(t[o+1]);)i+=t[++o];i=e.addToken(r,i,15);break;default:i+=u;break}}return e.addToken(r,i),r},t.addToken=function(n,t,i){var u=this,o,l,s,h,c,e,r,f;if(t){if(typeof i=="undefined"&&(i=u.calcErrors.indexOf(t.toUpperCase())>-1?16:u.rNumber.test(t)?13:u.rBoolean.test(t)?12:u.rRangeA1.test(t)||u.rRangeR1C1.test(t)?11:17),o=function(n){return n===11||n===17||n===13},o(i)){for(l=n.length,r="",e=l-1;e>=0;e--)if(s=n[e],h=s.type,c=s.text,r=c+r,h!==15&&c!==":")break;o(h)?(r+=t,f=r[r.length-1]===":"?r.substr(0,r.length-1):r,f=f.trim(),(u.rRangeA1.test(f)||u.rRangeR1C1.test(f))&&(n.splice(e),t=r,i=11)):t[t.length-1]===":"&&(f=t.substr(0,t.length-1),(u.rRangeA1.test(f)||u.rRangeR1C1.test(f))&&(i=11))}n.push({text:t,type:i})}return""},t.rNumber=/^(\+|-)?((\d\d*\,?\d*)|(\d*\,?\d\d*))$/,t.rBoolean=/^(TRUE|FALSE)$/i,t.rRangeA1=/^(.*!)?((\$?[a-z]+\$?\d+(\s*:\s*\$?[a-z]+\$?\d+)?)|(\$?[a-z]+\s*:\s*\$?[a-z]+)|(\$?\d+\s*:\s*\$?\d+)|(\$?[a-z]+\$?\d+\s*:\s*\$?\d+)|(\$?\d+\s*:\s*\$?[a-z]+\$?\d+)|(\$?[a-z]+\$?\d+\s*:\s*\$?[a-z]+)|(\$?[a-z]+\s*:\s*\$?[a-z]+\$?\d+))$/i,t.rRangeR1C1=/^(.*!)?((R\[?[-+]?\d*\]?C\[?[-+]?\d*\]?\s*(:\s*R\[?[-+]?\d*\]?C\[?[-+]?\d*\]?)?)|(R\[?[-+]?\d*\]?\s*(:\s*R\[?[-+]?\d*\]?)?)|(C\[?[-+]?\d*\]?\s*(:\s*C\[?[-+]?\d*\]?)?)|(R\[?[-+]?\d*\]?C\[?[-+]?\d*\]?\s*(:\s*C\[?[-+]?\d*\]?)?)|(C\[?[-+]?\d*\]?\s*(:\s*R\[?[-+]?\d*\]?C\[?[-+]?\d*\]?))?|(R\[?[-+]?\d*\]?C\[?\[-+]?d*\]?\s*(:\s*R\[?[-+]?\d*\]?))?|(R\[?[-+]?\d*\]?\s*(:\s*R\[?[-+]?\d*\]?C\[?[-+]?\d*\]?))?)$/i,t.calcErrors="#DIV/0! #N/A #NAME? #NULL! #NUM! #REF! #VALUE!".split(" "),t}();l=function(){function n(){var n=this;n.rowIndex=-1;n.columnIndex=-1;n.text="";n.caret=-1;n.sheet=null;n.isAppending=!1;n.appendingIndex=-1;n.dom=null;n.spread=null;n.canvasOffset=null}return n.prototype.clear=function(){var n=this;n.removeDom();n.rowIndex=-1;n.columnIndex=-1;n.text="";n.caret=-1;n.isAppending=!1;n.appendingIndex=-1;n.sheet=null;n.spread=null;n.canvasOffset=null},n.prototype.removeDom=function(){var n=this,i,r;n.sheet.disposed||(i=n.sheet.getCellType(n.rowIndex,n.columnIndex),r={sheet:n.sheet,row:n.rowIndex,col:n.columnIndex,sheetArea:3},i.deactivateEditor(n.dom,r));t.GC$(n.dom).remove();n.dom=null},n.prototype.save=function(n){var t=this;n._formulaTextBox&&(t.text=n._formulaTextBox.text(),t.rowIndex=n.getActiveRowIndex(),t.columnIndex=n.getActiveColumnIndex(),t.caret=n._formulaTextBox.caret(),t.isAppending=n._formulaTextBox.isAppending(),t.appendingIndex=n._formulaTextBox.appendingStartIndex(),t.sheet=n,t.spread=n.parent,t.canvasOffset=n._eventHandler._getCanvasPosition())},n.prototype.update=function(n){var t=this;n._formulaTextBox&&(t.text=n._formulaTextBox.text(),t.caret=n._formulaTextBox.caret(),t.isAppending=n._formulaTextBox.isAppending(),t.appendingIndex=n._formulaTextBox.appendingStartIndex())},n.prototype.exportInfo=function(n){var t=this;n._formulaTextBox&&(n._formulaTextBox.text(t.text),n._formulaTextBox.caret(t.caret),t.isAppending&&(n._formulaTextBox.startAppending(),n._formulaTextBox.appendingStartIndex(t.appendingIndex)))},n.prototype.handleFormulatextboxBeforeChange=function(n,t){var r=this,u;if(n._formulaTextBox&&n._formulaTextBox.close(),(!r.sheet||r.sheet.disposed)&&n._formulaTextBox&&n._formulaTextBox.canAppendRange()){r.save(n);u=n.getValue(n._activeRowIndex,n._activeColIndex,3);n.suspendEvent();try{if(!n.endEdit(!0))return}finally{n.resumeEvent()}n.setValue(n._activeRowIndex,n._activeColIndex,u,3,!0);n._editorStatus=1;return}if(r.text&&r.sheet===t&&n._formulaTextBox){r.update(n);n._formulaTextBox.destroy();n._formulaTextBox=i;return}r.text&&r.sheet!==t&&n._formulaTextBox&&(r.update(n),n._formulaTextBox.destroy(),n._formulaTextBox=i)},n.prototype.handleFormulatextboxAfterChange=function(n,t,i){typeof i=="undefined"&&(i=!0);var r=this;if(!t.disposed){if(r.dom&&r.text===""&&(n._loadAndSetSheetSelections(),r.clear()),r.text&&r.sheet===t){t._editorStatus=0;t._setActiveCellAndSelection(r.rowIndex,r.columnIndex,f,f,1);i&&(t.suspendEvent(),t.startEdit(!1),r.exportInfo(t),r.updateEditor(t,r.rowIndex,r.columnIndex),t.resumeEvent(),n._loadAndSetSheetSelections());r.clear();return}if(r.text&&!r.dom){t._editorStatus=1;n._editorStatus=1;r.createHiddenDomForFormulaAcrossSheet(t);t._saveAndClearSheetSelections();return}if(r.text&&r.sheet!==t){t._editorStatus=1;n._editorStatus=1;r.createHiddenDomForFormulaAcrossSheet(t);n._loadAndSetSheetSelections();t._saveAndClearSheetSelections();return}}},n.prototype.createHiddenDomForFormulaAcrossSheet=function(n){var r=this,e=r.sheet,c,l,a,v;if(!e.disposed){var o=r.rowIndex,s=r.columnIndex,f=e.getCellType(o,s),h={sheet:e,row:o,col:s,sheetArea:3,canvasOffset:this.canvasOffset},y=f.isImeAware(h),u;y&&(n._editorStatus=1,u=f.createEditorElement(h),r.dom&&r.removeDom(),r.dom=u,t.GC$(u).css("position","absolute"),c=e.getCellRect(o,s),t.GC$(u).attr("id","across"),l=e.getActualStyle(o,s),f.activateEditor(u,l,c,h),a=r.spread&&r.spread.getHost()||document.body,a.insertBefore(u,i),v=f.getEditingElement(),n._attachFormulaTextBox(v),f.focus(u),r.exportInfo(n),f.updateEditor(u,l,c,h))}},n.prototype.updateEditor=function(n,t,i){var e=n.getCellType(t,i),o=n._editor,u=n._getSheetLayout(),s=n.getActualStyle(t,i),r=n.getCellRect(t,i),f;r&&r.width>0&&r.height>0&&r.x>=u.frozenX&&r.y>=u.frozenY&&r.x+r.width<=u.frozenTrailingX+u.frozenTrailingWidth&&r.y+r.height<=u.frozenTrailingY+u.frozenTrailingHeight&&(f={sheet:n,row:t,col:i,sheetArea:3},e.updateEditor(o,s,r,f))},n}();t.FormulatextboxAcrossSheet=l;o=function(n){function i(){n.apply(this,arguments)}return __extends(i,n),i.handleFormulatextboxAcrossSheetBeforeTabChange=function(n,i){var r=i.oldSheet,u=i.newSheet;r!==u&&(t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance||(t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance=new l),t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance.handleFormulatextboxBeforeChange(r,u))},i.handleFormulatextboxAcrossSheetAfterTabChange=function(n,i){var r=i.oldSheet,u=i.newSheet;r!==u&&t.IFormulatextboxAcrossSheetSingleton.formulatextboxAcrossSheetInstance.handleFormulatextboxAfterChange(r,u)},i}(t.IFormulatextboxAcrossSheetSingleton);t.FormulatextboxAcrossSheetSingleton=o})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){n.feature("formulatextbox_resource");var r=function(){function n(n,t){this.name=n;this.description=t}return n}(),t=function(){function n(n,t){this.name=n;this.repeatable=t}return n}(),i=function(){function n(n,t,i){this.name=n;this.description=t;this.parameters=i}return n}(),u=function(){function n(){}return n.Table_Functions=[new r("#All","Returns the entire contents of the table, or specified table columns including column headers, data and total rows."),new r("#Data","Returns the data cells of the table or specified table columns."),new r("#Headers","Returns the columns headers for the table, or specified table columns."),new r("#Totals","Returns the total rows for the table or specified table columns."),new r("@","This row.")],n.Functions=[new i("ABS","This function calculates the absolute value of the specified value.",[new t("value")]),new i("ACCRINT","This function calculates the accrued interest for a security that pays periodic interest.",[new t("issue"),new t("first"),new t("settle"),new t("rate"),new t("par"),new t("frequency"),new t("basis")]),new i("ACCRINTM","This function calculates the accrued interest at maturity for a security that pays periodic interest.",[new t("issue"),new t("maturity"),new t("rate"),new t("par"),new t("basis")]),new i("ACOS","This function calculates the arccosine, that is, the angle whose cosine is the specified value.",[new t("value")]),new i("ACOSH","This function calculates the inverse hyperbolic cosine of the specified value.",[new t("value")]),new i("ADDRESS","This function uses the row and column numbers to create a cell address in text.",[new t("row"),new t("column"),new t("absnum"),new t("a1style"),new t("sheettext")]),new i("AMORDEGRC","This function returns the depreciation for an accounting period, taking into consideration prorated depreciation, and applies a depreciation coefficient in the calculation based on the life of the assets.",[new t("cost"),new t("datepurchased"),new t("firstperiod"),new t("salvage"),new t("period"),new t("drate"),new t("basis")]),new i("AMORLINC","This function calculates the depreciation for an accounting period, taking into account prorated depreciation.",[new t("cost"),new t("datepurchased"),new t("firstperiod"),new t("salvage"),new t("period"),new t("drate"),new t("basis")]),new i("AND","Check whether all arguments are True, and returns True if all arguments are True.",[new t("logical1"),new t("logical2")]),new i("ASIN","This function calculates the arcsine, that is, the angle whose sine is the specified value.",[new t("value")]),new i("ASINH","This function calculates the inverse hyperbolic sine of a number.",[new t("value")]),new i("ATAN","This function calculates the arctangent, that is, the angle whose tangent is the specified value.",[new t("value")]),new i("ATAN2","This function calculates the arctangent of the specified x- and y-coordinates.",[new t("x"),new t("y")]),new i("ATANH","This function calculates the inverse hyperbolic tangent of a number.",[new t("value")]),new i("AVEDEV","This function calculates the average of the absolute deviations of the specified values from their mean.",[new t("value1"),new t("value2",!0)]),new i("AVERAGE","This function calculates the average of the specified numeric values.",[new t("value1"),new t("value2",!0)]),new i("AVERAGEA","This function calculates the average of the specified values, including text or logical values as well as numeric values.",[new t("value1"),new t("value2",!0)]),new i("AVERAGEIF","This function calculates the average of the specified numeric values provided that they meet the specified criteria.",[new t("value1"),new t("value2",!0),new t("condition")]),new i("AVERAGEIFS","This function calculates the average of all cells that meet multiple specified criteria.",[new t("value1"),new t("condition1"),new t("value2",!0),new t("condition2...")]),new i("BESSELI","This function calculates the modified Bessel function of the first kind evaluated for purely imaginary arguments.",[new t("value"),new t("order")]),new i("BESSELJ","This function calculates the Bessel function of the first kind.",[new t("value"),new t("order")]),new i("BESSELK","This function calculates the modified Bessel function of the second kind evaluated for purely imaginary arguments.",[new t("value"),new t("order")]),new i("BESSELY","This function calculates the Bessel function of the second kind.",[new t("value"),new t("order")]),new i("BETADIST","This function calculates the cumulative beta distribution function.",[new t("x"),new t("alpha"),new t("beta"),new t("lower"),new t("upper")]),new i("BETAINV","This function calculates the inverse of the cumulative beta distribution function.",[new t("prob"),new t("alpha"),new t("beta"),new t("lower"),new t("upper")]),new i("BIN2DEC","This function converts a binary number to a decimal number",[new t("number")]),new i("BIN2HEX","This function converts a binary number to a hexadecimal number.",[new t("number"),new t("places")]),new i("BIN2OCT","This function converts a binary number to an octal number.",[new t("number"),new t("places")]),new i("BINOMDIST","This function calculates the individual term binomial distribution probability.",[new t("x"),new t("n"),new t("p"),new t("cumulative")]),new i("CEILING","This function rounds a number up to the nearest multiple of a specified value.",[new t("value"),new t("signif")]),new i("CHAR","This function returns the character specified by a number.",[new t("value")]),new i("CHIDIST","This function calculates the one-tailed probability of the chi-squared distribution.",[new t("value"),new t("deg")]),new i("CHIINV","This function calculates the inverse of the one-tailed probability of the chi-squared distribution",[new t("prob"),new t("deg")]),new i("CHITEST","This function calculates the test for independence from the chi-squared distribution.",[new t("obs_array"),new t("exp_array")]),new i("CHOOSE","This function returns a value from a list of values.",[new t("index"),new t("value1"),new t("value2",!0)]),new i("CLEAN","This function removes all non-printable characters from text.",[new t("text")]),new i("CODE","This function returns a numeric code to represent the first character in a text string. The returned code corresponds to the Windows character set (ANSI).",[new t("text")]),new i("COLUMN","This function returns the column number of a reference.",[new t("reference")]),new i("COLUMNS","This function returns the number of columns in an array.",[new t("array")]),new i("COMBIN","This function calculates the number of possible combinations for a specified number of items.",[new t("k"),new t("n")]),new i("COMPLEX","This function converts real and imaginary coefficients into a complex number.",[new t("realcoeff"),new t("imagcoeff"),new t("suffix")]),new i("CONCATENATE","This function combines multiple text strings or numbers into one text string.",[new t("text1"),new t("text2"),new t("....")]),new i("CONFIDENCE","This function returns confidence interval for a population mean.",[new t("alpha"),new t("stdev"),new t("size")]),new i("CONVERT","This function converts a number from one measurement system to its equivalent in another measurement system.",[new t("number"),new t("from-unit"),new t("to-unit")]),new i("CORREL","This function returns the correlation coefficient of the two sets of data.",[new t("array1"),new t("array2")]),new i("COS","This function returns the cosine of the specified angle.",[new t("angle")]),new i("COSH","This function returns the hyperbolic cosine of the specified value.",[new t("value")]),new i("COUNT","This function returns the number of cells that contain numbers.",[new t("value1"),new t("value2",!0)]),new i("COUNTA","This function returns the number of number of cells that contain numbers, text, or logical values.",[new t("value1"),new t("value2",!0)]),new i("COUNTBLANK","This function returns the number of empty (or blank) cells in a range of cells on a sheet.",[new t("cellrange")]),new i("COUNTIF","This function returns the number of cells that meet a certain condition",[new t("cellrange"),new t("condition")]),new i("COUNTIFS","This function returns the number of cells that meet multiple conditions.",[new t("cellrange"),new t("condition")]),new i("COUPDAYBS","This function calculates the number of days from the beginning of the coupon period to the settlement date.",[new t("settlement"),new t("maturity"),new t("frequency"),new t("basis")]),new i("COUPDAYS","This function returns the number of days in the coupon period that contains the settlement date.",[new t("settlement"),new t("maturity"),new t("frequency"),new t("basis")]),new i("COUPDAYSNC","This function calculates the number of days from the settlement date to the next coupon date.",[new t("settlement"),new t("maturity"),new t("frequency"),new t("basis")]),new i("COUPNCD","This function returns a date number of the next coupon date after the settlement date.",[new t("settlement"),new t("maturity"),new t("frequency"),new t("basi")]),new i("COUPNUM","This function returns the number of coupons due between the settlement date and maturity date.",[new t("settlement"),new t("maturity"),new t("frequency"),new t("basis")]),new i("COUPPCD","This function returns a date number of the previous coupon date before the settlement date.",[new t("settlement"),new t("maturity"),new t("frequency"),new t("basis")]),new i("COVAR","This function returns the covariance, which is the average of the products of deviations for each data point pair in two sets of numbers.",[new t("array1"),new t("array2")]),new i("CRITBINOM","This function returns the criterion binomial, the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.",[new t("n"),new t("p"),new t("alpha")]),new i("CUMIPMT","This function returns the cumulative interest paid on a loan between the starting and ending periods.",[new t("rate"),new t("nper"),new t("pval"),new t("startperiod"),new t("endperiod"),new t("paytype")]),new i("CUMPRINC","This function returns the cumulative principal paid on a loan between the start and end periods.",[new t("rate"),new t("nper"),new t("pval"),new t("startperiod"),new t("endperiod"),new t("paytype")]),new i("DATE","This function returns the DateTime object for a particular date, specified by the year, month, and day.",[new t("year"),new t("month"),new t("day")]),new i("DATEDIF","This function returns the number of days, months, or years between two dates.",[new t("date1"),new t("date2"),new t("outputcode")]),new i("DATEVALUE","This function returns a DateTime object of the specified date.",[new t("date_string")]),new i("DAVERAGE","This function calculates the average of values in a column of a list or database that match the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DAY","This function returns the day number of the month (integer 1 to 31) that corresponds to the specified date.",[new t("date")]),new i("DAYS360","This function returns the number of days between two dates based on a 360-day year.",[new t("startdate"),new t("enddate"),new t("method")]),new i("DB","This function calculates the depreciation of an asset for a specified period using the fixed\u2011declining balance method",[new t("cost"),new t("salvage"),new t("life"),new t("period"),new t("month")]),new i("DCOUNT","This function counts the cells that contain numbers in a column of a list or database that match the specified conditions",[new t("database"),new t(" field"),new t(" criteria")]),new i("DCOUNTA","This function counts the non-blank cells in a column of a list or database that match the specified conditions",[new t("database"),new t(" field"),new t(" criteria")]),new i("DDB","This function calculates the depreciation of an asset for a specified period using the double-declining balance method or another method you specify.",[new t("cost"),new t("salvage"),new t("life"),new t("period"),new t("factor")]),new i("DEC2BIN","This function converts a decimal number to a binary number.",[new t("number"),new t("places")]),new i("DEC2HEX","This function converts a decimal number to a hexadecimal number",[new t("number"),new t("places")]),new i("DEC2OCT","This function converts a decimal number to an octal number",[new t("number"),new t("places")]),new i("DEGREES","This function converts the specified value from radians to degrees",[new t("angle")]),new i("DELTA","This function identifies whether two values are equal. Returns 1 if they are equal; returns 0 otherwise.",[new t("value1"),new t("value2")]),new i("DEVSQ","This function calculates the sum of the squares of deviations of data points (or of an array of data points) from their sample mean.",[new t("value1"),new t("value2",!0)]),new i("DGET","This function extracts a single value from a column of a list or database that matches the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DISC","This function calculates the discount rate for a security.",[new t("settle"),new t("mature"),new t("pricep"),new t("redeem"),new t("basis")]),new i("DMAX","This function returns the largest number in a column of a list or database that matches the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DMIN","This function returns the smallest number in a column of a list or database that matches the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DOLLAR","This function converts a number to text using currency format, with the decimals rounded to the specified place.",[new t("value"),new t("digits")]),new i("DOLLARDE","This function converts a fraction dollar price to a decimal dollar price.",[new t("fractionaldollar"),new t("fraction")]),new i("DOLLARFR","This function converts a decimal number dollar price to a fraction dollar price.",[new t("decimaldollar"),new t("fraction")]),new i("DPRODUCT","This function multiplies the values in a column of a list or database that match the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DSTDEV","This function estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DSTDEVP","This function calculates the standard deviation of a population based on the entire population using the numbers in a column of a list or database that match the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DSUM","This function adds the numbers in a column of a list or database that match the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DURATION","This function returns the Macaulay duration for an assumed par value of $100.",[new t("settlement"),new t("maturity"),new t("coupon"),new t("yield"),new t("frequency"),new t("basis")]),new i("DVAR","This function estimates the variance of a population based on a sample by using the numbers in a column of a list or database that match the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("DVARP","This function calculates the variance of a population based on the entire population by using the numbers in a column of a list or database that match the specified conditions.",[new t("database"),new t(" field"),new t(" criteria")]),new i("EDATE","This function calculates the date that is the indicated number of months before or after a specified date.",[new t("startdate"),new t("months")]),new i("EFFECT","This function calculates the effective annual interest rate for a given nominal annual interest rate and the number of compounding periods per year.",[new t("nomrate"),new t("comper")]),new i("EOMONTH","This function calculates the date for the last day of the month (end of month) that is the indicated number of months before or after the starting date.",[new t("startdate"),new t("months")]),new i("ERF","This function calculates the error function integrated between a lower and an upper limit.",[new t("limit"),new t("upperlimit")]),new i("ERFC","This function calculates the complementary error function integrated between a lower limit and infinity.",[new t("lowerlimit")]),new i("ERROR.TYPE","This function returns a number corresponding to one of the error values.",[new t("errorvalue")]),new i("EURO","This function returns the equivalent of one Euro based on the ISO currency code.",[new t("code")]),new i("EUROCONVERT","This function converts currency from a Euro member currency (including Euros) to another Euro member currency (including Euros).",[new t("currency"),new t("source"),new t("target"),new t("fullprecision"),new t("triangulation")]),new i("EVEN","This function rounds the specified value up to the nearest even integer.",[new t("value")]),new i("EXACT","This function returns true if two strings are the same; otherwise, false.",[new t("text1"),new t("text2")]),new i("EXP","This function returns e raised to the power of the specified value.",[new t("value")]),new i("EXPONDIST","This function returns the exponential distribution or the probability density.",[new t("value"),new t("lambda"),new t("cumulative")]),new i("FACT","This function calculates the factorial of the specified number.",[new t("number")]),new i("FACTDOUBLE","This function calculates the double factorial of the specified number.",[new t("number")]),new i("FALSE","This function returns the value for logical FALSE.",[]),new i("FDIST","This function calculates the F probability distribution, to see degrees of diversity between two sets of data.",[new t("value"),new t("degnum"),new t("degden")]),new i("FIND","This function finds one text value within another and returns the text value\u2019s position in the text you searched.",[new t("findtext"),new t("intext"),new t("start")]),new i("FINV","This function returns the inverse of the F probability distribution.",[new t("p"),new t("degnum"),new t("degden")]),new i("FISHER","This function returns the Fisher transformation for a specified value.",[new t("value")]),new i("FISHERINV","This function returns the inverse of the Fisher transformation for a specified value.",[new t("value")]),new i("FIXED","This function rounds a number to the specified number of decimal places, formats the number in decimal format using a period and commas (if so specified), and returns the result as text.",[new t("num"),new t("digits"),new t("notcomma")]),new i("FLOOR","This function rounds a number down to the nearest multiple of a specified value.",[new t("value"),new t("signif")]),new i("FORECAST","This function calculates a future value using existing values.",[new t("value"),new t("Yarray"),new t("Xarray")]),new i("FREQUENCY","This function calculates how often values occur within a range of values. This function returns a vertical array of numbers.",[new t("dataarray"),new t("binarray")]),new i("FTEST","This function returns the result of an F-test, which returns the one-tailed probability that the variances in two arrays are not significantly different.",[new t("array1"),new t("array2")]),new i("FV","This function returns the future value of an investment based on a present value, periodic payments, and a specified interest rate.",[new t("rate"),new t("numper"),new t("paymt"),new t("pval"),new t("type")]),new i("FVSCHEDULE","This function returns the future value of an initial principal after applying a series of compound interest rates. Calculate future value of an investment with a variable or adjustable rate.",[new t("principal"),new t("schedule")]),new i("GAMMADIST","This function returns the gamma distribution.",[new t("x"),new t("alpha"),new t("beta"),new t("cumulative")]),new i("GAMMAINV","This function returns the inverse of the gamma cumulative distribution.",[new t("p"),new t("alpha"),new t("beta")]),new i("GAMMALN","This function returns the natural logarithm of the Gamma function, G(x).",[new t("value")]),new i("GCD","This function returns the greatest common divisor of two numbers.",[new t("number1"),new t("number2")]),new i("GEOMEAN","This function returns the geometric mean of a set of positive data.",[new t("value1"),new t("value2",!0)]),new i("GESTEP","This function, greater than or equal to step, returns an indication of whether a number is equal to a threshold.",[new t("number"),new t("step")]),new i("GROWTH","This function calculates predicted exponential growth. This function returns the y values for a series of new x values that are specified by using existing x and y values.",[new t("y"),new t("x"),new t("newx"),new t("constant")]),new i("HARMEAN","This function returns the harmonic mean of a data set.",[new t("value1"),new t("value2",!0)]),new i("HEX2BIN","This function converts a hexadecimal number to a binary number.",[new t("number"),new t(" places")]),new i("HEX2DEC","This function converts a hexadecimal number to a decimal number.",[new t("number")]),new i("HEX2OCT","This function converts a hexadecimal number to an octal number.",[new t("number"),new t(" places")]),new i("HLOOKUP","This function searches for a value in the top row and then returns a value in the same column from a specified row.",[new t("value"),new t("array"),new t("row"),new t("approx")]),new i("HOUR","This function returns the hour that corresponds to a specified time.",[new t("time")]),new i("HYPGEOMDIST","This function returns the hypergeometric distribution.",[new t("x"),new t("n"),new t("M"),new t("N")]),new i("IF","This function performs a comparison and returns one of two provided values based on that comparison.",[new t("valueTest"),new t("valueTrue"),new t("valueFalse")]),new i("IFERROR","This function evaluates a formula and returns a value you provide if there is an error or the formula result.",[new t("value"),new t("error")]),new i("IMABS","This function returns the absolute value or modulus of a complex number.",[new t("complexnum")]),new i("IMAGINARY","This function returns the imaginary coefficient of a complex number.",[new t("complexnum")]),new i("IMARGUMENT","This function returns the argument theta, which is an angle expressed in radians.",[new t("complexnum")]),new i("IMCONJUGATE","This function returns the complex conjugate of a complex number.",[new t("complexnum")]),new i("IMCOS","This function returns the cosine of a complex number.",[new t("complexnum")]),new i("IMDIV","This function returns the quotient of two complex numbers.",[new t("complexnum"),new t("complexdenom")]),new i("IMEXP","This function returns the exponential of a complex number.",[new t("complexnum")]),new i("IMLN","This function returns the natural logarithm of a complex number.",[new t("complexnum")]),new i("IMLOG2","This function returns the base-2 logarithm of a complex number.",[new t("complexnum")]),new i("IMLOG10","This function returns the common logarithm of a complex number.",[new t("complexnum")]),new i("IMPOWER","This function returns a complex number raised to a power.",[new t("complexnum"),new t("powernum")]),new i("IMPRODUCT","This function returns the product of up to 29 complex numbers in the x+yi or x+yj text format.",[new t("complexnum1"),new t("complexnum2",!0)]),new i("IMREAL","This function returns the real coefficient of a complex number in the x+yi or x+yj text format.",[new t("complexnum")]),new i("IMSIN","This function returns the sine of a complex number in the x+yi or x+yj text format.",[new t("complexnum")]),new i("IMSQRT","This function returns the square root of a complex number in the x+yi or x+yj text format.",[new t("complexnum")]),new i("IMSUB","This function returns the difference of two complex numbers in the x+yi or x+yj text format.",[new t("complexnum1"),new t("complexnum2")]),new i("IMSUM","This function returns the sum of two or more complex numbers in the x+yi or x+yj text format.",[new t("complexnum1"),new t("complexnum2",!0)]),new i("INDEX","This function returns a value or the reference to a value from within an array or range.",[new t("return"),new t("row"),new t("col"),new t("area")]),new i("INDIRECT","This function returns the reference specified by a text string. References are immediately evaluated to display their contents.",[new t("ref_text"),new t("a1_style")]),new i("INT","This function rounds a specified number down to the nearest integer.",[new t("value")]),new i("INTERCEPT","This function returns the coordinates of a point at which a line intersects the y-axis, by using existing x values and y values.",[new t("dependent"),new t("independent")]),new i("INTRATE","This function calculates the interest rate for a fully invested security.",[new t("settle"),new t("mature"),new t("invest"),new t("redeem"),new t("basis")]),new i("IPMT","This function calculates the payment of interest on a loan.",[new t("rate"),new t("per"),new t("nper"),new t("pval"),new t("fval"),new t("type")]),new i("IRR","This function returns the internal rate of return for a series of cash flows represented by the numbers in an array.",[new t("arrayvals"),new t("estimate")]),new i("ISBLANK","This function tests whether a value, an expression, or contents of a referenced cell is empty.",[new t("cellreference")]),new i("ISERR","This function, Is Error Other Than Not Available, tests whether a value, an expression, or contents of a referenced cell has an error other than not available (#N/A).",[new t("cellreference")]),new i("ISERROR","This function, Is Error of Any Kind, tests whether a value, an expression, or contents of a referenced cell has an error of any kind.",[new t("cellreference")]),new i("ISEVEN","This function, Is Number Even, tests whether a value, an expression, or contents of a referenced cell is even.",[new t("cellreference")]),new i("ISLOGICAL","This function tests whether a value, an expression, or contents of a referenced cell is a logical (Boolean) value.",[new t("cellreference")]),new i("ISNA","This function, Is Not Available, tests whether a value, an expression, or contents of a referenced cell has the not available (#N/A) error value.",[new t("cellreference")]),new i("ISNONTEXT","This function tests whether a value, an expression, or contents of a referenced cell has any data type other than text.",[new t("cellreference")]),new i("ISNUMBER","This function tests whether a value, an expression, or contents of a referenced cell has numeric data.",[new t("cellreference")]),new i("ISODD","This function, Is Number Odd, tests whether a value, an expression, or contents of a referenced cell has numeric data.",[new t("cellreference")]),new i("ISPMT","This function calculates the interest paid during a specific period of an investment.",[new t("rate"),new t("per"),new t("nper"),new t("pv")]),new i("ISREF","This function, Is Reference, tests whether a value, an expression, or contents of a referenced cell is a reference to another cell.",[new t("cellreference")]),new i("ISTEXT","This function tests whether a value, an expression, or contents of a referenced cell has text data.",[new t("cellreference")]),new i("KURT","This function returns the kurtosis of a data set.",[new t("value1"),new t("value2"),new t("value3"),new t("value4",!0)]),new i("LARGE","This function returns the nth largest value in a data set, where n is specified.",[new t("array"),new t("n")]),new i("LCM","This function returns the least common multiple of two numbers.",[new t("number1"),new t("number2")]),new i("LEFT","This function returns the specified leftmost characters from a text value.",[new t("mytext"),new t("num_chars")]),new i("LEN","This function returns the length of, the number of characters in, a text string.",[new t("value")]),new i("LINEST","This function calculates the statistics for a line.",[new t("y"),new t("x"),new t("constant"),new t("stats")]),new i("LN","This function returns the natural logarithm of the specified number.",[new t("value")]),new i("LOG","This function returns the logarithm base Y of a number X.",[new t("number"),new t("base")]),new i("LOG10","This function returns the logarithm base 10 of the number given.",[new t("value")]),new i("LOGEST","This function calculates an exponential curve that fits the data and returns an array of values that describes the curve.",[new t("y"),new t("x"),new t("constant"),new t("stats")]),new i("LOGINV","This function returns the inverse of the lognormal cumulative distribution function of x, where LN(x) is normally distributed with the specified mean and standard deviation.",[new t("prob"),new t("mean"),new t("stdev")]),new i("LOGNORMDIST","This function returns the cumulative natural log normal distribution of x, where LN(x) is normally distributed with the specified mean and standard deviation. Analyze data that has been logarithmically transformed with this function.",[new t("x"),new t("mean"),new t("stdev")]),new i("LOOKUP","This function searches for a value and returns a value from the same location in a second area.",[new t("lookupvalue"),new t("lookupvector"),new t("resultvector")]),new i("LOWER","This function converts text to lower case letters.",[new t("string")]),new i("MATCH","This function returns the relative position of a specified item in a range.",[new t("value1"),new t("array"),new t("type")]),new i("MAX","This function returns the maximum value, the greatest value, of all the values in the arguments.",[new t("value1"),new t("value2",!0)]),new i("MAXA","This function returns the largest value in a list of arguments, including text and logical values.",[new t("value1"),new t("value2",!0)]),new i("MDETERM","This function returns the matrix determinant of an array.",[new t("array")]),new i("MDURATION","This function calculates the modified Macaulay duration of a security with an assumed par value of $100.",[new t("settlement"),new t("maturity"),new t("coupon"),new t("yield"),new t("frequency"),new t("basis")]),new i("MEDIAN","This function returns the median, the number in the middle of the provided set of numbers; that is, half the numbers have values that are greater than the median, and half have values that are less than the median.",[new t("value1"),new t("value2",!0)]),new i("MID","This function returns the requested number of characters from a text string starting at the position you specify.",[new t("text"),new t("start_num"),new t("num_chars")]),new i("MIN","This function returns the minimum value, the least value, of all the values in the arguments.",[new t("value1"),new t("value2",!0)]),new i("MINA","This function returns the minimum value in a list of arguments, including text and logical values.",[new t("value1"),new t("value2",!0)]),new i("MINUTE","This function returns the minute corresponding to a specified time.",[new t("time")]),new i("MINVERSE","This function returns the inverse matrix for the matrix stored in an array.",[new t("array")]),new i("MIRR","This function returns the modified internal rate of return for a series of periodic cash flows.",[new t("arrayvals"),new t("payment_int"),new t("income_int")]),new i("MMULT","This function returns the matrix product for two arrays.",[new t("array1"),new t("array2")]),new i("MOD","This function returns the remainder of a division operation.",[new t("dividend"),new t("divisor")]),new i("MODE","This function returns the most frequently occurring value in a set of data.",[new t("value1"),new t("value2",!0)]),new i("MONTH","This function returns the month corresponding to the specified date value.",[new t("date")]),new i("MROUND","This function returns a number rounded to the desired multiple.",[new t("number"),new t("multiple")]),new i("MULTINOMIAL","This function calculates the ratio of the factorial of a sum of values to the product of factorials.",[new t("value1"),new t("value2",!0)]),new i("N","This function returns a value converted to a number.",[new t("value")]),new i("NA","This function returns the error value #N/A that means not available.",[]),new i("NEGBINOMDIST","This function returns the negative binomial distribution.",[new t("x"),new t("r"),new t("p")]),new i("NETWORKDAYS","This function returns the total number of complete working days between the start and end dates.",[new t("startdate"),new t("enddate"),new t("holidays")]),new i("NOMINAL","This function returns the nominal annual interest rate for a given effective rate and number of compounding periods per year.",[new t("effrate"),new t("comper")]),new i("NORMDIST","This function returns the normal cumulative distribution for the specified mean and standard deviation.",[new t("x"),new t("mean"),new t("stdev"),new t("cumulative")]),new i("NORMINV","This function returns the inverse of the normal cumulative distribution for the given mean and standard deviation.",[new t("prob"),new t("mean"),new t("stdev")]),new i("NORMSDIST","This function returns the standard normal cumulative distribution function.",[new t("value")]),new i("NORMSINV","This function returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one.",[new t("prob")]),new i("NOT","This function reverses the logical value of its argument.",[new t("value")]),new i("NOW","This function returns the current date and time.",[]),new i("NPER","This function returns the number of periods for an investment based on a present value, future value, periodic payments, and a specified interest rate.",[new t("rate"),new t("paymt"),new t("pval"),new t("fval"),new t("type")]),new i("NPV","This function calculates the net present value of an investment by using a discount rate and a series of future payments and income.",[new t("discount"),new t("value1"),new t("value2",!0)]),new i("OCT2BIN","This function converts an octal number to a binary number.",[new t("number"),new t("places")]),new i("OCT2DEC","This function converts an octal number to a decimal number.",[new t("number")]),new i("OCT2HEX","This function converts an octal number to a hexadecimal number.",[new t("number"),new t("places")]),new i("ODD","This function rounds the specified value up to the nearest odd integer.",[new t("value")]),new i("ODDFPRICE","This function calculates the price per $100 face value of a security with an odd first period.",[new t("settle"),new t("maturity"),new t("issue"),new t("first"),new t("rate"),new t("yield"),new t("redeem"),new t("freq"),new t("basis")]),new i("ODDFYIELD","This function calculates the yield of a security with an odd first period.",[new t("settle"),new t("maturity"),new t("issue"),new t("first"),new t("rate"),new t("price"),new t("redeem"),new t("freq"),new t("basis")]),new i("ODDLPRICE","This function calculates the price per $100 face value of a security with an odd last coupon period.",[new t("settle"),new t("maturity"),new t("last"),new t("rate"),new t("yield"),new t("redeem"),new t("freq"),new t("basis")]),new i("ODDLYIELD","This function calculates the yield of a security with an odd last period.",[new t("settle"),new t("maturity"),new t("last"),new t("rate"),new t("price"),new t("redeem"),new t("freq"),new t("basis")]),new i("OFFSET","This function returns a reference to a range. The range is a specified number of rows and columns from a cell or range of cells. The function returns a single cell or a range of cells.",[new t("reference"),new t("rows"),new t("cols"),new t("height"),new t("width")]),new i("OR","This function calculates logical OR. It returns TRUE if any of its arguments are true; otherwise, returns FALSE if all arguments are false.",[new t("argument1"),new t("argument2...")]),new i("PEARSON","This function returns the Pearson product moment correlation coefficient, a dimensionless index between -1.0 to 1.0 inclusive indicative of the linear relationship of two data sets.",[new t("array_ind"),new t("array_dep")]),new i("PERCENTILE","This function returns the nth percentile of values in a range.",[new t("array"),new t("n")]),new i("PERCENTRANK","This function returns the rank of a value in a data set as a percentage of the data set.",[new t("array"),new t("n"),new t("sigdig")]),new i("PERMUT","This function returns the number of possible permutations for a specified number of items.",[new t("k"),new t("n")]),new i("PI","This function returns PI as 3.1415926536.",[]),new i("PMT","This function returns the payment amount for a loan given the present value, specified interest rate, and number of terms.",[new t("rate"),new t("nper"),new t("pval"),new t("fval"),new t("type")]),new i("POISSON","This function returns the Poisson distribution.",[new t("nevents"),new t("mean"),new t("cumulative")]),new i("POWER","This function raises the specified number to the specified power.",[new t("number"),new t("power")]),new i("PPMT","This function returns the amount of payment of principal for a loan given the present value, specified interest rate, and number of terms.",[new t("rate"),new t("per"),new t("nper"),new t("pval"),new t("fval"),new t("type")]),new i("PRICE","This function calculates the price per $100 face value of a periodic interest security",[new t("settlement"),new t("maturity"),new t("rate"),new t("yield"),new t("redeem"),new t("frequency"),new t("basis")]),new i("PRICEDISC","This function returns the price per $100 face value of a discounted security.",[new t("settle"),new t("mature"),new t("discount"),new t("redeem"),new t("basis")]),new i("PRICEMAT","This function returns the price at maturity per $100 face value of a security that pays interest.",[new t("settle"),new t("mature"),new t("issue"),new t("rate"),new t("yield"),new t("basis")]),new i("PROB","This function returns the probability that values in a range are between two limits.",[new t("array"),new t("probs"),new t("lower"),new t("upper")]),new i("PRODUCT","This function multiplies all the arguments and returns the product.",[new t("value1"),new t("value2",!0)]),new i("PROPER","This function capitalizes the first letter in each word of a text string.",[new t("text")]),new i("PV","This function returns the present value of an investment based on the interest rate, number and amount of periodic payments, and future value. The present value is the total amount that a series of future payments is worth now.",[new t("rate"),new t("numper"),new t("paymt"),new t("fval"),new t("type")]),new i("QUARTILE","This function returns which quartile (which quarter or 25 percent) of a data set a value is.",[new t("array"),new t("quart")]),new i("QUOTIENT","This function returns the integer portion of a division. Use this to ignore the remainder of a division.",[new t("numerator"),new t("denominator")]),new i("RADIANS","This function converts the specified number from degrees to radians.",[new t("value")]),new i("RADIANS","This function converts the specified number from degrees to radians.",[new t("value")]),new i("RAND","This function returns an evenly distributed random number between 0 and 1.",[]),new i("RANDBETWEEN","This function returns a random number between the numbers you specify.",[new t("lower"),new t("upper")]),new i("RANK","This function returns the rank of a number in a set of numbers. If you were to sort the set, the rank of the number would be its position in the list.",[new t("number"),new t("array"),new t("order")]),new i("RATE","This function returns the interest rate per period of an annuity.",[new t("nper"),new t("pmt"),new t("pval"),new t("fval"),new t("type"),new t("guess")]),new i("RECEIVED","This function returns the amount received at maturity for a fully invested security.",[new t("settle"),new t("mature"),new t("invest"),new t("discount"),new t("basis")]),new i("REPLACE","This function replaces part of a text string with a different text string.",[new t("old_text"),new t("start_char"),new t("num_chars"),new t("new_text")]),new i("REPT","This function repeats text a specified number of times.",[new t("text"),new t("number")]),new i("RIGHT","This function returns the specified rightmost characters from a text value.",[new t("text"),new t("num_chars")]),new i("ROMAN","This function converts an Arabic numeral to a Roman numeral text equivalent.",[new t("number"),new t("style")]),new i("ROUND","This function rounds the specified value to the nearest number, using the specified number of decimal places.",[new t("value"),new t("places")]),new i("ROUNDDOWN","This function rounds the specified number down to the nearest number, using the specified number of decimal places.",[new t("value"),new t("places")]),new i("ROUNDUP","This function rounds the specified number up to the nearest number, using the specified number of decimal places.",[new t("value"),new t("places")]),new i("ROW","This function returns the number of a row from a reference.",[new t("reference")]),new i("ROWS","This function returns the number of rows in an array.",[new t("array")]),new i("RSQ","This function returns the square of the Pearson product moment correlation coefficient (R\u2011squared) through data points in known y\u2019s and known x\u2019s.",[new t("array_dep"),new t("array_ind")]),new i("SEARCH","This function finds one text string in another text string and returns the index of the starting position of the found text.",[new t("string1"),new t("string2")]),new i("SECOND","This function returns the seconds (0 to 59) value for a specified time.",[new t("time")]),new i("SERIESSUM","This function returns the sum of a power series.",[new t("x"),new t("n"),new t("m"),new t("coeff")]),new i("SIGN","This function returns the sign of a number or expression.",[new t("cellreference")]),new i("SIN","This function returns the sine of the specified angle.",[new t("angle")]),new i("SINH","This function returns the hyperbolic sine of the specified number.",[new t("value")]),new i("SKEW","This function returns the skewness of a distribution.",[new t("number1"),new t("number2",!0)]),new i("SLN","This function returns the straight-line depreciation of an asset for one period.",[new t("cost"),new t("salvage"),new t("life")]),new i("SLOPE","This function calculates the slope of a linear regression.",[new t("array_dep"),new t("array_ind")]),new i("SMALL","This function returns the nth smallest value in a data set, where n is specified.",[new t("array"),new t("n")]),new i("SQRT","This function returns the positive square root of the specified number.",[new t("value")]),new i("SQRTPI","This function returns the positive square root of a multiple of pi (p).",[new t("multiple")]),new i("STANDARDIZE","This function returns a normalized value from a distribution characterized by mean and standard deviation.",[new t("x"),new t("mean"),new t("stdev")]),new i("STDEVA","This function returns the standard deviation for a set of numbers, text, or logical values.",[new t("value1"),new t("value2",!0)]),new i("STDEVP","This function returns the standard deviation for an entire specified population (of numeric values).",[new t("value1"),new t("value2",!0)]),new i("STDEVPA","This function returns the standard deviation for an entire specified population, including text or logical values as well as numeric values.",[new t("value1"),new t("value2",!0)]),new i("STEYX","This function returns the standard error of the predicted y value for each x. The standard error is a measure of the amount of error in the prediction of y for a value of x.",[new t("array_dep"),new t("array_ind")]),new i("SUBSTITUTE","This function substitutes a new string for specified characters in an existing string.",[new t("text"),new t("old_piece"),new t("new_piece"),new t("instance")]),new i("SUBTOTAL","This function calculates a subtotal of a list of numbers using a specified built-in function.",[new t("functioncode"),new t("value1"),new t("value2",!0)]),new i("SUM","This function returns the sum of cells or range of cells.",[new t("value1"),new t("value2",!0)]),new i("SUMIF","This function adds the cells using a given criteria.",[new t("array"),new t("condition"),new t("sumrange")]),new i("SUMIFS","This function adds the cells in a range using multiple criteria.",[new t("array"),new t("conditionarray"),new t("condition",!0)]),new i("SUMPRODUCT","This function returns the sum of products of cells. Multiplies corresponding components in the given arrays, and returns the sum of those products.",[new t("array1"),new t("array2",!0)]),new i("SUMSQ","This function returns the sum of the squares of the arguments.",[new t("value1"),new t("value2",!0)]),new i("SUMX2MY2","This function returns the sum of the difference of the squares of corresponding values in two arrays.",[new t("array_x"),new t("array_y")]),new i("SUMX2PY2","This function returns the sum of the sum of squares of corresponding values in two arrays.",[new t("array_x"),new t("array_y")]),new i("SUMXMY2","This function returns the sum of the square of the differences of corresponding values in two arrays.",[new t("array_x"),new t("array_y")]),new i("SYD","This function returns the sum-of-years\u2019 digits depreciation of an asset for a specified period.",[new t("cost"),new t("salvage"),new t("life"),new t("period")]),new i("T","This function returns the text in a specified cell.",[new t("value")]),new i("TAN","This function returns the tangent of the specified angle.",[new t("angle")]),new i("TANH","This function returns the hyperbolic tangent of the specified number.",[new t("value")]),new i("TBILLEQ","This function returns the equivalent yield for a Treasury bill (or T-bill)",[new t("settle"),new t("mature"),new t("discount")]),new i("TBILLPRICE","This function returns the price per $100 face value for a Treasury bill (or T-bill).",[new t("settle"),new t("mature"),new t("discount")]),new i("TBILLYIELD","This function returns the yield for a Treasury bill (or T-bill).",[new t("settle"),new t("mature"),new t("priceper")]),new i("TDIST","This function returns the probability for the t-distribution.",[new t("x"),new t("deg"),new t("tails")]),new i("TEXT","This function formats a number and converts it to text.",[new t("value"),new t("text")]),new i("TIME","This function returns the TimeSpan object for a specified time.",[new t("hour"),new t("minutes"),new t("seconds")]),new i("TIMEVALUE","This function returns the TimeSpan object of the time represented by a text string.",[new t("time_string")]),new i("TINV","This function returns the t-value of the student's t-distribution as a function of the probability and the degrees of freedom.",[new t("prog"),new t("deg")]),new i("TODAY","This function returns the date and time of the current date.",[]),new i("TRANSPOSE","This function returns a vertical range of cells as a horizontal range or a horizontal range of cells as a vertical range.",[new t("array")]),new i("TREND","This function returns values along a linear trend. This function fits a straight line to the arrays known x and y values. Trend returns the y values along that line for the array of specified new x values.",[new t("y"),new t("x"),new t("newx"),new t("constant")]),new i("TRIM","This function removes extra spaces from a string and leaves single spaces between words.",[new t("text")]),new i("TRIMMEAN","This function returns the mean of a subset of data excluding the top and bottom data.",[new t("array"),new t("percent")]),new i("TRUE","This function returns the value for logical TRUE.",[]),new i("TRUNC","This function removes the specified fractional part of the specified number.",[new t("value"),new t("precision")]),new i("TTEST","This function returns the probability associated with a t-test.",[new t("array1"),new t("array2"),new t("tails"),new t("type")]),new i("TYPE","This function returns the type of value.",[new t("value")]),new i("UPPER","This function converts text to uppercase letters.",[new t("string")]),new i("VALUE","This function converts a text string that is a number to a numeric value.",[new t("text")]),new i("VAR","This function returns the variance based on a sample of a population, which uses only numeric values.",[new t("value1"),new t("value2",!0)]),new i("VARA","This function returns the variance based on a sample of a population, which includes numeric, logical, or text values.",[new t("value1"),new t("value2",!0)]),new i("VARP","This function returns variance based on the entire population, which uses only numeric values.",[new t("value1"),new t("value2",!0)]),new i("VARPA","This function returns variance based on the entire population, which includes numeric, logical, or text values.",[new t("value1"),new t("value2",!0)]),new i("VDB","This function returns the depreciation of an asset for any period you specify using the variable declining balance method.",[new t("cost"),new t("salvage"),new t("life"),new t("start"),new t("end"),new t("factor"),new t("switchnot")]),new i("VLOOKUP","This function searches for a value in the leftmost column and returns a value in the same row from a column you specify.",[new t("value"),new t("array"),new t("colindex"),new t("approx")]),new i("WEEKDAY","This function returns the number corresponding to the day of the week for a specified date.",[new t("date"),new t("type")]),new i("WEEKNUM","This function returns a number that indicates the week of the year numerically.",[new t("date"),new t("weektype")]),new i("WEIBULL","This function returns the two-parameter Weibull distribution, often used in reliability analysis.",[new t("x"),new t("alpha"),new t("beta"),new t("cumulative")]),new i("WORKDAY","This function returns the number of working days before or after the starting date.",[new t("startdate"),new t("numdays"),new t("holidays")]),new i("XIRR","This function calculates the internal rate of return for a schedule of cash flows that may not be periodic.",[new t("values"),new t("dates"),new t("guess")]),new i("XNPV","This function calculates the net present value for a schedule of cash flows that may not be periodic.",[new t("rate"),new t("values"),new t("dates")]),new i("YEAR","This function returns the year as an integer for a specified date.",[new t("date")]),new i("YEARFRAC","This function returns the fraction of the year represented by the number of whole days between the start and end dates.",[new t("startdate"),new t("enddate"),new t("basis")]),new i("YIELD","This function calculates the yield on a security that pays periodic interest.",[new t("settle"),new t("maturity"),new t("rate"),new t("price"),new t("redeem"),new t("frequency"),new t("basis")]),new i("YIELDDISC","This function calculates the annual yield for a discounted security.",[new t("settle"),new t("maturity"),new t("price"),new t("redeem"),new t("basis")]),new i("YIELDMAT","This function calculates the annual yield of a security that pays interest at maturity.",[new t("settle"),new t("maturity"),new t("issue"),new t("issrate"),new t("price"),new t("basis")]),new i("ZTEST","This function returns the significance value of a z-test. The z-test generates a standard score for x with respect to the set of data and returns the two-tailed probability for the normal distribution.",[new t("array"),new t("x"),new t("sigma")]),new i("HBARSPARKLINE","This function returns a data set used for representing a Hbar sparkline",[new t("value"),new t("colorScheme")]),new i("VBARSPARKLINE","This function returns a data set used for representing a Vbar sparkline",[new t("value"),new t("colorScheme")]),new i("VARISPARKLINE","This function returns a data set used for representing a variance sparkline",[new t("variance"),new t("reference"),new t("mini"),new t("maxi"),new t("mark"),new t("tickunit"),new t("legend"),new t("colorPositive"),new t("colorNegative"),new t("vertical")]),new i("PIESPARKLINE","This function returns a data set used for representing a pie sparkline",[new t("range|percentage"),new t("color",!0)]),new i("AREASPARKLINE","This function returns a data set used for representing a area sparkline",[new t("points"),new t("mini"),new t("maxi"),new t("line1"),new t("line2"),new t("colorPositive"),new t("colorNegative")]),new i("SCATTERSPARKLINE","This function returns a data set used for representing a scatter sparkline",[new t("points1"),new t("points2"),new t("minX"),new t("maxX"),new t("minY"),new t("maxY"),new t("hLine"),new t("vLine"),new t("xMinZone"),new t("xMaxZone"),new t("yMinZone"),new t("yMaxZone"),new t("tags"),new t("drawSymbol"),new t("drawLines"),new t("color1"),new t("color2"),new t("dash")]),new i("LINESPARKLINE","This function returns a data set used for representing a line sparkline",[new t("data"),new t("dataOrientation"),new t("dateAxisData"),new t("dateAxisOrientation"),new t("setting")]),new i("COLUMNSPARKLINE","This function returns a data set used for representing a column sparkline",[new t("data"),new t("dataOrientation"),new t("dateAxisData"),new t("dateAxisOrientation"),new t("setting")]),new i("WINLOSSSPARKLINE","This function returns a data set used for representing a win/loss sparkline",[new t("data"),new t("dataOrientation"),new t("dateAxisData"),new t("dateAxisOrientation"),new t("setting")]),new i("BULLETSPARKLINE","This function returns a data set used for representing a bullet sparkline",[new t("measure"),new t("target"),new t("maxi"),new t("good"),new t("bad"),new t("forecast"),new t("tickunit"),new t("colorScheme"),new t("vertical")]),new i("SPREADSPARKLINE","This function returns a data set used for representing a spread sparkline",[new t("points"),new t("showAverage"),new t("scaleStart"),new t("scaleEnd"),new t("style"),new t("colorScheme"),new t("vertical")]),new i("STACKEDSPARKLINE","This function returns a data set used for representing a stacked sparkline",[new t("points"),new t("colorRange"),new t("labelRange"),new t("maximum"),new t("targetRed"),new t("targetGreen"),new t("targetBlue"),new t("tragetYellow"),new t("color"),new t("highlightPosition"),new t("vertical"),new t("textOrientation"),new t("textSize")]),new i("BOXPLOTSPARKLINE","This function returns a data set used for representing a boxplot sparkline",[new t("points"),new t("boxPlotClass"),new t("showAverage"),new t("scaleStart"),new t("scaleEnd"),new t("acceptableStart"),new t("acceptableEnd"),new t("colorScheme"),new t("style"),new t("vertical")]),new i("CASCADESPARKLINE","This function returns a data set used for representing a cascade sparkline",[new t("pointsRange"),new t("pointIndex"),new t("labelsRange"),new t("minimum"),new t("maximum"),new t("colorPositive"),new t("colorNegative"),new t("vertical")]),new i("PARETOSPARKLINE","This function returns a data set used for representing a pareto sparkline",[new t("points"),new t("pointIndex"),new t("colorRange"),new t("target"),new t("target2"),new t("highlightPosition"),new t("label"),new t("vertical")]),new i("CEILING.PRECISE","This function rounds a number up to the nearest integer or to the nearest multiple of a specified value.",[new t("number"),new t("signif")]),new i("COVARIANCE.S","This function returns the sample covariance, which is the average of the products of deviations for each data point pair in two sets of numbers.",[new t("array1"),new t("array2")]),new i("FLOOR.PRECISE","This function rounds a number down to the nearest integer or to the nearest multiple of a specified value.",[new t("number"),new t("signif")]),new i("PERCENTILE.EXC","This function returns the nth percentile of values in a range.",[new t("array"),new t("n")]),new i("QUARTILE.EXC","This function returns which quartile (which quarter or 25 percent) of a data set a value is.",[new t("array"),new t("quart")]),new i("RANK.AVG","This function returns the rank of a number in a set of numbers. If some values have the same rank, it will return the average rank.",[new t("number"),new t("array"),new t("order")]),new i("MODE.MULT","This function returns the most frequently occurring vertical array or the most frequently occurring value in a set of data.",[new t("number1"),new t("number2",!0)]),new i("STDEV.P","This function returns the standard deviation for an entire specified population (of numeric values).",[new t("value1"),new t("value2",!0)]),new i("VAR.P","This function returns variance based on the entire population, which uses only numeric values.",[new t("value1"),new t("value2",!0)]),new i("COVARIANCE.P","This function returns the covariance, which is the average of the products of deviations for each data point pair in two sets of numbers.",[new t("array1"),new t("array2")]),new i("MODE.SNGL","This function returns the most frequently occurring value in a set of data.",[new t("value1"),new t("value2",!0)]),new i("PERCENTILE.INC","This function returns the nth percentile of values in a range.",[new t("array"),new t("n")]),new i("QUARTILE.INC","This function returns which quartile (which quarter or 25 percent) of a data set a value is.",[new t("array"),new t("quart")]),new i("RANK.EQ","This function returns the rank of a number in a set of numbers. If you were to sort the set, the rank of the number would be its position in the list.",[new t("number"),new t("array"),new t("order")]),new i("STDEV","This function returns standard deviation is estimated based on a sample.",[new t("number1"),new t("number2",!0)]),new i("STDEV.S","This function returns standard deviation is estimated based on a sample.",[new t("number1"),new t("number2",!0)]),new i("VAR.S","This function returns the variance based on a sample of a population, which uses only numeric values.",[new t("value1"),new t("value2",!0)]),new i("BETA.INV","This function calculates the inverse of the cumulative beta distribution function.",[new t("prob"),new t("alpha"),new t("beta"),new t("lower"),new t("upper")]),new i("BINOM.DIST","This function calculates the individual term binomial distribution probability.",[new t("x"),new t("n"),new t("p"),new t("cumulative")]),new i("BINOM.INV","This function returns the criterion binomial, the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.",[new t("n"),new t("p"),new t("alpha")]),new i("CHISQ.DIST.RT","This function calculates the one-tailed probability of the chi-squared distribution.",[new t("value"),new t("deg")]),new i("CHISQ.INV.RT","This function calculates the inverse of the one-tailed probability of the chi-squared distribution.",[new t("prob"),new t("deg")]),new i("CHISQ.TEST","This function calculates the test for independence from the chi-squared distribution.",[new t("obs_array"),new t("exp_array")]),new i("CONFIDENCE.NORM","This function returns confidence interval for a population mean.",[new t("alpha"),new t("stdev"),new t("size")]),new i("EXPON.DIST","This function returns the exponential distribution or the probability density.",[new t("value"),new t("lambda"),new t("cumulative")]),new i("F.DIST.RT","This function calculates the F probability distribution, to see degrees of diversity between two sets of data.",[new t("value"),new t("degnum"),new t("degden")]),new i("F.INV.RT","This function returns the inverse of the F probability distribution.",[new t("p"),new t("degnum"),new t("degden")]),new i("F.TEST","This function returns the result of an F-test, which returns the one-tailed probability that the variances in two arrays are not significantly different.",[new t("array1"),new t("array2")]),new i("GAMMA.DIST","This function returns the gamma distribution.",[new t("x"),new t("alpha"),new t("beta"),new t("cumulative")]),new i("GAMMA.INV","This function returns the inverse of the gamma cumulative distribution.",[new t("p"),new t("alpha"),new t("beta")]),new i("LOGNORM.INV","This function returns the inverse of the lognormal cumulative distribution function of x, where LN(x) is normally distributed with the specified mean and standard deviation.",[new t("prob"),new t("mean"),new t("stdev")]),new i("NORM.DIST","This function returns the normal cumulative distribution for the specified mean and standard deviation.",[new t("x"),new t("mean"),new t("stdev"),new t("cumulative")]),new i("NORM.INV","This function returns the inverse of the normal cumulative distribution for the given mean and standard deviation.",[new t("prob"),new t("mean"),new t("stdev")]),new i("NORM.S.INV","This function returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one.",[new t("prob")]),new i("PERCENTRANK.INC","This function returns the rank of a value in a data set as a percentage of the data set.",[new t("array"),new t("n"),new t("signif")]),new i("POISSON.DIST","This function returns the Poisson distribution.",[new t("nevents"),new t("mean"),new t("cumulative")]),new i("T.INV.2T","This function returns the t-value of the student's t-distribution as a function of the probability and the degrees of freedom.",[new t("prog"),new t("deg")]),new i("T.TEST","This function returns the probability associated with a t-test.",[new t("array1"),new t("array2"),new t("tails"),new t("type")]),new i("WEIBULL.DIST","This function returns the two-parameter Weibull distribution, often used in reliability analysis.",[new t("x"),new t("alpha"),new t("beta"),new t("cumulative")]),new i("Z.TEST","This function returns the significance value of a z-test. The z-test generates a standard score for x with respect to the set of data and returns the two-tailed probability for the normal distribution.",[new t("array"),new t("x"),new t("sigma")]),new i("T.DIST.RT","This function returns the right-tailed t-distribution.",[new t("x"),new t("deg")]),new i("T.DIST.2T","This function returns the two-tailed t-distribution.",[new t("x"),new t("deg")]),new i("ISO.CEILING","This function returns a number up to the nearest integer or to the nearest multiple of significance, regardless of sign of significance.",[new t("number"),new t("signif")]),new i("BETA.DIST","This function returns the beta distribution.",[new t("x"),new t("alpha"),new t("beta"),new t("cumulative"),new t("lower"),new t("upper")]),new i("GAMMALN.PRECISE","This function returns the natural logarithm of the gamma function.",[new t("value")]),new i("ERF.PRECISE","This function returns the error function.",[new t("lowerlimit")]),new i("ERFC.PRECISE","This function returns the complementary ERF function.",[new t("lowerlimit")]),new i("PERCENTRANK.EXC","This function returns the percentage rank(0..1, exclusive) of a value in a data set.",[new t("array"),new t("n"),new t("signif")]),new i("HYPGEOM.DIST","This function returns the hypergeometric distribution.",[new t("x"),new t("n"),new t("M"),new t("N"),new t("cumulative")]),new i("LOGNORM.DIST","This function returns the log normal distribution of x.",[new t("x"),new t("mean"),new t("stdev"),new t("cumulative")]),new i("NEGBINOM.DIST","This function returns the negative binomial distribution.",[new t("x"),new t("r"),new t("p"),new t("cumulative")]),new i("NORM.S.DIST","This function returns the standard normal distribution.",[new t("z"),new t("cumulative")]),new i("T.DIST","This function returns the t-distribution.",[new t("x"),new t("deg"),new t("cumulative")]),new i("F.DIST","This function returns the F probability distribution.",[new t("x"),new t("degnum"),new t("degden"),new t("cumulative")]),new i("CHISQ.DIST","This function returns the chi-squared distribution.",[new t("x"),new t("deg"),new t("cumulative")]),new i("F.INV","This function returns the inverse of the F probability distribution.",[new t("probability"),new t("degnum"),new t("degden")]),new i("T.INV","This function returns the left-tailed inverse of the t-distribution.",[new t("probability"),new t("deg")]),new i("CHISQ.INV","This function returns the inverse of left-tailed probability of the chi-squared distribution.",[new t("probability"),new t("deg")]),new i("CONFIDENCE.T","This function returns the confidence interval for a Student's t distribution.",[new t("alpha"),new t("stdev"),new t("size")]),new i("NETWORKDAYS.INTL","This function returns the number of workdays between two dates using arguments to indicate holidays and weekend days.",[new t("startdate"),new t("enddate"),new t("weekend"),new t("holidays")]),new i("WORKDAY.INTL","This function returns the serial number of the date before or after a number of workdays with custom weekend parameters. These parameters indicate weekend days and holidays.",[new t("startdate"),new t("numdays"),new t("weekend"),new t("holidays")])],n}();n.FormulaTextBoxResource_EN=u})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={})),function(n){(function(n){var t=undefined,i=null,e=function(){function n(n,t,i){var r=this;r.columnName=n;r.rowIndex=t;r.data=i}return n}(),u,o,f,r;n.SlicerDataItem=e;u=function(){function n(){}return n.prototype.setData=function(n,t){this.slicerData=n;this.columnName=t;this.data=n.getData(t);this.exclusiveDatas=n.getExclusiveData(t);this.slicerData.attachListener(this);this.onDataLoaded()},n.prototype.getDOMElement=function(){return i},n.prototype.onDataLoaded=function(){},n.prototype.onFiltered=function(n){},n.prototype.onDataChanged=function(n){},n.prototype.onRowsChanged=function(n,t,i){},n.prototype.onColumnNameChanged=function(n,t){},n.prototype.onColumnRemoved=function(n){},n}();n.SlicerBase=u,function(n){n[n.average=1]="average";n[n.count=2]="count";n[n.counta=3]="counta";n[n.max=4]="max";n[n.min=5]="min";n[n.product=6]="product";n[n.stdev=7]="stdev";n[n.stdevp=8]="stdevp";n[n.sum=9]="sum";n[n.vars=10]="vars";n[n.varp=11]="varp"}(n.SlicerAggregateType||(n.SlicerAggregateType={}));o=n.SlicerAggregateType;f=function(){function n(n,t){this._columnsSet={};this._columnDataCache=[];this._exclusiveDataCache=[];this._exclusiveDataIndex=[];this._exclusiveToFullMap=[];this._fullToExclusivelMap=[];this._filteredInfoSet=[];this._filteredInfoIndexes=[];this._filteredInfoByRangeSet=[];this._filteredInfoByRange=[];this._filteredRowMap=[];this._filteredRowIndexes=[];this._filteredColumns=[];this._filteredPreviewRowIndexes=[];this._filteredPreviewRowMap=[];this._inPreview=!1;this._listeners=[];this._suspendCount=0;this._sortedColumnDataCache=[];this._sorted2DataMapping=[];this._data2SortedMapping=[];this.setDataSource(n,t);for(var i=0;i<this.data.length;i++)this._filteredRowMap[i]=!0,this._filteredRowIndexes.push(i)}return n.prototype.inPreview=function(){return this._inPreview},n.prototype.setDataSource=function(n,t){var i=this;i.data=n;i.columnNames=t;i.updateDataCaches()},n.prototype.changeData=function(n){for(var v,r,f,e,p,c,i=this,s=new Array(i.columnNames.length),h=i._filteredInfoIndexes,y=i._exclusiveDataCache,l=i._filteredInfoSet,t=0;t<n.length;t++){var u=n[t],a=u.rowIndex,o=i.getColumnIndex(u.columnName);i.data[a][o]=u.data;v=i.isDataItemObject(u.data)?u.data.text:u.data;i._columnDataCache[o]&&(i._columnDataCache[o][a]=v);s[o]=!0}for(r=0;r<s.length;r++)if(s[r]){for(f=h[r],h[r]=f?[]:undefined,l[r]=f?{}:undefined,e=[],t=0;f&&t<f.length;t++)e.push(y[r][f[t]]);if(i.updateDataCache(r),p=[],e.length>0)for(t=0;t<e.length;t++)c=i._exclusiveDataIndex[r][e[t]],h[r].push(c),l[r][c]=!0}for(i.updateFilteredRows(),t=0;t<i._listeners.length;t++)if(i._listeners[t].onDataChanged)i._listeners[t].onDataChanged(n)},n.prototype.isDataItemObject=function(n){return n&&n.text!==t},n.prototype.changeColumnName=function(n,t){var i=this,u=i.getColumnIndex(n),r;if(!(u<0))for(i.columnNames[u]=t,delete i._columnsSet[n.toUpperCase()],i._columnsSet[t.toUpperCase()]=u,r=0;r<i._listeners.length;r++)if(i._listeners[r].onColumnNameChanged)i._listeners[r].onColumnNameChanged(n,t)},n.prototype.addRows=function(n,u){for(var h,c,l,a,v,y,w,d,o,ft,et,s,e=this,ht=new Array(e.columnNames.length),g=e.columnNames.length,nt=e.data,tt=e._columnDataCache,ot=e._exclusiveDataCache,it=e._exclusiveToFullMap,rt=e._fullToExclusivelMap,b=e._filteredInfoSet,st=e._filteredInfoIndexes,k=e._filteredRowMap,p=e._filteredRowIndexes,ut=e._filteredColumns,ct=new Array(u),f=0;f<u;f++)nt.splice(n,0,new Array(g));for(o=0;o<g;o++){for(f=0;f<u;f++)tt[o]&&tt[o].splice(n,0,t);if(h=ot[o],h){for(l=i,a=0;a<h.length;a++){for(v=it[o][a],y=0;y<v.length;y++)v[y]>=n&&(v[y]+=u);r.isEquals(h[a],i)&&(l=v,c=a)}for(l||(l=[],h.push(i),c=h.length-1,e._exclusiveDataIndex[o][i]=c,it[o].push(l),b[o]&&e._filteredColumns.indexOf(o)===-1&&(b[o][c]=!0,st[o].push(c))),w=n;w<n+u;w++)l.push(w);for(s=n;s<n+u;s++)rt[o].splice(s,0,c)}}for(d=!0,f=0;f<ut.length;f++)o=ut[f],ft=rt[o][n],b[o][ft]!==!0&&(d=!1);for(f=0;f<p.length;f++)p[f]>=n&&(p[f]+=u);for(s=nt.length-1;s>=n+u;s--)k[s]=k[s-u];for(et=e._filteredColumns.length>0,s=n;s<n+u;s++)d&&p.push(s),k[s]=!et;for(f=0;f<e._listeners.length;f++)if(e._listeners[f].onRowsChanged)e._listeners[f].onRowsChanged(n,u,!0)},n.prototype.removeRows=function(n,t){this.removeRowsCore(n,t,!0)},n.prototype.removeRowsCore=function(n,t,i){var r=this,d=new Array(r.columnNames.length),c=r._filteredInfoIndexes,p=r._exclusiveDataCache,v=r._filteredInfoSet,w=r.data,b=r.columnNames.length,y=r._columnDataCache,u,e,s,h,l,o,k,a,f;for(w.splice(n,t),u=0;u<b;u++){if(y[u]&&y[u].splice(n,t),e=c[u],s=[],e&&i){for(f=0;f<e.length;f++){for(h=r.getRowIndexes(r.columnNames[u],e[f]),l=!0,o=0;o<h.length;o++)if(h[o]<n||h[o]>=n+t){l=!1;break}l||s.push(p[u][e[f]])}c[u]=[];v[u]={}}if(r.updateDataCache(u),k=[],e&&i)for(f=0;f<s.length;f++)a=r._exclusiveDataIndex[u][s[f]],c[u].push(a),v[u][a]=!0}for(f=0;f<r._listeners.length;f++)if(r._listeners[f].onRowsChanged)r._listeners[f].onRowsChanged(n,t,!1)},n.prototype.updateFilteredRows=function(){for(var i,r,f,t,n=this,e=n._inPreview?n._filteredPreviewRowMap:n._filteredRowMap=[],o=n._filteredInfoByRangeSet,s=n._filteredInfoSet,h=n._inPreview?n._filteredPreviewRowIndexes:n._filteredRowIndexes=[],c=n.data.length,u=0;u<c;u++){for(i=!1,t=0;t<n._filteredColumns.length;t++)if((r=n._filteredColumns[t],!n._inPreview||r!==n._previewCol)&&(s[r]?(f=n.getExclusiveRowIndex(n.columnNames[r],u),i=!s[r][f]):o[r]&&(i=!o[r][u]),i))break;!i&&n._inPreview&&(n._filteredPreviewColumnSet?(f=n.getExclusiveRowIndex(n.columnNames[r],u),i=!n._filteredPreviewColumnSet[f]):n._filteredPreviewByRangColumnSet&&(i=!n._filteredPreviewByRangColumnSet[u]));i||(e[u]=!0)}for(t=0;t<e.length;t++)e[t]&&h.push(t)},n.prototype.removeColumns=function(n,t){for(var o,a,c,h,f,n,l,e,i=this,u=[],r=n;r<n+t;r++)u.push(i.columnNames[r]);for(o=i._filteredColumns,r=0;r<u.length;r++)f=u[r],a=i.getColumnIndex(f),o.indexOf(a)!==-1&&i.doUnfilter(f);var v=i._filteredInfoSet||i._filteredInfoByRangeSet,y=i._filteredInfoIndexes||i._filteredInfoByRange,s=i._columnsSet;for(r=0;r<i.data.length;r++)i.data[r].splice(n,t);i.columnNames.splice(n,t);i._columnDataCache.splice(n,t);i._exclusiveDataCache.splice(n,t);i._exclusiveDataIndex.splice(n,t);i._exclusiveToFullMap.splice(n,t);i._fullToExclusivelMap.splice(n,t);v.splice(n,t);y.splice(n,t);for(c in s)s[c]>=n+t&&(s[c]-=t);for(h=i._listeners||[],r=0;r<u.length;r++)for(f=u[r],delete s[f.toUpperCase()],n=i.getColumnIndex(f),l=o.indexOf(n),l!==-1&&o.splice(l,1),e=0;e<h.length;e++)if(h[e].onColumnRemoved)h[e].onColumnRemoved(u[r])},n.prototype.updateDataCaches=function(){var n=this,r=n._columnsSet={},i,t;for(n._columnDataCache=[],n._exclusiveDataCache=[],n._exclusiveToFullMap=[],n._fullToExclusivelMap=[],i=n.columnNames,t=0;t<i.length;t++)r[(i[t]+"").toUpperCase()]=t},n.prototype.getSortedColumnDataCache=function(){return this._sortedColumnDataCache},n.prototype.getSorted2DataMapping=function(){return this._sorted2DataMapping},n.prototype.sortOneCol=function(n){var t=this,s,o,u,f,h,i,e;for(t._columnDataCache[n]||t.updateDataCache(n),s=t.data[0]&&t.data[0].length,o=[],u=0;u<s;u++)f=t.data[u][n],h=t.isDataItemObject(f)?f.value:f,o.push(h);var c=r.quickSort(o),l=t._sortedColumnDataCache[n]=[],a=t._sorted2DataMapping[n]=[],v=t._data2SortedMapping[n]=[];for(i=0;i<c.length;i++)e=c[i],l.push(e.value),a.push(e.index),v[e.index]=i},n.prototype.updateDataCache=function(n){var t=this,v=t._columnDataCache,y=t._exclusiveDataCache,p=t._exclusiveDataIndex,l=t._exclusiveToFullMap,b=t._fullToExclusivelMap,o=t.data,f,i,s,e,a,h,u,c,w;for(v[n]=[],y[n]=[],p[n]={},f=b[n]=[],l[n]=[],i=0;i<o.length;i++)if(s=o[i][n],e=t.isDataItemObject(s)?s.text:s,v[n].push(e),f[i]===undefined)for(a=[i],y[n].push(e),l[n].push(a),h=l[n].length-1,p[n][e]=h,f[i]=h,u=i+1;u<o.length;u++)c=o[u][n],w=t.isDataItemObject(c)?c.text:c,f[u]===undefined&&r.isEquals(w,e)&&(a.push(u),f[u]=h)},n.prototype.getColumnIndex=function(n){var t=this._columnsSet[n.toUpperCase()];return t===undefined?-1:t},n.prototype.getFilteredRowIndexes=function(){return this._inPreview?this._filteredPreviewRowIndexes:this._filteredRowIndexes},n.prototype.getFilteredOutRowIndexes=function(){for(var i=this.data.length,r=this._inPreview?this._filteredPreviewRowMap:this._filteredRowMap,t=[],n=0;n<i;n++)r[n]||t.push(n);return t},n.prototype.getData=function(n,t){var r=this,i=this.getColumnIndex(n),u;if(i>=0){if(t){r._sortedColumnDataCache[i]||r.sortOneCol(i);var o=r._columnDataCache[i],s=r._sortedColumnDataCache[i],f=r._getStartEndIndex(s,t),h=f.start,c=f.end,e=[];for(u=h;u<=c;u++)e.push(o[r._sorted2DataMapping[i][u]]);return e}else this._columnDataCache[i]||this.updateDataCache(i);return this._columnDataCache[i]}return[]},n.prototype.aggregateData=function(n,r,u){var c=this,w=c._sortedColumnDataCache,v=c.getColumnIndex(n),s,h,y,e,p;if(v<0)return t;w[v]||c.sortOneCol(v);var l=w[v],k=l.length,b=c._getStartEndIndex(l,u);if(s=b.start,h=b.end,r===5)return s>=k?t:l[s];else if(r===4)return h<0?t:l[h];else if(r===3)return h<s?0:h-s+1;var f=r===6?1:0,a=0,o=0;for(y=s;y<=h;y++)(e=l[y],e!==i||e!==t)&&(p={value:i},r===3?f++:c.tryToNumber(e,p)&&(e=p.value,r===1?(f+=e,a++):r===2?f++:r===9?f+=e:r===6?f*=e:(r===7||r===8||r===10||r===11)&&(f+=e,a+=e*e,o++)));return r===1?f=f/a:r===7||r===10?(f=(o*a-f*f)/(o*(o-1)),f=r===7?Math.sqrt(f):f):(r===8||r===11)&&(f=(o*a-f*f)/(o*o),f=r===8?Math.sqrt(f):f),f},n.prototype.tryToNumber=function(n,u){var e,f;if(n===i||n===t)return!1;else if(typeof n=="number")u.value=n;else if(typeof n=="boolean")u.value=n?1:0;else if(n instanceof Date)u.value=r.toOADate(n);else if(typeof n=="string"){if((n=n.trim(),n.length===0)||(e=!1,n.charAt(n.length-1)==="%"&&(e=!0,n=n.substr(0,n.length-1)),n.length>=2&&n[0]==="0"&&n[1]==="x"))return!1;if(f=new Number(n).valueOf(),isNaN(f)||!isFinite(f)){if(f=new Date(n),isNaN(f))return!1;f=r.toOADate(f)}e&&(f/=100);u.value=f}else return!1;return!0},n.prototype._getStartEndIndex=function(n,i){var s=n.length,h=this,e,f,u,o;if(i){if(i.min===-Infinity)e=0;else for(u=0;u<s;u++)if(o=n[u],r.isEquals(i.min,o)||r.isGreaterThan(o,i.min)){e=u;break}if(e===t&&(e=s),f===Infinity)f=s-1;else{for(u=s-1;u>=0;u--)if(o=n[u],r.isEquals(o,i.max)||r.isGreaterThan(i.max,o)){f=u;break}f===t&&(f=-1)}}else e=0,f=s-1;return{start:e,end:f}},n.prototype.getExclusiveData=function(n){var t=this.getColumnIndex(n);return t>=0?(this._exclusiveDataCache[t]||this.updateDataCache(t),this._exclusiveDataCache[t]):[]},n.prototype.getRowIndexes=function(n,t){var i=this.getColumnIndex(n);return i>=0?(this._fullToExclusivelMap[i]||this.updateDataCache(i),this._exclusiveToFullMap[i][t]):[]},n.prototype.getExclusiveRowIndex=function(n,t){var i=this.getColumnIndex(n);return i>=0?(this._fullToExclusivelMap[i]||this.updateDataCache(i),this._fullToExclusivelMap[i][t]):-1},n.prototype.getFilteredIndexes=function(n){var t=[],i={};return this.getFilteredExclusiveIndexes(n,t,i),t},n.prototype.getFilteredExclusiveIndexes=function(n,t,i){for(var e,r,f=this._inPreview?this._filteredPreviewRowIndexes:this._filteredRowIndexes,u=0;u<f.length;u++)e=f[u],r=this.getExclusiveRowIndex(n,e),i[r]?i[r]++:(i[r]=1,t.push(r))},n.prototype.getFilteredExclusiveIndexesCore=function(n,t){var u=[],f={},e=[],r,i,o;for(this.getFilteredExclusiveIndexes(n,u,f),r=0;r<u.length;r++)i=u[r],o=this.getRowIndexes(n,i).length,t&&o===f[i]?e.push(i):o!==f[i]&&e.push(i);return e},n.prototype.getFilteredRanges=function(n){return this._getFilteredInfos(n,!1)},n.prototype.getFilteredOutRanges=function(n){return this._getFilteredInfos(n,!0)},n.prototype._getFilteredInfos=function(n,t){var i=this,u=i.getColumnIndex(n),h=[],f,l,c,e,o,a,r,s;if(!u||(f=i._inPreview?i._filteredPreviewByRangColumn:i._filteredInfoByRange[u],l=i._filteredRowMap,!f))return h;for(i._data2SortedMapping[u]||i.sortOneCol(u),c=[],e=i._data2SortedMapping[u],r=0;r<e.length;r++)o=i.data[r][u],a=i.isDataItemObject(o)?o.value:o,c[e[r]]=a;for(r=0;r<f.length;r++){var v=f[r],y=!1,p=i._getStartEndIndex(c,v);for(s=p.start;s<=p.end;s++)if(l[e[s]]){y=!0;break}y!==t&&h.push(v)}return h},n.prototype.getFilteredOutIndexes=function(n,t){return t===0?this.getAllFilteredOutExclusiveRowIndexes(n):t===1?this.getFilteredOutExclusiveRowIndexesBySelf(n):this.getFilteredOutExclusiveRowIndexesByOther(n)},n.prototype.getAllFilteredOutExclusiveRowIndexes=function(n){var i=[],e=this.getColumnIndex(n),u,f,t,r;if(e>=0)for(u=this.getData(n).length,f=this._inPreview?this._filteredPreviewRowMap:this._filteredRowMap,t=0;t<u;t++)f[t]||(r=this.getExclusiveRowIndex(n,t),i.indexOf(r)===-1&&i.push(r));return i},n.prototype.getFilteredOutExclusiveRowIndexesBySelf=function(n){var t=this,u=[],r=t.getColumnIndex(n),i,f;if(r>=0){var e=t._inPreview&&r===t._previewCol?t._filteredPreviewColumnSet||t._filteredPreviewByRangColumnSet:t._filteredInfoSet[r]||t._filteredInfoByRangeSet[r],o=!!t._filteredInfoByRangeSet[r],s=o?t.getData(n).length:t.getExclusiveData(n).length;for(i=0;i<s;i++)e&&!e[i]&&(f=o?t.getExclusiveRowIndex(n,i):i,u.indexOf(f)===-1&&u.push(f))}return u},n.prototype.getFilteredOutExclusiveRowIndexesByOther=function(n){for(var h,o,s,e,l,u,c,i=this,r=[],t=0,f=i.columnNames.length;t<f;t++)if(i.columnNames[t]!==n)for(h=i.getFilteredOutExclusiveRowIndexesBySelf(i.columnNames[t]),o=0;o<h.length;o++)for(s=i.getRowIndexes(i.columnNames[t],h[o]),e=0;e<s.length;e++)r.indexOf(s[e])===-1&&r.push(s[e]);for(t=0,f=i.data.length;t<f;t++)r.indexOf(t)!==-1?r.splice(r.indexOf(t),1):r.push(t);for(l=i.getExclusiveData(n).length,u=[],t=0;t<l;t++)u.push(t);for(t=0,f=r.length;t<f;t++)c=i.getExclusiveRowIndex(n,r[t]),u.indexOf(c)!==-1&&u.splice(u.indexOf(c),1);return u},n.prototype.attachListener=function(n){this._listeners.push(n)},n.prototype.detachListener=function(n){for(var t=0;t<this._listeners.length;t++)if(this._listeners[t]===n){this._listeners.splice(t,1);break}},n.prototype.suspendFilteredEvents=function(){this._suspendCount++},n.prototype.resumeFilteredEvents=function(){this._suspendCount--;this._suspendCount===0&&this.onFiltered()},n.prototype.doFilter=function(n,t,i){var r=this.getColumnIndex(n);r<0||(i?(this._inPreview=!0,this._previewCol=r):this._inPreview&&this.clearPreviewCore(!1),this._filteredColumns.indexOf(r)<0&&this._filteredColumns.push(r),t.ranges?this.doFilterByRange(n,t.ranges,i):this.doFilterByIndexes(n,t.exclusiveRowIndexes,i),this.onFiltered())},n.prototype.doFilterByRange=function(n,t,i){var r=this,f=r.getColumnIndex(n),v=r._filteredRowMap,c,e,s,a,h,u,l,o;for(r._data2SortedMapping[f]||r.sortOneCol(f),c=[],e=r._data2SortedMapping[f],u=0;u<e.length;u++)s=r.data[u][f],a=r.isDataItemObject(s)?s.value:s,c[e[u]]=a;for(h={},u=0;u<t.length;u++)for(l=r._getStartEndIndex(c,t[u]),o=0;o<e.length;o++)e[o]>=l.start&&e[o]<=l.end&&(h[o]=!0);i?(r._filteredPreviewByRangColumnSet=h,r._filteredPreviewByRangColumn=t):(r._filteredInfoByRange[f]=t,r._filteredInfoByRangeSet[f]=h,delete r._filteredInfoSet[f],delete r._filteredInfoIndexes[f]);r.updateFilteredRows()},n.prototype.doFilterByIndexes=function(n,t,i){for(var r=this,u=r.getColumnIndex(n),f={},e=0;e<t.length;e++)f[t[e]]=!0;i?r._filteredPreviewColumnSet=f:(r._filteredInfoSet[u]=f,r._filteredInfoIndexes[u]=t,delete r._filteredInfoByRange[u],delete r._filteredInfoByRangeSet[u]);r.updateFilteredRows()},n.prototype.clearPreview=function(){this.clearPreviewCore(!0)},n.prototype.clearPreviewCore=function(n){var t=this;t._inPreview=!1;t._filteredPreviewColumnSet={};t._filteredPreviewRowIndexes=[];t._filteredPreviewRowMap=[];t._filteredPreviewByRangColumnSet=[];n&&t.onFiltered()},n.prototype.doUnfilter=function(n){var t=this,i,r;(t._inPreview&&t.clearPreviewCore(!1),i=t.getColumnIndex(n),i<0)||(delete t._filteredInfoByRange[i],delete t._filteredInfoByRangeSet[i],delete t._filteredInfoSet[i],delete t._filteredInfoIndexes[i],t.updateFilteredRows(),r=t._filteredColumns.indexOf(i),r>=0&&t._filteredColumns.splice(r,1),t.onFiltered())},n.prototype.onFiltered=function(){var n=this,t;if(n._suspendCount===0)for(t=0;t<n._listeners.length;t++)if(n._listeners[t].onFiltered)n._listeners[t].onFiltered({rowIndexes:n.getFilteredRowIndexes(),isPreview:n._inPreview})},n}();n.GeneralSlicerData=f;r=function(){function n(){}return n.quickSort=function(n){for(var r=n.length,i=[],t=0;t<r;t++)i[t]={index:t,value:n[t]};return this.quickSortImp(i)},n.quickSortImp=function(n){var t,i;if(n.length<=1)return n;var e=Math.floor(n.length/2),o=n[e],r=[],u=[],f=[];for(t=0;t<n.length;t++)i=this.sortCompare(n[t].value,o.value),i<0?r.push(n[t]):i>0?u.push(n[t]):f.push(n[t]);return this.quickSortImp(r).concat(f,this.quickSortImp(u))},n.isEquals=function(n,r){return(n===i||n===t||n==="")&&(r===i||r===t||r==="")?!0:n instanceof Date&&r instanceof Date?n.valueOf()===r.valueOf():typeof n=="string"&&typeof r=="string"?n.toLowerCase()===r.toLowerCase():n===r},n.toOADate=function(n){return n===t||n===i?0:(typeof n=="number"&&(n=new Date(n)),(n.getTime()*1440+3181192704e6-n.getTimezoneOffset()*864e5)/124416e6)},n.isGreaterThan=function(n,t){return(typeof n=="boolean"?n=n?1:0:n instanceof Date&&(n=this.toOADate(n)),typeof t=="boolean"?t=t?1:0:t instanceof Date&&(t=this.toOADate(t)),typeof n!=typeof t&&(typeof n=="number"||typeof t=="number"))?typeof t=="number":typeof n=="string"&&typeof t=="string"?n.toLowerCase()>t.toLowerCase():n>t},n.sortCompare=function(n,r){var e=this,o=!0,u,f;return u=n===t||n===i||n===""||typeof n=="number"&&isNaN(n),f=r===t||r===i||r===""||typeof r=="number"&&isNaN(r),u&&f?0:u?1:f?-1:e.isEquals(n,r)?0:e.isGreaterThan(n,r)?o?1:-1:o?-1:1},n}();n.SortHelper=r})(n.Slicer||(n.Slicer={}));var t=n.Slicer}(GcSpread||(GcSpread={})),function(n){(function(n){(function(n){n[n.all=0]="all";n[n.byCurrentColumn=1]="byCurrentColumn";n[n.byOtherColumns=2]="byOtherColumns"})(n.FilteredOutDataType||(n.FilteredOutDataType={}));var t=n.FilteredOutDataType})(n.Slicer||(n.Slicer={}));var t=n.Slicer}(GcSpread||(GcSpread={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){var s,p,w,b,r,u,o,h,c,l,y,a;t.feature("tableSlicer",["core.common","core.sheet_action","floatingObject"]);var i=undefined,f=null,e="normal 11pt calibri",v=function(r){function u(n){r.call(this);this.CONTAINER_NAME="slicer-container";this.HEADER_NAME="slicer-header";this.HEADER_BORDERDIV_NAME="slicer-header-borderDiv";this.CAPTION_NAME="slicer-caption";this.CLEARFILTER_NAME="slicer-clearfilter";this.SPLITLINE_NAME="slicer-splitline";this.BODY_NAME="slicer-body";this.TABLE_NAME="slicer-table";this.TR_NAME="slicer-tr";this.TD1_NAME="slicer-td1";this.TD2_NAME="slicer-td2";this.ITEMSCONTAINER_NAME="slicer-itemscontainer";this.ITEM_NAME="slicer-item";this.SCROLLBAR_NAME="slicer-scrollbar";this.NO_USER_SELECT="no-user-select";var t=this;t._name=n;t._captionName="";t._width=180;t._height=210;t._showHeader=!0;t._sortState=1;t._disableResizingAndMoving=!1;t._showNoDataItems=!0;t._showNoDataItemsInLast=!0;t._visuallyNoDataItems=!0;t._isLocked=!0;t._container=null;t._containerPadding=6;t._containerBorderWidth=1;t._fontSize=14;t._zoomFactor=1;t._header=null;t._headerHeight=27;t._headerMarginBottom=5;t._caption=null;t._clearFilter=null;t._clearFilterWidth=28;t._clearFilterHeight=25;t._clearFilterTop=3;t._clearFilterRight=0;t._isFiltered=!1;t._captionTop=3;t._body=null;t._tb=null;t._tr=null;t._td1=null;t._td2=null;t._itemsContainer=null;t._itemsContainerWidth=0;t._itemsContainerHeight=0;t._scrollbar=null;t._tableBorderSpacing=2;t._items=[];t._itemsSet={};t._itemHeight=21;t._itemBorderWidth=1;t._itemVerticalPadding=1;t._itemHorizontalPadding=6;t._columnCount=1;t._itemMargin=2;t._scrollbarWidth=17;t._scrollbarValue=0;t._clearFilterNormalBackColor="white";t._clearFilterHoveredBackColor="#F9E578";t._clearFilterActivedForeColor="red";t._clearFilterNonActivedForeColor="#B0ADB0";t._isMouseDownOnItem=!1;t._isMouseDownOnScrollbar=!1;t._selectingItemIndexes=[];t._filteringItemIndexes=[];t._activeItemIndex=0;t._sortedItems=[];t._unSelectedItemIndexes=[];t._noDataItemIndexes=[];t._style=t.defaultStyle();t._exclusiveDataTexts=[];t._dataTexts=[]}return __extends(u,r),u.prototype.name=function(n){var t=this;return arguments.length===0?t._name:(t._name!==n&&(t._name=n),t)},u.prototype.width=function(n){var t=this;return arguments.length===0?t._width:(n!==t._width&&(t._width=n,t.refresh()),t)},u.prototype.height=function(n){var t=this;return arguments.length===0?t._height:(n!==t._height&&(t._height=n,t.refresh()),t)},u.prototype.captionName=function(n){var t=this;return arguments.length===0?t._captionName:(n!==t._captionName&&(t._captionName=n,t.refresh()),t)},u.prototype.columnCount=function(n){var t=this;return arguments.length===0?t._columnCount:(n>0&&n!==t._columnCount&&(t._columnCount=n,t.refresh()),t)},u.prototype.itemHeight=function(n){var t=this;return arguments.length===0?t._itemHeight:(n>0&&n!==t._itemHeight&&(t._itemHeight=n,t.refresh()),t)},u.prototype.showHeader=function(n){var t=this;return arguments.length===0?t._showHeader:(n!==t._showHeader&&(t._showHeader=n,t.refresh()),t)},u.prototype.sortState=function(n){var t=this;return arguments.length===0?t._sortState:(n!==t._sortState&&(t._sortState=n,t._sortedItems=t.getSortedItems(),t.refresh()),t)},u.prototype.showNoDataItems=function(n){var t=this;return arguments.length===0?t._showNoDataItems:(n!==t._showNoDataItems&&(t._showNoDataItems=n,t._sortedItems=t.getSortedItems(),t.refresh()),t)},u.prototype.showNoDataItemsInLast=function(n){var t=this;return arguments.length===0?t._showNoDataItemsInLast:(n!==t._showNoDataItemsInLast&&(t._showNoDataItemsInLast=n,t._sortedItems=t.getSortedItems(),t.refresh()),t)},u.prototype.visuallyNoDataItems=function(n){var t=this;return arguments.length===0?t._visuallyNoDataItems:(n!==t._visuallyNoDataItems&&(t._visuallyNoDataItems=n,t._sortedItems=t.getSortedItems(),t.refresh()),t)},u.prototype.style=function(n){var t=this;return arguments.length===0?t._style:(n&&t._style!==n&&(t._style=n,t.applyStyle(t._style),t.refresh()),t)},u.prototype.zoomFactor=function(n){var t=this;return arguments.length===0?t._zoomFactor:(n>0&&n!==t._zoomFactor&&(t._zoomFactor=n,t.refresh()),t)},u.prototype.isLocked=function(n){var t=this;return arguments.length===0?t._isLocked:(n!==t._isLocked&&(t._isLocked=n,t.refresh()),t)},u.prototype.disableResizingAndMoving=function(n){var t=this;return arguments.length===0?t._disableResizingAndMoving:(n!==t._disableResizingAndMoving&&(t._disableResizingAndMoving=n,t.refresh()),t)},u.prototype.setData=function(n,t){r.prototype.setData.call(this,n,t)},u.prototype.onDataLoaded=function(){var n=this;n._dataTexts=n.getDataTexts(n.data);n._exclusiveDataTexts=n.getDataTexts(n.exclusiveDatas);n._container=n.createContainer();n._captionName=n.columnName;n.attachEvents();n.onFiltered(null);n.applyStyle(n._style);n.refresh()},u.prototype.getDOMElement=function(){return this._container},u.prototype.getDataTexts=function(n){var u,r,e;if(!n||n.length===0)return[];for(u=[],r=0,e=n.length;r<e;r++)n[r]===i||n[r]===f||n[r]===""?u.push(t.SR.Blank):u.push(String(n[r]));return u},u.prototype.createContainer=function(){var n=this,i=document.createElement("div"),r,u;return t.GC$(i).css({position:"absolute",padding:6*n._zoomFactor,"box-sizing":"content-box",overflow:"hidden"}).addClass(n.CONTAINER_NAME),n.adjustContainerSize(),r=n.createHeader(),u=n.createBody(),t.GC$(i).append(r).append(u),i},u.prototype.createHeader=function(){var n=this,i=document.createElement("div"),r=document.createElement("div"),u,f;return t.GC$(i).css({width:"auto",position:"absolute",top:0,left:0,right:0,"box-sizing":"content-box",overflow:"hidden"}).addClass(n.HEADER_NAME),t.GC$(r).css({width:"auto",position:"absolute",left:n._containerPadding*n._zoomFactor,right:n._containerPadding*n._zoomFactor,"box-sizing":"content-box",overflow:"hidden"}).addClass(n.HEADER_BORDERDIV_NAME),n._header=i,n._headerBorderDiv=r,t.GC$(i).append(r),u=document.createElement("span"),t.GC$(u).css({"box-sizing":"content-box",position:"absolute",top:n._captionTop*n.getHeaderFontFactor()*n._zoomFactor,overflow:"hidden",width:n.getCaptionWidth()*n._zoomFactor,"text-overflow":"ellipsis","white-space":"nowrap"}).text(n._captionName).attr("unselectable","on").addClass(n.CAPTION_NAME+" "+n.NO_USER_SELECT),n._caption=u,f=document.createElement("div"),t.GC$(f).css({width:n._clearFilterWidth*n._zoomFactor,height:n._clearFilterHeight*n._zoomFactor,cursor:"default",position:"absolute",top:n._clearFilterTop*n.getHeaderFontFactor()*n._zoomFactor,right:n._clearFilterRight*n._zoomFactor,"text-align":"center","box-sizing":"content-box","font-weight":"normal","border-radius":2,overflow:"hidden","font-size":n._fontSize*n._zoomFactor+"px"}).attr("title","Clear Filter (Alt+C)").attr("unselectable","on").text("\u2717").addClass(n.CLEARFILTER_NAME+" "+n.NO_USER_SELECT),n._clearFilter=f,n.adjustHeaderSize(),t.GC$(r).append(u).append(f),i},u.prototype.createBody=function(){var n=this,e=document.createElement("div"),i,r,u,f,s,o;return t.GC$(e).css({width:"auto",height:"auto",overflow:"hidden","margin-top":(n._headerHeight-n._containerPadding+n._headerMarginBottom)*n.getHeaderFontFactor()*n._zoomFactor,"box-sizing":"content-box"}).attr("unselectable","on").addClass(n.BODY_NAME+" "+n.NO_USER_SELECT),n._body=e,i=document.createElement("table"),t.GC$(i).css("box-sizing","content-box").css("border-spacing","0px").attr("unselectable","on").addClass(n.TABLE_NAME+" "+n.NO_USER_SELECT),n._tb=i,r=document.createElement("tr"),t.GC$(r).css("box-sizing","content-box").addClass(n.TR_NAME),n._tr=r,u=document.createElement("td"),t.GC$(u).css({padding:0,"box-sizing":"content-box"}).addClass(n.TD1_NAME),n._td1=u,f=document.createElement("td"),t.GC$(f).css({padding:0,"box-sizing":"content-box",cursor:"default"}).addClass(n.TD2_NAME),n._td2=f,s=n.createItemsContainer(),t.GC$(u).append(s),o=n.createScrollbar(),t.GC$(f).append(o),n._scrollbar=o,t.GC$(r).append(u).append(f),t.GC$(i).append(r),t.GC$(e).append(i),e},u.prototype.createItemsContainer=function(){var n=this,u=document.createElement("div"),e,o,i,h,r,s,f;if(n._itemsContainer=u,e=n.getItemsContainerHeight(),n._itemsContainerHeight=e,o=n.getItemsContainerWidth(),n._itemsContainerWidth=o,t.GC$(u).css({width:o*n._zoomFactor,height:e*n._zoomFactor,"font-size":n._fontSize*n._zoomFactor+"px"}).attr("unselectable","on").addClass(n.ITEMSCONTAINER_NAME+" "+n.NO_USER_SELECT),i=n.getSortedItems(),n._sortedItems=i,i&&i.length!==0){for(h=Math.min(n.getMaxVisibleItemsCount(),i.length),r=0;r<h;r++)s=i[r],f=n.createItem(s,r),t.GC$(u).append(f),n._items.push(f),n._itemsSet[n._exclusiveDataTexts.indexOf(s)]=f;return u}},u.prototype.createItem=function(n,i){var r=this,f=n,u=document.createElement("button");return t.GC$(u).css({"text-align":"left","white-space":"nowrap","margin-bottom":r._itemMargin*r._zoomFactor+"px",cursor:"default","box-sizing":"content-box","border-radius":5,padding:"1px 6px",overflow:"hidden","text-overflow":"ellipsis","background-color":"white"}).attr("type","button").attr("unselectable","on").text(f).addClass(r.ITEM_NAME+" "+r.NO_USER_SELECT),(i+1)%r._columnCount!=0&&t.GC$(u).css("margin-right",r._itemMargin*r._zoomFactor+"px"),r.adjustItemSize(u),u},u.prototype.getHeaderFontFactor=function(){var u=this,i=u._style,n,h,r;if(!i||(n=u.getMergedStyleInfo(i.wholeSlicerStyle,i.headerStyle),!n||!n.font))return 1;var c=n.font,f=1,o=t.StyleHelper.splitFont(t.StyleHelper.normalizeFont(e)).fontSize,s=t.StyleHelper.splitFont(t.StyleHelper.normalizeFont(c)).fontSize;return o&&s&&(h=parseFloat(o),r=parseFloat(s),isNaN(r)||(f=r/h)),f},u.prototype.getCaptionWidth=function(){var n=this,o,t=n._container,i=n._header,r=1,u=1,f=0,e=0;return n._container&&(r=n.stringStyle2Number(t.style.borderLeftWidth),u=n.stringStyle2Number(t.style.borderRightWidth)),n._header&&(f=n.stringStyle2Number(i.style.borderLeftWidth),e=n.stringStyle2Number(i.style.borderRightWidth)),n._width-(r+u)-2*n._containerPadding-(f+e)-n._clearFilterWidth},u.prototype.stringStyle2Number=function(n){return n?parseFloat(n):0},u.prototype.getItemsContainerHeight=function(){var n=this,i=n.getSizeOffset(n._container),t=n.height()-2*n._containerPadding-i.heightOffset;return n._showHeader?t-n._headerHeight*n.getHeaderFontFactor()-n._headerMarginBottom:t},u.prototype.getItemsContainerWidth=function(){var n=this,i=n.getSizeOffset(n._container),t=n.width()-2*n._containerPadding-i.widthOffset-1;return n.needShowScrollbar()?t-n._scrollbarWidth:t},u.prototype.getItemWidth=function(n){var t=this;return(n-(t._columnCount-1)*t._itemMargin)/t._columnCount},u.prototype.getMaxVisibleItemsCount=function(){var n=this;return Math.ceil(n._itemsContainerHeight/(n._itemHeight+2*(n._itemVerticalPadding+n._itemBorderWidth)+n._itemMargin))*n._columnCount},u.prototype.getSortedItems=function(){var i=this,r,e,u,o,n,f;if(!i._exclusiveDataTexts||i._exclusiveDataTexts.length===0)return[];if(r=i.orderBySortState(i._exclusiveDataTexts.slice(0),i._sortState),e=i.slicerData.getFilteredOutIndexes(this.columnName,2),i._showNoDataItems){if(i._visuallyNoDataItems&&i._showNoDataItemsInLast){for(u=[],n=0;n<r.length;n++)f=r[n],t.ArrayHelper.contains(e,i._exclusiveDataTexts.indexOf(f))||u.push(f);for(n=0;n<r.length;n++)f=r[n],t.ArrayHelper.contains(e,i._exclusiveDataTexts.indexOf(f))&&u.push(f);r=u}}else for(u=r.concat(),n=0,o=u.length;n<o;n++)t.ArrayHelper.contains(e,i._exclusiveDataTexts.indexOf(u[n]))&&t.ArrayHelper.remove(r,u[n]);return t.ArrayHelper.contains(r,t.SR.Blank)&&(t.ArrayHelper.remove(r,t.SR.Blank),r.push(t.SR.Blank)),r},u.prototype.orderBySortState=function(t,i){var u=[],f,r;if(i!==0){for(f=n.Slicer.SortHelper.quickSort(t),r=0;r<f.length;r++)u[r]=f[r].value;return i===2&&u.reverse(),u}},u.prototype.createScrollbar=function(){var n=this,r=new t.Scrollbar(!1),i;return n._scrollbarObj=r,i=r.getScrollbar(),t.GC$(i).bind("scroll.gcScrollbar",function(t,i){var r=i.scrollEventType,u=i.scrollOrientation;if(t.data=n,u===1)switch(r){case 0:case 1:case 2:case 3:case 5:n.doScroll(t,i);break;default:break}}),i},u.prototype.needShowScrollbar=function(){var n=this,t=n._noDataItemIndexes,i=n._showNoDataItems?n._exclusiveDataTexts.length:n._exclusiveDataTexts.length-t.length,r=Math.ceil(i/n._columnCount)*(n._itemHeight+2*(n._itemBorderWidth+n._itemVerticalPadding)+n._itemMargin);return r>n._itemsContainerHeight},u.prototype.doScroll=function(n,t){this.scrollTo(n,t)},u.prototype.scrollTo=function(n,t){var i=this,r=t.newValue;r===i._scrollbarValue||r>i._scrollbarObj.maximum()||(i._scrollbarValue=r,i.refreshScrollbar(),i.refreshItems())},u.prototype.getScrollbarObj=function(){return this._scrollbarObj},u.prototype.applyStyle=function(n){var t=this,r,i,u,e,o,s;if(n){n.wholeSlicerStyle&&(t.setStyleInfo(t._container,n.wholeSlicerStyle),t.adjustContainerSize());r=t._headerBorderDiv;i=t.getMergedStyleInfo(n.wholeSlicerStyle,n.headerStyle);t.isDarwingInnerBorder(n)?(u=i.borderBottom,e=u&&u.borderWidth?u.borderWidth:0,r.style.height=(t._headerHeight-e)*t.getHeaderFontFactor()*t._zoomFactor+"px",t.setBorder(r,u,"borderBottom"),i.borderLeft=i.borderTop=i.borderRight=i.borderBottom=f):(r.style.borderBottomWidth="0px",r.style.height=t._header.style.height);t.setStyleInfo(t._header,i);t.adjustHeaderSize();for(o in t._itemsSet)s=parseInt(o),t.refreshItemStyle(s)}},u.prototype.isDarwingInnerBorder=function(n){var r=this,i=n.headerStyle,t;return!i||!(i.borderLeft||i.borderTop||i.borderRight||i.borderBottom)?!0:(t=r.getMergedStyleInfo(n.wholeSlicerStyle,i),t.borderBottom&&t.borderBottom.borderWidth>0&&(!t.borderLeft||t.borderLeft.borderWidth===0)&&(!t.borderTop||t.borderTop.borderWidth===0)&&(!t.borderRight||t.borderRight.borderWidth===0))?!0:!1},u.prototype.setStyleInfo=function(n,i){var u;if(n&&i){var r=this,f=this.getTheme(),o=i.foreColor||"black",s=i.backColor||"white",h=i.font||e,c=i.textDecoration||"";n.style.backgroundColor=r.getNormalizeColor(s,f);n.style.color=r.getNormalizeColor(o,f);n.style.font=t.StyleHelper._scaleFont(h,r._zoomFactor).font;r.setBorder(n,i.borderLeft,"borderLeft");r.setBorder(n,i.borderTop,"borderTop");r.setBorder(n,i.borderRight,"borderRight");r.setBorder(n,i.borderBottom,"borderBottom");u=t.StyleHelper.composeTextDecoration(i.textDecoration);t.StringHelper.Contains(n.className,r.HEADER_NAME)?r._caption.style.textDecoration=u:t.StringHelper.Contains(n.className,r.ITEM_NAME)&&(n.style.textDecoration=u)}},u.prototype.getMergedStyleInfo=function(n,t){var u={},r;if(t)for(r in t)u[r]=t[r];if(n)for(r in n)u[r]===i&&n[r]!==i&&(u[r]=n[r]);return u},u.prototype.setBorder=function(n,t,i){if(n){var r=t&&t.borderWidth?t.borderWidth:0,u=t&&t.borderStyle?t.borderStyle:"",f=t&&t.borderColor?t.borderColor:"";n.style[i+"Width"]=r+"px";n.style[i+"Style"]=u;n.style[i+"Color"]=this.getNormalizeColor(f,this.getTheme())}},u.prototype.getTheme=function(){var n=this.slicerData,t=n.getSheet&&n.getSheet();return t&&t.currentTheme()},u.prototype.getNormalizeColor=function(n,t){if(!t)return n;var r=this,i;return n&&t&&t.getColor&&(i=t.getColor(n)),i},u.prototype.defaultStyle=function(){var i=e,s="bold 11pt calibri",r={borderWidth:1,borderStyle:"solid",borderColor:"#808080"},o={borderWidth:0,borderStyle:"",borderColor:""},n={borderWidth:1,borderStyle:"solid",borderColor:"#999999"},t={borderWidth:1,borderStyle:"solid",borderColor:"#CCCCCC"},u={borderWidth:1,borderStyle:"solid",borderColor:"#E0E0E0"},f={backColor:"#F9E36F",foreColor:"black",font:i,borderLeft:n,borderTop:n,borderRight:n,borderBottom:n};return{wholeSlicerStyle:{backColor:"white",foreColor:"black",font:i,borderLeft:r,borderTop:r,borderRight:r,borderBottom:r},headerStyle:{backColor:"white",foreColor:"black",font:s,borderLeft:o,borderTop:o,borderRight:o,borderBottom:{borderWidth:1,borderStyle:"solid",borderColor:"#A6A6A6"}},selectedItemWithDataStyle:{backColor:"#BFBFBF",foreColor:"black",font:i,borderLeft:n,borderTop:n,borderRight:n,borderBottom:n},selectedItemWithNoDataStyle:{backColor:"#D9D9D9",foreColor:"black",font:i,borderLeft:t,borderTop:t,borderRight:t,borderBottom:t},unSelectedItemWithDataStyle:{backColor:"white",foreColor:"black",font:i,borderLeft:t,borderTop:t,borderRight:t,borderBottom:t},unSelectedItemWithNoDataStyle:{backColor:"white",foreColor:"#959595",font:i,borderLeft:u,borderTop:u,borderRight:u,borderBottom:u},hoveredSelectedItemWithDataStyle:f,hoveredSelectedItemWithNoDataStyle:f,hoveredUnSelectedItemWithDataStyle:f,hoveredUnSelectedItemWithNoDataStyle:f}},u.prototype.onFiltered=function(n){var t=this;t._sortedItems=t.getSortedItems();t._noDataItemIndexes=t.slicerData.getFilteredOutIndexes(t.columnName,2);t._unSelectedItemIndexes=t.slicerData.getFilteredOutIndexes(t.columnName,1);t.refresh()},u.prototype.onDataChanged=function(n){this.reset()},u.prototype.onRowsChanged=function(n,t,i){this.reset()},u.prototype.reset=function(){var n=this;n.data=n.slicerData.getData(n.columnName);n.exclusiveDatas=n.slicerData.getExclusiveData(n.columnName);n._dataTexts=n.getDataTexts(n.data);n._exclusiveDataTexts=n.getDataTexts(n.exclusiveDatas);n._sortedItems=n.getSortedItems();n.refreshScrollbar();n.refreshItems()},u.prototype.onColumnNameChanged=function(n,i){var r=this;r.columnName===n&&r._caption&&(r.columnName=i,r._captionName=i,t.GC$(r._caption).text(i))},u.prototype.onColumnRemoved=function(n){var i=this;n===i.columnName&&(i.slicerData.doUnfilter(n),i.detachEvents(),t.GC$(i._container).remove(),i._container=null)},u.prototype.refresh=function(n){var r=this,f=r._style,u;r._container&&(n!==i&&n!==r._zoomFactor&&(r._zoomFactor=n,r.applyStyle(r._style)),t.GC$(r._container).css({padding:6*r._zoomFactor}),r.adjustContainerSize(),r.refreshHeader(),u=r._showHeader?(r._headerHeight+r._headerMarginBottom-r._containerPadding)*r.getHeaderFontFactor()*r._zoomFactor:0,t.GC$(r._body).css("margin-top",u),r.refreshItemsContainer(),r.refreshScrollbar())},u.prototype.refreshHeader=function(){var n=this,f=n._style,i=n._zoomFactor,r,u;n._showHeader?(n._container.firstChild!==n._header&&(t.GC$(n._header).insertBefore(n._body),t.GC$(n._body).css("margin-top",(n._headerHeight+n._headerMarginBottom)*n.getHeaderFontFactor()*i)),t.GC$(n._header).css("height",n._headerHeight*n.getHeaderFontFactor()*i),t.GC$(n._headerBorderDiv).css({left:n._containerPadding*i,right:n._containerPadding*i}),n._caption.innerHTML!==n._captionName&&t.GC$(n._caption).text(n._captionName),t.GC$(n._caption).css({top:n._captionTop*n.getHeaderFontFactor()*i,width:n.getCaptionWidth()*i,"font-weight":"bold"}),r=n._unSelectedItemIndexes,u=r&&r.length>0?1:0,n.changeClearFilterColor(u),t.GC$(n._clearFilter).css({width:n._clearFilterWidth*i,height:n._clearFilterHeight*i,top:n._clearFilterTop*n.getHeaderFontFactor()*i,right:n._clearFilterRight*i}),n.adjustHeaderSize()):t.GC$(n._header).remove()},u.prototype.refreshItemsContainer=function(){var n=this,r=n.getItemsContainerHeight(),i;n._itemsContainerHeight=r;i=n.getItemsContainerWidth();n._itemsContainerWidth=i;t.GC$(n._itemsContainer).css({width:i*n._zoomFactor,height:r*n._zoomFactor,"font-size":n._fontSize*n._zoomFactor});n.refreshItems()},u.prototype.refreshItems=function(){var n=this,r=n._sortedItems,i,f,u,o;if(r){n._items&&n._items.length>0&&t.GC$(n._items).remove();n._items=[];n._itemsSet={};var s=Math.min(n.getMaxVisibleItemsCount(),r.length),e=n.needShowScrollbar()?n._scrollbarObj.value()*n._columnCount:0,h=Math.min(e+s,r.length);for(i=e;i<h;i++)f=r[i],u=n.createItem(f,i),t.GC$(n._itemsContainer).append(u),n._items.push(u),n._itemsSet[n._exclusiveDataTexts.indexOf(f)]=u;if(n._items.length!==0)for(o in n._itemsSet)n.refreshItemStyle(parseInt(o))}},u.prototype.refreshItemStyle=function(n){var i=this,u=i._hitInfo?this._exclusiveDataTexts.indexOf(i._hitInfo.itemValue):-1,f=i._unSelectedItemIndexes,e=i._noDataItemIndexes,o=i._itemsSet[n],r=0;n===u&&(r|=1);r|=t.ArrayHelper.contains(f,n)?4:2;r|=t.ArrayHelper.contains(e,n)&&i._visuallyNoDataItems?16:8;i.changeItemStyle(o,r)},u.prototype.changeItemStyle=function(n,t){if(n&&this._style){var i=this,r=i._style,u=i.getTheme();switch(t){case 10:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.selectedItemWithDataStyle));break;case 18:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.selectedItemWithNoDataStyle));break;case 12:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.unSelectedItemWithDataStyle));break;case 20:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.unSelectedItemWithNoDataStyle));break;case 11:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.hoveredSelectedItemWithDataStyle));break;case 19:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.hoveredSelectedItemWithNoDataStyle));break;case 13:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.hoveredUnSelectedItemWithDataStyle));break;case 21:i.setStyleInfo(n,i.getMergedStyleInfo(r.wholeSlicerStyle,r.hoveredUnSelectedItemWithNoDataStyle));break}i.adjustItemSize(n)}},u.prototype.adjustContainerSize=function(){var n=this,i=n.getSizeOffset(n._container);t.GC$(n._container).css({width:(n.width()-2*n._containerPadding)*n._zoomFactor-i.widthOffset,height:(n.height()-2*n._containerPadding)*n._zoomFactor-i.heightOffset})},u.prototype.adjustHeaderSize=function(){var n=this,i=n._zoomFactor,r=n.getSizeOffset(n._header),u=n._headerHeight*n.getHeaderFontFactor()*i-r.heightOffset;t.GC$(n._header).css("height",u);t.GC$(n._clearFilter).css({width:n._clearFilterWidth*i,height:n._clearFilterHeight*i})},u.prototype.adjustItemSize=function(n){var i=this,r=i.getSizeOffset(n);t.GC$(n).css({width:i.getItemWidth(i._itemsContainerWidth)*i._zoomFactor-2*i._itemHorizontalPadding-r.widthOffset,height:i._itemHeight*i._zoomFactor-r.heightOffset})},u.prototype.getSizeOffset=function(n){var s=this,i=0,r=0;if(n){var t=n.style,u=t.borderLeftWidth,f=t.borderTopWidth,e=t.borderRightWidth,o=t.borderBottomWidth;u&&(i+=parseFloat(u));f&&(r+=parseFloat(f));e&&(i+=parseFloat(e));o&&(r+=parseFloat(o))}return{widthOffset:i,heightOffset:r}},u.prototype.refreshScrollbar=function(){var n=this,r,i;n.needShowScrollbar()?(n._scrollbar||(n._scrollbar=n.createScrollbar()),n._td2.firstChild!==n._scrollbar&&(t.GC$(n._td2).append(n._scrollbar),n.refreshItemsContainer()),r=Math.floor(n._itemsContainerHeight/(n._itemHeight+2*n._itemVerticalPadding+n._itemMargin)),i=n._scrollbarObj,i.value(n._scrollbarValue),i.width(n._scrollbarWidth*n._zoomFactor),i.height(n._itemsContainerHeight*n._zoomFactor),i.minimum(0),i.maximum(Math.ceil(n._exclusiveDataTexts.length/n._columnCount)-r),i.pageValue(r),i.smallChange(1),i.largeChange(r-1),i.refreshLayout()):(n._td2.firstChild===n._scrollbar&&(n._scrollbar.parentElement&&n._scrollbar.parentElement.removeChild(n._scrollbar),n.refreshItemsContainer()),n._scrollbarValue=0)},u.prototype.attachEvents=function(){var n=this,r=t.GC$(n._container),i=".slicer";r&&(r.bind("mousedown"+i,function(t){n.doMouseDown(t)}).bind("mouseup"+i,function(t){n.doMouseUp(t)}).bind("mousemove"+i,function(t){n.doMouseMove(t)}).bind("mouseleave"+i,function(t){n.doMouseLeave(t)}),n._container.addEventListener("mousewheel",function(t){n.doMouseWheel(t)},!1),n._container.addEventListener("DOMMouseScroll",function(t){n.doMouseWheel(t)},!1),t.GC$(document).bind("mouseup"+i,function(t){n.doDocumentMouseUp(t)}).bind("keydown"+i,function(t){n.doKeyDown(t)}).bind("keyup"+i,function(t){n.doKeyUp(t)}),document.addEventListener("mousewheel",function(t){n.doMouseWheel(t)},!1),document.addEventListener("DOMMouseScroll",function(t){n.doMouseWheel(t)},!1))},u.prototype.detachEvents=function(){var i=this,n=i._container,r=".slicer";n&&t.GC$(n).unbind(r)},u.prototype.doMouseDown=function(n){var t=this,i=t.hitTest(n);i&&(i.mark===8&&(t._isMouseDownOnScrollbar=!0),i.mark===5&&(t._filteringItemIndexes=[],t._isMouseDownOnItem=!0,n.ctrlKey?t.mouseDownOnItemWithCtrl(i):n.shiftKey?t.mouseDownOnItemWithShift(i):t.mouseDownOnItemWithoutKeyDown(i)),t.preRefreshItemsStyle(t._selectingItemIndexes),(i.mark===5||i.mark===6||i.mark===8||i.mark===4&&t._isFiltered)&&n.stopPropagation())},u.prototype.mouseDownOnItemWithCtrl=function(n){var i=this,c=i.slicerData,s=i.exclusiveDatas,h=i._unSelectedItemIndexes,e=i.getExclusiveRowIndex(n.itemValue),u=i._selectingItemIndexes,f,r,o;for(t.ArrayHelper.contains(u,e)?t.ArrayHelper.remove(u,e):u.push(e),r=0,o=s.length;r<o;r++)t.ArrayHelper.contains(h,r)||i._filteringItemIndexes.push(r);for(f=0;f<i._selectingItemIndexes.length;f++)t.ArrayHelper.contains(i._filteringItemIndexes,u[f])?t.ArrayHelper.remove(i._filteringItemIndexes,u[f]):i._filteringItemIndexes.push(u[f]);if(i._filteringItemIndexes.length===0)for(r=0,o=i._exclusiveDataTexts.length;r<o;r++)i._filteringItemIndexes.push(r);i._activeItemIndex=e},u.prototype.mouseDownOnItemWithShift=function(n){var t=this,i=t._sortedItems,f=t._exclusiveDataTexts[t._activeItemIndex],e,o,u,r;for(t.clearItemsStyle(),e=Math.min(i.indexOf(f),i.indexOf(n.itemValue)),o=Math.max(i.indexOf(f),i.indexOf(n.itemValue)),u=e;u<=o;u++)r=t._exclusiveDataTexts.indexOf(i[u]),t._selectingItemIndexes.indexOf(r)===-1&&t._selectingItemIndexes.push(r),t._filteringItemIndexes.indexOf(r)===-1&&t._filteringItemIndexes.push(r)},u.prototype.mouseDownOnItemWithoutKeyDown=function(n){var t=this,i;t.clearItemsStyle();i=t.getExclusiveRowIndex(n.itemValue);t.refreshItemStyle(i);t._selectingItemIndexes.push(i);t._filteringItemIndexes.push(i);t._activeItemIndex=i},u.prototype.clearItemsStyle=function(){var r=this,n=r._items,f,i,e,u,o;if(n&&n.length!==0)for(f=r._noDataItemIndexes,i=0,e=n.length;i<e;i++)u=n[i],o=this._exclusiveDataTexts.indexOf(n[i].innerHTML),t.ArrayHelper.contains(f,o)?r.changeItemStyle(u,20):r.changeItemStyle(u,12)},u.prototype.getExclusiveRowIndex=function(n){var u=this,i=u._exclusiveDataTexts,t,r;if(!i||i.length===0)return-1;for(t=0,r=i.length;t<r;t++)if(i[t]===n)return t;return-1},u.prototype.doMouseUp=function(n){var t=this,r=t.hitTest(n);if(r){var u=t.slicerData,f=t._selectingItemIndexes,i=!1;r.mark===4?t._isFiltered&&(u.doUnfilter(t.columnName),t.changeClearFilterColor(0),i=!0):f&&f.length>0&&(t._isCtrlKeyDown||t._isShiftKeyDown||(u.doFilter(t.columnName,{exclusiveRowIndexes:t._filteringItemIndexes}),i=!0));t._isMouseDownOnItem=!1;t._isMouseDownOnScrollbar=!1;i&&(t._selectingItemIndexes=[],t._filteringItemIndexes=[])}},u.prototype.preRefreshItemsStyle=function(n){for(var u,i=this,o=i.slicerData,f=i._unSelectedItemIndexes,e=i._noDataItemIndexes,r=0;r<n.length;r++)u=0,u|=i._isCtrlKeyDown?t.ArrayHelper.contains(f,n[r])?2:4:2,u|=t.ArrayHelper.contains(e,n[r])&&i._visuallyNoDataItems?16:8,i.changeItemStyle(i._itemsSet[n[r]],u)},u.prototype.doDocumentMouseUp=function(n){var t=this,i;t.doMouseUp(n);i=t._hitInfo?new s(t._hitInfo.mark,t._hitInfo.itemValue):f;t._hitInfo=null;t.clearOldHover(i)},u.prototype.changeClearFilterColor=function(n){var i=this;if(i._clearFilter){var u=i._style,f=i.getMergedStyleInfo(u.wholeSlicerStyle,u.headerStyle),r=f&&f.backColor;r||(r="white");i._clearFilterNormalBackColor=r;switch(n){case 0:i._isFiltered=!1;t.GC$(i._clearFilter).css({color:i._clearFilterNonActivedForeColor,"background-color":r});break;case 1:i._isFiltered=!0;t.GC$(i._clearFilter).css({color:i._clearFilterActivedForeColor,"background-color":r});break;case 2:t.GC$(i._clearFilter).css({"background-color":i._clearFilterHoveredBackColor});break}}},u.prototype.doMouseMove=function(n){var i=this,o=i._hitInfo?new s(i._hitInfo.mark,i._hitInfo.itemValue):null,r=i.hitTest(n),h,v,l,u,c,a,e;if(r&&(!o||o.mark!==r.mark||o.mark===5&&o.itemValue!==r.itemValue)){if(!i._isMouseDownOnItem){i._hitInfo=r;i.clearOldHover(o);i.setNewHover(r);return}if(r.mark===5)if(h=i._exclusiveDataTexts.indexOf(r.itemValue),v=i._noDataItemIndexes,t.ArrayHelper.contains(i._filteringItemIndexes,h)){var f=i._sortedItems,p=Math.min(f.indexOf(i._exclusiveDataTexts[i._activeItemIndex]),f.indexOf(r.itemValue)),w=Math.max(f.indexOf(i._exclusiveDataTexts[i._activeItemIndex]),f.indexOf(r.itemValue)),y=[];for(u=0,c=i._filteringItemIndexes.length;u<c;u++)l=i._filteringItemIndexes[u],(f.indexOf(i._exclusiveDataTexts[l])>w||f.indexOf(i._exclusiveDataTexts[l])<p)&&y.push(l);for(u=0,c=y.length;u<c;u++)a=y[u],e=i.getItemElement(i._exclusiveDataTexts[a]),t.ArrayHelper.contains(v,a)?i.changeItemStyle(e,20):i.changeItemStyle(e,12),t.ArrayHelper.remove(i._filteringItemIndexes,a)}else e=i.getItemElement(i._exclusiveDataTexts[h]),t.ArrayHelper.contains(v,h)?i.changeItemStyle(e,18):i.changeItemStyle(e,10),t.ArrayHelper.add(i._filteringItemIndexes,h);i._hitInfo=r}},u.prototype.doMouseLeave=function(n){var t=this,i=t._hitInfo?new s(t._hitInfo.mark,t._hitInfo.itemValue):f;t._hitInfo=f;this.clearOldHover(i)},u.prototype.doMouseWheel=function(n){var t=this.hitTest(n);return t.mark===8?(n.stopPropagation(),!0):!1},u.prototype.clearOldHover=function(n){var i,r;if(n){i=this;switch(n.mark){case 4:if(!i._clearFilter)return;i._isFiltered?i.changeClearFilterColor(1):i.changeClearFilterColor(0);break;case 5:r=i._exclusiveDataTexts.indexOf(n.itemValue);i._selectingItemIndexes&&t.ArrayHelper.contains(i._selectingItemIndexes,r)?i.preRefreshItemsStyle(i._selectingItemIndexes):i.refreshItemStyle(r);break}}},u.prototype.setNewHover=function(n){var t,i;if(n){t=this;switch(n.mark){case 4:if(!t._clearFilter||!t._isFiltered)return;t.changeClearFilterColor(2);break;case 5:i=this._exclusiveDataTexts.indexOf(n.itemValue);t.refreshItemStyle(i);break;case 6:t._itemsContainer.style.cursor="default";break}}},u.prototype.getItemElement=function(n){var f=this,t=f._items,i,u,r;if(!t||t.length===0||n===null)return null;for(i=0,u=t.length;i<u;i++)if(r=t[i],r.innerHTML.toLowerCase()===n.toLowerCase())return r;return null},u.prototype.doKeyDown=function(n){var t=this;n.keyCode!==17||t._isCtrlKeyDown||(t._isCtrlKeyDown=!0);n.keyCode!==16||t._isShiftKeyDown||(t._isShiftKeyDown=!0)},u.prototype.doKeyUp=function(n){var t=this,i=t.slicerData;n.keyCode===17&&t._isCtrlKeyDown&&(t._isCtrlKeyDown=!1);n.keyCode===16&&t._isShiftKeyDown&&(t._isShiftKeyDown=!1);!t._isCtrlKeyDown&&!t._isShiftKeyDown&&t._selectingItemIndexes.length>0&&(i.doFilter(t.columnName,{exclusiveRowIndexes:t._filteringItemIndexes}),t._selectingItemIndexes=[],t._filteringItemIndexes=[])},u.prototype.hitTest=function(n){var t=this,i=t.getContainerRect(t._container),r=null,l=null,f,e,w,h,c,b;if(!i)return null;var o=n.pageX,u=n.pageY,a=t.getHeaderRect(i),v=t.getClearfilterRect(i),y=t.getBodyRect(i),p=t.getItemsContainerRect(i);if(a&&a.contains(o,u))r=v&&v.contains(o,u)?4:1;else if(y&&y.contains(o,u))if(f=t._items,p&&p.contains(o,u)&&f){for(e=0,w=f.length;e<w;e++)if(h=t.getItemRect(i,e),h&&h.contains(o,u)){r=5;for(c in t._itemsSet)if(t._itemsSet[c]===f[e]){l=t._exclusiveDataTexts[c];break}break}e>=f.length&&(b=t.getItemRect(i,f.length-1),r=u<b.y+t._itemHeight*t._zoomFactor?6:7)}else r=8;else r=0;return new s(r,l)},u.prototype.getContainerRect=function(n){if(!n)return null;var i=n,r=0,u=0,f=i.offsetWidth,e=i.offsetHeight;do r+=i.offsetLeft,u+=i.offsetTop;while(i=i.offsetParent);return new t.Rect(r,u,f,e)},u.prototype.getHeaderRect=function(n){var i=this,u,f,e,o,r;return!n||!i._showHeader?null:(r=i._zoomFactor,u=n.x+i._containerBorderWidth*r,f=n.y+i._containerBorderWidth*r,e=i.width()*r,o=i._headerHeight*i.getHeaderFontFactor()*r,new t.Rect(u,f,e,o))},u.prototype.getClearfilterRect=function(n){var i=this,r,u,f,e,o;return!n||!i._showHeader?null:(i=this,r=i._zoomFactor,u=n.x+n.width-(i._containerBorderWidth+i._containerPadding+i._clearFilterWidth)*r,f=n.y+i._containerBorderWidth+i._captionTop*i.getHeaderFontFactor()*r,e=i._clearFilterWidth,o=i._clearFilterHeight,new t.Rect(u,f,e*r,o*r))},u.prototype.getBodyRect=function(n){var i=this;if(!n)return null;var u,f,e,o,r=i._zoomFactor,s=i._containerBorderWidth+i._containerPadding,h=0,c=i._headerHeight*i.getHeaderFontFactor()+i._headerMarginBottom;return u=n.x+s*r,f=n.y+h*r+(i.showHeader()?c*r:0),e=(i.width()-2*s)*r,o=n.height-2*h*r-(i.showHeader()?c*r:0),new t.Rect(u,f,e,o)},u.prototype.getItemsContainerRect=function(n){var r=this,i=r.getBodyRect(n);return i?r.needShowScrollbar()?new t.Rect(i.x,i.y,i.width-r._scrollbarWidth*r._zoomFactor,i.height):i:null},u.prototype.getItemRect=function(n,i){var r=this,o=r._exclusiveDataTexts,u,s,h,f,e;return!n||o.length===0||i>=o.length?null:(u=r.getItemsContainerRect(n),!u)?null:(f=(u.width-(r._columnCount-2)*r._itemMargin*r._zoomFactor)/r._columnCount,e=r._itemHeight*r._zoomFactor+2*r._itemBorderWidth,s=u.x+i%r._columnCount*(f+r._itemMargin*r._zoomFactor),h=u.y+Math.floor(i/r._columnCount)*(e+r._itemMargin*r._zoomFactor),new t.Rect(s,h,f,e))},u}(n.Slicer.SlicerBase);t.ItemSlicer=v;s=function(){function n(n,t){var i=this;i.mark=n===undefined?null:n;i.itemValue=t===undefined?null:t}return n}();t.SlicerHitInfo=s,function(n){n[n.HOVERED=1]="HOVERED";n[n.SELECTED=2]="SELECTED";n[n.UNSELECTED=4]="UNSELECTED";n[n.HASDATA=8]="HASDATA";n[n.NODATA=16]="NODATA"}(t.SlicerItemState||(t.SlicerItemState={}));p=t.SlicerItemState,function(n){n[n.NORMAL=0]="NORMAL";n[n.ACTIVE=1]="ACTIVE";n[n.HOVERED=2]="HOVERED"}(t.SlicerClearFilterState||(t.SlicerClearFilterState={}));w=t.SlicerClearFilterState,function(n){n[n.CONTAINER=0]="CONTAINER";n[n.H_SPACE=1]="H_SPACE";n[n.H_CAPTION=2]="H_CAPTION";n[n.H_SPLITLINE=3]="H_SPLITLINE";n[n.H_CLEARFILTER=4]="H_CLEARFILTER";n[n.B_ITEM=5]="B_ITEM";n[n.B_ITEMSPACER=6]="B_ITEMSPACER";n[n.B_TAIL=7]="B_TAIL";n[n.B_SCROLLBAR=8]="B_SCROLLBAR"}(t.SlicerHitMark||(t.SlicerHitMark={}));b=t.SlicerHitMark;r=function(){function n(n,t,i,r,u,f,e,o){var s=this;s._backColor=n;s._foreColor=t;s._font=i;s._borderLeft=r;s._borderTop=u;s._borderRight=f;s._borderBottom=e;s._textDecoration=o}return n.prototype.setBorders=function(n){var t=this;t._borderLeft=t._borderTop=t._borderRight=t._borderBottom=n},n.prototype.backColor=function(n){var t=this;return arguments.length===0?t._backColor:(t._backColor=n,t)},n.prototype.foreColor=function(n){var t=this;return arguments.length===0?t._foreColor:(t._foreColor=n,t)},n.prototype.font=function(n){var t=this;return arguments.length===0?t._font:(t._font=n,t)},n.prototype.borderLeft=function(n){var t=this;return arguments.length===0?t._borderLeft:(t._borderLeft=n,t)},n.prototype.borderTop=function(n){var t=this;return arguments.length===0?t._borderTop:(t._borderTop=n,t)},n.prototype.borderRight=function(n){var t=this;return arguments.length===0?t._borderRight:(t._borderRight=n,t)},n.prototype.borderBottom=function(n){var t=this;return arguments.length===0?t._borderBottom:(t._borderBottom=n,t)},n.prototype.textDecoration=function(n){var t=this;return arguments.length===0?t._textDecoration:(t._textDecoration=n,t)},n.prototype.fromJSON=function(n){var r,f,e,o,s;n&&!t.GC$.isEmptyObject(n)&&(r=this,n.backColor!==i&&(r._backColor=n.backColor),n.foreColor!==i&&(r._foreColor=n.foreColor),n.font!==i&&(r._font=n.font),n.borderLeft!==i&&(f=new u,f.fromJSON(n.borderLeft),r._borderLeft=f),n.borderTop!==i&&(e=new u,e.fromJSON(n.borderTop),r._borderTop=e),n.borderRight!==i&&(o=new u,o.fromJSON(n.borderRight),r._borderRight=o),n.borderBottom!==i&&(s=new u,s.fromJSON(n.borderBottom),r._borderBottom=s),n.textDecoration!==i&&(r._textDecoration=n.textDecoration))},n.prototype.toJSON=function(){var n=this,e={backColor:n._backColor,foreColor:n._foreColor,font:t.StyleHelper.normalizeFont(n._font),borderLeft:n._borderLeft&&n._borderLeft.toJSON(),borderTop:n._borderTop&&n._borderTop.toJSON(),borderRight:n._borderRight&&n._borderRight.toJSON(),borderBottom:n._borderBottom&&n._borderBottom.toJSON(),textDecoration:n._textDecoration},o={},u,r;for(u in e)r=e[u],r===i||r===f||typeof r=="object"&&t.GC$.isEmptyObject(r)||(o[u]=r);return o},n}();t.SlicerStyleInfo=r;u=function(){function n(n,t,i){var r=this;r._borderWidth=n;r._borderStyle=t;r._borderColor=i}return n.prototype.borderWidth=function(n){var t=this;return arguments.length===0?t._borderWidth:(typeof n=="number"&&n>0&&n!==t._borderWidth&&(t._borderWidth=n),t)},n.prototype.borderStyle=function(n){var t=this;return arguments.length===0?t._borderStyle:(typeof n=="string"&&n!==t._borderStyle&&(t._borderStyle=n),t)},n.prototype.borderColor=function(n){var t=this;return arguments.length===0?t._borderColor:(typeof n=="string"&&n!==t._borderColor&&(t._borderColor=n),t)},n.prototype.fromJSON=function(n,r){if(n&&!t.GC$.isEmptyObject(n)){var u=this;n.borderWidth!==i&&(u._borderWidth=n.borderWidth);n.borderStyle!==i&&(u._borderStyle=n.borderStyle);n.borderColor!==i&&(u._borderColor=n.borderColor)}},n.prototype.toJSON=function(){var r=this,n={borderWidth:r._borderWidth,borderStyle:r._borderStyle,borderColor:r._borderColor},u={};for(var t in n)n[t]!==i&&n[t]!==f&&(u[t]=n[t]);return u},n}();t.SlicerBorder=u;o=function(){function n(){var n=this;n.name("");n._wholeSlicerStyle=n.createDefaultStyleInfo()}return n.prototype.createDefaultStyleInfo=function(){var t=new u(0,"",""),n=new r("white","black",e);return n.setBorders(t),n},n.prototype.name=function(n){var t=this;return arguments.length===0?this._name:(n!==i&&n!==f&&t._name!==n&&(t._name=n),t)},n.prototype.wholeSlicerStyle=function(n){var t=this;return arguments.length===0?t._wholeSlicerStyle:(n&&t._wholeSlicerStyle!==n&&(t._wholeSlicerStyle=n),t)},n.prototype.headerStyle=function(n){var t=this;return arguments.length===0?t._headerStyle:(n&&t._headerStyle!==n&&(t._headerStyle=n),t)},n.prototype.selectedItemWithDataStyle=function(n){var t=this;return arguments.length===0?t._selectedItemWithDataStyle:(n&&t._selectedItemWithDataStyle!==n&&(t._selectedItemWithDataStyle=n),t)},n.prototype.selectedItemWithNoDataStyle=function(n){var t=this;return arguments.length===0?t._selectedItemWithNoDataStyle:(n&&t._selectedItemWithNoDataStyle!==n&&(t._selectedItemWithNoDataStyle=n),t)},n.prototype.unSelectedItemWithDataStyle=function(n){var t=this;return arguments.length===0?t._unSelectedItemWithDataStyle:(n&&t._unSelectedItemWithDataStyle!==n&&(t._unSelectedItemWithDataStyle=n),t)},n.prototype.unSelectedItemWithNoDataStyle=function(n){var t=this;return arguments.length===0?t._unSelectedItemWithNoDataStyle:(n&&t._unSelectedItemWithNoDataStyle!==n&&(t._unSelectedItemWithNoDataStyle=n),t)},n.prototype.hoveredSelectedItemWithDataStyle=function(n){var t=this;return arguments.length===0?t._hoveredSelectedItemWithDataStyle:(n&&t._hoveredSelectedItemWithDataStyle!==n&&(t._hoveredSelectedItemWithDataStyle=n),t)},n.prototype.hoveredSelectedItemWithNoDataStyle=function(n){var t=this;return arguments.length===0?t._hoveredSelectedItemWithNoDataStyle:(n&&t._hoveredSelectedItemWithNoDataStyle!==n&&(t._hoveredSelectedItemWithNoDataStyle=n),t)},n.prototype.hoveredUnSelectedItemWithDataStyle=function(n){var t=this;return arguments.length===0?t._hoveredUnSelectedItemWithDataStyle:(n&&t._hoveredUnSelectedItemWithDataStyle!==n&&(t._hoveredUnSelectedItemWithDataStyle=n),t)},n.prototype.hoveredUnSelectedItemWithNoDataStyle=function(n){var t=this;return arguments.length===0?t._hoveredUnSelectedItemWithNoDataStyle:(n&&t._hoveredUnSelectedItemWithNoDataStyle!==n&&(t._hoveredUnSelectedItemWithNoDataStyle=n),t)},n.prototype.fromJSON=function(n){var f,o,e,u;if(n&&!t.GC$.isEmptyObject(n)){if(f=this,n.name!==i&&(f._name=n.name,f.isBuildinStyle(f._name))){o=f._name.toLocaleLowerCase().replace("slicerstyle","").replace(" ","");e=h[o]();f.wholeSlicerStyle(e.wholeSlicerStyle());f.headerStyle(e.headerStyle());f.selectedItemWithDataStyle(e.selectedItemWithDataStyle());f.selectedItemWithNoDataStyle(e.selectedItemWithNoDataStyle());f.unSelectedItemWithDataStyle(e.unSelectedItemWithDataStyle());f.unSelectedItemWithNoDataStyle(e.unSelectedItemWithNoDataStyle());f.hoveredSelectedItemWithDataStyle(e.hoveredSelectedItemWithDataStyle());f.hoveredSelectedItemWithNoDataStyle(e.hoveredSelectedItemWithNoDataStyle());f.hoveredUnSelectedItemWithDataStyle(e.hoveredUnSelectedItemWithDataStyle());f.hoveredSelectedItemWithNoDataStyle(e.hoveredSelectedItemWithNoDataStyle());return}n.wholeSlicerStyle!==i&&(u=new r,u.fromJSON(n.wholeSlicerStyle),f._wholeSlicerStyle=u);n.headerStyle!==i&&(u=new r,u.fromJSON(n.headerStyle),f._headerStyle=u);n.selectedItemWithDataStyle!==i&&(u=new r,u.fromJSON(n.selectedItemWithDataStyle),f._selectedItemWithDataStyle=u);n.selectedItemWithNoDataStyle!==i&&(u=new r,u.fromJSON(n.selectedItemWithNoDataStyle),f._selectedItemWithNoDataStyle=u);n.unSelectedItemWithDataStyle!==i&&(u=new r,u.fromJSON(n.unSelectedItemWithDataStyle),f._unSelectedItemWithDataStyle=u);n.unSelectedItemWithNoDataStyle!==i&&(u=new r,u.fromJSON(n.unSelectedItemWithNoDataStyle),f._unSelectedItemWithNoDataStyle=u);n.hoveredSelectedItemWithDataStyle!==i&&(u=new r,u.fromJSON(n.hoveredSelectedItemWithDataStyle),f._hoveredSelectedItemWithDataStyle=u);n.hoveredSelectedItemWithNoDataStyle!==i&&(u=new r,u.fromJSON(n.hoveredSelectedItemWithNoDataStyle),f._hoveredSelectedItemWithNoDataStyle=u);n.hoveredUnSelectedItemWithDataStyle!==i&&(u=new r,u.fromJSON(n.hoveredUnSelectedItemWithDataStyle),f._hoveredUnSelectedItemWithDataStyle=u);n.hoveredUnSelectedItemWithNoDataStyle!==i&&(u=new r,u.fromJSON(n.hoveredUnSelectedItemWithNoDataStyle),f._hoveredUnSelectedItemWithNoDataStyle=u)}},n.prototype.toJSON=function(){var u=this,n,e,r;n=u.isBuildinStyle(u._name)?{name:u._name}:u.toJSONInternal();e={};for(r in n)n[r]===f||n[r]===i||t.GC$.isEmptyObject(n[r])||(e[r]=n[r]);return e},n.prototype.toJSONInternal=function(){var n=this;return{name:n._name,wholeSlicerStyle:n._wholeSlicerStyle?n._wholeSlicerStyle.toJSON():f,headerStyle:n._headerStyle?n._headerStyle.toJSON():f,selectedItemWithDataStyle:n._selectedItemWithDataStyle?n._selectedItemWithDataStyle.toJSON():f,selectedItemWithNoDataStyle:n._selectedItemWithNoDataStyle?n._selectedItemWithNoDataStyle.toJSON():f,unSelectedItemWithDataStyle:n._unSelectedItemWithDataStyle?n._unSelectedItemWithDataStyle.toJSON():f,unSelectedItemWithNoDataStyle:n._unSelectedItemWithNoDataStyle?n._unSelectedItemWithNoDataStyle.toJSON():f,hoveredSelectedItemWithDataStyle:n._hoveredSelectedItemWithDataStyle?n._hoveredSelectedItemWithDataStyle.toJSON():f,hoveredSelectedItemWithNoDataStyle:n._hoveredSelectedItemWithNoDataStyle?n._hoveredSelectedItemWithNoDataStyle.toJSON():f,hoveredUnSelectedItemWithDataStyle:n._hoveredUnSelectedItemWithDataStyle?n._hoveredUnSelectedItemWithDataStyle.toJSON():f,hoveredUnSelectedItemWithNoDataStyle:n._hoveredUnSelectedItemWithNoDataStyle?n._hoveredUnSelectedItemWithNoDataStyle.toJSON():f}},n.prototype.isBuildinStyle=function(n){var i=["SlicerStyleLight1","SlicerStyleLight2","SlicerStyleLight3","SlicerStyleLight4","SlicerStyleLight5","SlicerStyleLight6","SlicerStyleDark1","SlicerStyleDark2","SlicerStyleDark3","SlicerStyleDark4","SlicerStyleDark5","SlicerStyleDark6","SlicerStyleOther1","SlicerStyleOther2"];return t.ArrayHelper.contains(i,n)},n}();t.SlicerStyle=o;h=function(){function n(){}return n.light1=function(){return n.createLightStyle(1)},n.light2=function(){return n.createLightStyle(2)},n.light3=function(){return n.createLightStyle(3)},n.light4=function(){return n.createLightStyle(4)},n.light5=function(){return n.createLightStyle(5)},n.light6=function(){return n.createLightStyle(6)},n.createLightStyle=function(n){var t=new o,a="Accent "+n,p="SlicerStyleLight"+n,f,s,h,c,l,i;t.name(p);f=new r;f.backColor("white");f.font(e);f.setBorders(new u(1,"solid",a));t.wholeSlicerStyle(f);var y=new r,v=new u(0,"",""),w=new u(1,"solid",a);return y.borderLeft(v).borderTop(v).borderRight(v).borderBottom(w),t.headerStyle(y),s=new r,s.foreColor("black"),s.backColor(a+",Lighter 60%"),s.setBorders(new u(1,"solid","#999999")),t.selectedItemWithDataStyle(s),h=new r,h.foreColor("#828282"),h.backColor(a+",Lighter 80%"),h.setBorders(new u(1,"solid","#CCCCCC")),t.selectedItemWithNoDataStyle(h),c=new r,c.foreColor("black"),c.backColor("white"),c.setBorders(new u(1,"solid","#CCCCCC")),t.unSelectedItemWithDataStyle(c),l=new r,l.foreColor("#828282"),l.backColor("white"),l.setBorders(new u(1,"solid","#E0E0E0")),t.unSelectedItemWithNoDataStyle(l),i=new r,i.foreColor("black"),i.backColor("#F9E36F"),i.setBorders(new u(1,"solid","#999999")),t.hoveredSelectedItemWithDataStyle(i),t.hoveredSelectedItemWithNoDataStyle(i),t.hoveredUnSelectedItemWithDataStyle(i),t.hoveredUnSelectedItemWithNoDataStyle(i),t},n.dark1=function(){return n.createDarkStyle(1)},n.dark2=function(){return n.createDarkStyle(2)},n.dark3=function(){return n.createDarkStyle(3)},n.dark4=function(){return n.createDarkStyle(4)},n.dark5=function(){return n.createDarkStyle(5)},n.dark6=function(){return n.createDarkStyle(6)},n.createDarkStyle=function(n){var t=new o,f="Accent "+n,p="SlicerStyleDark"+n,s,h,c,l,a,i;t.name(p);s=new r;s.backColor("white");s.font(e);s.setBorders(new u(1,"solid",f));t.wholeSlicerStyle(s);var y=new r,v=new u(0,"",""),w=new u(1,"solid",f);return y.borderLeft(v).borderTop(v).borderRight(v).borderBottom(w),t.headerStyle(y),h=new r,h.foreColor("white"),h.backColor(f),h.setBorders(new u(1,"solid",f)),t.selectedItemWithDataStyle(h),c=new r,c.foreColor(f+",Darker 25%"),c.backColor(f+",Lighter 60%"),c.setBorders(new u(1,"solid",f+",Lighter 60%")),t.selectedItemWithNoDataStyle(c),l=new r,l.foreColor("black"),l.backColor("#C0C0C0"),l.setBorders(new u(1,"solid","#C0C0C0")),t.unSelectedItemWithDataStyle(l),a=new r,a.foreColor("#959595"),a.backColor("#DFDFDF"),a.setBorders(new u(1,"solid","#DFDFDF")),t.unSelectedItemWithNoDataStyle(a),i=new r,i.foreColor("black"),i.backColor("#F9E36F"),i.setBorders(new u(1,"solid","#999999")),t.hoveredSelectedItemWithDataStyle(i),t.hoveredSelectedItemWithNoDataStyle(i),t.hoveredUnSelectedItemWithDataStyle(i),t.hoveredUnSelectedItemWithNoDataStyle(i),t},n.other1=function(){var n=new o,v="SlicerStyleOther1",i,f,s,h,c,t;n.name(v);i=new r;i.backColor("white");i.font(e);i.setBorders(new u(1,"solid","#808080"));n.wholeSlicerStyle(i);var a=new r,l=new u(0,"",""),y=new u(1,"solid","#A6A6A6");return a.borderLeft(l).borderTop(l).borderRight(l).borderBottom(y),n.headerStyle(a),f=new r,f.foreColor("black"),f.backColor("#BFBFBF"),f.setBorders(new u(1,"solid","#999999")),n.selectedItemWithDataStyle(f),s=new r,s.foreColor("black"),s.backColor("#D9D9D9"),s.setBorders(new u(1,"solid","#CCCCCC")),n.selectedItemWithNoDataStyle(s),h=new r,h.foreColor("black"),h.backColor("white"),h.setBorders(new u(1,"solid","#CCCCCC")),n.unSelectedItemWithDataStyle(h),c=new r,c.foreColor("#959595"),c.backColor("white"),c.setBorders(new u(1,"solid","#E0E0E0")),n.unSelectedItemWithNoDataStyle(c),t=new r,t.foreColor("black"),t.backColor("#F9E36F"),t.setBorders(new u(1,"solid","#999999")),n.hoveredSelectedItemWithDataStyle(t),n.hoveredSelectedItemWithNoDataStyle(t),n.hoveredUnSelectedItemWithDataStyle(t),n.hoveredUnSelectedItemWithNoDataStyle(t),n},n.other2=function(){var n=new o,v="SlicerStyleOther2",i,f,s,h,c,t;n.name(v);i=new r;i.backColor("white");i.font(e);i.setBorders(new u(1,"solid","#4F81BD"));n.wholeSlicerStyle(i);var a=new r,l=new u(0,"",""),y=new u(1,"solid","#4F81BD");return a.borderLeft(l).borderTop(l).borderRight(l).borderBottom(y),n.headerStyle(a),f=new r,f.foreColor("black"),f.backColor("#A9C1E3"),f.setBorders(new u(1,"solid","#999999")),n.selectedItemWithDataStyle(f),s=new r,s.foreColor("#828282"),s.backColor("#D5E2F6"),s.setBorders(new u(1,"solid","#CCCCCC")),n.selectedItemWithNoDataStyle(s),h=new r,h.foreColor("black"),h.backColor("white"),h.setBorders(new u(1,"solid","#CCCCCC")),n.unSelectedItemWithDataStyle(h),c=new r,c.foreColor("#828282"),c.backColor("white"),c.setBorders(new u(1,"solid","#E0E0E0")),n.unSelectedItemWithNoDataStyle(c),t=new r,t.foreColor("black"),t.backColor("#F9E36F"),t.setBorders(new u(1,"solid","#999999")),n.hoveredSelectedItemWithDataStyle(t),n.hoveredSelectedItemWithNoDataStyle(t),n.hoveredUnSelectedItemWithDataStyle(t),n.hoveredUnSelectedItemWithNoDataStyle(t),n},n}();t.SlicerStyles=h;c=function(){function i(t){this._listeners=[];var i=this,r=[],u=[],e=t._getSheet(),f=t.rowFilter();i._sheet=e;i._table=t;i._rowFilter=f;i.setDataSource(r,u);i._generalSlicerData=new n.Slicer.GeneralSlicerData(r,u);i.initFilterInfo();f.filterHandler=function(n){i.onFilteredByTable(n)}}return i.prototype.setDataSource=function(n,t){for(var e,i,s,h=this,f=h._table,o=f._getSheet(),r=f.dataRange(),c=r.row+r.rowCount-1,l=r.col+r.colCount-1,u=r.row;u<=c;u++)for(e=[],n.push(e),i=r.col;i<=l;i++)e.push({value:o.getValue(u,i),text:o.getText(u,i)});for(i=0;i<r.colCount;i++)s=f.getColumnName(i)||"",t.push(s)},i.prototype.initFilterInfo=function(){var t=this,r=t._sheet,u=t._table,e=u.dataRange(),f=u.rowFilter(),i,n;for(r.isPaintSuspended(!0),i=f&&f.filteredColumns||[],n=0;n<i.length;n++)t.onFilteredByTable({column:i[n]});r.isPaintSuspended(!1)},i.prototype.onFilteredByTable=function(n){var c=n.column-this._table.range().col,r=this._table.dataRange(),l=c+r.col,f=this._generalSlicerData.columnNames[c],e=[],a={},o,u,s,v,h,y,i;if(t.ArrayHelper.contains(this._rowFilter.filteredColumns,l)){for(o=[],u=r.row;u<r.row+r.rowCount;u++)if(s=this._rowFilter.filteredInRowsWithColIndexs[u],s)for(i=0;i<s.length;i++)if(s[i]===l){o.push(u);break}for(i=0;i<o.length;i++)v=o[i]-r.row,h=this.getExclusiveRowIndex(f,v),a[h]||(a[h]=!0,e.push(h))}else for(y=this.getExclusiveData(f).length,i=0;i<y;i++)e.push(i);if(!t.ArrayHelper.isEquals(this.getFilteredExclusiveRowIndexesBySelf(f),e)){this._generalSlicerData.doFilter(f,{exclusiveRowIndexes:e});this.onFiltered(this._generalSlicerData.getFilteredRowIndexes(),!1);this._sheet.invalidate()}},i.prototype.getFilteredExclusiveRowIndexesBySelf=function(n){for(var r=this,f=r.getExclusiveData(n),e=r.getFilteredOutIndexes(n,1),u=[],i=0,o=f.length;i<o;i++)t.ArrayHelper.contains(e,i)&&u.push(i);return u},i.prototype.getTable=function(){return this._table},i.prototype.getSheet=function(){return this._sheet},i.prototype.getColumnIndex=function(n){return this._generalSlicerData.getColumnIndex(n)},i.prototype.getGeneralSlicerData=function(){return this._generalSlicerData},i.prototype.getData=function(n,t){return this._generalSlicerData.getData(n,t)},i.prototype.getExclusiveData=function(n){return this._generalSlicerData.getExclusiveData(n)},i.prototype.getRowIndexes=function(n,t){return this._generalSlicerData.getRowIndexes(n,t)},i.prototype.getExclusiveRowIndex=function(n,t){return this._generalSlicerData.getExclusiveRowIndex(n,t)},i.prototype.getFilteredIndexes=function(n){return this._generalSlicerData.getFilteredIndexes(n)},i.prototype.getFilteredRanges=function(n){return this._generalSlicerData.getFilteredRanges(n)},i.prototype.getFilteredOutRanges=function(n){return this._generalSlicerData.getFilteredOutRanges(n)},i.prototype.getFilteredOutIndexes=function(n,t){return this._generalSlicerData.getFilteredOutIndexes(n,t)},i.prototype.attachListener=function(n){this._listeners.push(n)},i.prototype.detachListener=function(n){for(var t=0;t<this._listeners.length;t++)if(this._listeners[t]===n){this._listeners.splice(t,1);break}},i.prototype.getListeners=function(){return this._listeners},i.prototype.doFilter=function(n,i,r){var u=this,o=u._generalSlicerData,h=o.getColumnIndex(n),d,e,nt,c,tt,a,v,s,y,p,w,it,b,f,rt,k,l;if(!(h<0)&&(i.exclusiveRowIndexes||i.ranges))if(r){o.doFilter(n,i,r);u.onFiltered(o.getFilteredRowIndexes(),!0)}else{if(d=i.exclusiveRowIndexes?u.getExclusiveData(n):u.getData(n),i.exclusiveRowIndexes)e=i.exclusiveRowIndexes;else{e=[];var ft=o.data,g=o.getSortedColumnDataCache(),ut=o.getSorted2DataMapping();for(g[h]||o.sortOneCol(h),nt=g[h],c=0;c<i.ranges.length;c++)for(tt=i.ranges[c],a=o._getStartEndIndex(nt,tt),f=a.start;f<=a.end;f++)e.push(ut[h][f])}for(v=u._sheet.isPaintSuspended(),v||u._sheet.isPaintSuspended(!0),s=u._table.startColumn()+h,y=u._table.dataRange().row,u._rowFilter.removeFilterItemsInternal(s),u._rowFilter._unfilterColumn(s),u._sheet.refreshObjectsAboveSheet(),p=[],f=0;f<e.length;f++)w=new t.TextCondition(0,d[e[f]]),u._rowFilter.addFilterItem(s,w),p.push(w);for(u._generalSlicerData.doFilter(n,i),it=[],b={},u._generalSlicerData.getFilteredExclusiveIndexes(n,it,b),f=0;f<e.length;f++)if(rt=i.exclusiveRowIndexes?e[f]:u.getExclusiveRowIndex(n,e[f]),b[rt])if(u._rowFilter._addFilteredItem(p[f]),i.exclusiveRowIndexes)for(k=u.getRowIndexes(n,e[f]),l=0;l<k.length;l++)u._rowFilter._addFilteredInRowsWithColumnIndex(k[l]+y,s);else u._rowFilter._addFilteredInRowsWithColumnIndex(e[f]+y,s);u._rowFilter._setColumnFilteredState(s,!0);u._rowFilter.onFilter(u._rowFilter.getFilterArgs(0,s));u.onFiltered(u._generalSlicerData.getFilteredRowIndexes(),!1);u._sheet.invalidateLayout();v||u._sheet.isPaintSuspended(!1)}},i.prototype.clearPreview=function(){var n=this,t=n._generalSlicerData;n._generalSlicerData.clearPreview();n.onFiltered(t.getFilteredRowIndexes(),t.inPreview())},i.prototype.onFiltered=function(n,t){for(var r=this,i=0;i<r._listeners.length;i++)if(r._listeners[i].onFiltered)r._listeners[i].onFiltered({rowIndexes:n,isPreview:t})},i.prototype.doUnfilter=function(n){var t=this,u,i,r,f;if(t._generalSlicerData.inPreview()&&t.clearPreview(),u=t._generalSlicerData.getColumnIndex(n),i=t._rowFilter,u!==-1){r=t._table.startColumn()+u;f=t._table.dataRange().row;i.removeFilterItems(r);t._generalSlicerData.doUnfilter(n);i._unfilterColumn(r);i._setColumnFilteredState(r,!1);i.onFilter(i.getFilterArgs(0,r));t.onFiltered(t._generalSlicerData.getFilteredRowIndexes(),!1);t._sheet.invalidateLayout();t._sheet.repaint()}},i.prototype.refresh=function(){var n=this,r=[],u=[],t,f,i;for(n.setDataSource(r,u),n._generalSlicerData.setDataSource(r,u),t=0,f=n._listeners.length;t<f;t++)i=n._listeners[t],i.reset&&i.reset()},i.prototype.onDataChanged=function(t,i,r){var e=this._generalSlicerData,o,s,f,u,h;if(e)for(o=[new n.Slicer.SlicerDataItem(e.columnNames[i],t,r.text)],e.changeData(o),s=this,f=s._listeners||[],u=0,h=f.length;u<h;u++)if(f[u].onDataChanged)f[u].onDataChanged(o)},i.prototype.onColumnNameChanged=function(n,t){var i=this,o,r,f,e,u,s;if(i._generalSlicerData){if(i._generalSlicerData.changeColumnName(n,t),o=i._sheet,r=o._slicerCollection.getSlicers(i._table.tableName(),n),r&&r.length>0)for(f=0;f<r.length;f++)r[f].columnName(t);for(e=i._listeners||[],u=0,s=e.length;u<s;u++)if(e[u].onColumnNameChanged)e[u].onColumnNameChanged(n,t)}},i.prototype.onRowsAdded=function(n,t){var u=this,c=u._sheet,a=u._table,f=a.dataRange(),e=u._generalSlicerData,s,h,r,o,i,l;for(e&&e.addRows(n,t),s=e.columnNames,h=e.data,i=n;i<n+t;i++)for(r=0;r<s.length;r++)h[i][r]={value:c.getValue(f.row+i,f.col+r),text:c.getText(f.row+i,f.col+r)};for(u._generalSlicerData.setDataSource(h,s),o=u._listeners||[],i=0,l=o.length;i<l;i++)if(o[i].onRowsChanged)o[i].onRowsChanged(n,t,!0)},i.prototype.onRowsDeleted=function(n,t){var u=this._generalSlicerData,f,r,i,e;if(u)for(u.removeRowsCore(n,t,!1),f=this,r=f._listeners||[],i=0,e=r.length;i<e;i++)if(r[i].onRowsChanged)r[i].onRowsChanged(n,t,!1)},i.prototype.onColumnsAdded=function(n,t){var r=this,s=r._sheet,c=r._table,f=c.dataRange(),e,o,u,i,h;if(r._generalSlicerData){for(e=r._generalSlicerData.data,o=r._generalSlicerData.columnNames,i=0;i<e.length;i++)for(u=n;u<n+t;u++)e[i].splice(u,0,{value:s.getValue(f.row+i,f.col+u),text:s.getText(f.row+i,f.col+u)});for(i=n;i<n+t;i++)h=r._table.getColumnName(i)||"",o.splice(i,0,h);r._generalSlicerData.setDataSource(e,o)}},i.prototype.onColumnsDeleted=function(n,t){var u=this,e=u._generalSlicerData,f,i,s,r;if(e){var a=e.data,h=e.columnNames,p=a.concat(),v=h.concat(),o=[];for(i=n;i<n+t;i++)o.push(h[i]);for(u._generalSlicerData.removeColumns(n,t),f=u._listeners||[],i=0;i<o.length;i++)for(r=0;r<f.length;r++)if(f[r].onColumnRemoved)f[r].onColumnRemoved(o[i]);var c=u._sheet,y=u._table,l=c&&c._slicerCollection;for(i=n;i<n+t;i++)for(s=l.getSlicers(y.name(),v[i]),r=0;r<s.length;r++)l.removeSlicer(s[r])}},i.prototype.onTableRemoved=function(n){var t=this,r,u,i;if(n&&n===t._table){t._savedSlicers=[];var e=t._sheet,f=e._slicerCollection,h=t._listeners||[],o=t._generalSlicerData.columnNames,s=n.name();for(r=0;r<o.length;r++)for(u=f.getSlicers(s,o[r]),i=0;i<u.length;i++)t._savedSlicers.push(u[i]),e.removeSlicer(u[i].name());f&&f.removeSlicerData(t);t._listeners=[]}},i.prototype.onTableAdded=function(n){var r=this,u=r._sheet,f=u._slicerCollection,i,t;for(f&&n&&n.hasSlicerData()&&f.addSlicerData(n.getSlicerData()),i=r._savedSlicers||[],t=0;t<i.length;t++)u.addSlicerInternal(i[t])},i}();t.TableSlicerData=c;l=function(i){function r(n){i.call(this,n);this._isSelected=!1}return __extends(r,i),r.prototype.isSelected=function(n){var t=this;return arguments.length===0?t._isSelected:(n!==t._isSelected&&(t._isSelected=n),t)},r.prototype.sheet=function(n){var t=this;return arguments.length===0?t._sheet:(n!==t._sheet&&(t._sheet=n),t)},r.prototype.slicer=function(n){var t=this;return arguments.length===0?t._slicer:(n!==t._slicer&&(t._slicer=n),t)},r.prototype.onDataLoaded=function(){var n=this,t;n.slicerData&&n.slicerData instanceof c&&(t=n.slicerData,n._sheet=t.getSheet(),n._table=t.getTable());i.prototype.onDataLoaded.call(this)},r.prototype.onColumnRemoved=function(n){var t=this,r,i,u;n===t.columnName&&(r=t.slicerData.getFilteredOutIndexes(n,1),r.length!==0&&t.slicerData.doUnfilter(n),i=t._sheet,u=t._table,i&&u&&i._removeFloatingObjectInternal(t.name()))},r.prototype.orderBySortState=function(t,i){var r=this,l=r._sheet,a=r.slicerData.getColumnIndex(r.columnName),v=r._table,h=v.dataRange(),e=[],o,f,c,s,u;if(i!==0){for(o=[],f=0;f<t.length;f++)c=r.slicerData.getRowIndexes(r.columnName,f),o.push(l.getValue(h.row+c[0],h.col+a));for(s=n.Slicer.SortHelper.quickSort(o),u=0;u<s.length;u++)e[u]=t[s[u].index];i===2&&e.reverse()}else return t;return e},r.prototype.doMouseDown=function(n){var t=this,s=t._sheet,f=t._slicer,r,e,u,o;if(f&&s.canEditFloatingObject(f)){if(r=t.hitTest(n),!t.canDoFilter()&&(r.mark===5||r.mark===6||r.mark===8)){n.stopPropagation();return}for(e=f.getTableItemSlicers(),u=0,o=e.length;u<o;u++)i.prototype.doMouseDown.call(e[u],n)}},r.prototype.canDoFilter=function(){var n=this._table,i=this._sheet,t=n&&n.rowFilter();return!i.isProtected||t&&t.canDoFilter()},r.prototype.doMouseUp=function(n){var i=this,f=i._sheet,s=i._slicer,o,a,v,y,u,r,p;if(s&&f.canEditFloatingObject(s)&&i.canDoFilter()&&(o=i.hitTest(n),o)){var e=i.slicerData,c=i._selectingItemIndexes,l=i._filteringItemIndexes,w=e.getExclusiveData(i.columnName),h=!1;for(o.mark!==4&&(o.mark!==5||l.length!==w.length||i._isCtrlKeyDown||i._isShiftKeyDown)?c&&c.length>0&&(i._isCtrlKeyDown||i._isShiftKeyDown||(v=e.getFilteredIndexes(i.columnName),y=l.concat(),f._doCommand(new t.UndoRedo.SlicerDataFilterUndoAction(f,e,i.columnName,v,y)),h=!0)):(a=e.getFilteredIndexes(i.columnName),f._doCommand(new t.UndoRedo.SlicerDataUnFilterUndoAction(f,e,i.columnName,a)),h=!0),u=s.getTableItemSlicers(),r=0,p=u.length;r<p;r++)u[r]._isMouseDownOnItem=!1,u[r]._isMouseDownOnScrollbar=!1,h&&(u[r]._selectingItemIndexes=[],u[r]._filteringItemIndexes=[])}},r.prototype.doMouseMove=function(n){var r=this,o=r._sheet,u=r._slicer,f,t,e;if(u&&!r._isMouseDownOnScrollbar&&o.canEditFloatingObject(u))for(f=u.getTableItemSlicers(),t=0,e=f.length;t<e;t++)i.prototype.doMouseMove.call(f[t],n)},r.prototype.doMouseLeave=function(n){var f=this,o=f._sheet,r=f._slicer,u,t,e;if(r&&o.canEditFloatingObject(r))for(u=r.getTableItemSlicers(),t=0,e=u.length;t<e;t++)i.prototype.doMouseLeave.call(u[t],n)},r.prototype.doScroll=function(n,t){var e=this,s=e._sheet,u=e._slicer,f,r,o;for(u&&s.canEditFloatingObject(u)||(t.newValue=t.oldValue),f=u.getTableItemSlicers(),r=0,o=f.length;r<o;r++)i.prototype.scrollTo.call(f[r],n,t)},r.prototype.doMouseWheel=function(n){var t=this;if(i.prototype.doMouseWheel.call(this,n))return!0;var e=t._sheet,r=e._slicerCollection,u=r&&r.getSelectedSlicers(),f=t.getScrollbarObj();return u&&u.length===1&&t._isSelected&&t.needShowScrollbar()&&f?(f._scrollContainerMousewheel(n),n.stopPropagation(),!0):!1},r.prototype.doKeyUp=function(n){var i=this,r=i.slicerData,u=i._sheet,f,e,o,s;n.keyCode===17&&i._isCtrlKeyDown&&(i._isCtrlKeyDown=!1);n.keyCode===16&&i._isShiftKeyDown&&(i._isShiftKeyDown=!1);!i._isCtrlKeyDown&&!i._isShiftKeyDown&&i._selectingItemIndexes.length>0&&(f=i.slicerData.getExclusiveData(i.columnName).length,i._filteringItemIndexes.length===f?(e=r.getFilteredIndexes(i.columnName),u._doCommand(new t.UndoRedo.SlicerDataUnFilterUndoAction(u,r,i.columnName,e))):(o=r.getFilteredIndexes(i.columnName),s=i._filteringItemIndexes.concat(),u._doCommand(new t.UndoRedo.SlicerDataFilterUndoAction(u,r,i.columnName,o,s))),i._selectingItemIndexes=[],i._filteringItemIndexes=[])},r}(v);t.TableItemSlicer=l;y=function(){function n(n){var t=this;t._sheet=n;t._slicerDatas=[];t._slicerSet={}}return n.prototype.addSlicerData=function(n){var i=this,r,t,u;if(n){for(r=n.getTable(),t=0,u=i._slicerDatas.length;t<u;t++)if(i._slicerDatas[t].getTable()===r)return;i._slicerDatas.push(n)}},n.prototype.removeSlicerData=function(n){t.ArrayHelper.remove(this._slicerDatas,n)},n.prototype.getSlicerData=function(n){var i=this,r,u,t;if(!i._slicerDatas||i._slicerDatas.length===0)return null;for(r=0,u=i._slicerDatas.length;r<u;r++)if(t=i._slicerDatas[r],t&&t.getTable()&&t.getTable().tableName()===n)return t;return f},n.prototype.addSlicer=function(n){var i=this;if(n){if(!i.isSlicerNameValid(n.name()))throw new Error(t.SR.Exp_SlicerNameInvalid);if(i.isSlicerNameExist(n.name()))throw new Error(t.SR.Exp_SlicerNameExist);i._slicerSet[n.name()]=n;i.addSlicerData(n.getSlicerData())}},n.prototype.removeSlicer=function(n){var r=this,f=r._slicerSet,u,i,t;if(n&&f.hasOwnProperty(n.name())){for(u=n.getSlicerData(),i=n.getTableItemSlicers(),t=0;t<i.length;t++)u.detachListener(i[t]);delete r._slicerSet[n.name()]}},n.prototype.getSlicer=function(n){return n===f||n===undefined?null:this._slicerSet[n]},n.prototype.getSlicers=function(n,i){var e=this,f,r,u;if(t.GC$.isEmptyObject(e._slicerSet))return[];if(f=[],r=e._slicerSet,arguments.length===0)for(u in r)f.push(r[u]);else if(arguments.length===1)for(u in r)r[u].getTable().name()===n&&f.push(r[u]);else for(u in r)r[u].getTable().name()===n&&r[u].columnName()===i&&f.push(r[u]);return f},n.prototype.getSlicerSet=function(){return this._slicerSet},n.prototype.updateSlicerSet=function(n,t){var r=this,i=r._slicerSet,u=i[n];delete i[n];i[t]=u},n.prototype.isSlicerNameValid=function(n){return!!n},n.prototype.isSlicerNameExist=function(n){return this.getSlicerSetInSpread().hasOwnProperty(n)},n.prototype.getAutoSlicerName=function(n){var r=this.getSlicerSetInSpread();if(!r.hasOwnProperty(n))return n;for(var t=1,i=" ",u=n.split(i)[0];r.hasOwnProperty(u+i+t);)t++;return u+i+t},n.prototype.getSlicerSetInSpread=function(){var t=this,f={},i=t._sheet&&t._sheet.parent&&t._sheet.parent.sheets,n,r,u;if(i)for(n=0;n<i.length;n++){r=i[n]._slicerCollection.getSlicerSet();for(u in r)f[u]=r[u]}return f},n.prototype.getSelectedSlicers=function(){var n=this,r,u,i;if(!n._slicerSet||t.GC$.isEmptyObject(n._slicerSet))return[];r=[];for(u in n._slicerSet)i=n._slicerSet[u],i&&i.isSelected()&&r.push(i);return r},n.prototype.mouseWheelSelectedSlicer=function(n){var u=this,r=u.getSelectedSlicers(),t,i;if(r.length!==1)return!1;if(t=r[0].getTableItemSlicers(),t&&t.length>0){for(i=0;i<t.length;i++)t[i].doMouseWheel(n);return!0}return!1},n.prototype.toJSON=function(){var n=this,i,r;if(!n._slicerSet||t.GC$.isEmptyObject(n._slicerSet))return f;i=[];for(r in n._slicerSet)i.push(n._slicerSet[r].toJSON());return i.length===0?f:i},n.prototype.fromJSON=function(n,t){var f,i,e,r,u;if(n&&n.length!==0)for(f=this,f._slicerSet={},i=0;i<n.length;i++)if(e=n[i].tableName,r=n[i].columnName,e&&r){var f=this,o=f._sheet,s=o.findTableByName(e);s&&s.getColumnIndexInTable(r)!==-1&&(u=new a(n[i].name,s,r),u.fromJSON(n[i]),o._slicerCollection.addSlicer(u),o.addFloatingObject(u))}},n}();t.SlicerCollection=y;a=function(n){function r(t,i,u){n.call(this,t,r.DEFAULT_X,r.DEFAULT_Y,r.DEFAULT_WIDTH,r.DEFAULT_HEIGHT);var f=this,o,e;f.typeName="Slicer";i&&(o=i._getSheet(),f.owner(o),e=o._slicerCollection.getSlicerData(i.tableName()));e||(e=i.getSlicerData());f._slicerData=e;f._columnName=u;f._tableItemSlicers=[];f._sourceName=f._columnName;f._nameInFormula="Slicer_"+f._columnName;f._captionName=f._columnName;f._columnCount=r.DEFAULT_COLUMN_COUNT;f._itemHeight=r.DEFAULT_ITEM_HEIGHT;f._showHeader=!0;f._sortState=1;f._disableResizingAndMoving=!1;f._showNoDataItems=!0;f._showNoDataItemsInLast=!0;f._visuallyNoDataItems=!0;f._style=h.light1();f.dynamicSize(!1);f.dynamicMove(!1)}return __extends(r,n),r.prototype.name=function(t){var i=this,r;if(arguments.length===0)return n.prototype.name.call(this);else{if(t&&t!==n.prototype.name.call(this)){r=i.name();n.prototype.name.call(this,t);i.onNameChanged(r,t)}return i}},r.prototype.sourceName=function(){return this._sourceName},r.prototype.nameInFormula=function(n){var t=this;if(arguments.length===0)return t._nameInFormula;else{if(t._nameInFormula!==n){t._nameInFormula=n;t.onPropertyChanged("nameInFormula",n)}return t}},r.prototype.captionName=function(n){var t=this;if(arguments.length===0)return t._captionName;else{if(n!==t._captionName){t._captionName=n;t.onPropertyChanged("captionName",n)}return t}},r.prototype.columnCount=function(n){var t=this;if(arguments.length===0)return t._columnCount;else{if(n>0&&n!==t._columnCount){t._columnCount=n;t.onPropertyChanged("columnCount",n)}return t}},r.prototype.itemHeight=function(n){var t=this;if(arguments.length===0)return t._itemHeight;else{if(n!==t._itemHeight){t._itemHeight=n;t.onPropertyChanged("itemHeight",n)}return t}},r.prototype.showHeader=function(n){var t=this;if(arguments.length===0)return t._showHeader;else{if(n!==t._showHeader){t._showHeader=n;t.onPropertyChanged("showHeader",n)}return t}},r.prototype.sortState=function(n){var t=this;if(arguments.length===0)return t._sortState;else{if(n!==t._sortState){t._sortState=n;t.onPropertyChanged("sortState",n)}return t}},r.prototype.disableResizingAndMoving=function(n){var t=this;if(arguments.length===0)return t._disableResizingAndMoving;else{if(n!==t._disableResizingAndMoving){t._disableResizingAndMoving=n;t.allowMove(!n);t.allowResize(!n);t.onPropertyChanged("disableResizingAndMoving",n)}return t}},r.prototype.showNoDataItems=function(n){var t=this;if(arguments.length===0)return t._showNoDataItems;else{if(n!==t._showNoDataItems){t._showNoDataItems=n;t.onPropertyChanged("showNoDataItems",n)}return t}},r.prototype.showNoDataItemsInLast=function(n){var t=this;if(arguments.length===0)return t._showNoDataItemsInLast;else{if(n!==t._showNoDataItemsInLast){t._showNoDataItemsInLast=n;t.onPropertyChanged("showNoDataItemsInLast",n)}return t}},r.prototype.visuallyNoDataItems=function(n){var t=this;if(arguments.length===0)return t._visuallyNoDataItems;else{if(n!==t._visuallyNoDataItems){t._visuallyNoDataItems=n;t.onPropertyChanged("visuallyNoDataItems",n)}return t}},r.prototype.style=function(n){var t=this;if(arguments.length===0)return t._style;else{if(t._style!==n&&n!==null){t._style=n;t.onPropertyChanged("style",n)}return t}},r.prototype.isSelected=function(t){var i=this;if(arguments.length===0)return n.prototype.isSelected.call(this);else{if(t!==n.prototype.isSelected.call(this)){n.prototype.isSelected.call(this,t);i.onPropertyChanged("isSelected",t)}return i}},r.prototype.isVisible=function(){return this.callBaseClassProperty("isVisible",arguments)},r.prototype.Content=function(){return this.callBaseClassProperty("Content",arguments)},r.prototype.startRow=function(){return this.callBaseClassProperty("startRow",arguments)},r.prototype.startRowOffset=function(){return this.callBaseClassProperty("startRowOffset",arguments)},r.prototype.startColumn=function(){return this.callBaseClassProperty("startColumn",arguments)},r.prototype.startColumnOffset=function(){return this.callBaseClassProperty("startColumnOffset",arguments)},r.prototype.endRow=function(){return this.callBaseClassProperty("endRow",arguments)},r.prototype.endRowOffset=function(){return this.callBaseClassProperty("endRowOffset",arguments)},r.prototype.endColumn=function(){return this.callBaseClassProperty("endColumn",arguments)},r.prototype.endColumnOffset=function(){return this.callBaseClassProperty("endColumnOffset",arguments)},r.prototype.callBaseClassProperty=function(n,i){return t.CustomFloatingObject.prototype[n].apply(this,i)},r.prototype.onPropertyChanged=function(n,t){for(var i,f=this,u=f._tableItemSlicers||[],r=0,e=u.length;r<e;r++)u[r][n]&&(n==="style"?u[r][n](t.toJSONInternal()):u[r][n](t));i=f.owner();i&&i.triggerSlicerChanged({sheet:i,sheetName:i?i._name:"",slicer:f,propertyName:n})},r.prototype.onNameChanged=function(n,i){var u=this._slicerData.getSheet(),r=u._slicerCollection;t.ArrayHelper.contains(r.getSlicers(),this)&&r.updateSlicerSet(n,i)},r.prototype.cloneContent=function(){var n=this,i=n.owner(),t=new l(n.name());return t.setData(n._slicerData,n._columnName),t.width(n.width()).height(n.height()).captionName(n._captionName).columnCount(n._columnCount).itemHeight(n._itemHeight).showHeader(n._showHeader).sortState(n._sortState).isLocked(n.isLocked()).disableResizingAndMoving(n._disableResizingAndMoving).showNoDataItems(n._showNoDataItems).showNoDataItemsInLast(n._showNoDataItemsInLast).visuallyNoDataItems(n._visuallyNoDataItems).style(n._style.toJSONInternal()).zoomFactor(i._zoomFactor).isSelected(n.isSelected()).slicer(n),t.sheet()!==i&&t.sheet(i),n._tableItemSlicers.push(t),t.getDOMElement()},r.prototype.refresh=function(n){for(var r=this,i=r._tableItemSlicers||[],t=0,u=i.length;t<u;t++)i[t].refresh(n)},r.prototype.refreshContent=function(n){var t=this;t.refresh(t.owner()._zoomFactor)},r.prototype.clone=function(n){var t=this,i;return!t.owner()&&n&&t.owner(n),i=new r(t.name(),t.getTable(),t.columnName()),i.owner(t.owner()),i.fromJSON(t.toJSON(),!1,t._slicerData),i.name(t.name()),i},r.prototype.getSlicerData=function(){return this._slicerData},r.prototype.columnName=function(n){var t=this;return arguments.length===0?t._columnName:(n!==t._columnName&&(t._columnName=n,t._sourceName=n,t._captionName=n),t)},r.prototype.getTable=function(){return this._slicerData.getTable()},r.prototype.getTableItemSlicers=function(){return this._tableItemSlicers||[]},r.prototype.fromJSON=function(u,f,e){var v,y,p,c;if(u&&!t.GC$.isEmptyObject(u||!u.tableName||!u.columnName)){n.prototype.fromJSON.call(this,u);var s=this,l=s.owner(),a=l._slicerCollection,h=e?e:a.getSlicerData(u.tableName);h||(v=l.findTableByName(u.tableName),h=v.getSlicerData(),a.addSlicerData(h));s._slicerData=h;s._columnName=u.columnName;y=u.x!==i?u.x:r.DEFAULT_X;p=u.y!==i?u.y:r.DEFAULT_Y;s.position(new t.Point(y,p));s.width(u.width!==i?u.width:r.DEFAULT_WIDTH);s.height(u.height!==i?u.height:r.DEFAULT_HEIGHT);u.sourceName!==i&&(s._sourceName=u.sourceName);u.nameInFormula!==i&&(s._nameInFormula=u.nameInFormula);u.captionName!==i&&(s._captionName=u.captionName);u.columnCount!==i&&(s._columnCount=u.columnCount);u.itemHeight!==i&&(s._itemHeight=u.itemHeight);u.showHeader!==i&&(s._showHeader=u.showHeader);u.sortState!==i&&(s._sortState=u.sortState);u.disableResizingAndMoving!==i&&(s._disableResizingAndMoving=u.disableResizingAndMoving);u.showNoDataItems!==i&&(s._showNoDataItems=u.showNoDataItems);u.visuallyNoDataItems!==i&&(s._visuallyNoDataItems=u.visuallyNoDataItems);u.showNoDataItemsInLast!==i&&(s._showNoDataItemsInLast=u.showNoDataItemsInLast);u.style!==i&&(c=new o,c.fromJSON(u.style),s._style=c)}},r.prototype.toJSON=function(){var n=this,r={name:n.name(),x:n.position().x,y:n.position().y,width:n.width(),height:n.height(),sourceName:n._sourceName,nameInFormula:n._nameInFormula,captionName:n._captionName,columnCount:n._columnCount,itemHeight:n._itemHeight,showHeader:n._showHeader,sortState:n._sortState,disableResizingAndMoving:n._disableResizingAndMoving,showNoDataItems:n._showNoDataItems,visuallyNoDataItems:n._visuallyNoDataItems,showNoDataItemsInLast:n._showNoDataItemsInLast,style:n._style?n._style.toJSON():f,dynamicMove:n.dynamicMove(),dynamicSize:n.dynamicSize(),isLocked:n.isLocked(),fixedPosition:n.fixedPosition(),tableName:n._slicerData.getTable().tableName(),columnName:n._columnName},u={},t,i;for(t in r)i=r[t],n.isDefaultValue(t,i)||(u[t]=i);return u},r.prototype.isDefaultValue=function(n,t){switch(n){case"x":return t===r.DEFAULT_X;case"y":return t===r.DEFAULT_Y;case"width":return t===r.DEFAULT_WIDTH;case"height":return t===r.DEFAULT_HEIGHT;case"columnCount":return t===r.DEFAULT_COLUMN_COUNT;case"itemHeight":return t===r.DEFAULT_ITEM_HEIGHT;case"sortState":return t===1;case"disableResizingAndMoving":return t===!1;case"showHeader":case"showNoDataItems":case"visuallyNoDataItems":case"showNoDataItemsInLast":case"isLocked":return t===!0;case"style":return t&&t.name==="SlicerStyleLight1";case"dynamicMove":case"dynamicSize":case"fixedPosition":return t===!1;default:return!1}},r.DEFAULT_X=100,r.DEFAULT_Y=100,r.DEFAULT_WIDTH=192,r.DEFAULT_HEIGHT=250,r.DEFAULT_COLUMN_COUNT=1,r.DEFAULT_ITEM_HEIGHT=21,r}(t.CustomFloatingObject);t.Slicer=a})(n.Sheets||(n.Sheets={}));var t=n.Sheets}(GcSpread||(GcSpread={}))